@payloadcms/drizzle 4.0.0-internal.688c4d0 → 4.0.0-internal.77191e5

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 (222) 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 +2 -0
  6. package/dist/exports/postgres.d.ts.map +1 -1
  7. package/dist/exports/postgres.js +2 -0
  8. package/dist/exports/postgres.js.map +1 -1
  9. package/dist/find/buildFindManyArgs.d.ts.map +1 -1
  10. package/dist/find/buildPolymorphicJoinQuery.d.ts +38 -0
  11. package/dist/find/buildPolymorphicJoinQuery.d.ts.map +1 -0
  12. package/dist/find/buildPolymorphicJoinQuery.js +135 -0
  13. package/dist/find/buildPolymorphicJoinQuery.js.map +1 -0
  14. package/dist/find/buildPolymorphicJoinWhere.d.ts +20 -0
  15. package/dist/find/buildPolymorphicJoinWhere.d.ts.map +1 -0
  16. package/dist/find/buildPolymorphicJoinWhere.js +301 -0
  17. package/dist/find/buildPolymorphicJoinWhere.js.map +1 -0
  18. package/dist/find/createPolymorphicJoinWherePlan.d.ts +37 -0
  19. package/dist/find/createPolymorphicJoinWherePlan.d.ts.map +1 -0
  20. package/dist/find/createPolymorphicJoinWherePlan.js +191 -0
  21. package/dist/find/createPolymorphicJoinWherePlan.js.map +1 -0
  22. package/dist/find/findMany.d.ts.map +1 -1
  23. package/dist/find/traverseFields.d.ts.map +1 -1
  24. package/dist/find/traverseFields.js +19 -191
  25. package/dist/find/traverseFields.js.map +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/migrate.d.ts.map +1 -1
  31. package/dist/migrate.js +35 -13
  32. package/dist/migrate.js.map +1 -1
  33. package/dist/migrateDown.d.ts +2 -1
  34. package/dist/migrateDown.d.ts.map +1 -1
  35. package/dist/migrateDown.js +12 -2
  36. package/dist/migrateDown.js.map +1 -1
  37. package/dist/migrateFresh.d.ts +4 -2
  38. package/dist/migrateFresh.d.ts.map +1 -1
  39. package/dist/migrateFresh.js +21 -7
  40. package/dist/migrateFresh.js.map +1 -1
  41. package/dist/migrateRefresh.d.ts +2 -1
  42. package/dist/migrateRefresh.d.ts.map +1 -1
  43. package/dist/migrateRefresh.js +14 -3
  44. package/dist/migrateRefresh.js.map +1 -1
  45. package/dist/migrateReset.d.ts +2 -1
  46. package/dist/migrateReset.d.ts.map +1 -1
  47. package/dist/migrateReset.js +12 -2
  48. package/dist/migrateReset.js.map +1 -1
  49. package/dist/migrateStatus.d.ts +2 -1
  50. package/dist/migrateStatus.d.ts.map +1 -1
  51. package/dist/migrateStatus.js +11 -6
  52. package/dist/migrateStatus.js.map +1 -1
  53. package/dist/postgres/createDatabase.d.ts.map +1 -1
  54. package/dist/postgres/createExtensions.d.ts.map +1 -1
  55. package/dist/postgres/createJSONQuery/index.d.ts.map +1 -1
  56. package/dist/postgres/createJSONQuery/index.js +3 -3
  57. package/dist/postgres/createJSONQuery/index.js.map +1 -1
  58. package/dist/postgres/init.d.ts.map +1 -1
  59. package/dist/postgres/init.js +6 -0
  60. package/dist/postgres/init.js.map +1 -1
  61. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  62. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  63. package/dist/postgres/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  64. package/dist/postgres/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  65. package/dist/postgres/predefinedMigrations/v2-v3/index.js +1 -1
  66. package/dist/postgres/predefinedMigrations/v2-v3/index.js.map +1 -1
  67. package/dist/postgres/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  68. package/dist/postgres/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  69. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts +15 -0
  70. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts.map +1 -0
  71. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js +25 -0
  72. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js.map +1 -0
  73. package/dist/postgres/query/postgresUnaccent.d.ts +13 -0
  74. package/dist/postgres/query/postgresUnaccent.d.ts.map +1 -0
  75. package/dist/postgres/query/postgresUnaccent.js +40 -0
  76. package/dist/postgres/query/postgresUnaccent.js.map +1 -0
  77. package/dist/postgres/schema/buildDrizzleTable.d.ts.map +1 -1
  78. package/dist/postgres/schema/geometryColumn.d.ts +2 -2
  79. package/dist/postgres/schema/geometryColumn.d.ts.map +1 -1
  80. package/dist/postgres/types.d.ts +13 -2
  81. package/dist/postgres/types.d.ts.map +1 -1
  82. package/dist/postgres/types.js.map +1 -1
  83. package/dist/queries/addJoinTable.d.ts +1 -1
  84. package/dist/queries/addJoinTable.d.ts.map +1 -1
  85. package/dist/queries/buildOperatorConstraint.d.ts +22 -0
  86. package/dist/queries/buildOperatorConstraint.d.ts.map +1 -0
  87. package/dist/queries/buildOperatorConstraint.js +63 -0
  88. package/dist/queries/buildOperatorConstraint.js.map +1 -0
  89. package/dist/queries/buildOrderBy.d.ts +1 -1
  90. package/dist/queries/buildOrderBy.d.ts.map +1 -1
  91. package/dist/queries/buildQuery.d.ts.map +1 -1
  92. package/dist/queries/getTableAlias.d.ts.map +1 -1
  93. package/dist/queries/getTableColumnFromPath.d.ts +12 -3
  94. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  95. package/dist/queries/getTableColumnFromPath.js +59 -27
  96. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  97. package/dist/queries/operatorMap.d.ts +7 -3
  98. package/dist/queries/operatorMap.d.ts.map +1 -1
  99. package/dist/queries/operatorMap.js.map +1 -1
  100. package/dist/queries/parseParams.d.ts.map +1 -1
  101. package/dist/queries/parseParams.js +262 -10
  102. package/dist/queries/parseParams.js.map +1 -1
  103. package/dist/queries/resolveRelationshipPath.d.ts +36 -0
  104. package/dist/queries/resolveRelationshipPath.d.ts.map +1 -0
  105. package/dist/queries/resolveRelationshipPath.js +66 -0
  106. package/dist/queries/resolveRelationshipPath.js.map +1 -0
  107. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  108. package/dist/queries/selectDistinct.d.ts.map +1 -1
  109. package/dist/queries/validateOperatorHandlers.d.ts +8 -0
  110. package/dist/queries/validateOperatorHandlers.d.ts.map +1 -0
  111. package/dist/queries/validateOperatorHandlers.js +30 -0
  112. package/dist/queries/validateOperatorHandlers.js.map +1 -0
  113. package/dist/schema/build.d.ts.map +1 -1
  114. package/dist/schema/buildDrizzleRelations.d.ts.map +1 -1
  115. package/dist/schema/buildRawSchema.d.ts.map +1 -1
  116. package/dist/schema/idToUUID.d.ts.map +1 -1
  117. package/dist/schema/traverseFields.d.ts.map +1 -1
  118. package/dist/schema/traverseFields.js +6 -5
  119. package/dist/schema/traverseFields.js.map +1 -1
  120. package/dist/schema/withDefault.d.ts.map +1 -1
  121. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -1
  122. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js +3 -2
  123. package/dist/sqlite/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
  124. package/dist/sqlite/createJSONQuery/index.d.ts.map +1 -1
  125. package/dist/sqlite/createJSONQuery/index.js +6 -5
  126. package/dist/sqlite/createJSONQuery/index.js.map +1 -1
  127. package/dist/transform/read/hasManyNumber.d.ts.map +1 -1
  128. package/dist/transform/read/hasManyText.d.ts.map +1 -1
  129. package/dist/transform/read/index.d.ts.map +1 -1
  130. package/dist/transform/read/relationship.d.ts.map +1 -1
  131. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  132. package/dist/transform/write/array.d.ts.map +1 -1
  133. package/dist/transform/write/blocks.d.ts.map +1 -1
  134. package/dist/transform/write/index.d.ts.map +1 -1
  135. package/dist/transform/write/numbers.d.ts.map +1 -1
  136. package/dist/transform/write/relationships.d.ts.map +1 -1
  137. package/dist/transform/write/selects.d.ts.map +1 -1
  138. package/dist/transform/write/texts.d.ts.map +1 -1
  139. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  140. package/dist/transform/write/traverseFields.js +8 -14
  141. package/dist/transform/write/traverseFields.js.map +1 -1
  142. package/dist/types.d.ts +50 -6
  143. package/dist/types.d.ts.map +1 -1
  144. package/dist/types.js +1 -3
  145. package/dist/types.js.map +1 -1
  146. package/dist/updateJobs.d.ts.map +1 -1
  147. package/dist/updateJobs.js +37 -0
  148. package/dist/updateJobs.js.map +1 -1
  149. package/dist/updateOne.d.ts.map +1 -1
  150. package/dist/updateOne.js +41 -1
  151. package/dist/updateOne.js.map +1 -1
  152. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -1
  153. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
  154. package/dist/upsertRow/handleUpsertError.d.ts.map +1 -1
  155. package/dist/upsertRow/handleUpsertError.js +2 -1
  156. package/dist/upsertRow/handleUpsertError.js.map +1 -1
  157. package/dist/upsertRow/index.d.ts +1 -1
  158. package/dist/upsertRow/index.d.ts.map +1 -1
  159. package/dist/upsertRow/index.js +25 -5
  160. package/dist/upsertRow/index.js.map +1 -1
  161. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  162. package/dist/upsertRow/insertArrays.js +2 -1
  163. package/dist/upsertRow/insertArrays.js.map +1 -1
  164. package/dist/upsertRow/shouldUseOptimizedUpsertRow.d.ts.map +1 -1
  165. package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -1
  166. package/dist/utilities/blocksToJsonMigrator.d.ts.map +1 -1
  167. package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
  168. package/dist/utilities/buildCreateMigration.js +12 -8
  169. package/dist/utilities/buildCreateMigration.js.map +1 -1
  170. package/dist/utilities/buildForeignKeyName.d.ts.map +1 -1
  171. package/dist/utilities/buildForeignKeyName.js +3 -2
  172. package/dist/utilities/buildForeignKeyName.js.map +1 -1
  173. package/dist/utilities/buildIndexName.d.ts.map +1 -1
  174. package/dist/utilities/buildIndexName.js +3 -2
  175. package/dist/utilities/buildIndexName.js.map +1 -1
  176. package/dist/utilities/checkTruncatedIdentifiers.d.ts +13 -0
  177. package/dist/utilities/checkTruncatedIdentifiers.d.ts.map +1 -0
  178. package/dist/utilities/checkTruncatedIdentifiers.js +56 -0
  179. package/dist/utilities/checkTruncatedIdentifiers.js.map +1 -0
  180. package/dist/utilities/createBlocksMap.d.ts.map +1 -1
  181. package/dist/utilities/createRelationshipMap.d.ts.map +1 -1
  182. package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
  183. package/dist/utilities/createSchemaGenerator.js +3 -0
  184. package/dist/utilities/createSchemaGenerator.js.map +1 -1
  185. package/dist/utilities/escapeSQLValue.d.ts.map +1 -1
  186. package/dist/utilities/executeSchemaHooks.d.ts.map +1 -1
  187. package/dist/utilities/extendDrizzleTable.d.ts.map +1 -1
  188. package/dist/utilities/getArrayRelationName.d.ts.map +1 -1
  189. package/dist/utilities/getCollectionIdType.d.ts.map +1 -1
  190. package/dist/utilities/getMigrationTemplate.d.ts.map +1 -1
  191. package/dist/utilities/getNameFromDrizzleTable.d.ts.map +1 -1
  192. package/dist/utilities/getPrimaryDb.d.ts +1 -1
  193. package/dist/utilities/getPrimaryDb.d.ts.map +1 -1
  194. package/dist/utilities/getTransaction.d.ts +1 -1
  195. package/dist/utilities/getTransaction.d.ts.map +1 -1
  196. package/dist/utilities/hasLocalesTable.d.ts.map +1 -1
  197. package/dist/utilities/isPolymorphicRelationship.d.ts.map +1 -1
  198. package/dist/utilities/isUUIDType.d.ts.map +1 -1
  199. package/dist/utilities/json.d.ts.map +1 -1
  200. package/dist/utilities/migrationTableExists.d.ts.map +1 -1
  201. package/dist/utilities/parseError.d.ts.map +1 -1
  202. package/dist/utilities/parseJSONPathSegment.d.ts +9 -0
  203. package/dist/utilities/parseJSONPathSegment.d.ts.map +1 -0
  204. package/dist/utilities/parseJSONPathSegment.js +17 -0
  205. package/dist/utilities/parseJSONPathSegment.js.map +1 -0
  206. package/dist/utilities/pushDevSchema.d.ts.map +1 -1
  207. package/dist/utilities/rawConstraint.d.ts.map +1 -1
  208. package/dist/utilities/sanitizePathSegment.d.ts.map +1 -1
  209. package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -5
  210. package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
  211. package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
  212. package/dist/utilities/validateIdentifierLength.d.ts +12 -0
  213. package/dist/utilities/validateIdentifierLength.d.ts.map +1 -0
  214. package/dist/utilities/validateIdentifierLength.js +18 -0
  215. package/dist/utilities/validateIdentifierLength.js.map +1 -0
  216. package/package.json +3 -3
  217. package/dist/find/chainMethods.d.ts +0 -20
  218. package/dist/find/chainMethods.d.ts.map +0 -1
  219. package/dist/find/chainMethods.js +0 -16
  220. package/dist/find/chainMethods.js.map +0 -1
  221. package/dist/utilities/isValidStringID.spec.js +0 -15
  222. package/dist/utilities/isValidStringID.spec.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ export type JSONPathSegment = {
2
+ type: 'arrayIndex';
3
+ value: string;
4
+ } | {
5
+ type: 'objectKey';
6
+ value: string;
7
+ };
8
+ export declare const parseJSONPathSegment: (segment: string) => JSONPathSegment;
9
+ //# sourceMappingURL=parseJSONPathSegment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseJSONPathSegment.d.ts","sourceRoot":"","sources":["../../src/utilities/parseJSONPathSegment.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAIL,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,eActD,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { sanitizePathSegment } from './sanitizePathSegment.js';
2
+ const ARRAY_INDEX_REGEX = /^\d+$/;
3
+ export const parseJSONPathSegment = (segment)=>{
4
+ const sanitizedSegment = sanitizePathSegment(segment);
5
+ if (ARRAY_INDEX_REGEX.test(sanitizedSegment)) {
6
+ return {
7
+ type: 'arrayIndex',
8
+ value: sanitizedSegment
9
+ };
10
+ }
11
+ return {
12
+ type: 'objectKey',
13
+ value: sanitizedSegment
14
+ };
15
+ };
16
+
17
+ //# sourceMappingURL=parseJSONPathSegment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/parseJSONPathSegment.ts"],"sourcesContent":["import { sanitizePathSegment } from './sanitizePathSegment.js'\n\nexport type JSONPathSegment =\n | {\n type: 'arrayIndex'\n value: string\n }\n | {\n type: 'objectKey'\n value: string\n }\n\nconst ARRAY_INDEX_REGEX = /^\\d+$/\n\nexport const parseJSONPathSegment = (segment: string): JSONPathSegment => {\n const sanitizedSegment = sanitizePathSegment(segment)\n\n if (ARRAY_INDEX_REGEX.test(sanitizedSegment)) {\n return {\n type: 'arrayIndex',\n value: sanitizedSegment,\n }\n }\n\n return {\n type: 'objectKey',\n value: sanitizedSegment,\n }\n}\n"],"names":["sanitizePathSegment","ARRAY_INDEX_REGEX","parseJSONPathSegment","segment","sanitizedSegment","test","type","value"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,2BAA0B;AAY9D,MAAMC,oBAAoB;AAE1B,OAAO,MAAMC,uBAAuB,CAACC;IACnC,MAAMC,mBAAmBJ,oBAAoBG;IAE7C,IAAIF,kBAAkBI,IAAI,CAACD,mBAAmB;QAC5C,OAAO;YACLE,MAAM;YACNC,OAAOH;QACT;IACF;IAEA,OAAO;QACLE,MAAM;QACNC,OAAOH;IACT;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pushDevSchema.d.ts","sourceRoot":"","sources":["../../src/utilities/pushDevSchema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AAUvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAU,SAAS,cAAc,kBA6F1D,CAAA"}
1
+ {"version":3,"file":"pushDevSchema.d.ts","sourceRoot":"","sources":["../../src/utilities/pushDevSchema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AAUvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,YAAmB,cAAc,kBA6F1D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"rawConstraint.d.ts","sourceRoot":"","sources":["../../src/utilities/rawConstraint.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,eAA2B,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO;;;CAG1C,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAAU,CAAC,OAAO,aAAa,CAExF,CAAA"}
1
+ {"version":3,"file":"rawConstraint.d.ts","sourceRoot":"","sources":["../../src/utilities/rawConstraint.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,eAA2B,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO;;;CAG1C,CAAA;AAEF,eAAO,MAAM,eAAe,UAAW,OAAO,KAAG,KAAK,IAAI,UAAU,CAAC,OAAO,aAAa,CAExF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizePathSegment.d.ts","sourceRoot":"","sources":["../../src/utilities/sanitizePathSegment.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MAQrD,CAAA"}
1
+ {"version":3,"file":"sanitizePathSegment.d.ts","sourceRoot":"","sources":["../../src/utilities/sanitizePathSegment.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,YAAa,MAAM,KAAG,MAQrD,CAAA"}
@@ -3,11 +3,7 @@ import type { RawTable } from '../types.js';
3
3
  type Args = {
4
4
  block: Block;
5
5
  localized: boolean;
6
- /**
7
- * @todo make required in v4.0. Usually you'd wanna pass this in
8
- */
9
- parentIsLocalized?: boolean;
10
- rootTableName: string;
6
+ parentIsLocalized: boolean;
11
7
  table: RawTable;
12
8
  tableLocales?: RawTable;
13
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"validateExistingBlockIsIdentical.d.ts","sourceRoot":"","sources":["../../src/utilities/validateExistingBlockIsIdentical.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAS,cAAc,EAAE,MAAM,SAAS,CAAA;AAS3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,QAAQ,CAAA;IACf,YAAY,CAAC,EAAE,QAAQ,CAAA;CACxB,CAAA;AA+DD;;GAEG;AACH,eAAO,MAAM,gCAAgC,GAAI,+DAM9C,IAAI,KAAG,OAwBT,CAAA;AAED,eAAO,MAAM,2BAA2B,eAAwC,CAAA;AAChF,eAAO,MAAM,qBAAqB,GAAI,OAAO,cAAc,EAAE,OAAO,MAAM,SAEzE,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,cAAc,EAAE,mBAAmB,MAAM,WAMrF,CAAA"}
1
+ {"version":3,"file":"validateExistingBlockIsIdentical.d.ts","sourceRoot":"","sources":["../../src/utilities/validateExistingBlockIsIdentical.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAS,cAAc,EAAE,MAAM,SAAS,CAAA;AAS3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,KAAK,EAAE,QAAQ,CAAA;IACf,YAAY,CAAC,EAAE,QAAQ,CAAA;CACxB,CAAA;AA+DD;;GAEG;AACH,eAAO,MAAM,gCAAgC,kEAM1C,IAAI,KAAG,OAwBT,CAAA;AAED,eAAO,MAAM,2BAA2B,eAAwC,CAAA;AAChF,eAAO,MAAM,qBAAqB,UAAW,cAAc,SAAS,MAAM,SAEzE,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,cAAc,qBAAqB,MAAM,WAMrF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/validateExistingBlockIsIdentical.ts"],"sourcesContent":["import type { Block, Field, FlattenedBlock } from 'payload'\n\nimport {\n fieldAffectsData,\n fieldHasSubFields,\n fieldShouldBeLocalized,\n tabHasName,\n} from 'payload/shared'\n\nimport type { RawTable } from '../types.js'\n\ntype Args = {\n block: Block\n localized: boolean\n /**\n * @todo make required in v4.0. Usually you'd wanna pass this in\n */\n parentIsLocalized?: boolean\n rootTableName: string\n table: RawTable\n tableLocales?: RawTable\n}\n\nconst getFlattenedFieldNames = (args: {\n fields: Field[]\n parentIsLocalized: boolean\n prefix?: string\n}): { localized?: boolean; name: string }[] => {\n const { fields, parentIsLocalized, prefix = '' } = args\n return fields.reduce((fieldsToUse, field) => {\n let fieldPrefix = prefix\n\n if (\n ['array', 'blocks', 'relationship', 'upload'].includes(field.type) ||\n ('hasMany' in field && field.hasMany === true)\n ) {\n return fieldsToUse\n }\n\n if (fieldHasSubFields(field)) {\n fieldPrefix = 'name' in field ? `${prefix}${field.name}_` : prefix\n return [\n ...fieldsToUse,\n ...getFlattenedFieldNames({\n fields: field.fields,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n prefix: fieldPrefix,\n }),\n ]\n }\n\n if (field.type === 'tabs') {\n return [\n ...fieldsToUse,\n ...field.tabs.reduce((tabFields, tab) => {\n fieldPrefix = 'name' in tab ? `${prefix}_${tab.name}` : prefix\n return [\n ...tabFields,\n ...(tabHasName(tab)\n ? [{ ...tab, type: 'tab' }]\n : getFlattenedFieldNames({\n fields: tab.fields,\n parentIsLocalized: parentIsLocalized || tab.localized,\n prefix: fieldPrefix,\n })),\n ]\n }, []),\n ]\n }\n\n if (fieldAffectsData(field)) {\n return [\n ...fieldsToUse,\n {\n name: `${fieldPrefix}${field.name}`,\n localized: fieldShouldBeLocalized({ field, parentIsLocalized }),\n },\n ]\n }\n\n return fieldsToUse\n }, [])\n}\n\n/**\n * returns true if all the fields in a block are identical to the existing table\n */\nexport const validateExistingBlockIsIdentical = ({\n block,\n localized,\n parentIsLocalized,\n table,\n tableLocales,\n}: Args): boolean => {\n const fieldNames = getFlattenedFieldNames({\n fields: block.fields,\n parentIsLocalized: parentIsLocalized || localized,\n })\n\n const missingField =\n // ensure every field from the config is in the matching table\n fieldNames.find(({ name, localized }) => {\n const fieldTable = localized && tableLocales ? tableLocales : table\n return Object.keys(fieldTable.columns).indexOf(name) === -1\n }) ||\n // ensure every table column is matched for every field from the config\n Object.keys(table).find((fieldName) => {\n if (!['_locale', '_order', '_parentID', '_path', '_uuid'].includes(fieldName)) {\n return fieldNames.findIndex((field) => field.name) === -1\n }\n })\n\n if (missingField) {\n return false\n }\n\n return Boolean(localized) === Boolean(table.columns._locale)\n}\n\nexport const InternalBlockTableNameIndex = Symbol('InternalBlockTableNameIndex')\nexport const setInternalBlockIndex = (block: FlattenedBlock, index: number) => {\n block[InternalBlockTableNameIndex] = index\n}\n\nexport const resolveBlockTableName = (block: FlattenedBlock, originalTableName: string) => {\n if (!block[InternalBlockTableNameIndex]) {\n return originalTableName\n }\n\n return `${originalTableName}_${block[InternalBlockTableNameIndex]}`\n}\n"],"names":["fieldAffectsData","fieldHasSubFields","fieldShouldBeLocalized","tabHasName","getFlattenedFieldNames","args","fields","parentIsLocalized","prefix","reduce","fieldsToUse","field","fieldPrefix","includes","type","hasMany","name","localized","tabs","tabFields","tab","validateExistingBlockIsIdentical","block","table","tableLocales","fieldNames","missingField","find","fieldTable","Object","keys","columns","indexOf","fieldName","findIndex","Boolean","_locale","InternalBlockTableNameIndex","Symbol","setInternalBlockIndex","index","resolveBlockTableName","originalTableName"],"mappings":"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"}
1
+ {"version":3,"sources":["../../src/utilities/validateExistingBlockIsIdentical.ts"],"sourcesContent":["import type { Block, Field, FlattenedBlock } from 'payload'\n\nimport {\n fieldAffectsData,\n fieldHasSubFields,\n fieldShouldBeLocalized,\n tabHasName,\n} from 'payload/shared'\n\nimport type { RawTable } from '../types.js'\n\ntype Args = {\n block: Block\n localized: boolean\n parentIsLocalized: boolean\n table: RawTable\n tableLocales?: RawTable\n}\n\nconst getFlattenedFieldNames = (args: {\n fields: Field[]\n parentIsLocalized: boolean\n prefix?: string\n}): { localized?: boolean; name: string }[] => {\n const { fields, parentIsLocalized, prefix = '' } = args\n return fields.reduce((fieldsToUse, field) => {\n let fieldPrefix = prefix\n\n if (\n ['array', 'blocks', 'relationship', 'upload'].includes(field.type) ||\n ('hasMany' in field && field.hasMany === true)\n ) {\n return fieldsToUse\n }\n\n if (fieldHasSubFields(field)) {\n fieldPrefix = 'name' in field ? `${prefix}${field.name}_` : prefix\n return [\n ...fieldsToUse,\n ...getFlattenedFieldNames({\n fields: field.fields,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n prefix: fieldPrefix,\n }),\n ]\n }\n\n if (field.type === 'tabs') {\n return [\n ...fieldsToUse,\n ...field.tabs.reduce((tabFields, tab) => {\n fieldPrefix = 'name' in tab ? `${prefix}_${tab.name}` : prefix\n return [\n ...tabFields,\n ...(tabHasName(tab)\n ? [{ ...tab, type: 'tab' }]\n : getFlattenedFieldNames({\n fields: tab.fields,\n parentIsLocalized: parentIsLocalized || tab.localized,\n prefix: fieldPrefix,\n })),\n ]\n }, []),\n ]\n }\n\n if (fieldAffectsData(field)) {\n return [\n ...fieldsToUse,\n {\n name: `${fieldPrefix}${field.name}`,\n localized: fieldShouldBeLocalized({ field, parentIsLocalized }),\n },\n ]\n }\n\n return fieldsToUse\n }, [])\n}\n\n/**\n * returns true if all the fields in a block are identical to the existing table\n */\nexport const validateExistingBlockIsIdentical = ({\n block,\n localized,\n parentIsLocalized,\n table,\n tableLocales,\n}: Args): boolean => {\n const fieldNames = getFlattenedFieldNames({\n fields: block.fields,\n parentIsLocalized: parentIsLocalized || localized,\n })\n\n const missingField =\n // ensure every field from the config is in the matching table\n fieldNames.find(({ name, localized }) => {\n const fieldTable = localized && tableLocales ? tableLocales : table\n return Object.keys(fieldTable.columns).indexOf(name) === -1\n }) ||\n // ensure every table column is matched for every field from the config\n Object.keys(table).find((fieldName) => {\n if (!['_locale', '_order', '_parentID', '_path', '_uuid'].includes(fieldName)) {\n return fieldNames.findIndex((field) => field.name) === -1\n }\n })\n\n if (missingField) {\n return false\n }\n\n return Boolean(localized) === Boolean(table.columns._locale)\n}\n\nexport const InternalBlockTableNameIndex = Symbol('InternalBlockTableNameIndex')\nexport const setInternalBlockIndex = (block: FlattenedBlock, index: number) => {\n block[InternalBlockTableNameIndex] = index\n}\n\nexport const resolveBlockTableName = (block: FlattenedBlock, originalTableName: string) => {\n if (!block[InternalBlockTableNameIndex]) {\n return originalTableName\n }\n\n return `${originalTableName}_${block[InternalBlockTableNameIndex]}`\n}\n"],"names":["fieldAffectsData","fieldHasSubFields","fieldShouldBeLocalized","tabHasName","getFlattenedFieldNames","args","fields","parentIsLocalized","prefix","reduce","fieldsToUse","field","fieldPrefix","includes","type","hasMany","name","localized","tabs","tabFields","tab","validateExistingBlockIsIdentical","block","table","tableLocales","fieldNames","missingField","find","fieldTable","Object","keys","columns","indexOf","fieldName","findIndex","Boolean","_locale","InternalBlockTableNameIndex","Symbol","setInternalBlockIndex","index","resolveBlockTableName","originalTableName"],"mappings":"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"}
@@ -0,0 +1,12 @@
1
+ /** Postgres max identifier length (NAMEDATALEN - 1). */
2
+ export declare const maxIdentifierLength = 63;
3
+ /**
4
+ * Cap for builder-generated identifiers (`buildIndexName`/`buildForeignKeyName`). Sits
5
+ * below `maxIdentifierLength` to leave headroom for the appended `_idx`/`_fk`/`_N` suffixes.
6
+ */
7
+ export declare const maxGeneratedIdentifierLength: number;
8
+ /**
9
+ * Throws if a table or enum identifier exceeds the Postgres 63-char limit.
10
+ */
11
+ export declare const validateIdentifierLength: (name: string) => string;
12
+ //# sourceMappingURL=validateIdentifierLength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateIdentifierLength.d.ts","sourceRoot":"","sources":["../../src/utilities/validateIdentifierLength.ts"],"names":[],"mappings":"AAEA,wDAAwD;AACxD,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;GAGG;AACH,eAAO,MAAM,4BAA4B,QAA0B,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,wBAAwB,SAAU,MAAM,KAAG,MAUvD,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { APIError } from 'payload';
2
+ /** Postgres max identifier length (NAMEDATALEN - 1). */ export const maxIdentifierLength = 63;
3
+ /**
4
+ * Cap for builder-generated identifiers (`buildIndexName`/`buildForeignKeyName`). Sits
5
+ * below `maxIdentifierLength` to leave headroom for the appended `_idx`/`_fk`/`_N` suffixes.
6
+ */ export const maxGeneratedIdentifierLength = maxIdentifierLength - 3;
7
+ /**
8
+ * Throws if a table or enum identifier exceeds the Postgres 63-char limit.
9
+ */ export const validateIdentifierLength = (name)=>{
10
+ if (name.length > maxIdentifierLength) {
11
+ throw new APIError(`Exceeded max identifier length for table or enum name of ${maxIdentifierLength} characters. Invalid name: ${name}.
12
+ Tip: You can use the dbName property to reduce the table name length.
13
+ `);
14
+ }
15
+ return name;
16
+ };
17
+
18
+ //# sourceMappingURL=validateIdentifierLength.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/validateIdentifierLength.ts"],"sourcesContent":["import { APIError } from 'payload'\n\n/** Postgres max identifier length (NAMEDATALEN - 1). */\nexport const maxIdentifierLength = 63\n\n/**\n * Cap for builder-generated identifiers (`buildIndexName`/`buildForeignKeyName`). Sits\n * below `maxIdentifierLength` to leave headroom for the appended `_idx`/`_fk`/`_N` suffixes.\n */\nexport const maxGeneratedIdentifierLength = maxIdentifierLength - 3\n\n/**\n * Throws if a table or enum identifier exceeds the Postgres 63-char limit.\n */\nexport const validateIdentifierLength = (name: string): string => {\n if (name.length > maxIdentifierLength) {\n throw new APIError(\n `Exceeded max identifier length for table or enum name of ${maxIdentifierLength} characters. Invalid name: ${name}.\nTip: You can use the dbName property to reduce the table name length.\n `,\n )\n }\n\n return name\n}\n"],"names":["APIError","maxIdentifierLength","maxGeneratedIdentifierLength","validateIdentifierLength","name","length"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAS;AAElC,sDAAsD,GACtD,OAAO,MAAMC,sBAAsB,GAAE;AAErC;;;CAGC,GACD,OAAO,MAAMC,+BAA+BD,sBAAsB,EAAC;AAEnE;;CAEC,GACD,OAAO,MAAME,2BAA2B,CAACC;IACvC,IAAIA,KAAKC,MAAM,GAAGJ,qBAAqB;QACrC,MAAM,IAAID,SACR,CAAC,yDAAyD,EAAEC,oBAAoB,2BAA2B,EAAEG,KAAK;;MAElH,CAAC;IAEL;IAEA,OAAOA;AACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/drizzle",
3
- "version": "4.0.0-internal.688c4d0",
3
+ "version": "4.0.0-internal.77191e5",
4
4
  "description": "A library of shared functions used by different payload database adapters",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -55,10 +55,10 @@
55
55
  "@types/pg": "8.20.0",
56
56
  "@types/to-snake-case": "1.0.0",
57
57
  "@payloadcms/eslint-config": "3.28.0",
58
- "payload": "4.0.0-internal.688c4d0"
58
+ "payload": "4.0.0-internal.77191e5"
59
59
  },
60
60
  "peerDependencies": {
61
- "payload": "4.0.0-internal.688c4d0"
61
+ "payload": "4.0.0-internal.77191e5"
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"}
@@ -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"}