@payloadcms/db-postgres 3.29.0-internal.d2c9ba5 → 3.29.0-internal.d74b919

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":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAyD1D,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAkJ/E;AAED,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAyD1D,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAqJ/E;AAED,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ const filename = fileURLToPath(import.meta.url);
8
8
  export function postgresAdapter(args) {
9
9
  const postgresIDType = args.idType || 'serial';
10
10
  const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text';
11
+ const allowIDOnCreate = args.allowIDOnCreate ?? false;
11
12
  function adapter({ payload }) {
12
13
  const migrationDir = findMigrationDir(args.migrationDir);
13
14
  let resolveInitializing;
@@ -33,6 +34,7 @@ export function postgresAdapter(args) {
33
34
  return createDatabaseAdapter({
34
35
  name: 'postgres',
35
36
  afterSchemaInit: args.afterSchemaInit ?? [],
37
+ allowIDOnCreate,
36
38
  beforeSchemaInit: args.beforeSchemaInit ?? [],
37
39
  createDatabase,
38
40
  createExtensions,
@@ -140,6 +142,7 @@ export function postgresAdapter(args) {
140
142
  });
141
143
  }
142
144
  return {
145
+ allowIDOnCreate,
143
146
  defaultIDType: payloadIDType,
144
147
  init: adapter
145
148
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapterObj, Payload } from 'payload'\n\nimport {\n beginTransaction,\n buildCreateMigration,\n commitTransaction,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createSchemaGenerator,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateMany,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport {\n columnToCodeConverter,\n countDistinct,\n createDatabase,\n createExtensions,\n createJSONQuery,\n defaultDrizzleSnapshot,\n deleteWhere,\n dropDatabase,\n execute,\n init,\n insert,\n requireDrizzleKit,\n} from '@payloadcms/drizzle/postgres'\nimport { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'\nimport { createDatabaseAdapter, defaultBeginTransaction } from 'payload'\nimport { fileURLToPath } from 'url'\n\nimport type { Args, PostgresAdapter } from './types.js'\n\nimport { connect } from './connect.js'\n\nconst filename = fileURLToPath(import.meta.url)\n\nexport function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n let adapterSchema: PostgresAdapter['pgSchema']\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n if (args.schemaName) {\n adapterSchema = pgSchema(args.schemaName)\n } else {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n adapterSchema = { enum: pgEnum, table: pgTable }\n }\n\n const extensions = (args.extensions ?? []).reduce(\n (acc, name) => {\n acc[name] = true\n return acc\n },\n {} as Record<string, boolean>,\n )\n\n return createDatabaseAdapter<PostgresAdapter>({\n name: 'postgres',\n afterSchemaInit: args.afterSchemaInit ?? [],\n beforeSchemaInit: args.beforeSchemaInit ?? [],\n createDatabase,\n createExtensions,\n createMigration: buildCreateMigration({\n executeMethod: 'execute',\n filename,\n sanitizeStatements({ sqlExecute, statements }) {\n return `${sqlExecute}\\n ${statements.join('\\n')}\\`)`\n },\n }),\n defaultDrizzleSnapshot,\n disableCreateDatabase: args.disableCreateDatabase ?? false,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n drizzle: undefined,\n enums: {},\n extensions,\n features: {\n json: true,\n },\n fieldConstraints: {},\n generateSchema: createSchemaGenerator({\n columnToCodeConverter,\n corePackageSuffix: 'pg-core',\n defaultOutputFile: args.generateSchemaOutputFile,\n enumImport: 'pgEnum',\n schemaImport: 'pgSchema',\n tableImport: 'pgTable',\n }),\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators: operatorMap,\n pgSchema: adapterSchema,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n pool: undefined,\n poolOptions: args.pool,\n prodMigrations: args.prodMigrations,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n tablesFilter: args.tablesFilter,\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction:\n args.transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n commitTransaction,\n connect,\n count,\n countDistinct,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n findOne,\n findVersions,\n indexes: new Set<string>(),\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n packageName: '@payloadcms/db-postgres',\n payload,\n queryDrafts,\n rawRelations: {},\n rawTables: {},\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n rejectInitializing,\n requireDrizzleKit,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateMany,\n updateOne,\n updateVersion,\n upsert: updateOne,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n\nexport type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/drizzle/postgres'\nexport { geometryColumn } from '@payloadcms/drizzle/postgres'\nexport { sql } from 'drizzle-orm'\n"],"names":["beginTransaction","buildCreateMigration","commitTransaction","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createSchemaGenerator","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateMany","updateOne","updateVersion","columnToCodeConverter","countDistinct","createDatabase","createExtensions","createJSONQuery","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","init","insert","requireDrizzleKit","pgEnum","pgSchema","pgTable","createDatabaseAdapter","defaultBeginTransaction","fileURLToPath","connect","filename","url","postgresAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","adapterSchema","initializing","Promise","res","rej","schemaName","enum","table","extensions","reduce","acc","name","afterSchemaInit","beforeSchemaInit","createMigration","executeMethod","sanitizeStatements","sqlExecute","statements","join","disableCreateDatabase","drizzle","undefined","enums","features","json","fieldConstraints","generateSchema","corePackageSuffix","defaultOutputFile","generateSchemaOutputFile","enumImport","schemaImport","tableImport","localesSuffix","logger","operators","pool","poolOptions","prodMigrations","push","relations","relationshipsSuffix","schema","sessions","tableNameMap","Map","tables","tablesFilter","transactionOptions","versionsSuffix","defaultIDType","indexes","Set","packageName","rawRelations","rawTables","upsert","geometryColumn","sql"],"mappings":"AAEA,SACEA,gBAAgB,EAChBC,oBAAoB,EACpBC,iBAAiB,EACjBC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,qBAAqB,EACrBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,aAAa,QACR,sBAAqB;AAC5B,SACEC,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,IAAIC;YACb3E;YACAC;YACAxB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAqC;YACAyD,aAAa;YACb1D;YACAlC;YACA6F,cAAc,CAAC;YACfC,WAAW,CAAC;YACZ,oFAAoF;YACpFzD;YACAnB;YACA,oFAAoF;YACpFkB;YACAnC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAyF,QAAQ1F;QACV;IACF;IAEA,OAAO;QACLoF,eAAezD;QACfhB,MAAMiB;IACR;AACF;AAGA,SAAS+D,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,GAAG,QAAQ,cAAa"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapterObj, Payload } from 'payload'\n\nimport {\n beginTransaction,\n buildCreateMigration,\n commitTransaction,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createSchemaGenerator,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateMany,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport {\n columnToCodeConverter,\n countDistinct,\n createDatabase,\n createExtensions,\n createJSONQuery,\n defaultDrizzleSnapshot,\n deleteWhere,\n dropDatabase,\n execute,\n init,\n insert,\n requireDrizzleKit,\n} from '@payloadcms/drizzle/postgres'\nimport { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'\nimport { createDatabaseAdapter, defaultBeginTransaction } from 'payload'\nimport { fileURLToPath } from 'url'\n\nimport type { Args, PostgresAdapter } from './types.js'\n\nimport { connect } from './connect.js'\n\nconst filename = fileURLToPath(import.meta.url)\n\nexport function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n const allowIDOnCreate = args.allowIDOnCreate ?? false\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n let adapterSchema: PostgresAdapter['pgSchema']\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n if (args.schemaName) {\n adapterSchema = pgSchema(args.schemaName)\n } else {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n adapterSchema = { enum: pgEnum, table: pgTable }\n }\n\n const extensions = (args.extensions ?? []).reduce(\n (acc, name) => {\n acc[name] = true\n return acc\n },\n {} as Record<string, boolean>,\n )\n\n return createDatabaseAdapter<PostgresAdapter>({\n name: 'postgres',\n afterSchemaInit: args.afterSchemaInit ?? [],\n allowIDOnCreate,\n beforeSchemaInit: args.beforeSchemaInit ?? [],\n createDatabase,\n createExtensions,\n createMigration: buildCreateMigration({\n executeMethod: 'execute',\n filename,\n sanitizeStatements({ sqlExecute, statements }) {\n return `${sqlExecute}\\n ${statements.join('\\n')}\\`)`\n },\n }),\n defaultDrizzleSnapshot,\n disableCreateDatabase: args.disableCreateDatabase ?? false,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n drizzle: undefined,\n enums: {},\n extensions,\n features: {\n json: true,\n },\n fieldConstraints: {},\n generateSchema: createSchemaGenerator({\n columnToCodeConverter,\n corePackageSuffix: 'pg-core',\n defaultOutputFile: args.generateSchemaOutputFile,\n enumImport: 'pgEnum',\n schemaImport: 'pgSchema',\n tableImport: 'pgTable',\n }),\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators: operatorMap,\n pgSchema: adapterSchema,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n pool: undefined,\n poolOptions: args.pool,\n prodMigrations: args.prodMigrations,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n tablesFilter: args.tablesFilter,\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction:\n args.transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n commitTransaction,\n connect,\n count,\n countDistinct,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n findOne,\n findVersions,\n indexes: new Set<string>(),\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n packageName: '@payloadcms/db-postgres',\n payload,\n queryDrafts,\n rawRelations: {},\n rawTables: {},\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n rejectInitializing,\n requireDrizzleKit,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateMany,\n updateOne,\n updateVersion,\n upsert: updateOne,\n })\n }\n\n return {\n allowIDOnCreate,\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n\nexport type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/drizzle/postgres'\nexport { geometryColumn } from '@payloadcms/drizzle/postgres'\nexport { sql } from 'drizzle-orm'\n"],"names":["beginTransaction","buildCreateMigration","commitTransaction","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createSchemaGenerator","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateMany","updateOne","updateVersion","columnToCodeConverter","countDistinct","createDatabase","createExtensions","createJSONQuery","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","init","insert","requireDrizzleKit","pgEnum","pgSchema","pgTable","createDatabaseAdapter","defaultBeginTransaction","fileURLToPath","connect","filename","url","postgresAdapter","args","postgresIDType","idType","payloadIDType","allowIDOnCreate","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","adapterSchema","initializing","Promise","res","rej","schemaName","enum","table","extensions","reduce","acc","name","afterSchemaInit","beforeSchemaInit","createMigration","executeMethod","sanitizeStatements","sqlExecute","statements","join","disableCreateDatabase","drizzle","undefined","enums","features","json","fieldConstraints","generateSchema","corePackageSuffix","defaultOutputFile","generateSchemaOutputFile","enumImport","schemaImport","tableImport","localesSuffix","logger","operators","pool","poolOptions","prodMigrations","push","relations","relationshipsSuffix","schema","sessions","tableNameMap","Map","tables","tablesFilter","transactionOptions","versionsSuffix","defaultIDType","indexes","Set","packageName","rawRelations","rawTables","upsert","geometryColumn","sql"],"mappings":"AAEA,SACEA,gBAAgB,EAChBC,oBAAoB,EACpBC,iBAAiB,EACjBC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,qBAAqB,EACrBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,aAAa,QACR,sBA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YACA4B;YACAC;YACA5B;YACAC;YACAC;YACA,oFAAoF;YACpFE;YACAC;YACAmG,SAAS,IAAIC;YACb5E;YACAC;YACAxB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAsC;YACAyD,aAAa;YACb1D;YACAnC;YACA8F,cAAc,CAAC;YACfC,WAAW,CAAC;YACZ,oFAAoF;YACpFzD;YACApB;YACA,oFAAoF;YACpFmB;YACApC;YACAC;YACAC;YACAC;YACAC;YACAC;YACA0F,QAAQ3F;QACV;IACF;IAEA,OAAO;QACL4B;QACAyD,eAAe1D;QACfhB,MAAMkB;IACR;AACF;AAGA,SAAS+D,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,GAAG,QAAQ,cAAa"}
package/dist/types.d.ts CHANGED
@@ -11,6 +11,14 @@ export type Args = {
11
11
  * Examples may include: composite indices, generated columns, vectors
12
12
  */
13
13
  afterSchemaInit?: PostgresSchemaHook[];
14
+ /**
15
+ * Enable this flag if you want to thread your own ID to create operation data, for example:
16
+ * ```ts
17
+ * // doc created with id 1
18
+ * const doc = await payload.create({ collection: 'posts', data: {id: 1, title: "my title"}})
19
+ * ```
20
+ */
21
+ allowIDOnCreate?: boolean;
14
22
  /**
15
23
  * Transform the schema before it's built.
16
24
  * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,EAEb,kBAAkB,EACnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,q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,EAAE,MAAM,CAAA;YACZ,EAAE,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;SAC3C,EAAE,CAAA;QACH,IAAI,EAAE,OAAO,CAAA;QACb,kBAAkB,EAAE,MAAM,IAAI,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,UAAU,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACjC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n BasePostgresAdapter,\n GenericEnum,\n MigrateDownArgs,\n MigrateUpArgs,\n PostgresDB,\n PostgresSchemaHook,\n} from '@payloadcms/drizzle/postgres'\nimport type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { DrizzleConfig } from 'drizzle-orm'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type { PgSchema, PgTableFn, PgTransactionConfig } from 'drizzle-orm/pg-core'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type Args = {\n /**\n * Transform the schema after it's built.\n * You can use it to customize the schema with features that aren't supported by Payload.\n * Examples may include: composite indices, generated columns, vectors\n */\n afterSchemaInit?: PostgresSchemaHook[]\n /**\n * Transform the schema before it's built.\n * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.\n * To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)\n */\n beforeSchemaInit?: PostgresSchemaHook[]\n /**\n * Pass `true` to disale auto database creation if it doesn't exist.\n * @default false\n */\n disableCreateDatabase?: boolean\n extensions?: string[]\n /** Generated schema from payload generate:db-schema file path */\n generateSchemaOutputFile?: string\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push?: boolean\n relationshipsSuffix?: string\n /**\n * The schema name to use for the database\n * @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.\n */\n schemaName?: string\n tablesFilter?: string[]\n transactionOptions?: false | PgTransactionConfig\n versionsSuffix?: string\n}\n\nexport interface GeneratedDatabaseSchema {\n schemaUntyped: Record<string, unknown>\n}\n\ntype ResolveSchemaType<T> = 'schema' extends keyof T\n ? T['schema']\n : GeneratedDatabaseSchema['schemaUntyped']\n\ntype Drizzle = NodePgDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\nexport type PostgresAdapter = {\n drizzle: Drizzle\n pool: Pool\n poolOptions: PoolConfig\n} & BasePostgresAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n afterSchemaInit: PostgresSchemaHook[]\n\n beforeSchemaInit: PostgresSchemaHook[]\n beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>\n drizzle: Drizzle\n enums: Record<string, GenericEnum>\n extensions: Record<string, boolean>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, unknown>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n tablesFilter?: string[]\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAkEA,WAIuB"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n BasePostgresAdapter,\n GenericEnum,\n MigrateDownArgs,\n MigrateUpArgs,\n PostgresDB,\n PostgresSchemaHook,\n} from '@payloadcms/drizzle/postgres'\nimport type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { DrizzleConfig } from 'drizzle-orm'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type { PgSchema, PgTableFn, PgTransactionConfig } from 'drizzle-orm/pg-core'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type Args = {\n /**\n * Transform the schema after it's built.\n * You can use it to customize the schema with features that aren't supported by Payload.\n * Examples may include: composite indices, generated columns, vectors\n */\n afterSchemaInit?: PostgresSchemaHook[]\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * // doc created with id 1\n * const doc = await payload.create({ collection: 'posts', data: {id: 1, title: \"my title\"}})\n * ```\n */\n allowIDOnCreate?: boolean\n /**\n * Transform the schema before it's built.\n * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.\n * To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)\n */\n beforeSchemaInit?: PostgresSchemaHook[]\n /**\n * Pass `true` to disale auto database creation if it doesn't exist.\n * @default false\n */\n disableCreateDatabase?: boolean\n extensions?: string[]\n /** Generated schema from payload generate:db-schema file path */\n generateSchemaOutputFile?: string\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push?: boolean\n relationshipsSuffix?: string\n /**\n * The schema name to use for the database\n * @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.\n */\n schemaName?: string\n tablesFilter?: string[]\n transactionOptions?: false | PgTransactionConfig\n versionsSuffix?: string\n}\n\nexport interface GeneratedDatabaseSchema {\n schemaUntyped: Record<string, unknown>\n}\n\ntype ResolveSchemaType<T> = 'schema' extends keyof T\n ? T['schema']\n : GeneratedDatabaseSchema['schemaUntyped']\n\ntype Drizzle = NodePgDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\nexport type PostgresAdapter = {\n drizzle: Drizzle\n pool: Pool\n poolOptions: PoolConfig\n} & BasePostgresAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n afterSchemaInit: PostgresSchemaHook[]\n\n beforeSchemaInit: PostgresSchemaHook[]\n beginTransaction: (options?: PgTransactionConfig) => Promise<null | number | string>\n drizzle: Drizzle\n enums: Record<string, GenericEnum>\n extensions: Record<string, boolean>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, unknown>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n tablesFilter?: string[]\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AA0EA,WAIuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-postgres",
3
- "version": "3.29.0-internal.d2c9ba5",
3
+ "version": "3.29.0-internal.d74b919",
4
4
  "description": "The officially supported Postgres database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -70,17 +70,17 @@
70
70
  "prompts": "2.4.2",
71
71
  "to-snake-case": "1.0.0",
72
72
  "uuid": "10.0.0",
73
- "@payloadcms/drizzle": "3.29.0-internal.d2c9ba5"
73
+ "@payloadcms/drizzle": "3.29.0-internal.d74b919"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@hyrious/esbuild-plugin-commonjs": "^0.2.4",
77
77
  "@types/to-snake-case": "1.0.0",
78
78
  "esbuild": "0.24.2",
79
79
  "@payloadcms/eslint-config": "3.28.0",
80
- "payload": "3.29.0-internal.d2c9ba5"
80
+ "payload": "3.29.0-internal.d74b919"
81
81
  },
82
82
  "peerDependencies": {
83
- "payload": "3.29.0-internal.d2c9ba5"
83
+ "payload": "3.29.0-internal.d74b919"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",