@treeseed/sdk 0.13.0-rc.90 → 0.13.0-rc.92
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/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +6 -6
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +144 -144
- package/dist/capacity-provider/environment-catalog.d.ts +12 -12
- package/dist/capacity-provider/index.d.ts +1 -0
- package/dist/capacity-provider/index.js +1 -0
- package/dist/capacity-provider/install-configuration.d.ts +39 -0
- package/dist/capacity-provider/install-configuration.js +18 -0
- package/dist/configuration/secrets-capability.d.ts +3 -0
- package/dist/configuration/secrets-capability.js +3 -0
- package/dist/content/validation/agent-operational-content-schemas.d.ts +16 -16
- package/dist/content/validation/auxiliary-content-schemas.d.ts +20 -20
- package/dist/content/validation/content-model-schemas.d.ts +304 -304
- package/dist/content/validation/portable-content-data.d.ts +28 -28
- package/dist/deployment/ai-hosting.d.ts +297 -0
- package/dist/deployment/ai-hosting.js +63 -0
- package/dist/deployment/ai-instance.d.ts +48 -0
- package/dist/deployment/ai-instance.js +23 -0
- package/dist/deployment/hosted-topology-template.d.ts +24 -24
- package/dist/deployment/hosted-topology.d.ts +114 -114
- package/dist/deployment/index.d.ts +2 -0
- package/dist/deployment/index.js +2 -0
- package/dist/deployment/schemas.d.ts +38 -38
- package/dist/development/schemas.d.ts +76 -76
- package/dist/operator-contracts/canonical-command-tree.js +3 -10
- package/dist/operator-contracts/catalog/communication-operations.d.ts +5 -5
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +21 -21
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +8 -8
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +29 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +18 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.d.ts +3 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.js +15 -0
- package/dist/operator-contracts/communication/contracts.d.ts +34 -34
- package/dist/operator-contracts/control-plane-operations.d.ts +63 -34
- package/dist/operator-contracts/control-plane-operations.js +3 -17
- package/dist/operator-contracts/inbox/contracts.d.ts +30 -30
- package/dist/operator-contracts/operation-builder.d.ts +1 -0
- package/dist/operator-contracts/operation-builder.js +17 -0
- package/dist/platform/schemas.d.ts +220 -40
- package/dist/platform/schemas.js +7 -2
- package/dist/platform/workset.js +5 -1
- package/dist/secrets-capability/github-actions-encryption.js +1 -1
- package/dist/secrets-capability/provider-operation-contracts.d.ts +14 -0
- package/dist/secrets-capability/service-provider-contracts.d.ts +4 -2
- package/dist/secrets-capability/service-provider-contracts.js +41 -27
- package/dist/secrets-capability/shared-access.d.ts +51 -0
- package/dist/secrets-capability/shared-access.js +36 -0
- package/dist/secrets-capability/shared-resources.d.ts +376 -0
- package/dist/secrets-capability/shared-resources.js +91 -0
- package/dist/secrets-capability/vault-contracts.d.ts +132 -0
- package/dist/secrets-capability/vault-contracts.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type SharedResourceGrant, type ServiceBinding } from './shared-resources.js';
|
|
2
|
+
export interface SharedAccessRequest {
|
|
3
|
+
resourceKind: 'connection' | 'vault';
|
|
4
|
+
resourceId: string;
|
|
5
|
+
ownerTeamId: string | null;
|
|
6
|
+
teamId: string;
|
|
7
|
+
permission: string;
|
|
8
|
+
environment: 'staging' | 'production' | 'shared';
|
|
9
|
+
resourceIdWithinProvider: string;
|
|
10
|
+
projectId?: string;
|
|
11
|
+
assignmentId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CurrentSharingAuthority {
|
|
14
|
+
actorCanUse: boolean;
|
|
15
|
+
ownerOrganizationId: string | null;
|
|
16
|
+
recipientOrganizationId: string | null;
|
|
17
|
+
deploymentAudiencePolicyId: string | null;
|
|
18
|
+
}
|
|
19
|
+
/** Pure policy check only. API supplies fresh trusted authority and atomically reserves quota before execution. */
|
|
20
|
+
export declare function authorizeSharedGrant(input: SharedResourceGrant, request: SharedAccessRequest, authority: CurrentSharingAuthority, now: Date): {
|
|
21
|
+
grantId: string;
|
|
22
|
+
grantVersion: number;
|
|
23
|
+
limits: {
|
|
24
|
+
maxConcurrentOperations: number;
|
|
25
|
+
maxOperationsPerWindow: number;
|
|
26
|
+
windowSeconds: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export interface BindingSelection {
|
|
30
|
+
teamId: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
capability: string;
|
|
33
|
+
environment: ServiceBinding['environment'];
|
|
34
|
+
}
|
|
35
|
+
/** Once bound, never consult a lower-priority default. Eligibility is evaluated by the API after selection. */
|
|
36
|
+
export declare function selectServiceBinding(request: BindingSelection, pinned: ServiceBinding | null, defaults: {
|
|
37
|
+
explicit: ServiceBinding[];
|
|
38
|
+
team: ServiceBinding[];
|
|
39
|
+
organization: ServiceBinding[];
|
|
40
|
+
deployment: ServiceBinding[];
|
|
41
|
+
}): {
|
|
42
|
+
id: string;
|
|
43
|
+
version: number;
|
|
44
|
+
projectId: string;
|
|
45
|
+
teamId: string;
|
|
46
|
+
environment: "production" | "staging" | "shared";
|
|
47
|
+
capability: string;
|
|
48
|
+
connectionId: string;
|
|
49
|
+
grantId: string | null;
|
|
50
|
+
ownerTeamId: string;
|
|
51
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { sharedResourceGrantSchema, serviceBindingSchema } from "./shared-resources.js";
|
|
2
|
+
function authorizeSharedGrant(input, request, authority, now) {
|
|
3
|
+
const grant = sharedResourceGrantSchema.parse(input);
|
|
4
|
+
const deny = (reason) => {
|
|
5
|
+
throw new Error(reason);
|
|
6
|
+
};
|
|
7
|
+
if (!Number.isFinite(now.getTime())) deny("invalid_authorization_time");
|
|
8
|
+
if (!authority.actorCanUse) deny("actor_not_authorized");
|
|
9
|
+
if (grant.status !== "active" || grant.expiresAt && Date.parse(grant.expiresAt) <= now.getTime()) deny("grant_inactive");
|
|
10
|
+
if (grant.recipientTeamId !== request.teamId || grant.resource.kind !== request.resourceKind || grant.resource.id !== request.resourceId || grant.resource.ownerTeamId !== request.ownerTeamId) deny("grant_resource_mismatch");
|
|
11
|
+
if (grant.authority.kind === "organization") {
|
|
12
|
+
if (authority.ownerOrganizationId !== grant.authority.organizationId || authority.recipientOrganizationId !== grant.authority.organizationId) deny("organization_membership_required");
|
|
13
|
+
} else if (authority.deploymentAudiencePolicyId !== grant.authority.audiencePolicyId) deny("deployment_audience_required");
|
|
14
|
+
if (!grant.permissions.includes(request.permission) || grant.scope.environment !== request.environment || !grant.scope.resourceIds.includes(request.resourceIdWithinProvider)) deny("grant_scope_mismatch");
|
|
15
|
+
if (grant.scope.projectIds.length && (!request.projectId || !grant.scope.projectIds.includes(request.projectId))) deny("project_scope_mismatch");
|
|
16
|
+
if (grant.scope.assignmentIds.length && (!request.assignmentId || !grant.scope.assignmentIds.includes(request.assignmentId))) deny("assignment_scope_mismatch");
|
|
17
|
+
return { grantId: grant.id, grantVersion: grant.version, limits: { ...grant.limits } };
|
|
18
|
+
}
|
|
19
|
+
function selectServiceBinding(request, pinned, defaults) {
|
|
20
|
+
const matches = (value) => value.teamId === request.teamId && value.projectId === request.projectId && value.capability === request.capability && value.environment === request.environment;
|
|
21
|
+
if (pinned) {
|
|
22
|
+
const binding = serviceBindingSchema.parse(pinned);
|
|
23
|
+
if (!matches(binding)) throw new Error("binding_scope_mismatch");
|
|
24
|
+
return binding;
|
|
25
|
+
}
|
|
26
|
+
for (const tier of ["explicit", "team", "organization", "deployment"]) {
|
|
27
|
+
const candidates = defaults[tier].map((value) => serviceBindingSchema.parse(value)).filter(matches);
|
|
28
|
+
if (candidates.length > 1) throw new Error("ambiguous_service_default");
|
|
29
|
+
if (candidates[0]) return candidates[0];
|
|
30
|
+
}
|
|
31
|
+
throw new Error("service_binding_unavailable");
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
authorizeSharedGrant,
|
|
35
|
+
selectServiceBinding
|
|
36
|
+
};
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const organizationSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
version: z.ZodNumber;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
id: string;
|
|
8
|
+
version: number;
|
|
9
|
+
name: string;
|
|
10
|
+
}, {
|
|
11
|
+
id: string;
|
|
12
|
+
version: number;
|
|
13
|
+
name: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const organizationMemberSchema: z.ZodObject<{
|
|
16
|
+
organizationId: z.ZodString;
|
|
17
|
+
userId: z.ZodString;
|
|
18
|
+
role: z.ZodEnum<["owner", "admin", "member"]>;
|
|
19
|
+
version: z.ZodNumber;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
role: "owner" | "admin" | "member";
|
|
22
|
+
version: number;
|
|
23
|
+
organizationId: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
}, {
|
|
26
|
+
role: "owner" | "admin" | "member";
|
|
27
|
+
version: number;
|
|
28
|
+
organizationId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const organizationTeamSchema: z.ZodObject<{
|
|
32
|
+
teamId: z.ZodString;
|
|
33
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
34
|
+
version: z.ZodNumber;
|
|
35
|
+
}, "strict", z.ZodTypeAny, {
|
|
36
|
+
version: number;
|
|
37
|
+
teamId: string;
|
|
38
|
+
organizationId: string | null;
|
|
39
|
+
}, {
|
|
40
|
+
version: number;
|
|
41
|
+
teamId: string;
|
|
42
|
+
organizationId: string | null;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const organizationTeamInvitationSchema: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
organizationId: z.ZodString;
|
|
47
|
+
teamId: z.ZodString;
|
|
48
|
+
organizationAuthorizedBy: z.ZodString;
|
|
49
|
+
teamAuthorizedBy: z.ZodNullable<z.ZodString>;
|
|
50
|
+
expiresAt: z.ZodString;
|
|
51
|
+
status: z.ZodEnum<["pending", "accepted", "rejected", "revoked", "expired"]>;
|
|
52
|
+
version: z.ZodNumber;
|
|
53
|
+
}, "strict", z.ZodTypeAny, {
|
|
54
|
+
status: "rejected" | "revoked" | "expired" | "pending" | "accepted";
|
|
55
|
+
id: string;
|
|
56
|
+
version: number;
|
|
57
|
+
teamId: string;
|
|
58
|
+
expiresAt: string;
|
|
59
|
+
organizationId: string;
|
|
60
|
+
organizationAuthorizedBy: string;
|
|
61
|
+
teamAuthorizedBy: string | null;
|
|
62
|
+
}, {
|
|
63
|
+
status: "rejected" | "revoked" | "expired" | "pending" | "accepted";
|
|
64
|
+
id: string;
|
|
65
|
+
version: number;
|
|
66
|
+
teamId: string;
|
|
67
|
+
expiresAt: string;
|
|
68
|
+
organizationId: string;
|
|
69
|
+
organizationAuthorizedBy: string;
|
|
70
|
+
teamAuthorizedBy: string | null;
|
|
71
|
+
}>;
|
|
72
|
+
export declare const sharedResourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"connection">;
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
ownerTeamId: z.ZodString;
|
|
76
|
+
}, "strict", z.ZodTypeAny, {
|
|
77
|
+
kind: "connection";
|
|
78
|
+
id: string;
|
|
79
|
+
ownerTeamId: string;
|
|
80
|
+
}, {
|
|
81
|
+
kind: "connection";
|
|
82
|
+
id: string;
|
|
83
|
+
ownerTeamId: string;
|
|
84
|
+
}>, z.ZodObject<{
|
|
85
|
+
kind: z.ZodLiteral<"vault">;
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
ownerTeamId: z.ZodNullable<z.ZodString>;
|
|
88
|
+
}, "strict", z.ZodTypeAny, {
|
|
89
|
+
kind: "vault";
|
|
90
|
+
id: string;
|
|
91
|
+
ownerTeamId: string | null;
|
|
92
|
+
}, {
|
|
93
|
+
kind: "vault";
|
|
94
|
+
id: string;
|
|
95
|
+
ownerTeamId: string | null;
|
|
96
|
+
}>]>;
|
|
97
|
+
export declare const sharedResourceGrantSchema: z.ZodEffects<z.ZodObject<{
|
|
98
|
+
id: z.ZodString;
|
|
99
|
+
resource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
100
|
+
kind: z.ZodLiteral<"connection">;
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
ownerTeamId: z.ZodString;
|
|
103
|
+
}, "strict", z.ZodTypeAny, {
|
|
104
|
+
kind: "connection";
|
|
105
|
+
id: string;
|
|
106
|
+
ownerTeamId: string;
|
|
107
|
+
}, {
|
|
108
|
+
kind: "connection";
|
|
109
|
+
id: string;
|
|
110
|
+
ownerTeamId: string;
|
|
111
|
+
}>, z.ZodObject<{
|
|
112
|
+
kind: z.ZodLiteral<"vault">;
|
|
113
|
+
id: z.ZodString;
|
|
114
|
+
ownerTeamId: z.ZodNullable<z.ZodString>;
|
|
115
|
+
}, "strict", z.ZodTypeAny, {
|
|
116
|
+
kind: "vault";
|
|
117
|
+
id: string;
|
|
118
|
+
ownerTeamId: string | null;
|
|
119
|
+
}, {
|
|
120
|
+
kind: "vault";
|
|
121
|
+
id: string;
|
|
122
|
+
ownerTeamId: string | null;
|
|
123
|
+
}>]>;
|
|
124
|
+
recipientTeamId: z.ZodString;
|
|
125
|
+
authority: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
126
|
+
kind: z.ZodLiteral<"organization">;
|
|
127
|
+
organizationId: z.ZodString;
|
|
128
|
+
}, "strict", z.ZodTypeAny, {
|
|
129
|
+
kind: "organization";
|
|
130
|
+
organizationId: string;
|
|
131
|
+
}, {
|
|
132
|
+
kind: "organization";
|
|
133
|
+
organizationId: string;
|
|
134
|
+
}>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"deployment">;
|
|
136
|
+
audiencePolicyId: z.ZodString;
|
|
137
|
+
}, "strict", z.ZodTypeAny, {
|
|
138
|
+
kind: "deployment";
|
|
139
|
+
audiencePolicyId: string;
|
|
140
|
+
}, {
|
|
141
|
+
kind: "deployment";
|
|
142
|
+
audiencePolicyId: string;
|
|
143
|
+
}>]>;
|
|
144
|
+
origin: z.ZodEnum<["explicit", "default-policy"]>;
|
|
145
|
+
defaultPolicyId: z.ZodNullable<z.ZodString>;
|
|
146
|
+
permissions: z.ZodArray<z.ZodString, "many">;
|
|
147
|
+
scope: z.ZodObject<{
|
|
148
|
+
environment: z.ZodEnum<["staging", "production", "shared"]>;
|
|
149
|
+
resourceIds: z.ZodArray<z.ZodString, "many">;
|
|
150
|
+
projectIds: z.ZodArray<z.ZodString, "many">;
|
|
151
|
+
assignmentIds: z.ZodArray<z.ZodString, "many">;
|
|
152
|
+
}, "strict", z.ZodTypeAny, {
|
|
153
|
+
environment: "production" | "staging" | "shared";
|
|
154
|
+
projectIds: string[];
|
|
155
|
+
resourceIds: string[];
|
|
156
|
+
assignmentIds: string[];
|
|
157
|
+
}, {
|
|
158
|
+
environment: "production" | "staging" | "shared";
|
|
159
|
+
projectIds: string[];
|
|
160
|
+
resourceIds: string[];
|
|
161
|
+
assignmentIds: string[];
|
|
162
|
+
}>;
|
|
163
|
+
limits: z.ZodObject<{
|
|
164
|
+
maxConcurrentOperations: z.ZodNumber;
|
|
165
|
+
maxOperationsPerWindow: z.ZodNumber;
|
|
166
|
+
windowSeconds: z.ZodNumber;
|
|
167
|
+
}, "strict", z.ZodTypeAny, {
|
|
168
|
+
maxConcurrentOperations: number;
|
|
169
|
+
maxOperationsPerWindow: number;
|
|
170
|
+
windowSeconds: number;
|
|
171
|
+
}, {
|
|
172
|
+
maxConcurrentOperations: number;
|
|
173
|
+
maxOperationsPerWindow: number;
|
|
174
|
+
windowSeconds: number;
|
|
175
|
+
}>;
|
|
176
|
+
status: z.ZodEnum<["active", "revoked"]>;
|
|
177
|
+
version: z.ZodNumber;
|
|
178
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
179
|
+
}, "strict", z.ZodTypeAny, {
|
|
180
|
+
status: "revoked" | "active";
|
|
181
|
+
id: string;
|
|
182
|
+
version: number;
|
|
183
|
+
scope: {
|
|
184
|
+
environment: "production" | "staging" | "shared";
|
|
185
|
+
projectIds: string[];
|
|
186
|
+
resourceIds: string[];
|
|
187
|
+
assignmentIds: string[];
|
|
188
|
+
};
|
|
189
|
+
expiresAt: string | null;
|
|
190
|
+
origin: "explicit" | "default-policy";
|
|
191
|
+
resource: {
|
|
192
|
+
kind: "connection";
|
|
193
|
+
id: string;
|
|
194
|
+
ownerTeamId: string;
|
|
195
|
+
} | {
|
|
196
|
+
kind: "vault";
|
|
197
|
+
id: string;
|
|
198
|
+
ownerTeamId: string | null;
|
|
199
|
+
};
|
|
200
|
+
authority: {
|
|
201
|
+
kind: "organization";
|
|
202
|
+
organizationId: string;
|
|
203
|
+
} | {
|
|
204
|
+
kind: "deployment";
|
|
205
|
+
audiencePolicyId: string;
|
|
206
|
+
};
|
|
207
|
+
limits: {
|
|
208
|
+
maxConcurrentOperations: number;
|
|
209
|
+
maxOperationsPerWindow: number;
|
|
210
|
+
windowSeconds: number;
|
|
211
|
+
};
|
|
212
|
+
permissions: string[];
|
|
213
|
+
recipientTeamId: string;
|
|
214
|
+
defaultPolicyId: string | null;
|
|
215
|
+
}, {
|
|
216
|
+
status: "revoked" | "active";
|
|
217
|
+
id: string;
|
|
218
|
+
version: number;
|
|
219
|
+
scope: {
|
|
220
|
+
environment: "production" | "staging" | "shared";
|
|
221
|
+
projectIds: string[];
|
|
222
|
+
resourceIds: string[];
|
|
223
|
+
assignmentIds: string[];
|
|
224
|
+
};
|
|
225
|
+
expiresAt: string | null;
|
|
226
|
+
origin: "explicit" | "default-policy";
|
|
227
|
+
resource: {
|
|
228
|
+
kind: "connection";
|
|
229
|
+
id: string;
|
|
230
|
+
ownerTeamId: string;
|
|
231
|
+
} | {
|
|
232
|
+
kind: "vault";
|
|
233
|
+
id: string;
|
|
234
|
+
ownerTeamId: string | null;
|
|
235
|
+
};
|
|
236
|
+
authority: {
|
|
237
|
+
kind: "organization";
|
|
238
|
+
organizationId: string;
|
|
239
|
+
} | {
|
|
240
|
+
kind: "deployment";
|
|
241
|
+
audiencePolicyId: string;
|
|
242
|
+
};
|
|
243
|
+
limits: {
|
|
244
|
+
maxConcurrentOperations: number;
|
|
245
|
+
maxOperationsPerWindow: number;
|
|
246
|
+
windowSeconds: number;
|
|
247
|
+
};
|
|
248
|
+
permissions: string[];
|
|
249
|
+
recipientTeamId: string;
|
|
250
|
+
defaultPolicyId: string | null;
|
|
251
|
+
}>, {
|
|
252
|
+
status: "revoked" | "active";
|
|
253
|
+
id: string;
|
|
254
|
+
version: number;
|
|
255
|
+
scope: {
|
|
256
|
+
environment: "production" | "staging" | "shared";
|
|
257
|
+
projectIds: string[];
|
|
258
|
+
resourceIds: string[];
|
|
259
|
+
assignmentIds: string[];
|
|
260
|
+
};
|
|
261
|
+
expiresAt: string | null;
|
|
262
|
+
origin: "explicit" | "default-policy";
|
|
263
|
+
resource: {
|
|
264
|
+
kind: "connection";
|
|
265
|
+
id: string;
|
|
266
|
+
ownerTeamId: string;
|
|
267
|
+
} | {
|
|
268
|
+
kind: "vault";
|
|
269
|
+
id: string;
|
|
270
|
+
ownerTeamId: string | null;
|
|
271
|
+
};
|
|
272
|
+
authority: {
|
|
273
|
+
kind: "organization";
|
|
274
|
+
organizationId: string;
|
|
275
|
+
} | {
|
|
276
|
+
kind: "deployment";
|
|
277
|
+
audiencePolicyId: string;
|
|
278
|
+
};
|
|
279
|
+
limits: {
|
|
280
|
+
maxConcurrentOperations: number;
|
|
281
|
+
maxOperationsPerWindow: number;
|
|
282
|
+
windowSeconds: number;
|
|
283
|
+
};
|
|
284
|
+
permissions: string[];
|
|
285
|
+
recipientTeamId: string;
|
|
286
|
+
defaultPolicyId: string | null;
|
|
287
|
+
}, {
|
|
288
|
+
status: "revoked" | "active";
|
|
289
|
+
id: string;
|
|
290
|
+
version: number;
|
|
291
|
+
scope: {
|
|
292
|
+
environment: "production" | "staging" | "shared";
|
|
293
|
+
projectIds: string[];
|
|
294
|
+
resourceIds: string[];
|
|
295
|
+
assignmentIds: string[];
|
|
296
|
+
};
|
|
297
|
+
expiresAt: string | null;
|
|
298
|
+
origin: "explicit" | "default-policy";
|
|
299
|
+
resource: {
|
|
300
|
+
kind: "connection";
|
|
301
|
+
id: string;
|
|
302
|
+
ownerTeamId: string;
|
|
303
|
+
} | {
|
|
304
|
+
kind: "vault";
|
|
305
|
+
id: string;
|
|
306
|
+
ownerTeamId: string | null;
|
|
307
|
+
};
|
|
308
|
+
authority: {
|
|
309
|
+
kind: "organization";
|
|
310
|
+
organizationId: string;
|
|
311
|
+
} | {
|
|
312
|
+
kind: "deployment";
|
|
313
|
+
audiencePolicyId: string;
|
|
314
|
+
};
|
|
315
|
+
limits: {
|
|
316
|
+
maxConcurrentOperations: number;
|
|
317
|
+
maxOperationsPerWindow: number;
|
|
318
|
+
windowSeconds: number;
|
|
319
|
+
};
|
|
320
|
+
permissions: string[];
|
|
321
|
+
recipientTeamId: string;
|
|
322
|
+
defaultPolicyId: string | null;
|
|
323
|
+
}>;
|
|
324
|
+
export type SharedResourceGrant = z.infer<typeof sharedResourceGrantSchema>;
|
|
325
|
+
export declare const serviceBindingSchema: z.ZodEffects<z.ZodObject<{
|
|
326
|
+
id: z.ZodString;
|
|
327
|
+
teamId: z.ZodString;
|
|
328
|
+
projectId: z.ZodString;
|
|
329
|
+
capability: z.ZodString;
|
|
330
|
+
environment: z.ZodEnum<["staging", "production", "shared"]>;
|
|
331
|
+
connectionId: z.ZodString;
|
|
332
|
+
ownerTeamId: z.ZodString;
|
|
333
|
+
grantId: z.ZodNullable<z.ZodString>;
|
|
334
|
+
version: z.ZodNumber;
|
|
335
|
+
}, "strict", z.ZodTypeAny, {
|
|
336
|
+
id: string;
|
|
337
|
+
version: number;
|
|
338
|
+
projectId: string;
|
|
339
|
+
teamId: string;
|
|
340
|
+
environment: "production" | "staging" | "shared";
|
|
341
|
+
capability: string;
|
|
342
|
+
connectionId: string;
|
|
343
|
+
grantId: string | null;
|
|
344
|
+
ownerTeamId: string;
|
|
345
|
+
}, {
|
|
346
|
+
id: string;
|
|
347
|
+
version: number;
|
|
348
|
+
projectId: string;
|
|
349
|
+
teamId: string;
|
|
350
|
+
environment: "production" | "staging" | "shared";
|
|
351
|
+
capability: string;
|
|
352
|
+
connectionId: string;
|
|
353
|
+
grantId: string | null;
|
|
354
|
+
ownerTeamId: string;
|
|
355
|
+
}>, {
|
|
356
|
+
id: string;
|
|
357
|
+
version: number;
|
|
358
|
+
projectId: string;
|
|
359
|
+
teamId: string;
|
|
360
|
+
environment: "production" | "staging" | "shared";
|
|
361
|
+
capability: string;
|
|
362
|
+
connectionId: string;
|
|
363
|
+
grantId: string | null;
|
|
364
|
+
ownerTeamId: string;
|
|
365
|
+
}, {
|
|
366
|
+
id: string;
|
|
367
|
+
version: number;
|
|
368
|
+
projectId: string;
|
|
369
|
+
teamId: string;
|
|
370
|
+
environment: "production" | "staging" | "shared";
|
|
371
|
+
capability: string;
|
|
372
|
+
connectionId: string;
|
|
373
|
+
grantId: string | null;
|
|
374
|
+
ownerTeamId: string;
|
|
375
|
+
}>;
|
|
376
|
+
export type ServiceBinding = z.infer<typeof serviceBindingSchema>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const id = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u);
|
|
3
|
+
const version = z.number().int().nonnegative().safe();
|
|
4
|
+
const environment = z.enum(["staging", "production", "shared"]);
|
|
5
|
+
const timestamp = z.string().datetime();
|
|
6
|
+
const organizationSchema = z.object({
|
|
7
|
+
id,
|
|
8
|
+
name: z.string().trim().min(1).max(160),
|
|
9
|
+
version
|
|
10
|
+
}).strict();
|
|
11
|
+
const organizationMemberSchema = z.object({
|
|
12
|
+
organizationId: id,
|
|
13
|
+
userId: id,
|
|
14
|
+
role: z.enum(["owner", "admin", "member"]),
|
|
15
|
+
version
|
|
16
|
+
}).strict();
|
|
17
|
+
const organizationTeamSchema = z.object({
|
|
18
|
+
teamId: id,
|
|
19
|
+
organizationId: id.nullable(),
|
|
20
|
+
version
|
|
21
|
+
}).strict();
|
|
22
|
+
const organizationTeamInvitationSchema = z.object({
|
|
23
|
+
id,
|
|
24
|
+
organizationId: id,
|
|
25
|
+
teamId: id,
|
|
26
|
+
organizationAuthorizedBy: id,
|
|
27
|
+
teamAuthorizedBy: id.nullable(),
|
|
28
|
+
expiresAt: timestamp,
|
|
29
|
+
status: z.enum(["pending", "accepted", "rejected", "revoked", "expired"]),
|
|
30
|
+
version
|
|
31
|
+
}).strict();
|
|
32
|
+
const sharedResourceSchema = z.discriminatedUnion("kind", [
|
|
33
|
+
z.object({ kind: z.literal("connection"), id, ownerTeamId: id }).strict(),
|
|
34
|
+
z.object({ kind: z.literal("vault"), id, ownerTeamId: id.nullable() }).strict()
|
|
35
|
+
]);
|
|
36
|
+
const sharedResourceGrantSchema = z.object({
|
|
37
|
+
id,
|
|
38
|
+
resource: sharedResourceSchema,
|
|
39
|
+
recipientTeamId: id,
|
|
40
|
+
authority: z.discriminatedUnion("kind", [
|
|
41
|
+
z.object({ kind: z.literal("organization"), organizationId: id }).strict(),
|
|
42
|
+
z.object({ kind: z.literal("deployment"), audiencePolicyId: id }).strict()
|
|
43
|
+
]),
|
|
44
|
+
origin: z.enum(["explicit", "default-policy"]),
|
|
45
|
+
defaultPolicyId: id.nullable(),
|
|
46
|
+
permissions: z.array(id).min(1),
|
|
47
|
+
scope: z.object({
|
|
48
|
+
environment,
|
|
49
|
+
resourceIds: z.array(z.string().min(1).max(512)).min(1),
|
|
50
|
+
projectIds: z.array(id),
|
|
51
|
+
assignmentIds: z.array(id)
|
|
52
|
+
}).strict(),
|
|
53
|
+
limits: z.object({
|
|
54
|
+
maxConcurrentOperations: z.number().int().positive().safe(),
|
|
55
|
+
maxOperationsPerWindow: z.number().int().positive().safe(),
|
|
56
|
+
windowSeconds: z.number().int().positive().safe()
|
|
57
|
+
}).strict(),
|
|
58
|
+
status: z.enum(["active", "revoked"]),
|
|
59
|
+
version,
|
|
60
|
+
expiresAt: timestamp.nullable()
|
|
61
|
+
}).strict().superRefine((grant, context) => {
|
|
62
|
+
if (grant.origin === "default-policy" !== (grant.defaultPolicyId !== null))
|
|
63
|
+
context.addIssue({ code: "custom", path: ["defaultPolicyId"], message: "Default grants require exactly one policy reference." });
|
|
64
|
+
if (grant.authority.kind === "organization" && grant.resource.ownerTeamId === null)
|
|
65
|
+
context.addIssue({ code: "custom", path: ["resource", "ownerTeamId"], message: "Organization resources require an owning team." });
|
|
66
|
+
if (grant.scope.resourceIds.includes("*"))
|
|
67
|
+
context.addIssue({ code: "custom", path: ["scope", "resourceIds"], message: "Unbounded resource grants are prohibited." });
|
|
68
|
+
});
|
|
69
|
+
const serviceBindingSchema = z.object({
|
|
70
|
+
id,
|
|
71
|
+
teamId: id,
|
|
72
|
+
projectId: id,
|
|
73
|
+
capability: id,
|
|
74
|
+
environment,
|
|
75
|
+
connectionId: id,
|
|
76
|
+
ownerTeamId: id,
|
|
77
|
+
grantId: id.nullable(),
|
|
78
|
+
version
|
|
79
|
+
}).strict().superRefine((binding, context) => {
|
|
80
|
+
if (binding.teamId !== binding.ownerTeamId && binding.grantId === null)
|
|
81
|
+
context.addIssue({ code: "custom", path: ["grantId"], message: "Shared bindings require a grant." });
|
|
82
|
+
});
|
|
83
|
+
export {
|
|
84
|
+
organizationMemberSchema,
|
|
85
|
+
organizationSchema,
|
|
86
|
+
organizationTeamInvitationSchema,
|
|
87
|
+
organizationTeamSchema,
|
|
88
|
+
serviceBindingSchema,
|
|
89
|
+
sharedResourceGrantSchema,
|
|
90
|
+
sharedResourceSchema
|
|
91
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Configuration validation is not DNS/routing authorization; Deployment enforces transport policy. */
|
|
3
|
+
export declare const vaultDescriptorSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
ownerTeamId: z.ZodNullable<z.ZodString>;
|
|
6
|
+
displayName: z.ZodString;
|
|
7
|
+
backend: z.ZodEnum<["managed-openbao", "external-openbao", "hashicorp-vault"]>;
|
|
8
|
+
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
9
|
+
secretsMount: z.ZodEffects<z.ZodString, string, string>;
|
|
10
|
+
namespace: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
11
|
+
networkRouteId: z.ZodString;
|
|
12
|
+
tlsTrustId: z.ZodString;
|
|
13
|
+
authentication: z.ZodObject<{
|
|
14
|
+
method: z.ZodLiteral<"approle">;
|
|
15
|
+
mount: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
roleId: z.ZodString;
|
|
17
|
+
bootstrapCredentialRef: z.ZodString;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
method: "approle";
|
|
20
|
+
mount: string;
|
|
21
|
+
roleId: string;
|
|
22
|
+
bootstrapCredentialRef: string;
|
|
23
|
+
}, {
|
|
24
|
+
method: "approle";
|
|
25
|
+
mount: string;
|
|
26
|
+
roleId: string;
|
|
27
|
+
bootstrapCredentialRef: string;
|
|
28
|
+
}>;
|
|
29
|
+
status: z.ZodEnum<["unverified", "ready", "unavailable", "revoked"]>;
|
|
30
|
+
version: z.ZodNumber;
|
|
31
|
+
}, "strict", z.ZodTypeAny, {
|
|
32
|
+
status: "revoked" | "ready" | "unavailable" | "unverified";
|
|
33
|
+
id: string;
|
|
34
|
+
version: number;
|
|
35
|
+
authentication: {
|
|
36
|
+
method: "approle";
|
|
37
|
+
mount: string;
|
|
38
|
+
roleId: string;
|
|
39
|
+
bootstrapCredentialRef: string;
|
|
40
|
+
};
|
|
41
|
+
displayName: string;
|
|
42
|
+
endpoint: string;
|
|
43
|
+
namespace: string | null;
|
|
44
|
+
backend: "managed-openbao" | "external-openbao" | "hashicorp-vault";
|
|
45
|
+
ownerTeamId: string | null;
|
|
46
|
+
secretsMount: string;
|
|
47
|
+
networkRouteId: string;
|
|
48
|
+
tlsTrustId: string;
|
|
49
|
+
}, {
|
|
50
|
+
status: "revoked" | "ready" | "unavailable" | "unverified";
|
|
51
|
+
id: string;
|
|
52
|
+
version: number;
|
|
53
|
+
authentication: {
|
|
54
|
+
method: "approle";
|
|
55
|
+
mount: string;
|
|
56
|
+
roleId: string;
|
|
57
|
+
bootstrapCredentialRef: string;
|
|
58
|
+
};
|
|
59
|
+
displayName: string;
|
|
60
|
+
endpoint: string;
|
|
61
|
+
namespace: string | null;
|
|
62
|
+
backend: "managed-openbao" | "external-openbao" | "hashicorp-vault";
|
|
63
|
+
ownerTeamId: string | null;
|
|
64
|
+
secretsMount: string;
|
|
65
|
+
networkRouteId: string;
|
|
66
|
+
tlsTrustId: string;
|
|
67
|
+
}>;
|
|
68
|
+
export type VaultDescriptor = z.infer<typeof vaultDescriptorSchema>;
|
|
69
|
+
export declare const vaultAllocationSchema: z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
vaultId: z.ZodString;
|
|
72
|
+
teamId: z.ZodString;
|
|
73
|
+
grantId: z.ZodNullable<z.ZodString>;
|
|
74
|
+
pathPrefix: z.ZodEffects<z.ZodString, string, string>;
|
|
75
|
+
permissions: z.ZodArray<z.ZodEnum<["read", "write", "delete"]>, "many">;
|
|
76
|
+
version: z.ZodNumber;
|
|
77
|
+
}, "strict", z.ZodTypeAny, {
|
|
78
|
+
id: string;
|
|
79
|
+
version: number;
|
|
80
|
+
teamId: string;
|
|
81
|
+
grantId: string | null;
|
|
82
|
+
permissions: ("read" | "write" | "delete")[];
|
|
83
|
+
vaultId: string;
|
|
84
|
+
pathPrefix: string;
|
|
85
|
+
}, {
|
|
86
|
+
id: string;
|
|
87
|
+
version: number;
|
|
88
|
+
teamId: string;
|
|
89
|
+
grantId: string | null;
|
|
90
|
+
permissions: ("read" | "write" | "delete")[];
|
|
91
|
+
vaultId: string;
|
|
92
|
+
pathPrefix: string;
|
|
93
|
+
}>;
|
|
94
|
+
export declare const vaultCredentialReferenceSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
|
|
95
|
+
mode: z.ZodLiteral<"managed">;
|
|
96
|
+
vaultId: z.ZodString;
|
|
97
|
+
allocationId: z.ZodString;
|
|
98
|
+
recordPath: z.ZodEffects<z.ZodString, string, string>;
|
|
99
|
+
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
mode: "managed";
|
|
101
|
+
vaultId: string;
|
|
102
|
+
allocationId: string;
|
|
103
|
+
recordPath: string;
|
|
104
|
+
}, {
|
|
105
|
+
mode: "managed";
|
|
106
|
+
vaultId: string;
|
|
107
|
+
allocationId: string;
|
|
108
|
+
recordPath: string;
|
|
109
|
+
}>, z.ZodObject<{
|
|
110
|
+
mode: z.ZodLiteral<"existing">;
|
|
111
|
+
vaultId: z.ZodString;
|
|
112
|
+
allocationId: z.ZodString;
|
|
113
|
+
recordPath: z.ZodEffects<z.ZodString, string, string>;
|
|
114
|
+
fieldMapping: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
|
|
115
|
+
pinnedVersion: z.ZodNullable<z.ZodNumber>;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
mode: "existing";
|
|
118
|
+
vaultId: string;
|
|
119
|
+
allocationId: string;
|
|
120
|
+
recordPath: string;
|
|
121
|
+
fieldMapping: Record<string, string>;
|
|
122
|
+
pinnedVersion: number | null;
|
|
123
|
+
}, {
|
|
124
|
+
mode: "existing";
|
|
125
|
+
vaultId: string;
|
|
126
|
+
allocationId: string;
|
|
127
|
+
recordPath: string;
|
|
128
|
+
fieldMapping: Record<string, string>;
|
|
129
|
+
pinnedVersion: number | null;
|
|
130
|
+
}>]>;
|
|
131
|
+
export type VaultCredentialReference = z.infer<typeof vaultCredentialReferenceSchema>;
|
|
132
|
+
export declare function assertCredentialRecordMutation(reference: VaultCredentialReference): void;
|