@payloadcms/drizzle 4.0.0-internal.a0ef1b8 → 4.0.0-internal.a7ca468

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 (165) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/createTableName.d.ts.map +1 -1
  3. package/dist/createTableName.js +2 -7
  4. package/dist/createTableName.js.map +1 -1
  5. package/dist/exports/postgres.d.ts +1 -0
  6. package/dist/exports/postgres.d.ts.map +1 -1
  7. package/dist/exports/postgres.js +1 -0
  8. package/dist/exports/postgres.js.map +1 -1
  9. package/dist/exports/sqlite.d.ts +1 -0
  10. package/dist/exports/sqlite.d.ts.map +1 -1
  11. package/dist/exports/sqlite.js +1 -0
  12. package/dist/exports/sqlite.js.map +1 -1
  13. package/dist/find/buildFindManyArgs.d.ts.map +1 -1
  14. package/dist/find/findMany.d.ts.map +1 -1
  15. package/dist/find/traverseFields.d.ts.map +1 -1
  16. package/dist/find/traverseFields.js +1 -2
  17. package/dist/find/traverseFields.js.map +1 -1
  18. package/dist/index.d.ts +1 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +0 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/postgres/createDatabase.d.ts.map +1 -1
  23. package/dist/postgres/createExtensions.d.ts.map +1 -1
  24. package/dist/postgres/createJSONQuery/index.d.ts.map +1 -1
  25. package/dist/postgres/predefinedMigrations/localize-status/index.d.ts +11 -0
  26. package/dist/postgres/predefinedMigrations/localize-status/index.d.ts.map +1 -0
  27. package/dist/postgres/predefinedMigrations/localize-status/index.js +296 -0
  28. package/dist/postgres/predefinedMigrations/localize-status/index.js.map +1 -0
  29. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.d.ts +13 -0
  30. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.d.ts.map +1 -0
  31. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.js +51 -0
  32. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.js.map +1 -0
  33. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.d.ts +13 -0
  34. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.d.ts.map +1 -0
  35. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.js +54 -0
  36. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.js.map +1 -0
  37. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  38. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  39. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
  40. package/dist/postgres/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  41. package/dist/postgres/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  42. package/dist/postgres/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  43. package/dist/postgres/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  44. package/dist/postgres/schema/buildDrizzleTable.d.ts.map +1 -1
  45. package/dist/postgres/schema/geometryColumn.d.ts +2 -2
  46. package/dist/postgres/schema/geometryColumn.d.ts.map +1 -1
  47. package/dist/queries/addJoinTable.d.ts +1 -1
  48. package/dist/queries/addJoinTable.d.ts.map +1 -1
  49. package/dist/queries/buildOrderBy.d.ts +1 -1
  50. package/dist/queries/buildOrderBy.d.ts.map +1 -1
  51. package/dist/queries/buildQuery.d.ts.map +1 -1
  52. package/dist/queries/getTableAlias.d.ts.map +1 -1
  53. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  54. package/dist/queries/getTableColumnFromPath.js +2 -2
  55. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  56. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  57. package/dist/queries/selectDistinct.d.ts.map +1 -1
  58. package/dist/schema/build.d.ts.map +1 -1
  59. package/dist/schema/build.js +5 -4
  60. package/dist/schema/build.js.map +1 -1
  61. package/dist/schema/buildDrizzleRelations.d.ts.map +1 -1
  62. package/dist/schema/buildRawSchema.d.ts.map +1 -1
  63. package/dist/schema/buildRawSchema.spec.js +230 -0
  64. package/dist/schema/buildRawSchema.spec.js.map +1 -0
  65. package/dist/schema/idToUUID.d.ts.map +1 -1
  66. package/dist/schema/traverseFields.d.ts.map +1 -1
  67. package/dist/schema/traverseFields.js +7 -6
  68. package/dist/schema/traverseFields.js.map +1 -1
  69. package/dist/schema/withDefault.d.ts.map +1 -1
  70. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -1
  71. package/dist/sqlite/createJSONQuery/index.d.ts.map +1 -1
  72. package/dist/sqlite/predefinedMigrations/localize-status/index.d.ts +28 -0
  73. package/dist/sqlite/predefinedMigrations/localize-status/index.d.ts.map +1 -0
  74. package/dist/sqlite/predefinedMigrations/localize-status/index.js +198 -0
  75. package/dist/sqlite/predefinedMigrations/localize-status/index.js.map +1 -0
  76. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.d.ts +12 -0
  77. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.d.ts.map +1 -0
  78. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.js +24 -0
  79. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.js.map +1 -0
  80. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.d.ts +12 -0
  81. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.d.ts.map +1 -0
  82. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.js +28 -0
  83. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.js.map +1 -0
  84. package/dist/transform/read/hasManyNumber.d.ts.map +1 -1
  85. package/dist/transform/read/hasManyText.d.ts.map +1 -1
  86. package/dist/transform/read/index.d.ts.map +1 -1
  87. package/dist/transform/read/relationship.d.ts.map +1 -1
  88. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  89. package/dist/transform/read/traverseFields.js +2 -2
  90. package/dist/transform/read/traverseFields.js.map +1 -1
  91. package/dist/transform/write/array.d.ts.map +1 -1
  92. package/dist/transform/write/blocks.d.ts.map +1 -1
  93. package/dist/transform/write/blocks.js +1 -1
  94. package/dist/transform/write/blocks.js.map +1 -1
  95. package/dist/transform/write/index.d.ts.map +1 -1
  96. package/dist/transform/write/numbers.d.ts.map +1 -1
  97. package/dist/transform/write/relationships.d.ts.map +1 -1
  98. package/dist/transform/write/selects.d.ts.map +1 -1
  99. package/dist/transform/write/texts.d.ts.map +1 -1
  100. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  101. package/dist/transform/write/traverseFields.js +1 -2
  102. package/dist/transform/write/traverseFields.js.map +1 -1
  103. package/dist/types.d.ts +0 -4
  104. package/dist/types.d.ts.map +1 -1
  105. package/dist/types.js +1 -3
  106. package/dist/types.js.map +1 -1
  107. package/dist/updateJobs.d.ts.map +1 -1
  108. package/dist/updateJobs.js +37 -0
  109. package/dist/updateJobs.js.map +1 -1
  110. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -1
  111. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
  112. package/dist/upsertRow/handleUpsertError.d.ts.map +1 -1
  113. package/dist/upsertRow/handleUpsertError.js +2 -1
  114. package/dist/upsertRow/handleUpsertError.js.map +1 -1
  115. package/dist/upsertRow/handleUpsertError.spec.js +42 -0
  116. package/dist/upsertRow/handleUpsertError.spec.js.map +1 -0
  117. package/dist/upsertRow/index.d.ts.map +1 -1
  118. package/dist/upsertRow/index.js +5 -2
  119. package/dist/upsertRow/index.js.map +1 -1
  120. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  121. package/dist/upsertRow/insertArrays.js +2 -1
  122. package/dist/upsertRow/insertArrays.js.map +1 -1
  123. package/dist/upsertRow/shouldUseOptimizedUpsertRow.d.ts.map +1 -1
  124. package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -1
  125. package/dist/utilities/blocksToJsonMigrator.d.ts.map +1 -1
  126. package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
  127. package/dist/utilities/buildForeignKeyName.d.ts.map +1 -1
  128. package/dist/utilities/buildIndexName.d.ts.map +1 -1
  129. package/dist/utilities/createBlocksMap.d.ts.map +1 -1
  130. package/dist/utilities/createRelationshipMap.d.ts.map +1 -1
  131. package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
  132. package/dist/utilities/escapeSQLValue.d.ts.map +1 -1
  133. package/dist/utilities/executeSchemaHooks.d.ts.map +1 -1
  134. package/dist/utilities/extendDrizzleTable.d.ts.map +1 -1
  135. package/dist/utilities/getArrayRelationName.d.ts.map +1 -1
  136. package/dist/utilities/getCollectionIdType.d.ts.map +1 -1
  137. package/dist/utilities/getMigrationTemplate.d.ts.map +1 -1
  138. package/dist/utilities/getNameFromDrizzleTable.d.ts.map +1 -1
  139. package/dist/utilities/getPrimaryDb.d.ts +1 -1
  140. package/dist/utilities/getPrimaryDb.d.ts.map +1 -1
  141. package/dist/utilities/getTransaction.d.ts +1 -1
  142. package/dist/utilities/getTransaction.d.ts.map +1 -1
  143. package/dist/utilities/hasLocalesTable.d.ts.map +1 -1
  144. package/dist/utilities/isPolymorphicRelationship.d.ts.map +1 -1
  145. package/dist/utilities/isUUIDType.d.ts.map +1 -1
  146. package/dist/utilities/json.d.ts.map +1 -1
  147. package/dist/utilities/migrationTableExists.d.ts.map +1 -1
  148. package/dist/utilities/parseError.d.ts.map +1 -1
  149. package/dist/utilities/pushDevSchema.d.ts.map +1 -1
  150. package/dist/utilities/rawConstraint.d.ts.map +1 -1
  151. package/dist/utilities/sanitizePathSegment.d.ts.map +1 -1
  152. package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -5
  153. package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
  154. package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
  155. package/dist/utilities/validateIdentifierLength.d.ts +7 -0
  156. package/dist/utilities/validateIdentifierLength.d.ts.map +1 -0
  157. package/dist/utilities/validateIdentifierLength.js +14 -0
  158. package/dist/utilities/validateIdentifierLength.js.map +1 -0
  159. package/dist/utilities/validateIdentifierLength.spec.js +19 -0
  160. package/dist/utilities/validateIdentifierLength.spec.js.map +1 -0
  161. package/package.json +4 -4
  162. package/dist/find/chainMethods.d.ts +0 -20
  163. package/dist/find/chainMethods.d.ts.map +0 -1
  164. package/dist/find/chainMethods.js +0 -16
  165. package/dist/find/chainMethods.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { maxIdentifierLength, validateIdentifierLength } from './validateIdentifierLength.js';
3
+ describe('validateIdentifierLength', ()=>{
4
+ it('should return the name unchanged when at or under the 63-char limit', ()=>{
5
+ const name = 'a'.repeat(maxIdentifierLength);
6
+ expect(validateIdentifierLength(name)).toBe(name);
7
+ });
8
+ it('should throw when the name exceeds the 63-char limit', ()=>{
9
+ const name = 'a'.repeat(maxIdentifierLength + 1);
10
+ expect(()=>validateIdentifierLength(name)).toThrow('Exceeded max identifier length');
11
+ });
12
+ it('should include the invalid name and the dbName tip in the error', ()=>{
13
+ const name = `some_long_table_name${'x'.repeat(maxIdentifierLength)}_locales`;
14
+ expect(()=>validateIdentifierLength(name)).toThrow(name);
15
+ expect(()=>validateIdentifierLength(name)).toThrow('You can use the dbName property to reduce the table name length');
16
+ });
17
+ });
18
+
19
+ //# sourceMappingURL=validateIdentifierLength.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/validateIdentifierLength.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { maxIdentifierLength, validateIdentifierLength } from './validateIdentifierLength.js'\n\ndescribe('validateIdentifierLength', () => {\n it('should return the name unchanged when at or under the 63-char limit', () => {\n const name = 'a'.repeat(maxIdentifierLength)\n\n expect(validateIdentifierLength(name)).toBe(name)\n })\n\n it('should throw when the name exceeds the 63-char limit', () => {\n const name = 'a'.repeat(maxIdentifierLength + 1)\n\n expect(() => validateIdentifierLength(name)).toThrow('Exceeded max identifier length')\n })\n\n it('should include the invalid name and the dbName tip in the error', () => {\n const name = `some_long_table_name${'x'.repeat(maxIdentifierLength)}_locales`\n\n expect(() => validateIdentifierLength(name)).toThrow(name)\n expect(() => validateIdentifierLength(name)).toThrow(\n 'You can use the dbName property to reduce the table name length',\n )\n })\n})\n"],"names":["describe","expect","it","maxIdentifierLength","validateIdentifierLength","name","repeat","toBe","toThrow"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,mBAAmB,EAAEC,wBAAwB,QAAQ,gCAA+B;AAE7FJ,SAAS,4BAA4B;IACnCE,GAAG,uEAAuE;QACxE,MAAMG,OAAO,IAAIC,MAAM,CAACH;QAExBF,OAAOG,yBAAyBC,OAAOE,IAAI,CAACF;IAC9C;IAEAH,GAAG,wDAAwD;QACzD,MAAMG,OAAO,IAAIC,MAAM,CAACH,sBAAsB;QAE9CF,OAAO,IAAMG,yBAAyBC,OAAOG,OAAO,CAAC;IACvD;IAEAN,GAAG,mEAAmE;QACpE,MAAMG,OAAO,CAAC,oBAAoB,EAAE,IAAIC,MAAM,CAACH,qBAAqB,QAAQ,CAAC;QAE7EF,OAAO,IAAMG,yBAAyBC,OAAOG,OAAO,CAACH;QACrDJ,OAAO,IAAMG,yBAAyBC,OAAOG,OAAO,CAClD;IAEJ;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/drizzle",
3
- "version": "4.0.0-internal.a0ef1b8",
3
+ "version": "4.0.0-internal.a7ca468",
4
4
  "description": "A library of shared functions used by different payload database adapters",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -54,11 +54,11 @@
54
54
  "@libsql/client": "0.14.0",
55
55
  "@types/pg": "8.20.0",
56
56
  "@types/to-snake-case": "1.0.0",
57
- "payload": "4.0.0-internal.a0ef1b8",
58
- "@payloadcms/eslint-config": "3.28.0"
57
+ "@payloadcms/eslint-config": "3.28.0",
58
+ "payload": "4.0.0-internal.a7ca468"
59
59
  },
60
60
  "peerDependencies": {
61
- "payload": "4.0.0-internal.a0ef1b8"
61
+ "payload": "4.0.0-internal.a7ca468"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "pnpm build:swc && pnpm build:types",
@@ -1,20 +0,0 @@
1
- /**
2
- * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building
3
- */
4
- export type ChainedMethods = {
5
- args: unknown[];
6
- method: string;
7
- }[];
8
- /**
9
- * Call and returning methods that would normally be chained together but cannot be because of control logic
10
- * @param methods
11
- * @param query
12
- *
13
- * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building
14
- */
15
- declare const chainMethods: <T>({ methods, query }: {
16
- methods: ChainedMethods;
17
- query: T;
18
- }) => T;
19
- export { chainMethods };
20
- //# sourceMappingURL=chainMethods.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chainMethods.d.ts","sourceRoot":"","sources":["../../src/find/chainMethods.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf,EAAE,CAAA;AAEH;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,GAAI,CAAC,EAAE,oBAAoB;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,KAAG,CAIpF,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,16 +0,0 @@
1
- /**
2
- * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building
3
- */ /**
4
- * Call and returning methods that would normally be chained together but cannot be because of control logic
5
- * @param methods
6
- * @param query
7
- *
8
- * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building
9
- */ const chainMethods = ({ methods, query })=>{
10
- return methods.reduce((query, { args, method })=>{
11
- return query[method](...args);
12
- }, query);
13
- };
14
- export { chainMethods };
15
-
16
- //# sourceMappingURL=chainMethods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/find/chainMethods.ts"],"sourcesContent":["/**\n * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building\n */\nexport type ChainedMethods = {\n args: unknown[]\n method: string\n}[]\n\n/**\n * Call and returning methods that would normally be chained together but cannot be because of control logic\n * @param methods\n * @param query\n *\n * @deprecated - will be removed in 4.0. Use query + $dynamic() instead: https://orm.drizzle.team/docs/dynamic-query-building\n */\nconst chainMethods = <T>({ methods, query }: { methods: ChainedMethods; query: T }): T => {\n return methods.reduce((query, { args, method }) => {\n return query[method](...args)\n }, query)\n}\n\nexport { chainMethods }\n"],"names":["chainMethods","methods","query","reduce","args","method"],"mappings":"AAAA;;CAEC,GAMD;;;;;;CAMC,GACD,MAAMA,eAAe,CAAI,EAAEC,OAAO,EAAEC,KAAK,EAAyC;IAChF,OAAOD,QAAQE,MAAM,CAAC,CAACD,OAAO,EAAEE,IAAI,EAAEC,MAAM,EAAE;QAC5C,OAAOH,KAAK,CAACG,OAAO,IAAID;IAC1B,GAAGF;AACL;AAEA,SAASF,YAAY,GAAE"}