@payloadcms/drizzle 4.0.0-internal.e55ccef → 4.0.0-internal.ea6e8f8
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/count.d.ts.map +1 -1
- package/dist/count.js +25 -3
- package/dist/count.js.map +1 -1
- package/dist/countVersions.d.ts.map +1 -1
- package/dist/countVersions.js +28 -4
- package/dist/countVersions.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +15 -2
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createTableName.d.ts.map +1 -1
- package/dist/createTableName.js +2 -7
- package/dist/createTableName.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +12 -1
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteBranchGlobal.d.ts +10 -0
- package/dist/deleteBranchGlobal.d.ts.map +1 -0
- package/dist/deleteBranchGlobal.js +27 -0
- package/dist/deleteBranchGlobal.js.map +1 -0
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +18 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/exports/postgres.d.ts +3 -0
- package/dist/exports/postgres.d.ts.map +1 -1
- package/dist/exports/postgres.js +3 -0
- package/dist/exports/postgres.js.map +1 -1
- package/dist/exports/sqlite.d.ts +1 -0
- package/dist/exports/sqlite.d.ts.map +1 -1
- package/dist/exports/sqlite.js +1 -0
- package/dist/exports/sqlite.js.map +1 -1
- package/dist/find/buildFindManyArgs.d.ts +3 -2
- package/dist/find/buildFindManyArgs.d.ts.map +1 -1
- package/dist/find/buildFindManyArgs.js +2 -1
- package/dist/find/buildFindManyArgs.js.map +1 -1
- package/dist/find/buildPolymorphicJoinQuery.d.ts +39 -0
- package/dist/find/buildPolymorphicJoinQuery.d.ts.map +1 -0
- package/dist/find/buildPolymorphicJoinQuery.js +152 -0
- package/dist/find/buildPolymorphicJoinQuery.js.map +1 -0
- package/dist/find/buildPolymorphicJoinWhere.d.ts +20 -0
- package/dist/find/buildPolymorphicJoinWhere.d.ts.map +1 -0
- package/dist/find/buildPolymorphicJoinWhere.js +301 -0
- package/dist/find/buildPolymorphicJoinWhere.js.map +1 -0
- package/dist/find/createPolymorphicJoinWherePlan.d.ts +37 -0
- package/dist/find/createPolymorphicJoinWherePlan.d.ts.map +1 -0
- package/dist/find/createPolymorphicJoinWherePlan.js +191 -0
- package/dist/find/createPolymorphicJoinWherePlan.js.map +1 -0
- package/dist/find/findMany.d.ts +6 -1
- package/dist/find/findMany.d.ts.map +1 -1
- package/dist/find/findMany.js +16 -3
- package/dist/find/findMany.js.map +1 -1
- package/dist/find/traverseFields.d.ts +3 -2
- package/dist/find/traverseFields.d.ts.map +1 -1
- package/dist/find/traverseFields.js +72 -197
- package/dist/find/traverseFields.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +32 -4
- package/dist/find.js.map +1 -1
- package/dist/findDistinct.d.ts.map +1 -1
- package/dist/findDistinct.js +107 -8
- package/dist/findDistinct.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +22 -5
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.js +8 -3
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +30 -3
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +32 -5
- package/dist/findVersions.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/migrate.d.ts.map +1 -1
- package/dist/migrate.js +41 -15
- package/dist/migrate.js.map +1 -1
- package/dist/migrateDown.d.ts +2 -1
- package/dist/migrateDown.d.ts.map +1 -1
- package/dist/migrateDown.js +17 -4
- package/dist/migrateDown.js.map +1 -1
- package/dist/migrateFresh.d.ts +4 -2
- package/dist/migrateFresh.d.ts.map +1 -1
- package/dist/migrateFresh.js +26 -9
- package/dist/migrateFresh.js.map +1 -1
- package/dist/migrateRefresh.d.ts +2 -1
- package/dist/migrateRefresh.d.ts.map +1 -1
- package/dist/migrateRefresh.js +20 -5
- package/dist/migrateRefresh.js.map +1 -1
- package/dist/migrateReset.d.ts +2 -1
- package/dist/migrateReset.d.ts.map +1 -1
- package/dist/migrateReset.js +18 -4
- package/dist/migrateReset.js.map +1 -1
- package/dist/migrateStatus.d.ts +2 -1
- package/dist/migrateStatus.d.ts.map +1 -1
- package/dist/migrateStatus.js +11 -6
- package/dist/migrateStatus.js.map +1 -1
- package/dist/postgres/createJSONQuery/index.js +3 -3
- package/dist/postgres/createJSONQuery/index.js.map +1 -1
- package/dist/postgres/init.d.ts.map +1 -1
- package/dist/postgres/init.js +6 -0
- package/dist/postgres/init.js.map +1 -1
- package/dist/postgres/insert.d.ts.map +1 -1
- package/dist/postgres/insert.js +4 -2
- package/dist/postgres/insert.js.map +1 -1
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts +35 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js +185 -0
- package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js +8 -4
- package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/index.js +1 -1
- package/dist/postgres/predefinedMigrations/v2-v3/index.js.map +1 -1
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts +15 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts.map +1 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js +25 -0
- package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js.map +1 -0
- package/dist/postgres/query/postgresUnaccent.d.ts +13 -0
- package/dist/postgres/query/postgresUnaccent.d.ts.map +1 -0
- package/dist/postgres/query/postgresUnaccent.js +40 -0
- package/dist/postgres/query/postgresUnaccent.js.map +1 -0
- package/dist/postgres/types.d.ts +17 -2
- package/dist/postgres/types.d.ts.map +1 -1
- package/dist/postgres/types.js.map +1 -1
- package/dist/queries/buildAndOrConditions.d.ts +3 -2
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
- package/dist/queries/buildAndOrConditions.js +2 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildBranchVisibility.d.ts +11 -0
- package/dist/queries/buildBranchVisibility.d.ts.map +1 -0
- package/dist/queries/buildBranchVisibility.js +48 -0
- package/dist/queries/buildBranchVisibility.js.map +1 -0
- package/dist/queries/buildOperatorConstraint.d.ts +22 -0
- package/dist/queries/buildOperatorConstraint.d.ts.map +1 -0
- package/dist/queries/buildOperatorConstraint.js +63 -0
- package/dist/queries/buildOperatorConstraint.js.map +1 -0
- package/dist/queries/buildOrderBy.d.ts +3 -2
- package/dist/queries/buildOrderBy.d.ts.map +1 -1
- package/dist/queries/buildOrderBy.js +2 -1
- package/dist/queries/buildOrderBy.js.map +1 -1
- package/dist/queries/buildQuery.d.ts +3 -2
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildQuery.js +4 -2
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/getTableColumnFromPath.d.ts +15 -5
- package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
- package/dist/queries/getTableColumnFromPath.js +225 -54
- package/dist/queries/getTableColumnFromPath.js.map +1 -1
- package/dist/queries/operatorMap.d.ts +7 -3
- package/dist/queries/operatorMap.d.ts.map +1 -1
- package/dist/queries/operatorMap.js.map +1 -1
- package/dist/queries/parseParams.d.ts +3 -2
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +266 -11
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queries/resolveRelationshipPath.d.ts +36 -0
- package/dist/queries/resolveRelationshipPath.d.ts.map +1 -0
- package/dist/queries/resolveRelationshipPath.js +66 -0
- package/dist/queries/resolveRelationshipPath.js.map +1 -0
- package/dist/queries/validateOperatorHandlers.d.ts +8 -0
- package/dist/queries/validateOperatorHandlers.d.ts.map +1 -0
- package/dist/queries/validateOperatorHandlers.js +30 -0
- package/dist/queries/validateOperatorHandlers.js.map +1 -0
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +23 -4
- package/dist/queryDrafts.js.map +1 -1
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +20 -17
- package/dist/schema/build.js.map +1 -1
- package/dist/schema/traverseFields.js +5 -5
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js +3 -2
- package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
- package/dist/sqlite/createJSONQuery/index.d.ts.map +1 -1
- package/dist/sqlite/createJSONQuery/index.js +6 -5
- package/dist/sqlite/createJSONQuery/index.js.map +1 -1
- package/dist/sqlite/insert.d.ts.map +1 -1
- package/dist/sqlite/insert.js +9 -4
- package/dist/sqlite/insert.js.map +1 -1
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts +15 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js +114 -0
- package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
- package/dist/sqlite/types.d.ts +4 -0
- package/dist/sqlite/types.d.ts.map +1 -1
- package/dist/sqlite/types.js.map +1 -1
- package/dist/transactions/beginTransaction.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.js +13 -5
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/transactions/commitTransaction.d.ts.map +1 -1
- package/dist/transactions/commitTransaction.js +1 -5
- package/dist/transactions/commitTransaction.js.map +1 -1
- package/dist/transform/write/array.d.ts +3 -2
- package/dist/transform/write/array.d.ts.map +1 -1
- package/dist/transform/write/array.js +2 -1
- package/dist/transform/write/array.js.map +1 -1
- package/dist/transform/write/blocks.d.ts +3 -2
- package/dist/transform/write/blocks.d.ts.map +1 -1
- package/dist/transform/write/blocks.js +2 -1
- package/dist/transform/write/blocks.js.map +1 -1
- package/dist/transform/write/index.d.ts.map +1 -1
- package/dist/transform/write/index.js +2 -0
- package/dist/transform/write/index.js.map +1 -1
- package/dist/transform/write/traverseFields.d.ts +2 -1
- package/dist/transform/write/traverseFields.d.ts.map +1 -1
- package/dist/transform/write/traverseFields.js +40 -20
- package/dist/transform/write/traverseFields.js.map +1 -1
- package/dist/transform/write/types.d.ts +7 -0
- package/dist/transform/write/types.d.ts.map +1 -1
- package/dist/transform/write/types.js.map +1 -1
- package/dist/types.d.ts +51 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateGlobal.d.ts +5 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +96 -4
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateJobs.d.ts.map +1 -1
- package/dist/updateJobs.js +37 -0
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +86 -4
- package/dist/updateOne.js.map +1 -1
- package/dist/upsertBranchGlobalChange.d.ts +3 -0
- package/dist/upsertBranchGlobalChange.d.ts.map +1 -0
- package/dist/upsertBranchGlobalChange.js +35 -0
- package/dist/upsertBranchGlobalChange.js.map +1 -0
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +17 -12
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -1
- package/dist/upsertRow/index.d.ts +1 -1
- package/dist/upsertRow/index.d.ts.map +1 -1
- package/dist/upsertRow/index.js +156 -46
- package/dist/upsertRow/index.js.map +1 -1
- package/dist/upsertRow/types.d.ts +3 -0
- package/dist/upsertRow/types.d.ts.map +1 -1
- package/dist/upsertRow/types.js.map +1 -1
- package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
- package/dist/utilities/buildCreateMigration.js +12 -8
- package/dist/utilities/buildCreateMigration.js.map +1 -1
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts +15 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts.map +1 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js +110 -0
- package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js.map +1 -0
- package/dist/utilities/buildForeignKeyName.d.ts.map +1 -1
- package/dist/utilities/buildForeignKeyName.js +3 -2
- package/dist/utilities/buildForeignKeyName.js.map +1 -1
- package/dist/utilities/buildIndexName.d.ts.map +1 -1
- package/dist/utilities/buildIndexName.js +3 -2
- package/dist/utilities/buildIndexName.js.map +1 -1
- package/dist/utilities/checkTruncatedIdentifiers.d.ts +13 -0
- package/dist/utilities/checkTruncatedIdentifiers.d.ts.map +1 -0
- package/dist/utilities/checkTruncatedIdentifiers.js +56 -0
- package/dist/utilities/checkTruncatedIdentifiers.js.map +1 -0
- package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
- package/dist/utilities/createSchemaGenerator.js +3 -0
- package/dist/utilities/createSchemaGenerator.js.map +1 -1
- package/dist/utilities/getSizesToVariantsRenames.d.ts +54 -0
- package/dist/utilities/getSizesToVariantsRenames.d.ts.map +1 -0
- package/dist/utilities/getSizesToVariantsRenames.js +251 -0
- package/dist/utilities/getSizesToVariantsRenames.js.map +1 -0
- package/dist/utilities/parseJSONPathSegment.d.ts +9 -0
- package/dist/utilities/parseJSONPathSegment.d.ts.map +1 -0
- package/dist/utilities/parseJSONPathSegment.js +17 -0
- package/dist/utilities/parseJSONPathSegment.js.map +1 -0
- package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -5
- package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
- package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
- package/dist/utilities/validateIdentifierLength.d.ts +12 -0
- package/dist/utilities/validateIdentifierLength.d.ts.map +1 -0
- package/dist/utilities/validateIdentifierLength.js +18 -0
- package/dist/utilities/validateIdentifierLength.js.map +1 -0
- package/package.json +3 -3
- package/dist/upsertRow/handleUpsertError.spec.js +0 -42
- package/dist/upsertRow/handleUpsertError.spec.js.map +0 -1
- package/dist/utilities/isValidStringID.spec.js +0 -15
- package/dist/utilities/isValidStringID.spec.js.map +0 -1
package/dist/sqlite/types.d.ts
CHANGED
|
@@ -97,6 +97,10 @@ export type Execute<T> = (args: {
|
|
|
97
97
|
}) => SQLiteRaw<Promise<T>> | SQLiteRaw<ResultSet>;
|
|
98
98
|
export type Insert = (args: {
|
|
99
99
|
db: LibSQLDatabase;
|
|
100
|
+
onConflictDoNothing?: {
|
|
101
|
+
target?: SQLiteColumn | SQLiteColumn[];
|
|
102
|
+
where?: SQL;
|
|
103
|
+
};
|
|
100
104
|
onConflictDoUpdate?: SQLiteInsertOnConflictDoUpdateConfig<any>;
|
|
101
105
|
tableName: string;
|
|
102
106
|
values: Record<string, unknown> | Record<string, unknown>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sqlite/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EACV,eAAe,EACf,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qlite/types.ts"],"sourcesContent":["import type { Client, ResultSet } from '@libsql/client'\nimport type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'\nimport type { DrizzleD1Database } from 'drizzle-orm/d1'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type {\n AnySQLiteColumn,\n SQLiteColumn,\n SQLiteInsertOnConflictDoUpdateConfig,\n SQLiteTableWithColumns,\n SQLiteTransactionConfig,\n} from 'drizzle-orm/sqlite-core'\nimport type { SQLiteRaw } from 'drizzle-orm/sqlite-core/query-builders/raw'\nimport type { Payload, PayloadRequest } from 'payload'\n\nimport type { Operators } from '../queries/operatorMap.js'\nimport type { BuildQueryJoinAliases, DrizzleAdapter } from '../types.js'\nimport type { extendDrizzleTable } from '../utilities/extendDrizzleTable.js'\n\ntype SQLiteSchema = {\n relations: Record<string, GenericRelation>\n tables: Record<string, SQLiteTableWithColumns<any>>\n}\n\ntype SQLiteSchemaHookArgs = {\n extendTable: typeof extendDrizzleTable\n schema: SQLiteSchema\n}\n\nexport type SQLiteSchemaHook = (args: SQLiteSchemaHookArgs) => Promise<SQLiteSchema> | SQLiteSchema\n\nexport type BaseSQLiteArgs = {\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?: SQLiteSchemaHook[]\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 * Enable [AUTOINCREMENT](https://www.sqlite.org/autoinc.html) for Primary Keys.\n * This ensures that the same ID cannot be reused from previously deleted rows.\n */\n autoIncrement?: 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?: SQLiteSchemaHook[]\n /**\n * Store blocks as JSON column instead of storing them in a relational structure.\n */\n blocksAsJSON?: boolean\n /** Generated schema from payload generate:db-schema file path */\n generateSchemaOutputFile?: string\n idType?: 'number' | 'uuid' | 'uuidv7'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\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 schemaName?: string\n transactionOptions?: false | SQLiteTransactionConfig\n versionsSuffix?: string\n}\n\nexport type GenericColumns = {\n [x: string]: AnySQLiteColumn\n}\n\nexport type GenericTable = SQLiteTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type CountDistinct = (args: {\n column?: SQLiteColumn<any>\n db: LibSQLDatabase\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: LibSQLDatabase\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: BaseSQLiteAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: DrizzleD1Database | LibSQLDatabase\n drizzle?: DrizzleD1Database | LibSQLDatabase\n raw?: string\n sql?: SQL<unknown>\n}) => SQLiteRaw<Promise<T>> | SQLiteRaw<ResultSet>\n\nexport type Insert = (args: {\n db: LibSQLDatabase\n onConflictDoUpdate?: SQLiteInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\n// Explicitly omit drizzle property for complete override in SQLiteAdapter, required in ts 5.5\ntype SQLiteDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'idType'\n | 'insert'\n | 'operators'\n | 'relations'\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 = { $client: Client } & LibSQLDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\n\nexport type BaseSQLiteAdapter = {\n afterSchemaInit: SQLiteSchemaHook[]\n autoIncrement: boolean\n beforeSchemaInit: SQLiteSchemaHook[]\n client: Client\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: any\n deleteWhere: DeleteWhere\n dropDatabase: DropDatabase\n execute: Execute<unknown>\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: BaseSQLiteArgs['idType']\n initializing: Promise<void>\n insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\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 relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n schemaName?: BaseSQLiteArgs['schemaName']\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\n} & SQLiteDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'text'\n\nexport type MigrateUpArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateUpArgs } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\nexport type MigrateDownArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateDownArgs } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/sqlite/types.ts"],"sourcesContent":["import type { Client, ResultSet } from '@libsql/client'\nimport type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'\nimport type { DrizzleD1Database } from 'drizzle-orm/d1'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type {\n AnySQLiteColumn,\n SQLiteColumn,\n SQLiteInsertOnConflictDoUpdateConfig,\n SQLiteTableWithColumns,\n SQLiteTransactionConfig,\n} from 'drizzle-orm/sqlite-core'\nimport type { SQLiteRaw } from 'drizzle-orm/sqlite-core/query-builders/raw'\nimport type { Payload, PayloadRequest } from 'payload'\n\nimport type { Operators } from '../queries/operatorMap.js'\nimport type { BuildQueryJoinAliases, DrizzleAdapter } from '../types.js'\nimport type { extendDrizzleTable } from '../utilities/extendDrizzleTable.js'\n\ntype SQLiteSchema = {\n relations: Record<string, GenericRelation>\n tables: Record<string, SQLiteTableWithColumns<any>>\n}\n\ntype SQLiteSchemaHookArgs = {\n extendTable: typeof extendDrizzleTable\n schema: SQLiteSchema\n}\n\nexport type SQLiteSchemaHook = (args: SQLiteSchemaHookArgs) => Promise<SQLiteSchema> | SQLiteSchema\n\nexport type BaseSQLiteArgs = {\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?: SQLiteSchemaHook[]\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 * Enable [AUTOINCREMENT](https://www.sqlite.org/autoinc.html) for Primary Keys.\n * This ensures that the same ID cannot be reused from previously deleted rows.\n */\n autoIncrement?: 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?: SQLiteSchemaHook[]\n /**\n * Store blocks as JSON column instead of storing them in a relational structure.\n */\n blocksAsJSON?: boolean\n /** Generated schema from payload generate:db-schema file path */\n generateSchemaOutputFile?: string\n idType?: 'number' | 'uuid' | 'uuidv7'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\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 schemaName?: string\n transactionOptions?: false | SQLiteTransactionConfig\n versionsSuffix?: string\n}\n\nexport type GenericColumns = {\n [x: string]: AnySQLiteColumn\n}\n\nexport type GenericTable = SQLiteTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type CountDistinct = (args: {\n column?: SQLiteColumn<any>\n db: LibSQLDatabase\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: LibSQLDatabase\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: BaseSQLiteAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: DrizzleD1Database | LibSQLDatabase\n drizzle?: DrizzleD1Database | LibSQLDatabase\n raw?: string\n sql?: SQL<unknown>\n}) => SQLiteRaw<Promise<T>> | SQLiteRaw<ResultSet>\n\nexport type Insert = (args: {\n db: LibSQLDatabase\n onConflictDoNothing?: {\n target?: SQLiteColumn | SQLiteColumn[]\n where?: SQL\n }\n onConflictDoUpdate?: SQLiteInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\n// Explicitly omit drizzle property for complete override in SQLiteAdapter, required in ts 5.5\ntype SQLiteDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'idType'\n | 'insert'\n | 'operators'\n | 'relations'\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 = { $client: Client } & LibSQLDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\n\nexport type BaseSQLiteAdapter = {\n afterSchemaInit: SQLiteSchemaHook[]\n autoIncrement: boolean\n beforeSchemaInit: SQLiteSchemaHook[]\n client: Client\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: any\n deleteWhere: DeleteWhere\n dropDatabase: DropDatabase\n execute: Execute<unknown>\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: BaseSQLiteArgs['idType']\n initializing: Promise<void>\n insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\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 relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n schemaName?: BaseSQLiteArgs['schemaName']\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\n} & SQLiteDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'text'\n\nexport type MigrateUpArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateUpArgs } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\nexport type MigrateDownArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateDownArgs } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\n"],"names":[],"mappings":"AA6NA,WA8BC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beginTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/beginTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM/C,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"beginTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/beginTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM/C,eAAO,MAAM,gBAAgB,EAAE,gBAwE9B,CAAA"}
|
|
@@ -8,6 +8,8 @@ export const beginTransaction = async function beginTransaction(options) {
|
|
|
8
8
|
let transaction;
|
|
9
9
|
let transactionReady;
|
|
10
10
|
let transactionFailed;
|
|
11
|
+
let hasTransactionStarted = false;
|
|
12
|
+
const rollbackSignal = new Error('Payload transaction rollback requested');
|
|
11
13
|
// Await initialization here
|
|
12
14
|
// Prevent race conditions where the adapter may be
|
|
13
15
|
// re-initializing, and `this.drizzle` is potentially undefined
|
|
@@ -25,20 +27,26 @@ export const beginTransaction = async function beginTransaction(options) {
|
|
|
25
27
|
return done;
|
|
26
28
|
};
|
|
27
29
|
reject = ()=>{
|
|
28
|
-
|
|
29
|
-
rej();
|
|
30
|
+
rej(rollbackSignal);
|
|
30
31
|
return done;
|
|
31
32
|
};
|
|
32
33
|
transactionReady();
|
|
33
34
|
});
|
|
34
35
|
}, options || this.transactionOptions).catch((err)=>{
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
if (!hasTransactionStarted) {
|
|
37
|
+
// Connection failed before callback ran - reject instead of hanging forever
|
|
38
|
+
transactionFailed(err);
|
|
39
|
+
} else if (err !== rollbackSignal) {
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
37
42
|
});
|
|
38
43
|
// Need to wait until the transaction is ready
|
|
39
44
|
// before binding its `resolve` and `reject` methods below
|
|
40
45
|
await new Promise((res, rej)=>{
|
|
41
|
-
transactionReady =
|
|
46
|
+
transactionReady = ()=>{
|
|
47
|
+
hasTransactionStarted = true;
|
|
48
|
+
res();
|
|
49
|
+
};
|
|
42
50
|
transactionFailed = rej;
|
|
43
51
|
});
|
|
44
52
|
this.sessions[id] = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/beginTransaction.ts"],"sourcesContent":["import type { BeginTransaction } from 'payload'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { DrizzleAdapter, DrizzleTransaction } from '../types.js'\n\nexport const beginTransaction: BeginTransaction = async function beginTransaction(\n this: DrizzleAdapter,\n options: DrizzleAdapter['transactionOptions'],\n) {\n let id\n try {\n id = uuid()\n\n let reject: () => Promise<void>\n let resolve: () => Promise<void>\n let transaction: DrizzleTransaction\n\n let transactionReady: () => void\n let transactionFailed: (err: unknown) => void\n\n // Await initialization here\n // Prevent race conditions where the adapter may be\n // re-initializing, and `this.drizzle` is potentially undefined\n await this.initializing\n\n // Drizzle only exposes a transactions API that is sufficient if you\n // can directly pass around the `tx` argument. But our operations are spread\n // over many files and we don't want to pass the `tx` around like that,\n // so instead, we \"lift\" up the `resolve` and `reject` methods\n // and will call them in our respective transaction methods\n const done = this.drizzle\n .transaction(async (tx) => {\n transaction = tx\n await new Promise<void>((res, rej) => {\n resolve = () => {\n res()\n return done\n }\n reject = () => {\n
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/beginTransaction.ts"],"sourcesContent":["import type { BeginTransaction } from 'payload'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { DrizzleAdapter, DrizzleTransaction } from '../types.js'\n\nexport const beginTransaction: BeginTransaction = async function beginTransaction(\n this: DrizzleAdapter,\n options: DrizzleAdapter['transactionOptions'],\n) {\n let id\n try {\n id = uuid()\n\n let reject: () => Promise<void>\n let resolve: () => Promise<void>\n let transaction: DrizzleTransaction\n\n let transactionReady: () => void\n let transactionFailed: (err: unknown) => void\n let hasTransactionStarted = false\n const rollbackSignal = new Error('Payload transaction rollback requested')\n\n // Await initialization here\n // Prevent race conditions where the adapter may be\n // re-initializing, and `this.drizzle` is potentially undefined\n await this.initializing\n\n // Drizzle only exposes a transactions API that is sufficient if you\n // can directly pass around the `tx` argument. But our operations are spread\n // over many files and we don't want to pass the `tx` around like that,\n // so instead, we \"lift\" up the `resolve` and `reject` methods\n // and will call them in our respective transaction methods\n const done = this.drizzle\n .transaction(async (tx) => {\n transaction = tx\n await new Promise<void>((res, rej) => {\n resolve = () => {\n res()\n return done\n }\n reject = () => {\n rej(rollbackSignal)\n return done\n }\n transactionReady()\n })\n }, options || this.transactionOptions)\n .catch((err) => {\n if (!hasTransactionStarted) {\n // Connection failed before callback ran - reject instead of hanging forever\n transactionFailed(err)\n } else if (err !== rollbackSignal) {\n throw err\n }\n })\n\n // Need to wait until the transaction is ready\n // before binding its `resolve` and `reject` methods below\n await new Promise<void>((res, rej) => {\n transactionReady = () => {\n hasTransactionStarted = true\n res()\n }\n transactionFailed = rej\n })\n\n this.sessions[id] = {\n db: transaction,\n reject,\n resolve,\n }\n } catch (err) {\n this.payload.logger.error({ err, msg: `Error: cannot begin transaction: ${err.message}` })\n throw new Error(`Error: cannot begin transaction: ${err.message}`)\n }\n\n return id\n}\n"],"names":["v4","uuid","beginTransaction","options","id","reject","resolve","transaction","transactionReady","transactionFailed","hasTransactionStarted","rollbackSignal","Error","initializing","done","drizzle","tx","Promise","res","rej","transactionOptions","catch","err","sessions","db","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AAC,iCAAiC,EAAEU,IAAIO,OAAO,EAAE;IACnE;IAEA,OAAOzB;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commitTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/commitTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"commitTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/commitTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,eAAO,MAAM,iBAAiB,EAAE,iBAiB/B,CAAA"}
|
|
@@ -8,11 +8,7 @@ export const commitTransaction = async function commitTransaction(incomingID = '
|
|
|
8
8
|
// Delete from registry FIRST to prevent race conditions
|
|
9
9
|
// This ensures other operations can't retrieve this session while we're ending it
|
|
10
10
|
delete this.sessions[transactionID];
|
|
11
|
-
|
|
12
|
-
await session.resolve();
|
|
13
|
-
} catch (_) {
|
|
14
|
-
await session.reject();
|
|
15
|
-
}
|
|
11
|
+
await session.resolve();
|
|
16
12
|
};
|
|
17
13
|
|
|
18
14
|
//# sourceMappingURL=commitTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/commitTransaction.ts"],"sourcesContent":["import type { CommitTransaction } from 'payload'\n\nexport const commitTransaction: CommitTransaction = async function commitTransaction(\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n // if the session was deleted it has already been aborted\n if (!this.sessions[transactionID]) {\n return\n }\n\n const session = this.sessions[transactionID]\n\n // Delete from registry FIRST to prevent race conditions\n // This ensures other operations can't retrieve this session while we're ending it\n delete this.sessions[transactionID]\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/commitTransaction.ts"],"sourcesContent":["import type { CommitTransaction } from 'payload'\n\nexport const commitTransaction: CommitTransaction = async function commitTransaction(\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n // if the session was deleted it has already been aborted\n if (!this.sessions[transactionID]) {\n return\n }\n\n const session = this.sessions[transactionID]\n\n // Delete from registry FIRST to prevent race conditions\n // This ensures other operations can't retrieve this session while we're ending it\n delete this.sessions[transactionID]\n\n await session.resolve()\n}\n"],"names":["commitTransaction","incomingID","transactionID","Promise","sessions","session","resolve"],"mappings":"AAEA,OAAO,MAAMA,oBAAuC,eAAeA,kBACjEC,aAAa,EAAE;IAEf,MAAMC,gBAAgBD,sBAAsBE,UAAU,MAAMF,aAAaA;IAEzE,yDAAyD;IACzD,IAAI,CAAC,IAAI,CAACG,QAAQ,CAACF,cAAc,EAAE;QACjC;IACF;IAEA,MAAMG,UAAU,IAAI,CAACD,QAAQ,CAACF,cAAc;IAE5C,wDAAwD;IACxD,kFAAkF;IAClF,OAAO,IAAI,CAACE,QAAQ,CAACF,cAAc;IAEnC,MAAMG,QAAQC,OAAO;AACvB,EAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FlattenedArrayField } from 'payload';
|
|
2
2
|
import type { DrizzleAdapter } from '../../types.js';
|
|
3
|
-
import type { ArrayRowToInsert, BlockRowToInsert, NumberToDelete, RelationshipToDelete, TextToDelete } from './types.js';
|
|
3
|
+
import type { ArrayRowToInsert, BlockRowToInsert, NumberToDelete, RelationshipToDelete, RowToInsert, TextToDelete } from './types.js';
|
|
4
4
|
type Args = {
|
|
5
5
|
adapter: DrizzleAdapter;
|
|
6
6
|
arrayTableName: string;
|
|
@@ -21,6 +21,7 @@ type Args = {
|
|
|
21
21
|
selects: {
|
|
22
22
|
[tableName: string]: Record<string, unknown>[];
|
|
23
23
|
};
|
|
24
|
+
selectsToDelete: RowToInsert['selectsToDelete'];
|
|
24
25
|
texts: Record<string, unknown>[];
|
|
25
26
|
textsToDelete: TextToDelete[];
|
|
26
27
|
/**
|
|
@@ -29,6 +30,6 @@ type Args = {
|
|
|
29
30
|
*/
|
|
30
31
|
withinArrayOrBlockLocale?: string;
|
|
31
32
|
};
|
|
32
|
-
export declare const transformArray: ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => ArrayRowToInsert[];
|
|
33
|
+
export declare const transformArray: ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, selectsToDelete, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => ArrayRowToInsert[];
|
|
33
34
|
export {};
|
|
34
35
|
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/transform/write/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAA;AAKnB,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,mBAAmB,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,C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,CAAA;IAClC,eAAe,EAAE,cAAc,EAAE,CAAA;IACjC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,eAAe,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAA;IAC/C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAChC,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,cAAc,gQAoBxB,IAAI,uBA0EN,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fieldShouldBeLocalized } from 'payload/shared';
|
|
2
2
|
import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
|
|
3
3
|
import { traverseFields } from './traverseFields.js';
|
|
4
|
-
export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, texts, textsToDelete, withinArrayOrBlockLocale })=>{
|
|
4
|
+
export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, selectsToDelete, texts, textsToDelete, withinArrayOrBlockLocale })=>{
|
|
5
5
|
const newRows = [];
|
|
6
6
|
const hasUUID = adapter.tables[arrayTableName]._uuid;
|
|
7
7
|
if (isArrayOfRows(data)) {
|
|
@@ -60,6 +60,7 @@ export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks,
|
|
|
60
60
|
relationshipsToDelete,
|
|
61
61
|
row: newRow.row,
|
|
62
62
|
selects,
|
|
63
|
+
selectsToDelete,
|
|
63
64
|
texts,
|
|
64
65
|
textsToDelete,
|
|
65
66
|
withinArrayOrBlockLocale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/array.ts"],"sourcesContent":["import type { FlattenedArrayField } from 'payload'\n\nimport { fieldShouldBeLocalized } from 'payload/shared'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type {\n ArrayRowToInsert,\n BlockRowToInsert,\n NumberToDelete,\n RelationshipToDelete,\n TextToDelete,\n} from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n arrayTableName: string\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: unknown\n field: FlattenedArrayField\n locale?: string\n numbers: Record<string, unknown>[]\n numbersToDelete: NumberToDelete[]\n parentIsLocalized: boolean\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n textsToDelete: TextToDelete[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\n\nexport const transformArray = ({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n numbersToDelete,\n parentIsLocalized,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n}: Args) => {\n const newRows: ArrayRowToInsert[] = []\n\n const hasUUID = adapter.tables[arrayTableName]._uuid\n\n if (isArrayOfRows(data)) {\n data.forEach((arrayRow, i) => {\n const newRow: ArrayRowToInsert = {\n arrays: {},\n arraysToPush: {},\n locales: {},\n row: {\n _order: i + 1,\n },\n }\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = arrayRow.id\n delete arrayRow.id\n }\n\n if (locale) {\n newRow.locales[locale] = {\n _locale: locale,\n }\n }\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized }) && locale) {\n newRow.row._locale = locale\n }\n\n if (withinArrayOrBlockLocale) {\n newRow.row._locale = withinArrayOrBlockLocale\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n arraysToPush: newRow.arraysToPush,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: arrayRow,\n fieldPrefix: '',\n fields: field.flattenedFields,\n insideArrayOrBlock: true,\n locales: newRow.locales,\n numbers,\n numbersToDelete,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentTableName: arrayTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToAppend: [],\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n })\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["fieldShouldBeLocalized","isArrayOfRows","traverseFields","transformArray","adapter","arrayTableName","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","numbersToDelete","parentIsLocalized","path","relationships","relationshipsToDelete","selects","texts","textsToDelete","withinArrayOrBlockLocale","newRows","hasUUID","tables","_uuid","forEach","arrayRow","i","newRow","arrays","arraysToPush","locales","row","_order","id","_locale","columnPrefix","fieldPrefix","fields","flattenedFields","insideArrayOrBlock","localized","parentTableName","name","relationshipsToAppend","push"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,iBAAgB;
|
|
1
|
+
{"version":3,"sources":["../../../src/transform/write/array.ts"],"sourcesContent":["import type { FlattenedArrayField } from 'payload'\n\nimport { fieldShouldBeLocalized } from 'payload/shared'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type {\n ArrayRowToInsert,\n BlockRowToInsert,\n NumberToDelete,\n RelationshipToDelete,\n RowToInsert,\n TextToDelete,\n} from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n arrayTableName: string\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: unknown\n field: FlattenedArrayField\n locale?: string\n numbers: Record<string, unknown>[]\n numbersToDelete: NumberToDelete[]\n parentIsLocalized: boolean\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n selectsToDelete: RowToInsert['selectsToDelete']\n texts: Record<string, unknown>[]\n textsToDelete: TextToDelete[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\n\nexport const transformArray = ({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n numbersToDelete,\n parentIsLocalized,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n selectsToDelete,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n}: Args) => {\n const newRows: ArrayRowToInsert[] = []\n\n const hasUUID = adapter.tables[arrayTableName]._uuid\n\n if (isArrayOfRows(data)) {\n data.forEach((arrayRow, i) => {\n const newRow: ArrayRowToInsert = {\n arrays: {},\n arraysToPush: {},\n locales: {},\n row: {\n _order: i + 1,\n },\n }\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = arrayRow.id\n delete arrayRow.id\n }\n\n if (locale) {\n newRow.locales[locale] = {\n _locale: locale,\n }\n }\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized }) && locale) {\n newRow.row._locale = locale\n }\n\n if (withinArrayOrBlockLocale) {\n newRow.row._locale = withinArrayOrBlockLocale\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n arraysToPush: newRow.arraysToPush,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: arrayRow,\n fieldPrefix: '',\n fields: field.flattenedFields,\n insideArrayOrBlock: true,\n locales: newRow.locales,\n numbers,\n numbersToDelete,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentTableName: arrayTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToAppend: [],\n relationshipsToDelete,\n row: newRow.row,\n selects,\n selectsToDelete,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n })\n\n newRows.push(newRow)\n })\n }\n\n return newRows\n}\n"],"names":["fieldShouldBeLocalized","isArrayOfRows","traverseFields","transformArray","adapter","arrayTableName","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","numbersToDelete","parentIsLocalized","path","relationships","relationshipsToDelete","selects","selectsToDelete","texts","textsToDelete","withinArrayOrBlockLocale","newRows","hasUUID","tables","_uuid","forEach","arrayRow","i","newRow","arrays","arraysToPush","locales","row","_order","id","_locale","columnPrefix","fieldPrefix","fields","flattenedFields","insideArrayOrBlock","localized","parentTableName","name","relationshipsToAppend","push"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,iBAAgB;AAYvD,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,sBAAqB;AAgCpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,eAAe,EACfC,iBAAiB,EACjBC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,eAAe,EACfC,KAAK,EACLC,aAAa,EACbC,wBAAwB,EACnB;IACL,M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AC;YACF;YAEAC,QAAQwB,IAAI,CAACjB;QACf;IACF;IAEA,OAAOP;AACT,EAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FlattenedBlocksField } from 'payload';
|
|
2
2
|
import type { DrizzleAdapter } from '../../types.js';
|
|
3
|
-
import type { BlockRowToInsert, NumberToDelete, RelationshipToDelete, TextToDelete } from './types.js';
|
|
3
|
+
import type { BlockRowToInsert, NumberToDelete, RelationshipToDelete, RowToInsert, TextToDelete } from './types.js';
|
|
4
4
|
type Args = {
|
|
5
5
|
adapter: DrizzleAdapter;
|
|
6
6
|
baseTableName: string;
|
|
@@ -20,6 +20,7 @@ type Args = {
|
|
|
20
20
|
selects: {
|
|
21
21
|
[tableName: string]: Record<string, unknown>[];
|
|
22
22
|
};
|
|
23
|
+
selectsToDelete: RowToInsert['selectsToDelete'];
|
|
23
24
|
texts: Record<string, unknown>[];
|
|
24
25
|
textsToDelete: TextToDelete[];
|
|
25
26
|
/**
|
|
@@ -28,6 +29,6 @@ type Args = {
|
|
|
28
29
|
*/
|
|
29
30
|
withinArrayOrBlockLocale?: string;
|
|
30
31
|
};
|
|
31
|
-
export declare const transformBlocks: ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => void;
|
|
32
|
+
export declare const transformBlocks: ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, selectsToDelete, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => void;
|
|
32
33
|
export {};
|
|
33
34
|
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/transform/write/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,oBAAoB,EAAE,MAAM,SAA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
|
2
2
|
import toSnakeCase from 'to-snake-case';
|
|
3
3
|
import { resolveBlockTableName } from '../../utilities/validateExistingBlockIsIdentical.js';
|
|
4
4
|
import { traverseFields } from './traverseFields.js';
|
|
5
|
-
export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, texts, textsToDelete, withinArrayOrBlockLocale })=>{
|
|
5
|
+
export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, selectsToDelete, texts, textsToDelete, withinArrayOrBlockLocale })=>{
|
|
6
6
|
data.forEach((blockRow, i)=>{
|
|
7
7
|
if (typeof blockRow.blockType !== 'string') {
|
|
8
8
|
return;
|
|
@@ -67,6 +67,7 @@ export const transformBlocks = ({ adapter, baseTableName, blocks, blocksToDelete
|
|
|
67
67
|
relationshipsToDelete,
|
|
68
68
|
row: newRow.row,
|
|
69
69
|
selects,
|
|
70
|
+
selectsToDelete,
|
|
70
71
|
texts,
|
|
71
72
|
textsToDelete,
|
|
72
73
|
withinArrayOrBlockLocale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/blocks.ts"],"sourcesContent":["import type { FlattenedBlock, FlattenedBlocksField } from 'payload'\n\nimport { fieldShouldBeLocalized } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type {\n BlockRowToInsert,\n NumberToDelete,\n RelationshipToDelete,\n TextToDelete,\n} from './types.js'\n\nimport { resolveBlockTableName } from '../../utilities/validateExistingBlockIsIdentical.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: Record<string, unknown>[]\n field: FlattenedBlocksField\n locale?: string\n numbers: Record<string, unknown>[]\n numbersToDelete: NumberToDelete[]\n parentIsLocalized: boolean\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n textsToDelete: TextToDelete[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\nexport const transformBlocks = ({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n numbersToDelete,\n parentIsLocalized,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n}: Args) => {\n data.forEach((blockRow, i) => {\n if (typeof blockRow.blockType !== 'string') {\n return\n }\n\n const matchedBlock =\n adapter.payload.blocks[blockRow.blockType] ??\n (field.blocks.find(\n (block) => typeof block !== 'string' && block.slug === blockRow.blockType,\n ) as FlattenedBlock | undefined)\n\n if (!matchedBlock) {\n return\n }\n const blockType = toSnakeCase(blockRow.blockType)\n\n const newRow: BlockRowToInsert = {\n arrays: {},\n arraysToPush: {},\n locales: {},\n row: {\n _order: i + 1,\n _path: `${path}${field.name}`,\n },\n }\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized }) && locale) {\n newRow.row._locale = locale\n }\n if (withinArrayOrBlockLocale) {\n newRow.row._locale = withinArrayOrBlockLocale\n }\n\n const blockTableName = resolveBlockTableName(\n matchedBlock,\n adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`),\n )\n\n if (!blocks[blockTableName]) {\n blocks[blockTableName] = []\n }\n\n const hasUUID = adapter.tables[blockTableName]._uuid\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = blockRow.id\n delete blockRow.id\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n arraysToPush: newRow.arraysToPush,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: blockRow,\n fieldPrefix: '',\n fields: matchedBlock.flattenedFields,\n insideArrayOrBlock: true,\n locales: newRow.locales,\n numbers,\n numbersToDelete,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentTableName: blockTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToAppend: [],\n relationshipsToDelete,\n row: newRow.row,\n selects,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n })\n\n blocks[blockTableName].push(newRow)\n })\n}\n"],"names":["fieldShouldBeLocalized","toSnakeCase","resolveBlockTableName","traverseFields","transformBlocks","adapter","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","numbersToDelete","parentIsLocalized","path","relationships","relationshipsToDelete","selects","texts","textsToDelete","withinArrayOrBlockLocale","forEach","blockRow","i","blockType","matchedBlock","payload","find","block","slug","newRow","arrays","arraysToPush","locales","row","_order","_path","name","_locale","blockTableName","tableNameMap","get","hasUUID","tables","_uuid","id","columnPrefix","fieldPrefix","fields","flattenedFields","insideArrayOrBlock","localized","parentTableName","relationshipsToAppend","push"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,iBAAiB,gBAAe;
|
|
1
|
+
{"version":3,"sources":["../../../src/transform/write/blocks.ts"],"sourcesContent":["import type { FlattenedBlock, FlattenedBlocksField } from 'payload'\n\nimport { fieldShouldBeLocalized } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type {\n BlockRowToInsert,\n NumberToDelete,\n RelationshipToDelete,\n RowToInsert,\n TextToDelete,\n} from './types.js'\n\nimport { resolveBlockTableName } from '../../utilities/validateExistingBlockIsIdentical.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n data: Record<string, unknown>[]\n field: FlattenedBlocksField\n locale?: string\n numbers: Record<string, unknown>[]\n numbersToDelete: NumberToDelete[]\n parentIsLocalized: boolean\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n selectsToDelete: RowToInsert['selectsToDelete']\n texts: Record<string, unknown>[]\n textsToDelete: TextToDelete[]\n /**\n * Set to a locale code if this set of fields is traversed within a\n * localized array or block field\n */\n withinArrayOrBlockLocale?: string\n}\nexport const transformBlocks = ({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data,\n field,\n locale,\n numbers,\n numbersToDelete,\n parentIsLocalized,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n selectsToDelete,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n}: Args) => {\n data.forEach((blockRow, i) => {\n if (typeof blockRow.blockType !== 'string') {\n return\n }\n\n const matchedBlock =\n adapter.payload.blocks[blockRow.blockType] ??\n (field.blocks.find(\n (block) => typeof block !== 'string' && block.slug === blockRow.blockType,\n ) as FlattenedBlock | undefined)\n\n if (!matchedBlock) {\n return\n }\n const blockType = toSnakeCase(blockRow.blockType)\n\n const newRow: BlockRowToInsert = {\n arrays: {},\n arraysToPush: {},\n locales: {},\n row: {\n _order: i + 1,\n _path: `${path}${field.name}`,\n },\n }\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized }) && locale) {\n newRow.row._locale = locale\n }\n if (withinArrayOrBlockLocale) {\n newRow.row._locale = withinArrayOrBlockLocale\n }\n\n const blockTableName = resolveBlockTableName(\n matchedBlock,\n adapter.tableNameMap.get(`${baseTableName}_blocks_${blockType}`),\n )\n\n if (!blocks[blockTableName]) {\n blocks[blockTableName] = []\n }\n\n const hasUUID = adapter.tables[blockTableName]._uuid\n\n // If we have declared a _uuid field on arrays,\n // that means the ID has to be unique,\n // and our ids within arrays are not unique.\n // So move the ID to a uuid field for storage\n // and allow the database to generate a serial id automatically\n if (hasUUID) {\n newRow.row._uuid = blockRow.id\n delete blockRow.id\n }\n\n traverseFields({\n adapter,\n arrays: newRow.arrays,\n arraysToPush: newRow.arraysToPush,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: '',\n data: blockRow,\n fieldPrefix: '',\n fields: matchedBlock.flattenedFields,\n insideArrayOrBlock: true,\n locales: newRow.locales,\n numbers,\n numbersToDelete,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentTableName: blockTableName,\n path: `${path || ''}${field.name}.${i}.`,\n relationships,\n relationshipsToAppend: [],\n relationshipsToDelete,\n row: newRow.row,\n selects,\n selectsToDelete,\n texts,\n textsToDelete,\n withinArrayOrBlockLocale,\n })\n\n blocks[blockTableName].push(newRow)\n })\n}\n"],"names":["fieldShouldBeLocalized","toSnakeCase","resolveBlockTableName","traverseFields","transformBlocks","adapter","baseTableName","blocks","blocksToDelete","data","field","locale","numbers","numbersToDelete","parentIsLocalized","path","relationships","relationshipsToDelete","selects","selectsToDelete","texts","textsToDelete","withinArrayOrBlockLocale","forEach","blockRow","i","blockType","matchedBlock","payload","find","block","slug","newRow","arrays","arraysToPush","locales","row","_order","_path","name","_locale","blockTableName","tableNameMap","get","hasUUID","tables","_uuid","id","columnPrefix","fieldPrefix","fields","flattenedFields","insideArrayOrBlock","localized","parentTableName","relationshipsToAppend","push"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,iBAAiB,gBAAe;AAWvC,SAASC,qBAAqB,QAAQ,sDAAqD;AAC3F,SAASC,cAAc,QAAQ,sBAAqB;AA8BpD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,OAAO,EACPC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,eAAe,EACfC,iBAAiB,EACjBC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,OAAO,EACPC,eAAe,EACfC,KAAK,EACLC,aAAa,EACbC,w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,YAAY;YACjC5B;YACAC;YACAC;YACAwC,cAAc;YACdvC,MAAMe;YACNyB,aAAa;YACbC,QAAQvB,aAAawB,eAAe;YACpCC,oBAAoB;YACpBjB,SAASH,OAAOG,OAAO;YACvBvB;YACAC;YACAC,mBAAmBA,qBAAqBJ,MAAM2C,SAAS;YACvDC,iBAAiBb;YACjB1B,MAAM,GAAGA,QAAQ,KAAKL,MAAM6B,IAAI,CAAC,CAAC,EAAEd,EAAE,CAAC,CAAC;YACxCT;YACAuC,uBAAuB,EAAE;YACzBtC;YACAmB,KAAKJ,OAAOI,GAAG;YACflB;YACAC;YACAC;YACAC;YACAC;QACF;QAEAf,MAAM,CAACkC,eAAe,CAACe,IAAI,CAACxB;IAC9B;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transform/write/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAI7C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,iBAAiB,uFAQ3B,IAAI,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transform/write/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAI7C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,iBAAiB,uFAQ3B,IAAI,KAAG,WAmDT,CAAA"}
|
|
@@ -14,6 +14,7 @@ export const transformForWrite = ({ adapter, data, enableAtomicWrites, fields, p
|
|
|
14
14
|
relationshipsToDelete: [],
|
|
15
15
|
row: {},
|
|
16
16
|
selects: {},
|
|
17
|
+
selectsToDelete: {},
|
|
17
18
|
texts: [],
|
|
18
19
|
textsToDelete: []
|
|
19
20
|
};
|
|
@@ -42,6 +43,7 @@ export const transformForWrite = ({ adapter, data, enableAtomicWrites, fields, p
|
|
|
42
43
|
relationshipsToDelete: rowToInsert.relationshipsToDelete,
|
|
43
44
|
row: rowToInsert.row,
|
|
44
45
|
selects: rowToInsert.selects,
|
|
46
|
+
selectsToDelete: rowToInsert.selectsToDelete,
|
|
45
47
|
texts: rowToInsert.texts,
|
|
46
48
|
textsToDelete: rowToInsert.textsToDelete
|
|
47
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/transform/write/index.ts"],"sourcesContent":["import type { FlattenedField } from 'payload'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { RowToInsert } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n data: Record<string, unknown>\n enableAtomicWrites?: boolean\n fields: FlattenedField[]\n parentIsLocalized?: boolean\n path?: string\n tableName: string\n}\n\nexport const transformForWrite = ({\n adapter,\n data,\n enableAtomicWrites,\n fields,\n parentIsLocalized,\n path = '',\n tableName,\n}: Args): RowToInsert => {\n // Split out the incoming data into rows to insert / delete\n const rowToInsert: RowToInsert = {\n arrays: {},\n arraysToPush: {},\n blocks: {},\n blocksToDelete: new Set(),\n locales: {},\n numbers: [],\n numbersToDelete: [],\n relationships: [],\n relationshipsToAppend: [],\n relationshipsToDelete: [],\n row: {},\n selects: {},\n texts: [],\n textsToDelete: [],\n }\n\n // This function is responsible for building up the\n // above rowToInsert\n traverseFields({\n adapter,\n arrays: rowToInsert.arrays,\n arraysToPush: rowToInsert.arraysToPush,\n baseTableName: tableName,\n blocks: rowToInsert.blocks,\n blocksToDelete: rowToInsert.blocksToDelete,\n columnPrefix: '',\n data,\n enableAtomicWrites,\n fieldPrefix: '',\n fields,\n locales: rowToInsert.locales,\n numbers: rowToInsert.numbers,\n numbersToDelete: rowToInsert.numbersToDelete,\n parentIsLocalized,\n parentTableName: tableName,\n path,\n relationships: rowToInsert.relationships,\n relationshipsToAppend: rowToInsert.relationshipsToAppend,\n relationshipsToDelete: rowToInsert.relationshipsToDelete,\n row: rowToInsert.row,\n selects: rowToInsert.selects,\n texts: rowToInsert.texts,\n textsToDelete: rowToInsert.textsToDelete,\n })\n\n return rowToInsert\n}\n"],"names":["traverseFields","transformForWrite","adapter","data","enableAtomicWrites","fields","parentIsLocalized","path","tableName","rowToInsert","arrays","arraysToPush","blocks","blocksToDelete","Set","locales","numbers","numbersToDelete","relationships","relationshipsToAppend","relationshipsToDelete","row","selects","texts","textsToDelete","baseTableName","columnPrefix","fieldPrefix","parentTableName"],"mappings":"AAKA,SAASA,cAAc,QAAQ,sBAAqB;AAYpD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,OAAO,EACPC,IAAI,EACJC,kBAAkB,EAClBC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EAAE,EACTC,SAAS,EACJ;IACL,2DAA2D;IAC3D,MAAMC,cAA2B;QAC/BC,QAAQ,CAAC;QACTC,cAAc,CAAC;QACfC,QAAQ,CAAC;QACTC,gBAAgB,IAAIC;QACpBC,SAAS,CAAC;QACVC,SAAS,EAAE;QACXC,iBAAiB,EAAE;QACnBC,eAAe,EAAE;QACjBC,uBAAuB,EAAE;QACzBC,uBAAuB,EAAE;QACzBC,KAAK,CAAC;QACNC,SAAS,CAAC;QACVC,OAAO,EAAE;QACTC,eAAe,EAAE;IACnB;IAEA,mDAAmD;IACnD,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../../../src/transform/write/index.ts"],"sourcesContent":["import type { FlattenedField } from 'payload'\n\nimport type { DrizzleAdapter } from '../../types.js'\nimport type { RowToInsert } from './types.js'\n\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n adapter: DrizzleAdapter\n data: Record<string, unknown>\n enableAtomicWrites?: boolean\n fields: FlattenedField[]\n parentIsLocalized?: boolean\n path?: string\n tableName: string\n}\n\nexport const transformForWrite = ({\n adapter,\n data,\n enableAtomicWrites,\n fields,\n parentIsLocalized,\n path = '',\n tableName,\n}: Args): RowToInsert => {\n // Split out the incoming data into rows to insert / delete\n const rowToInsert: RowToInsert = {\n arrays: {},\n arraysToPush: {},\n blocks: {},\n blocksToDelete: new Set(),\n locales: {},\n numbers: [],\n numbersToDelete: [],\n relationships: [],\n relationshipsToAppend: [],\n relationshipsToDelete: [],\n row: {},\n selects: {},\n selectsToDelete: {},\n texts: [],\n textsToDelete: [],\n }\n\n // This function is responsible for building up the\n // above rowToInsert\n traverseFields({\n adapter,\n arrays: rowToInsert.arrays,\n arraysToPush: rowToInsert.arraysToPush,\n baseTableName: tableName,\n blocks: rowToInsert.blocks,\n blocksToDelete: rowToInsert.blocksToDelete,\n columnPrefix: '',\n data,\n enableAtomicWrites,\n fieldPrefix: '',\n fields,\n locales: rowToInsert.locales,\n numbers: rowToInsert.numbers,\n numbersToDelete: rowToInsert.numbersToDelete,\n parentIsLocalized,\n parentTableName: tableName,\n path,\n relationships: rowToInsert.relationships,\n relationshipsToAppend: rowToInsert.relationshipsToAppend,\n relationshipsToDelete: rowToInsert.relationshipsToDelete,\n row: rowToInsert.row,\n selects: rowToInsert.selects,\n selectsToDelete: rowToInsert.selectsToDelete,\n texts: rowToInsert.texts,\n textsToDelete: rowToInsert.textsToDelete,\n })\n\n return rowToInsert\n}\n"],"names":["traverseFields","transformForWrite","adapter","data","enableAtomicWrites","fields","parentIsLocalized","path","tableName","rowToInsert","arrays","arraysToPush","blocks","blocksToDelete","Set","locales","numbers","numbersToDelete","relationships","relationshipsToAppend","relationshipsToDelete","row","selects","selectsToDelete","texts","textsToDelete","baseTableName","columnPrefix","fieldPrefix","parentTableName"],"mappings":"AAKA,SAASA,cAAc,QAAQ,sBAAqB;AAYpD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,OAAO,EACPC,IAAI,EACJC,kBAAkB,EAClBC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EAAE,EACTC,SAAS,EACJ;IACL,2DAA2D;IAC3D,MAAMC,cAA2B;QAC/BC,QAAQ,CAAC;QACTC,cAAc,CAAC;QACfC,QAAQ,CAAC;QACTC,gBAAgB,IAAIC;QACpBC,SAAS,CAAC;QACVC,SAAS,EAAE;QACXC,iBAAiB,EAAE;QACnBC,eAAe,EAAE;QACjBC,uBAAuB,EAAE;QACzBC,uBAAuB,EAAE;QACzBC,KAAK,CAAC;QACNC,SAAS,CAAC;QACVC,iBAAiB,CAAC;QAClBC,OAAO,EAAE;QACTC,eAAe,EAAE;IACnB;IAEA,mDAAmD;IACnD,oBAAoB;IACpBzB,eAAe;QACbE;QACAQ,QAAQD,YAAYC,MAAM;QAC1BC,cAAcF,YAAYE,YAAY;QACtCe,eAAelB;QACfI,QAAQH,YAAYG,MAAM;QAC1BC,gBAAgBJ,YAAYI,cAAc;QAC1Cc,cAAc;QACdxB;QACAC;QACAwB,aAAa;QACbvB;QACAU,SAASN,YAAYM,OAAO;QAC5BC,SAASP,YAAYO,OAAO;QAC5BC,iBAAiBR,YAAYQ,eAAe;QAC5CX;QACAuB,iBAAiBrB;QACjBD;QACAW,eAAeT,YAAYS,aAAa;QACxCC,uBAAuBV,YAAYU,qBAAqB;QACxDC,uBAAuBX,YAAYW,qBAAqB;QACxDC,KAAKZ,YAAYY,GAAG;QACpBC,SAASb,YAAYa,OAAO;QAC5BC,iBAAiBd,YAAYc,eAAe;QAC5CC,OAAOf,YAAYe,KAAK;QACxBC,eAAehB,YAAYgB,aAAa;IAC1C;IAEA,OAAOhB;AACT,EAAC"}
|
|
@@ -55,6 +55,7 @@ type Args = {
|
|
|
55
55
|
selects: {
|
|
56
56
|
[tableName: string]: Record<string, unknown>[];
|
|
57
57
|
};
|
|
58
|
+
selectsToDelete: RowToInsert['selectsToDelete'];
|
|
58
59
|
texts: Record<string, unknown>[];
|
|
59
60
|
textsToDelete: TextToDelete[];
|
|
60
61
|
/**
|
|
@@ -63,6 +64,6 @@ type Args = {
|
|
|
63
64
|
*/
|
|
64
65
|
withinArrayOrBlockLocale?: string;
|
|
65
66
|
};
|
|
66
|
-
export declare const traverseFields: ({ adapter, arrays, arraysToPush, baseTableName, blocks, blocksToDelete, columnPrefix, data, enableAtomicWrites, existingLocales, fieldPrefix, fields, forcedLocale, insideArrayOrBlock, locales, numbers, numbersToDelete, parentIsLocalized, parentTableName, path, relationships, relationshipsToAppend, relationshipsToDelete, row, selects, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => void;
|
|
67
|
+
export declare const traverseFields: ({ adapter, arrays, arraysToPush, baseTableName, blocks, blocksToDelete, columnPrefix, data, enableAtomicWrites, existingLocales, fieldPrefix, fields, forcedLocale, insideArrayOrBlock, locales, numbers, numbersToDelete, parentIsLocalized, parentTableName, path, relationships, relationshipsToAppend, relationshipsToDelete, row, selects, selectsToDelete, texts, textsToDelete, withinArrayOrBlockLocale, }: Args) => void;
|
|
67
68
|
export {};
|
|
68
69
|
//# sourceMappingURL=traverseFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/transform/write/traverseFields.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAIvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACb,MAAM,YAAY,CAAA;AAWnB,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7B;;;OAGG;IACH,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IACzC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC3C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC,eAA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