@spacefast/common 0.0.13 → 0.0.17
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/agents/client-registry.d.ts +22 -0
- package/dist/agents/client-registry.js +41 -0
- package/dist/agents/connect-targets.d.ts +51 -6
- package/dist/agents/connect-targets.js +93 -28
- package/dist/brand.d.ts +0 -11
- package/dist/brand.js +0 -20
- package/dist/config/domains.d.ts +15 -6
- package/dist/config/domains.js +24 -10
- package/dist/config/postgres-budget.d.ts +3 -0
- package/dist/config/postgres-budget.js +6 -1
- package/dist/config/postgres-budget.json +2 -1
- package/dist/contracts/abuse.js +1 -1
- package/dist/contracts/access.d.ts +149 -44
- package/dist/contracts/access.js +94 -8
- package/dist/contracts/activity.js +5 -1
- package/dist/contracts/api-keys.js +9 -9
- package/dist/contracts/archives.js +11 -11
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/builds.js +14 -14
- package/dist/contracts/channels.js +2 -2
- package/dist/contracts/comments.d.ts +86 -15
- package/dist/contracts/comments.js +116 -20
- package/dist/contracts/common.d.ts +12 -12
- package/dist/contracts/common.js +33 -30
- package/dist/contracts/continuation.js +5 -5
- package/dist/contracts/data-source-routes.js +1 -1
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +12 -12
- package/dist/contracts/docs.d.ts +10 -10
- package/dist/contracts/domains.js +39 -33
- package/dist/contracts/enums.d.ts +2 -10
- package/dist/contracts/enums.js +0 -2
- package/dist/contracts/error-code-meta.d.ts +116 -47
- package/dist/contracts/error-code-meta.js +37 -16
- package/dist/contracts/error-codes.d.ts +7 -4
- package/dist/contracts/error-codes.js +46 -21
- package/dist/contracts/events.d.ts +10 -3
- package/dist/contracts/events.js +33 -5
- package/dist/contracts/execution.d.ts +26 -0
- package/dist/contracts/execution.js +21 -0
- package/dist/contracts/feature-lifecycle.d.ts +21 -24
- package/dist/contracts/feature-lifecycle.js +28 -26
- package/dist/contracts/features.js +4 -4
- package/dist/contracts/functions.d.ts +8 -140
- package/dist/contracts/functions.js +9 -19
- package/dist/contracts/git.d.ts +1 -1
- package/dist/contracts/grants.d.ts +96 -79
- package/dist/contracts/grants.js +130 -43
- package/dist/contracts/ids.d.ts +2 -2
- package/dist/contracts/ids.js +2 -4
- package/dist/contracts/internal.js +2 -2
- package/dist/contracts/mcp.d.ts +17 -556
- package/dist/contracts/mcp.js +9 -103
- package/dist/contracts/me.js +3 -4
- package/dist/contracts/notifications.d.ts +108 -0
- package/dist/contracts/notifications.js +54 -0
- package/dist/contracts/oauth-resources.d.ts +18 -1
- package/dist/contracts/oauth-resources.js +22 -2
- package/dist/contracts/operations.d.ts +2 -50
- package/dist/contracts/operations.js +0 -19
- package/dist/contracts/pages.d.ts +8 -4
- package/dist/contracts/pages.js +16 -3
- package/dist/contracts/platform.js +10 -8
- package/dist/contracts/problem-document.d.ts +14 -0
- package/dist/contracts/problem-document.js +35 -0
- package/dist/contracts/push-new.d.ts +21 -6
- package/dist/contracts/push-new.js +3 -7
- package/dist/contracts/resources.d.ts +8 -7
- package/dist/contracts/resources.js +9 -6
- package/dist/contracts/runtime-api.d.ts +162 -92
- package/dist/contracts/runtime-api.js +99 -27
- package/dist/contracts/runtime-app.d.ts +41 -11
- package/dist/contracts/runtime-app.js +22 -1
- package/dist/contracts/runtime-db.d.ts +424 -0
- package/dist/contracts/runtime-db.js +108 -0
- package/dist/contracts/runtime-storage.d.ts +120 -0
- package/dist/contracts/runtime-storage.js +40 -0
- package/dist/contracts/sf-config-v1.d.ts +49 -1
- package/dist/contracts/sf-config-v1.js +2 -2
- package/dist/contracts/sites.d.ts +1 -0
- package/dist/contracts/sites.js +20 -12
- package/dist/contracts/space-config.d.ts +62 -22
- package/dist/contracts/space-config.js +173 -47
- package/dist/contracts/spaces.d.ts +79 -45
- package/dist/contracts/spaces.js +66 -50
- package/dist/contracts/superadmin-spaces.d.ts +13 -2
- package/dist/contracts/superadmin-spaces.js +15 -0
- package/dist/contracts/superadmin-tenants.js +4 -4
- package/dist/contracts/superadmin.d.ts +4 -0
- package/dist/contracts/superadmin.js +14 -1
- package/dist/contracts/tags.d.ts +17 -17
- package/dist/contracts/tags.js +1 -1
- package/dist/contracts/teams.js +25 -16
- package/dist/contracts/theme-json.js +1 -1
- package/dist/contracts/transfers.js +4 -4
- package/dist/contracts/variables.js +3 -3
- package/dist/contracts/zero.d.ts +204 -338
- package/dist/contracts/zero.js +94 -98
- package/dist/dashboard-paths/index.d.ts +16 -1
- package/dist/dashboard-paths/index.js +18 -0
- package/dist/docs/agent-handoff-document.d.ts +2 -2
- package/dist/docs/agent-handoff-document.js +8 -7
- package/dist/docs/agent-prose.d.ts +22 -3
- package/dist/docs/agent-prose.js +221 -51
- package/dist/docs/agent-setup.d.ts +13 -10
- package/dist/docs/agent-setup.js +279 -53
- package/dist/docs/agent-solutions.d.ts +6 -6
- package/dist/docs/agent-solutions.js +23 -21
- package/dist/docs/catalog.d.ts +29 -74
- package/dist/docs/catalog.js +65 -92
- package/dist/docs/error-docs.js +293 -221
- package/dist/docs/skill-distribution.d.ts +2 -0
- package/dist/docs/skill-distribution.js +7 -4
- package/dist/docs/skills.d.ts +546 -0
- package/dist/docs/skills.js +340 -0
- package/dist/utils/browser-credential.d.ts +19 -0
- package/dist/utils/browser-credential.js +62 -0
- package/dist/utils/comment-avatars.d.ts +7 -0
- package/dist/utils/comment-avatars.js +42 -0
- package/dist/utils/content-type.d.ts +3 -3
- package/dist/utils/content-type.js +38 -61
- package/dist/utils/domain-diagnostics.d.ts +5 -5
- package/dist/utils/domain-diagnostics.js +21 -10
- package/dist/utils/local-space-state.d.ts +78 -4
- package/dist/utils/local-space-state.js +383 -82
- package/dist/utils/one-shot-replay.d.ts +14 -0
- package/dist/utils/one-shot-replay.js +21 -0
- package/dist/utils/page-preview.d.ts +7 -0
- package/dist/utils/page-preview.js +9 -0
- package/dist/utils/pages.d.ts +2 -11
- package/dist/utils/pages.js +58 -14
- package/dist/utils/publish-form-data.d.ts +22 -0
- package/dist/utils/publish-form-data.js +26 -0
- package/dist/utils/publish-policy.js +20 -4
- package/dist/utils/query-keys.d.ts +7 -4
- package/dist/utils/query-keys.js +13 -4
- package/dist/utils/runtime-paths.d.ts +3 -0
- package/dist/utils/runtime-paths.js +7 -0
- package/dist/utils/secure-local-file.d.ts +73 -0
- package/dist/utils/secure-local-file.js +1373 -0
- package/dist/utils/space-config.d.ts +13 -4
- package/dist/utils/space-config.js +123 -15
- package/dist/utils/storage-policy.d.ts +20 -0
- package/dist/utils/storage-policy.fixtures.json +174 -0
- package/dist/utils/storage-policy.js +193 -0
- package/dist/utils/upload-session.d.ts +12 -1
- package/dist/utils/upload-session.js +37 -2
- package/dist/utils/version-file-browser.d.ts +13 -0
- package/dist/utils/version-file-browser.js +59 -0
- package/package.json +19 -1
- package/dist/contracts/mounts.d.ts +0 -142
- package/dist/contracts/mounts.js +0 -56
- package/dist/utils/asset-fingerprint.d.ts +0 -64
- package/dist/utils/asset-fingerprint.js +0 -620
package/dist/contracts/grants.js
CHANGED
|
@@ -104,16 +104,16 @@ export const grantResourcePatternSchema = z
|
|
|
104
104
|
.string()
|
|
105
105
|
.min(1)
|
|
106
106
|
.max(1024)
|
|
107
|
-
.
|
|
107
|
+
.check((context) => {
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
context.value = normalizeGrantResourcePattern(context.value);
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
112
|
-
context.
|
|
112
|
+
context.issues.push({
|
|
113
113
|
code: "custom",
|
|
114
|
+
input: context.value,
|
|
114
115
|
message: error instanceof Error ? error.message : "invalid resource pattern",
|
|
115
116
|
});
|
|
116
|
-
return z.NEVER;
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
function uniqueArray(values) {
|
|
@@ -244,53 +244,54 @@ const grantNetworkCidrSchema = z
|
|
|
244
244
|
.string()
|
|
245
245
|
.min(1)
|
|
246
246
|
.max(64)
|
|
247
|
-
.
|
|
247
|
+
.check((context) => {
|
|
248
248
|
try {
|
|
249
|
-
|
|
249
|
+
context.value = normalizeGrantNetworkCidr(context.value);
|
|
250
250
|
}
|
|
251
251
|
catch (error) {
|
|
252
|
-
context.
|
|
252
|
+
context.issues.push({
|
|
253
253
|
code: "custom",
|
|
254
|
+
input: context.value,
|
|
254
255
|
message: error instanceof Error ? error.message : "invalid network rule",
|
|
255
256
|
});
|
|
256
|
-
return z.NEVER;
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
const grantCountrySchema = z
|
|
260
260
|
.string()
|
|
261
261
|
.length(2)
|
|
262
|
-
.
|
|
262
|
+
.overwrite((country) => country.toUpperCase())
|
|
263
263
|
.refine((country) => ISO_COUNTRY_CODES.includes(country), "Country must be an ISO 3166-1 alpha-2 code.");
|
|
264
|
+
const grantConstraintDateSchema = z.string().datetime();
|
|
265
|
+
const grantConstraintMaxUsesSchema = z.number().int().positive().max(1_000_000);
|
|
266
|
+
const grantConstraintIpCidrsSchema = z.array(grantNetworkCidrSchema).min(1).max(50);
|
|
267
|
+
const grantConstraintCountriesSchema = z.array(grantCountrySchema).min(1).max(250);
|
|
268
|
+
const grantConstraintUserAgentsSchema = z.array(z.string().trim().min(1).max(200)).min(1).max(50);
|
|
269
|
+
const grantNetworkConstraintsSchema = z
|
|
270
|
+
.object({
|
|
271
|
+
ipCidrs: grantConstraintIpCidrsSchema.optional(),
|
|
272
|
+
countries: grantConstraintCountriesSchema.optional(),
|
|
273
|
+
excludedCountries: grantConstraintCountriesSchema.optional(),
|
|
274
|
+
excludedUserAgentSubstrings: grantConstraintUserAgentsSchema.optional(),
|
|
275
|
+
})
|
|
276
|
+
.strict()
|
|
277
|
+
.superRefine((network, context) => {
|
|
278
|
+
if (network.ipCidrs === undefined &&
|
|
279
|
+
network.countries === undefined &&
|
|
280
|
+
network.excludedCountries === undefined &&
|
|
281
|
+
network.excludedUserAgentSubstrings === undefined) {
|
|
282
|
+
context.addIssue({
|
|
283
|
+
code: "custom",
|
|
284
|
+
message: "network requires at least one IP, country, or user-agent selector",
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
});
|
|
264
288
|
export const grantConstraintsSchema = z
|
|
265
289
|
.object({
|
|
266
|
-
notBefore:
|
|
267
|
-
expiresAt:
|
|
268
|
-
maxUses:
|
|
290
|
+
notBefore: grantConstraintDateSchema.optional(),
|
|
291
|
+
expiresAt: grantConstraintDateSchema.optional(),
|
|
292
|
+
maxUses: grantConstraintMaxUsesSchema.optional(),
|
|
269
293
|
requireVerifiedEmail: z.boolean().optional(),
|
|
270
|
-
network:
|
|
271
|
-
.object({
|
|
272
|
-
ipCidrs: z.array(grantNetworkCidrSchema).min(1).max(50).optional(),
|
|
273
|
-
countries: z.array(grantCountrySchema).min(1).max(250).optional(),
|
|
274
|
-
excludedCountries: z.array(grantCountrySchema).min(1).max(250).optional(),
|
|
275
|
-
excludedUserAgentSubstrings: z
|
|
276
|
-
.array(z.string().trim().min(1).max(200))
|
|
277
|
-
.min(1)
|
|
278
|
-
.max(50)
|
|
279
|
-
.optional(),
|
|
280
|
-
})
|
|
281
|
-
.strict()
|
|
282
|
-
.superRefine((network, context) => {
|
|
283
|
-
if (network.ipCidrs === undefined &&
|
|
284
|
-
network.countries === undefined &&
|
|
285
|
-
network.excludedCountries === undefined &&
|
|
286
|
-
network.excludedUserAgentSubstrings === undefined) {
|
|
287
|
-
context.addIssue({
|
|
288
|
-
code: "custom",
|
|
289
|
-
message: "network requires at least one IP, country, or user-agent selector",
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
.optional(),
|
|
294
|
+
network: grantNetworkConstraintsSchema.optional(),
|
|
294
295
|
})
|
|
295
296
|
.strict()
|
|
296
297
|
.superRefine((value, context) => {
|
|
@@ -304,9 +305,98 @@ export const grantConstraintsSchema = z
|
|
|
304
305
|
});
|
|
305
306
|
}
|
|
306
307
|
});
|
|
308
|
+
/** Field-scoped PATCH shape. `null` clears one constraint without replacing its siblings. */
|
|
309
|
+
export const grantConstraintsPatchSchema = z
|
|
310
|
+
.object({
|
|
311
|
+
notBefore: grantConstraintDateSchema.nullable().optional(),
|
|
312
|
+
expiresAt: grantConstraintDateSchema.nullable().optional(),
|
|
313
|
+
maxUses: grantConstraintMaxUsesSchema.nullable().optional(),
|
|
314
|
+
requireVerifiedEmail: z.boolean().nullable().optional(),
|
|
315
|
+
network: z
|
|
316
|
+
.object({
|
|
317
|
+
ipCidrs: grantConstraintIpCidrsSchema.nullable().optional(),
|
|
318
|
+
countries: grantConstraintCountriesSchema.nullable().optional(),
|
|
319
|
+
excludedCountries: grantConstraintCountriesSchema.nullable().optional(),
|
|
320
|
+
excludedUserAgentSubstrings: grantConstraintUserAgentsSchema.nullable().optional(),
|
|
321
|
+
})
|
|
322
|
+
.strict()
|
|
323
|
+
.nullable()
|
|
324
|
+
.optional(),
|
|
325
|
+
})
|
|
326
|
+
.strict();
|
|
327
|
+
export function diffGrantConstraints(original, draft) {
|
|
328
|
+
const network = JSON.stringify(original.network) === JSON.stringify(draft.network)
|
|
329
|
+
? undefined
|
|
330
|
+
: draft.network === undefined
|
|
331
|
+
? null
|
|
332
|
+
: {
|
|
333
|
+
...(JSON.stringify(original.network?.ipCidrs) === JSON.stringify(draft.network.ipCidrs)
|
|
334
|
+
? {}
|
|
335
|
+
: { ipCidrs: draft.network.ipCidrs ?? null }),
|
|
336
|
+
...(JSON.stringify(original.network?.countries) ===
|
|
337
|
+
JSON.stringify(draft.network.countries)
|
|
338
|
+
? {}
|
|
339
|
+
: { countries: draft.network.countries ?? null }),
|
|
340
|
+
...(JSON.stringify(original.network?.excludedCountries) ===
|
|
341
|
+
JSON.stringify(draft.network.excludedCountries)
|
|
342
|
+
? {}
|
|
343
|
+
: { excludedCountries: draft.network.excludedCountries ?? null }),
|
|
344
|
+
...(JSON.stringify(original.network?.excludedUserAgentSubstrings) ===
|
|
345
|
+
JSON.stringify(draft.network.excludedUserAgentSubstrings)
|
|
346
|
+
? {}
|
|
347
|
+
: {
|
|
348
|
+
excludedUserAgentSubstrings: draft.network.excludedUserAgentSubstrings ?? null,
|
|
349
|
+
}),
|
|
350
|
+
};
|
|
351
|
+
const patch = {
|
|
352
|
+
...(original.notBefore === draft.notBefore ? {} : { notBefore: draft.notBefore ?? null }),
|
|
353
|
+
...(original.expiresAt === draft.expiresAt ? {} : { expiresAt: draft.expiresAt ?? null }),
|
|
354
|
+
...(original.maxUses === draft.maxUses ? {} : { maxUses: draft.maxUses ?? null }),
|
|
355
|
+
...(original.requireVerifiedEmail === draft.requireVerifiedEmail
|
|
356
|
+
? {}
|
|
357
|
+
: { requireVerifiedEmail: draft.requireVerifiedEmail ?? null }),
|
|
358
|
+
...(network === undefined ? {} : { network }),
|
|
359
|
+
};
|
|
360
|
+
return Object.keys(patch).length === 0 ? undefined : patch;
|
|
361
|
+
}
|
|
362
|
+
export function applyGrantConstraintsPatch(current, patch) {
|
|
363
|
+
const network = patch.network === undefined
|
|
364
|
+
? current.network
|
|
365
|
+
: patch.network === null
|
|
366
|
+
? undefined
|
|
367
|
+
: {
|
|
368
|
+
...current.network,
|
|
369
|
+
...(patch.network.ipCidrs === undefined
|
|
370
|
+
? {}
|
|
371
|
+
: { ipCidrs: patch.network.ipCidrs ?? undefined }),
|
|
372
|
+
...(patch.network.countries === undefined
|
|
373
|
+
? {}
|
|
374
|
+
: { countries: patch.network.countries ?? undefined }),
|
|
375
|
+
...(patch.network.excludedCountries === undefined
|
|
376
|
+
? {}
|
|
377
|
+
: { excludedCountries: patch.network.excludedCountries ?? undefined }),
|
|
378
|
+
...(patch.network.excludedUserAgentSubstrings === undefined
|
|
379
|
+
? {}
|
|
380
|
+
: {
|
|
381
|
+
excludedUserAgentSubstrings: patch.network.excludedUserAgentSubstrings ?? undefined,
|
|
382
|
+
}),
|
|
383
|
+
};
|
|
384
|
+
const compactNetwork = network && Object.values(network).some((value) => value !== undefined) ? network : undefined;
|
|
385
|
+
return grantConstraintsSchema.parse({
|
|
386
|
+
...current,
|
|
387
|
+
...(patch.notBefore === undefined ? {} : { notBefore: patch.notBefore ?? undefined }),
|
|
388
|
+
...(patch.expiresAt === undefined ? {} : { expiresAt: patch.expiresAt ?? undefined }),
|
|
389
|
+
...(patch.maxUses === undefined ? {} : { maxUses: patch.maxUses ?? undefined }),
|
|
390
|
+
...(patch.requireVerifiedEmail === undefined
|
|
391
|
+
? {}
|
|
392
|
+
: { requireVerifiedEmail: patch.requireVerifiedEmail ?? undefined }),
|
|
393
|
+
network: compactNetwork,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
307
396
|
export const GRANT_SOURCE_KINDS = ["config", "managed", "system"];
|
|
308
397
|
export const grantSourceKindSchema = z.enum(GRANT_SOURCE_KINDS);
|
|
309
398
|
export const PRECLAIM_OPEN_GRANT_SOURCE_REFERENCE = "open:preclaim-author";
|
|
399
|
+
export const SPACE_OPEN_GRANT_SOURCE_REFERENCE = "open:space";
|
|
310
400
|
export const OWNING_TEAM_MANAGEMENT_GRANT_SOURCE_REFERENCE = "ownership:team";
|
|
311
401
|
export const OWNING_TEAM_VERSION_GRANT_SOURCE_REFERENCE = "ownership:team:versions";
|
|
312
402
|
export const OWNING_EXTERNAL_MANAGEMENT_GRANT_SOURCE_REFERENCE = "ownership:external";
|
|
@@ -380,14 +470,11 @@ const grantObjectSchema = grantDimensionsSchema.extend({
|
|
|
380
470
|
});
|
|
381
471
|
function validateGrantCapabilityBoundary(value, context) {
|
|
382
472
|
validateGrantAudienceCapabilityBoundary(value, context);
|
|
383
|
-
if (value.audience.kind === "link" &&
|
|
384
|
-
value.capabilities.includes("content.publish") &&
|
|
385
|
-
(value.source.kind !== "system" ||
|
|
386
|
-
value.source.reference !== PRECLAIM_OPEN_GRANT_SOURCE_REFERENCE)) {
|
|
473
|
+
if (value.audience.kind === "link" && value.capabilities.includes("content.publish")) {
|
|
387
474
|
context.addIssue({
|
|
388
475
|
code: "custom",
|
|
389
476
|
path: ["capabilities"],
|
|
390
|
-
message: "link audiences
|
|
477
|
+
message: "link audiences cannot publish content",
|
|
391
478
|
});
|
|
392
479
|
}
|
|
393
480
|
}
|
|
@@ -538,7 +625,7 @@ const credentialGrantFields = {
|
|
|
538
625
|
export const passwordCredentialCreateSchema = z
|
|
539
626
|
.object({
|
|
540
627
|
...credentialGrantFields,
|
|
541
|
-
password: z.string().min(
|
|
628
|
+
password: z.string().min(1).max(1024),
|
|
542
629
|
})
|
|
543
630
|
.strict()
|
|
544
631
|
.superRefine((value, context) => {
|
|
@@ -552,7 +639,7 @@ export const passwordCredentialCreateSchema = z
|
|
|
552
639
|
}
|
|
553
640
|
});
|
|
554
641
|
export const passwordCredentialRotateSchema = z
|
|
555
|
-
.object({ password: z.string().min(
|
|
642
|
+
.object({ password: z.string().min(1).max(1024) })
|
|
556
643
|
.strict();
|
|
557
644
|
export const machineCredentialCreateSchema = z
|
|
558
645
|
.object(credentialGrantFields)
|
package/dist/contracts/ids.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const ID_PREFIXES: {
|
|
|
19
19
|
readonly whd: "WebhookDelivery";
|
|
20
20
|
readonly rec: "DnsRecord";
|
|
21
21
|
readonly evt: "ActivityEvent";
|
|
22
|
+
readonly ntf: "Notification";
|
|
22
23
|
readonly pvc: "ProviderClient";
|
|
23
24
|
readonly tgs: "TagSet";
|
|
24
25
|
readonly tgv: "TagVersion";
|
|
@@ -33,13 +34,12 @@ export declare const ID_PREFIXES: {
|
|
|
33
34
|
readonly acn: "IdentityConnection";
|
|
34
35
|
readonly pwd: "SpacePasswordCredential";
|
|
35
36
|
readonly mch: "SpaceMachineCredential";
|
|
36
|
-
readonly mnt: "StaticMount";
|
|
37
37
|
};
|
|
38
38
|
export type IdPrefix = keyof typeof ID_PREFIXES;
|
|
39
39
|
/** Any registered public resource id, e.g. `spc_…` or `ver_…`. */
|
|
40
40
|
export type Id = `${IdPrefix}_${string}`;
|
|
41
41
|
/** Validate an id belonging to one registered public resource family. */
|
|
42
|
-
export declare function registeredIdSchema<P extends IdPrefix>(prefix: P): z.
|
|
42
|
+
export declare function registeredIdSchema<P extends IdPrefix>(prefix: P): z.ZodTemplateLiteral<`${`${P}_` extends infer T extends string | number | bigint | boolean | null | undefined ? T extends undefined ? "" : T : never}${string}`>;
|
|
43
43
|
export declare const MAIN_TENANT_ID = "ten_main";
|
|
44
44
|
/** Mint a globally unique id for a registered public resource prefix. */
|
|
45
45
|
export declare function createId<P extends IdPrefix>(prefix: P): `${P}_${string}`;
|
package/dist/contracts/ids.js
CHANGED
|
@@ -26,6 +26,7 @@ export const ID_PREFIXES = {
|
|
|
26
26
|
whd: "WebhookDelivery",
|
|
27
27
|
rec: "DnsRecord",
|
|
28
28
|
evt: "ActivityEvent",
|
|
29
|
+
ntf: "Notification",
|
|
29
30
|
pvc: "ProviderClient",
|
|
30
31
|
tgs: "TagSet",
|
|
31
32
|
tgv: "TagVersion",
|
|
@@ -41,13 +42,10 @@ export const ID_PREFIXES = {
|
|
|
41
42
|
acn: "IdentityConnection",
|
|
42
43
|
pwd: "SpacePasswordCredential",
|
|
43
44
|
mch: "SpaceMachineCredential",
|
|
44
|
-
mnt: "StaticMount",
|
|
45
45
|
};
|
|
46
46
|
/** Validate an id belonging to one registered public resource family. */
|
|
47
47
|
export function registeredIdSchema(prefix) {
|
|
48
|
-
return z.
|
|
49
|
-
value.startsWith(`${prefix}_`) &&
|
|
50
|
-
/^[A-Za-z0-9]+$/.test(value.slice(prefix.length + 1)), `Invalid ${ID_PREFIXES[prefix]} id`);
|
|
48
|
+
return z.templateLiteral([z.literal(`${prefix}_`), z.string().regex(/^[A-Za-z0-9]+$/)], `Invalid ${ID_PREFIXES[prefix]} id`);
|
|
51
49
|
}
|
|
52
50
|
// The main Stattic tenant every self-serve team/user/resource lives under. A
|
|
53
51
|
// well-known CONSTANT, never configuration: grammatically a normal tenant id with
|
|
@@ -30,7 +30,7 @@ export const pendingUploadSchema = manifestFileSchema.pick({
|
|
|
30
30
|
});
|
|
31
31
|
export const uploadSessionModeSchema = z
|
|
32
32
|
.enum(["dist", "source"])
|
|
33
|
-
.describe("`dist` bytes are
|
|
33
|
+
.describe("`dist` bytes are publishable output. `source` bytes must be transformed, unpacked, or built before publish.");
|
|
34
34
|
export const uploadTargetSchema = z.object({
|
|
35
35
|
path: z.string().describe("Caller-local path/key identifying the bytes this target accepts."),
|
|
36
36
|
method: z.enum(["PUT", "POST"]).describe("HTTP method to use for this target."),
|
|
@@ -66,7 +66,7 @@ export const uploadInstructionsSchema = z.object({
|
|
|
66
66
|
expiresAt: z
|
|
67
67
|
.string()
|
|
68
68
|
.datetime()
|
|
69
|
-
.describe("
|
|
69
|
+
.describe("Instant when the session token expires. This rotates only the token, never the version lifecycle boundary. Resume always mints a fresh token."),
|
|
70
70
|
summary: z
|
|
71
71
|
.object({
|
|
72
72
|
upload: z.number().int().nonnegative().describe("Files that still need uploading."),
|