joist-codegen 2.2.0 → 2.3.0-next.10

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 (64) hide show
  1. package/build/EntityDbMetadata.d.ts +62 -0
  2. package/build/EntityDbMetadata.d.ts.map +1 -1
  3. package/build/EntityDbMetadata.js +127 -3
  4. package/build/EntityDbMetadata.js.map +1 -1
  5. package/build/EntityDbMetadata.test.js +94 -0
  6. package/build/EntityDbMetadata.test.js.map +1 -1
  7. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts +2 -0
  8. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts.map +1 -0
  9. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js +9 -0
  10. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js.map +1 -0
  11. package/build/codemods/codemod_0003-rename_find_paginated.d.ts +7 -0
  12. package/build/codemods/codemod_0003-rename_find_paginated.d.ts.map +1 -0
  13. package/build/codemods/codemod_0003-rename_find_paginated.js +29 -0
  14. package/build/codemods/codemod_0003-rename_find_paginated.js.map +1 -0
  15. package/build/codemods/index.d.ts.map +1 -1
  16. package/build/codemods/index.js +6 -1
  17. package/build/codemods/index.js.map +1 -1
  18. package/build/codemods/index.test.js +7 -2
  19. package/build/codemods/index.test.js.map +1 -1
  20. package/build/config.d.ts +41 -535
  21. package/build/config.d.ts.map +1 -1
  22. package/build/config.js +25 -7
  23. package/build/config.js.map +1 -1
  24. package/build/config.test.js +15 -0
  25. package/build/config.test.js.map +1 -1
  26. package/build/docs/index.js +1 -1
  27. package/build/docs/index.js.map +1 -1
  28. package/build/docs/index.test.js +11 -0
  29. package/build/docs/index.test.js.map +1 -1
  30. package/build/findEntityScopes.d.ts +11 -0
  31. package/build/findEntityScopes.d.ts.map +1 -0
  32. package/build/findEntityScopes.js +144 -0
  33. package/build/findEntityScopes.js.map +1 -0
  34. package/build/generate.d.ts.map +1 -1
  35. package/build/generate.js +4 -2
  36. package/build/generate.js.map +1 -1
  37. package/build/generateEntitiesFile.d.ts +1 -1
  38. package/build/generateEntitiesFile.d.ts.map +1 -1
  39. package/build/generateEntityCodegenFile.d.ts +4 -3
  40. package/build/generateEntityCodegenFile.d.ts.map +1 -1
  41. package/build/generateEntityCodegenFile.js +94 -34
  42. package/build/generateEntityCodegenFile.js.map +1 -1
  43. package/build/generateMetadataFile.js +25 -0
  44. package/build/generateMetadataFile.js.map +1 -1
  45. package/build/index.d.ts +1 -1
  46. package/build/index.d.ts.map +1 -1
  47. package/build/index.js +2 -0
  48. package/build/index.js.map +1 -1
  49. package/build/inheritance.d.ts.map +1 -1
  50. package/build/inheritance.js +4 -0
  51. package/build/inheritance.js.map +1 -1
  52. package/build/logger.d.ts +2 -2
  53. package/build/logger.d.ts.map +1 -1
  54. package/build/symbols.d.ts +4 -0
  55. package/build/symbols.d.ts.map +1 -1
  56. package/build/symbols.js +7 -3
  57. package/build/symbols.js.map +1 -1
  58. package/build/utils.d.ts +2 -0
  59. package/build/utils.d.ts.map +1 -1
  60. package/build/utils.js +22 -9
  61. package/build/utils.js.map +1 -1
  62. package/build/write-json-schema.js +6 -4
  63. package/build/write-json-schema.js.map +1 -1
  64. package/package.json +11 -12
package/build/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { DbMetadata, Entity, EntityDbMetadata } from "EntityDbMetadata";
1
+ import { DbMetadata, Entity, EntityDbMetadata } from "./EntityDbMetadata";
2
2
  import { z } from "zod";
3
3
  declare const fieldConfig: z.ZodObject<{
4
- derived: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
4
+ derived: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
5
5
  protected: z.ZodOptional<z.ZodBoolean>;
6
6
  ignore: z.ZodOptional<z.ZodBoolean>;
7
7
  superstruct: z.ZodOptional<z.ZodString>;
@@ -12,76 +12,26 @@ declare const fieldConfig: z.ZodObject<{
12
12
  stiType: z.ZodOptional<z.ZodString>;
13
13
  notNull: z.ZodOptional<z.ZodBoolean>;
14
14
  hasDefault: z.ZodOptional<z.ZodBoolean>;
15
- }, "strict", z.ZodTypeAny, {
16
- type?: string | undefined;
17
- derived?: "sync" | "async" | undefined;
18
- protected?: boolean | undefined;
19
- ignore?: boolean | undefined;
20
- superstruct?: string | undefined;
21
- zodSchema?: string | undefined;
22
- serde?: string | undefined;
23
- stiDiscriminator?: Record<string, string> | undefined;
24
- stiType?: string | undefined;
25
- notNull?: boolean | undefined;
26
- hasDefault?: boolean | undefined;
27
- }, {
28
- type?: string | undefined;
29
- derived?: "sync" | "async" | undefined;
30
- protected?: boolean | undefined;
31
- ignore?: boolean | undefined;
32
- superstruct?: string | undefined;
33
- zodSchema?: string | undefined;
34
- serde?: string | undefined;
35
- stiDiscriminator?: Record<string, string> | undefined;
36
- stiType?: string | undefined;
37
- notNull?: boolean | undefined;
38
- hasDefault?: boolean | undefined;
39
- }>;
15
+ }, z.core.$strict>;
40
16
  export type FieldConfig = z.infer<typeof fieldConfig>;
41
17
  declare const relationConfig: z.ZodObject<{
42
18
  derived: z.ZodOptional<z.ZodLiteral<"async">>;
43
- polymorphic: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
19
+ polymorphic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
44
20
  large: z.ZodOptional<z.ZodBoolean>;
45
21
  orderBy: z.ZodOptional<z.ZodString>;
22
+ softDeletes: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"include">, z.ZodLiteral<"exclude">]>>;
46
23
  stiType: z.ZodOptional<z.ZodString>;
47
- /**
48
- * Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).
49
- *
50
- * Self-referential FKs also support `subType: "self"` that means each subtype will point
51
- * at its own subtype.
52
- */
53
24
  subType: z.ZodOptional<z.ZodString>;
54
- /** Allow skipping self-referential fields getting a `...Recursive` relation. */
55
25
  skipRecursiveRelations: z.ZodOptional<z.ZodBoolean>;
56
26
  notNull: z.ZodOptional<z.ZodBoolean>;
57
27
  hasDefault: z.ZodOptional<z.ZodBoolean>;
58
- }, "strict", z.ZodTypeAny, {
59
- derived?: "async" | undefined;
60
- stiType?: string | undefined;
61
- notNull?: boolean | undefined;
62
- hasDefault?: boolean | undefined;
63
- polymorphic?: true | "notNull" | undefined;
64
- large?: boolean | undefined;
65
- orderBy?: string | undefined;
66
- subType?: string | undefined;
67
- skipRecursiveRelations?: boolean | undefined;
68
- }, {
69
- derived?: "async" | undefined;
70
- stiType?: string | undefined;
71
- notNull?: boolean | undefined;
72
- hasDefault?: boolean | undefined;
73
- polymorphic?: true | "notNull" | undefined;
74
- large?: boolean | undefined;
75
- orderBy?: string | undefined;
76
- subType?: string | undefined;
77
- skipRecursiveRelations?: boolean | undefined;
78
- }>;
28
+ }, z.core.$strict>;
79
29
  export type RelationConfig = z.infer<typeof relationConfig>;
80
30
  declare const entityConfig: z.ZodObject<{
81
31
  tag: z.ZodString;
82
32
  tableName: z.ZodOptional<z.ZodString>;
83
33
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
84
- derived: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
34
+ derived: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
85
35
  protected: z.ZodOptional<z.ZodBoolean>;
86
36
  ignore: z.ZodOptional<z.ZodBoolean>;
87
37
  superstruct: z.ZodOptional<z.ZodString>;
@@ -92,258 +42,58 @@ declare const entityConfig: z.ZodObject<{
92
42
  stiType: z.ZodOptional<z.ZodString>;
93
43
  notNull: z.ZodOptional<z.ZodBoolean>;
94
44
  hasDefault: z.ZodOptional<z.ZodBoolean>;
95
- }, "strict", z.ZodTypeAny, {
96
- type?: string | undefined;
97
- derived?: "sync" | "async" | undefined;
98
- protected?: boolean | undefined;
99
- ignore?: boolean | undefined;
100
- superstruct?: string | undefined;
101
- zodSchema?: string | undefined;
102
- serde?: string | undefined;
103
- stiDiscriminator?: Record<string, string> | undefined;
104
- stiType?: string | undefined;
105
- notNull?: boolean | undefined;
106
- hasDefault?: boolean | undefined;
107
- }, {
108
- type?: string | undefined;
109
- derived?: "sync" | "async" | undefined;
110
- protected?: boolean | undefined;
111
- ignore?: boolean | undefined;
112
- superstruct?: string | undefined;
113
- zodSchema?: string | undefined;
114
- serde?: string | undefined;
115
- stiDiscriminator?: Record<string, string> | undefined;
116
- stiType?: string | undefined;
117
- notNull?: boolean | undefined;
118
- hasDefault?: boolean | undefined;
119
- }>>>;
45
+ }, z.core.$strict>>>;
120
46
  relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
121
47
  derived: z.ZodOptional<z.ZodLiteral<"async">>;
122
- polymorphic: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
48
+ polymorphic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
123
49
  large: z.ZodOptional<z.ZodBoolean>;
124
50
  orderBy: z.ZodOptional<z.ZodString>;
51
+ softDeletes: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"include">, z.ZodLiteral<"exclude">]>>;
125
52
  stiType: z.ZodOptional<z.ZodString>;
126
- /**
127
- * Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).
128
- *
129
- * Self-referential FKs also support `subType: "self"` that means each subtype will point
130
- * at its own subtype.
131
- */
132
53
  subType: z.ZodOptional<z.ZodString>;
133
- /** Allow skipping self-referential fields getting a `...Recursive` relation. */
134
54
  skipRecursiveRelations: z.ZodOptional<z.ZodBoolean>;
135
55
  notNull: z.ZodOptional<z.ZodBoolean>;
136
56
  hasDefault: z.ZodOptional<z.ZodBoolean>;
137
- }, "strict", z.ZodTypeAny, {
138
- derived?: "async" | undefined;
139
- stiType?: string | undefined;
140
- notNull?: boolean | undefined;
141
- hasDefault?: boolean | undefined;
142
- polymorphic?: true | "notNull" | undefined;
143
- large?: boolean | undefined;
144
- orderBy?: string | undefined;
145
- subType?: string | undefined;
146
- skipRecursiveRelations?: boolean | undefined;
147
- }, {
148
- derived?: "async" | undefined;
149
- stiType?: string | undefined;
150
- notNull?: boolean | undefined;
151
- hasDefault?: boolean | undefined;
152
- polymorphic?: true | "notNull" | undefined;
153
- large?: boolean | undefined;
154
- orderBy?: string | undefined;
155
- subType?: string | undefined;
156
- skipRecursiveRelations?: boolean | undefined;
157
- }>>>;
158
- /** Whether this entity should be abstract, e.g. for inheritance a subtype must be instantiated instead of this type. */
57
+ }, z.core.$strict>>>;
159
58
  abstract: z.ZodOptional<z.ZodBoolean>;
160
59
  orderBy: z.ZodOptional<z.ZodString>;
161
- uniqueBy: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">]>, string[][], string | string[] | string[][]>>;
162
- }, "strict", z.ZodTypeAny, {
163
- tag: string;
164
- tableName?: string | undefined;
165
- fields?: Record<string, {
166
- type?: string | undefined;
167
- derived?: "sync" | "async" | undefined;
168
- protected?: boolean | undefined;
169
- ignore?: boolean | undefined;
170
- superstruct?: string | undefined;
171
- zodSchema?: string | undefined;
172
- serde?: string | undefined;
173
- stiDiscriminator?: Record<string, string> | undefined;
174
- stiType?: string | undefined;
175
- notNull?: boolean | undefined;
176
- hasDefault?: boolean | undefined;
177
- }> | undefined;
178
- relations?: Record<string, {
179
- derived?: "async" | undefined;
180
- stiType?: string | undefined;
181
- notNull?: boolean | undefined;
182
- hasDefault?: boolean | undefined;
183
- polymorphic?: true | "notNull" | undefined;
184
- large?: boolean | undefined;
185
- orderBy?: string | undefined;
186
- subType?: string | undefined;
187
- skipRecursiveRelations?: boolean | undefined;
188
- }> | undefined;
189
- orderBy?: string | undefined;
190
- abstract?: boolean | undefined;
191
- uniqueBy?: string[][] | undefined;
192
- }, {
193
- tag: string;
194
- tableName?: string | undefined;
195
- fields?: Record<string, {
196
- type?: string | undefined;
197
- derived?: "sync" | "async" | undefined;
198
- protected?: boolean | undefined;
199
- ignore?: boolean | undefined;
200
- superstruct?: string | undefined;
201
- zodSchema?: string | undefined;
202
- serde?: string | undefined;
203
- stiDiscriminator?: Record<string, string> | undefined;
204
- stiType?: string | undefined;
205
- notNull?: boolean | undefined;
206
- hasDefault?: boolean | undefined;
207
- }> | undefined;
208
- relations?: Record<string, {
209
- derived?: "async" | undefined;
210
- stiType?: string | undefined;
211
- notNull?: boolean | undefined;
212
- hasDefault?: boolean | undefined;
213
- polymorphic?: true | "notNull" | undefined;
214
- large?: boolean | undefined;
215
- orderBy?: string | undefined;
216
- subType?: string | undefined;
217
- skipRecursiveRelations?: boolean | undefined;
218
- }> | undefined;
219
- orderBy?: string | undefined;
220
- abstract?: boolean | undefined;
221
- uniqueBy?: string | string[] | string[][] | undefined;
222
- }>;
60
+ uniqueBy: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodArray<z.ZodString>>]>, z.ZodTransform<string[][], string | string[] | string[][]>>>;
61
+ }, z.core.$strict>;
223
62
  export type EntityConfig = z.infer<typeof entityConfig>;
224
63
  declare const timestampConfig: z.ZodObject<{
225
- /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */
226
- names: z.ZodArray<z.ZodString, "many">;
227
- /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */
64
+ names: z.ZodArray<z.ZodString>;
228
65
  required: z.ZodOptional<z.ZodBoolean>;
229
- }, "strict", z.ZodTypeAny, {
230
- names: string[];
231
- required?: boolean | undefined;
232
- }, {
233
- names: string[];
234
- required?: boolean | undefined;
235
- }>;
66
+ }, z.core.$strict>;
236
67
  export type TimestampConfig = z.infer<typeof timestampConfig>;
237
68
  export declare const config: z.ZodObject<{
238
- /** The _build-time_ database URL for reading database metadata. */
239
69
  databaseUrl: z.ZodOptional<z.ZodString>;
240
- /** Your application's request-level `Context` type. */
241
70
  contextType: z.ZodOptional<z.ZodString>;
242
- /** Your application's database client's `Transaction` type. */
243
71
  transactionType: z.ZodOptional<z.ZodString>;
244
- /**
245
- * Allows the user to specify the `updated_at` / `created_at` column names to look up, and if they're optional.
246
- *
247
- * We default to looking for `updated_at`, `updatedAt`, `created_at`, `createdAt`, and optional to true,
248
- * e.g. tables are not required to have both timestamp columns to be considered entities.
249
- *
250
- * These defaults are the most lenient, to facilitate running Joist against an existing schema and
251
- * seeing all of your entities, regardless of your previous conventions.
252
- */
253
72
  timestampColumns: z.ZodOptional<z.ZodObject<{
254
73
  createdAt: z.ZodOptional<z.ZodObject<{
255
- /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */
256
- names: z.ZodArray<z.ZodString, "many">;
257
- /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */
74
+ names: z.ZodArray<z.ZodString>;
258
75
  required: z.ZodOptional<z.ZodBoolean>;
259
- }, "strict", z.ZodTypeAny, {
260
- names: string[];
261
- required?: boolean | undefined;
262
- }, {
263
- names: string[];
264
- required?: boolean | undefined;
265
- }>>;
76
+ }, z.core.$strict>>;
266
77
  updatedAt: z.ZodOptional<z.ZodObject<{
267
- /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */
268
- names: z.ZodArray<z.ZodString, "many">;
269
- /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */
78
+ names: z.ZodArray<z.ZodString>;
270
79
  required: z.ZodOptional<z.ZodBoolean>;
271
- }, "strict", z.ZodTypeAny, {
272
- names: string[];
273
- required?: boolean | undefined;
274
- }, {
275
- names: string[];
276
- required?: boolean | undefined;
277
- }>>;
80
+ }, z.core.$strict>>;
278
81
  deletedAt: z.ZodOptional<z.ZodObject<{
279
- /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */
280
- names: z.ZodArray<z.ZodString, "many">;
281
- /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */
82
+ names: z.ZodArray<z.ZodString>;
282
83
  required: z.ZodOptional<z.ZodBoolean>;
283
- }, "strict", z.ZodTypeAny, {
284
- names: string[];
285
- required?: boolean | undefined;
286
- }, {
287
- names: string[];
288
- required?: boolean | undefined;
289
- }>>;
290
- }, "strip", z.ZodTypeAny, {
291
- createdAt?: {
292
- names: string[];
293
- required?: boolean | undefined;
294
- } | undefined;
295
- updatedAt?: {
296
- names: string[];
297
- required?: boolean | undefined;
298
- } | undefined;
299
- deletedAt?: {
300
- names: string[];
301
- required?: boolean | undefined;
302
- } | undefined;
303
- }, {
304
- createdAt?: {
305
- names: string[];
306
- required?: boolean | undefined;
307
- } | undefined;
308
- updatedAt?: {
309
- names: string[];
310
- required?: boolean | undefined;
311
- } | undefined;
312
- deletedAt?: {
313
- names: string[];
314
- required?: boolean | undefined;
315
- } | undefined;
316
- }>>;
317
- /**
318
- * Allows the user to have codegen output `Temporal` types (via `temporal-polyfill`) instead of the base JS `Date`
319
- *
320
- * Additionally, allows for specifying the default time zone for `Temporal` types when converting dates to/from
321
- * the database.
322
- */
323
- temporal: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
84
+ }, z.core.$strict>>;
85
+ }, z.core.$strip>>;
86
+ temporal: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
324
87
  timeZone: z.ZodString;
325
- }, "strip", z.ZodTypeAny, {
326
- timeZone: string;
327
- }, {
328
- timeZone: string;
329
- }>]>>;
330
- /**
331
- * By default, we create a `flush_database` function for fast testing.
332
- *
333
- * However, if you don't want to use this, or you have your own bespoke function like we do
334
- * that is more application-aware, then you can disable Joist's out-of-the-box one.
335
- *
336
- * If you have more than one test database, you can set `createFlushFunction` to the array
337
- * of test database names, i.e. `mydb_test_1`, `mydb_test_2`, etc.
338
- */
339
- createFlushFunction: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
88
+ }, z.core.$strip>]>>;
89
+ createFlushFunction: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
340
90
  entitiesDirectory: z.ZodDefault<z.ZodString>;
341
- codegenPlugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
91
+ codegenPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
342
92
  entities: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
343
93
  tag: z.ZodString;
344
94
  tableName: z.ZodOptional<z.ZodString>;
345
95
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
346
- derived: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
96
+ derived: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"sync">, z.ZodLiteral<"async">]>>;
347
97
  protected: z.ZodOptional<z.ZodBoolean>;
348
98
  ignore: z.ZodOptional<z.ZodBoolean>;
349
99
  superstruct: z.ZodOptional<z.ZodString>;
@@ -354,280 +104,34 @@ export declare const config: z.ZodObject<{
354
104
  stiType: z.ZodOptional<z.ZodString>;
355
105
  notNull: z.ZodOptional<z.ZodBoolean>;
356
106
  hasDefault: z.ZodOptional<z.ZodBoolean>;
357
- }, "strict", z.ZodTypeAny, {
358
- type?: string | undefined;
359
- derived?: "sync" | "async" | undefined;
360
- protected?: boolean | undefined;
361
- ignore?: boolean | undefined;
362
- superstruct?: string | undefined;
363
- zodSchema?: string | undefined;
364
- serde?: string | undefined;
365
- stiDiscriminator?: Record<string, string> | undefined;
366
- stiType?: string | undefined;
367
- notNull?: boolean | undefined;
368
- hasDefault?: boolean | undefined;
369
- }, {
370
- type?: string | undefined;
371
- derived?: "sync" | "async" | undefined;
372
- protected?: boolean | undefined;
373
- ignore?: boolean | undefined;
374
- superstruct?: string | undefined;
375
- zodSchema?: string | undefined;
376
- serde?: string | undefined;
377
- stiDiscriminator?: Record<string, string> | undefined;
378
- stiType?: string | undefined;
379
- notNull?: boolean | undefined;
380
- hasDefault?: boolean | undefined;
381
- }>>>;
107
+ }, z.core.$strict>>>;
382
108
  relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
383
109
  derived: z.ZodOptional<z.ZodLiteral<"async">>;
384
- polymorphic: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
110
+ polymorphic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
385
111
  large: z.ZodOptional<z.ZodBoolean>;
386
112
  orderBy: z.ZodOptional<z.ZodString>;
113
+ softDeletes: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"include">, z.ZodLiteral<"exclude">]>>;
387
114
  stiType: z.ZodOptional<z.ZodString>;
388
- /**
389
- * Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).
390
- *
391
- * Self-referential FKs also support `subType: "self"` that means each subtype will point
392
- * at its own subtype.
393
- */
394
115
  subType: z.ZodOptional<z.ZodString>;
395
- /** Allow skipping self-referential fields getting a `...Recursive` relation. */
396
116
  skipRecursiveRelations: z.ZodOptional<z.ZodBoolean>;
397
117
  notNull: z.ZodOptional<z.ZodBoolean>;
398
118
  hasDefault: z.ZodOptional<z.ZodBoolean>;
399
- }, "strict", z.ZodTypeAny, {
400
- derived?: "async" | undefined;
401
- stiType?: string | undefined;
402
- notNull?: boolean | undefined;
403
- hasDefault?: boolean | undefined;
404
- polymorphic?: true | "notNull" | undefined;
405
- large?: boolean | undefined;
406
- orderBy?: string | undefined;
407
- subType?: string | undefined;
408
- skipRecursiveRelations?: boolean | undefined;
409
- }, {
410
- derived?: "async" | undefined;
411
- stiType?: string | undefined;
412
- notNull?: boolean | undefined;
413
- hasDefault?: boolean | undefined;
414
- polymorphic?: true | "notNull" | undefined;
415
- large?: boolean | undefined;
416
- orderBy?: string | undefined;
417
- subType?: string | undefined;
418
- skipRecursiveRelations?: boolean | undefined;
419
- }>>>;
420
- /** Whether this entity should be abstract, e.g. for inheritance a subtype must be instantiated instead of this type. */
119
+ }, z.core.$strict>>>;
421
120
  abstract: z.ZodOptional<z.ZodBoolean>;
422
121
  orderBy: z.ZodOptional<z.ZodString>;
423
- uniqueBy: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">]>, string[][], string | string[] | string[][]>>;
424
- }, "strict", z.ZodTypeAny, {
425
- tag: string;
426
- tableName?: string | undefined;
427
- fields?: Record<string, {
428
- type?: string | undefined;
429
- derived?: "sync" | "async" | undefined;
430
- protected?: boolean | undefined;
431
- ignore?: boolean | undefined;
432
- superstruct?: string | undefined;
433
- zodSchema?: string | undefined;
434
- serde?: string | undefined;
435
- stiDiscriminator?: Record<string, string> | undefined;
436
- stiType?: string | undefined;
437
- notNull?: boolean | undefined;
438
- hasDefault?: boolean | undefined;
439
- }> | undefined;
440
- relations?: Record<string, {
441
- derived?: "async" | undefined;
442
- stiType?: string | undefined;
443
- notNull?: boolean | undefined;
444
- hasDefault?: boolean | undefined;
445
- polymorphic?: true | "notNull" | undefined;
446
- large?: boolean | undefined;
447
- orderBy?: string | undefined;
448
- subType?: string | undefined;
449
- skipRecursiveRelations?: boolean | undefined;
450
- }> | undefined;
451
- orderBy?: string | undefined;
452
- abstract?: boolean | undefined;
453
- uniqueBy?: string[][] | undefined;
454
- }, {
455
- tag: string;
456
- tableName?: string | undefined;
457
- fields?: Record<string, {
458
- type?: string | undefined;
459
- derived?: "sync" | "async" | undefined;
460
- protected?: boolean | undefined;
461
- ignore?: boolean | undefined;
462
- superstruct?: string | undefined;
463
- zodSchema?: string | undefined;
464
- serde?: string | undefined;
465
- stiDiscriminator?: Record<string, string> | undefined;
466
- stiType?: string | undefined;
467
- notNull?: boolean | undefined;
468
- hasDefault?: boolean | undefined;
469
- }> | undefined;
470
- relations?: Record<string, {
471
- derived?: "async" | undefined;
472
- stiType?: string | undefined;
473
- notNull?: boolean | undefined;
474
- hasDefault?: boolean | undefined;
475
- polymorphic?: true | "notNull" | undefined;
476
- large?: boolean | undefined;
477
- orderBy?: string | undefined;
478
- subType?: string | undefined;
479
- skipRecursiveRelations?: boolean | undefined;
480
- }> | undefined;
481
- orderBy?: string | undefined;
482
- abstract?: boolean | undefined;
483
- uniqueBy?: string | string[] | string[][] | undefined;
484
- }>>>;
485
- ignoredTables: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
486
- /** The type of entity `id` fields; defaults to `tagged-string`. */
487
- idType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"tagged-string">, z.ZodLiteral<"untagged-string">, z.ZodLiteral<"number">]>>;
488
- /** How we should support non-deferred foreign keys. */
489
- nonDeferredForeignKeys: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"ignore">]>>;
490
- /** Enables esm output. */
122
+ uniqueBy: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodArray<z.ZodString>>]>, z.ZodTransform<string[][], string | string[] | string[][]>>>;
123
+ }, z.core.$strict>>>;
124
+ ignoredTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
+ idType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"tagged-string">, z.ZodLiteral<"untagged-string">, z.ZodLiteral<"number">]>>;
126
+ nonDeferredForeignKeys: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"ignore">]>>;
491
127
  esm: z.ZodOptional<z.ZodBoolean>;
492
- /** Enables documentation syncing between .md files and JSDocs. */
128
+ paginationStyle: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"cursor">, z.ZodLiteral<"limit">]>>>;
493
129
  docs: z.ZodOptional<z.ZodBoolean>;
494
- /** Output a metadata-docs.ts file with entity/field documentation available at runtime. */
495
130
  outputDocs: z.ZodOptional<z.ZodBoolean>;
496
- /** Auto-set by probing the project's `tsconfig.json` file. */
497
131
  allowImportingTsExtensions: z.ZodOptional<z.ZodBoolean>;
498
- /** The latest Joist codemod counter that has been applied to this project. */
499
132
  codemodVersion: z.ZodDefault<z.ZodNumber>;
500
- /** A list of postgres schemas to use for finding tables */
501
- schemas: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
502
- }, "strict", z.ZodTypeAny, {
503
- entitiesDirectory: string;
504
- entities: Record<string, {
505
- tag: string;
506
- tableName?: string | undefined;
507
- fields?: Record<string, {
508
- type?: string | undefined;
509
- derived?: "sync" | "async" | undefined;
510
- protected?: boolean | undefined;
511
- ignore?: boolean | undefined;
512
- superstruct?: string | undefined;
513
- zodSchema?: string | undefined;
514
- serde?: string | undefined;
515
- stiDiscriminator?: Record<string, string> | undefined;
516
- stiType?: string | undefined;
517
- notNull?: boolean | undefined;
518
- hasDefault?: boolean | undefined;
519
- }> | undefined;
520
- relations?: Record<string, {
521
- derived?: "async" | undefined;
522
- stiType?: string | undefined;
523
- notNull?: boolean | undefined;
524
- hasDefault?: boolean | undefined;
525
- polymorphic?: true | "notNull" | undefined;
526
- large?: boolean | undefined;
527
- orderBy?: string | undefined;
528
- subType?: string | undefined;
529
- skipRecursiveRelations?: boolean | undefined;
530
- }> | undefined;
531
- orderBy?: string | undefined;
532
- abstract?: boolean | undefined;
533
- uniqueBy?: string[][] | undefined;
534
- }>;
535
- codemodVersion: number;
536
- databaseUrl?: string | undefined;
537
- contextType?: string | undefined;
538
- transactionType?: string | undefined;
539
- timestampColumns?: {
540
- createdAt?: {
541
- names: string[];
542
- required?: boolean | undefined;
543
- } | undefined;
544
- updatedAt?: {
545
- names: string[];
546
- required?: boolean | undefined;
547
- } | undefined;
548
- deletedAt?: {
549
- names: string[];
550
- required?: boolean | undefined;
551
- } | undefined;
552
- } | undefined;
553
- temporal?: boolean | {
554
- timeZone: string;
555
- } | undefined;
556
- createFlushFunction?: boolean | string[] | undefined;
557
- codegenPlugins?: string[] | undefined;
558
- ignoredTables?: string[] | undefined;
559
- idType?: "number" | "tagged-string" | "untagged-string" | undefined;
560
- nonDeferredForeignKeys?: "warn" | "error" | "ignore" | undefined;
561
- esm?: boolean | undefined;
562
- docs?: boolean | undefined;
563
- outputDocs?: boolean | undefined;
564
- allowImportingTsExtensions?: boolean | undefined;
565
- schemas?: string[] | undefined;
566
- }, {
567
- databaseUrl?: string | undefined;
568
- contextType?: string | undefined;
569
- transactionType?: string | undefined;
570
- timestampColumns?: {
571
- createdAt?: {
572
- names: string[];
573
- required?: boolean | undefined;
574
- } | undefined;
575
- updatedAt?: {
576
- names: string[];
577
- required?: boolean | undefined;
578
- } | undefined;
579
- deletedAt?: {
580
- names: string[];
581
- required?: boolean | undefined;
582
- } | undefined;
583
- } | undefined;
584
- temporal?: boolean | {
585
- timeZone: string;
586
- } | undefined;
587
- createFlushFunction?: boolean | string[] | undefined;
588
- entitiesDirectory?: string | undefined;
589
- codegenPlugins?: string[] | undefined;
590
- entities?: Record<string, {
591
- tag: string;
592
- tableName?: string | undefined;
593
- fields?: Record<string, {
594
- type?: string | undefined;
595
- derived?: "sync" | "async" | undefined;
596
- protected?: boolean | undefined;
597
- ignore?: boolean | undefined;
598
- superstruct?: string | undefined;
599
- zodSchema?: string | undefined;
600
- serde?: string | undefined;
601
- stiDiscriminator?: Record<string, string> | undefined;
602
- stiType?: string | undefined;
603
- notNull?: boolean | undefined;
604
- hasDefault?: boolean | undefined;
605
- }> | undefined;
606
- relations?: Record<string, {
607
- derived?: "async" | undefined;
608
- stiType?: string | undefined;
609
- notNull?: boolean | undefined;
610
- hasDefault?: boolean | undefined;
611
- polymorphic?: true | "notNull" | undefined;
612
- large?: boolean | undefined;
613
- orderBy?: string | undefined;
614
- subType?: string | undefined;
615
- skipRecursiveRelations?: boolean | undefined;
616
- }> | undefined;
617
- orderBy?: string | undefined;
618
- abstract?: boolean | undefined;
619
- uniqueBy?: string | string[] | string[][] | undefined;
620
- }> | undefined;
621
- ignoredTables?: string[] | undefined;
622
- idType?: "number" | "tagged-string" | "untagged-string" | undefined;
623
- nonDeferredForeignKeys?: "warn" | "error" | "ignore" | undefined;
624
- esm?: boolean | undefined;
625
- docs?: boolean | undefined;
626
- outputDocs?: boolean | undefined;
627
- allowImportingTsExtensions?: boolean | undefined;
628
- codemodVersion?: number | undefined;
629
- schemas?: string[] | undefined;
630
- }>;
133
+ schemas: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
+ }, z.core.$strict>;
631
135
  export type Config = z.infer<typeof config> & {
632
136
  __tableToEntityName?: Record<string, string>;
633
137
  };
@@ -645,6 +149,8 @@ export declare function superstructConfig(config: Config, entity: Entity, fieldN
645
149
  export declare function zodSchemaConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
646
150
  export declare function fieldTypeConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
647
151
  export declare function isLargeCollection(config: Config, entity: Entity, fieldName: string): boolean;
152
+ /** Whether a collection should include (or exclude) soft-deleted entities from `.get`/`.load`. */
153
+ export declare function softDeletesConfig(config: Config, entity: Entity, fieldName: string): "include" | "exclude" | undefined;
648
154
  export declare function isFieldIgnored(config: Config, entity: Entity, fieldName: string, notNull?: boolean, hasDefault?: boolean): boolean;
649
155
  export declare function isFieldHasDefault(config: Config, entity: Entity, fieldName: string): boolean;
650
156
  export declare function loadConfig(): Promise<Config>;