@izara_project/izara-core-generate-service-code 1.0.96 → 1.0.98

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 (219) hide show
  1. package/index.js +2 -2
  2. package/package.json +2 -1
  3. package/src/compile/loadSchemas.js +44 -322
  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/{crud → application/crud}/templates/FlowEndpoint_HdrWbs.ejs +2 -2
  10. package/src/emit/{crud → application/crud}/templates/FlowMain_Wbs.ejs +2 -2
  11. package/src/emit/{custom → application/custom}/customFlowS3.js +1 -1
  12. package/src/emit/{custom → application/custom}/customFlowSteps.js +1 -1
  13. package/src/emit/{custom → application/custom}/customFlowTemplates.js +1 -1
  14. package/src/emit/{custom → application/custom}/emitCustomFlowApplicationArtifacts.js +1 -1
  15. package/src/emit/{custom → application/custom}/generateCustomFlowApplicationArtifacts.js +2 -2
  16. package/src/emit/{custom → application/custom}/templates/s3/CreateObject_Main.ejs +5 -2
  17. package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs +2 -2
  18. package/src/emit/{rbac → application/rbac}/emitRbacApplicationArtifacts.js +2 -2
  19. package/src/emit/{rbac → application/rbac}/generateCreateTargetRoleHandler.js +2 -2
  20. package/src/emit/{rbac → application/rbac}/generateDynamicRbacFlowSchemas.js +2 -2
  21. package/src/emit/{relationship → application/relationship}/emitRelationshipApplicationArtifacts.js +3 -3
  22. package/src/emit/{relationship → application/relationship}/generateDynamicRelationshipFlowSchemas.js +2 -2
  23. package/src/emit/{relationship → application/relationship}/generateRelationshipApplicationArtifacts.js +2 -2
  24. package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs +3 -2
  25. package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs +3 -2
  26. package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs +3 -2
  27. package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs +3 -2
  28. package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs +3 -2
  29. package/src/emit/{relationship → application/relationship}/templates/UpdateRelationship_Main.ejs +3 -2
  30. package/src/emit/{system → application/system}/emitSystemFindDataArtifacts.js +1 -1
  31. package/src/emit/{system → application/system}/templates/RegisterComplete_Main.ejs +6 -2
  32. package/src/emit/{system → application/system}/templates/Register_Main.ejs +6 -2
  33. package/src/emit/{system → application/system}/templates/WebSocketComplete_Main.ejs +3 -3
  34. package/src/emit/{resource → infrastructure/resources}/generateResourceArtifacts.js +2 -2
  35. package/src/emit/{resource → infrastructure/resources}/iamResourceArtifacts.js +3 -3
  36. package/src/emit/{resource → infrastructure/resources}/resourceState.js +4 -4
  37. package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +14 -22
  38. package/src/emit/schemas/attributeTree/emitAttributeTreeTargetValueStandard.js +132 -0
  39. package/src/emit/schemas/ledger/emitLedgerSchemas.js +392 -0
  40. package/src/emit/schemas/ledger/templates/LedgerObjectSchema.ejs +3 -0
  41. package/src/emit/schemas/ledger/templates/LedgerRelationshipSchema.ejs +1 -0
  42. package/src/emit/schemas/propertyValue/emitPropertyValueSchemas.js +329 -0
  43. package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
  44. package/src/generate.js +34 -308
  45. package/src/{generateIntTest.js → intTest/generateIntTest.js} +2 -2
  46. package/src/{generateResourceIntTest.js → intTest/generateResourceIntTest.js} +2 -2
  47. package/src/output/mergeHooks.js +69 -15
  48. package/src/plan/domainRegistry.js +307 -0
  49. package/task.md +132 -0
  50. package/test/helpers/testProject.js +127 -0
  51. package/test/helpers/testProject.test.js +57 -0
  52. package/test/{core.test.js → integration/core.test.js} +3 -3
  53. package/test/{graphDrivenFlowSchema.test.js → integration/graphDrivenFlowSchema.test.js} +1 -1
  54. package/test/{intTestApi.test.js → integration/intTestApi.test.js} +1 -1
  55. package/test/{publicApi.test.js → integration/publicApi.test.js} +55 -2
  56. package/test/{createTargetRoleHandler.test.js → unit/application/createTargetRoleHandler.test.js} +1 -1
  57. package/test/{crudApplicationArtifacts.test.js → unit/application/crudApplicationArtifacts.test.js} +1 -1
  58. package/test/{customFlowApplicationArtifacts.test.js → unit/application/customFlowApplicationArtifacts.test.js} +18 -9
  59. package/test/{relationshipApplicationArtifacts.test.js → unit/application/relationshipApplicationArtifacts.test.js} +31 -1
  60. package/test/{systemFindDataArtifacts.test.js → unit/application/systemFindDataArtifacts.test.js} +1 -1
  61. package/test/{functionYamlArtifact.test.js → unit/infrastructure/functionYamlArtifact.test.js} +1 -1
  62. package/test/{resourceArtifacts.test.js → unit/infrastructure/resourceArtifacts.test.js} +2 -1
  63. package/test/unit/output/mergeHooks.test.js +268 -0
  64. package/test/unit/schemas/attributeTreeDirectives.test.js +177 -0
  65. package/test/{attributeTreeSchemas.test.js → unit/schemas/attributeTreeSchemas.test.js} +46 -102
  66. package/test/{dynamicCrudFlowSchemas.test.js → unit/schemas/dynamicCrudFlowSchemas.test.js} +2 -2
  67. package/test/{dynamicRbacFlowSchemas.test.js → unit/schemas/dynamicRbacFlowSchemas.test.js} +1 -1
  68. package/test/{dynamicRelationshipFlowSchemas.test.js → unit/schemas/dynamicRelationshipFlowSchemas.test.js} +11 -1
  69. package/test/{errorSchemas.test.js → unit/schemas/errorSchemas.test.js} +2 -2
  70. package/test/unit/schemas/ledgerSchemas.test.js +289 -0
  71. package/test/unit/schemas/propertyValueSchemas.test.js +265 -0
  72. package/test/{systemTextSchemas.test.js → unit/schemas/systemTextSchemas.test.js} +24 -36
  73. package/src/emit/attributeTree/emitAttributeTreeTargetSchemas.js +0 -153
  74. package/src/emit/attributeTree/resolveTargetServicePath.js +0 -111
  75. package/src/emit/crud/loadLocalSchemaArrays.js +0 -4
  76. /package/src/emit/{coreFunction → application/coreFunction}/emitCoreFunctionArtifacts.js +0 -0
  77. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreFunction_Yaml.ejs +0 -0
  78. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreResource_Yaml.ejs +0 -0
  79. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_HdrInv.ejs +0 -0
  80. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_Main.ejs +0 -0
  81. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_HdrInv.ejs +0 -0
  82. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_Main.ejs +0 -0
  83. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +0 -0
  84. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_Main.ejs +0 -0
  85. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs +0 -0
  86. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs +0 -0
  87. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs +0 -0
  88. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs +0 -0
  89. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs +0 -0
  90. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_initialSetup.ejs +0 -0
  91. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedDynamo.ejs +0 -0
  92. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedGraph.ejs +0 -0
  93. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedRemove.ejs +0 -0
  94. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_uploadSchema.ejs +0 -0
  95. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs +0 -0
  96. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_Main.ejs +0 -0
  97. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_HdrInv.ejs +0 -0
  98. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs +0 -0
  99. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs +0 -0
  100. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_Main.ejs +0 -0
  101. /package/src/emit/{crud → application/crud}/crudActionPlan.js +0 -0
  102. /package/src/emit/{crud → application/crud}/dynamicCrudFlowSchemaTemplate.js +0 -0
  103. /package/src/emit/{crud → application/crud}/emitDynamicCrudFlowSchemas.js +0 -0
  104. /package/src/emit/{crud → application/crud}/templates/CreateAfterHookCallback_Main.ejs +0 -0
  105. /package/src/emit/{crud → application/crud}/templates/CreateBeforeHookCallback_Main.ejs +0 -0
  106. /package/src/emit/{crud → application/crud}/templates/CreateComplete_Main.ejs +0 -0
  107. /package/src/emit/{crud → application/crud}/templates/CreateConfirmComplete_Main.ejs +0 -0
  108. /package/src/emit/{crud → application/crud}/templates/CreateEndpoint_Main.ejs +0 -0
  109. /package/src/emit/{crud → application/crud}/templates/CreateLogicalLib.ejs +0 -0
  110. /package/src/emit/{crud → application/crud}/templates/CreateNodeCallback_Main.ejs +0 -0
  111. /package/src/emit/{crud → application/crud}/templates/DeleteAfterHookCallback_Main.ejs +0 -0
  112. /package/src/emit/{crud → application/crud}/templates/DeleteBeforeHookCallback_Main.ejs +0 -0
  113. /package/src/emit/{crud → application/crud}/templates/DeleteComplete_Main.ejs +0 -0
  114. /package/src/emit/{crud → application/crud}/templates/DeleteEndpoint_Main.ejs +0 -0
  115. /package/src/emit/{crud → application/crud}/templates/DeleteLogicalLib.ejs +0 -0
  116. /package/src/emit/{crud → application/crud}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  117. /package/src/emit/{crud → application/crud}/templates/GetEndpoint_Main.ejs +0 -0
  118. /package/src/emit/{crud → application/crud}/templates/GetRangeEndpoint_Main.ejs +0 -0
  119. /package/src/emit/{crud → application/crud}/templates/UpdateAfterHookCallback_Main.ejs +0 -0
  120. /package/src/emit/{crud → application/crud}/templates/UpdateBeforeHookCallback_Main.ejs +0 -0
  121. /package/src/emit/{crud → application/crud}/templates/UpdateComplete_Main.ejs +0 -0
  122. /package/src/emit/{crud → application/crud}/templates/UpdateEndpoint_Main.ejs +0 -0
  123. /package/src/emit/{crud → application/crud}/templates/UpdateLogicalLib.ejs +0 -0
  124. /package/src/emit/{custom → application/custom}/customFlowPaths.js +0 -0
  125. /package/src/emit/{custom → application/custom}/customFlows.js +0 -0
  126. /package/src/emit/{custom → application/custom}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  127. /package/src/emit/{custom → application/custom}/templates/FlowEndpoint_Main.ejs +0 -0
  128. /package/src/emit/{custom → application/custom}/templates/FlowStep_Main.ejs +0 -0
  129. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
  130. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_Main.ejs +0 -0
  131. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_HdrWbs.ejs +0 -0
  132. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
  133. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_Main.ejs +0 -0
  134. /package/src/emit/{custom → application/custom}/templates/s3/FlowHandler_HdrS3.ejs +0 -0
  135. /package/src/emit/{custom → application/custom}/templates/s3/ProcessS3File_Main.ejs +0 -0
  136. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
  137. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_Main.ejs +0 -0
  138. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  139. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  140. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs +0 -0
  141. /package/src/emit/{rbac → application/rbac}/emitDynamicRbacFlowSchemas.js +0 -0
  142. /package/src/emit/{rbac → application/rbac}/rbacFlowTag.js +0 -0
  143. /package/src/emit/{rbac → application/rbac}/templates/CancelUsage_Main.ejs +0 -0
  144. /package/src/emit/{rbac → application/rbac}/templates/ConfirmUsage_Main.ejs +0 -0
  145. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_HdrSqs.ejs +0 -0
  146. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_Main.ejs +0 -0
  147. /package/src/emit/{rbac → application/rbac}/templates/DeleteTargetRole_Main.ejs +0 -0
  148. /package/src/emit/{rbac → application/rbac}/templates/DynamicRbacFlowSchema.ejs +0 -0
  149. /package/src/emit/{rbac → application/rbac}/templates/GetMyPermissions_Main.ejs +0 -0
  150. /package/src/emit/{rbac → application/rbac}/templates/GetTargetRole_Main.ejs +0 -0
  151. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrApi.ejs +0 -0
  152. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrSqs.ejs +0 -0
  153. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_Main.ejs +0 -0
  154. /package/src/emit/{rbac → application/rbac}/templates/RbacMutation_Main.ejs +0 -0
  155. /package/src/emit/{rbac → application/rbac}/templates/ReservedDynamicUsage_Main.ejs +0 -0
  156. /package/src/emit/{rbac → application/rbac}/templates/UpdateTargetRole_Main.ejs +0 -0
  157. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_HdrSqs.ejs +0 -0
  158. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_Main.ejs +0 -0
  159. /package/src/emit/{rbac → application/rbac}/templates/UserRoleMutation_Main.ejs +0 -0
  160. /package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js +0 -0
  161. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_HdrSqs.ejs +0 -0
  162. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_Main.ejs +0 -0
  163. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_HdrSqs.ejs +0 -0
  164. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_Main.ejs +0 -0
  165. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_HdrSqs.ejs +0 -0
  166. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_Main.ejs +0 -0
  167. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_HdrSqs.ejs +0 -0
  168. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_Main.ejs +0 -0
  169. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_HdrSqs.ejs +0 -0
  170. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_Main.ejs +0 -0
  171. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_HdrSqs.ejs +0 -0
  172. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_Main.ejs +0 -0
  173. /package/src/emit/{system → application/system}/emitSystemWebSocketArtifacts.js +0 -0
  174. /package/src/emit/{system → application/system}/templates/RegisterComplete_HdrSqs.ejs +0 -0
  175. /package/src/emit/{system → application/system}/templates/RegisterComplete_Yaml.ejs +0 -0
  176. /package/src/emit/{system → application/system}/templates/RegisterWbs_Yaml.ejs +0 -0
  177. /package/src/emit/{system → application/system}/templates/Register_HdrWbs.ejs +0 -0
  178. /package/src/emit/{system → application/system}/templates/WebSocketComplete_HdrSqs.ejs +0 -0
  179. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Yaml.ejs +0 -0
  180. /package/src/emit/{system → application/system}/templates/WebSocketConnect.ejs +0 -0
  181. /package/src/emit/{system → application/system}/templates/WebSocketConnect_Yaml.ejs +0 -0
  182. /package/src/emit/{function → infrastructure/functions}/functionYamlArtifact.js +0 -0
  183. /package/src/emit/{function → infrastructure/functions}/templates/ApiFunction_Yaml.ejs +0 -0
  184. /package/src/emit/{function → infrastructure/functions}/templates/EventBridgeFunction_Yaml.ejs +0 -0
  185. /package/src/emit/{function → infrastructure/functions}/templates/InvFunction_Yaml.ejs +0 -0
  186. /package/src/emit/{function → infrastructure/functions}/templates/S3Function_Yaml.ejs +0 -0
  187. /package/src/emit/{function → infrastructure/functions}/templates/SqsFunction_Yaml.ejs +0 -0
  188. /package/src/emit/{function → infrastructure/functions}/templates/WbsFunction_Yaml.ejs +0 -0
  189. /package/src/emit/{resource → infrastructure/resources}/dynamoResourceArtifacts.js +0 -0
  190. /package/src/emit/{resource → infrastructure/resources}/emitResourceArtifacts.js +0 -0
  191. /package/src/emit/{resource → infrastructure/resources}/resourceTemplate.js +0 -0
  192. /package/src/emit/{resource → infrastructure/resources}/s3ResourceArtifacts.js +0 -0
  193. /package/src/emit/{resource → infrastructure/resources}/sqsResourceArtifacts.js +0 -0
  194. /package/src/emit/{resource → infrastructure/resources}/templates/DynamoDBTable_Yaml.ejs +0 -0
  195. /package/src/emit/{resource → infrastructure/resources}/templates/FlowOut_Yaml.ejs +0 -0
  196. /package/src/emit/{resource → infrastructure/resources}/templates/GeneratedLambdaRoleServiceConfig.ejs +0 -0
  197. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceSqsYaml.ejs +0 -0
  198. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceYaml.ejs +0 -0
  199. /package/src/emit/{resource → infrastructure/resources}/templates/S3Bucket_Yaml.ejs +0 -0
  200. /package/src/emit/{resource → infrastructure/resources}/templates/S3Subscription_Yaml.ejs +0 -0
  201. /package/src/emit/{resource → infrastructure/resources}/templates/SharedResource_Yaml.ejs +0 -0
  202. /package/src/emit/{resource → infrastructure/resources}/templates/SystemDynamoDB_Yaml.ejs +0 -0
  203. /package/src/emit/{resource → infrastructure/resources}/templates/WebSocketSubscription_Yaml.ejs +0 -0
  204. /package/src/emit/{error → schemas/error}/emitErrorSchemas.js +0 -0
  205. /package/src/emit/{error → schemas/error}/templates/errorSchema.ejs +0 -0
  206. /package/src/emit/{systemText → schemas/systemText}/templates/SystemTextSchemas.ejs +0 -0
  207. /package/src/{generateResources/IntTest → intTest/generators}/consts.js +0 -0
  208. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/generateResources.js +0 -0
  209. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/templateResources.ejs +0 -0
  210. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/events.js +0 -0
  211. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/templateEvents.ejs +0 -0
  212. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/generateTemplate.js +0 -0
  213. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/pathIntTest.js +0 -0
  214. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/template.ejs +0 -0
  215. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/templateTests.ejs +0 -0
  216. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/tests.js +0 -0
  217. /package/src/{generateResources/IntTest → intTest/generators}/libs/IntTestGenerateLib.js +0 -0
  218. /package/src/{generateResources/IntTest → intTest/generators}/upload/uploadIntTest.js +0 -0
  219. /package/src/{intTestGeneratorShared.js → intTest/intTestGeneratorShared.js} +0 -0
@@ -1,153 +0,0 @@
1
- import path from 'node:path';
2
-
3
- function _renderObjectSchema(schema) {
4
- return `export default [\n ${JSON.stringify(schema, null, 2).replace(/\n/g, '\n ')}\n];\n`;
5
- }
6
-
7
- /**
8
- * Emits standard schemas into target service folder for attributeTree.
9
- *
10
- * @param {Object} params
11
- * @param {string} params.attributeTag - e.g. 'sellOfferTerm'
12
- * @param {string} params.targetServiceRoot - Target service root directory
13
- * @param {Object} [params.graphStorageResources] - Graph storage resources
14
- * @returns {Array<{ path: string, content: string }>} Emitted target artifacts
15
- */
16
- export function emitAttributeTreeTargetSchemas({
17
- attributeTag,
18
- targetServiceRoot,
19
- graphStorageResources = {
20
- myGraph: {
21
- storageType: 'graph',
22
- graphServerTag: 'GraphHandler'
23
- }
24
- }
25
- } = {}) {
26
- if (!attributeTag || !targetServiceRoot) {
27
- return [];
28
- }
29
-
30
- const tag = attributeTag;
31
- const storageResourceTags = Object.keys(graphStorageResources);
32
-
33
- // 1. {tag}ValueStandardPropertyLabel.js
34
- const labelSchema = {
35
- objectType: `${tag}ValueStandardPropertyLabel`,
36
- canDelete: true,
37
- generatedBy: 'user',
38
- storageResources: graphStorageResources,
39
- fieldNames: {
40
- [`${tag}ValueStandardPropertyLabelId`]: {
41
- type: 'string',
42
- randomOnCreate: true,
43
- canUpdate: false,
44
- storageResourceTags
45
- },
46
- label: {
47
- type: 'string',
48
- requiredOnCreate: true,
49
- canUpdate: true,
50
- storageResourceTags
51
- }
52
- },
53
- identifiers: [
54
- {
55
- type: 'identifier',
56
- fieldName: `${tag}ValueStandardPropertyLabelId`
57
- }
58
- ]
59
- };
60
-
61
- // 2. {tag}ValueStandardPropertyValue.js
62
- const valueSchema = {
63
- objectType: `${tag}ValueStandardPropertyValue`,
64
- canDelete: true,
65
- generatedBy: 'user',
66
- storageResources: graphStorageResources,
67
- fieldNames: {
68
- [`${tag}ValueStandardPropertyValueId`]: {
69
- type: 'string',
70
- randomOnCreate: true,
71
- canUpdate: false,
72
- storageResourceTags
73
- },
74
- value: {
75
- type: 'string',
76
- requiredOnCreate: true,
77
- canUpdate: true,
78
- storageResourceTags
79
- }
80
- },
81
- identifiers: [
82
- {
83
- type: 'identifier',
84
- fieldName: `${tag}ValueStandardPropertyValueId`
85
- }
86
- ]
87
- };
88
-
89
- // 3. {tag}ValueStandard.js
90
- const standardValueSchema = {
91
- objectType: `${tag}ValueStandard`,
92
- canDelete: true,
93
- generatedBy: 'user',
94
- storageResources: graphStorageResources,
95
- fieldNames: {
96
- [`${tag}ValueStandardId`]: {
97
- type: 'string',
98
- randomOnCreate: true,
99
- canUpdate: false,
100
- storageResourceTags
101
- },
102
- value: {
103
- type: 'string',
104
- requiredOnCreate: true,
105
- canUpdate: true,
106
- storageResourceTags
107
- }
108
- },
109
- identifiers: [
110
- {
111
- type: 'identifier',
112
- fieldName: `${tag}ValueStandardId`
113
- }
114
- ]
115
- };
116
-
117
- const relDir = path.join(
118
- 'app',
119
- 'src',
120
- 'schemas',
121
- 'ObjectSchemas',
122
- 'generatedCode',
123
- 'attributeTree',
124
- 'propertyValue'
125
- );
126
-
127
- return [
128
- {
129
- path: path.join(
130
- targetServiceRoot,
131
- relDir,
132
- `${tag}ValueStandardPropertyLabel.js`
133
- ),
134
- content: _renderObjectSchema(labelSchema)
135
- },
136
- {
137
- path: path.join(
138
- targetServiceRoot,
139
- relDir,
140
- `${tag}ValueStandardPropertyValue.js`
141
- ),
142
- content: _renderObjectSchema(valueSchema)
143
- },
144
- {
145
- path: path.join(
146
- targetServiceRoot,
147
- relDir,
148
- `${tag}ValueStandard.js`
149
- ),
150
- content: _renderObjectSchema(standardValueSchema)
151
- }
152
- ];
153
- }
@@ -1,111 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
-
4
- /**
5
- * Resolves target service root path based on attributeTag and developer suffix.
6
- *
7
- * @param {Object} params
8
- * @param {string} params.currentServiceRoot - Root path of the current service
9
- * @param {string} params.attributeTag - The attribute tag, e.g. 'sellOfferTerm'
10
- * @param {string} [params.customOverridePath] - Optional custom path override
11
- * @returns {string|null} Resolved absolute path or null if not found
12
- */
13
- export function resolveTargetServicePath({
14
- currentServiceRoot,
15
- attributeTag,
16
- customOverridePath
17
- } = {}) {
18
- if (!currentServiceRoot || !attributeTag) {
19
- return null;
20
- }
21
-
22
- if (customOverridePath) {
23
- const resolvedCustom = path.resolve(
24
- currentServiceRoot,
25
- customOverridePath
26
- );
27
- if (fs.existsSync(resolvedCustom)) {
28
- return resolvedCustom;
29
- }
30
- }
31
-
32
- const currentFolderName = path.basename(currentServiceRoot);
33
- const parentDir = path.resolve(currentServiceRoot, '..');
34
-
35
- if (!fs.existsSync(parentDir)) {
36
- return null;
37
- }
38
-
39
- let entries = [];
40
- try {
41
- entries = fs.readdirSync(parentDir, { withFileTypes: true });
42
- } catch (err) {
43
- return null;
44
- }
45
-
46
- const suffixMatch = currentFolderName.match(/-([a-zA-Z0-9]+)$/);
47
- let devSuffix = '';
48
- if (suffixMatch && suffixMatch[1]) {
49
- devSuffix = suffixMatch[1].toLowerCase();
50
- }
51
-
52
- const normalizedTag = attributeTag.toLowerCase();
53
- const kebabTag = attributeTag
54
- .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
55
- .toLowerCase();
56
-
57
- const priority1Matches = [];
58
- const priority2Matches = [];
59
- const priority3Matches = [];
60
-
61
- for (const entry of entries) {
62
- if (!entry.isDirectory()) {
63
- continue;
64
- }
65
-
66
- if (entry.name === currentFolderName) {
67
- continue;
68
- }
69
-
70
- const folderNameLower = entry.name.toLowerCase();
71
- const hasTagMatch =
72
- folderNameLower.includes(normalizedTag) ||
73
- folderNameLower.includes(kebabTag);
74
-
75
- if (!hasTagMatch) {
76
- continue;
77
- }
78
-
79
- const fullPath = path.join(parentDir, entry.name);
80
- const hasStructure =
81
- fs.existsSync(path.join(fullPath, 'app', 'src')) ||
82
- fs.existsSync(path.join(fullPath, 'package.json'));
83
-
84
- if (!hasStructure) {
85
- continue;
86
- }
87
-
88
- if (devSuffix !== '' && folderNameLower.endsWith('-' + devSuffix)) {
89
- priority1Matches.push(fullPath);
90
- } else if (
91
- folderNameLower.endsWith(normalizedTag) ||
92
- folderNameLower.endsWith(kebabTag)
93
- ) {
94
- priority2Matches.push(fullPath);
95
- } else {
96
- priority3Matches.push(fullPath);
97
- }
98
- }
99
-
100
- if (priority1Matches.length > 0) {
101
- return priority1Matches[0];
102
- }
103
- if (priority2Matches.length > 0) {
104
- return priority2Matches[0];
105
- }
106
- if (priority3Matches.length > 0) {
107
- return priority3Matches[0];
108
- }
109
-
110
- return null;
111
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated Use `loadLocalSchemaArrays` from `../../compile/loadSchemas.js` instead.
3
- */
4
- export { loadLocalSchemaArrays } from '../../compile/loadSchemas.js';