@lowdefy/build 4.0.0-rc.0 → 4.0.0-rc.10
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 +2 -2
- package/dist/build/addKeys.js +48 -0
- package/dist/build/buildAuth/buildAuth.js +2 -2
- package/dist/build/buildAuth/buildAuthPlugins.js +5 -5
- package/dist/build/buildAuth/buildPageAuth.js +2 -2
- package/dist/build/buildAuth/getPageRoles.js +2 -2
- package/dist/build/buildAuth/getProtectedPages.js +2 -2
- package/dist/build/buildAuth/validateAuthConfig.js +2 -2
- package/dist/build/buildConnections.js +2 -2
- package/dist/build/buildImports/buildIconImports.js +14 -9
- package/dist/build/buildImports/buildImports.js +2 -2
- package/dist/build/buildImports/buildImportsDev.js +4 -4
- package/dist/build/buildImports/buildImportsProd.js +2 -2
- package/dist/build/buildImports/buildStyleImports.js +2 -2
- package/dist/build/buildImports/defaultIconsDev.js +2 -2
- package/dist/build/buildImports/defaultIconsProd.js +1 -1
- package/dist/build/buildMenu.js +5 -5
- package/dist/build/buildPages/buildBlock/buildBlock.js +1 -1
- package/dist/build/buildPages/buildBlock/buildEvents.js +2 -2
- package/dist/build/buildPages/buildBlock/buildRequests.js +2 -2
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +3 -3
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +2 -2
- 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 +2 -2
- package/dist/build/buildPages/buildBlock/validateBlock.js +2 -2
- package/dist/build/buildPages/buildPage.js +2 -2
- package/dist/build/buildPages/buildPages.js +2 -2
- package/dist/build/buildPages/buildTestPage.js +2 -2
- package/dist/build/buildRefs/buildRefs.js +3 -3
- package/dist/build/buildRefs/evaluateBuildOperators.js +5 -5
- package/dist/build/buildRefs/getConfigFile.js +2 -2
- package/dist/build/buildRefs/getKey.js +24 -0
- package/dist/build/buildRefs/getRefContent.js +2 -2
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +3 -3
- package/dist/build/buildRefs/getUserJavascriptFunction.js +2 -2
- package/dist/build/buildRefs/makeRefDefinition.js +11 -5
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +4 -9
- package/dist/build/buildRefs/populateRefs.js +2 -2
- package/dist/build/buildRefs/recursiveBuild.js +25 -8
- package/dist/build/buildRefs/runRefResolver.js +2 -2
- package/dist/build/buildRefs/runTransformer.js +2 -2
- package/dist/build/buildTypes.js +4 -4
- package/dist/build/cleanBuildDirectory.js +2 -2
- package/dist/build/copyPublicFolder.js +8 -5
- package/dist/build/testSchema.js +3 -3
- package/dist/build/updateServerPackageJson.js +3 -8
- package/dist/build/validateApp.js +2 -2
- package/dist/build/validateConfig.js +2 -2
- package/dist/build/writeApp.js +6 -3
- package/dist/build/writeAuth.js +6 -3
- package/dist/build/writeConfig.js +6 -3
- package/dist/build/writeConnections.js +6 -4
- package/dist/build/writeGlobal.js +6 -4
- package/dist/build/writeMaps.js +30 -0
- package/dist/build/writeMenus.js +6 -4
- package/dist/build/writePages.js +7 -4
- package/dist/build/writePluginImports/generateImportFile.js +2 -2
- package/dist/build/writePluginImports/writeActionImports.js +2 -2
- package/dist/build/writePluginImports/writeAuthImports.js +2 -2
- 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 +2 -2
- package/dist/build/writePluginImports/writePluginImports.js +2 -2
- package/dist/build/writePluginImports/writeStyleImports.js +2 -2
- package/dist/build/writeRequests.js +7 -4
- package/dist/build/writeTypes.js +6 -3
- package/dist/createContext.js +4 -2
- package/dist/defaultTypesMap.js +363 -365
- package/dist/index.js +11 -1
- package/dist/lowdefySchema.js +8 -2
- package/dist/scripts/generateDefaultTypes.js +3 -3
- package/dist/scripts/run.js +1 -1
- 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 +1 -1
- package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/test/testContext.js +5 -3
- package/dist/utils/countOperators.js +2 -2
- package/dist/utils/createCheckDuplicateId.js +3 -3
- package/dist/utils/createCounter.js +1 -1
- package/dist/utils/createPluginTypesMap.js +3 -3
- package/dist/utils/formatErrorMessage.js +4 -4
- package/dist/utils/makeId.js +20 -0
- package/dist/utils/readConfigFile.js +2 -2
- package/dist/utils/writeBuildArtifact.js +2 -2
- package/package.json +47 -48
|
@@ -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,8 +15,8 @@
|
|
|
15
15
|
*/ import recursiveBuild from './recursiveBuild.js';
|
|
16
16
|
import makeRefDefinition from './makeRefDefinition.js';
|
|
17
17
|
import evaluateBuildOperators from './evaluateBuildOperators.js';
|
|
18
|
-
async function buildRefs({ context
|
|
19
|
-
const refDef = makeRefDefinition('lowdefy.yaml');
|
|
18
|
+
async function buildRefs({ context }) {
|
|
19
|
+
const refDef = makeRefDefinition('lowdefy.yaml', null, context.refMap);
|
|
20
20
|
let components = await recursiveBuild({
|
|
21
21
|
context,
|
|
22
22
|
refDef,
|
|
@@ -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,14 +12,14 @@
|
|
|
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 { BuildParser } from '@lowdefy/operators';
|
|
16
16
|
import operators from '@lowdefy/operators-js/operators/build';
|
|
17
|
-
async function evaluateBuildOperators({ context
|
|
18
|
-
const operatorsParser = new
|
|
17
|
+
async function evaluateBuildOperators({ context, input, refDef }) {
|
|
18
|
+
const operatorsParser = new BuildParser({
|
|
19
19
|
env: process.env,
|
|
20
20
|
operators
|
|
21
21
|
});
|
|
22
|
-
const { output
|
|
22
|
+
const { output, errors } = operatorsParser.parse({
|
|
23
23
|
input,
|
|
24
24
|
location: refDef.path ?? refDef.resolver,
|
|
25
25
|
operatorPrefix: '_build.'
|
|
@@ -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.
|
|
@@ -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
|
-
async function getConfigFile({ context
|
|
16
|
+
async function getConfigFile({ context, refDef, referencedFrom }) {
|
|
17
17
|
if (!type.isString(refDef.path)) {
|
|
18
18
|
throw new Error(`Invalid _ref definition ${JSON.stringify({
|
|
19
19
|
_ref: refDef.original
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { get } from '@lowdefy/helpers';
|
|
16
|
+
function getKey({ input, refDef }) {
|
|
17
|
+
if (refDef.key) {
|
|
18
|
+
return get(input, refDef.key, {
|
|
19
|
+
default: null
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return input;
|
|
23
|
+
}
|
|
24
|
+
export default getKey;
|
|
@@ -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 getConfigFile from './getConfigFile.js';
|
|
16
16
|
import parseRefContent from './parseRefContent.js';
|
|
17
17
|
import runRefResolver from './runRefResolver.js';
|
|
18
|
-
async function getRefContent({ context
|
|
18
|
+
async function getRefContent({ context, refDef, referencedFrom }) {
|
|
19
19
|
let content;
|
|
20
20
|
if (refDef.path === 'lowdefy.yaml' || refDef.path === 'lowdefy.yml') {
|
|
21
21
|
content = await getConfigFile({
|
|
@@ -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 { type } from '@lowdefy/helpers';
|
|
16
16
|
import makeRefDefinition from './makeRefDefinition.js';
|
|
17
|
-
function getRefsFromFile(fileContent) {
|
|
17
|
+
function getRefsFromFile(fileContent, parentRefDefId, refMap) {
|
|
18
18
|
const foundRefs = [];
|
|
19
19
|
const reviver = (key, value)=>{
|
|
20
20
|
if (type.isObject(value)) {
|
|
21
21
|
if (!type.isUndefined(value._ref)) {
|
|
22
|
-
const def = makeRefDefinition(value._ref);
|
|
22
|
+
const def = makeRefDefinition(value._ref, parentRefDefId, refMap);
|
|
23
23
|
foundRefs.push(def);
|
|
24
24
|
return {
|
|
25
25
|
_ref: def
|
|
@@ -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,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import path from 'path';
|
|
16
16
|
import { pathToFileURL } from 'url';
|
|
17
|
-
async function getUserJavascriptFunction({ context
|
|
17
|
+
async function getUserJavascriptFunction({ context, filePath }) {
|
|
18
18
|
try {
|
|
19
19
|
return (await import(pathToFileURL(path.join(context.directories.config, filePath)))).default;
|
|
20
20
|
} catch (error) {
|
|
@@ -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.
|
|
@@ -13,14 +13,20 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { get } from '@lowdefy/helpers';
|
|
16
|
-
import { v1 as uuid } from 'uuid';
|
|
17
16
|
import getRefPath from './getRefPath.js';
|
|
18
|
-
|
|
17
|
+
import makeId from '../../utils/makeId.js';
|
|
18
|
+
function makeRefDefinition(refDefinition, parent, refMap) {
|
|
19
|
+
const id = makeId();
|
|
20
|
+
const refDef = {
|
|
21
|
+
parent
|
|
22
|
+
};
|
|
23
|
+
refMap[id] = refDef;
|
|
19
24
|
return {
|
|
20
|
-
|
|
25
|
+
...refDef,
|
|
26
|
+
id,
|
|
27
|
+
key: get(refDefinition, 'key'),
|
|
21
28
|
original: refDefinition,
|
|
22
29
|
path: getRefPath(refDefinition),
|
|
23
|
-
key: get(refDefinition, 'key'),
|
|
24
30
|
resolver: get(refDefinition, 'resolver'),
|
|
25
31
|
transformer: get(refDefinition, 'transformer'),
|
|
26
32
|
vars: get(refDefinition, 'vars', {
|
|
@@ -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,13 +12,13 @@
|
|
|
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
|
-
*/ /* eslint-disable no-param-reassign */ import {
|
|
15
|
+
*/ /* eslint-disable no-param-reassign */ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import { getFileExtension, getFileSubExtension } from '@lowdefy/node-utils';
|
|
17
17
|
import JSON5 from 'json5';
|
|
18
18
|
import YAML from 'yaml';
|
|
19
19
|
import parseNunjucks from './parseNunjucks.js';
|
|
20
|
-
function parseRefContent({ content
|
|
21
|
-
const { path
|
|
20
|
+
function parseRefContent({ content, refDef }) {
|
|
21
|
+
const { path, vars } = refDef;
|
|
22
22
|
if (type.isString(path)) {
|
|
23
23
|
let ext = getFileExtension(path);
|
|
24
24
|
if (ext === 'njk') {
|
|
@@ -32,11 +32,6 @@ function parseRefContent({ content , refDef }) {
|
|
|
32
32
|
content = JSON5.parse(content);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
if (refDef.key) {
|
|
36
|
-
content = get(content, refDef.key, {
|
|
37
|
-
default: null
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
35
|
return content;
|
|
41
36
|
}
|
|
42
37
|
export default parseRefContent;
|
|
@@ -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.
|
|
@@ -34,7 +34,7 @@ function refReviver(key, value) {
|
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
|
-
function populateRefs({ parsedFiles
|
|
37
|
+
function populateRefs({ parsedFiles, refDef, toPopulate }) {
|
|
38
38
|
return JSON.parse(JSON.stringify(toPopulate), refReviver.bind({
|
|
39
39
|
parsedFiles,
|
|
40
40
|
vars: refDef.vars
|
|
@@ -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,14 +12,16 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
+
import evaluateBuildOperators from './evaluateBuildOperators.js';
|
|
17
|
+
import getKey from './getKey.js';
|
|
16
18
|
import getRefContent from './getRefContent.js';
|
|
17
19
|
import getRefsFromFile from './getRefsFromFile.js';
|
|
18
20
|
import populateRefs from './populateRefs.js';
|
|
19
21
|
import runTransformer from './runTransformer.js';
|
|
20
|
-
async function
|
|
22
|
+
async function recursiveBuild({ context, refDef, count, referencedFrom }) {
|
|
21
23
|
// TODO: Maybe it would be better to detect a cycle, since this is the real issue here?
|
|
22
|
-
if (count >
|
|
24
|
+
if (count > 10000) {
|
|
23
25
|
throw new Error(`Maximum recursion depth of references exceeded.`);
|
|
24
26
|
}
|
|
25
27
|
let fileContent = await getRefContent({
|
|
@@ -27,7 +29,7 @@ async function recursiveParseFile({ context , refDef , count , referencedFrom }
|
|
|
27
29
|
refDef,
|
|
28
30
|
referencedFrom
|
|
29
31
|
});
|
|
30
|
-
const { foundRefs
|
|
32
|
+
const { foundRefs, fileContentBuiltRefs } = getRefsFromFile(fileContent, refDef.id, context.refMap);
|
|
31
33
|
const parsedFiles = {};
|
|
32
34
|
// Since we can have references in the variables of a reference, we need to first parse
|
|
33
35
|
// the deeper nodes, so we can use those parsed files in references higher in the tree.
|
|
@@ -40,7 +42,8 @@ async function recursiveParseFile({ context , refDef , count , referencedFrom }
|
|
|
40
42
|
parsedFiles,
|
|
41
43
|
refDef
|
|
42
44
|
});
|
|
43
|
-
|
|
45
|
+
context.refMap[parsedRefDef.id].path = parsedRefDef.path;
|
|
46
|
+
const parsedFile = await recursiveBuild({
|
|
44
47
|
context,
|
|
45
48
|
refDef: parsedRefDef,
|
|
46
49
|
count: count + 1,
|
|
@@ -57,7 +60,21 @@ async function recursiveParseFile({ context , refDef , count , referencedFrom }
|
|
|
57
60
|
input: transformedFile,
|
|
58
61
|
refDef: parsedRefDef
|
|
59
62
|
});
|
|
60
|
-
|
|
63
|
+
const withRefKey = getKey({
|
|
64
|
+
input: evaluatedOperators,
|
|
65
|
+
refDef: parsedRefDef
|
|
66
|
+
});
|
|
67
|
+
const reviver = (_, value)=>{
|
|
68
|
+
if (!type.isObject(value)) return value;
|
|
69
|
+
Object.defineProperty(value, '~r', {
|
|
70
|
+
value: refDef.id,
|
|
71
|
+
enumerable: false,
|
|
72
|
+
writable: true,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
return value;
|
|
76
|
+
};
|
|
77
|
+
parsedFiles[newRefDef.id] = JSON.parse(JSON.stringify(withRefKey), reviver);
|
|
61
78
|
}
|
|
62
79
|
return populateRefs({
|
|
63
80
|
toPopulate: fileContentBuiltRefs,
|
|
@@ -65,4 +82,4 @@ async function recursiveParseFile({ context , refDef , count , referencedFrom }
|
|
|
65
82
|
refDef
|
|
66
83
|
});
|
|
67
84
|
}
|
|
68
|
-
export default
|
|
85
|
+
export default recursiveBuild;
|
|
@@ -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,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import getUserJavascriptFunction from './getUserJavascriptFunction.js';
|
|
17
|
-
async function runRefResolver({ context
|
|
17
|
+
async function runRefResolver({ context, refDef, referencedFrom }) {
|
|
18
18
|
const resolverFn = await getUserJavascriptFunction({
|
|
19
19
|
context,
|
|
20
20
|
filePath: refDef.resolver || context.refResolver
|
|
@@ -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.
|
|
@@ -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 getUserJavascriptFunction from './getUserJavascriptFunction.js';
|
|
16
|
-
async function runTransformer({ context
|
|
16
|
+
async function runTransformer({ context, input, refDef }) {
|
|
17
17
|
if (refDef.transformer) {
|
|
18
18
|
const transformerFn = await getUserJavascriptFunction({
|
|
19
19
|
context,
|
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.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import basicTypes from '@lowdefy/blocks-basic/types';
|
|
16
16
|
import loaderTypes from '@lowdefy/blocks-loaders/types';
|
|
17
|
-
function buildTypeClass(context, { counter
|
|
17
|
+
function buildTypeClass(context, { counter, definitions, store, typeClass, warnIfMissing = false }) {
|
|
18
18
|
const counts = counter.getCounts();
|
|
19
19
|
Object.keys(counts).forEach((typeName)=>{
|
|
20
20
|
if (!definitions[typeName]) {
|
|
@@ -32,8 +32,8 @@ function buildTypeClass(context, { counter , definitions , store , typeClass , w
|
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function buildTypes({ components
|
|
36
|
-
const { typeCounters
|
|
35
|
+
function buildTypes({ components, context }) {
|
|
36
|
+
const { typeCounters } = context;
|
|
37
37
|
// Add Mandatory Types
|
|
38
38
|
// Add operators used by form validation
|
|
39
39
|
typeCounters.operators.client.increment('_not');
|
|
@@ -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.
|
|
@@ -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 { cleanDirectory } from '@lowdefy/node-utils';
|
|
16
|
-
async function cleanBuildDirectory({ context
|
|
16
|
+
async function cleanBuildDirectory({ context }) {
|
|
17
17
|
await cleanDirectory(context.directories.build);
|
|
18
18
|
}
|
|
19
19
|
export default cleanBuildDirectory;
|
|
@@ -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 {
|
|
18
|
-
async function copyPublicFolder({ context
|
|
17
|
+
import { cleanDirectory, copyFileOrDirectory } from '@lowdefy/node-utils';
|
|
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,8 +15,8 @@
|
|
|
15
15
|
*/ import { validate } from '@lowdefy/ajv';
|
|
16
16
|
import lowdefySchema from '../lowdefySchema.js';
|
|
17
17
|
import formatErrorMessage from '../utils/formatErrorMessage.js';
|
|
18
|
-
function testSchema({ components
|
|
19
|
-
const { valid
|
|
18
|
+
function testSchema({ components, context }) {
|
|
19
|
+
const { valid, errors } = validate({
|
|
20
20
|
schema: lowdefySchema,
|
|
21
21
|
data: components,
|
|
22
22
|
returnErrors: true
|
|
@@ -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,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import path from 'path';
|
|
16
16
|
import { readFile, writeFile } from '@lowdefy/node-utils';
|
|
17
|
-
async function updateServerPackageJson({ components
|
|
17
|
+
async function updateServerPackageJson({ components, context }) {
|
|
18
18
|
const filePath = path.join(context.directories.server, 'package.json');
|
|
19
19
|
const packageJsonContent = await readFile(filePath);
|
|
20
20
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -40,11 +40,6 @@ async function updateServerPackageJson({ components , context }) {
|
|
|
40
40
|
packageJson.dependencies[name] = dependencies[name];
|
|
41
41
|
});
|
|
42
42
|
const newPackageJsonContent = JSON.stringify(packageJson, null, 2).concat('\n');
|
|
43
|
-
|
|
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
|
-
}
|
|
43
|
+
await writeFile(filePath, newPackageJsonContent);
|
|
49
44
|
}
|
|
50
45
|
export default updateServerPackageJson;
|
|
@@ -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
|
-
function validateApp({ components
|
|
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,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
|
-
function validateConfig({ components
|
|
16
|
+
function validateConfig({ components }) {
|
|
17
17
|
if (type.isNone(components.config)) {
|
|
18
18
|
components.config = {};
|
|
19
19
|
}
|
package/dist/build/writeApp.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.
|
|
@@ -12,7 +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
|
-
|
|
15
|
+
*/ import { serializer } from '@lowdefy/helpers';
|
|
16
|
+
async function writeApp({ components, context }) {
|
|
17
|
+
await context.writeBuildArtifact('app.json', serializer.serializeToString(components.app ?? {}, {
|
|
18
|
+
space: 2
|
|
19
|
+
}));
|
|
17
20
|
}
|
|
18
21
|
export default writeApp;
|
package/dist/build/writeAuth.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.
|
|
@@ -12,7 +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
|
-
|
|
15
|
+
*/ import { serializer } from '@lowdefy/helpers';
|
|
16
|
+
async function writeAuth({ components, context }) {
|
|
17
|
+
await context.writeBuildArtifact('auth.json', serializer.serializeToString(components.auth ?? {}, {
|
|
18
|
+
space: 2
|
|
19
|
+
}));
|
|
17
20
|
}
|
|
18
21
|
export default writeAuth;
|
|
@@ -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,7 +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
|
-
|
|
15
|
+
*/ import { serializer } from '@lowdefy/helpers';
|
|
16
|
+
async function writeConfig({ components, context }) {
|
|
17
|
+
await context.writeBuildArtifact('config.json', serializer.serializeToString(components.config ?? {}, {
|
|
18
|
+
space: 2
|
|
19
|
+
}));
|
|
17
20
|
}
|
|
18
21
|
export default writeConfig;
|
|
@@ -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,14 +12,16 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
-
async function writeConnections({ components
|
|
15
|
+
*/ import { type, serializer } from '@lowdefy/helpers';
|
|
16
|
+
async function writeConnections({ components, context }) {
|
|
17
17
|
if (type.isNone(components.connections)) return;
|
|
18
18
|
if (!type.isArray(components.connections)) {
|
|
19
19
|
throw new Error(`Connections is not an array.`);
|
|
20
20
|
}
|
|
21
21
|
const writePromises = components.connections.map(async (connection)=>{
|
|
22
|
-
await context.writeBuildArtifact(`connections/${connection.connectionId}.json`,
|
|
22
|
+
await context.writeBuildArtifact(`connections/${connection.connectionId}.json`, serializer.serializeToString(connection, {
|
|
23
|
+
space: 2
|
|
24
|
+
}));
|
|
23
25
|
});
|
|
24
26
|
return Promise.all(writePromises);
|
|
25
27
|
}
|
|
@@ -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,14 +12,16 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
-
async function writeGlobal({ components
|
|
15
|
+
*/ import { type, serializer } from '@lowdefy/helpers';
|
|
16
|
+
async function writeGlobal({ components, context }) {
|
|
17
17
|
if (type.isNone(components.global)) {
|
|
18
18
|
components.global = {};
|
|
19
19
|
}
|
|
20
20
|
if (!type.isObject(components.global)) {
|
|
21
21
|
throw new Error('Global is not an object.');
|
|
22
22
|
}
|
|
23
|
-
await context.writeBuildArtifact('global.json',
|
|
23
|
+
await context.writeBuildArtifact('global.json', serializer.serializeToString(components.global, {
|
|
24
|
+
space: 2
|
|
25
|
+
}));
|
|
24
26
|
}
|
|
25
27
|
export default writeGlobal;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { serializer, type } from '@lowdefy/helpers';
|
|
16
|
+
async function writeMaps({ context }) {
|
|
17
|
+
if (!type.isObject(context.keyMap)) {
|
|
18
|
+
throw new Error('keyMap is not an object.');
|
|
19
|
+
}
|
|
20
|
+
if (!type.isObject(context.refMap)) {
|
|
21
|
+
throw new Error('refMap is not an object.');
|
|
22
|
+
}
|
|
23
|
+
await context.writeBuildArtifact('keyMap.json', serializer.serializeToString(context.keyMap, {
|
|
24
|
+
space: 0
|
|
25
|
+
}));
|
|
26
|
+
await context.writeBuildArtifact('refMap.json', serializer.serializeToString(context.refMap, {
|
|
27
|
+
space: 0
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
export default writeMaps;
|