@payloadcms/drizzle 3.91.0-internal.6e3dc85 → 4.0.0-beta.0

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 (204) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/exports/postgres.d.ts +4 -0
  3. package/dist/exports/postgres.d.ts.map +1 -1
  4. package/dist/exports/postgres.js +4 -0
  5. package/dist/exports/postgres.js.map +1 -1
  6. package/dist/exports/sqlite.d.ts +2 -0
  7. package/dist/exports/sqlite.d.ts.map +1 -1
  8. package/dist/exports/sqlite.js +2 -0
  9. package/dist/exports/sqlite.js.map +1 -1
  10. package/dist/find/buildPolymorphicJoinQuery.d.ts +2 -1
  11. package/dist/find/buildPolymorphicJoinQuery.d.ts.map +1 -1
  12. package/dist/find/buildPolymorphicJoinQuery.js +2 -1
  13. package/dist/find/buildPolymorphicJoinQuery.js.map +1 -1
  14. package/dist/find/buildPolymorphicJoinWhere.d.ts +2 -1
  15. package/dist/find/buildPolymorphicJoinWhere.d.ts.map +1 -1
  16. package/dist/find/buildPolymorphicJoinWhere.js +43 -10
  17. package/dist/find/buildPolymorphicJoinWhere.js.map +1 -1
  18. package/dist/find/createPolymorphicJoinWherePlan.js +3 -2
  19. package/dist/find/createPolymorphicJoinWherePlan.js.map +1 -1
  20. package/dist/find/traverseFields.d.ts.map +1 -1
  21. package/dist/find/traverseFields.js +2 -2
  22. package/dist/find/traverseFields.js.map +1 -1
  23. package/dist/index.d.ts +4 -11
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -9
  26. package/dist/index.js.map +1 -1
  27. package/dist/migrate.d.ts.map +1 -1
  28. package/dist/migrate.js +41 -15
  29. package/dist/migrate.js.map +1 -1
  30. package/dist/migrateDown.d.ts +2 -1
  31. package/dist/migrateDown.d.ts.map +1 -1
  32. package/dist/migrateDown.js +17 -4
  33. package/dist/migrateDown.js.map +1 -1
  34. package/dist/migrateFresh.d.ts +4 -2
  35. package/dist/migrateFresh.d.ts.map +1 -1
  36. package/dist/migrateFresh.js +26 -9
  37. package/dist/migrateFresh.js.map +1 -1
  38. package/dist/migrateRefresh.d.ts +2 -1
  39. package/dist/migrateRefresh.d.ts.map +1 -1
  40. package/dist/migrateRefresh.js +20 -5
  41. package/dist/migrateRefresh.js.map +1 -1
  42. package/dist/migrateReset.d.ts +2 -1
  43. package/dist/migrateReset.d.ts.map +1 -1
  44. package/dist/migrateReset.js +18 -4
  45. package/dist/migrateReset.js.map +1 -1
  46. package/dist/migrateStatus.d.ts +2 -1
  47. package/dist/migrateStatus.d.ts.map +1 -1
  48. package/dist/migrateStatus.js +11 -6
  49. package/dist/migrateStatus.js.map +1 -1
  50. package/dist/postgres/predefinedMigrations/localize-status/index.d.ts +11 -0
  51. package/dist/postgres/predefinedMigrations/localize-status/index.d.ts.map +1 -0
  52. package/dist/postgres/predefinedMigrations/localize-status/index.js +296 -0
  53. package/dist/postgres/predefinedMigrations/localize-status/index.js.map +1 -0
  54. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.d.ts +13 -0
  55. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.d.ts.map +1 -0
  56. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.js +51 -0
  57. package/dist/postgres/predefinedMigrations/localize-status/migrateMainCollection.js.map +1 -0
  58. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.d.ts +13 -0
  59. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.d.ts.map +1 -0
  60. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.js +54 -0
  61. package/dist/postgres/predefinedMigrations/localize-status/migrateMainGlobal.js.map +1 -0
  62. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts +35 -0
  63. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
  64. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js +185 -0
  65. package/dist/postgres/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
  66. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  67. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js +8 -4
  68. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
  69. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  70. package/dist/postgres/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
  71. package/dist/postgres/predefinedMigrations/v2-v3/index.js +1 -1
  72. package/dist/postgres/predefinedMigrations/v2-v3/index.js.map +1 -1
  73. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts +15 -0
  74. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.d.ts.map +1 -0
  75. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js +25 -0
  76. package/dist/postgres/query/assertOperatorHandlerExtensionsInstalled.js.map +1 -0
  77. package/dist/postgres/query/postgresUnaccent.d.ts +13 -0
  78. package/dist/postgres/query/postgresUnaccent.d.ts.map +1 -0
  79. package/dist/postgres/query/postgresUnaccent.js +40 -0
  80. package/dist/postgres/query/postgresUnaccent.js.map +1 -0
  81. package/dist/postgres/schema/geometryColumn.d.ts +2 -2
  82. package/dist/postgres/types.d.ts +13 -2
  83. package/dist/postgres/types.d.ts.map +1 -1
  84. package/dist/postgres/types.js.map +1 -1
  85. package/dist/queries/addJoinTable.d.ts +1 -1
  86. package/dist/queries/buildOperatorConstraint.d.ts +22 -0
  87. package/dist/queries/buildOperatorConstraint.d.ts.map +1 -0
  88. package/dist/queries/buildOperatorConstraint.js +63 -0
  89. package/dist/queries/buildOperatorConstraint.js.map +1 -0
  90. package/dist/queries/buildOrderBy.d.ts +1 -1
  91. package/dist/queries/buildOrderBy.d.ts.map +1 -1
  92. package/dist/queries/buildOrderBy.js +6 -1
  93. package/dist/queries/buildOrderBy.js.map +1 -1
  94. package/dist/queries/getTableColumnFromPath.d.ts +12 -3
  95. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  96. package/dist/queries/getTableColumnFromPath.js +52 -29
  97. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  98. package/dist/queries/operatorMap.d.ts +7 -3
  99. package/dist/queries/operatorMap.d.ts.map +1 -1
  100. package/dist/queries/operatorMap.js.map +1 -1
  101. package/dist/queries/parseParams.d.ts.map +1 -1
  102. package/dist/queries/parseParams.js +226 -36
  103. package/dist/queries/parseParams.js.map +1 -1
  104. package/dist/queries/resolveRelationshipPath.d.ts +36 -0
  105. package/dist/queries/resolveRelationshipPath.d.ts.map +1 -0
  106. package/dist/queries/resolveRelationshipPath.js +66 -0
  107. package/dist/queries/resolveRelationshipPath.js.map +1 -0
  108. package/dist/queries/validateOperatorHandlers.d.ts +8 -0
  109. package/dist/queries/validateOperatorHandlers.d.ts.map +1 -0
  110. package/dist/queries/validateOperatorHandlers.js +30 -0
  111. package/dist/queries/validateOperatorHandlers.js.map +1 -0
  112. package/dist/schema/traverseFields.d.ts.map +1 -1
  113. package/dist/schema/traverseFields.js +2 -1
  114. package/dist/schema/traverseFields.js.map +1 -1
  115. package/dist/sqlite/insert.d.ts.map +1 -1
  116. package/dist/sqlite/insert.js +4 -1
  117. package/dist/sqlite/insert.js.map +1 -1
  118. package/dist/sqlite/predefinedMigrations/localize-status/index.d.ts +28 -0
  119. package/dist/sqlite/predefinedMigrations/localize-status/index.d.ts.map +1 -0
  120. package/dist/sqlite/predefinedMigrations/localize-status/index.js +198 -0
  121. package/dist/sqlite/predefinedMigrations/localize-status/index.js.map +1 -0
  122. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.d.ts +12 -0
  123. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.d.ts.map +1 -0
  124. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.js +24 -0
  125. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainCollection.js.map +1 -0
  126. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.d.ts +12 -0
  127. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.d.ts.map +1 -0
  128. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.js +28 -0
  129. package/dist/sqlite/predefinedMigrations/localize-status/migrateMainGlobal.js.map +1 -0
  130. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts +15 -0
  131. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.d.ts.map +1 -0
  132. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js +114 -0
  133. package/dist/sqlite/predefinedMigrations/sizes-to-variants/index.js.map +1 -0
  134. package/dist/transform/read/traverseFields.js +2 -2
  135. package/dist/transform/read/traverseFields.js.map +1 -1
  136. package/dist/transform/write/blocks.js +1 -1
  137. package/dist/transform/write/blocks.js.map +1 -1
  138. package/dist/transform/write/traverseFields.js +1 -2
  139. package/dist/transform/write/traverseFields.js.map +1 -1
  140. package/dist/types.d.ts +50 -6
  141. package/dist/types.d.ts.map +1 -1
  142. package/dist/types.js +1 -3
  143. package/dist/types.js.map +1 -1
  144. package/dist/updateJobs.d.ts.map +1 -1
  145. package/dist/updateJobs.js +37 -0
  146. package/dist/updateJobs.js.map +1 -1
  147. package/dist/upsertRow/index.d.ts.map +1 -1
  148. package/dist/upsertRow/index.js +5 -2
  149. package/dist/upsertRow/index.js.map +1 -1
  150. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  151. package/dist/upsertRow/insertArrays.js +2 -1
  152. package/dist/upsertRow/insertArrays.js.map +1 -1
  153. package/dist/utilities/buildCreateMigration.d.ts.map +1 -1
  154. package/dist/utilities/buildCreateMigration.js +12 -8
  155. package/dist/utilities/buildCreateMigration.js.map +1 -1
  156. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts +15 -0
  157. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.d.ts.map +1 -0
  158. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js +110 -0
  159. package/dist/utilities/buildDynamicPredefinedSizesToVariantsMigration.js.map +1 -0
  160. package/dist/utilities/checkTruncatedIdentifiers.d.ts +1 -1
  161. package/dist/utilities/createSchemaGenerator.d.ts.map +1 -1
  162. package/dist/utilities/createSchemaGenerator.js +3 -0
  163. package/dist/utilities/createSchemaGenerator.js.map +1 -1
  164. package/dist/utilities/getPrimaryDb.d.ts +1 -1
  165. package/dist/utilities/getSizesToVariantsRenames.d.ts +54 -0
  166. package/dist/utilities/getSizesToVariantsRenames.d.ts.map +1 -0
  167. package/dist/utilities/getSizesToVariantsRenames.js +251 -0
  168. package/dist/utilities/getSizesToVariantsRenames.js.map +1 -0
  169. package/dist/utilities/getTransaction.d.ts +1 -1
  170. package/dist/utilities/getTransaction.d.ts.map +1 -1
  171. package/dist/utilities/validateExistingBlockIsIdentical.d.ts +1 -4
  172. package/dist/utilities/validateExistingBlockIsIdentical.d.ts.map +1 -1
  173. package/dist/utilities/validateExistingBlockIsIdentical.js.map +1 -1
  174. package/package.json +6 -11
  175. package/dist/exports/types-deprecated.d.ts +0 -150
  176. package/dist/exports/types-deprecated.d.ts.map +0 -1
  177. package/dist/exports/types-deprecated.js +0 -5
  178. package/dist/exports/types-deprecated.js.map +0 -1
  179. package/dist/find/buildPolymorphicJoinQuery.spec.js +0 -384
  180. package/dist/find/buildPolymorphicJoinQuery.spec.js.map +0 -1
  181. package/dist/find/buildPolymorphicJoinWhere.spec.js +0 -762
  182. package/dist/find/buildPolymorphicJoinWhere.spec.js.map +0 -1
  183. package/dist/find/chainMethods.d.ts +0 -20
  184. package/dist/find/chainMethods.d.ts.map +0 -1
  185. package/dist/find/chainMethods.js +0 -16
  186. package/dist/find/chainMethods.js.map +0 -1
  187. package/dist/find/createPolymorphicJoinWherePlan.spec.js +0 -897
  188. package/dist/find/createPolymorphicJoinWherePlan.spec.js.map +0 -1
  189. package/dist/schema/buildRawSchema.spec.js +0 -231
  190. package/dist/schema/buildRawSchema.spec.js.map +0 -1
  191. package/dist/sqlite/createJSONQuery/index.spec.js +0 -28
  192. package/dist/sqlite/createJSONQuery/index.spec.js.map +0 -1
  193. package/dist/updateOne.spec.js +0 -84
  194. package/dist/updateOne.spec.js.map +0 -1
  195. package/dist/upsertRow/conditionalUpdate.spec.js +0 -61
  196. package/dist/upsertRow/conditionalUpdate.spec.js.map +0 -1
  197. package/dist/upsertRow/handleUpsertError.spec.js +0 -42
  198. package/dist/upsertRow/handleUpsertError.spec.js.map +0 -1
  199. package/dist/utilities/checkTruncatedIdentifiers.spec.js +0 -301
  200. package/dist/utilities/checkTruncatedIdentifiers.spec.js.map +0 -1
  201. package/dist/utilities/isValidStringID.spec.js +0 -15
  202. package/dist/utilities/isValidStringID.spec.js.map +0 -1
  203. package/dist/utilities/validateIdentifierLength.spec.js +0 -19
  204. package/dist/utilities/validateIdentifierLength.spec.js.map +0 -1
@@ -1,150 +0,0 @@
1
- import type { BaseRawColumn as _BaseRawColumn, BuildDrizzleTable as _BuildDrizzleTable, BuildQueryJoinAliases as _BuildQueryJoinAliases, ChainedMethods as _ChainedMethods, ColumnToCodeConverter as _ColumnToCodeConverter, CountDistinct as _CountDistinct, CreateJSONQueryArgs as _CreateJSONQueryArgs, DeleteWhere as _DeleteWhere, DrizzleAdapter as _DrizzleAdapter, DrizzleTransaction as _DrizzleTransaction, DropDatabase as _DropDatabase, EnumRawColumn as _EnumRawColumn, Execute as _Execute, GenericColumn as _GenericColumn, GenericColumns as _GenericColumns, GenericPgColumn as _GenericPgColumn, GenericRelation as _GenericRelation, GenericTable as _GenericTable, IDType as _IDType, Insert as _Insert, IntegerRawColumn as _IntegerRawColumn, Migration as _Migration, PostgresDB as _PostgresDB, RawColumn as _RawColumn, RawForeignKey as _RawForeignKey, RawIndex as _RawIndex, RawRelation as _RawRelation, RawTable as _RawTable, RelationMap as _RelationMap, RequireDrizzleKit as _RequireDrizzleKit, SetColumnID as _SetColumnID, SQLiteDB as _SQLiteDB, TimestampRawColumn as _TimestampRawColumn, TransactionPg as _TransactionPg, TransactionSQLite as _TransactionSQLite, UUIDRawColumn as _UUIDRawColumn, VectorRawColumn as _VectorRawColumn } from '../types.js';
2
- /**
3
- * @deprecated - import from `@payloadcms/drizzle` instead
4
- */
5
- export type BaseRawColumn = _BaseRawColumn;
6
- /**
7
- * @deprecated - import from `@payloadcms/drizzle` instead
8
- */
9
- export type BuildDrizzleTable = _BuildDrizzleTable;
10
- /**
11
- * @deprecated - import from `@payloadcms/drizzle` instead
12
- */
13
- export type BuildQueryJoinAliases = _BuildQueryJoinAliases;
14
- /**
15
- * @deprecated - import from `@payloadcms/drizzle` instead
16
- */
17
- export type ChainedMethods = _ChainedMethods;
18
- /**
19
- * @deprecated - import from `@payloadcms/drizzle` instead
20
- */
21
- export type ColumnToCodeConverter = _ColumnToCodeConverter;
22
- /**
23
- * @deprecated - import from `@payloadcms/drizzle` instead
24
- */
25
- export type CountDistinct = _CountDistinct;
26
- /**
27
- * @deprecated - import from `@payloadcms/drizzle` instead
28
- */
29
- export type CreateJSONQueryArgs = _CreateJSONQueryArgs;
30
- /**
31
- * @deprecated - import from `@payloadcms/drizzle` instead
32
- */
33
- export type DeleteWhere = _DeleteWhere;
34
- /**
35
- * @deprecated - import from `@payloadcms/drizzle` instead
36
- */
37
- export type DrizzleAdapter = _DrizzleAdapter;
38
- /**
39
- * @deprecated - import from `@payloadcms/drizzle` instead
40
- */
41
- export type DrizzleTransaction = _DrizzleTransaction;
42
- /**
43
- * @deprecated - import from `@payloadcms/drizzle` instead
44
- */
45
- export type DropDatabase = _DropDatabase;
46
- /**
47
- * @deprecated - import from `@payloadcms/drizzle` instead
48
- */
49
- export type EnumRawColumn = _EnumRawColumn;
50
- /**
51
- * @deprecated - import from `@payloadcms/drizzle` instead
52
- */
53
- export type Execute<T> = _Execute<T>;
54
- /**
55
- * @deprecated - import from `@payloadcms/drizzle` instead
56
- */
57
- export type GenericColumn = _GenericColumn;
58
- /**
59
- * @deprecated - import from `@payloadcms/drizzle` instead
60
- */
61
- export type GenericColumns<T> = _GenericColumns<T>;
62
- /**
63
- * @deprecated - import from `@payloadcms/drizzle` instead
64
- */
65
- export type GenericPgColumn = _GenericPgColumn;
66
- /**
67
- * @deprecated - import from `@payloadcms/drizzle` instead
68
- */
69
- export type GenericRelation = _GenericRelation;
70
- /**
71
- * @deprecated - import from `@payloadcms/drizzle` instead
72
- */
73
- export type GenericTable = _GenericTable;
74
- /**
75
- * @deprecated - import from `@payloadcms/drizzle` instead
76
- */
77
- export type IDType = _IDType;
78
- /**
79
- * @deprecated - import from `@payloadcms/drizzle` instead
80
- */
81
- export type Insert = _Insert;
82
- /**
83
- * @deprecated - import from `@payloadcms/drizzle` instead
84
- */
85
- export type IntegerRawColumn = _IntegerRawColumn;
86
- /**
87
- * @deprecated - import from `@payloadcms/drizzle` instead
88
- */
89
- export type Migration = _Migration;
90
- /**
91
- * @deprecated - import from `@payloadcms/drizzle` instead
92
- */
93
- export type PostgresDB = _PostgresDB;
94
- /**
95
- * @deprecated - import from `@payloadcms/drizzle` instead
96
- */
97
- export type RawColumn = _RawColumn;
98
- /**
99
- * @deprecated - import from `@payloadcms/drizzle` instead
100
- */
101
- export type RawForeignKey = _RawForeignKey;
102
- /**
103
- * @deprecated - import from `@payloadcms/drizzle` instead
104
- */
105
- export type RawIndex = _RawIndex;
106
- /**
107
- * @deprecated - import from `@payloadcms/drizzle` instead
108
- */
109
- export type RawRelation = _RawRelation;
110
- /**
111
- * @deprecated - import from `@payloadcms/drizzle` instead
112
- */
113
- export type RawTable = _RawTable;
114
- /**
115
- * @deprecated - import from `@payloadcms/drizzle` instead
116
- */
117
- export type RelationMap = _RelationMap;
118
- /**
119
- * @deprecated - import from `@payloadcms/drizzle` instead
120
- */
121
- export type RequireDrizzleKit = _RequireDrizzleKit;
122
- /**
123
- * @deprecated - import from `@payloadcms/drizzle` instead
124
- */
125
- export type SetColumnID = _SetColumnID;
126
- /**
127
- * @deprecated - import from `@payloadcms/drizzle` instead
128
- */
129
- export type SQLiteDB = _SQLiteDB;
130
- /**
131
- * @deprecated - import from `@payloadcms/drizzle` instead
132
- */
133
- export type TimestampRawColumn = _TimestampRawColumn;
134
- /**
135
- * @deprecated - import from `@payloadcms/drizzle` instead
136
- */
137
- export type TransactionPg = _TransactionPg;
138
- /**
139
- * @deprecated - import from `@payloadcms/drizzle` instead
140
- */
141
- export type TransactionSQLite = _TransactionSQLite;
142
- /**
143
- * @deprecated - import from `@payloadcms/drizzle` instead
144
- */
145
- export type UUIDRawColumn = _UUIDRawColumn;
146
- /**
147
- * @deprecated - import from `@payloadcms/drizzle` instead
148
- */
149
- export type VectorRawColumn = _VectorRawColumn;
150
- //# sourceMappingURL=types-deprecated.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-deprecated.d.ts","sourceRoot":"","sources":["../../src/exports/types-deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,IAAI,cAAc,EAC/B,iBAAiB,IAAI,kBAAkB,EACvC,qBAAqB,IAAI,sBAAsB,EAC/C,cAAc,IAAI,eAAe,EACjC,qBAAqB,IAAI,sBAAsB,EAC/C,aAAa,IAAI,cAAc,EAC/B,mBAAmB,IAAI,oBAAoB,EAC3C,WAAW,IAAI,YAAY,EAC3B,cAAc,IAAI,eAAe,EACjC,kBAAkB,IAAI,mBAAmB,EACzC,YAAY,IAAI,aAAa,EAC7B,aAAa,IAAI,cAAc,EAC/B,OAAO,IAAI,QAAQ,EACnB,aAAa,IAAI,cAAc,EAC/B,cAAc,IAAI,eAAe,EACjC,eAAe,IAAI,gBAAgB,EACnC,eAAe,IAAI,gBAAgB,EACnC,YAAY,IAAI,aAAa,EAC7B,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EACzB,SAAS,IAAI,UAAU,EACvB,aAAa,IAAI,cAAc,EAC/B,QAAQ,IAAI,SAA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5 +0,0 @@
1
- /**
2
- * @deprecated - import from `@payloadcms/drizzle` instead
3
- */ export { };
4
-
5
- //# sourceMappingURL=types-deprecated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/exports/types-deprecated.ts"],"sourcesContent":["import type {\n BaseRawColumn as _BaseRawColumn,\n BuildDrizzleTable as _BuildDrizzleTable,\n BuildQueryJoinAliases as _BuildQueryJoinAliases,\n ChainedMethods as _ChainedMethods,\n ColumnToCodeConverter as _ColumnToCodeConverter,\n CountDistinct as _CountDistinct,\n CreateJSONQueryArgs as _CreateJSONQueryArgs,\n DeleteWhere as _DeleteWhere,\n DrizzleAdapter as _DrizzleAdapter,\n DrizzleTransaction as _DrizzleTransaction,\n DropDatabase as _DropDatabase,\n EnumRawColumn as _EnumRawColumn,\n Execute as _Execute,\n GenericColumn as _GenericColumn,\n GenericColumns as _GenericColumns,\n GenericPgColumn as _GenericPgColumn,\n GenericRelation as _GenericRelation,\n GenericTable as _GenericTable,\n IDType as _IDType,\n Insert as _Insert,\n IntegerRawColumn as _IntegerRawColumn,\n Migration as _Migration,\n PostgresDB as _PostgresDB,\n RawColumn as _RawColumn,\n RawForeignKey as _RawForeignKey,\n RawIndex as _RawIndex,\n RawRelation as _RawRelation,\n RawTable as _RawTable,\n RelationMap as _RelationMap,\n RequireDrizzleKit as _RequireDrizzleKit,\n SetColumnID as _SetColumnID,\n SQLiteDB as _SQLiteDB,\n TimestampRawColumn as _TimestampRawColumn,\n TransactionPg as _TransactionPg,\n TransactionSQLite as _TransactionSQLite,\n UUIDRawColumn as _UUIDRawColumn,\n VectorRawColumn as _VectorRawColumn,\n} from '../types.js'\n\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type BaseRawColumn = _BaseRawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type BuildDrizzleTable = _BuildDrizzleTable\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type BuildQueryJoinAliases = _BuildQueryJoinAliases\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type ChainedMethods = _ChainedMethods\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type ColumnToCodeConverter = _ColumnToCodeConverter\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type CountDistinct = _CountDistinct\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type CreateJSONQueryArgs = _CreateJSONQueryArgs\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type DeleteWhere = _DeleteWhere\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type DrizzleAdapter = _DrizzleAdapter\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type DrizzleTransaction = _DrizzleTransaction\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type DropDatabase = _DropDatabase\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type EnumRawColumn = _EnumRawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type Execute<T> = _Execute<T>\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type GenericColumn = _GenericColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type GenericColumns<T> = _GenericColumns<T>\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type GenericPgColumn = _GenericPgColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type GenericRelation = _GenericRelation\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type GenericTable = _GenericTable\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type IDType = _IDType\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type Insert = _Insert\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type IntegerRawColumn = _IntegerRawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type Migration = _Migration\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type PostgresDB = _PostgresDB\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RawColumn = _RawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RawForeignKey = _RawForeignKey\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RawIndex = _RawIndex\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RawRelation = _RawRelation\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RawTable = _RawTable\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RelationMap = _RelationMap\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type RequireDrizzleKit = _RequireDrizzleKit\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type SetColumnID = _SetColumnID\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type SQLiteDB = _SQLiteDB\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type TimestampRawColumn = _TimestampRawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type TransactionPg = _TransactionPg\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type TransactionSQLite = _TransactionSQLite\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type UUIDRawColumn = _UUIDRawColumn\n/**\n * @deprecated - import from `@payloadcms/drizzle` instead\n */\nexport type VectorRawColumn = _VectorRawColumn\n"],"names":[],"mappings":"AAwLA;;CAEC,GACD,WAA8C"}
@@ -1,384 +0,0 @@
1
- import { createClient } from '@libsql/client';
2
- import { getTableName, like, notLike } from 'drizzle-orm';
3
- import { drizzle } from 'drizzle-orm/libsql';
4
- import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
5
- import { flattenAllFields } from 'payload';
6
- import toSnakeCase from 'to-snake-case';
7
- import { afterAll, describe, expect, it } from 'vitest';
8
- import { operatorMap } from '../queries/operatorMap.js';
9
- import { createJSONQuery } from '../sqlite/createJSONQuery/index.js';
10
- import { buildPolymorphicJoinQuery } from './buildPolymorphicJoinQuery.js';
11
- const parentsTable = sqliteTable('join_parents', {
12
- id: integer('id').primaryKey()
13
- });
14
- const articlesTable = sqliteTable('join_articles', {
15
- id: integer('id').primaryKey(),
16
- createdAt: text('created_at'),
17
- details_rank: integer('details_rank'),
18
- parent: integer('parent_id'),
19
- score: integer('score'),
20
- title: text('title')
21
- });
22
- const notesTable = sqliteTable('join_notes', {
23
- id: integer('id').primaryKey(),
24
- parent: integer('parent_id'),
25
- title: text('title')
26
- });
27
- const tableWithoutID = sqliteTable('join_without_id', {
28
- parent: integer('parent_id')
29
- });
30
- const tableWithoutParent = sqliteTable('join_without_parent', {
31
- id: integer('id').primaryKey()
32
- });
33
- const client = createClient({
34
- url: 'file::memory:'
35
- });
36
- const db = drizzle(client, {
37
- schema: {
38
- articlesTable,
39
- notesTable,
40
- parentsTable,
41
- tableWithoutID,
42
- tableWithoutParent
43
- }
44
- });
45
- const createAdapter = (fixtures)=>{
46
- const collections = {};
47
- const tableNameMap = new Map();
48
- const tables = {};
49
- for (const [slug, fixture] of Object.entries(fixtures)){
50
- const tableName = getTableName(fixture.table);
51
- collections[slug] = {
52
- config: {
53
- fields: fixture.fields,
54
- flattenedFields: flattenAllFields({
55
- fields: fixture.fields
56
- })
57
- }
58
- };
59
- tableNameMap.set(toSnakeCase(slug), tableName);
60
- tables[tableName] = fixture.table;
61
- }
62
- return {
63
- createJSONQuery,
64
- drizzle: db,
65
- idType: 'serial',
66
- name: 'sqlite',
67
- operatorHandlers: [],
68
- operators: {
69
- ...operatorMap,
70
- contains: like,
71
- like,
72
- not_like: notLike
73
- },
74
- payload: {
75
- collections
76
- },
77
- tableNameMap,
78
- tables
79
- };
80
- };
81
- const adapter = createAdapter({
82
- articles: {
83
- fields: [
84
- {
85
- name: 'createdAt',
86
- type: 'date'
87
- },
88
- {
89
- name: 'details',
90
- type: 'group',
91
- fields: [
92
- {
93
- name: 'rank',
94
- type: 'number'
95
- }
96
- ]
97
- },
98
- {
99
- name: 'parent',
100
- relationTo: 'join-parents',
101
- type: 'relationship'
102
- },
103
- {
104
- name: 'score',
105
- type: 'number'
106
- },
107
- {
108
- name: 'title',
109
- type: 'text'
110
- }
111
- ],
112
- table: articlesTable
113
- },
114
- notes: {
115
- fields: [
116
- {
117
- name: 'parent',
118
- relationTo: 'join-parents',
119
- type: 'relationship'
120
- },
121
- {
122
- name: 'title',
123
- type: 'text'
124
- }
125
- ],
126
- table: notesTable
127
- }
128
- });
129
- const joinField = {
130
- collection: [
131
- 'articles',
132
- 'notes'
133
- ],
134
- name: 'children',
135
- on: 'parent',
136
- type: 'join'
137
- };
138
- const buildQuery = ({ adapter: adapterArg = adapter, field = joinField, limit = 0, page, path = '', shouldCount = false, sort, where } = {})=>buildPolymorphicJoinQuery({
139
- adapter: adapterArg,
140
- currentTableName: getTableName(parentsTable),
141
- field,
142
- limit,
143
- page,
144
- path,
145
- shouldCount,
146
- sort,
147
- where
148
- });
149
- const renderQuery = (query)=>{
150
- const selection = {
151
- documents: query.documents
152
- };
153
- if (query.count) {
154
- selection.count = query.count;
155
- }
156
- return db.select(selection).from(parentsTable).toSQL();
157
- };
158
- afterAll(()=>client.close());
159
- describe('buildPolymorphicJoinQuery', ()=>{
160
- it('combines every target into one fixed polymorphic document projection', ()=>{
161
- const result = buildQuery({
162
- path: 'content.'
163
- });
164
- const query = renderQuery(result);
165
- expect(result.columnName).toBe('content_children');
166
- expect(result.count).toBeUndefined();
167
- expect(query.sql).toContain('union all');
168
- expect(query.sql).toContain('select "id"');
169
- expect(query.sql).toContain('from "join_articles" union all');
170
- expect(query.sql).toContain('from "join_notes"');
171
- expect(query.sql).toContain('as "parent"');
172
- expect(query.sql).toContain('as "relationTo"');
173
- expect(query.sql).toContain("json_object('id',");
174
- expect(query.sql).toContain("'relationTo',");
175
- expect(query.params).toContain('articles');
176
- expect(query.params).toContain('notes');
177
- });
178
- it('sorts by createdAt descending by default when one target has timestamps', ()=>{
179
- const query = renderQuery(buildQuery());
180
- expect(query.sql).toContain('"created_at" as "sortPath" from "join_articles"');
181
- expect(query.sql).toContain('? as "sortPath" from "join_notes"');
182
- expect(query.sql).toContain('order by "sortPath" desc');
183
- expect(query.params).toContain(null);
184
- });
185
- it('uses id ascending by default when no target has a createdAt field', ()=>{
186
- const adapterWithoutTimestamps = createAdapter({
187
- articles: {
188
- fields: [
189
- {
190
- name: 'parent',
191
- relationTo: 'join-parents',
192
- type: 'relationship'
193
- }
194
- ],
195
- table: articlesTable
196
- },
197
- notes: {
198
- fields: [
199
- {
200
- name: 'parent',
201
- relationTo: 'join-parents',
202
- type: 'relationship'
203
- }
204
- ],
205
- table: notesTable
206
- }
207
- });
208
- const query = renderQuery(buildQuery({
209
- adapter: adapterWithoutTimestamps
210
- }));
211
- expect(query.sql).toContain('"id" as "sortPath" from "join_articles"');
212
- expect(query.sql).toContain('"id" as "sortPath" from "join_notes"');
213
- expect(query.sql).toContain('order by "sortPath" asc');
214
- });
215
- it('supports an explicit ascending nested sort and substitutes null when it is absent', ()=>{
216
- const query = renderQuery(buildQuery({
217
- sort: 'details.rank'
218
- }));
219
- expect(query.sql).toContain('"details_rank" as "sortPath" from "join_articles"');
220
- expect(query.sql).toContain('? as "sortPath" from "join_notes"');
221
- expect(query.sql).toContain('order by "sortPath" asc');
222
- expect(query.params).toContain(null);
223
- });
224
- it('applies the shared where clause independently to each target branch', ()=>{
225
- const query = renderQuery(buildQuery({
226
- where: {
227
- AND: [
228
- {
229
- title: {
230
- equals: 'available'
231
- }
232
- },
233
- {
234
- relationTo: {
235
- equals: 'articles'
236
- }
237
- }
238
- ]
239
- }
240
- }));
241
- expect(query.sql.match(/"title" = \?/g)).toHaveLength(2);
242
- expect(query.sql).toContain('? = ?');
243
- expect(query.params.filter((value)=>value === 'available')).toHaveLength(2);
244
- expect(query.params).toContain('articles');
245
- expect(query.params).toContain('notes');
246
- });
247
- it('adds a correlated count only when requested', ()=>{
248
- const result = buildQuery({
249
- shouldCount: true
250
- });
251
- const query = renderQuery(result);
252
- expect(result.count).toBeDefined();
253
- expect(query.sql).toContain('select count(*) from');
254
- expect(query.sql).toContain('"join_parents"."id" = "children_subquery"."parent"');
255
- });
256
- it('adds limit and page offset to the document query', ()=>{
257
- const query = renderQuery(buildQuery({
258
- limit: 11,
259
- page: 3
260
- }));
261
- expect(query.sql).toContain('LIMIT ? OFFSET ?');
262
- expect(query.params.slice(-2)).toEqual([
263
- 11,
264
- 22
265
- ]);
266
- });
267
- it('does not add limit or offset when limit is zero', ()=>{
268
- const query = renderQuery(buildQuery({
269
- limit: 0,
270
- page: 3
271
- }));
272
- const normalizedSQL = query.sql.toLowerCase();
273
- expect(normalizedSQL).not.toContain(' limit ');
274
- expect(normalizedSQL).not.toContain(' offset ');
275
- });
276
- it('rejects a join field with a non-polymorphic collection', ()=>{
277
- const scalarJoinField = {
278
- ...joinField,
279
- collection: 'articles'
280
- };
281
- expect(()=>buildQuery({
282
- field: scalarJoinField
283
- })).toThrow('A polymorphic join requires a collection array');
284
- });
285
- it('rejects a polymorphic join with no target collections', ()=>{
286
- const emptyJoinField = {
287
- ...joinField,
288
- collection: []
289
- };
290
- expect(()=>buildQuery({
291
- field: emptyJoinField
292
- })).toThrow('A polymorphic join requires at least one collection');
293
- });
294
- it('rejects multiple sort fields with a descriptive error', ()=>{
295
- expect(()=>buildQuery({
296
- sort: [
297
- 'title',
298
- '-createdAt'
299
- ]
300
- })).toThrow('Polymorphic joins do not support multiple sort fields');
301
- });
302
- it('throws a descriptive error when a target collection is not configured', ()=>{
303
- const missingCollectionField = {
304
- ...joinField,
305
- collection: [
306
- 'articles',
307
- 'missing'
308
- ]
309
- };
310
- expect(()=>buildQuery({
311
- field: missingCollectionField
312
- })).toThrow('Unknown polymorphic join collection "missing"');
313
- });
314
- it('throws a descriptive error when a configured collection has no database table', ()=>{
315
- const adapterWithoutTable = createAdapter({
316
- articles: {
317
- fields: [
318
- {
319
- name: 'parent',
320
- relationTo: 'join-parents',
321
- type: 'relationship'
322
- }
323
- ],
324
- table: articlesTable
325
- }
326
- });
327
- adapterWithoutTable.tables = {};
328
- const singleCollectionField = {
329
- ...joinField,
330
- collection: [
331
- 'articles'
332
- ]
333
- };
334
- expect(()=>buildQuery({
335
- adapter: adapterWithoutTable,
336
- field: singleCollectionField
337
- })).toThrow('Polymorphic join collection "articles" has no database table');
338
- });
339
- it.each([
340
- [
341
- 'id',
342
- createAdapter({
343
- articles: {
344
- fields: [
345
- {
346
- name: 'parent',
347
- relationTo: 'join-parents',
348
- type: 'relationship'
349
- }
350
- ],
351
- table: tableWithoutID
352
- }
353
- })
354
- ],
355
- [
356
- 'parent',
357
- createAdapter({
358
- articles: {
359
- fields: [
360
- {
361
- name: 'parent',
362
- relationTo: 'join-parents',
363
- type: 'relationship'
364
- }
365
- ],
366
- table: tableWithoutParent
367
- }
368
- })
369
- ]
370
- ])('rejects a target whose table has no %s column', (column, adapterArg)=>{
371
- const singleCollectionField = {
372
- ...joinField,
373
- collection: [
374
- 'articles'
375
- ]
376
- };
377
- expect(()=>buildQuery({
378
- adapter: adapterArg,
379
- field: singleCollectionField
380
- })).toThrow(`Polymorphic join collection "articles" has no "${column}" column`);
381
- });
382
- });
383
-
384
- //# sourceMappingURL=buildPolymorphicJoinQuery.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/find/buildPolymorphicJoinQuery.spec.ts"],"sourcesContent":["import type { Client } from '@libsql/client'\nimport type { SQL } from 'drizzle-orm'\nimport type { Field, FlattenedJoinField, Where } from 'payload'\n\nimport { createClient } from '@libsql/client'\nimport { getTableName, like, notLike } from 'drizzle-orm'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { flattenAllFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\nimport { afterAll, describe, expect, it } from 'vitest'\n\nimport type { DrizzleAdapter, GenericTable } from '../types.js'\n\nimport { operatorMap } from '../queries/operatorMap.js'\nimport { createJSONQuery } from '../sqlite/createJSONQuery/index.js'\nimport { buildPolymorphicJoinQuery } from './buildPolymorphicJoinQuery.js'\n\nconst parentsTable = sqliteTable('join_parents', {\n id: integer('id').primaryKey(),\n})\n\nconst articlesTable = sqliteTable('join_articles', {\n id: integer('id').primaryKey(),\n createdAt: text('created_at'),\n details_rank: integer('details_rank'),\n parent: integer('parent_id'),\n score: integer('score'),\n title: text('title'),\n})\n\nconst notesTable = sqliteTable('join_notes', {\n id: integer('id').primaryKey(),\n parent: integer('parent_id'),\n title: text('title'),\n})\n\nconst tableWithoutID = sqliteTable('join_without_id', {\n parent: integer('parent_id'),\n})\n\nconst tableWithoutParent = sqliteTable('join_without_parent', {\n id: integer('id').primaryKey(),\n})\n\nconst client: Client = createClient({ url: 'file::memory:' })\nconst db = drizzle(client, {\n schema: { articlesTable, notesTable, parentsTable, tableWithoutID, tableWithoutParent },\n})\n\ntype CollectionFixture = {\n fields: Field[]\n table: GenericTable\n}\n\nconst createAdapter = (fixtures: Record<string, CollectionFixture>): DrizzleAdapter => {\n const collections: Record<\n string,\n { config: { fields: Field[]; flattenedFields: ReturnType<typeof flattenAllFields> } }\n > = {}\n const tableNameMap = new Map<string, string>()\n const tables: Record<string, GenericTable> = {}\n\n for (const [slug, fixture] of Object.entries(fixtures)) {\n const tableName = getTableName(fixture.table)\n\n collections[slug] = {\n config: {\n fields: fixture.fields,\n flattenedFields: flattenAllFields({ fields: fixture.fields }),\n },\n }\n tableNameMap.set(toSnakeCase(slug), tableName)\n tables[tableName] = fixture.table\n }\n\n return {\n createJSONQuery,\n drizzle: db,\n idType: 'serial',\n name: 'sqlite',\n operatorHandlers: [],\n operators: {\n ...operatorMap,\n contains: like,\n like,\n not_like: notLike,\n },\n payload: { collections },\n tableNameMap,\n tables,\n } as unknown as DrizzleAdapter\n}\n\nconst adapter = createAdapter({\n articles: {\n fields: [\n { name: 'createdAt', type: 'date' },\n {\n name: 'details',\n type: 'group',\n fields: [{ name: 'rank', type: 'number' }],\n },\n { name: 'parent', relationTo: 'join-parents', type: 'relationship' },\n { name: 'score', type: 'number' },\n { name: 'title', type: 'text' },\n ],\n table: articlesTable,\n },\n notes: {\n fields: [\n { name: 'parent', relationTo: 'join-parents', type: 'relationship' },\n { name: 'title', type: 'text' },\n ],\n table: notesTable,\n },\n})\n\nconst joinField = {\n collection: ['articles', 'notes'],\n name: 'children',\n on: 'parent',\n type: 'join',\n} as unknown as FlattenedJoinField\n\nconst buildQuery = ({\n adapter: adapterArg = adapter,\n field = joinField,\n limit = 0,\n page,\n path = '',\n shouldCount = false,\n sort,\n where,\n}: {\n adapter?: DrizzleAdapter\n field?: FlattenedJoinField\n limit?: number\n page?: number\n path?: string\n shouldCount?: boolean\n sort?: string | string[]\n where?: Where\n} = {}) =>\n buildPolymorphicJoinQuery({\n adapter: adapterArg,\n currentTableName: getTableName(parentsTable),\n field,\n limit,\n page,\n path,\n shouldCount,\n sort,\n where,\n })\n\nconst renderQuery = (query: ReturnType<typeof buildPolymorphicJoinQuery>) => {\n const selection: Record<string, SQL.Aliased> = { documents: query.documents }\n\n if (query.count) {\n selection.count = query.count\n }\n\n return db.select(selection).from(parentsTable).toSQL()\n}\n\nafterAll(() => client.close())\n\ndescribe('buildPolymorphicJoinQuery', () => {\n it('combines every target into one fixed polymorphic document projection', () => {\n const result = buildQuery({ path: 'content.' })\n const query = renderQuery(result)\n\n expect(result.columnName).toBe('content_children')\n expect(result.count).toBeUndefined()\n expect(query.sql).toContain('union all')\n expect(query.sql).toContain('select \"id\"')\n expect(query.sql).toContain('from \"join_articles\" union all')\n expect(query.sql).toContain('from \"join_notes\"')\n expect(query.sql).toContain('as \"parent\"')\n expect(query.sql).toContain('as \"relationTo\"')\n expect(query.sql).toContain(\"json_object('id',\")\n expect(query.sql).toContain(\"'relationTo',\")\n expect(query.params).toContain('articles')\n expect(query.params).toContain('notes')\n })\n\n it('sorts by createdAt descending by default when one target has timestamps', () => {\n const query = renderQuery(buildQuery())\n\n expect(query.sql).toContain('\"created_at\" as \"sortPath\" from \"join_articles\"')\n expect(query.sql).toContain('? as \"sortPath\" from \"join_notes\"')\n expect(query.sql).toContain('order by \"sortPath\" desc')\n expect(query.params).toContain(null)\n })\n\n it('uses id ascending by default when no target has a createdAt field', () => {\n const adapterWithoutTimestamps = createAdapter({\n articles: {\n fields: [{ name: 'parent', relationTo: 'join-parents', type: 'relationship' }],\n table: articlesTable,\n },\n notes: {\n fields: [{ name: 'parent', relationTo: 'join-parents', type: 'relationship' }],\n table: notesTable,\n },\n })\n const query = renderQuery(buildQuery({ adapter: adapterWithoutTimestamps }))\n\n expect(query.sql).toContain('\"id\" as \"sortPath\" from \"join_articles\"')\n expect(query.sql).toContain('\"id\" as \"sortPath\" from \"join_notes\"')\n expect(query.sql).toContain('order by \"sortPath\" asc')\n })\n\n it('supports an explicit ascending nested sort and substitutes null when it is absent', () => {\n const query = renderQuery(buildQuery({ sort: 'details.rank' }))\n\n expect(query.sql).toContain('\"details_rank\" as \"sortPath\" from \"join_articles\"')\n expect(query.sql).toContain('? as \"sortPath\" from \"join_notes\"')\n expect(query.sql).toContain('order by \"sortPath\" asc')\n expect(query.params).toContain(null)\n })\n\n it('applies the shared where clause independently to each target branch', () => {\n const query = renderQuery(\n buildQuery({\n where: {\n AND: [{ title: { equals: 'available' } }, { relationTo: { equals: 'articles' } }],\n },\n }),\n )\n\n expect(query.sql.match(/\"title\" = \\?/g)).toHaveLength(2)\n expect(query.sql).toContain('? = ?')\n expect(query.params.filter((value) => value === 'available')).toHaveLength(2)\n expect(query.params).toContain('articles')\n expect(query.params).toContain('notes')\n })\n\n it('adds a correlated count only when requested', () => {\n const result = buildQuery({ shouldCount: true })\n const query = renderQuery(result)\n\n expect(result.count).toBeDefined()\n expect(query.sql).toContain('select count(*) from')\n expect(query.sql).toContain('\"join_parents\".\"id\" = \"children_subquery\".\"parent\"')\n })\n\n it('adds limit and page offset to the document query', () => {\n const query = renderQuery(buildQuery({ limit: 11, page: 3 }))\n\n expect(query.sql).toContain('LIMIT ? OFFSET ?')\n expect(query.params.slice(-2)).toEqual([11, 22])\n })\n\n it('does not add limit or offset when limit is zero', () => {\n const query = renderQuery(buildQuery({ limit: 0, page: 3 }))\n const normalizedSQL = query.sql.toLowerCase()\n\n expect(normalizedSQL).not.toContain(' limit ')\n expect(normalizedSQL).not.toContain(' offset ')\n })\n\n it('rejects a join field with a non-polymorphic collection', () => {\n const scalarJoinField = {\n ...joinField,\n collection: 'articles',\n } as unknown as FlattenedJoinField\n\n expect(() => buildQuery({ field: scalarJoinField })).toThrow(\n 'A polymorphic join requires a collection array',\n )\n })\n\n it('rejects a polymorphic join with no target collections', () => {\n const emptyJoinField = { ...joinField, collection: [] } as unknown as FlattenedJoinField\n\n expect(() => buildQuery({ field: emptyJoinField })).toThrow(\n 'A polymorphic join requires at least one collection',\n )\n })\n\n it('rejects multiple sort fields with a descriptive error', () => {\n expect(() => buildQuery({ sort: ['title', '-createdAt'] })).toThrow(\n 'Polymorphic joins do not support multiple sort fields',\n )\n })\n\n it('throws a descriptive error when a target collection is not configured', () => {\n const missingCollectionField = {\n ...joinField,\n collection: ['articles', 'missing'],\n } as unknown as FlattenedJoinField\n\n expect(() => buildQuery({ field: missingCollectionField })).toThrow(\n 'Unknown polymorphic join collection \"missing\"',\n )\n })\n\n it('throws a descriptive error when a configured collection has no database table', () => {\n const adapterWithoutTable = createAdapter({\n articles: {\n fields: [{ name: 'parent', relationTo: 'join-parents', type: 'relationship' }],\n table: articlesTable,\n },\n })\n\n adapterWithoutTable.tables = {}\n\n const singleCollectionField = {\n ...joinField,\n collection: ['articles'],\n } as unknown as FlattenedJoinField\n\n expect(() =>\n buildQuery({ adapter: adapterWithoutTable, field: singleCollectionField }),\n ).toThrow('Polymorphic join collection \"articles\" has no database table')\n })\n\n it.each([\n [\n 'id',\n createAdapter({\n articles: {\n fields: [{ name: 'parent', relationTo: 'join-parents', type: 'relationship' }],\n table: tableWithoutID,\n },\n }),\n ],\n [\n 'parent',\n createAdapter({\n articles: {\n fields: [{ name: 'parent', relationTo: 'join-parents', type: 'relationship' }],\n table: tableWithoutParent,\n },\n }),\n ],\n ] as const)('rejects a target whose table has no %s column', (column, adapterArg) => {\n const singleCollectionField = {\n ...joinField,\n collection: ['articles'],\n } as unknown as FlattenedJoinField\n\n expect(() => buildQuery({ adapter: adapterArg, field: singleCollectionField })).toThrow(\n `Polymorphic join collection \"articles\" has no \"${column}\" column`,\n )\n })\n})\n"],"names":["createClient","getTableName","like","notLike","drizzle","integer","sqliteTable","text","flattenAllFields","toSnakeCase","afterAll","describe","expect","it","operatorMap","createJSONQuery","buildPolymorphicJoinQuery","parentsTable","id","primaryKey","articlesTable","createdAt","details_rank","parent","score","title","notesTable","tableWithoutID","tableWithoutParent","client","url","db","schema","createAdapter","fixtures","collections","tableNameMap","Map","tables","slug","fixture","Object","entries","tableName","table","config","fields","flattenedFields","set","idType","name","operatorHandlers","operators","contains","not_like","payload","adapter","articles","type","relationTo","notes","joinField","collection","on","buildQuery","adapterArg","field","limit","page","path","shouldCount","sort","where","currentTableName","renderQuery","query","selection","documents","count","select","from","toSQL","close","result","columnName","toBe","toBeUndefined","sql","toContain","params","adapterWithoutTimestamps","AND","equals","match","toHaveLength","filter","value","toBeDefined","slice","toEqual","normalizedSQL","toLowerCase","not","scalarJoinField","toThrow","emptyJoinField","missingCollectionField","adapterWithoutTable","singleCollectionField","each","column"],"mappings":"AAIA,SAASA,YAAY,QAAQ,iBAAgB;AAC7C,SAASC,YAAY,EAAEC,IAAI,EAAEC,OAAO,QAAQ,cAAa;AACzD,SAASC,OAAO,QAAQ,qBAAoB;AAC5C,SAASC,OAAO,EAAEC,WAAW,EAAEC,IAAI,QAAQ,0BAAyB;AACpE,SAASC,gBAAgB,QAAQ,UAAS;AAC1C,OAAOC,iBAAiB,gBAAe;AACvC,SAASC,QAAQ,EAAEC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