payload 3.24.0 → 3.25.0-canary.6d6bbd2
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/auth/strategies/jwt.d.ts.map +1 -1
- package/dist/auth/strategies/jwt.js +2 -0
- package/dist/auth/strategies/jwt.js.map +1 -1
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +9 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/collections/operations/local/count.d.ts +31 -1
- package/dist/collections/operations/local/count.d.ts.map +1 -1
- package/dist/collections/operations/local/count.js.map +1 -1
- package/dist/collections/operations/local/countVersions.d.ts +31 -1
- package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/countVersions.js.map +1 -1
- package/dist/collections/operations/local/create.d.ts +66 -1
- package/dist/collections/operations/local/create.d.ts.map +1 -1
- package/dist/collections/operations/local/create.js.map +1 -1
- package/dist/collections/operations/local/delete.d.ts +58 -1
- package/dist/collections/operations/local/delete.d.ts.map +1 -1
- package/dist/collections/operations/local/delete.js.map +1 -1
- package/dist/collections/operations/local/duplicate.d.ts +51 -1
- package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/local/duplicate.js.map +1 -1
- package/dist/collections/operations/local/find.d.ts +76 -1
- package/dist/collections/operations/local/find.d.ts.map +1 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +59 -1
- package/dist/collections/operations/local/findByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findByID.js.map +1 -1
- package/dist/collections/operations/local/findVersionByID.d.ts +48 -1
- package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersionByID.js.map +1 -1
- package/dist/collections/operations/local/findVersions.d.ts +58 -1
- package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersions.js.map +1 -1
- package/dist/collections/operations/local/restoreVersion.d.ts +44 -1
- package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/local/restoreVersion.js.map +1 -1
- package/dist/collections/operations/local/update.d.ts +88 -1
- package/dist/collections/operations/local/update.d.ts.map +1 -1
- package/dist/collections/operations/local/update.js.map +1 -1
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +8 -4
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/types.d.ts +2 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/validations.js +2 -2
- package/dist/fields/validations.js.map +1 -1
- package/dist/globals/operations/local/countGlobalVersions.d.ts +31 -1
- package/dist/globals/operations/local/countGlobalVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/countGlobalVersions.js.map +1 -1
- package/dist/globals/operations/local/findOne.d.ts +46 -0
- package/dist/globals/operations/local/findOne.d.ts.map +1 -1
- package/dist/globals/operations/local/findOne.js.map +1 -1
- package/dist/globals/operations/local/findVersionByID.d.ts +47 -0
- package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersionByID.js.map +1 -1
- package/dist/globals/operations/local/findVersions.d.ts +57 -0
- package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersions.js.map +1 -1
- package/dist/globals/operations/local/restoreVersion.d.ts +40 -0
- package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/local/restoreVersion.js.map +1 -1
- package/dist/globals/operations/local/update.d.ts +54 -0
- package/dist/globals/operations/local/update.d.ts.map +1 -1
- package/dist/globals/operations/local/update.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/types/constants.d.ts +2 -2
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/constants.js +1 -0
- package/dist/types/constants.js.map +1 -1
- package/dist/uploads/endpoints/getFile.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFile.js +24 -1
- package/dist/uploads/endpoints/getFile.js.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.js +2 -2
- package/dist/utilities/checkDocumentLockStatus.js.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts +1 -1
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +46 -34
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/auth/strategies/jwt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAQ,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/auth/strategies/jwt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAQ,MAAM,aAAa,CAAA;AAqE7D;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,oBA4C/B,CAAA"}
|
|
@@ -27,6 +27,8 @@ async function autoLogin({ isGraphQL, payload, strategyName = 'local-jwt' }) {
|
|
|
27
27
|
const user = (await payload.find({
|
|
28
28
|
collection: collection.config.slug,
|
|
29
29
|
depth: isGraphQL ? 0 : collection.config.auth.depth,
|
|
30
|
+
limit: 1,
|
|
31
|
+
pagination: false,
|
|
30
32
|
where
|
|
31
33
|
})).docs[0];
|
|
32
34
|
if (!user) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/strategies/jwt.ts"],"sourcesContent":["// @ts-strict-ignore\nimport { jwtVerify } from 'jose'\n\nimport type { Payload, Where } from '../../types/index.js'\nimport type { AuthStrategyFunction, User } from '../index.js'\n\nimport { extractJWT } from '../extractJWT.js'\n\ntype JWTToken = {\n collection: string\n id: string\n}\n\nasync function autoLogin({\n isGraphQL,\n payload,\n strategyName = 'local-jwt',\n}: {\n isGraphQL: boolean\n payload: Payload\n strategyName?: string\n}): Promise<{\n user: null | User\n}> {\n if (\n typeof payload?.config?.admin?.autoLogin !== 'object' ||\n payload.config.admin?.autoLogin.prefillOnly ||\n !payload?.config?.admin?.autoLogin ||\n (!payload.config.admin?.autoLogin.email && !payload.config.admin?.autoLogin.username)\n ) {\n return { user: null }\n }\n\n const collection = payload.collections[payload.config.admin.user]\n\n const where: Where = {\n or: [],\n }\n if (payload.config.admin?.autoLogin.email) {\n where.or?.push({\n email: {\n equals: payload.config.admin?.autoLogin.email,\n },\n })\n } else if (payload.config.admin?.autoLogin.username) {\n where.or?.push({\n username: {\n equals: payload.config.admin?.autoLogin.username,\n },\n })\n }\n\n const user = (\n await payload.find({\n collection: collection.config.slug,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n where,\n })\n ).docs[0]\n\n if (!user) {\n return { user: null }\n }\n user.collection = collection.config.slug\n user._strategy = strategyName\n\n return {\n user: user as User,\n }\n}\n\n/**\n * Authentication strategy function for JWT tokens\n */\nexport const JWTAuthentication: AuthStrategyFunction = async ({\n headers,\n isGraphQL = false,\n payload,\n strategyName = 'local-jwt',\n}) => {\n try {\n const token = extractJWT({ headers, payload })\n\n if (!token) {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n\n const secretKey = new TextEncoder().encode(payload.secret)\n const { payload: decodedPayload } = await jwtVerify<JWTToken>(token, secretKey)\n const collection = payload.collections[decodedPayload.collection]\n\n const user = await payload.findByID({\n id: decodedPayload.id,\n collection: decodedPayload.collection,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n })\n\n if (user && (!collection.config.auth.verify || user._verified)) {\n user.collection = collection.config.slug\n user._strategy = strategyName\n return {\n user: user as User,\n }\n } else {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n } catch (ignore) {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n}\n"],"names":["jwtVerify","extractJWT","autoLogin","isGraphQL","payload","strategyName","config","admin","prefillOnly","email","username","user","collection","collections","where","or","push","equals","find","slug","depth","auth","docs","_strategy","JWTAuthentication","headers","token","get","secretKey","TextEncoder","encode","secret","decodedPayload","findByID","id","verify","_verified","ignore"],"mappings":"AAAA,oBAAoB;AACpB,SAASA,SAAS,QAAQ,OAAM;AAKhC,SAASC,UAAU,QAAQ,mBAAkB;AAO7C,eAAeC,UAAU,EACvBC,SAAS,EACTC,OAAO,EACPC,eAAe,WAAW,EAK3B;IAGC,IACE,OAAOD,SAASE,QAAQC,OAAOL,cAAc,YAC7CE,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUM,eAChC,CAACJ,SAASE,QAAQC,OAAOL,aACxB,CAACE,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUO,SAAS,CAACL,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUQ,UAC5E;QACA,OAAO;YAAEC,MAAM;QAAK;IACtB;IAEA,MAAMC,aAAaR,QAAQS,WAAW,CAACT,QAAQE,MAAM,CAACC,KAAK,CAACI,IAAI,CAAC;IAEjE,MAAMG,QAAe;QACnBC,IAAI,EAAE;IACR;IACA,IAAIX,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUO,OAAO;QACzCK,MAAMC,EAAE,EAAEC,KAAK;YACbP,OAAO;gBACLQ,QAAQb,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUO;YAC1C;QACF;IACF,OAAO,IAAIL,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUQ,UAAU;QACnDI,MAAMC,EAAE,EAAEC,KAAK;YACbN,UAAU;gBACRO,QAAQb,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUQ;YAC1C;QACF;IACF;IAEA,MAAMC,OAAO,AACX,CAAA,MAAMP,QAAQc,IAAI,CAAC;QACjBN,YAAYA,WAAWN,MAAM,CAACa,IAAI;QAClCC,OAAOjB,YAAY,IAAIS,WAAWN,MAAM,CAACe,IAAI,CAACD,KAAK;
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/strategies/jwt.ts"],"sourcesContent":["// @ts-strict-ignore\nimport { jwtVerify } from 'jose'\n\nimport type { Payload, Where } from '../../types/index.js'\nimport type { AuthStrategyFunction, User } from '../index.js'\n\nimport { extractJWT } from '../extractJWT.js'\n\ntype JWTToken = {\n collection: string\n id: string\n}\n\nasync function autoLogin({\n isGraphQL,\n payload,\n strategyName = 'local-jwt',\n}: {\n isGraphQL: boolean\n payload: Payload\n strategyName?: string\n}): Promise<{\n user: null | User\n}> {\n if (\n typeof payload?.config?.admin?.autoLogin !== 'object' ||\n payload.config.admin?.autoLogin.prefillOnly ||\n !payload?.config?.admin?.autoLogin ||\n (!payload.config.admin?.autoLogin.email && !payload.config.admin?.autoLogin.username)\n ) {\n return { user: null }\n }\n\n const collection = payload.collections[payload.config.admin.user]\n\n const where: Where = {\n or: [],\n }\n if (payload.config.admin?.autoLogin.email) {\n where.or?.push({\n email: {\n equals: payload.config.admin?.autoLogin.email,\n },\n })\n } else if (payload.config.admin?.autoLogin.username) {\n where.or?.push({\n username: {\n equals: payload.config.admin?.autoLogin.username,\n },\n })\n }\n\n const user = (\n await payload.find({\n collection: collection.config.slug,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n limit: 1,\n pagination: false,\n where,\n })\n ).docs[0]\n\n if (!user) {\n return { user: null }\n }\n user.collection = collection.config.slug\n user._strategy = strategyName\n\n return {\n user: user as User,\n }\n}\n\n/**\n * Authentication strategy function for JWT tokens\n */\nexport const JWTAuthentication: AuthStrategyFunction = async ({\n headers,\n isGraphQL = false,\n payload,\n strategyName = 'local-jwt',\n}) => {\n try {\n const token = extractJWT({ headers, payload })\n\n if (!token) {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n\n const secretKey = new TextEncoder().encode(payload.secret)\n const { payload: decodedPayload } = await jwtVerify<JWTToken>(token, secretKey)\n const collection = payload.collections[decodedPayload.collection]\n\n const user = await payload.findByID({\n id: decodedPayload.id,\n collection: decodedPayload.collection,\n depth: isGraphQL ? 0 : collection.config.auth.depth,\n })\n\n if (user && (!collection.config.auth.verify || user._verified)) {\n user.collection = collection.config.slug\n user._strategy = strategyName\n return {\n user: user as User,\n }\n } else {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n } catch (ignore) {\n if (headers.get('DisableAutologin') !== 'true') {\n return await autoLogin({ isGraphQL, payload, strategyName })\n }\n return { user: null }\n }\n}\n"],"names":["jwtVerify","extractJWT","autoLogin","isGraphQL","payload","strategyName","config","admin","prefillOnly","email","username","user","collection","collections","where","or","push","equals","find","slug","depth","auth","limit","pagination","docs","_strategy","JWTAuthentication","headers","token","get","secretKey","TextEncoder","encode","secret","decodedPayload","findByID","id","verify","_verified","ignore"],"mappings":"AAAA,oBAAoB;AACpB,SAASA,SAAS,QAAQ,OAAM;AAKhC,SAASC,UAAU,QAAQ,mBAAkB;AAO7C,eAAeC,UAAU,EACvBC,SAAS,EACTC,OAAO,EACPC,eAAe,WAAW,EAK3B;IAGC,IACE,OAAOD,SAASE,QAAQC,OAAOL,cAAc,YAC7CE,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUM,eAChC,CAACJ,SAASE,QAAQC,OAAOL,aACxB,CAACE,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUO,SAAS,CAACL,QAAQE,MAAM,CAACC,KAAK,EAAEL,UAAUQ,UAC5E;QACA,OAAO;YAAEC,MAAM;QAAK;IACtB;IAEA,MAAMC,aAAaR,QAAQS,WAAW,CAACT,QAAQE,MAAM,CAACC,KAAK,CAACI,IAAI,CAAC;IAEjE,MAAMG,QAAe;QACnBC,IAAI,EAAE;IACR;IACA,IAAIX,QAAQE,MAAM,CAACC,KAAK,EAAEL,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AQS,WAAW,CAACqB,eAAetB,UAAU,CAAC;QAEjE,MAAMD,OAAO,MAAMP,QAAQ+B,QAAQ,CAAC;YAClCC,IAAIF,eAAeE,EAAE;YACrBxB,YAAYsB,eAAetB,UAAU;YACrCQ,OAAOjB,YAAY,IAAIS,WAAWN,MAAM,CAACe,IAAI,CAACD,KAAK;QACrD;QAEA,IAAIT,QAAS,CAAA,CAACC,WAAWN,MAAM,CAACe,IAAI,CAACgB,MAAM,IAAI1B,KAAK2B,SAAS,AAAD,GAAI;YAC9D3B,KAAKC,UAAU,GAAGA,WAAWN,MAAM,CAACa,IAAI;YACxCR,KAAKc,SAAS,GAAGpB;YACjB,OAAO;gBACLM,MAAMA;YACR;QACF,OAAO;YACL,IAAIgB,QAAQE,GAAG,CAAC,wBAAwB,QAAQ;gBAC9C,OAAO,MAAM3B,UAAU;oBAAEC;oBAAWC;oBAASC;gBAAa;YAC5D;YACA,OAAO;gBAAEM,MAAM;YAAK;QACtB;IACF,EAAE,OAAO4B,QAAQ;QACf,IAAIZ,QAAQE,GAAG,CAAC,wBAAwB,QAAQ;YAC9C,OAAO,MAAM3B,UAAU;gBAAEC;gBAAWC;gBAASC;YAAa;QAC5D;QACA,OAAO;YAAEM,MAAM;QAAK;IACtB;AACF,EAAC"}
|
package/dist/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,GAAG,qBA0If,CAAA"}
|
package/dist/bin/index.js
CHANGED
|
@@ -63,8 +63,15 @@ export const bin = async ()=>{
|
|
|
63
63
|
const userBinScript = Array.isArray(config.bin) ? config.bin.find(({ key })=>key === script) : false;
|
|
64
64
|
if (userBinScript) {
|
|
65
65
|
try {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const module = await import(pathToFileURL(userBinScript.scriptPath).toString());
|
|
67
|
+
if (!module.script || typeof module.script !== 'function') {
|
|
68
|
+
console.error(`Could not find "script" function export for script ${userBinScript.key} in ${userBinScript.scriptPath}`);
|
|
69
|
+
} else {
|
|
70
|
+
await module.script(config).catch((err)=>{
|
|
71
|
+
console.log(`Script ${userBinScript.key} failed, details:`);
|
|
72
|
+
console.error(err);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
68
75
|
} catch (err) {
|
|
69
76
|
console.log(`Could not find associated bin script for the ${userBinScript.key} command`);
|
|
70
77
|
console.error(err);
|
package/dist/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["// @ts-strict-ignore\n/* eslint-disable no-console */\nimport { Cron } from 'croner'\nimport minimist from 'minimist'\nimport { pathToFileURL } from 'node:url'\nimport path from 'path'\n\nimport type { BinScript } from '../config/types.js'\n\nimport { findConfig } from '../config/find.js'\nimport payload, { getPayload } from '../index.js'\nimport { generateImportMap } from './generateImportMap/index.js'\nimport { generateTypes } from './generateTypes.js'\nimport { info } from './info.js'\nimport { loadEnv } from './loadEnv.js'\nimport { migrate, availableCommands as migrateCommands } from './migrate.js'\n\n// Note: this does not account for any user bin scripts\nconst availableScripts = [\n 'generate:db-schema',\n 'generate:importmap',\n 'generate:types',\n 'info',\n 'jobs:run',\n 'run',\n ...migrateCommands,\n] as const\n\nexport const bin = async () => {\n loadEnv()\n\n const args = minimist(process.argv.slice(2))\n const script = (typeof args._[0] === 'string' ? args._[0] : '').toLowerCase()\n\n if (script === 'info') {\n await info()\n return\n }\n\n if (script === 'run') {\n const scriptPath = args._[1]\n if (!scriptPath) {\n console.error('Please provide a script path to run.')\n process.exit(1)\n }\n\n const absoluteScriptPath = path.resolve(process.cwd(), scriptPath)\n\n // Modify process.argv to remove 'run' and the script path\n const originalArgv = process.argv\n process.argv = [process.argv[0], process.argv[1], ...args._.slice(2)]\n\n try {\n await import(pathToFileURL(absoluteScriptPath).toString())\n } catch (error) {\n console.error(`Error running script: ${absoluteScriptPath}`)\n console.error(error)\n process.exit(1)\n } finally {\n // Restore original process.argv\n process.argv = originalArgv\n }\n return\n }\n\n const configPath = findConfig()\n const configPromise = await import(pathToFileURL(configPath).toString())\n let config = await configPromise\n if (config.default) {\n config = await config.default\n }\n\n const userBinScript = Array.isArray(config.bin)\n ? config.bin.find(({ key }) => key === script)\n : false\n\n if (userBinScript) {\n try {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["// @ts-strict-ignore\n/* eslint-disable no-console */\nimport { Cron } from 'croner'\nimport minimist from 'minimist'\nimport { pathToFileURL } from 'node:url'\nimport path from 'path'\n\nimport type { BinScript } from '../config/types.js'\n\nimport { findConfig } from '../config/find.js'\nimport payload, { getPayload } from '../index.js'\nimport { generateImportMap } from './generateImportMap/index.js'\nimport { generateTypes } from './generateTypes.js'\nimport { info } from './info.js'\nimport { loadEnv } from './loadEnv.js'\nimport { migrate, availableCommands as migrateCommands } from './migrate.js'\n\n// Note: this does not account for any user bin scripts\nconst availableScripts = [\n 'generate:db-schema',\n 'generate:importmap',\n 'generate:types',\n 'info',\n 'jobs:run',\n 'run',\n ...migrateCommands,\n] as const\n\nexport const bin = async () => {\n loadEnv()\n\n const args = minimist(process.argv.slice(2))\n const script = (typeof args._[0] === 'string' ? args._[0] : '').toLowerCase()\n\n if (script === 'info') {\n await info()\n return\n }\n\n if (script === 'run') {\n const scriptPath = args._[1]\n if (!scriptPath) {\n console.error('Please provide a script path to run.')\n process.exit(1)\n }\n\n const absoluteScriptPath = path.resolve(process.cwd(), scriptPath)\n\n // Modify process.argv to remove 'run' and the script path\n const originalArgv = process.argv\n process.argv = [process.argv[0], process.argv[1], ...args._.slice(2)]\n\n try {\n await import(pathToFileURL(absoluteScriptPath).toString())\n } catch (error) {\n console.error(`Error running script: ${absoluteScriptPath}`)\n console.error(error)\n process.exit(1)\n } finally {\n // Restore original process.argv\n process.argv = originalArgv\n }\n return\n }\n\n const configPath = findConfig()\n const configPromise = await import(pathToFileURL(configPath).toString())\n let config = await configPromise\n if (config.default) {\n config = await config.default\n }\n\n const userBinScript = Array.isArray(config.bin)\n ? config.bin.find(({ key }) => key === script)\n : false\n\n if (userBinScript) {\n try {\n const module = await import(pathToFileURL(userBinScript.scriptPath).toString())\n\n if (!module.script || typeof module.script !== 'function') {\n console.error(\n `Could not find \"script\" function export for script ${userBinScript.key} in ${userBinScript.scriptPath}`,\n )\n } else {\n await module.script(config).catch((err: unknown) => {\n console.log(`Script ${userBinScript.key} failed, details:`)\n console.error(err)\n })\n }\n } catch (err) {\n console.log(`Could not find associated bin script for the ${userBinScript.key} command`)\n console.error(err)\n }\n\n return\n }\n\n if (script.startsWith('migrate')) {\n return migrate({ config, parsedArgs: args }).then(() => process.exit(0))\n }\n\n if (script === 'generate:types') {\n return generateTypes(config)\n }\n\n if (script === 'generate:importmap') {\n return generateImportMap(config)\n }\n\n if (script === 'jobs:run') {\n const payload = await getPayload({ config })\n const limit = args.limit ? parseInt(args.limit, 10) : undefined\n const queue = args.queue ? args.queue : undefined\n\n if (args.cron) {\n new Cron(args.cron, async () => {\n await payload.jobs.run({\n limit,\n queue,\n })\n })\n\n process.stdin.resume() // Keep the process alive\n\n return\n } else {\n await payload.jobs.run({\n limit,\n queue,\n })\n\n await payload.db.destroy() // close database connections after running jobs so process can exit cleanly\n\n return\n }\n }\n\n if (script === 'generate:db-schema') {\n // Barebones instance to access database adapter, without connecting to the DB\n await payload.init({\n config,\n disableDBConnect: true,\n disableOnInit: true,\n })\n\n if (typeof payload.db.generateSchema !== 'function') {\n payload.logger.error({\n msg: `${payload.db.packageName} does not support database schema generation`,\n })\n\n process.exit(1)\n }\n\n await payload.db.generateSchema({\n log: args.log === 'false' ? false : true,\n prettify: args.prettify === 'false' ? false : true,\n })\n\n process.exit(0)\n }\n\n console.error(script ? `Unknown command: \"${script}\"` : 'Please provide a command to run')\n console.log(`\\nAvailable commands:\\n${availableScripts.map((c) => ` - ${c}`).join('\\n')}`)\n\n process.exit(1)\n}\n"],"names":["Cron","minimist","pathToFileURL","path","findConfig","payload","getPayload","generateImportMap","generateTypes","info","loadEnv","migrate","availableCommands","migrateCommands","availableScripts","bin","args","process","argv","slice","script","_","toLowerCase","scriptPath","console","error","exit","absoluteScriptPath","resolve","cwd","originalArgv","toString","configPath","configPromise","config","default","userBinScript","Array","isArray","find","key","module","catch","err","log","startsWith","parsedArgs","then","limit","parseInt","undefined","queue","cron","jobs","run","stdin","resume","db","destroy","init","disableDBConnect","disableOnInit","generateSchema","logger","msg","packageName","prettify","map","c","join"],"mappings":"AAAA,oBAAoB;AACpB,6BAA6B,GAC7B,SAASA,IAAI,QAAQ,SAAQ;AAC7B,OAAOC,cAAc,WAAU;AAC/B,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM;AAIvB,SAASC,UAAU,QAAQ,oBAAmB;AAC9C,OAAOC,WAAWC,UAAU,QAAQ,cAAa;AACjD,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,OAAO,EAAEC,qBAAqBC,eAAe,QAAQ,eAAc;AAE5E,uDAAuD;AACvD,MAAMC,mBAAmB;IACvB;IACA;IACA;IACA;IACA;IACA;OACGD;CACJ;AAED,OAAO,MAAME,MAAM;IACjBL;IAEA,MAAMM,OAAOf,SAASgB,QAAQC,IAAI,CAACC,KAAK,CAAC;IACzC,MAAMC,SAAS,AAAC,CAAA,OAAOJ,KAAKK,CAAC,CAAC,EAAE,KAAK,WAAWL,KAAKK,CAAC,CAAC,EAAE,GAAG,EAAC,EAAGC,WAAW;IAE3E,IAAIF,WAAW,QAAQ;QACrB,MAAMX;QACN;IACF;IAEA,IAAIW,WAAW,OAAO;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AsB;QACnC,8EAA8E;QAC9E,MAAMf,QAAQsD,IAAI,CAAC;YACjBzB;YACA0B,kBAAkB;YAClBC,eAAe;QACjB;QAEA,IAAI,OAAOxD,QAAQoD,EAAE,CAACK,cAAc,KAAK,YAAY;YACnDzD,QAAQ0D,MAAM,CAACtC,KAAK,CAAC;gBACnBuC,KAAK,GAAG3D,QAAQoD,EAAE,CAACQ,WAAW,CAAC,4CAA4C,CAAC;YAC9E;YAEAhD,QAAQS,IAAI,CAAC;QACf;QAEA,MAAMrB,QAAQoD,EAAE,CAACK,cAAc,CAAC;YAC9BlB,KAAK5B,KAAK4B,GAAG,KAAK,UAAU,QAAQ;YACpCsB,UAAUlD,KAAKkD,QAAQ,KAAK,UAAU,QAAQ;QAChD;QAEAjD,QAAQS,IAAI,CAAC;IACf;IAEAF,QAAQC,KAAK,CAACL,SAAS,CAAC,kBAAkB,EAAEA,OAAO,CAAC,CAAC,GAAG;IACxDI,QAAQoB,GAAG,CAAC,CAAC,uBAAuB,EAAE9B,iBAAiBqD,GAAG,CAAC,CAACC,IAAM,CAAC,IAAI,EAAEA,GAAG,EAAEC,IAAI,CAAC,OAAO;IAE1FpD,QAAQS,IAAI,CAAC;AACf,EAAC"}
|
|
@@ -1,17 +1,47 @@
|
|
|
1
1
|
import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
|
|
2
2
|
import type { Document, PayloadRequest, Where } from '../../../types/index.js';
|
|
3
3
|
export type Options<TSlug extends CollectionSlug> = {
|
|
4
|
+
/**
|
|
5
|
+
* the Collection slug to operate against.
|
|
6
|
+
*/
|
|
4
7
|
collection: TSlug;
|
|
5
8
|
/**
|
|
6
|
-
* context, which will then be passed to req.context
|
|
9
|
+
* [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
|
|
10
|
+
* which can be read by hooks. Useful if you want to pass additional information to the hooks which
|
|
11
|
+
* shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
|
|
12
|
+
* to determine if it should run or not.
|
|
7
13
|
*/
|
|
8
14
|
context?: RequestContext;
|
|
15
|
+
/**
|
|
16
|
+
* [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
|
|
17
|
+
*/
|
|
9
18
|
depth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When set to `true`, errors will not be thrown.
|
|
21
|
+
*/
|
|
10
22
|
disableErrors?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
|
|
25
|
+
*/
|
|
11
26
|
locale?: TypedLocale;
|
|
27
|
+
/**
|
|
28
|
+
* Skip access control.
|
|
29
|
+
* Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
12
32
|
overrideAccess?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
|
|
35
|
+
* Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
|
|
36
|
+
*/
|
|
13
37
|
req?: Partial<PayloadRequest>;
|
|
38
|
+
/**
|
|
39
|
+
* If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
|
|
40
|
+
*/
|
|
14
41
|
user?: Document;
|
|
42
|
+
/**
|
|
43
|
+
* A filter [query](https://payloadcms.com/docs/queries/overview)
|
|
44
|
+
*/
|
|
15
45
|
where?: Where;
|
|
16
46
|
};
|
|
17
47
|
export default function countLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAM9E,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD,UAAU,EAAE,KAAK,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAM9E,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAGD,wBAA8B,UAAU,CAAC,KAAK,SAAS,cAAc,EACnE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/collections/operations/local/count.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countOperation } from '../count.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n collection: TSlug\n /**\n * context, which will then be passed to req.context
|
|
1
|
+
{"version":3,"sources":["../../../../src/collections/operations/local/count.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countOperation } from '../count.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\n// eslint-disable-next-line no-restricted-exports\nexport default async function countLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<{ totalDocs: number }> {\n const { collection: collectionSlug, disableErrors, overrideAccess = true, where } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Count Operation.`,\n )\n }\n\n return countOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options, payload),\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countOperation","countLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","where","collections","String","req"],"mappings":"AAAA,oBAAoB;AAIpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,cAAa;AA+C5C,iDAAiD;AACjD,eAAe,eAAeC,WAC5BC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EAAEC,YAAYC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAEpF,MAAMC,aAAaF,QAAQO,WAAW,CAACJ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEY,OAAOL,gBAAgB,iCAAiC,CAAC;IAEzF;IAEA,OAAOL,eAAsB;QAC3BI;QACAE;QACAC;QACAI,KAAK,MAAMZ,eAAeI,SAASD;QACnCM;IACF;AACF"}
|
|
@@ -1,17 +1,47 @@
|
|
|
1
1
|
import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
|
|
2
2
|
import type { Document, PayloadRequest, Where } from '../../../types/index.js';
|
|
3
3
|
export type Options<TSlug extends CollectionSlug> = {
|
|
4
|
+
/**
|
|
5
|
+
* the Collection slug to operate against.
|
|
6
|
+
*/
|
|
4
7
|
collection: TSlug;
|
|
5
8
|
/**
|
|
6
|
-
* context, which will then be passed to req.context
|
|
9
|
+
* [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
|
|
10
|
+
* which can be read by hooks. Useful if you want to pass additional information to the hooks which
|
|
11
|
+
* shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
|
|
12
|
+
* to determine if it should run or not.
|
|
7
13
|
*/
|
|
8
14
|
context?: RequestContext;
|
|
15
|
+
/**
|
|
16
|
+
* [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
|
|
17
|
+
*/
|
|
9
18
|
depth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When set to `true`, errors will not be thrown.
|
|
21
|
+
*/
|
|
10
22
|
disableErrors?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
|
|
25
|
+
*/
|
|
11
26
|
locale?: TypedLocale;
|
|
27
|
+
/**
|
|
28
|
+
* Skip access control.
|
|
29
|
+
* Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
12
32
|
overrideAccess?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
|
|
35
|
+
* Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
|
|
36
|
+
*/
|
|
13
37
|
req?: Partial<PayloadRequest>;
|
|
38
|
+
/**
|
|
39
|
+
* If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
|
|
40
|
+
*/
|
|
14
41
|
user?: Document;
|
|
42
|
+
/**
|
|
43
|
+
* A filter [query](https://payloadcms.com/docs/queries/overview)
|
|
44
|
+
*/
|
|
15
45
|
where?: Where;
|
|
16
46
|
};
|
|
17
47
|
export default function countVersionsLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/countVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAM9E,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD,UAAU,EAAE,KAAK,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/countVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAM9E,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAGD,wBAA8B,kBAAkB,CAAC,KAAK,SAAS,cAAc,EAC3E,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/collections/operations/local/countVersions.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countVersionsOperation } from '../countVersions.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n collection: TSlug\n /**\n * context, which will then be passed to req.context
|
|
1
|
+
{"version":3,"sources":["../../../../src/collections/operations/local/countVersions.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countVersionsOperation } from '../countVersions.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\n// eslint-disable-next-line no-restricted-exports\nexport default async function countVersionsLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<{ totalDocs: number }> {\n const { collection: collectionSlug, disableErrors, overrideAccess = true, where } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Count Versions Operation.`,\n )\n }\n\n return countVersionsOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options, payload),\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countVersionsOperation","countVersionsLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","where","collections","String","req"],"mappings":"AAAA,oBAAoB;AAIpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,sBAAsB,QAAQ,sBAAqB;AA+C5D,iDAAiD;AACjD,eAAe,eAAeC,mBAC5BC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EAAEC,YAAYC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAEpF,MAAMC,aAAaF,QAAQO,WAAW,CAACJ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEY,OAAOL,gBAAgB,0CAA0C,CAAC;IAElG;IAEA,OAAOL,uBAA8B;QACnCI;QACAE;QACAC;QACAI,KAAK,MAAMZ,eAAeI,SAASD;QACnCM;IACF;AACF"}
|
|
@@ -3,27 +3,92 @@ import type { File } from '../../../uploads/types.js';
|
|
|
3
3
|
import type { DataFromCollectionSlug, RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
|
|
4
4
|
import { type CollectionSlug, type Payload, type RequestContext, type TypedLocale } from '../../../index.js';
|
|
5
5
|
export type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = {
|
|
6
|
+
/**
|
|
7
|
+
* the Collection slug to operate against.
|
|
8
|
+
*/
|
|
6
9
|
collection: TSlug;
|
|
7
10
|
/**
|
|
8
|
-
* context, which will then be passed to req.context
|
|
11
|
+
* [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
|
|
12
|
+
* which can be read by hooks. Useful if you want to pass additional information to the hooks which
|
|
13
|
+
* shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
|
|
14
|
+
* to determine if it should run or not.
|
|
9
15
|
*/
|
|
10
16
|
context?: RequestContext;
|
|
17
|
+
/**
|
|
18
|
+
* The data for the document to create.
|
|
19
|
+
*/
|
|
11
20
|
data: RequiredDataFromCollectionSlug<TSlug>;
|
|
21
|
+
/**
|
|
22
|
+
* [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
|
|
23
|
+
*/
|
|
12
24
|
depth?: number;
|
|
25
|
+
/**
|
|
26
|
+
* When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
13
29
|
disableTransaction?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* If creating verification-enabled auth doc,
|
|
32
|
+
* you can disable the email that is auto-sent
|
|
33
|
+
*/
|
|
14
34
|
disableVerificationEmail?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
|
|
37
|
+
*/
|
|
15
38
|
draft?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* If you want to create a document that is a duplicate of another document
|
|
41
|
+
*/
|
|
16
42
|
duplicateFromID?: DataFromCollectionSlug<TSlug>['id'];
|
|
43
|
+
/**
|
|
44
|
+
* Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
|
|
45
|
+
*/
|
|
17
46
|
fallbackLocale?: false | TypedLocale;
|
|
47
|
+
/**
|
|
48
|
+
* A `File` object when creating a collection with `upload: true`.
|
|
49
|
+
*/
|
|
18
50
|
file?: File;
|
|
51
|
+
/**
|
|
52
|
+
* A file path when creating a collection with `upload: true`.
|
|
53
|
+
*/
|
|
19
54
|
filePath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
|
|
57
|
+
*/
|
|
20
58
|
locale?: TypedLocale;
|
|
59
|
+
/**
|
|
60
|
+
* Skip access control.
|
|
61
|
+
* Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
21
64
|
overrideAccess?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* If you are uploading a file and would like to replace
|
|
67
|
+
* the existing file instead of generating a new filename,
|
|
68
|
+
* you can set the following property to `true`
|
|
69
|
+
*/
|
|
22
70
|
overwriteExistingFiles?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
|
|
73
|
+
*/
|
|
23
74
|
populate?: PopulateType;
|
|
75
|
+
/**
|
|
76
|
+
* The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
|
|
77
|
+
* Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
|
|
78
|
+
*/
|
|
24
79
|
req?: Partial<PayloadRequest>;
|
|
80
|
+
/**
|
|
81
|
+
* Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
|
|
82
|
+
*/
|
|
25
83
|
select?: TSelect;
|
|
84
|
+
/**
|
|
85
|
+
* Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
26
88
|
showHiddenFields?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
|
|
91
|
+
*/
|
|
27
92
|
user?: Document;
|
|
28
93
|
};
|
|
29
94
|
export default function createLocal<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(payload: Payload, options: Options<TSlug, TSelect>): Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAK1B,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAC9E,UAAU,EAAE,KAAK,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,EACV,sBAAsB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;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA;AAGD,wBAA8B,WAAW,CACvC,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CA2CxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/collections/operations/local/create.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type {\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n type CollectionSlug,\n deepCopyObjectSimple,\n type Payload,\n type RequestContext,\n type TypedLocale,\n} from '../../../index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { createOperation } from '../create.js'\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n collection: TSlug\n /**\n * context, which will then be passed to req.context
|
|
1
|
+
{"version":3,"sources":["../../../../src/collections/operations/local/create.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type {\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n type CollectionSlug,\n deepCopyObjectSimple,\n type Payload,\n type RequestContext,\n type TypedLocale,\n} from '../../../index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { createOperation } from '../create.js'\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The data for the document to create.\n */\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * If creating verification-enabled auth doc,\n * you can disable the email that is auto-sent\n */\n disableVerificationEmail?: boolean\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n /**\n * If you want to create a document that is a duplicate of another document\n */\n duplicateFromID?: DataFromCollectionSlug<TSlug>['id']\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when creating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\n// eslint-disable-next-line no-restricted-exports\nexport default async function createLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n file,\n filePath,\n overrideAccess = true,\n overwriteExistingFiles = false,\n populate,\n select,\n showHiddenFields,\n } = options\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Create Operation.`,\n )\n }\n\n const req = await createLocalReq(options, payload)\n req.file = file ?? (await getFileByPath(filePath))\n\n return createOperation<TSlug, TSelect>({\n collection,\n data: deepCopyObjectSimple(data), // Ensure mutation of data in create operation hooks doesn't affect the original data\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n overrideAccess,\n overwriteExistingFiles,\n populate,\n req,\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","deepCopyObjectSimple","getFileByPath","createLocalReq","createOperation","createLocal","payload","options","collection","collectionSlug","data","depth","disableTransaction","disableVerificationEmail","draft","duplicateFromID","file","filePath","overrideAccess","overwriteExistingFiles","populate","select","showHiddenFields","collections","String","req"],"mappings":"AAAA,oBAAoB;AAepB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAEEC,oBAAoB,QAIf,oBAAmB;AAC1B,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AA4F9C,iDAAiD;AACjD,eAAe,eAAeC,YAI5BC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,wBAAwB,EACxBC,KAAK,EACLC,eAAe,EACfC,IAAI,EACJC,QAAQ,EACRC,iBAAiB,IAAI,EACrBC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGf;IACJ,MAAMC,aAAaF,QAAQiB,WAAW,CAACd,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEwB,OAAOf,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMgB,MAAM,MAAMtB,eAAeI,SAASD;IAC1CmB,IAAIT,IAAI,GAAGA,QAAS,MAAMd,cAAce;IAExC,OAAOb,gBAAgC;QACrCI;QACAE,MAAMT,qBAAqBS;QAC3BC;QACAC;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAK;QACAJ;QACAC;IACF;AACF"}
|
|
@@ -2,29 +2,86 @@ import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../..
|
|
|
2
2
|
import type { Document, PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect, Where } from '../../../types/index.js';
|
|
3
3
|
import type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js';
|
|
4
4
|
export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
|
|
5
|
+
/**
|
|
6
|
+
* the Collection slug to operate against.
|
|
7
|
+
*/
|
|
5
8
|
collection: TSlug;
|
|
6
9
|
/**
|
|
7
|
-
* context, which will then be passed to req.context
|
|
10
|
+
* [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
|
|
11
|
+
* which can be read by hooks. Useful if you want to pass additional information to the hooks which
|
|
12
|
+
* shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
|
|
13
|
+
* to determine if it should run or not.
|
|
8
14
|
*/
|
|
9
15
|
context?: RequestContext;
|
|
16
|
+
/**
|
|
17
|
+
* [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
|
|
18
|
+
*/
|
|
10
19
|
depth?: number;
|
|
20
|
+
/**
|
|
21
|
+
* When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
11
24
|
disableTransaction?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
|
|
27
|
+
*/
|
|
12
28
|
fallbackLocale?: false | TypedLocale;
|
|
29
|
+
/**
|
|
30
|
+
* Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
|
|
31
|
+
*/
|
|
13
32
|
locale?: TypedLocale;
|
|
33
|
+
/**
|
|
34
|
+
* Skip access control.
|
|
35
|
+
* Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
14
38
|
overrideAccess?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
15
43
|
overrideLock?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
|
|
46
|
+
*/
|
|
16
47
|
populate?: PopulateType;
|
|
48
|
+
/**
|
|
49
|
+
* The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
|
|
50
|
+
* Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
|
|
51
|
+
*/
|
|
17
52
|
req?: Partial<PayloadRequest>;
|
|
53
|
+
/**
|
|
54
|
+
* Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
|
|
55
|
+
*/
|
|
18
56
|
select?: TSelect;
|
|
57
|
+
/**
|
|
58
|
+
* Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
19
61
|
showHiddenFields?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
|
|
64
|
+
*/
|
|
20
65
|
user?: Document;
|
|
21
66
|
};
|
|
22
67
|
export type ByIDOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
|
|
68
|
+
/**
|
|
69
|
+
* The ID of the document to delete.
|
|
70
|
+
*/
|
|
23
71
|
id: number | string;
|
|
72
|
+
/**
|
|
73
|
+
* A filter [query](https://payloadcms.com/docs/queries/overview)
|
|
74
|
+
*/
|
|
24
75
|
where?: never;
|
|
25
76
|
} & BaseOptions<TSlug, TSelect>;
|
|
26
77
|
export type ManyOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
|
|
78
|
+
/**
|
|
79
|
+
* The ID of the document to delete.
|
|
80
|
+
*/
|
|
27
81
|
id?: never;
|
|
82
|
+
/**
|
|
83
|
+
* A filter [query](https://payloadcms.com/docs/queries/overview)
|
|
84
|
+
*/
|
|
28
85
|
where: Where;
|
|
29
86
|
} & BaseOptions<TSlug, TSelect>;
|
|
30
87
|
export type Options<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAO1F,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF,UAAU,EAAE,KAAK,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAO1F,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC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C,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACzD,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAC/C,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAiD/F,eAAe,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/collections/operations/local/delete.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { deleteOperation } from '../delete.js'\nimport { deleteByIDOperation } from '../deleteByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n collection: TSlug\n /**\n * context, which will then be passed to req.context
|
|
1
|
+
{"version":3,"sources":["../../../../src/collections/operations/local/delete.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { deleteOperation } from '../delete.js'\nimport { deleteByIDOperation } from '../deleteByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id: number | string\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n disableTransaction,\n overrideAccess = true,\n overrideLock,\n populate,\n select,\n showHiddenFields,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Delete Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n disableTransaction,\n overrideAccess,\n overrideLock,\n populate,\n req: await createLocalReq(options, payload),\n select,\n showHiddenFields,\n where,\n }\n\n if (options.id) {\n return deleteByIDOperation<TSlug, TSelect>(args)\n }\n return deleteOperation<TSlug, TSelect>(args)\n}\n\nexport default deleteLocal\n"],"names":["APIError","createLocalReq","deleteOperation","deleteByIDOperation","deleteLocal","payload","options","id","collection","collectionSlug","depth","disableTransaction","overrideAccess","overrideLock","populate","select","showHiddenFields","where","collections","String","args","req"],"mappings":"AAAA,oBAAoB;AAYpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AAwHtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,kBAAkB,EAClBC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,KAAK,EACN,GAAGX;IAEJ,MAAME,aAAaH,QAAQa,WAAW,CAACT,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEmB,OAAOV,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMW,OAAO;QACXb;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAO,KAAK,MAAMpB,eAAeK,SAASD;QACnCU;QACAC;QACAC;IACF;IAEA,IAAIX,QAAQC,EAAE,EAAE;QACd,OAAOJ,oBAAoCiB;IAC7C;IACA,OAAOlB,gBAAgCkB;AACzC;AAEA,eAAehB,YAAW"}
|