payload 4.0.0-beta.2 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/adapters/router.d.ts +1 -1
- package/dist/admin/adapters/router.d.ts.map +1 -1
- package/dist/admin/adapters/router.js.map +1 -1
- package/dist/admin/initAdminContext.js.map +1 -1
- package/dist/auth/getFieldsToSign.js.map +1 -1
- package/dist/auth/loginWithCookie.js.map +1 -1
- package/dist/auth/serverFunctions/cookies.js.map +1 -1
- package/dist/auth/serverFunctions/login.js.map +1 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/cli/commands/data/utilities.d.ts +1 -1
- package/dist/cli/commands/data/utilities.d.ts.map +1 -1
- package/dist/cli/commands/data/utilities.js.map +1 -1
- package/dist/cli/defineCLICommand.js +1 -1
- package/dist/cli/defineCLICommand.js.map +1 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/local/findDistinct.js.map +1 -1
- package/dist/collections/operations/renameFile.js +1 -1
- package/dist/collections/operations/renameFile.js.map +1 -1
- package/dist/collections/operations/utilities/update.js +1 -1
- package/dist/collections/operations/utilities/update.js.map +1 -1
- package/dist/collections/operations/validate.js +4 -4
- package/dist/collections/operations/validate.js.map +1 -1
- package/dist/config/definePlugin.js.map +1 -1
- package/dist/config/sanitize.js +2 -2
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/database/types.d.ts +4 -0
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/exports/build-config.d.ts +9 -0
- package/dist/exports/build-config.d.ts.map +1 -0
- package/dist/exports/build-config.js +38 -0
- package/dist/exports/build-config.js.map +1 -0
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/reservedFieldNames.d.ts.map +1 -1
- package/dist/fields/config/reservedFieldNames.js.map +1 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts +14 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts.map +1 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.js +36 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.js.map +1 -0
- package/dist/fields/hooks/beforeChange/promise.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +96 -22
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js +2 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +4 -1
- package/dist/fields/validations.js.map +1 -1
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/local/findOne.js.map +1 -1
- package/dist/globals/operations/local/update.js.map +1 -1
- package/dist/globals/operations/restoreVersion.d.ts +2 -3
- package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/restoreVersion.js +22 -15
- package/dist/globals/operations/restoreVersion.js.map +1 -1
- package/dist/globals/operations/validate.js +1 -1
- package/dist/globals/operations/validate.js.map +1 -1
- package/dist/hierarchy/createFolderField.js.map +1 -1
- package/dist/hierarchy/resolveHierarchyCollections.js +2 -2
- package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -1
- package/dist/hierarchy/utils/computePaths.d.ts.map +1 -1
- package/dist/hierarchy/utils/computePaths.js.map +1 -1
- package/dist/index.bundled.d.ts +18 -4
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/fileVersioning/archive.js.map +1 -1
- package/dist/uploads/fileVersioning/cloudStorage.js.map +1 -1
- package/dist/uploads/fileVersioning/resolveHistoricalFile.js.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getFileContentRequirement.js.map +1 -1
- package/dist/uploads/getFileFromUploadInstructions.js.map +1 -1
- package/dist/uploads/safeFetch.js.map +1 -1
- package/dist/uploads/stagedUpload.js.map +1 -1
- package/dist/uploads/transformers/handleDynamicFileRequest.js +11 -2
- package/dist/uploads/transformers/handleDynamicFileRequest.js.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.js +0 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.js.map +1 -1
- package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
- package/dist/utilities/cloneValidationRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/deepCopyObject.js.map +1 -1
- package/dist/utilities/documentMatchingWhereExists.js +1 -1
- package/dist/utilities/documentMatchingWhereExists.js.map +1 -1
- package/dist/utilities/entityInputSchema/validateEntityData.d.ts.map +1 -1
- package/dist/utilities/entityInputSchema/validateEntityData.js.map +1 -1
- package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js +1 -0
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
- package/dist/utilities/getVersionsConfig.js.map +1 -1
- package/dist/utilities/parseParams/index.js.map +1 -1
- package/dist/utilities/parseValidationLocale.js.map +1 -1
- package/dist/utilities/sanitizePopulateParam.js.map +1 -1
- package/dist/utilities/telemetry/conf/index.d.ts +4 -1
- package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/index.js.map +1 -1
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -1
- package/dist/versions/allLocalesPublicationStatus.js.map +1 -1
- package/dist/versions/isInheritedReadVersionsAccess.js.map +1 -1
- package/package.json +29 -27
- package/skills/payload/reference/ENDPOINTS.md +3 -9
- package/skills/payload/reference/PLUGIN-DEVELOPMENT.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utilities/telemetry/conf/index.ts"],"sourcesContent":["/**\n * Taken & simplified from https://github.com/sindresorhus/conf/blob/main/source/index.ts\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport assert from 'node:assert'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { envPaths } from './envPaths.js'\n\nconst createPlainObject = <T = Record<string, unknown>>(): T => Object.create(null)\n\nconst checkValueType = (key: string, value: unknown): void => {\n const nonJsonTypes = new Set(['function', 'symbol', 'undefined'])\n\n const type = typeof value\n\n if (nonJsonTypes.has(type)) {\n throw new TypeError(\n `Setting a value of type \\`${type}\\` for key \\`${key}\\` is not allowed as it's not supported by JSON`,\n )\n }\n}\n\nexport class Conf<T extends Record<string, any> = Record<string, unknown>>\n implements Iterable<[keyof T, T[keyof T]]>\n{\n readonly #options: Readonly<Partial<Options>>\n private readonly _deserialize: Deserialize<T> = (value) => JSON.parse(value)\n private readonly _serialize: Serialize<T> = (value) => JSON.stringify(value, undefined, '\\t')\n\n readonly events: EventTarget\n\n readonly path: string\n\n constructor() {\n const options: Partial<Options> = {\n configFileMode: 0o666,\n configName: 'config',\n fileExtension: 'json',\n projectSuffix: 'nodejs',\n }\n\n const cwd = envPaths('payload', { suffix: options.projectSuffix }).config\n\n this.#options = options\n\n this.events = new EventTarget()\n\n const fileExtension = options.fileExtension ? `.${options.fileExtension}` : ''\n this.path = path.resolve(cwd, `${options.configName ?? 'config'}${fileExtension}`)\n\n const fileStore = this.store\n const store = Object.assign(createPlainObject(), fileStore)\n\n try {\n assert.deepEqual(fileStore, store)\n } catch {\n this.store = store\n }\n }\n\n private _ensureDirectory(): void {\n // Ensure the directory exists as it could have been deleted in the meantime.\n fs.mkdirSync(path.dirname(this.path), { recursive: true })\n }\n\n private _write(value: T): void {\n const data: string | Uint8Array = this._serialize(value)\n\n fs.writeFileSync(this.path, data, { mode: this.#options.configFileMode })\n }\n\n /**\n Delete an item.\n\n @param key - The key of the item to delete.\n */\n delete(key: string): void {\n const { store } = this\n delete store[key]\n\n this.store = store\n }\n\n /**\n Get an item.\n\n @param key - The key of the item to get.\n */\n get<Key extends keyof T>(key: Key): T[Key] {\n const { store } = this\n return store[key]\n }\n\n /**\n Set an item or multiple items at once.\n\n @param key - You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a key to access nested properties. Or a hashmap of items to set at once.\n @param value - Must be JSON serializable. Trying to set the type `undefined`, `function`, or `symbol` will result in a `TypeError`.\n */\n set<Key extends keyof T>(key: string, value?: T[Key] | unknown): void {\n if (typeof key !== 'string' && typeof key !== 'object') {\n throw new TypeError(\n `Expected \\`key\\` to be of type \\`string\\` or \\`object\\`, got ${typeof key}`,\n )\n }\n\n if (typeof key !== 'object' && value === undefined) {\n throw new TypeError('Use `delete()` to clear values')\n }\n\n const { store } = this\n\n const set = (key: string, value?: T | T[Key] | unknown): void => {\n checkValueType(key, value)\n store[key as Key] = value as T[Key]\n }\n\n if (typeof key === 'object') {\n const object = key\n for (const [key, value] of Object.entries(object)) {\n set(key, value)\n }\n } else {\n set(key, value)\n }\n\n this.store = store\n }\n\n *[Symbol.iterator](): IterableIterator<[keyof T, T[keyof T]]> {\n for (const [key, value] of Object.entries(this.store)) {\n yield [key, value]\n }\n }\n get size(): number {\n return Object.keys(this.store).length\n }\n get store(): T {\n try {\n const dataString = fs.readFileSync(this.path, 'utf8')\n const deserializedData = this._deserialize(dataString)\n return Object.assign(createPlainObject(), deserializedData)\n } catch (error: unknown) {\n if ((error as any)?.code === 'ENOENT') {\n this._ensureDirectory()\n return createPlainObject()\n }\n\n throw error\n }\n }\n\n set store(value: T) {\n this._ensureDirectory()\n\n this._write(value)\n\n this.events.dispatchEvent(new Event('change'))\n }\n}\n\nexport type Options = {\n /**\n The config is cleared if reading the config file causes a `SyntaxError`. This is a good behavior for unimportant data, as the config file is not intended to be hand-edited, so it usually means the config is corrupt and there's nothing the user can do about it anyway. However, if you let the user edit the config file directly, mistakes might happen and it could be more useful to throw an error when the config is invalid instead of clearing.\n\n @default false\n */\n clearInvalidConfig?: boolean\n\n /**\n The [mode](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) that will be used for the config file.\n\n You would usually not need this, but it could be useful if you want to restrict the permissions of the config file. Setting a permission such as `0o600` would result in a config file that can only be accessed by the user running the program.\n\n Note that setting restrictive permissions can cause problems if different users need to read the file. A common problem is a user running your tool with and without `sudo` and then not being able to access the config the second time.\n\n @default 0o666\n */\n readonly configFileMode?: number\n\n /**\n Name of the config file (without extension).\n\n Useful if you need multiple config files for your app or module. For example, different config files between two major versions.\n\n @default 'config'\n */\n configName?: string\n\n /**\n Extension of the config file.\n\n You would usually not need this, but could be useful if you want to interact with a file with a custom file extension that can be associated with your app. These might be simple save/export/preference files that are intended to be shareable or saved outside of the app.\n\n @default 'json'\n */\n fileExtension?: string\n\n readonly projectSuffix?: string\n}\n\nexport type Serialize<T> = (value: T) => string\nexport type Deserialize<T> = (text: string) => T\n"],"names":["assert","fs","path","envPaths","createPlainObject","Object","create","checkValueType","key","value","nonJsonTypes","Set","type","has","TypeError","Conf","_deserialize","JSON","parse","_serialize","stringify","undefined","events","options","configFileMode","configName","fileExtension","projectSuffix","cwd","suffix","config","EventTarget","resolve","fileStore","store","assign","deepEqual","_ensureDirectory","mkdirSync","dirname","recursive","_write","data","writeFileSync","mode","delete","get","set","object","entries","Symbol","iterator","size","keys","length","dataString","readFileSync","deserializedData","error","code","dispatchEvent","Event"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,OAAOA,YAAY,cAAa;AAChC,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAE5B,SAASC,QAAQ,QAAQ,gBAAe;AAExC,MAAMC,oBAAoB,IAAsCC,OAAOC,MAAM,CAAC;AAE9E,MAAMC,iBAAiB,CAACC,KAAaC;IACnC,MAAMC,eAAe,IAAIC,IAAI;QAAC;QAAY;QAAU;KAAY;IAEhE,MAAMC,OAAO,OAAOH;IAEpB,IAAIC,aAAaG,GAAG,CAACD,OA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AK,EAAEoB,MAAM;IACvC;IACA,IAAIpB,QAAW;QACb,IAAI;YACF,MAAMqB,aAAatD,GAAGuD,YAAY,CAAC,IAAI,CAACtD,IAAI,EAAE;YAC9C,MAAMuD,mBAAmB,IAAI,CAACzC,YAAY,CAACuC;YAC3C,OAAOlD,OAAO8B,MAAM,CAAC/B,qBAAqBqD;QAC5C,EAAE,OAAOC,OAAgB;YACvB,IAAI,AAACA,OAAeC,SAAS,UAAU;gBACrC,IAAI,CAACtB,gBAAgB;gBACrB,OAAOjC;YACT;YAEA,MAAMsD;QACR;IACF;IAEA,IAAIxB,MAAMzB,KAAQ,EAAE;QAClB,IAAI,CAAC4B,gBAAgB;QAErB,IAAI,CAACI,MAAM,CAAChC;QAEZ,IAAI,CAACa,MAAM,CAACsC,aAAa,CAAC,IAAIC,MAAM;IACtC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/utilities/telemetry/conf/index.ts"],"sourcesContent":["/**\n * Taken & simplified from https://github.com/sindresorhus/conf/blob/main/source/index.ts\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport assert from 'node:assert'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { envPaths } from './envPaths.js'\n\nconst createPlainObject = <T = Record<string, unknown>>(): T => Object.create(null)\n\nconst checkValueType = (key: string, value: unknown): void => {\n const nonJsonTypes = new Set(['function', 'symbol', 'undefined'])\n\n const type = typeof value\n\n if (nonJsonTypes.has(type)) {\n throw new TypeError(\n `Setting a value of type \\`${type}\\` for key \\`${key}\\` is not allowed as it's not supported by JSON`,\n )\n }\n}\n\nexport class Conf<T extends Record<string, any> = Record<string, unknown>> implements Iterable<\n [keyof T, T[keyof T]]\n> {\n readonly #options: Readonly<Partial<Options>>\n private readonly _deserialize: Deserialize<T> = (value) => JSON.parse(value)\n private readonly _serialize: Serialize<T> = (value) => JSON.stringify(value, undefined, '\\t')\n\n readonly events: EventTarget\n\n readonly path: string\n\n constructor() {\n const options: Partial<Options> = {\n configFileMode: 0o666,\n configName: 'config',\n fileExtension: 'json',\n projectSuffix: 'nodejs',\n }\n\n const cwd = envPaths('payload', { suffix: options.projectSuffix }).config\n\n this.#options = options\n\n this.events = new EventTarget()\n\n const fileExtension = options.fileExtension ? `.${options.fileExtension}` : ''\n this.path = path.resolve(cwd, `${options.configName ?? 'config'}${fileExtension}`)\n\n const fileStore = this.store\n const store = Object.assign(createPlainObject(), fileStore)\n\n try {\n assert.deepEqual(fileStore, store)\n } catch {\n this.store = store\n }\n }\n\n private _ensureDirectory(): void {\n // Ensure the directory exists as it could have been deleted in the meantime.\n fs.mkdirSync(path.dirname(this.path), { recursive: true })\n }\n\n private _write(value: T): void {\n const data: string | Uint8Array = this._serialize(value)\n\n fs.writeFileSync(this.path, data, { mode: this.#options.configFileMode })\n }\n\n /**\n Delete an item.\n\n @param key - The key of the item to delete.\n */\n delete(key: string): void {\n const { store } = this\n delete store[key]\n\n this.store = store\n }\n\n /**\n Get an item.\n\n @param key - The key of the item to get.\n */\n get<Key extends keyof T>(key: Key): T[Key] {\n const { store } = this\n return store[key]\n }\n\n /**\n Set an item or multiple items at once.\n\n @param key - You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a key to access nested properties. Or a hashmap of items to set at once.\n @param value - Must be JSON serializable. Trying to set the type `undefined`, `function`, or `symbol` will result in a `TypeError`.\n */\n set<Key extends keyof T>(key: string, value?: T[Key] | unknown): void {\n if (typeof key !== 'string' && typeof key !== 'object') {\n throw new TypeError(\n `Expected \\`key\\` to be of type \\`string\\` or \\`object\\`, got ${typeof key}`,\n )\n }\n\n if (typeof key !== 'object' && value === undefined) {\n throw new TypeError('Use `delete()` to clear values')\n }\n\n const { store } = this\n\n const set = (key: string, value?: T | T[Key] | unknown): void => {\n checkValueType(key, value)\n store[key as Key] = value as T[Key]\n }\n\n if (typeof key === 'object') {\n const object = key\n for (const [key, value] of Object.entries(object)) {\n set(key, value)\n }\n } else {\n set(key, value)\n }\n\n this.store = store\n }\n\n *[Symbol.iterator](): IterableIterator<[keyof T, T[keyof T]]> {\n for (const [key, value] of Object.entries(this.store)) {\n yield [key, value]\n }\n }\n get size(): number {\n return Object.keys(this.store).length\n }\n get store(): T {\n try {\n const dataString = fs.readFileSync(this.path, 'utf8')\n const deserializedData = this._deserialize(dataString)\n return Object.assign(createPlainObject(), deserializedData)\n } catch (error: unknown) {\n if ((error as any)?.code === 'ENOENT') {\n this._ensureDirectory()\n return createPlainObject()\n }\n\n throw error\n }\n }\n\n set store(value: T) {\n this._ensureDirectory()\n\n this._write(value)\n\n this.events.dispatchEvent(new Event('change'))\n }\n}\n\nexport type Options = {\n /**\n The config is cleared if reading the config file causes a `SyntaxError`. This is a good behavior for unimportant data, as the config file is not intended to be hand-edited, so it usually means the config is corrupt and there's nothing the user can do about it anyway. However, if you let the user edit the config file directly, mistakes might happen and it could be more useful to throw an error when the config is invalid instead of clearing.\n\n @default false\n */\n clearInvalidConfig?: boolean\n\n /**\n The [mode](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) that will be used for the config file.\n\n You would usually not need this, but it could be useful if you want to restrict the permissions of the config file. Setting a permission such as `0o600` would result in a config file that can only be accessed by the user running the program.\n\n Note that setting restrictive permissions can cause problems if different users need to read the file. A common problem is a user running your tool with and without `sudo` and then not being able to access the config the second time.\n\n @default 0o666\n */\n readonly configFileMode?: number\n\n /**\n Name of the config file (without extension).\n\n Useful if you need multiple config files for your app or module. For example, different config files between two major versions.\n\n @default 'config'\n */\n configName?: string\n\n /**\n Extension of the config file.\n\n You would usually not need this, but could be useful if you want to interact with a file with a custom file extension that can be associated with your app. These might be simple save/export/preference files that are intended to be shareable or saved outside of the app.\n\n @default 'json'\n */\n fileExtension?: string\n\n readonly projectSuffix?: string\n}\n\nexport type Serialize<T> = (value: T) => string\nexport type Deserialize<T> = (text: string) => T\n"],"names":["assert","fs","path","envPaths","createPlainObject","Object","create","checkValueType","key","value","nonJsonTypes","Set","type","has","TypeError","Conf","_deserialize","JSON","parse","_serialize","stringify","undefined","events","options","configFileMode","configName","fileExtension","projectSuffix","cwd","suffix","config","EventTarget","resolve","fileStore","store","assign","deepEqual","_ensureDirectory","mkdirSync","dirname","recursive","_write","data","writeFileSync","mode","delete","get","set","object","entries","Symbol","iterator","size","keys","length","dataString","readFileSync","deserializedData","error","code","dispatchEvent","Event"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,OAAOA,YAAY,cAAa;AAChC,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAE5B,SAASC,QAAQ,QAAQ,gBAAe;AAExC,MAAMC,oBAAoB,IAAsCC,OAAOC,MAAM,CAAC;AAE9E,MAAMC,iBAAiB,CAACC,KAAaC;IACnC,MAAMC,eAAe,IAAIC,IAAI;QAAC;QAAY;QAAU;KAAY;IAEhE,MAAMC,OAAO,OAAOH;IAEpB,IAAIC,aAAaG,GAAG,CAACD,OAAO;QAC1B,MAAM,IAAIE,UACR,CAAC,0BAA0B,EAAEF,KAAK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ACF,MAAMqB,aAAatD,GAAGuD,YAAY,CAAC,IAAI,CAACtD,IAAI,EAAE;YAC9C,MAAMuD,mBAAmB,IAAI,CAACzC,YAAY,CAACuC;YAC3C,OAAOlD,OAAO8B,MAAM,CAAC/B,qBAAqBqD;QAC5C,EAAE,OAAOC,OAAgB;YACvB,IAAI,AAACA,OAAeC,SAAS,UAAU;gBACrC,IAAI,CAACtB,gBAAgB;gBACrB,OAAOjC;YACT;YAEA,MAAMsD;QACR;IACF;IAEA,IAAIxB,MAAMzB,KAAQ,EAAE;QAClB,IAAI,CAAC4B,gBAAgB;QAErB,IAAI,CAACI,MAAM,CAAChC;QAEZ,IAAI,CAACa,MAAM,CAACsC,aAAa,CAAC,IAAIC,MAAM;IACtC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utilities/telemetry/featureInfo/getFeatureInfo.ts"],"sourcesContent":["import type { SanitizedConfig } from '../../../config/types.js'\nimport type { IncomingDrafts } from '../../../versions/types.js'\nimport type { FeatureInfo, RichTextFeature } from './types.js'\n\nimport { defaultUserCollection } from '../../../auth/defaultUser.js'\nimport { isUserMenuSettingsGroup } from '../../../config/types.js'\n\nexport const getFeatureInfo = (config: SanitizedConfig): FeatureInfo => {\n const telemetryConfig = sanitizeTelemetryConfig(config)\n\n return Object.assign(\n {},\n ...[\n collectAdminCustomization,\n collectAuthentication,\n collectBasicDenominators,\n collectHierarchy,\n collectI18n,\n collectJobsAndQueues,\n collectOrdering,\n collectPreviewAndLivePreview,\n collectQueryPresets,\n collectTrash,\n collectUploadAndMedia,\n collectVersionsAndDrafts,\n collectRichTextFeatures,\n ].map((collect) => safelyCollect(() => collect(telemetryConfig))),\n )\n}\n\nconst safelyCollect = (collect: () => FeatureInfo): FeatureInfo => {\n try {\n return collect()\n } catch (_) {\n return {}\n }\n}\n\n// sanitization adds 4 system widgets that we need to account for\nconst SYSTEM_WIDGET_COUNT = 4\nconst SYSTEM_COLLECTION_SLUGS = [\n 'payload-llm-instructions',\n 'payload-locked-documents',\n 'payload-migrations',\n 'payload-preferences',\n 'payload-query-presets',\n]\nconst SYSTEM_GLOBAL_SLUGS = new Set(['payload-jobs-stats'])\n\n/**\n * Payload adds internal collections, globals and tasks during config sanitization.\n * Remove them from the telemetry view so feature metrics represent user config.\n */\nconst sanitizeTelemetryConfig = (config: SanitizedConfig): SanitizedConfig => {\n try {\n const collections = config.collections ?? []\n const systemCollectionSlugs = new Set(SYSTEM_COLLECTION_SLUGS)\n const kvCollectionSlug = config.kv?.kvCollection?.slug\n\n if (kvCollectionSlug) {\n systemCollectionSlugs.add(kvCollectionSlug)\n }\n\n if (config.jobs?.enabled) {\n // uses SYSTEM_COLLECTION_SLUGS (not the Set) to exclude kv slug from position detection\n const firstCollectionAfterJobs = collections.findIndex(({ slug }) =>\n SYSTEM_COLLECTION_SLUGS.includes(slug),\n )\n\n if (firstCollectionAfterJobs > 0) {\n systemCollectionSlugs.add(collections[firstCollectionAfterJobs - 1]!.slug)\n } else {\n systemCollectionSlugs.add('payload-jobs')\n }\n }\n\n const tasks = [...(config.jobs?.tasks ?? [])]\n\n if (getDraftEntities(config).some(hasScheduledPublishing)) {\n for (let index = tasks.length - 1; index >= 0; index--) {\n if (tasks[index]?.slug === 'schedulePublish') {\n tasks.splice(index, 1)\n break\n }\n }\n }\n\n return {\n ...config,\n collections: collections.filter(\n (collection) =>\n collection !== defaultUserCollection && !systemCollectionSlugs.has(collection.slug),\n ),\n globals: (config.globals ?? []).filter(({ slug }) => !SYSTEM_GLOBAL_SLUGS.has(slug)),\n jobs: {\n ...config.jobs,\n tasks,\n },\n }\n } catch (_) {\n return config\n }\n}\n\nconst collectAdminCustomization = (config: SanitizedConfig): FeatureInfo => ({\n adminCustomization: {\n customAdminComponentCount: countRootAdminComponents(config),\n customAdminViewCount: Object.keys(config.admin?.components?.views ?? {}).length,\n customDashboardWidgetCount: Math.max(\n 0,\n (config.admin?.dashboard?.widgets?.length ?? 0) - SYSTEM_WIDGET_COUNT,\n ),\n },\n})\n\nconst collectAuthentication = (config: SanitizedConfig): FeatureInfo => {\n const authCollections = (config.collections ?? []).filter(({ auth }) => Boolean(auth))\n\n return {\n authentication: {\n apiKeyCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.useAPIKey),\n ).length,\n authCollectionCount: authCollections.length,\n customAuthStrategyCount: authCollections.reduce(\n (count, { auth }) =>\n count + (isObject(auth) && Array.isArray(auth.strategies) ? auth.strategies.length : 0),\n 0,\n ),\n localAuthDisabledCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.disableLocalStrategy),\n ).length,\n sessionsDisabledCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && auth.useSessions === false,\n ).length,\n usernameCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.loginWithUsername),\n ).length,\n verifiedCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.verify),\n ).length,\n },\n }\n}\n\nconst collectBasicDenominators = (config: SanitizedConfig): FeatureInfo => ({\n basicDenominators: {\n collectionCount: config.collections?.length ?? 0,\n globalCount: config.globals?.length ?? 0,\n },\n})\n\nconst collectHierarchy = (config: SanitizedConfig): FeatureInfo => ({\n hierarchyCollectionCount: (config.collections ?? []).filter(({ hierarchy }) => Boolean(hierarchy))\n .length,\n})\n\nconst collectI18n = (config: SanitizedConfig): FeatureInfo => ({\n i18n: {\n hasCustomAdminTranslations: Object.keys(config.i18n?.translations ?? {}).length > 0,\n supportedAdminLanguageCount: config.i18n?.supportedLanguages\n ? Object.keys(config.i18n.supportedLanguages).length\n : 1,\n },\n})\n\nconst collectJobsAndQueues = (config: SanitizedConfig): FeatureInfo => {\n const tasks = Array.isArray(config.jobs?.tasks) ? config.jobs.tasks : []\n const workflows = Array.isArray(config.jobs?.workflows) ? config.jobs.workflows : []\n const tasksAndWorkflows = [...tasks, ...workflows]\n const scheduledPublishingEntityCount =\n getDraftEntities(config).filter(hasScheduledPublishing).length\n\n return {\n jobsAndQueues: {\n jobsAutoRunConfigured: config.jobs?.autoRun !== undefined,\n jobsConcurrencyEnabled: tasksAndWorkflows.some(({ concurrency }) => Boolean(concurrency)),\n jobsEnabled: tasks.length > 0 || workflows.length > 0 || scheduledPublishingEntityCount > 0,\n jobsSchedulingEnabled: tasksAndWorkflows.some(({ schedule }) => Boolean(schedule)),\n taskCount: tasks.length,\n workflowCount: workflows.length,\n },\n }\n}\n\nconst collectOrdering = (config: SanitizedConfig): FeatureInfo => ({\n orderableCollectionCount: (config.collections ?? []).filter(({ orderable }) => Boolean(orderable))\n .length,\n})\n\nconst collectPreviewAndLivePreview = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n const globals = config.globals ?? []\n const livePreviewCollections = new Set([\n ...(config.admin?.livePreview?.collections ?? []),\n ...collections.filter((c) => c.admin?.livePreview).map((c) => c.slug),\n ])\n const livePreviewGlobals = new Set([\n ...(config.admin?.livePreview?.globals ?? []),\n ...globals.filter((g) => g.admin?.livePreview).map((g) => g.slug),\n ])\n\n return {\n previewAndLivePreview: {\n livePreviewCollectionCount: collections.filter(({ slug }) => livePreviewCollections.has(slug))\n .length,\n livePreviewGlobalCount: globals.filter(({ slug }) => livePreviewGlobals.has(slug)).length,\n previewCollectionCount: collections.filter(({ admin }) => Boolean(admin?.preview)).length,\n previewGlobalCount: globals.filter(({ admin }) => Boolean(admin?.preview)).length,\n },\n }\n}\n\nconst collectQueryPresets = (config: SanitizedConfig): FeatureInfo => ({\n queryPresetCollectionCount: (config.collections ?? []).filter(({ enableQueryPresets }) =>\n Boolean(enableQueryPresets),\n ).length,\n})\n\nconst collectRichTextFeatures = (config: SanitizedConfig): FeatureInfo => {\n const editor: unknown = config.editor\n const features =\n isObject(editor) && isObject(editor.editorConfig) ? editor.editorConfig.features : undefined\n const raw =\n isObject(features) && Array.isArray(features.enabledFeatures) ? features.enabledFeatures : []\n const featureSet = new Set(raw.filter((f): f is string => typeof f === 'string'))\n // per-field editor overrides are not checked; root editor covers the vast majority of projects\n return {\n richTextFeatures: (['blocks', 'table', 'upload', 'relationship'] as const).filter((f) =>\n featureSet.has(f),\n ) as RichTextFeature[],\n }\n}\n\nconst collectTrash = (config: SanitizedConfig): FeatureInfo => ({\n trashCollectionCount: (config.collections ?? []).filter(({ trash }) => Boolean(trash)).length,\n})\n\nconst collectUploadAndMedia = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n\n return {\n uploadAndMedia: {\n cropDisabledCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && upload.crop === false,\n ).length,\n focalPointDisabledCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && upload.focalPoint === false,\n ).length,\n imageSizesCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && Boolean(upload.variants?.length),\n ).length,\n mimeRestrictedCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && Boolean(upload.mimeTypes?.length),\n ).length,\n uploadCollectionCount: collections.filter(({ upload }) => Boolean(upload)).length,\n },\n }\n}\n\nconst collectVersionsAndDrafts = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n const globals = config.globals ?? []\n const draftCollections = collections.filter(hasDrafts)\n const draftGlobals = globals.filter(hasDrafts)\n const draftEntities = [...draftCollections, ...draftGlobals]\n\n return {\n versionsAndDrafts: {\n autosaveEntityCount: draftEntities.filter(hasAutosave).length,\n draftCollectionCount: draftCollections.length,\n draftGlobalCount: draftGlobals.length,\n scheduledPublishingEntityCount: draftEntities.filter(hasScheduledPublishing).length,\n versionsDisabledCollectionCount: collections.filter(({ versions }) => !versions).length,\n versionsDisabledGlobalCount: globals.filter(({ versions }) => !versions).length,\n },\n }\n}\n\nconst getDraftEntities = (config: SanitizedConfig) => [\n ...(config.collections ?? []).filter(hasDrafts),\n ...(config.globals ?? []).filter(hasDrafts),\n]\n\nconst hasDrafts = ({ versions }: { versions?: { drafts?: unknown } | boolean }): boolean =>\n isObject(versions) && Boolean(versions.drafts)\n\nconst getDraftOptions = ({\n versions,\n}: {\n versions?: { drafts?: boolean | IncomingDrafts } | boolean\n}): IncomingDrafts | undefined =>\n isObject(versions) && isObject(versions.drafts) ? versions.drafts : undefined\n\nconst hasAutosave = (entity: Parameters<typeof getDraftOptions>[0]): boolean =>\n Boolean(getDraftOptions(entity)?.autosave)\n\nconst hasScheduledPublishing = (entity: Parameters<typeof getDraftOptions>[0]): boolean =>\n Boolean(getDraftOptions(entity)?.schedulePublish)\n\nconst countRootAdminComponents = (config: SanitizedConfig): number => {\n const admin = config.admin\n const customAvatarCount = Number(\n Boolean(admin?.avatar && typeof admin.avatar === 'object' && admin.avatar.Component),\n )\n const components = admin?.components\n\n if (!components) {\n return customAvatarCount\n }\n\n const componentArrays = [\n components.actions,\n components.afterDashboard,\n components.afterLogin,\n components.afterNav,\n components.afterNavLinks,\n components.beforeDashboard,\n components.beforeLogin,\n components.beforeNav,\n components.beforeNavLinks,\n components.header,\n components.providers,\n components.settingsMenu,\n ]\n const directComponents = [\n components.graphics?.Icon,\n components.graphics?.Logo,\n components.logout?.Button,\n components.Nav,\n ]\n const hierarchyTabSlugs = new Set(\n (config.collections ?? [])\n .filter(({ hierarchy }) => Boolean(hierarchy))\n .map(({ slug }) => `hierarchy-${slug}`),\n )\n const sidebarTabComponentCount =\n components.sidebar?.tabs?.reduce((count, tab) => {\n if (hierarchyTabSlugs.has(tab.slug)) {\n return count\n }\n\n return count + Number(Boolean(tab.components.Content)) + Number(Boolean(tab.components.Icon))\n }, 0) ?? 0\n const userMenuComponentCount =\n components.userMenuSettingsItems?.reduce(\n (count, item) => count + (isUserMenuSettingsGroup(item) ? item.items.length : 1),\n 0,\n ) ?? 0\n\n return (\n customAvatarCount +\n componentArrays.reduce((count, items) => count + (items?.length ?? 0), 0) +\n directComponents.filter(Boolean).length +\n sidebarTabComponentCount +\n userMenuComponentCount\n )\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object'\n"],"names":["defaultUserCollection","isUserMenuSettingsGroup","getFeatureInfo","config","telemetryConfig","sanitizeTelemetryConfig","Object","assign","collectAdminCustomization","collectAuthentication","collectBasicDenominators","collectHierarchy","collectI18n","collectJobsAndQueues","collectOrdering","collectPreviewAndLivePreview","collectQueryPresets","collectTrash","collectUploadAndMedia","collectVersionsAndDrafts","collectRichTextFeatures","map","collect","safelyCollect","_","SYSTEM_WIDGET_COUNT","SYSTEM_COLLECTION_SLUGS","SYSTEM_GLOBAL_SLUGS","Set","collections","systemCollectionSlugs","kvCollectionSlug","kv","kvCollection","slug","add","jobs","enabled","firstCollectionAfterJobs","findIndex","includes","tasks","getDraftEntities","some","hasScheduledPublishing","index","length","splice","filter","collection","has","globals","adminCustomization","customAdminComponentCount","countRootAdminComponents","customAdminViewCount","keys","admin","components","views","customDashboardWidgetCount","Math","max","dashboard","widgets","authCollections","auth","Boolean","authentication","apiKeyCollectionCount","isObject","useAPIKey","authCollectionCount","customAuthStrategyCount","reduce","count","Array","isArray","strategies","localAuthDisabledCollectionCount","disableLocalStrategy","sessionsDisabledCollectionCount","useSessions","usernameCollectionCount","loginWithUsername","verifiedCollectionCount","verify","basicDenominators","collectionCount","globalCount","hierarchyCollectionCount","hierarchy","i18n","hasCustomAdminTranslations","translations","supportedAdminLanguageCount","supportedLanguages","workflows","tasksAndWorkflows","scheduledPublishingEntityCount","jobsAndQueues","jobsAutoRunConfigured","autoRun","undefined","jobsConcurrencyEnabled","concurrency","jobsEnabled","jobsSchedulingEnabled","schedule","taskCount","workflowCount","orderableCollectionCount","orderable","livePreviewCollections","livePreview","c","livePreviewGlobals","g","previewAndLivePreview","livePreviewCollectionCount","livePreviewGlobalCount","previewCollectionCount","preview","previewGlobalCount","queryPresetCollectionCount","enableQueryPresets","editor","features","editorConfig","raw","enabledFeatures","featureSet","f","richTextFeatures","trashCollectionCount","trash","uploadAndMedia","cropDisabledCollectionCount","upload","crop","focalPointDisabledCollectionCount","focalPoint","imageSizesCollectionCount","variants","mimeRestrictedCollectionCount","mimeTypes","uploadCollectionCount","draftCollections","hasDrafts","draftGlobals","draftEntities","versionsAndDrafts","autosaveEntityCount","hasAutosave","draftCollectionCount","draftGlobalCount","versionsDisabledCollectionCount","versions","versionsDisabledGlobalCount","drafts","getDraftOptions","entity","autosave","schedulePublish","customAvatarCount","Number","avatar","Component","componentArrays","actions","afterDashboard","afterLogin","afterNav","afterNavLinks","beforeDashboard","beforeLogin","beforeNav","beforeNavLinks","header","providers","settingsMenu","directComponents","graphics","Icon","Logo","logout","Button","Nav","hierarchyTabSlugs","sidebarTabComponentCount","sidebar","tabs","tab","Content","userMenuComponentCount","userMenuSettingsItems","item","items","value"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,+BAA8B;AACpE,SAASC,uBAAuB,QAAQ,2BAA0B;AAElE,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAMC,kBAAkBC,wBAAwBF;IAEhD,OAAOG,OAAOC,MAAM,CAClB,CAAC,MACE;QACDC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACD,CAACC,GAAG,CAAC,CAACC,UAAYC,cAAc,IAAMD,QAAQlB;AAEnD,EAAC;AAED,MAAMmB,gBAAgB,CAACD;IACrB,IAAI;QACF,OAAOA;IACT,EAAE,OAAOE,GAAG;QACV,OAAO,CAAC;IACV;AACF;AAEA,iEAAiE;AACjE,MAAMC,sBAAsB;AAC5B,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;CACD;AACD,MAAMC,sBAAsB,IAAIC,IAAI;IAAC;CAAqB;AAE1D;;;CAGC,GACD,MAAMvB,0BAA0B,CAACF;IAC/B,IAAI;QACF,MAAM0B,cAAc1B,OAAO0B,WAAW,IAAI,EAAE;QAC5C,MAAMC,wBAAwB,IAAIF,IAAIF;QACtC,MAAMK,mBAAmB5B,OAAO6B,EAAE,EAAEC,cAAcC;QAElD,IAAIH,kBAAkB;YACpBD,sBAAsBK,GAAG,C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AAAD,EACrBmB,MAAM,CAAC,CAAC,EAAE2C,SAAS,EAAE,GAAKxB,QAAQwB,YAClCtE,GAAG,CAAC,CAAC,EAAEa,IAAI,EAAE,GAAK,CAAC,UAAU,EAAEA,MAAM;IAE1C,MAAM2J,2BACJnI,WAAWoI,OAAO,EAAEC,MAAMrH,OAAO,CAACC,OAAOqH;QACvC,IAAIJ,kBAAkB1I,GAAG,CAAC8I,IAAI9J,IAAI,GAAG;YACnC,OAAOyC;QACT;QAEA,OAAOA,QAAQ0F,OAAOlG,QAAQ6H,IAAItI,UAAU,CAACuI,OAAO,KAAK5B,OAAOlG,QAAQ6H,IAAItI,UAAU,CAAC6H,IAAI;IAC7F,GAAG,MAAM;IACX,MAAMW,yBACJxI,WAAWyI,qBAAqB,EAAEzH,OAChC,CAACC,OAAOyH,OAASzH,QAAS1E,CAAAA,wBAAwBmM,QAAQA,KAAKC,KAAK,CAACvJ,MAAM,GAAG,CAAA,GAC9E,MACG;IAEP,OACEsH,oBACAI,gBAAgB9F,MAAM,CAAC,CAACC,OAAO0H,QAAU1H,QAAS0H,CAAAA,OAAOvJ,UAAU,CAAA,GAAI,KACvEuI,iBAAiBrI,MAAM,CAACmB,SAASrB,MAAM,GACvC+I,2BACAK;AAEJ;AAEA,MAAM5H,WAAW,CAACgI,QAChBA,UAAU,QAAQ,OAAOA,UAAU"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/utilities/telemetry/featureInfo/getFeatureInfo.ts"],"sourcesContent":["import type { SanitizedConfig } from '../../../config/types.js'\nimport type { IncomingDrafts } from '../../../versions/types.js'\nimport type { FeatureInfo, RichTextFeature } from './types.js'\n\nimport { defaultUserCollection } from '../../../auth/defaultUser.js'\nimport { isUserMenuSettingsGroup } from '../../../config/types.js'\n\nexport const getFeatureInfo = (config: SanitizedConfig): FeatureInfo => {\n const telemetryConfig = sanitizeTelemetryConfig(config)\n\n return Object.assign(\n {},\n ...[\n collectAdminCustomization,\n collectAuthentication,\n collectBasicDenominators,\n collectHierarchy,\n collectI18n,\n collectJobsAndQueues,\n collectOrdering,\n collectPreviewAndLivePreview,\n collectQueryPresets,\n collectTrash,\n collectUploadAndMedia,\n collectVersionsAndDrafts,\n collectRichTextFeatures,\n ].map((collect) => safelyCollect(() => collect(telemetryConfig))),\n )\n}\n\nconst safelyCollect = (collect: () => FeatureInfo): FeatureInfo => {\n try {\n return collect()\n } catch (_) {\n return {}\n }\n}\n\n// sanitization adds 4 system widgets that we need to account for\nconst SYSTEM_WIDGET_COUNT = 4\nconst SYSTEM_COLLECTION_SLUGS = [\n 'payload-llm-instructions',\n 'payload-locked-documents',\n 'payload-migrations',\n 'payload-preferences',\n 'payload-query-presets',\n]\nconst SYSTEM_GLOBAL_SLUGS = new Set(['payload-jobs-stats'])\n\n/**\n * Payload adds internal collections, globals and tasks during config sanitization.\n * Remove them from the telemetry view so feature metrics represent user config.\n */\nconst sanitizeTelemetryConfig = (config: SanitizedConfig): SanitizedConfig => {\n try {\n const collections = config.collections ?? []\n const systemCollectionSlugs = new Set(SYSTEM_COLLECTION_SLUGS)\n const kvCollectionSlug = config.kv?.kvCollection?.slug\n\n if (kvCollectionSlug) {\n systemCollectionSlugs.add(kvCollectionSlug)\n }\n\n if (config.jobs?.enabled) {\n // uses SYSTEM_COLLECTION_SLUGS (not the Set) to exclude kv slug from position detection\n const firstCollectionAfterJobs = collections.findIndex(({ slug }) =>\n SYSTEM_COLLECTION_SLUGS.includes(slug),\n )\n\n if (firstCollectionAfterJobs > 0) {\n systemCollectionSlugs.add(collections[firstCollectionAfterJobs - 1]!.slug)\n } else {\n systemCollectionSlugs.add('payload-jobs')\n }\n }\n\n const tasks = [...(config.jobs?.tasks ?? [])]\n\n if (getDraftEntities(config).some(hasScheduledPublishing)) {\n for (let index = tasks.length - 1; index >= 0; index--) {\n if (tasks[index]?.slug === 'schedulePublish') {\n tasks.splice(index, 1)\n break\n }\n }\n }\n\n return {\n ...config,\n collections: collections.filter(\n (collection) =>\n collection !== defaultUserCollection && !systemCollectionSlugs.has(collection.slug),\n ),\n globals: (config.globals ?? []).filter(({ slug }) => !SYSTEM_GLOBAL_SLUGS.has(slug)),\n jobs: {\n ...config.jobs,\n tasks,\n },\n }\n } catch (_) {\n return config\n }\n}\n\nconst collectAdminCustomization = (config: SanitizedConfig): FeatureInfo => ({\n adminCustomization: {\n customAdminComponentCount: countRootAdminComponents(config),\n customAdminViewCount: Object.keys(config.admin?.components?.views ?? {}).length,\n customDashboardWidgetCount: Math.max(\n 0,\n (config.admin?.dashboard?.widgets?.length ?? 0) - SYSTEM_WIDGET_COUNT,\n ),\n },\n})\n\nconst collectAuthentication = (config: SanitizedConfig): FeatureInfo => {\n const authCollections = (config.collections ?? []).filter(({ auth }) => Boolean(auth))\n\n return {\n authentication: {\n apiKeyCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.useAPIKey),\n ).length,\n authCollectionCount: authCollections.length,\n customAuthStrategyCount: authCollections.reduce(\n (count, { auth }) =>\n count + (isObject(auth) && Array.isArray(auth.strategies) ? auth.strategies.length : 0),\n 0,\n ),\n localAuthDisabledCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.disableLocalStrategy),\n ).length,\n sessionsDisabledCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && auth.useSessions === false,\n ).length,\n usernameCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.loginWithUsername),\n ).length,\n verifiedCollectionCount: authCollections.filter(\n ({ auth }) => isObject(auth) && Boolean(auth.verify),\n ).length,\n },\n }\n}\n\nconst collectBasicDenominators = (config: SanitizedConfig): FeatureInfo => ({\n basicDenominators: {\n collectionCount: config.collections?.length ?? 0,\n globalCount: config.globals?.length ?? 0,\n },\n})\n\nconst collectHierarchy = (config: SanitizedConfig): FeatureInfo => ({\n hierarchyCollectionCount: (config.collections ?? []).filter(({ hierarchy }) => Boolean(hierarchy))\n .length,\n})\n\nconst collectI18n = (config: SanitizedConfig): FeatureInfo => ({\n i18n: {\n hasCustomAdminTranslations: Object.keys(config.i18n?.translations ?? {}).length > 0,\n supportedAdminLanguageCount: config.i18n?.supportedLanguages\n ? Object.keys(config.i18n.supportedLanguages).length\n : 1,\n },\n})\n\nconst collectJobsAndQueues = (config: SanitizedConfig): FeatureInfo => {\n const tasks = Array.isArray(config.jobs?.tasks) ? config.jobs.tasks : []\n const workflows = Array.isArray(config.jobs?.workflows) ? config.jobs.workflows : []\n const tasksAndWorkflows = [...tasks, ...workflows]\n const scheduledPublishingEntityCount =\n getDraftEntities(config).filter(hasScheduledPublishing).length\n\n return {\n jobsAndQueues: {\n jobsAutoRunConfigured: config.jobs?.autoRun !== undefined,\n jobsConcurrencyEnabled: tasksAndWorkflows.some(({ concurrency }) => Boolean(concurrency)),\n jobsEnabled: tasks.length > 0 || workflows.length > 0 || scheduledPublishingEntityCount > 0,\n jobsSchedulingEnabled: tasksAndWorkflows.some(({ schedule }) => Boolean(schedule)),\n taskCount: tasks.length,\n workflowCount: workflows.length,\n },\n }\n}\n\nconst collectOrdering = (config: SanitizedConfig): FeatureInfo => ({\n orderableCollectionCount: (config.collections ?? []).filter(({ orderable }) => Boolean(orderable))\n .length,\n})\n\nconst collectPreviewAndLivePreview = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n const globals = config.globals ?? []\n const livePreviewCollections = new Set([\n ...(config.admin?.livePreview?.collections ?? []),\n ...collections.filter((c) => c.admin?.livePreview).map((c) => c.slug),\n ])\n const livePreviewGlobals = new Set([\n ...(config.admin?.livePreview?.globals ?? []),\n ...globals.filter((g) => g.admin?.livePreview).map((g) => g.slug),\n ])\n\n return {\n previewAndLivePreview: {\n livePreviewCollectionCount: collections.filter(({ slug }) => livePreviewCollections.has(slug))\n .length,\n livePreviewGlobalCount: globals.filter(({ slug }) => livePreviewGlobals.has(slug)).length,\n previewCollectionCount: collections.filter(({ admin }) => Boolean(admin?.preview)).length,\n previewGlobalCount: globals.filter(({ admin }) => Boolean(admin?.preview)).length,\n },\n }\n}\n\nconst collectQueryPresets = (config: SanitizedConfig): FeatureInfo => ({\n queryPresetCollectionCount: (config.collections ?? []).filter(({ enableQueryPresets }) =>\n Boolean(enableQueryPresets),\n ).length,\n})\n\nconst collectRichTextFeatures = (config: SanitizedConfig): FeatureInfo => {\n const editor: unknown = config.editor\n const features =\n isObject(editor) && isObject(editor.editorConfig) ? editor.editorConfig.features : undefined\n const raw =\n isObject(features) && Array.isArray(features.enabledFeatures) ? features.enabledFeatures : []\n const featureSet = new Set(raw.filter((f): f is string => typeof f === 'string'))\n // per-field editor overrides are not checked; root editor covers the vast majority of projects\n return {\n richTextFeatures: (['blocks', 'table', 'upload', 'relationship'] as const).filter((f) =>\n featureSet.has(f),\n ),\n }\n}\n\nconst collectTrash = (config: SanitizedConfig): FeatureInfo => ({\n trashCollectionCount: (config.collections ?? []).filter(({ trash }) => Boolean(trash)).length,\n})\n\nconst collectUploadAndMedia = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n\n return {\n uploadAndMedia: {\n cropDisabledCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && upload.crop === false,\n ).length,\n focalPointDisabledCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && upload.focalPoint === false,\n ).length,\n imageSizesCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && Boolean(upload.variants?.length),\n ).length,\n mimeRestrictedCollectionCount: collections.filter(\n ({ upload }) => isObject(upload) && Boolean(upload.mimeTypes?.length),\n ).length,\n uploadCollectionCount: collections.filter(({ upload }) => Boolean(upload)).length,\n },\n }\n}\n\nconst collectVersionsAndDrafts = (config: SanitizedConfig): FeatureInfo => {\n const collections = config.collections ?? []\n const globals = config.globals ?? []\n const draftCollections = collections.filter(hasDrafts)\n const draftGlobals = globals.filter(hasDrafts)\n const draftEntities = [...draftCollections, ...draftGlobals]\n\n return {\n versionsAndDrafts: {\n autosaveEntityCount: draftEntities.filter(hasAutosave).length,\n draftCollectionCount: draftCollections.length,\n draftGlobalCount: draftGlobals.length,\n scheduledPublishingEntityCount: draftEntities.filter(hasScheduledPublishing).length,\n versionsDisabledCollectionCount: collections.filter(({ versions }) => !versions).length,\n versionsDisabledGlobalCount: globals.filter(({ versions }) => !versions).length,\n },\n }\n}\n\nconst getDraftEntities = (config: SanitizedConfig) => [\n ...(config.collections ?? []).filter(hasDrafts),\n ...(config.globals ?? []).filter(hasDrafts),\n]\n\nconst hasDrafts = ({ versions }: { versions?: { drafts?: unknown } | boolean }): boolean =>\n isObject(versions) && Boolean(versions.drafts)\n\nconst getDraftOptions = ({\n versions,\n}: {\n versions?: { drafts?: boolean | IncomingDrafts } | boolean\n}): IncomingDrafts | undefined =>\n isObject(versions) && isObject(versions.drafts) ? versions.drafts : undefined\n\nconst hasAutosave = (entity: Parameters<typeof getDraftOptions>[0]): boolean =>\n Boolean(getDraftOptions(entity)?.autosave)\n\nconst hasScheduledPublishing = (entity: Parameters<typeof getDraftOptions>[0]): boolean =>\n Boolean(getDraftOptions(entity)?.schedulePublish)\n\nconst countRootAdminComponents = (config: SanitizedConfig): number => {\n const admin = config.admin\n const customAvatarCount = Number(\n Boolean(admin?.avatar && typeof admin.avatar === 'object' && admin.avatar.Component),\n )\n const components = admin?.components\n\n if (!components) {\n return customAvatarCount\n }\n\n const componentArrays = [\n components.actions,\n components.afterDashboard,\n components.afterLogin,\n components.afterNav,\n components.afterNavLinks,\n components.beforeDashboard,\n components.beforeLogin,\n components.beforeNav,\n components.beforeNavLinks,\n components.header,\n components.providers,\n components.settingsMenu,\n ]\n const directComponents = [\n components.graphics?.Icon,\n components.graphics?.Logo,\n components.logout?.Button,\n components.Nav,\n ]\n const hierarchyTabSlugs = new Set(\n (config.collections ?? [])\n .filter(({ hierarchy }) => Boolean(hierarchy))\n .map(({ slug }) => `hierarchy-${slug}`),\n )\n const sidebarTabComponentCount =\n components.sidebar?.tabs?.reduce((count, tab) => {\n if (hierarchyTabSlugs.has(tab.slug)) {\n return count\n }\n\n return count + Number(Boolean(tab.components.Content)) + Number(Boolean(tab.components.Icon))\n }, 0) ?? 0\n const userMenuComponentCount =\n components.userMenuSettingsItems?.reduce(\n (count, item) => count + (isUserMenuSettingsGroup(item) ? item.items.length : 1),\n 0,\n ) ?? 0\n\n return (\n customAvatarCount +\n componentArrays.reduce((count, items) => count + (items?.length ?? 0), 0) +\n directComponents.filter(Boolean).length +\n sidebarTabComponentCount +\n userMenuComponentCount\n )\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object'\n"],"names":["defaultUserCollection","isUserMenuSettingsGroup","getFeatureInfo","config","telemetryConfig","sanitizeTelemetryConfig","Object","assign","collectAdminCustomization","collectAuthentication","collectBasicDenominators","collectHierarchy","collectI18n","collectJobsAndQueues","collectOrdering","collectPreviewAndLivePreview","collectQueryPresets","collectTrash","collectUploadAndMedia","collectVersionsAndDrafts","collectRichTextFeatures","map","collect","safelyCollect","_","SYSTEM_WIDGET_COUNT","SYSTEM_COLLECTION_SLUGS","SYSTEM_GLOBAL_SLUGS","Set","collections","systemCollectionSlugs","kvCollectionSlug","kv","kvCollection","slug","add","jobs","enabled","firstCollectionAfterJobs","findIndex","includes","tasks","getDraftEntities","some","hasScheduledPublishing","index","length","splice","filter","collection","has","globals","adminCustomization","customAdminComponentCount","countRootAdminComponents","customAdminViewCount","keys","admin","components","views","customDashboardWidgetCount","Math","max","dashboard","widgets","authCollections","auth","Boolean","authentication","apiKeyCollectionCount","isObject","useAPIKey","authCollectionCount","customAuthStrategyCount","reduce","count","Array","isArray","strategies","localAuthDisabledCollectionCount","disableLocalStrategy","sessionsDisabledCollectionCount","useSessions","usernameCollectionCount","loginWithUsername","verifiedCollectionCount","verify","basicDenominators","collectionCount","globalCount","hierarchyCollectionCount","hierarchy","i18n","hasCustomAdminTranslations","translations","supportedAdminLanguageCount","supportedLanguages","workflows","tasksAndWorkflows","scheduledPublishingEntityCount","jobsAndQueues","jobsAutoRunConfigured","autoRun","undefined","jobsConcurrencyEnabled","concurrency","jobsEnabled","jobsSchedulingEnabled","schedule","taskCount","workflowCount","orderableCollectionCount","orderable","livePreviewCollections","livePreview","c","livePreviewGlobals","g","previewAndLivePreview","livePreviewCollectionCount","livePreviewGlobalCount","previewCollectionCount","preview","previewGlobalCount","queryPresetCollectionCount","enableQueryPresets","editor","features","editorConfig","raw","enabledFeatures","featureSet","f","richTextFeatures","trashCollectionCount","trash","uploadAndMedia","cropDisabledCollectionCount","upload","crop","focalPointDisabledCollectionCount","focalPoint","imageSizesCollectionCount","variants","mimeRestrictedCollectionCount","mimeTypes","uploadCollectionCount","draftCollections","hasDrafts","draftGlobals","draftEntities","versionsAndDrafts","autosaveEntityCount","hasAutosave","draftCollectionCount","draftGlobalCount","versionsDisabledCollectionCount","versions","versionsDisabledGlobalCount","drafts","getDraftOptions","entity","autosave","schedulePublish","customAvatarCount","Number","avatar","Component","componentArrays","actions","afterDashboard","afterLogin","afterNav","afterNavLinks","beforeDashboard","beforeLogin","beforeNav","beforeNavLinks","header","providers","settingsMenu","directComponents","graphics","Icon","Logo","logout","Button","Nav","hierarchyTabSlugs","sidebarTabComponentCount","sidebar","tabs","tab","Content","userMenuComponentCount","userMenuSettingsItems","item","items","value"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,+BAA8B;AACpE,SAASC,uBAAuB,QAAQ,2BAA0B;AAElE,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAMC,kBAAkBC,wBAAwBF;IAEhD,OAAOG,OAAOC,MAAM,CAClB,CAAC,MACE;QACDC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACD,CAACC,GAAG,CAAC,CAACC,UAAYC,cAAc,IAAMD,QAAQlB;AAEnD,EAAC;AAED,MAAMmB,gBAAgB,CAACD;IACrB,IAAI;QACF,OAAOA;IACT,EAAE,OAAOE,GAAG;QACV,OAAO,CAAC;IACV;AACF;AAEA,iEAAiE;AACjE,MAAMC,sBAAsB;AAC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versions/allLocalesPublicationStatus.ts"],"sourcesContent":["import type { JsonObject } from '../types/index.js'\n\nimport { APIError } from '../errors/index.js'\nimport { httpStatus } from '../utilities/httpStatus.js'\n\nexport type AllLocalesPublicationStatus = 'draft' | 'published'\n\ntype AllLocalesPublicationIntent = {\n hadStatus: boolean\n previousStatus: unknown\n status: AllLocalesPublicationStatus\n}\n\nexport const buildAllLocalesPublicationHookDoc = <TDoc extends JsonObject>({\n doc,\n docWithLocales,\n status,\n}: {\n doc: TDoc\n docWithLocales: JsonObject\n status: AllLocalesPublicationStatus | undefined\n}): TDoc => {\n if (status && typeof docWithLocales._status === 'object' && docWithLocales._status !== null) {\n return {\n ...doc,\n _status: { ...(docWithLocales._status as JsonObject) },\n }
|
|
1
|
+
{"version":3,"sources":["../../src/versions/allLocalesPublicationStatus.ts"],"sourcesContent":["import type { JsonObject } from '../types/index.js'\n\nimport { APIError } from '../errors/index.js'\nimport { httpStatus } from '../utilities/httpStatus.js'\n\nexport type AllLocalesPublicationStatus = 'draft' | 'published'\n\ntype AllLocalesPublicationIntent = {\n hadStatus: boolean\n previousStatus: unknown\n status: AllLocalesPublicationStatus\n}\n\nexport const buildAllLocalesPublicationHookDoc = <TDoc extends JsonObject>({\n doc,\n docWithLocales,\n status,\n}: {\n doc: TDoc\n docWithLocales: JsonObject\n status: AllLocalesPublicationStatus | undefined\n}): TDoc => {\n if (status && typeof docWithLocales._status === 'object' && docWithLocales._status !== null) {\n return {\n ...doc,\n _status: { ...(docWithLocales._status as JsonObject) },\n }\n }\n\n return doc\n}\n\nexport const getAllLocalesPublicationStatus = ({\n hasLocalizedStatus,\n publishAllLocales,\n unpublishAllLocales,\n}: {\n hasLocalizedStatus: boolean\n publishAllLocales: boolean\n unpublishAllLocales: boolean\n}): AllLocalesPublicationStatus | undefined => {\n if (!hasLocalizedStatus) {\n return undefined\n }\n\n if (unpublishAllLocales) {\n return 'draft'\n }\n\n if (publishAllLocales) {\n return 'published'\n }\n\n return undefined\n}\n\nexport const hasAuthorizedAllLocalesPublicationStatus = ({\n data,\n fieldAccessDenied,\n fieldValue,\n status,\n}: {\n data: JsonObject\n fieldAccessDenied: boolean\n fieldValue: unknown\n status: AllLocalesPublicationStatus | undefined\n}): boolean => {\n return Boolean(status && !fieldAccessDenied && data._status === status && fieldValue === status)\n}\n\nexport const normalizeAllLocalesPublicationStatus = ({\n data,\n status,\n}: {\n data: JsonObject\n status: AllLocalesPublicationStatus | undefined\n}): AllLocalesPublicationIntent | undefined => {\n if (!status) {\n return undefined\n }\n\n const intent = {\n hadStatus: Object.prototype.hasOwnProperty.call(data, '_status'),\n previousStatus: data._status,\n status,\n }\n\n data._status = status\n\n return intent\n}\n\nexport const reconcileAllLocalesPublicationStatus = ({\n data,\n intent,\n status,\n}: {\n data: JsonObject\n intent: AllLocalesPublicationIntent | undefined\n status: AllLocalesPublicationStatus | undefined\n}): AllLocalesPublicationStatus | undefined => {\n if (intent && intent.status !== status && data._status === intent.status) {\n if (intent.hadStatus) {\n data._status = intent.previousStatus\n } else {\n delete data._status\n }\n }\n\n return status && data._status === status ? status : undefined\n}\n\nexport const validateAllLocalesPublicationFlags = ({\n publishAllLocales,\n unpublishAllLocales,\n}: {\n publishAllLocales?: boolean\n unpublishAllLocales?: boolean\n}): void => {\n if (publishAllLocales && unpublishAllLocales) {\n throw new APIError(\n 'publishAllLocales and unpublishAllLocales cannot both be true.',\n httpStatus.BAD_REQUEST,\n )\n }\n}\n"],"names":["APIError","httpStatus","buildAllLocalesPublicationHookDoc","doc","docWithLocales","status","_status","getAllLocalesPublicationStatus","hasLocalizedStatus","publishAllLocales","unpublishAllLocales","undefined","hasAuthorizedAllLocalesPublicationStatus","data","fieldAccessDenied","fieldValue","Boolean","normalizeAllLocalesPublicationStatus","intent","hadStatus","Object","prototype","hasOwnProperty","call","previousStatus","reconcileAllLocalesPublicationStatus","validateAllLocalesPublicationFlags","BAD_REQUEST"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,qBAAoB;AAC7C,SA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,OAAO;YACL,OAAOX,KAAKP,OAAO;QACrB;IACF;IAEA,OAAOD,UAAUQ,KAAKP,OAAO,KAAKD,SAASA,SAASM;AACtD,EAAC;AAED,OAAO,MAAMe,qCAAqC,CAAC,EACjDjB,iBAAiB,EACjBC,mBAAmB,EAIpB;IACC,IAAID,qBAAqBC,qBAAqB;QAC5C,MAAM,IAAIV,SACR,kEACAC,WAAW0B,WAAW;IAE1B;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/versions/isInheritedReadVersionsAccess.ts"],"sourcesContent":["import type { Access, AccessArgs } from '../config/types.js'\n\nconst inheritedReadVersionsAccess = Symbol('inheritedReadVersionsAccess')\nconst inheritedReadVersionsParentID = Symbol('inheritedReadVersionsParentID')\n\ntype InheritedReadVersionsAccess = {\n [inheritedReadVersionsAccess]: true\n} & Access\n\ntype InheritedReadVersionsAccessArgs = {\n [inheritedReadVersionsParentID]?: AccessArgs['id']\n} & AccessArgs\n\nexport const markInheritedReadVersionsAccess = <TAccess extends Access>(\n access: TAccess,\n): TAccess => {\n Object.defineProperty(access, inheritedReadVersionsAccess, { value: true })\n\n return access\n}\n\nexport const isInheritedReadVersionsAccess = (access?: Access): boolean =>\n Boolean(\n access &&\n
|
|
1
|
+
{"version":3,"sources":["../../src/versions/isInheritedReadVersionsAccess.ts"],"sourcesContent":["import type { Access, AccessArgs } from '../config/types.js'\n\nconst inheritedReadVersionsAccess = Symbol('inheritedReadVersionsAccess')\nconst inheritedReadVersionsParentID = Symbol('inheritedReadVersionsParentID')\n\ntype InheritedReadVersionsAccess = {\n [inheritedReadVersionsAccess]: true\n} & Access\n\ntype InheritedReadVersionsAccessArgs = {\n [inheritedReadVersionsParentID]?: AccessArgs['id']\n} & AccessArgs\n\nexport const markInheritedReadVersionsAccess = <TAccess extends Access>(\n access: TAccess,\n): TAccess => {\n Object.defineProperty(access, inheritedReadVersionsAccess, { value: true })\n\n return access\n}\n\nexport const isInheritedReadVersionsAccess = (access?: Access): boolean =>\n Boolean(\n access &&\n (access as Partial<InheritedReadVersionsAccess>)[inheritedReadVersionsAccess] === true,\n )\n\nexport const resolveInheritedReadVersionsAccessArgs = (args: AccessArgs): AccessArgs => {\n const inheritedArgs = args as InheritedReadVersionsAccessArgs\n\n if (!(inheritedReadVersionsParentID in inheritedArgs)) {\n return args\n }\n\n const readArgs = {\n ...args,\n id: inheritedArgs[inheritedReadVersionsParentID],\n } as InheritedReadVersionsAccessArgs\n\n delete readArgs[inheritedReadVersionsParentID]\n\n return readArgs\n}\n\nexport const withInheritedReadVersionsParentID = (\n args: AccessArgs,\n parentID: AccessArgs['id'],\n): AccessArgs => {\n const inheritedArgs: InheritedReadVersionsAccessArgs = {\n ...args,\n [inheritedReadVersionsParentID]: parentID,\n }\n\n return inheritedArgs\n}\n"],"names":["inheritedReadVersionsAccess","Symbol","inheritedReadVersionsParentID","markInheritedReadVersionsAccess","access","Object","defineProperty","value","isInheritedReadVersionsAccess","Boolean","resolveInheritedReadVersionsAccessArgs","args","inheritedArgs","readArgs","id","withInheritedReadVersionsParentID","parentID"],"mappings":"AAEA,MAAMA,8BAA8BC,OAAO;AAC3C,MAAMC,gCAAgCD,OAAO;AAU7C,OAAO,MAAME,kCAAkC,CAC7CC;IAEAC,OAAOC,cAAc,CAACF,QAAQJ,6BAA6B;QAAEO,OAAO;IAAK;IAEzE,OAAOH;AACT,EAAC;AAED,OAAO,MAAMI,gCAAgC,CAACJ,SAC5CK,QACEL,UACA,AAACA,MAA+C,CAACJ,4BAA4B,KAAK,MACnF;AAEH,OAAO,MAAMU,yCAAyC,CAACC;IACrD,MAAMC,gBAAgBD;IAEtB,IAAI,CAAET,CAAAA,iCAAiCU,aAAY,GAAI;QACrD,OAAOD;IACT;IAEA,MAAME,WAAW;QACf,GAAGF,IAAI;QACPG,IAAIF,aAAa,CAACV,8BAA8B;IAClD;IAEA,OAAOW,QAAQ,CAACX,8BAA8B;IAE9C,OAAOW;AACT,EAAC;AAED,OAAO,MAAME,oCAAoC,CAC/CJ,MACAK;IAEA,MAAMJ,gBAAiD;QACrD,GAAGD,IAAI;QACP,CAACT,8BAA8B,EAAEc;IACnC;IAEA,OAAOJ;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -23,11 +23,6 @@
|
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/payloadcms/payload"
|
|
25
25
|
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "https://github.com/payloadcms/payload.git",
|
|
29
|
-
"directory": "packages/payload"
|
|
30
|
-
},
|
|
31
26
|
"license": "MIT",
|
|
32
27
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
33
28
|
"maintainers": [
|
|
@@ -37,8 +32,23 @@
|
|
|
37
32
|
"url": "https://payloadcms.com"
|
|
38
33
|
}
|
|
39
34
|
],
|
|
40
|
-
"
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/payloadcms/payload.git",
|
|
38
|
+
"directory": "packages/payload"
|
|
39
|
+
},
|
|
40
|
+
"bin": {
|
|
41
|
+
"payload": "bin.js"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"bin.js",
|
|
46
|
+
"skills"
|
|
47
|
+
],
|
|
41
48
|
"type": "module",
|
|
49
|
+
"sideEffects": false,
|
|
50
|
+
"main": "./dist/index.js",
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
42
52
|
"imports": {
|
|
43
53
|
"#validateJSONSchema": {
|
|
44
54
|
"types": "./dist/fields/validateJSONSchema.d.ts",
|
|
@@ -47,6 +57,11 @@
|
|
|
47
57
|
}
|
|
48
58
|
},
|
|
49
59
|
"exports": {
|
|
60
|
+
"./build-config": {
|
|
61
|
+
"types": "./dist/exports/build-config.d.ts",
|
|
62
|
+
"import": "./dist/exports/build-config.js",
|
|
63
|
+
"default": "./dist/exports/build-config.js"
|
|
64
|
+
},
|
|
50
65
|
".": {
|
|
51
66
|
"types": "./dist/index.d.ts",
|
|
52
67
|
"browser": "./dist/exports/shared.js",
|
|
@@ -98,18 +113,12 @@
|
|
|
98
113
|
"default": "./dist/__testing__/predefinedMigration.js"
|
|
99
114
|
}
|
|
100
115
|
},
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
"bin": {
|
|
104
|
-
"payload": "bin.js"
|
|
116
|
+
"publishConfig": {
|
|
117
|
+
"registry": "https://registry.npmjs.org/"
|
|
105
118
|
},
|
|
106
|
-
"files": [
|
|
107
|
-
"dist",
|
|
108
|
-
"bin.js",
|
|
109
|
-
"skills"
|
|
110
|
-
],
|
|
111
119
|
"dependencies": {
|
|
112
120
|
"@next/env": "16.4.2",
|
|
121
|
+
"@payloadcms/translations": "4.0.0-beta.4",
|
|
113
122
|
"@standard-schema/spec": "1.1.0",
|
|
114
123
|
"@types/busboy": "1.5.4",
|
|
115
124
|
"bson-objectid": "2.0.4",
|
|
@@ -138,11 +147,10 @@
|
|
|
138
147
|
"sax": "1.6.1",
|
|
139
148
|
"ts-essentials": "10.0.3",
|
|
140
149
|
"tsx": "4.23.15",
|
|
141
|
-
"undici": "7.
|
|
150
|
+
"undici": "7.30.1",
|
|
142
151
|
"uuid": "14.0.0",
|
|
143
152
|
"ws": "^8.16.0",
|
|
144
|
-
"zod": "^4.6.0"
|
|
145
|
-
"@payloadcms/translations": "4.0.0-beta.2"
|
|
153
|
+
"zod": "^4.6.0"
|
|
146
154
|
},
|
|
147
155
|
"devDependencies": {
|
|
148
156
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
@@ -160,17 +168,13 @@
|
|
|
160
168
|
"react-datepicker": "9.1.0",
|
|
161
169
|
"rimraf": "6.0.1",
|
|
162
170
|
"rollup": "4.59.0",
|
|
163
|
-
"rollup-plugin-dts": "6.2.3"
|
|
164
|
-
"@payloadcms/eslint-config": "3.28.0"
|
|
171
|
+
"rollup-plugin-dts": "6.2.3"
|
|
165
172
|
},
|
|
166
173
|
"peerDependencies": {
|
|
167
174
|
"graphql": "^16.8.1"
|
|
168
175
|
},
|
|
169
176
|
"engines": {
|
|
170
|
-
"node": ">=24.
|
|
171
|
-
},
|
|
172
|
-
"publishConfig": {
|
|
173
|
-
"registry": "https://registry.npmjs.org/"
|
|
177
|
+
"node": ">=24.22.1"
|
|
174
178
|
},
|
|
175
179
|
"scripts": {
|
|
176
180
|
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm bundle:types && echo skipping esbuild",
|
|
@@ -182,8 +186,6 @@
|
|
|
182
186
|
"clean": "rimraf -g {dist,*.tsbuildinfo}",
|
|
183
187
|
"clean:cache": "rimraf node_modules/.cache",
|
|
184
188
|
"copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
185
|
-
"lint": "eslint .",
|
|
186
|
-
"lint:fix": "eslint . --fix",
|
|
187
189
|
"pretest": "pnpm build"
|
|
188
190
|
}
|
|
189
191
|
}
|
|
@@ -493,9 +493,7 @@ import type { CollectionConfig } from 'payload'
|
|
|
493
493
|
|
|
494
494
|
export const Orders: CollectionConfig = {
|
|
495
495
|
slug: 'orders',
|
|
496
|
-
fields: [
|
|
497
|
-
/* ... */
|
|
498
|
-
],
|
|
496
|
+
fields: [/* ... */],
|
|
499
497
|
endpoints: [
|
|
500
498
|
{
|
|
501
499
|
path: '/:id/tracking',
|
|
@@ -519,9 +517,7 @@ import type { GlobalConfig } from 'payload'
|
|
|
519
517
|
|
|
520
518
|
export const Settings: GlobalConfig = {
|
|
521
519
|
slug: 'settings',
|
|
522
|
-
fields: [
|
|
523
|
-
/* ... */
|
|
524
|
-
],
|
|
520
|
+
fields: [/* ... */],
|
|
525
521
|
endpoints: [
|
|
526
522
|
{
|
|
527
523
|
path: '/clear-cache',
|
|
@@ -568,9 +564,7 @@ Add endpoints based on config options.
|
|
|
568
564
|
```ts
|
|
569
565
|
export const MyCollection: CollectionConfig = {
|
|
570
566
|
slug: 'posts',
|
|
571
|
-
fields: [
|
|
572
|
-
/* ... */
|
|
573
|
-
],
|
|
567
|
+
fields: [/* ... */],
|
|
574
568
|
endpoints: [
|
|
575
569
|
// Always included
|
|
576
570
|
{
|