@payloadcms/db-postgres 3.0.0-canary.ef0a8d0 → 3.0.0-canary.f118ee4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +6 -0
- package/dist/connect.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +0 -4
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/index.js +1 -7
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +0 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
- package/dist/types.d.ts +26 -105
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/dist/countDistinct.d.ts +0 -3
- package/dist/countDistinct.d.ts.map +0 -1
- package/dist/countDistinct.js +0 -26
- package/dist/countDistinct.js.map +0 -1
- package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
- package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
- package/dist/createJSONQuery/convertPathToJSONTraversal.js +0 -14
- package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
- package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/createJSONQuery/formatJSONPathSegment.js +0 -5
- package/dist/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/createJSONQuery/index.d.ts +0 -10
- package/dist/createJSONQuery/index.d.ts.map +0 -1
- package/dist/createJSONQuery/index.js +0 -54
- package/dist/createJSONQuery/index.js.map +0 -1
- package/dist/createMigration.d.ts +0 -3
- package/dist/createMigration.d.ts.map +0 -1
- package/dist/createMigration.js +0 -80
- package/dist/createMigration.js.map +0 -1
- package/dist/defaultSnapshot.d.ts +0 -3
- package/dist/defaultSnapshot.d.ts.map +0 -1
- package/dist/defaultSnapshot.js +0 -16
- package/dist/defaultSnapshot.js.map +0 -1
- package/dist/deleteWhere.d.ts +0 -3
- package/dist/deleteWhere.d.ts.map +0 -1
- package/dist/deleteWhere.js +0 -7
- package/dist/deleteWhere.js.map +0 -1
- package/dist/dropDatabase.d.ts +0 -3
- package/dist/dropDatabase.d.ts.map +0 -1
- package/dist/dropDatabase.js +0 -9
- package/dist/dropDatabase.js.map +0 -1
- package/dist/execute.d.ts +0 -3
- package/dist/execute.d.ts.map +0 -1
- package/dist/execute.js +0 -13
- package/dist/execute.js.map +0 -1
- package/dist/generateDrizzleJSON.d.ts +0 -3
- package/dist/generateDrizzleJSON.d.ts.map +0 -1
- package/dist/generateDrizzleJSON.js +0 -8
- package/dist/generateDrizzleJSON.js.map +0 -1
- package/dist/generateMigration.d.ts +0 -3
- package/dist/generateMigration.d.ts.map +0 -1
- package/dist/generateMigration.js +0 -8
- package/dist/generateMigration.js.map +0 -1
- package/dist/getMigrationTemplate.d.ts +0 -3
- package/dist/getMigrationTemplate.d.ts.map +0 -1
- package/dist/getMigrationTemplate.js +0 -12
- package/dist/getMigrationTemplate.js.map +0 -1
- package/dist/init.d.ts +0 -3
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -91
- package/dist/init.js.map +0 -1
- package/dist/insert.d.ts +0 -3
- package/dist/insert.d.ts.map +0 -1
- package/dist/insert.js +0 -13
- package/dist/insert.js.map +0 -1
- package/dist/requireDrizzleKit.d.ts +0 -3
- package/dist/requireDrizzleKit.d.ts.map +0 -1
- package/dist/requireDrizzleKit.js +0 -5
- package/dist/requireDrizzleKit.js.map +0 -1
- package/dist/schema/build.d.ts +0 -34
- package/dist/schema/build.d.ts.map +0 -1
- package/dist/schema/build.js +0 -369
- package/dist/schema/build.js.map +0 -1
- package/dist/schema/createIndex.d.ts +0 -12
- package/dist/schema/createIndex.d.ts.map +0 -1
- package/dist/schema/createIndex.js +0 -18
- package/dist/schema/createIndex.js.map +0 -1
- package/dist/schema/idToUUID.d.ts +0 -3
- package/dist/schema/idToUUID.d.ts.map +0 -1
- package/dist/schema/idToUUID.js +0 -11
- package/dist/schema/idToUUID.js.map +0 -1
- package/dist/schema/parentIDColumnMap.d.ts +0 -4
- package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
- package/dist/schema/parentIDColumnMap.js +0 -9
- package/dist/schema/parentIDColumnMap.js.map +0 -1
- package/dist/schema/setColumnID.d.ts +0 -11
- package/dist/schema/setColumnID.d.ts.map +0 -1
- package/dist/schema/setColumnID.js +0 -24
- package/dist/schema/setColumnID.js.map +0 -1
- package/dist/schema/traverseFields.d.ts +0 -36
- package/dist/schema/traverseFields.d.ts.map +0 -1
- package/dist/schema/traverseFields.js +0 -612
- package/dist/schema/traverseFields.js.map +0 -1
package/dist/execute.d.ts
DELETED
package/dist/execute.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,GAAG,CAUhC,CAAA"}
|
package/dist/execute.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
2
|
-
export const execute = function execute({ db, drizzle, raw, sql: statement }) {
|
3
|
-
const executeFrom = db ?? drizzle;
|
4
|
-
if (raw) {
|
5
|
-
// @ts-expect-error drizzle-orm confusing libsql and pgsql types
|
6
|
-
return executeFrom.execute(sql.raw(raw));
|
7
|
-
} else {
|
8
|
-
// @ts-expect-error drizzle-orm confusing libsql and pgsql types
|
9
|
-
return executeFrom.execute(sql`${statement}`);
|
10
|
-
}
|
11
|
-
};
|
12
|
-
|
13
|
-
//# sourceMappingURL=execute.js.map
|
package/dist/execute.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/execute.ts"],"sourcesContent":["import { sql } from 'drizzle-orm'\n\nimport type { Execute } from './types.js'\n\nexport const execute: Execute<any> = function execute({ db, drizzle, raw, sql: statement }) {\n const executeFrom = db ?? drizzle\n\n if (raw) {\n // @ts-expect-error drizzle-orm confusing libsql and pgsql types\n return executeFrom.execute(sql.raw(raw))\n } else {\n // @ts-expect-error drizzle-orm confusing libsql and pgsql types\n return executeFrom.execute(sql`${statement}`)\n }\n}\n"],"names":["sql","execute","db","drizzle","raw","statement","executeFrom"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAa;AAIjC,OAAO,MAAMC,UAAwB,SAASA,QAAQ,EAAEC,EAAE,EAAEC,OAAO,EAAEC,GAAG,EAAEJ,KAAKK,SAAS,EAAE;IACxF,MAAMC,cAAcJ,MAAMC;IAE1B,IAAIC,KAAK;QACP,gEAAgE;QAChE,OAAOE,YAAYL,OAAO,CAACD,IAAII,GAAG,CAACA;IACrC,OAAO;QACL,gEAAgE;QAChE,OAAOE,YAAYL,OAAO,CAACD,GAAG,CAAC,EAAEK,UAAU,CAAC;IAC9C;AACF,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"generateDrizzleJSON.d.ts","sourceRoot":"","sources":["../src/generateDrizzleJSON.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,eAAO,MAAM,mBAAmB,EAAE,mBAIjC,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { createRequire } from 'module';
|
2
|
-
const require = createRequire(import.meta.url);
|
3
|
-
export const generateDrizzleJSON = function generateDrizzleJSON({ schema }) {
|
4
|
-
const { generateDrizzleJson } = require('drizzle-kit/payload');
|
5
|
-
return generateDrizzleJson(schema);
|
6
|
-
};
|
7
|
-
|
8
|
-
//# sourceMappingURL=generateDrizzleJSON.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/generateDrizzleJSON.ts"],"sourcesContent":["import { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\n\nimport type { GenerateDrizzleJSON } from './types.js'\n\nexport const generateDrizzleJSON: GenerateDrizzleJSON = function generateDrizzleJSON({ schema }) {\n const { generateDrizzleJson } = require('drizzle-kit/payload')\n\n return generateDrizzleJson(schema)\n}\n"],"names":["createRequire","require","url","generateDrizzleJSON","schema","generateDrizzleJson"],"mappings":"AAAA,SAASA,aAAa,QAAQ,SAAQ;AACtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAI7C,OAAO,MAAMC,sBAA2C,SAASA,oBAAoB,EAAEC,MAAM,EAAE;IAC7F,MAAM,EAAEC,mBAAmB,EAAE,GAAGJ,QAAQ;IAExC,OAAOI,oBAAoBD;AAC7B,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"generateMigration.d.ts","sourceRoot":"","sources":["../src/generateMigration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,eAAO,MAAM,mBAAmB,EAAE,mBAIjC,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { createRequire } from 'module';
|
2
|
-
const require = createRequire(import.meta.url);
|
3
|
-
export const generateDrizzleJSON = function generateDrizzleJSON({ schema }) {
|
4
|
-
const { generateDrizzleJson } = require('drizzle-kit/payload');
|
5
|
-
return generateDrizzleJson(schema);
|
6
|
-
};
|
7
|
-
|
8
|
-
//# sourceMappingURL=generateMigration.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/generateMigration.ts"],"sourcesContent":["import { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\n\nimport type { GenerateDrizzleJSON } from './types.js'\n\nexport const generateDrizzleJSON: GenerateDrizzleJSON = function generateDrizzleJSON({ schema }) {\n const { generateDrizzleJson } = require('drizzle-kit/payload')\n\n return generateDrizzleJson(schema)\n}\n"],"names":["createRequire","require","url","generateDrizzleJSON","schema","generateDrizzleJson"],"mappings":"AAAA,SAASA,aAAa,QAAQ,SAAQ;AACtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAI7C,OAAO,MAAMC,sBAA2C,SAASA,oBAAoB,EAAEC,MAAM,EAAE;IAC7F,MAAM,EAAEC,mBAAmB,EAAE,GAAGJ,QAAQ;IAExC,OAAOI,oBAAoBD;AAC7B,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getMigrationTemplate.d.ts","sourceRoot":"","sources":["../src/getMigrationTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,eAAO,MAAM,oBAAoB,iCAI9B,qBAAqB,KAAG,MAS1B,CAAA"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
export const getMigrationTemplate = ({ downSQL, imports, upSQL })=>`import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
2
|
-
${imports ? `${imports}\n` : ''}
|
3
|
-
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
4
|
-
${upSQL}
|
5
|
-
}
|
6
|
-
|
7
|
-
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
8
|
-
${downSQL}
|
9
|
-
}
|
10
|
-
`;
|
11
|
-
|
12
|
-
//# sourceMappingURL=getMigrationTemplate.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/getMigrationTemplate.ts"],"sourcesContent":["import type { MigrationTemplateArgs } from 'payload'\n\nexport const getMigrationTemplate = ({\n downSQL,\n imports,\n upSQL,\n}: MigrationTemplateArgs): string => `import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'\n${imports ? `${imports}\\n` : ''}\nexport async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n${upSQL}\n}\n\nexport async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n${downSQL}\n}\n`\n"],"names":["getMigrationTemplate","downSQL","imports","upSQL"],"mappings":"AAEA,OAAO,MAAMA,uBAAuB,CAAC,EACnCC,OAAO,EACPC,OAAO,EACPC,KAAK,EACiB,GAAa,CAAC;AACtC,EAAED,UAAU,CAAC,EAAEA,QAAQ,EAAE,CAAC,GAAG,GAAG;;AAEhC,EAAEC,MAAM;;;;AAIR,EAAEF,QAAQ;;AAEV,CAAC,CAAA"}
|
package/dist/init.d.ts
DELETED
package/dist/init.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAWnC,eAAO,MAAM,IAAI,EAAE,IA4FlB,CAAA"}
|
package/dist/init.js
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
/* eslint-disable no-param-reassign */ import { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core';
|
2
|
-
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload';
|
3
|
-
import toSnakeCase from 'to-snake-case';
|
4
|
-
import { createTableName } from '../../drizzle/src/createTableName.js';
|
5
|
-
import { buildTable } from './schema/build.js';
|
6
|
-
export const init = function init() {
|
7
|
-
if (this.schemaName) {
|
8
|
-
this.pgSchema = pgSchema(this.schemaName);
|
9
|
-
} else {
|
10
|
-
this.pgSchema = {
|
11
|
-
table: pgTable
|
12
|
-
};
|
13
|
-
}
|
14
|
-
if (this.payload.config.localization) {
|
15
|
-
this.enums.enum__locales = pgEnum('_locales', this.payload.config.localization.locales.map(({ code })=>code));
|
16
|
-
}
|
17
|
-
this.payload.config.collections.forEach((collection)=>{
|
18
|
-
createTableName({
|
19
|
-
adapter: this,
|
20
|
-
config: collection
|
21
|
-
});
|
22
|
-
if (collection.versions) {
|
23
|
-
createTableName({
|
24
|
-
adapter: this,
|
25
|
-
config: collection,
|
26
|
-
versions: true,
|
27
|
-
versionsCustomName: true
|
28
|
-
});
|
29
|
-
}
|
30
|
-
});
|
31
|
-
this.payload.config.collections.forEach((collection)=>{
|
32
|
-
const tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
|
33
|
-
buildTable({
|
34
|
-
adapter: this,
|
35
|
-
disableNotNull: !!collection?.versions?.drafts,
|
36
|
-
disableUnique: false,
|
37
|
-
fields: collection.fields,
|
38
|
-
tableName,
|
39
|
-
timestamps: collection.timestamps,
|
40
|
-
versions: false
|
41
|
-
});
|
42
|
-
if (collection.versions) {
|
43
|
-
const versionsTableName = this.tableNameMap.get(`_${toSnakeCase(collection.slug)}${this.versionsSuffix}`);
|
44
|
-
const versionFields = buildVersionCollectionFields(collection);
|
45
|
-
buildTable({
|
46
|
-
adapter: this,
|
47
|
-
disableNotNull: !!collection.versions?.drafts,
|
48
|
-
disableUnique: true,
|
49
|
-
fields: versionFields,
|
50
|
-
tableName: versionsTableName,
|
51
|
-
timestamps: true,
|
52
|
-
versions: true
|
53
|
-
});
|
54
|
-
}
|
55
|
-
});
|
56
|
-
this.payload.config.globals.forEach((global)=>{
|
57
|
-
const tableName = createTableName({
|
58
|
-
adapter: this,
|
59
|
-
config: global
|
60
|
-
});
|
61
|
-
buildTable({
|
62
|
-
adapter: this,
|
63
|
-
disableNotNull: !!global?.versions?.drafts,
|
64
|
-
disableUnique: false,
|
65
|
-
fields: global.fields,
|
66
|
-
tableName,
|
67
|
-
timestamps: false,
|
68
|
-
versions: false
|
69
|
-
});
|
70
|
-
if (global.versions) {
|
71
|
-
const versionsTableName = createTableName({
|
72
|
-
adapter: this,
|
73
|
-
config: global,
|
74
|
-
versions: true,
|
75
|
-
versionsCustomName: true
|
76
|
-
});
|
77
|
-
const versionFields = buildVersionGlobalFields(global);
|
78
|
-
buildTable({
|
79
|
-
adapter: this,
|
80
|
-
disableNotNull: !!global.versions?.drafts,
|
81
|
-
disableUnique: true,
|
82
|
-
fields: versionFields,
|
83
|
-
tableName: versionsTableName,
|
84
|
-
timestamps: true,
|
85
|
-
versions: true
|
86
|
-
});
|
87
|
-
}
|
88
|
-
});
|
89
|
-
};
|
90
|
-
|
91
|
-
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/init.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { SanitizedCollectionConfig } from 'payload'\nimport type { Init } from 'payload'\n\nimport { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'\nimport { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { createTableName } from '../../drizzle/src/createTableName.js'\nimport { buildTable } from './schema/build.js'\n\nexport const init: Init = function init(this: PostgresAdapter) {\n if (this.schemaName) {\n this.pgSchema = pgSchema(this.schemaName)\n } else {\n this.pgSchema = { table: pgTable }\n }\n if (this.payload.config.localization) {\n this.enums.enum__locales = pgEnum(\n '_locales',\n this.payload.config.localization.locales.map(({ code }) => code) as [string, ...string[]],\n )\n }\n\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n createTableName({\n adapter: this,\n config: collection,\n })\n\n if (collection.versions) {\n createTableName({\n adapter: this,\n config: collection,\n versions: true,\n versionsCustomName: true,\n })\n }\n })\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))\n\n buildTable({\n adapter: this,\n disableNotNull: !!collection?.versions?.drafts,\n disableUnique: false,\n fields: collection.fields,\n tableName,\n timestamps: collection.timestamps,\n versions: false,\n })\n\n if (collection.versions) {\n const versionsTableName = this.tableNameMap.get(\n `_${toSnakeCase(collection.slug)}${this.versionsSuffix}`,\n )\n const versionFields = buildVersionCollectionFields(collection)\n\n buildTable({\n adapter: this,\n disableNotNull: !!collection.versions?.drafts,\n disableUnique: true,\n fields: versionFields,\n tableName: versionsTableName,\n timestamps: true,\n versions: true,\n })\n }\n })\n\n this.payload.config.globals.forEach((global) => {\n const tableName = createTableName({ adapter: this, config: global })\n\n buildTable({\n adapter: this,\n disableNotNull: !!global?.versions?.drafts,\n disableUnique: false,\n fields: global.fields,\n tableName,\n timestamps: false,\n versions: false,\n })\n\n if (global.versions) {\n const versionsTableName = createTableName({\n adapter: this,\n config: global,\n versions: true,\n versionsCustomName: true,\n })\n const versionFields = buildVersionGlobalFields(global)\n\n buildTable({\n adapter: this,\n disableNotNull: !!global.versions?.drafts,\n disableUnique: true,\n fields: versionFields,\n tableName: versionsTableName,\n timestamps: true,\n versions: true,\n })\n }\n })\n}\n"],"names":["pgEnum","pgSchema","pgTable","buildVersionCollectionFields","buildVersionGlobalFields","toSnakeCase","createTableName","buildTable","init","schemaName","table","payload","config","localization","enums","enum__locales","locales","map","code","collections","forEach","collection","adapter","versions","versionsCustomName","tableName","tableNameMap","get","slug","disableNotNull","drafts","disableUnique","fields","timestamps","versionsTableName","versionsSuffix","versionFields","globals","global"],"mappings":"AAAA,oCAAoC,GAIpC,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,sBAAqB;AAC/D,SAASC,4BAA4B,EAAEC,wBAAwB,QAAQ,UAAS;AAChF,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,eAAe,QAAQ,uCAAsC;AACtE,SAASC,UAAU,QAAQ,oBAAmB;AAE9C,OAAO,MAAMC,OAAa,SAASA;IACjC,IAAI,IAAI,CAACC,UAAU,EAAE;QACnB,IAAI,CAACR,QAAQ,GAAGA,SAAS,IAAI,CAACQ,UAAU;IAC1C,OAAO;QACL,IAAI,CAACR,QAAQ,GAAG;YAAES,OAAOR;QAAQ;IACnC;IACA,IAAI,IAAI,CAACS,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpC,IAAI,CAACC,KAAK,CAACC,aAAa,GAAGf,OACzB,YACA,IAAI,CAACW,OAAO,CAACC,MAAM,CAACC,YAAY,CAACG,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAE/D;IAEA,IAAI,CAACP,OAAO,CAACC,MAAM,CAACO,WAAW,CAACC,OAAO,CAAC,CAACC;QACvCf,gBAAgB;YACdgB,SAAS,IAAI;YACbV,QAAQS;QACV;QAEA,IAAIA,WAAWE,QAAQ,EAAE;YACvBjB,gBAAgB;gBACdgB,SAAS,IAAI;gBACbV,QAAQS;gBACRE,UAAU;gBACVC,oBAAoB;YACtB;QACF;IACF;IACA,IAAI,CAACb,OAAO,CAACC,MAAM,CAACO,WAAW,CAACC,OAAO,CAAC,CAACC;QACvC,MAAMI,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACtB,YAAYgB,WAAWO,IAAI;QAEnErB,WAAW;YACTe,SAAS,IAAI;YACbO,gBAAgB,CAAC,CAACR,YAAYE,UAAUO;YACxCC,eAAe;YACfC,QAAQX,WAAWW,MAAM;YACzBP;YACAQ,YAAYZ,WAAWY,UAAU;YACjCV,UAAU;QACZ;QAEA,IAAIF,WAAWE,QAAQ,EAAE;YACvB,MAAMW,oBAAoB,IAAI,CAACR,YAAY,CAACC,GAAG,CAC7C,CAAC,CAAC,EAAEtB,YAAYgB,WAAWO,IAAI,EAAE,EAAE,IAAI,CAACO,cAAc,CAAC,CAAC;YAE1D,MAAMC,gBAAgBjC,6BAA6BkB;YAEnDd,WAAW;gBACTe,SAAS,IAAI;gBACbO,gBAAgB,CAAC,CAACR,WAAWE,QAAQ,EAAEO;gBACvCC,eAAe;gBACfC,QAAQI;gBACRX,WAAWS;gBACXD,YAAY;gBACZV,UAAU;YACZ;QACF;IACF;IAEA,IAAI,CAACZ,OAAO,CAACC,MAAM,CAACyB,OAAO,CAACjB,OAAO,CAAC,CAACkB;QACnC,MAAMb,YAAYnB,gBAAgB;YAAEgB,SAAS,IAAI;YAAEV,QAAQ0B;QAAO;QAElE/B,WAAW;YACTe,SAAS,IAAI;YACbO,gBAAgB,CAAC,CAACS,QAAQf,UAAUO;YACpCC,eAAe;YACfC,QAAQM,OAAON,MAAM;YACrBP;YACAQ,YAAY;YACZV,UAAU;QACZ;QAEA,IAAIe,OAAOf,QAAQ,EAAE;YACnB,MAAMW,oBAAoB5B,gBAAgB;gBACxCgB,SAAS,IAAI;gBACbV,QAAQ0B;gBACRf,UAAU;gBACVC,oBAAoB;YACtB;YACA,MAAMY,gBAAgBhC,yBAAyBkC;YAE/C/B,WAAW;gBACTe,SAAS,IAAI;gBACbO,gBAAgB,CAAC,CAACS,OAAOf,QAAQ,EAAEO;gBACnCC,eAAe;gBACfC,QAAQI;gBACRX,WAAWS;gBACXD,YAAY;gBACZV,UAAU;YACZ;QACF;IACF;AACF,EAAC"}
|
package/dist/insert.d.ts
DELETED
package/dist/insert.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../src/insert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,MAAM,EAAE,MAqBpB,CAAA"}
|
package/dist/insert.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
export const insert = async function insert({ db, onConflictDoUpdate, tableName, values }) {
|
2
|
-
const table = this.tables[tableName];
|
3
|
-
let result;
|
4
|
-
if (onConflictDoUpdate) {
|
5
|
-
result = await db.insert(table).values(values)// @ts-expect-error drizzle-orm confusing libsql and pgsql types
|
6
|
-
.onConflictDoUpdate(onConflictDoUpdate).returning();
|
7
|
-
} else {
|
8
|
-
result = await db.insert(table).values(values).returning();
|
9
|
-
}
|
10
|
-
return result;
|
11
|
-
};
|
12
|
-
|
13
|
-
//# sourceMappingURL=insert.js.map
|
package/dist/insert.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/insert.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\n\nimport type { Insert } from './types.js'\n\nexport const insert: Insert = async function insert({\n db,\n onConflictDoUpdate,\n tableName,\n values,\n}): Promise<Record<string, unknown>[]> {\n const table = this.tables[tableName]\n let result\n\n if (onConflictDoUpdate) {\n result = await (db as TransactionPg)\n .insert(table)\n .values(values)\n // @ts-expect-error drizzle-orm confusing libsql and pgsql types\n .onConflictDoUpdate(onConflictDoUpdate)\n .returning()\n } else {\n result = await (db as TransactionPg).insert(table).values(values).returning()\n }\n\n return result\n}\n"],"names":["insert","db","onConflictDoUpdate","tableName","values","table","tables","result","returning"],"mappings":"AAIA,OAAO,MAAMA,SAAiB,eAAeA,OAAO,EAClDC,EAAE,EACFC,kBAAkB,EAClBC,SAAS,EACTC,MAAM,EACP;IACC,MAAMC,QAAQ,IAAI,CAACC,MAAM,CAACH,UAAU;IACpC,IAAII;IAEJ,IAAIL,oBAAoB;QACtBK,SAAS,MAAM,AAACN,GACbD,MAAM,CAACK,OACPD,MAAM,CAACA,OACR,gEAAgE;SAC/DF,kBAAkB,CAACA,oBACnBM,SAAS;IACd,OAAO;QACLD,SAAS,MAAM,AAACN,GAAqBD,MAAM,CAACK,OAAOD,MAAM,CAACA,QAAQI,SAAS;IAC7E;IAEA,OAAOD;AACT,EAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"requireDrizzleKit.d.ts","sourceRoot":"","sources":["../src/requireDrizzleKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,eAAO,MAAM,iBAAiB,EAAE,iBAAwD,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/requireDrizzleKit.ts"],"sourcesContent":["import type { RequireDrizzleKit } from '@payloadcms/drizzle/types'\n\nimport { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\nexport const requireDrizzleKit: RequireDrizzleKit = () => require('drizzle-kit/payload')\n"],"names":["createRequire","require","url","requireDrizzleKit"],"mappings":"AAEA,SAASA,aAAa,QAAQ,SAAQ;AACtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAC7C,OAAO,MAAMC,oBAAuC,IAAMF,QAAQ,uBAAsB"}
|
package/dist/schema/build.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import type { ForeignKeyBuilder, IndexBuilder, PgColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/pg-core';
|
2
|
-
import type { Field } from 'payload';
|
3
|
-
import type { GenericColumns, PostgresAdapter } from '../types.js';
|
4
|
-
export type BaseExtraConfig = Record<string, (cols: GenericColumns) => ForeignKeyBuilder | IndexBuilder | UniqueConstraintBuilder>;
|
5
|
-
export type RelationMap = Map<string, {
|
6
|
-
localized: boolean;
|
7
|
-
target: string;
|
8
|
-
type: 'many' | 'one';
|
9
|
-
}>;
|
10
|
-
type Args = {
|
11
|
-
adapter: PostgresAdapter;
|
12
|
-
baseColumns?: Record<string, PgColumnBuilder>;
|
13
|
-
baseExtraConfig?: BaseExtraConfig;
|
14
|
-
buildNumbers?: boolean;
|
15
|
-
buildRelationships?: boolean;
|
16
|
-
disableNotNull: boolean;
|
17
|
-
disableUnique: boolean;
|
18
|
-
fields: Field[];
|
19
|
-
rootRelationsToBuild?: RelationMap;
|
20
|
-
rootRelationships?: Set<string>;
|
21
|
-
rootTableIDColType?: string;
|
22
|
-
rootTableName?: string;
|
23
|
-
tableName: string;
|
24
|
-
timestamps?: boolean;
|
25
|
-
versions: boolean;
|
26
|
-
};
|
27
|
-
type Result = {
|
28
|
-
hasManyNumberField: 'index' | boolean;
|
29
|
-
hasManyTextField: 'index' | boolean;
|
30
|
-
relationsToBuild: RelationMap;
|
31
|
-
};
|
32
|
-
export declare const buildTable: ({ adapter, baseColumns, baseExtraConfig, disableNotNull, disableUnique, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions, }: Args) => Result;
|
33
|
-
export {};
|
34
|
-
//# sourceMappingURL=build.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/schema/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAEf,uBAAuB,EACxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAgBpC,OAAO,KAAK,EAAE,cAAc,EAAwB,eAAe,EAAE,MAAM,aAAa,CAAA;AAMxF,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,CAAC,IAAI,EAAE,cAAc,KAAK,iBAAiB,GAAG,YAAY,GAAG,uBAAuB,CACrF,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAC,CAAA;AAEnG,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC7C,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,oBAAoB,CAAC,EAAE,WAAW,CAAA;IAClC,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAA;IACnC,gBAAgB,EAAE,WAAW,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,UAAU,0NAcpB,IAAI,KAAG,MAqYT,CAAA"}
|