@izara_project/izara-market-library-service-schemas 1.0.59 → 1.0.60
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 +3 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +5 -5
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +24 -24
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +1 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +16 -6
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-market-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"@izara_project/izara-core-library-core": "^1.0.20",
|
|
25
25
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
26
26
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
27
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
27
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.90",
|
|
28
28
|
"@izara_project/izara-core-library-sns": "^1.0.6",
|
|
29
29
|
"@izara_project/izara-core-library-sqs": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-shared": "^1.0.126",
|
|
31
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
31
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.29",
|
|
32
32
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
33
33
|
"ejs": "^3.1.10",
|
|
34
34
|
"js-beautify": "^1.15.4",
|
|
@@ -72,7 +72,7 @@ function validateSchemaMiddleware(
|
|
|
72
72
|
middleware,
|
|
73
73
|
// objectType,
|
|
74
74
|
action,
|
|
75
|
-
bucketName =
|
|
75
|
+
bucketName = process.env.iz_serviceSchemaBucketName
|
|
76
76
|
// setting = {}
|
|
77
77
|
) {
|
|
78
78
|
|
|
@@ -108,7 +108,7 @@ async function validateSchemaPerRecord(
|
|
|
108
108
|
lambdaFunctionName,
|
|
109
109
|
objType,
|
|
110
110
|
action,
|
|
111
|
-
setting = { bucketName:
|
|
111
|
+
setting = { bucketName: process.env.iz_serviceSchemaBucketName, specificFieldNames: [] }
|
|
112
112
|
) {
|
|
113
113
|
try {
|
|
114
114
|
record._izContext.logger.debug("validateSchemaPerRecord: ",
|
|
@@ -350,7 +350,7 @@ async function messageToDlq(record, messageFailError, queueUrl) {
|
|
|
350
350
|
* @param {Object} _izContext
|
|
351
351
|
* @param {Object} objectSchema
|
|
352
352
|
*/
|
|
353
|
-
async function createGetDataDetails(_izContext, objectSchema, settings = { bucketName:
|
|
353
|
+
async function createGetDataDetails(_izContext, objectSchema, settings = { bucketName: process.env.iz_serviceSchemaBucketName }) {
|
|
354
354
|
|
|
355
355
|
// group versionedData per storageTag
|
|
356
356
|
// or should group versionedData per graph serviceTag
|
|
@@ -546,7 +546,7 @@ async function createGetDataDetails(_izContext, objectSchema, settings = { bucke
|
|
|
546
546
|
* @param {Object} objectSchema
|
|
547
547
|
* @param {Object} reqIdentifiers - input identifier from calling function
|
|
548
548
|
*/
|
|
549
|
-
async function generateDynamoDbIdentifiers(_izContext, objectSchema, reqIdentifiers, bucketName =
|
|
549
|
+
async function generateDynamoDbIdentifiers(_izContext, objectSchema, reqIdentifiers, bucketName = process.env.iz_serviceSchemaBucketName) {
|
|
550
550
|
|
|
551
551
|
// start create identifiers for dynamo
|
|
552
552
|
let dynamoIdentifiers = {};
|
|
@@ -617,7 +617,7 @@ const generateDynamoDbIdentifiersWithCache = inMemoryCacheLib(
|
|
|
617
617
|
* @param {Object} dynamoStorageResource
|
|
618
618
|
* @param {Object} reqIdentifiers
|
|
619
619
|
*/
|
|
620
|
-
async function dynamoDbIdentifiersByStorageResource(_izContext, objectSchema, dynamoStorageResource, reqIdentifiers, bucketName =
|
|
620
|
+
async function dynamoDbIdentifiersByStorageResource(_izContext, objectSchema, dynamoStorageResource, reqIdentifiers, bucketName = process.env.iz_serviceSchemaBucketName) {
|
|
621
621
|
|
|
622
622
|
let dynamoIdentifiers = await generateDynamoDbIdentifiersWithCache(_izContext, objectSchema, reqIdentifiers, bucketName)
|
|
623
623
|
|
|
@@ -169,40 +169,40 @@ module.exports.createMain = async (
|
|
|
169
169
|
const identifier = objectSchemas.identifiers[0];
|
|
170
170
|
_izContext.logger.debug(":::::case single identifier:::::", identifier);
|
|
171
171
|
|
|
172
|
-
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate")) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
172
|
+
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate") && (objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == true)) {
|
|
173
|
+
Object.assign(requestParams.fieldNames, {
|
|
174
|
+
[identifier.fieldName]: hash({
|
|
175
|
+
fieldNames: identifier, //
|
|
176
|
+
uniqueRequestId: _izContext.uniqueRequestId,
|
|
177
|
+
callingFlowConfig: callingFlowConfig
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate") && objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == false ||
|
|
183
|
+
objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == null) {
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate == true) &&
|
|
186
|
+
(objectSchemas.fieldNames[identifier.fieldName].canUpdate == false)) {
|
|
187
|
+
// check Fns have receive
|
|
189
188
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
if (requestParams.fieldNames.hasOwnProperty([identifier.fieldName])) {
|
|
190
|
+
_izContext.logger.debug("identifier is exist:", {
|
|
191
|
+
[identifier.fieldName]: requestParams.fieldNames[identifier.fieldName]
|
|
192
|
+
});
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
194
|
+
} else {
|
|
195
|
+
errorsFound.push("[invalid]requestParams not have data fieldNames of requiredOnCreate");
|
|
198
196
|
}
|
|
199
|
-
}
|
|
197
|
+
}
|
|
200
198
|
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate")) {
|
|
201
199
|
let hashFieldName = {}
|
|
202
200
|
if (objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length &&
|
|
203
201
|
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length > 0) {
|
|
204
202
|
for (const fieldName of objectSchemas.fieldNames[identifier.fieldName].hashOnCreate) {
|
|
205
|
-
Object.assign(hashFieldName, {
|
|
203
|
+
Object.assign(hashFieldName, {
|
|
204
|
+
[fieldName]: requestParams.fieldNames[fieldName]
|
|
205
|
+
})
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
Object.assign(
|
|
@@ -154,7 +154,7 @@ module.exports.getMain = async (
|
|
|
154
154
|
let graphServiceName = await getGraphServiceTagWithCache(_izContext, getDataDetail.graphServiceTag);
|
|
155
155
|
|
|
156
156
|
let versionedDataLabels = [];
|
|
157
|
-
if (
|
|
157
|
+
if (returnVersionedData) {
|
|
158
158
|
if (getDataDetail.versionedDatas && Object.keys(getDataDetail.versionedDatas).length) {
|
|
159
159
|
// have versionedData
|
|
160
160
|
versionedDataLabels = Object.keys(getDataDetail.versionedDatas);
|
|
@@ -231,7 +231,6 @@ module.exports.getMain = async (
|
|
|
231
231
|
let dataFromDynamoDb = await dynamodbSharedLib.getItem(
|
|
232
232
|
_izContext,
|
|
233
233
|
await dynamodbSharedLib.tableName(_izContext, getDataDetail.tableName, getDataDetail.serviceTag),
|
|
234
|
-
await dynamodbSharedLib.tableName(_izContext, getDataDetail.tableName, getDataDetail.serviceTag),
|
|
235
234
|
identifiersForGetData
|
|
236
235
|
);
|
|
237
236
|
|
|
@@ -81,7 +81,7 @@ module.exports.confirmNewReserved = async (
|
|
|
81
81
|
|
|
82
82
|
let sendMessageToConfirmUsage = {
|
|
83
83
|
Message: JSON.stringify(confirmUsageMessage),
|
|
84
|
-
TopicArn: await snsSharedLib.
|
|
84
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, 'ConfirmUsage_In', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
85
85
|
};
|
|
86
86
|
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
87
87
|
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
@@ -114,7 +114,7 @@ module.exports.confirmNewReserved = async (
|
|
|
114
114
|
|
|
115
115
|
let sendMessageToUpdateEndpoint = {
|
|
116
116
|
Message: JSON.stringify(sendMessageToUpdateStatus),
|
|
117
|
-
TopicArn: await snsSharedLib.
|
|
117
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "Update_In")
|
|
118
118
|
};
|
|
119
119
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
120
120
|
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
@@ -152,14 +152,22 @@ module.exports.createPresignUrl = async (
|
|
|
152
152
|
await sns.publishAsync(_izContext, sendMessageToCancelReserved);
|
|
153
153
|
|
|
154
154
|
await postToConnection({ message: "reserved has reach limit" }, connectionId)
|
|
155
|
+
|
|
156
|
+
//(<createIdentifiersForDeleteTask>)
|
|
157
|
+
let identifiers
|
|
158
|
+
//(</createIdentifiersForDeleteTask>)
|
|
155
159
|
// after post message delete websocket task
|
|
156
160
|
await dynamodbSharedLib.deleteItem(_izContext,
|
|
157
161
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
158
162
|
{
|
|
159
|
-
taskKey:
|
|
163
|
+
taskKey: `${createFlowTypeConcat(_izContext, { flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
|
|
160
164
|
connectionId: connectionId
|
|
161
165
|
}
|
|
162
166
|
)
|
|
167
|
+
|
|
168
|
+
//(<afterCancelReservedLimit>)
|
|
169
|
+
//(</afterCancelReservedLimit>)
|
|
170
|
+
|
|
163
171
|
return "reserved not pass"
|
|
164
172
|
}
|
|
165
173
|
|
|
@@ -207,7 +215,7 @@ module.exports.createPresignUrl = async (
|
|
|
207
215
|
},
|
|
208
216
|
fields: {
|
|
209
217
|
importBatchStatus: "waitingToUpload",
|
|
210
|
-
expiryTimestamp: (getResult.startTime + (createPresignUrlParam.expires * 1000))
|
|
218
|
+
expiryTimestamp: (getResult.fields.startTime + (createPresignUrlParam.expires * 1000))
|
|
211
219
|
}
|
|
212
220
|
},
|
|
213
221
|
objectType: objType.objectType
|
|
@@ -232,11 +240,9 @@ module.exports.createPresignUrl = async (
|
|
|
232
240
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
233
241
|
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
234
242
|
|
|
235
|
-
|
|
236
|
-
//(<createIdentifiersFlow>)
|
|
243
|
+
//(<createIdentifierFlow>)
|
|
237
244
|
let identifiers
|
|
238
|
-
//(</
|
|
239
|
-
|
|
245
|
+
//(</createIdentifierFlow>)
|
|
240
246
|
await dynamodbSharedLib.updateItem(_izContext,
|
|
241
247
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
242
248
|
{
|
|
@@ -248,6 +254,10 @@ module.exports.createPresignUrl = async (
|
|
|
248
254
|
}
|
|
249
255
|
)
|
|
250
256
|
}
|
|
257
|
+
|
|
258
|
+
//(<mainFunctionHookCode>)
|
|
259
|
+
//(</mainFunctionHookCode>)
|
|
260
|
+
|
|
251
261
|
} catch (err) {
|
|
252
262
|
_izContext.logger.error('error createPresignUrl: ', err)
|
|
253
263
|
throw (err)
|
|
@@ -55,7 +55,7 @@ module.exports.updateNodeComplete = async (
|
|
|
55
55
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
56
56
|
hash({
|
|
57
57
|
objectType: returnValue.requestParams.objType.objectType,
|
|
58
|
-
serviceTag: returnValue.requestParams.objType.
|
|
58
|
+
serviceTag: returnValue.requestParams.objType.serviceTag,
|
|
59
59
|
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
60
60
|
fields: returnValue.requestParams.objInstanceFull.fields
|
|
61
61
|
}),
|
|
@@ -83,12 +83,12 @@ module.exports.updateNodeComplete = async (
|
|
|
83
83
|
|
|
84
84
|
let updateCompleteMsg = {
|
|
85
85
|
objType: {
|
|
86
|
-
objectType: returnValue.
|
|
87
|
-
serviceTag: returnValue.
|
|
86
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
87
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
88
88
|
},
|
|
89
89
|
objInstanceFull: {
|
|
90
|
-
identifiers: returnValue.
|
|
91
|
-
fields: returnValue.
|
|
90
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
91
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
92
92
|
},
|
|
93
93
|
status: status,
|
|
94
94
|
errorsFound: errorsFound,
|