@payloadcms/drizzle 4.0.0-internal.203916b → 4.0.0-internal.2071af3

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.
Files changed (268) hide show
  1. package/dist/createTableName.d.ts.map +1 -1
  2. package/dist/createTableName.js +2 -7
  3. package/dist/createTableName.js.map +1 -1
  4. package/dist/exports/postgres.d.ts +4 -1
  5. package/dist/exports/postgres.d.ts.map +1 -1
  6. package/dist/exports/postgres.js +4 -1
  7. package/dist/exports/postgres.js.map +1 -1
  8. package/dist/exports/sqlite.d.ts +2 -1
  9. package/dist/exports/sqlite.d.ts.map +1 -1
  10. package/dist/exports/sqlite.js +2 -1
  11. package/dist/exports/sqlite.js.map +1 -1
  12. package/dist/find/buildFindManyArgs.d.ts.map +1 -1
  13. package/dist/find/buildPolymorphicJoinQuery.d.ts +39 -0
  14. package/dist/find/buildPolymorphicJoinQuery.d.ts.map +1 -0
  15. package/dist/find/buildPolymorphicJoinQuery.js +146 -0
  16. package/dist/find/buildPolymorphicJoinQuery.js.map +1 -0
  17. package/dist/find/buildPolymorphicJoinWhere.d.ts +20 -0
  18. package/dist/find/buildPolymorphicJoinWhere.d.ts.map +1 -0
  19. package/dist/find/buildPolymorphicJoinWhere.js +301 -0
  20. package/dist/find/buildPolymorphicJoinWhere.js.map +1 -0
  21. package/dist/find/createPolymorphicJoinWherePlan.d.ts +38 -0
  22. package/dist/find/createPolymorphicJoinWherePlan.d.ts.map +1 -0
  23. package/dist/find/createPolymorphicJoinWherePlan.js +200 -0
  24. package/dist/find/createPolymorphicJoinWherePlan.js.map +1 -0
  25. package/dist/find/findMany.d.ts.map +1 -1
  26. package/dist/find/traverseFields.d.ts.map +1 -1
  27. package/dist/find/traverseFields.js +20 -191
  28. package/dist/find/traverseFields.js.map +1 -1
  29. package/dist/index.d.ts +4 -10
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -8
  32. package/dist/index.js.map +1 -1
  33. package/dist/migrate.d.ts.map +1 -1
  34. package/dist/migrate.js +41 -15
  35. package/dist/migrate.js.map +1 -1
  36. package/dist/migrateDown.d.ts +2 -1
  37. package/dist/migrateDown.d.ts.map +1 -1
  38. package/dist/migrateDown.js +17 -4
  39. package/dist/migrateDown.js.map +1 -1
  40. package/dist/migrateFresh.d.ts +4 -2
  41. package/dist/migrateFresh.d.ts.map +1 -1
  42. package/dist/migrateFresh.js +26 -9
  43. package/dist/migrateFresh.js.map +1 -1
  44. package/dist/migrateRefresh.d.ts +2 -1
  45. package/dist/migrateRefresh.d.ts.map +1 -1
  46. package/dist/migrateRefresh.js +20 -5
  47. package/dist/migrateRefresh.js.map +1 -1
  48. package/dist/migrateReset.d.ts +2 -1
  49. package/dist/migrateReset.d.ts.map +1 -1
  50. package/dist/migrateReset.js +18 -4
  51. package/dist/migrateReset.js.map +1 -1
  52. package/dist/migrateStatus.d.ts +2 -1
  53. package/dist/migrateStatus.d.ts.map +1 -1
  54. package/dist/migrateStatus.js +11 -6
  55. package/dist/migrateStatus.js.map +1 -1
  56. package/dist/postgres/createDatabase.d.ts.map +1 -1
  57. package/dist/postgres/createExtensions.d.ts.map +1 -1
  58. package/dist/postgres/createJSONQuery/index.d.ts.map +1 -1
  59. package/dist/postgres/createJSONQuery/index.js +3 -3
  60. package/dist/postgres/createJSONQuery/index.js.map +1 -1
  61. package/dist/postgres/init.d.ts.map +1 -1
  62. package/dist/postgres/init.js +6 -0
  63. package/dist/postgres/init.js.map +1 -1
  64. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts +35 -0
  65. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
  66. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js +185 -0
  67. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
  68. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  69. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js +8 -4
  70. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
  71. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  72. package/dist/postgres/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  73. package/dist/postgres/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  74. package/dist/postgres/predefinedMigrations/v2-v3/index.js +2 -2
  75. package/dist/postgres/predefinedMigrations/v2-v3/index.js.map +1 -1
  76. package/dist/postgres/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  77. package/dist/postgres/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  78. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts +15 -0
  79. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts.map +1 -0
  80. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js +25 -0
  81. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js.map +1 -0
  82. package/dist/postgres/query/postgresUnaccent.d.ts +13 -0
  83. package/dist/postgres/query/postgresUnaccent.d.ts.map +1 -0
  84. package/dist/postgres/query/postgresUnaccent.js +40 -0
  85. package/dist/postgres/query/postgresUnaccent.js.map +1 -0
  86. package/dist/postgres/requireDrizzleKit.d.ts +4 -0
  87. package/dist/postgres/requireDrizzleKit.d.ts.map +1 -1
  88. package/dist/postgres/requireDrizzleKit.js +16 -10
  89. package/dist/postgres/requireDrizzleKit.js.map +1 -1
  90. package/dist/postgres/schema/buildDrizzleTable.d.ts.map +1 -1
  91. package/dist/postgres/schema/geometryColumn.d.ts +2 -2
  92. package/dist/postgres/schema/geometryColumn.d.ts.map +1 -1
  93. package/dist/postgres/types.d.ts +13 -2
  94. package/dist/postgres/types.d.ts.map +1 -1
  95. package/dist/postgres/types.js.map +1 -1
  96. package/dist/queries/addJoinTable.d.ts +1 -1
  97. package/dist/queries/addJoinTable.d.ts.map +1 -1
  98. package/dist/queries/buildOperatorConstraint.d.ts +22 -0
  99. package/dist/queries/buildOperatorConstraint.d.ts.map +1 -0
  100. package/dist/queries/buildOperatorConstraint.js +63 -0
  101. package/dist/queries/buildOperatorConstraint.js.map +1 -0
  102. package/dist/queries/buildOrderBy.d.ts +1 -1
  103. package/dist/queries/buildOrderBy.d.ts.map +1 -1
  104. package/dist/queries/buildQuery.d.ts.map +1 -1
  105. package/dist/queries/getTableAlias.d.ts.map +1 -1
  106. package/dist/queries/getTableColumnFromPath.d.ts +12 -3
  107. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  108. package/dist/queries/getTableColumnFromPath.js +59 -27
  109. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  110. package/dist/queries/operatorMap.d.ts +7 -3
  111. package/dist/queries/operatorMap.d.ts.map +1 -1
  112. package/dist/queries/operatorMap.js.map +1 -1
  113. package/dist/queries/parseParams.d.ts.map +1 -1
  114. package/dist/queries/parseParams.js +262 -10
  115. package/dist/queries/parseParams.js.map +1 -1
  116. package/dist/queries/resolveRelationshipPath.d.ts +36 -0
  117. package/dist/queries/resolveRelationshipPath.d.ts.map +1 -0
  118. package/dist/queries/resolveRelationshipPath.js +66 -0
  119. package/dist/queries/resolveRelationshipPath.js.map +1 -0
  120. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  121. package/dist/queries/selectDistinct.d.ts.map +1 -1
  122. package/dist/queries/validateOperatorHandlers.d.ts +8 -0
  123. package/dist/queries/validateOperatorHandlers.d.ts.map +1 -0
  124. package/dist/queries/validateOperatorHandlers.js +30 -0
  125. package/dist/queries/validateOperatorHandlers.js.map +1 -0
  126. package/dist/schema/build.d.ts.map +1 -1
  127. package/dist/schema/build.js +3 -3
  128. package/dist/schema/build.js.map +1 -1
  129. package/dist/schema/buildDrizzleRelations.d.ts.map +1 -1
  130. package/dist/schema/buildRawSchema.d.ts.map +1 -1
  131. package/dist/schema/idToUUID.d.ts.map +1 -1
  132. package/dist/schema/traverseFields.d.ts.map +1 -1
  133. package/dist/schema/traverseFields.js +6 -5
  134. package/dist/schema/traverseFields.js.map +1 -1
  135. package/dist/schema/withDefault.d.ts.map +1 -1
  136. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -1
  137. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js +3 -2
  138. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
  139. package/dist/sqlite/createJSONQuery/index.d.ts.map +1 -1
  140. package/dist/sqlite/createJSONQuery/index.js +6 -5
  141. package/dist/sqlite/createJSONQuery/index.js.map +1 -1
  142. package/dist/sqlite/createRequireDrizzleKit.d.ts +6 -0
  143. package/dist/sqlite/createRequireDrizzleKit.d.ts.map +1 -0
  144. package/dist/sqlite/createRequireDrizzleKit.js +15 -0
  145. package/dist/sqlite/createRequireDrizzleKit.js.map +1 -0
  146. package/dist/sqlite/execute.js.map +1 -1
  147. package/dist/sqlite/insert.d.ts.map +1 -1
  148. package/dist/sqlite/insert.js +4 -1
  149. package/dist/sqlite/insert.js.map +1 -1
  150. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts +15 -0
  151. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
  152. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js +114 -0
  153. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
  154. package/dist/transform/read/hasManyNumber.d.ts.map +1 -1
  155. package/dist/transform/read/hasManyText.d.ts.map +1 -1
  156. package/dist/transform/read/index.d.ts.map +1 -1
  157. package/dist/transform/read/relationship.d.ts.map +1 -1
  158. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  159. package/dist/transform/read/traverseFields.js.map +1 -1
  160. package/dist/transform/write/array.d.ts.map +1 -1
  161. package/dist/transform/write/blocks.d.ts.map +1 -1
  162. package/dist/transform/write/index.d.ts.map +1 -1
  163. package/dist/transform/write/numbers.d.ts.map +1 -1
  164. package/dist/transform/write/relationships.d.ts.map +1 -1
  165. package/dist/transform/write/selects.d.ts.map +1 -1
  166. package/dist/transform/write/texts.d.ts.map +1 -1
  167. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  168. package/dist/transform/write/traverseFields.js +9 -15
  169. package/dist/transform/write/traverseFields.js.map +1 -1
  170. package/dist/types.d.ts +52 -4
  171. package/dist/types.d.ts.map +1 -1
  172. package/dist/types.js.map +1 -1
  173. package/dist/updateJobs.d.ts.map +1 -1
  174. package/dist/updateJobs.js +37 -0
  175. package/dist/updateJobs.js.map +1 -1
  176. package/dist/updateOne.d.ts.map +1 -1
  177. package/dist/updateOne.js +41 -1
  178. package/dist/updateOne.js.map +1 -1
  179. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -1
  180. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
  181. package/dist/upsertRow/handleUpsertError.d.ts.map +1 -1
  182. package/dist/upsertRow/index.d.ts +1 -1
  183. package/dist/upsertRow/index.d.ts.map +1 -1
  184. package/dist/upsertRow/index.js +25 -5
  185. package/dist/upsertRow/index.js.map +1 -1
  186. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  187. package/dist/upsertRow/insertArrays.js +2 -1
  188. package/dist/upsertRow/insertArrays.js.map +1 -1
  189. package/dist/upsertRow/shouldUseOptimizedUpsertRow.d.ts.map +1 -1
  190. package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -1
  191. package/dist/utilities/blocksToJsonMigrator.d.ts.map +1 -1
  192. package/dist/utilities/blocksToJsonMigrator.js +7 -18
  193. package/dist/utilities/blocksToJsonMigrator.js.map +1 -1
  194. package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
  195. package/dist/utilities/buildCreateMigration.js +13 -9
  196. package/dist/utilities/buildCreateMigration.js.map +1 -1
  197. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts +15 -0
  198. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts.map +1 -0
  199. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js +110 -0
  200. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js.map +1 -0
  201. package/dist/utilities/buildForeignKeyName.d.ts.map +1 -1
  202. package/dist/utilities/buildForeignKeyName.js +3 -2
  203. package/dist/utilities/buildForeignKeyName.js.map +1 -1
  204. package/dist/utilities/buildIndexName.d.ts.map +1 -1
  205. package/dist/utilities/buildIndexName.js +3 -2
  206. package/dist/utilities/buildIndexName.js.map +1 -1
  207. package/dist/utilities/checkTruncatedIdentifiers.d.ts +13 -0
  208. package/dist/utilities/checkTruncatedIdentifiers.d.ts.map +1 -0
  209. package/dist/utilities/checkTruncatedIdentifiers.js +56 -0
  210. package/dist/utilities/checkTruncatedIdentifiers.js.map +1 -0
  211. package/dist/utilities/createBlocksMap.d.ts.map +1 -1
  212. package/dist/utilities/createRelationshipMap.d.ts.map +1 -1
  213. package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
  214. package/dist/utilities/createSchemaGenerator.js +10 -12
  215. package/dist/utilities/createSchemaGenerator.js.map +1 -1
  216. package/dist/utilities/escapeSQLValue.d.ts.map +1 -1
  217. package/dist/utilities/executeSchemaHooks.d.ts.map +1 -1
  218. package/dist/utilities/executeSchemaHooks.js +1 -1
  219. package/dist/utilities/executeSchemaHooks.js.map +1 -1
  220. package/dist/utilities/extendDrizzleTable.d.ts.map +1 -1
  221. package/dist/utilities/formatGeneratedFile.d.ts +10 -0
  222. package/dist/utilities/formatGeneratedFile.d.ts.map +1 -0
  223. package/dist/utilities/formatGeneratedFile.js +58 -0
  224. package/dist/utilities/formatGeneratedFile.js.map +1 -0
  225. package/dist/utilities/getArrayRelationName.d.ts.map +1 -1
  226. package/dist/utilities/getCollectionIdType.d.ts.map +1 -1
  227. package/dist/utilities/getMigrationTemplate.d.ts.map +1 -1
  228. package/dist/utilities/getNameFromDrizzleTable.d.ts.map +1 -1
  229. package/dist/utilities/getPrimaryDb.d.ts +1 -1
  230. package/dist/utilities/getPrimaryDb.d.ts.map +1 -1
  231. package/dist/utilities/getSizesToVariantsRenames.d.ts +54 -0
  232. package/dist/utilities/getSizesToVariantsRenames.d.ts.map +1 -0
  233. package/dist/utilities/getSizesToVariantsRenames.js +251 -0
  234. package/dist/utilities/getSizesToVariantsRenames.js.map +1 -0
  235. package/dist/utilities/getTransaction.d.ts +1 -1
  236. package/dist/utilities/getTransaction.d.ts.map +1 -1
  237. package/dist/utilities/getTransaction.js.map +1 -1
  238. package/dist/utilities/hasLocalesTable.d.ts.map +1 -1
  239. package/dist/utilities/isPolymorphicRelationship.d.ts.map +1 -1
  240. package/dist/utilities/isUUIDType.d.ts.map +1 -1
  241. package/dist/utilities/json.d.ts.map +1 -1
  242. package/dist/utilities/migrationTableExists.d.ts.map +1 -1
  243. package/dist/utilities/parseError.d.ts.map +1 -1
  244. package/dist/utilities/parseJSONPathSegment.d.ts +9 -0
  245. package/dist/utilities/parseJSONPathSegment.d.ts.map +1 -0
  246. package/dist/utilities/parseJSONPathSegment.js +17 -0
  247. package/dist/utilities/parseJSONPathSegment.js.map +1 -0
  248. package/dist/utilities/pushDevSchema.d.ts.map +1 -1
  249. package/dist/utilities/pushDevSchema.js +1 -1
  250. package/dist/utilities/pushDevSchema.js.map +1 -1
  251. package/dist/utilities/rawConstraint.d.ts.map +1 -1
  252. package/dist/utilities/sanitizePathSegment.d.ts.map +1 -1
  253. package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -5
  254. package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
  255. package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
  256. package/dist/utilities/validateIdentifierLength.d.ts +12 -0
  257. package/dist/utilities/validateIdentifierLength.d.ts.map +1 -0
  258. package/dist/utilities/validateIdentifierLength.js +18 -0
  259. package/dist/utilities/validateIdentifierLength.js.map +1 -0
  260. package/package.json +17 -19
  261. package/dist/sqlite/requireDrizzleKit.d.ts +0 -3
  262. package/dist/sqlite/requireDrizzleKit.d.ts.map +0 -1
  263. package/dist/sqlite/requireDrizzleKit.js +0 -12
  264. package/dist/sqlite/requireDrizzleKit.js.map +0 -1
  265. package/dist/upsertRow/handleUpsertError.spec.js +0 -42
  266. package/dist/upsertRow/handleUpsertError.spec.js.map +0 -1
  267. package/dist/utilities/isValidStringID.spec.js +0 -15
  268. package/dist/utilities/isValidStringID.spec.js.map +0 -1
@@ -1,3 +0,0 @@
1
- import type { RequireDrizzleKit } from '../types.js';
2
- export declare const requireDrizzleKit: RequireDrizzleKit;
3
- //# sourceMappingURL=requireDrizzleKit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requireDrizzleKit.d.ts","sourceRoot":"","sources":["../../src/sqlite/requireDrizzleKit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,iBAAiB,EAAE,iBAY/B,CAAA"}
@@ -1,12 +0,0 @@
1
- import { createRequire } from 'module';
2
- const require = createRequire(import.meta.url);
3
- export const requireDrizzleKit = ()=>{
4
- const { generateSQLiteDrizzleJson, generateSQLiteMigration, pushSQLiteSchema } = require('drizzle-kit/api');
5
- return {
6
- generateDrizzleJson: generateSQLiteDrizzleJson,
7
- generateMigration: generateSQLiteMigration,
8
- pushSchema: pushSQLiteSchema
9
- };
10
- };
11
-
12
- //# sourceMappingURL=requireDrizzleKit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/sqlite/requireDrizzleKit.ts"],"sourcesContent":["import { createRequire } from 'module'\n\nimport type { RequireDrizzleKit } from '../types.js'\n\nconst require = createRequire(import.meta.url)\n\nexport const requireDrizzleKit: RequireDrizzleKit = () => {\n const {\n generateSQLiteDrizzleJson,\n generateSQLiteMigration,\n pushSQLiteSchema,\n } = require('drizzle-kit/api')\n\n return {\n generateDrizzleJson: generateSQLiteDrizzleJson,\n generateMigration: generateSQLiteMigration,\n pushSchema: pushSQLiteSchema,\n }\n}\n"],"names":["createRequire","require","url","requireDrizzleKit","generateSQLiteDrizzleJson","generateSQLiteMigration","pushSQLiteSchema","generateDrizzleJson","generateMigration","pushSchema"],"mappings":"AAAA,SAASA,aAAa,QAAQ,SAAQ;AAItC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAE7C,OAAO,MAAMC,oBAAuC;IAClD,MAAM,EACJC,yBAAyB,EACzBC,uBAAuB,EACvBC,gBAAgB,EACjB,GAAGL,QAAQ;IAEZ,OAAO;QACLM,qBAAqBH;QACrBI,mBAAmBH;QACnBI,YAAYH;IACd;AACF,EAAC"}
@@ -1,42 +0,0 @@
1
- import { ValidationError } from 'payload';
2
- import { describe, expect, it } from 'vitest';
3
- import { handleUpsertError } from './handleUpsertError.js';
4
- const adapter = {
5
- fieldConstraints: {}
6
- };
7
- describe('handleUpsertError', ()=>{
8
- it('preserves the failing sub-table name on the ValidationError', ()=>{
9
- const pgError = {
10
- code: '23505',
11
- constraint: 'ultrasonic_avail_country_pkey',
12
- detail: 'Key (id)=(6a27e2a63f4b64567370f595) already exists.'
13
- };
14
- let thrown;
15
- try {
16
- handleUpsertError({
17
- adapter,
18
- collectionSlug: 'ultrasonic',
19
- error: pgError,
20
- tableName: 'ultrasonic_avail_country'
21
- });
22
- } catch (error) {
23
- thrown = error;
24
- }
25
- expect(thrown).toBeInstanceOf(ValidationError);
26
- const validationError = thrown;
27
- const fieldError = validationError.data.errors[0];
28
- expect(fieldError.path).toBe('id');
29
- expect(fieldError.tableName).toBe('ultrasonic_avail_country');
30
- });
31
- it('re-throws non unique-constraint errors unchanged', ()=>{
32
- const otherError = new Error('some other db error');
33
- expect(()=>handleUpsertError({
34
- adapter,
35
- collectionSlug: 'ultrasonic',
36
- error: otherError,
37
- tableName: 'ultrasonic_avail_country'
38
- })).toThrow(otherError);
39
- });
40
- });
41
-
42
- //# sourceMappingURL=handleUpsertError.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/upsertRow/handleUpsertError.spec.ts"],"sourcesContent":["import { ValidationError } from 'payload'\nimport { describe, expect, it } from 'vitest'\n\nimport type { DrizzleAdapter } from '../types.js'\n\nimport { handleUpsertError } from './handleUpsertError.js'\n\nconst adapter = { fieldConstraints: {} } as unknown as DrizzleAdapter\n\ndescribe('handleUpsertError', () => {\n it('preserves the failing sub-table name on the ValidationError', () => {\n const pgError = {\n code: '23505',\n constraint: 'ultrasonic_avail_country_pkey',\n detail: 'Key (id)=(6a27e2a63f4b64567370f595) already exists.',\n }\n\n let thrown: unknown\n try {\n handleUpsertError({\n adapter,\n collectionSlug: 'ultrasonic',\n error: pgError,\n tableName: 'ultrasonic_avail_country',\n })\n } catch (error) {\n thrown = error\n }\n\n expect(thrown).toBeInstanceOf(ValidationError)\n const validationError = thrown as ValidationError\n const fieldError = validationError.data.errors[0]!\n expect(fieldError.path).toBe('id')\n expect(fieldError.tableName).toBe('ultrasonic_avail_country')\n })\n\n it('re-throws non unique-constraint errors unchanged', () => {\n const otherError = new Error('some other db error')\n\n expect(() =>\n handleUpsertError({\n adapter,\n collectionSlug: 'ultrasonic',\n error: otherError,\n tableName: 'ultrasonic_avail_country',\n }),\n ).toThrow(otherError)\n })\n})\n"],"names":["ValidationError","describe","expect","it","handleUpsertError","adapter","fieldConstraints","pgError","code","constraint","detail","thrown","collectionSlug","error","tableName","toBeInstanceOf","validationError","fieldError","data","errors","path","toBe","otherError","Error","toThrow"],"mappings":"AAAA,SAASA,eAAe,QAAQ,UAAS;AACzC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAI7C,SAASC,iBAAiB,QAAQ,yBAAwB;AAE1D,MAAMC,UAAU;IAAEC,kBAAkB,CAAC;AAAE;AAEvCL,SAAS,qBAAqB;IAC5BE,GAAG,+DAA+D;QAChE,MAAMI,UAAU;YACdC,MAAM;YACNC,YAAY;YACZC,QAAQ;QACV;QAEA,IAAIC;QACJ,IAAI;YACFP,kBAAkB;gBAChBC;gBACAO,gBAAgB;gBAChBC,OAAON;gBACPO,WAAW;YACb;QACF,EAAE,OAAOD,OAAO;YACdF,SAASE;QACX;QAEAX,OAAOS,QAAQI,cAAc,CAACf;QAC9B,MAAMgB,kBAAkBL;QACxB,MAAMM,aAAaD,gBAAgBE,IAAI,CAACC,MAAM,CAAC,EAAE;QACjDjB,OAAOe,WAAWG,IAAI,EAAEC,IAAI,CAAC;QAC7BnB,OAAOe,WAAWH,SAAS,EAAEO,IAAI,CAAC;IACpC;IAEAlB,GAAG,oDAAoD;QACrD,MAAMmB,aAAa,IAAIC,MAAM;QAE7BrB,OAAO,IACLE,kBAAkB;gBAChBC;gBACAO,gBAAgB;gBAChBC,OAAOS;gBACPR,WAAW;YACb,IACAU,OAAO,CAACF;IACZ;AACF"}
@@ -1,15 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { isValidStringID } from './isValidStringID.js';
3
- describe('isValidStringID', ()=>{
4
- it('should pass', ()=>{
5
- expect(isValidStringID('1')).toBe(true);
6
- expect(isValidStringID('a_b_c')).toBe(true);
7
- expect(isValidStringID('8cc2df6d-6e07-4da4-be48-5fa747c3b92b')).toBe(true);
8
- });
9
- it('should not pass', ()=>{
10
- expect(isValidStringID('1 2 3')).toBe(false);
11
- expect(isValidStringID('1@')).toBe(false);
12
- });
13
- });
14
-
15
- //# sourceMappingURL=isValidStringID.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/isValidStringID.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { isValidStringID } from './isValidStringID.js'\n\ndescribe('isValidStringID', () => {\n it('should pass', () => {\n expect(isValidStringID('1')).toBe(true)\n expect(isValidStringID('a_b_c')).toBe(true)\n expect(isValidStringID('8cc2df6d-6e07-4da4-be48-5fa747c3b92b')).toBe(true)\n })\n\n it('should not pass', () => {\n expect(isValidStringID('1 2 3')).toBe(false)\n expect(isValidStringID('1@')).toBe(false)\n })\n})\n"],"names":["describe","it","expect","isValidStringID","toBe"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAC7C,SAASC,eAAe,QAAQ,uBAAsB;AAEtDH,SAAS,mBAAmB;IAC1BC,GAAG,eAAe;QAChBC,OAAOC,gBAAgB,MAAMC,IAAI,CAAC;QAClCF,OAAOC,gBAAgB,UAAUC,IAAI,CAAC;QACtCF,OAAOC,gBAAgB,yCAAyCC,IAAI,CAAC;IACvE;IAEAH,GAAG,mBAAmB;QACpBC,OAAOC,gBAAgB,UAAUC,IAAI,CAAC;QACtCF,OAAOC,gBAAgB,OAAOC,IAAI,CAAC;IACrC;AACF"}