@postxl/generator 0.74.1 → 1.0.1
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.
- package/LICENSE +50 -0
- package/README.md +79 -1
- package/dist/generator-manager.class.d.ts +59 -0
- package/dist/generator-manager.class.js +221 -0
- package/dist/generator.class.d.ts +90 -0
- package/dist/generator.class.js +32 -0
- package/dist/generator.context.d.ts +174 -0
- package/dist/generator.context.js +125 -0
- package/dist/helpers/branded.types.d.ts +149 -0
- package/dist/helpers/branded.types.js +111 -0
- package/dist/helpers/config-builder.class.d.ts +27 -0
- package/dist/helpers/config-builder.class.js +54 -0
- package/dist/helpers/import-generator.class.d.ts +70 -0
- package/dist/helpers/import-generator.class.js +166 -0
- package/dist/helpers/importable.types.d.ts +52 -0
- package/dist/helpers/importable.types.js +15 -0
- package/dist/helpers/index-generator.class.d.ts +10 -0
- package/dist/helpers/index-generator.class.js +46 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.js +24 -0
- package/dist/helpers/package-json.generator.d.ts +56 -0
- package/dist/helpers/package-json.generator.js +36 -0
- package/dist/helpers/tsconfig.generator.d.ts +1 -0
- package/dist/helpers/tsconfig.generator.js +14 -0
- package/dist/helpers/verify-context.d.ts +4 -0
- package/dist/helpers/verify-context.js +23 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/utils/checksum.d.ts +10 -0
- package/dist/utils/checksum.js +132 -0
- package/dist/utils/fs-utils.d.ts +34 -0
- package/dist/utils/fs-utils.js +126 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +26 -0
- package/dist/utils/jsdoc.d.ts +12 -0
- package/dist/utils/jsdoc.js +37 -0
- package/dist/utils/lint.d.ts +46 -0
- package/dist/utils/lint.js +154 -0
- package/dist/utils/lockfile.d.ts +7 -0
- package/dist/utils/lockfile.js +80 -0
- package/dist/utils/logger.class.d.ts +25 -0
- package/dist/utils/logger.class.js +55 -0
- package/dist/utils/merge-conflict.d.ts +55 -0
- package/dist/utils/merge-conflict.js +264 -0
- package/dist/utils/path.d.ts +52 -0
- package/dist/utils/path.js +183 -0
- package/dist/utils/prettier-config.d.ts +2 -0
- package/dist/utils/prettier-config.js +13 -0
- package/dist/utils/prettier.d.ts +5 -0
- package/dist/utils/prettier.js +67 -0
- package/dist/utils/prettier.skiptest.d.ts +1 -0
- package/dist/utils/prettier.skiptest.js +22 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.js +10 -0
- package/dist/utils/string-functions.d.ts +9 -0
- package/dist/utils/string-functions.js +23 -0
- package/dist/utils/sync-log-result.d.ts +9 -0
- package/dist/utils/sync-log-result.js +90 -0
- package/dist/utils/sync.d.ts +143 -0
- package/dist/utils/sync.js +325 -0
- package/dist/utils/template.d.ts +66 -0
- package/dist/utils/template.js +159 -0
- package/dist/utils/vfs.class.d.ts +115 -0
- package/dist/utils/vfs.class.js +239 -0
- package/dist/utils/zip.d.ts +13 -0
- package/dist/utils/zip.js +40 -0
- package/package.json +57 -34
- package/dist/generator.d.ts +0 -13
- package/dist/generator.js +0 -455
- package/dist/generators/enums/react.generator.d.ts +0 -10
- package/dist/generators/enums/react.generator.js +0 -110
- package/dist/generators/enums/types.generator.d.ts +0 -10
- package/dist/generators/enums/types.generator.js +0 -39
- package/dist/generators/indices/data/module.generator.d.ts +0 -9
- package/dist/generators/indices/data/module.generator.js +0 -60
- package/dist/generators/indices/data/service.generator.d.ts +0 -9
- package/dist/generators/indices/data/service.generator.js +0 -249
- package/dist/generators/indices/data/types.generator.d.ts +0 -9
- package/dist/generators/indices/data/types.generator.js +0 -49
- package/dist/generators/indices/dispatcher-service.generator.d.ts +0 -9
- package/dist/generators/indices/dispatcher-service.generator.js +0 -107
- package/dist/generators/indices/export/class.generator.d.ts +0 -9
- package/dist/generators/indices/export/class.generator.js +0 -140
- package/dist/generators/indices/export/encoder.generator.d.ts +0 -9
- package/dist/generators/indices/export/encoder.generator.js +0 -50
- package/dist/generators/indices/import/convert-functions.generator.d.ts +0 -9
- package/dist/generators/indices/import/convert-functions.generator.js +0 -509
- package/dist/generators/indices/import/decoder.generator.d.ts +0 -9
- package/dist/generators/indices/import/decoder.generator.js +0 -40
- package/dist/generators/indices/import/service.generator.d.ts +0 -9
- package/dist/generators/indices/import/service.generator.js +0 -573
- package/dist/generators/indices/import/types.generator.d.ts +0 -9
- package/dist/generators/indices/import/types.generator.js +0 -242
- package/dist/generators/indices/repositories.generator.d.ts +0 -9
- package/dist/generators/indices/repositories.generator.js +0 -25
- package/dist/generators/indices/routes.generator.d.ts +0 -9
- package/dist/generators/indices/routes.generator.js +0 -29
- package/dist/generators/indices/seed-migration.generator.d.ts +0 -9
- package/dist/generators/indices/seed-migration.generator.js +0 -36
- package/dist/generators/indices/seed-template.generator.d.ts +0 -9
- package/dist/generators/indices/seed-template.generator.js +0 -80
- package/dist/generators/indices/testids.generator.d.ts +0 -7
- package/dist/generators/indices/testids.generator.js +0 -71
- package/dist/generators/indices/types.generator.d.ts +0 -10
- package/dist/generators/indices/types.generator.js +0 -35
- package/dist/generators/indices/update/actiontypes.generator.d.ts +0 -9
- package/dist/generators/indices/update/actiontypes.generator.js +0 -49
- package/dist/generators/indices/update/module.generator.d.ts +0 -9
- package/dist/generators/indices/update/module.generator.js +0 -41
- package/dist/generators/indices/update/service.generator.d.ts +0 -9
- package/dist/generators/indices/update/service.generator.js +0 -34
- package/dist/generators/indices/view/module.generator.d.ts +0 -9
- package/dist/generators/indices/view/module.generator.js +0 -39
- package/dist/generators/indices/view/service.generator.d.ts +0 -9
- package/dist/generators/indices/view/service.generator.js +0 -34
- package/dist/generators/models/admin.page.generator.d.ts +0 -7
- package/dist/generators/models/admin.page.generator.js +0 -74
- package/dist/generators/models/export/encoder.generator.d.ts +0 -9
- package/dist/generators/models/export/encoder.generator.js +0 -51
- package/dist/generators/models/import/decoder.generator.d.ts +0 -9
- package/dist/generators/models/import/decoder.generator.js +0 -148
- package/dist/generators/models/react/context.generator.d.ts +0 -9
- package/dist/generators/models/react/context.generator.js +0 -71
- package/dist/generators/models/react/index.d.ts +0 -10
- package/dist/generators/models/react/index.js +0 -31
- package/dist/generators/models/react/library.generator.d.ts +0 -10
- package/dist/generators/models/react/library.generator.js +0 -94
- package/dist/generators/models/react/lookup.generator.d.ts +0 -9
- package/dist/generators/models/react/lookup.generator.js +0 -175
- package/dist/generators/models/react/modals.generator.d.ts +0 -23
- package/dist/generators/models/react/modals.generator.js +0 -710
- package/dist/generators/models/repository.generator.d.ts +0 -9
- package/dist/generators/models/repository.generator.js +0 -955
- package/dist/generators/models/route.generator.d.ts +0 -9
- package/dist/generators/models/route.generator.js +0 -92
- package/dist/generators/models/seed.generator.d.ts +0 -21
- package/dist/generators/models/seed.generator.js +0 -285
- package/dist/generators/models/stub.generator.d.ts +0 -9
- package/dist/generators/models/stub.generator.js +0 -92
- package/dist/generators/models/types.generator.d.ts +0 -9
- package/dist/generators/models/types.generator.js +0 -125
- package/dist/generators/models/update/service.generator.d.ts +0 -10
- package/dist/generators/models/update/service.generator.js +0 -302
- package/dist/generators/models/view/service.generator.d.ts +0 -10
- package/dist/generators/models/view/service.generator.js +0 -239
- package/dist/lib/attributes.d.ts +0 -114
- package/dist/lib/attributes.js +0 -2
- package/dist/lib/exports.d.ts +0 -45
- package/dist/lib/exports.js +0 -90
- package/dist/lib/imports.d.ts +0 -65
- package/dist/lib/imports.js +0 -114
- package/dist/lib/meta.d.ts +0 -1191
- package/dist/lib/meta.js +0 -434
- package/dist/lib/schema/fields.d.ts +0 -46
- package/dist/lib/schema/fields.js +0 -62
- package/dist/lib/schema/schema.d.ts +0 -466
- package/dist/lib/schema/schema.js +0 -18
- package/dist/lib/schema/types.d.ts +0 -201
- package/dist/lib/schema/types.js +0 -112
- package/dist/lib/serializer.d.ts +0 -15
- package/dist/lib/serializer.js +0 -24
- package/dist/lib/test-id-collector.d.ts +0 -42
- package/dist/lib/test-id-collector.js +0 -53
- package/dist/lib/types.d.ts +0 -7
- package/dist/lib/types.js +0 -13
- package/dist/lib/typescript.d.ts +0 -5
- package/dist/lib/typescript.js +0 -22
- package/dist/lib/utils/ast.d.ts +0 -29
- package/dist/lib/utils/ast.js +0 -23
- package/dist/lib/utils/error.d.ts +0 -17
- package/dist/lib/utils/error.js +0 -52
- package/dist/lib/utils/file.d.ts +0 -10
- package/dist/lib/utils/file.js +0 -56
- package/dist/lib/utils/jsdoc.d.ts +0 -9
- package/dist/lib/utils/jsdoc.js +0 -37
- package/dist/lib/utils/logger.d.ts +0 -17
- package/dist/lib/utils/logger.js +0 -12
- package/dist/lib/utils/string.d.ts +0 -40
- package/dist/lib/utils/string.js +0 -187
- package/dist/lib/utils/types.d.ts +0 -12
- package/dist/lib/utils/types.js +0 -2
- package/dist/lib/zod.d.ts +0 -8
- package/dist/lib/zod.js +0 -60
- package/dist/prisma/attributes.d.ts +0 -21
- package/dist/prisma/attributes.js +0 -175
- package/dist/prisma/client-path.d.ts +0 -7
- package/dist/prisma/client-path.js +0 -29
- package/dist/prisma/parse.d.ts +0 -12
- package/dist/prisma/parse.js +0 -452
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import { EnumAttributes, FieldAttributes, ModelAttributes } from '../attributes';
|
|
2
|
-
import { Prettify } from '../utils/types';
|
|
3
|
-
import * as Types from './types';
|
|
4
|
-
/**
|
|
5
|
-
* A shared configuration of the schema.
|
|
6
|
-
*
|
|
7
|
-
* NOTE: This may be accessed in every model, field and enumerator.
|
|
8
|
-
*/
|
|
9
|
-
export type SchemaConfig = {
|
|
10
|
-
paths: {
|
|
11
|
-
/**
|
|
12
|
-
* Path to the directory containing actions.
|
|
13
|
-
*
|
|
14
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
15
|
-
* may reference actions using `@backend/actions` import.
|
|
16
|
-
*/
|
|
17
|
-
actionsPath: Types.FilePath;
|
|
18
|
-
/**
|
|
19
|
-
* Path to the directory containing business view logic.
|
|
20
|
-
*
|
|
21
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
22
|
-
* may reference mock data using `@backend/view` import.
|
|
23
|
-
*/
|
|
24
|
-
businessViewLogicPath: Types.FilePath;
|
|
25
|
-
/**
|
|
26
|
-
* Path to the directory containing business update logic.
|
|
27
|
-
*
|
|
28
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
29
|
-
* may reference mock data using `@backend/update` import.
|
|
30
|
-
*/
|
|
31
|
-
businessUpdateLogicPath: Types.FilePath;
|
|
32
|
-
/**
|
|
33
|
-
* Path to the directory containing Playwright project.
|
|
34
|
-
*/
|
|
35
|
-
playwrightPath: Types.FilePath;
|
|
36
|
-
/**
|
|
37
|
-
* Path to the directory containing e2e tests.
|
|
38
|
-
*/
|
|
39
|
-
e2eLibPath: Types.FilePath;
|
|
40
|
-
/**
|
|
41
|
-
* Path to the directory containing data library definitions.
|
|
42
|
-
*
|
|
43
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
44
|
-
* may reference data library using `@backend/data` import.
|
|
45
|
-
*/
|
|
46
|
-
dataLibPath: Types.FilePath;
|
|
47
|
-
/**
|
|
48
|
-
* Path to the directory containing db library definitions.
|
|
49
|
-
*
|
|
50
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
51
|
-
* may reference data library using `@backend/db` import.
|
|
52
|
-
*/
|
|
53
|
-
dbLibPath: Types.FilePath;
|
|
54
|
-
/**
|
|
55
|
-
* Path to the directory containing import module.
|
|
56
|
-
*
|
|
57
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
58
|
-
* may reference import using `@backend/import` import.
|
|
59
|
-
*/
|
|
60
|
-
importPath: Types.FilePath;
|
|
61
|
-
/**
|
|
62
|
-
* Path to the directory containing export module.
|
|
63
|
-
*
|
|
64
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
65
|
-
* may reference export using `@backend/export` import.
|
|
66
|
-
*/
|
|
67
|
-
exportPath: Types.FilePath;
|
|
68
|
-
/**
|
|
69
|
-
* Path to the directory containing Prisma migrations.
|
|
70
|
-
*/
|
|
71
|
-
prismaMigrationsFolderPath: Types.FilePath;
|
|
72
|
-
/**
|
|
73
|
-
* Path to the directory containing model type definitions.
|
|
74
|
-
*
|
|
75
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
76
|
-
* may reference type definitions using `@backend/types` import.
|
|
77
|
-
*/
|
|
78
|
-
modelTypeDefinitionsPath: Types.FilePath;
|
|
79
|
-
/**
|
|
80
|
-
* Path to the directory containing React components.
|
|
81
|
-
*
|
|
82
|
-
* NOTE: Metadata assumes that the project is set up so that React components
|
|
83
|
-
* may be referenced using `@backend/react` import.
|
|
84
|
-
*/
|
|
85
|
-
reactFolderPath: Types.FilePath;
|
|
86
|
-
/**
|
|
87
|
-
* Path to the directory containing seed module.
|
|
88
|
-
*
|
|
89
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
90
|
-
* may reference mock data using `@backend/seed` import.
|
|
91
|
-
*/
|
|
92
|
-
seedLibPath: Types.FilePath;
|
|
93
|
-
/**
|
|
94
|
-
* Path to the directory containing mock data samples.
|
|
95
|
-
*
|
|
96
|
-
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
97
|
-
* may reference mock data using `@backend/seed-data` import.
|
|
98
|
-
*/
|
|
99
|
-
seedDataPath: Types.FilePath;
|
|
100
|
-
/**
|
|
101
|
-
* Path to the directory containing trpc routes.
|
|
102
|
-
*/
|
|
103
|
-
trpcRoutesFolderPath: Types.FilePath;
|
|
104
|
-
/**
|
|
105
|
-
* Path to the directory containing admin pages.
|
|
106
|
-
*/
|
|
107
|
-
adminPagesFolderPath: Types.FilePath;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Whether the generator should overwrite existing files.
|
|
111
|
-
*/
|
|
112
|
-
force: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Name of the User type
|
|
115
|
-
*/
|
|
116
|
-
userType: Types.TypeName;
|
|
117
|
-
};
|
|
118
|
-
export type Model = Prettify<ModelCore & ModelFields>;
|
|
119
|
-
/**
|
|
120
|
-
* The model's core properties (i.e. without fields)
|
|
121
|
-
*/
|
|
122
|
-
export type ModelCore = {
|
|
123
|
-
/**
|
|
124
|
-
* Name of the model (e.g. Aggregation)
|
|
125
|
-
*/
|
|
126
|
-
name: Types.ModelName;
|
|
127
|
-
/**
|
|
128
|
-
* Description of the model, ideally providing business background and detailed information
|
|
129
|
-
*/
|
|
130
|
-
description?: string;
|
|
131
|
-
/**
|
|
132
|
-
* Name of the models type (e.g. Aggregation)
|
|
133
|
-
*/
|
|
134
|
-
typeName: Types.TypeName;
|
|
135
|
-
/**
|
|
136
|
-
* Name of the model in the source, e.g. in the database (e.g. aggregation)
|
|
137
|
-
*
|
|
138
|
-
* Note: Should be only relevant to repository and DB migration generators
|
|
139
|
-
* @internal
|
|
140
|
-
*/
|
|
141
|
-
sourceName: string;
|
|
142
|
-
/**
|
|
143
|
-
* Name of the schema in the source, (e.g. Configuration)
|
|
144
|
-
*
|
|
145
|
-
* Note: Should be only relevant to DB migration generator
|
|
146
|
-
* @internal
|
|
147
|
-
*/
|
|
148
|
-
sourceSchemaName?: string;
|
|
149
|
-
/**
|
|
150
|
-
* Type of the ID field that is specific to this model, e.g. `AggregationId`.
|
|
151
|
-
*/
|
|
152
|
-
brandedIdType: Types.TypeName;
|
|
153
|
-
/**
|
|
154
|
-
* Attributes of the model
|
|
155
|
-
* @see ModelAttributes
|
|
156
|
-
*/
|
|
157
|
-
attributes: ModelAttributes;
|
|
158
|
-
/**
|
|
159
|
-
* A global schema configuration.
|
|
160
|
-
*/
|
|
161
|
-
schemaConfig: SchemaConfig;
|
|
162
|
-
};
|
|
163
|
-
export type ModelFields = {
|
|
164
|
-
/**
|
|
165
|
-
* The id field of the model
|
|
166
|
-
*/
|
|
167
|
-
idField: FieldId;
|
|
168
|
-
/**
|
|
169
|
-
* The field of the model that identifies when the entry was created.
|
|
170
|
-
*/
|
|
171
|
-
createdAtField?: FieldScalar;
|
|
172
|
-
/**
|
|
173
|
-
* The field of the model that identifies when the entry was last updated.
|
|
174
|
-
*/
|
|
175
|
-
updatedAtField?: FieldScalar;
|
|
176
|
-
/**
|
|
177
|
-
* The property of the model that identifies the default row.
|
|
178
|
-
*/
|
|
179
|
-
defaultField?: Field;
|
|
180
|
-
/**
|
|
181
|
-
* The property of the model that is used to define the name/label
|
|
182
|
-
*
|
|
183
|
-
* By default, this is maps to the `name` field (with `id` field used as fallback in case no `name` field exists).
|
|
184
|
-
* Using the `@@Label()` attribute, other fields can be used.
|
|
185
|
-
*/
|
|
186
|
-
nameField: Field;
|
|
187
|
-
/**
|
|
188
|
-
* All fields of the model
|
|
189
|
-
*/
|
|
190
|
-
fields: Field[];
|
|
191
|
-
/**
|
|
192
|
-
* A list of models that reference this model in their relations.
|
|
193
|
-
*/
|
|
194
|
-
references: {
|
|
195
|
-
/**
|
|
196
|
-
* The name of the field in the referencing model that references this model.
|
|
197
|
-
*/
|
|
198
|
-
referencingField: FieldRelation;
|
|
199
|
-
/**
|
|
200
|
-
* The model that references this model.
|
|
201
|
-
*/
|
|
202
|
-
referencingModel: ModelCore;
|
|
203
|
-
}[];
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* A field of a model.
|
|
207
|
-
* Note: Different field types are represented as discriminant unions.
|
|
208
|
-
*/
|
|
209
|
-
export type Field = FieldId | FieldScalar | FieldRelation | FieldEnum;
|
|
210
|
-
/**
|
|
211
|
-
* The properties shared by all field types.
|
|
212
|
-
*/
|
|
213
|
-
export type FieldCore = {
|
|
214
|
-
/**
|
|
215
|
-
* Name of the field and variable (e.g. name)
|
|
216
|
-
*
|
|
217
|
-
* Note: The type of the name is narrowed by each field type.
|
|
218
|
-
*/
|
|
219
|
-
name: Types.FieldName;
|
|
220
|
-
/**
|
|
221
|
-
* Description of the field, ideally providing business background and detailed information
|
|
222
|
-
*/
|
|
223
|
-
description?: string;
|
|
224
|
-
/**
|
|
225
|
-
* Tells whether there's a NOT NULL constraint on the field.
|
|
226
|
-
*/
|
|
227
|
-
isRequired: boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Tells whether there's a unique constraint on the field.
|
|
230
|
-
*/
|
|
231
|
-
isUnique: boolean;
|
|
232
|
-
/**
|
|
233
|
-
* A dictionary of potential attributes the field can have.
|
|
234
|
-
*/
|
|
235
|
-
attributes: FieldAttributes;
|
|
236
|
-
/**
|
|
237
|
-
* Name of the field in the source e.g. in the database (e.g. Id)
|
|
238
|
-
*/
|
|
239
|
-
sourceName: string;
|
|
240
|
-
/**
|
|
241
|
-
* The type of the field as it appears in the schema (e.g. `Int`, `Float`, `String`).
|
|
242
|
-
*/
|
|
243
|
-
schemaType: string;
|
|
244
|
-
/**
|
|
245
|
-
* Validation rule for the field.
|
|
246
|
-
*/
|
|
247
|
-
validation?: Validation;
|
|
248
|
-
/**
|
|
249
|
-
* A global schema configuration.
|
|
250
|
-
*/
|
|
251
|
-
schemaConfig: SchemaConfig;
|
|
252
|
-
};
|
|
253
|
-
export type Validation = {
|
|
254
|
-
type: 'int';
|
|
255
|
-
} | {
|
|
256
|
-
type: 'float';
|
|
257
|
-
};
|
|
258
|
-
/**
|
|
259
|
-
* A scalar field, i.e. a string, number, boolean, Date
|
|
260
|
-
*/
|
|
261
|
-
export type FieldScalar = Prettify<Omit<FieldCore, 'name'> & {
|
|
262
|
-
kind: 'scalar';
|
|
263
|
-
/**
|
|
264
|
-
* Name of the field and variable (e.g. name)
|
|
265
|
-
*/
|
|
266
|
-
name: Types.FieldName;
|
|
267
|
-
/**
|
|
268
|
-
* Name of the scalar TypeScript type, e.g. string
|
|
269
|
-
*/
|
|
270
|
-
tsTypeName: Types.TypeName;
|
|
271
|
-
/**
|
|
272
|
-
* If true, each element is unique.
|
|
273
|
-
* Note: This is ensured by the repository/database
|
|
274
|
-
*/
|
|
275
|
-
isUnique: boolean;
|
|
276
|
-
/**
|
|
277
|
-
* True if the id field is an autoIncremented field.
|
|
278
|
-
*/
|
|
279
|
-
isGenerated: boolean;
|
|
280
|
-
}>;
|
|
281
|
-
/**
|
|
282
|
-
* The id field of a model. A model can only have one id field.
|
|
283
|
-
*/
|
|
284
|
-
export type FieldId = Prettify<Omit<FieldCore, 'name'> & {
|
|
285
|
-
kind: 'id';
|
|
286
|
-
/**
|
|
287
|
-
* Name of the field and variable (must be `id`)
|
|
288
|
-
*/
|
|
289
|
-
name: Types.IdFieldName;
|
|
290
|
-
/**
|
|
291
|
-
* Model that this ID field identifies.
|
|
292
|
-
*/
|
|
293
|
-
model: ModelCore;
|
|
294
|
-
/**
|
|
295
|
-
* If true, each element is unique.
|
|
296
|
-
* Note: This is ensured by the repository/database
|
|
297
|
-
*/
|
|
298
|
-
isUnique: boolean;
|
|
299
|
-
/**
|
|
300
|
-
* True if the id field is an autoIncremented field.
|
|
301
|
-
*/
|
|
302
|
-
isGenerated: boolean;
|
|
303
|
-
/**
|
|
304
|
-
* Name of the unbranded TypeScript type of the id field, e.g. string
|
|
305
|
-
*
|
|
306
|
-
* Note: This should only be used in the type generator - all other generators
|
|
307
|
-
* should use the branded type "tsTypeName"!
|
|
308
|
-
*/
|
|
309
|
-
unbrandedTypeName: Types.TypeName;
|
|
310
|
-
}>;
|
|
311
|
-
/**
|
|
312
|
-
* Utility function to check if a field is an id field.
|
|
313
|
-
*/
|
|
314
|
-
export declare const isFieldId: (field: Field) => field is Prettify<Omit<FieldCore, "name"> & {
|
|
315
|
-
kind: 'id';
|
|
316
|
-
/**
|
|
317
|
-
* Name of the field and variable (must be `id`)
|
|
318
|
-
*/
|
|
319
|
-
name: Types.IdFieldName;
|
|
320
|
-
/**
|
|
321
|
-
* Model that this ID field identifies.
|
|
322
|
-
*/
|
|
323
|
-
model: ModelCore;
|
|
324
|
-
/**
|
|
325
|
-
* If true, each element is unique.
|
|
326
|
-
* Note: This is ensured by the repository/database
|
|
327
|
-
*/
|
|
328
|
-
isUnique: boolean;
|
|
329
|
-
/**
|
|
330
|
-
* True if the id field is an autoIncremented field.
|
|
331
|
-
*/
|
|
332
|
-
isGenerated: boolean;
|
|
333
|
-
/**
|
|
334
|
-
* Name of the unbranded TypeScript type of the id field, e.g. string
|
|
335
|
-
*
|
|
336
|
-
* Note: This should only be used in the type generator - all other generators
|
|
337
|
-
* should use the branded type "tsTypeName"!
|
|
338
|
-
*/
|
|
339
|
-
unbrandedTypeName: Types.TypeName;
|
|
340
|
-
}>;
|
|
341
|
-
/**
|
|
342
|
-
* A relation field, representing a "to-relation" in the schema.
|
|
343
|
-
*/
|
|
344
|
-
export type FieldRelation = Prettify<Omit<FieldCore, 'name'> & {
|
|
345
|
-
kind: 'relation';
|
|
346
|
-
/**
|
|
347
|
-
* Name of the field and variable (e.g. aggregationId)
|
|
348
|
-
*/
|
|
349
|
-
name: Types.FieldName;
|
|
350
|
-
/**
|
|
351
|
-
* Name of the relation field in the model.
|
|
352
|
-
*
|
|
353
|
-
* NOTE: This does not reference the database column name, but the field name
|
|
354
|
-
* in the model (e.g. not `aggregationId`, but `aggregation`).
|
|
355
|
-
*/
|
|
356
|
-
relationFieldName: Types.FieldName;
|
|
357
|
-
/**
|
|
358
|
-
* Name of the unbranded TypeScript type of the field, e.g. string
|
|
359
|
-
*
|
|
360
|
-
* Note: This should only be used in the type generator - all other generators
|
|
361
|
-
* should use the branded type "typeName"!
|
|
362
|
-
*
|
|
363
|
-
* @internal
|
|
364
|
-
*/
|
|
365
|
-
unbrandedTypeName: Types.TypeName;
|
|
366
|
-
/**
|
|
367
|
-
* The referenced model.
|
|
368
|
-
*/
|
|
369
|
-
relationToModel: ModelCore;
|
|
370
|
-
}>;
|
|
371
|
-
/**
|
|
372
|
-
* Utility function to check if a field is an relation field.
|
|
373
|
-
*/
|
|
374
|
-
export declare const isFieldRelation: (field: Field) => field is Prettify<Omit<FieldCore, "name"> & {
|
|
375
|
-
kind: 'relation';
|
|
376
|
-
/**
|
|
377
|
-
* Name of the field and variable (e.g. aggregationId)
|
|
378
|
-
*/
|
|
379
|
-
name: Types.FieldName;
|
|
380
|
-
/**
|
|
381
|
-
* Name of the relation field in the model.
|
|
382
|
-
*
|
|
383
|
-
* NOTE: This does not reference the database column name, but the field name
|
|
384
|
-
* in the model (e.g. not `aggregationId`, but `aggregation`).
|
|
385
|
-
*/
|
|
386
|
-
relationFieldName: Types.FieldName;
|
|
387
|
-
/**
|
|
388
|
-
* Name of the unbranded TypeScript type of the field, e.g. string
|
|
389
|
-
*
|
|
390
|
-
* Note: This should only be used in the type generator - all other generators
|
|
391
|
-
* should use the branded type "typeName"!
|
|
392
|
-
*
|
|
393
|
-
* @internal
|
|
394
|
-
*/
|
|
395
|
-
unbrandedTypeName: Types.TypeName;
|
|
396
|
-
/**
|
|
397
|
-
* The referenced model.
|
|
398
|
-
*/
|
|
399
|
-
relationToModel: ModelCore;
|
|
400
|
-
}>;
|
|
401
|
-
/**
|
|
402
|
-
* An enum field, e.g. a field that can only have a value of a specific enum.
|
|
403
|
-
*/
|
|
404
|
-
export type FieldEnum = Prettify<Omit<FieldCore, 'name'> & {
|
|
405
|
-
kind: 'enum';
|
|
406
|
-
/**
|
|
407
|
-
* Name of the field and variable (e.g. language)
|
|
408
|
-
*/
|
|
409
|
-
name: Types.FieldName;
|
|
410
|
-
/**
|
|
411
|
-
* Name of the TypeScript type of the field, e.g. Language
|
|
412
|
-
*/
|
|
413
|
-
typeName: Types.TypeName;
|
|
414
|
-
/**
|
|
415
|
-
* Enum definition of the field.
|
|
416
|
-
*/
|
|
417
|
-
enumerator: Enum;
|
|
418
|
-
}>;
|
|
419
|
-
/**
|
|
420
|
-
* Utility function to check if a field is an enum field.
|
|
421
|
-
*/
|
|
422
|
-
export declare const isFieldEnum: (field: Field) => field is Prettify<Omit<FieldCore, "name"> & {
|
|
423
|
-
kind: 'enum';
|
|
424
|
-
/**
|
|
425
|
-
* Name of the field and variable (e.g. language)
|
|
426
|
-
*/
|
|
427
|
-
name: Types.FieldName;
|
|
428
|
-
/**
|
|
429
|
-
* Name of the TypeScript type of the field, e.g. Language
|
|
430
|
-
*/
|
|
431
|
-
typeName: Types.TypeName;
|
|
432
|
-
/**
|
|
433
|
-
* Enum definition of the field.
|
|
434
|
-
*/
|
|
435
|
-
enumerator: Enum;
|
|
436
|
-
}>;
|
|
437
|
-
/**
|
|
438
|
-
* Definition of an enum, consisting of a name and a list of enum members.
|
|
439
|
-
*/
|
|
440
|
-
export type Enum = {
|
|
441
|
-
name: Types.EnumName;
|
|
442
|
-
/**
|
|
443
|
-
* Description of the enum, ideally providing business background and detailed information
|
|
444
|
-
*/
|
|
445
|
-
description?: string;
|
|
446
|
-
/**
|
|
447
|
-
* TypeScript type that should be used to reference an enumerator.
|
|
448
|
-
*/
|
|
449
|
-
tsTypeName: Types.TypeName;
|
|
450
|
-
/**
|
|
451
|
-
* Object containing all optional attributes of the enum.
|
|
452
|
-
*/
|
|
453
|
-
attributes: EnumAttributes;
|
|
454
|
-
/**
|
|
455
|
-
* Name of the enum as it appears in the source (e.g. in the Prisma file).
|
|
456
|
-
*/
|
|
457
|
-
sourceName: string;
|
|
458
|
-
/**
|
|
459
|
-
* List of enum members, e.g. [EN, DE]
|
|
460
|
-
*/
|
|
461
|
-
values: string[];
|
|
462
|
-
/**
|
|
463
|
-
* A global schema configuration.
|
|
464
|
-
*/
|
|
465
|
-
schemaConfig: SchemaConfig;
|
|
466
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFieldEnum = exports.isFieldRelation = exports.isFieldId = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility function to check if a field is an id field.
|
|
6
|
-
*/
|
|
7
|
-
const isFieldId = (field) => field.kind === 'id';
|
|
8
|
-
exports.isFieldId = isFieldId;
|
|
9
|
-
/**
|
|
10
|
-
* Utility function to check if a field is an relation field.
|
|
11
|
-
*/
|
|
12
|
-
const isFieldRelation = (field) => field.kind === 'relation';
|
|
13
|
-
exports.isFieldRelation = isFieldRelation;
|
|
14
|
-
/**
|
|
15
|
-
* Utility function to check if a field is an enum field.
|
|
16
|
-
*/
|
|
17
|
-
const isFieldEnum = (field) => field.kind === 'enum';
|
|
18
|
-
exports.isFieldEnum = isFieldEnum;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The name of a class, e.g. "AggregationRepository".
|
|
3
|
-
*/
|
|
4
|
-
export type ClassName = string & {
|
|
5
|
-
readonly ___type: 'ClassName';
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Converts a raw string to a branded ClassName.
|
|
9
|
-
*/
|
|
10
|
-
export declare const toClassName: (t: string) => ClassName;
|
|
11
|
-
/**
|
|
12
|
-
* Name of a "Discriminant" in a "Discriminated Union".
|
|
13
|
-
*
|
|
14
|
-
* (Background)[https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions]:
|
|
15
|
-
* A "discriminated union" in TypeScript is a union type with a common, singleton type property — the discriminant.
|
|
16
|
-
* E.g.:
|
|
17
|
-
* ```ts
|
|
18
|
-
* type Shape = Square | Rectangle | Circle
|
|
19
|
-
* type Square = { kind: "square"; size: number }
|
|
20
|
-
* type Rectangle = { kind: "rectangle"; width: number; height: number }
|
|
21
|
-
* type Circle = { kind: "circle"; radius: number }
|
|
22
|
-
* ```
|
|
23
|
-
* In the above example, the `kind` property is the discriminant.
|
|
24
|
-
*/
|
|
25
|
-
export type DiscriminantName = string & {
|
|
26
|
-
readonly ___type: 'DiscriminantName';
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Brands a raw string as a discriminant.
|
|
30
|
-
*/
|
|
31
|
-
export declare const toDiscriminantName: (t: string) => DiscriminantName;
|
|
32
|
-
/**
|
|
33
|
-
* The name of a model, e.g. "Aggregation".
|
|
34
|
-
*/
|
|
35
|
-
export type ModelName = string & {
|
|
36
|
-
readonly ___type: 'ModelName';
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Brands a raw string to a ModelName identifier.
|
|
40
|
-
*/
|
|
41
|
-
export declare const toModelName: (t: string) => ModelName;
|
|
42
|
-
/**
|
|
43
|
-
* Name of a Typescript type, e.g. "Aggregation".
|
|
44
|
-
*/
|
|
45
|
-
export type TypeName = string & {
|
|
46
|
-
readonly ___type: 'TypeName';
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Brands a raw string to a TypeScript Type identifier.
|
|
50
|
-
*/
|
|
51
|
-
export declare const toTypeName: (t: string) => TypeName;
|
|
52
|
-
/**
|
|
53
|
-
* A TypeName that is annotated with the kind of the type.
|
|
54
|
-
* Note: This is used when distinguishing between kinds is required at runtime.
|
|
55
|
-
*/
|
|
56
|
-
export type AnnotatedTypeName = {
|
|
57
|
-
typeName: TypeName;
|
|
58
|
-
kind: 'TypeName';
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Converts a branded string to a branded TypeName.
|
|
62
|
-
*/
|
|
63
|
-
export declare const toAnnotatedTypeName: (name: TypeName) => AnnotatedTypeName;
|
|
64
|
-
/**
|
|
65
|
-
* Type guard to check if a given type is an AnnotatedTypeName.
|
|
66
|
-
*/
|
|
67
|
-
export declare const isAnnotatedTypeName: (t: string | AnnotatedTypeName) => t is AnnotatedTypeName;
|
|
68
|
-
/**
|
|
69
|
-
* The name of a model field, e.g. "name".
|
|
70
|
-
*/
|
|
71
|
-
export type FieldName = string & {
|
|
72
|
-
readonly ___type: 'FieldName';
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Brands a raw string to an IdFieldName identifier.
|
|
76
|
-
*/
|
|
77
|
-
export declare const ID_FIELD_NAME: IdFieldName;
|
|
78
|
-
/**
|
|
79
|
-
* The name of the id field. Must be `id`.
|
|
80
|
-
*/
|
|
81
|
-
export type IdFieldName = 'id' & {
|
|
82
|
-
readonly ___type: 'FieldName';
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Brands a raw string to a FieldName identifier.
|
|
86
|
-
*/
|
|
87
|
-
export declare const toFieldName: (t: string) => FieldName;
|
|
88
|
-
/**
|
|
89
|
-
* The name of an Enum, e.g. "Language".
|
|
90
|
-
*/
|
|
91
|
-
export type EnumName = string & {
|
|
92
|
-
readonly ___type: 'EnumName';
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Brands a raw string to an EnumName identifier.
|
|
96
|
-
*/
|
|
97
|
-
export declare const toEnumName: (t: string) => EnumName;
|
|
98
|
-
/**
|
|
99
|
-
* The name of a function (e.g. "toAggregation").
|
|
100
|
-
*/
|
|
101
|
-
export type FunctionName = string & {
|
|
102
|
-
readonly ___type: 'FunctionName';
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Converts a string to a branded function name.
|
|
106
|
-
*/
|
|
107
|
-
export declare const toFunctionName: (t: string) => FunctionName;
|
|
108
|
-
/**
|
|
109
|
-
* The name of a variable or a property in the generated code.
|
|
110
|
-
*/
|
|
111
|
-
export type VariableName = string & {
|
|
112
|
-
readonly ___type: 'VariableName';
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Converts a string to a branded VariableName.
|
|
116
|
-
*/
|
|
117
|
-
export declare const toVariableName: (t: string) => VariableName;
|
|
118
|
-
/**
|
|
119
|
-
* A name of the file without a file extension, e.g. "aggregation.type".
|
|
120
|
-
*/
|
|
121
|
-
export type FileName = string & {
|
|
122
|
-
readonly ___type: 'FileName';
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Lets you brand a string value as a name of the file.
|
|
126
|
-
*
|
|
127
|
-
* NOTE: THIS SHOULD NOT BE A PATH!
|
|
128
|
-
*/
|
|
129
|
-
export declare const toFileName: (t: string) => FileName;
|
|
130
|
-
/**
|
|
131
|
-
* A name of the folder without the trailing and leading slash (e.g. "aggregation").
|
|
132
|
-
*/
|
|
133
|
-
export type FolderName = string & {
|
|
134
|
-
readonly ___type: 'FolderName';
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Converts a string to a branded FolderName.
|
|
138
|
-
*/
|
|
139
|
-
export declare const toFolderName: (t: string) => FolderName;
|
|
140
|
-
/**
|
|
141
|
-
* A relative or absolute path to a file or folder.
|
|
142
|
-
*/
|
|
143
|
-
export type FilePath = string & {
|
|
144
|
-
readonly ___type: 'FilePath';
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* The combination of a file path and the import path to the file in a module.
|
|
148
|
-
*/
|
|
149
|
-
export type ModuleLocation = {
|
|
150
|
-
/**
|
|
151
|
-
* The path to the file, e.g. `/backend/libs/update/src/update.module`.
|
|
152
|
-
*/
|
|
153
|
-
path: FilePath;
|
|
154
|
-
/**
|
|
155
|
-
* The import path to the file, e.g. `@backend/update/update.module`.
|
|
156
|
-
*/
|
|
157
|
-
import: BackendModulePath;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Converts a absolute module file path and a module name to a concrete location.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* toModuleLocation(`actions`, `./backend/libs/actions/src/dispatcher.service`)
|
|
166
|
-
* // {
|
|
167
|
-
* // path: '/backend/libs/actions/src/dispatcher.service',
|
|
168
|
-
* // import: '@backend/actions/dispatcher.service'
|
|
169
|
-
* // }
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
export declare const toModuleLocation: (moduleName: string, absoluteFilePath: string) => ModuleLocation;
|
|
173
|
-
/**
|
|
174
|
-
* Converts a string to a branded BackendModulePath.
|
|
175
|
-
*/
|
|
176
|
-
export declare const toBackendModulePath: (t: `@backend/${string}`) => BackendModulePath;
|
|
177
|
-
/**
|
|
178
|
-
* A relative or absolute path to a backend file or folder.
|
|
179
|
-
*/
|
|
180
|
-
export type BackendModulePath = `@backend/${string}` & {
|
|
181
|
-
readonly ___type: 'BackendModulePath';
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* Converts a string to a branded PAth.
|
|
185
|
-
*/
|
|
186
|
-
export declare const toPath: (t: string) => FilePath;
|
|
187
|
-
/**
|
|
188
|
-
* The name of an NPM package (e.g. "@postxl/runtime").
|
|
189
|
-
*/
|
|
190
|
-
export type PackageName = string & {
|
|
191
|
-
readonly ___type: 'PackageName';
|
|
192
|
-
};
|
|
193
|
-
export declare const toPackageName: (t: string) => PackageName;
|
|
194
|
-
/**
|
|
195
|
-
* Branded string values that can be used as import statement values in the generators
|
|
196
|
-
*/
|
|
197
|
-
export type ImportableTypes = FunctionName | ClassName | TypeName | AnnotatedTypeName | VariableName | EnumName;
|
|
198
|
-
/**
|
|
199
|
-
* Branded string values that can be used as paths in import statements
|
|
200
|
-
*/
|
|
201
|
-
export type ImportPaths = BackendModulePath | FilePath | PackageName;
|