@codenotch/codenotch.cli 1.0.35 → 1.0.36

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 (75) hide show
  1. package/dist/commands/generate/index.d.ts +3 -0
  2. package/dist/commands/generate/index.js +42 -0
  3. package/dist/commands/generate/index.js.map +1 -0
  4. package/dist/commands/index.js +2 -0
  5. package/dist/commands/index.js.map +1 -1
  6. package/dist/commands/project/new.js +32 -124
  7. package/dist/commands/project/new.js.map +1 -1
  8. package/dist/commands/system/info.js +0 -7
  9. package/dist/commands/system/info.js.map +1 -1
  10. package/dist/commands/validation/ValidationUtils.d.ts +3 -13
  11. package/dist/commands/validation/ValidationUtils.js +2 -58
  12. package/dist/commands/validation/ValidationUtils.js.map +1 -1
  13. package/dist/commands/validation/files/AppManifestValidator.js +5 -20
  14. package/dist/commands/validation/files/AppManifestValidator.js.map +1 -1
  15. package/dist/commands/validation/files/ScriptValidator.d.ts +6 -2
  16. package/dist/commands/validation/files/ScriptValidator.js.map +1 -1
  17. package/dist/commands/validation/validate.js +8 -44
  18. package/dist/commands/validation/validate.js.map +1 -1
  19. package/dist/models/Codenotch.d.ts +0 -205
  20. package/dist/models/Codenotch.js +0 -211
  21. package/dist/models/Codenotch.js.map +1 -1
  22. package/dist/utils/BuildUtils.d.ts +5 -21
  23. package/dist/utils/BuildUtils.js +4 -109
  24. package/dist/utils/BuildUtils.js.map +1 -1
  25. package/dist/utils/ConsoleUtils.d.ts +5 -0
  26. package/dist/utils/ConsoleUtils.js +25 -0
  27. package/dist/utils/ConsoleUtils.js.map +1 -1
  28. package/dist/utils/GitHubAuthUtils.js.map +1 -1
  29. package/dist/utils/ManifestUtils.d.ts +24 -0
  30. package/dist/utils/ManifestUtils.js +53 -0
  31. package/dist/utils/ManifestUtils.js.map +1 -0
  32. package/dist/utils/ProjectCompilationUtils.d.ts +4 -30
  33. package/dist/utils/ProjectCompilationUtils.js +64 -750
  34. package/dist/utils/ProjectCompilationUtils.js.map +1 -1
  35. package/dist/utils/ProjectUtils.d.ts +2 -2
  36. package/dist/utils/ProjectUtils.js +0 -29
  37. package/dist/utils/ProjectUtils.js.map +1 -1
  38. package/dist/utils/ServeUtils.d.ts +0 -1
  39. package/dist/utils/ServeUtils.js +1 -24
  40. package/dist/utils/ServeUtils.js.map +1 -1
  41. package/dist/utils/ShellUtils.js.map +1 -1
  42. package/package.json +2 -3
  43. package/dist/commands/validation/files/BpmnValidator.d.ts +0 -5
  44. package/dist/commands/validation/files/BpmnValidator.js +0 -32
  45. package/dist/commands/validation/files/BpmnValidator.js.map +0 -1
  46. package/dist/commands/validation/files/DbSchemaValidator.d.ts +0 -5
  47. package/dist/commands/validation/files/DbSchemaValidator.js +0 -16
  48. package/dist/commands/validation/files/DbSchemaValidator.js.map +0 -1
  49. package/dist/commands/validation/files/DocumentValidator.d.ts +0 -5
  50. package/dist/commands/validation/files/DocumentValidator.js +0 -12
  51. package/dist/commands/validation/files/DocumentValidator.js.map +0 -1
  52. package/dist/commands/validation/files/I18nValidator.d.ts +0 -5
  53. package/dist/commands/validation/files/I18nValidator.js +0 -13
  54. package/dist/commands/validation/files/I18nValidator.js.map +0 -1
  55. package/dist/commands/validation/files/ManifestCacheValidator.d.ts +0 -5
  56. package/dist/commands/validation/files/ManifestCacheValidator.js +0 -121
  57. package/dist/commands/validation/files/ManifestCacheValidator.js.map +0 -1
  58. package/dist/commands/validation/files/ManifestValidator.d.ts +0 -5
  59. package/dist/commands/validation/files/ManifestValidator.js +0 -14
  60. package/dist/commands/validation/files/ManifestValidator.js.map +0 -1
  61. package/dist/commands/validation/files/TableValidator.d.ts +0 -5
  62. package/dist/commands/validation/files/TableValidator.js +0 -19
  63. package/dist/commands/validation/files/TableValidator.js.map +0 -1
  64. package/dist/models/DbModels.d.ts +0 -221
  65. package/dist/models/DbModels.js +0 -130
  66. package/dist/models/DbModels.js.map +0 -1
  67. package/dist/models/OpenApiModels.d.ts +0 -115
  68. package/dist/models/OpenApiModels.js +0 -103
  69. package/dist/models/OpenApiModels.js.map +0 -1
  70. package/dist/utils/I18nUtils.d.ts +0 -9
  71. package/dist/utils/I18nUtils.js +0 -54
  72. package/dist/utils/I18nUtils.js.map +0 -1
  73. package/dist/utils/OpenAPIUtils.d.ts +0 -33
  74. package/dist/utils/OpenAPIUtils.js +0 -279
  75. package/dist/utils/OpenAPIUtils.js.map +0 -1
@@ -1,221 +0,0 @@
1
- import { JSONSchema7 } from "json-schema";
2
- export declare enum FieldType {
3
- STRING = 0,
4
- NUMBER = 1,// Float
5
- INTEGER = 2,
6
- BOOL = 3,
7
- LIST = 4,// aka array
8
- MAP = 5
9
- }
10
- /**
11
- * Used only to save JSON .table file in scenar.io later
12
- * given to DatabaseMigrationGenerator to compute XML migration
13
- */
14
- export interface TableDefinition {
15
- Name: string;
16
- Description: string;
17
- Id: IdField;
18
- CreatedAt: CreatedAtField;
19
- UpdatedAt: UpdatedAtField;
20
- Fields?: BaseFieldType[];
21
- AccessPolicy: ContainerAccessSettings;
22
- RetentionPolicy: ContainerRetentionPolicy;
23
- PatchSettings: ContainerPatchSettings;
24
- }
25
- /**
26
- * All SQL field types
27
- */
28
- export declare enum FieldTypes {
29
- Guid = "Guid",
30
- Boolean = "Boolean",
31
- String = "String",
32
- Text = "Text",
33
- Email = "Email",
34
- Decimal = "Decimal",
35
- Integer = "Integer",
36
- Date = "Date",
37
- DateTime = "DateTime",
38
- Version = "Version",
39
- Enum = "Enum",
40
- AutoIncrement = "AutoIncrement",
41
- HasMany = "HasMany",
42
- HasOne = "HasOne",
43
- BelongsTo = "BelongsTo"
44
- }
45
- export interface IdField {
46
- Name: string;
47
- }
48
- export interface BaseFieldType {
49
- Name: string;
50
- Description: string;
51
- Type: FieldTypes;
52
- IsNullable: boolean;
53
- IsUnique: boolean;
54
- IsSecret: boolean;
55
- IsIndexed: boolean;
56
- IsValidated: boolean;
57
- Validation: string;
58
- }
59
- export interface BaseRelation extends BaseFieldType {
60
- Table: string;
61
- }
62
- export interface HasRelation extends BaseRelation {
63
- BelongsTo: string;
64
- LinkBehaviour: "Unlink" | "Delete" | string;
65
- }
66
- export interface HasOne extends HasRelation {
67
- }
68
- export interface HasMany extends HasRelation {
69
- }
70
- export interface BelongsTo extends BaseRelation {
71
- Key: string;
72
- }
73
- export interface GuidField extends BaseFieldType {
74
- }
75
- /**
76
- * Contains email with autovalidation
77
- */
78
- export interface EmailField extends BaseFieldType {
79
- }
80
- /**
81
- * Special SQL timestamp
82
- */
83
- export interface VersionField extends BaseFieldType {
84
- }
85
- /**
86
- * Contains date + time
87
- */
88
- export interface DateTimeField extends BaseFieldType {
89
- }
90
- /**
91
- * Contains date
92
- */
93
- export interface DateField extends BaseFieldType {
94
- }
95
- /**
96
- * Array of string
97
- */
98
- export interface EnumField extends BaseFieldType {
99
- /**
100
- *
101
- */
102
- Value: string[];
103
- }
104
- /**
105
- * Any number with Precision (How many floating numbers) and Scale (Max integer part)
106
- */
107
- export interface DecimalField extends BaseFieldType {
108
- /**
109
- *
110
- */
111
- Precision: number;
112
- /**
113
- *
114
- */
115
- Scale: number;
116
- }
117
- /**
118
- * No floating number value
119
- */
120
- export interface IntegerField extends BaseFieldType {
121
- Size: string | undefined;
122
- }
123
- /**
124
- * String > of 16b
125
- */
126
- export interface TextField extends BaseFieldType {
127
- }
128
- /**
129
- * Equivalent of VARCHAR(255)
130
- */
131
- export interface StringField extends BaseFieldType {
132
- }
133
- /**
134
- * Contains true false as a bit
135
- */
136
- export interface BooleanField extends BaseFieldType {
137
- }
138
- /**
139
- * An integer column that is auto incremented
140
- */
141
- export interface AutoIncrementField extends BaseFieldType {
142
- /**
143
- * Start value
144
- */
145
- Seed: number;
146
- /**
147
- *
148
- */
149
- Increment: number;
150
- UseBigInt?: boolean;
151
- }
152
- /**
153
- *
154
- */
155
- export interface UpdatedAtField {
156
- Name: string;
157
- }
158
- /**
159
- *
160
- */
161
- export interface CreatedAtField {
162
- Name: string;
163
- }
164
- export declare enum ContainerType {
165
- Document = "0",
166
- Sql = "1"
167
- }
168
- export default class AbstractRecordContainer {
169
- name: string;
170
- dataSourceKind: ContainerType;
171
- schema: JSONSchema7;
172
- accessPolicy: ContainerAccessSettings;
173
- retentionPolicy: ContainerRetentionPolicy;
174
- patchSettings: ContainerPatchSettings;
175
- secretFields: string[];
176
- constructor(name: string, type: ContainerType, schema: JSONSchema7, accessSettings?: ContainerAccessSettings, retentionPolicy?: ContainerRetentionPolicy, patchSettings?: ContainerPatchSettings, secretFields?: string[]);
177
- getTag(): string;
178
- }
179
- export interface CrudAccessSetting {
180
- read: 'all' | 'rls' | 'none';
181
- update: 'all' | 'rls' | 'none';
182
- delete: 'all' | 'rls' | 'none';
183
- create: 'all' | 'none';
184
- }
185
- export interface ContainerAccessSettings {
186
- internal: {
187
- [scope: string]: CrudAccessSetting;
188
- };
189
- public: CrudAccessSetting;
190
- external: CrudAccessSetting;
191
- system: {
192
- [serviceName: string]: CrudAccessSetting;
193
- };
194
- }
195
- export interface ContainerRetentionPolicy {
196
- /**
197
- * The time after which the data is purged from the datasource
198
- * If null, data never expires
199
- * Default to null
200
- */
201
- RetentionPeriod: string | null;
202
- /**
203
- * Describes the behaviour of the data upon reaching the retention period
204
- */
205
- RetentionReachedBehaviour: "DELETE";
206
- }
207
- export interface ContainerPatchSettings {
208
- /**
209
- * Time (in minutes) after which a patch can no longer be compensated
210
- */
211
- PatchExpirationMinutes: number;
212
- /**
213
- * Maximum amount of non-merged patches
214
- * When this number is reached, the oldest patch is merged and can no longer be compensated
215
- * 0 means no patch are kept for this datastore (the grain still keep a copy of the latest version of the record though)
216
- */
217
- PatchRetentionAmount: number;
218
- }
219
- export interface DatabaseSchema {
220
- Tables: TableDefinition[];
221
- }
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContainerType = exports.FieldTypes = exports.FieldType = void 0;
4
- var FieldType;
5
- (function (FieldType) {
6
- FieldType[FieldType["STRING"] = 0] = "STRING";
7
- FieldType[FieldType["NUMBER"] = 1] = "NUMBER";
8
- FieldType[FieldType["INTEGER"] = 2] = "INTEGER";
9
- FieldType[FieldType["BOOL"] = 3] = "BOOL";
10
- FieldType[FieldType["LIST"] = 4] = "LIST";
11
- FieldType[FieldType["MAP"] = 5] = "MAP"; // aka object
12
- })(FieldType || (exports.FieldType = FieldType = {}));
13
- /**
14
- * All SQL field types
15
- */
16
- var FieldTypes;
17
- (function (FieldTypes) {
18
- FieldTypes["Guid"] = "Guid";
19
- FieldTypes["Boolean"] = "Boolean";
20
- FieldTypes["String"] = "String";
21
- FieldTypes["Text"] = "Text";
22
- FieldTypes["Email"] = "Email";
23
- FieldTypes["Decimal"] = "Decimal";
24
- FieldTypes["Integer"] = "Integer";
25
- FieldTypes["Date"] = "Date";
26
- FieldTypes["DateTime"] = "DateTime";
27
- FieldTypes["Version"] = "Version";
28
- FieldTypes["Enum"] = "Enum";
29
- FieldTypes["AutoIncrement"] = "AutoIncrement";
30
- FieldTypes["HasMany"] = "HasMany";
31
- FieldTypes["HasOne"] = "HasOne";
32
- FieldTypes["BelongsTo"] = "BelongsTo";
33
- })(FieldTypes || (exports.FieldTypes = FieldTypes = {}));
34
- var ContainerType;
35
- (function (ContainerType) {
36
- ContainerType["Document"] = "0";
37
- ContainerType["Sql"] = "1";
38
- })(ContainerType || (exports.ContainerType = ContainerType = {}));
39
- // Abstraction of datastore container, provide a way to use any type of container, blob storage, sql, etc
40
- class AbstractRecordContainer {
41
- // Name and identifier
42
- name;
43
- dataSourceKind;
44
- schema;
45
- accessPolicy;
46
- retentionPolicy;
47
- patchSettings;
48
- secretFields;
49
- constructor(name, type, schema, accessSettings, retentionPolicy, patchSettings, secretFields) {
50
- this.name = name;
51
- this.dataSourceKind = type;
52
- this.schema = schema;
53
- if (accessSettings && accessSettings.public === undefined) {
54
- accessSettings = undefined;
55
- }
56
- if (accessSettings) {
57
- this.accessPolicy = accessSettings;
58
- }
59
- else {
60
- this.accessPolicy = {
61
- public: {
62
- read: 'all',
63
- update: 'all',
64
- create: 'all',
65
- delete: 'all'
66
- },
67
- external: {
68
- read: 'all',
69
- update: 'all',
70
- create: 'all',
71
- delete: 'all'
72
- },
73
- internal: {
74
- _other: {
75
- read: 'all',
76
- update: 'all',
77
- create: 'all',
78
- delete: 'all'
79
- },
80
- admin: {
81
- read: 'all',
82
- update: 'all',
83
- create: 'all',
84
- delete: 'all'
85
- },
86
- dev: {
87
- read: 'all',
88
- update: 'all',
89
- create: 'all',
90
- delete: 'all'
91
- }
92
- },
93
- system: {}
94
- };
95
- }
96
- if (retentionPolicy) {
97
- this.retentionPolicy = retentionPolicy;
98
- }
99
- else {
100
- this.retentionPolicy = {
101
- RetentionPeriod: null, // default is to never expires
102
- RetentionReachedBehaviour: "DELETE"
103
- };
104
- }
105
- if (patchSettings) {
106
- this.patchSettings = patchSettings;
107
- }
108
- else {
109
- this.patchSettings = {
110
- PatchExpirationMinutes: 1440,
111
- PatchRetentionAmount: 10
112
- };
113
- }
114
- if (secretFields) {
115
- this.secretFields = secretFields;
116
- }
117
- else {
118
- this.secretFields = [];
119
- }
120
- }
121
- // Used to display a little tag in the UI
122
- getTag() {
123
- switch (this.dataSourceKind) {
124
- case ContainerType.Document: return "json";
125
- case ContainerType.Sql: return "sql";
126
- }
127
- }
128
- }
129
- exports.default = AbstractRecordContainer;
130
- //# sourceMappingURL=DbModels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DbModels.js","sourceRoot":"","sources":["../../src/models/DbModels.ts"],"names":[],"mappings":";;;AAEA,IAAY,SAOX;AAPD,WAAY,SAAS;IACjB,6CAAM,CAAA;IACN,6CAAM,CAAA;IACN,+CAAO,CAAA;IACP,yCAAI,CAAA;IACJ,yCAAI,CAAA;IACJ,uCAAG,CAAA,CAAC,aAAa;AACrB,CAAC,EAPW,SAAS,yBAAT,SAAS,QAOpB;AAoBD;;GAEG;AACH,IAAY,UAgBX;AAhBD,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,iCA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CAAC;YAC3C,KAAK,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC;QACzC,CAAC;IACL,CAAC;CACJ;AAnGD,0CAmGC"}
@@ -1,115 +0,0 @@
1
- import { JSONSchema7 } from "json-schema";
2
- export interface IOpenApiSchemaRef {
3
- schema: {
4
- '$ref': string;
5
- };
6
- }
7
- export interface IOpenApiResponse {
8
- description?: string;
9
- content?: {
10
- [type: string]: IOpenApiSchemaRef;
11
- };
12
- }
13
- export interface IOpenApiEndpoint {
14
- description?: string;
15
- operationId?: string;
16
- responses?: {
17
- [code: string]: IOpenApiResponse;
18
- };
19
- parameters?: IOpenApiParameter[];
20
- requestBody?: {
21
- content: {
22
- [type: string]: IOpenApiSchemaRef;
23
- };
24
- description?: string;
25
- };
26
- }
27
- export interface IOpenApiParameter {
28
- description?: string;
29
- in: string;
30
- name: string;
31
- required: boolean;
32
- schema: JSONSchema7;
33
- }
34
- /**
35
- * Open api version 3.0
36
- */
37
- export default class OpenAPISpec {
38
- /**
39
- * Describe open API version
40
- */
41
- openapi: string;
42
- /**
43
- * Api information
44
- * version, title and license
45
- */
46
- info: APIInfo;
47
- /**
48
- * List of API paths
49
- */
50
- paths: any;
51
- components?: {
52
- schemas?: {
53
- [name: string]: JSONSchema7;
54
- };
55
- };
56
- /**
57
- * constructor
58
- */
59
- constructor();
60
- }
61
- /**
62
- * API information specification
63
- */
64
- export declare class APIInfo {
65
- /**
66
- * API Version
67
- */
68
- version: string;
69
- /**
70
- * API Title
71
- */
72
- title: string;
73
- constructor();
74
- }
75
- export declare class APIController {
76
- description: string;
77
- requestBody: any | null;
78
- parameters: APIParameter[] | null;
79
- responses: any;
80
- constructor();
81
- }
82
- /**
83
- * Api parameters use for path, inquery and headers
84
- */
85
- export declare class APIParameter {
86
- name: string;
87
- in: string;
88
- schema: SchemaType | null;
89
- required: boolean;
90
- constructor();
91
- }
92
- /**
93
- * Open API response definition
94
- */
95
- export declare class APIResponse {
96
- description: string;
97
- content?: {
98
- "application/json": {
99
- schema: SchemaType;
100
- };
101
- };
102
- constructor();
103
- }
104
- /**
105
- * Open API schema type definition
106
- */
107
- export declare class SchemaType {
108
- type: string;
109
- items?: object;
110
- properties?: {
111
- [key: string]: SchemaType;
112
- };
113
- example?: string;
114
- constructor();
115
- }
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaType = exports.APIResponse = exports.APIParameter = exports.APIController = exports.APIInfo = void 0;
4
- /**
5
- * Open api version 3.0
6
- */
7
- class OpenAPISpec {
8
- /**
9
- * Describe open API version
10
- */
11
- openapi;
12
- /**
13
- * Api information
14
- * version, title and license
15
- */
16
- info;
17
- /**
18
- * List of API paths
19
- */
20
- paths;
21
- components;
22
- /**
23
- * constructor
24
- */
25
- constructor() {
26
- this.openapi = "3.0.0";
27
- this.info = new APIInfo();
28
- this.paths = {};
29
- }
30
- }
31
- exports.default = OpenAPISpec;
32
- /**
33
- * API information specification
34
- */
35
- class APIInfo {
36
- /**
37
- * API Version
38
- */
39
- version;
40
- /**
41
- * API Title
42
- */
43
- title;
44
- constructor() {
45
- this.version = "1.0.0";
46
- this.title = "";
47
- }
48
- }
49
- exports.APIInfo = APIInfo;
50
- class APIController {
51
- description;
52
- requestBody;
53
- parameters;
54
- responses;
55
- constructor() {
56
- this.description = "";
57
- this.requestBody = null;
58
- this.parameters = null;
59
- this.responses = {};
60
- }
61
- }
62
- exports.APIController = APIController;
63
- /**
64
- * Api parameters use for path, inquery and headers
65
- */
66
- class APIParameter {
67
- name;
68
- in;
69
- schema;
70
- required;
71
- constructor() {
72
- this.name = "";
73
- this.in = "query";
74
- this.schema = null;
75
- this.required = false;
76
- }
77
- }
78
- exports.APIParameter = APIParameter;
79
- /**
80
- * Open API response definition
81
- */
82
- class APIResponse {
83
- description;
84
- content;
85
- constructor() {
86
- this.description = "";
87
- }
88
- }
89
- exports.APIResponse = APIResponse;
90
- /**
91
- * Open API schema type definition
92
- */
93
- class SchemaType {
94
- type;
95
- items;
96
- properties;
97
- example;
98
- constructor() {
99
- this.type = "";
100
- }
101
- }
102
- exports.SchemaType = SchemaType;
103
- //# sourceMappingURL=OpenApiModels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OpenApiModels.js","sourceRoot":"","sources":["../../src/models/OpenApiModels.ts"],"names":[],"mappings":";;;AA2BA;;GAEG;AACH,MAAqB,WAAW;IAC5B;;OAEG;IACH,OAAO,CAAS;IAChB;;;OAGG;IACH,IAAI,CAAU;IAEd;;OAEG;IACH,KAAK,CAAM;IAEX,UAAU,CAER;IAEF;;OAEG;IACH;QACI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACpB,CAAC;CAIJ;AA/BD,8BA+BC;AAED;;GAEG;AACH,MAAa,OAAO;IAChB;;OAEG;IACH,OAAO,CAAS;IAChB;;OAEG;IACH,KAAK,CAAS;IAEd;QACI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACpB,CAAC;CACJ;AAdD,0BAcC;AAED,MAAa,aAAa;IACtB,WAAW,CAAS;IAEpB,WAAW,CAAa;IAExB,UAAU,CAAwB;IAClC,SAAS,CAAM;IAEf;QACI,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;CACJ;AAdD,sCAcC;AAED;;GAEG;AACH,MAAa,YAAY;IACrB,IAAI,CAAS;IACb,EAAE,CAAS;IACX,MAAM,CAAoB;IAC1B,QAAQ,CAAU;IAElB;QACI,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1B,CAAC;CACJ;AAZD,oCAYC;AAED;;GAEG;AACH,MAAa,WAAW;IACpB,WAAW,CAAS;IACpB,OAAO,CAAoD;IAE3D;QACI,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;CAEJ;AARD,kCAQC;AACD;;GAEG;AACH,MAAa,UAAU;IAEnB,IAAI,CAAS;IAEb,KAAK,CAAU;IAEf,UAAU,CAAiC;IAE3C,OAAO,CAAU;IAEjB;QACI,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;CAEJ;AAdD,gCAcC"}
@@ -1,9 +0,0 @@
1
- export default abstract class I18nUtils {
2
- static getAllI18nFiles(folderPath: string): Promise<{
3
- key: string;
4
- values: {
5
- lang: string;
6
- value: string;
7
- }[];
8
- }[]>;
9
- }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = require("fs");
7
- const FileUtils_1 = __importDefault(require("./FileUtils"));
8
- const papaparse_1 = __importDefault(require("papaparse"));
9
- class I18nUtils {
10
- static async getAllI18nFiles(folderPath) {
11
- let files = FileUtils_1.default.getAllFilesFromPath(folderPath, ['.codenotch', 'node_modules', 'dist', 'build']).filter(c => c.endsWith('.i18n.csv'));
12
- let allLines = [];
13
- for (let file of files) {
14
- // parse
15
- let config = { header: true };
16
- let content = (0, fs_1.readFileSync)(file, { encoding: "utf-8" });
17
- let lines = papaparse_1.default.parse(content, config).data;
18
- if (lines.length === 0)
19
- continue;
20
- for (let line of lines) {
21
- let masterLine = allLines.find(c => c.key === line.key);
22
- if (masterLine === undefined) {
23
- masterLine = {
24
- key: line.key,
25
- values: []
26
- };
27
- allLines.push(masterLine);
28
- }
29
- let langs = Object.keys(line).filter(c => c !== 'key');
30
- for (let lang of langs) {
31
- let value = line[lang];
32
- if (typeof value === 'string' && value.trim() !== '') {
33
- if (masterLine.values.find(c => c.lang === lang) === undefined) {
34
- masterLine.values.push({
35
- lang,
36
- value
37
- });
38
- }
39
- else {
40
- // Duplicate value for language 'lang'
41
- }
42
- }
43
- }
44
- }
45
- }
46
- for (let line of allLines) {
47
- line.values = line.values.sort((a, b) => a.lang.localeCompare(b.lang));
48
- }
49
- allLines = allLines.sort((a, b) => a.key.localeCompare(b.key));
50
- return allLines;
51
- }
52
- }
53
- exports.default = I18nUtils;
54
- //# sourceMappingURL=I18nUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"I18nUtils.js","sourceRoot":"","sources":["../../src/utils/I18nUtils.ts"],"names":[],"mappings":";;;;;AAAA,2BAAkC;AAClC,4DAAoC;AACpC,0DAA6B;AAE7B,MAA8B,SAAS;IAG5B,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,UAAkB;QAClD,IAAI,KAAK,GAAG,mBAAS,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;QAC5I,IAAI,QAAQ,GAAiE,EAAE,CAAC;QAChF,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YAErB,QAAQ;YACR,IAAI,MAAM,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YAC9B,IAAI,OAAO,GAAG,IAAA,iBAAY,EAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YACxD,IAAI,KAAK,GAAG,mBAAI,CAAC,KAAK,CAA6B,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC;YACzE,IAAI,KAAK,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IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3E,CAAC;QACD,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,QAAQ,CAAC;IACpB,CAAC;CAGJ;AAlDD,4BAkDC"}
@@ -1,33 +0,0 @@
1
- import OpenAPISpec, { APIParameter, SchemaType } from "../models/OpenApiModels";
2
- import { CompilationContext } from "./ProjectCompilationUtils";
3
- import { IVariable } from "@codenotch/codenotch.core";
4
- import { IProcess, IWorkflowItem } from "@codenotch/codenotch.core.workflow";
5
- export declare abstract class OpenApiUtils {
6
- static generateOpenApi(context: CompilationContext): Promise<OpenAPISpec | undefined>;
7
- /**
8
- * Convert codevariable object to openapi json standard
9
- * @param codevariable Code variable object
10
- * @returns the converted object
11
- */
12
- static CodeVariableToOpenAPISchema(codevariable: IVariable): SchemaType;
13
- /**
14
- * Return parameters from codevariables
15
- * @param codevariable the codevariable source
16
- * @param intype
17
- * @param required
18
- * @returns
19
- */
20
- static CodevariableToParameters(codevariable: IVariable, intype: string, required: boolean): APIParameter[];
21
- /**
22
- * Browse the graph recursivly to find api error or api end event
23
- * @param item the start node
24
- * @param model the entire bpmn model
25
- * @returns the list of node to convert into openapi
26
- */
27
- static BrowseResponses(item: IWorkflowItem, model: IProcess): IWorkflowItem[] | null;
28
- /**
29
- * Add bpmn model into open api spec
30
- * @param model Bpmn definition model
31
- */
32
- static AddBPMN(spec: OpenAPISpec, model: IProcess): boolean;
33
- }