payload 3.90.0 → 3.91.0-internal.6e3dc85

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.
Files changed (38) hide show
  1. package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
  2. package/dist/database/queryValidation/validateSearchParams.js +14 -9
  3. package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
  4. package/dist/exports/shared.d.ts +1 -1
  5. package/dist/exports/shared.d.ts.map +1 -1
  6. package/dist/exports/shared.js +1 -1
  7. package/dist/exports/shared.js.map +1 -1
  8. package/dist/index.bundled.d.ts +1 -1
  9. package/dist/utilities/formatAdminURL.d.ts +1 -0
  10. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  11. package/dist/utilities/formatAdminURL.js +22 -4
  12. package/dist/utilities/formatAdminURL.js.map +1 -1
  13. package/dist/utilities/formatAdminURL.spec.js +98 -2
  14. package/dist/utilities/formatAdminURL.spec.js.map +1 -1
  15. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  16. package/dist/utilities/handleEndpoints.js +5 -3
  17. package/dist/utilities/handleEndpoints.js.map +1 -1
  18. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.d.ts +4 -0
  19. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.d.ts.map +1 -0
  20. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js +248 -0
  21. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -0
  22. package/dist/utilities/telemetry/featureInfo/types.d.ts +62 -0
  23. package/dist/utilities/telemetry/featureInfo/types.d.ts.map +1 -0
  24. package/dist/utilities/telemetry/featureInfo/types.js +3 -0
  25. package/dist/utilities/telemetry/featureInfo/types.js.map +1 -0
  26. package/dist/utilities/telemetry/getProjectContext.d.ts +14 -0
  27. package/dist/utilities/telemetry/getProjectContext.d.ts.map +1 -0
  28. package/dist/utilities/telemetry/getProjectContext.js +36 -0
  29. package/dist/utilities/telemetry/getProjectContext.js.map +1 -0
  30. package/dist/utilities/telemetry/index.d.ts +7 -1
  31. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  32. package/dist/utilities/telemetry/index.js +22 -0
  33. package/dist/utilities/telemetry/index.js.map +1 -1
  34. package/package.json +2 -2
  35. package/dist/auth/baseFields/apiKey.d.ts +0 -3
  36. package/dist/auth/baseFields/apiKey.d.ts.map +0 -1
  37. package/dist/auth/baseFields/apiKey.js +0 -59
  38. package/dist/auth/baseFields/apiKey.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"validateSearchParams.d.ts","sourceRoot":"","sources":["../../../src/database/queryValidation/validateSearchParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAA;AAW7D,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,OAAO,CAAA;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,cAAc,CAAA;IACxB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,GAAG,EAAE,OAAO,CAAA;IACZ,aAAa,CAAC,EAAE,cAAc,EAAE,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,IAAI,EAAE,YAAY,EAClB,QAAQ,EACR,eAAe,EACf,GAAG,EACH,gBAAgB,EAChB,GAAG,EACH,aAAa,GACd,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAmStB"}
1
+ {"version":3,"file":"validateSearchParams.d.ts","sourceRoot":"","sources":["../../../src/database/queryValidation/validateSearchParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAA;AAW7D,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,OAAO,CAAA;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,cAAc,CAAA;IACxB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,GAAG,EAAE,OAAO,CAAA;IACZ,aAAa,CAAC,EAAE,cAAc,EAAE,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,IAAI,EAAE,YAAY,EAClB,QAAQ,EACR,eAAe,EACf,GAAG,EACH,gBAAgB,EAChB,GAAG,EACH,aAAa,GACd,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8StB"}
@@ -129,21 +129,19 @@ import { validateQueryPaths } from './validateQueryPaths.js';
129
129
  });
130
130
  }
131
131
  const relatedCollectionReadPermission = policies.collections[collectionSlug].read;
132
- if (paths.length > 1 && relatedCollectionReadPermission && typeof relatedCollectionReadPermission === 'object' && relatedCollectionReadPermission.where) {
133
- const relationshipPath = paths.slice(0, -1).map(({ path: pathToRelationship })=>pathToRelationship).join('.');
134
- const accessWhere = prefixWherePaths({
135
- prefix: relationshipPath,
136
- where: relatedCollectionReadPermission.where
137
- });
132
+ const previousSegment = paths[i - 1];
133
+ const traversedField = previousSegment?.field;
134
+ const isRelationshipHop = Boolean(traversedField) && (traversedField.type === 'relationship' || traversedField.type === 'upload' || traversedField.type === 'join');
135
+ if (isRelationshipHop && relatedCollectionReadPermission && typeof relatedCollectionReadPermission === 'object' && relatedCollectionReadPermission.where) {
136
+ const relationshipPath = paths.slice(0, i).map(({ path: pathToRelationship })=>pathToRelationship).join('.');
138
137
  const mutableWhere = constraint;
139
138
  const existingAnd = Array.isArray(mutableWhere.and) ? mutableWhere.and : [];
140
- const relationshipField = paths.at(-2)?.field;
141
139
  // Has-many relationships and joins can point to many related documents, so the user's
142
140
  // filter and the access constraint must be satisfied by the SAME related document.
143
141
  // Scoping both into a single `contains` prevents a different, readable document from
144
142
  // masking one the user cannot read (a related-document oracle).
145
- const isHasManyRelationship = relationshipField && (relationshipField.type === 'relationship' || relationshipField.type === 'upload') && relationshipField.hasMany;
146
- const isJoin = relationshipField?.type === 'join';
143
+ const isHasManyRelationship = (traversedField.type === 'relationship' || traversedField.type === 'upload') && traversedField.hasMany;
144
+ const isJoin = traversedField.type === 'join';
147
145
  if (isHasManyRelationship || isJoin) {
148
146
  const relatedFieldPath = paths.at(-1)?.path;
149
147
  if (relatedFieldPath) {
@@ -164,8 +162,15 @@ import { validateQueryPaths } from './validateQueryPaths.js';
164
162
  }
165
163
  }
166
164
  ];
165
+ // The scoped `contains` above fully replaces the user's original filter;
166
+ // so we can remove it from the top-level where clause
167
+ delete mutableWhere[incomingPath];
167
168
  }
168
169
  } else {
170
+ const accessWhere = prefixWherePaths({
171
+ prefix: relationshipPath,
172
+ where: relatedCollectionReadPermission.where
173
+ });
169
174
  mutableWhere.and = [
170
175
  ...existingAnd,
171
176
  accessWhere
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/database/queryValidation/validateSearchParams.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { FlattenedField } from '../../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest, WhereField } from '../../types/index.js'\nimport type { EntityPolicies, PathToQuery } from './types.js'\n\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { SAFE_FIELD_PATH_REGEX } from '../../types/constants.js'\nimport { getEntityPermissions } from '../../utilities/getEntityPermissions/getEntityPermissions.js'\nimport { isolateObjectProperty } from '../../utilities/isolateObjectProperty.js'\nimport { getLocalizedPaths } from '../getLocalizedPaths.js'\nimport { isNestedRelationshipQuery } from '../isNestedRelationshipQuery.js'\nimport { prefixWherePaths } from '../prefixWherePaths.js'\nimport { validateQueryPaths } from './validateQueryPaths.js'\n\ntype Args = {\n collectionConfig?: SanitizedCollectionConfig\n constraint: WhereField\n errors: { path: string }[]\n fields: FlattenedField[]\n globalConfig?: SanitizedGlobalConfig\n operator: string\n overrideAccess: boolean\n parentIsLocalized?: boolean\n path: string\n // TODO: Rename to permissions or entityPermissions in 4.0\n policies: EntityPolicies\n polymorphicJoin?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n val: unknown\n versionFields?: FlattenedField[]\n}\n\n/**\n * Validate the Payload key / value / operator\n */\nexport async function validateSearchParam({\n collectionConfig,\n constraint,\n errors,\n fields,\n globalConfig,\n operator,\n overrideAccess,\n parentIsLocalized,\n path: incomingPath,\n policies,\n polymorphicJoin,\n req,\n showHiddenFields,\n val,\n versionFields,\n}: Args): Promise<void> {\n // Replace GraphQL nested field double underscore formatting\n let sanitizedPath\n if (incomingPath === '_id') {\n sanitizedPath = 'id'\n } else {\n sanitizedPath = incomingPath.replace(/__/g, '.')\n }\n let paths: PathToQuery[] = []\n const { slug } = (collectionConfig || globalConfig)!\n\n const blockReferencesPermissions = {}\n\n if (globalConfig && !policies.globals![slug]) {\n policies.globals![slug] = await getEntityPermissions({\n blockReferencesPermissions,\n entity: globalConfig,\n entityType: 'global',\n fetchData: false,\n operations: ['read'],\n req,\n })\n }\n\n if (sanitizedPath !== 'id') {\n paths = getLocalizedPaths({\n collectionSlug: collectionConfig?.slug,\n fields,\n globalSlug: globalConfig?.slug,\n incomingPath: sanitizedPath,\n locale: req.locale!,\n overrideAccess,\n parentIsLocalized,\n payload: req.payload,\n showHiddenFields,\n })\n }\n const promises: Promise<void>[] = []\n\n const relationshipField = paths.length === 1 ? paths[0]?.field : undefined\n const hasNestedWhere = isNestedRelationshipQuery(val)\n const relatedCollectionSlug =\n relationshipField &&\n (relationshipField.type === 'relationship' || relationshipField.type === 'upload') &&\n relationshipField.hasMany &&\n typeof relationshipField.relationTo === 'string'\n ? relationshipField.relationTo\n : undefined\n // 3.x supports only the `contains` operator for nested relationship queries.\n const isNestedHasManyQuery =\n operator === 'contains' && hasNestedWhere && Boolean(relatedCollectionSlug)\n\n const isJoinContainsQuery =\n operator === 'contains' &&\n relationshipField?.type === 'join' &&\n typeof relationshipField.collection === 'string' &&\n hasNestedWhere\n\n // Plain-object values would be merged as raw query fragments.\n if (operator === 'like' || operator === 'not_like' || operator === 'contains') {\n const isValidNestedContains =\n operator === 'contains' && (isNestedHasManyQuery || isJoinContainsQuery)\n\n const containsPlainObject =\n isNestedRelationshipQuery(val) ||\n (Array.isArray(val) && val.some((entry) => isNestedRelationshipQuery(entry)))\n\n if (containsPlainObject && !isValidNestedContains) {\n errors.push({ path: incomingPath })\n return\n }\n }\n\n if (isNestedHasManyQuery && relatedCollectionSlug) {\n // Validate the nested query against the related collection.\n promises.push(\n validateQueryPaths({\n collectionConfig: req.payload.collections[relatedCollectionSlug]!.config,\n errors,\n overrideAccess,\n policies,\n req,\n showHiddenFields,\n where: val,\n }),\n )\n }\n\n // Sanitize relation.otherRelation.id to relation.otherRelation\n if (paths.at(-1)?.path === 'id') {\n const previousField = paths.at(-2)?.field\n if (\n previousField &&\n (previousField.type === 'relationship' || previousField.type === 'upload') &&\n typeof previousField.relationTo === 'string'\n ) {\n paths.pop()\n }\n }\n\n promises.push(\n ...paths.map(async ({ collectionSlug, field, invalid, path }, i) => {\n if (invalid) {\n const isUnknownPolymorphicJoinField =\n polymorphicJoin && !field && SAFE_FIELD_PATH_REGEX.test(incomingPath)\n\n if (!isUnknownPolymorphicJoinField) {\n errors.push({ path })\n }\n\n return\n }\n\n // where: { relatedPosts: { equals: 1}} -> { 'relatedPosts.id': { equals: 1}}\n if (field.type === 'join' && path === incomingPath) {\n constraint[`${path}.id` as keyof WhereField] = constraint[path as keyof WhereField]\n delete constraint[path as keyof WhereField]\n }\n\n if ('virtual' in field && field.virtual) {\n if (field.virtual === true) {\n errors.push({ path })\n }\n }\n\n if (polymorphicJoin && path === 'relationTo') {\n return\n }\n\n if (!overrideAccess && fieldAffectsData(field)) {\n if (collectionSlug) {\n if (!policies.collections![collectionSlug]) {\n policies.collections![collectionSlug] = await getEntityPermissions({\n blockReferencesPermissions,\n entity: req.payload.collections[collectionSlug]!.config,\n entityType: 'collection',\n fetchData: false,\n operations: ['read'],\n req: isolateObjectProperty(req, 'transactionID'),\n })\n }\n\n if (\n ['hash', 'salt'].includes(incomingPath) &&\n collectionConfig!.auth &&\n !collectionConfig!.auth?.disableLocalStrategy\n ) {\n errors.push({ path: incomingPath })\n }\n\n const relatedCollectionReadPermission = policies.collections![collectionSlug].read\n if (\n paths.length > 1 &&\n relatedCollectionReadPermission &&\n typeof relatedCollectionReadPermission === 'object' &&\n relatedCollectionReadPermission.where\n ) {\n const relationshipPath = paths\n .slice(0, -1)\n .map(({ path: pathToRelationship }) => pathToRelationship)\n .join('.')\n\n const accessWhere = prefixWherePaths({\n prefix: relationshipPath,\n where: relatedCollectionReadPermission.where,\n })\n const mutableWhere = constraint as Record<string, unknown>\n const existingAnd = Array.isArray(mutableWhere.and) ? mutableWhere.and : []\n const relationshipField = paths.at(-2)?.field\n\n // Has-many relationships and joins can point to many related documents, so the user's\n // filter and the access constraint must be satisfied by the SAME related document.\n // Scoping both into a single `contains` prevents a different, readable document from\n // masking one the user cannot read (a related-document oracle).\n const isHasManyRelationship =\n relationshipField &&\n (relationshipField.type === 'relationship' || relationshipField.type === 'upload') &&\n relationshipField.hasMany\n const isJoin = relationshipField?.type === 'join'\n\n if (isHasManyRelationship || isJoin) {\n const relatedFieldPath = paths.at(-1)?.path\n\n if (relatedFieldPath) {\n mutableWhere.and = [\n ...existingAnd,\n {\n [relationshipPath]: {\n contains: {\n and: [\n {\n [relatedFieldPath]: {\n [operator]: val,\n },\n },\n relatedCollectionReadPermission.where,\n ],\n },\n },\n },\n ]\n }\n } else {\n mutableWhere.and = [...existingAnd, accessWhere]\n }\n }\n }\n let fieldPath = path\n // remove locale from end of path\n if (path.endsWith(`.${req.locale}`)) {\n fieldPath = path.slice(0, -(req.locale!.length + 1))\n }\n // remove \".value\" from ends of polymorphic relationship paths\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n Array.isArray(field.relationTo)\n ) {\n fieldPath = fieldPath.replace('.value', '')\n }\n\n const entityType: 'collections' | 'globals' = globalConfig ? 'globals' : 'collections'\n const entitySlug = collectionSlug || globalConfig!.slug\n const segments = fieldPath.split('.')\n\n let fieldAccess: any\n\n if (versionFields) {\n fieldAccess = policies[entityType]![entitySlug]!.fields\n\n if (\n segments[0] === 'parent' ||\n segments[0] === 'version' ||\n segments[0] === 'snapshot' ||\n segments[0] === 'latest'\n ) {\n segments.shift()\n }\n } else {\n fieldAccess = policies[entityType]![entitySlug]!.fields\n }\n\n if (segments.length) {\n segments.forEach((segment) => {\n if (fieldAccess[segment]) {\n if ('fields' in fieldAccess[segment]) {\n fieldAccess = fieldAccess[segment].fields\n } else {\n fieldAccess = fieldAccess[segment]\n }\n }\n })\n\n if (!fieldAccess?.read?.permission) {\n errors.push({ path: fieldPath })\n }\n }\n }\n\n if (!isNestedHasManyQuery && i > 1) {\n // Remove top collection and reverse array\n // to work backwards from top\n const pathsToQuery = paths.slice(1).reverse()\n\n pathsToQuery.forEach(\n ({ collectionSlug: pathCollectionSlug, path: subPath }, pathToQueryIndex) => {\n // On the \"deepest\" collection,\n // validate query of the relationship\n if (pathToQueryIndex === 0) {\n promises.push(\n validateQueryPaths({\n collectionConfig: req.payload.collections[pathCollectionSlug!]!.config,\n errors,\n globalConfig: undefined,\n overrideAccess,\n policies,\n req,\n showHiddenFields,\n where: {\n [subPath]: {\n [operator]: val,\n },\n },\n }),\n )\n }\n },\n )\n }\n }),\n )\n await Promise.all(promises)\n}\n"],"names":["fieldAffectsData","SAFE_FIELD_PATH_REGEX","getEntityPermissions","isolateObjectProperty","getLocalizedPaths","isNestedRelationshipQuery","prefixWherePaths","validateQueryPaths","validateSearchParam","collectionConfig","constraint","errors","fields","globalConfig","operator","overrideAccess","parentIsLocalized","path","incomingPath","policies","polymorphicJoin","req","showHiddenFields","val","versionFields","sanitizedPath","replace","paths","slug","blockReferencesPermissions","globals","entity","entityType","fetchData","operations","collectionSlug","globalSlug","locale","payload","promises","relationshipField","length","field","undefined","hasNestedWhere","relatedCollectionSlug","type","hasMany","relationTo","isNestedHasManyQuery","Boolean","isJoinContainsQuery","collection","isValidNestedContains","containsPlainObject","Array","isArray","some","entry","push","collections","config","where","at","previousField","pop","map","invalid","i","isUnknownPolymorphicJoinField","test","virtual","includes","auth","disableLocalStrategy","relatedCollectionReadPermission","read","relationshipPath","slice","pathToRelationship","join","accessWhere","prefix","mutableWhere","existingAnd","and","isHasManyRelationship","isJoin","relatedFieldPath","contains","fieldPath","endsWith","entitySlug","segments","split","fieldAccess","shift","forEach","segment","permission","pathsToQuery","reverse","pathCollectionSlug","subPath","pathToQueryIndex","Promise","all"],"mappings":"AAMA,SAASA,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,qBAAqB,QAAQ,2BAA0B;AAChE,SAASC,oBAAoB,QAAQ,+DAA8D;AACnG,SAASC,qBAAqB,QAAQ,2CAA0C;AAChF,SAASC,iBAAiB,QAAQ,0BAAyB;AAC3D,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,kBAAkB,QAAQ,0BAAyB;AAqB5D;;CAEC,GACD,OAAO,eAAeC,oBAAoB,EACxCC,gBAAgB,EAChBC,UAAU,EACVC,MAAM,EACNC,MAAM,EACNC,YAAY,EACZC,QAAQ,EACRC,cAAc,EACdC,iBAAiB,EACjBC,MAAMC,YAAY,EAClBC,QAAQ,EACRC,eAAe,EACfC,GAAG,EACHC,gBAAgB,EAChBC,GAAG,EACHC,aAAa,EACR;IACL,4DAA4D;IAC5D,IAAIC;IACJ,IAAIP,iBAAiB,OAAO;QAC1BO,gBAAgB;IAClB,OAAO;QACLA,gBAAgBP,aAAaQ,OAAO,CAAC,OAAO;IAC9C;IACA,IAAIC,QAAuB,EAAE;IAC7B,MAAM,EAAEC,IAAI,EAAE,GAAInB,oBAAoBI;IAEtC,MAAMgB,6BAA6B,CAAC;IAEpC,IAAIhB,gBAAgB,CAACM,SAASW,OAAO,AAAC,CAAC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CAAC,EAAE,KAAK,cAChBA,QAAQ,CAAC,EAAE,KAAK,UAChB;oBACAA,SAASG,KAAK;gBAChB;YACF,OAAO;gBACLD,cAAc5E,QAAQ,CAACa,WAAW,AAAC,CAAC4D,WAAW,CAAEhF,MAAM;YACzD;YAEA,IAAIiF,SAASpD,MAAM,EAAE;gBACnBoD,SAASI,OAAO,CAAC,CAACC;oBAChB,IAAIH,WAAW,CAACG,QAAQ,EAAE;wBACxB,IAAI,YAAYH,WAAW,CAACG,QAAQ,EAAE;4BACpCH,cAAcA,WAAW,CAACG,QAAQ,CAACtF,MAAM;wBAC3C,OAAO;4BACLmF,cAAcA,WAAW,CAACG,QAAQ;wBACpC;oBACF;gBACF;gBAEA,IAAI,CAACH,aAAanB,MAAMuB,YAAY;oBAClCxF,OAAOgD,IAAI,CAAC;wBAAE1C,MAAMyE;oBAAU;gBAChC;YACF;QACF;QAEA,IAAI,CAACzC,wBAAwBmB,IAAI,GAAG;YAClC,0CAA0C;YAC1C,6BAA6B;YAC7B,MAAMgC,eAAezE,MAAMmD,KAAK,CAAC,GAAGuB,OAAO;YAE3CD,aAAaH,OAAO,CAClB,CAAC,EAAE9D,gBAAgBmE,kBAAkB,EAAErF,MAAMsF,OAAO,EAAE,EAAEC;gBACtD,+BAA+B;gBAC/B,qCAAqC;gBACrC,IAAIA,qBAAqB,GAAG;oBAC1BjE,SAASoB,IAAI,CACXpD,mBAAmB;wBACjBE,kBAAkBY,IAAIiB,OAAO,CAACsB,WAAW,CAAC0C,mBAAoB,CAAEzC,MAAM;wBACtElD;wBACAE,cAAc8B;wBACd5B;wBACAI;wBACAE;wBACAC;wBACAwC,OAAO;4BACL,CAACyC,QAAQ,EAAE;gCACT,CAACzF,SAAS,EAAES;4BACd;wBACF;oBACF;gBAEJ;YACF;QAEJ;IACF;IAEF,MAAMkF,QAAQC,GAAG,CAACnE;AACpB"}
1
+ {"version":3,"sources":["../../../src/database/queryValidation/validateSearchParams.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { FlattenedField } from '../../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest, WhereField } from '../../types/index.js'\nimport type { EntityPolicies, PathToQuery } from './types.js'\n\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { SAFE_FIELD_PATH_REGEX } from '../../types/constants.js'\nimport { getEntityPermissions } from '../../utilities/getEntityPermissions/getEntityPermissions.js'\nimport { isolateObjectProperty } from '../../utilities/isolateObjectProperty.js'\nimport { getLocalizedPaths } from '../getLocalizedPaths.js'\nimport { isNestedRelationshipQuery } from '../isNestedRelationshipQuery.js'\nimport { prefixWherePaths } from '../prefixWherePaths.js'\nimport { validateQueryPaths } from './validateQueryPaths.js'\n\ntype Args = {\n collectionConfig?: SanitizedCollectionConfig\n constraint: WhereField\n errors: { path: string }[]\n fields: FlattenedField[]\n globalConfig?: SanitizedGlobalConfig\n operator: string\n overrideAccess: boolean\n parentIsLocalized?: boolean\n path: string\n // TODO: Rename to permissions or entityPermissions in 4.0\n policies: EntityPolicies\n polymorphicJoin?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n val: unknown\n versionFields?: FlattenedField[]\n}\n\n/**\n * Validate the Payload key / value / operator\n */\nexport async function validateSearchParam({\n collectionConfig,\n constraint,\n errors,\n fields,\n globalConfig,\n operator,\n overrideAccess,\n parentIsLocalized,\n path: incomingPath,\n policies,\n polymorphicJoin,\n req,\n showHiddenFields,\n val,\n versionFields,\n}: Args): Promise<void> {\n // Replace GraphQL nested field double underscore formatting\n let sanitizedPath\n if (incomingPath === '_id') {\n sanitizedPath = 'id'\n } else {\n sanitizedPath = incomingPath.replace(/__/g, '.')\n }\n let paths: PathToQuery[] = []\n const { slug } = (collectionConfig || globalConfig)!\n\n const blockReferencesPermissions = {}\n\n if (globalConfig && !policies.globals![slug]) {\n policies.globals![slug] = await getEntityPermissions({\n blockReferencesPermissions,\n entity: globalConfig,\n entityType: 'global',\n fetchData: false,\n operations: ['read'],\n req,\n })\n }\n\n if (sanitizedPath !== 'id') {\n paths = getLocalizedPaths({\n collectionSlug: collectionConfig?.slug,\n fields,\n globalSlug: globalConfig?.slug,\n incomingPath: sanitizedPath,\n locale: req.locale!,\n overrideAccess,\n parentIsLocalized,\n payload: req.payload,\n showHiddenFields,\n })\n }\n const promises: Promise<void>[] = []\n\n const relationshipField = paths.length === 1 ? paths[0]?.field : undefined\n const hasNestedWhere = isNestedRelationshipQuery(val)\n const relatedCollectionSlug =\n relationshipField &&\n (relationshipField.type === 'relationship' || relationshipField.type === 'upload') &&\n relationshipField.hasMany &&\n typeof relationshipField.relationTo === 'string'\n ? relationshipField.relationTo\n : undefined\n // 3.x supports only the `contains` operator for nested relationship queries.\n const isNestedHasManyQuery =\n operator === 'contains' && hasNestedWhere && Boolean(relatedCollectionSlug)\n\n const isJoinContainsQuery =\n operator === 'contains' &&\n relationshipField?.type === 'join' &&\n typeof relationshipField.collection === 'string' &&\n hasNestedWhere\n\n // Plain-object values would be merged as raw query fragments.\n if (operator === 'like' || operator === 'not_like' || operator === 'contains') {\n const isValidNestedContains =\n operator === 'contains' && (isNestedHasManyQuery || isJoinContainsQuery)\n\n const containsPlainObject =\n isNestedRelationshipQuery(val) ||\n (Array.isArray(val) && val.some((entry) => isNestedRelationshipQuery(entry)))\n\n if (containsPlainObject && !isValidNestedContains) {\n errors.push({ path: incomingPath })\n return\n }\n }\n\n if (isNestedHasManyQuery && relatedCollectionSlug) {\n // Validate the nested query against the related collection.\n promises.push(\n validateQueryPaths({\n collectionConfig: req.payload.collections[relatedCollectionSlug]!.config,\n errors,\n overrideAccess,\n policies,\n req,\n showHiddenFields,\n where: val,\n }),\n )\n }\n\n // Sanitize relation.otherRelation.id to relation.otherRelation\n if (paths.at(-1)?.path === 'id') {\n const previousField = paths.at(-2)?.field\n if (\n previousField &&\n (previousField.type === 'relationship' || previousField.type === 'upload') &&\n typeof previousField.relationTo === 'string'\n ) {\n paths.pop()\n }\n }\n\n promises.push(\n ...paths.map(async ({ collectionSlug, field, invalid, path }, i) => {\n if (invalid) {\n const isUnknownPolymorphicJoinField =\n polymorphicJoin && !field && SAFE_FIELD_PATH_REGEX.test(incomingPath)\n\n if (!isUnknownPolymorphicJoinField) {\n errors.push({ path })\n }\n\n return\n }\n\n // where: { relatedPosts: { equals: 1}} -> { 'relatedPosts.id': { equals: 1}}\n if (field.type === 'join' && path === incomingPath) {\n constraint[`${path}.id` as keyof WhereField] = constraint[path as keyof WhereField]\n delete constraint[path as keyof WhereField]\n }\n\n if ('virtual' in field && field.virtual) {\n if (field.virtual === true) {\n errors.push({ path })\n }\n }\n\n if (polymorphicJoin && path === 'relationTo') {\n return\n }\n\n if (!overrideAccess && fieldAffectsData(field)) {\n if (collectionSlug) {\n if (!policies.collections![collectionSlug]) {\n policies.collections![collectionSlug] = await getEntityPermissions({\n blockReferencesPermissions,\n entity: req.payload.collections[collectionSlug]!.config,\n entityType: 'collection',\n fetchData: false,\n operations: ['read'],\n req: isolateObjectProperty(req, 'transactionID'),\n })\n }\n\n if (\n ['hash', 'salt'].includes(incomingPath) &&\n collectionConfig!.auth &&\n !collectionConfig!.auth?.disableLocalStrategy\n ) {\n errors.push({ path: incomingPath })\n }\n\n const relatedCollectionReadPermission = policies.collections![collectionSlug].read\n const previousSegment = paths[i - 1]\n const traversedField = previousSegment?.field\n const isRelationshipHop =\n Boolean(traversedField) &&\n (traversedField!.type === 'relationship' ||\n traversedField!.type === 'upload' ||\n traversedField!.type === 'join')\n\n if (\n isRelationshipHop &&\n relatedCollectionReadPermission &&\n typeof relatedCollectionReadPermission === 'object' &&\n relatedCollectionReadPermission.where\n ) {\n const relationshipPath = paths\n .slice(0, i)\n .map(({ path: pathToRelationship }) => pathToRelationship)\n .join('.')\n\n const mutableWhere = constraint as Record<string, unknown>\n const existingAnd = Array.isArray(mutableWhere.and) ? mutableWhere.and : []\n\n // Has-many relationships and joins can point to many related documents, so the user's\n // filter and the access constraint must be satisfied by the SAME related document.\n // Scoping both into a single `contains` prevents a different, readable document from\n // masking one the user cannot read (a related-document oracle).\n const isHasManyRelationship =\n (traversedField!.type === 'relationship' || traversedField!.type === 'upload') &&\n traversedField!.hasMany\n const isJoin = traversedField!.type === 'join'\n\n if (isHasManyRelationship || isJoin) {\n const relatedFieldPath = paths.at(-1)?.path\n\n if (relatedFieldPath) {\n mutableWhere.and = [\n ...existingAnd,\n {\n [relationshipPath]: {\n contains: {\n and: [\n {\n [relatedFieldPath]: {\n [operator]: val,\n },\n },\n relatedCollectionReadPermission.where,\n ],\n },\n },\n },\n ]\n\n // The scoped `contains` above fully replaces the user's original filter;\n // so we can remove it from the top-level where clause\n delete mutableWhere[incomingPath]\n }\n } else {\n const accessWhere = prefixWherePaths({\n prefix: relationshipPath,\n where: relatedCollectionReadPermission.where,\n })\n\n mutableWhere.and = [...existingAnd, accessWhere]\n }\n }\n }\n let fieldPath = path\n // remove locale from end of path\n if (path.endsWith(`.${req.locale}`)) {\n fieldPath = path.slice(0, -(req.locale!.length + 1))\n }\n // remove \".value\" from ends of polymorphic relationship paths\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n Array.isArray(field.relationTo)\n ) {\n fieldPath = fieldPath.replace('.value', '')\n }\n\n const entityType: 'collections' | 'globals' = globalConfig ? 'globals' : 'collections'\n const entitySlug = collectionSlug || globalConfig!.slug\n const segments = fieldPath.split('.')\n\n let fieldAccess: any\n\n if (versionFields) {\n fieldAccess = policies[entityType]![entitySlug]!.fields\n\n if (\n segments[0] === 'parent' ||\n segments[0] === 'version' ||\n segments[0] === 'snapshot' ||\n segments[0] === 'latest'\n ) {\n segments.shift()\n }\n } else {\n fieldAccess = policies[entityType]![entitySlug]!.fields\n }\n\n if (segments.length) {\n segments.forEach((segment) => {\n if (fieldAccess[segment]) {\n if ('fields' in fieldAccess[segment]) {\n fieldAccess = fieldAccess[segment].fields\n } else {\n fieldAccess = fieldAccess[segment]\n }\n }\n })\n\n if (!fieldAccess?.read?.permission) {\n errors.push({ path: fieldPath })\n }\n }\n }\n\n if (!isNestedHasManyQuery && i > 1) {\n // Remove top collection and reverse array\n // to work backwards from top\n const pathsToQuery = paths.slice(1).reverse()\n\n pathsToQuery.forEach(\n ({ collectionSlug: pathCollectionSlug, path: subPath }, pathToQueryIndex) => {\n // On the \"deepest\" collection,\n // validate query of the relationship\n if (pathToQueryIndex === 0) {\n promises.push(\n validateQueryPaths({\n collectionConfig: req.payload.collections[pathCollectionSlug!]!.config,\n errors,\n globalConfig: undefined,\n overrideAccess,\n policies,\n req,\n showHiddenFields,\n where: {\n [subPath]: {\n [operator]: val,\n },\n },\n }),\n )\n }\n },\n )\n }\n }),\n )\n await Promise.all(promises)\n}\n"],"names":["fieldAffectsData","SAFE_FIELD_PATH_REGEX","getEntityPermissions","isolateObjectProperty","getLocalizedPaths","isNestedRelationshipQuery","prefixWherePaths","validateQueryPaths","validateSearchParam","collectionConfig","constraint","errors","fields","globalConfig","operator","overrideAccess","parentIsLocalized","path","incomingPath","policies","polymorphicJoin","req","showHiddenFields","val","versionFields","sanitizedPath","replace","paths","slug","blockReferencesPermissions","globals","entity","entityType","fetchData","operations","collectionSlug","globalSlug","locale","payload","promises","relationshipField","length","field","undefined","hasNestedWhere","relatedCollectionSlug","type","hasMany","relationTo","isNestedHasManyQuery","Boolean","isJoinContainsQuery","collection","isValidNestedContains","containsPlainObject","Array","isArray","some","entry","push","collections","config","where","at","previousField","pop","map","invalid","i","isUnknownPolymorphicJoinField","test","virtual","includes","auth","disableLocalStrategy","relatedCollectionReadPermission","read","previousSegment","traversedField","isRelationshipHop","relationshipPath","slice","pathToRelationship","join","mutableWhere","existingAnd","and","isHasManyRelationship","isJoin","relatedFieldPath","contains","accessWhere","prefix","fieldPath","endsWith","entitySlug","segments","split","fieldAccess","shift","forEach","segment","permission","pathsToQuery","reverse","pathCollectionSlug","subPath","pathToQueryIndex","Promise","all"],"mappings":"AAMA,SAASA,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,qBAA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ChB,IAAIH,WAAW,CAACG,QAAQ,EAAE;wBACxB,IAAI,YAAYH,WAAW,CAACG,QAAQ,EAAE;4BACpCH,cAAcA,WAAW,CAACG,QAAQ,CAACzF,MAAM;wBAC3C,OAAO;4BACLsF,cAAcA,WAAW,CAACG,QAAQ;wBACpC;oBACF;gBACF;gBAEA,IAAI,CAACH,aAAatB,MAAM0B,YAAY;oBAClC3F,OAAOgD,IAAI,CAAC;wBAAE1C,MAAM4E;oBAAU;gBAChC;YACF;QACF;QAEA,IAAI,CAAC5C,wBAAwBmB,IAAI,GAAG;YAClC,0CAA0C;YAC1C,6BAA6B;YAC7B,MAAMmC,eAAe5E,MAAMsD,KAAK,CAAC,GAAGuB,OAAO;YAE3CD,aAAaH,OAAO,CAClB,CAAC,EAAEjE,gBAAgBsE,kBAAkB,EAAExF,MAAMyF,OAAO,EAAE,EAAEC;gBACtD,+BAA+B;gBAC/B,qCAAqC;gBACrC,IAAIA,qBAAqB,GAAG;oBAC1BpE,SAASoB,IAAI,CACXpD,mBAAmB;wBACjBE,kBAAkBY,IAAIiB,OAAO,CAACsB,WAAW,CAAC6C,mBAAoB,CAAE5C,MAAM;wBACtElD;wBACAE,cAAc8B;wBACd5B;wBACAI;wBACAE;wBACAC;wBACAwC,OAAO;4BACL,CAAC4C,QAAQ,EAAE;gCACT,CAAC5F,SAAS,EAAES;4BACd;wBACF;oBACF;gBAEJ;YACF;QAEJ;IACF;IAEF,MAAMqF,QAAQC,GAAG,CAACtE;AACpB"}
@@ -29,7 +29,7 @@ export { extractID } from '../utilities/extractID.js';
29
29
  export { expandOwnDottedKey, hasUnsupportedFieldPathSegment, setOwnProperty, } from '../utilities/fieldPath.js';
30
30
  export { flattenAllFields } from '../utilities/flattenAllFields.js';
31
31
  export { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js';
32
- export { formatAdminURL } from '../utilities/formatAdminURL.js';
32
+ export { formatAdminURL, stripTrailingSlash } from '../utilities/formatAdminURL.js';
33
33
  export { formatLabels, toWords } from '../utilities/formatLabels.js';
34
34
  export { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js';
35
35
  export { getDataByPath } from '../utilities/getDataByPath.js';
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/exports/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAA;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAA;AACnG,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,4CAA4C,CAAA;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAA;AAEpF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AAEpF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,wBAAwB,GACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4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tB,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAEnF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,4CAA4C,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
@@ -27,7 +27,7 @@ export { extractID } from '../utilities/extractID.js';
27
27
  export { expandOwnDottedKey, hasUnsupportedFieldPathSegment, setOwnProperty } from '../utilities/fieldPath.js';
28
28
  export { flattenAllFields } from '../utilities/flattenAllFields.js';
29
29
  export { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js';
30
- export { formatAdminURL } from '../utilities/formatAdminURL.js';
30
+ export { formatAdminURL, stripTrailingSlash } from '../utilities/formatAdminURL.js';
31
31
  export { formatLabels, toWords } from '../utilities/formatLabels.js';
32
32
  export { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js';
33
33
  export { getDataByPath } from '../utilities/getDataByPath.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\n\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { addSessionToUser, removeExpiredSessions } from '../auth/sessions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/utilities/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/utilities/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\nexport {\n BASE_36_DIGITS,\n generateKeyBetween,\n generateNKeysBetween,\n} from '../config/orderable/fractional-indexing.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport { isNestedRelationshipQuery } from '../database/isNestedRelationshipQuery.js'\n\nexport { type Slugify } from '../fields/baseFields/slug/index.js'\n\nexport { defaultTimezones } from '../fields/baseFields/timezone/defaultTimezones.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsHiddenOrDisabled,\n fieldIsID,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldShouldBeLocalized,\n fieldSupportsMany,\n groupHasName,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\n\nexport * from '../fields/validations.js'\n\nexport type {\n FolderBreadcrumb,\n FolderDocumentItemKey,\n FolderEnabledColection,\n FolderInterface,\n FolderOrDocument,\n GetFolderDataResult,\n Subfolder,\n} from '../folders/types.js'\nexport { buildFolderWhereConstraints } from '../folders/utils/buildFolderWhereConstraints.js'\nexport { formatFolderOrDocumentItem } from '../folders/utils/formatFolderOrDocumentItem.js'\n\nexport { PREFERENCE_KEYS } from '../preferences/keys.js'\n\nexport { validOperators, validOperatorSet } from '../types/constants.js'\nexport { formatFilesize } from '../uploads/formatFilesize.js'\nexport {\n getSanitizedUploadFilename,\n isSvgUpload,\n isXmlUpload,\n uploadRequiresServerValidation,\n} from '../uploads/getFileTypeIdentity.js'\nexport { isImage } from '../uploads/isImage.js'\nexport { appendUploadSelectFields } from '../utilities/appendUploadSelectFields.js'\n\nexport { applyLocaleFiltering } from '../utilities/applyLocaleFiltering.js'\n\nexport { combineWhereConstraints } from '../utilities/combineWhereConstraints.js'\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\n\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\n\nexport { extractID } from '../utilities/extractID.js'\n\nexport {\n expandOwnDottedKey,\n hasUnsupportedFieldPathSegment,\n setOwnProperty,\n} from '../utilities/fieldPath.js'\nexport { flattenAllFields } from '../utilities/flattenAllFields.js'\nexport { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'\nexport { formatAdminURL } from '../utilities/formatAdminURL.js'\n\nexport { formatLabels, toWords } from '../utilities/formatLabels.js'\nexport { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js'\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getFieldPermissions } from '../utilities/getFieldPermissions.js'\n\nexport { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'\n\nexport { getSafeRedirect } from '../utilities/getSafeRedirect.js'\n\nexport { getSelectMode } from '../utilities/getSelectMode.js'\n\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport {\n getAutosaveInterval,\n getVersionsMax,\n hasAutosaveEnabled,\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasLocalizeStatusEnabled,\n hasScheduledPublishEnabled,\n} from '../utilities/getVersionsConfig.js'\n\nexport { isNextBuild } from '../utilities/isNextBuild.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport {\n hoistQueryParamsToAnd,\n mergeListSearchAndWhere,\n} from '../utilities/mergeListSearchAndWhere.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { sanitizeFilename } from '../utilities/sanitizeFilename.js'\n\nexport { sanitizeUrl } from '../utilities/sanitizeUrl.js'\n\nexport { sanitizeUserDataForEmail } from '../utilities/sanitizeUserDataForEmail.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { slugify } from '../utilities/slugify.js'\n\nexport { toKebabCase } from '../utilities/toKebabCase.js'\n\nexport {\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from '../utilities/transformColumnPreferences.js'\n\nexport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\nexport { unflatten } from '../utilities/unflatten.js'\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nexport { wait } from '../utilities/wait.js'\nexport { wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","addSessionToUser","removeExpiredSessions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","BASE_36_DIGITS","generateKeyBetween","generateNKeysBetween","serverProps","isNestedRelationshipQuery","defaultTimezones","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsHiddenOrDisabled","fieldIsID","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldShouldBeLocalized","fieldSupportsMany","groupHasName","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","buildFolderWhereConstraints","formatFolderOrDocumentItem","PREFERENCE_KEYS","validOperators","validOperatorSet","formatFilesize","getSanitizedUploadFilename","isSvgUpload","isXmlUpload","uploadRequiresServerValidation","isImage","appendUploadSelectFields","applyLocaleFiltering","combineWhereConstraints","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","extractID","expandOwnDottedKey","hasUnsupportedFieldPathSegment","setOwnProperty","flattenAllFields","flattenTopLevelFields","formatAdminURL","formatLabels","toWords","getBestFitFromSizes","getDataByPath","getFieldPermissions","getObjectDotNotation","getSafeRedirect","getSelectMode","getSiblingData","getUniqueListBy","getAutosaveInterval","getVersionsMax","hasAutosaveEnabled","hasDraftsEnabled","hasDraftValidationEnabled","hasLocalizeStatusEnabled","hasScheduledPublishEnabled","isNextBuild","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","hoistQueryParamsToAnd","mergeListSearchAndWhere","reduceFieldsToValues","sanitizeFilename","sanitizeUrl","sanitizeUserDataForEmail","setsAreEqual","slugify","toKebabCase","transformColumnsToPreferences","transformColumnsToSearchParams","transformWhereQuery","unflatten","validateMimeType","validateWhereQuery","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAE3B,S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AA6B,EAC7BC,8BAA8B,QACzB,6CAA4C;AAEnD,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,SAAS,QAAQ,4BAA2B;AACrD,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,SAASC,eAAe,QAAQ,qCAAoC"}
1
+ {"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\n\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { addSessionToUser, removeExpiredSessions } from '../auth/sessions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/utilities/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/utilities/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\nexport {\n BASE_36_DIGITS,\n generateKeyBetween,\n generateNKeysBetween,\n} from '../config/orderable/fractional-indexing.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport { isNestedRelationshipQuery } from '../database/isNestedRelationshipQuery.js'\n\nexport { type Slugify } from '../fields/baseFields/slug/index.js'\n\nexport { defaultTimezones } from '../fields/baseFields/timezone/defaultTimezones.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsHiddenOrDisabled,\n fieldIsID,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldShouldBeLocalized,\n fieldSupportsMany,\n groupHasName,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\n\nexport * from '../fields/validations.js'\n\nexport type {\n FolderBreadcrumb,\n FolderDocumentItemKey,\n FolderEnabledColection,\n FolderInterface,\n FolderOrDocument,\n GetFolderDataResult,\n Subfolder,\n} from '../folders/types.js'\nexport { buildFolderWhereConstraints } from '../folders/utils/buildFolderWhereConstraints.js'\nexport { formatFolderOrDocumentItem } from '../folders/utils/formatFolderOrDocumentItem.js'\n\nexport { PREFERENCE_KEYS } from '../preferences/keys.js'\n\nexport { validOperators, validOperatorSet } from '../types/constants.js'\nexport { formatFilesize } from '../uploads/formatFilesize.js'\nexport {\n getSanitizedUploadFilename,\n isSvgUpload,\n isXmlUpload,\n uploadRequiresServerValidation,\n} from '../uploads/getFileTypeIdentity.js'\nexport { isImage } from '../uploads/isImage.js'\nexport { appendUploadSelectFields } from '../utilities/appendUploadSelectFields.js'\n\nexport { applyLocaleFiltering } from '../utilities/applyLocaleFiltering.js'\n\nexport { combineWhereConstraints } from '../utilities/combineWhereConstraints.js'\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\n\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\n\nexport { extractID } from '../utilities/extractID.js'\n\nexport {\n expandOwnDottedKey,\n hasUnsupportedFieldPathSegment,\n setOwnProperty,\n} from '../utilities/fieldPath.js'\nexport { flattenAllFields } from '../utilities/flattenAllFields.js'\nexport { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'\nexport { formatAdminURL, stripTrailingSlash } from '../utilities/formatAdminURL.js'\nexport { formatLabels, toWords } from '../utilities/formatLabels.js'\nexport { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js'\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getFieldPermissions } from '../utilities/getFieldPermissions.js'\n\nexport { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'\n\nexport { getSafeRedirect } from '../utilities/getSafeRedirect.js'\n\nexport { getSelectMode } from '../utilities/getSelectMode.js'\n\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport {\n getAutosaveInterval,\n getVersionsMax,\n hasAutosaveEnabled,\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasLocalizeStatusEnabled,\n hasScheduledPublishEnabled,\n} from '../utilities/getVersionsConfig.js'\n\nexport { isNextBuild } from '../utilities/isNextBuild.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport {\n hoistQueryParamsToAnd,\n mergeListSearchAndWhere,\n} from '../utilities/mergeListSearchAndWhere.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { sanitizeFilename } from '../utilities/sanitizeFilename.js'\n\nexport { sanitizeUrl } from '../utilities/sanitizeUrl.js'\n\nexport { sanitizeUserDataForEmail } from '../utilities/sanitizeUserDataForEmail.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { slugify } from '../utilities/slugify.js'\n\nexport { toKebabCase } from '../utilities/toKebabCase.js'\n\nexport {\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from '../utilities/transformColumnPreferences.js'\n\nexport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\nexport { unflatten } from '../utilities/unflatten.js'\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nexport { wait } from '../utilities/wait.js'\nexport { wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","addSessionToUser","removeExpiredSessions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","BASE_36_DIGITS","generateKeyBetween","generateNKeysBetween","serverProps","isNestedRelationshipQuery","defaultTimezones","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsHiddenOrDisabled","fieldIsID","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldShouldBeLocalized","fieldSupportsMany","groupHasName","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","buildFolderWhereConstraints","formatFolderOrDocumentItem","PREFERENCE_KEYS","validOperators","validOperatorSet","formatFilesize","getSanitizedUploadFilename","isSvgUpload","isXmlUpload","uploadRequiresServerValidation","isImage","appendUploadSelectFields","applyLocaleFiltering","combineWhereConstraints","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","extractID","expandOwnDottedKey","hasUnsupportedFieldPathSegment","setOwnProperty","flattenAllFields","flattenTopLevelFields","formatAdminURL","stripTrailingSlash","formatLabels","toWords","getBestFitFromSizes","getDataByPath","getFieldPermissions","getObjectDotNotation","getSafeRedirect","getSelectMode","getSiblingData","getUniqueListBy","getAutosaveInterval","getVersionsMax","hasAutosaveEnabled","hasDraftsEnabled","hasDraftValidationEnabled","hasLocalizeStatusEnabled","hasScheduledPublishEnabled","isNextBuild","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","hoistQueryParamsToAnd","mergeListSearchAndWhere","reduceFieldsToValues","sanitizeFilename","sanitizeUrl","sanitizeUserDataForEmail","setsAreEqual","slugify","toKebabCase","transformColumnsToPreferences","transformColumnsToSearchParams","transformWhereQuery","unflatten","validateMimeType","validateWhereQuery","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAE3B,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,gBAAgB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC7E,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,qBAAqB,QAAQ,8DAA6D;AACnG,SAASC,YAAYC,kBAAkB,QAAQ,oCAAmC;AAClF,SACEC,cAAc,EACdC,kBAAkB,EAClBC,oBAAoB,QACf,6CAA4C;AAEnD,SAASC,WAAW,QAAQ,qBAAoB;AAEhD,SAASC,yBAAyB,QAAQ,2CAA0C;AAIpF,SAASC,gBAAgB,QAAQ,oDAAmD;AAEpF,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,uBAAuB,EACvBC,SAAS,EACTC,gBAAgB,EAChBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc,EACdC,sBAAsB,EACtBC,iBAAiB,EACjBC,YAAY,EACZC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,4BAA2B;AAClC,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,cAAc,2BAA0B;AAWxC,SAASC,2BAA2B,QAAQ,kDAAiD;AAC7F,SAASC,0BAA0B,QAAQ,iDAAgD;AAE3F,SAASC,eAAe,QAAQ,yBAAwB;AAExD,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,wBAAuB;AACxE,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SACEC,0BAA0B,EAC1BC,WAAW,EACXC,WAAW,EACXC,8BAA8B,QACzB,oCAAmC;AAC1C,SAASC,OAAO,QAAQ,wBAAuB;AAC/C,SAASC,wBAAwB,QAAQ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AASC,WAAW,QAAQ,8BAA6B;AAEzD,SAASC,wBAAwB,QAAQ,2CAA0C;AAEnF,SAASC,YAAY,QAAQ,+BAA8B;AAE3D,SAASC,OAAO,QAAQ,0BAAyB;AAEjD,SAASC,WAAW,QAAQ,8BAA6B;AAEzD,SACEC,6BAA6B,EAC7BC,8BAA8B,QACzB,6CAA4C;AAEnD,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,SAAS,QAAQ,4BAA2B;AACrD,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,SAASC,eAAe,QAAQ,qCAAoC"}
@@ -19,7 +19,7 @@ import { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adap
19
19
  import { PinoPretty } from 'pino-pretty';
20
20
  import { DatePickerProps } from 'react-datepicker';
21
21
 
22
- declare const clientTranslationKeys: ("authentication:account" | "authentication:accountOfCurrentUser" | "authentication:accountVerified" | "authentication:alreadyActivated" | "authentication:alreadyLoggedIn" | "authentication:apiKey" | "authentication:authenticated" | "authentication:backToLogin" | "authentication:beginCreateFirstUser" | "authentication:changePassword" | "authentication:checkYourEmailForPasswordReset" | "authentication:confirmGeneration" | "authentication:confirmPassword" | "authentication:createFirstUser" | "authentication:emailNotValid" | "authentication:emailOrUsername" | "authentication:emailSent" | "authentication:emailVerified" | "authentication:enableAPIKey" | "authentication:failedToUnlock" | "authentication:forceUnlock" | "authentication:forgotPassword" | "authentication:forgotPasswordEmailInstructions" | "authentication:forgotPasswordUsernameInstructions" | "authentication:usernameNotValid" | "authentication:forgotPasswordQuestion" | "authentication:generate" | "authentication:generateNewAPIKey" | "authentication:generatingNewAPIKeyWillInvalidate" | "authentication:logBackIn" | "authentication:loggedIn" | "authentication:loggedInChangePassword" | "authentication:loggedOutInactivity" | "authentication:loggedOutSuccessfully" | "authentication:loggingOut" | "authentication:login" | "authentication:logOut" | "authentication:logout" | "authentication:logoutSuccessful" | "authentication:logoutUser" | "authentication:newAPIKeyGenerated" | "authentication:newPassword" | "authentication:passed" | "authentication:passwordResetSuccessfully" | "authentication:resend" | "authentication:resetPassword" | "authentication:stayLoggedIn" | "authentication:successfullyRegisteredFirstUser" | "authentication:successfullyUnlocked" | "authentication:tokenRefreshSuccessful" | "authentication:unableToVerify" | "authentication:username" | "authentication:verified" | "authentication:verifiedSuccessfully" | "authentication:verify" | "authentication:verifyUser" | "authentication:youAreInactive" | "dashboard:addButton" | "dashboard:addWidget" | "dashboard:deleteWidget" | "dashboard:discardConfirmLabel" | "dashboard:discardMessage" | "dashboard:discardTitle" | "dashboard:editDashboard" | "dashboard:editingDashboard" | "dashboard:noItems" | "dashboard:resetLayout" | "dashboard:searchWidgets" | "error:autosaving" | "error:correctInvalidFields" | "error:deletingTitle" | "error:documentNotFound" | "error:emailOrPasswordIncorrect" | "error:failedToResetLayout" | "error:failedToSaveLayout" | "error:insufficientClipboardPermissions" | "error:invalidClipboardData" | "error:invalidFileType" | "error:invalidRequestArgs" | "error:loadingDocument" | "error:logoutFailed" | "error:noMatchedField" | "error:notAllowedToAccessPage" | "error:notAllowedToPerformAction" | "error:previewing" | "error:problemUploadingFile" | "error:restoringTitle" | "error:revertingDocument" | "error:tokenNotProvided" | "error:unableToCopy" | "error:unableToDeleteCount" | "error:unableToReindexCollection" | "error:unableToUpdateCount" | "error:unauthorized" | "error:unauthorizedAdmin" | "error:unknown" | "error:unPublishingDocument" | "error:unspecific" | "error:unverifiedEmail" | "error:userEmailAlreadyRegistered" | "error:usernameAlreadyRegistered" | "error:usernameOrPasswordIncorrect" | "fields:blocks" | "fields:addLabel" | "fields:addLink" | "fields:addNew" | "fields:addNewLabel" | "fields:addRelationship" | "fields:addUpload" | "fields:block" | "fields:blockType" | "fields:chooseBetweenCustomTextOrDocument" | "fields:chooseDocumentToLink" | "fields:chooseFromExisting" | "fields:collapseAll" | "fields:customURL" | "fields:editLink" | "fields:editRelationship" | "fields:enterURL" | "fields:internalLink" | "fields:itemsAndMore" | "fields:labelRelationship" | "fields:latitude" | "fields:linkedTo" | "fields:linkType" | "fields:longitude" | "fields:openInNewTab" | "fields:passwordsDoNotMatch" | "fields:removeRelationship" | "fields:removeUpload" | "fields:saveChanges" | "fields:searchForBlock" | "fields:searchForLanguage" | "fields:selectFieldsToEdit" | "fields:showAll" | "fields:swapRelationship" | "fields:swapUpload" | "fields:textToDisplay" | "fields:toggleBlock" | "fields:uploadNewLabel" | "folder:browseByFolder" | "folder:byFolder" | "folder:deleteFolder" | "folder:folderName" | "folder:folders" | "folder:folderTypeDescription" | "folder:itemHasBeenMoved" | "folder:itemHasBeenMovedToRoot" | "folder:itemsMovedToFolder" | "folder:itemsMovedToRoot" | "folder:moveFolder" | "folder:moveItemsToFolderConfirmation" | "folder:moveItemsToRootConfirmation" | "folder:moveItemToFolderConfirmation" | "folder:moveItemToRootConfirmation" | "folder:movingFromFolder" | "folder:newFolder" | "folder:noFolder" | "folder:renameFolder" | "folder:searchByNameInFolder" | "folder:selectFolderForItem" | "general:items" | "general:of" | "general:dashboard" | "general:error" | "general:username" | "general:notFound" | "general:unauthorized" | "general:newLabel" | "general:saveChanges" | "general:name" | "general:aboutToDelete" | "general:aboutToPermanentlyDelete" | "general:aboutToPermanentlyDeleteTrash" | "general:aboutToRestore" | "general:aboutToRestoreAsDraft" | "general:aboutToRestoreAsDraftCount" | "general:aboutToRestoreCount" | "general:aboutToTrash" | "general:aboutToTrashCount" | "general:addBelow" | "general:addFilter" | "general:adminTheme" | "general:all" | "general:allCollections" | "general:allLocales" | "general:and" | "general:anotherUser" | "general:anotherUserTakenOver" | "general:applyChanges" | "general:ascending" | "general:automatic" | "general:backToDashboard" | "general:cancel" | "general:changesNotSaved" | "general:clear" | "general:clearAll" | "general:close" | "general:collapse" | "general:collections" | "general:columns" | "general:columnToSort" | "general:confirm" | "general:confirmCopy" | "general:confirmDeletion" | "general:confirmDuplication" | "general:confirmMove" | "general:confirmReindex" | "general:confirmReindexAll" | "general:confirmReindexDescription" | "general:confirmReindexDescriptionAll" | "general:confirmRestoration" | "general:copied" | "general:copy" | "general:copyField" | "general:copying" | "general:copyRow" | "general:copyWarning" | "general:create" | "general:created" | "general:createdAt" | "general:createNew" | "general:createNewLabel" | "general:creating" | "general:creatingNewLabel" | "general:currentlyEditing" | "general:custom" | "general:dark" | "general:delete" | "general:deleted" | "general:deletedAt" | "general:deletedCountSuccessfully" | "general:deletedSuccessfully" | "general:deleteLabel" | "general:deletePermanently" | "general:deleting" | "general:depth" | "general:descending" | "general:deselectAllRows" | "general:document" | "general:documentIsTrashed" | "general:documentLocked" | "general:documentModified" | "general:documentOutOfDate" | "general:documents" | "general:duplicate" | "general:duplicateWithoutSaving" | "general:edit" | "general:editAll" | "general:editedSince" | "general:editing" | "general:editingTakenOver" | "general:editLabel" | "general:email" | "general:emailAddress" | "general:emptyTrash" | "general:emptyTrashLabel" | "general:enterAValue" | "general:errors" | "general:exitLivePreview" | "general:export" | "general:fallbackToDefaultLocale" | "general:false" | "general:filters" | "general:filterWhere" | "general:globals" | "general:goBack" | "general:groupByLabel" | "general:import" | "general:isEditing" | "general:item" | "general:language" | "general:lastModified" | "general:layout" | "general:leaveAnyway" | "general:leaveWithoutSaving" | "general:light" | "general:livePreview" | "general:loading" | "general:locale" | "general:locales" | "general:lock" | "general:menu" | "general:moreOptions" | "general:move" | "general:moveConfirm" | "general:moveCount" | "general:moveDown" | "general:moveUp" | "general:moving" | "general:movingCount" | "general:next" | "general:no" | "general:noDateSelected" | "general:noFiltersSet" | "general:noLabel" | "general:none" | "general:noOptions" | "general:noResults" | "general:noResultsDescription" | "general:noResultsFound" | "general:nothingFound" | "general:noTrashResults" | "general:noUpcomingEventsScheduled" | "general:noValue" | "general:only" | "general:open" | "general:openInNewWindow" | "general:or" | "general:order" | "general:overwriteExistingData" | "general:pageNotFound" | "general:password" | "general:pasteField" | "general:pasteRow" | "general:payloadSettings" | "general:permanentlyDelete" | "general:permanentlyDeletedCountSuccessfully" | "general:perPage" | "general:previous" | "general:reindex" | "general:reindexingAll" | "general:reloadDocument" | "general:remove" | "general:rename" | "general:reset" | "general:resetPreferences" | "general:resetPreferencesDescription" | "general:resettingPreferences" | "general:restore" | "general:restoreAsPublished" | "general:restoredCountSuccessfully" | "general:restoring" | "general:row" | "general:rows" | "general:save" | "general:saving" | "general:schedulePublishFor" | "general:searchBy" | "general:select" | "general:selectAll" | "general:selectAllRows" | "general:selectedCount" | "general:selectLabel" | "general:selectValue" | "general:showAllLabel" | "general:sorryNotFound" | "general:sort" | "general:sortByLabelDirection" | "general:stayOnThisPage" | "general:submissionSuccessful" | "general:submit" | "general:submitting" | "general:success" | "general:successfullyCreated" | "general:successfullyDuplicated" | "general:successfullyReindexed" | "general:takeOver" | "general:thisLanguage" | "general:time" | "general:timezone" | "general:titleDeleted" | "general:titleRestored" | "general:titleTrashed" | "general:trash" | "general:trashedCountSuccessfully" | "general:true" | "general:unlock" | "general:unsavedChanges" | "general:unsavedChangesDuplicate" | "general:untitled" | "general:upcomingEvents" | "general:updatedAt" | "general:updatedCountSuccessfully" | "general:updatedLabelSuccessfully" | "general:updatedSuccessfully" | "general:updateForEveryone" | "general:updating" | "general:uploading" | "general:uploadingBulk" | "general:user" | "general:users" | "general:value" | "general:viewing" | "general:viewReadOnly" | "general:welcome" | "general:yes" | "general:aboutToDeleteCount" | "general:editingLabel" | "localization:cannotCopySameLocale" | "localization:copyFrom" | "localization:copyFromTo" | "localization:copyTo" | "localization:copyToLocale" | "localization:localeToPublish" | "localization:selectedLocales" | "localization:selectLocaleToCopy" | "localization:selectLocaleToDuplicate" | "operators:contains" | "operators:equals" | "operators:exists" | "operators:intersects" | "operators:near" | "operators:within" | "operators:isGreaterThan" | "operators:isGreaterThanOrEqualTo" | "operators:isIn" | "operators:isLessThan" | "operators:isLessThanOrEqualTo" | "operators:isLike" | "operators:isNotEqualTo" | "operators:isNotIn" | "operators:isNotLike" | "upload:addFile" | "upload:addFiles" | "upload:bulkUpload" | "upload:crop" | "upload:cropToolDescription" | "upload:download" | "upload:dragAndDrop" | "upload:editImage" | "upload:fileName" | "upload:fileSize" | "upload:filesToUpload" | "upload:fileToUpload" | "upload:focalPoint" | "upload:focalPointDescription" | "upload:height" | "upload:noFile" | "upload:pasteURL" | "upload:previewSizes" | "upload:selectCollectionToBrowse" | "upload:selectFile" | "upload:setCropArea" | "upload:setFocalPoint" | "upload:sizes" | "upload:sizesFor" | "upload:width" | "validation:username" | "validation:emailAddress" | "validation:enterNumber" | "validation:fieldHasNo" | "validation:greaterThanMax" | "validation:invalidBlock" | "validation:invalidBlocks" | "validation:invalidInput" | "validation:invalidSelection" | "validation:invalidSelections" | "validation:latitudeOutOfBounds" | "validation:lessThanMin" | "validation:limitReached" | "validation:longerThanMin" | "validation:longitudeOutOfBounds" | "validation:notValidDate" | "validation:required" | "validation:requiresAtLeast" | "validation:requiresNoMoreThan" | "validation:requiresTwoNumbers" | "validation:shorterThanMax" | "validation:timezoneRequired" | "validation:trueOrFalse" | "validation:validUploadID" | "version:version" | "version:aboutToRestore" | "version:restoring" | "version:type" | "version:aboutToPublishSelection" | "version:aboutToRestoreGlobal" | "version:aboutToRevertToPublished" | "version:aboutToUnpublish" | "version:aboutToUnpublishIn" | "version:aboutToUnpublishSelection" | "version:autosave" | "version:autosavedSuccessfully" | "version:autosavedVersion" | "version:changed" | "version:compareVersions" | "version:comparingAgainst" | "version:confirmPublish" | "version:confirmRevertToSaved" | "version:confirmUnpublish" | "version:confirmVersionRestoration" | "version:currentDraft" | "version:currentlyPublished" | "version:currentlyViewing" | "version:currentPublishedVersion" | "version:draft" | "version:draftHasPublishedVersion" | "version:draftSavedSuccessfully" | "version:lastSavedAgo" | "version:modifiedOnly" | "version:moreVersions" | "version:noFurtherVersionsFound" | "version:noLabelGroup" | "version:noRowsFound" | "version:noRowsSelected" | "version:preview" | "version:previouslyDraft" | "version:previouslyPublished" | "version:previousVersion" | "version:problemRestoringVersion" | "version:publish" | "version:publishAllLocales" | "version:publishChanges" | "version:published" | "version:publishIn" | "version:publishing" | "version:restoreAsDraft" | "version:restoredSuccessfully" | "version:restoreThisVersion" | "version:reverting" | "version:revertToPublished" | "version:revertUnsuccessful" | "version:saveDraft" | "version:scheduledSuccessfully" | "version:schedulePublish" | "version:selectLocales" | "version:selectVersionToCompare" | "version:showLocales" | "version:specificVersion" | "version:status" | "version:unpublish" | "version:unpublished" | "version:unpublishedSuccessfully" | "version:unpublishIn" | "version:unpublishing" | "version:versionAgo" | "version:versionID" | "version:versions" | "version:viewingVersion" | "version:viewingVersionGlobal" | "version:viewingVersions" | "version:viewingVersionsGlobal" | "version:changedFieldsCount")[];
22
+ declare const clientTranslationKeys: ("authentication:account" | "authentication:accountOfCurrentUser" | "authentication:accountVerified" | "authentication:alreadyActivated" | "authentication:alreadyLoggedIn" | "authentication:apiKey" | "authentication:authenticated" | "authentication:backToLogin" | "authentication:beginCreateFirstUser" | "authentication:changePassword" | "authentication:checkYourEmailForPasswordReset" | "authentication:confirmGeneration" | "authentication:confirmPassword" | "authentication:createFirstUser" | "authentication:emailNotValid" | "authentication:emailOrUsername" | "authentication:emailSent" | "authentication:emailVerified" | "authentication:enableAPIKey" | "authentication:failedToUnlock" | "authentication:forceUnlock" | "authentication:forgotPassword" | "authentication:forgotPasswordEmailInstructions" | "authentication:forgotPasswordUsernameInstructions" | "authentication:usernameNotValid" | "authentication:forgotPasswordQuestion" | "authentication:generate" | "authentication:generateNewAPIKey" | "authentication:generatingNewAPIKeyWillInvalidate" | "authentication:logBackIn" | "authentication:loggedIn" | "authentication:loggedInChangePassword" | "authentication:loggedOutInactivity" | "authentication:loggedOutSuccessfully" | "authentication:loggingOut" | "authentication:login" | "authentication:logOut" | "authentication:logout" | "authentication:logoutSuccessful" | "authentication:logoutUser" | "authentication:newAPIKeyGenerated" | "authentication:newPassword" | "authentication:passed" | "authentication:passwordResetSuccessfully" | "authentication:resend" | "authentication:resetPassword" | "authentication:stayLoggedIn" | "authentication:successfullyRegisteredFirstUser" | "authentication:successfullyUnlocked" | "authentication:tokenRefreshSuccessful" | "authentication:unableToVerify" | "authentication:username" | "authentication:verified" | "authentication:verifiedSuccessfully" | "authentication:verify" | "authentication:verifyUser" | "authentication:youAreInactive" | "dashboard:addButton" | "dashboard:addWidget" | "dashboard:deleteWidget" | "dashboard:discardConfirmLabel" | "dashboard:discardMessage" | "dashboard:discardTitle" | "dashboard:editDashboard" | "dashboard:editingDashboard" | "dashboard:noItems" | "dashboard:resetLayout" | "dashboard:searchWidgets" | "error:autosaving" | "error:correctInvalidFields" | "error:deletingTitle" | "error:documentNotFound" | "error:emailOrPasswordIncorrect" | "error:failedToResetLayout" | "error:failedToSaveLayout" | "error:insufficientClipboardPermissions" | "error:invalidClipboardData" | "error:invalidFileType" | "error:invalidRequestArgs" | "error:loadingDocument" | "error:logoutFailed" | "error:noMatchedField" | "error:notAllowedToAccessPage" | "error:notAllowedToPerformAction" | "error:previewing" | "error:problemUploadingFile" | "error:restoringTitle" | "error:revertingDocument" | "error:tokenNotProvided" | "error:unableToCopy" | "error:unableToDeleteCount" | "error:unableToReindexCollection" | "error:unableToUpdateCount" | "error:unauthorized" | "error:unauthorizedAdmin" | "error:unknown" | "error:unPublishingDocument" | "error:unspecific" | "error:unverifiedEmail" | "error:userEmailAlreadyRegistered" | "error:usernameAlreadyRegistered" | "error:usernameOrPasswordIncorrect" | "fields:blocks" | "fields:addLabel" | "fields:addLink" | "fields:addNew" | "fields:addNewLabel" | "fields:addRelationship" | "fields:addUpload" | "fields:block" | "fields:blockType" | "fields:chooseBetweenCustomTextOrDocument" | "fields:chooseDocumentToLink" | "fields:chooseFromExisting" | "fields:collapseAll" | "fields:customURL" | "fields:editLink" | "fields:editRelationship" | "fields:enterURL" | "fields:internalLink" | "fields:itemsAndMore" | "fields:labelRelationship" | "fields:latitude" | "fields:linkedTo" | "fields:linkType" | "fields:longitude" | "fields:openInNewTab" | "fields:passwordsDoNotMatch" | "fields:removeRelationship" | "fields:removeUpload" | "fields:saveChanges" | "fields:searchForBlock" | "fields:searchForLanguage" | "fields:selectFieldsToEdit" | "fields:showAll" | "fields:swapRelationship" | "fields:swapUpload" | "fields:textToDisplay" | "fields:toggleBlock" | "fields:uploadNewLabel" | "folder:browseByFolder" | "folder:byFolder" | "folder:deleteFolder" | "folder:folderName" | "folder:folders" | "folder:folderTypeDescription" | "folder:itemHasBeenMoved" | "folder:itemHasBeenMovedToRoot" | "folder:itemsMovedToFolder" | "folder:itemsMovedToRoot" | "folder:moveFolder" | "folder:moveItemsToFolderConfirmation" | "folder:moveItemsToRootConfirmation" | "folder:moveItemToFolderConfirmation" | "folder:moveItemToRootConfirmation" | "folder:movingFromFolder" | "folder:newFolder" | "folder:noFolder" | "folder:renameFolder" | "folder:searchByNameInFolder" | "folder:selectFolderForItem" | "general:items" | "general:of" | "general:language" | "general:dashboard" | "general:error" | "general:username" | "general:notFound" | "general:unauthorized" | "general:newLabel" | "general:saveChanges" | "general:name" | "general:aboutToDelete" | "general:aboutToPermanentlyDelete" | "general:aboutToPermanentlyDeleteTrash" | "general:aboutToRestore" | "general:aboutToRestoreAsDraft" | "general:aboutToRestoreAsDraftCount" | "general:aboutToRestoreCount" | "general:aboutToTrash" | "general:aboutToTrashCount" | "general:addBelow" | "general:addFilter" | "general:adminTheme" | "general:all" | "general:allCollections" | "general:allLocales" | "general:and" | "general:anotherUser" | "general:anotherUserTakenOver" | "general:applyChanges" | "general:ascending" | "general:automatic" | "general:backToDashboard" | "general:cancel" | "general:changesNotSaved" | "general:clear" | "general:clearAll" | "general:close" | "general:collapse" | "general:collections" | "general:columns" | "general:columnToSort" | "general:confirm" | "general:confirmCopy" | "general:confirmDeletion" | "general:confirmDuplication" | "general:confirmMove" | "general:confirmReindex" | "general:confirmReindexAll" | "general:confirmReindexDescription" | "general:confirmReindexDescriptionAll" | "general:confirmRestoration" | "general:copied" | "general:copy" | "general:copyField" | "general:copying" | "general:copyRow" | "general:copyWarning" | "general:create" | "general:created" | "general:createdAt" | "general:createNew" | "general:createNewLabel" | "general:creating" | "general:creatingNewLabel" | "general:currentlyEditing" | "general:custom" | "general:dark" | "general:delete" | "general:deleted" | "general:deletedAt" | "general:deletedCountSuccessfully" | "general:deletedSuccessfully" | "general:deleteLabel" | "general:deletePermanently" | "general:deleting" | "general:depth" | "general:descending" | "general:deselectAllRows" | "general:document" | "general:documentIsTrashed" | "general:documentLocked" | "general:documentModified" | "general:documentOutOfDate" | "general:documents" | "general:duplicate" | "general:duplicateWithoutSaving" | "general:edit" | "general:editAll" | "general:editedSince" | "general:editing" | "general:editingTakenOver" | "general:editLabel" | "general:email" | "general:emailAddress" | "general:emptyTrash" | "general:emptyTrashLabel" | "general:enterAValue" | "general:errors" | "general:exitLivePreview" | "general:export" | "general:fallbackToDefaultLocale" | "general:false" | "general:filters" | "general:filterWhere" | "general:globals" | "general:goBack" | "general:groupByLabel" | "general:import" | "general:isEditing" | "general:item" | "general:lastModified" | "general:layout" | "general:leaveAnyway" | "general:leaveWithoutSaving" | "general:light" | "general:livePreview" | "general:loading" | "general:locale" | "general:locales" | "general:lock" | "general:menu" | "general:moreOptions" | "general:move" | "general:moveConfirm" | "general:moveCount" | "general:moveDown" | "general:moveUp" | "general:moving" | "general:movingCount" | "general:next" | "general:no" | "general:noDateSelected" | "general:noFiltersSet" | "general:noLabel" | "general:none" | "general:noOptions" | "general:noResults" | "general:noResultsDescription" | "general:noResultsFound" | "general:nothingFound" | "general:noTrashResults" | "general:noUpcomingEventsScheduled" | "general:noValue" | "general:only" | "general:open" | "general:openInNewWindow" | "general:or" | "general:order" | "general:overwriteExistingData" | "general:pageNotFound" | "general:password" | "general:pasteField" | "general:pasteRow" | "general:payloadSettings" | "general:permanentlyDelete" | "general:permanentlyDeletedCountSuccessfully" | "general:perPage" | "general:previous" | "general:reindex" | "general:reindexingAll" | "general:reloadDocument" | "general:remove" | "general:rename" | "general:reset" | "general:resetPreferences" | "general:resetPreferencesDescription" | "general:resettingPreferences" | "general:restore" | "general:restoreAsPublished" | "general:restoredCountSuccessfully" | "general:restoring" | "general:row" | "general:rows" | "general:save" | "general:saving" | "general:schedulePublishFor" | "general:searchBy" | "general:select" | "general:selectAll" | "general:selectAllRows" | "general:selectedCount" | "general:selectLabel" | "general:selectValue" | "general:showAllLabel" | "general:sorryNotFound" | "general:sort" | "general:sortByLabelDirection" | "general:stayOnThisPage" | "general:submissionSuccessful" | "general:submit" | "general:submitting" | "general:success" | "general:successfullyCreated" | "general:successfullyDuplicated" | "general:successfullyReindexed" | "general:takeOver" | "general:thisLanguage" | "general:time" | "general:timezone" | "general:titleDeleted" | "general:titleRestored" | "general:titleTrashed" | "general:trash" | "general:trashedCountSuccessfully" | "general:true" | "general:unlock" | "general:unsavedChanges" | "general:unsavedChangesDuplicate" | "general:untitled" | "general:upcomingEvents" | "general:updatedAt" | "general:updatedCountSuccessfully" | "general:updatedLabelSuccessfully" | "general:updatedSuccessfully" | "general:updateForEveryone" | "general:updating" | "general:uploading" | "general:uploadingBulk" | "general:user" | "general:users" | "general:value" | "general:viewing" | "general:viewReadOnly" | "general:welcome" | "general:yes" | "localization:cannotCopySameLocale" | "localization:copyFrom" | "localization:copyFromTo" | "localization:copyTo" | "localization:copyToLocale" | "localization:localeToPublish" | "localization:selectedLocales" | "localization:selectLocaleToCopy" | "localization:selectLocaleToDuplicate" | "operators:contains" | "operators:equals" | "operators:exists" | "operators:intersects" | "operators:near" | "operators:within" | "operators:isGreaterThan" | "operators:isGreaterThanOrEqualTo" | "operators:isIn" | "operators:isLessThan" | "operators:isLessThanOrEqualTo" | "operators:isLike" | "operators:isNotEqualTo" | "operators:isNotIn" | "operators:isNotLike" | "upload:addFile" | "upload:addFiles" | "upload:bulkUpload" | "upload:crop" | "upload:cropToolDescription" | "upload:download" | "upload:dragAndDrop" | "upload:editImage" | "upload:fileName" | "upload:fileSize" | "upload:filesToUpload" | "upload:fileToUpload" | "upload:focalPoint" | "upload:focalPointDescription" | "upload:height" | "upload:noFile" | "upload:pasteURL" | "upload:previewSizes" | "upload:selectCollectionToBrowse" | "upload:selectFile" | "upload:setCropArea" | "upload:setFocalPoint" | "upload:sizes" | "upload:sizesFor" | "upload:width" | "validation:username" | "validation:emailAddress" | "validation:enterNumber" | "validation:fieldHasNo" | "validation:greaterThanMax" | "validation:invalidBlock" | "validation:invalidBlocks" | "validation:invalidInput" | "validation:invalidSelection" | "validation:invalidSelections" | "validation:latitudeOutOfBounds" | "validation:lessThanMin" | "validation:limitReached" | "validation:longerThanMin" | "validation:longitudeOutOfBounds" | "validation:notValidDate" | "validation:required" | "validation:requiresAtLeast" | "validation:requiresNoMoreThan" | "validation:requiresTwoNumbers" | "validation:shorterThanMax" | "validation:timezoneRequired" | "validation:trueOrFalse" | "validation:validUploadID" | "version:version" | "version:aboutToRestore" | "version:restoring" | "version:type" | "version:aboutToPublishSelection" | "version:aboutToRestoreGlobal" | "version:aboutToRevertToPublished" | "version:aboutToUnpublish" | "version:aboutToUnpublishIn" | "version:aboutToUnpublishSelection" | "version:autosave" | "version:autosavedSuccessfully" | "version:autosavedVersion" | "version:changed" | "version:compareVersions" | "version:comparingAgainst" | "version:confirmPublish" | "version:confirmRevertToSaved" | "version:confirmUnpublish" | "version:confirmVersionRestoration" | "version:currentDraft" | "version:currentlyPublished" | "version:currentlyViewing" | "version:currentPublishedVersion" | "version:draft" | "version:draftHasPublishedVersion" | "version:draftSavedSuccessfully" | "version:lastSavedAgo" | "version:modifiedOnly" | "version:moreVersions" | "version:noFurtherVersionsFound" | "version:noLabelGroup" | "version:noRowsFound" | "version:noRowsSelected" | "version:preview" | "version:previouslyDraft" | "version:previouslyPublished" | "version:previousVersion" | "version:problemRestoringVersion" | "version:publish" | "version:publishAllLocales" | "version:publishChanges" | "version:published" | "version:publishIn" | "version:publishing" | "version:restoreAsDraft" | "version:restoredSuccessfully" | "version:restoreThisVersion" | "version:reverting" | "version:revertToPublished" | "version:revertUnsuccessful" | "version:saveDraft" | "version:scheduledSuccessfully" | "version:schedulePublish" | "version:selectLocales" | "version:selectVersionToCompare" | "version:showLocales" | "version:specificVersion" | "version:status" | "version:unpublish" | "version:unpublished" | "version:unpublishedSuccessfully" | "version:unpublishIn" | "version:unpublishing" | "version:versionAgo" | "version:versionID" | "version:versions" | "version:viewingVersion" | "version:viewingVersionGlobal" | "version:viewingVersions" | "version:viewingVersionsGlobal" | "general:aboutToDeleteCount" | "general:editingLabel" | "version:changedFieldsCount")[];
23
23
 
24
24
  declare const enTranslations: {
25
25
  authentication: {
@@ -29,5 +29,6 @@ type FormatURLArgs = ({
29
29
  apiRoute: NonNullable<Config['routes']>['api'];
30
30
  } & BaseFormatURLArgs);
31
31
  export declare const formatAdminURL: (args: FormatURLArgs) => string;
32
+ export declare const stripTrailingSlash: (path: string) => string;
32
33
  export {};
33
34
  //# sourceMappingURL=formatAdminURL.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatAdminURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAdminURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAE7B,KAAK,aAAa,GACd,CAAC;IACC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,GAAG,iBAAiB,CAAC,GACtB,CAAC;IACC,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAC/C,GAAG,iBAAiB,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,SAAU,aAAa,KAAG,MAyBpD,CAAA"}
1
+ {"version":3,"file":"formatAdminURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAdminURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAE7B,KAAK,aAAa,GACd,CAAC;IACC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,GAAG,iBAAiB,CAAC,GACtB,CAAC;IACC,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAC/C,GAAG,iBAAiB,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,SAAU,aAAa,KAAG,MAyBpD,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAMjD,CAAA"}
@@ -7,16 +7,34 @@ export const formatAdminURL = (args)=>{
7
7
  path && path
8
8
  ].filter(Boolean);
9
9
  const pathname = segments.join('') || '/';
10
- const pathnameWithBase = (basePath + pathname).replace(/\/$/, '') || '/';
10
+ const pathnameWithBase = stripTrailingSlash(basePath + pathname) || '/';
11
11
  const includeBasePath = includeBasePathArg ?? (adminRoute ? false : true);
12
12
  if (relative || !serverURL) {
13
13
  if (includeBasePath && basePath) {
14
- return pathnameWithBase;
14
+ return applyTrailingSlash(pathnameWithBase);
15
15
  }
16
- return pathname;
16
+ return applyTrailingSlash(pathname);
17
17
  }
18
18
  const serverURLObj = new URL(serverURL);
19
- return new URL(pathnameWithBase, serverURLObj.origin).toString();
19
+ return applyTrailingSlash(new URL(pathnameWithBase, serverURLObj.origin).toString());
20
+ };
21
+ export const stripTrailingSlash = (path)=>{
22
+ if (path.length > 1 && path.endsWith('/')) {
23
+ return path.slice(0, -1);
24
+ }
25
+ return path;
26
+ };
27
+ const applyTrailingSlash = (url)=>{
28
+ if (process.env.NEXT_TRAILING_SLASH !== 'true') {
29
+ return url;
30
+ }
31
+ const queryIndex = url.search(/[?#]/);
32
+ const pathPart = queryIndex === -1 ? url : url.slice(0, queryIndex);
33
+ const queryPart = queryIndex === -1 ? '' : url.slice(queryIndex);
34
+ if (pathPart.endsWith('/')) {
35
+ return url;
36
+ }
37
+ return `${pathPart}/${queryPart}`;
20
38
  };
21
39
 
22
40
  //# sourceMappingURL=formatAdminURL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/formatAdminURL.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\n/**\n * This function builds correct URLs for admin panel routing.\n * Its primary responsibilities are:\n * 1. Read from your `routes.admin` config and appropriately handle `\"/\"` admin paths\n * 2. Prepend the `basePath` from your Next.js config, if specified\n * 3. Return relative or absolute URLs, as needed\n */\ntype BaseFormatURLArgs = {\n /**\n * The subpath of your application, if specified.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath\n * @example '/docs'\n */\n basePath?: string\n includeBasePath?: boolean\n path?: '' | `/${string}` | null\n /**\n * Return a relative URL, e.g. ignore `serverURL`.\n * Useful for route-matching, etc.\n */\n relative?: boolean\n} & Pick<Config, 'serverURL'>\n\ntype FormatURLArgs =\n | ({\n adminRoute: NonNullable<Config['routes']>['admin']\n apiRoute?: never\n } & BaseFormatURLArgs)\n | ({\n adminRoute?: never\n apiRoute: NonNullable<Config['routes']>['api']\n } & BaseFormatURLArgs)\n\nexport const formatAdminURL = (args: FormatURLArgs): string => {\n const {\n adminRoute,\n apiRoute,\n includeBasePath: includeBasePathArg,\n path = '',\n relative = false,\n serverURL,\n } = args\n const basePath = process.env.NEXT_BASE_PATH || args.basePath || ''\n const routePath = adminRoute || apiRoute\n const segments = [routePath && routePath !== '/' && routePath, path && path].filter(Boolean)\n const pathname = segments.join('') || '/'\n const pathnameWithBase = (basePath + pathname).replace(/\\/$/, '') || '/'\n const includeBasePath = includeBasePathArg ?? (adminRoute ? false : true)\n\n if (relative || !serverURL) {\n if (includeBasePath && basePath) {\n return pathnameWithBase\n }\n return pathname\n }\n\n const serverURLObj = new URL(serverURL)\n return new URL(pathnameWithBase, serverURLObj.origin).toString()\n}\n"],"names":["formatAdminURL","args","adminRoute","apiRoute","includeBasePath","includeBasePathArg","path","relative","serverURL","basePath","process","env","NEXT_BASE_PATH","routePath","segments","filter","Boolean","pathname","join","pathnameWithBase","replace","serverURLObj","URL","origin","toString"],"mappings":"AAmCA,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,MAAM,EACJC,UAAU,EACVC,QAAQ,EACRC,iBAAiBC,kBAAkB,EACnCC,OAAO,EAAE,EACTC,WAAW,KAAK,EAChBC,SAAS,EACV,GAAGP;IACJ,MAAMQ,WAAWC,QAAQC,GAAG,CAACC,cAAc,IAAIX,KAAKQ,QAAQ,IAAI;IAChE,MAAMI,YAAYX,cAAcC;IAChC,MAAMW,WAAW;QAACD,aAAaA,cAAc,OAAOA;QAAWP,QAAQA;KAAK,CAACS,MAAM,CAACC;IACpF,MAAMC,WAAWH,SAASI,IAAI,CAAC,OAAO;IACtC,MAAMC,mBAAmB,AAACV,CAAAA,WAAWQ,QAAO,EAAGG,OAAO,CAAC,OAAO,OAAO;IACrE,MAAMhB,kBAAkBC,sBAAuBH,CAAAA,aAAa,QAAQ,IAAG;IAEvE,IAAIK,YAAY,CAACC,WAAW;QAC1B,IAAIJ,mBAAmBK,UAAU;YAC/B,OAAOU;QACT;QACA,OAAOF;IACT;IAEA,MAAMI,eAAe,IAAIC,IAAId;IAC7B,OAAO,IAAIc,IAAIH,kBAAkBE,aAAaE,MAAM,EAAEC,QAAQ;AAChE,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/formatAdminURL.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\n/**\n * This function builds correct URLs for admin panel routing.\n * Its primary responsibilities are:\n * 1. Read from your `routes.admin` config and appropriately handle `\"/\"` admin paths\n * 2. Prepend the `basePath` from your Next.js config, if specified\n * 3. Return relative or absolute URLs, as needed\n */\ntype BaseFormatURLArgs = {\n /**\n * The subpath of your application, if specified.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath\n * @example '/docs'\n */\n basePath?: string\n includeBasePath?: boolean\n path?: '' | `/${string}` | null\n /**\n * Return a relative URL, e.g. ignore `serverURL`.\n * Useful for route-matching, etc.\n */\n relative?: boolean\n} & Pick<Config, 'serverURL'>\n\ntype FormatURLArgs =\n | ({\n adminRoute: NonNullable<Config['routes']>['admin']\n apiRoute?: never\n } & BaseFormatURLArgs)\n | ({\n adminRoute?: never\n apiRoute: NonNullable<Config['routes']>['api']\n } & BaseFormatURLArgs)\n\nexport const formatAdminURL = (args: FormatURLArgs): string => {\n const {\n adminRoute,\n apiRoute,\n includeBasePath: includeBasePathArg,\n path = '',\n relative = false,\n serverURL,\n } = args\n const basePath = process.env.NEXT_BASE_PATH || args.basePath || ''\n const routePath = adminRoute || apiRoute\n const segments = [routePath && routePath !== '/' && routePath, path && path].filter(Boolean)\n const pathname = segments.join('') || '/'\n const pathnameWithBase = stripTrailingSlash(basePath + pathname) || '/'\n const includeBasePath = includeBasePathArg ?? (adminRoute ? false : true)\n\n if (relative || !serverURL) {\n if (includeBasePath && basePath) {\n return applyTrailingSlash(pathnameWithBase)\n }\n return applyTrailingSlash(pathname)\n }\n\n const serverURLObj = new URL(serverURL)\n return applyTrailingSlash(new URL(pathnameWithBase, serverURLObj.origin).toString())\n}\n\nexport const stripTrailingSlash = (path: string): string => {\n if (path.length > 1 && path.endsWith('/')) {\n return path.slice(0, -1)\n }\n\n return path\n}\n\nconst applyTrailingSlash = (url: string): string => {\n if (process.env.NEXT_TRAILING_SLASH !== 'true') {\n return url\n }\n const queryIndex = url.search(/[?#]/)\n const pathPart = queryIndex === -1 ? url : url.slice(0, queryIndex)\n const queryPart = queryIndex === -1 ? '' : url.slice(queryIndex)\n if (pathPart.endsWith('/')) {\n return url\n }\n return `${pathPart}/${queryPart}`\n}\n"],"names":["formatAdminURL","args","adminRoute","apiRoute","includeBasePath","includeBasePathArg","path","relative","serverURL","basePath","process","env","NEXT_BASE_PATH","routePath","segments","filter","Boolean","pathname","join","pathnameWithBase","stripTrailingSlash","applyTrailingSlash","serverURLObj","URL","origin","toString","length","endsWith","slice","url","NEXT_TRAILING_SLASH","queryIndex","search","pathPart","queryPart"],"mappings":"AAmCA,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,MAAM,EACJC,UAAU,EACVC,QAAQ,EACRC,iBAAiBC,kBAAkB,EACnCC,OAAO,EAAE,EACTC,WAAW,KAAK,EAChBC,SAAS,EACV,GAAGP;IACJ,MAAMQ,WAAWC,QAAQC,GAAG,CAACC,cAAc,IAAIX,KAAKQ,QAAQ,IAAI;IAChE,MAAMI,YAAYX,cAAcC;IAChC,MAAMW,WAAW;QAACD,aAAaA,cAAc,OAAOA;QAAWP,QAAQA;KAAK,CAACS,MAAM,CAACC;IACpF,MAAMC,WAAWH,SAASI,IAAI,CAAC,OAAO;IACtC,MAAMC,mBAAmBC,mBAAmBX,WAAWQ,aAAa;IACpE,MAAMb,kBAAkBC,sBAAuBH,CAAAA,aAAa,QAAQ,IAAG;IAEvE,IAAIK,YAAY,CAACC,WAAW;QAC1B,IAAIJ,mBAAmBK,UAAU;YAC/B,OAAOY,mBAAmBF;QAC5B;QACA,OAAOE,mBAAmBJ;IAC5B;IAEA,MAAMK,eAAe,IAAIC,IAAIf;IAC7B,OAAOa,mBAAmB,IAAIE,IAAIJ,kBAAkBG,aAAaE,MAAM,EAAEC,QAAQ;AACnF,EAAC;AAED,OAAO,MAAML,qBAAqB,CAACd;IACjC,IAAIA,KAAKoB,MAAM,GAAG,KAAKpB,KAAKqB,QAAQ,CAAC,MAAM;QACzC,OAAOrB,KAAKsB,KAAK,CAAC,GAAG,CAAC;IACxB;IAEA,OAAOtB;AACT,EAAC;AAED,MAAMe,qBAAqB,CAACQ;IAC1B,IAAInB,QAAQC,GAAG,CAACmB,mBAAmB,KAAK,QAAQ;QAC9C,OAAOD;IACT;IACA,MAAME,aAAaF,IAAIG,MAAM,CAAC;IAC9B,MAAMC,WAAWF,eAAe,CAAC,IAAIF,MAAMA,IAAID,KAAK,CAAC,GAAGG;IACxD,MAAMG,YAAYH,eAAe,CAAC,IAAI,KAAKF,IAAID,KAAK,CAACG;IACrD,IAAIE,SAASN,QAAQ,CAAC,MAAM;QAC1B,OAAOE;IACT;IACA,OAAO,GAAGI,SAAS,CAAC,EAAEC,WAAW;AACnC"}
@@ -1,10 +1,17 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { formatAdminURL } from './formatAdminURL.js';
1
+ import { afterEach, beforeEach, describe, it, expect } from 'vitest';
2
+ import { formatAdminURL, stripTrailingSlash } from './formatAdminURL.js';
3
3
  describe('formatAdminURL', ()=>{
4
4
  const serverURL = 'https://example.com';
5
5
  const defaultAdminRoute = '/admin';
6
6
  const rootAdminRoute = '/';
7
7
  const dummyPath = '/collections/posts';
8
+ describe('stripTrailingSlash', ()=>{
9
+ it('removes a trailing slash while preserving the root path', ()=>{
10
+ expect(stripTrailingSlash('/admin/')).toBe('/admin');
11
+ expect(stripTrailingSlash('/')).toBe('/');
12
+ expect(stripTrailingSlash('/admin')).toBe('/admin');
13
+ });
14
+ });
8
15
  describe('relative URLs', ()=>{
9
16
  it('should ignore `serverURL` when relative=true', ()=>{
10
17
  const result = formatAdminURL({
@@ -163,6 +170,95 @@ describe('formatAdminURL', ()=>{
163
170
  expect(result).toBe('/');
164
171
  });
165
172
  });
173
+ describe('trailing slash handling', ()=>{
174
+ const originalTrailingSlash = process.env.NEXT_TRAILING_SLASH;
175
+ beforeEach(()=>{
176
+ process.env.NEXT_TRAILING_SLASH = 'true';
177
+ });
178
+ afterEach(()=>{
179
+ if (originalTrailingSlash === undefined) {
180
+ delete process.env.NEXT_TRAILING_SLASH;
181
+ } else {
182
+ process.env.NEXT_TRAILING_SLASH = originalTrailingSlash;
183
+ }
184
+ });
185
+ it('should append trailing slash to relative admin URL', ()=>{
186
+ const result = formatAdminURL({
187
+ adminRoute: defaultAdminRoute,
188
+ path: dummyPath,
189
+ relative: true
190
+ });
191
+ expect(result).toBe(`${defaultAdminRoute}${dummyPath}/`);
192
+ });
193
+ it('should append trailing slash to relative api URL', ()=>{
194
+ const result = formatAdminURL({
195
+ apiRoute: '/api',
196
+ path: '/users',
197
+ relative: true
198
+ });
199
+ expect(result).toBe(`${process.env.NEXT_BASE_PATH || ''}/api/users/`);
200
+ });
201
+ it('should append trailing slash to absolute URL', ()=>{
202
+ const result = formatAdminURL({
203
+ adminRoute: defaultAdminRoute,
204
+ path: dummyPath,
205
+ serverURL
206
+ });
207
+ expect(result).toBe(`${serverURL}${process.env.NEXT_BASE_PATH || ''}${defaultAdminRoute}${dummyPath}/`);
208
+ });
209
+ it('should append trailing slash when basePath is set', ()=>{
210
+ const result = formatAdminURL({
211
+ apiRoute: '/api',
212
+ basePath: '/v1',
213
+ path: '/users',
214
+ serverURL
215
+ });
216
+ expect(result).toBe(`${serverURL}${process.env.NEXT_BASE_PATH || ''}/v1/api/users/`);
217
+ });
218
+ it('should not append trailing slash to root "/"', ()=>{
219
+ const result = formatAdminURL({
220
+ adminRoute: rootAdminRoute,
221
+ relative: true
222
+ });
223
+ expect(result).toBe('/');
224
+ });
225
+ it('should not double-slash when path already ends with /', ()=>{
226
+ const result = formatAdminURL({
227
+ adminRoute: defaultAdminRoute,
228
+ path: '/collections/posts',
229
+ relative: true
230
+ });
231
+ expect(result.endsWith('//')).toBe(false);
232
+ expect(result).toBe(`${defaultAdminRoute}/collections/posts/`);
233
+ });
234
+ it('should place trailing slash before query string', ()=>{
235
+ const path = `${dummyPath}?page=2`;
236
+ const result = formatAdminURL({
237
+ adminRoute: defaultAdminRoute,
238
+ path,
239
+ relative: true
240
+ });
241
+ expect(result).toBe(`${defaultAdminRoute}${dummyPath}/?page=2`);
242
+ });
243
+ it('should leave URLs unchanged when env var is not set', ()=>{
244
+ delete process.env.NEXT_TRAILING_SLASH;
245
+ const result = formatAdminURL({
246
+ adminRoute: defaultAdminRoute,
247
+ path: dummyPath,
248
+ relative: true
249
+ });
250
+ expect(result).toBe(`${defaultAdminRoute}${dummyPath}`);
251
+ });
252
+ it('should leave URLs unchanged when env var is "false"', ()=>{
253
+ process.env.NEXT_TRAILING_SLASH = 'false';
254
+ const result = formatAdminURL({
255
+ adminRoute: defaultAdminRoute,
256
+ path: dummyPath,
257
+ relative: true
258
+ });
259
+ expect(result).toBe(`${defaultAdminRoute}${dummyPath}`);
260
+ });
261
+ });
166
262
  });
167
263
 
168
264
  //# sourceMappingURL=formatAdminURL.spec.js.map