@wildo-ai/saas-workers-node-lib 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/runtime/services/define-worker-init.d.ts +4 -0
- package/dist/esm/runtime/services/define-worker-init.d.ts.map +1 -1
- package/dist/esm/runtime/services/define-worker-init.js +1 -0
- package/dist/esm/runtime/services/define-worker-init.js.map +1 -1
- package/dist/esm/runtime/services/start-worker-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-worker-application.backend.service.js +7 -1
- package/dist/esm/runtime/services/start-worker-application.backend.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -8
- package/src/runtime/services/__tests__/start-worker-application.backend.service.test.ts +4 -0
- package/src/runtime/services/define-worker-init.ts +4 -0
- package/src/runtime/services/start-worker-application.backend.service.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildo-ai/saas-workers-node-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Node worker runtime host boundary for Wildo SaaS applications",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Wildo AI",
|
|
@@ -30,18 +30,17 @@
|
|
|
30
30
|
"test:watch": "vitest"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"
|
|
33
|
+
"@wildo-ai/platform-config-lib": "1.1.6",
|
|
34
|
+
"@wildo-ai/platform-core-shared": "1.1.6",
|
|
35
|
+
"@wildo-ai/saas-backend-lib": "1.1.6",
|
|
36
|
+
"@wildo-ai/saas-models": "1.1.6",
|
|
34
37
|
"express": "^5.1.0",
|
|
35
38
|
"helmet": "^8.1.0",
|
|
36
39
|
"jsonwebtoken": "^9.0.2",
|
|
37
|
-
"
|
|
38
|
-
"@wildo-ai/saas-backend-lib": "1.1.4",
|
|
39
|
-
"@wildo-ai/platform-config-lib": "1.1.4",
|
|
40
|
-
"@wildo-ai/platform-core-shared": "1.1.4"
|
|
40
|
+
"reflect-metadata": "0.2.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"inversify": "^8.1.0"
|
|
44
|
-
"reflect-metadata": "^0.2.2"
|
|
43
|
+
"inversify": "^8.1.0"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@types/node": "^24.0.15",
|
|
@@ -91,6 +91,7 @@ function instantiate() {
|
|
|
91
91
|
const bootstrapClient = {
|
|
92
92
|
initialize: vi.fn(),
|
|
93
93
|
getBootstrap: vi.fn().mockResolvedValue(createBootstrapResponse()),
|
|
94
|
+
getBootstrapAtStartup: vi.fn().mockResolvedValue(createBootstrapResponse()),
|
|
94
95
|
} as unknown as WildoWorkerBootstrapClientService;
|
|
95
96
|
const workerHttpServer = {
|
|
96
97
|
initialize: vi.fn().mockResolvedValue(undefined),
|
|
@@ -142,6 +143,9 @@ describe('StartWorkerApplicationBackendService', () => {
|
|
|
142
143
|
}),
|
|
143
144
|
});
|
|
144
145
|
|
|
146
|
+
// Startup takes the read that waits out an apps-manager restart; the plain read is the refresh loop's.
|
|
147
|
+
expect(bootstrapClient.getBootstrapAtStartup).toHaveBeenCalledTimes(1);
|
|
148
|
+
expect(bootstrapClient.getBootstrap).not.toHaveBeenCalled();
|
|
145
149
|
expect(bootstrapClient.initialize).toHaveBeenCalledWith({
|
|
146
150
|
appsManagerBaseUrl: 'https://apps-manager.example.com',
|
|
147
151
|
applicationId: 'app-1',
|
|
@@ -19,6 +19,8 @@ export interface WorkerProviderRuntimeArtifact {
|
|
|
19
19
|
* which would assert, across a package boundary, the very thing nobody checked.
|
|
20
20
|
*/
|
|
21
21
|
providerRuntimeImports?: ProviderRuntimeArtifact['providerRuntimeImports'];
|
|
22
|
+
/** Mirrored for the same reason: the projection narrows and forwards it (#1672). */
|
|
23
|
+
providerRuntimeAugmentations?: ProviderRuntimeArtifact['providerRuntimeAugmentations'];
|
|
22
24
|
providerGraphDigest?: ProviderRuntimeArtifact['providerGraphDigest'];
|
|
23
25
|
lockfileSectionDigest?: ProviderRuntimeArtifact['lockfileSectionDigest'];
|
|
24
26
|
artifactKind: 'nodeWorkers';
|
|
@@ -45,6 +47,7 @@ export interface WorkerProviderRuntimeArtifact {
|
|
|
45
47
|
* services into the worker boundary and defeat the language-pluggable
|
|
46
48
|
* isolation the worker kind exists to provide.
|
|
47
49
|
*/
|
|
50
|
+
/** @wildo_source:part:start workers.node.worker-init-contract facet:layer:backend facet:family:worker facet:audience:app-developer */
|
|
48
51
|
export interface WorkerInitializationConfig {
|
|
49
52
|
workerName: string;
|
|
50
53
|
serviceKind: BackgroundRuntimeType.WORKER;
|
|
@@ -90,3 +93,4 @@ export function defineWorkerInit(
|
|
|
90
93
|
): WorkerInitializationConfig {
|
|
91
94
|
return config;
|
|
92
95
|
}
|
|
96
|
+
/** @wildo_source:part:end workers.node.worker-init-contract */
|
|
@@ -115,7 +115,8 @@ export class StartWorkerApplicationBackendService {
|
|
|
115
115
|
platformApplicationPrimarySecret,
|
|
116
116
|
refreshIntervalMs: config.publicKeyRefreshIntervalMs,
|
|
117
117
|
});
|
|
118
|
-
|
|
118
|
+
// The startup read tolerates apps-manager restarting; the refresh loop below keeps a single attempt.
|
|
119
|
+
this.bootstrapResponse = await this.workerBootstrapClient.getBootstrapAtStartup();
|
|
119
120
|
this.scheduleRefresh(config.publicKeyRefreshIntervalMs);
|
|
120
121
|
|
|
121
122
|
await this.workerHttpServer.initialize({
|
|
@@ -328,6 +329,10 @@ export class StartWorkerApplicationBackendService {
|
|
|
328
329
|
providerRuntime.providerRuntimeImports ?? {},
|
|
329
330
|
).filter(([providerRef]) => projectedProviderRefs.includes(providerRef)),
|
|
330
331
|
);
|
|
332
|
+
// Narrowed with the refs as well (#1672): a host applies augmentations only to providers it declares, and a
|
|
333
|
+
// sibling's opt-in must not load a package into this process.
|
|
334
|
+
const projectedAugmentations = Object.entries(providerRuntime.providerRuntimeAugmentations ?? {})
|
|
335
|
+
.filter(([providerRef]) => projectedProviderRefs.includes(providerRef));
|
|
331
336
|
|
|
332
337
|
return {
|
|
333
338
|
__AUTOGENERATED__: providerRuntime.__AUTOGENERATED__,
|
|
@@ -336,6 +341,7 @@ export class StartWorkerApplicationBackendService {
|
|
|
336
341
|
sourceDigest: providerRuntime.sourceDigest,
|
|
337
342
|
providerRefs: projectedProviderRefs,
|
|
338
343
|
providerRuntimeImports: projectedProviderRuntimeImports,
|
|
344
|
+
...(projectedAugmentations.length === 0 ? {} : { providerRuntimeAugmentations: Object.fromEntries(projectedAugmentations) }),
|
|
339
345
|
providerGraphDigest: providerRuntime.providerGraphDigest,
|
|
340
346
|
lockfileSectionDigest: providerRuntime.lockfileSectionDigest,
|
|
341
347
|
artifactKind: 'backend',
|