@izara_project/izara-core-generate-service-code 1.0.95 → 1.0.97

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 (210) hide show
  1. package/index.js +2 -2
  2. package/package.json +2 -1
  3. package/src/compile/loadSchemas.js +17 -318
  4. package/src/compile/loadSchemasRemote.js +195 -0
  5. package/src/compile/schemaValidatorSetup.js +143 -0
  6. package/src/emit/{crud → application/crud}/emitCrudApplicationArtifacts.js +2 -2
  7. package/src/emit/{crud → application/crud}/generateCrudApplicationArtifacts.js +2 -2
  8. package/src/emit/{crud → application/crud}/generateDynamicCrudFlowSchemas.js +2 -2
  9. package/src/emit/{custom → application/custom}/customFlowS3.js +1 -1
  10. package/src/emit/{custom → application/custom}/customFlowSteps.js +34 -5
  11. package/src/emit/{custom → application/custom}/customFlowTemplates.js +1 -1
  12. package/src/emit/{custom → application/custom}/emitCustomFlowApplicationArtifacts.js +1 -1
  13. package/src/emit/{custom → application/custom}/generateCustomFlowApplicationArtifacts.js +2 -2
  14. package/src/emit/{custom → application/custom}/templates/FlowEndpoint_Main.ejs +66 -4
  15. package/src/emit/{custom → application/custom}/templates/FlowStep_Main.ejs +27 -0
  16. package/src/emit/{rbac → application/rbac}/emitRbacApplicationArtifacts.js +2 -2
  17. package/src/emit/{rbac → application/rbac}/generateCreateTargetRoleHandler.js +2 -2
  18. package/src/emit/{rbac → application/rbac}/generateDynamicRbacFlowSchemas.js +2 -2
  19. package/src/emit/{relationship → application/relationship}/emitRelationshipApplicationArtifacts.js +3 -3
  20. package/src/emit/{relationship → application/relationship}/generateDynamicRelationshipFlowSchemas.js +2 -2
  21. package/src/emit/{relationship → application/relationship}/generateRelationshipApplicationArtifacts.js +2 -2
  22. package/src/emit/{system → application/system}/emitSystemFindDataArtifacts.js +1 -1
  23. package/src/emit/{resource → infrastructure/resources}/generateResourceArtifacts.js +2 -2
  24. package/src/emit/{resource → infrastructure/resources}/iamResourceArtifacts.js +2 -2
  25. package/src/emit/{resource → infrastructure/resources}/resourceState.js +4 -4
  26. package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +29 -48
  27. package/src/emit/schemas/attributeTree/emitAttributeTreeTargetSchemas.js +153 -0
  28. package/src/emit/schemas/attributeTree/resolveTargetServicePath.js +111 -0
  29. package/src/emit/schemas/ledger/emitLedgerSchemas.js +370 -0
  30. package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
  31. package/src/generate.js +81 -240
  32. package/src/{generateIntTest.js → intTest/generateIntTest.js} +2 -2
  33. package/src/{generateResourceIntTest.js → intTest/generateResourceIntTest.js} +2 -2
  34. package/src/plan/domainRegistry.js +271 -0
  35. package/test/helpers/testProject.js +127 -0
  36. package/test/helpers/testProject.test.js +57 -0
  37. package/test/{core.test.js → integration/core.test.js} +3 -3
  38. package/test/{graphDrivenFlowSchema.test.js → integration/graphDrivenFlowSchema.test.js} +1 -1
  39. package/test/{intTestApi.test.js → integration/intTestApi.test.js} +1 -1
  40. package/test/{publicApi.test.js → integration/publicApi.test.js} +1 -1
  41. package/test/{createTargetRoleHandler.test.js → unit/application/createTargetRoleHandler.test.js} +1 -1
  42. package/test/{crudApplicationArtifacts.test.js → unit/application/crudApplicationArtifacts.test.js} +1 -1
  43. package/test/{customFlowApplicationArtifacts.test.js → unit/application/customFlowApplicationArtifacts.test.js} +139 -9
  44. package/test/{relationshipApplicationArtifacts.test.js → unit/application/relationshipApplicationArtifacts.test.js} +1 -1
  45. package/test/{systemFindDataArtifacts.test.js → unit/application/systemFindDataArtifacts.test.js} +1 -1
  46. package/test/{functionYamlArtifact.test.js → unit/infrastructure/functionYamlArtifact.test.js} +1 -1
  47. package/test/{resourceArtifacts.test.js → unit/infrastructure/resourceArtifacts.test.js} +1 -1
  48. package/test/{attributeTreeSchemas.test.js → unit/schemas/attributeTreeSchemas.test.js} +127 -50
  49. package/test/{dynamicCrudFlowSchemas.test.js → unit/schemas/dynamicCrudFlowSchemas.test.js} +2 -2
  50. package/test/{dynamicRbacFlowSchemas.test.js → unit/schemas/dynamicRbacFlowSchemas.test.js} +1 -1
  51. package/test/{dynamicRelationshipFlowSchemas.test.js → unit/schemas/dynamicRelationshipFlowSchemas.test.js} +11 -1
  52. package/test/{errorSchemas.test.js → unit/schemas/errorSchemas.test.js} +2 -2
  53. package/test/unit/schemas/ledgerSchemas.test.js +263 -0
  54. package/test/{systemTextSchemas.test.js → unit/schemas/systemTextSchemas.test.js} +24 -36
  55. package/src/emit/crud/loadLocalSchemaArrays.js +0 -4
  56. /package/src/emit/{coreFunction → application/coreFunction}/emitCoreFunctionArtifacts.js +0 -0
  57. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreFunction_Yaml.ejs +0 -0
  58. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreResource_Yaml.ejs +0 -0
  59. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_HdrInv.ejs +0 -0
  60. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_Main.ejs +0 -0
  61. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_HdrInv.ejs +0 -0
  62. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_Main.ejs +0 -0
  63. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +0 -0
  64. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_Main.ejs +0 -0
  65. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs +0 -0
  66. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs +0 -0
  67. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs +0 -0
  68. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs +0 -0
  69. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs +0 -0
  70. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_initialSetup.ejs +0 -0
  71. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedDynamo.ejs +0 -0
  72. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedGraph.ejs +0 -0
  73. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedRemove.ejs +0 -0
  74. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_uploadSchema.ejs +0 -0
  75. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs +0 -0
  76. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_Main.ejs +0 -0
  77. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_HdrInv.ejs +0 -0
  78. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs +0 -0
  79. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs +0 -0
  80. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_Main.ejs +0 -0
  81. /package/src/emit/{crud → application/crud}/crudActionPlan.js +0 -0
  82. /package/src/emit/{crud → application/crud}/dynamicCrudFlowSchemaTemplate.js +0 -0
  83. /package/src/emit/{crud → application/crud}/emitDynamicCrudFlowSchemas.js +0 -0
  84. /package/src/emit/{crud → application/crud}/templates/CreateAfterHookCallback_Main.ejs +0 -0
  85. /package/src/emit/{crud → application/crud}/templates/CreateBeforeHookCallback_Main.ejs +0 -0
  86. /package/src/emit/{crud → application/crud}/templates/CreateComplete_Main.ejs +0 -0
  87. /package/src/emit/{crud → application/crud}/templates/CreateConfirmComplete_Main.ejs +0 -0
  88. /package/src/emit/{crud → application/crud}/templates/CreateEndpoint_Main.ejs +0 -0
  89. /package/src/emit/{crud → application/crud}/templates/CreateLogicalLib.ejs +0 -0
  90. /package/src/emit/{crud → application/crud}/templates/CreateNodeCallback_Main.ejs +0 -0
  91. /package/src/emit/{crud → application/crud}/templates/DeleteAfterHookCallback_Main.ejs +0 -0
  92. /package/src/emit/{crud → application/crud}/templates/DeleteBeforeHookCallback_Main.ejs +0 -0
  93. /package/src/emit/{crud → application/crud}/templates/DeleteComplete_Main.ejs +0 -0
  94. /package/src/emit/{crud → application/crud}/templates/DeleteEndpoint_Main.ejs +0 -0
  95. /package/src/emit/{crud → application/crud}/templates/DeleteLogicalLib.ejs +0 -0
  96. /package/src/emit/{crud → application/crud}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  97. /package/src/emit/{crud → application/crud}/templates/FlowEndpoint_HdrWbs.ejs +0 -0
  98. /package/src/emit/{crud → application/crud}/templates/FlowMain_Wbs.ejs +0 -0
  99. /package/src/emit/{crud → application/crud}/templates/GetEndpoint_Main.ejs +0 -0
  100. /package/src/emit/{crud → application/crud}/templates/GetRangeEndpoint_Main.ejs +0 -0
  101. /package/src/emit/{crud → application/crud}/templates/UpdateAfterHookCallback_Main.ejs +0 -0
  102. /package/src/emit/{crud → application/crud}/templates/UpdateBeforeHookCallback_Main.ejs +0 -0
  103. /package/src/emit/{crud → application/crud}/templates/UpdateComplete_Main.ejs +0 -0
  104. /package/src/emit/{crud → application/crud}/templates/UpdateEndpoint_Main.ejs +0 -0
  105. /package/src/emit/{crud → application/crud}/templates/UpdateLogicalLib.ejs +0 -0
  106. /package/src/emit/{custom → application/custom}/customFlowPaths.js +0 -0
  107. /package/src/emit/{custom → application/custom}/customFlows.js +0 -0
  108. /package/src/emit/{custom → application/custom}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  109. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
  110. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_Main.ejs +0 -0
  111. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_HdrWbs.ejs +0 -0
  112. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_Main.ejs +0 -0
  113. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
  114. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_Main.ejs +0 -0
  115. /package/src/emit/{custom → application/custom}/templates/s3/FlowHandler_HdrS3.ejs +0 -0
  116. /package/src/emit/{custom → application/custom}/templates/s3/ProcessS3File_Main.ejs +0 -0
  117. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
  118. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_Main.ejs +0 -0
  119. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  120. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs +0 -0
  121. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  122. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs +0 -0
  123. /package/src/emit/{rbac → application/rbac}/emitDynamicRbacFlowSchemas.js +0 -0
  124. /package/src/emit/{rbac → application/rbac}/rbacFlowTag.js +0 -0
  125. /package/src/emit/{rbac → application/rbac}/templates/CancelUsage_Main.ejs +0 -0
  126. /package/src/emit/{rbac → application/rbac}/templates/ConfirmUsage_Main.ejs +0 -0
  127. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_HdrSqs.ejs +0 -0
  128. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_Main.ejs +0 -0
  129. /package/src/emit/{rbac → application/rbac}/templates/DeleteTargetRole_Main.ejs +0 -0
  130. /package/src/emit/{rbac → application/rbac}/templates/DynamicRbacFlowSchema.ejs +0 -0
  131. /package/src/emit/{rbac → application/rbac}/templates/GetMyPermissions_Main.ejs +0 -0
  132. /package/src/emit/{rbac → application/rbac}/templates/GetTargetRole_Main.ejs +0 -0
  133. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrApi.ejs +0 -0
  134. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrSqs.ejs +0 -0
  135. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_Main.ejs +0 -0
  136. /package/src/emit/{rbac → application/rbac}/templates/RbacMutation_Main.ejs +0 -0
  137. /package/src/emit/{rbac → application/rbac}/templates/ReservedDynamicUsage_Main.ejs +0 -0
  138. /package/src/emit/{rbac → application/rbac}/templates/UpdateTargetRole_Main.ejs +0 -0
  139. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_HdrSqs.ejs +0 -0
  140. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_Main.ejs +0 -0
  141. /package/src/emit/{rbac → application/rbac}/templates/UserRoleMutation_Main.ejs +0 -0
  142. /package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js +0 -0
  143. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_HdrSqs.ejs +0 -0
  144. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_Main.ejs +0 -0
  145. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs +0 -0
  146. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_HdrSqs.ejs +0 -0
  147. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_Main.ejs +0 -0
  148. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs +0 -0
  149. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_HdrSqs.ejs +0 -0
  150. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_Main.ejs +0 -0
  151. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs +0 -0
  152. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_HdrSqs.ejs +0 -0
  153. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_Main.ejs +0 -0
  154. /package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs +0 -0
  155. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_HdrSqs.ejs +0 -0
  156. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_Main.ejs +0 -0
  157. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs +0 -0
  158. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_HdrSqs.ejs +0 -0
  159. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_Main.ejs +0 -0
  160. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationship_Main.ejs +0 -0
  161. /package/src/emit/{system → application/system}/emitSystemWebSocketArtifacts.js +0 -0
  162. /package/src/emit/{system → application/system}/templates/RegisterComplete_HdrSqs.ejs +0 -0
  163. /package/src/emit/{system → application/system}/templates/RegisterComplete_Main.ejs +0 -0
  164. /package/src/emit/{system → application/system}/templates/RegisterComplete_Yaml.ejs +0 -0
  165. /package/src/emit/{system → application/system}/templates/RegisterWbs_Yaml.ejs +0 -0
  166. /package/src/emit/{system → application/system}/templates/Register_HdrWbs.ejs +0 -0
  167. /package/src/emit/{system → application/system}/templates/Register_Main.ejs +0 -0
  168. /package/src/emit/{system → application/system}/templates/WebSocketComplete_HdrSqs.ejs +0 -0
  169. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Main.ejs +0 -0
  170. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Yaml.ejs +0 -0
  171. /package/src/emit/{system → application/system}/templates/WebSocketConnect.ejs +0 -0
  172. /package/src/emit/{system → application/system}/templates/WebSocketConnect_Yaml.ejs +0 -0
  173. /package/src/emit/{function → infrastructure/functions}/functionYamlArtifact.js +0 -0
  174. /package/src/emit/{function → infrastructure/functions}/templates/ApiFunction_Yaml.ejs +0 -0
  175. /package/src/emit/{function → infrastructure/functions}/templates/EventBridgeFunction_Yaml.ejs +0 -0
  176. /package/src/emit/{function → infrastructure/functions}/templates/InvFunction_Yaml.ejs +0 -0
  177. /package/src/emit/{function → infrastructure/functions}/templates/S3Function_Yaml.ejs +0 -0
  178. /package/src/emit/{function → infrastructure/functions}/templates/SqsFunction_Yaml.ejs +0 -0
  179. /package/src/emit/{function → infrastructure/functions}/templates/WbsFunction_Yaml.ejs +0 -0
  180. /package/src/emit/{resource → infrastructure/resources}/dynamoResourceArtifacts.js +0 -0
  181. /package/src/emit/{resource → infrastructure/resources}/emitResourceArtifacts.js +0 -0
  182. /package/src/emit/{resource → infrastructure/resources}/resourceTemplate.js +0 -0
  183. /package/src/emit/{resource → infrastructure/resources}/s3ResourceArtifacts.js +0 -0
  184. /package/src/emit/{resource → infrastructure/resources}/sqsResourceArtifacts.js +0 -0
  185. /package/src/emit/{resource → infrastructure/resources}/templates/DynamoDBTable_Yaml.ejs +0 -0
  186. /package/src/emit/{resource → infrastructure/resources}/templates/FlowOut_Yaml.ejs +0 -0
  187. /package/src/emit/{resource → infrastructure/resources}/templates/GeneratedLambdaRoleServiceConfig.ejs +0 -0
  188. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceSqsYaml.ejs +0 -0
  189. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceYaml.ejs +0 -0
  190. /package/src/emit/{resource → infrastructure/resources}/templates/S3Bucket_Yaml.ejs +0 -0
  191. /package/src/emit/{resource → infrastructure/resources}/templates/S3Subscription_Yaml.ejs +0 -0
  192. /package/src/emit/{resource → infrastructure/resources}/templates/SharedResource_Yaml.ejs +0 -0
  193. /package/src/emit/{resource → infrastructure/resources}/templates/SystemDynamoDB_Yaml.ejs +0 -0
  194. /package/src/emit/{resource → infrastructure/resources}/templates/WebSocketSubscription_Yaml.ejs +0 -0
  195. /package/src/emit/{error → schemas/error}/emitErrorSchemas.js +0 -0
  196. /package/src/emit/{error → schemas/error}/templates/errorSchema.ejs +0 -0
  197. /package/src/emit/{systemText → schemas/systemText}/templates/SystemTextSchemas.ejs +0 -0
  198. /package/src/{generateResources/IntTest → intTest/generators}/consts.js +0 -0
  199. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/generateResources.js +0 -0
  200. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/templateResources.ejs +0 -0
  201. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/events.js +0 -0
  202. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/templateEvents.ejs +0 -0
  203. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/generateTemplate.js +0 -0
  204. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/pathIntTest.js +0 -0
  205. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/template.ejs +0 -0
  206. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/templateTests.ejs +0 -0
  207. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/tests.js +0 -0
  208. /package/src/{generateResources/IntTest → intTest/generators}/libs/IntTestGenerateLib.js +0 -0
  209. /package/src/{generateResources/IntTest → intTest/generators}/upload/uploadIntTest.js +0 -0
  210. /package/src/{intTestGeneratorShared.js → intTest/intTestGeneratorShared.js} +0 -0
package/index.js CHANGED
@@ -16,8 +16,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  import { generate } from './src/generate.js';
19
- import { generateIntTest } from './src/generateIntTest.js';
20
- import { generateResourceIntTest } from './src/generateResourceIntTest.js';
19
+ import { generateIntTest } from './src/intTest/generateIntTest.js';
20
+ import { generateResourceIntTest } from './src/intTest/generateResourceIntTest.js';
21
21
 
22
22
  export {
23
23
  // High-level API (recommended for consumers) — wires legacy Logger+validateLocalSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "Code for locally generating per service files",
5
5
  "homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
6
6
  "repository": {
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@izara_project/izara-attribute-tree": "^1.0.15",
21
21
  "@izara_project/izara-core-library-core": "^1.0.37",
22
+ "@izara_project/izara-core-library-ledger": "^1.0.2",
22
23
  "@izara_project/izara-core-library-s3": "^1.0.12",
23
24
  "@izara_project/izara-property-nodes": "^1.0.16",
24
25
  "@izara_project/izara-shared-core": "^1.0.13",
@@ -1,13 +1,23 @@
1
1
  import { readdir, stat } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { pathToFileURL } from 'node:url';
4
- import {
5
- getObjectSchema,
6
- utils
7
- } from '@izara_project/izara-core-library-service-schemas';
8
- import { basicValidatorSchema } from '@izara_project/izara-shared-service-schemas';
9
- import { s3 } from '@izara_project/izara-core-library-s3';
4
+ import { utils } from '@izara_project/izara-core-library-service-schemas';
10
5
  import { validateFlowSchema } from './flowValidator.js';
6
+ import {
7
+ ensureBasicValidatorConfigured,
8
+ VALID_INITIATE_BY_ENUM,
9
+ VALID_EVENT_ENUM,
10
+ VALID_CODE_HOOK_TAG_ENUM,
11
+ VALID_GENERATE_CODE_TAG_ENUM,
12
+ VALID_INVOCATION_TYPE_ENUM,
13
+ VALID_GENERATED_BY_ENUM
14
+ } from './schemaValidatorSetup.js';
15
+ import {
16
+ resolveExtendedObjectSchemas,
17
+ resolveGraphServiceTags
18
+ } from './loadSchemasRemote.js';
19
+
20
+ ensureBasicValidatorConfigured();
11
21
 
12
22
  const consoleLogger = {
13
23
  debug: console.log,
@@ -16,131 +26,7 @@ const consoleLogger = {
16
26
  error: console.error
17
27
  };
18
28
 
19
- const VALID_INITIATE_BY_ENUM = ['user', 'systemWithUser', 'systemNoUser'];
20
- const VALID_EVENT_ENUM = [
21
- 'ownTopic',
22
- 'extTopic',
23
- 's3',
24
- 'eventBridge',
25
- 'lambdaSyncInv',
26
- 'lambdaSyncApi',
27
- 'dsq',
28
- 'generateCode'
29
- ];
30
- const VALID_CODE_HOOK_TAG_ENUM = ['before', 'after'];
31
- const VALID_GENERATE_CODE_TAG_ENUM = ['create', 'update', 'delete'];
32
- const VALID_INVOCATION_TYPE_ENUM = ['ownTopic', 'lambdaSyncInv'];
33
-
34
- if (basicValidatorSchema?.basicFlowSchema?.properties?.initiateBy) {
35
- basicValidatorSchema.basicFlowSchema.properties.initiateBy.enum =
36
- VALID_INITIATE_BY_ENUM;
37
- }
38
-
39
- if (basicValidatorSchema?.basicFlowSchema?.properties?.event?.items) {
40
- basicValidatorSchema.basicFlowSchema.properties.event.items.enum =
41
- VALID_EVENT_ENUM;
42
- }
43
-
44
- if (
45
- basicValidatorSchema?.basicFlowSchema?.properties?.generatedCodeConfig
46
- ?.properties?.codeHookTag
47
- ) {
48
- basicValidatorSchema.basicFlowSchema.properties.generatedCodeConfig.properties.codeHookTag.enum =
49
- VALID_CODE_HOOK_TAG_ENUM;
50
- }
51
-
52
- if (
53
- basicValidatorSchema?.basicFlowSchema?.properties?.generatedCodeConfig
54
- ?.properties?.invocationType
55
- ) {
56
- basicValidatorSchema.basicFlowSchema.properties.generatedCodeConfig.properties.invocationType.enum =
57
- VALID_INVOCATION_TYPE_ENUM;
58
- }
59
-
60
- if (
61
- basicValidatorSchema?.basicFlowSchema?.properties?.generatedCodeConfig
62
- ?.properties?.generateCodeTag
63
- ) {
64
- basicValidatorSchema.basicFlowSchema.properties.generatedCodeConfig.properties.generateCodeTag =
65
- {
66
- anyOf: [
67
- {
68
- type: 'array',
69
- items: {
70
- type: 'string',
71
- enum: VALID_GENERATE_CODE_TAG_ENUM
72
- }
73
- },
74
- {
75
- type: 'string',
76
- enum: VALID_GENERATE_CODE_TAG_ENUM
77
- }
78
- ]
79
- };
80
- }
81
-
82
- if (
83
- basicValidatorSchema?.basicFlowSchema?.properties?.generatedCodeConfig
84
- ?.properties
85
- ) {
86
- basicValidatorSchema.basicFlowSchema.properties.generatedCodeConfig.properties.objType =
87
- {
88
- anyOf: [
89
- { type: 'string' },
90
- {
91
- type: 'array',
92
- items: { type: 'string' }
93
- },
94
- {
95
- type: 'object',
96
- properties: {
97
- objectType: { type: 'string' },
98
- serviceTag: { type: 'string' }
99
- },
100
- required: ['objectType']
101
- }
102
- ]
103
- };
104
- }
105
-
106
- const VALID_GENERATED_BY_ENUM = [
107
- 'user',
108
- 'systemWithUser',
109
- 'systemNoUser',
110
- 'searchResultGenerated'
111
- ];
112
-
113
- if (basicValidatorSchema?.basicObjectSchema?.properties?.generatedBy) {
114
- basicValidatorSchema.basicObjectSchema.properties.generatedBy.enum =
115
- VALID_GENERATED_BY_ENUM;
116
- }
117
-
118
- if (basicValidatorSchema?.basicExtendObjectSchema?.properties?.generatedBy) {
119
- basicValidatorSchema.basicExtendObjectSchema.properties.generatedBy.enum =
120
- VALID_GENERATED_BY_ENUM;
121
- }
122
-
123
- const objectSchemasToPatch = [
124
- basicValidatorSchema?.basicObjectSchema,
125
- basicValidatorSchema?.basicExtendObjectSchema
126
- ];
127
-
128
- for (const objSchema of objectSchemasToPatch) {
129
- const addOnItems = objSchema?.properties?.addOnDataStructure?.items?.anyOf;
130
- if (Array.isArray(addOnItems)) {
131
- for (const item of addOnItems) {
132
- if (item?.properties?.type?.enum?.includes('rbac')) {
133
- if (item.properties.billalble) {
134
- delete item.properties.billalble;
135
- }
136
- item.properties.billable = { type: 'boolean' };
137
- if (Array.isArray(item.required)) {
138
- item.required = item.required.filter((r) => r !== 'billalble');
139
- }
140
- }
141
- }
142
- }
143
- }
29
+ export { resolveExtendedObjectSchemas, resolveGraphServiceTags };
144
30
 
145
31
  export async function loadLocalSchemaDirectory(
146
32
  project,
@@ -654,194 +540,7 @@ export async function loadLocalSchemaArrays(project, options = {}) {
654
540
  return { objects, flows };
655
541
  }
656
542
 
657
- /**
658
- * Resolves extendObjType for ObjectSchemas by fetching the parent schema
659
- * from S3 and merging its storageResources into the child schema.
660
- *
661
- * Only schemas with `extendObjType` are processed; others are returned as-is.
662
- * If `bucketName` is not provided, falls back to the
663
- * `iz_serviceSchemaBucketName` environment variable.
664
- *
665
- * @param {Object[]} objectSchemas - Array of local ObjectSchemas from
666
- * loadLocalSchemaDirectory.
667
- * @param {string} [bucketName] - S3 bucket name for fetching parent schemas.
668
- * @returns {Promise<Object[]>} The same array with extended storageResources
669
- * merged in.
670
- */
671
- export async function resolveExtendedObjectSchemas(
672
- objectSchemas,
673
- bucketName = process.env.iz_serviceSchemaBucketName
674
- ) {
675
- if (!Array.isArray(objectSchemas)) {
676
- throw new TypeError('objectSchemas must be an array');
677
- }
678
- const resolvedSchemas = [];
679
- for (const schema of objectSchemas) {
680
- let currentSchema = schema;
681
- if (currentSchema.hasOwnProperty('extendObjType')) {
682
- try {
683
- console.log(
684
- `[DEBUG] [resolveExtendedObjectSchemas] Merging extendObjType ` +
685
- `for objectType=${currentSchema.objectType}`,
686
- { extendObjType: currentSchema.extendObjType }
687
- );
688
- const initialResources = currentSchema.storageResources || {};
689
- const childStorageResourceKeys = new Set(Object.keys(initialResources));
690
- const parentServiceTag = currentSchema.extendObjType.serviceTag;
691
-
692
- const mergedSchema = await getObjectSchema.mergeExtendObjSchema(
693
- { logger: consoleLogger },
694
- currentSchema,
695
- bucketName
696
- );
697
-
698
- const externalDynamoResources = [];
699
- const ownStorageResources = {};
700
- const mergedStorageResources = mergedSchema.storageResources || {};
701
- for (const [key, resource] of Object.entries(mergedStorageResources)) {
702
- if (
703
- resource &&
704
- (resource.storageType === 'dynamo' ||
705
- resource.storageType === 'dynamoDB' ||
706
- !resource.storageType) &&
707
- !childStorageResourceKeys.has(key)
708
- ) {
709
- externalDynamoResources.push({
710
- serviceTag: parentServiceTag,
711
- tableName: resource.tableName
712
- });
713
- } else {
714
- ownStorageResources[key] = resource;
715
- }
716
- }
717
-
718
- mergedSchema.storageResources = ownStorageResources;
719
- if (externalDynamoResources.length > 0) {
720
- mergedSchema.externalDynamoResources = externalDynamoResources;
721
- }
722
-
723
- currentSchema = mergedSchema;
724
- } catch (error) {
725
- console.log(
726
- `[ERROR] [resolveExtendedObjectSchemas] Failed to merge ` +
727
- `extendObjType for objectType=${currentSchema.objectType}`,
728
- { error }
729
- );
730
- throw error;
731
- }
732
- }
733
-
734
- if (currentSchema.hasOwnProperty('belongTo') && currentSchema.belongTo) {
735
- const belongToTarget = Array.isArray(currentSchema.belongTo)
736
- ? currentSchema.belongTo[0]
737
- : currentSchema.belongTo;
738
-
739
- if (
740
- belongToTarget &&
741
- belongToTarget.serviceTag &&
742
- belongToTarget.objectType
743
- ) {
744
- try {
745
- console.log(
746
- `[DEBUG] [resolveExtendedObjectSchemas] Fetching belongTo ` +
747
- `schema for objectType=${currentSchema.objectType}`,
748
- { belongTo: belongToTarget }
749
- );
750
- const belongToObjType = {
751
- serviceTag: belongToTarget.serviceTag,
752
- objectType: belongToTarget.objectType
753
- };
754
- const belongToSchema = await getObjectSchema.getObjSchemaS3(
755
- { logger: consoleLogger },
756
- belongToObjType,
757
- false,
758
- bucketName
759
- );
760
- currentSchema.belongToSchema = belongToSchema;
761
- console.log(
762
- `[DEBUG] [resolveExtendedObjectSchemas] Successfully fetched ` +
763
- `belongTo schema for objectType=${currentSchema.objectType}`,
764
- { belongToObjectType: belongToSchema?.objectType }
765
- );
766
- } catch (error) {
767
- console.log(
768
- `[WARN] [resolveExtendedObjectSchemas] Failed to fetch ` +
769
- `belongTo schema for objectType=${currentSchema.objectType}`,
770
- { error }
771
- );
772
- }
773
- }
774
- }
775
-
776
- resolvedSchemas.push(currentSchema);
777
- }
778
- return resolvedSchemas;
779
- }
780
-
781
- export async function resolveGraphServiceTags(
782
- schemas,
783
- bucketName = process.env.iz_serviceSchemaBucketName
784
- ) {
785
- if (!Array.isArray(schemas) || schemas.length === 0) {
786
- return [];
787
- }
788
-
789
- const graphServerTags = new Set();
790
- for (const schema of schemas) {
791
- if (!schema || typeof schema !== 'object') continue;
792
- let targetObjs = [];
793
- if (schema.storageResources) {
794
- targetObjs = [schema];
795
- } else {
796
- targetObjs = Object.values(schema).filter(
797
- (val) => val && typeof val === 'object' && val.storageResources
798
- );
799
- }
800
-
801
- for (const targetObj of targetObjs) {
802
- const resources = targetObj.storageResources;
803
- if (resources && typeof resources === 'object') {
804
- for (const res of Object.values(resources)) {
805
- if (res?.storageType === 'graph' && res.graphServerTag) {
806
- graphServerTags.add(res.graphServerTag);
807
- }
808
- }
809
- }
810
- }
811
- }
812
543
 
813
- if (graphServerTags.size === 0) {
814
- return [];
815
- }
816
-
817
- let graphServerTagsMap = {};
818
- if (bucketName) {
819
- try {
820
- const _izContext = { logger: consoleLogger };
821
- const s3Data = await s3.getObjectS3(_izContext, {
822
- Bucket: bucketName,
823
- Key: 'serviceConfig/GraphServerTags.json'
824
- });
825
- if (s3Data && typeof s3Data === 'object') {
826
- graphServerTagsMap = s3Data;
827
- }
828
- } catch (error) {
829
- console.log(
830
- `[DEBUG] [resolveGraphServiceTags] Could not fetch ` +
831
- `GraphServerTags.json from bucket=${bucketName}`,
832
- error
833
- );
834
- }
835
- }
836
-
837
- const resolvedTags = new Set();
838
- for (const tag of graphServerTags) {
839
- const serviceTag = graphServerTagsMap[tag] || tag || 'GraphHandler';
840
- resolvedTags.add(serviceTag);
841
- }
842
-
843
- return Array.from(resolvedTags);
844
- }
845
544
 
846
545
  function _isTestEnvironment() {
847
546
  return (
@@ -0,0 +1,195 @@
1
+ import {
2
+ getObjectSchema
3
+ } from '@izara_project/izara-core-library-service-schemas';
4
+ import { s3 } from '@izara_project/izara-core-library-s3';
5
+
6
+ const consoleLogger = {
7
+ debug: console.log,
8
+ info: console.log,
9
+ warn: console.log,
10
+ error: console.error
11
+ };
12
+
13
+ /**
14
+ * Resolves extendObjType for ObjectSchemas by fetching the parent schema
15
+ * from S3 and merging its storageResources into the child schema.
16
+ *
17
+ * @param {Object[]} objectSchemas - Array of local ObjectSchemas.
18
+ * @param {string} [bucketName] - S3 bucket name for fetching parent schemas.
19
+ * @returns {Promise<Object[]>} The same array with extended storageResources.
20
+ */
21
+ export async function resolveExtendedObjectSchemas(
22
+ objectSchemas,
23
+ bucketName = process.env.iz_serviceSchemaBucketName
24
+ ) {
25
+ if (!Array.isArray(objectSchemas)) {
26
+ throw new TypeError('objectSchemas must be an array');
27
+ }
28
+ const resolvedSchemas = [];
29
+ for (const schema of objectSchemas) {
30
+ let currentSchema = schema;
31
+ if (currentSchema.hasOwnProperty('extendObjType')) {
32
+ try {
33
+ console.log(
34
+ `[DEBUG] [resolveExtendedObjectSchemas] Merging extendObjType ` +
35
+ `for objectType=${currentSchema.objectType}`,
36
+ { extendObjType: currentSchema.extendObjType }
37
+ );
38
+ const initialResources = currentSchema.storageResources || {};
39
+ const childStorageResourceKeys = new Set(Object.keys(initialResources));
40
+ const parentServiceTag = currentSchema.extendObjType.serviceTag;
41
+
42
+ const mergedSchema = await getObjectSchema.mergeExtendObjSchema(
43
+ { logger: consoleLogger },
44
+ currentSchema,
45
+ bucketName
46
+ );
47
+
48
+ const externalDynamoResources = [];
49
+ const ownStorageResources = {};
50
+ const mergedStorageResources = mergedSchema.storageResources || {};
51
+ for (const [key, resource] of Object.entries(mergedStorageResources)) {
52
+ if (
53
+ resource &&
54
+ (resource.storageType === 'dynamo' ||
55
+ resource.storageType === 'dynamoDB' ||
56
+ !resource.storageType) &&
57
+ !childStorageResourceKeys.has(key)
58
+ ) {
59
+ externalDynamoResources.push({
60
+ serviceTag: parentServiceTag,
61
+ tableName: resource.tableName
62
+ });
63
+ } else {
64
+ ownStorageResources[key] = resource;
65
+ }
66
+ }
67
+
68
+ mergedSchema.storageResources = ownStorageResources;
69
+ if (externalDynamoResources.length > 0) {
70
+ mergedSchema.externalDynamoResources = externalDynamoResources;
71
+ }
72
+
73
+ currentSchema = mergedSchema;
74
+ } catch (error) {
75
+ console.log(
76
+ `[ERROR] [resolveExtendedObjectSchemas] Failed to merge ` +
77
+ `extendObjType for objectType=${currentSchema.objectType}`,
78
+ { error }
79
+ );
80
+ throw error;
81
+ }
82
+ }
83
+
84
+ if (currentSchema.hasOwnProperty('belongTo') && currentSchema.belongTo) {
85
+ let belongToTarget = currentSchema.belongTo;
86
+ if (Array.isArray(currentSchema.belongTo)) {
87
+ belongToTarget = currentSchema.belongTo[0];
88
+ }
89
+
90
+ if (
91
+ belongToTarget &&
92
+ belongToTarget.serviceTag &&
93
+ belongToTarget.objectType
94
+ ) {
95
+ try {
96
+ console.log(
97
+ `[DEBUG] [resolveExtendedObjectSchemas] Fetching belongTo ` +
98
+ `schema for objectType=${currentSchema.objectType}`,
99
+ { belongTo: belongToTarget }
100
+ );
101
+ const belongToObjType = {
102
+ serviceTag: belongToTarget.serviceTag,
103
+ objectType: belongToTarget.objectType
104
+ };
105
+ const belongToSchema = await getObjectSchema.getObjSchemaS3(
106
+ { logger: consoleLogger },
107
+ belongToObjType,
108
+ false,
109
+ bucketName
110
+ );
111
+ currentSchema.belongToSchema = belongToSchema;
112
+ console.log(
113
+ `[DEBUG] [resolveExtendedObjectSchemas] Successfully fetched ` +
114
+ `belongTo schema for objectType=${currentSchema.objectType}`,
115
+ { belongToObjectType: belongToSchema?.objectType }
116
+ );
117
+ } catch (error) {
118
+ console.log(
119
+ `[WARN] [resolveExtendedObjectSchemas] Failed to fetch ` +
120
+ `belongTo schema for objectType=${currentSchema.objectType}`,
121
+ { error }
122
+ );
123
+ }
124
+ }
125
+ }
126
+
127
+ resolvedSchemas.push(currentSchema);
128
+ }
129
+ return resolvedSchemas;
130
+ }
131
+
132
+ export async function resolveGraphServiceTags(
133
+ schemas,
134
+ bucketName = process.env.iz_serviceSchemaBucketName
135
+ ) {
136
+ if (!Array.isArray(schemas) || schemas.length === 0) {
137
+ return [];
138
+ }
139
+
140
+ const graphServerTags = new Set();
141
+ for (const schema of schemas) {
142
+ if (!schema || typeof schema !== 'object') continue;
143
+ let targetObjs = [];
144
+ if (schema.storageResources) {
145
+ targetObjs = [schema];
146
+ } else {
147
+ targetObjs = Object.values(schema).filter(
148
+ (val) => val && typeof val === 'object' && val.storageResources
149
+ );
150
+ }
151
+
152
+ for (const targetObj of targetObjs) {
153
+ const resources = targetObj.storageResources;
154
+ if (resources && typeof resources === 'object') {
155
+ for (const res of Object.values(resources)) {
156
+ if (res?.storageType === 'graph' && res.graphServerTag) {
157
+ graphServerTags.add(res.graphServerTag);
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+ if (graphServerTags.size === 0) {
165
+ return [];
166
+ }
167
+
168
+ let graphServerTagsMap = {};
169
+ if (bucketName) {
170
+ try {
171
+ const _izContext = { logger: consoleLogger };
172
+ const s3Data = await s3.getObjectS3(_izContext, {
173
+ Bucket: bucketName,
174
+ Key: 'serviceConfig/GraphServerTags.json'
175
+ });
176
+ if (s3Data && typeof s3Data === 'object') {
177
+ graphServerTagsMap = s3Data;
178
+ }
179
+ } catch (error) {
180
+ console.log(
181
+ `[DEBUG] [resolveGraphServiceTags] Could not fetch ` +
182
+ `GraphServerTags.json from bucket=${bucketName}`,
183
+ error
184
+ );
185
+ }
186
+ }
187
+
188
+ const resolvedTags = new Set();
189
+ for (const tag of graphServerTags) {
190
+ const serviceTag = graphServerTagsMap[tag] || tag || 'GraphHandler';
191
+ resolvedTags.add(serviceTag);
192
+ }
193
+
194
+ return Array.from(resolvedTags);
195
+ }