declastruct 1.3.0 → 1.4.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.
Files changed (73) hide show
  1. package/dist/contract/cli/apply.js +4 -3
  2. package/dist/contract/cli/apply.js.map +1 -1
  3. package/dist/contract/cli/plan.js +4 -3
  4. package/dist/contract/cli/plan.js.map +1 -1
  5. package/dist/domain.objects/ContextDeclastruct.d.ts +1 -1
  6. package/dist/domain.objects/DeclastructChange.d.ts +1 -1
  7. package/dist/domain.objects/DeclastructChange.js.map +1 -1
  8. package/dist/domain.objects/DeclastructDao.d.ts +2 -2
  9. package/dist/domain.objects/DeclastructPlan.d.ts +2 -2
  10. package/dist/domain.objects/DeclastructProvider.d.ts +1 -1
  11. package/dist/domain.operations/apply/applyChanges.d.ts +6 -6
  12. package/dist/domain.operations/apply/applyChanges.js +24 -14
  13. package/dist/domain.operations/apply/applyChanges.js.map +1 -1
  14. package/dist/domain.operations/plan/computeChange.js +2 -28
  15. package/dist/domain.operations/plan/computeChange.js.map +1 -1
  16. package/dist/domain.operations/plan/getDisplayableDiff.d.ts +10 -0
  17. package/dist/domain.operations/plan/getDisplayableDiff.js +40 -0
  18. package/dist/domain.operations/plan/getDisplayableDiff.js.map +1 -0
  19. package/dist/domain.operations/plan/planChanges.d.ts +4 -4
  20. package/dist/domain.operations/plan/planChanges.js +40 -23
  21. package/dist/domain.operations/plan/planChanges.js.map +1 -1
  22. package/dist/infra/asIsoTimestamp.d.ts +1 -1
  23. package/dist/infra/colorizeAction.d.ts +7 -0
  24. package/dist/infra/colorizeAction.js +31 -0
  25. package/dist/infra/colorizeAction.js.map +1 -0
  26. package/dist/infra/withSpinner.d.ts +12 -0
  27. package/dist/infra/withSpinner.js +90 -0
  28. package/dist/infra/withSpinner.js.map +1 -0
  29. package/license.md +21 -0
  30. package/package.json +20 -9
  31. package/readme.md +52 -32
  32. package/dist/.test/assets/providers/demo.provider.d.ts +0 -32
  33. package/dist/.test/assets/providers/demo.provider.js +0 -101
  34. package/dist/.test/assets/providers/demo.provider.js.map +0 -1
  35. package/dist/contract/cli/apply.integration.test.d.ts +0 -1
  36. package/dist/contract/cli/apply.integration.test.js +0 -215
  37. package/dist/contract/cli/apply.integration.test.js.map +0 -1
  38. package/dist/contract/cli/plan.integration.test.d.ts +0 -1
  39. package/dist/contract/cli/plan.integration.test.js +0 -142
  40. package/dist/contract/cli/plan.integration.test.js.map +0 -1
  41. package/dist/domain.objects/ContextDeclastruct.test.d.ts +0 -1
  42. package/dist/domain.objects/ContextDeclastruct.test.js +0 -41
  43. package/dist/domain.objects/ContextDeclastruct.test.js.map +0 -1
  44. package/dist/domain.objects/DeclastructChange.test.d.ts +0 -1
  45. package/dist/domain.objects/DeclastructChange.test.js +0 -59
  46. package/dist/domain.objects/DeclastructChange.test.js.map +0 -1
  47. package/dist/domain.objects/DeclastructDao.test.d.ts +0 -1
  48. package/dist/domain.objects/DeclastructDao.test.js +0 -78
  49. package/dist/domain.objects/DeclastructDao.test.js.map +0 -1
  50. package/dist/domain.objects/DeclastructPlan.test.d.ts +0 -1
  51. package/dist/domain.objects/DeclastructPlan.test.js +0 -31
  52. package/dist/domain.objects/DeclastructPlan.test.js.map +0 -1
  53. package/dist/domain.objects/DeclastructProvider.test.d.ts +0 -1
  54. package/dist/domain.objects/DeclastructProvider.test.js +0 -80
  55. package/dist/domain.objects/DeclastructProvider.test.js.map +0 -1
  56. package/dist/domain.objects/IsoTimestamp.test.d.ts +0 -1
  57. package/dist/domain.objects/IsoTimestamp.test.js +0 -10
  58. package/dist/domain.objects/IsoTimestamp.test.js.map +0 -1
  59. package/dist/domain.operations/apply/applyChange.test.d.ts +0 -1
  60. package/dist/domain.operations/apply/applyChange.test.js +0 -241
  61. package/dist/domain.operations/apply/applyChange.test.js.map +0 -1
  62. package/dist/domain.operations/apply/applyChanges.integration.test.d.ts +0 -1
  63. package/dist/domain.operations/apply/applyChanges.integration.test.js +0 -291
  64. package/dist/domain.operations/apply/applyChanges.integration.test.js.map +0 -1
  65. package/dist/domain.operations/plan/computeChange.test.d.ts +0 -1
  66. package/dist/domain.operations/plan/computeChange.test.js +0 -153
  67. package/dist/domain.operations/plan/computeChange.test.js.map +0 -1
  68. package/dist/domain.operations/plan/getDaoByResource.test.d.ts +0 -1
  69. package/dist/domain.operations/plan/getDaoByResource.test.js +0 -101
  70. package/dist/domain.operations/plan/getDaoByResource.test.js.map +0 -1
  71. package/dist/domain.operations/plan/planChanges.integration.test.d.ts +0 -1
  72. package/dist/domain.operations/plan/planChanges.integration.test.js +0 -200
  73. package/dist/domain.operations/plan/planChanges.integration.test.js.map +0 -1
@@ -1,215 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs_1 = require("fs");
4
- const promises_1 = require("fs/promises");
5
- const path_1 = require("path");
6
- const uuid_fns_1 = require("uuid-fns");
7
- const DeclastructPlan_1 = require("../../domain.objects/DeclastructPlan");
8
- const apply_1 = require("./apply");
9
- const plan_1 = require("./plan");
10
- /**
11
- * .what = creates an isolated wish file for a test
12
- * .why = ensures stable resources within a single test while maintaining test isolation
13
- */
14
- const createIsolatedWishFile = async () => {
15
- const tempDir = (0, path_1.resolve)(process.cwd(), '.test/.temp');
16
- const wishPath = (0, path_1.resolve)(tempDir, `wish-${(0, uuid_fns_1.getUuid)()}.ts`);
17
- // ensure temp directory exists
18
- if (!(0, fs_1.existsSync)(tempDir)) {
19
- await (0, promises_1.mkdir)(tempDir, { recursive: true });
20
- }
21
- const exid1 = (0, uuid_fns_1.getUuid)();
22
- const exid2 = (0, uuid_fns_1.getUuid)();
23
- const wishContent = `
24
- import { DomainEntity } from 'domain-objects';
25
- import { DeclastructProvider } from '../../src/domain.objects/DeclastructProvider';
26
- import { DemoResource, demoProvider } from '../../src/.test/assets/providers/demo.provider';
27
-
28
- export const getResources = async (): Promise<DomainEntity<any>[]> => {
29
- return [
30
- DemoResource.as({ exid: '${exid1}', name: 'First Resource' }),
31
- DemoResource.as({ exid: '${exid2}', name: 'Second Resource' }),
32
- ];
33
- };
34
-
35
- export const getProviders = async (): Promise<DeclastructProvider<any, any>[]> => {
36
- return [demoProvider];
37
- };
38
- `;
39
- await (0, promises_1.writeFile)(wishPath, wishContent, 'utf-8');
40
- return wishPath;
41
- };
42
- describe('executeApplyCommand', () => {
43
- const planFilePath = (0, path_1.resolve)(process.cwd(), 'src/.test/assets/apply.test.json');
44
- afterEach(async () => {
45
- // cleanup plan file after each test
46
- if ((0, fs_1.existsSync)(planFilePath)) {
47
- await (0, promises_1.rm)(planFilePath);
48
- }
49
- });
50
- it('should apply changes from a valid plan file', async () => {
51
- // create isolated wish file for this test
52
- const wishFilePath = await createIsolatedWishFile();
53
- // first generate a plan
54
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
55
- // verify plan was created
56
- expect((0, fs_1.existsSync)(planFilePath)).toBe(true);
57
- // now apply the plan
58
- await (0, apply_1.executeApplyCommand)({ planFilePath });
59
- // verify plan still exists after apply
60
- expect((0, fs_1.existsSync)(planFilePath)).toBe(true);
61
- // read plan to verify structure
62
- const planJson = await (0, promises_1.readFile)(planFilePath, 'utf-8');
63
- const plan = new DeclastructPlan_1.DeclastructPlan(JSON.parse(planJson));
64
- // verify plan has changes
65
- expect(plan.changes.length).toBe(2);
66
- });
67
- it('should throw when plan file does not exist', async () => {
68
- const nonexistentPlanPath = (0, path_1.resolve)(__dirname, 'nonexistent-plan.json');
69
- await expect((0, apply_1.executeApplyCommand)({ planFilePath: nonexistentPlanPath })).rejects.toThrow('Plan file not found');
70
- });
71
- it('should throw when wish file referenced in plan does not exist', async () => {
72
- // create plan with invalid wish path
73
- const invalidPlan = {
74
- hash: 'test-hash',
75
- createdAt: new Date().toISOString(),
76
- wish: { uri: '/nonexistent/wish.ts' },
77
- changes: [],
78
- };
79
- await (0, promises_1.writeFile)(planFilePath, JSON.stringify(invalidPlan, null, 2));
80
- await expect((0, apply_1.executeApplyCommand)({ planFilePath })).rejects.toThrow();
81
- });
82
- it('should throw when wish file does not export getResources', async () => {
83
- const badWishPath = (0, path_1.resolve)(process.cwd(), 'src/.test/assets/bad-apply-wish.ts');
84
- // create bad wish file
85
- await (0, promises_1.writeFile)(badWishPath, 'export const foo = "bar";', 'utf-8');
86
- // create plan pointing to bad wish
87
- const invalidPlan = {
88
- hash: 'test-hash',
89
- createdAt: new Date().toISOString(),
90
- wish: { uri: badWishPath },
91
- changes: [],
92
- };
93
- await (0, promises_1.writeFile)(planFilePath, JSON.stringify(invalidPlan, null, 2));
94
- await expect((0, apply_1.executeApplyCommand)({ planFilePath })).rejects.toThrow('Wish file must export getResources() function');
95
- // cleanup
96
- await (0, promises_1.rm)(badWishPath);
97
- });
98
- it('should successfully apply multiple CREATE actions', async () => {
99
- // create isolated wish file for this test
100
- const wishFilePath = await createIsolatedWishFile();
101
- // generate plan
102
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
103
- // spy on console to verify logging
104
- const logSpy = jest.spyOn(console, 'info');
105
- // apply changes
106
- await (0, apply_1.executeApplyCommand)({ planFilePath });
107
- // verify success logging occurred
108
- const logCalls = logSpy.mock.calls.map((call) => call.join(' '));
109
- const successLogs = logCalls.filter((log) => log.includes('✔'));
110
- // should have logged success for each CREATE action
111
- expect(successLogs.length).toBeGreaterThan(0);
112
- // cleanup spy
113
- logSpy.mockRestore();
114
- });
115
- it('should handle KEEP actions without errors', async () => {
116
- // create isolated wish file for this test
117
- const wishFilePath = await createIsolatedWishFile();
118
- // generate initial plan
119
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
120
- // apply changes
121
- await (0, apply_1.executeApplyCommand)({ planFilePath });
122
- // generate new plan (should now show KEEP actions)
123
- await (0, promises_1.rm)(planFilePath);
124
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
125
- // read new plan
126
- const planJson = await (0, promises_1.readFile)(planFilePath, 'utf-8');
127
- const plan = new DeclastructPlan_1.DeclastructPlan(JSON.parse(planJson));
128
- // verify we have KEEP actions
129
- const keepActions = plan.changes.filter((c) => c.action === 'KEEP');
130
- expect(keepActions.length).toBe(2);
131
- // apply again (should handle KEEP without errors)
132
- await (0, apply_1.executeApplyCommand)({ planFilePath });
133
- });
134
- it('should throw when plan is stale', async () => {
135
- // create isolated wish file for this test
136
- const wishFilePath = await createIsolatedWishFile();
137
- // generate initial plan
138
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
139
- // modify the plan's hash to make it stale
140
- const planJson = await (0, promises_1.readFile)(planFilePath, 'utf-8');
141
- const plan = JSON.parse(planJson);
142
- plan.hash = 'stale-hash-that-wont-match';
143
- await (0, promises_1.writeFile)(planFilePath, JSON.stringify(plan, null, 2));
144
- // applying stale plan should throw
145
- await expect((0, apply_1.executeApplyCommand)({ planFilePath })).rejects.toThrow('plan is stale');
146
- });
147
- describe('yolo mode (--plan yolo)', () => {
148
- it('should apply changes directly from wish file without plan file', async () => {
149
- // create isolated wish file for this test
150
- const wishFilePath = await createIsolatedWishFile();
151
- // spy on console to verify yolo logging
152
- const logSpy = jest.spyOn(console, 'info');
153
- // apply in yolo mode (no plan file needed)
154
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
155
- // verify yolo mode logging occurred
156
- const logCalls = logSpy.mock.calls.map((call) => call.join(' '));
157
- expect(logCalls.some((log) => log.includes('yolo'))).toBe(true);
158
- expect(logCalls.some((log) => log.includes('🤙'))).toBe(true);
159
- // cleanup spy
160
- logSpy.mockRestore();
161
- });
162
- it('should throw when --wish is not provided with --plan yolo', async () => {
163
- await expect((0, apply_1.executeApplyCommand)({ planFilePath: 'yolo' })).rejects.toThrow('--wish required when --plan yolo');
164
- });
165
- it('should throw when wish file does not exist in yolo mode', async () => {
166
- await expect((0, apply_1.executeApplyCommand)({
167
- planFilePath: 'yolo',
168
- wishFilePath: '/nonexistent/wish.ts',
169
- })).rejects.toThrow('Wish file not found');
170
- });
171
- it('should skip staleness validation in yolo mode', async () => {
172
- // create isolated wish file for this test
173
- const wishFilePath = await createIsolatedWishFile();
174
- // first apply to create resources
175
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
176
- // apply again - should succeed without staleness check
177
- // (in standard mode with stale plan this would fail)
178
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
179
- });
180
- it('should handle CREATE actions in yolo mode', async () => {
181
- // create isolated wish file for this test
182
- const wishFilePath = await createIsolatedWishFile();
183
- // spy on console to verify CREATE logging
184
- const logSpy = jest.spyOn(console, 'info');
185
- // apply in yolo mode
186
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
187
- // verify CREATE logging occurred (plan phase + apply phase = 4 total, 2 per phase)
188
- const logCalls = logSpy.mock.calls.map((call) => call.join(' '));
189
- const createLogs = logCalls.filter((log) => log.includes('CREATE'));
190
- expect(createLogs.length).toBeGreaterThanOrEqual(2);
191
- // cleanup spy
192
- logSpy.mockRestore();
193
- });
194
- it('should handle KEEP actions in yolo mode', async () => {
195
- // create isolated wish file for this test
196
- const wishFilePath = await createIsolatedWishFile();
197
- // first apply to create resources
198
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
199
- // spy on console to verify KEEP logging
200
- const logSpy = jest.spyOn(console, 'info');
201
- // apply again - should show KEEP actions
202
- await (0, apply_1.executeApplyCommand)({ planFilePath: 'yolo', wishFilePath });
203
- // verify KEEP logging occurred (plan phase + apply phase = 4 total, 2 per phase)
204
- const logCalls = logSpy.mock.calls.map((call) => call.join(' '));
205
- const keepLogs = logCalls.filter((log) => log.includes('KEEP'));
206
- expect(keepLogs.length).toBeGreaterThanOrEqual(2);
207
- // cleanup spy
208
- logSpy.mockRestore();
209
- });
210
- });
211
- it('should throw when neither --plan nor --wish is provided', async () => {
212
- await expect((0, apply_1.executeApplyCommand)({})).rejects.toThrow('--plan required');
213
- });
214
- });
215
- //# sourceMappingURL=apply.integration.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":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AE;YACvD,0CAA0C;YAC1C,MAAM,YAAY,GAAG,MAAM,sBAAsB,EAAE,CAAC;YAEpD,kCAAkC;YAClC,MAAM,IAAA,2BAAmB,EAAC,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;YAElE,wCAAwC;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAE3C,yCAAyC;YACzC,MAAM,IAAA,2BAAmB,EAAC,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;YAElE,iFAAiF;YACjF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YAChE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAElD,cAAc;YACd,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE,MAAM,MAAM,CAAC,IAAA,2BAAmB,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs_1 = require("fs");
4
- const promises_1 = require("fs/promises");
5
- const path_1 = require("path");
6
- const uuid_fns_1 = require("uuid-fns");
7
- const DeclastructPlan_1 = require("../../domain.objects/DeclastructPlan");
8
- const plan_1 = require("./plan");
9
- /**
10
- * .what = generates unique temp directory for test run
11
- * .why = enables isolated test artifacts without cleanup
12
- */
13
- const genTempDir = async () => {
14
- const testUuid = (0, uuid_fns_1.getUuid)();
15
- const tempDir = (0, path_1.resolve)(process.cwd(), `src/.test/assets/.temp/${testUuid}`);
16
- await (0, promises_1.mkdir)(tempDir, { recursive: true });
17
- return tempDir;
18
- };
19
- describe('executePlanCommand', () => {
20
- const wishFilePath = (0, path_1.resolve)(process.cwd(), 'src/.test/assets/wish.fixture.ts');
21
- it('should generate a plan file with changes based on wish file', async () => {
22
- const tempDir = await genTempDir();
23
- const planFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
24
- // execute plan command
25
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
26
- // verify plan file was created
27
- expect((0, fs_1.existsSync)(planFilePath)).toBe(true);
28
- // read and parse plan
29
- const planJson = await (0, promises_1.readFile)(planFilePath, 'utf-8');
30
- const plan = new DeclastructPlan_1.DeclastructPlan(JSON.parse(planJson));
31
- // verify plan structure
32
- expect(plan.hash).toBeDefined();
33
- expect(plan.createdAt).toBeDefined();
34
- expect(plan.wish.uri).toBe(wishFilePath);
35
- expect(plan.changes.length).toBe(2);
36
- // verify changes are all CREATE (no remote state)
37
- plan.changes.forEach((change) => {
38
- expect(change.action).toBe('CREATE');
39
- expect(change.forResource.class).toBe('DemoResource');
40
- expect(change.state.desired).toBeDefined();
41
- expect(change.state.remote).toBeNull();
42
- });
43
- // verify slugs exist and are unique
44
- const slugs = plan.changes.map((c) => c.forResource.slug);
45
- expect(slugs.length).toBe(2);
46
- expect(slugs[0]).toBeDefined();
47
- expect(slugs[1]).toBeDefined();
48
- expect(slugs[0]).not.toBe(slugs[1]);
49
- });
50
- it('should throw when wish file does not exist', async () => {
51
- const tempDir = await genTempDir();
52
- const nonexistentWishPath = (0, path_1.resolve)(tempDir, 'nonexistent.ts');
53
- const planFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
54
- await expect((0, plan_1.executePlanCommand)({
55
- wishFilePath: nonexistentWishPath,
56
- planFilePath,
57
- })).rejects.toThrow('Wish file not found');
58
- });
59
- it('should throw when wish file does not export getResources', async () => {
60
- const tempDir = await genTempDir();
61
- const badWishPath = (0, path_1.resolve)(tempDir, 'bad-wish.ts');
62
- const planFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
63
- // create bad wish file
64
- await (0, promises_1.writeFile)(badWishPath, 'export const getProviders = async () => [];', 'utf-8');
65
- await expect((0, plan_1.executePlanCommand)({ wishFilePath: badWishPath, planFilePath })).rejects.toThrow('Wish file must export getResources() function');
66
- });
67
- it('should throw when wish file does not export getProviders', async () => {
68
- const tempDir = await genTempDir();
69
- const badWishPath = (0, path_1.resolve)(tempDir, 'bad-wish.ts');
70
- const planFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
71
- // create bad wish file
72
- await (0, promises_1.writeFile)(badWishPath, 'export const getResources = async () => [];', 'utf-8');
73
- await expect((0, plan_1.executePlanCommand)({ wishFilePath: badWishPath, planFilePath })).rejects.toThrow('Wish file must export getProviders() function');
74
- });
75
- it('should detect KEEP action when resource already exists remotely', async () => {
76
- const tempDir = await genTempDir();
77
- const planFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
78
- // first run - create resources
79
- await (0, plan_1.executePlanCommand)({ wishFilePath, planFilePath });
80
- // read first plan
81
- const firstPlanJson = await (0, promises_1.readFile)(planFilePath, 'utf-8');
82
- const firstPlan = new DeclastructPlan_1.DeclastructPlan(JSON.parse(firstPlanJson));
83
- // verify all CREATE
84
- expect(firstPlan.changes.every((c) => c.action === 'CREATE')).toBe(true);
85
- // Note: In a real integration test, we would need to actually apply the changes
86
- // to populate remote state. For now, this test just verifies the basic flow.
87
- // A more complete test would require mocking or actual provider state.
88
- });
89
- it('should pass provider context through to DAO operations', async () => {
90
- const tempDir = await genTempDir();
91
- const authWishFilePath = (0, path_1.resolve)(process.cwd(), 'src/.test/assets/wish-with-auth.fixture.ts');
92
- const authPlanFilePath = (0, path_1.resolve)(tempDir, 'plan.json');
93
- // execute plan command with auth provider
94
- await (0, plan_1.executePlanCommand)({
95
- wishFilePath: authWishFilePath,
96
- planFilePath: authPlanFilePath,
97
- });
98
- // verify plan file was created successfully
99
- expect((0, fs_1.existsSync)(authPlanFilePath)).toBe(true);
100
- // read and parse plan
101
- const planJson = await (0, promises_1.readFile)(authPlanFilePath, 'utf-8');
102
- const plan = new DeclastructPlan_1.DeclastructPlan(JSON.parse(planJson));
103
- // verify plan was generated (context was passed through)
104
- expect(plan.changes.length).toBe(2);
105
- expect(plan.changes[0]?.forResource.class).toBe('DemoAuthResource');
106
- // verify context enabled DAO operations (if this passes, context was properly passed)
107
- expect(plan.changes[0]?.state.desired).toBeDefined();
108
- });
109
- it('should throw when provider context is missing required auth token', async () => {
110
- const tempDir = await genTempDir();
111
- const badAuthWishPath = (0, path_1.resolve)(tempDir, 'bad-auth-wish.ts');
112
- const badAuthPlanPath = (0, path_1.resolve)(tempDir, 'plan.json');
113
- // create wish file with provider missing auth token
114
- await (0, promises_1.writeFile)(badAuthWishPath, `
115
- import { DomainEntity } from 'domain-objects';
116
- import { DeclastructProvider } from '${(0, path_1.resolve)(process.cwd(), 'src/domain.objects/DeclastructProvider')}';
117
- import {
118
- DemoAuthResource,
119
- genSampleDemoAuthResource,
120
- demoAuthProvider,
121
- } from '${(0, path_1.resolve)(process.cwd(), 'src/.test/assets/providers/demo-with-auth.provider')}';
122
-
123
- export const getResources = async (): Promise<DomainEntity<any>[]> => {
124
- return [genSampleDemoAuthResource({ name: 'Test' })];
125
- };
126
-
127
- export const getProviders = async (): Promise<DeclastructProvider<any, any>[]> => {
128
- // return provider with invalid context (missing demoAuthToken)
129
- return [new DeclastructProvider({
130
- ...demoAuthProvider,
131
- context: {} as any, // invalid context - missing required demoAuthToken
132
- })];
133
- };
134
- `, 'utf-8');
135
- // attempt to execute plan command
136
- await expect((0, plan_1.executePlanCommand)({
137
- wishFilePath: badAuthWishPath,
138
- planFilePath: badAuthPlanPath,
139
- })).rejects.toThrow('demoAuthToken required in context');
140
- });
141
- });
142
- //# sourceMappingURL=plan.integration.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan.integration.test.js","sourceRoot":"","sources":["../../../src/contract/cli/plan.integration.test.ts"],"names":[],"mappings":";;AAAA,2BAAgC;AAChC,0CAAyD;AACzD,+BAA+B;AAC/B,uCAAmC;AAEnC,0EAAuE;AACvE,iCAA4C;AAE5C;;;GAGG;AACH,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;IAC5B,MAAM,QAAQ,GAAG,IAAA,kBAAO,GAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,QAAQ,EAAE,CAAC,CAAC;IAC7E,MAAM,IAAA,gBAAK,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,IAAA,cAAO,EAC1B,OAAO,CAAC,GAAG,EAAE,EACb,kCAAkC,CACnC,CAAC;IAEF,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;QACnC,MAAM,YAAY,GAAG,IAAA,cAAO,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAEnD,uBAAuB;QACvB,MAAM,IAAA,yBAAkB,EAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;QAEzD,+BAA+B;QAC/B,MAAM,CAAC,IAAA,eAAU,EAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5C,sBAAsB;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAA,m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,IAAA,cAAO,EACtC,OAAO,CAAC,GAAG,EAAE,EACb,wCAAwC,CACzC;;;;;UAKG,IAAA,cAAO,EACT,OAAO,CAAC,GAAG,EAAE,EACb,oDAAoD,CACrD;;;;;;;;;;;;;OAaA,EACD,OAAO,CACR,CAAC;QAEF,kCAAkC;QAClC,MAAM,MAAM,CACV,IAAA,yBAAkB,EAAC;YACjB,YAAY,EAAE,eAAe;YAC7B,YAAY,EAAE,eAAe;SAC9B,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bottleneck_1 = __importDefault(require("bottleneck"));
7
- describe('ContextDeclastruct', () => {
8
- it('should accept single bottleneck configuration', () => {
9
- const context = {
10
- bottleneck: new bottleneck_1.default({ maxConcurrent: 5 }),
11
- };
12
- expect(context.bottleneck).toBeInstanceOf(bottleneck_1.default);
13
- });
14
- it('should accept split bottleneck configuration', () => {
15
- const context = {
16
- bottleneck: {
17
- onPlan: new bottleneck_1.default({ maxConcurrent: 10 }),
18
- onApply: new bottleneck_1.default({ maxConcurrent: 1 }),
19
- },
20
- };
21
- expect(context.bottleneck).toHaveProperty('onPlan');
22
- expect(context.bottleneck).toHaveProperty('onApply');
23
- expect(context.bottleneck.onPlan).toBeInstanceOf(bottleneck_1.default);
24
- expect(context.bottleneck.onApply).toBeInstanceOf(bottleneck_1.default);
25
- });
26
- it('should be able to intersect with ContextLogTrail', () => {
27
- // type verification
28
- const context = {
29
- bottleneck: new bottleneck_1.default({ maxConcurrent: 5 }),
30
- log: {
31
- info: () => { },
32
- warn: () => { },
33
- error: () => { },
34
- debug: () => { },
35
- },
36
- };
37
- expect(context.bottleneck).toBeDefined();
38
- expect(context.log).toBeDefined();
39
- });
40
- });
41
- //# sourceMappingURL=ContextDeclastruct.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextDeclastruct.test.js","sourceRoot":"","sources":["../../src/domain.objects/ContextDeclastruct.test.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AAKpC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,OAAO,GAAuB;YAClC,UAAU,EAAE,IAAI,oBAAU,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;SACjD,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,oBAAU,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,OAAO,GAAuB;YAClC,UAAU,EAAE;gBACV,MAAM,EAAE,IAAI,oBAAU,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;gBAC7C,OAAO,EAAE,IAAI,oBAAU,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;aAC9C;SACF,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,CAAE,OAAO,CAAC,UAAkB,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,oBAAU,CAAC,CAAC;QACtE,MAAM,CAAE,OAAO,CAAC,UAAkB,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,oBAAU,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,oBAAoB;QACpB,MAAM,OAAO,GAAyC;YACpD,UAAU,EAAE,IAAI,oBAAU,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAChD,GAAG,EAAE;gBACH,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;gBACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;gBACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;gBACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;aAChB;SACF,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const domain_objects_1 = require("domain-objects");
4
- const DeclastructChange_1 = require("./DeclastructChange");
5
- describe('DeclastructChange', () => {
6
- describe('DeclastructChangeAction', () => {
7
- it('should export all 5 action types', () => {
8
- expect(DeclastructChange_1.DeclastructChangeAction.KEEP).toBe('KEEP');
9
- expect(DeclastructChange_1.DeclastructChangeAction.CREATE).toBe('CREATE');
10
- expect(DeclastructChange_1.DeclastructChangeAction.UPDATE).toBe('UPDATE');
11
- expect(DeclastructChange_1.DeclastructChangeAction.DESTROY).toBe('DESTROY');
12
- expect(DeclastructChange_1.DeclastructChangeAction.REPLACE).toBe('REPLACE');
13
- });
14
- });
15
- describe('DeclastructChange class', () => {
16
- class DemoResource extends domain_objects_1.DomainEntity {
17
- }
18
- DemoResource.unique = ['id'];
19
- it('should build a change with all required properties', () => {
20
- const change = new DeclastructChange_1.DeclastructChange({
21
- forResource: {
22
- class: DemoResource.constructor.name,
23
- slug: 'demo-1',
24
- },
25
- action: DeclastructChange_1.DeclastructChangeAction.CREATE,
26
- state: {
27
- desired: new DemoResource({ id: 'demo-1', name: 'Demo' }),
28
- remote: null,
29
- difference: null,
30
- },
31
- });
32
- expect(change.forResource.class).toBe(DemoResource.constructor.name);
33
- expect(change.forResource.slug).toBe('demo-1');
34
- expect(change.action).toBe(DeclastructChange_1.DeclastructChangeAction.CREATE);
35
- expect(change.state.desired).toBeDefined();
36
- expect(change.state.remote).toBeNull();
37
- expect(change.state.difference).toBeNull();
38
- });
39
- it('should handle KEEP action with matching desired and remote state', () => {
40
- const resource = new DemoResource({ id: 'demo-2', name: 'Demo' });
41
- const change = new DeclastructChange_1.DeclastructChange({
42
- forResource: {
43
- class: DemoResource.constructor.name,
44
- slug: 'demo-2',
45
- },
46
- action: DeclastructChange_1.DeclastructChangeAction.KEEP,
47
- state: {
48
- desired: resource,
49
- remote: resource,
50
- difference: null,
51
- },
52
- });
53
- expect(change.action).toBe(DeclastructChange_1.DeclastructChangeAction.KEEP);
54
- expect(change.state.difference).toBeNull();
55
- expect(change.state.desired).toBe(change.state.remote);
56
- });
57
- });
58
- });
59
- //# sourceMappingURL=DeclastructChange.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclastructChange.test.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructChange.test.ts"],"names":[],"mappings":";;AAAA,mDAA8C;AAE9C,2DAG6B;AAE7B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,MAAM,CAAC,2CAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,CAAC,2CAAuB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtD,MAAM,CAAC,2CAAuB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtD,MAAM,CAAC,2CAAuB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAA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AAC,CAAC;QAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;YAC1E,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAElE,MAAM,MAAM,GAAG,IAAI,qCAAiB,CAAC;gBACnC,WAAW,EAAE;oBACX,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC,IAAI;oBACpC,IAAI,EAAE,QAAQ;iBACf;gBACD,MAAM,EAAE,2CAAuB,CAAC,IAAI;gBACpC,KAAK,EAAE;oBACL,OAAO,EAAE,QAAQ;oBACjB,MAAM,EAAE,QAAQ;oBAChB,UAAU,EAAE,IAAI;iBACjB;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,2CAAuB,CAAC,IAAI,CAAC,CAAC;YACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const domain_objects_1 = require("domain-objects");
4
- describe('DeclastructDao', () => {
5
- class DemoResource extends domain_objects_1.DomainEntity {
6
- }
7
- DemoResource.unique = ['id'];
8
- it('should implement the interface structure', () => {
9
- // type verification
10
- const dao = {
11
- get: {
12
- byUnique: async () => null,
13
- byRef: async () => null,
14
- },
15
- set: {
16
- finsert: async (input) => input,
17
- },
18
- };
19
- expect(dao.get.byUnique).toBeDefined();
20
- expect(dao.get.byRef).toBeDefined();
21
- expect(dao.set.finsert).toBeDefined();
22
- });
23
- it('should support optional methods', () => {
24
- // type verification
25
- const dao = {
26
- get: {
27
- byUnique: async () => null,
28
- byPrimary: async () => null,
29
- byRef: async () => null,
30
- },
31
- set: {
32
- finsert: async (input) => input,
33
- upsert: async (input) => input,
34
- delete: async () => { },
35
- },
36
- };
37
- expect(dao.get.byPrimary).toBeDefined();
38
- expect(dao.set.upsert).toBeDefined();
39
- expect(dao.set.delete).toBeDefined();
40
- });
41
- describe('resource with optional primary key', () => {
42
- class DemoResourceWithOptionalPrimary extends domain_objects_1.DomainEntity {
43
- }
44
- DemoResourceWithOptionalPrimary.primary = ['uuid'];
45
- DemoResourceWithOptionalPrimary.unique = ['name'];
46
- it('RefByPrimary should require uuid (not optional)', () => {
47
- // type test: this should compile
48
- const ref = {
49
- uuid: 'test-uuid',
50
- };
51
- // verify ref has uuid
52
- expect(ref.uuid).toBe('test-uuid');
53
- // note: the following would fail type check (but we can't test that at runtime)
54
- // @ts-expect-error - uuid should be required, empty object should fail
55
- const badRef = {};
56
- expect(badRef).toBeDefined(); // suppress unused var warning
57
- });
58
- it('dao.get.byPrimary should accept RefByPrimary with required uuid', () => {
59
- // type verification: byPrimary input should have uuid as required (not optional)
60
- const dao = {
61
- get: {
62
- byUnique: async () => null,
63
- byPrimary: async (input) => {
64
- // input.uuid should be string (not string | undefined)
65
- // this assignment would fail if uuid were optional
66
- const uuid = input.uuid;
67
- expect(uuid).toBeDefined();
68
- return null;
69
- },
70
- byRef: async () => null,
71
- },
72
- set: { finsert: async (r) => r },
73
- };
74
- expect(dao.get.byPrimary).toBeDefined();
75
- });
76
- });
77
- });
78
- //# sourceMappingURL=DeclastructDao.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclastructDao.test.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructDao.test.ts"],"names":[],"mappings":";;AAAA,mDAA4D;AAI5D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAK9B,MAAM,YACJ,SAAQ,6BAA0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,CAAC,WAAW,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const DeclastructPlan_1 = require("./DeclastructPlan");
4
- describe('DeclastructPlan', () => {
5
- it('should build a plan with all required properties', () => {
6
- const plan = new DeclastructPlan_1.DeclastructPlan({
7
- hash: 'abc123',
8
- createdAt: '2025-11-22T10:30:00.000Z',
9
- wish: { uri: '/path/to/wish.ts' },
10
- changes: [],
11
- });
12
- expect(plan.hash).toBe('abc123');
13
- expect(plan.createdAt).toBe('2025-11-22T10:30:00.000Z');
14
- expect(plan.wish.uri).toBe('/path/to/wish.ts');
15
- expect(plan.changes).toEqual([]);
16
- });
17
- it('should have unique key set to hash', () => {
18
- expect(DeclastructPlan_1.DeclastructPlan.unique).toEqual(['hash']);
19
- });
20
- it('should extend DomainEntity', () => {
21
- const plan = new DeclastructPlan_1.DeclastructPlan({
22
- hash: 'test-hash',
23
- createdAt: '2025-11-22T10:30:00.000Z',
24
- wish: { uri: '/test' },
25
- changes: [],
26
- });
27
- // domain entities should have constructor.name
28
- expect(plan.constructor.name).toBe('DeclastructPlan');
29
- });
30
- });
31
- //# sourceMappingURL=DeclastructPlan.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclastructPlan.test.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructPlan.test.ts"],"names":[],"mappings":";;AAAA,uDAAoD;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,IAAI,GAAG,IAAI,iCAAe,CAAC;YAC/B,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,0BAA0B;YACrC,IAAI,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE;YACjC,OAAO,EAA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