@lowdefy/build 3.23.0-alpha.0 → 4.0.0-alpha.4
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/dist/build/addDefaultPages/404.js +56 -0
- package/dist/build/addDefaultPages/addDefaultPages.js +40 -0
- package/dist/build/buildAuth/buildAuth.js +50 -0
- package/dist/build/buildAuth/getPageRoles.js +34 -0
- package/dist/build/buildAuth/getProtectedPages.js +30 -0
- package/dist/build/buildConnections.js +47 -0
- package/dist/build/buildIcons.js +63 -0
- package/dist/build/buildMenu.js +122 -0
- package/dist/build/buildPages/buildBlock/buildBlock.js +31 -0
- package/dist/build/buildPages/buildBlock/buildEvents.js +72 -0
- package/dist/build/buildPages/buildBlock/buildRequests.js +52 -0
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +35 -0
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +33 -0
- package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +25 -0
- package/dist/build/buildPages/buildBlock/setBlockId.js +20 -0
- package/dist/build/buildPages/buildBlock/validateBlock.js +39 -0
- package/dist/build/buildPages/buildPage.js +50 -0
- package/dist/build/buildPages/buildPages.js +33 -0
- package/dist/build/buildRefs/buildRefs.js +26 -0
- package/dist/build/buildRefs/getConfigFile.js +28 -0
- package/dist/build/buildRefs/getRefContent.js +44 -0
- package/dist/build/buildRefs/getRefPath.js +30 -0
- package/dist/build/buildRefs/getRefsFromFile.js +37 -0
- package/dist/build/buildRefs/getUserJavascriptFunction.js +21 -0
- package/dist/build/buildRefs/makeRefDefinition.js +31 -0
- package/dist/build/buildRefs/parseNunjucks.js +20 -0
- package/dist/build/buildRefs/parseRefContent.js +37 -0
- package/dist/build/buildRefs/populateRefs.js +43 -0
- package/dist/build/buildRefs/recursiveBuild.js +63 -0
- package/dist/build/buildRefs/runRefResolver.js +33 -0
- package/dist/build/buildRefs/runTransformer.js +26 -0
- package/dist/build/buildStyles.js +29 -0
- package/dist/build/buildTypes.js +83 -0
- package/dist/build/cleanBuildDirectory.js +19 -0
- package/dist/build/testSchema.js +34 -0
- package/dist/build/validateApp.js +36 -0
- package/dist/build/validateConfig.js +53 -0
- package/dist/build/writeApp.js +22 -0
- package/dist/build/writeConfig.js +22 -0
- package/dist/build/writeConnections.js +29 -0
- package/dist/build/writeGlobal.js +29 -0
- package/dist/build/writeMenus.js +25 -0
- package/dist/build/writePages.js +37 -0
- package/dist/build/writePluginImports/writeBlockImports.js +39 -0
- package/dist/build/writePluginImports/writeConnectionImports.js +39 -0
- package/dist/build/writePluginImports/writeIconImports.js +37 -0
- package/dist/build/writePluginImports/writeStyleImports.js +30 -0
- package/dist/build/writeRequests.js +37 -0
- package/dist/build/writeTypes.js +21 -0
- package/dist/defaultTypes.json +66 -0
- package/dist/index.js +182 -1
- package/dist/lowdefySchema.js +699 -0
- package/dist/scripts/generateDefaultTypes.js +101 -0
- package/dist/scripts/run.js +25 -0
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +25 -0
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +18 -0
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +19 -0
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +39 -0
- package/dist/test/buildRefs/testBuildRefsResolver.js +23 -0
- package/dist/test/buildRefs/testBuildRefsTransform.js +25 -0
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +21 -0
- package/dist/test/testContext.js +55 -0
- package/dist/utils/countOperators.js +30 -0
- package/dist/utils/createCheckDuplicateId.js +31 -0
- package/dist/utils/createCounter.js +33 -0
- package/dist/utils/files/readConfigFile.js +24 -0
- package/dist/utils/files/writeBuildArtifact.js +26 -0
- package/dist/utils/formatErrorMessage.js +56 -0
- package/package.json +22 -21
- package/dist/138.index.js +0 -2
- package/dist/138.index.js.LICENSE.txt +0 -3
- package/dist/231.index.js +0 -1
- package/dist/319.index.js +0 -1
- package/dist/35.index.js +0 -1
- package/dist/422.index.js +0 -1
- package/dist/443.index.js +0 -1
- package/dist/449.index.js +0 -1
- package/dist/5.index.js +0 -2
- package/dist/5.index.js.LICENSE.txt +0 -1
- package/dist/564.index.js +0 -1
- package/dist/569.index.js +0 -1
- package/dist/625.index.js +0 -1
- package/dist/693.index.js +0 -2
- package/dist/693.index.js.LICENSE.txt +0 -1
- package/dist/734.index.js +0 -1
- package/dist/904.index.js +0 -1
- package/dist/remoteEntry.js +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ function buildTypeClass({ counter , definitions , store , typeClass }) {
|
|
16
|
+
const counts = counter.getCounts();
|
|
17
|
+
Object.keys(counts).forEach((typeName)=>{
|
|
18
|
+
if (!definitions[typeName]) {
|
|
19
|
+
throw new Error(`${typeClass} type "${typeName}" was used but is not defined.`);
|
|
20
|
+
}
|
|
21
|
+
store[typeName] = {
|
|
22
|
+
package: definitions[typeName].package,
|
|
23
|
+
version: definitions[typeName].version,
|
|
24
|
+
count: counts[typeName]
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function buildTypes({ components , context }) {
|
|
29
|
+
const { typeCounters } = context;
|
|
30
|
+
components.types = {
|
|
31
|
+
actions: {
|
|
32
|
+
},
|
|
33
|
+
blocks: {
|
|
34
|
+
},
|
|
35
|
+
connections: {
|
|
36
|
+
},
|
|
37
|
+
requests: {
|
|
38
|
+
},
|
|
39
|
+
operators: {
|
|
40
|
+
client: {
|
|
41
|
+
},
|
|
42
|
+
server: {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
// buildTypeClass({
|
|
47
|
+
// counter: typeCounters.actions,
|
|
48
|
+
// definitions: context.types.actions,
|
|
49
|
+
// store: components.types.actions,
|
|
50
|
+
// typeClass: 'Action',
|
|
51
|
+
// });
|
|
52
|
+
buildTypeClass({
|
|
53
|
+
counter: typeCounters.blocks,
|
|
54
|
+
definitions: context.types.blocks,
|
|
55
|
+
store: components.types.blocks,
|
|
56
|
+
typeClass: 'Block'
|
|
57
|
+
});
|
|
58
|
+
buildTypeClass({
|
|
59
|
+
counter: typeCounters.connections,
|
|
60
|
+
definitions: context.types.connections,
|
|
61
|
+
store: components.types.connections,
|
|
62
|
+
typeClass: 'Connection'
|
|
63
|
+
});
|
|
64
|
+
buildTypeClass({
|
|
65
|
+
counter: typeCounters.requests,
|
|
66
|
+
definitions: context.types.requests,
|
|
67
|
+
store: components.types.requests,
|
|
68
|
+
typeClass: 'Request'
|
|
69
|
+
});
|
|
70
|
+
// buildTypeClass({
|
|
71
|
+
// counter: typeCounters.operators.client,
|
|
72
|
+
// definitions: context.types.operators.client,
|
|
73
|
+
// store: components.types.operators.client,
|
|
74
|
+
// typeClass: 'Operator',
|
|
75
|
+
// });
|
|
76
|
+
// buildTypeClass({
|
|
77
|
+
// counter: typeCounters.operators.server,
|
|
78
|
+
// definitions: context.types.operators.server,
|
|
79
|
+
// store: components.types.operators.server,
|
|
80
|
+
// typeClass: 'Operator',
|
|
81
|
+
// });
|
|
82
|
+
}
|
|
83
|
+
export default buildTypes;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { cleanDirectory } from '@lowdefy/node-utils';
|
|
16
|
+
async function cleanBuildDirectory({ context }) {
|
|
17
|
+
return cleanDirectory(context.buildDirectory);
|
|
18
|
+
}
|
|
19
|
+
export default cleanBuildDirectory;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { validate } from '@lowdefy/ajv';
|
|
16
|
+
import lowdefySchema from '../lowdefySchema.js';
|
|
17
|
+
import formatErrorMessage from '../utils/formatErrorMessage.js';
|
|
18
|
+
async function testSchema({ components , context }) {
|
|
19
|
+
const { valid , errors } = validate({
|
|
20
|
+
schema: lowdefySchema,
|
|
21
|
+
data: components,
|
|
22
|
+
returnErrors: true
|
|
23
|
+
});
|
|
24
|
+
if (!valid) {
|
|
25
|
+
await context.logger.warn('Schema not valid.');
|
|
26
|
+
const promises = errors.map((error)=>context.logger.warn(formatErrorMessage({
|
|
27
|
+
error,
|
|
28
|
+
components
|
|
29
|
+
}))
|
|
30
|
+
);
|
|
31
|
+
await promises;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default testSchema;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */ /*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function validateApp({ components }) {
|
|
17
|
+
if (type.isNone(components.app)) {
|
|
18
|
+
components.app = {
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (!type.isObject(components.app)) {
|
|
22
|
+
throw new Error('lowdefy.app is not an object.');
|
|
23
|
+
}
|
|
24
|
+
if (type.isNone(components.app.html)) {
|
|
25
|
+
components.app.html = {
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (type.isNone(components.app.html.appendBody)) {
|
|
29
|
+
components.app.html.appendBody = '';
|
|
30
|
+
}
|
|
31
|
+
if (type.isNone(components.app.html.appendHead)) {
|
|
32
|
+
components.app.html.appendHead = '';
|
|
33
|
+
}
|
|
34
|
+
return components;
|
|
35
|
+
}
|
|
36
|
+
export default validateApp;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */ /*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
import { validate } from '@lowdefy/ajv';
|
|
17
|
+
import lowdefySchema from '../lowdefySchema.js';
|
|
18
|
+
async function validateConfig({ components }) {
|
|
19
|
+
if (type.isNone(components.config)) {
|
|
20
|
+
components.config = {
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (!type.isObject(components.config)) {
|
|
24
|
+
throw new Error('lowdefy.config is not an object.');
|
|
25
|
+
}
|
|
26
|
+
if (type.isNone(components.config.auth)) {
|
|
27
|
+
components.config.auth = {
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (type.isNone(components.config.auth.pages)) {
|
|
31
|
+
components.config.auth.pages = {
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (type.isNone(components.config.auth.pages.roles)) {
|
|
35
|
+
components.config.auth.pages.roles = {
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
validate({
|
|
39
|
+
schema: lowdefySchema.definitions.authConfig,
|
|
40
|
+
data: components.config.auth
|
|
41
|
+
});
|
|
42
|
+
if (components.config.auth.pages.protected === true && components.config.auth.pages.public === true || type.isArray(components.config.auth.pages.protected) && type.isArray(components.config.auth.pages.public)) {
|
|
43
|
+
throw new Error('Protected and public pages are mutually exclusive. When protected pages are listed, all unlisted pages are public by default and visa versa.');
|
|
44
|
+
}
|
|
45
|
+
if (components.config.auth.pages.protected === false) {
|
|
46
|
+
throw new Error('Protected pages can not be set to false.');
|
|
47
|
+
}
|
|
48
|
+
if (components.config.auth.pages.public === false) {
|
|
49
|
+
throw new Error('Public pages can not be set to false.');
|
|
50
|
+
}
|
|
51
|
+
return components;
|
|
52
|
+
}
|
|
53
|
+
export default validateConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ async function writeApp({ components , context }) {
|
|
16
|
+
await context.writeBuildArtifact({
|
|
17
|
+
filePath: 'app.json',
|
|
18
|
+
content: JSON.stringify(components.app || {
|
|
19
|
+
}, null, 2)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export default writeApp;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ async function writeConfig({ components , context }) {
|
|
16
|
+
await context.writeBuildArtifact({
|
|
17
|
+
filePath: 'config.json',
|
|
18
|
+
content: JSON.stringify(components.config || {
|
|
19
|
+
}, null, 2)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export default writeConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function writeConnections({ components , context }) {
|
|
17
|
+
if (type.isNone(components.connections)) return;
|
|
18
|
+
if (!type.isArray(components.connections)) {
|
|
19
|
+
throw new Error(`Connections is not an array.`);
|
|
20
|
+
}
|
|
21
|
+
const writePromises = components.connections.map(async (connection)=>{
|
|
22
|
+
await context.writeBuildArtifact({
|
|
23
|
+
filePath: `connections/${connection.connectionId}.json`,
|
|
24
|
+
content: JSON.stringify(connection, null, 2)
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return Promise.all(writePromises);
|
|
28
|
+
}
|
|
29
|
+
export default writeConnections;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function writeGlobal({ components , context }) {
|
|
17
|
+
if (type.isNone(components.global)) {
|
|
18
|
+
components.global = {
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (!type.isObject(components.global)) {
|
|
22
|
+
throw new Error('Global is not an object.');
|
|
23
|
+
}
|
|
24
|
+
await context.writeBuildArtifact({
|
|
25
|
+
filePath: 'global.json',
|
|
26
|
+
content: JSON.stringify(components.global, null, 2)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export default writeGlobal;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function writeMenus({ components , context }) {
|
|
17
|
+
if (!type.isArray(components.menus)) {
|
|
18
|
+
throw new Error('Menus is not an array.');
|
|
19
|
+
}
|
|
20
|
+
await context.writeBuildArtifact({
|
|
21
|
+
filePath: 'menus.json',
|
|
22
|
+
content: JSON.stringify(components.menus, null, 2)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default writeMenus;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function writePage({ page , context }) {
|
|
17
|
+
if (!type.isObject(page)) {
|
|
18
|
+
throw new Error(`Page is not an object. Received ${JSON.stringify(page)}`);
|
|
19
|
+
}
|
|
20
|
+
await context.writeBuildArtifact({
|
|
21
|
+
filePath: `pages/${page.pageId}/${page.pageId}.json`,
|
|
22
|
+
content: JSON.stringify(page, null, 2)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function writePages({ components , context }) {
|
|
26
|
+
if (type.isNone(components.pages)) return;
|
|
27
|
+
if (!type.isArray(components.pages)) {
|
|
28
|
+
throw new Error(`Pages is not an array.`);
|
|
29
|
+
}
|
|
30
|
+
const writePromises = components.pages.map((page)=>writePage({
|
|
31
|
+
page,
|
|
32
|
+
context
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
return Promise.all(writePromises);
|
|
36
|
+
}
|
|
37
|
+
export default writePages;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { nunjucksFunction } from '@lowdefy/nunjucks';
|
|
16
|
+
const template = `{%- for block in blocks -%}
|
|
17
|
+
import { {{ block.type }} } from '{{ block.package }}/blocks';
|
|
18
|
+
{% endfor -%}
|
|
19
|
+
export default {
|
|
20
|
+
{% for block in blocks -%}
|
|
21
|
+
{{ block.type }},
|
|
22
|
+
{% endfor -%}
|
|
23
|
+
};
|
|
24
|
+
`;
|
|
25
|
+
async function writeBlockImports({ components , context }) {
|
|
26
|
+
const templateFn = nunjucksFunction(template);
|
|
27
|
+
const blocks = Object.keys(components.types.blocks).map((type)=>({
|
|
28
|
+
type,
|
|
29
|
+
...components.types.blocks[type]
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
await context.writeBuildArtifact({
|
|
33
|
+
filePath: 'plugins/blocks.js',
|
|
34
|
+
content: templateFn({
|
|
35
|
+
blocks
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export default writeBlockImports;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { nunjucksFunction } from '@lowdefy/nunjucks';
|
|
16
|
+
const template = `{%- for connection in connections -%}
|
|
17
|
+
import { {{ connection.type }} } from '{{ connection.package }}/connections';
|
|
18
|
+
{% endfor -%}
|
|
19
|
+
export default {
|
|
20
|
+
{% for connection in connections -%}
|
|
21
|
+
{{ connection.type }},
|
|
22
|
+
{% endfor -%}
|
|
23
|
+
};
|
|
24
|
+
`;
|
|
25
|
+
async function writeConnectionImports({ components , context }) {
|
|
26
|
+
const templateFn = nunjucksFunction(template);
|
|
27
|
+
const connections = Object.keys(components.types.connections).map((type)=>({
|
|
28
|
+
type,
|
|
29
|
+
...components.types.connections[type]
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
await context.writeBuildArtifact({
|
|
33
|
+
filePath: 'plugins/connections.js',
|
|
34
|
+
content: templateFn({
|
|
35
|
+
connections
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export default writeConnectionImports;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { nunjucksFunction } from '@lowdefy/nunjucks';
|
|
16
|
+
const template = `{%- for package in packages -%}
|
|
17
|
+
{%- for icon in package.icons -%}
|
|
18
|
+
import { {{ icon }} } from '{{ package.package }}';
|
|
19
|
+
{% endfor -%}
|
|
20
|
+
{% endfor -%}
|
|
21
|
+
export default {
|
|
22
|
+
{% for package in packages -%}
|
|
23
|
+
{%- for icon in package.icons -%}
|
|
24
|
+
{{ icon }},
|
|
25
|
+
{% endfor -%}{%- endfor -%}
|
|
26
|
+
};
|
|
27
|
+
`;
|
|
28
|
+
async function writeIconImports({ components , context }) {
|
|
29
|
+
const templateFn = nunjucksFunction(template);
|
|
30
|
+
await context.writeBuildArtifact({
|
|
31
|
+
filePath: 'plugins/icons.js',
|
|
32
|
+
content: templateFn({
|
|
33
|
+
packages: components.icons
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export default writeIconImports;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { nunjucksFunction } from '@lowdefy/nunjucks';
|
|
16
|
+
const template = `@import '@lowdefy/layout/style.less';
|
|
17
|
+
{% for style in styles -%}
|
|
18
|
+
@import '{{ style }}';
|
|
19
|
+
{% endfor -%}
|
|
20
|
+
`;
|
|
21
|
+
async function writeStyleImports({ components , context }) {
|
|
22
|
+
const templateFn = nunjucksFunction(template);
|
|
23
|
+
await context.writeBuildArtifact({
|
|
24
|
+
filePath: 'plugins/styles.less',
|
|
25
|
+
content: templateFn({
|
|
26
|
+
styles: components.styles
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export default writeStyleImports;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
async function writeRequestsOnPage({ page , context }) {
|
|
17
|
+
return Promise.all(page.requests.map(async (request)=>{
|
|
18
|
+
await context.writeBuildArtifact({
|
|
19
|
+
filePath: `pages/${page.pageId}/requests/${request.requestId}.json`,
|
|
20
|
+
content: JSON.stringify(request, null, 2)
|
|
21
|
+
});
|
|
22
|
+
delete request.properties;
|
|
23
|
+
delete request.type;
|
|
24
|
+
delete request.connectionId;
|
|
25
|
+
delete request.auth;
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
async function writeRequests({ components , context }) {
|
|
29
|
+
if (type.isNone(components.pages)) return;
|
|
30
|
+
const writePromises = components.pages.map((page)=>writeRequestsOnPage({
|
|
31
|
+
page,
|
|
32
|
+
context
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
return Promise.all(writePromises);
|
|
36
|
+
}
|
|
37
|
+
export default writeRequests;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ async function writeTypes({ components , context }) {
|
|
16
|
+
await context.writeBuildArtifact({
|
|
17
|
+
filePath: 'types.json',
|
|
18
|
+
content: JSON.stringify(components.types, null, 2)
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export default writeTypes;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": {},
|
|
3
|
+
"blocks": {
|
|
4
|
+
"Anchor": {
|
|
5
|
+
"package": "@lowdefy/blocks-basic",
|
|
6
|
+
"version": "4.0.0-alpha.4"
|
|
7
|
+
},
|
|
8
|
+
"Box": {
|
|
9
|
+
"package": "@lowdefy/blocks-basic",
|
|
10
|
+
"version": "4.0.0-alpha.4"
|
|
11
|
+
},
|
|
12
|
+
"DangerousHtml": {
|
|
13
|
+
"package": "@lowdefy/blocks-basic",
|
|
14
|
+
"version": "4.0.0-alpha.4"
|
|
15
|
+
},
|
|
16
|
+
"Html": {
|
|
17
|
+
"package": "@lowdefy/blocks-basic",
|
|
18
|
+
"version": "4.0.0-alpha.4"
|
|
19
|
+
},
|
|
20
|
+
"Icon": {
|
|
21
|
+
"package": "@lowdefy/blocks-basic",
|
|
22
|
+
"version": "4.0.0-alpha.4"
|
|
23
|
+
},
|
|
24
|
+
"Img": {
|
|
25
|
+
"package": "@lowdefy/blocks-basic",
|
|
26
|
+
"version": "4.0.0-alpha.4"
|
|
27
|
+
},
|
|
28
|
+
"List": {
|
|
29
|
+
"package": "@lowdefy/blocks-basic",
|
|
30
|
+
"version": "4.0.0-alpha.4"
|
|
31
|
+
},
|
|
32
|
+
"Span": {
|
|
33
|
+
"package": "@lowdefy/blocks-basic",
|
|
34
|
+
"version": "4.0.0-alpha.4"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"connections": {
|
|
38
|
+
"AxiosHttp": {
|
|
39
|
+
"package": "@lowdefy/connection-axios-http",
|
|
40
|
+
"version": "4.0.0-alpha.4"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"requests": {
|
|
44
|
+
"AxiosHttp": {
|
|
45
|
+
"package": "@lowdefy/connection-axios-http",
|
|
46
|
+
"version": "4.0.0-alpha.4"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"operators": {
|
|
50
|
+
"client": {},
|
|
51
|
+
"server": {}
|
|
52
|
+
},
|
|
53
|
+
"styles": {
|
|
54
|
+
"@lowdefy/blocks-basic": {
|
|
55
|
+
"default": [],
|
|
56
|
+
"Anchor": [],
|
|
57
|
+
"Box": [],
|
|
58
|
+
"DangerousHtml": [],
|
|
59
|
+
"Html": [],
|
|
60
|
+
"Icon": [],
|
|
61
|
+
"Img": [],
|
|
62
|
+
"List": [],
|
|
63
|
+
"Span": []
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|