@izara_project/izara-core-library-service-schemas 1.0.99 → 1.0.100

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-library-service-schemas",
3
- "version": "1.0.99",
3
+ "version": "1.0.100",
4
4
  "description": "Schemas for the service and objects it controls",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,11 +25,11 @@
25
25
  "@aws-sdk/client-lambda": "^3.862.0",
26
26
  "@aws-sdk/client-s3": "^3.862.0",
27
27
  "@aws-sdk/crc64-nvme-crt": "^3.862.0",
28
- "@izara_project/izara-core-library-core": "^1.0.24",
28
+ "@izara_project/izara-core-library-core": "^1.0.27",
29
29
  "@izara_project/izara-core-library-external-request": "^1.0.21",
30
30
  "@izara_project/izara-core-library-lambda": "^1.0.5",
31
31
  "@izara_project/izara-core-library-logger": "^1.0.7",
32
- "@izara_project/izara-shared-core": "^1.0.2",
32
+ "@izara_project/izara-shared-core": "^1.0.4",
33
33
  "@izara_project/izara-shared-service-schemas": "^1.0.32",
34
34
  "glob": "^11.0.3",
35
35
  "lodash": "^4.17.21",
@@ -21,7 +21,6 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
21
21
  const glob = require('glob')
22
22
  const path = require('path')
23
23
  const lodash = require('lodash');
24
-
25
24
  const hash = require('@izara_project/izara-shared-core').objectHash;
26
25
 
27
26
  const sharedServiceSchema = require("@izara_project/izara-shared-service-schemas");
@@ -1128,6 +1127,46 @@ async function getObjectSchemaForUpdate(_izContext, objType) {
1128
1127
  return await getObjectSchemaForUpdateShared(getSchemaByNameWithCache, objType, process.env.iz_serviceSchemaBucketName)
1129
1128
  }
1130
1129
 
1130
+
1131
+ // collect dynamoDB storageResources of objType in flowType
1132
+ async function getTableNamesByFlowType(_izContext, flowType) {
1133
+ let tableNamesStorageResource = [];
1134
+ const flowSchema = await getFlowSchemaS3WithCache(_izContext, flowType);
1135
+
1136
+ // validate flowSchema
1137
+ if (!flowSchema) {
1138
+ throw new NoRetryError(`Flow schema not found for flowType: ${JSON.stringify(flowType)}`);
1139
+ }
1140
+
1141
+ // validate flowSchema
1142
+ if (!flowSchema.objType) {
1143
+ throw new NoRetryError(`Invalid Flow schema not have objType: ${JSON.stringify(flowType)}`);
1144
+ }
1145
+
1146
+
1147
+ const objectSchema = await getObjSchemaS3WithHierarchy(_izContext, flowSchema.objType);
1148
+
1149
+ // validate objectSchemaTriggerCache
1150
+ if (!objectSchema) {
1151
+ throw new NoRetryError(`Object schema not found for flowType: ${JSON.stringify(flowType)}, objType: ${JSON.stringify(flowSchema.objType)}`);
1152
+ }
1153
+
1154
+ //collect storageResourceDynamoDB
1155
+ for (const storageTag in objectSchema.storageResources) {
1156
+ const storageResource = objectSchema.storageResources[storageTag];
1157
+ if (storageResource.storageType === 'dynamoDB') {
1158
+
1159
+ tableNamesStorageResource.push({
1160
+ ...storageResource,
1161
+ storageTag
1162
+ })
1163
+ }
1164
+ }
1165
+
1166
+ return tableNamesStorageResource;
1167
+ }
1168
+
1169
+
1131
1170
  module.exports = {
1132
1171
  // getObjectTypes,
1133
1172
  getDataFromPath,
@@ -1186,6 +1225,8 @@ module.exports = {
1186
1225
 
1187
1226
  getObjectSchemaForCreate,
1188
1227
  getObjectSchemaForUpdate,
1228
+
1229
+ getTableNamesByFlowType
1189
1230
  }
1190
1231
 
1191
1232