@codenotch/codenotch.cli 1.0.33 → 1.0.34

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 (97) hide show
  1. package/dist/commands/index.js +2 -0
  2. package/dist/commands/index.js.map +1 -1
  3. package/dist/commands/validation/ValidationUtils.d.ts +28 -0
  4. package/dist/commands/validation/ValidationUtils.js +182 -0
  5. package/dist/commands/validation/ValidationUtils.js.map +1 -0
  6. package/dist/commands/validation/files/AppManifestValidator.d.ts +6 -0
  7. package/dist/commands/validation/files/AppManifestValidator.js +93 -0
  8. package/dist/commands/validation/files/AppManifestValidator.js.map +1 -0
  9. package/dist/commands/validation/files/BpmnValidator.d.ts +5 -0
  10. package/dist/commands/validation/files/BpmnValidator.js +32 -0
  11. package/dist/commands/validation/files/BpmnValidator.js.map +1 -0
  12. package/dist/commands/validation/files/DbSchemaValidator.d.ts +5 -0
  13. package/dist/commands/validation/files/DbSchemaValidator.js +16 -0
  14. package/dist/commands/validation/files/DbSchemaValidator.js.map +1 -0
  15. package/dist/commands/validation/files/DocumentValidator.d.ts +5 -0
  16. package/dist/commands/validation/files/DocumentValidator.js +12 -0
  17. package/dist/commands/validation/files/DocumentValidator.js.map +1 -0
  18. package/dist/commands/validation/files/I18nValidator.d.ts +5 -0
  19. package/dist/commands/validation/files/I18nValidator.js +13 -0
  20. package/dist/commands/validation/files/I18nValidator.js.map +1 -0
  21. package/dist/commands/validation/files/JsonValidator.d.ts +5 -0
  22. package/dist/commands/validation/files/JsonValidator.js +13 -0
  23. package/dist/commands/validation/files/JsonValidator.js.map +1 -0
  24. package/dist/commands/validation/files/ManifestCacheValidator.d.ts +5 -0
  25. package/dist/commands/validation/files/ManifestCacheValidator.js +121 -0
  26. package/dist/commands/validation/files/ManifestCacheValidator.js.map +1 -0
  27. package/dist/commands/validation/files/ManifestValidator.d.ts +5 -0
  28. package/dist/commands/validation/files/ManifestValidator.js +14 -0
  29. package/dist/commands/validation/files/ManifestValidator.js.map +1 -0
  30. package/dist/commands/validation/files/ScriptValidator.d.ts +12 -0
  31. package/dist/commands/validation/files/ScriptValidator.js +128 -0
  32. package/dist/commands/validation/files/ScriptValidator.js.map +1 -0
  33. package/dist/commands/validation/files/TableValidator.d.ts +5 -0
  34. package/dist/commands/validation/files/TableValidator.js +19 -0
  35. package/dist/commands/validation/files/TableValidator.js.map +1 -0
  36. package/dist/commands/validation/validate.d.ts +2 -0
  37. package/dist/commands/validation/validate.js +245 -0
  38. package/dist/commands/validation/validate.js.map +1 -0
  39. package/dist/utils/BuildUtils.d.ts +22 -4
  40. package/dist/utils/BuildUtils.js +45 -16
  41. package/dist/utils/BuildUtils.js.map +1 -1
  42. package/dist/utils/FileUtils.d.ts +13 -0
  43. package/dist/utils/FileUtils.js +30 -0
  44. package/dist/utils/FileUtils.js.map +1 -1
  45. package/dist/utils/I18nUtils.js +0 -2
  46. package/dist/utils/I18nUtils.js.map +1 -1
  47. package/package.json +14 -6
  48. package/.github/copilot-instructions.md +0 -3
  49. package/bin/cli.js +0 -3
  50. package/docs/ARCHITECTURE.md +0 -179
  51. package/docs/TODO.md +0 -18
  52. package/src/bin/cli.ts +0 -4
  53. package/src/commands/index.ts +0 -13
  54. package/src/commands/project/compile.ts +0 -20
  55. package/src/commands/project/deploy.ts +0 -11
  56. package/src/commands/project/index.ts +0 -28
  57. package/src/commands/project/inspect.ts +0 -12
  58. package/src/commands/project/new.ts +0 -11
  59. package/src/commands/project/open.ts +0 -21
  60. package/src/commands/project/package.ts +0 -20
  61. package/src/commands/project/refresh.ts +0 -13
  62. package/src/commands/project/remove.ts +0 -12
  63. package/src/commands/project/shared.ts +0 -9
  64. package/src/commands/project/start.ts +0 -24
  65. package/src/commands/project/test.ts +0 -15
  66. package/src/commands/react/build.ts +0 -12
  67. package/src/commands/react/index.ts +0 -12
  68. package/src/commands/react/serve.ts +0 -13
  69. package/src/commands/runtime/clear.ts +0 -11
  70. package/src/commands/runtime/index.ts +0 -24
  71. package/src/commands/runtime/info.ts +0 -47
  72. package/src/commands/runtime/latest.ts +0 -18
  73. package/src/commands/runtime/portal.ts +0 -20
  74. package/src/commands/runtime/start.ts +0 -16
  75. package/src/commands/runtime/stop.ts +0 -13
  76. package/src/commands/runtime/update.ts +0 -12
  77. package/src/commands/system/index.ts +0 -9
  78. package/src/commands/system/info.ts +0 -23
  79. package/src/commands/system/read.ts +0 -25
  80. package/src/index.ts +0 -22
  81. package/src/models/Codenotch.ts +0 -361
  82. package/src/models/DbModels.ts +0 -428
  83. package/src/models/OpenApiModels.ts +0 -145
  84. package/src/utils/BuildUtils.ts +0 -739
  85. package/src/utils/ConsoleUtils.ts +0 -22
  86. package/src/utils/FileUtils.ts +0 -266
  87. package/src/utils/GitHubAuthUtils.ts +0 -83
  88. package/src/utils/I18nUtils.ts +0 -58
  89. package/src/utils/OpenAPIUtils.ts +0 -285
  90. package/src/utils/OsUtils.ts +0 -32
  91. package/src/utils/ProjectCompilationUtils.ts +0 -1002
  92. package/src/utils/ProjectUtils.ts +0 -151
  93. package/src/utils/RuntimeUtils.ts +0 -743
  94. package/src/utils/ServeUtils.ts +0 -175
  95. package/src/utils/ShellUtils.ts +0 -26
  96. package/src/utils/StringUtils.ts +0 -80
  97. package/tsconfig.json +0 -35
@@ -1,428 +0,0 @@
1
- import { JSONSchema7 } from "json-schema";
2
-
3
- export enum FieldType {
4
- STRING,
5
- NUMBER, // Float
6
- INTEGER,
7
- BOOL,
8
- LIST, // aka array
9
- MAP // aka object
10
- }
11
- /**
12
- * Used only to save JSON .table file in scenar.io later
13
- * given to DatabaseMigrationGenerator to compute XML migration
14
- */
15
- export interface TableDefinition {
16
- Name: string;
17
- Description: string;
18
-
19
- Id: IdField;
20
- CreatedAt: CreatedAtField;
21
- UpdatedAt: UpdatedAtField;
22
-
23
- Fields?: BaseFieldType[];
24
-
25
- AccessPolicy: ContainerAccessSettings,
26
- RetentionPolicy: ContainerRetentionPolicy,
27
- PatchSettings: ContainerPatchSettings
28
- }
29
-
30
- /**
31
- * All SQL field types
32
- */
33
- export enum FieldTypes {
34
- Guid = "Guid",
35
- Boolean = "Boolean",
36
- String = "String",
37
- Text = "Text",
38
- Email = "Email",
39
- Decimal = "Decimal",
40
- Integer = "Integer",
41
- Date = "Date",
42
- DateTime = "DateTime",
43
- Version = "Version",
44
- Enum = "Enum",
45
- AutoIncrement = "AutoIncrement",
46
- HasMany = "HasMany",
47
- HasOne = "HasOne",
48
- BelongsTo = "BelongsTo"
49
- }
50
-
51
- export interface IdField {
52
- Name: string;
53
- }
54
-
55
- export interface BaseFieldType {
56
- Name: string;
57
- Description: string;
58
- Type: FieldTypes;
59
- IsNullable: boolean;
60
- IsUnique: boolean;
61
- IsSecret: boolean;
62
- IsIndexed: boolean;
63
- IsValidated: boolean;
64
- Validation: string;
65
- }
66
-
67
- export interface BaseRelation extends BaseFieldType {
68
- Table: string;
69
- }
70
-
71
- export interface HasRelation extends BaseRelation {
72
- BelongsTo: string;
73
- LinkBehaviour: "Unlink" | "Delete" | string;
74
- }
75
-
76
- export interface HasOne extends HasRelation {
77
-
78
- }
79
-
80
- export interface HasMany extends HasRelation {
81
-
82
- }
83
-
84
- export interface BelongsTo extends BaseRelation {
85
- Key: string
86
- }
87
-
88
- export interface GuidField extends BaseFieldType {
89
-
90
- }
91
-
92
- /**
93
- * Contains email with autovalidation
94
- */
95
- export interface EmailField extends BaseFieldType {
96
-
97
- }
98
-
99
- /**
100
- * Special SQL timestamp
101
- */
102
- export interface VersionField extends BaseFieldType {
103
-
104
- }
105
-
106
- /**
107
- * Contains date + time
108
- */
109
- export interface DateTimeField extends BaseFieldType {
110
-
111
- }
112
-
113
- /**
114
- * Contains date
115
- */
116
- export interface DateField extends BaseFieldType {
117
-
118
- }
119
-
120
- /**
121
- * Array of string
122
- */
123
- export interface EnumField extends BaseFieldType {
124
- /**
125
- *
126
- */
127
- Value: string[];
128
- }
129
-
130
- /**
131
- * Any number with Precision (How many floating numbers) and Scale (Max integer part)
132
- */
133
- export interface DecimalField extends BaseFieldType {
134
- /**
135
- *
136
- */
137
- Precision: number;
138
- /**
139
- *
140
- */
141
- Scale: number;
142
- }
143
-
144
- /**
145
- * No floating number value
146
- */
147
- export interface IntegerField extends BaseFieldType {
148
-
149
- // Tiny, Small, Normal (default), Big
150
- Size: string | undefined;
151
-
152
- }
153
-
154
- /**
155
- * String > of 16b
156
- */
157
- export interface TextField extends BaseFieldType {
158
-
159
- }
160
-
161
- /**
162
- * Equivalent of VARCHAR(255)
163
- */
164
- export interface StringField extends BaseFieldType {
165
-
166
- }
167
-
168
- /**
169
- * Contains true false as a bit
170
- */
171
- export interface BooleanField extends BaseFieldType {
172
-
173
- }
174
-
175
- /**
176
- * An integer column that is auto incremented
177
- */
178
- export interface AutoIncrementField extends BaseFieldType {
179
- /**
180
- * Start value
181
- */
182
- Seed: number;
183
-
184
- /**
185
- *
186
- */
187
- Increment: number;
188
-
189
- UseBigInt?: boolean;
190
- }
191
-
192
- /**
193
- *
194
- */
195
- export interface UpdatedAtField {
196
- Name: string;
197
- }
198
-
199
- /**
200
- *
201
- */
202
- export interface CreatedAtField {
203
- Name: string;
204
- }
205
-
206
- export enum ContainerType {
207
- Document = "0",
208
- Sql = "1"
209
- }
210
-
211
- // Abstraction of datastore container, provide a way to use any type of container, blob storage, sql, etc
212
- export default class AbstractRecordContainer {
213
-
214
- // Name and identifier
215
- name: string;
216
- dataSourceKind: ContainerType;
217
- schema: JSONSchema7;
218
-
219
- accessPolicy: ContainerAccessSettings;
220
- retentionPolicy: ContainerRetentionPolicy;
221
- patchSettings: ContainerPatchSettings;
222
- secretFields: string[];
223
-
224
- public constructor(name: string, type: ContainerType, schema: JSONSchema7, accessSettings?: ContainerAccessSettings, retentionPolicy?: ContainerRetentionPolicy, patchSettings?: ContainerPatchSettings, secretFields?: string[]) {
225
- this.name = name;
226
- this.dataSourceKind = type;
227
- this.schema = schema;
228
-
229
- if (accessSettings && accessSettings.public === undefined) {
230
- accessSettings = undefined;
231
- }
232
-
233
- if (accessSettings) {
234
- this.accessPolicy = accessSettings;
235
- }
236
- else {
237
- this.accessPolicy = {
238
- public: {
239
- read: 'all',
240
- update: 'all',
241
- create: 'all',
242
- delete: 'all'
243
- },
244
- external: {
245
- read: 'all',
246
- update: 'all',
247
- create: 'all',
248
- delete: 'all'
249
- },
250
- internal: {
251
- _other: {
252
- read: 'all',
253
- update: 'all',
254
- create: 'all',
255
- delete: 'all'
256
- },
257
- admin: {
258
- read: 'all',
259
- update: 'all',
260
- create: 'all',
261
- delete: 'all'
262
- },
263
- dev: {
264
- read: 'all',
265
- update: 'all',
266
- create: 'all',
267
- delete: 'all'
268
- }
269
- },
270
- system: {
271
-
272
- }
273
- };
274
- }
275
-
276
- if (retentionPolicy) {
277
- this.retentionPolicy = retentionPolicy;
278
- }
279
- else {
280
- this.retentionPolicy = {
281
- RetentionPeriod: null, // default is to never expires
282
- RetentionReachedBehaviour: "DELETE"
283
- }
284
- }
285
-
286
- if (patchSettings) {
287
- this.patchSettings = patchSettings;
288
- }
289
- else {
290
- this.patchSettings = {
291
- PatchExpirationMinutes: 1440,
292
- PatchRetentionAmount: 10
293
- }
294
- }
295
-
296
- if (secretFields) {
297
- this.secretFields = secretFields;
298
- }
299
- else {
300
- this.secretFields = [];
301
- }
302
- }
303
-
304
- // Used to display a little tag in the UI
305
- public getTag(): string {
306
- switch (this.dataSourceKind) {
307
- case ContainerType.Document: return "json";
308
- case ContainerType.Sql: return "sql";
309
- }
310
- }
311
- }
312
- export interface CrudAccessSetting {
313
-
314
- read: 'all' | 'rls' | 'none';
315
-
316
- update: 'all' | 'rls' | 'none';
317
-
318
- delete: 'all' | 'rls' | 'none';
319
-
320
- create: 'all' | 'none';
321
- }
322
-
323
- export interface ContainerAccessSettings {
324
-
325
- internal: { [scope: string]: CrudAccessSetting; };
326
- public: CrudAccessSetting;
327
- external: CrudAccessSetting;
328
- system: { [serviceName: string]: CrudAccessSetting; };
329
- }
330
-
331
- export interface ContainerRetentionPolicy {
332
-
333
- /**
334
- * The time after which the data is purged from the datasource
335
- * If null, data never expires
336
- * Default to null
337
- */
338
- RetentionPeriod: string | null;
339
-
340
- /**
341
- * Describes the behaviour of the data upon reaching the retention period
342
- */
343
- RetentionReachedBehaviour: "DELETE"; // TODO for the moment, only DELETE is supported
344
- }
345
-
346
-
347
- export interface ContainerPatchSettings {
348
-
349
- /**
350
- * Time (in minutes) after which a patch can no longer be compensated
351
- */
352
- PatchExpirationMinutes: number;
353
-
354
- /**
355
- * Maximum amount of non-merged patches
356
- * When this number is reached, the oldest patch is merged and can no longer be compensated
357
- * 0 means no patch are kept for this datastore (the grain still keep a copy of the latest version of the record though)
358
- */
359
- PatchRetentionAmount: number
360
- }
361
-
362
- /*
363
- export class DatabaseSchemaGenerator {
364
- static GetXMLFromTableDefinition(definitions: TableDefinition[], version: string = "0.0.1"): string {
365
-
366
- let DatabaseSchema: any = {
367
- Tables: {
368
- Table: []
369
- },
370
- "@": { Version: version }
371
- };
372
-
373
- definitions.forEach(definition => {
374
- let definitionModel: any = {
375
- "@": {
376
- Name: definition.Name,
377
- Description: definition.Description
378
- },
379
- Id: {
380
- "@": {
381
- Name: definition.Id.Name,
382
- }
383
- },
384
- CreatedAt: {
385
- "@": {
386
- Name: definition.CreatedAt.Name,
387
- }
388
- },
389
- UpdatedAt: {
390
- "@": {
391
- Name: definition.UpdatedAt.Name,
392
- }
393
- }
394
- }
395
- definition.Fields?.forEach(field => {
396
- let resultfield: any = {
397
- "@": Object.assign({}, field)
398
- }
399
- delete resultfield["@"].Type;
400
-
401
- if (field.Type === FieldTypes.Enum) {
402
- resultfield["Value"] = resultfield["@"].Value;
403
- delete resultfield["@"].Value;
404
- }
405
-
406
- if (Array.isArray(definitionModel[field.Type])) {
407
- definitionModel[field.Type].push(resultfield);
408
- } else if (definitionModel[field.Type]) {
409
- definitionModel[field.Type] = [definitionModel[field.Type]];
410
- definitionModel[field.Type].push(resultfield);
411
- } else {
412
- definitionModel[field.Type] = resultfield
413
- }
414
- })
415
- DatabaseSchema.Tables.Table.push(definitionModel)
416
-
417
- });
418
-
419
- let result = parse("DatabaseSchema", DatabaseSchema, { format: { doubleQuotes: true } })
420
- return result;
421
- }
422
- }
423
- */
424
-
425
- export interface DatabaseSchema {
426
-
427
- Tables: TableDefinition[];
428
- }
@@ -1,145 +0,0 @@
1
- import { JSONSchema7 } from "json-schema";
2
-
3
- export interface IOpenApiSchemaRef { schema: { '$ref': string } }
4
- export interface IOpenApiResponse {
5
- description?: string;
6
- content?: { [type: string]: IOpenApiSchemaRef }
7
- }
8
- export interface IOpenApiEndpoint {
9
- description?: string;
10
- operationId?: string;
11
- responses?: { [code: string]: IOpenApiResponse };
12
- parameters?: IOpenApiParameter[];
13
- requestBody?: {
14
- content: { [type: string]: IOpenApiSchemaRef };
15
- description?: string;
16
- };
17
- }
18
-
19
- export interface IOpenApiParameter {
20
- description?: string;
21
- in: string;
22
- name: string;
23
- required: boolean;
24
- schema: JSONSchema7;
25
- }
26
-
27
-
28
- /**
29
- * Open api version 3.0
30
- */
31
- export default class OpenAPISpec {
32
- /**
33
- * Describe open API version
34
- */
35
- openapi: string;
36
- /**
37
- * Api information
38
- * version, title and license
39
- */
40
- info: APIInfo;
41
-
42
- /**
43
- * List of API paths
44
- */
45
- paths: any;
46
-
47
- components?: {
48
- schemas?: { [name: string]: JSONSchema7 }
49
- };
50
-
51
- /**
52
- * constructor
53
- */
54
- constructor() {
55
- this.openapi = "3.0.0";
56
- this.info = new APIInfo();
57
- this.paths = {};
58
- }
59
-
60
-
61
-
62
- }
63
-
64
- /**
65
- * API information specification
66
- */
67
- export class APIInfo {
68
- /**
69
- * API Version
70
- */
71
- version: string;
72
- /**
73
- * API Title
74
- */
75
- title: string;
76
-
77
- constructor() {
78
- this.version = "1.0.0";
79
- this.title = "";
80
- }
81
- }
82
-
83
- export class APIController {
84
- description: string;
85
-
86
- requestBody: any | null;
87
-
88
- parameters: APIParameter[] | null;
89
- responses: any;
90
-
91
- constructor() {
92
- this.description = "";
93
- this.requestBody = null;
94
- this.parameters = null;
95
- this.responses = {};
96
- }
97
- }
98
-
99
- /**
100
- * Api parameters use for path, inquery and headers
101
- */
102
- export class APIParameter {
103
- name: string;
104
- in: string;
105
- schema: SchemaType | null;
106
- required: boolean;
107
-
108
- constructor() {
109
- this.name = "";
110
- this.in = "query";
111
- this.schema = null;
112
- this.required = false;
113
- }
114
- }
115
-
116
- /**
117
- * Open API response definition
118
- */
119
- export class APIResponse {
120
- description: string;
121
- content?: { "application/json": { schema: SchemaType; }; };
122
-
123
- constructor() {
124
- this.description = "";
125
- }
126
-
127
- }
128
- /**
129
- * Open API schema type definition
130
- */
131
- export class SchemaType {
132
-
133
- type: string;
134
-
135
- items?: object;
136
-
137
- properties?: { [key: string]: SchemaType };
138
-
139
- example?: string;
140
-
141
- constructor() {
142
- this.type = "";
143
- }
144
-
145
- }