@spacefast/common 0.2.1 → 0.4.1
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/marketplace-prompts.d.ts +1 -0
- package/dist/agents/marketplace-prompts.js +6 -0
- package/dist/agents/registry/core.d.ts +4 -12
- package/dist/agents/registry/core.js +7 -28
- package/dist/config/domains.d.ts +10 -8
- package/dist/config/domains.js +4 -7
- package/dist/contracts/access-core.d.ts +135 -0
- package/dist/contracts/access-core.js +242 -0
- package/dist/contracts/access-profiles.d.ts +8 -8
- package/dist/contracts/access-profiles.js +8 -8
- package/dist/contracts/access.d.ts +14 -103
- package/dist/contracts/access.js +10 -210
- package/dist/contracts/activity.d.ts +54 -55
- package/dist/contracts/activity.js +38 -9
- package/dist/contracts/api-keys.d.ts +69 -26
- package/dist/contracts/api-keys.js +29 -2
- package/dist/contracts/application-journal.d.ts +197 -4
- package/dist/contracts/application-journal.js +97 -16
- package/dist/contracts/auth.d.ts +20 -0
- package/dist/contracts/auth.js +18 -0
- package/dist/contracts/beta.d.ts +13 -0
- package/dist/contracts/beta.js +28 -0
- package/dist/contracts/billing.d.ts +2 -2
- package/dist/contracts/bootstrap.d.ts +23 -6
- package/dist/contracts/builds.d.ts +24 -4
- package/dist/contracts/builds.js +16 -4
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +22 -6
- package/dist/contracts/comments.d.ts +49 -0
- package/dist/contracts/comments.js +61 -2
- package/dist/contracts/commerce.d.ts +19 -13
- package/dist/contracts/connector-access.d.ts +28 -0
- package/dist/contracts/connector-access.js +31 -0
- package/dist/contracts/connectors.d.ts +2382 -0
- package/dist/contracts/connectors.js +941 -0
- package/dist/contracts/content-contract-verification.d.ts +112 -58
- package/dist/contracts/content-contract-verification.js +42 -54
- package/dist/contracts/content-model-emit.d.ts +97 -0
- package/dist/contracts/content-model-emit.js +306 -0
- package/dist/contracts/content-model-sdk.d.ts +101 -0
- package/dist/contracts/content-model-sdk.js +232 -0
- package/dist/contracts/{content-program.d.ts → content-model.d.ts} +338 -82
- package/dist/contracts/{content-program.js → content-model.js} +291 -63
- package/dist/contracts/content-platform-fixture.d.ts +380 -110
- package/dist/contracts/content-platform-fixture.js +8 -8
- package/dist/contracts/content-sync.d.ts +197 -74
- package/dist/contracts/content-sync.js +98 -37
- package/dist/contracts/content.d.ts +30 -422
- package/dist/contracts/content.js +34 -294
- package/dist/contracts/dashboard-prefs.d.ts +10 -3
- package/dist/contracts/dashboard-prefs.js +6 -3
- package/dist/contracts/data-location.d.ts +9 -0
- package/dist/contracts/data-location.js +7 -0
- package/dist/contracts/deployment-comparison.d.ts +67 -0
- package/dist/contracts/deployment-comparison.js +68 -0
- package/dist/contracts/device-auth.d.ts +55 -11
- package/dist/contracts/domains.d.ts +40 -16
- package/dist/contracts/domains.js +23 -0
- package/dist/contracts/enums.d.ts +1 -10
- package/dist/contracts/enums.js +0 -15
- package/dist/contracts/error-code-meta.d.ts +388 -20
- package/dist/contracts/error-code-meta.js +201 -5
- package/dist/contracts/error-codes.d.ts +17 -4
- package/dist/contracts/error-codes.js +109 -10
- package/dist/contracts/events.d.ts +5 -0
- package/dist/contracts/events.js +12 -3
- package/dist/contracts/execution.d.ts +5 -1
- package/dist/contracts/execution.js +4 -0
- package/dist/contracts/feature-lifecycle.d.ts +53 -20
- package/dist/contracts/feature-lifecycle.js +65 -23
- package/dist/contracts/features.d.ts +57 -31
- package/dist/contracts/features.js +0 -1
- package/dist/contracts/feedback.d.ts +124 -0
- package/dist/contracts/feedback.js +64 -0
- package/dist/contracts/fixtures/content-model-sdk-v1.generated.d.ts +129 -0
- package/dist/contracts/fixtures/content-model-sdk-v1.generated.js +48 -0
- package/dist/contracts/fixtures/content-platform-v1.json +101 -49
- package/dist/contracts/frame-session.d.ts +60 -10
- package/dist/contracts/frame-session.js +52 -12
- package/dist/contracts/functions.d.ts +28 -2
- package/dist/contracts/functions.js +25 -2
- package/dist/contracts/grant-copy.d.ts +2 -0
- package/dist/contracts/grant-copy.js +2 -0
- package/dist/contracts/grants-core.d.ts +95 -0
- package/dist/contracts/grants-core.js +435 -0
- package/dist/contracts/grants.d.ts +13 -84
- package/dist/contracts/grants.js +21 -369
- package/dist/contracts/ids-core.d.ts +11 -0
- package/dist/contracts/ids-core.js +14 -0
- package/dist/contracts/ids.d.ts +7 -4
- package/dist/contracts/ids.js +12 -4
- package/dist/contracts/internal.d.ts +18 -0
- package/dist/contracts/internal.js +19 -0
- package/dist/contracts/mcp.d.ts +8 -18
- package/dist/contracts/mcp.js +2 -23
- package/dist/contracts/notifications.d.ts +4 -1
- package/dist/contracts/notifications.js +1 -0
- package/dist/contracts/oauth-resources.d.ts +55 -9
- package/dist/contracts/oauth-resources.js +64 -1
- package/dist/contracts/oauth-scope-actions.d.ts +27 -3
- package/dist/contracts/oauth-scope-actions.js +18 -8
- package/dist/contracts/operations.d.ts +1 -1
- package/dist/contracts/partner-account.d.ts +629 -0
- package/dist/contracts/partner-account.js +18 -0
- package/dist/contracts/principal-assertion.d.ts +74 -1
- package/dist/contracts/principal-assertion.js +67 -3
- package/dist/contracts/publish-archive.d.ts +22 -1
- package/dist/contracts/push-new.d.ts +3 -3
- package/dist/contracts/push-new.js +1 -1
- package/dist/contracts/quotas.js +2 -1
- package/dist/contracts/repository-connections.d.ts +10 -6
- package/dist/contracts/repository-connections.js +15 -0
- package/dist/contracts/resources.d.ts +6 -5
- package/dist/contracts/resources.js +7 -0
- package/dist/contracts/route-inventory.d.ts +74 -19
- package/dist/contracts/route-inventory.js +20 -6
- package/dist/contracts/runtime-api.d.ts +415 -4
- package/dist/contracts/runtime-api.js +60 -15
- package/dist/contracts/runtime-app.d.ts +6 -1
- package/dist/contracts/runtime-components.d.ts +646 -18
- package/dist/contracts/runtime-components.js +304 -188
- package/dist/contracts/runtime-services.d.ts +15 -0
- package/dist/contracts/runtime-services.js +25 -0
- package/dist/contracts/runtime-storage.d.ts +32 -0
- package/dist/contracts/runtime-storage.js +37 -0
- package/dist/contracts/source-workspaces.d.ts +511 -0
- package/dist/contracts/source-workspaces.js +276 -0
- package/dist/contracts/space-config-spacefast.d.ts +394 -0
- package/dist/contracts/space-config-spacefast.js +70 -0
- package/dist/contracts/space-config.d.ts +177 -90
- package/dist/contracts/space-config.js +77 -92
- package/dist/contracts/spaces.d.ts +132 -24
- package/dist/contracts/spaces.js +77 -13
- package/dist/contracts/superadmin-connectors.d.ts +371 -0
- package/dist/contracts/superadmin-connectors.js +61 -0
- package/dist/contracts/superadmin-emails.d.ts +1 -1
- package/dist/contracts/superadmin-emails.js +1 -1
- package/dist/contracts/superadmin-entities.d.ts +105 -0
- package/dist/contracts/superadmin-entities.js +64 -0
- package/dist/contracts/superadmin-runtime.d.ts +35 -116
- package/dist/contracts/superadmin-runtime.js +13 -69
- package/dist/contracts/superadmin-search.d.ts +12 -14
- package/dist/contracts/superadmin-search.js +2 -2
- package/dist/contracts/superadmin-spaces.d.ts +15 -72
- package/dist/contracts/superadmin-spaces.js +2 -7
- package/dist/contracts/superadmin-teams.d.ts +12 -0
- package/dist/contracts/superadmin-teams.js +7 -1
- package/dist/contracts/superadmin-tenants.d.ts +44 -16
- package/dist/contracts/superadmin.d.ts +2 -2
- package/dist/contracts/tags.d.ts +12 -12
- package/dist/contracts/teams.d.ts +29 -1
- package/dist/contracts/teams.js +24 -2
- package/dist/contracts/tenants.d.ts +98 -0
- package/dist/contracts/tenants.js +20 -0
- package/dist/contracts/transfers.d.ts +92 -0
- package/dist/contracts/transfers.js +37 -0
- package/dist/contracts/usage.d.ts +9 -1
- package/dist/contracts/usage.js +2 -0
- package/dist/contracts/visual-review.d.ts +448 -0
- package/dist/contracts/visual-review.js +156 -0
- package/dist/contracts/wordpress-php-toolkit.json +9 -0
- package/dist/contracts/work-mode.d.ts +24 -0
- package/dist/contracts/work-mode.js +17 -0
- package/dist/contracts/wp-cli.d.ts +66 -0
- package/dist/contracts/wp-cli.js +68 -0
- package/dist/contracts/zero-catalog.d.ts +29 -0
- package/dist/contracts/zero-catalog.js +55 -0
- package/dist/contracts/zero-platform-abilities.generated.d.ts +31 -0
- package/dist/contracts/zero-platform-abilities.generated.js +373 -0
- package/dist/contracts/zero-spacefast.d.ts +444 -0
- package/dist/contracts/zero-spacefast.js +149 -0
- package/dist/contracts/zero-types.d.ts +47 -0
- package/dist/contracts/zero-types.js +263 -0
- package/dist/contracts/zero.d.ts +781 -14
- package/dist/contracts/zero.js +204 -10
- package/dist/dashboard-paths/index.d.ts +2 -2
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -2
- package/dist/dashboard-paths/route-reservations.generated.js +5 -0
- package/dist/docs/agent-prose.d.ts +1 -1
- package/dist/docs/agent-prose.js +15 -18
- package/dist/docs/agent-setup.d.ts +1 -1
- package/dist/docs/agent-setup.js +5 -13
- package/dist/docs/catalog.d.ts +64 -28
- package/dist/docs/catalog.js +155 -28
- package/dist/docs/error-docs.d.ts +365 -17
- package/dist/docs/error-docs.js +369 -21
- package/dist/docs/reference-urls.js +1 -1
- package/dist/docs/skills.d.ts +84 -84
- package/dist/docs/skills.js +66 -47
- package/dist/docs/start-prompts.d.ts +14 -0
- package/dist/docs/start-prompts.js +20 -0
- package/dist/utils/account-labels.d.ts +7 -0
- package/dist/utils/account-labels.js +15 -0
- package/dist/utils/auth.d.ts +1 -0
- package/dist/utils/auth.js +1 -0
- package/dist/utils/credential-policy.d.ts +22 -1
- package/dist/utils/credential-policy.js +55 -6
- package/dist/utils/local-space-state.d.ts +7 -0
- package/dist/utils/local-space-state.js +7 -0
- package/dist/utils/logger.d.ts +34 -0
- package/dist/utils/logger.js +144 -0
- package/dist/utils/page-routes.d.ts +9 -0
- package/dist/utils/page-routes.js +82 -0
- package/dist/utils/pages.d.ts +2 -0
- package/dist/utils/pages.js +7 -0
- package/dist/utils/publish-form-data.d.ts +2 -0
- package/dist/utils/publish-form-data.js +2 -0
- package/dist/utils/publish-policy-spacefast.d.ts +13 -0
- package/dist/utils/publish-policy-spacefast.js +117 -0
- package/dist/utils/publish-policy.d.ts +22 -16
- package/dist/utils/publish-policy.fixtures.json +15 -0
- package/dist/utils/publish-policy.js +62 -139
- package/dist/utils/query-client.js +9 -1
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/space-config.d.ts +2 -3
- package/dist/utils/space-config.js +1 -1
- package/dist/utils/uploaded-source.d.ts +4 -0
- package/dist/utils/uploaded-source.js +12 -0
- package/dist/visual-review.d.ts +4 -0
- package/dist/visual-review.js +208 -0
- package/dist/vocabulary.d.ts +38 -0
- package/dist/vocabulary.js +55 -0
- package/package.json +7 -2
- package/dist/agents/registry/deeplink-probes.d.ts +0 -23
- package/dist/agents/registry/deeplink-probes.js +0 -18
|
@@ -1,289 +1,39 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
// `content.
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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`,
|
|
2
|
+
// What survives of the pre-content-model contracts: the one-use WordPress
|
|
3
|
+
// editor session the dashboard opens. Everything the deleted
|
|
4
|
+
// `@spacefast/content` client spoke — compile, activate, batch query, render,
|
|
5
|
+
// document write, Markdown import — went with the routes that answered it, and
|
|
6
|
+
// the batch-query read shape a Zero capsule used to be handed went with the
|
|
7
|
+
// handler for it. A Space's content model is compiled at publish into
|
|
8
|
+
// `content-model.php` and reached through the Abilities API; see
|
|
9
|
+
// ./content-model.ts and ./content-model-sdk.ts.
|
|
10
|
+
/**
|
|
11
|
+
* Where a content-editor launch lands.
|
|
12
|
+
*
|
|
13
|
+
* The requested screen selects the initial Zero view. The control plane turns
|
|
14
|
+
* it into a signed access grant before the runtime creates the session, so the
|
|
15
|
+
* iframe cannot widen its own navigation permissions.
|
|
16
|
+
*
|
|
17
|
+
* `collections` and `users` are the Content dashboard's two screens.
|
|
18
|
+
* Omitting the screen lands on WordPress's own admin, which is the escape
|
|
19
|
+
* hatch the dashboard opens in a new tab.
|
|
20
|
+
*/
|
|
21
|
+
export const contentAdminScreenSchema = z.enum(["collections", "users"]);
|
|
22
|
+
export const contentAdminLaunchSchema = z
|
|
23
|
+
.object({ screen: contentAdminScreenSchema.optional() })
|
|
24
|
+
.strict();
|
|
25
|
+
export const contentAdminAccessSchema = z.discriminatedUnion("surface", [
|
|
26
|
+
z
|
|
27
|
+
.object({
|
|
28
|
+
surface: z.literal("zero"),
|
|
29
|
+
initialScreen: contentAdminScreenSchema,
|
|
30
|
+
allowedScreens: z.union([
|
|
31
|
+
z.tuple([z.literal("collections")]),
|
|
32
|
+
z.tuple([z.literal("collections"), z.literal("users")]),
|
|
33
|
+
]),
|
|
48
34
|
})
|
|
49
|
-
.
|
|
50
|
-
|
|
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(),
|
|
35
|
+
.strict(),
|
|
36
|
+
z.object({ surface: z.literal("wordpress") }).strict(),
|
|
287
37
|
]);
|
|
288
38
|
export const contentAdminSessionSchema = z
|
|
289
39
|
.object({
|
|
@@ -291,13 +41,3 @@ export const contentAdminSessionSchema = z
|
|
|
291
41
|
expiresAt: z.string().datetime(),
|
|
292
42
|
})
|
|
293
43
|
.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();
|
|
@@ -24,6 +24,13 @@ export declare const dashboardPrefsPatchSchema: z.ZodRecord<z.ZodString, z.ZodUn
|
|
|
24
24
|
export type DashboardPrefsPatch = z.infer<typeof dashboardPrefsPatchSchema>;
|
|
25
25
|
/** The dashboard appearance key. */
|
|
26
26
|
export declare const DASHBOARD_PREF_APPEARANCE = "appearance";
|
|
27
|
+
/** Personal spaces-list layout, shared across teams. */
|
|
28
|
+
export declare const DASHBOARD_PREF_SPACE_VIEW = "spaceView";
|
|
29
|
+
export declare const spaceViewPreferenceSchema: z.ZodEnum<{
|
|
30
|
+
table: "table";
|
|
31
|
+
grid: "grid";
|
|
32
|
+
}>;
|
|
33
|
+
export type SpaceViewPreference = z.infer<typeof spaceViewPreferenceSchema>;
|
|
27
34
|
/** Personal space favorites: the starred space ids, across every team. */
|
|
28
35
|
export declare const DASHBOARD_PREF_SPACE_FAVORITES = "spaceFavorites";
|
|
29
36
|
/**
|
|
@@ -44,9 +51,9 @@ export declare const DASHBOARD_PREF_SPACE_ORDERS = "spaceOrders";
|
|
|
44
51
|
export declare const spaceOrdersPreferenceSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
45
52
|
export type SpaceOrdersPreference = z.infer<typeof spaceOrdersPreferenceSchema>;
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
54
|
+
* `system` follows the OS setting live; the other two pin it. An absent account
|
|
55
|
+
* preference leaves the device choice alone. A device without a choice follows
|
|
56
|
+
* the system.
|
|
50
57
|
*/
|
|
51
58
|
export declare const appearancePreferenceSchema: z.ZodEnum<{
|
|
52
59
|
dark: "dark";
|
|
@@ -26,6 +26,9 @@ export const dashboardPrefsPatchSchema = z
|
|
|
26
26
|
.describe("Preference keys to merge into the stored bag. A key set to `null` is deleted; every other key is overwritten. Keys you do not send are left alone.");
|
|
27
27
|
/** The dashboard appearance key. */
|
|
28
28
|
export const DASHBOARD_PREF_APPEARANCE = "appearance";
|
|
29
|
+
/** Personal spaces-list layout, shared across teams. */
|
|
30
|
+
export const DASHBOARD_PREF_SPACE_VIEW = "spaceView";
|
|
31
|
+
export const spaceViewPreferenceSchema = z.enum(["grid", "table"]);
|
|
29
32
|
/** Personal space favorites: the starred space ids, across every team. */
|
|
30
33
|
export const DASHBOARD_PREF_SPACE_FAVORITES = "spaceFavorites";
|
|
31
34
|
/**
|
|
@@ -44,8 +47,8 @@ export const DASHBOARD_PREF_SPACE_ORDERS = "spaceOrders";
|
|
|
44
47
|
*/
|
|
45
48
|
export const spaceOrdersPreferenceSchema = z.record(z.string().max(64), z.array(z.string().max(64)).max(200));
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
+
* `system` follows the OS setting live; the other two pin it. An absent account
|
|
51
|
+
* preference leaves the device choice alone. A device without a choice follows
|
|
52
|
+
* the system.
|
|
50
53
|
*/
|
|
51
54
|
export const appearancePreferenceSchema = z.enum(["light", "dark", "system"]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const placementRegions = ["ams", "bur", "dca", "dfw"];
|
|
3
|
+
export const dataLocationSchema = z
|
|
4
|
+
.string()
|
|
5
|
+
.trim()
|
|
6
|
+
.pipe(z.enum(["auto", ...placementRegions]))
|
|
7
|
+
.describe('Data location for a new Space; "auto" lets placement decide.');
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const deploymentComparisonQuerySchema: z.ZodObject<{
|
|
3
|
+
baseVersionId: z.ZodString;
|
|
4
|
+
versionId: z.ZodString;
|
|
5
|
+
path: z.ZodOptional<z.ZodString>;
|
|
6
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const deploymentComparisonSchema: z.ZodObject<{
|
|
10
|
+
spaceId: z.ZodString;
|
|
11
|
+
view: z.ZodLiteral<"served">;
|
|
12
|
+
baseDeploymentVersionId: z.ZodString;
|
|
13
|
+
deploymentVersionId: z.ZodString;
|
|
14
|
+
baseVersionNumber: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
versionNumber: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
stats: z.ZodObject<{
|
|
17
|
+
files: z.ZodNumber;
|
|
18
|
+
added: z.ZodNumber;
|
|
19
|
+
modified: z.ZodNumber;
|
|
20
|
+
deleted: z.ZodNumber;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
files: z.ZodArray<z.ZodObject<{
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
state: z.ZodEnum<{
|
|
25
|
+
deleted: "deleted";
|
|
26
|
+
added: "added";
|
|
27
|
+
modified: "modified";
|
|
28
|
+
}>;
|
|
29
|
+
before: z.ZodNullable<z.ZodObject<{
|
|
30
|
+
sha256: z.ZodString;
|
|
31
|
+
size: z.ZodNumber;
|
|
32
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
after: z.ZodNullable<z.ZodObject<{
|
|
35
|
+
sha256: z.ZodString;
|
|
36
|
+
size: z.ZodNumber;
|
|
37
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
file: z.ZodNullable<z.ZodObject<{
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
before: z.ZodNullable<z.ZodString>;
|
|
43
|
+
after: z.ZodNullable<z.ZodString>;
|
|
44
|
+
beforeReason: z.ZodNullable<z.ZodEnum<{
|
|
45
|
+
unavailable: "unavailable";
|
|
46
|
+
binary: "binary";
|
|
47
|
+
not_present: "not_present";
|
|
48
|
+
too_large: "too_large";
|
|
49
|
+
}>>;
|
|
50
|
+
afterReason: z.ZodNullable<z.ZodEnum<{
|
|
51
|
+
unavailable: "unavailable";
|
|
52
|
+
binary: "binary";
|
|
53
|
+
not_present: "not_present";
|
|
54
|
+
too_large: "too_large";
|
|
55
|
+
}>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
sourceComparison: z.ZodNullable<z.ZodObject<{
|
|
58
|
+
repositoryId: z.ZodString;
|
|
59
|
+
baseSourceCommitSha: z.ZodString;
|
|
60
|
+
sourceCommitSha: z.ZodString;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
pagination: z.ZodObject<{
|
|
63
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
64
|
+
hasMore: z.ZodBoolean;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export type DeploymentComparison = z.infer<typeof deploymentComparisonSchema>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CursorPaginationSchema } from "./common.js";
|
|
3
|
+
import { externalVersionFilePathSchema } from "./spaces.js";
|
|
4
|
+
export const deploymentComparisonQuerySchema = z.object({
|
|
5
|
+
baseVersionId: z.string().min(1).max(64).describe("ID of the earlier deployment version."),
|
|
6
|
+
versionId: z.string().min(1).max(64).describe("ID of the deployment version to compare."),
|
|
7
|
+
path: externalVersionFilePathSchema
|
|
8
|
+
.max(1024)
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Read before-and-after text for this file path. Requires versions:download access."),
|
|
11
|
+
cursor: z
|
|
12
|
+
.string()
|
|
13
|
+
.max(4000)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Copy the next cursor from this exact version comparison."),
|
|
16
|
+
limit: z.coerce
|
|
17
|
+
.number()
|
|
18
|
+
.int()
|
|
19
|
+
.min(1)
|
|
20
|
+
.max(250)
|
|
21
|
+
.default(100)
|
|
22
|
+
.describe("Maximum changed paths to return."),
|
|
23
|
+
});
|
|
24
|
+
const artifactSchema = z.object({
|
|
25
|
+
sha256: z.string(),
|
|
26
|
+
size: z.number().int().nonnegative(),
|
|
27
|
+
contentType: z.string().nullable(),
|
|
28
|
+
});
|
|
29
|
+
const unavailableReasonSchema = z
|
|
30
|
+
.enum(["not_present", "binary", "too_large", "unavailable"])
|
|
31
|
+
.nullable();
|
|
32
|
+
export const deploymentComparisonSchema = z.object({
|
|
33
|
+
spaceId: z.string(),
|
|
34
|
+
view: z.literal("served"),
|
|
35
|
+
baseDeploymentVersionId: z.string(),
|
|
36
|
+
deploymentVersionId: z.string(),
|
|
37
|
+
baseVersionNumber: z.number().int().nullable(),
|
|
38
|
+
versionNumber: z.number().int().nullable(),
|
|
39
|
+
stats: z.object({
|
|
40
|
+
files: z.number().int().nonnegative(),
|
|
41
|
+
added: z.number().int().nonnegative(),
|
|
42
|
+
modified: z.number().int().nonnegative(),
|
|
43
|
+
deleted: z.number().int().nonnegative(),
|
|
44
|
+
}),
|
|
45
|
+
files: z.array(z.object({
|
|
46
|
+
path: z.string(),
|
|
47
|
+
state: z.enum(["added", "modified", "deleted"]),
|
|
48
|
+
before: artifactSchema.nullable(),
|
|
49
|
+
after: artifactSchema.nullable(),
|
|
50
|
+
})),
|
|
51
|
+
file: z
|
|
52
|
+
.object({
|
|
53
|
+
path: z.string(),
|
|
54
|
+
before: z.string().nullable(),
|
|
55
|
+
after: z.string().nullable(),
|
|
56
|
+
beforeReason: unavailableReasonSchema,
|
|
57
|
+
afterReason: unavailableReasonSchema,
|
|
58
|
+
})
|
|
59
|
+
.nullable(),
|
|
60
|
+
sourceComparison: z
|
|
61
|
+
.object({
|
|
62
|
+
repositoryId: z.string(),
|
|
63
|
+
baseSourceCommitSha: z.string(),
|
|
64
|
+
sourceCommitSha: z.string(),
|
|
65
|
+
})
|
|
66
|
+
.nullable(),
|
|
67
|
+
pagination: CursorPaginationSchema,
|
|
68
|
+
});
|