@lowdefy/build 4.0.0-alpha.1 → 4.0.0-alpha.7
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 +36 -41
- package/dist/build/addDefaultPages/addDefaultPages.js +6 -2
- package/dist/build/buildAuth/getPageRoles.js +1 -2
- package/dist/build/buildConnections.js +1 -2
- package/dist/build/buildIcons.js +91 -0
- package/dist/build/buildPages/buildBlock/buildEvents.js +4 -1
- package/dist/build/buildPages/buildBlock/buildRequests.js +1 -2
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +2 -4
- package/dist/build/buildRefs/buildRefs.js +1 -2
- package/dist/build/buildRefs/getUserJavascriptFunction.js +6 -3
- package/dist/build/buildRefs/makeRefDefinition.js +1 -2
- package/dist/build/buildRefs/parseRefContent.js +2 -2
- package/dist/build/buildRefs/recursiveBuild.js +1 -2
- package/dist/build/buildRefs/runTransformer.js +5 -1
- package/dist/build/buildStyles.js +29 -0
- package/dist/build/buildTypes.js +36 -40
- package/dist/build/cleanBuildDirectory.js +1 -1
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/updateServerPackageJson.js +46 -0
- package/dist/build/validateApp.js +2 -4
- package/dist/build/validateConfig.js +12 -8
- package/dist/build/writeApp.js +1 -5
- package/dist/build/writeConfig.js +1 -5
- package/dist/build/writeConnections.js +1 -4
- package/dist/build/writeGlobal.js +2 -6
- package/dist/build/writeMenus.js +1 -4
- package/dist/build/writePages.js +2 -13
- package/dist/build/writePluginImports/generateImportFile.js +36 -0
- package/dist/build/writePluginImports/writeActionImports.js +22 -0
- package/dist/build/writePluginImports/writeBlockImports.js +5 -22
- package/dist/build/writePluginImports/writeConnectionImports.js +5 -22
- package/dist/build/writePluginImports/writeIconImports.js +31 -0
- package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
- package/dist/build/writePluginImports/writeStyleImports.js +27 -0
- package/dist/build/writeRequests.js +2 -7
- package/dist/build/writeTypes.js +1 -4
- package/dist/defaultTypes.json +1418 -19
- package/dist/index.js +129 -100
- package/dist/lowdefySchema.js +29 -12
- package/dist/scripts/generateDefaultTypes.js +35 -26
- package/dist/scripts/run.js +12 -11
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +2 -5
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/test/testContext.js +11 -18
- package/dist/utils/formatErrorMessage.js +1 -1
- package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +2 -2
- package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +3 -6
- package/package.json +42 -16
|
@@ -15,15 +15,11 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
async function writeGlobal({ components , context }) {
|
|
17
17
|
if (type.isNone(components.global)) {
|
|
18
|
-
components.global = {
|
|
19
|
-
};
|
|
18
|
+
components.global = {};
|
|
20
19
|
}
|
|
21
20
|
if (!type.isObject(components.global)) {
|
|
22
21
|
throw new Error('Global is not an object.');
|
|
23
22
|
}
|
|
24
|
-
await context.writeBuildArtifact(
|
|
25
|
-
filePath: 'global.json',
|
|
26
|
-
content: JSON.stringify(components.global, null, 2)
|
|
27
|
-
});
|
|
23
|
+
await context.writeBuildArtifact('global.json', JSON.stringify(components.global, null, 2));
|
|
28
24
|
}
|
|
29
25
|
export default writeGlobal;
|
package/dist/build/writeMenus.js
CHANGED
|
@@ -17,9 +17,6 @@ async function writeMenus({ components , context }) {
|
|
|
17
17
|
if (!type.isArray(components.menus)) {
|
|
18
18
|
throw new Error('Menus is not an array.');
|
|
19
19
|
}
|
|
20
|
-
await context.writeBuildArtifact(
|
|
21
|
-
filePath: 'menus.json',
|
|
22
|
-
content: JSON.stringify(components.menus, null, 2)
|
|
23
|
-
});
|
|
20
|
+
await context.writeBuildArtifact('menus.json', JSON.stringify(components.menus, null, 2));
|
|
24
21
|
}
|
|
25
22
|
export default writeMenus;
|
package/dist/build/writePages.js
CHANGED
|
@@ -12,21 +12,10 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
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
|
-
});
|
|
15
|
+
*/ async function writePage({ page , context }) {
|
|
16
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/${page.pageId}.json`, JSON.stringify(page, null, 2));
|
|
24
17
|
}
|
|
25
18
|
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
19
|
const writePromises = components.pages.map((page)=>writePage({
|
|
31
20
|
page,
|
|
32
21
|
context
|
|
@@ -0,0 +1,36 @@
|
|
|
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 import in imports -%}
|
|
17
|
+
import { {{ import.type }} } from '{{ import.package }}/{{ importPath }}';
|
|
18
|
+
{% endfor -%}
|
|
19
|
+
export default {
|
|
20
|
+
{% for import in imports -%}
|
|
21
|
+
{{ import.type }},
|
|
22
|
+
{% endfor -%}
|
|
23
|
+
}`;
|
|
24
|
+
function generateImportFile({ types , importPath }) {
|
|
25
|
+
const templateFn = nunjucksFunction(template);
|
|
26
|
+
const imports = Object.keys(types).map((type)=>({
|
|
27
|
+
type,
|
|
28
|
+
...types[type]
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
return templateFn({
|
|
32
|
+
imports,
|
|
33
|
+
importPath
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export default generateImportFile;
|
|
@@ -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
|
+
*/ import generateImportFile from './generateImportFile.js';
|
|
16
|
+
async function writeActionImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/actions.js', generateImportFile({
|
|
18
|
+
types: components.types.actions,
|
|
19
|
+
importPath: 'actions'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default writeActionImports;
|
|
@@ -12,28 +12,11 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import
|
|
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
|
-
`;
|
|
15
|
+
*/ import generateImportFile from './generateImportFile.js';
|
|
25
16
|
async function writeBlockImports({ components , context }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
await context.writeBuildArtifact({
|
|
33
|
-
filePath: 'plugins/blocks.js',
|
|
34
|
-
content: templateFn({
|
|
35
|
-
blocks
|
|
36
|
-
})
|
|
37
|
-
});
|
|
17
|
+
await context.writeBuildArtifact('plugins/blocks.js', generateImportFile({
|
|
18
|
+
types: components.types.blocks,
|
|
19
|
+
importPath: 'blocks'
|
|
20
|
+
}));
|
|
38
21
|
}
|
|
39
22
|
export default writeBlockImports;
|
|
@@ -12,28 +12,11 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import
|
|
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
|
-
`;
|
|
15
|
+
*/ import generateImportFile from './generateImportFile.js';
|
|
25
16
|
async function writeConnectionImports({ components , context }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
await context.writeBuildArtifact({
|
|
33
|
-
filePath: 'plugins/connections.js',
|
|
34
|
-
content: templateFn({
|
|
35
|
-
connections
|
|
36
|
-
})
|
|
37
|
-
});
|
|
17
|
+
await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
|
|
18
|
+
types: components.types.connections,
|
|
19
|
+
importPath: 'connections'
|
|
20
|
+
}));
|
|
38
21
|
}
|
|
39
22
|
export default writeConnectionImports;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
{% if package.icons.length %}import { {% for icon in package.icons -%}{% if not loop.last -%} {{ icon }}, {% else -%} {{ icon }} } from '{{ package.package }}';
|
|
18
|
+
{% endif -%}{% endfor %}{% endif %}{% endfor -%}
|
|
19
|
+
export default {
|
|
20
|
+
{%- for package in packages -%}
|
|
21
|
+
{%- for icon in package.icons %}
|
|
22
|
+
{{ icon }},{% endfor %}
|
|
23
|
+
{%- endfor %}
|
|
24
|
+
};`;
|
|
25
|
+
async function writeIconImports({ components , context }) {
|
|
26
|
+
const templateFn = nunjucksFunction(template);
|
|
27
|
+
await context.writeBuildArtifact('plugins/icons.js', templateFn({
|
|
28
|
+
packages: components.icons
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
export default writeIconImports;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 generateImportFile from './generateImportFile.js';
|
|
16
|
+
async function writeOperatorImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/operatorsClient.js', generateImportFile({
|
|
18
|
+
types: components.types.operators.client,
|
|
19
|
+
importPath: 'operators/client'
|
|
20
|
+
}));
|
|
21
|
+
await context.writeBuildArtifact('plugins/operatorsServer.js', generateImportFile({
|
|
22
|
+
types: components.types.operators.server,
|
|
23
|
+
importPath: 'operators/server'
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
export default writeOperatorImports;
|
|
@@ -0,0 +1,27 @@
|
|
|
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('plugins/styles.less', templateFn({
|
|
24
|
+
styles: components.styles
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
export default writeStyleImports;
|
|
@@ -12,13 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
async function writeRequestsOnPage({ page , context }) {
|
|
15
|
+
*/ async function writeRequestsOnPage({ page , context }) {
|
|
17
16
|
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
|
-
});
|
|
17
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, JSON.stringify(request, null, 2));
|
|
22
18
|
delete request.properties;
|
|
23
19
|
delete request.type;
|
|
24
20
|
delete request.connectionId;
|
|
@@ -26,7 +22,6 @@ async function writeRequestsOnPage({ page , context }) {
|
|
|
26
22
|
}));
|
|
27
23
|
}
|
|
28
24
|
async function writeRequests({ components , context }) {
|
|
29
|
-
if (type.isNone(components.pages)) return;
|
|
30
25
|
const writePromises = components.pages.map((page)=>writeRequestsOnPage({
|
|
31
26
|
page,
|
|
32
27
|
context
|
package/dist/build/writeTypes.js
CHANGED
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ async function writeTypes({ components , context }) {
|
|
16
|
-
await context.writeBuildArtifact(
|
|
17
|
-
filePath: 'types.json',
|
|
18
|
-
content: JSON.stringify(components.types, null, 2)
|
|
19
|
-
});
|
|
16
|
+
await context.writeBuildArtifact('types.json', JSON.stringify(components.types, null, 2));
|
|
20
17
|
}
|
|
21
18
|
export default writeTypes;
|