sonamu 0.2.55 → 0.2.56

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 (45) hide show
  1. package/dist/bin/cli.js +89 -118
  2. package/dist/bin/cli.js.map +1 -1
  3. package/dist/bin/cli.mjs +45 -74
  4. package/dist/bin/cli.mjs.map +1 -1
  5. package/dist/{chunk-ZFLQLW37.mjs → chunk-RHSTOLSM.mjs} +5568 -5243
  6. package/dist/chunk-RHSTOLSM.mjs.map +1 -0
  7. package/dist/{chunk-WJGRXAXE.js → chunk-V6CWU5VD.js} +5577 -5252
  8. package/dist/chunk-V6CWU5VD.js.map +1 -0
  9. package/dist/index.d.mts +931 -226
  10. package/dist/index.d.ts +931 -226
  11. package/dist/index.js +26 -13
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +31 -18
  14. package/dist/index.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/dist/base-model-BzMJ2E_I.d.mts +0 -43
  17. package/dist/base-model-CWRKUX49.d.ts +0 -43
  18. package/dist/chunk-4K2F3SOM.mjs +0 -231
  19. package/dist/chunk-4K2F3SOM.mjs.map +0 -1
  20. package/dist/chunk-6SP5N5ND.mjs +0 -1579
  21. package/dist/chunk-6SP5N5ND.mjs.map +0 -1
  22. package/dist/chunk-EUP6N7EK.js +0 -1579
  23. package/dist/chunk-EUP6N7EK.js.map +0 -1
  24. package/dist/chunk-HVVCQLAU.mjs +0 -280
  25. package/dist/chunk-HVVCQLAU.mjs.map +0 -1
  26. package/dist/chunk-N6N3LENC.js +0 -231
  27. package/dist/chunk-N6N3LENC.js.map +0 -1
  28. package/dist/chunk-UAG3SKFM.js +0 -280
  29. package/dist/chunk-UAG3SKFM.js.map +0 -1
  30. package/dist/chunk-WJGRXAXE.js.map +0 -1
  31. package/dist/chunk-ZFLQLW37.mjs.map +0 -1
  32. package/dist/database/drivers/knex/base-model.d.mts +0 -16
  33. package/dist/database/drivers/knex/base-model.d.ts +0 -16
  34. package/dist/database/drivers/knex/base-model.js +0 -55
  35. package/dist/database/drivers/knex/base-model.js.map +0 -1
  36. package/dist/database/drivers/knex/base-model.mjs +0 -56
  37. package/dist/database/drivers/knex/base-model.mjs.map +0 -1
  38. package/dist/database/drivers/kysely/base-model.d.mts +0 -22
  39. package/dist/database/drivers/kysely/base-model.d.ts +0 -22
  40. package/dist/database/drivers/kysely/base-model.js +0 -64
  41. package/dist/database/drivers/kysely/base-model.js.map +0 -1
  42. package/dist/database/drivers/kysely/base-model.mjs +0 -65
  43. package/dist/database/drivers/kysely/base-model.mjs.map +0 -1
  44. package/dist/model-CAH_4oQh.d.mts +0 -1042
  45. package/dist/model-CAH_4oQh.d.ts +0 -1042
@@ -1,1042 +0,0 @@
1
- import { Knex } from 'knex';
2
- import { Migrator, Kysely, Transaction, SelectQueryBuilder, ReferenceExpression, MysqlDialectConfig, FileMigrationProviderProps } from 'kysely';
3
- import { z } from 'zod';
4
- import { PoolOptions } from 'mysql2';
5
-
6
- type EnumsLabel<T extends string, L extends "ko" | "en"> = {
7
- [key in T]: {
8
- [lang in L]: string;
9
- };
10
- };
11
- type EnumsLabelKo<T extends string> = EnumsLabel<T, "ko">;
12
- declare const SQLDateTimeString: z.ZodString;
13
- type SQLDateTimeString = z.infer<typeof SQLDateTimeString>;
14
- declare function zArrayable<T extends z.ZodTypeAny>(shape: T): z.ZodUnion<[T, z.ZodArray<T, "many">]>;
15
- type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
16
- type CommonProp = {
17
- name: string;
18
- nullable?: boolean;
19
- toFilter?: true;
20
- desc?: string;
21
- dbDefault?: string;
22
- };
23
- type IntegerProp = CommonProp & {
24
- type: "integer";
25
- unsigned?: true;
26
- };
27
- type BigIntegerProp = CommonProp & {
28
- type: "bigInteger";
29
- unsigned?: true;
30
- };
31
- type TextProp = CommonProp & {
32
- type: "text";
33
- textType: "text" | "mediumtext" | "longtext";
34
- };
35
- type StringProp = CommonProp & {
36
- type: "string";
37
- length: number;
38
- };
39
- type EnumProp = CommonProp & {
40
- type: "enum";
41
- length: number;
42
- id: string;
43
- };
44
- type FloatProp = CommonProp & {
45
- type: "float";
46
- unsigned?: true;
47
- precision: number;
48
- scale: number;
49
- };
50
- type DoubleProp = CommonProp & {
51
- type: "double";
52
- unsigned?: true;
53
- precision: number;
54
- scale: number;
55
- };
56
- type DecimalProp = CommonProp & {
57
- type: "decimal";
58
- unsigned?: true;
59
- precision: number;
60
- scale: number;
61
- };
62
- type BooleanProp = CommonProp & {
63
- type: "boolean";
64
- };
65
- type DateProp = CommonProp & {
66
- type: "date";
67
- };
68
- type DateTimeProp = CommonProp & {
69
- type: "datetime";
70
- };
71
- type TimeProp = CommonProp & {
72
- type: "time";
73
- };
74
- type TimestampProp = CommonProp & {
75
- type: "timestamp";
76
- };
77
- type JsonProp = CommonProp & {
78
- type: "json";
79
- id: string;
80
- };
81
- type UuidProp = CommonProp & {
82
- type: "uuid";
83
- };
84
- type VirtualProp = CommonProp & {
85
- type: "virtual";
86
- id: string;
87
- };
88
- type RelationType = "HasMany" | "BelongsToOne" | "ManyToMany" | "OneToOne";
89
- type RelationOn = "CASCADE" | "SET NULL" | "NO ACTION" | "SET DEFAULT" | "RESTRICT";
90
- type _RelationProp = {
91
- type: "relation";
92
- name: string;
93
- with: string;
94
- nullable?: boolean;
95
- toFilter?: true;
96
- desc?: string;
97
- };
98
- type OneToOneRelationProp = _RelationProp & {
99
- relationType: "OneToOne";
100
- customJoinClause?: string;
101
- } & ({
102
- hasJoinColumn: true;
103
- onUpdate: RelationOn;
104
- onDelete: RelationOn;
105
- } | {
106
- hasJoinColumn: false;
107
- });
108
- type BelongsToOneRelationProp = _RelationProp & {
109
- relationType: "BelongsToOne";
110
- customJoinClause?: string;
111
- onUpdate: RelationOn;
112
- onDelete: RelationOn;
113
- };
114
- type HasManyRelationProp = _RelationProp & {
115
- relationType: "HasMany";
116
- joinColumn: string;
117
- fromColumn?: string;
118
- };
119
- type ManyToManyRelationProp = _RelationProp & {
120
- relationType: "ManyToMany";
121
- joinTable: `${string}__${string}`;
122
- onUpdate: RelationOn;
123
- onDelete: RelationOn;
124
- };
125
- type RelationProp = OneToOneRelationProp | BelongsToOneRelationProp | HasManyRelationProp | ManyToManyRelationProp;
126
- type EntityProp = IntegerProp | BigIntegerProp | TextProp | StringProp | FloatProp | DoubleProp | DecimalProp | BooleanProp | DateProp | DateTimeProp | TimeProp | TimestampProp | JsonProp | UuidProp | EnumProp | VirtualProp | RelationProp;
127
- type EntityIndex = {
128
- type: "index" | "unique";
129
- columns: string[];
130
- name?: string;
131
- };
132
- type EntityJson = {
133
- id: string;
134
- parentId?: string;
135
- table: string;
136
- title?: string;
137
- props: EntityProp[];
138
- indexes: EntityIndex[];
139
- subsets: {
140
- [subset: string]: string[];
141
- };
142
- enums: {
143
- [enumId: string]: {
144
- [key: string]: string;
145
- };
146
- };
147
- };
148
- type EntitySubsetRow = {
149
- field: string;
150
- has: {
151
- [key: string]: boolean;
152
- };
153
- children: EntitySubsetRow[];
154
- prefixes: string[];
155
- relationEntity?: string;
156
- isOpen?: boolean;
157
- };
158
- type FlattenSubsetRow = Omit<EntitySubsetRow, "children">;
159
- type SMDInput<T extends string> = {
160
- id: string;
161
- parentId?: string;
162
- table?: string;
163
- title?: string;
164
- props?: EntityProp[];
165
- indexes?: EntityIndex[];
166
- subsets?: {
167
- [subset: string]: T[];
168
- };
169
- };
170
- type EntityPropNode = {
171
- nodeType: "plain";
172
- prop: EntityProp;
173
- } | {
174
- nodeType: "object" | "array";
175
- prop?: EntityProp;
176
- children: EntityPropNode[];
177
- };
178
- declare function isIntegerProp(p: any): p is IntegerProp;
179
- declare function isBigIntegerProp(p: any): p is BigIntegerProp;
180
- declare function isTextProp(p: any): p is TextProp;
181
- declare function isStringProp(p: any): p is StringProp;
182
- declare function isEnumProp(p: any): p is EnumProp;
183
- declare function isFloatProp(p: any): p is FloatProp;
184
- declare function isDoubleProp(p: any): p is DoubleProp;
185
- declare function isDecimalProp(p: any): p is DecimalProp;
186
- declare function isBooleanProp(p: any): p is BooleanProp;
187
- declare function isDateProp(p: any): p is DateProp;
188
- declare function isDateTimeProp(p: any): p is DateTimeProp;
189
- declare function isTimeProp(p: any): p is TimeProp;
190
- declare function isTimestampProp(p: any): p is TimestampProp;
191
- declare function isJsonProp(p: any): p is JsonProp;
192
- declare function isUuidProp(p: any): p is UuidProp;
193
- declare function isVirtualProp(p: any): p is VirtualProp;
194
- declare function isRelationProp(p: any): p is RelationProp;
195
- declare function isOneToOneRelationProp(p: any): p is OneToOneRelationProp;
196
- declare function isBelongsToOneRelationProp(p: any): p is BelongsToOneRelationProp;
197
- declare function isHasManyRelationProp(p: any): p is HasManyRelationProp;
198
- declare function isManyToManyRelationProp(p: any): p is ManyToManyRelationProp;
199
- type JoinClause = {
200
- from: string;
201
- to: string;
202
- } | {
203
- custom: string;
204
- };
205
- declare function isCustomJoinClause(p: any): p is {
206
- custom: string;
207
- };
208
- type SubsetLoader = {
209
- as: string;
210
- table: string;
211
- manyJoin: {
212
- fromTable: string;
213
- fromCol: string;
214
- idField: string;
215
- toTable: string;
216
- toCol: string;
217
- through?: {
218
- table: string;
219
- fromCol: string;
220
- toCol: string;
221
- };
222
- };
223
- oneJoins: ({
224
- as: string;
225
- join: "inner" | "outer";
226
- table: string;
227
- } & JoinClause)[];
228
- select: string[];
229
- loaders?: SubsetLoader[];
230
- };
231
- type SubsetQuery = {
232
- select: string[];
233
- virtual: string[];
234
- joins: ({
235
- as: string;
236
- join: "inner" | "outer";
237
- table: string;
238
- } & JoinClause)[];
239
- loaders: SubsetLoader[];
240
- };
241
- declare const SonamuQueryMode: z.ZodEnum<["both", "list", "count"]>;
242
- type SonamuQueryMode = z.infer<typeof SonamuQueryMode>;
243
- type KnexError = {
244
- code: string;
245
- errno: number;
246
- sql: string;
247
- sqlMessage: string;
248
- sqlState: string;
249
- };
250
- declare function isKnexError(e: any): e is KnexError;
251
- declare function isKyselyError(e: any): e is KnexError;
252
- type KnexColumnType = "string" | "text" | "smalltext" | "mediumtext" | "longtext" | "integer" | "bigInteger" | "decimal" | "timestamp" | "boolean" | "foreign" | "uuid" | "json" | "float" | "date" | "time" | "datetime";
253
- type MigrationColumn = {
254
- name: string;
255
- type: KnexColumnType;
256
- nullable: boolean;
257
- unsigned?: boolean;
258
- length?: number;
259
- defaultTo?: string;
260
- precision?: number;
261
- scale?: number;
262
- };
263
- type MigrationIndex = {
264
- columns: string[];
265
- type: "unique" | "index";
266
- };
267
- type MigrationForeign = {
268
- columns: string[];
269
- to: string;
270
- onUpdate: RelationOn;
271
- onDelete: RelationOn;
272
- };
273
- type MigrationJoinTable = {
274
- table: string;
275
- indexes: MigrationIndex[];
276
- columns: MigrationColumn[];
277
- foreigns: MigrationForeign[];
278
- };
279
- type MigrationSet = {
280
- table: string;
281
- columns: MigrationColumn[];
282
- indexes: MigrationIndex[];
283
- foreigns: MigrationForeign[];
284
- };
285
- type MigrationSetAndJoinTable = MigrationSet & {
286
- joinTables: MigrationJoinTable[];
287
- };
288
- type GenMigrationCode = {
289
- title: string;
290
- table: string;
291
- type: "normal" | "foreign";
292
- formatted: string | null;
293
- };
294
- type ApiParam = {
295
- name: string;
296
- type: ApiParamType;
297
- optional: boolean;
298
- defaultDef?: string;
299
- };
300
- declare namespace ApiParamType {
301
- type Object = {
302
- t: "object";
303
- props: ApiParam[];
304
- };
305
- type Union = {
306
- t: "union";
307
- types: ApiParamType[];
308
- };
309
- type Intersection = {
310
- t: "intersection";
311
- types: ApiParamType[];
312
- };
313
- type StringLiteral = {
314
- t: "string-literal";
315
- value: string;
316
- };
317
- type NumericLiteral = {
318
- t: "numeric-literal";
319
- value: number;
320
- };
321
- type Array = {
322
- t: "array";
323
- elementsType: ApiParamType;
324
- };
325
- type Ref = {
326
- t: "ref";
327
- id: string;
328
- args?: ApiParamType[];
329
- };
330
- type IndexedAccess = {
331
- t: "indexed-access";
332
- object: ApiParamType;
333
- index: ApiParamType;
334
- };
335
- type TupleType = {
336
- t: "tuple-type";
337
- elements: ApiParamType[];
338
- };
339
- type Pick = Ref & {
340
- t: "ref";
341
- id: "Pick";
342
- };
343
- type Omit = Ref & {
344
- t: "ref";
345
- id: "Omit";
346
- };
347
- type Partial = Ref & {
348
- t: "ref";
349
- id: "Partial";
350
- };
351
- type Promise = Ref & {
352
- t: "ref";
353
- id: "Promise";
354
- };
355
- type Context = Ref & {
356
- t: "ref";
357
- id: "Context";
358
- };
359
- type TypeParam = {
360
- t: "type-param";
361
- id: string;
362
- constraint?: ApiParamType;
363
- };
364
- function isObject(v: any): v is ApiParamType.Object;
365
- function isUnion(v: any): v is ApiParamType.Union;
366
- function isIntersection(v: any): v is ApiParamType.Intersection;
367
- function isStringLiteral(v: any): v is ApiParamType.StringLiteral;
368
- function isNumericLiteral(v: any): v is ApiParamType.NumericLiteral;
369
- function isArray(v: any): v is ApiParamType.Array;
370
- function isRef(v: any): v is ApiParamType.Ref;
371
- function isIndexedAccess(v: any): v is ApiParamType.IndexedAccess;
372
- function isTupleType(v: any): v is ApiParamType.TupleType;
373
- function isPick(v: any): v is ApiParamType.Pick;
374
- function isOmit(v: any): v is ApiParamType.Omit;
375
- function isPartial(v: any): v is ApiParamType.Partial;
376
- function isPromise(v: any): v is ApiParamType.Promise;
377
- function isContext(v: any): v is ApiParamType.Context;
378
- function isRefKnex(v: any): v is ApiParamType.Ref;
379
- function isRefKysely(v: any): v is ApiParamType.Ref;
380
- function isTypeParam(v: any): v is ApiParamType.TypeParam;
381
- }
382
- type ApiParamType = "string" | "number" | "boolean" | "null" | "undefined" | "void" | "any" | "unknown" | "true" | "false" | ApiParamType.StringLiteral | ApiParamType.NumericLiteral | ApiParamType.Object | ApiParamType.Union | ApiParamType.Intersection | ApiParamType.Array | ApiParamType.Ref | ApiParamType.IndexedAccess | ApiParamType.TypeParam | ApiParamType.TupleType;
383
- declare const RenderingNode: z.ZodAny;
384
- type RenderingNode = {
385
- name: string;
386
- label: string;
387
- renderType: "string-plain" | "string-image" | "string-datetime" | "string-date" | "number-plain" | "number-id" | "number-fk_id" | "boolean" | "enums" | "array" | "array-images" | "object" | "object-pick" | "record";
388
- zodType: z.ZodTypeAny;
389
- element?: RenderingNode;
390
- children?: RenderingNode[];
391
- config?: {
392
- picked: string;
393
- };
394
- optional?: boolean;
395
- nullable?: boolean;
396
- };
397
- declare const TemplateOptions: z.ZodObject<{
398
- entity: z.ZodObject<{
399
- entityId: z.ZodString;
400
- parentId: z.ZodOptional<z.ZodString>;
401
- title: z.ZodString;
402
- table: z.ZodOptional<z.ZodString>;
403
- props: z.ZodOptional<z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">>;
404
- indexes: z.ZodOptional<z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">>;
405
- subsets: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
406
- enums: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
407
- }, "strip", z.ZodTypeAny, {
408
- entityId: string;
409
- title: string;
410
- parentId?: string | undefined;
411
- table?: string | undefined;
412
- props?: {}[] | undefined;
413
- indexes?: {}[] | undefined;
414
- subsets?: {} | undefined;
415
- enums?: {} | undefined;
416
- }, {
417
- entityId: string;
418
- title: string;
419
- parentId?: string | undefined;
420
- table?: string | undefined;
421
- props?: {}[] | undefined;
422
- indexes?: {}[] | undefined;
423
- subsets?: {} | undefined;
424
- enums?: {} | undefined;
425
- }>;
426
- init_types: z.ZodObject<{
427
- entityId: z.ZodString;
428
- }, "strip", z.ZodTypeAny, {
429
- entityId: string;
430
- }, {
431
- entityId: string;
432
- }>;
433
- generated: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
434
- generated_sso: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
435
- generated_http: z.ZodObject<{
436
- entityId: z.ZodString;
437
- }, "strip", z.ZodTypeAny, {
438
- entityId: string;
439
- }, {
440
- entityId: string;
441
- }>;
442
- model: z.ZodObject<{
443
- entityId: z.ZodString;
444
- defaultSearchField: z.ZodString;
445
- defaultOrderBy: z.ZodString;
446
- }, "strip", z.ZodTypeAny, {
447
- entityId: string;
448
- defaultSearchField: string;
449
- defaultOrderBy: string;
450
- }, {
451
- entityId: string;
452
- defaultSearchField: string;
453
- defaultOrderBy: string;
454
- }>;
455
- model_test: z.ZodObject<{
456
- entityId: z.ZodString;
457
- }, "strip", z.ZodTypeAny, {
458
- entityId: string;
459
- }, {
460
- entityId: string;
461
- }>;
462
- bridge: z.ZodObject<{
463
- entityId: z.ZodString;
464
- }, "strip", z.ZodTypeAny, {
465
- entityId: string;
466
- }, {
467
- entityId: string;
468
- }>;
469
- service: z.ZodObject<{
470
- entityId: z.ZodString;
471
- }, "strip", z.ZodTypeAny, {
472
- entityId: string;
473
- }, {
474
- entityId: string;
475
- }>;
476
- view_list: z.ZodObject<{
477
- entityId: z.ZodString;
478
- extra: z.ZodUnknown;
479
- }, "strip", z.ZodTypeAny, {
480
- entityId: string;
481
- extra?: unknown;
482
- }, {
483
- entityId: string;
484
- extra?: unknown;
485
- }>;
486
- view_list_columns: z.ZodObject<{
487
- entityId: z.ZodString;
488
- columns: z.ZodArray<z.ZodObject<{
489
- name: z.ZodString;
490
- label: z.ZodString;
491
- tc: z.ZodString;
492
- }, "strip", z.ZodTypeAny, {
493
- name: string;
494
- label: string;
495
- tc: string;
496
- }, {
497
- name: string;
498
- label: string;
499
- tc: string;
500
- }>, "many">;
501
- columnImports: z.ZodString;
502
- }, "strip", z.ZodTypeAny, {
503
- entityId: string;
504
- columns: {
505
- name: string;
506
- label: string;
507
- tc: string;
508
- }[];
509
- columnImports: string;
510
- }, {
511
- entityId: string;
512
- columns: {
513
- name: string;
514
- label: string;
515
- tc: string;
516
- }[];
517
- columnImports: string;
518
- }>;
519
- view_search_input: z.ZodObject<{
520
- entityId: z.ZodString;
521
- }, "strip", z.ZodTypeAny, {
522
- entityId: string;
523
- }, {
524
- entityId: string;
525
- }>;
526
- view_form: z.ZodObject<{
527
- entityId: z.ZodString;
528
- }, "strip", z.ZodTypeAny, {
529
- entityId: string;
530
- }, {
531
- entityId: string;
532
- }>;
533
- view_id_all_select: z.ZodObject<{
534
- entityId: z.ZodString;
535
- }, "strip", z.ZodTypeAny, {
536
- entityId: string;
537
- }, {
538
- entityId: string;
539
- }>;
540
- view_id_async_select: z.ZodObject<{
541
- entityId: z.ZodString;
542
- textField: z.ZodString;
543
- }, "strip", z.ZodTypeAny, {
544
- entityId: string;
545
- textField: string;
546
- }, {
547
- entityId: string;
548
- textField: string;
549
- }>;
550
- view_enums_select: z.ZodObject<{
551
- entityId: z.ZodString;
552
- enumId: z.ZodString;
553
- }, "strip", z.ZodTypeAny, {
554
- entityId: string;
555
- enumId: string;
556
- }, {
557
- entityId: string;
558
- enumId: string;
559
- }>;
560
- view_enums_dropdown: z.ZodObject<{
561
- entityId: z.ZodString;
562
- enumId: z.ZodString;
563
- }, "strip", z.ZodTypeAny, {
564
- entityId: string;
565
- enumId: string;
566
- }, {
567
- entityId: string;
568
- enumId: string;
569
- }>;
570
- view_enums_buttonset: z.ZodObject<{
571
- entityId: z.ZodString;
572
- enumId: z.ZodString;
573
- }, "strip", z.ZodTypeAny, {
574
- entityId: string;
575
- enumId: string;
576
- }, {
577
- entityId: string;
578
- enumId: string;
579
- }>;
580
- kysely_interface: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
581
- }, "strip", z.ZodTypeAny, {
582
- entity: {
583
- entityId: string;
584
- title: string;
585
- parentId?: string | undefined;
586
- table?: string | undefined;
587
- props?: {}[] | undefined;
588
- indexes?: {}[] | undefined;
589
- subsets?: {} | undefined;
590
- enums?: {} | undefined;
591
- };
592
- init_types: {
593
- entityId: string;
594
- };
595
- generated: {};
596
- generated_sso: {};
597
- generated_http: {
598
- entityId: string;
599
- };
600
- model: {
601
- entityId: string;
602
- defaultSearchField: string;
603
- defaultOrderBy: string;
604
- };
605
- model_test: {
606
- entityId: string;
607
- };
608
- bridge: {
609
- entityId: string;
610
- };
611
- service: {
612
- entityId: string;
613
- };
614
- view_list: {
615
- entityId: string;
616
- extra?: unknown;
617
- };
618
- view_list_columns: {
619
- entityId: string;
620
- columns: {
621
- name: string;
622
- label: string;
623
- tc: string;
624
- }[];
625
- columnImports: string;
626
- };
627
- view_search_input: {
628
- entityId: string;
629
- };
630
- view_form: {
631
- entityId: string;
632
- };
633
- view_id_all_select: {
634
- entityId: string;
635
- };
636
- view_id_async_select: {
637
- entityId: string;
638
- textField: string;
639
- };
640
- view_enums_select: {
641
- entityId: string;
642
- enumId: string;
643
- };
644
- view_enums_dropdown: {
645
- entityId: string;
646
- enumId: string;
647
- };
648
- view_enums_buttonset: {
649
- entityId: string;
650
- enumId: string;
651
- };
652
- kysely_interface: {};
653
- }, {
654
- entity: {
655
- entityId: string;
656
- title: string;
657
- parentId?: string | undefined;
658
- table?: string | undefined;
659
- props?: {}[] | undefined;
660
- indexes?: {}[] | undefined;
661
- subsets?: {} | undefined;
662
- enums?: {} | undefined;
663
- };
664
- init_types: {
665
- entityId: string;
666
- };
667
- generated: {};
668
- generated_sso: {};
669
- generated_http: {
670
- entityId: string;
671
- };
672
- model: {
673
- entityId: string;
674
- defaultSearchField: string;
675
- defaultOrderBy: string;
676
- };
677
- model_test: {
678
- entityId: string;
679
- };
680
- bridge: {
681
- entityId: string;
682
- };
683
- service: {
684
- entityId: string;
685
- };
686
- view_list: {
687
- entityId: string;
688
- extra?: unknown;
689
- };
690
- view_list_columns: {
691
- entityId: string;
692
- columns: {
693
- name: string;
694
- label: string;
695
- tc: string;
696
- }[];
697
- columnImports: string;
698
- };
699
- view_search_input: {
700
- entityId: string;
701
- };
702
- view_form: {
703
- entityId: string;
704
- };
705
- view_id_all_select: {
706
- entityId: string;
707
- };
708
- view_id_async_select: {
709
- entityId: string;
710
- textField: string;
711
- };
712
- view_enums_select: {
713
- entityId: string;
714
- enumId: string;
715
- };
716
- view_enums_dropdown: {
717
- entityId: string;
718
- enumId: string;
719
- };
720
- view_enums_buttonset: {
721
- entityId: string;
722
- enumId: string;
723
- };
724
- kysely_interface: {};
725
- }>;
726
- type TemplateOptions = z.infer<typeof TemplateOptions>;
727
- declare const TemplateKey: z.ZodEnum<["entity", "init_types", "generated", "generated_sso", "generated_http", "model", "model_test", "bridge", "service", "view_list", "view_list_columns", "view_search_input", "view_form", "view_id_all_select", "view_id_async_select", "view_enums_select", "view_enums_dropdown", "view_enums_buttonset", "kysely_interface"]>;
728
- type TemplateKey = z.infer<typeof TemplateKey>;
729
- declare const GenerateOptions: z.ZodObject<{
730
- overwrite: z.ZodOptional<z.ZodBoolean>;
731
- }, "strip", z.ZodTypeAny, {
732
- overwrite?: boolean | undefined;
733
- }, {
734
- overwrite?: boolean | undefined;
735
- }>;
736
- type GenerateOptions = z.infer<typeof GenerateOptions>;
737
- declare const PathAndCode: z.ZodObject<{
738
- path: z.ZodString;
739
- code: z.ZodString;
740
- }, "strip", z.ZodTypeAny, {
741
- path: string;
742
- code: string;
743
- }, {
744
- path: string;
745
- code: string;
746
- }>;
747
- type PathAndCode = z.infer<typeof PathAndCode>;
748
- type FixtureSearchOptions = {
749
- entityId: string;
750
- field: string;
751
- value: string;
752
- searchType: "equals" | "like";
753
- };
754
- type FixtureRecord = {
755
- fixtureId: string;
756
- entityId: string;
757
- id: number;
758
- columns: {
759
- [key: string]: {
760
- prop: EntityProp;
761
- value: any;
762
- };
763
- };
764
- fetchedRecords: string[];
765
- belongsRecords: string[];
766
- target?: FixtureRecord;
767
- unique?: FixtureRecord;
768
- override?: boolean;
769
- };
770
- type FixtureImportResult = {
771
- entityId: string;
772
- data: {
773
- [key: string]: any;
774
- };
775
- };
776
- type RelationNode = {
777
- fixtureId: string;
778
- entityId: string;
779
- related: Set<string>;
780
- };
781
-
782
- declare class CodeGenerator {
783
- getAlterColumnsTo(entityColumns: MigrationColumn[], dbColumns: MigrationColumn[]): {
784
- add: MigrationColumn[];
785
- drop: MigrationColumn[];
786
- alter: MigrationColumn[];
787
- };
788
- getAlterIndexesTo(entityIndexes: MigrationIndex[], dbIndexes: MigrationIndex[]): {
789
- add: MigrationIndex[];
790
- drop: MigrationIndex[];
791
- };
792
- }
793
-
794
- declare class KnexGenerator extends CodeGenerator {
795
- generateCreateCode_ColumnAndIndexes(table: string, columns: MigrationColumn[], indexes: MigrationIndex[]): Promise<GenMigrationCode>;
796
- generateCreateCode_Foreign(table: string, foreigns: MigrationForeign[]): Promise<GenMigrationCode[]>;
797
- generateAlterCode_ColumnAndIndexes(table: string, entityColumns: MigrationColumn[], entityIndexes: MigrationIndex[], dbColumns: MigrationColumn[], dbIndexes: MigrationIndex[]): Promise<GenMigrationCode[]>;
798
- generateAlterCode_Foreigns(table: string, entityForeigns: MigrationForeign[], dbForeigns: MigrationForeign[]): Promise<GenMigrationCode[]>;
799
- generateModelTemplate(entityId: string, def: {
800
- orderBy: string;
801
- search: string;
802
- }): string;
803
- private genColumnDefinitions;
804
- private genIndexDefinitions;
805
- private getAlterColumnLinesTo;
806
- private getAlterIndexLinesTo;
807
- private genForeignDefinitions;
808
- }
809
-
810
- type ExtendedKnexTrx = Knex.Transaction & DatabaseClient<"knex">;
811
- declare class KnexClient implements DatabaseClient<"knex"> {
812
- private config;
813
- private knex;
814
- generator: KnexGenerator;
815
- get connectionInfo(): {
816
- host: any;
817
- port: any;
818
- database: any;
819
- user: any;
820
- password: any;
821
- };
822
- private _qb?;
823
- set qb(qb: Knex.QueryBuilder);
824
- get qb(): Knex.QueryBuilder;
825
- get sql(): string;
826
- constructor(config: KnexConfig, _knex?: Knex);
827
- from(table: string): KnexClient;
828
- innerJoin(table: string, k1: string, k2: string): this;
829
- leftJoin(table: string, k1: string, k2: string): this;
830
- clearSelect(): this;
831
- select(columns: string | string[]): this;
832
- selectAll(): this;
833
- where(ops: WhereClause | WhereClause[]): this;
834
- orWhere(ops: WhereClause | WhereClause[]): this;
835
- insert(table: string, data: any[]): Promise<void>;
836
- upsert(table: string, data: any[]): Promise<void>;
837
- limit(limit: number): this;
838
- offset(offset: number): this;
839
- count(column: string, alias?: string): this;
840
- distinct(column: string): this;
841
- first(): this;
842
- execute(trx?: ExtendedKnexTrx): Promise<any[]>;
843
- pluck(column: string): Promise<any[]>;
844
- createRawQuery(query: string, bindings?: any[]): string;
845
- raw<R>(query: string, bindings?: any[]): Promise<R[]>;
846
- truncate(table: string): Promise<void>;
847
- trx(callback: (trx: KnexClient) => Promise<any>): Promise<any>;
848
- destroy(): Promise<void>;
849
- clearQueryParts(parts: ("order" | "offset" | "limit")[]): this;
850
- clone(): KnexClient;
851
- getMigrations(): Promise<string[]>;
852
- status(): Promise<number>;
853
- migrate(): Promise<any>;
854
- rollback(): Promise<any>;
855
- rollbackAll(): Promise<any>;
856
- }
857
-
858
- type ExtendedKyselyTrx = Transaction<Database> & DatabaseClient<"kysely">;
859
- declare class KyselyClient implements DatabaseClient<"kysely"> {
860
- private config;
861
- private kysely;
862
- get connectionInfo(): {
863
- host: string | undefined;
864
- port: number | undefined;
865
- database: string | undefined;
866
- user: string | undefined;
867
- password: string | undefined;
868
- };
869
- private _qb?;
870
- set qb(qb: DriverSpec["kysely"]["queryBuilder"]);
871
- get qb(): DriverSpec["kysely"]["queryBuilder"];
872
- private _migrator?;
873
- set migrator(migrator: Migrator);
874
- get migrator(): Migrator;
875
- get sql(): string;
876
- constructor(config: KyselyConfig, kysely?: Kysely<Database>);
877
- from(table: string): this;
878
- innerJoin(table: string, k1: string, k2: string): this;
879
- leftJoin(table: string, k1: string, k2: string): this;
880
- clearSelect(): this;
881
- select(columns: string | string[]): this;
882
- selectAll(): this;
883
- where(ops: WhereClause | WhereClause[]): this;
884
- orWhere(ops: WhereClause | WhereClause[]): this;
885
- insert(table: string, data: any[]): Promise<void>;
886
- upsert(table: string, data: any[]): Promise<void>;
887
- limit(limit: number): this;
888
- offset(offset: number): this;
889
- count(column: string, alias?: string): this;
890
- distinct(column: string): this;
891
- first(): this;
892
- execute(trx?: ExtendedKyselyTrx): Promise<any[]>;
893
- pluck(column: string): Promise<any[]>;
894
- createRawQuery(query: string, bindings?: any[]): string;
895
- raw<R>(query: string, bindings?: any[]): Promise<R[]>;
896
- truncate(table: string): Promise<void>;
897
- trx<T>(callback: (trx: KyselyClient) => Promise<T>): Promise<T>;
898
- destroy(): Promise<void>;
899
- clearQueryParts(parts: ("order" | "offset" | "limit")[]): this;
900
- clone(): KyselyClient;
901
- getMigrations(): Promise<string[]>;
902
- status(): Promise<number>;
903
- migrate(): Promise<(number | string[] | undefined)[]>;
904
- rollback(): Promise<(number | string[] | undefined)[]>;
905
- rollbackAll(): Promise<void>;
906
- }
907
-
908
- type DBPreset = "w" | "r";
909
- type DatabaseDriver = keyof DriverSpec;
910
- /**
911
- * core: 실제 데이터베이스 라이브러리 인스턴스
912
- * adapter: Sonamu의 래퍼 클라이언트 구현체
913
- * queryBuilder: 쿼리빌더 인스턴스
914
- * table/column: 테이블과 컬럼 타입 정보
915
- */
916
- interface DriverSpec {
917
- knex: {
918
- core: Knex;
919
- adapter: KnexClient;
920
- queryBuilder: Knex.QueryBuilder;
921
- table: string;
922
- column: string;
923
- };
924
- kysely: {
925
- core: Kysely<Database>;
926
- adapter: KyselyClient;
927
- queryBuilder: SelectQueryBuilder<Database, keyof Database, {}>;
928
- table: keyof Database;
929
- column: ReferenceExpression<Database, keyof Database>;
930
- };
931
- }
932
- type WhereClause = [string, string, any];
933
- interface DatabaseClient<T extends DatabaseDriver> {
934
- from(table: string): DriverSpec[T]["adapter"];
935
- innerJoin(table: string, k1: string, k2: string): DriverSpec[T]["adapter"];
936
- leftJoin(table: string, k1: string, k2: string): DriverSpec[T]["adapter"];
937
- select(columns: string | string[]): DriverSpec[T]["adapter"];
938
- where(o: WhereClause): DriverSpec[T]["adapter"];
939
- orWhere(o: WhereClause | WhereClause[]): DriverSpec[T]["adapter"];
940
- insert(table: string, data: Record<string, any>): Promise<void>;
941
- first(): DriverSpec[T]["adapter"];
942
- execute(): Promise<any[]>;
943
- raw<R>(query: string, bindings?: any[]): Promise<R[]>;
944
- truncate(table: string): Promise<void>;
945
- trx<T>(callback: (trx: any) => Promise<T>): Promise<T>;
946
- destroy(): Promise<void>;
947
- getMigrations(): Promise<string[]>;
948
- }
949
- type Environment = "development" | "development_slave" | "production" | "production_slave";
950
- type EnvironmentConfigs<T> = {
951
- [K in Environment]?: Partial<T>;
952
- };
953
- type KnexConfig = Knex.Config & {
954
- connection: Knex.MySql2ConnectionConfig;
955
- };
956
- type KnexBaseConfig = {
957
- client: "knex";
958
- database: string;
959
- defaultOptions?: Partial<KnexConfig>;
960
- environments?: EnvironmentConfigs<KnexConfig>;
961
- };
962
- type KyselyConfig = PoolOptions & Pick<MysqlDialectConfig, "onCreateConnection"> & {
963
- migration?: FileMigrationProviderProps;
964
- };
965
- type KyselyBaseConfig = {
966
- client: "kysely";
967
- database: string;
968
- defaultOptions: KyselyConfig;
969
- environments?: EnvironmentConfigs<KyselyConfig>;
970
- types?: {
971
- enabled?: boolean;
972
- outDir?: string;
973
- fileName?: string;
974
- };
975
- };
976
- type SonamuDBBaseConfig<T extends "knex" | "kysely" = "knex" | "kysely"> = T extends "knex" ? KnexBaseConfig : KyselyBaseConfig;
977
- type SonamuDBFullConfig<T extends KnexConfig | KyselyConfig> = {
978
- development_master: T;
979
- development_slave: T;
980
- test: T;
981
- fixture_local: T;
982
- fixture_remote: T;
983
- production_master: T;
984
- production_slave: T;
985
- };
986
- type SonamuKnexDBConfig = SonamuDBFullConfig<KnexConfig>;
987
- type SonamuKyselyDBConfig = SonamuDBFullConfig<KyselyConfig>;
988
- type SonamuDBConfig = SonamuKnexDBConfig | SonamuKyselyDBConfig;
989
- interface DatabaseExtend {
990
- }
991
- type Database = DatabaseExtend & {};
992
-
993
- type TableData = {
994
- references: Set<string>;
995
- rows: any[];
996
- uniqueIndexes: {
997
- name?: string;
998
- columns: string[];
999
- }[];
1000
- uniquesMap: Map<string, string>;
1001
- };
1002
- type UBRef = {
1003
- uuid: string;
1004
- of: string;
1005
- use?: string;
1006
- };
1007
- declare function isRefField(field: any): field is UBRef;
1008
- declare class UpsertBuilder<D extends DatabaseDriver> {
1009
- tables: Map<string, TableData>;
1010
- constructor();
1011
- getTable(tableName: string): TableData;
1012
- hasTable(tableName: string): boolean;
1013
- register<T extends string>(tableName: DriverSpec[D]["table"], row: {
1014
- [key in T]?: UBRef | string | number | boolean | bigint | null | object | unknown;
1015
- }): UBRef;
1016
- upsert(wdb: DriverSpec[D]["core"], tableName: DriverSpec[D]["table"], chunkSize?: number): Promise<number[]>;
1017
- insertOnly(wdb: DriverSpec[D]["core"], tableName: DriverSpec[D]["table"], chunkSize?: number): Promise<number[]>;
1018
- upsertOrInsert(_wdb: DriverSpec[D]["core"], tableName: DriverSpec[D]["table"], mode: "upsert" | "insert", chunkSize?: number): Promise<number[]>;
1019
- updateBatch(wdb: Knex | Kysely<Database>, tableName: DriverSpec[D]["table"], options?: {
1020
- chunkSize?: number;
1021
- where?: DriverSpec[D]["column"] | DriverSpec[D]["column"][];
1022
- }): Promise<void>;
1023
- }
1024
-
1025
- type ListResult<T> = {
1026
- rows: T[];
1027
- total?: number;
1028
- };
1029
- type ArrayOr<T> = T | T[];
1030
- declare function asArray<T>(param: T | T[]): T[];
1031
- declare function objToMap<T>(obj: {
1032
- [k: string]: T;
1033
- }): Map<number, T> | Map<string, T>;
1034
- interface BaseListParams {
1035
- id?: number | number[];
1036
- num?: number;
1037
- page?: number;
1038
- keyword?: string;
1039
- queryMode?: "list" | "count" | "both";
1040
- }
1041
-
1042
- export { type DistributiveOmit as $, ApiParamType as A, type BaseListParams as B, CodeGenerator as C, type DBPreset as D, type EntityPropNode as E, type StringProp as F, GenerateOptions as G, type FloatProp as H, type IntegerProp as I, type DoubleProp as J, KnexClient as K, type DecimalProp as L, type MigrationColumn as M, type BooleanProp as N, type DateProp as O, PathAndCode as P, type DateTimeProp as Q, type RelationProp as R, type SubsetQuery as S, type TextProp as T, UpsertBuilder as U, type TimeProp as V, type TimestampProp as W, type JsonProp as X, type UuidProp as Y, type EnumProp as Z, type VirtualProp as _, type Database as a, type OneToOneRelationProp as a0, type BelongsToOneRelationProp as a1, type HasManyRelationProp as a2, type ManyToManyRelationProp as a3, type MigrationSet as a4, type MigrationSetAndJoinTable as a5, type FixtureSearchOptions as a6, type FixtureRecord as a7, type FixtureImportResult as a8, type UBRef as a9, isTimestampProp as aA, isJsonProp as aB, isUuidProp as aC, isVirtualProp as aD, isRelationProp as aE, isOneToOneRelationProp as aF, isBelongsToOneRelationProp as aG, isHasManyRelationProp as aH, isManyToManyRelationProp as aI, isCustomJoinClause as aJ, SonamuQueryMode as aK, type KnexError as aL, isKnexError as aM, isKyselyError as aN, type KnexColumnType as aO, type MigrationJoinTable as aP, type RelationNode as aQ, type ListResult as aR, type ArrayOr as aS, asArray as aT, objToMap as aU, isRefField as aa, type WhereClause as ab, type DatabaseClient as ac, type Environment as ad, type SonamuDBFullConfig as ae, type EnumsLabel as af, type EnumsLabelKo as ag, SQLDateTimeString as ah, zArrayable as ai, type CommonProp as aj, type RelationType as ak, type RelationOn as al, type FlattenSubsetRow as am, type SMDInput as an, isIntegerProp as ao, isBigIntegerProp as ap, isTextProp as aq, isStringProp as ar, isEnumProp as as, isFloatProp as at, isDoubleProp as au, isDecimalProp as av, isBooleanProp as aw, isDateProp as ax, isDateTimeProp as ay, isTimeProp as az, KyselyClient as b, type DatabaseDriver as c, type DriverSpec as d, type ApiParam as e, type EntityProp as f, type EntityIndex as g, type EntityJson as h, type EntitySubsetRow as i, TemplateKey as j, TemplateOptions as k, RenderingNode as l, type SonamuDBConfig as m, type SonamuDBBaseConfig as n, type KnexConfig as o, type KyselyConfig as p, KnexGenerator as q, type KnexBaseConfig as r, type SonamuKnexDBConfig as s, type MigrationIndex as t, type GenMigrationCode as u, type MigrationForeign as v, type KyselyBaseConfig as w, type SonamuKyselyDBConfig as x, type DatabaseExtend as y, type BigIntegerProp as z };