@spacefast/common 0.0.26 → 0.2.2
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/connect-targets.d.ts +6 -146
- package/dist/agents/connect-targets.js +63 -295
- package/dist/agents/private-key-oauth.d.ts +31 -1
- package/dist/agents/private-key-oauth.js +124 -33
- package/dist/agents/registry/core.d.ts +292 -0
- package/dist/agents/registry/core.js +1388 -0
- package/dist/agents/registry/deeplink-probes.d.ts +23 -0
- package/dist/agents/registry/deeplink-probes.js +18 -0
- package/dist/agents/registry/node.d.ts +56 -0
- package/dist/agents/registry/node.js +339 -0
- package/dist/brand-assets-build.js +1 -2
- package/dist/brand-assets.js +4 -7
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +55 -28
- package/dist/config/domains.js +85 -41
- package/dist/config/index.js +1 -2
- package/dist/contracts/abuse.js +9 -24
- package/dist/contracts/access-profiles.d.ts +86 -0
- package/dist/contracts/access-profiles.js +89 -0
- package/dist/contracts/access.d.ts +21 -27
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +70 -26
- package/dist/contracts/analytics.js +8 -10
- package/dist/contracts/api-keys.d.ts +77 -52
- package/dist/contracts/api-keys.js +44 -24
- package/dist/contracts/application-journal.d.ts +216 -0
- package/dist/contracts/application-journal.js +167 -0
- package/dist/contracts/auth.d.ts +90 -17
- package/dist/contracts/auth.js +86 -17
- package/dist/contracts/beta.d.ts +9 -4
- package/dist/contracts/beta.js +20 -16
- package/dist/contracts/billing.js +7 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +192 -7
- package/dist/contracts/builds.js +84 -21
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +25 -9
- package/dist/contracts/cli.d.ts +7 -0
- package/dist/contracts/cli.js +6 -0
- package/dist/contracts/collab-public.d.ts +1 -1
- package/dist/contracts/collab-public.js +5 -8
- package/dist/contracts/comments.d.ts +45 -35
- package/dist/contracts/comments.js +107 -77
- package/dist/contracts/commerce.d.ts +165 -0
- package/dist/contracts/commerce.js +146 -0
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +18 -29
- package/dist/contracts/content-contract-verification.d.ts +521 -0
- package/dist/contracts/content-contract-verification.js +320 -0
- package/dist/contracts/content-platform-fixture.d.ts +1278 -0
- package/dist/contracts/content-platform-fixture.js +44 -0
- package/dist/contracts/content-program.d.ts +994 -0
- package/dist/contracts/content-program.js +658 -0
- package/dist/contracts/content-sync.d.ts +290 -0
- package/dist/contracts/content-sync.js +167 -0
- package/dist/contracts/content.d.ts +432 -0
- package/dist/contracts/content.js +303 -0
- package/dist/contracts/continuation.d.ts +17 -1
- package/dist/contracts/continuation.js +23 -23
- package/dist/contracts/countries.js +3 -4
- package/dist/contracts/crons.d.ts +17 -0
- package/dist/contracts/crons.js +33 -15
- package/dist/contracts/dashboard-prefs.d.ts +56 -0
- package/dist/contracts/dashboard-prefs.js +51 -0
- package/dist/contracts/device-auth.d.ts +234 -37
- package/dist/contracts/device-auth.js +267 -53
- package/dist/contracts/docs.d.ts +6 -10
- package/dist/contracts/docs.js +5 -13
- package/dist/contracts/domains.d.ts +499 -102
- package/dist/contracts/domains.js +169 -58
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +26 -26
- package/dist/contracts/enums.js +61 -54
- package/dist/contracts/error-code-meta.d.ts +273 -7
- package/dist/contracts/error-code-meta.js +81 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +79 -16
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +51 -64
- package/dist/contracts/feature-lifecycle.d.ts +70 -14
- package/dist/contracts/feature-lifecycle.js +86 -15
- package/dist/contracts/features.d.ts +100 -37
- package/dist/contracts/features.js +21 -27
- package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
- package/dist/contracts/frame-session.d.ts +192 -0
- package/dist/contracts/frame-session.js +164 -0
- package/dist/contracts/functions.d.ts +218 -211
- package/dist/contracts/functions.js +273 -260
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +64 -56
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +4 -1
- package/dist/contracts/internal.d.ts +5 -4
- package/dist/contracts/internal.js +12 -3
- package/dist/contracts/mcp.d.ts +17 -0
- package/dist/contracts/mcp.js +23 -0
- package/dist/contracts/me.d.ts +6 -1
- package/dist/contracts/me.js +12 -6
- package/dist/contracts/notifications.d.ts +27 -29
- package/dist/contracts/notifications.js +9 -4
- package/dist/contracts/oauth-resources.d.ts +121 -10
- package/dist/contracts/oauth-resources.js +130 -11
- package/dist/contracts/oauth-scope-actions.d.ts +90 -0
- package/dist/contracts/oauth-scope-actions.js +126 -0
- package/dist/contracts/operations.d.ts +27 -4
- package/dist/contracts/operations.js +11 -5
- package/dist/contracts/pages.d.ts +29 -5
- package/dist/contracts/pages.js +22 -5
- package/dist/contracts/partner-notifications.d.ts +3 -0
- package/dist/contracts/partner-notifications.js +65 -0
- package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
- package/dist/contracts/{platform.js → partner.js} +27 -40
- package/dist/contracts/plan-policy.d.ts +1 -1
- package/dist/contracts/principal-assertion.d.ts +43 -0
- package/dist/contracts/principal-assertion.js +67 -0
- package/dist/contracts/principals.d.ts +73 -0
- package/dist/contracts/principals.js +59 -0
- package/dist/contracts/privacy.d.ts +11 -0
- package/dist/contracts/privacy.js +17 -0
- package/dist/contracts/problem-document.js +3 -4
- package/dist/contracts/publish-archive.d.ts +116 -18
- package/dist/contracts/publish-archive.js +6 -3
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +3 -3
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/repository-connections.js +6 -2
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +145 -21
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +112 -35
- package/dist/contracts/runtime-api.js +86 -66
- package/dist/contracts/runtime-app.d.ts +11 -21
- package/dist/contracts/runtime-app.js +39 -24
- package/dist/contracts/runtime-components.d.ts +143 -0
- package/dist/contracts/runtime-components.js +199 -0
- package/dist/contracts/runtime-db.d.ts +45 -19
- package/dist/contracts/runtime-db.js +85 -20
- package/dist/contracts/runtime-purge.js +3 -5
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +14 -14
- package/dist/contracts/runtime-storage.js +28 -13
- package/dist/contracts/sf-config-v1.d.ts +14 -18
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +235 -28
- package/dist/contracts/space-config.js +246 -91
- package/dist/contracts/spaces.d.ts +360 -255
- package/dist/contracts/spaces.js +190 -122
- package/dist/contracts/superadmin-activity.d.ts +3 -43
- package/dist/contracts/superadmin-activity.js +6 -30
- package/dist/contracts/superadmin-emails.d.ts +1 -0
- package/dist/contracts/superadmin-emails.js +17 -1
- package/dist/contracts/superadmin-runtime.d.ts +199 -0
- package/dist/contracts/superadmin-runtime.js +141 -0
- package/dist/contracts/superadmin-search.d.ts +22 -2
- package/dist/contracts/superadmin-search.js +14 -6
- package/dist/contracts/superadmin-spaces.d.ts +435 -186
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +3 -0
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -6
- package/dist/contracts/superadmin-tenants.js +32 -7
- package/dist/contracts/superadmin.d.ts +98 -16
- package/dist/contracts/superadmin.js +63 -10
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +44 -34
- package/dist/contracts/teams.d.ts +72 -9
- package/dist/contracts/teams.js +84 -25
- package/dist/contracts/tenants.d.ts +135 -0
- package/dist/contracts/tenants.js +120 -0
- package/dist/contracts/test-triggers.d.ts +70 -0
- package/dist/contracts/test-triggers.js +116 -0
- package/dist/contracts/theme-json.js +3 -8
- package/dist/contracts/transfers.d.ts +1 -0
- package/dist/contracts/transfers.js +1 -0
- package/dist/contracts/usage.d.ts +209 -0
- package/dist/contracts/usage.js +124 -12
- package/dist/contracts/variables.d.ts +2 -2
- package/dist/contracts/variables.js +9 -13
- package/dist/contracts/webhooks.d.ts +13 -5
- package/dist/contracts/webhooks.js +3 -1
- package/dist/contracts/zero.d.ts +57 -64
- package/dist/contracts/zero.js +68 -66
- package/dist/dashboard-paths/index.d.ts +24 -21
- package/dist/dashboard-paths/index.js +35 -47
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
- package/dist/dashboard-paths/route-reservations.generated.js +36 -0
- package/dist/docs/agent-arrival.d.ts +92 -0
- package/dist/docs/agent-arrival.js +227 -0
- package/dist/docs/agent-output-policy.d.ts +6 -0
- package/dist/docs/agent-output-policy.js +22 -0
- package/dist/docs/agent-prose.d.ts +11 -17
- package/dist/docs/agent-prose.js +62 -37
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +336 -436
- package/dist/docs/catalog.d.ts +147 -89
- package/dist/docs/catalog.js +157 -42
- package/dist/docs/error-docs.d.ts +2102 -1
- package/dist/docs/error-docs.js +285 -16
- package/dist/docs/index-build.d.ts +0 -1
- package/dist/docs/index-build.js +2 -3
- package/dist/docs/page-context-prompt.d.ts +77 -0
- package/dist/docs/page-context-prompt.js +131 -0
- package/dist/docs/reference-urls.d.ts +46 -0
- package/dist/docs/reference-urls.js +79 -0
- package/dist/docs/search.d.ts +6 -8
- package/dist/docs/search.js +10 -13
- package/dist/docs/skill-distribution.d.ts +4 -1
- package/dist/docs/skill-distribution.js +10 -5
- package/dist/docs/skills.d.ts +117 -117
- package/dist/docs/skills.js +120 -72
- package/dist/docs/start-prompts.d.ts +45 -0
- package/dist/docs/start-prompts.js +62 -0
- package/dist/domain-exploration.js +9 -13
- package/dist/og-template.d.ts +56 -0
- package/dist/og-template.js +56 -0
- package/dist/slug-policy/index.js +5 -11
- package/dist/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +16 -0
- package/dist/utils/build-settings.js +63 -17
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +3 -5
- package/dist/utils/cast-transport.d.ts +5 -17
- package/dist/utils/cast-transport.js +6 -19
- package/dist/utils/claim-token.js +1 -2
- package/dist/utils/comment-avatars.js +4 -6
- package/dist/utils/concurrency.js +2 -3
- package/dist/utils/content-type.d.ts +7 -6
- package/dist/utils/content-type.js +73 -51
- package/dist/utils/credential-policy.d.ts +50 -6
- package/dist/utils/credential-policy.js +123 -57
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +4 -7
- package/dist/utils/gravatar.d.ts +2 -4
- package/dist/utils/gravatar.js +6 -12
- package/dist/utils/id-hints.js +14 -23
- package/dist/utils/idempotency.d.ts +3 -3
- package/dist/utils/idempotency.js +6 -7
- package/dist/utils/local-space-state.d.ts +15 -15
- package/dist/utils/local-space-state.js +34 -23
- package/dist/utils/oauth-signed-query.d.ts +3 -5
- package/dist/utils/oauth-signed-query.js +6 -9
- package/dist/utils/one-shot-replay.d.ts +3 -5
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +4 -10
- package/dist/utils/page-colors.js +11 -35
- package/dist/utils/page-fonts.js +6 -11
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +22 -11
- package/dist/utils/pages.js +70 -30
- package/dist/utils/privacy-regions.d.ts +19 -0
- package/dist/utils/privacy-regions.js +91 -0
- package/dist/utils/publish-form-data.d.ts +4 -5
- package/dist/utils/publish-form-data.js +2 -3
- package/dist/utils/publish-policy.d.ts +10 -23
- package/dist/utils/publish-policy.js +63 -116
- package/dist/utils/query-client.d.ts +2 -0
- package/dist/utils/query-client.js +10 -1
- package/dist/utils/runtime-paths.d.ts +4 -4
- package/dist/utils/runtime-paths.js +6 -8
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +18 -24
- package/dist/utils/space-config.d.ts +11 -14
- package/dist/utils/space-config.js +10 -16
- package/dist/utils/static-runtime-policy.d.ts +5 -8
- package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
- package/dist/utils/static-runtime-policy.generated.js +70 -0
- package/dist/utils/static-runtime-policy.js +17 -84
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.js +8 -14
- package/dist/utils/version-path.js +11 -19
- package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
- package/dist/utils/wpcom-auth-redirects.js +1 -4
- package/dist/vocabulary.d.ts +7 -7
- package/dist/vocabulary.js +30 -16
- package/package.json +14 -2
- package/dist/agents/client-registry.d.ts +0 -22
- package/dist/agents/client-registry.js +0 -41
- package/dist/docs/agent-handoff-document.d.ts +0 -15
- package/dist/docs/agent-handoff-document.js +0 -180
- package/dist/docs/agent-solutions.d.ts +0 -110
- package/dist/docs/agent-solutions.js +0 -183
- package/dist/utils/query-keys.d.ts +0 -84
- package/dist/utils/query-keys.js +0 -108
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const CONTENT_SCHEMA_FORMAT = "spacefast.content.schema";
|
|
3
|
+
export const CONTENT_QUERY_FORMAT = "spacefast.content.query";
|
|
4
|
+
export const CONTENT_SOURCE_FORMAT = "spacefast.content.source";
|
|
5
|
+
export const CONTENT_RENDER_FORMAT = "spacefast.content.render";
|
|
6
|
+
export const CONTENT_API_VERSION = 1;
|
|
7
|
+
// The content model is authored as files in the Space and compiled at publish.
|
|
8
|
+
// `content.config.ts` at the Space root is the entry module; sibling modules it
|
|
9
|
+
// imports live under `content/`. Both are read out of the version being
|
|
10
|
+
// published, so the compiled model is bound to that version and rolls back with
|
|
11
|
+
// it. There is no API that mutates the content model out of band.
|
|
12
|
+
export const CONTENT_CONFIG_FILE = "content.config.ts";
|
|
13
|
+
export const CONTENT_CONFIG_DIRECTORY = "content/";
|
|
14
|
+
export const CONTENT_CAPS = {
|
|
15
|
+
batchQueries: 25,
|
|
16
|
+
collections: 50,
|
|
17
|
+
fieldsPerCollection: 100,
|
|
18
|
+
filterClauses: 24,
|
|
19
|
+
pageSize: 100,
|
|
20
|
+
selectFields: 100,
|
|
21
|
+
sourceBytes: 2 * 1024 * 1024,
|
|
22
|
+
sourceFiles: 64,
|
|
23
|
+
};
|
|
24
|
+
const contentIdentifierSchema = z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(63)
|
|
28
|
+
.regex(/^[a-z][a-z0-9_-]*$/, "must start with a letter and contain lowercase letters, digits, _ or -");
|
|
29
|
+
const contentFieldIdentifierSchema = z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(128)
|
|
33
|
+
.regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "must start with a letter and contain letters, digits, _ or -");
|
|
34
|
+
const contentSourcePathSchema = z
|
|
35
|
+
.string()
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(240)
|
|
38
|
+
.regex(/^(?:[A-Za-z0-9_-]+\/)*[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*\.(?:[cm]?[jt]sx?)$/, "must be a relative JavaScript or TypeScript module path");
|
|
39
|
+
export const contentSourceBundleSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
format: z.literal(CONTENT_SOURCE_FORMAT),
|
|
42
|
+
version: z.literal(CONTENT_API_VERSION),
|
|
43
|
+
entry: contentSourcePathSchema.default(CONTENT_CONFIG_FILE),
|
|
44
|
+
files: z
|
|
45
|
+
.record(contentSourcePathSchema, z.string().max(CONTENT_CAPS.sourceBytes))
|
|
46
|
+
.refine((files) => Object.keys(files).length <= CONTENT_CAPS.sourceFiles, {
|
|
47
|
+
message: `must contain at most ${CONTENT_CAPS.sourceFiles} files`,
|
|
48
|
+
})
|
|
49
|
+
.refine((files) => Object.entries(files).reduce((bytes, [name, source]) => bytes +
|
|
50
|
+
new TextEncoder().encode(name).byteLength +
|
|
51
|
+
new TextEncoder().encode(source).byteLength, 0) <= CONTENT_CAPS.sourceBytes, { message: `must contain at most ${CONTENT_CAPS.sourceBytes} bytes` }),
|
|
52
|
+
phpOnly: z.boolean().default(false),
|
|
53
|
+
})
|
|
54
|
+
.strict()
|
|
55
|
+
.refine((bundle) => Object.hasOwn(bundle.files, bundle.entry), {
|
|
56
|
+
message: "entry must name one of files",
|
|
57
|
+
path: ["entry"],
|
|
58
|
+
});
|
|
59
|
+
export const contentCompileResponseSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
revision: z.string().regex(/^[a-f0-9]{64}$/),
|
|
62
|
+
schemaVersion: z.number().int().positive(),
|
|
63
|
+
collections: z.number().int().nonnegative(),
|
|
64
|
+
fields: z.number().int().nonnegative(),
|
|
65
|
+
hooks: z.number().int().nonnegative(),
|
|
66
|
+
quickJsHooks: z.number().int().nonnegative(),
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
69
|
+
// Activation points the Space's WordPress at an already-compiled release. A null
|
|
70
|
+
// revision is the honest answer for a version that shipped no content config:
|
|
71
|
+
// activating it leaves the Space with no managed content model, so rolling back
|
|
72
|
+
// to a version from before the model existed restores exactly that.
|
|
73
|
+
export const contentReleaseActivateResponseSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
revision: z
|
|
76
|
+
.string()
|
|
77
|
+
.regex(/^[a-f0-9]{64}$/)
|
|
78
|
+
.nullable(),
|
|
79
|
+
})
|
|
80
|
+
.strict();
|
|
81
|
+
export const contentRenderInputSchema = z
|
|
82
|
+
.object({
|
|
83
|
+
format: z.literal(CONTENT_RENDER_FORMAT),
|
|
84
|
+
version: z.literal(CONTENT_API_VERSION),
|
|
85
|
+
collection: contentIdentifierSchema.default("posts"),
|
|
86
|
+
id: z.number().int().positive().optional(),
|
|
87
|
+
slug: z.string().trim().min(1).max(200).optional(),
|
|
88
|
+
field: contentFieldIdentifierSchema.default("content"),
|
|
89
|
+
output: z.enum(["blocks", "html"]).default("html"),
|
|
90
|
+
})
|
|
91
|
+
.strict()
|
|
92
|
+
.refine((input) => (input.id === undefined) !== (input.slug === undefined), {
|
|
93
|
+
message: "set exactly one of id or slug",
|
|
94
|
+
path: ["id"],
|
|
95
|
+
});
|
|
96
|
+
export const contentRenderResponseSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
id: z.number().int().positive(),
|
|
99
|
+
content: z.string(),
|
|
100
|
+
output: z.enum(["blocks", "html"]),
|
|
101
|
+
})
|
|
102
|
+
.strict();
|
|
103
|
+
const contentQueryKeySchema = z
|
|
104
|
+
.string()
|
|
105
|
+
.min(1)
|
|
106
|
+
.max(63)
|
|
107
|
+
.regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "must be a safe query key");
|
|
108
|
+
const contentLabelSchema = z.string().trim().min(1).max(120);
|
|
109
|
+
const contentFieldBaseSchema = z.object({
|
|
110
|
+
label: contentLabelSchema,
|
|
111
|
+
required: z.boolean().default(false),
|
|
112
|
+
description: z.string().trim().max(500).optional(),
|
|
113
|
+
});
|
|
114
|
+
export const contentFieldSchema = z.discriminatedUnion("type", [
|
|
115
|
+
contentFieldBaseSchema.extend({
|
|
116
|
+
type: z.literal("text"),
|
|
117
|
+
multiline: z.boolean().default(false),
|
|
118
|
+
maxLength: z.number().int().positive().max(100_000).optional(),
|
|
119
|
+
}),
|
|
120
|
+
contentFieldBaseSchema.extend({ type: z.literal("markdown") }),
|
|
121
|
+
contentFieldBaseSchema.extend({ type: z.literal("richText") }),
|
|
122
|
+
contentFieldBaseSchema.extend({ type: z.literal("number") }),
|
|
123
|
+
contentFieldBaseSchema.extend({ type: z.literal("boolean") }),
|
|
124
|
+
contentFieldBaseSchema.extend({ type: z.literal("date") }),
|
|
125
|
+
contentFieldBaseSchema.extend({
|
|
126
|
+
type: z.literal("media"),
|
|
127
|
+
multiple: z.boolean().default(false),
|
|
128
|
+
}),
|
|
129
|
+
contentFieldBaseSchema.extend({
|
|
130
|
+
type: z.literal("relation"),
|
|
131
|
+
collection: contentIdentifierSchema,
|
|
132
|
+
multiple: z.boolean().default(false),
|
|
133
|
+
}),
|
|
134
|
+
contentFieldBaseSchema.extend({
|
|
135
|
+
type: z.literal("select"),
|
|
136
|
+
options: z.array(z.string().trim().min(1).max(120)).min(1).max(100),
|
|
137
|
+
multiple: z.boolean().default(false),
|
|
138
|
+
}),
|
|
139
|
+
]);
|
|
140
|
+
export const contentCollectionSchema = z
|
|
141
|
+
.object({
|
|
142
|
+
resourceId: z.string().min(8).max(96),
|
|
143
|
+
name: contentIdentifierSchema,
|
|
144
|
+
label: contentLabelSchema,
|
|
145
|
+
singularLabel: contentLabelSchema,
|
|
146
|
+
public: z.boolean().default(true),
|
|
147
|
+
fields: z
|
|
148
|
+
.record(contentFieldIdentifierSchema, contentFieldSchema)
|
|
149
|
+
.refine((fields) => Object.keys(fields).length <= CONTENT_CAPS.fieldsPerCollection, {
|
|
150
|
+
message: `must contain at most ${CONTENT_CAPS.fieldsPerCollection} fields`,
|
|
151
|
+
}),
|
|
152
|
+
})
|
|
153
|
+
.strict();
|
|
154
|
+
export const contentManifestSchema = z
|
|
155
|
+
.object({
|
|
156
|
+
format: z.literal(CONTENT_SCHEMA_FORMAT),
|
|
157
|
+
version: z.literal(CONTENT_API_VERSION),
|
|
158
|
+
collections: z
|
|
159
|
+
.record(contentIdentifierSchema, contentCollectionSchema)
|
|
160
|
+
.refine((collections) => Object.keys(collections).length <= CONTENT_CAPS.collections, {
|
|
161
|
+
message: `must contain at most ${CONTENT_CAPS.collections} collections`,
|
|
162
|
+
}),
|
|
163
|
+
})
|
|
164
|
+
.strict()
|
|
165
|
+
.superRefine((manifest, context) => {
|
|
166
|
+
const resourceIds = new Map();
|
|
167
|
+
const collectionNames = new Set([
|
|
168
|
+
"posts",
|
|
169
|
+
"pages",
|
|
170
|
+
"media",
|
|
171
|
+
...Object.keys(manifest.collections),
|
|
172
|
+
]);
|
|
173
|
+
for (const [name, collection] of Object.entries(manifest.collections)) {
|
|
174
|
+
if (collection.name !== name) {
|
|
175
|
+
context.addIssue({
|
|
176
|
+
code: "custom",
|
|
177
|
+
message: `collection key "${name}" must match collection.name`,
|
|
178
|
+
path: ["collections", name, "name"],
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (name === "posts" || name === "pages" || name === "media") {
|
|
182
|
+
context.addIssue({
|
|
183
|
+
code: "custom",
|
|
184
|
+
message: `collection name "${name}" is reserved`,
|
|
185
|
+
path: ["collections", name],
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const existingName = resourceIds.get(collection.resourceId);
|
|
189
|
+
if (existingName !== undefined) {
|
|
190
|
+
context.addIssue({
|
|
191
|
+
code: "custom",
|
|
192
|
+
message: `resourceId is already used by collection "${existingName}"`,
|
|
193
|
+
path: ["collections", name, "resourceId"],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
resourceIds.set(collection.resourceId, name);
|
|
198
|
+
}
|
|
199
|
+
for (const [fieldName, field] of Object.entries(collection.fields)) {
|
|
200
|
+
if (field.type === "relation" && !collectionNames.has(field.collection)) {
|
|
201
|
+
context.addIssue({
|
|
202
|
+
code: "custom",
|
|
203
|
+
message: `relation collection "${field.collection}" does not exist`,
|
|
204
|
+
path: ["collections", name, "fields", fieldName, "collection"],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
export const contentScalarSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
211
|
+
const contentValueSchema = z.union([contentScalarSchema, z.array(contentScalarSchema).max(100)]);
|
|
212
|
+
export const contentFilterSchema = z
|
|
213
|
+
.object({
|
|
214
|
+
field: contentFieldIdentifierSchema,
|
|
215
|
+
operator: z.enum(["eq", "neq", "in", "notIn", "gt", "gte", "lt", "lte", "contains", "exists"]),
|
|
216
|
+
value: contentValueSchema.optional(),
|
|
217
|
+
})
|
|
218
|
+
.strict()
|
|
219
|
+
.superRefine((filter, context) => {
|
|
220
|
+
if (filter.operator !== "exists" && filter.value === undefined) {
|
|
221
|
+
context.addIssue({ code: "custom", message: "value is required", path: ["value"] });
|
|
222
|
+
}
|
|
223
|
+
if ((filter.operator === "in" || filter.operator === "notIn") && !Array.isArray(filter.value)) {
|
|
224
|
+
context.addIssue({ code: "custom", message: "value must be an array", path: ["value"] });
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
export const contentOrderSchema = z
|
|
228
|
+
.object({
|
|
229
|
+
field: contentFieldIdentifierSchema,
|
|
230
|
+
direction: z.enum(["asc", "desc"]).default("asc"),
|
|
231
|
+
})
|
|
232
|
+
.strict();
|
|
233
|
+
export const contentQuerySchema = z
|
|
234
|
+
.object({
|
|
235
|
+
collection: contentIdentifierSchema,
|
|
236
|
+
where: z.array(contentFilterSchema).max(CONTENT_CAPS.filterClauses).default([]),
|
|
237
|
+
orderBy: z.array(contentOrderSchema).max(1).default([]),
|
|
238
|
+
limit: z.number().int().positive().max(CONTENT_CAPS.pageSize).default(20),
|
|
239
|
+
cursor: z.string().min(1).max(512).optional(),
|
|
240
|
+
select: z.array(contentFieldIdentifierSchema).max(CONTENT_CAPS.selectFields).optional(),
|
|
241
|
+
status: z.enum(["publish", "draft", "any"]).default("publish"),
|
|
242
|
+
})
|
|
243
|
+
.strict();
|
|
244
|
+
export const contentBatchQueryRequestSchema = z
|
|
245
|
+
.object({
|
|
246
|
+
format: z.literal(CONTENT_QUERY_FORMAT),
|
|
247
|
+
version: z.literal(CONTENT_API_VERSION),
|
|
248
|
+
queries: z.record(contentQueryKeySchema, contentQuerySchema).refine((queries) => {
|
|
249
|
+
const length = Object.keys(queries).length;
|
|
250
|
+
return length > 0 && length <= CONTENT_CAPS.batchQueries;
|
|
251
|
+
}, { message: `must contain between 1 and ${CONTENT_CAPS.batchQueries} queries` }),
|
|
252
|
+
})
|
|
253
|
+
.strict();
|
|
254
|
+
export const contentItemSchema = z
|
|
255
|
+
.object({
|
|
256
|
+
id: z.number().int().positive(),
|
|
257
|
+
slug: z.string(),
|
|
258
|
+
status: z.string(),
|
|
259
|
+
title: z.string(),
|
|
260
|
+
createdAt: z.string(),
|
|
261
|
+
updatedAt: z.string(),
|
|
262
|
+
fields: z.record(z.string(), z.unknown()),
|
|
263
|
+
})
|
|
264
|
+
.passthrough();
|
|
265
|
+
export const contentQueryResultSchema = z.object({
|
|
266
|
+
items: z.array(contentItemSchema),
|
|
267
|
+
total: z.number().int().nonnegative(),
|
|
268
|
+
nextCursor: z.string().nullable(),
|
|
269
|
+
});
|
|
270
|
+
export const contentBatchQueryResponseSchema = z
|
|
271
|
+
.object({
|
|
272
|
+
format: z.literal(CONTENT_QUERY_FORMAT),
|
|
273
|
+
version: z.literal(CONTENT_API_VERSION),
|
|
274
|
+
results: z.record(contentQueryKeySchema, contentQueryResultSchema),
|
|
275
|
+
})
|
|
276
|
+
.strict();
|
|
277
|
+
const contentDocumentFields = {
|
|
278
|
+
collection: contentIdentifierSchema,
|
|
279
|
+
slug: z.string().trim().min(1).max(200),
|
|
280
|
+
title: z.string().max(500),
|
|
281
|
+
status: z.enum(["draft", "publish"]).default("draft"),
|
|
282
|
+
fields: z.record(contentFieldIdentifierSchema, z.unknown()).default({}),
|
|
283
|
+
};
|
|
284
|
+
export const contentDocumentInputSchema = z.union([
|
|
285
|
+
z.object({ ...contentDocumentFields, id: z.number().int().positive() }).strict(),
|
|
286
|
+
z.object({ ...contentDocumentFields, externalId: z.string().min(1).max(255) }).strict(),
|
|
287
|
+
]);
|
|
288
|
+
export const contentAdminSessionSchema = z
|
|
289
|
+
.object({
|
|
290
|
+
url: z.string().url(),
|
|
291
|
+
expiresAt: z.string().datetime(),
|
|
292
|
+
})
|
|
293
|
+
.strict();
|
|
294
|
+
export const contentMarkdownSyncInputSchema = z
|
|
295
|
+
.object({
|
|
296
|
+
collection: contentIdentifierSchema.default("posts"),
|
|
297
|
+
markdown: z.string().max(200_000),
|
|
298
|
+
slug: z.string().trim().min(1).max(200),
|
|
299
|
+
source: z.string().trim().min(1).max(1_000),
|
|
300
|
+
status: z.enum(["draft", "publish"]).default("draft"),
|
|
301
|
+
title: z.string().max(500),
|
|
302
|
+
})
|
|
303
|
+
.strict();
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const RequiresActionTypeSchema: z.ZodEnum<{
|
|
3
3
|
device_authorization: "device_authorization";
|
|
4
|
+
confirmation: "confirmation";
|
|
5
|
+
elevation: "elevation";
|
|
4
6
|
}>;
|
|
5
7
|
export declare const RequiresActionSchema: z.ZodObject<{
|
|
6
8
|
actionType: z.ZodEnum<{
|
|
7
9
|
device_authorization: "device_authorization";
|
|
10
|
+
confirmation: "confirmation";
|
|
11
|
+
elevation: "elevation";
|
|
8
12
|
}>;
|
|
9
13
|
instruction: z.ZodString;
|
|
10
14
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
pollUrl: z.ZodOptional<z.ZodString>;
|
|
11
16
|
continuationToken: z.ZodString;
|
|
12
17
|
pollAfterSeconds: z.ZodNumber;
|
|
13
18
|
expiresAt: z.ZodString;
|
|
14
19
|
}, z.core.$strict>;
|
|
15
20
|
export type RequiresAction = z.infer<typeof RequiresActionSchema>;
|
|
16
|
-
/** The canonical `{ requiresAction }` envelope, additive alongside `{ data }` / `{ error }`. */
|
|
17
21
|
export declare const RequiresActionEnvelopeSchema: z.ZodObject<{
|
|
18
22
|
requiresAction: z.ZodObject<{
|
|
19
23
|
actionType: z.ZodEnum<{
|
|
20
24
|
device_authorization: "device_authorization";
|
|
25
|
+
confirmation: "confirmation";
|
|
26
|
+
elevation: "elevation";
|
|
21
27
|
}>;
|
|
22
28
|
instruction: z.ZodString;
|
|
23
29
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
pollUrl: z.ZodOptional<z.ZodString>;
|
|
24
31
|
continuationToken: z.ZodString;
|
|
25
32
|
pollAfterSeconds: z.ZodNumber;
|
|
26
33
|
expiresAt: z.ZodString;
|
|
@@ -34,9 +41,12 @@ export declare const ActionResumeResponseSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
34
41
|
requiresAction: z.ZodObject<{
|
|
35
42
|
actionType: z.ZodEnum<{
|
|
36
43
|
device_authorization: "device_authorization";
|
|
44
|
+
confirmation: "confirmation";
|
|
45
|
+
elevation: "elevation";
|
|
37
46
|
}>;
|
|
38
47
|
instruction: z.ZodString;
|
|
39
48
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
pollUrl: z.ZodOptional<z.ZodString>;
|
|
40
50
|
continuationToken: z.ZodString;
|
|
41
51
|
pollAfterSeconds: z.ZodNumber;
|
|
42
52
|
expiresAt: z.ZodString;
|
|
@@ -45,18 +55,24 @@ export declare const ActionResumeResponseSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
45
55
|
status: z.ZodLiteral<"completed">;
|
|
46
56
|
actionType: z.ZodEnum<{
|
|
47
57
|
device_authorization: "device_authorization";
|
|
58
|
+
confirmation: "confirmation";
|
|
59
|
+
elevation: "elevation";
|
|
48
60
|
}>;
|
|
49
61
|
result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
50
62
|
}, z.core.$strict>, z.ZodObject<{
|
|
51
63
|
status: z.ZodLiteral<"denied">;
|
|
52
64
|
actionType: z.ZodEnum<{
|
|
53
65
|
device_authorization: "device_authorization";
|
|
66
|
+
confirmation: "confirmation";
|
|
67
|
+
elevation: "elevation";
|
|
54
68
|
}>;
|
|
55
69
|
message: z.ZodString;
|
|
56
70
|
}, z.core.$strict>, z.ZodObject<{
|
|
57
71
|
status: z.ZodLiteral<"expired">;
|
|
58
72
|
actionType: z.ZodEnum<{
|
|
59
73
|
device_authorization: "device_authorization";
|
|
74
|
+
confirmation: "confirmation";
|
|
75
|
+
elevation: "elevation";
|
|
60
76
|
}>;
|
|
61
77
|
message: z.ZodString;
|
|
62
78
|
}, z.core.$strict>], "status">;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AnyObjectSchema } from "./common.js";
|
|
3
|
-
// Canonical `requires_action` result envelope
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// human
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// the additive third shape alongside `{ data }` / `{ error }`: it tells the caller
|
|
10
|
-
// exactly what human step is pending, where to send the human, and — crucially —
|
|
11
|
-
// hands back a short-lived, single-use, principal-scoped continuation token plus a
|
|
12
|
-
// poll hint so the SAME agent can drive the flow to completion through the
|
|
13
|
-
// generalized resume endpoint once the human step is done.
|
|
3
|
+
// Canonical `requires_action` result envelope, the third shape alongside
|
|
4
|
+
// `{ data }` / `{ error }`. Some flows need an out-of-band human step (approve a
|
|
5
|
+
// device in the browser). This says what step is pending and where to send the
|
|
6
|
+
// human, and hands back a short-lived, single-use, principal-scoped continuation
|
|
7
|
+
// token plus a poll hint, so the SAME agent can finish through resume.
|
|
8
|
+
// New blocking steps are added here, so resume stays one generalized contract.
|
|
14
9
|
export const RequiresActionTypeSchema = z
|
|
15
|
-
.enum(["device_authorization"])
|
|
16
|
-
.describe("Stable identifier for the out-of-band step that blocks the flow.
|
|
10
|
+
.enum(["device_authorization", "confirmation", "elevation"])
|
|
11
|
+
.describe("Stable identifier for the out-of-band step that blocks the flow.");
|
|
17
12
|
export const RequiresActionSchema = z
|
|
18
13
|
.object({
|
|
19
14
|
actionType: RequiresActionTypeSchema,
|
|
20
|
-
instruction: z
|
|
21
|
-
.string()
|
|
22
|
-
.describe("Human-facing instruction describing the step a person must complete out of band."),
|
|
15
|
+
instruction: z.string().describe("The step a person must complete out of band."),
|
|
23
16
|
url: z
|
|
24
17
|
.string()
|
|
25
18
|
.url()
|
|
26
19
|
.nullable()
|
|
27
20
|
.optional()
|
|
28
21
|
.describe("Where to send the human to complete the step, when a destination exists."),
|
|
22
|
+
// `url` / `pollUrl` / `continuationToken` are the blocked-agent key set, and
|
|
23
|
+
// they are spelled the same way here and in the `confirmation_required`
|
|
24
|
+
// problem document. One flow that answers with two vocabularies is a flow
|
|
25
|
+
// agents have to special-case twice.
|
|
26
|
+
pollUrl: z
|
|
27
|
+
.string()
|
|
28
|
+
.url()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Where to POST the continuationToken to poll this flow: `/v1/actions/resume`."),
|
|
29
31
|
continuationToken: z
|
|
30
32
|
.string()
|
|
31
33
|
.min(1)
|
|
32
|
-
.describe("Short-lived, principal-scoped capability for this
|
|
34
|
+
.describe("Short-lived, principal-scoped capability for this flow. Present it to POST /v1/actions/resume to poll and complete. Single-use on completion. A secret: never log it."),
|
|
33
35
|
pollAfterSeconds: z
|
|
34
36
|
.number()
|
|
35
37
|
.int()
|
|
36
38
|
.positive()
|
|
37
|
-
.describe("Minimum
|
|
39
|
+
.describe("Minimum seconds to wait before calling resume again."),
|
|
38
40
|
expiresAt: z
|
|
39
41
|
.string()
|
|
40
42
|
.datetime()
|
|
41
|
-
.describe("
|
|
43
|
+
.describe("Deadline for the human step. Resume after this returns terminal `expired`; the token survives a short grace so resume can say so, but the flow can no longer be redeemed."),
|
|
42
44
|
})
|
|
43
45
|
.strict();
|
|
44
|
-
/** The canonical `{ requiresAction }` envelope, additive alongside `{ data }` / `{ error }`. */
|
|
45
46
|
export const RequiresActionEnvelopeSchema = z
|
|
46
47
|
.object({ requiresAction: RequiresActionSchema })
|
|
47
48
|
.strict();
|
|
48
49
|
// Generalized resume/poll contract. One endpoint (`POST /v1/actions/resume`)
|
|
49
|
-
// drives every requires_action flow to completion from its continuation token
|
|
50
|
-
// agents learn the pattern once and reuse it everywhere.
|
|
50
|
+
// drives every requires_action flow to completion from its continuation token.
|
|
51
51
|
export const ActionResumeRequestSchema = z
|
|
52
52
|
.object({
|
|
53
53
|
continuationToken: z
|
|
@@ -70,7 +70,7 @@ export const ActionResumeResponseSchema = z
|
|
|
70
70
|
.object({
|
|
71
71
|
status: z.literal("completed"),
|
|
72
72
|
actionType: RequiresActionTypeSchema,
|
|
73
|
-
result: AnyObjectSchema.describe("
|
|
73
|
+
result: AnyObjectSchema.describe("The flow returns this result one time. Device authorization returns an API key. Confirmation returns an action receipt. Elevation returns a lease receipt."),
|
|
74
74
|
})
|
|
75
75
|
.strict(),
|
|
76
76
|
z
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// ISO 3166-1 alpha-2 country codes used by Grant network constraints. The
|
|
2
|
-
// runtime compares them with the edge-supplied country header.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// ranges). Display names are a UI concern (`Intl.DisplayNames`), never stored.
|
|
2
|
+
// runtime compares them with the edge-supplied country header. Officially
|
|
3
|
+
// assigned codes only (no exceptionally-reserved / user-assigned ranges).
|
|
4
|
+
// Display names are a UI concern (`Intl.DisplayNames`), never stored.
|
|
6
5
|
export const ISO_COUNTRY_CODES = [
|
|
7
6
|
"AD",
|
|
8
7
|
"AE",
|
|
@@ -2,8 +2,18 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const spaceCronFailureSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
4
|
occurredAt: z.ZodString;
|
|
5
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
6
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
5
7
|
}, z.core.$strip>;
|
|
6
8
|
export type SpaceCronFailure = z.infer<typeof spaceCronFailureSchema>;
|
|
9
|
+
export declare const spaceCronUnattributedFailureSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
occurredAt: z.ZodString;
|
|
12
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
13
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
14
|
+
key: z.ZodNullable<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type SpaceCronUnattributedFailure = z.infer<typeof spaceCronUnattributedFailureSchema>;
|
|
7
17
|
export declare const spaceCronListItemSchema: z.ZodObject<{
|
|
8
18
|
key: z.ZodString;
|
|
9
19
|
path: z.ZodString;
|
|
@@ -11,6 +21,8 @@ export declare const spaceCronListItemSchema: z.ZodObject<{
|
|
|
11
21
|
recentFailures: z.ZodArray<z.ZodObject<{
|
|
12
22
|
id: z.ZodString;
|
|
13
23
|
occurredAt: z.ZodString;
|
|
24
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
14
26
|
}, z.core.$strip>>;
|
|
15
27
|
}, z.core.$strip>;
|
|
16
28
|
export type SpaceCronListItem = z.infer<typeof spaceCronListItemSchema>;
|
|
@@ -24,11 +36,16 @@ export declare const spaceCronsResponseSchema: z.ZodObject<{
|
|
|
24
36
|
recentFailures: z.ZodArray<z.ZodObject<{
|
|
25
37
|
id: z.ZodString;
|
|
26
38
|
occurredAt: z.ZodString;
|
|
39
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
27
41
|
}, z.core.$strip>>;
|
|
28
42
|
}, z.core.$strip>>;
|
|
29
43
|
unattributedFailures: z.ZodArray<z.ZodObject<{
|
|
30
44
|
id: z.ZodString;
|
|
31
45
|
occurredAt: z.ZodString;
|
|
46
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
47
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
48
|
+
key: z.ZodNullable<z.ZodString>;
|
|
32
49
|
}, z.core.$strip>>;
|
|
33
50
|
}, z.core.$strip>;
|
|
34
51
|
}, z.core.$strip>;
|
package/dist/contracts/crons.js
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// Crons READ surface: what the live version declares, plus what has failed.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
3
|
+
// There is no write side. `crons` is an sf.jsonc key, so the config file is the
|
|
4
|
+
// only writer and a publish the only edit, which is what makes a rollback
|
|
5
|
+
// restore the previous schedules for free.
|
|
6
|
+
// One reported failure. Pinned to what the platform provably knows: the
|
|
7
|
+
// identity, the instant, the run's exit status when the provider delivery
|
|
8
|
+
// carried one, and what that status means on our runtime (the scheduled
|
|
9
|
+
// command is ours — runtime/engine/entrypoints/cron.php defines the exit-code
|
|
10
|
+
// contract). Deeper detail (run output, the handler's HTTP status, whether a
|
|
11
|
+
// report is a concurrency-limit skip rather than a non-zero exit) stays out of
|
|
12
|
+
// the public contract until a captured live delivery pins the provider's
|
|
13
|
+
// shape. Nothing from the raw delivery is ever echoed: run output can contain
|
|
14
|
+
// an author's response bodies and secrets.
|
|
14
15
|
export const spaceCronFailureSchema = z.object({
|
|
15
|
-
id: z.string().describe("
|
|
16
|
+
id: z.string().describe("Failure report id."),
|
|
16
17
|
occurredAt: z.string().datetime().describe("Instant the failure was reported."),
|
|
18
|
+
exitCode: z
|
|
19
|
+
.number()
|
|
20
|
+
.int()
|
|
21
|
+
.nullable()
|
|
22
|
+
.describe("Exit status the platform reported for the run. Null when the failure report did not carry one."),
|
|
23
|
+
reason: z
|
|
24
|
+
.string()
|
|
25
|
+
.nullable()
|
|
26
|
+
.describe("What the exit status means on this runtime, when it maps to a known failure mode. Null when unknown."),
|
|
27
|
+
});
|
|
28
|
+
// An unattributed failure also carries the key the platform reported, so a
|
|
29
|
+
// failure from a cron since removed from the config can still say which entry
|
|
30
|
+
// it belonged to. Null when the report named no key at all.
|
|
31
|
+
export const spaceCronUnattributedFailureSchema = spaceCronFailureSchema.extend({
|
|
32
|
+
key: z
|
|
33
|
+
.string()
|
|
34
|
+
.nullable()
|
|
35
|
+
.describe("Key the failure report named — an entry the live config no longer declares — or null when the report carried none."),
|
|
17
36
|
});
|
|
18
37
|
// One scheduled entry, exactly as the live version declared it. `key` is the
|
|
19
|
-
// path's slug and
|
|
20
|
-
// the failure reports, the platform's own bookkeeping.
|
|
38
|
+
// path's slug and names the entry in the CLI, failure reports, and bookkeeping.
|
|
21
39
|
export const spaceCronListItemSchema = z.object({
|
|
22
40
|
key: z.string().describe("Stable identifier for this entry, derived from its path."),
|
|
23
41
|
path: z.string().describe("Path on this space that gets requested."),
|
|
@@ -36,7 +54,7 @@ export const spaceCronsResponseSchema = z.object({
|
|
|
36
54
|
.describe("Live version these declarations come from, or null before the first publish."),
|
|
37
55
|
crons: z.array(spaceCronListItemSchema),
|
|
38
56
|
unattributedFailures: z
|
|
39
|
-
.array(
|
|
57
|
+
.array(spaceCronUnattributedFailureSchema)
|
|
40
58
|
.describe("Failures that could not be tied to one entry, newest first. A cron removed from the config can still have failed while it was live."),
|
|
41
59
|
}),
|
|
42
60
|
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Most keys one user's preference bag may hold. */
|
|
3
|
+
export declare const DASHBOARD_PREFS_MAX_KEYS = 50;
|
|
4
|
+
/** Longest single preference key, in characters. */
|
|
5
|
+
export declare const DASHBOARD_PREFS_MAX_KEY_LENGTH = 64;
|
|
6
|
+
/** Largest serialized preference bag, in UTF-8 bytes. */
|
|
7
|
+
export declare const DASHBOARD_PREFS_MAX_BYTES: number;
|
|
8
|
+
/**
|
|
9
|
+
* The stored bag. Values stay `unknown`: every reader narrows with its own
|
|
10
|
+
* schema rather than trusting a shape the server never enforced.
|
|
11
|
+
*/
|
|
12
|
+
export declare const dashboardPrefsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
13
|
+
export type DashboardPrefs = z.infer<typeof dashboardPrefsSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* One value out of the bag, as wide as JSON. This is the type every consumer
|
|
16
|
+
* narrows FROM, at the boundary.
|
|
17
|
+
*/
|
|
18
|
+
export type DashboardPrefValue = DashboardPrefs[string];
|
|
19
|
+
/**
|
|
20
|
+
* The PATCH body: a partial bag merged key-wise into the stored one. An explicit
|
|
21
|
+
* `null` deletes its key.
|
|
22
|
+
*/
|
|
23
|
+
export declare const dashboardPrefsPatchSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
24
|
+
export type DashboardPrefsPatch = z.infer<typeof dashboardPrefsPatchSchema>;
|
|
25
|
+
/** The dashboard appearance key. */
|
|
26
|
+
export declare const DASHBOARD_PREF_APPEARANCE = "appearance";
|
|
27
|
+
/** Personal space favorites: the starred space ids, across every team. */
|
|
28
|
+
export declare const DASHBOARD_PREF_SPACE_FAVORITES = "spaceFavorites";
|
|
29
|
+
/**
|
|
30
|
+
* Favorites value: unique space ids. Capped well under the bag's byte budget —
|
|
31
|
+
* a favorite is a shortcut, and hundreds of shortcuts stop being one. Ids the
|
|
32
|
+
* server can no longer resolve to a live space are dropped on write.
|
|
33
|
+
*/
|
|
34
|
+
export declare const spaceFavoritesPreferenceSchema: z.ZodArray<z.ZodString>;
|
|
35
|
+
export type SpaceFavoritesPreference = z.infer<typeof spaceFavoritesPreferenceSchema>;
|
|
36
|
+
/** Personal manual space ordering, keyed by team id. */
|
|
37
|
+
export declare const DASHBOARD_PREF_SPACE_ORDERS = "spaceOrders";
|
|
38
|
+
/**
|
|
39
|
+
* Per-team ordered space ids for the "custom order" of the spaces list. This is
|
|
40
|
+
* the only home for a manual space order: it is per-user, like every other
|
|
41
|
+
* dashboard preference. Ids the server can no longer resolve to a live space of
|
|
42
|
+
* that team are dropped on write, so a deleted space cannot squat a slot.
|
|
43
|
+
*/
|
|
44
|
+
export declare const spaceOrdersPreferenceSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
45
|
+
export type SpaceOrdersPreference = z.infer<typeof spaceOrdersPreferenceSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* Values the appearance preference may take. `system` follows the OS setting
|
|
48
|
+
* live; the other two pin it. Mirrors the client-side `ThemePreference` union
|
|
49
|
+
* in `@spacefast/app-shell/lib/theme`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const appearancePreferenceSchema: z.ZodEnum<{
|
|
52
|
+
dark: "dark";
|
|
53
|
+
light: "light";
|
|
54
|
+
system: "system";
|
|
55
|
+
}>;
|
|
56
|
+
export type AppearancePreference = z.infer<typeof appearancePreferenceSchema>;
|