@payloadcms/drizzle 3.52.0-internal.8a9caef → 3.53.0-internal.2dadf5b
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/createGlobalVersion.d.ts +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +1 -2
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createVersion.d.ts +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +1 -2
- package/dist/createVersion.js.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +10 -11
- package/dist/queryDrafts.js.map +1 -1
- package/dist/utilities/buildIndexName.d.ts.map +1 -1
- package/dist/utilities/buildIndexName.js +5 -1
- package/dist/utilities/buildIndexName.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CreateGlobalVersionArgs, TypeWithID, TypeWithVersion } from 'payload';
|
|
2
2
|
import type { DrizzleAdapter } from './types.js';
|
|
3
|
-
export declare function createGlobalVersion<T extends TypeWithID>(this: DrizzleAdapter, { autosave, createdAt, globalSlug,
|
|
3
|
+
export declare function createGlobalVersion<T extends TypeWithID>(this: DrizzleAdapter, { autosave, createdAt, globalSlug, publishedLocale, req, returning, select, snapshot, updatedAt, versionData, }: CreateGlobalVersionArgs): Promise<TypeWithVersion<T>>;
|
|
4
4
|
//# sourceMappingURL=createGlobalVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,cAAc,EACpB,EACE,QAAQ,EACR,SAAS,EACT,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,cAAc,EACpB,EACE,QAAQ,EACR,SAAS,EACT,UAAU,EACV,eAAe,EACf,GAAG,EACH,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,uBAAuB,+BA4C3B"}
|
|
@@ -3,7 +3,7 @@ import { buildVersionGlobalFields } from 'payload';
|
|
|
3
3
|
import toSnakeCase from 'to-snake-case';
|
|
4
4
|
import { upsertRow } from './upsertRow/index.js';
|
|
5
5
|
import { getTransaction } from './utilities/getTransaction.js';
|
|
6
|
-
export async function createGlobalVersion({ autosave, createdAt, globalSlug,
|
|
6
|
+
export async function createGlobalVersion({ autosave, createdAt, globalSlug, publishedLocale, req, returning, select, snapshot, updatedAt, versionData }) {
|
|
7
7
|
const db = await getTransaction(this, req);
|
|
8
8
|
const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
|
|
9
9
|
const tableName = this.tableNameMap.get(`_${toSnakeCase(global.slug)}${this.versionsSuffix}`);
|
|
@@ -13,7 +13,6 @@ export async function createGlobalVersion({ autosave, createdAt, globalSlug, loc
|
|
|
13
13
|
autosave,
|
|
14
14
|
createdAt,
|
|
15
15
|
latest: true,
|
|
16
|
-
localeStatus,
|
|
17
16
|
publishedLocale,
|
|
18
17
|
snapshot,
|
|
19
18
|
updatedAt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import type { CreateGlobalVersionArgs, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { sql } from 'drizzle-orm'\nimport { buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\nimport { getTransaction } from './utilities/getTransaction.js'\n\nexport async function createGlobalVersion<T extends TypeWithID>(\n this: DrizzleAdapter,\n {\n autosave,\n createdAt,\n globalSlug,\n
|
|
1
|
+
{"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import type { CreateGlobalVersionArgs, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { sql } from 'drizzle-orm'\nimport { buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\nimport { getTransaction } from './utilities/getTransaction.js'\n\nexport async function createGlobalVersion<T extends TypeWithID>(\n this: DrizzleAdapter,\n {\n autosave,\n createdAt,\n globalSlug,\n publishedLocale,\n req,\n returning,\n select,\n snapshot,\n updatedAt,\n versionData,\n }: CreateGlobalVersionArgs,\n) {\n const db = await getTransaction(this, req)\n const global = this.payload.globals.config.find(({ slug }) => slug === globalSlug)\n\n const tableName = this.tableNameMap.get(`_${toSnakeCase(global.slug)}${this.versionsSuffix}`)\n\n const result = await upsertRow<TypeWithVersion<T>>({\n adapter: this,\n data: {\n autosave,\n createdAt,\n latest: true,\n publishedLocale,\n snapshot,\n updatedAt,\n version: versionData,\n },\n db,\n fields: buildVersionGlobalFields(this.payload.config, global, true),\n ignoreResult: returning === false ? 'idOnly' : false,\n operation: 'create',\n req,\n select,\n tableName,\n })\n\n const table = this.tables[tableName]\n if (global.versions.drafts) {\n await this.execute({\n db,\n sql: sql`\n UPDATE ${table}\n SET latest = false\n WHERE ${table.id} != ${result.id};\n `,\n })\n }\n\n if (returning === false) {\n return null\n }\n\n return result\n}\n"],"names":["sql","buildVersionGlobalFields","toSnakeCase","upsertRow","getTransaction","createGlobalVersion","autosave","createdAt","globalSlug","publishedLocale","req","returning","select","snapshot","updatedAt","versionData","db","global","payload","globals","config","find","slug","tableName","tableNameMap","get","versionsSuffix","result","adapter","data","latest","version","fields","ignoreResult","operation","table","tables","versions","drafts","execute","id"],"mappings":"AAEA,SAASA,GAAG,QAAQ,cAAa;AACjC,SAASC,wBAAwB,QAAQ,UAAS;AAClD,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAChD,SAASC,cAAc,QAAQ,gCAA+B;AAE9D,OAAO,eAAeC,oBAEpB,EACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,eAAe,EACfC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACa;IAE1B,MAAMC,KAAK,MAAMZ,eAAe,IAAI,EAAEM;IACtC,MAAMO,SAAS,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASd;IAEvE,MAAMe,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEvB,YAAYe,OAAOK,IAAI,IAAI,IAAI,CAACI,cAAc,EAAE;IAE5F,MAAMC,SAAS,MAAMxB,UAA8B;QACjDyB,SAAS,IAAI;QACbC,MAAM;YACJvB;YACAC;YACAuB,QAAQ;YACRrB;YACAI;YACAC;YACAiB,SAAShB;QACX;QACAC;QACAgB,QAAQ/B,yBAAyB,IAAI,CAACiB,OAAO,CAACE,MAAM,EAAEH,QAAQ;QAC9DgB,cAActB,cAAc,QAAQ,WAAW;QAC/CuB,WAAW;QACXxB;QACAE;QACAW;IACF;IAEA,MAAMY,QAAQ,IAAI,CAACC,MAAM,CAACb,UAAU;IACpC,IAAIN,OAAOoB,QAAQ,CAACC,MAAM,EAAE;QAC1B,MAAM,IAAI,CAACC,OAAO,CAAC;YACjBvB;YACAhB,KAAKA,GAAG,CAAC;iBACE,EAAEmC,MAAM;;gBAET,EAAEA,MAAMK,EAAE,CAAC,IAAI,EAAEb,OAAOa,EAAE,CAAC;QACnC,CAAC;QACL;IACF;IAEA,IAAI7B,cAAc,OAAO;QACvB,OAAO;IACT;IAEA,OAAOgB;AACT"}
|
package/dist/createVersion.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CreateVersionArgs, TypeWithID, TypeWithVersion } from 'payload';
|
|
2
2
|
import type { DrizzleAdapter } from './types.js';
|
|
3
|
-
export declare function createVersion<T extends TypeWithID>(this: DrizzleAdapter, { autosave, collectionSlug, createdAt,
|
|
3
|
+
export declare function createVersion<T extends TypeWithID>(this: DrizzleAdapter, { autosave, collectionSlug, createdAt, parent, publishedLocale, req, returning, select, snapshot, updatedAt, versionData, }: CreateVersionArgs<T>): Promise<TypeWithVersion<T>>;
|
|
4
4
|
//# sourceMappingURL=createVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAM7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,cAAc,EACpB,EACE,QAAQ,EACR,cAAc,EACd,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAM7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,cAAc,EACpB,EACE,QAAQ,EACR,cAAc,EACd,SAAS,EACT,MAAM,EACN,eAAe,EACf,GAAG,EACH,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAuDxB"}
|
package/dist/createVersion.js
CHANGED
|
@@ -3,7 +3,7 @@ import { buildVersionCollectionFields } from 'payload';
|
|
|
3
3
|
import toSnakeCase from 'to-snake-case';
|
|
4
4
|
import { upsertRow } from './upsertRow/index.js';
|
|
5
5
|
import { getTransaction } from './utilities/getTransaction.js';
|
|
6
|
-
export async function createVersion({ autosave, collectionSlug, createdAt,
|
|
6
|
+
export async function createVersion({ autosave, collectionSlug, createdAt, parent, publishedLocale, req, returning, select, snapshot, updatedAt, versionData }) {
|
|
7
7
|
const db = await getTransaction(this, req);
|
|
8
8
|
const collection = this.payload.collections[collectionSlug].config;
|
|
9
9
|
const defaultTableName = toSnakeCase(collection.slug);
|
|
@@ -18,7 +18,6 @@ export async function createVersion({ autosave, collectionSlug, createdAt, local
|
|
|
18
18
|
autosave,
|
|
19
19
|
createdAt,
|
|
20
20
|
latest: true,
|
|
21
|
-
localeStatus,
|
|
22
21
|
parent,
|
|
23
22
|
publishedLocale,
|
|
24
23
|
snapshot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/createVersion.ts"],"sourcesContent":["import type { CreateVersionArgs, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { sql } from 'drizzle-orm'\nimport { buildVersionCollectionFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\nimport { getTransaction } from './utilities/getTransaction.js'\n\nexport async function createVersion<T extends TypeWithID>(\n this: DrizzleAdapter,\n {\n autosave,\n collectionSlug,\n createdAt,\n
|
|
1
|
+
{"version":3,"sources":["../src/createVersion.ts"],"sourcesContent":["import type { CreateVersionArgs, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { sql } from 'drizzle-orm'\nimport { buildVersionCollectionFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\nimport { getTransaction } from './utilities/getTransaction.js'\n\nexport async function createVersion<T extends TypeWithID>(\n this: DrizzleAdapter,\n {\n autosave,\n collectionSlug,\n createdAt,\n parent,\n publishedLocale,\n req,\n returning,\n select,\n snapshot,\n updatedAt,\n versionData,\n }: CreateVersionArgs<T>,\n) {\n const db = await getTransaction(this, req)\n const collection = this.payload.collections[collectionSlug].config\n const defaultTableName = toSnakeCase(collection.slug)\n\n const tableName = this.tableNameMap.get(`_${defaultTableName}${this.versionsSuffix}`)\n\n const version = { ...versionData }\n if (version.id) {\n delete version.id\n }\n\n const data: Record<string, unknown> = {\n autosave,\n createdAt,\n latest: true,\n parent,\n publishedLocale,\n snapshot,\n updatedAt,\n version,\n }\n\n const result = await upsertRow<TypeWithVersion<T>>({\n adapter: this,\n data,\n db,\n fields: buildVersionCollectionFields(this.payload.config, collection, true),\n operation: 'create',\n req,\n select,\n tableName,\n })\n\n const table = this.tables[tableName]\n\n if (collection.versions.drafts) {\n await this.execute({\n db,\n sql: sql`\n UPDATE ${table}\n SET latest = false\n WHERE ${table.id} != ${result.id}\n AND ${table.parent} = ${parent}\n AND ${table.updatedAt} < ${result.updatedAt}\n `,\n })\n }\n\n if (returning === false) {\n return null\n }\n\n return result\n}\n"],"names":["sql","buildVersionCollectionFields","toSnakeCase","upsertRow","getTransaction","createVersion","autosave","collectionSlug","createdAt","parent","publishedLocale","req","returning","select","snapshot","updatedAt","versionData","db","collection","payload","collections","config","defaultTableName","slug","tableName","tableNameMap","get","versionsSuffix","version","id","data","latest","result","adapter","fields","operation","table","tables","versions","drafts","execute"],"mappings":"AAEA,SAASA,GAAG,QAAQ,cAAa;AACjC,SAASC,4BAA4B,QAAQ,UAAS;AACtD,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAChD,SAASC,cAAc,QAAQ,gCAA+B;AAE9D,OAAO,eAAeC,cAEpB,EACEC,QAAQ,EACRC,cAAc,EACdC,SAAS,EACTC,MAAM,EACNC,eAAe,EACfC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACU;IAEvB,MAAMC,KAAK,MAAMb,eAAe,IAAI,EAAEO;IACtC,MAAMO,aAAa,IAAI,CAACC,OAAO,CAACC,WAAW,CAACb,eAAe,CAACc,MAAM;IAClE,MAAMC,mBAAmBpB,YAAYgB,WAAWK,IAAI;IAEpD,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEJ,mBAAmB,IAAI,CAACK,cAAc,EAAE;IAEpF,MAAMC,UAAU;QAAE,GAAGZ,WAAW;IAAC;IACjC,IAAIY,QAAQC,EAAE,EAAE;QACd,OAAOD,QAAQC,EAAE;IACnB;IAEA,MAAMC,OAAgC;QACpCxB;QACAE;QACAuB,QAAQ;QACRtB;QACAC;QACAI;QACAC;QACAa;IACF;IAEA,MAAMI,SAAS,MAAM7B,UAA8B;QACjD8B,SAAS,IAAI;QACbH;QACAb;QACAiB,QAAQjC,6BAA6B,IAAI,CAACkB,OAAO,CAACE,MAAM,EAAEH,YAAY;QACtEiB,WAAW;QACXxB;QACAE;QACAW;IACF;IAEA,MAAMY,QAAQ,IAAI,CAACC,MAAM,CAACb,UAAU;IAEpC,IAAIN,WAAWoB,QAAQ,CAACC,MAAM,EAAE;QAC9B,MAAM,IAAI,CAACC,OAAO,CAAC;YACjBvB;YACAjB,KAAKA,GAAG,CAAC;eACA,EAAEoC,MAAM;;cAET,EAAEA,MAAMP,EAAE,CAAC,IAAI,EAAEG,OAAOH,EAAE,CAAC;cAC3B,EAAEO,MAAM3B,MAAM,CAAC,GAAG,EAAEA,OAAO;cAC3B,EAAE2B,MAAMrB,SAAS,CAAC,GAAG,EAAEiB,OAAOjB,SAAS,CAAC;MAChD,CAAC;QACH;IACF;IAEA,IAAIH,cAAc,OAAO;QACvB,OAAO;IACT;IAEA,OAAOoB;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,SAAS,CAAA;AASrE,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,SAAS,CAAA;AASrE,eAAO,MAAM,WAAW,EAAE,WAwCzB,CAAA"}
|
package/dist/queryDrafts.js
CHANGED
|
@@ -26,17 +26,16 @@ export const queryDrafts = async function queryDrafts({ collection, joins, limit
|
|
|
26
26
|
versions: true,
|
|
27
27
|
where: combinedWhere
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
29
|
+
return {
|
|
30
|
+
...result,
|
|
31
|
+
docs: result.docs.map((doc)=>{
|
|
32
|
+
doc = {
|
|
33
|
+
id: doc.parent,
|
|
34
|
+
...doc.version
|
|
35
|
+
};
|
|
36
|
+
return doc;
|
|
37
|
+
})
|
|
38
|
+
};
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=queryDrafts.js.map
|
package/dist/queryDrafts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/queryDrafts.ts"],"sourcesContent":["import type { QueryDrafts, SanitizedCollectionConfig } from 'payload'\n\nimport { buildVersionCollectionFields, combineQueries } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { findMany } from './find/findMany.js'\n\nexport const queryDrafts: QueryDrafts = async function queryDrafts(\n this: DrizzleAdapter,\n { collection, joins, limit, locale, page = 1, pagination, req, select, sort, where },\n) {\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`,\n )\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const combinedWhere = combineQueries({ latest: { equals: true } }, where)\n\n const result = await findMany({\n adapter: this,\n collectionSlug: collection,\n fields,\n joins,\n limit,\n locale,\n page,\n pagination,\n req,\n select,\n sort,\n tableName,\n versions: true,\n where: combinedWhere,\n })\n\n
|
|
1
|
+
{"version":3,"sources":["../src/queryDrafts.ts"],"sourcesContent":["import type { QueryDrafts, SanitizedCollectionConfig } from 'payload'\n\nimport { buildVersionCollectionFields, combineQueries } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { findMany } from './find/findMany.js'\n\nexport const queryDrafts: QueryDrafts = async function queryDrafts(\n this: DrizzleAdapter,\n { collection, joins, limit, locale, page = 1, pagination, req, select, sort, where },\n) {\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`,\n )\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const combinedWhere = combineQueries({ latest: { equals: true } }, where)\n\n const result = await findMany({\n adapter: this,\n collectionSlug: collection,\n fields,\n joins,\n limit,\n locale,\n page,\n pagination,\n req,\n select,\n sort,\n tableName,\n versions: true,\n where: combinedWhere,\n })\n\n return {\n ...result,\n docs: result.docs.map((doc) => {\n doc = {\n id: doc.parent,\n ...doc.version,\n }\n\n return doc\n }),\n }\n}\n"],"names":["buildVersionCollectionFields","combineQueries","toSnakeCase","findMany","queryDrafts","collection","joins","limit","locale","page","pagination","req","select","sort","where","collectionConfig","payload","collections","config","tableName","tableNameMap","get","slug","versionsSuffix","fields","combinedWhere","latest","equals","result","adapter","collectionSlug","versions","docs","map","doc","id","parent","version"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,cAAc,QAAQ,UAAS;AACtE,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,QAAQ,QAAQ,qBAAoB;AAE7C,OAAO,MAAMC,cAA2B,eAAeA,YAErD,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,CAAC,EAAEC,UAAU,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE;IAEpF,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACZ,WAAW,CAACa,MAAM;IAC/F,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEnB,YAAYa,iBAAiBO,IAAI,IAAI,IAAI,CAACC,cAAc,EAAE;IAEhE,MAAMC,SAASxB,6BAA6B,IAAI,CAACgB,OAAO,CAACE,MAAM,EAAEH,kBAAkB;IAEnF,MAAMU,gBAAgBxB,eAAe;QAAEyB,QAAQ;YAAEC,QAAQ;QAAK;IAAE,GAAGb;IAEnE,MAAMc,SAAS,MAAMzB,SAAS;QAC5B0B,SAAS,IAAI;QACbC,gBAAgBzB;QAChBmB;QACAlB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAM;QACAY,UAAU;QACVjB,OAAOW;IACT;IAEA,OAAO;QACL,GAAGG,MAAM;QACTI,MAAMJ,OAAOI,IAAI,CAACC,GAAG,CAAC,CAACC;YACrBA,MAAM;gBACJC,IAAID,IAAIE,MAAM;gBACd,GAAGF,IAAIG,OAAO;YAChB;YAEA,OAAOH;QACT;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildIndexName.d.ts","sourceRoot":"","sources":["../../src/utilities/buildIndexName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,cAAc,+BAIxB;IACD,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,KAAG,
|
|
1
|
+
{"version":3,"file":"buildIndexName.d.ts","sourceRoot":"","sources":["../../src/utilities/buildIndexName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,cAAc,+BAIxB;IACD,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,KAAG,MAkBH,CAAA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export const buildIndexName = ({ name, adapter, number = 0 })=>{
|
|
2
|
-
|
|
2
|
+
let indexName = `${name}${number ? `_${number}` : ''}_idx`;
|
|
3
|
+
if (indexName.length > 60) {
|
|
4
|
+
const suffix = `${number ? `_${number}` : ''}_idx`;
|
|
5
|
+
indexName = `${name.slice(0, 60 - suffix.length)}${suffix}`;
|
|
6
|
+
}
|
|
3
7
|
if (!adapter.indexes.has(indexName)) {
|
|
4
8
|
adapter.indexes.add(indexName);
|
|
5
9
|
return indexName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/buildIndexName.ts"],"sourcesContent":["import type { DrizzleAdapter } from '../types.js'\n\nexport const buildIndexName = ({\n name,\n adapter,\n number = 0,\n}: {\n adapter: DrizzleAdapter\n name: string\n number?: number\n}): string => {\n
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/buildIndexName.ts"],"sourcesContent":["import type { DrizzleAdapter } from '../types.js'\n\nexport const buildIndexName = ({\n name,\n adapter,\n number = 0,\n}: {\n adapter: DrizzleAdapter\n name: string\n number?: number\n}): string => {\n let indexName = `${name}${number ? `_${number}` : ''}_idx`\n\n if (indexName.length > 60) {\n const suffix = `${number ? `_${number}` : ''}_idx`\n indexName = `${name.slice(0, 60 - suffix.length)}${suffix}`\n }\n\n if (!adapter.indexes.has(indexName)) {\n adapter.indexes.add(indexName)\n return indexName\n }\n\n return buildIndexName({\n name,\n adapter,\n number: number + 1,\n })\n}\n"],"names":["buildIndexName","name","adapter","number","indexName","length","suffix","slice","indexes","has","add"],"mappings":"AAEA,OAAO,MAAMA,iBAAiB,CAAC,EAC7BC,IAAI,EACJC,OAAO,EACPC,SAAS,CAAC,EAKX;IACC,IAAIC,YAAY,GAAGH,OAAOE,SAAS,CAAC,CAAC,EAAEA,QAAQ,GAAG,GAAG,IAAI,CAAC;IAE1D,IAAIC,UAAUC,MAAM,GAAG,IAAI;QACzB,MAAMC,SAAS,GAAGH,SAAS,CAAC,CAAC,EAAEA,QAAQ,GAAG,GAAG,IAAI,CAAC;QAClDC,YAAY,GAAGH,KAAKM,KAAK,CAAC,GAAG,KAAKD,OAAOD,MAAM,IAAIC,QAAQ;IAC7D;IAEA,IAAI,CAACJ,QAAQM,OAAO,CAACC,GAAG,CAACL,YAAY;QACnCF,QAAQM,OAAO,CAACE,GAAG,CAACN;QACpB,OAAOA;IACT;IAEA,OAAOJ,eAAe;QACpBC;QACAC;QACAC,QAAQA,SAAS;IACnB;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/drizzle",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.53.0-internal.2dadf5b",
|
|
4
4
|
"description": "A library of shared functions used by different payload database adapters",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"@types/pg": "8.10.2",
|
|
56
56
|
"@types/to-snake-case": "1.0.0",
|
|
57
57
|
"@payloadcms/eslint-config": "3.28.0",
|
|
58
|
-
"payload": "3.
|
|
58
|
+
"payload": "3.53.0-internal.2dadf5b"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"payload": "3.
|
|
61
|
+
"payload": "3.53.0-internal.2dadf5b"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "pnpm build:swc && pnpm build:types",
|