@izara_project/izara-core-generate-service-code 1.0.32 → 1.0.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Code for locally generating per service files",
5
5
  "author": "Sven Mason <thebarbariansven@gmail.com>",
6
6
  "license": "AGPL-3.0-or-later",
@@ -72,19 +72,23 @@ async function generateCodeWithTemplate(
72
72
  // ── 1. Fetch all schemas ─────────────────────────────────────────────────
73
73
  console.info('[INFO] [generateCode] STATUS=FETCHING | schemas...');
74
74
  const fetchStartTime = Date.now();
75
- const [allLocalFlowSchemas, allObjSchemas, allLocalRelationshipSchemas, allLocalNotificationSystem] =
76
- await Promise.all([
77
- getObjectSchema.getAllLocalFlowSchemas(_izContext, schemasPath),
78
- getObjectSchema.getAllLocalObjectSchemasWithHierarchy(
79
- _izContext,
80
- schemasPath
81
- ),
82
- getObjectSchema.getAllLocalRelationshipSchema(_izContext, schemasPath),
83
- getObjectSchema.getLocalNotificationSystemSchemas(_izContext, schemasPath)
84
- ]);
75
+ const [
76
+ allLocalFlowSchemas,
77
+ allObjSchemas,
78
+ allLocalRelationshipSchemas,
79
+ allLocalNotificationSystem
80
+ ] = await Promise.all([
81
+ getObjectSchema.getAllLocalFlowSchemas(_izContext, schemasPath),
82
+ getObjectSchema.getAllLocalObjectSchemasWithHierarchy(
83
+ _izContext,
84
+ schemasPath
85
+ ),
86
+ getObjectSchema.getAllLocalRelationshipSchema(_izContext, schemasPath),
87
+ getObjectSchema.getLocalNotificationSystemSchemas(_izContext, schemasPath)
88
+ ]);
85
89
 
86
90
  const fetchDuration = Date.now() - fetchStartTime;
87
- const fetchStr = `flow=${allLocalFlowSchemas.records?.length ?? 0} obj=${allObjSchemas.records?.length ?? 0} rel=${allLocalRelationshipSchemas.records?.length ?? 0}`;
91
+ const fetchStr = `flow=${allLocalFlowSchemas.records?.length ?? 0} obj=${allObjSchemas.records?.length ?? 0} rel=${allLocalRelationshipSchemas.length ?? 0}`;
88
92
  console.info(
89
93
  `[INFO] [generateCode] STATUS=FETCHED | ${fetchStr.padEnd(40)} | elapsedMs=${fetchDuration}`
90
94
  );
@@ -93,41 +97,37 @@ async function generateCodeWithTemplate(
93
97
  console.info('[INFO] [generateCode] STATUS=GENERATING| template data...');
94
98
  _izContext.logger.info('[generateCode] generating template data...');
95
99
  const genStartTime = Date.now();
96
- const [
97
- flowSchemaResult,
98
- schemaResult,
99
- initialSetupResult,
100
- otherResult,
101
- ] = await Promise.all([
102
- generateTemplateDataFromFlowSchema(
103
- _izContext,
104
- appPath,
105
- allLocalFlowSchemas.records,
106
- settings
107
- ),
108
- generateTemplateDataFromSchema(
109
- _izContext,
110
- appPath,
111
- allObjSchemas,
112
- allLocalRelationshipSchemas,
113
- allLocalFlowSchemas.records,
114
- allLocalNotificationSystem,
115
- settings
116
- ).catch(error => {
117
- console.error('[generateCode] schemaResult error:', error);
118
- _izContext.logger.error('[generateCode] schemaResult error:', error);
119
- return [];
120
- }),
121
- generateTemplateDataInitialSetup(
122
- _izContext,
123
- appPath,
124
- allObjSchemas.records,
125
- allLocalRelationshipSchemas,
126
- allLocalFlowSchemas.records,
127
- settings
128
- ),
129
- generateTemplateDataOther(_izContext, appPath)
130
- ]);
100
+ const [flowSchemaResult, schemaResult, initialSetupResult, otherResult] =
101
+ await Promise.all([
102
+ generateTemplateDataFromFlowSchema(
103
+ _izContext,
104
+ appPath,
105
+ allLocalFlowSchemas.records,
106
+ settings
107
+ ),
108
+ generateTemplateDataFromSchema(
109
+ _izContext,
110
+ appPath,
111
+ allObjSchemas,
112
+ allLocalRelationshipSchemas,
113
+ allLocalFlowSchemas.records,
114
+ allLocalNotificationSystem,
115
+ settings
116
+ ).catch(error => {
117
+ console.error('[generateCode] schemaResult error:', error);
118
+ _izContext.logger.error('[generateCode] schemaResult error:', error);
119
+ return [];
120
+ }),
121
+ generateTemplateDataInitialSetup(
122
+ _izContext,
123
+ appPath,
124
+ allObjSchemas.records,
125
+ allLocalRelationshipSchemas,
126
+ allLocalFlowSchemas.records,
127
+ settings
128
+ ),
129
+ generateTemplateDataOther(_izContext, appPath)
130
+ ]);
131
131
 
132
132
  const genDuration = Date.now() - genStartTime;
133
133
  const genStr = `flow=${flowSchemaResult.length} sch=${schemaResult.length} setup=${initialSetupResult.length} other=${otherResult.length}`;
@@ -139,7 +139,7 @@ async function generateCodeWithTemplate(
139
139
  ...flowSchemaResult,
140
140
  ...schemaResult,
141
141
  ...initialSetupResult,
142
- ...otherResult,
142
+ ...otherResult
143
143
  ];
144
144
 
145
145
  // ── 3. Generate role configs ─────────────────────────────────────────────
package/src/libs/Libs.js CHANGED
@@ -52,7 +52,7 @@ function resourceNames(resourceClass, resourceName) {
52
52
  [RESOURCE_CLASSES.webSocket]:
53
53
  'arn:aws:execute-api:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_webSocketHostId}/${self:custom.iz_stage}/POST/@connections/{connectionId}',
54
54
  [RESOURCE_CLASSES.s3]:
55
- 'arn:aws:s3:::${self:custom.iz_serviceSchemaBucketName}/' + resourceName,
55
+ 'arn:aws:s3:::${self:custom.iz_serviceSchemaBucketName}/' + resourceName
56
56
  }[resourceClass];
57
57
  }
58
58
 
@@ -66,7 +66,7 @@ function resourceNames(resourceClass, resourceName) {
66
66
  function createIamRole(action, resource = [], effect = 'Allow') {
67
67
  if (!Array.isArray(resource)) {
68
68
  resource = [resource];
69
- };
69
+ }
70
70
 
71
71
  if (Array.isArray(action)) {
72
72
  const actionObj = {};
@@ -187,24 +187,15 @@ function defaultIamRolePerAction() {
187
187
  ]
188
188
  },
189
189
  [
190
- resourceNames(
191
- RESOURCE_CLASSES.s3,
192
- '${self:custom.iz_serviceSchemaBucketName}/perServiceSchemas/*'
193
- ),
194
- resourceNames(
195
- RESOURCE_CLASSES.s3,
196
- '${self:custom.iz_serviceSchemaBucketName}/serviceConfig/GraphServerTags.json'
197
- )
190
+ resourceNames(RESOURCE_CLASSES.s3, 'perServiceSchemas/*'),
191
+ resourceNames(RESOURCE_CLASSES.s3, 'serviceConfig/GraphServerTags.json')
198
192
  ]
199
193
  )
200
194
  );
201
195
 
202
196
  defaultIamRole.push(
203
197
  createIamRole({ [RESOURCE_CLASSES.s3]: [S3_RESOURCE.listBucket] }, [
204
- resourceNames(
205
- RESOURCE_CLASSES.s3,
206
- '${self:custom.iz_serviceSchemaBucketName}'
207
- )
198
+ resourceNames(RESOURCE_CLASSES.s3, '*')
208
199
  ])
209
200
  );
210
201