@izara_project/izara-core-generate-service-code 1.0.28 → 1.0.30
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 +2 -2
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs +4 -4
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/handler/handlerS3/template.ejs +4 -4
- package/src/generateCode/generateInitialSetup/GenerateCodeExternalService.js +0 -1
- package/src/generateCode/generateInitialSetup/externalServiceComponent/index.js +9 -3
- package/src/generateCode/generateInitialSetup/externalServiceComponent/tableNameConfig/data.js +90 -0
- package/src/generateCode/generateInitialSetup/externalServiceComponent/tableNameConfig/template.ejs +43 -0
- package/src/generateCode/generateSchema/GenerateCodeSchema.js +13 -4
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +4 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +3 -3
- package/src/generateCode/{generateTranslation/generateTranslation.js → generateSchema/generateTextTag/index.js} +10 -7
- package/src/generateCode/{generateTranslation/translations → generateSchema/generateTextTag/systemText}/data.js +46 -11
- package/src/generateCode/generateSchema/rbac/dynamoDb/data.js +112 -0
- package/src/generateCode/generateSchema/rbac/index.js +74 -0
- package/src/generateCode/generateSchema/rbac/lambda/authApi/data.js +69 -0
- package/src/generateCode/generateSchema/rbac/lambda/authApi/templateInv.ejs +52 -0
- package/src/generateCode/generateSchema/rbac/lambda/authInv/handler/data.js +70 -0
- package/src/generateCode/generateSchema/rbac/lambda/authInv/handler/templateInv.ejs +52 -0
- package/src/generateCode/generateSchema/rbac/lambda/authInv/mainFunction/data.js +82 -0
- package/src/generateCode/generateSchema/rbac/lambda/authInv/mainFunction/template.ejs +42 -0
- package/src/generateCode/generateSchema/rbac/lambda/yaml/data.js +128 -0
- package/src/generateCode/generateSchema/rbac/lambda/yaml/template.ejs +6 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/action/mainFunction/template.ejs +36 -12
- package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/action/mainFunction/template.ejs +10 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/mainFunction/template.ejs +6 -6
- package/src/generateCode.js +5 -12
- package/src/libs/Consts.js +10 -4
- package/src/libs/Libs.js +7 -1
- /package/src/generateCode/{generateTranslation/translations → generateSchema/generateTextTag/systemText}/template.ejs +0 -0
package/src/generateCode.js
CHANGED
|
@@ -37,7 +37,6 @@ import generateTemplateDataInitialSetup from './generateCode/generateInitialSetu
|
|
|
37
37
|
import generateTemplateDataOther from './generateCode/generateOther/generateCodeOther.js';
|
|
38
38
|
|
|
39
39
|
import generateTemplateDataRole from './generateCode/generateRole/generateCodeRole.js';
|
|
40
|
-
import generateTemplateTranslations from './generateCode/generateTranslation/generateTranslation.js';
|
|
41
40
|
|
|
42
41
|
const __filename = fileURLToPath(import.meta.url);
|
|
43
42
|
const __dirname = dirname(__filename);
|
|
@@ -73,14 +72,15 @@ async function generateCodeWithTemplate(
|
|
|
73
72
|
// ── 1. Fetch all schemas ─────────────────────────────────────────────────
|
|
74
73
|
console.info('[INFO] [generateCode] STATUS=FETCHING | schemas...');
|
|
75
74
|
const fetchStartTime = Date.now();
|
|
76
|
-
const [allLocalFlowSchemas, allObjSchemas, allLocalRelationshipSchemas] =
|
|
75
|
+
const [allLocalFlowSchemas, allObjSchemas, allLocalRelationshipSchemas, allLocalNotificationSystem] =
|
|
77
76
|
await Promise.all([
|
|
78
77
|
getObjectSchema.getAllLocalFlowSchemas(_izContext, schemasPath),
|
|
79
78
|
getObjectSchema.getAllLocalObjectSchemasWithHierarchy(
|
|
80
79
|
_izContext,
|
|
81
80
|
schemasPath
|
|
82
81
|
),
|
|
83
|
-
getObjectSchema.getAllLocalRelationshipSchema(_izContext, schemasPath)
|
|
82
|
+
getObjectSchema.getAllLocalRelationshipSchema(_izContext, schemasPath),
|
|
83
|
+
getObjectSchema.getLocalNotificationSystemSchemas(_izContext, schemasPath)
|
|
84
84
|
]);
|
|
85
85
|
|
|
86
86
|
const fetchDuration = Date.now() - fetchStartTime;
|
|
@@ -98,7 +98,6 @@ async function generateCodeWithTemplate(
|
|
|
98
98
|
schemaResult,
|
|
99
99
|
initialSetupResult,
|
|
100
100
|
otherResult,
|
|
101
|
-
translationResult
|
|
102
101
|
] = await Promise.all([
|
|
103
102
|
generateTemplateDataFromFlowSchema(
|
|
104
103
|
_izContext,
|
|
@@ -112,6 +111,7 @@ async function generateCodeWithTemplate(
|
|
|
112
111
|
allObjSchemas,
|
|
113
112
|
allLocalRelationshipSchemas,
|
|
114
113
|
allLocalFlowSchemas.records,
|
|
114
|
+
allLocalNotificationSystem,
|
|
115
115
|
settings
|
|
116
116
|
).catch(error => {
|
|
117
117
|
console.error('[generateCode] schemaResult error:', error);
|
|
@@ -126,13 +126,7 @@ async function generateCodeWithTemplate(
|
|
|
126
126
|
allLocalFlowSchemas.records,
|
|
127
127
|
settings
|
|
128
128
|
),
|
|
129
|
-
generateTemplateDataOther(_izContext, appPath)
|
|
130
|
-
generateTemplateTranslations(
|
|
131
|
-
_izContext,
|
|
132
|
-
appPath,
|
|
133
|
-
allObjSchemas,
|
|
134
|
-
allLocalFlowSchemas
|
|
135
|
-
)
|
|
129
|
+
generateTemplateDataOther(_izContext, appPath)
|
|
136
130
|
]);
|
|
137
131
|
|
|
138
132
|
const genDuration = Date.now() - genStartTime;
|
|
@@ -146,7 +140,6 @@ async function generateCodeWithTemplate(
|
|
|
146
140
|
...schemaResult,
|
|
147
141
|
...initialSetupResult,
|
|
148
142
|
...otherResult,
|
|
149
|
-
...translationResult
|
|
150
143
|
];
|
|
151
144
|
|
|
152
145
|
// ── 3. Generate role configs ─────────────────────────────────────────────
|
package/src/libs/Consts.js
CHANGED
|
@@ -93,8 +93,12 @@ const SOURCE_PATH = {
|
|
|
93
93
|
resourceLocationCreateRecordComplete:
|
|
94
94
|
'src/generatedCode/CreateRecordComplete/',
|
|
95
95
|
|
|
96
|
-
//
|
|
97
|
-
|
|
96
|
+
// systemText
|
|
97
|
+
systemTextSchema: 'SystemTextSchema/generatedCode/',
|
|
98
|
+
|
|
99
|
+
// rbac
|
|
100
|
+
rbac: '/src/generatedCode/Rbac/source/',
|
|
101
|
+
resourceLocationRbac: 'src/generatedCode/Rbac/source/'
|
|
98
102
|
};
|
|
99
103
|
|
|
100
104
|
const SQS_RESOURCE = {
|
|
@@ -146,16 +150,18 @@ const SAVE_FILE_NAME = {
|
|
|
146
150
|
sharedResourceYaml: 'generate-shared-resource',
|
|
147
151
|
authorizerYaml: 'authorizer',
|
|
148
152
|
findData: 'find-data',
|
|
153
|
+
rbac: 'rbac',
|
|
149
154
|
|
|
150
155
|
externalLambdaRole: 'generatedLambdaRoleServiceConfig',
|
|
151
156
|
snsSubscription: 'generatedSnsServiceConfig',
|
|
152
|
-
|
|
157
|
+
tableName: "generatedTableNameConfig",
|
|
158
|
+
// translateId: 'TranslateIdsRequest',
|
|
153
159
|
S3Bucket: 'generated-s3-bucket',
|
|
154
160
|
objectRelationship: 'ObjectRelationships',
|
|
155
161
|
refObjectRelationship: 'RefObjectRelationships',
|
|
156
162
|
objectSchema: 'ObjectFieldSchema',
|
|
157
163
|
roleNameConfig: 'RoleNameConfig',
|
|
158
|
-
|
|
164
|
+
systemTextSchema: 'SystemTextSchema'
|
|
159
165
|
};
|
|
160
166
|
|
|
161
167
|
const FUNCTION_NAME = {
|
package/src/libs/Libs.js
CHANGED
|
@@ -50,7 +50,9 @@ function resourceNames(resourceClass, resourceName) {
|
|
|
50
50
|
'arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:${self:custom.iz_resourcePrefix}' +
|
|
51
51
|
resourceName,
|
|
52
52
|
[RESOURCE_CLASSES.webSocket]:
|
|
53
|
-
'arn:aws:execute-api:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_webSocketHostId}/${self:custom.iz_stage}/POST/@connections/{connectionId}'
|
|
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
|
+
[RESOURCE_CLASSES.s3]:
|
|
55
|
+
'arn:aws:s3:::${self:custom.iz_serviceSchemaBucketName}/' + resourceName,
|
|
54
56
|
}[resourceClass];
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -62,6 +64,10 @@ function resourceNames(resourceClass, resourceName) {
|
|
|
62
64
|
* @returns {{ effect, action, resource}}
|
|
63
65
|
*/
|
|
64
66
|
function createIamRole(action, resource = [], effect = 'Allow') {
|
|
67
|
+
if (!Array.isArray(resource)) {
|
|
68
|
+
resource = [resource];
|
|
69
|
+
};
|
|
70
|
+
|
|
65
71
|
if (Array.isArray(action)) {
|
|
66
72
|
const actionObj = {};
|
|
67
73
|
action.forEach(act => {
|