@payloadcms/figma 0.1.0-alpha.0 → 0.1.0-alpha.10
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/LICENSE.md +1 -1
- package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
- package/dist/adapters/asset-collection.js +242 -0
- package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
- package/dist/adapters/build-lambda-zip.js +111 -0
- package/dist/adapters/configureNextjsCache.d.ts +8 -0
- package/dist/adapters/configureNextjsCache.js +55 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
- package/dist/adapters/deploy-output/isFile.d.ts +1 -0
- package/dist/adapters/deploy-output/isFile.js +4 -0
- package/dist/adapters/deploy-output/readJson.d.ts +1 -0
- package/dist/adapters/deploy-output/readJson.js +9 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
- package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
- package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
- package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
- package/dist/adapters/deploy-output/resolveWithin.js +12 -0
- package/dist/adapters/fs-utils.d.ts +39 -0
- package/dist/adapters/fs-utils.js +135 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
- package/dist/adapters/nextjs.d.ts +12 -0
- package/dist/adapters/nextjs.js +67 -0
- package/dist/adapters/nitro.d.ts +8 -0
- package/dist/adapters/nitro.js +193 -0
- package/dist/adapters/secret-files.d.ts +25 -0
- package/dist/adapters/secret-files.js +50 -0
- package/dist/adapters/types.d.ts +42 -0
- package/dist/adapters/types.js +1 -0
- package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
- package/dist/adapters/vite.js +33 -0
- package/dist/api/check-project-subdomain-availability.d.ts +12 -0
- package/dist/api/check-project-subdomain-availability.js +32 -0
- package/dist/api/control-plane-error.d.ts +6 -0
- package/dist/api/control-plane-error.js +8 -0
- package/dist/api/control-plane-fetch.d.ts +7 -0
- package/dist/api/control-plane-fetch.js +37 -0
- package/dist/api/control-plane.d.ts +1 -9
- package/dist/api/control-plane.js +2 -48
- package/dist/api/create-project.d.ts +18 -0
- package/dist/api/create-project.js +37 -0
- package/dist/api/list-project-workspaces.d.ts +8 -0
- package/dist/api/list-project-workspaces.js +28 -0
- package/dist/api/project-resource-type.d.ts +1 -0
- package/dist/api/project-resource-type.js +1 -0
- package/dist/auth/headless-oauth-flow.d.ts +23 -0
- package/dist/auth/headless-oauth-flow.js +69 -0
- package/dist/auth/oauth-flow.d.ts +2 -0
- package/dist/auth/oauth-flow.js +13 -8
- package/dist/auth/token-store.d.ts +4 -1
- package/dist/auth/token-store.js +14 -0
- package/dist/auth/types.d.ts +12 -0
- package/dist/cli.d.ts +39 -0
- package/dist/cli.js +71 -36
- package/dist/commands/bootstrap.js +2 -1
- package/dist/commands/build-lambda-zip.js +1 -1
- package/dist/commands/deploy.d.ts +12 -0
- package/dist/commands/deploy.js +63 -25
- package/dist/commands/detect-project-resource-type.d.ts +3 -0
- package/dist/commands/detect-project-resource-type.js +28 -0
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +164 -79
- package/dist/commands/login.d.ts +11 -1
- package/dist/commands/login.js +66 -4
- package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
- package/dist/commands/prompt-to-create-project.d.ts +24 -0
- package/dist/commands/prompt-to-create-project.js +69 -0
- package/dist/commands/setup-agent.d.ts +12 -0
- package/dist/commands/setup-agent.js +123 -0
- package/dist/commands/write-project-configuration.d.ts +12 -0
- package/dist/commands/write-project-configuration.js +16 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +661 -16
- package/dist/db-content-api/index.d.ts +3 -0
- package/dist/db-content-api/index.js +155 -161
- package/dist/db-content-api/utilities/clientVersionHeaders.d.ts +7 -0
- package/dist/db-content-api/utilities/clientVersionHeaders.js +15 -0
- package/dist/db-content-api/utilities/data/atomicOperations.d.ts +16 -0
- package/dist/db-content-api/utilities/data/atomicOperations.js +48 -0
- package/dist/db-content-api/utilities/data/convertRelationshipIds.d.ts +25 -0
- package/dist/db-content-api/utilities/data/convertRelationshipIds.js +109 -0
- package/dist/db-content-api/utilities/data/index.js +73 -57
- package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
- package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
- package/dist/db-content-api/utilities/data/isLocaleMap.d.ts +10 -0
- package/dist/db-content-api/utilities/data/isLocaleMap.js +13 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
- package/dist/db-content-api/utilities/data/resolveFieldLocalization.d.ts +18 -0
- package/dist/db-content-api/utilities/data/resolveFieldLocalization.js +21 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +19 -12
- package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
- package/dist/db-content-api/utilities/isRecord.js +19 -0
- package/dist/db-content-api/utilities/joins.d.ts +6 -8
- package/dist/db-content-api/utilities/joins.js +13 -22
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +21 -4
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +118 -36
- package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
- package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
- package/dist/db-content-api/utilities/where.d.ts +3 -17
- package/dist/db-content-api/utilities/where.js +21 -21
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.js +2 -0
- package/dist/exports/views.d.ts +1 -0
- package/dist/exports/views.js +1 -0
- package/dist/imageSizeOptions.d.ts +23 -0
- package/dist/imageSizeOptions.js +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib/write-agent-config.d.ts +12 -0
- package/dist/lib/write-agent-config.js +52 -0
- package/dist/next/image-loader.d.ts +6 -0
- package/dist/next/image-loader.js +14 -0
- package/dist/oauth/components/LoginButton/index.js +66 -19
- package/dist/oauth/components/LoginButton/index.scss +121 -15
- package/dist/oauth/defaults.js +4 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
- package/dist/oauth/index.js +8 -7
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
- package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
- package/dist/plugin/build-config.d.ts +4 -2
- package/dist/plugin/build-config.js +95 -31
- package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
- package/dist/plugin/cache-revalidation-hooks.js +69 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +8 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
- package/dist/plugin/cloud-limits/routes.d.ts +2 -0
- package/dist/plugin/cloud-limits/routes.js +4 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
- package/dist/plugin/cloud-limits/shared.d.ts +10 -0
- package/dist/plugin/cloud-limits/shared.js +52 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
- package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
- package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
- package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
- package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
- package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
- package/dist/plugin/sandbox-upload-fetch.js +53 -0
- package/dist/skills/deploy-to-figma/SKILL.md +234 -0
- package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
- package/dist/storage-content-api/client-uploads/generate.js +2 -1
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +27 -0
- package/dist/storage-content-api/index.js +1 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
- package/dist/storage-content-api/staticHandler.js +2 -1
- package/dist/storage-content-api/types.d.ts +4 -1
- package/dist/translations/ar.d.ts +12 -0
- package/dist/translations/ar.js +12 -0
- package/dist/translations/az.d.ts +12 -0
- package/dist/translations/az.js +12 -0
- package/dist/translations/bg.d.ts +12 -0
- package/dist/translations/bg.js +12 -0
- package/dist/translations/bnBd.d.ts +12 -0
- package/dist/translations/bnBd.js +12 -0
- package/dist/translations/bnIn.d.ts +12 -0
- package/dist/translations/bnIn.js +12 -0
- package/dist/translations/ca.d.ts +12 -0
- package/dist/translations/ca.js +12 -0
- package/dist/translations/cs.d.ts +12 -0
- package/dist/translations/cs.js +12 -0
- package/dist/translations/da.d.ts +12 -0
- package/dist/translations/da.js +12 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +12 -0
- package/dist/translations/en.d.ts +12 -0
- package/dist/translations/en.js +12 -0
- package/dist/translations/es.d.ts +12 -0
- package/dist/translations/es.js +12 -0
- package/dist/translations/et.d.ts +12 -0
- package/dist/translations/et.js +12 -0
- package/dist/translations/fa.d.ts +12 -0
- package/dist/translations/fa.js +12 -0
- package/dist/translations/fr.d.ts +12 -0
- package/dist/translations/fr.js +12 -0
- package/dist/translations/he.d.ts +12 -0
- package/dist/translations/he.js +12 -0
- package/dist/translations/hr.d.ts +12 -0
- package/dist/translations/hr.js +12 -0
- package/dist/translations/hu.d.ts +12 -0
- package/dist/translations/hu.js +12 -0
- package/dist/translations/hy.d.ts +12 -0
- package/dist/translations/hy.js +12 -0
- package/dist/translations/id.d.ts +12 -0
- package/dist/translations/id.js +12 -0
- package/dist/translations/index.d.ts +533 -0
- package/dist/translations/index.js +90 -0
- package/dist/translations/is.d.ts +12 -0
- package/dist/translations/is.js +12 -0
- package/dist/translations/it.d.ts +12 -0
- package/dist/translations/it.js +12 -0
- package/dist/translations/ja.d.ts +12 -0
- package/dist/translations/ja.js +12 -0
- package/dist/translations/ko.d.ts +12 -0
- package/dist/translations/ko.js +12 -0
- package/dist/translations/lt.d.ts +12 -0
- package/dist/translations/lt.js +12 -0
- package/dist/translations/lv.d.ts +12 -0
- package/dist/translations/lv.js +12 -0
- package/dist/translations/my.d.ts +12 -0
- package/dist/translations/my.js +12 -0
- package/dist/translations/nb.d.ts +12 -0
- package/dist/translations/nb.js +12 -0
- package/dist/translations/nl.d.ts +12 -0
- package/dist/translations/nl.js +12 -0
- package/dist/translations/pl.d.ts +12 -0
- package/dist/translations/pl.js +12 -0
- package/dist/translations/pt.d.ts +12 -0
- package/dist/translations/pt.js +12 -0
- package/dist/translations/ro.d.ts +12 -0
- package/dist/translations/ro.js +12 -0
- package/dist/translations/rs.d.ts +12 -0
- package/dist/translations/rs.js +12 -0
- package/dist/translations/rsLatin.d.ts +12 -0
- package/dist/translations/rsLatin.js +12 -0
- package/dist/translations/ru.d.ts +12 -0
- package/dist/translations/ru.js +12 -0
- package/dist/translations/sk.d.ts +12 -0
- package/dist/translations/sk.js +12 -0
- package/dist/translations/sl.d.ts +12 -0
- package/dist/translations/sl.js +12 -0
- package/dist/translations/sv.d.ts +12 -0
- package/dist/translations/sv.js +12 -0
- package/dist/translations/ta.d.ts +12 -0
- package/dist/translations/ta.js +12 -0
- package/dist/translations/th.d.ts +12 -0
- package/dist/translations/th.js +12 -0
- package/dist/translations/tr.d.ts +12 -0
- package/dist/translations/tr.js +12 -0
- package/dist/translations/uk.d.ts +12 -0
- package/dist/translations/uk.js +12 -0
- package/dist/translations/vi.d.ts +12 -0
- package/dist/translations/vi.js +12 -0
- package/dist/translations/zh.d.ts +12 -0
- package/dist/translations/zh.js +12 -0
- package/dist/translations/zhTw.d.ts +12 -0
- package/dist/translations/zhTw.js +12 -0
- package/dist/types.d.ts +11 -0
- package/dist/utils/assert-never.d.ts +1 -0
- package/dist/utils/assert-never.js +3 -0
- package/dist/utils/build-detection.d.ts +6 -1
- package/dist/utils/build-detection.js +68 -89
- package/dist/utils/deploy-adapter.d.ts +3 -35
- package/dist/utils/deploy-adapter.js +25 -14
- package/dist/utils/lambda-config.js +18 -23
- package/dist/utils/load-payload-config.d.ts +2 -2
- package/dist/utils/messages.js +24 -3
- package/dist/utils/next-image-loader-config.d.ts +2 -0
- package/dist/utils/next-image-loader-config.js +63 -0
- package/dist/utils/next-image-loader-file.d.ts +2 -0
- package/dist/utils/next-image-loader-file.js +11 -0
- package/dist/utils/payload-generate.d.ts +10 -0
- package/dist/utils/payload-generate.js +59 -0
- package/dist/utils/pnpm-builds.d.ts +14 -0
- package/dist/utils/pnpm-builds.js +125 -0
- package/dist/utils/s3-upload.js +4 -1
- package/package.json +31 -7
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +0 -10
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +0 -71
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +0 -41
- package/dist/db-content-api/utilities/meta/buildMeta.js +0 -39
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +0 -16
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +0 -243
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +0 -12
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +0 -60
- package/dist/lib/download-skill.d.ts +0 -12
- package/dist/lib/download-skill.js +0 -77
- package/dist/utils/adapters/nextjs.d.ts +0 -8
- package/dist/utils/adapters/nextjs.js +0 -61
- package/dist/utils/adapters/nitro.d.ts +0 -8
- package/dist/utils/adapters/nitro.js +0 -172
- package/dist/utils/adapters/vite.js +0 -31
- package/dist/utils/asset-collection.js +0 -144
- package/dist/utils/build-lambda-zip.js +0 -90
- package/dist/utils/fs-utils.d.ts +0 -12
- package/dist/utils/fs-utils.js +0 -55
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { traverseFields } from 'payload';
|
|
2
|
+
import { valueIsValueWithRelation } from 'payload/shared';
|
|
3
|
+
import { RELATIONSHIP_ATOMIC_OPERATORS, unwrapAtomicOperation } from './atomicOperations.js';
|
|
4
|
+
import { resolveFieldLocalization } from './resolveFieldLocalization.js';
|
|
2
5
|
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3
6
|
function collectRelationshipValues({ data, fields }) {
|
|
4
7
|
const relationships = [];
|
|
5
|
-
const callback = ({ field, ref })=>{
|
|
6
|
-
if (!('name' in
|
|
8
|
+
const callback = ({ field: declaredField, parentIsLocalized, ref })=>{
|
|
9
|
+
if (!('name' in declaredField) || !declaredField.name) {
|
|
7
10
|
return;
|
|
8
11
|
}
|
|
9
|
-
if (
|
|
12
|
+
if (declaredField.type !== 'relationship' && declaredField.type !== 'upload') {
|
|
10
13
|
return;
|
|
11
14
|
}
|
|
12
15
|
if (!ref || typeof ref !== 'object') {
|
|
13
16
|
return;
|
|
14
17
|
}
|
|
18
|
+
// Only a field whose locale keys were not absorbed by a localized ancestor
|
|
19
|
+
// holds a locale map; an absorbed one holds the relationship value directly.
|
|
20
|
+
const field = resolveFieldLocalization({
|
|
21
|
+
field: declaredField,
|
|
22
|
+
isAbsorbed: parentIsLocalized
|
|
23
|
+
});
|
|
15
24
|
const rawValue = ref[field.name];
|
|
16
25
|
if (rawValue == null || rawValue === '') {
|
|
17
26
|
return;
|
|
@@ -38,21 +47,19 @@ function collectRelationshipValues({ data, fields }) {
|
|
|
38
47
|
});
|
|
39
48
|
return relationships;
|
|
40
49
|
}
|
|
41
|
-
function parseRelationshipValues(
|
|
50
|
+
function parseRelationshipValues(rawValue, relationTo, relationships) {
|
|
51
|
+
const value = unwrapAtomicOperation(rawValue, RELATIONSHIP_ATOMIC_OPERATORS);
|
|
42
52
|
if (Array.isArray(relationTo)) {
|
|
43
53
|
// Polymorphic (single or hasMany): value is { relationTo, value } or array of them
|
|
44
54
|
const values = Array.isArray(value) ? value : [
|
|
45
55
|
value
|
|
46
56
|
];
|
|
47
57
|
for (const v of values){
|
|
48
|
-
if (v &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
value: obj.value
|
|
54
|
-
});
|
|
55
|
-
}
|
|
58
|
+
if (valueIsValueWithRelation(v) && v.value != null && v.value !== '') {
|
|
59
|
+
relationships.push({
|
|
60
|
+
collection: v.relationTo,
|
|
61
|
+
value: v.value
|
|
62
|
+
});
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
} else {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plain, string-keyed object — the shape that can safely be spread and have
|
|
3
|
+
* properties read off it without tripping over arrays, `null`, or exotic objects.
|
|
4
|
+
*
|
|
5
|
+
* Objects carrying symbol-keyed own properties are rejected: symbol keys are how
|
|
6
|
+
* libraries tag a value as something more than data, and a spread copies only the
|
|
7
|
+
* string keys, so treating such a value as a record silently strips the tag.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plain, string-keyed object — the shape that can safely be spread and have
|
|
3
|
+
* properties read off it without tripping over arrays, `null`, or exotic objects.
|
|
4
|
+
*
|
|
5
|
+
* Objects carrying symbol-keyed own properties are rejected: symbol keys are how
|
|
6
|
+
* libraries tag a value as something more than data, and a spread copies only the
|
|
7
|
+
* string keys, so treating such a value as a record silently strips the tag.
|
|
8
|
+
*/ export function isRecord(value) {
|
|
9
|
+
if (value == null) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (typeof value !== 'object') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return Object.getOwnPropertySymbols(value).length === 0;
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JoinQuery, Payload } from 'payload';
|
|
2
2
|
import type { components } from '../generated/content-api-types.js';
|
|
3
|
-
type ContentAPIJoin = components['schemas']['
|
|
3
|
+
type ContentAPIJoin = components['schemas']['JoinClauseV1'][number];
|
|
4
4
|
/**
|
|
5
5
|
* Convert Payload's JoinQuery to Content API's join format.
|
|
6
6
|
*
|
|
@@ -32,10 +32,8 @@ type ContentAPIJoin = components['schemas']['JoinClause'][number];
|
|
|
32
32
|
* }
|
|
33
33
|
* }
|
|
34
34
|
*
|
|
35
|
-
* Content API's join format:
|
|
35
|
+
* Content API's v1 join format:
|
|
36
36
|
* [{
|
|
37
|
-
* collectionId: 'posts', // collection to join FROM
|
|
38
|
-
* on: 'group.category', // field in joined collection pointing to this doc
|
|
39
37
|
* path: 'group.relatedPosts', // where to put results
|
|
40
38
|
* count: false,
|
|
41
39
|
* where: { ... }, // Content API where format
|
|
@@ -44,9 +42,9 @@ type ContentAPIJoin = components['schemas']['JoinClause'][number];
|
|
|
44
42
|
* page: 2
|
|
45
43
|
* }]
|
|
46
44
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
45
|
+
* v1 resolves the joined collection and key from the document schema, so the
|
|
46
|
+
* adapter no longer emits collectionId/on. The collection config is still read
|
|
47
|
+
* to resolve default limit and sort for each join path.
|
|
50
48
|
*/
|
|
51
|
-
export declare function convertPayloadJoinsToContentAPI(payload: Payload, collectionSlug: string, joins: false | JoinQuery | undefined
|
|
49
|
+
export declare function convertPayloadJoinsToContentAPI(payload: Payload, collectionSlug: string, joins: false | JoinQuery | undefined): ContentAPIJoin[] | undefined;
|
|
52
50
|
export {};
|
|
@@ -31,10 +31,8 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
31
31
|
* }
|
|
32
32
|
* }
|
|
33
33
|
*
|
|
34
|
-
* Content API's join format:
|
|
34
|
+
* Content API's v1 join format:
|
|
35
35
|
* [{
|
|
36
|
-
* collectionId: 'posts', // collection to join FROM
|
|
37
|
-
* on: 'group.category', // field in joined collection pointing to this doc
|
|
38
36
|
* path: 'group.relatedPosts', // where to put results
|
|
39
37
|
* count: false,
|
|
40
38
|
* where: { ... }, // Content API where format
|
|
@@ -43,10 +41,10 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
43
41
|
* page: 2
|
|
44
42
|
* }]
|
|
45
43
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*/ export function convertPayloadJoinsToContentAPI(payload, collectionSlug, joins
|
|
44
|
+
* v1 resolves the joined collection and key from the document schema, so the
|
|
45
|
+
* adapter no longer emits collectionId/on. The collection config is still read
|
|
46
|
+
* to resolve default limit and sort for each join path.
|
|
47
|
+
*/ export function convertPayloadJoinsToContentAPI(payload, collectionSlug, joins) {
|
|
50
48
|
const collectionConfig = payload.config.collections.find((c)=>c.slug === collectionSlug);
|
|
51
49
|
if (!collectionConfig) {
|
|
52
50
|
return undefined;
|
|
@@ -72,14 +70,10 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
72
70
|
for (const [collectionSlug, sanitizedJoins] of Object.entries(collectionConfig.joins)){
|
|
73
71
|
for (const sanitizedJoin of sanitizedJoins){
|
|
74
72
|
if (sanitizedJoin.joinPath === joinPath) {
|
|
75
|
-
const on = locale && sanitizedJoin.getForeignPath ? sanitizedJoin.getForeignPath({
|
|
76
|
-
locale
|
|
77
|
-
}) : sanitizedJoin.field.on;
|
|
78
73
|
foundJoin = {
|
|
79
74
|
collectionSlug,
|
|
80
75
|
defaultLimit: sanitizedJoin.field.defaultLimit,
|
|
81
|
-
defaultSort: sanitizedJoin.field.defaultSort
|
|
82
|
-
on
|
|
76
|
+
defaultSort: sanitizedJoin.field.defaultSort
|
|
83
77
|
};
|
|
84
78
|
break;
|
|
85
79
|
}
|
|
@@ -92,14 +86,9 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
92
86
|
if (!foundJoin) {
|
|
93
87
|
for (const sanitizedJoin of collectionConfig.polymorphicJoins){
|
|
94
88
|
if (sanitizedJoin.joinPath === joinPath) {
|
|
95
|
-
const collections = sanitizedJoin.field.collection;
|
|
96
|
-
const on = locale && sanitizedJoin.getForeignPath ? sanitizedJoin.getForeignPath({
|
|
97
|
-
locale
|
|
98
|
-
}) : sanitizedJoin.field.on;
|
|
99
89
|
foundJoin = {
|
|
100
|
-
collectionSlug:
|
|
101
|
-
defaultSort: sanitizedJoin.field.defaultSort
|
|
102
|
-
on
|
|
90
|
+
collectionSlug: sanitizedJoin.field.collection,
|
|
91
|
+
defaultSort: sanitizedJoin.field.defaultSort
|
|
103
92
|
};
|
|
104
93
|
break;
|
|
105
94
|
}
|
|
@@ -113,10 +102,12 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
113
102
|
const effectiveLimit = joinQuery.limit ?? foundJoin.defaultLimit;
|
|
114
103
|
// Add fallback sort for the joined collection
|
|
115
104
|
const sortWithFallback = addFallbackSort(joinQuery.sort, payload, foundJoin.collectionSlug, foundJoin.defaultSort);
|
|
105
|
+
// A join's `where` filters the *joined* collection, so id coercion resolves against
|
|
106
|
+
// that collection (the first target for a polymorphic join; `id` is coerced regardless).
|
|
107
|
+
const joinedSlug = Array.isArray(foundJoin.collectionSlug) ? foundJoin.collectionSlug[0] : foundJoin.collectionSlug;
|
|
108
|
+
const whereConverted = convertPayloadWhereToContentAPI(joinQuery.where, payload, joinedSlug, false);
|
|
116
109
|
const contentAPIJoin = {
|
|
117
|
-
collectionId: foundJoin.collectionSlug,
|
|
118
110
|
count: joinQuery.count ?? false,
|
|
119
|
-
on: foundJoin.on,
|
|
120
111
|
path: joinPath,
|
|
121
112
|
...effectiveLimit !== undefined && {
|
|
122
113
|
limit: effectiveLimit
|
|
@@ -128,7 +119,7 @@ import { convertPayloadWhereToContentAPI } from './where.js';
|
|
|
128
119
|
sort: sortWithFallback
|
|
129
120
|
},
|
|
130
121
|
...joinQuery.where && {
|
|
131
|
-
where:
|
|
122
|
+
where: whereConverted
|
|
132
123
|
}
|
|
133
124
|
};
|
|
134
125
|
result.push(contentAPIJoin);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Field, Payload } from 'payload';
|
|
2
|
+
export interface ResolveContext {
|
|
3
|
+
readonly fieldCache: Map<string, boolean>;
|
|
4
|
+
readonly fields: Field[];
|
|
5
|
+
readonly isVersions: boolean;
|
|
6
|
+
readonly payload: Payload;
|
|
7
|
+
}
|
|
8
|
+
/** Walks a path's segments against a field list, reporting whether it lands on a
|
|
9
|
+
* relationship/upload field's id-bearing value. */
|
|
10
|
+
export declare function resolvesToRelationshipValue(segments: string[], fields: Field[], ctx: ResolveContext): boolean;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { resolveBlocks } from '../resolveBlocks.js';
|
|
2
|
+
/** Walks a path's segments against a field list, reporting whether it lands on a
|
|
3
|
+
* relationship/upload field's id-bearing value. */ export function resolvesToRelationshipValue(segments, fields, ctx) {
|
|
4
|
+
const [head, ...rest] = segments;
|
|
5
|
+
if (head == null) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const field = findNamedField(fields, head);
|
|
9
|
+
if (field == null) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
switch(field.type){
|
|
13
|
+
case 'array':
|
|
14
|
+
return 'fields' in field && resolvesToRelationshipValue(skipLocaleSegment(rest, field, ctx), field.fields, ctx);
|
|
15
|
+
case 'blocks':
|
|
16
|
+
{
|
|
17
|
+
if (!('blocks' in field)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// Any block whose fields the remaining path resolves through makes it id-bearing:
|
|
21
|
+
// one path can only mean one thing, whichever block supplied the field.
|
|
22
|
+
const childSegments = skipLocaleSegment(rest, field, ctx);
|
|
23
|
+
return resolveBlocks(field.blocks, ctx.payload.config.blocks).some((block)=>resolvesToRelationshipValue(childSegments, block.fields, ctx));
|
|
24
|
+
}
|
|
25
|
+
case 'group':
|
|
26
|
+
return 'fields' in field && resolvesToRelationshipValue(rest, field.fields, ctx);
|
|
27
|
+
case 'relationship':
|
|
28
|
+
case 'upload':
|
|
29
|
+
// A polymorphic field's id sits at `<path>.value`; its `.relationTo` is a slug.
|
|
30
|
+
if (Array.isArray(field.relationTo)) {
|
|
31
|
+
return rest.length === 1 && rest[0] === 'value';
|
|
32
|
+
}
|
|
33
|
+
// A single-target field's id sits at the field's own path.
|
|
34
|
+
if (rest.length === 0) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Payload accepts an explicit `<path>.id` for that same value —
|
|
38
|
+
// `getTableColumnFromPath` treats the bare path and `.id` as one column — which the
|
|
39
|
+
// Content API resolves as a traversal into the related collection's, equally text, id.
|
|
40
|
+
return rest.length === 1 && rest[0] === 'id';
|
|
41
|
+
default:
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Finds the field a path segment names. Unnamed containers (row, collapsible, unnamed tab)
|
|
46
|
+
* are transparent to query paths, so their children are searched too; a named tab nests its
|
|
47
|
+
* fields under its own name, exactly like a group. */ function findNamedField(fields, name) {
|
|
48
|
+
for (const field of fields){
|
|
49
|
+
if ('name' in field && field.name) {
|
|
50
|
+
// A named container's children need its name consumed first, so only match the
|
|
51
|
+
// container itself here.
|
|
52
|
+
if (field.name === name) {
|
|
53
|
+
return field;
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if ('fields' in field && Array.isArray(field.fields)) {
|
|
58
|
+
const match = findNamedField(field.fields, name);
|
|
59
|
+
if (match) {
|
|
60
|
+
return match;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if ('tabs' in field && Array.isArray(field.tabs)) {
|
|
64
|
+
for (const tab of field.tabs){
|
|
65
|
+
if (!tab.fields) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!tab.name) {
|
|
69
|
+
const match = findNamedField(tab.fields, name);
|
|
70
|
+
if (match) {
|
|
71
|
+
return match;
|
|
72
|
+
}
|
|
73
|
+
} else if (tab.name === name) {
|
|
74
|
+
return {
|
|
75
|
+
name: tab.name,
|
|
76
|
+
type: 'group',
|
|
77
|
+
fields: tab.fields
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
// A localized array/blocks field is stored as a locale map, so its children's paths carry a
|
|
86
|
+
// locale key (`items.en.rel`) — see `normalizeLocaleInWhere`, which runs before this.
|
|
87
|
+
// Locale keys are *only* added to `array` and `blocks`.
|
|
88
|
+
function skipLocaleSegment(segments, field, ctx) {
|
|
89
|
+
const localization = ctx.payload.config.localization;
|
|
90
|
+
if (!localization || !('localized' in field) || !field.localized) {
|
|
91
|
+
return segments;
|
|
92
|
+
}
|
|
93
|
+
const [head] = segments;
|
|
94
|
+
return head != null && localization.localeCodes.includes(head) ? segments.slice(1) : segments;
|
|
95
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Payload, Where } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Stringifies numeric operands on a Where clause's id-bearing paths (`id`, `parent` for
|
|
4
|
+
* versions, and relationship-value paths), so a custom-numeric-id filter matches the
|
|
5
|
+
* Content API's text storage. Returns the clause untouched when there is nothing to
|
|
6
|
+
* convert. `isVersions` treats `parent` (the parent document's id) as id-bearing and looks
|
|
7
|
+
* for the collection's own fields under `version.`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stringifyIdsInWhere(where: undefined | Where, payload: Payload, collectionSlug: string, isVersions: boolean): undefined | Where;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { resolvesToRelationshipValue } from './resolvesToRelationshipValue.js';
|
|
2
|
+
// The Content API stores every document id and every relationship value as text, but
|
|
3
|
+
// Payload keeps a collection's custom numeric id as a `number`. So a filter that carries
|
|
4
|
+
// a numeric id would never match the stored string form. This is the sole place the
|
|
5
|
+
// adapter translates those query-side ids to the wire's string form (the data-side
|
|
6
|
+
// counterpart is `convertRelationshipIds`); `convertPayloadWhereToContentAPI` itself is
|
|
7
|
+
// purely structural.
|
|
8
|
+
//
|
|
9
|
+
// A condition's path is id-bearing when it resolves to:
|
|
10
|
+
// - `id` — the document's own id (always).
|
|
11
|
+
// - `parent` — the parent document's id, on a *versions* query (`isVersions`).
|
|
12
|
+
// - a relationship/upload field's value: the field's own path for a single-target field
|
|
13
|
+
// (`rel: { equals: 999 }`), or `<path>.value` for a polymorphic one
|
|
14
|
+
// (`rel.value: { equals: 999 }`). A polymorphic field's `.relationTo` is a slug, not
|
|
15
|
+
// an id, so it is deliberately left alone.
|
|
16
|
+
//
|
|
17
|
+
// Every stored id is text, so a bare "stringify any numeric operand on this path" is
|
|
18
|
+
// sufficient — no per-target id-type resolution is needed (which also handles a
|
|
19
|
+
// polymorphic `in` array that mixes targets).
|
|
20
|
+
/**
|
|
21
|
+
* Stringifies numeric operands on a Where clause's id-bearing paths (`id`, `parent` for
|
|
22
|
+
* versions, and relationship-value paths), so a custom-numeric-id filter matches the
|
|
23
|
+
* Content API's text storage. Returns the clause untouched when there is nothing to
|
|
24
|
+
* convert. `isVersions` treats `parent` (the parent document's id) as id-bearing and looks
|
|
25
|
+
* for the collection's own fields under `version.`.
|
|
26
|
+
*/ export function stringifyIdsInWhere(where, payload, collectionSlug, isVersions) {
|
|
27
|
+
if (!where) {
|
|
28
|
+
return where;
|
|
29
|
+
}
|
|
30
|
+
// An unknown slug names no fields, but `id` (and `parent` on a versions query) is
|
|
31
|
+
// id-bearing regardless of the config, so still walk the clause with an empty field list:
|
|
32
|
+
// discarding it here would turn the query into a match-all.
|
|
33
|
+
const config = payload.config.collections.find((c)=>c.slug === collectionSlug);
|
|
34
|
+
const fields = config?.fields ?? [];
|
|
35
|
+
const fieldCache = new Map();
|
|
36
|
+
return transformWhere(where, {
|
|
37
|
+
fieldCache,
|
|
38
|
+
fields,
|
|
39
|
+
isVersions,
|
|
40
|
+
payload
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Recursively transforms a Where clause, stringifying numeric operands on any condition
|
|
44
|
+
* whose path is id-bearing. */ function transformWhere(where, context) {
|
|
45
|
+
const result = {};
|
|
46
|
+
for (const [key, value] of Object.entries(where)){
|
|
47
|
+
const keyLower = key.toLowerCase();
|
|
48
|
+
if (keyLower === 'and' || keyLower === 'or') {
|
|
49
|
+
const targetValue = where[key];
|
|
50
|
+
if (targetValue == null || !Array.isArray(targetValue)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
result[key] = targetValue.map((clause)=>transformWhere(clause, context));
|
|
54
|
+
} else if (isIdBearingPath(key, context)) {
|
|
55
|
+
result[key] = stringifyNumericOperands(value);
|
|
56
|
+
} else {
|
|
57
|
+
result[key] = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
/** Whether a condition's path resolves to an id. */ function isIdBearingPath(path, context) {
|
|
63
|
+
const cachedResult = context.fieldCache.get(path);
|
|
64
|
+
if (cachedResult != null) {
|
|
65
|
+
return cachedResult;
|
|
66
|
+
}
|
|
67
|
+
// GraphQL spells a nested path with `__`, since dots are invalid in GraphQL names; the
|
|
68
|
+
// structural conversion normalizes those the same way.
|
|
69
|
+
const segments = path.replace(/__/g, '.').split('.');
|
|
70
|
+
// The document's own id — on a versions query, the version document's own id.
|
|
71
|
+
if (segments.length === 1 && segments[0] === 'id') {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (context.isVersions) {
|
|
75
|
+
// `parent` is a version-only field that contains an ID.
|
|
76
|
+
if (segments.length === 1) {
|
|
77
|
+
return segments[0] === 'parent';
|
|
78
|
+
}
|
|
79
|
+
// The only other paths that can contain IDs are in the version envelope.
|
|
80
|
+
if (segments[0] !== 'version') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Normalize the path segments by removing the `version` envelope for paths
|
|
85
|
+
// in document versions.
|
|
86
|
+
const normalizedSegments = context.isVersions ? segments.slice(1) : segments;
|
|
87
|
+
return resolvesToRelationshipValue(normalizedSegments, context.fields, context);
|
|
88
|
+
}
|
|
89
|
+
function stringifyNumericOperands(condition) {
|
|
90
|
+
// Payload's shorthand — `{ id: 999 }` rather than `{ id: { equals: 999 } }` — carries the
|
|
91
|
+
// operand directly, with no operator keys to walk. The structural conversion reads it as
|
|
92
|
+
// an implicit `equals`, so coerce it in place: walking a primitive as an operator map
|
|
93
|
+
// would drop the condition entirely and turn the query into a match-all.
|
|
94
|
+
if (condition === null || typeof condition !== 'object' || Array.isArray(condition)) {
|
|
95
|
+
return stringifyNumbers(condition);
|
|
96
|
+
}
|
|
97
|
+
const result = {};
|
|
98
|
+
for (const [operator, operand] of Object.entries(condition)){
|
|
99
|
+
result[operator] = stringifyNumbers(operand);
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
/** A number becomes its string form; a number inside an array does too (e.g. `in`);
|
|
104
|
+
* everything else passes through untouched. */ function stringifyNumbers(value) {
|
|
105
|
+
if (typeof value === 'number') {
|
|
106
|
+
return String(value);
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
return value.map((entry)=>typeof entry === 'number' ? String(entry) : entry);
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type { Config } from 'payload';
|
|
1
|
+
import type { Config, SanitizedConfig } from 'payload';
|
|
2
2
|
/**
|
|
3
3
|
* Wire form of the v1 `DocumentSchema` sent on every request so the server can
|
|
4
4
|
* classify each queried path against the index tables. Paths are
|
|
5
5
|
* period-delimited (e.g. `author.name`).
|
|
6
|
+
*
|
|
7
|
+
* `localized` on a path is the flag *declared* by the Payload field, not a
|
|
8
|
+
* statement about where locale keys appear in the data. Payload nests locale keys
|
|
9
|
+
* at the outermost localized field on a path and stores everything beneath it
|
|
10
|
+
* plainly; the Content API resolves that absorption itself while walking a path,
|
|
11
|
+
* because a block entity is shared across the schema and can be referenced from
|
|
12
|
+
* both a localized and a non-localized `blocks` field. Read paths that need the
|
|
13
|
+
* resolved flag on this side use `isLocaleAbsorbed`.
|
|
6
14
|
*/
|
|
7
15
|
export interface DocumentSchemaWire {
|
|
16
|
+
blocks: Record<string, WireBlockSchema>;
|
|
8
17
|
collections: Record<string, WireCollectionSchema>;
|
|
9
18
|
version: 1;
|
|
10
19
|
}
|
|
@@ -13,11 +22,19 @@ interface WireCollectionSchema {
|
|
|
13
22
|
name: string;
|
|
14
23
|
paths: Record<string, WireFieldSchema>;
|
|
15
24
|
}
|
|
25
|
+
interface WireBlockSchema {
|
|
26
|
+
name: string;
|
|
27
|
+
paths: Record<string, WireFieldSchema>;
|
|
28
|
+
}
|
|
16
29
|
type WireHint = {
|
|
17
30
|
paths: string[];
|
|
18
31
|
type: 'unique';
|
|
19
32
|
};
|
|
20
33
|
type WireFieldSchema = {
|
|
34
|
+
blocks: Record<string, string>;
|
|
35
|
+
localized: boolean;
|
|
36
|
+
type: 'blocks';
|
|
37
|
+
} | {
|
|
21
38
|
collection: string | string[];
|
|
22
39
|
on: string;
|
|
23
40
|
type: 'join';
|
|
@@ -42,14 +59,14 @@ type WireFieldSchema = {
|
|
|
42
59
|
unique: boolean;
|
|
43
60
|
} | {
|
|
44
61
|
localized: boolean;
|
|
45
|
-
type: 'array'
|
|
62
|
+
type: 'array';
|
|
46
63
|
} | {
|
|
47
64
|
localized: boolean;
|
|
48
65
|
type: 'checkbox' | 'date' | 'json' | 'radio';
|
|
49
66
|
} | {
|
|
50
67
|
localized: boolean;
|
|
51
|
-
type: 'code' | 'email' | 'point' | 'textarea';
|
|
68
|
+
type: 'code' | 'email' | 'point' | 'slug' | 'textarea';
|
|
52
69
|
unique: boolean;
|
|
53
70
|
};
|
|
54
|
-
export declare function buildDocumentSchema(config: Config): DocumentSchemaWire;
|
|
71
|
+
export declare function buildDocumentSchema(config: Config | SanitizedConfig): DocumentSchemaWire;
|
|
55
72
|
export {};
|