@treeseed/sdk 0.13.0-rc.73 → 0.13.0-rc.74
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/.treeseed-build-complete.json +1 -1
- package/dist/deployment/hosted-topology.d.ts +134 -1
- package/dist/deployment/hosted-topology.js +31 -2
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +16 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"completedAt":"2026-09-02T03:
|
|
1
|
+
{"completedAt":"2026-09-02T03:24:42.316Z"}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const hostedProviderSchema: z.ZodEnum<["cloudflare", "railway"]>;
|
|
3
3
|
export declare const hostedResourceKindSchema: z.ZodEnum<["admin-application", "dns-record", "tls-policy", "api-proxy", "control-plane-api", "postgresql", "operations-runner", "treedx-service"]>;
|
|
4
|
+
declare const hostedConnectionSnapshotSchema: z.ZodEffects<z.ZodObject<{
|
|
5
|
+
connectionRef: z.ZodString;
|
|
6
|
+
nonSecretConfig: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
connectionRef: string;
|
|
9
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
10
|
+
}, {
|
|
11
|
+
connectionRef: string;
|
|
12
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
13
|
+
}>, {
|
|
14
|
+
connectionRef: string;
|
|
15
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
16
|
+
}, {
|
|
17
|
+
connectionRef: string;
|
|
18
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
19
|
+
}>;
|
|
4
20
|
export declare const hostedTopologyDeclarationSchema: z.ZodEffects<z.ZodObject<{
|
|
5
21
|
schemaVersion: z.ZodLiteral<"treeseed.hosted-topology/v1">;
|
|
6
22
|
id: z.ZodString;
|
|
@@ -329,6 +345,32 @@ export declare const hostedTopologyPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
|
329
345
|
readonly topologyId: z.ZodString;
|
|
330
346
|
readonly environment: z.ZodEnum<["staging", "production"]>;
|
|
331
347
|
readonly platformCommit: z.ZodString;
|
|
348
|
+
readonly artifacts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
349
|
+
digest: z.ZodString;
|
|
350
|
+
source: z.ZodString;
|
|
351
|
+
}, "strict", z.ZodTypeAny, {
|
|
352
|
+
digest: string;
|
|
353
|
+
source: string;
|
|
354
|
+
}, {
|
|
355
|
+
digest: string;
|
|
356
|
+
source: string;
|
|
357
|
+
}>>;
|
|
358
|
+
readonly providerConnections: z.ZodRecord<z.ZodEnum<["cloudflare", "railway"]>, z.ZodEffects<z.ZodObject<{
|
|
359
|
+
connectionRef: z.ZodString;
|
|
360
|
+
nonSecretConfig: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
361
|
+
}, "strict", z.ZodTypeAny, {
|
|
362
|
+
connectionRef: string;
|
|
363
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
364
|
+
}, {
|
|
365
|
+
connectionRef: string;
|
|
366
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
367
|
+
}>, {
|
|
368
|
+
connectionRef: string;
|
|
369
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
370
|
+
}, {
|
|
371
|
+
connectionRef: string;
|
|
372
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
373
|
+
}>>;
|
|
332
374
|
readonly actions: z.ZodArray<z.ZodObject<{
|
|
333
375
|
resourceId: z.ZodString;
|
|
334
376
|
provider: z.ZodEnum<["cloudflare", "railway"]>;
|
|
@@ -560,7 +602,15 @@ export declare const hostedTopologyPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
|
560
602
|
}[];
|
|
561
603
|
environment: "production" | "staging";
|
|
562
604
|
executable: false;
|
|
605
|
+
artifacts: Record<string, {
|
|
606
|
+
digest: string;
|
|
607
|
+
source: string;
|
|
608
|
+
}>;
|
|
563
609
|
planId: string;
|
|
610
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
611
|
+
connectionRef: string;
|
|
612
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
613
|
+
}>>;
|
|
564
614
|
declarationDigest: string;
|
|
565
615
|
topologyId: string;
|
|
566
616
|
platformCommit: string;
|
|
@@ -607,7 +657,15 @@ export declare const hostedTopologyPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
|
607
657
|
}[];
|
|
608
658
|
environment: "production" | "staging";
|
|
609
659
|
executable: false;
|
|
660
|
+
artifacts: Record<string, {
|
|
661
|
+
digest: string;
|
|
662
|
+
source: string;
|
|
663
|
+
}>;
|
|
610
664
|
planId: string;
|
|
665
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
666
|
+
connectionRef: string;
|
|
667
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
668
|
+
}>>;
|
|
611
669
|
declarationDigest: string;
|
|
612
670
|
topologyId: string;
|
|
613
671
|
platformCommit: string;
|
|
@@ -654,7 +712,15 @@ export declare const hostedTopologyPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
|
654
712
|
}[];
|
|
655
713
|
environment: "production" | "staging";
|
|
656
714
|
executable: false;
|
|
715
|
+
artifacts: Record<string, {
|
|
716
|
+
digest: string;
|
|
717
|
+
source: string;
|
|
718
|
+
}>;
|
|
657
719
|
planId: string;
|
|
720
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
721
|
+
connectionRef: string;
|
|
722
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
723
|
+
}>>;
|
|
658
724
|
declarationDigest: string;
|
|
659
725
|
topologyId: string;
|
|
660
726
|
platformCommit: string;
|
|
@@ -701,7 +767,15 @@ export declare const hostedTopologyPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
|
701
767
|
}[];
|
|
702
768
|
environment: "production" | "staging";
|
|
703
769
|
executable: false;
|
|
770
|
+
artifacts: Record<string, {
|
|
771
|
+
digest: string;
|
|
772
|
+
source: string;
|
|
773
|
+
}>;
|
|
704
774
|
planId: string;
|
|
775
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
776
|
+
connectionRef: string;
|
|
777
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
778
|
+
}>>;
|
|
705
779
|
declarationDigest: string;
|
|
706
780
|
topologyId: string;
|
|
707
781
|
platformCommit: string;
|
|
@@ -760,6 +834,32 @@ export declare const authorizedHostedTopologyPlanSchema: z.ZodEffects<z.ZodObjec
|
|
|
760
834
|
topologyId: z.ZodString;
|
|
761
835
|
environment: z.ZodEnum<["staging", "production"]>;
|
|
762
836
|
platformCommit: z.ZodString;
|
|
837
|
+
artifacts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
838
|
+
digest: z.ZodString;
|
|
839
|
+
source: z.ZodString;
|
|
840
|
+
}, "strict", z.ZodTypeAny, {
|
|
841
|
+
digest: string;
|
|
842
|
+
source: string;
|
|
843
|
+
}, {
|
|
844
|
+
digest: string;
|
|
845
|
+
source: string;
|
|
846
|
+
}>>;
|
|
847
|
+
providerConnections: z.ZodRecord<z.ZodEnum<["cloudflare", "railway"]>, z.ZodEffects<z.ZodObject<{
|
|
848
|
+
connectionRef: z.ZodString;
|
|
849
|
+
nonSecretConfig: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
850
|
+
}, "strict", z.ZodTypeAny, {
|
|
851
|
+
connectionRef: string;
|
|
852
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
853
|
+
}, {
|
|
854
|
+
connectionRef: string;
|
|
855
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
856
|
+
}>, {
|
|
857
|
+
connectionRef: string;
|
|
858
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
859
|
+
}, {
|
|
860
|
+
connectionRef: string;
|
|
861
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
862
|
+
}>>;
|
|
763
863
|
actions: z.ZodArray<z.ZodObject<{
|
|
764
864
|
resourceId: z.ZodString;
|
|
765
865
|
provider: z.ZodEnum<["cloudflare", "railway"]>;
|
|
@@ -990,7 +1090,15 @@ export declare const authorizedHostedTopologyPlanSchema: z.ZodEffects<z.ZodObjec
|
|
|
990
1090
|
}[];
|
|
991
1091
|
environment: "production" | "staging";
|
|
992
1092
|
executable: true;
|
|
1093
|
+
artifacts: Record<string, {
|
|
1094
|
+
digest: string;
|
|
1095
|
+
source: string;
|
|
1096
|
+
}>;
|
|
993
1097
|
planId: string;
|
|
1098
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
1099
|
+
connectionRef: string;
|
|
1100
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
1101
|
+
}>>;
|
|
994
1102
|
declarationDigest: string;
|
|
995
1103
|
topologyId: string;
|
|
996
1104
|
platformCommit: string;
|
|
@@ -1044,7 +1152,15 @@ export declare const authorizedHostedTopologyPlanSchema: z.ZodEffects<z.ZodObjec
|
|
|
1044
1152
|
}[];
|
|
1045
1153
|
environment: "production" | "staging";
|
|
1046
1154
|
executable: true;
|
|
1155
|
+
artifacts: Record<string, {
|
|
1156
|
+
digest: string;
|
|
1157
|
+
source: string;
|
|
1158
|
+
}>;
|
|
1047
1159
|
planId: string;
|
|
1160
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
1161
|
+
connectionRef: string;
|
|
1162
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
1163
|
+
}>>;
|
|
1048
1164
|
declarationDigest: string;
|
|
1049
1165
|
topologyId: string;
|
|
1050
1166
|
platformCommit: string;
|
|
@@ -1098,7 +1214,15 @@ export declare const authorizedHostedTopologyPlanSchema: z.ZodEffects<z.ZodObjec
|
|
|
1098
1214
|
}[];
|
|
1099
1215
|
environment: "production" | "staging";
|
|
1100
1216
|
executable: true;
|
|
1217
|
+
artifacts: Record<string, {
|
|
1218
|
+
digest: string;
|
|
1219
|
+
source: string;
|
|
1220
|
+
}>;
|
|
1101
1221
|
planId: string;
|
|
1222
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
1223
|
+
connectionRef: string;
|
|
1224
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
1225
|
+
}>>;
|
|
1102
1226
|
declarationDigest: string;
|
|
1103
1227
|
topologyId: string;
|
|
1104
1228
|
platformCommit: string;
|
|
@@ -1152,7 +1276,15 @@ export declare const authorizedHostedTopologyPlanSchema: z.ZodEffects<z.ZodObjec
|
|
|
1152
1276
|
}[];
|
|
1153
1277
|
environment: "production" | "staging";
|
|
1154
1278
|
executable: true;
|
|
1279
|
+
artifacts: Record<string, {
|
|
1280
|
+
digest: string;
|
|
1281
|
+
source: string;
|
|
1282
|
+
}>;
|
|
1155
1283
|
planId: string;
|
|
1284
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
1285
|
+
connectionRef: string;
|
|
1286
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
1287
|
+
}>>;
|
|
1156
1288
|
declarationDigest: string;
|
|
1157
1289
|
topologyId: string;
|
|
1158
1290
|
platformCommit: string;
|
|
@@ -1370,7 +1502,7 @@ export type HostedTopologyReceipt = z.infer<typeof hostedTopologyReceiptSchema>;
|
|
|
1370
1502
|
export declare function planHostedTopology(input: {
|
|
1371
1503
|
declaration: HostedTopologyDeclaration;
|
|
1372
1504
|
observations: HostedResourceObservation[];
|
|
1373
|
-
|
|
1505
|
+
connections: Partial<Record<z.infer<typeof hostedProviderSchema>, z.input<typeof hostedConnectionSnapshotSchema>>>;
|
|
1374
1506
|
}): HostedTopologyPlan;
|
|
1375
1507
|
export declare function authorizeHostedTopologyPlan(planInput: HostedTopologyPlan, approvalInput?: HostedTopologyApproval): AuthorizedHostedTopologyPlan;
|
|
1376
1508
|
export declare function verifyHostedTopologyReadback(input: {
|
|
@@ -1415,3 +1547,4 @@ export declare function authorizeHostedTopologyRollback(rollbackInput: z.input<t
|
|
|
1415
1547
|
rollbackDigest: string;
|
|
1416
1548
|
};
|
|
1417
1549
|
};
|
|
1550
|
+
export {};
|
|
@@ -27,6 +27,15 @@ const resourceProviderKinds = {
|
|
|
27
27
|
};
|
|
28
28
|
const sensitiveKey = /(?:credential|password|private.?key|registration.?code|secret|token)/iu;
|
|
29
29
|
const personalPath = /(?:^|[\s'"`:=])(?:\/home\/[^/\s]+|\/Users\/[^/\s]+|[A-Za-z]:\\Users\\[^\\\s]+)/u;
|
|
30
|
+
const runtimeScalar = z.union([z.string().max(4096), z.number().finite(), z.boolean()]);
|
|
31
|
+
const runtimeInputName = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]{0,63}$/u);
|
|
32
|
+
const hostedConnectionSnapshotSchema = z.object({
|
|
33
|
+
connectionRef: identifier,
|
|
34
|
+
nonSecretConfig: z.record(runtimeInputName, runtimeScalar)
|
|
35
|
+
}).strict().superRefine((snapshot, context) => {
|
|
36
|
+
for (const key of Object.keys(snapshot.nonSecretConfig)) if (sensitiveKey.test(key))
|
|
37
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["nonSecretConfig", key], message: "Hosted provider snapshots cannot contain credential-like fields." });
|
|
38
|
+
});
|
|
30
39
|
const hostedResourceDeclarationSchema = z.object({
|
|
31
40
|
id: identifier,
|
|
32
41
|
provider: hostedProviderSchema,
|
|
@@ -72,6 +81,8 @@ const hostedTopologyPlanShape = {
|
|
|
72
81
|
topologyId: identifier,
|
|
73
82
|
environment: z.enum(["staging", "production"]),
|
|
74
83
|
platformCommit: gitCommit,
|
|
84
|
+
artifacts: z.record(identifier, z.object({ digest, source: z.string().url() }).strict()),
|
|
85
|
+
providerConnections: z.record(hostedProviderSchema, hostedConnectionSnapshotSchema),
|
|
75
86
|
actions: z.array(z.object({
|
|
76
87
|
resourceId: identifier,
|
|
77
88
|
provider: hostedProviderSchema,
|
|
@@ -93,12 +104,16 @@ function verifyPlanBinding(plan, context) {
|
|
|
93
104
|
context.addIssue({ code: z.ZodIssueCode.custom, path: ["actions", index, "desiredResource"], message: "Hosted plan action identity must match its desired resource specification." });
|
|
94
105
|
if (deploymentDigest(desired) !== action.desiredDigest)
|
|
95
106
|
context.addIssue({ code: z.ZodIssueCode.custom, path: ["actions", index, "desiredDigest"], message: "Hosted plan desired digest must bind its complete desired resource specification." });
|
|
107
|
+
if (!plan.providerConnections[action.provider] && !plan.blockers.some((blocker) => blocker.code === "connection-unavailable"))
|
|
108
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["providerConnections", action.provider], message: `Hosted plan is missing the selected ${action.provider} connection snapshot.` });
|
|
96
109
|
}
|
|
97
110
|
const core = {
|
|
98
111
|
declarationDigest: plan.declarationDigest,
|
|
99
112
|
topologyId: plan.topologyId,
|
|
100
113
|
environment: plan.environment,
|
|
101
114
|
platformCommit: plan.platformCommit,
|
|
115
|
+
artifacts: plan.artifacts,
|
|
116
|
+
providerConnections: plan.providerConnections,
|
|
102
117
|
actions: plan.actions,
|
|
103
118
|
blockers: plan.blockers
|
|
104
119
|
};
|
|
@@ -194,7 +209,12 @@ function planHostedTopology(input) {
|
|
|
194
209
|
};
|
|
195
210
|
const observations = observationMap(input.observations, normalizedDeclaration);
|
|
196
211
|
const blockers = [];
|
|
197
|
-
|
|
212
|
+
const providerConnections = {};
|
|
213
|
+
for (const [provider, binding] of Object.entries(normalizedDeclaration.providerConnections)) {
|
|
214
|
+
const snapshot = input.connections[provider];
|
|
215
|
+
if (!snapshot || snapshot.connectionRef !== binding.connectionRef) blockers.push({ code: "connection-unavailable", message: `${provider} connection ${binding.connectionRef} is unavailable.` });
|
|
216
|
+
else providerConnections[provider] = hostedConnectionSnapshotSchema.parse(snapshot);
|
|
217
|
+
}
|
|
198
218
|
for (const resourceId of cycleMembers(normalizedDeclaration)) blockers.push({ code: "dependency-cycle", resourceId, message: `Hosted resource ${resourceId} participates in a dependency cycle.` });
|
|
199
219
|
const actions = normalizedDeclaration.resources.map((resource) => {
|
|
200
220
|
const desiredDigest = deploymentDigest(resource);
|
|
@@ -218,7 +238,16 @@ function planHostedTopology(input) {
|
|
|
218
238
|
};
|
|
219
239
|
});
|
|
220
240
|
const declarationDigest = deploymentDigest(normalizedDeclaration);
|
|
221
|
-
const core = {
|
|
241
|
+
const core = {
|
|
242
|
+
declarationDigest,
|
|
243
|
+
topologyId: declaration.id,
|
|
244
|
+
environment: declaration.environment,
|
|
245
|
+
platformCommit: declaration.platform.commit,
|
|
246
|
+
artifacts: normalizedDeclaration.artifacts,
|
|
247
|
+
providerConnections,
|
|
248
|
+
actions,
|
|
249
|
+
blockers
|
|
250
|
+
};
|
|
222
251
|
const planDigest = deploymentDigest(core);
|
|
223
252
|
return hostedTopologyPlanSchema.parse({ schemaVersion: "treeseed.hosted-topology-plan/v1", planId: `topology-plan-${planDigest.slice(7, 23)}`, planDigest, ...core, approvalRequired: actions.some(({ action }) => action !== "noop"), executable: false });
|
|
224
253
|
}
|
|
@@ -84,7 +84,15 @@ export declare const HOSTED_TOPOLOGY_OPERATIONS: {
|
|
|
84
84
|
}[];
|
|
85
85
|
environment: "production" | "staging";
|
|
86
86
|
executable: false;
|
|
87
|
+
artifacts: Record<string, {
|
|
88
|
+
digest: string;
|
|
89
|
+
source: string;
|
|
90
|
+
}>;
|
|
87
91
|
planId: string;
|
|
92
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
93
|
+
connectionRef: string;
|
|
94
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
95
|
+
}>>;
|
|
88
96
|
declarationDigest: string;
|
|
89
97
|
topologyId: string;
|
|
90
98
|
platformCommit: string;
|
|
@@ -143,7 +151,15 @@ export declare const HOSTED_TOPOLOGY_OPERATIONS: {
|
|
|
143
151
|
}[];
|
|
144
152
|
environment: "production" | "staging";
|
|
145
153
|
executable: false;
|
|
154
|
+
artifacts: Record<string, {
|
|
155
|
+
digest: string;
|
|
156
|
+
source: string;
|
|
157
|
+
}>;
|
|
146
158
|
planId: string;
|
|
159
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
160
|
+
connectionRef: string;
|
|
161
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
162
|
+
}>>;
|
|
147
163
|
declarationDigest: string;
|
|
148
164
|
topologyId: string;
|
|
149
165
|
platformCommit: string;
|
|
@@ -87,7 +87,15 @@ export declare const CONTROL_PLANE_OPERATIONS: {
|
|
|
87
87
|
}[];
|
|
88
88
|
environment: "production" | "staging";
|
|
89
89
|
executable: false;
|
|
90
|
+
artifacts: Record<string, {
|
|
91
|
+
digest: string;
|
|
92
|
+
source: string;
|
|
93
|
+
}>;
|
|
90
94
|
planId: string;
|
|
95
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
96
|
+
connectionRef: string;
|
|
97
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
98
|
+
}>>;
|
|
91
99
|
declarationDigest: string;
|
|
92
100
|
topologyId: string;
|
|
93
101
|
platformCommit: string;
|
|
@@ -146,7 +154,15 @@ export declare const CONTROL_PLANE_OPERATIONS: {
|
|
|
146
154
|
}[];
|
|
147
155
|
environment: "production" | "staging";
|
|
148
156
|
executable: false;
|
|
157
|
+
artifacts: Record<string, {
|
|
158
|
+
digest: string;
|
|
159
|
+
source: string;
|
|
160
|
+
}>;
|
|
149
161
|
planId: string;
|
|
162
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
163
|
+
connectionRef: string;
|
|
164
|
+
nonSecretConfig: Record<string, string | number | boolean>;
|
|
165
|
+
}>>;
|
|
150
166
|
declarationDigest: string;
|
|
151
167
|
topologyId: string;
|
|
152
168
|
platformCommit: string;
|