@scoutflo/topology-contracts 0.2.0 → 0.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.
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sourceSyncBatchUnitsResponseSchema = exports.sourceSyncBatchResponseSchema = exports.sourceSyncApplyResponseSchema = exports.sourceSyncApplyRequestSchema = exports.sourceSyncApplySelectionSchema = exports.sourceSyncDryRunResponseSchema = exports.sourceSyncDuplicateSchema = exports.sourceSyncErrorSchema = exports.sourceSyncDryRunSourceResultSchema = exports.sourceSyncSourceSummarySchema = exports.sourceSyncJobSchema = exports.sourceSyncRecordSchema = exports.sourceSyncCapabilitiesResponseSchema = exports.sourceSyncUnitStatusSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const capability_1 = require("./capability");
6
+ const completeness_1 = require("./completeness");
7
+ const common_1 = require("./common");
8
+ const warning_1 = require("./warning");
9
+ exports.sourceSyncUnitStatusSchema = common_1.nonEmptyStringSchema;
10
+ exports.sourceSyncCapabilitiesResponseSchema = zod_1.z.object({
11
+ status: zod_1.z.number().int().optional(),
12
+ providers: zod_1.z.array(capability_1.sourceSyncCapabilitySchema),
13
+ }).passthrough();
14
+ exports.sourceSyncRecordSchema = zod_1.z.object({
15
+ sync_batch_id: common_1.nonEmptyStringSchema.optional(),
16
+ source_run_id: common_1.nonEmptyStringSchema.optional(),
17
+ scan_unit_id: common_1.nonEmptyStringSchema.optional(),
18
+ fetch_group_id: common_1.nonEmptyStringSchema.optional(),
19
+ plan_unit_id: common_1.nonEmptyStringSchema.optional(),
20
+ apply_unit_id: common_1.nonEmptyStringSchema.optional(),
21
+ correlation_run_id: common_1.nonEmptyStringSchema.optional(),
22
+ correlation_unit_id: common_1.nonEmptyStringSchema.optional(),
23
+ unit_kind: common_1.nonEmptyStringSchema.optional(),
24
+ provider: common_1.nonEmptyStringSchema.optional(),
25
+ unit_key: common_1.nonEmptyStringSchema.optional(),
26
+ family: common_1.nonEmptyStringSchema.optional(),
27
+ status: exports.sourceSyncUnitStatusSchema.optional(),
28
+ apply_eligible: zod_1.z.boolean().optional(),
29
+ apply_mode: common_1.nonEmptyStringSchema.optional(),
30
+ allowed_apply_modes: zod_1.z.array(common_1.nonEmptyStringSchema).optional(),
31
+ apply_blocked_code: common_1.nonEmptyStringSchema.optional(),
32
+ apply_blocked_reason: common_1.nonEmptyStringSchema.optional(),
33
+ diff_hash: common_1.nonEmptyStringSchema.optional(),
34
+ diff_summary: zod_1.z.record(zod_1.z.number()).optional(),
35
+ candidate_counts: zod_1.z.record(zod_1.z.number()).optional(),
36
+ conflict_counts: zod_1.z.record(zod_1.z.number()).optional(),
37
+ lifecycle_authority_scope_key: common_1.nonEmptyStringSchema.optional(),
38
+ requested_scope: common_1.recordSchema.optional(),
39
+ effective_scope: common_1.recordSchema.optional(),
40
+ warnings: zod_1.z.array(warning_1.topologySyncWarningSchema).optional(),
41
+ expires_at: common_1.nonEmptyStringSchema.optional(),
42
+ created_at: common_1.nonEmptyStringSchema.optional(),
43
+ updated_at: common_1.nonEmptyStringSchema.optional(),
44
+ }).passthrough();
45
+ exports.sourceSyncJobSchema = zod_1.z.object({
46
+ job_id: common_1.nonEmptyStringSchema,
47
+ status: exports.sourceSyncUnitStatusSchema,
48
+ operation_type: common_1.nonEmptyStringSchema.optional(),
49
+ mode: common_1.nonEmptyStringSchema.optional(),
50
+ counters: zod_1.z.record(zod_1.z.number()).optional(),
51
+ errors: zod_1.z.array(common_1.recordSchema).optional(),
52
+ dry_run: zod_1.z.boolean().optional(),
53
+ started_at: common_1.nonEmptyStringSchema.optional(),
54
+ finished_at: common_1.nonEmptyStringSchema.optional(),
55
+ }).passthrough();
56
+ exports.sourceSyncSourceSummarySchema = zod_1.z.object({
57
+ provider: common_1.nonEmptyStringSchema,
58
+ provider_account_id: common_1.nonEmptyStringSchema.optional(),
59
+ requested_scope: common_1.recordSchema.optional(),
60
+ effective_scope: common_1.recordSchema.optional(),
61
+ completeness: completeness_1.topologySyncCompletenessSchema.optional(),
62
+ candidates: zod_1.z.object({
63
+ nodes: zod_1.z.number().int().min(0).optional(),
64
+ relationships: zod_1.z.number().int().min(0).optional(),
65
+ }).passthrough().optional(),
66
+ diff_summary: zod_1.z.record(zod_1.z.number()).optional(),
67
+ diff_hash: common_1.nonEmptyStringSchema.optional(),
68
+ }).passthrough();
69
+ exports.sourceSyncDryRunSourceResultSchema = zod_1.z.object({
70
+ provider: common_1.nonEmptyStringSchema,
71
+ job: exports.sourceSyncJobSchema.optional(),
72
+ dry_run_job_id: common_1.nonEmptyStringSchema.optional(),
73
+ sync_batch: exports.sourceSyncRecordSchema.optional(),
74
+ source_runs: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
75
+ scan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
76
+ fetch_groups: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
77
+ plan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
78
+ apply_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
79
+ source: exports.sourceSyncSourceSummarySchema.optional(),
80
+ summary: zod_1.z.record(zod_1.z.number()).optional(),
81
+ diff_hash: common_1.nonEmptyStringSchema,
82
+ links: zod_1.z.record(common_1.nonEmptyStringSchema).optional(),
83
+ }).passthrough();
84
+ exports.sourceSyncErrorSchema = zod_1.z.object({
85
+ index: zod_1.z.number().int().min(0).optional(),
86
+ provider: common_1.nonEmptyStringSchema.optional(),
87
+ source_ref: common_1.recordSchema.optional(),
88
+ include: common_1.recordSchema.optional(),
89
+ exclude: common_1.recordSchema.optional(),
90
+ dry_run_job_id: common_1.nonEmptyStringSchema.optional(),
91
+ sync_batch_id: common_1.nonEmptyStringSchema.optional(),
92
+ status: common_1.nonEmptyStringSchema.optional(),
93
+ code: common_1.nonEmptyStringSchema,
94
+ status_code: zod_1.z.number().int().optional(),
95
+ message: common_1.nonEmptyStringSchema,
96
+ }).passthrough();
97
+ exports.sourceSyncDuplicateSchema = zod_1.z.object({
98
+ index: zod_1.z.number().int().min(0),
99
+ provider: common_1.nonEmptyStringSchema,
100
+ provider_account_id: common_1.nonEmptyStringSchema.optional(),
101
+ dry_run_job_id: common_1.nonEmptyStringSchema,
102
+ duplicate_of_dry_run_job_id: common_1.nonEmptyStringSchema,
103
+ completed_scope_keys: zod_1.z.array(common_1.nonEmptyStringSchema),
104
+ }).passthrough();
105
+ exports.sourceSyncDryRunResponseSchema = zod_1.z.object({
106
+ status: zod_1.z.union([zod_1.z.number().int(), common_1.nonEmptyStringSchema]).optional(),
107
+ http_status: zod_1.z.number().int().optional(),
108
+ sync_batch_id: common_1.nonEmptyStringSchema.optional(),
109
+ sync_batch: exports.sourceSyncRecordSchema.optional(),
110
+ jobs: zod_1.z.array(exports.sourceSyncJobSchema).optional(),
111
+ providers: zod_1.z.array(common_1.nonEmptyStringSchema).optional(),
112
+ source_results: zod_1.z.array(exports.sourceSyncDryRunSourceResultSchema).optional(),
113
+ source_errors: zod_1.z.array(exports.sourceSyncErrorSchema).optional(),
114
+ source_duplicates: zod_1.z.array(exports.sourceSyncDuplicateSchema).optional(),
115
+ sync_batches: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
116
+ source_runs: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
117
+ scan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
118
+ fetch_groups: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
119
+ plan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
120
+ apply_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
121
+ sources: zod_1.z.array(exports.sourceSyncSourceSummarySchema).optional(),
122
+ summary: zod_1.z.record(zod_1.z.number()).optional(),
123
+ diff_hashes: zod_1.z.record(common_1.nonEmptyStringSchema).optional(),
124
+ links: common_1.recordSchema.optional(),
125
+ }).passthrough();
126
+ exports.sourceSyncApplySelectionSchema = zod_1.z.object({
127
+ apply_all_ready: zod_1.z.boolean().optional(),
128
+ sync_batch_id: common_1.nonEmptyStringSchema.optional(),
129
+ source_run_ids: zod_1.z.array(common_1.nonEmptyStringSchema).optional(),
130
+ scan_unit_ids: zod_1.z.array(common_1.nonEmptyStringSchema).optional(),
131
+ plan_unit_ids: zod_1.z.array(common_1.nonEmptyStringSchema).optional(),
132
+ plan_units: zod_1.z.array(zod_1.z.object({
133
+ plan_unit_id: common_1.nonEmptyStringSchema,
134
+ confirm_diff_hash: common_1.nonEmptyStringSchema,
135
+ }).passthrough()).optional(),
136
+ }).passthrough();
137
+ exports.sourceSyncApplyRequestSchema = zod_1.z.object({
138
+ dry_run_job_id: common_1.nonEmptyStringSchema,
139
+ sync_batch_id: common_1.nonEmptyStringSchema.optional(),
140
+ confirm_diff_hash: common_1.nonEmptyStringSchema,
141
+ selection: exports.sourceSyncApplySelectionSchema.optional(),
142
+ }).passthrough();
143
+ exports.sourceSyncApplyResponseSchema = zod_1.z.object({
144
+ status: zod_1.z.number().int(),
145
+ job: exports.sourceSyncJobSchema.optional(),
146
+ sync_batch: exports.sourceSyncRecordSchema.optional(),
147
+ source_runs: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
148
+ scan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
149
+ fetch_groups: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
150
+ plan_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
151
+ apply_units: zod_1.z.array(exports.sourceSyncRecordSchema).optional(),
152
+ source: exports.sourceSyncSourceSummarySchema.optional(),
153
+ diff_hash: common_1.nonEmptyStringSchema.optional(),
154
+ apply_selection: common_1.recordSchema.optional(),
155
+ apply: zod_1.z.object({
156
+ summary: zod_1.z.record(zod_1.z.number()).optional(),
157
+ }).passthrough().optional(),
158
+ links: zod_1.z.record(common_1.nonEmptyStringSchema).optional(),
159
+ }).passthrough();
160
+ exports.sourceSyncBatchResponseSchema = zod_1.z.object({
161
+ status: zod_1.z.number().int(),
162
+ sync_batch: exports.sourceSyncRecordSchema,
163
+ }).passthrough();
164
+ exports.sourceSyncBatchUnitsResponseSchema = zod_1.z.object({
165
+ status: zod_1.z.number().int(),
166
+ source_runs: zod_1.z.array(exports.sourceSyncRecordSchema),
167
+ scan_units: zod_1.z.array(exports.sourceSyncRecordSchema),
168
+ fetch_groups: zod_1.z.array(exports.sourceSyncRecordSchema),
169
+ plan_units: zod_1.z.array(exports.sourceSyncRecordSchema),
170
+ apply_units: zod_1.z.array(exports.sourceSyncRecordSchema),
171
+ }).passthrough();
172
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../src/source-sync/lifecycle.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,6CAA0D;AAC1D,iDAAgE;AAChE,qCAGkB;AAClB,uCAAsD;AAEzC,QAAA,0BAA0B,GAAG,6BAAoB,CAAC;AAElD,QAAA,oCAAoC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3D,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,uCAA0B,CAAC;CAC/C,CAAC,CAAC,WAAW,EAAE,CAAC;AAEJ,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC9C,aAAa,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC9C,YAAY,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC7C,cAAc,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC/C,YAAY,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC7C,aAAa,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC9C,kBAAkB,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IACnD,mBAAmB,EAAE,6BAAo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,CAAC,QAAQ,EAAE;IACvD,MAAM,EAAE,qCAA6B,CAAC,QAAQ,EAAE;IAChD,SAAS,EAAE,6BAAoB,CAAC,QAAQ,EAAE;IAC1C,eAAe,EAAE,qBAAY,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,6BAAoB,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC,WAAW,EAAE,CAAC;AAEJ,QAAA,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACxB,UAAU,EAAE,8BAAsB;CACnC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEJ,QAAA,kCAAkC,GAAG,OAAC,CAAC,MAAM,CAAC;IACzD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACxB,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;IAC5C,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;IAC3C,YAAY,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;IAC7C,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;IAC3C,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;CAC7C,CAAC,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,83 @@
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 strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_test_1 = __importDefault(require("node:test"));
8
+ const src_1 = require("../src");
9
+ const credentialItem = {
10
+ found: true,
11
+ entity_id: 'res-k8s-deployment-123',
12
+ entity_type: 'resource',
13
+ root_type: 'kubernetes_cluster',
14
+ source_resource_id: 'res-k8s-cluster-1',
15
+ externalRef: {
16
+ provider: 'k8s',
17
+ external_id: 'cluster-1',
18
+ source_collection: 'kubernetes_clusters',
19
+ source_document_id: 'cluster-doc-1',
20
+ },
21
+ resolution_mode: 'root_refs',
22
+ reason_codes: ['ROOT_REFS_HIT'],
23
+ traversal_path: ['root_refs.kubernetes_cluster'],
24
+ error: null,
25
+ };
26
+ (0, node_test_1.default)('parses credential-source single success envelope', () => {
27
+ const parsed = src_1.credentialSourceSingleResponseSchema.parse({
28
+ status: 'success',
29
+ data: credentialItem,
30
+ gateway_extension: 'allowed',
31
+ });
32
+ strict_1.default.equal(parsed.status, 'success');
33
+ strict_1.default.equal(parsed.data.entity_id, 'res-k8s-deployment-123');
34
+ strict_1.default.equal(parsed.gateway_extension, 'allowed');
35
+ });
36
+ (0, node_test_1.default)('parses credential-source bulk request and partial success response', () => {
37
+ const request = src_1.credentialSourceBulkRequestSchema.parse({
38
+ requests: [
39
+ {
40
+ entity_type: 'resource',
41
+ entity_id: 'res-k8s-deployment-123',
42
+ root_type: 'kubernetes_cluster',
43
+ },
44
+ ],
45
+ });
46
+ const response = src_1.credentialSourceBulkResponseSchema.parse({
47
+ status: 'partial_success',
48
+ results: [
49
+ credentialItem,
50
+ {
51
+ found: false,
52
+ entity_id: 'res-k8s-deployment-999',
53
+ entity_type: 'resource',
54
+ root_type: 'kubernetes_cluster',
55
+ source_resource_id: null,
56
+ externalRef: null,
57
+ resolution_mode: 'not_found',
58
+ reason_codes: ['BFS_EXHAUSTED'],
59
+ traversal_path: [],
60
+ error: null,
61
+ },
62
+ ],
63
+ });
64
+ strict_1.default.equal(request.requests[0]?.entity_type, 'resource');
65
+ strict_1.default.equal(response.status, 'partial_success');
66
+ strict_1.default.equal(response.results[1]?.resolution_mode, 'not_found');
67
+ });
68
+ (0, node_test_1.default)('parses topology API error envelope with retry hint', () => {
69
+ const parsed = src_1.topologyApiErrorEnvelopeSchema.parse({
70
+ status: 'error',
71
+ correlation_id: 'inv-123',
72
+ timestamp: '2026-03-11T10:00:00.000Z',
73
+ error: {
74
+ code: 'RATE_LIMITED',
75
+ message: 'Rate limit exceeded',
76
+ details: null,
77
+ retry_after_seconds: 2,
78
+ },
79
+ });
80
+ strict_1.default.equal(parsed.error.code, 'RATE_LIMITED');
81
+ strict_1.default.equal(parsed.error.retry_after_seconds, 2);
82
+ });
83
+ //# sourceMappingURL=credential-source.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-source.test.js","sourceRoot":"","sources":["../../test/credential-source.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,0DAA6B;AAC7B,gCAKgB;AAEhB,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,wBAAwB;IACnC,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,oBAAoB;IAC/B,kBAAkB,EAAE,mBAAmB;IACvC,WAAW,EAAE;QACX,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,WAAW;QACxB,iBAAiB,EAAE,qBAAqB;QACxC,kBAAkB,EAAE,eAAe;KACpC;IACD,eAAe,EAAE,WAAW;IAC5B,YAAY,EAAE,CAAC,eAAe,CAAC;IAC/B,cAAc,EAAE,CAAC,8BAA8B,CAAC;IAChD,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,IAAA,mBAAI,EAAC,kDAAkD,EAAE,GAAG,EAAE;IAC5D,MAAM,MAAM,GAAG,0CAAoC,CAAC,KAAK,CAAC;QACxD,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,cAAc;QACpB,iBAAiB,EAAE,SAAS;KAC7B,CAAC,CAAC;IAEH,gBAAM,CAA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DAAoD,EAAE,GAAG,EAAE;IAC9D,MAAM,MAAM,GAAG,oCAA8B,CAAC,KAAK,CAAC;QAClD,MAAM,EAAE,OAAO;QACf,cAAc,EAAE,SAAS;QACzB,SAAS,EAAE,0BAA0B;QACrC,KAAK,EAAE;YACL,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,qBAAqB;YAC9B,OAAO,EAAE,IAAI;YACb,mBAAmB,EAAE,CAAC;SACvB;KACF,CAAC,CAAC;IAEH,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChD,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,223 @@
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 strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_test_1 = __importDefault(require("node:test"));
8
+ const src_1 = require("../src");
9
+ const sourceSyncRecord = {
10
+ sync_batch_id: 'sync_batch_123',
11
+ source_run_id: 'source_run_123',
12
+ scan_unit_id: 'scan_unit_123',
13
+ fetch_group_id: 'fetch_group_123',
14
+ plan_unit_id: 'plan_unit_123',
15
+ apply_unit_id: 'apply_unit_123',
16
+ correlation_run_id: 'correlation_run_123',
17
+ correlation_unit_id: 'correlation_unit_123',
18
+ unit_kind: 'plan_unit',
19
+ provider: 'k8s',
20
+ unit_key: 'plan:k8s:cluster-prod',
21
+ family: 'kubernetes_workload',
22
+ status: 'ready_for_apply',
23
+ apply_eligible: true,
24
+ apply_mode: 'selected_apply',
25
+ allowed_apply_modes: ['selected_apply'],
26
+ diff_hash: 'diff_hash_123',
27
+ diff_summary: { create: 2, refresh: 1 },
28
+ candidate_counts: { nodes: 2, relationships: 1 },
29
+ conflict_counts: { ambiguous: 0 },
30
+ lifecycle_authority_scope_key: 'k8s:cluster:prod',
31
+ requested_scope: { cluster_id: 'cluster-prod' },
32
+ effective_scope: { dimensions: { region: 'us-east-1' } },
33
+ warnings: [
34
+ {
35
+ code: 'partial_scope',
36
+ message: 'Namespace filter limited the dry run',
37
+ severity: 'warning',
38
+ },
39
+ ],
40
+ expires_at: '2026-06-17T12:00:00.000Z',
41
+ created_at: '2026-06-17T10:00:00.000Z',
42
+ updated_at: '2026-06-17T10:05:00.000Z',
43
+ gateway_extension: 'allowed',
44
+ };
45
+ const sourceSyncJob = {
46
+ job_id: 'job_123',
47
+ status: 'completed',
48
+ operation_type: 'topology_source_sync',
49
+ mode: 'dry_run',
50
+ counters: { candidates: 3 },
51
+ errors: [],
52
+ dry_run: true,
53
+ started_at: '2026-06-17T10:00:00.000Z',
54
+ finished_at: '2026-06-17T10:05:00.000Z',
55
+ };
56
+ const sourceSummary = {
57
+ provider: 'k8s',
58
+ provider_account_id: 'acct_123',
59
+ requested_scope: { cluster_id: 'cluster-prod' },
60
+ effective_scope: { dimensions: { region: 'us-east-1' } },
61
+ completeness: {
62
+ overall: 'partial',
63
+ completed_scope_keys: ['namespace:payments'],
64
+ failed_scope_keys: [],
65
+ },
66
+ candidates: {
67
+ nodes: 2,
68
+ relationships: 1,
69
+ },
70
+ diff_summary: { create: 2, refresh: 1 },
71
+ diff_hash: 'diff_hash_123',
72
+ };
73
+ (0, node_test_1.default)('parses source-sync capabilities response used by Client', () => {
74
+ const parsed = src_1.sourceSyncCapabilitiesResponseSchema.parse({
75
+ status: 200,
76
+ providers: [
77
+ {
78
+ provider: 'k8s',
79
+ status: 'available',
80
+ source_sync_version: 'topology.scoutflo.dev/v1',
81
+ supports_dry_run: true,
82
+ supports_apply: true,
83
+ supports_selected_apply: true,
84
+ supports_correlation: false,
85
+ selected_apply_modes: ['selected_apply'],
86
+ partial_scope_apply: {
87
+ supported: true,
88
+ mode: 'selected_apply',
89
+ families: ['kubernetes_workload'],
90
+ lifecycle_writes: true,
91
+ },
92
+ families: ['kubernetes_workload'],
93
+ locality_options: [{ kind: 'cluster', id: 'cluster-prod' }],
94
+ non_goals: ['credentials'],
95
+ },
96
+ ],
97
+ });
98
+ strict_1.default.equal(parsed.status, 200);
99
+ strict_1.default.equal(parsed.providers[0]?.provider, 'k8s');
100
+ strict_1.default.equal(parsed.providers[0]?.partial_scope_apply?.supported, true);
101
+ });
102
+ (0, node_test_1.default)('parses source-sync dry-run lifecycle response used by Client', () => {
103
+ const parsed = src_1.sourceSyncDryRunResponseSchema.parse({
104
+ status: 'partial',
105
+ http_status: 200,
106
+ sync_batch_id: 'sync_batch_123',
107
+ sync_batch: sourceSyncRecord,
108
+ jobs: [sourceSyncJob],
109
+ providers: ['k8s'],
110
+ source_results: [
111
+ {
112
+ provider: 'k8s',
113
+ job: sourceSyncJob,
114
+ dry_run_job_id: 'job_123',
115
+ sync_batch: sourceSyncRecord,
116
+ source_runs: [sourceSyncRecord],
117
+ scan_units: [sourceSyncRecord],
118
+ fetch_groups: [sourceSyncRecord],
119
+ plan_units: [sourceSyncRecord],
120
+ apply_units: [],
121
+ source: sourceSummary,
122
+ summary: { create: 2 },
123
+ diff_hash: 'diff_hash_123',
124
+ links: {
125
+ units: '/v1/topology/source-sync/batches/sync_batch_123/units',
126
+ },
127
+ },
128
+ ],
129
+ source_errors: [
130
+ {
131
+ index: 1,
132
+ provider: 'aws',
133
+ status: 'failed',
134
+ code: 'source_dry_run_failed',
135
+ message: 'AWS credentials missing',
136
+ },
137
+ ],
138
+ source_duplicates: [
139
+ {
140
+ index: 2,
141
+ provider: 'k8s',
142
+ dry_run_job_id: 'job_duplicate',
143
+ duplicate_of_dry_run_job_id: 'job_123',
144
+ completed_scope_keys: ['namespace:payments'],
145
+ },
146
+ ],
147
+ sync_batches: [sourceSyncRecord],
148
+ source_runs: [sourceSyncRecord],
149
+ scan_units: [sourceSyncRecord],
150
+ fetch_groups: [sourceSyncRecord],
151
+ plan_units: [sourceSyncRecord],
152
+ apply_units: [],
153
+ sources: [sourceSummary],
154
+ summary: { create: 2, refresh: 1 },
155
+ diff_hashes: { k8s: 'diff_hash_123' },
156
+ links: { jobs: ['/v1/topology/jobs/job_123'] },
157
+ });
158
+ strict_1.default.equal(parsed.status, 'partial');
159
+ strict_1.default.equal(parsed.source_results?.[0]?.provider, 'k8s');
160
+ strict_1.default.equal(parsed.source_errors?.[0]?.code, 'source_dry_run_failed');
161
+ });
162
+ (0, node_test_1.default)('parses source-sync apply request and response used by Client', () => {
163
+ const request = src_1.sourceSyncApplyRequestSchema.parse({
164
+ dry_run_job_id: 'job_123',
165
+ sync_batch_id: 'sync_batch_123',
166
+ confirm_diff_hash: 'diff_hash_123',
167
+ selection: {
168
+ apply_all_ready: false,
169
+ sync_batch_id: 'sync_batch_123',
170
+ source_run_ids: ['source_run_123'],
171
+ scan_unit_ids: ['scan_unit_123'],
172
+ plan_unit_ids: ['plan_unit_123'],
173
+ plan_units: [
174
+ {
175
+ plan_unit_id: 'plan_unit_123',
176
+ confirm_diff_hash: 'diff_hash_123',
177
+ },
178
+ ],
179
+ },
180
+ });
181
+ const response = src_1.sourceSyncApplyResponseSchema.parse({
182
+ status: 200,
183
+ job: { ...sourceSyncJob, mode: 'apply', dry_run: false },
184
+ sync_batch: sourceSyncRecord,
185
+ source_runs: [sourceSyncRecord],
186
+ scan_units: [sourceSyncRecord],
187
+ fetch_groups: [sourceSyncRecord],
188
+ plan_units: [sourceSyncRecord],
189
+ apply_units: [{ ...sourceSyncRecord, status: 'applied' }],
190
+ source: sourceSummary,
191
+ diff_hash: 'diff_hash_123',
192
+ apply_selection: {
193
+ source_run_ids: ['source_run_123'],
194
+ },
195
+ apply: {
196
+ summary: { applied: 1 },
197
+ relationships_created: 1,
198
+ },
199
+ links: {
200
+ job: '/v1/topology/jobs/job_456',
201
+ audit: '/v1/topology/audit/events?apply_job_id=job_456',
202
+ },
203
+ });
204
+ strict_1.default.equal(request.selection?.plan_units?.[0]?.plan_unit_id, 'plan_unit_123');
205
+ strict_1.default.equal(response.apply_units?.[0]?.status, 'applied');
206
+ });
207
+ (0, node_test_1.default)('parses source-sync batch and batch-units responses used by Client', () => {
208
+ const batch = src_1.sourceSyncBatchResponseSchema.parse({
209
+ status: 200,
210
+ sync_batch: sourceSyncRecord,
211
+ });
212
+ const units = src_1.sourceSyncBatchUnitsResponseSchema.parse({
213
+ status: 200,
214
+ source_runs: [sourceSyncRecord],
215
+ scan_units: [sourceSyncRecord],
216
+ fetch_groups: [sourceSyncRecord],
217
+ plan_units: [sourceSyncRecord],
218
+ apply_units: [{ ...sourceSyncRecord, status: 'applied' }],
219
+ });
220
+ strict_1.default.equal(batch.sync_batch.sync_batch_id, 'sync_batch_123');
221
+ strict_1.default.equal(units.plan_units[0]?.apply_eligible, true);
222
+ });
223
+ //# sourceMappingURL=source-sync-lifecycle.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-sync-lifecycle.test.js","sourceRoot":"","sources":["../../test/source-sync-lifecycle.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,0DAA6B;AAC7B,gCAOgB;AAEhB,MAAM,gBAAgB,GAAG;IACvB,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,gBAAgB;IAC/B,YAAY,EAAE,eAAe;IAC7B,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;IAC/B,kBAAkB,EAAE,qBAAqB;IACzC,mBAAmB,EAAE,sBAAsB;IAC3C,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,uBAAuB;IACjC,MAAM,EAAE,qBAAqB;IAC7B,MAAM,EAAE,iBAAiB;IACzB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,gBAAgB;IAC5B,mBAAmB,EAAE,CAAC,gBAAgB,CAAC;IACvC,SAAS,EAAE,eAAe;IA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GAAG,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;KAC1D,CAAC,CAAC;IAEH,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAC/D,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scoutflo/topology-contracts",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Pure shared topology vocabulary and Zod schemas for Scoutflo topology workflows.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",