@tbox.cn/app-toolkit 0.5.0 → 0.7.0
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/README.md +2 -2
- package/dist/index.d.ts +101 -20
- package/dist/index.js +9 -9
- package/package.json +1 -1
- package/src/assembly/walk-manifests.ts +28 -12
- package/src/core/errors.ts +12 -2
- package/src/core/module-schema.ts +3 -0
- package/src/dto.ts +41 -5
- package/src/factory.ts +48 -28
- package/src/index.ts +4 -2
- package/src/integrations/write.ts +4 -0
- package/src/views/context.ts +4 -2
- package/src/views/integration-schemas.ts +17 -3
- package/src/views/modules.ts +66 -4
- package/src/views/service-resolutions.ts +113 -25
- package/tests/dev-manifest-catalog.test.ts +39 -1
- package/tests/module-resources.test.ts +148 -0
- package/tests/module-schema.test.ts +14 -0
- package/tests/views.test.ts +437 -120
- package/tests/write-core.test.ts +34 -0
package/tests/write-core.test.ts
CHANGED
|
@@ -368,3 +368,37 @@ describe('写核心管线(FX-1c)', () => {
|
|
|
368
368
|
expect(err.fields).toEqual(['a.b']);
|
|
369
369
|
});
|
|
370
370
|
});
|
|
371
|
+
|
|
372
|
+
describe('孤儿凭据写后对账(PUT 路径追平——finalize 单点)', () => {
|
|
373
|
+
let h: Harness;
|
|
374
|
+
beforeEach(() => {
|
|
375
|
+
h = harness();
|
|
376
|
+
});
|
|
377
|
+
afterEach(() => {
|
|
378
|
+
h.app.dispose();
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('P1 PUT 替换弃 credentialRef → ORPHANED_CREDENTIAL warning(message 含被弃 stem)', async () => {
|
|
382
|
+
writeAppFile(h.app.appDir, 'config/credentials/wd-parking.json', JSON.stringify({ type: 'wanda-c', k: 'v' }));
|
|
383
|
+
await h.tk.writeServiceIntegration('parking.query', {
|
|
384
|
+
provider: 'wanda', implementation: 'w@1', credentialRef: 'secret://wd-parking',
|
|
385
|
+
} as never);
|
|
386
|
+
const r = await h.tk.writeServiceIntegration('parking.query', {} as never);
|
|
387
|
+
expect(r.written).toBe(true);
|
|
388
|
+
const orphan = r.issues.find((i) => i.code === 'ORPHANED_CREDENTIAL');
|
|
389
|
+
expect(orphan).toBeTruthy();
|
|
390
|
+
expect(orphan?.message).toContain('wd-parking');
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
it('P2 真写报全量孤儿 / dryRun 不报 / no-diff 不报', async () => {
|
|
394
|
+
writeAppFile(h.app.appDir, 'config/credentials/stray.json', JSON.stringify({ type: 'x', k: 'v' }));
|
|
395
|
+
const node = { provider: 'wanda', implementation: 'w@1' } as never;
|
|
396
|
+
const dry = await h.tk.writeServiceIntegration('parking.query', node, { dryRun: true });
|
|
397
|
+
expect(dry.issues.some((i) => i.code === 'ORPHANED_CREDENTIAL')).toBe(false);
|
|
398
|
+
const real = await h.tk.writeServiceIntegration('parking.query', node);
|
|
399
|
+
expect(real.issues.some((i) => i.code === 'ORPHANED_CREDENTIAL' && i.message.includes('stray'))).toBe(true);
|
|
400
|
+
const nodiff = await h.tk.writeServiceIntegration('parking.query', node);
|
|
401
|
+
expect(nodiff.written).toBe(false);
|
|
402
|
+
expect(nodiff.issues.some((i) => i.code === 'ORPHANED_CREDENTIAL')).toBe(false);
|
|
403
|
+
});
|
|
404
|
+
});
|