@izara_project/izara-core-generate-service-code 1.0.96 → 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 +1 -1
- 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/{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/schemas/ledger/emitLedgerSchemas.js +370 -0
- package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
- package/src/generate.js +46 -261
- 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} +9 -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} +41 -46
- 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/FlowEndpoint_Main.ejs +0 -0
- /package/src/emit/{custom → application/custom}/templates/FlowStep_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/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +0 -0
- /package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeTargetSchemas.js +0 -0
- /package/src/emit/{attributeTree → schemas/attributeTree}/resolveTargetServicePath.js +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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test, { after } from 'node:test';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
emitLedgerObjectSchemas,
|
|
6
|
+
emitLedgerRelationshipSchemas,
|
|
7
|
+
ledgerObjectSchemaManagedPaths,
|
|
8
|
+
ledgerRelationshipSchemaManagedPaths
|
|
9
|
+
} from '../../../src/emit/schemas/ledger/emitLedgerSchemas.js';
|
|
10
|
+
import { generate } from '../../../src/generate.js';
|
|
11
|
+
import {
|
|
12
|
+
createTestProject,
|
|
13
|
+
readProjectFile,
|
|
14
|
+
writeProjectFile,
|
|
15
|
+
cleanupTestProjects
|
|
16
|
+
} from '../../helpers/testProject.js';
|
|
17
|
+
|
|
18
|
+
after(async () => {
|
|
19
|
+
await cleanupTestProjects();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('emitLedgerObjectSchemas returns 1 object schema per ledger addOn', () => {
|
|
23
|
+
const objects = [
|
|
24
|
+
{
|
|
25
|
+
objectType: 'unitStandard',
|
|
26
|
+
serviceTag: 'UnitStandard',
|
|
27
|
+
storageResources: {
|
|
28
|
+
graph: {
|
|
29
|
+
storageType: 'graph',
|
|
30
|
+
graphServerTag: 'GraphHandler'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
addOnDataStructure: [
|
|
34
|
+
{
|
|
35
|
+
type: 'ledger',
|
|
36
|
+
prefix: 'unitStandardSupplyLocation',
|
|
37
|
+
storageResourceTag: 'graph',
|
|
38
|
+
ledgerType: 'movable',
|
|
39
|
+
targetObjType: {
|
|
40
|
+
serviceTag: 'SupplyLocationStandard',
|
|
41
|
+
objectType: 'supplyLocation'
|
|
42
|
+
},
|
|
43
|
+
moveToTargetObjTypes: [
|
|
44
|
+
{
|
|
45
|
+
serviceTag: 'UnitPacking',
|
|
46
|
+
objectType: 'unitPacking'
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'ledger',
|
|
52
|
+
prefix: 'unitStandardUnitPacking',
|
|
53
|
+
storageResourceTag: 'graph',
|
|
54
|
+
ledgerType: 'movable',
|
|
55
|
+
targetObjType: {
|
|
56
|
+
serviceTag: 'SupplyLocationStandard',
|
|
57
|
+
objectType: 'supplyLocation'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const artifacts = emitLedgerObjectSchemas({ objects });
|
|
65
|
+
assert.equal(artifacts.length, 2);
|
|
66
|
+
|
|
67
|
+
const paths = artifacts.map((a) => a.path);
|
|
68
|
+
assert.deepEqual(paths, [
|
|
69
|
+
'app/src/schemas/ObjectSchemas/generatedLedger/unitStandardSupplyLocationEntry.js',
|
|
70
|
+
'app/src/schemas/ObjectSchemas/generatedLedger/unitStandardUnitPackingEntry.js'
|
|
71
|
+
]);
|
|
72
|
+
|
|
73
|
+
const entryArtifact = artifacts[0];
|
|
74
|
+
assert.match(
|
|
75
|
+
entryArtifact.content,
|
|
76
|
+
/"objectType": "unitStandardSupplyLocationEntry"/
|
|
77
|
+
);
|
|
78
|
+
assert.match(entryArtifact.content, /"unitStandardSupplyLocationEntryId"/);
|
|
79
|
+
assert.match(entryArtifact.content, /"generatedBy": "systemNoUser"/);
|
|
80
|
+
assert.match(entryArtifact.content, /"canDelete": false/);
|
|
81
|
+
assert.match(entryArtifact.content, /GraphHandler/);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('emitLedgerRelationshipSchemas returns current, old, and is relationship schemas per ledger addOn', () => {
|
|
85
|
+
const objects = [
|
|
86
|
+
{
|
|
87
|
+
objectType: 'unitStandard',
|
|
88
|
+
serviceTag: 'UnitStandard',
|
|
89
|
+
storageResources: {
|
|
90
|
+
graph: {
|
|
91
|
+
storageType: 'graph',
|
|
92
|
+
graphServerTag: 'GraphHandler'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
addOnDataStructure: [
|
|
96
|
+
{
|
|
97
|
+
type: 'ledger',
|
|
98
|
+
prefix: 'unitStandardSupplyLocation',
|
|
99
|
+
storageResourceTag: 'graph',
|
|
100
|
+
ledgerType: 'movable',
|
|
101
|
+
targetObjType: {
|
|
102
|
+
serviceTag: 'SupplyLocationStandard',
|
|
103
|
+
objectType: 'supplyLocation'
|
|
104
|
+
},
|
|
105
|
+
moveToTargetObjTypes: [
|
|
106
|
+
{
|
|
107
|
+
serviceTag: 'UnitPacking',
|
|
108
|
+
objectType: 'unitPacking'
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
const artifacts = emitLedgerRelationshipSchemas({
|
|
117
|
+
objects,
|
|
118
|
+
serviceTag: 'UnitStandard'
|
|
119
|
+
});
|
|
120
|
+
assert.equal(artifacts.length, 3);
|
|
121
|
+
|
|
122
|
+
const paths = artifacts.map((a) => a.path);
|
|
123
|
+
assert.deepEqual(paths, [
|
|
124
|
+
'app/src/schemas/RelationshipSchemas/generatedLedger/currentUnitStandardSupplyLocation.js',
|
|
125
|
+
'app/src/schemas/RelationshipSchemas/generatedLedger/oldUnitStandardSupplyLocation.js',
|
|
126
|
+
'app/src/schemas/RelationshipSchemas/generatedLedger/isUnitStandardSupplyLocationEntry.js'
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
// 1. Current relationship
|
|
130
|
+
const currentRel = artifacts.find((a) =>
|
|
131
|
+
a.path.endsWith('currentUnitStandardSupplyLocation.js')
|
|
132
|
+
);
|
|
133
|
+
assert.match(currentRel.content, /"currentUnitStandardSupplyLocation"/);
|
|
134
|
+
assert.match(currentRel.content, /"generatedBy": "user"/);
|
|
135
|
+
assert.match(currentRel.content, /"fromTimestamp"/);
|
|
136
|
+
assert.match(
|
|
137
|
+
currentRel.content,
|
|
138
|
+
/"relationshipTag": "oldUnitStandardSupplyLocation"/
|
|
139
|
+
);
|
|
140
|
+
assert.match(currentRel.content, /"belongTo": true/);
|
|
141
|
+
|
|
142
|
+
// 2. Old relationship
|
|
143
|
+
const oldRel = artifacts.find((a) =>
|
|
144
|
+
a.path.endsWith('oldUnitStandardSupplyLocation.js')
|
|
145
|
+
);
|
|
146
|
+
assert.match(oldRel.content, /"oldUnitStandardSupplyLocation"/);
|
|
147
|
+
assert.match(oldRel.content, /"generatedBy": "systemWithUser"/);
|
|
148
|
+
assert.match(oldRel.content, /"fromTimestamp"/);
|
|
149
|
+
assert.match(oldRel.content, /"toTimestamp"/);
|
|
150
|
+
|
|
151
|
+
// 3. IsEntry relationship
|
|
152
|
+
const isRel = artifacts.find((a) =>
|
|
153
|
+
a.path.endsWith('isUnitStandardSupplyLocationEntry.js')
|
|
154
|
+
);
|
|
155
|
+
assert.match(isRel.content, /"isUnitStandardSupplyLocationEntry"/);
|
|
156
|
+
assert.match(isRel.content, /"generatedBy": "systemNoUser"/);
|
|
157
|
+
assert.match(isRel.content, /"supplyLocation"/);
|
|
158
|
+
assert.match(isRel.content, /"unitPacking"/);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('managed paths return empty array when no ledger is present', () => {
|
|
162
|
+
const objects = [{ objectType: 'user', addOnDataStructure: [] }];
|
|
163
|
+
assert.deepEqual(ledgerObjectSchemaManagedPaths(objects), []);
|
|
164
|
+
assert.deepEqual(ledgerRelationshipSchemaManagedPaths(objects), []);
|
|
165
|
+
assert.deepEqual(emitLedgerObjectSchemas({ objects }), []);
|
|
166
|
+
assert.deepEqual(emitLedgerRelationshipSchemas({ objects }), []);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('generate commits and cleans up ledger dynamic schemas', async () => {
|
|
170
|
+
const rootPath = await createProjectWithLedger({ hasAddOn: true });
|
|
171
|
+
await generate(rootPath);
|
|
172
|
+
|
|
173
|
+
const objectRelPath =
|
|
174
|
+
'app/src/schemas/ObjectSchemas/generatedLedger/unitStandardSupplyLocationEntry.js';
|
|
175
|
+
const relRelPath =
|
|
176
|
+
'app/src/schemas/RelationshipSchemas/generatedLedger/currentUnitStandardSupplyLocation.js';
|
|
177
|
+
|
|
178
|
+
const objectContent = await readProjectFile(rootPath, objectRelPath);
|
|
179
|
+
assert.match(objectContent, /unitStandardSupplyLocationEntry/);
|
|
180
|
+
assert.match(objectContent, /GraphHandler/);
|
|
181
|
+
|
|
182
|
+
const relContent = await readProjectFile(rootPath, relRelPath);
|
|
183
|
+
assert.match(relContent, /currentUnitStandardSupplyLocation/);
|
|
184
|
+
assert.match(relContent, /oldUnitStandardSupplyLocation/);
|
|
185
|
+
|
|
186
|
+
// Re-run without addOn to verify stale file cleanup
|
|
187
|
+
await createProjectWithLedger({ rootPath, hasAddOn: false });
|
|
188
|
+
await generate(rootPath);
|
|
189
|
+
|
|
190
|
+
await assert.rejects(readProjectFile(rootPath, objectRelPath), {
|
|
191
|
+
code: 'ENOENT'
|
|
192
|
+
});
|
|
193
|
+
await assert.rejects(readProjectFile(rootPath, relRelPath), {
|
|
194
|
+
code: 'ENOENT'
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
async function createProjectWithLedger({
|
|
199
|
+
rootPath: existingRoot,
|
|
200
|
+
hasAddOn = true
|
|
201
|
+
} = {}) {
|
|
202
|
+
const addOnContent = hasAddOn
|
|
203
|
+
? `
|
|
204
|
+
addOnDataStructure: [
|
|
205
|
+
{
|
|
206
|
+
type: 'ledger',
|
|
207
|
+
prefix: 'unitStandardSupplyLocation',
|
|
208
|
+
storageResourceTag: 'graph',
|
|
209
|
+
ledgerType: 'movable',
|
|
210
|
+
targetObjType: {
|
|
211
|
+
serviceTag: 'SupplyLocationStandard',
|
|
212
|
+
objectType: 'supplyLocation'
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
],`
|
|
216
|
+
: ' addOnDataStructure: [],';
|
|
217
|
+
|
|
218
|
+
const schemaContent = `export default [
|
|
219
|
+
{
|
|
220
|
+
objectType: 'unitStandard',
|
|
221
|
+
canDelete: false,
|
|
222
|
+
generatedBy: 'user',${addOnContent}
|
|
223
|
+
storageResources: {
|
|
224
|
+
graph: {
|
|
225
|
+
storageType: 'graph',
|
|
226
|
+
graphServerTag: 'GraphHandler'
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
fieldNames: {
|
|
230
|
+
unitId: {
|
|
231
|
+
type: 'string',
|
|
232
|
+
randomOnCreate: true,
|
|
233
|
+
canUpdate: false,
|
|
234
|
+
storageResourceTags: ['graph']
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
identifiers: [
|
|
238
|
+
{
|
|
239
|
+
type: 'partitionKey',
|
|
240
|
+
fieldName: 'unitId'
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
if (existingRoot) {
|
|
248
|
+
await writeProjectFile(
|
|
249
|
+
existingRoot,
|
|
250
|
+
'app/src/schemas/ObjectSchemas/UnitStandard.js',
|
|
251
|
+
schemaContent
|
|
252
|
+
);
|
|
253
|
+
return existingRoot;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return await createTestProject({
|
|
257
|
+
prefix: 'izara-ledger-test-',
|
|
258
|
+
serviceTag: 'UnitStandard',
|
|
259
|
+
schemas: {
|
|
260
|
+
'ObjectSchemas/UnitStandard.js': schemaContent
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
|
-
import { readFile, rm, writeFile, mkdir } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
2
|
import test, { after } from 'node:test';
|
|
6
3
|
|
|
7
4
|
import {
|
|
8
5
|
emitSystemTextSchemas,
|
|
9
6
|
systemTextSchemaManagedPaths
|
|
10
|
-
} from '
|
|
11
|
-
import { generate } from '
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
} from '../../../src/emit/schemas/systemText/emitSystemTextSchemas.js';
|
|
8
|
+
import { generate } from '../../../src/generate.js';
|
|
9
|
+
import {
|
|
10
|
+
createTestProject,
|
|
11
|
+
readProjectFile,
|
|
12
|
+
writeProjectFile,
|
|
13
|
+
cleanupTestProjects
|
|
14
|
+
} from '../../helpers/testProject.js';
|
|
15
|
+
|
|
16
|
+
after(async () => {
|
|
17
|
+
await cleanupTestProjects();
|
|
18
|
+
});
|
|
19
19
|
|
|
20
20
|
test('emitSystemTextSchemas produces expected structure for objects, flows, relationships, and notifications', async () => {
|
|
21
21
|
const artifacts = await emitSystemTextSchemas({
|
|
@@ -107,33 +107,21 @@ test('emitSystemTextSchemas returns empty array when no inputs provided', async
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
test('generate preserves user hooks inside SystemTextSchemas.js across regeneration', async () => {
|
|
110
|
-
const rootPath =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
const rootPath = await createTestProject({
|
|
111
|
+
prefix: 'system-text-hook-test-',
|
|
112
|
+
serverlessConfig: 'main_config:\n iz_serviceTag: TestService\n',
|
|
113
|
+
schemas: {
|
|
114
|
+
'ObjectSchemas/Item.js':
|
|
115
|
+
"export default { objectType: 'item', fieldNames: { itemId: { type: 'string' } }, generatedBy: 'user' };\n"
|
|
116
|
+
}
|
|
117
117
|
});
|
|
118
|
-
await mkdir(join(rootPath, 'config'), { recursive: true });
|
|
119
|
-
|
|
120
|
-
await writeFile(
|
|
121
|
-
join(rootPath, 'config/serverless.config.yml'),
|
|
122
|
-
'main_config:\n iz_serviceTag: TestService\n'
|
|
123
|
-
);
|
|
124
|
-
await writeFile(
|
|
125
|
-
join(rootPath, 'app/src/schemas/ObjectSchemas/Item.js'),
|
|
126
|
-
"export default { objectType: 'item', fieldNames: { itemId: { type: 'string' } }, generatedBy: 'user' };\n"
|
|
127
|
-
);
|
|
128
118
|
|
|
129
119
|
// First generate
|
|
130
120
|
await generate(rootPath);
|
|
131
121
|
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
136
|
-
const initialContent = await readFile(targetFile, 'utf8');
|
|
122
|
+
const targetRelPath =
|
|
123
|
+
'app/src/schemas/SystemTextSchemas/generatedCode/SystemTextSchemas.js';
|
|
124
|
+
const initialContent = await readProjectFile(rootPath, targetRelPath);
|
|
137
125
|
assert.match(initialContent, /\/\/\(<item_TestServiceitemIdHook>\)/);
|
|
138
126
|
|
|
139
127
|
// User edits inside hook
|
|
@@ -141,12 +129,12 @@ test('generate preserves user hooks inside SystemTextSchemas.js across regenerat
|
|
|
141
129
|
'//(<item_TestServiceitemIdHook>)\n //(</item_TestServiceitemIdHook>)',
|
|
142
130
|
'//(<item_TestServiceitemIdHook>)\n customTranslation: "Item ID Value",\n //(</item_TestServiceitemIdHook>)'
|
|
143
131
|
);
|
|
144
|
-
await
|
|
132
|
+
await writeProjectFile(rootPath, targetRelPath, modifiedContent);
|
|
145
133
|
|
|
146
134
|
// Second generate (regeneration)
|
|
147
135
|
await generate(rootPath);
|
|
148
136
|
|
|
149
|
-
const regeneratedContent = await
|
|
137
|
+
const regeneratedContent = await readProjectFile(rootPath, targetRelPath);
|
|
150
138
|
assert.match(
|
|
151
139
|
regeneratedContent,
|
|
152
140
|
/customTranslation:\s*"Item ID Value"/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs
RENAMED
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs
RENAMED
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs
RENAMED
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs
RENAMED
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs
RENAMED
|
File without changes
|
/package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs
RENAMED
|
File without changes
|
/package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs
RENAMED
|
File without changes
|
/package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs
RENAMED
|
File without changes
|
/package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|