@izara_project/izara-core-generate-service-code 1.0.97 → 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.
- package/package.json +1 -1
- package/src/compile/loadSchemas.js +29 -6
- package/src/emit/application/crud/templates/FlowEndpoint_HdrWbs.ejs +2 -2
- package/src/emit/application/crud/templates/FlowMain_Wbs.ejs +2 -2
- package/src/emit/application/custom/templates/s3/CreateObject_Main.ejs +5 -2
- package/src/emit/application/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +2 -2
- package/src/emit/application/relationship/templates/ChangeRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/CreateRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/DeleteRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/GetRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/MoveRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/UpdateRelationship_Main.ejs +3 -2
- package/src/emit/application/system/templates/RegisterComplete_Main.ejs +6 -2
- package/src/emit/application/system/templates/Register_Main.ejs +6 -2
- package/src/emit/application/system/templates/WebSocketComplete_Main.ejs +3 -3
- package/src/emit/infrastructure/resources/iamResourceArtifacts.js +1 -1
- package/src/emit/schemas/attributeTree/emitAttributeTreeSchemas.js +14 -22
- package/src/emit/schemas/attributeTree/emitAttributeTreeTargetValueStandard.js +132 -0
- package/src/emit/schemas/ledger/emitLedgerSchemas.js +33 -11
- package/src/emit/schemas/ledger/templates/LedgerObjectSchema.ejs +3 -0
- package/src/emit/schemas/ledger/templates/LedgerRelationshipSchema.ejs +1 -0
- package/src/emit/schemas/propertyValue/emitPropertyValueSchemas.js +329 -0
- package/src/generate.js +16 -75
- package/src/output/mergeHooks.js +69 -15
- package/src/plan/domainRegistry.js +41 -5
- package/task.md +132 -0
- package/test/integration/publicApi.test.js +54 -1
- package/test/unit/application/customFlowApplicationArtifacts.test.js +9 -0
- package/test/unit/application/relationshipApplicationArtifacts.test.js +30 -0
- package/test/unit/infrastructure/resourceArtifacts.test.js +1 -0
- package/test/unit/output/mergeHooks.test.js +268 -0
- package/test/unit/schemas/attributeTreeDirectives.test.js +177 -0
- package/test/unit/schemas/attributeTreeSchemas.test.js +10 -61
- package/test/unit/schemas/ledgerSchemas.test.js +33 -7
- package/test/unit/schemas/propertyValueSchemas.test.js +265 -0
- package/src/emit/schemas/attributeTree/emitAttributeTreeTargetSchemas.js +0 -153
- package/src/emit/schemas/attributeTree/resolveTargetServicePath.js +0 -111
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.98",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,10 @@ const consoleLogger = {
|
|
|
28
28
|
|
|
29
29
|
export { resolveExtendedObjectSchemas, resolveGraphServiceTags };
|
|
30
30
|
|
|
31
|
+
export async function loadGenerateDirectives(project, options = {}) {
|
|
32
|
+
return loadLocalSchemaDirectory(project, 'GenerateDirectives', options);
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
export async function loadLocalSchemaDirectory(
|
|
32
36
|
project,
|
|
33
37
|
directoryName,
|
|
@@ -37,7 +41,10 @@ export async function loadLocalSchemaDirectory(
|
|
|
37
41
|
const logger = options.logger || consoleLogger;
|
|
38
42
|
let entries;
|
|
39
43
|
try {
|
|
40
|
-
entries = await readdir(directoryPath, {
|
|
44
|
+
entries = await readdir(directoryPath, {
|
|
45
|
+
recursive: true,
|
|
46
|
+
withFileTypes: true
|
|
47
|
+
});
|
|
41
48
|
} catch (error) {
|
|
42
49
|
if (error.code === 'ENOENT') {
|
|
43
50
|
return [];
|
|
@@ -45,14 +52,30 @@ export async function loadLocalSchemaDirectory(
|
|
|
45
52
|
throw error;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
const validEntries = entries.filter(
|
|
49
|
-
(entry
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
const validEntries = entries.filter((entry) => {
|
|
56
|
+
if (!entry.isFile() || !entry.name.endsWith('.js')) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (directoryName === 'FlowSchemas') {
|
|
60
|
+
const parentDir = entry.parentPath || entry.path || '';
|
|
61
|
+
if (parentDir.includes('generateCode')) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
validEntries.sort((a, b) => {
|
|
68
|
+
const aParent = a.parentPath || a.path || directoryPath;
|
|
69
|
+
const bParent = b.parentPath || b.path || directoryPath;
|
|
70
|
+
const aPath = join(aParent, a.name);
|
|
71
|
+
const bPath = join(bParent, b.name);
|
|
72
|
+
return aPath.localeCompare(bPath);
|
|
73
|
+
});
|
|
52
74
|
|
|
53
75
|
const schemas = [];
|
|
54
76
|
for (const entry of validEntries) {
|
|
55
|
-
const
|
|
77
|
+
const parentDir = entry.parentPath || entry.path || directoryPath;
|
|
78
|
+
const filePath = join(parentDir, entry.name);
|
|
56
79
|
const details = await stat(filePath);
|
|
57
80
|
const module = await import(
|
|
58
81
|
`${pathToFileURL(filePath).href}?schemaVersion=${details.mtimeMs}-${details.size}`
|
|
@@ -26,7 +26,7 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
|
|
|
26
26
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
27
27
|
import {
|
|
28
28
|
utils,
|
|
29
|
-
|
|
29
|
+
getFlowSchema
|
|
30
30
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
31
31
|
const { createFlowTypeConcat } = utils;
|
|
32
32
|
|
|
@@ -70,7 +70,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
70
70
|
let identifiers = '';
|
|
71
71
|
//(</createIdentifiersFlow>)
|
|
72
72
|
|
|
73
|
-
let flowSchema = await
|
|
73
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
74
74
|
event._izContext,
|
|
75
75
|
{
|
|
76
76
|
flowTag: '<%- flowTag %>',
|
|
@@ -16,7 +16,7 @@ along with this program. If not, see
|
|
|
16
16
|
<http: //www.gnu.org/licenses />.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { getFlowSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
20
20
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
21
21
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
22
22
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
@@ -53,7 +53,7 @@ export default async function <%- typeof functionName !== 'undefined' ? function
|
|
|
53
53
|
callingFlowConfig
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
const flowSchema = await
|
|
56
|
+
const flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
57
57
|
_izContext,
|
|
58
58
|
{
|
|
59
59
|
flowTag: '<%- flowTag %>',
|
|
@@ -16,7 +16,10 @@ along with this program. If not, see
|
|
|
16
16
|
<http: //www.gnu.org/licenses />.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
getObjectSchema,
|
|
21
|
+
getFlowSchema
|
|
22
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
20
23
|
import { consts } from '@izara_project/izara-middleware';
|
|
21
24
|
|
|
22
25
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
@@ -65,7 +68,7 @@ export default async function createObject(
|
|
|
65
68
|
|
|
66
69
|
let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
67
70
|
|
|
68
|
-
let flowSchema = await
|
|
71
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
69
72
|
_izContext,
|
|
70
73
|
{
|
|
71
74
|
flowTag: '<%- flowTag %>',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFlowSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
2
2
|
import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
|
|
3
3
|
|
|
4
4
|
//(<optionalRequire>)
|
|
@@ -19,7 +19,7 @@ export default async function <%- functionName %>(
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const topicName = topicArn.split(':')[5].split('_');
|
|
22
|
-
const flowSchema = await
|
|
22
|
+
const flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
23
23
|
_izContext,
|
|
24
24
|
{
|
|
25
25
|
flowTag: topicName[2],
|
|
@@ -29,14 +29,15 @@ import { sns } from '@izara_project/izara-core-library-external-request';
|
|
|
29
29
|
|
|
30
30
|
import {
|
|
31
31
|
getObjectSchema,
|
|
32
|
+
getRelSchema,
|
|
32
33
|
utils,
|
|
33
34
|
serviceConfig,
|
|
34
35
|
consts,
|
|
35
36
|
relSchemaLib
|
|
36
37
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
37
38
|
|
|
38
|
-
const { getRelationshipSchemaWithCache
|
|
39
|
-
|
|
39
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
40
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
40
41
|
|
|
41
42
|
const { createLinkTypeId } = utils;
|
|
42
43
|
|
|
@@ -29,6 +29,7 @@ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
|
29
29
|
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
30
30
|
import {
|
|
31
31
|
getObjectSchema,
|
|
32
|
+
getRelSchema,
|
|
32
33
|
utils,
|
|
33
34
|
serviceConfig,
|
|
34
35
|
consts,
|
|
@@ -36,8 +37,8 @@ import {
|
|
|
36
37
|
identifiersObject
|
|
37
38
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
38
39
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
39
|
-
const { getRelationshipSchemaWithCache
|
|
40
|
-
|
|
40
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
41
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
41
42
|
|
|
42
43
|
const { createLinkTypeId } = utils;
|
|
43
44
|
|
|
@@ -29,14 +29,15 @@ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
|
29
29
|
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
30
30
|
import {
|
|
31
31
|
getObjectSchema,
|
|
32
|
+
getRelSchema,
|
|
32
33
|
utils,
|
|
33
34
|
serviceConfig,
|
|
34
35
|
consts,
|
|
35
36
|
identifiersObject
|
|
36
37
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
37
38
|
|
|
38
|
-
const { getRelationshipSchemaWithCache
|
|
39
|
-
|
|
39
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
40
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
40
41
|
|
|
41
42
|
const { createLinkTypeId } = utils;
|
|
42
43
|
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from '@izara_project/izara-core-library-external-request';
|
|
28
28
|
import {
|
|
29
29
|
getObjectSchema,
|
|
30
|
+
getRelSchema,
|
|
30
31
|
utils,
|
|
31
32
|
serviceConfig,
|
|
32
33
|
consts,
|
|
@@ -36,8 +37,8 @@ import {
|
|
|
36
37
|
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
37
38
|
|
|
38
39
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
39
|
-
const { getRelationshipSchemaWithCache
|
|
40
|
-
|
|
40
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
41
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
41
42
|
const { createLinkTypeId } = utils;
|
|
42
43
|
const { getGraphServiceTagWithCache } = serviceConfig;
|
|
43
44
|
const { PREFIX, TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER } = consts;
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
|
|
34
34
|
import {
|
|
35
35
|
getObjectSchema,
|
|
36
|
+
getRelSchema,
|
|
36
37
|
utils,
|
|
37
38
|
serviceConfig,
|
|
38
39
|
consts,
|
|
@@ -41,8 +42,8 @@ import {
|
|
|
41
42
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
42
43
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
43
44
|
|
|
44
|
-
const { getRelationshipSchemaWithCache
|
|
45
|
-
|
|
45
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
46
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
46
47
|
|
|
47
48
|
const { createLinkTypeId } = utils;
|
|
48
49
|
|
|
@@ -30,14 +30,15 @@ import { sns } from '@izara_project/izara-core-library-external-request';
|
|
|
30
30
|
|
|
31
31
|
import {
|
|
32
32
|
getObjectSchema,
|
|
33
|
+
getRelSchema,
|
|
33
34
|
utils,
|
|
34
35
|
serviceConfig,
|
|
35
36
|
consts,
|
|
36
37
|
identifiersObject
|
|
37
38
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
38
39
|
|
|
39
|
-
const { getRelationshipSchemaWithCache
|
|
40
|
-
|
|
40
|
+
const { getRelationshipSchemaWithCache } = getRelSchema;
|
|
41
|
+
const { getObjSchemaS3WithHierarchy } = getObjectSchema;
|
|
41
42
|
|
|
42
43
|
const { createLinkTypeId } = utils;
|
|
43
44
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
2
2
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getObjectSchema,
|
|
5
|
+
getFlowSchema,
|
|
6
|
+
identifiersObject
|
|
7
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
4
8
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
5
9
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
6
10
|
import { lambda, webSocket } from '@izara_project/izara-core-library-external-request';
|
|
@@ -29,7 +33,7 @@ export default async function registerCompleteMain(
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
let topicName = topicArn.split(':')[5].split('_');
|
|
32
|
-
let flowSchema = await
|
|
36
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
33
37
|
flowTag: topicName[2],
|
|
34
38
|
serviceTag: topicName[0]
|
|
35
39
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getObjectSchema,
|
|
4
|
+
getFlowSchema,
|
|
5
|
+
identifiersObject
|
|
6
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
3
7
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
4
8
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
5
9
|
import { lambda, webSocket } from '@izara_project/izara-core-library-external-request';
|
|
@@ -20,7 +24,7 @@ export default async function registerMain(
|
|
|
20
24
|
) {
|
|
21
25
|
try {
|
|
22
26
|
let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
23
|
-
let flowSchema = await
|
|
27
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
24
28
|
flowTag: requestParams.flowTag,
|
|
25
29
|
serviceTag: process.env.iz_serviceTag
|
|
26
30
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
2
2
|
import { consts } from '@izara_project/izara-middleware';
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
getFlowSchema,
|
|
5
5
|
utils
|
|
6
6
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
7
7
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
@@ -30,7 +30,7 @@ export default async function WebSocketComplete(
|
|
|
30
30
|
throw new NoRetryError('not have TopicArn for get FlowSchemas');
|
|
31
31
|
const topicName = topicArn.split(':')[5].split('_');
|
|
32
32
|
let flowTag = topicName[2];
|
|
33
|
-
let flowSchema = await
|
|
33
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
34
34
|
_izContext,
|
|
35
35
|
{ flowTag, serviceTag: topicName[0] }
|
|
36
36
|
);
|
|
@@ -40,7 +40,7 @@ export default async function WebSocketComplete(
|
|
|
40
40
|
'Could not find flowSchema from topicArn or requestParams.flowTag'
|
|
41
41
|
);
|
|
42
42
|
flowTag = requestParams.flowTag;
|
|
43
|
-
flowSchema = await
|
|
43
|
+
flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
44
44
|
flowTag,
|
|
45
45
|
serviceTag: process.env.iz_serviceTag
|
|
46
46
|
});
|
|
@@ -369,7 +369,7 @@ export function roleDlqQueueNames(state, roleName) {
|
|
|
369
369
|
export function roleTopicNames(state, roleName) {
|
|
370
370
|
if (roleName === 'ProcFindDataRole') {
|
|
371
371
|
return state.outTopics
|
|
372
|
-
.filter((topic) => topic === 'FindData')
|
|
372
|
+
.filter((topic) => topic === 'FindData' || topic === 'ProcessLogical')
|
|
373
373
|
.map((t) => `${t}_Out`);
|
|
374
374
|
}
|
|
375
375
|
if (roleName === 'FlowObjectsRole') {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { resolveTargetServicePath } from './resolveTargetServicePath.js';
|
|
2
|
-
import { emitAttributeTreeTargetSchemas } from './emitAttributeTreeTargetSchemas.js';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Emits dynamic ObjectSchemas and RelationshipSchemas for attributeTree add-ons
|
|
6
3
|
*/
|
|
@@ -72,9 +69,9 @@ export function attributeTreeObjectSchemaManagedPaths(objects = []) {
|
|
|
72
69
|
for (const { attributeTreeTag } of trees) {
|
|
73
70
|
const tag = attributeTreeTag;
|
|
74
71
|
paths.push(
|
|
75
|
-
`app/src/schemas/ObjectSchemas/
|
|
76
|
-
`app/src/schemas/ObjectSchemas/
|
|
77
|
-
`app/src/schemas/ObjectSchemas/
|
|
72
|
+
`app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Link.js`,
|
|
73
|
+
`app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Value.js`,
|
|
74
|
+
`app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Label.js`
|
|
78
75
|
);
|
|
79
76
|
}
|
|
80
77
|
|
|
@@ -89,10 +86,10 @@ export function attributeTreeRelationshipSchemaManagedPaths(objects = []) {
|
|
|
89
86
|
const tag = attributeTreeTag;
|
|
90
87
|
const tagCap = _capitalize(tag);
|
|
91
88
|
paths.push(
|
|
92
|
-
`app/src/schemas/RelationshipSchemas/
|
|
93
|
-
`app/src/schemas/RelationshipSchemas/
|
|
94
|
-
`app/src/schemas/RelationshipSchemas/
|
|
95
|
-
`app/src/schemas/RelationshipSchemas/
|
|
89
|
+
`app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/has${tagCap}Link.js`,
|
|
90
|
+
`app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/disabled${tagCap}Link.js`,
|
|
91
|
+
`app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}.js`,
|
|
92
|
+
`app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}Label.js`
|
|
96
93
|
);
|
|
97
94
|
}
|
|
98
95
|
|
|
@@ -141,7 +138,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
141
138
|
]
|
|
142
139
|
};
|
|
143
140
|
artifacts.push({
|
|
144
|
-
path: `app/src/schemas/ObjectSchemas/
|
|
141
|
+
path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Link.js`,
|
|
145
142
|
content: _renderObjectSchema(linkSchema)
|
|
146
143
|
});
|
|
147
144
|
|
|
@@ -173,7 +170,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
173
170
|
]
|
|
174
171
|
};
|
|
175
172
|
artifacts.push({
|
|
176
|
-
path: `app/src/schemas/ObjectSchemas/
|
|
173
|
+
path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Value.js`,
|
|
177
174
|
content: _renderObjectSchema(valueSchema)
|
|
178
175
|
});
|
|
179
176
|
|
|
@@ -205,7 +202,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
|
|
|
205
202
|
]
|
|
206
203
|
};
|
|
207
204
|
artifacts.push({
|
|
208
|
-
path: `app/src/schemas/ObjectSchemas/
|
|
205
|
+
path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Label.js`,
|
|
209
206
|
content: _renderObjectSchema(labelSchema)
|
|
210
207
|
});
|
|
211
208
|
}
|
|
@@ -260,7 +257,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
260
257
|
]
|
|
261
258
|
};
|
|
262
259
|
artifacts.push({
|
|
263
|
-
path: `app/src/schemas/RelationshipSchemas/
|
|
260
|
+
path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/has${tagCap}Link.js`,
|
|
264
261
|
content: _renderRelationshipSchema(`has${tagCap}Link`, hasLinkRel)
|
|
265
262
|
});
|
|
266
263
|
|
|
@@ -290,7 +287,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
290
287
|
]
|
|
291
288
|
};
|
|
292
289
|
artifacts.push({
|
|
293
|
-
path: `app/src/schemas/RelationshipSchemas/
|
|
290
|
+
path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/disabled${tagCap}Link.js`,
|
|
294
291
|
content: _renderRelationshipSchema(
|
|
295
292
|
`disabled${tagCap}Link`,
|
|
296
293
|
disabledLinkRel
|
|
@@ -324,7 +321,7 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
324
321
|
]
|
|
325
322
|
};
|
|
326
323
|
artifacts.push({
|
|
327
|
-
path: `app/src/schemas/RelationshipSchemas/
|
|
324
|
+
path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}.js`,
|
|
328
325
|
content: _renderRelationshipSchema(`is${tagCap}`, isRel)
|
|
329
326
|
});
|
|
330
327
|
|
|
@@ -355,15 +352,10 @@ export function emitAttributeTreeRelationshipSchemas({
|
|
|
355
352
|
]
|
|
356
353
|
};
|
|
357
354
|
artifacts.push({
|
|
358
|
-
path: `app/src/schemas/RelationshipSchemas/
|
|
355
|
+
path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}Label.js`,
|
|
359
356
|
content: _renderRelationshipSchema(`is${tagCap}Label`, isLabelRel)
|
|
360
357
|
});
|
|
361
358
|
}
|
|
362
359
|
|
|
363
360
|
return artifacts;
|
|
364
361
|
}
|
|
365
|
-
|
|
366
|
-
export {
|
|
367
|
-
resolveTargetServicePath,
|
|
368
|
-
emitAttributeTreeTargetSchemas
|
|
369
|
-
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits target ValueStandard ObjectSchema for attributeTreeTarget directives
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function _extractTargetDirectives(directives = []) {
|
|
6
|
+
if (!Array.isArray(directives)) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const results = [];
|
|
10
|
+
const seenTags = new Set();
|
|
11
|
+
|
|
12
|
+
for (const directive of directives) {
|
|
13
|
+
if (
|
|
14
|
+
directive?.type === 'attributeTreeTarget' &&
|
|
15
|
+
directive?.attributeTreeTag
|
|
16
|
+
) {
|
|
17
|
+
const tag = directive.attributeTreeTag;
|
|
18
|
+
if (seenTags.has(tag)) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
seenTags.add(tag);
|
|
22
|
+
results.push(directive);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return results;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _extractStorageResources(directive) {
|
|
30
|
+
if (directive?.storageResources) {
|
|
31
|
+
return directive.storageResources;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
myGraph: {
|
|
35
|
+
storageType: 'graph',
|
|
36
|
+
graphServerTag: 'GraphHandler'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _renderTargetValueStandardSchema(tag, storageResources) {
|
|
42
|
+
const storageResourceTags = Object.keys(storageResources);
|
|
43
|
+
if (storageResourceTags.length === 0) {
|
|
44
|
+
storageResourceTags.push('myGraph');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const storageJson = JSON.stringify(storageResources, null, 2)
|
|
48
|
+
.replace(/\n/g, '\n ');
|
|
49
|
+
const tagsJson = JSON.stringify(storageResourceTags);
|
|
50
|
+
|
|
51
|
+
return `export default [
|
|
52
|
+
{
|
|
53
|
+
objectType: '${tag}ValueStandard',
|
|
54
|
+
canDelete: true,
|
|
55
|
+
generatedBy: 'user',
|
|
56
|
+
storageResources: ${storageJson},
|
|
57
|
+
addOnDataStructure: [
|
|
58
|
+
//(<addOnDataStructure${tag}ValueStandard>)
|
|
59
|
+
// {
|
|
60
|
+
// type: 'propertyValue',
|
|
61
|
+
// propertyValuePrefix: '${tag}ValueStandard'
|
|
62
|
+
// }
|
|
63
|
+
//(</addOnDataStructure${tag}ValueStandard>)
|
|
64
|
+
],
|
|
65
|
+
fieldNames: {
|
|
66
|
+
${tag}ValueStandardId: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
randomOnCreate: true,
|
|
69
|
+
canUpdate: false,
|
|
70
|
+
storageResourceTags: ${tagsJson}
|
|
71
|
+
},
|
|
72
|
+
label: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
canUpdate: true,
|
|
75
|
+
storageResourceTags: ${tagsJson}
|
|
76
|
+
},
|
|
77
|
+
value: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
requiredOnCreate: true,
|
|
80
|
+
canUpdate: true,
|
|
81
|
+
storageResourceTags: ${tagsJson}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
identifiers: [
|
|
85
|
+
{
|
|
86
|
+
type: 'identifier',
|
|
87
|
+
fieldName: '${tag}ValueStandardId'
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function attributeTreeTargetValueStandardManagedPaths(directives = []) {
|
|
96
|
+
const targets = _extractTargetDirectives(directives);
|
|
97
|
+
const paths = [];
|
|
98
|
+
|
|
99
|
+
for (const directive of targets) {
|
|
100
|
+
const tag = directive.attributeTreeTag;
|
|
101
|
+
paths.push(
|
|
102
|
+
`app/src/schemas/ObjectSchemas/generatedCode/attributeTree/` +
|
|
103
|
+
`${tag}ValueStandard.js`
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return paths;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function emitAttributeTreeTargetValueStandard({
|
|
111
|
+
directives = []
|
|
112
|
+
} = {}) {
|
|
113
|
+
const targets = _extractTargetDirectives(directives);
|
|
114
|
+
if (targets.length === 0) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const artifacts = [];
|
|
119
|
+
|
|
120
|
+
for (const directive of targets) {
|
|
121
|
+
const tag = directive.attributeTreeTag;
|
|
122
|
+
const storageResources = _extractStorageResources(directive);
|
|
123
|
+
artifacts.push({
|
|
124
|
+
path:
|
|
125
|
+
`app/src/schemas/ObjectSchemas/generatedCode/attributeTree/` +
|
|
126
|
+
`${tag}ValueStandard.js`,
|
|
127
|
+
content: _renderTargetValueStandardSchema(tag, storageResources)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return artifacts;
|
|
132
|
+
}
|