@payloadcms/drizzle 3.40.0-internal.e3ed6ab → 3.41.0-canary.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/postgres/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAUnC,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/postgres/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAUnC,eAAO,MAAM,IAAI,EAAE,IAkClB,CAAA"}
|
package/dist/postgres/init.js
CHANGED
|
@@ -30,6 +30,12 @@ export const init = async function init() {
|
|
|
30
30
|
type: 'afterSchemaInit',
|
|
31
31
|
adapter: this
|
|
32
32
|
});
|
|
33
|
+
this.schema = {
|
|
34
|
+
pgSchema: this.pgSchema,
|
|
35
|
+
...this.tables,
|
|
36
|
+
...this.relations,
|
|
37
|
+
...this.enums
|
|
38
|
+
};
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/postgres/init.ts"],"sourcesContent":["import type { Init } from 'payload'\n\nimport type { BasePostgresAdapter } from './types.js'\n\nimport { buildDrizzleRelations } from '../schema/buildDrizzleRelations.js'\nimport { buildRawSchema } from '../schema/buildRawSchema.js'\nimport { executeSchemaHooks } from '../utilities/executeSchemaHooks.js'\nimport { buildDrizzleTable } from './schema/buildDrizzleTable.js'\nimport { setColumnID } from './schema/setColumnID.js'\n\nexport const init: Init = async function init(this: BasePostgresAdapter) {\n this.rawRelations = {}\n this.rawTables = {}\n\n buildRawSchema({\n adapter: this,\n setColumnID,\n })\n\n await executeSchemaHooks({ type: 'beforeSchemaInit', adapter: this })\n\n if (this.payload.config.localization) {\n this.enums.enum__locales = this.pgSchema.enum(\n '_locales',\n this.payload.config.localization.locales.map(({ code }) => code) as [string, ...string[]],\n )\n }\n\n for (const tableName in this.rawTables) {\n buildDrizzleTable({ adapter: this, rawTable: this.rawTables[tableName] })\n }\n\n buildDrizzleRelations({\n adapter: this,\n })\n\n await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })\n}\n"],"names":["buildDrizzleRelations","buildRawSchema","executeSchemaHooks","buildDrizzleTable","setColumnID","init","rawRelations","rawTables","adapter","type","payload","config","localization","enums","enum__locales","pgSchema","enum","locales","map","code","tableName","rawTable"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,WAAW,QAAQ,0BAAyB;AAErD,OAAO,MAAMC,OAAa,eAAeA;IACvC,IAAI,CAACC,YAAY,GAAG,CAAC;IACrB,IAAI,CAACC,SAAS,GAAG,CAAC;IAElBN,eAAe;QACbO,SAAS,IAAI;QACbJ;IACF;IAEA,MAAMF,mBAAmB;QAAEO,MAAM;QAAoBD,SAAS,IAAI;IAAC;IAEnE,IAAI,IAAI,CAACE,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpC,IAAI,CAACC,KAAK,CAACC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAACC,IAAI,CAC3C,YACA,IAAI,CAACN,OAAO,CAACC,MAAM,CAACC,YAAY,CAACK,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAE/D;IAEA,IAAK,MAAMC,aAAa,IAAI,CAACb,SAAS,CAAE;QACtCJ,kBAAkB;YAAEK,SAAS,IAAI;YAAEa,UAAU,IAAI,CAACd,SAAS,CAACa,UAAU;QAAC;IACzE;IAEApB,sBAAsB;QACpBQ,SAAS,IAAI;IACf;IAEA,MAAMN,mBAAmB;QAAEO,MAAM;QAAmBD,SAAS,IAAI;IAAC;
|
|
1
|
+
{"version":3,"sources":["../../src/postgres/init.ts"],"sourcesContent":["import type { Init } from 'payload'\n\nimport type { BasePostgresAdapter } from './types.js'\n\nimport { buildDrizzleRelations } from '../schema/buildDrizzleRelations.js'\nimport { buildRawSchema } from '../schema/buildRawSchema.js'\nimport { executeSchemaHooks } from '../utilities/executeSchemaHooks.js'\nimport { buildDrizzleTable } from './schema/buildDrizzleTable.js'\nimport { setColumnID } from './schema/setColumnID.js'\n\nexport const init: Init = async function init(this: BasePostgresAdapter) {\n this.rawRelations = {}\n this.rawTables = {}\n\n buildRawSchema({\n adapter: this,\n setColumnID,\n })\n\n await executeSchemaHooks({ type: 'beforeSchemaInit', adapter: this })\n\n if (this.payload.config.localization) {\n this.enums.enum__locales = this.pgSchema.enum(\n '_locales',\n this.payload.config.localization.locales.map(({ code }) => code) as [string, ...string[]],\n )\n }\n\n for (const tableName in this.rawTables) {\n buildDrizzleTable({ adapter: this, rawTable: this.rawTables[tableName] })\n }\n\n buildDrizzleRelations({\n adapter: this,\n })\n\n await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })\n\n this.schema = {\n pgSchema: this.pgSchema,\n ...this.tables,\n ...this.relations,\n ...this.enums,\n }\n}\n"],"names":["buildDrizzleRelations","buildRawSchema","executeSchemaHooks","buildDrizzleTable","setColumnID","init","rawRelations","rawTables","adapter","type","payload","config","localization","enums","enum__locales","pgSchema","enum","locales","map","code","tableName","rawTable","schema","tables","relations"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,WAAW,QAAQ,0BAAyB;AAErD,OAAO,MAAMC,OAAa,eAAeA;IACvC,IAAI,CAACC,YAAY,GAAG,CAAC;IACrB,IAAI,CAACC,SAAS,GAAG,CAAC;IAElBN,eAAe;QACbO,SAAS,IAAI;QACbJ;IACF;IAEA,MAAMF,mBAAmB;QAAEO,MAAM;QAAoBD,SAAS,IAAI;IAAC;IAEnE,IAAI,IAAI,CAACE,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpC,IAAI,CAACC,KAAK,CAACC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAACC,IAAI,CAC3C,YACA,IAAI,CAACN,OAAO,CAACC,MAAM,CAACC,YAAY,CAACK,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAE/D;IAEA,IAAK,MAAMC,aAAa,IAAI,CAACb,SAAS,CAAE;QACtCJ,kBAAkB;YAAEK,SAAS,IAAI;YAAEa,UAAU,IAAI,CAACd,SAAS,CAACa,UAAU;QAAC;IACzE;IAEApB,sBAAsB;QACpBQ,SAAS,IAAI;IACf;IAEA,MAAMN,mBAAmB;QAAEO,MAAM;QAAmBD,SAAS,IAAI;IAAC;IAElE,IAAI,CAACc,MAAM,GAAG;QACZP,UAAU,IAAI,CAACA,QAAQ;QACvB,GAAG,IAAI,CAACQ,MAAM;QACd,GAAG,IAAI,CAACC,SAAS;QACjB,GAAG,IAAI,CAACX,KAAK;IACf;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withDefault.d.ts","sourceRoot":"","sources":["../../src/schema/withDefault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,WAAW,WAAY,SAAS,SAAS,kBAAkB,KAAG,
|
|
1
|
+
{"version":3,"file":"withDefault.d.ts","sourceRoot":"","sources":["../../src/schema/withDefault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,WAAW,WAAY,SAAS,SAAS,kBAAkB,KAAG,SAS1E,CAAA"}
|
|
@@ -2,13 +2,6 @@ export const withDefault = (column, field)=>{
|
|
|
2
2
|
if (typeof field.defaultValue === 'undefined' || typeof field.defaultValue === 'function') {
|
|
3
3
|
return column;
|
|
4
4
|
}
|
|
5
|
-
if (typeof field.defaultValue === 'string' && field.defaultValue.includes("'")) {
|
|
6
|
-
const escapedString = field.defaultValue.replaceAll("'", "''");
|
|
7
|
-
return {
|
|
8
|
-
...column,
|
|
9
|
-
default: escapedString
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
5
|
return {
|
|
13
6
|
...column,
|
|
14
7
|
default: field.defaultValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/withDefault.ts"],"sourcesContent":["import type { FieldAffectingData } from 'payload'\n\nimport type { RawColumn } from '../types.js'\n\nexport const withDefault = (column: RawColumn, field: FieldAffectingData): RawColumn => {\n if (typeof field.defaultValue === 'undefined' || typeof field.defaultValue === 'function') {\n return column\n }\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/schema/withDefault.ts"],"sourcesContent":["import type { FieldAffectingData } from 'payload'\n\nimport type { RawColumn } from '../types.js'\n\nexport const withDefault = (column: RawColumn, field: FieldAffectingData): RawColumn => {\n if (typeof field.defaultValue === 'undefined' || typeof field.defaultValue === 'function') {\n return column\n }\n\n return {\n ...column,\n default: field.defaultValue,\n }\n}\n"],"names":["withDefault","column","field","defaultValue","default"],"mappings":"AAIA,OAAO,MAAMA,cAAc,CAACC,QAAmBC;IAC7C,IAAI,OAAOA,MAAMC,YAAY,KAAK,eAAe,OAAOD,MAAMC,YAAY,KAAK,YAAY;QACzF,OAAOF;IACT;IAEA,OAAO;QACL,GAAGA,MAAM;QACTG,SAASF,MAAMC,YAAY;IAC7B;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/drizzle",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.41.0-canary.0",
|
|
4
4
|
"description": "A library of shared functions used by different payload database adapters",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@types/pg": "8.10.2",
|
|
55
55
|
"@types/to-snake-case": "1.0.0",
|
|
56
56
|
"@payloadcms/eslint-config": "3.28.0",
|
|
57
|
-
"payload": "3.
|
|
57
|
+
"payload": "3.41.0-canary.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"payload": "3.
|
|
60
|
+
"payload": "3.41.0-canary.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "pnpm build:swc && pnpm build:types",
|