Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nfkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nfkit
Commits
c23ef591
You need to sign in or sign up before continuing.
Commit
c23ef591
authored
Feb 17, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix createEntryFromRecord async
parent
e7283a63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
15 deletions
+14
-15
.gitignore
.gitignore
+1
-0
.npmignore
.npmignore
+3
-1
src/app-context/app-context.ts
src/app-context/app-context.ts
+10
-14
No files found.
.gitignore
View file @
c23ef591
...
@@ -12,6 +12,7 @@ lerna-debug.log*
...
@@ -12,6 +12,7 @@ lerna-debug.log*
# OS
# OS
.DS_Store
.DS_Store
._*
# Tests
# Tests
/coverage
/coverage
...
...
.npmignore
View file @
c23ef591
...
@@ -10,4 +10,6 @@ Dockerfile
...
@@ -10,4 +10,6 @@ Dockerfile
/coverage
/coverage
/tests
/tests
/dist/tests
/dist/tests
/build.js
/build.js
\ No newline at end of file
.DS_Store
._*
src/app-context/app-context.ts
View file @
c23ef591
import
{
AnyClass
,
Empty
}
from
'
../types
'
;
import
{
AnyClass
,
Awaitable
,
Empty
}
from
'
../types
'
;
import
{
import
{
AppContext
,
AppContext
,
AppServiceClass
,
AppServiceClass
,
...
@@ -60,7 +60,7 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
...
@@ -60,7 +60,7 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
return
undefined
;
return
undefined
;
}
}
private
createEntryFromRecord
(
record
:
ProvideRecord
):
LoadEntry
{
private
createEntryFromRecord
(
record
:
ProvideRecord
):
Awaitable
<
LoadEntry
>
{
const
existing
=
this
.
createdEntries
?.
get
(
record
);
const
existing
=
this
.
createdEntries
?.
get
(
record
);
if
(
existing
)
{
if
(
existing
)
{
return
existing
;
return
existing
;
...
@@ -82,6 +82,12 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
...
@@ -82,6 +82,12 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
this.createdEntries?.set(record, entry);
this.createdEntries?.set(record, entry);
this.registry.set(record.classRef, entry);
this.registry.set(record.classRef, entry);
this.startingEntries?.push(entry);
this.startingEntries?.push(entry);
if (entry.inst?.then && typeof entry.inst.then === 'function') {
return entry.inst.then((resolvedInst: any) => {
entry.inst = resolvedInst;
return entry;
});
}
return entry;
return entry;
} finally {
} finally {
this.loadingRecords.delete(record);
this.loadingRecords.delete(record);
...
@@ -217,15 +223,12 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
...
@@ -217,15 +223,12 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
return entry.inst as any;
return entry.inst as any;
}
}
/**
* @deprecated Use get() instead. getAsync() is no longer needed as all services are loaded synchronously during start().
*/
async getAsync<R>(
async getAsync<R>(
cls:
cls:
| AppServiceClass<Cur, Req, any, R>
| AppServiceClass<Cur, Req, any, R>
| (() => AppServiceClass<Cur, Req, any, R>),
| (() => AppServiceClass<Cur, Req, any, R>),
): Promise<R> {
): Promise<R> {
return this.get(cls);
return
await
this.get(cls);
}
}
use<const Ctxes extends AppContext<any, any>[]>(
use<const Ctxes extends AppContext<any, any>[]>(
...
@@ -289,14 +292,7 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
...
@@ -289,14 +292,7 @@ export class AppContextCore<Cur = Empty, Req = Empty> {
if (preloadedKeys.has(record.classRef)) {
if (preloadedKeys.has(record.classRef)) {
continue;
continue;
}
}
this.createEntryFromRecord(record);
await this.createEntryFromRecord(record);
}
// Resolve all promises created in this start().
for (const entry of startedEntries) {
if (entry.inst && typeof entry.inst.then === 'function') {
entry.inst = await entry.inst;
}
}
}
// Init only instances created in this start().
// Init only instances created in this start().
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment