@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.
- package/index.js +2 -2
- package/package.json +2 -1
- package/src/compile/loadSchemas.js +17 -318
- package/src/compile/loadSchemasRemote.js +195 -0
- package/src/compile/schemaValidatorSetup.js +143 -0
- package/src/emit/{crud → application/crud}/emitCrudApplicationArtifacts.js +2 -2
- package/src/emit/{crud → application/crud}/generateCrudApplicationArtifacts.js +2 -2
- package/src/emit/{crud → application/crud}/generateDynamicCrudFlowSchemas.js +2 -2
- package/src/emit/{custom → application/custom}/customFlowS3.js +1 -1
- package/src/emit/{custom → application/custom}/customFlowSteps.js +34 -5
- package/src/emit/{custom → application/custom}/customFlowTemplates.js +1 -1
- package/src/emit/{custom → application/custom}/emitCustomFlowApplicationArtifacts.js +1 -1
- package/src/emit/{custom → application/custom}/generateCustomFlowApplicationArtifacts.js +2 -2
- package/src/emit/{custom → application/custom}/templates/FlowEndpoint_Main.ejs +66 -4
- package/src/emit/{custom → application/custom}/templates/FlowStep_Main.ejs +27 -0
- package/src/emit/{rbac → application/rbac}/emitRbacApplicationArtifacts.js +2 -2
- package/src/emit/{rbac → application/rbac}/generateCreateTargetRoleHandler.js +2 -2
- package/src/emit/{rbac → application/rbac}/generateDynamicRbacFlowSchemas.js +2 -2
- package/src/emit/{relationship → application/relationship}/emitRelationshipApplicationArtifacts.js +3 -3
- package/src/emit/{relationship → application/relationship}/generateDynamicRelationshipFlowSchemas.js +2 -2
- package/src/emit/{relationship → application/relationship}/generateRelationshipApplicationArtifacts.js +2 -2
- package/src/emit/{system → application/system}/emitSystemFindDataArtifacts.js +1 -1
- package/src/emit/{resource → infrastructure/resources}/generateResourceArtifacts.js +2 -2
- package/src/emit/{resource → infrastructure/resources}/iamResourceArtifacts.js +2 -2
- package/src/emit/{resource → infrastructure/resources}/resourceState.js +4 -4
- package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +29 -48
- package/src/emit/schemas/attributeTree/emitAttributeTreeTargetSchemas.js +153 -0
- package/src/emit/schemas/attributeTree/resolveTargetServicePath.js +111 -0
- package/src/emit/schemas/ledger/emitLedgerSchemas.js +370 -0
- package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
- package/src/generate.js +81 -240
- package/src/{generateIntTest.js → intTest/generateIntTest.js} +2 -2
- package/src/{generateResourceIntTest.js → intTest/generateResourceIntTest.js} +2 -2
- package/src/plan/domainRegistry.js +271 -0
- package/test/helpers/testProject.js +127 -0
- package/test/helpers/testProject.test.js +57 -0
- package/test/{core.test.js → integration/core.test.js} +3 -3
- package/test/{graphDrivenFlowSchema.test.js → integration/graphDrivenFlowSchema.test.js} +1 -1
- package/test/{intTestApi.test.js → integration/intTestApi.test.js} +1 -1
- package/test/{publicApi.test.js → integration/publicApi.test.js} +1 -1
- package/test/{createTargetRoleHandler.test.js → unit/application/createTargetRoleHandler.test.js} +1 -1
- package/test/{crudApplicationArtifacts.test.js → unit/application/crudApplicationArtifacts.test.js} +1 -1
- package/test/{customFlowApplicationArtifacts.test.js → unit/application/customFlowApplicationArtifacts.test.js} +139 -9
- package/test/{relationshipApplicationArtifacts.test.js → unit/application/relationshipApplicationArtifacts.test.js} +1 -1
- package/test/{systemFindDataArtifacts.test.js → unit/application/systemFindDataArtifacts.test.js} +1 -1
- package/test/{functionYamlArtifact.test.js → unit/infrastructure/functionYamlArtifact.test.js} +1 -1
- package/test/{resourceArtifacts.test.js → unit/infrastructure/resourceArtifacts.test.js} +1 -1
- package/test/{attributeTreeSchemas.test.js → unit/schemas/attributeTreeSchemas.test.js} +127 -50
- package/test/{dynamicCrudFlowSchemas.test.js → unit/schemas/dynamicCrudFlowSchemas.test.js} +2 -2
- package/test/{dynamicRbacFlowSchemas.test.js → unit/schemas/dynamicRbacFlowSchemas.test.js} +1 -1
- package/test/{dynamicRelationshipFlowSchemas.test.js → unit/schemas/dynamicRelationshipFlowSchemas.test.js} +11 -1
- package/test/{errorSchemas.test.js → unit/schemas/errorSchemas.test.js} +2 -2
- package/test/unit/schemas/ledgerSchemas.test.js +263 -0
- package/test/{systemTextSchemas.test.js → unit/schemas/systemTextSchemas.test.js} +24 -36
- package/src/emit/crud/loadLocalSchemaArrays.js +0 -4
- /package/src/emit/{coreFunction → application/coreFunction}/emitCoreFunctionArtifacts.js +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreFunction_Yaml.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreResource_Yaml.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_Main.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_Main.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_Main.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_initialSetup.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedDynamo.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedGraph.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedRemove.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_uploadSchema.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_Main.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs +0 -0
- /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/crudActionPlan.js +0 -0
- /package/src/emit/{crud → application/crud}/dynamicCrudFlowSchemaTemplate.js +0 -0
- /package/src/emit/{crud → application/crud}/emitDynamicCrudFlowSchemas.js +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateAfterHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateBeforeHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateComplete_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateConfirmComplete_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateEndpoint_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateLogicalLib.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/CreateNodeCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/DeleteAfterHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/DeleteBeforeHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/DeleteComplete_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/DeleteEndpoint_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/DeleteLogicalLib.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/FlowEndpoint_HdrWbs.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/FlowMain_Wbs.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/GetEndpoint_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/GetRangeEndpoint_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/UpdateAfterHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/UpdateBeforeHookCallback_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/UpdateComplete_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/UpdateEndpoint_Main.ejs +0 -0
- /package/src/emit/{crud → application/crud}/templates/UpdateLogicalLib.ejs +0 -0
- /package/src/emit/{custom → application/custom}/customFlowPaths.js +0 -0
- /package/src/emit/{custom → application/custom}/customFlows.js +0 -0
- /package/src/emit/{custom → application/custom}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_HdrWbs.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/FlowHandler_HdrS3.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/ProcessS3File_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/emitDynamicRbacFlowSchemas.js +0 -0
- /package/src/emit/{rbac → application/rbac}/rbacFlowTag.js +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/CancelUsage_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/ConfirmUsage_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_HdrSqs.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/DeleteTargetRole_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/DynamicRbacFlowSchema.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/GetMyPermissions_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/GetTargetRole_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrApi.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrSqs.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/ListRbac_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/RbacMutation_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/ReservedDynamicUsage_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/UpdateTargetRole_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_HdrSqs.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_Main.ejs +0 -0
- /package/src/emit/{rbac → application/rbac}/templates/UserRoleMutation_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_Main.ejs +0 -0
- /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationship_Main.ejs +0 -0
- /package/src/emit/{system → application/system}/emitSystemWebSocketArtifacts.js +0 -0
- /package/src/emit/{system → application/system}/templates/RegisterComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/RegisterComplete_Main.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/RegisterComplete_Yaml.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/RegisterWbs_Yaml.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/Register_HdrWbs.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/Register_Main.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/WebSocketComplete_HdrSqs.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/WebSocketComplete_Main.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/WebSocketComplete_Yaml.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/WebSocketConnect.ejs +0 -0
- /package/src/emit/{system → application/system}/templates/WebSocketConnect_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/functionYamlArtifact.js +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/ApiFunction_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/EventBridgeFunction_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/InvFunction_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/S3Function_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/SqsFunction_Yaml.ejs +0 -0
- /package/src/emit/{function → infrastructure/functions}/templates/WbsFunction_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/dynamoResourceArtifacts.js +0 -0
- /package/src/emit/{resource → infrastructure/resources}/emitResourceArtifacts.js +0 -0
- /package/src/emit/{resource → infrastructure/resources}/resourceTemplate.js +0 -0
- /package/src/emit/{resource → infrastructure/resources}/s3ResourceArtifacts.js +0 -0
- /package/src/emit/{resource → infrastructure/resources}/sqsResourceArtifacts.js +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/DynamoDBTable_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/FlowOut_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/GeneratedLambdaRoleServiceConfig.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/ResourceSqsYaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/ResourceYaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/S3Bucket_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/S3Subscription_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/SharedResource_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/SystemDynamoDB_Yaml.ejs +0 -0
- /package/src/emit/{resource → infrastructure/resources}/templates/WebSocketSubscription_Yaml.ejs +0 -0
- /package/src/emit/{error → schemas/error}/emitErrorSchemas.js +0 -0
- /package/src/emit/{error → schemas/error}/templates/errorSchema.ejs +0 -0
- /package/src/emit/{systemText → schemas/systemText}/templates/SystemTextSchemas.ejs +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/consts.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateResources/generateResources.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateResources/templateResources.ejs +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/events.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/templateEvents.ejs +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/generateTemplate.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/pathIntTest.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/template.ejs +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/templateTests.ejs +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/tests.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/libs/IntTestGenerateLib.js +0 -0
- /package/src/{generateResources/IntTest → intTest/generators}/upload/uploadIntTest.js +0 -0
- /package/src/{intTestGeneratorShared.js → intTest/intTestGeneratorShared.js} +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { resolveTargetServicePath } from './resolveTargetServicePath.js';
|
|
2
|
+
import { emitAttributeTreeTargetSchemas } from './emitAttributeTreeTargetSchemas.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Emits dynamic ObjectSchemas and RelationshipSchemas for attributeTree add-ons
|
|
3
6
|
*/
|
|
@@ -68,12 +71,10 @@ export function attributeTreeObjectSchemaManagedPaths(objects = []) {
|
|
|
68
71
|
|
|
69
72
|
for (const { attributeTreeTag } of trees) {
|
|
70
73
|
const tag = attributeTreeTag;
|
|
71
|
-
const tagCap = _capitalize(tag);
|
|
72
74
|
paths.push(
|
|
73
75
|
`app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Link.js`,
|
|
74
|
-
`app/src/schemas/ObjectSchemas/generatedAttributeTree
|
|
75
|
-
`app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Label.js
|
|
76
|
-
`app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}ValueStandard.js`
|
|
76
|
+
`app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Value.js`,
|
|
77
|
+
`app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Label.js`
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -144,14 +145,14 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
144
145
|
content: _renderObjectSchema(linkSchema)
|
|
145
146
|
});
|
|
146
147
|
|
|
147
|
-
// 2.
|
|
148
|
+
// 2. {tag}Value.js
|
|
148
149
|
const valueSchema = {
|
|
149
|
-
objectType:
|
|
150
|
+
objectType: `${tag}Value`,
|
|
150
151
|
canDelete: true,
|
|
151
152
|
generatedBy: 'user',
|
|
152
153
|
storageResources: graphStorageResources,
|
|
153
154
|
fieldNames: {
|
|
154
|
-
[
|
|
155
|
+
[`${tag}ValueId`]: {
|
|
155
156
|
type: 'string',
|
|
156
157
|
randomOnCreate: true,
|
|
157
158
|
canUpdate: false,
|
|
@@ -167,12 +168,12 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
167
168
|
identifiers: [
|
|
168
169
|
{
|
|
169
170
|
type: 'identifier',
|
|
170
|
-
fieldName:
|
|
171
|
+
fieldName: `${tag}ValueId`
|
|
171
172
|
}
|
|
172
173
|
]
|
|
173
174
|
};
|
|
174
175
|
artifacts.push({
|
|
175
|
-
path: `app/src/schemas/ObjectSchemas/generatedAttributeTree
|
|
176
|
+
path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Value.js`,
|
|
176
177
|
content: _renderObjectSchema(valueSchema)
|
|
177
178
|
});
|
|
178
179
|
|
|
@@ -207,38 +208,6 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
207
208
|
path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Label.js`,
|
|
208
209
|
content: _renderObjectSchema(labelSchema)
|
|
209
210
|
});
|
|
210
|
-
|
|
211
|
-
// 4. {tag}ValueStandard.js
|
|
212
|
-
const standardValueSchema = {
|
|
213
|
-
objectType: `${tag}ValueStandard`,
|
|
214
|
-
canDelete: true,
|
|
215
|
-
generatedBy: 'user',
|
|
216
|
-
storageResources: graphStorageResources,
|
|
217
|
-
fieldNames: {
|
|
218
|
-
[`${tag}ValueStandardId`]: {
|
|
219
|
-
type: 'string',
|
|
220
|
-
randomOnCreate: true,
|
|
221
|
-
canUpdate: false,
|
|
222
|
-
storageResourceTags
|
|
223
|
-
},
|
|
224
|
-
value: {
|
|
225
|
-
type: 'string',
|
|
226
|
-
requiredOnCreate: true,
|
|
227
|
-
canUpdate: true,
|
|
228
|
-
storageResourceTags
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
identifiers: [
|
|
232
|
-
{
|
|
233
|
-
type: 'identifier',
|
|
234
|
-
fieldName: `${tag}ValueStandardId`
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
};
|
|
238
|
-
artifacts.push({
|
|
239
|
-
path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}ValueStandard.js`,
|
|
240
|
-
content: _renderObjectSchema(standardValueSchema)
|
|
241
|
-
});
|
|
242
211
|
}
|
|
243
212
|
|
|
244
213
|
return artifacts;
|
|
@@ -268,6 +237,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
268
237
|
const hasLinkRel = {
|
|
269
238
|
fieldNames: {},
|
|
270
239
|
storageResources: graphStorageResources,
|
|
240
|
+
generatedBy: 'user',
|
|
271
241
|
links: [
|
|
272
242
|
{
|
|
273
243
|
storageResourceTags,
|
|
@@ -283,7 +253,8 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
283
253
|
serviceTag: effectiveServiceTag,
|
|
284
254
|
objectType: `${tag}Link`
|
|
285
255
|
},
|
|
286
|
-
linkType: 'many'
|
|
256
|
+
linkType: 'many',
|
|
257
|
+
requiredOnCreate: true
|
|
287
258
|
}
|
|
288
259
|
}
|
|
289
260
|
]
|
|
@@ -297,6 +268,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
297
268
|
const disabledLinkRel = {
|
|
298
269
|
fieldNames: {},
|
|
299
270
|
storageResources: graphStorageResources,
|
|
271
|
+
generatedBy: 'user',
|
|
300
272
|
links: [
|
|
301
273
|
{
|
|
302
274
|
storageResourceTags,
|
|
@@ -329,6 +301,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
329
301
|
const isRel = {
|
|
330
302
|
fieldNames: {},
|
|
331
303
|
storageResources: graphStorageResources,
|
|
304
|
+
generatedBy: 'systemNoUser',
|
|
332
305
|
links: [
|
|
333
306
|
{
|
|
334
307
|
storageResourceTags,
|
|
@@ -337,14 +310,15 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
337
310
|
serviceTag: effectiveServiceTag,
|
|
338
311
|
objectType: `${tag}Link`
|
|
339
312
|
},
|
|
340
|
-
linkType: '
|
|
313
|
+
linkType: 'many',
|
|
314
|
+
requiredOnCreate: true
|
|
341
315
|
},
|
|
342
316
|
to: {
|
|
343
317
|
objType: {
|
|
344
318
|
serviceTag: effectiveServiceTag,
|
|
345
|
-
objectType:
|
|
319
|
+
objectType: `${tag}Value`
|
|
346
320
|
},
|
|
347
|
-
linkType: '
|
|
321
|
+
linkType: 'one'
|
|
348
322
|
}
|
|
349
323
|
}
|
|
350
324
|
]
|
|
@@ -358,22 +332,24 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
358
332
|
const isLabelRel = {
|
|
359
333
|
fieldNames: {},
|
|
360
334
|
storageResources: graphStorageResources,
|
|
335
|
+
generatedBy: 'systemNoUser',
|
|
361
336
|
links: [
|
|
362
337
|
{
|
|
363
338
|
storageResourceTags,
|
|
364
339
|
from: {
|
|
365
340
|
objType: {
|
|
366
341
|
serviceTag: effectiveServiceTag,
|
|
367
|
-
objectType: `${tag}
|
|
342
|
+
objectType: `${tag}Value`
|
|
368
343
|
},
|
|
369
|
-
linkType: '
|
|
344
|
+
linkType: 'many',
|
|
345
|
+
requiredOnCreate: true
|
|
370
346
|
},
|
|
371
347
|
to: {
|
|
372
348
|
objType: {
|
|
373
349
|
serviceTag: effectiveServiceTag,
|
|
374
350
|
objectType: `${tag}Label`
|
|
375
351
|
},
|
|
376
|
-
linkType: '
|
|
352
|
+
linkType: 'one'
|
|
377
353
|
}
|
|
378
354
|
}
|
|
379
355
|
]
|
|
@@ -386,3 +362,8 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
386
362
|
|
|
387
363
|
return artifacts;
|
|
388
364
|
}
|
|
365
|
+
|
|
366
|
+
export {
|
|
367
|
+
resolveTargetServicePath,
|
|
368
|
+
emitAttributeTreeTargetSchemas
|
|
369
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
}
|