@lowdefy/build 4.0.0-alpha.29 → 4.0.0-alpha.30
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 +51 -0
- package/dist/build/addDefaultPages/addDefaultPages.js +43 -0
- package/dist/build/buildAuth/buildAuth.js +34 -0
- package/dist/build/buildAuth/buildAuthPlugins.js +71 -0
- package/dist/build/buildAuth/buildPageAuth.js +50 -0
- package/dist/build/buildAuth/getPageRoles.js +33 -0
- package/dist/build/buildAuth/getProtectedPages.js +28 -0
- package/dist/build/buildAuth/validateAuthConfig.js +61 -0
- package/dist/build/buildConnections.js +46 -0
- package/dist/build/buildImports/buildIconImports.js +83 -0
- package/dist/build/buildImports/buildImports.js +30 -0
- package/dist/build/buildImports/buildImportsDev.js +106 -0
- package/dist/build/buildImports/buildImportsProd.js +54 -0
- package/dist/build/buildImports/buildStyleImports.js +25 -0
- package/dist/build/buildImports/defaultIconsDev.js +584 -0
- package/dist/build/buildImports/defaultIconsProd.js +21 -0
- package/dist/build/buildMenu.js +118 -0
- package/dist/build/buildPages/buildBlock/buildBlock.js +35 -0
- package/dist/build/buildPages/buildBlock/buildEvents.js +76 -0
- package/dist/build/buildPages/buildBlock/buildRequests.js +51 -0
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +30 -0
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +31 -0
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +18 -0
- package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +35 -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 +38 -0
- package/dist/build/buildPages/buildPage.js +50 -0
- package/dist/build/buildPages/buildPages.js +31 -0
- package/dist/build/buildPages/buildTestPage.js +46 -0
- package/dist/build/buildRefs/buildRefs.js +32 -0
- package/dist/build/buildRefs/evaluateBuildOperators.js +34 -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 +24 -0
- package/dist/build/buildRefs/makeRefDefinition.js +30 -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 +68 -0
- package/dist/build/buildRefs/runRefResolver.js +33 -0
- package/dist/build/buildRefs/runTransformer.js +30 -0
- package/dist/build/buildTypes.js +124 -0
- package/dist/build/cleanBuildDirectory.js +19 -0
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/testSchema.js +32 -0
- package/dist/build/updateServerPackageJson.js +50 -0
- package/dist/build/validateApp.js +34 -0
- package/dist/build/validateConfig.js +33 -0
- package/dist/build/writeApp.js +18 -0
- package/dist/build/writeAuth.js +18 -0
- package/dist/build/writeConfig.js +18 -0
- package/dist/build/writeConnections.js +26 -0
- package/dist/build/writeGlobal.js +25 -0
- package/dist/build/writeMenus.js +22 -0
- package/dist/build/writePages.js +25 -0
- package/dist/build/writePluginImports/generateImportFile.js +31 -0
- package/dist/build/writePluginImports/writeActionImports.js +22 -0
- package/dist/build/writePluginImports/writeAuthImports.js +34 -0
- package/dist/build/writePluginImports/writeBlockImports.js +22 -0
- package/dist/build/writePluginImports/writeConnectionImports.js +22 -0
- package/dist/build/writePluginImports/writeIconImports.js +31 -0
- package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
- package/dist/build/writePluginImports/writePluginImports.js +52 -0
- package/dist/build/writePluginImports/writeStyleImports.js +28 -0
- package/dist/build/writeRequests.js +31 -0
- package/dist/build/writeTypes.js +18 -0
- package/dist/createContext.js +55 -0
- package/dist/defaultTypesMap.js +2046 -0
- package/dist/index.js +139 -0
- package/dist/lowdefySchema.js +841 -0
- package/dist/scripts/generateDefaultTypes.js +88 -0
- package/dist/scripts/run.js +33 -0
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +22 -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 +54 -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/createPluginTypesMap.js +113 -0
- package/dist/utils/formatErrorMessage.js +56 -0
- package/dist/utils/readConfigFile.js +24 -0
- package/dist/utils/writeBuildArtifact.js +23 -0
- package/package.json +36 -36
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 path from 'path';
|
|
16
|
+
import { readFile, writeFile } from '@lowdefy/node-utils';
|
|
17
|
+
async function updateServerPackageJson({ components , context }) {
|
|
18
|
+
const filePath = path.join(context.directories.server, 'package.json');
|
|
19
|
+
const packageJsonContent = await readFile(filePath);
|
|
20
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
21
|
+
const dependencies = packageJson.dependencies;
|
|
22
|
+
function getPackages(types) {
|
|
23
|
+
Object.values(types).forEach((type)=>{
|
|
24
|
+
dependencies[type.package] = type.version;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getPackages(components.types.actions);
|
|
28
|
+
getPackages(components.types.auth.adapters);
|
|
29
|
+
getPackages(components.types.auth.callbacks);
|
|
30
|
+
getPackages(components.types.auth.events);
|
|
31
|
+
getPackages(components.types.auth.providers);
|
|
32
|
+
getPackages(components.types.blocks);
|
|
33
|
+
getPackages(components.types.connections);
|
|
34
|
+
getPackages(components.types.requests);
|
|
35
|
+
getPackages(components.types.operators.client);
|
|
36
|
+
getPackages(components.types.operators.server);
|
|
37
|
+
// Sort dependencies
|
|
38
|
+
packageJson.dependencies = {};
|
|
39
|
+
Object.keys(dependencies).sort().forEach((name)=>{
|
|
40
|
+
packageJson.dependencies[name] = dependencies[name];
|
|
41
|
+
});
|
|
42
|
+
const newPackageJsonContent = JSON.stringify(packageJson, null, 2).concat('\n');
|
|
43
|
+
// Only write package.json if it has changed since dev server will
|
|
44
|
+
// be watching the file to trigger reinstalls
|
|
45
|
+
if (newPackageJsonContent !== packageJsonContent) {
|
|
46
|
+
context.logger.warn('Plugin dependencies have changed. Updating "package.json".');
|
|
47
|
+
await writeFile(filePath, newPackageJsonContent);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export default updateServerPackageJson;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */ /*
|
|
2
|
+
Copyright 2020-2022 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
|
+
function validateApp({ components }) {
|
|
17
|
+
if (type.isNone(components.app)) {
|
|
18
|
+
components.app = {};
|
|
19
|
+
}
|
|
20
|
+
if (!type.isObject(components.app)) {
|
|
21
|
+
throw new Error('lowdefy.app is not an object.');
|
|
22
|
+
}
|
|
23
|
+
if (type.isNone(components.app.html)) {
|
|
24
|
+
components.app.html = {};
|
|
25
|
+
}
|
|
26
|
+
if (type.isNone(components.app.html.appendBody)) {
|
|
27
|
+
components.app.html.appendBody = '';
|
|
28
|
+
}
|
|
29
|
+
if (type.isNone(components.app.html.appendHead)) {
|
|
30
|
+
components.app.html.appendHead = '';
|
|
31
|
+
}
|
|
32
|
+
return components;
|
|
33
|
+
}
|
|
34
|
+
export default validateApp;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */ /*
|
|
2
|
+
Copyright 2020-2022 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
|
+
function validateConfig({ components }) {
|
|
17
|
+
if (type.isNone(components.config)) {
|
|
18
|
+
components.config = {};
|
|
19
|
+
}
|
|
20
|
+
if (!type.isObject(components.config)) {
|
|
21
|
+
throw new Error('lowdefy.config is not an object.');
|
|
22
|
+
}
|
|
23
|
+
if (type.isNone(components.config.theme)) {
|
|
24
|
+
components.config.theme = {};
|
|
25
|
+
}
|
|
26
|
+
if (type.isString(components.config.basePath)) {
|
|
27
|
+
if (components.config.basePath[0] !== '/') {
|
|
28
|
+
throw Error('Base path must start with "/".');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return components;
|
|
32
|
+
}
|
|
33
|
+
export default validateConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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('app.json', JSON.stringify(components.app || {}, null, 2));
|
|
17
|
+
}
|
|
18
|
+
export default writeApp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeAuth({ components , context }) {
|
|
16
|
+
await context.writeBuildArtifact('auth.json', JSON.stringify(components.auth || {}, null, 2));
|
|
17
|
+
}
|
|
18
|
+
export default writeAuth;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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('config.json', JSON.stringify(components.config || {}, null, 2));
|
|
17
|
+
}
|
|
18
|
+
export default writeConfig;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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(`connections/${connection.connectionId}.json`, JSON.stringify(connection, null, 2));
|
|
23
|
+
});
|
|
24
|
+
return Promise.all(writePromises);
|
|
25
|
+
}
|
|
26
|
+
export default writeConnections;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
if (!type.isObject(components.global)) {
|
|
21
|
+
throw new Error('Global is not an object.');
|
|
22
|
+
}
|
|
23
|
+
await context.writeBuildArtifact('global.json', JSON.stringify(components.global, null, 2));
|
|
24
|
+
}
|
|
25
|
+
export default writeGlobal;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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('menus.json', JSON.stringify(components.menus, null, 2));
|
|
21
|
+
}
|
|
22
|
+
export default writeMenus;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writePage({ page , context }) {
|
|
16
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/${page.pageId}.json`, JSON.stringify(page, null, 2));
|
|
17
|
+
}
|
|
18
|
+
async function writePages({ components , context }) {
|
|
19
|
+
const writePromises = components.pages.map((page)=>writePage({
|
|
20
|
+
page,
|
|
21
|
+
context
|
|
22
|
+
}));
|
|
23
|
+
return Promise.all(writePromises);
|
|
24
|
+
}
|
|
25
|
+
export default writePages;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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.originalTypeName }} as {{ import.typeName }} } from '{{ import.package }}/{{ importPath }}';
|
|
18
|
+
{% endfor -%}
|
|
19
|
+
export default {
|
|
20
|
+
{% for import in imports -%}
|
|
21
|
+
{{ import.typeName }},
|
|
22
|
+
{% endfor -%}
|
|
23
|
+
};`;
|
|
24
|
+
function generateImportFile({ imports , importPath }) {
|
|
25
|
+
const templateFn = nunjucksFunction(template);
|
|
26
|
+
return templateFn({
|
|
27
|
+
imports,
|
|
28
|
+
importPath
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export default generateImportFile;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
imports: components.imports.actions,
|
|
19
|
+
importPath: 'actions'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default writeActionImports;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeAuthImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/auth/adapters.js', generateImportFile({
|
|
18
|
+
imports: components.imports.auth.adapters,
|
|
19
|
+
importPath: 'auth/adapters'
|
|
20
|
+
}));
|
|
21
|
+
await context.writeBuildArtifact('plugins/auth/callbacks.js', generateImportFile({
|
|
22
|
+
imports: components.imports.auth.callbacks,
|
|
23
|
+
importPath: 'auth/callbacks'
|
|
24
|
+
}));
|
|
25
|
+
await context.writeBuildArtifact('plugins/auth/events.js', generateImportFile({
|
|
26
|
+
imports: components.imports.auth.events,
|
|
27
|
+
importPath: 'auth/events'
|
|
28
|
+
}));
|
|
29
|
+
await context.writeBuildArtifact('plugins/auth/providers.js', generateImportFile({
|
|
30
|
+
imports: components.imports.auth.providers,
|
|
31
|
+
importPath: 'auth/providers'
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export default writeAuthImports;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeBlockImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/blocks.js', generateImportFile({
|
|
18
|
+
imports: components.imports.blocks,
|
|
19
|
+
importPath: 'blocks'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default writeBlockImports;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeConnectionImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
|
|
18
|
+
imports: components.imports.connections,
|
|
19
|
+
importPath: 'connections'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default writeConnectionImports;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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.imports.icons
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
export default writeIconImports;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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/operators/client.js', generateImportFile({
|
|
18
|
+
imports: components.imports.operators.client,
|
|
19
|
+
importPath: 'operators/client'
|
|
20
|
+
}));
|
|
21
|
+
await context.writeBuildArtifact('plugins/operators/server.js', generateImportFile({
|
|
22
|
+
imports: components.imports.operators.server,
|
|
23
|
+
importPath: 'operators/server'
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
export default writeOperatorImports;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeActionImports from './writeActionImports.js';
|
|
16
|
+
import writeAuthImports from './writeAuthImports.js';
|
|
17
|
+
import writeBlockImports from './writeBlockImports.js';
|
|
18
|
+
import writeConnectionImports from './writeConnectionImports.js';
|
|
19
|
+
import writeIconImports from './writeIconImports.js';
|
|
20
|
+
import writeOperatorImports from './writeOperatorImports.js';
|
|
21
|
+
import writeStyleImports from './writeStyleImports.js';
|
|
22
|
+
async function writePluginImports({ components , context }) {
|
|
23
|
+
await writeActionImports({
|
|
24
|
+
components,
|
|
25
|
+
context
|
|
26
|
+
});
|
|
27
|
+
await writeAuthImports({
|
|
28
|
+
components,
|
|
29
|
+
context
|
|
30
|
+
});
|
|
31
|
+
await writeBlockImports({
|
|
32
|
+
components,
|
|
33
|
+
context
|
|
34
|
+
});
|
|
35
|
+
await writeConnectionImports({
|
|
36
|
+
components,
|
|
37
|
+
context
|
|
38
|
+
});
|
|
39
|
+
await writeIconImports({
|
|
40
|
+
components,
|
|
41
|
+
context
|
|
42
|
+
});
|
|
43
|
+
await writeOperatorImports({
|
|
44
|
+
components,
|
|
45
|
+
context
|
|
46
|
+
});
|
|
47
|
+
await writeStyleImports({
|
|
48
|
+
components,
|
|
49
|
+
context
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export default writePluginImports;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
@import '@lowdefy/client/style.less';
|
|
18
|
+
{% for style in styles -%}
|
|
19
|
+
@import '{{ style }}';
|
|
20
|
+
{% endfor -%}
|
|
21
|
+
`;
|
|
22
|
+
async function writeStyleImports({ components , context }) {
|
|
23
|
+
const templateFn = nunjucksFunction(template);
|
|
24
|
+
await context.writeBuildArtifact('plugins/styles.less', templateFn({
|
|
25
|
+
styles: components.imports.styles
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
export default writeStyleImports;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 writeRequestsOnPage({ page , context }) {
|
|
16
|
+
return Promise.all(page.requests.map(async (request)=>{
|
|
17
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, JSON.stringify(request, null, 2));
|
|
18
|
+
delete request.properties;
|
|
19
|
+
delete request.type;
|
|
20
|
+
delete request.connectionId;
|
|
21
|
+
delete request.auth;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
async function writeRequests({ components , context }) {
|
|
25
|
+
const writePromises = components.pages.map((page)=>writeRequestsOnPage({
|
|
26
|
+
page,
|
|
27
|
+
context
|
|
28
|
+
}));
|
|
29
|
+
return Promise.all(writePromises);
|
|
30
|
+
}
|
|
31
|
+
export default writeRequests;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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('types.json', JSON.stringify(components.types, null, 2));
|
|
17
|
+
}
|
|
18
|
+
export default writeTypes;
|