@lowdefy/build 4.0.0-alpha.9 → 4.0.0-rc.1
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 +4 -4
- package/dist/build/addDefaultPages/addDefaultPages.js +3 -4
- package/dist/build/buildAuth/buildAuth.js +12 -28
- package/dist/build/buildAuth/buildAuthPlugins.js +71 -0
- package/dist/build/buildAuth/buildPageAuth.js +50 -0
- package/dist/build/buildAuth/getPageRoles.js +2 -2
- package/dist/build/buildAuth/getProtectedPages.js +7 -9
- package/dist/build/buildAuth/validateAuthConfig.js +64 -0
- package/dist/build/buildConnections.js +2 -2
- package/dist/build/{buildIcons.js → buildImports/buildIconImports.js} +26 -29
- 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/{buildStyles.js → buildImports/buildStyleImports.js} +8 -12
- package/dist/build/buildImports/defaultIconsDev.js +584 -0
- package/dist/build/buildImports/defaultIconsProd.js +21 -0
- package/dist/build/buildMenu.js +11 -15
- package/dist/build/buildPages/buildBlock/buildBlock.js +3 -3
- package/dist/build/buildPages/buildBlock/buildEvents.js +8 -7
- package/dist/build/buildPages/buildBlock/buildRequests.js +1 -1
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +3 -8
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +1 -1
- package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +9 -9
- package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
- package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
- package/dist/build/buildPages/buildBlock/validateBlock.js +1 -1
- package/dist/build/buildPages/buildPage.js +3 -3
- package/dist/build/buildPages/buildPages.js +4 -6
- package/dist/build/buildPages/buildTestPage.js +46 -0
- package/dist/build/buildRefs/buildRefs.js +11 -5
- package/dist/build/buildRefs/evaluateBuildOperators.js +3 -4
- package/dist/build/buildRefs/getConfigFile.js +2 -2
- package/dist/build/buildRefs/getKey.js +24 -0
- package/dist/build/buildRefs/getRefContent.js +1 -1
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +1 -1
- package/dist/build/buildRefs/getUserJavascriptFunction.js +3 -2
- package/dist/build/buildRefs/makeRefDefinition.js +2 -1
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +4 -4
- package/dist/build/buildRefs/populateRefs.js +4 -4
- package/dist/build/buildRefs/recursiveBuild.js +9 -5
- package/dist/build/buildRefs/runRefResolver.js +1 -1
- package/dist/build/buildRefs/runTransformer.js +1 -1
- package/dist/build/buildTypes.js +33 -5
- package/dist/build/cleanBuildDirectory.js +1 -1
- package/dist/build/copyPublicFolder.js +7 -4
- package/dist/build/testSchema.js +5 -7
- package/dist/build/updateServerPackageJson.js +5 -1
- package/dist/build/validateApp.js +2 -2
- package/dist/build/validateConfig.js +2 -29
- package/dist/build/writeApp.js +1 -1
- package/dist/build/writeAuth.js +18 -0
- package/dist/build/writeConfig.js +1 -1
- package/dist/build/writeConnections.js +1 -1
- package/dist/build/writeGlobal.js +1 -1
- package/dist/build/writeMenus.js +1 -1
- package/dist/build/writePages.js +2 -3
- package/dist/build/writePluginImports/generateImportFile.js +2 -7
- package/dist/build/writePluginImports/writeActionImports.js +2 -2
- package/dist/build/writePluginImports/writeAuthImports.js +34 -0
- package/dist/build/writePluginImports/writeBlockImports.js +2 -2
- package/dist/build/writePluginImports/writeConnectionImports.js +2 -2
- package/dist/build/writePluginImports/writeIconImports.js +2 -2
- package/dist/build/writePluginImports/writeOperatorImports.js +5 -5
- package/dist/build/writePluginImports/writePluginImports.js +52 -0
- package/dist/build/writePluginImports/writeStyleImports.js +9 -3
- package/dist/build/writeRequests.js +2 -3
- package/dist/build/writeTypes.js +1 -1
- package/dist/createContext.js +55 -0
- package/dist/{defaultTypesMap.json → defaultTypesMap.js} +922 -405
- package/dist/index.js +20 -78
- package/dist/lowdefySchema.js +176 -68
- package/dist/scripts/generateDefaultTypes.js +21 -3
- package/dist/scripts/run.js +5 -4
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +1 -1
- 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 +2 -2
- package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/test/testContext.js +8 -2
- package/dist/utils/countOperators.js +1 -1
- package/dist/utils/createCheckDuplicateId.js +1 -1
- package/dist/utils/createCounter.js +1 -1
- package/dist/utils/createPluginTypesMap.js +29 -1
- package/dist/utils/formatErrorMessage.js +1 -1
- package/dist/utils/readConfigFile.js +5 -2
- package/dist/utils/writeBuildArtifact.js +1 -1
- package/package.json +56 -45
package/dist/build/buildTypes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -39,13 +39,17 @@ function buildTypes({ components , context }) {
|
|
|
39
39
|
typeCounters.operators.client.increment('_not');
|
|
40
40
|
typeCounters.operators.client.increment('_type');
|
|
41
41
|
// Add loaders and basic
|
|
42
|
-
basicTypes.blocks.forEach((block)=>typeCounters.blocks.increment(block)
|
|
43
|
-
);
|
|
44
|
-
loaderTypes.blocks.forEach((block)=>typeCounters.blocks.increment(block)
|
|
45
|
-
);
|
|
42
|
+
basicTypes.blocks.forEach((block)=>typeCounters.blocks.increment(block));
|
|
43
|
+
loaderTypes.blocks.forEach((block)=>typeCounters.blocks.increment(block));
|
|
46
44
|
typeCounters.blocks.increment('Message'); // Used for DisplayMessage in @lowdefy/client
|
|
47
45
|
components.types = {
|
|
48
46
|
actions: {},
|
|
47
|
+
auth: {
|
|
48
|
+
adapters: {},
|
|
49
|
+
callbacks: {},
|
|
50
|
+
events: {},
|
|
51
|
+
providers: {}
|
|
52
|
+
},
|
|
49
53
|
blocks: {},
|
|
50
54
|
connections: {},
|
|
51
55
|
requests: {},
|
|
@@ -60,6 +64,30 @@ function buildTypes({ components , context }) {
|
|
|
60
64
|
store: components.types.actions,
|
|
61
65
|
typeClass: 'Action'
|
|
62
66
|
});
|
|
67
|
+
buildTypeClass(context, {
|
|
68
|
+
counter: typeCounters.auth.adapters,
|
|
69
|
+
definitions: context.typesMap.auth.adapters,
|
|
70
|
+
store: components.types.auth.adapters,
|
|
71
|
+
typeClass: 'Auth adapter'
|
|
72
|
+
});
|
|
73
|
+
buildTypeClass(context, {
|
|
74
|
+
counter: typeCounters.auth.callbacks,
|
|
75
|
+
definitions: context.typesMap.auth.callbacks,
|
|
76
|
+
store: components.types.auth.callbacks,
|
|
77
|
+
typeClass: 'Auth callback'
|
|
78
|
+
});
|
|
79
|
+
buildTypeClass(context, {
|
|
80
|
+
counter: typeCounters.auth.events,
|
|
81
|
+
definitions: context.typesMap.auth.events,
|
|
82
|
+
store: components.types.auth.events,
|
|
83
|
+
typeClass: 'Auth event'
|
|
84
|
+
});
|
|
85
|
+
buildTypeClass(context, {
|
|
86
|
+
counter: typeCounters.auth.providers,
|
|
87
|
+
definitions: context.typesMap.auth.providers,
|
|
88
|
+
store: components.types.auth.providers,
|
|
89
|
+
typeClass: 'Auth provider'
|
|
90
|
+
});
|
|
63
91
|
buildTypeClass(context, {
|
|
64
92
|
counter: typeCounters.blocks,
|
|
65
93
|
definitions: context.typesMap.blocks,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,10 +14,13 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import path from 'path';
|
|
16
16
|
import fs from 'fs';
|
|
17
|
-
import {
|
|
17
|
+
import { cleanDirectory, copyFileOrDirectory } from '@lowdefy/node-utils';
|
|
18
18
|
async function copyPublicFolder({ context }) {
|
|
19
19
|
if (context.directories.config === context.directories.server) return;
|
|
20
|
-
|
|
21
|
-
await
|
|
20
|
+
await cleanDirectory(path.resolve(context.directories.server, 'public'));
|
|
21
|
+
await copyFileOrDirectory(path.resolve(context.directories.server, 'public_default'), path.resolve(context.directories.server, 'public'));
|
|
22
|
+
if (fs.existsSync(path.resolve(context.directories.config, 'public'))) {
|
|
23
|
+
await copyFileOrDirectory(path.resolve(context.directories.config, 'public'), path.resolve(context.directories.server, 'public'));
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
export default copyPublicFolder;
|
package/dist/build/testSchema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,20 +15,18 @@
|
|
|
15
15
|
*/ import { validate } from '@lowdefy/ajv';
|
|
16
16
|
import lowdefySchema from '../lowdefySchema.js';
|
|
17
17
|
import formatErrorMessage from '../utils/formatErrorMessage.js';
|
|
18
|
-
|
|
18
|
+
function testSchema({ components , context }) {
|
|
19
19
|
const { valid , errors } = validate({
|
|
20
20
|
schema: lowdefySchema,
|
|
21
21
|
data: components,
|
|
22
22
|
returnErrors: true
|
|
23
23
|
});
|
|
24
24
|
if (!valid) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
context.logger.warn('Schema not valid.');
|
|
26
|
+
errors.map((error)=>context.logger.warn(formatErrorMessage({
|
|
27
27
|
error,
|
|
28
28
|
components
|
|
29
|
-
}))
|
|
30
|
-
);
|
|
31
|
-
await promises;
|
|
29
|
+
})));
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
export default testSchema;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -25,6 +25,10 @@ async function updateServerPackageJson({ components , context }) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
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);
|
|
28
32
|
getPackages(components.types.blocks);
|
|
29
33
|
getPackages(components.types.connections);
|
|
30
34
|
getPackages(components.types.requests);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
|
|
16
|
+
function validateApp({ components }) {
|
|
17
17
|
if (type.isNone(components.app)) {
|
|
18
18
|
components.app = {};
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,45 +13,18 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
|
|
17
|
-
import lowdefySchema from '../lowdefySchema.js';
|
|
18
|
-
async function validateConfig({ components }) {
|
|
16
|
+
function validateConfig({ components }) {
|
|
19
17
|
if (type.isNone(components.config)) {
|
|
20
18
|
components.config = {};
|
|
21
19
|
}
|
|
22
20
|
if (!type.isObject(components.config)) {
|
|
23
21
|
throw new Error('lowdefy.config is not an object.');
|
|
24
22
|
}
|
|
25
|
-
if (type.isNone(components.config.auth)) {
|
|
26
|
-
components.config.auth = {};
|
|
27
|
-
}
|
|
28
|
-
if (type.isNone(components.config.auth.pages)) {
|
|
29
|
-
components.config.auth.pages = {};
|
|
30
|
-
}
|
|
31
|
-
if (type.isNone(components.config.auth.pages.roles)) {
|
|
32
|
-
components.config.auth.pages.roles = {};
|
|
33
|
-
}
|
|
34
|
-
if (type.isNone(components.config.theme)) {
|
|
35
|
-
components.config.theme = {};
|
|
36
|
-
}
|
|
37
23
|
if (type.isString(components.config.basePath)) {
|
|
38
24
|
if (components.config.basePath[0] !== '/') {
|
|
39
25
|
throw Error('Base path must start with "/".');
|
|
40
26
|
}
|
|
41
27
|
}
|
|
42
|
-
validate({
|
|
43
|
-
schema: lowdefySchema.definitions.authConfig,
|
|
44
|
-
data: components.config.auth
|
|
45
|
-
});
|
|
46
|
-
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)) {
|
|
47
|
-
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.');
|
|
48
|
-
}
|
|
49
|
-
if (components.config.auth.pages.protected === false) {
|
|
50
|
-
throw new Error('Protected pages can not be set to false.');
|
|
51
|
-
}
|
|
52
|
-
if (components.config.auth.pages.public === false) {
|
|
53
|
-
throw new Error('Public pages can not be set to false.');
|
|
54
|
-
}
|
|
55
28
|
return components;
|
|
56
29
|
}
|
|
57
30
|
export default validateConfig;
|
package/dist/build/writeApp.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 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;
|
package/dist/build/writeMenus.js
CHANGED
package/dist/build/writePages.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,8 +19,7 @@ async function writePages({ components , context }) {
|
|
|
19
19
|
const writePromises = components.pages.map((page)=>writePage({
|
|
20
20
|
page,
|
|
21
21
|
context
|
|
22
|
-
})
|
|
23
|
-
);
|
|
22
|
+
}));
|
|
24
23
|
return Promise.all(writePromises);
|
|
25
24
|
}
|
|
26
25
|
export default writePages;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,13 +21,8 @@ export default {
|
|
|
21
21
|
{{ import.typeName }},
|
|
22
22
|
{% endfor -%}
|
|
23
23
|
};`;
|
|
24
|
-
function generateImportFile({
|
|
24
|
+
function generateImportFile({ imports , importPath }) {
|
|
25
25
|
const templateFn = nunjucksFunction(template);
|
|
26
|
-
const imports = Object.keys(types).map((typeName)=>({
|
|
27
|
-
typeName,
|
|
28
|
-
...types[typeName]
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
26
|
return templateFn({
|
|
32
27
|
imports,
|
|
33
28
|
importPath
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeActionImports({ components , context }) {
|
|
17
17
|
await context.writeBuildArtifact('plugins/actions.js', generateImportFile({
|
|
18
|
-
|
|
18
|
+
imports: components.imports.actions,
|
|
19
19
|
importPath: 'actions'
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeBlockImports({ components , context }) {
|
|
17
17
|
await context.writeBuildArtifact('plugins/blocks.js', generateImportFile({
|
|
18
|
-
|
|
18
|
+
imports: components.imports.blocks,
|
|
19
19
|
importPath: 'blocks'
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeConnectionImports({ components , context }) {
|
|
17
17
|
await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
|
|
18
|
-
|
|
18
|
+
imports: components.imports.connections,
|
|
19
19
|
importPath: 'connections'
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
async function writeIconImports({ components , context }) {
|
|
26
26
|
const templateFn = nunjucksFunction(template);
|
|
27
27
|
await context.writeBuildArtifact('plugins/icons.js', templateFn({
|
|
28
|
-
packages: components.icons
|
|
28
|
+
packages: components.imports.icons
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
export default writeIconImports;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeOperatorImports({ components , context }) {
|
|
17
|
-
await context.writeBuildArtifact('plugins/
|
|
18
|
-
|
|
17
|
+
await context.writeBuildArtifact('plugins/operators/client.js', generateImportFile({
|
|
18
|
+
imports: components.imports.operators.client,
|
|
19
19
|
importPath: 'operators/client'
|
|
20
20
|
}));
|
|
21
|
-
await context.writeBuildArtifact('plugins/
|
|
22
|
-
|
|
21
|
+
await context.writeBuildArtifact('plugins/operators/server.js', generateImportFile({
|
|
22
|
+
imports: components.imports.operators.server,
|
|
23
23
|
importPath: 'operators/server'
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,17 +12,23 @@
|
|
|
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
|
|
15
|
+
*/ import fs from 'fs';
|
|
16
|
+
import path from 'path';
|
|
17
|
+
import { nunjucksFunction } from '@lowdefy/nunjucks';
|
|
16
18
|
const template = `@import '@lowdefy/layout/style.less';
|
|
17
19
|
@import '@lowdefy/client/style.less';
|
|
18
20
|
{% for style in styles -%}
|
|
19
21
|
@import '{{ style }}';
|
|
20
22
|
{% endfor -%}
|
|
23
|
+
{% if importUserStyles %}
|
|
24
|
+
@import '../../public/styles.less';
|
|
25
|
+
{% endif %}
|
|
21
26
|
`;
|
|
22
27
|
async function writeStyleImports({ components , context }) {
|
|
23
28
|
const templateFn = nunjucksFunction(template);
|
|
24
29
|
await context.writeBuildArtifact('plugins/styles.less', templateFn({
|
|
25
|
-
styles: components.styles
|
|
30
|
+
styles: components.imports.styles,
|
|
31
|
+
importUserStyles: fs.existsSync(path.join(context.directories.config, 'public/styles.less'))
|
|
26
32
|
}));
|
|
27
33
|
}
|
|
28
34
|
export default writeStyleImports;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -25,8 +25,7 @@ async function writeRequests({ components , context }) {
|
|
|
25
25
|
const writePromises = components.pages.map((page)=>writeRequestsOnPage({
|
|
26
26
|
page,
|
|
27
27
|
context
|
|
28
|
-
})
|
|
29
|
-
);
|
|
28
|
+
}));
|
|
30
29
|
return Promise.all(writePromises);
|
|
31
30
|
}
|
|
32
31
|
export default writeRequests;
|
package/dist/build/writeTypes.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable no-console */ /*
|
|
2
|
+
Copyright 2020-2023 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 { mergeObjects } from '@lowdefy/helpers';
|
|
16
|
+
import createCounter from './utils/createCounter.js';
|
|
17
|
+
import createReadConfigFile from './utils/readConfigFile.js';
|
|
18
|
+
import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
|
|
19
|
+
import defaultTypesMap from './defaultTypesMap.js';
|
|
20
|
+
function createContext({ customTypesMap , directories , logger , refResolver , stage ='prod' }) {
|
|
21
|
+
const context = {
|
|
22
|
+
directories,
|
|
23
|
+
logger,
|
|
24
|
+
readConfigFile: createReadConfigFile({
|
|
25
|
+
directories
|
|
26
|
+
}),
|
|
27
|
+
refResolver,
|
|
28
|
+
stage,
|
|
29
|
+
typeCounters: {
|
|
30
|
+
actions: createCounter(),
|
|
31
|
+
auth: {
|
|
32
|
+
adapters: createCounter(),
|
|
33
|
+
callbacks: createCounter(),
|
|
34
|
+
events: createCounter(),
|
|
35
|
+
providers: createCounter()
|
|
36
|
+
},
|
|
37
|
+
blocks: createCounter(),
|
|
38
|
+
connections: createCounter(),
|
|
39
|
+
requests: createCounter(),
|
|
40
|
+
operators: {
|
|
41
|
+
client: createCounter(),
|
|
42
|
+
server: createCounter()
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
typesMap: mergeObjects([
|
|
46
|
+
defaultTypesMap,
|
|
47
|
+
customTypesMap
|
|
48
|
+
]),
|
|
49
|
+
writeBuildArtifact: createWriteBuildArtifact({
|
|
50
|
+
directories
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
export default createContext;
|