@lowdefy/build 4.0.0-alpha.7 → 4.0.0-alpha.8
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/buildIcons.js +2 -2
- package/dist/build/buildRefs/buildRefs.js +1 -0
- package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
- package/dist/build/buildRefs/getRefContent.js +1 -1
- package/dist/build/buildRefs/recursiveBuild.js +8 -2
- package/dist/build/buildRefs/runTransformer.js +3 -3
- package/dist/build/buildStyles.js +2 -2
- package/dist/build/buildTypes.js +7 -6
- package/dist/build/writePluginImports/generateImportFile.js +6 -6
- package/dist/{defaultTypes.json → defaultTypesMap.json} +665 -625
- package/dist/index.js +15 -12
- package/dist/lowdefySchema.js +40 -10
- package/dist/scripts/generateDefaultTypes.js +14 -57
- package/dist/utils/createPluginTypesMap.js +85 -0
- package/package.json +33 -28
package/dist/index.js
CHANGED
|
@@ -12,8 +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
|
-
*/ import {
|
|
15
|
+
*/ import { mergeObjects } from '@lowdefy/helpers';
|
|
16
|
+
import { readFile } from '@lowdefy/node-utils';
|
|
16
17
|
import createCounter from './utils/createCounter.js';
|
|
18
|
+
import createPluginTypesMap from './utils/createPluginTypesMap.js';
|
|
17
19
|
import createReadConfigFile from './utils/readConfigFile.js';
|
|
18
20
|
import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
|
|
19
21
|
import addDefaultPages from './build/addDefaultPages/addDefaultPages.js';
|
|
@@ -45,12 +47,15 @@ import writePages from './build/writePages.js';
|
|
|
45
47
|
import writeRequests from './build/writeRequests.js';
|
|
46
48
|
import writeStyleImports from './build/writePluginImports/writeStyleImports.js';
|
|
47
49
|
import writeTypes from './build/writeTypes.js';
|
|
48
|
-
async function createContext(
|
|
49
|
-
const
|
|
50
|
-
const defaultTypes = JSON.parse(await readFile(new URL('./defaultTypes.json', import.meta.url).pathname));
|
|
51
|
-
// TODO: resolve custom plugin types
|
|
50
|
+
async function createContext({ customTypesMap , directories , logger , refResolver }) {
|
|
51
|
+
const defaultTypesMap = JSON.parse(await readFile(new URL('./defaultTypesMap.json', import.meta.url).pathname));
|
|
52
52
|
const context = {
|
|
53
53
|
directories,
|
|
54
|
+
logger,
|
|
55
|
+
readConfigFile: createReadConfigFile({
|
|
56
|
+
directories
|
|
57
|
+
}),
|
|
58
|
+
refResolver,
|
|
54
59
|
typeCounters: {
|
|
55
60
|
actions: createCounter(),
|
|
56
61
|
blocks: createCounter(),
|
|
@@ -61,12 +66,10 @@ async function createContext(options) {
|
|
|
61
66
|
server: createCounter()
|
|
62
67
|
}
|
|
63
68
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
refResolver,
|
|
69
|
-
types: defaultTypes,
|
|
69
|
+
typesMap: mergeObjects([
|
|
70
|
+
defaultTypesMap,
|
|
71
|
+
customTypesMap
|
|
72
|
+
]),
|
|
70
73
|
writeBuildArtifact: createWriteBuildArtifact({
|
|
71
74
|
directories
|
|
72
75
|
})
|
|
@@ -190,5 +193,5 @@ async function build(options) {
|
|
|
190
193
|
context
|
|
191
194
|
});
|
|
192
195
|
}
|
|
193
|
-
export { createContext };
|
|
196
|
+
export { createContext, createPluginTypesMap };
|
|
194
197
|
export default build;
|
package/dist/lowdefySchema.js
CHANGED
|
@@ -536,6 +536,41 @@ export default {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
},
|
|
539
|
+
plugin: {
|
|
540
|
+
type: 'object',
|
|
541
|
+
additionalProperties: false,
|
|
542
|
+
required: [
|
|
543
|
+
'name',
|
|
544
|
+
'version'
|
|
545
|
+
],
|
|
546
|
+
properties: {
|
|
547
|
+
name: {
|
|
548
|
+
type: 'string',
|
|
549
|
+
errorMessage: {
|
|
550
|
+
type: 'Plugin "name" should be a string.'
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
version: {
|
|
554
|
+
type: 'string',
|
|
555
|
+
errorMessage: {
|
|
556
|
+
type: 'Plugin "version" should be a string.'
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
typePrefix: {
|
|
560
|
+
type: 'string',
|
|
561
|
+
errorMessage: {
|
|
562
|
+
type: 'Plugin "typePrefix" should be a string.'
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
errorMessage: {
|
|
567
|
+
type: 'Plugin should be an object.',
|
|
568
|
+
required: {
|
|
569
|
+
name: 'Plugin should have required property "name".',
|
|
570
|
+
version: 'Plugin should have required property "version".'
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
},
|
|
539
574
|
request: {
|
|
540
575
|
type: 'object',
|
|
541
576
|
additionalProperties: false,
|
|
@@ -659,18 +694,13 @@ export default {
|
|
|
659
694
|
}
|
|
660
695
|
}
|
|
661
696
|
},
|
|
662
|
-
|
|
663
|
-
type: '
|
|
664
|
-
|
|
665
|
-
'
|
|
666
|
-
url: 'string',
|
|
667
|
-
errorMessage: {
|
|
668
|
-
enum: 'Type "url" should be a string.'
|
|
669
|
-
}
|
|
670
|
-
}
|
|
697
|
+
plugins: {
|
|
698
|
+
type: 'array',
|
|
699
|
+
items: {
|
|
700
|
+
$ref: '#/definitions/plugin'
|
|
671
701
|
},
|
|
672
702
|
errorMessage: {
|
|
673
|
-
type: 'App "
|
|
703
|
+
type: 'App "plugins" should be an array.'
|
|
674
704
|
}
|
|
675
705
|
},
|
|
676
706
|
global: {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/ import path from 'path';
|
|
17
|
-
import { type } from '@lowdefy/helpers';
|
|
18
17
|
import { readFile, writeFile } from '@lowdefy/node-utils';
|
|
18
|
+
import createPluginTypesMap from '../utils/createPluginTypesMap.js';
|
|
19
19
|
const defaultPackages = [
|
|
20
20
|
'@lowdefy/actions-core',
|
|
21
21
|
'@lowdefy/blocks-antd',
|
|
@@ -40,76 +40,33 @@ const defaultPackages = [
|
|
|
40
40
|
'@lowdefy/operators-uuid',
|
|
41
41
|
'@lowdefy/operators-yaml',
|
|
42
42
|
];
|
|
43
|
-
function
|
|
44
|
-
if (type.isArray(typeNames)) {
|
|
45
|
-
typeNames.forEach((typeName)=>{
|
|
46
|
-
store[typeName] = {
|
|
47
|
-
package: packageName,
|
|
48
|
-
version
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function generateDefaultTypes() {
|
|
43
|
+
async function generateDefaultTypesMap() {
|
|
54
44
|
const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
|
|
55
|
-
const
|
|
45
|
+
const defaultTypesMap = {
|
|
56
46
|
actions: {},
|
|
57
47
|
blocks: {},
|
|
58
48
|
connections: {},
|
|
59
|
-
|
|
49
|
+
icons: {},
|
|
60
50
|
operators: {
|
|
61
51
|
client: {},
|
|
62
52
|
server: {}
|
|
63
53
|
},
|
|
64
|
-
|
|
65
|
-
styles: {
|
|
54
|
+
requests: {},
|
|
55
|
+
styles: {
|
|
56
|
+
packages: {},
|
|
57
|
+
blocks: {}
|
|
58
|
+
}
|
|
66
59
|
};
|
|
67
60
|
await Promise.all(defaultPackages.map(async (packageName)=>{
|
|
68
61
|
const { default: types } = await import(`${packageName}/types`);
|
|
69
62
|
const version = packageFile.devDependencies[packageName];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
packageName,
|
|
74
|
-
version
|
|
75
|
-
});
|
|
76
|
-
createTypeDefinitions({
|
|
77
|
-
typeNames: types.blocks,
|
|
78
|
-
store: defaultTypes.blocks,
|
|
79
|
-
packageName,
|
|
80
|
-
version
|
|
81
|
-
});
|
|
82
|
-
createTypeDefinitions({
|
|
83
|
-
typeNames: types.connections,
|
|
84
|
-
store: defaultTypes.connections,
|
|
85
|
-
packageName,
|
|
86
|
-
version
|
|
87
|
-
});
|
|
88
|
-
createTypeDefinitions({
|
|
89
|
-
typeNames: types.requests,
|
|
90
|
-
store: defaultTypes.requests,
|
|
91
|
-
packageName,
|
|
92
|
-
version
|
|
93
|
-
});
|
|
94
|
-
createTypeDefinitions({
|
|
95
|
-
typeNames: type.isObject(types.operators) ? types.operators.client : [],
|
|
96
|
-
store: defaultTypes.operators.client,
|
|
97
|
-
packageName,
|
|
98
|
-
version
|
|
99
|
-
});
|
|
100
|
-
createTypeDefinitions({
|
|
101
|
-
typeNames: type.isObject(types.operators) ? types.operators.server : [],
|
|
102
|
-
store: defaultTypes.operators.server,
|
|
63
|
+
createPluginTypesMap({
|
|
64
|
+
packageTypes: types,
|
|
65
|
+
typesMap: defaultTypesMap,
|
|
103
66
|
packageName,
|
|
104
67
|
version
|
|
105
68
|
});
|
|
106
|
-
if (type.isObject(types.styles)) {
|
|
107
|
-
defaultTypes.styles[packageName] = types.styles;
|
|
108
|
-
}
|
|
109
|
-
if (type.isObject(types.icons)) {
|
|
110
|
-
defaultTypes.icons[packageName] = types.icons;
|
|
111
|
-
}
|
|
112
69
|
}));
|
|
113
|
-
await writeFile(path.resolve(process.cwd(), './dist/
|
|
70
|
+
await writeFile(path.resolve(process.cwd(), './dist/defaultTypesMap.json'), JSON.stringify(defaultTypesMap, null, 2));
|
|
114
71
|
}
|
|
115
|
-
|
|
72
|
+
generateDefaultTypesMap();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
function createTypeDefinitions({ packageName , store , typeNames , typePrefix , version }) {
|
|
17
|
+
if (type.isArray(typeNames)) {
|
|
18
|
+
typeNames.forEach((typeName)=>{
|
|
19
|
+
store[`${typePrefix}${typeName}`] = {
|
|
20
|
+
package: packageName,
|
|
21
|
+
originalTypeName: typeName,
|
|
22
|
+
version
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function createPluginTypesMap({ packageName , packageTypes , typePrefix ='' , typesMap , version }) {
|
|
28
|
+
createTypeDefinitions({
|
|
29
|
+
typeNames: packageTypes.actions,
|
|
30
|
+
store: typesMap.actions,
|
|
31
|
+
packageName,
|
|
32
|
+
typePrefix,
|
|
33
|
+
version
|
|
34
|
+
});
|
|
35
|
+
createTypeDefinitions({
|
|
36
|
+
typeNames: packageTypes.blocks,
|
|
37
|
+
store: typesMap.blocks,
|
|
38
|
+
packageName,
|
|
39
|
+
typePrefix,
|
|
40
|
+
version
|
|
41
|
+
});
|
|
42
|
+
createTypeDefinitions({
|
|
43
|
+
typeNames: packageTypes.connections,
|
|
44
|
+
store: typesMap.connections,
|
|
45
|
+
packageName,
|
|
46
|
+
typePrefix,
|
|
47
|
+
version
|
|
48
|
+
});
|
|
49
|
+
createTypeDefinitions({
|
|
50
|
+
typeNames: type.isObject(packageTypes.operators) ? packageTypes.operators.client : [],
|
|
51
|
+
store: typesMap.operators.client,
|
|
52
|
+
packageName,
|
|
53
|
+
typePrefix,
|
|
54
|
+
version
|
|
55
|
+
});
|
|
56
|
+
createTypeDefinitions({
|
|
57
|
+
typeNames: type.isObject(packageTypes.operators) ? packageTypes.operators.server : [],
|
|
58
|
+
store: typesMap.operators.server,
|
|
59
|
+
packageName,
|
|
60
|
+
typePrefix,
|
|
61
|
+
version
|
|
62
|
+
});
|
|
63
|
+
createTypeDefinitions({
|
|
64
|
+
typeNames: packageTypes.requests,
|
|
65
|
+
store: typesMap.requests,
|
|
66
|
+
packageName,
|
|
67
|
+
typePrefix,
|
|
68
|
+
version
|
|
69
|
+
});
|
|
70
|
+
if (type.isObject(packageTypes.styles)) {
|
|
71
|
+
Object.entries(packageTypes.styles).forEach(([blockType, styles])=>{
|
|
72
|
+
if (blockType === 'default') {
|
|
73
|
+
typesMap.styles.packages[packageName] = styles;
|
|
74
|
+
} else {
|
|
75
|
+
typesMap.styles.blocks[`${typePrefix}${blockType}`] = styles;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (type.isObject(packageTypes.icons)) {
|
|
80
|
+
Object.entries(packageTypes.icons).forEach(([blockType, icons])=>{
|
|
81
|
+
typesMap.icons[`${typePrefix}${blockType}`] = icons;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export default createPluginTypesMap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/build",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"licence": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"name": "Gerrie van Wyk",
|
|
20
20
|
"url": "https://github.com/Gervwyk"
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Johann Möller",
|
|
24
|
+
"url": "https://github.com/JohannMoller"
|
|
25
|
+
},
|
|
22
26
|
{
|
|
23
27
|
"name": "Sandile Memela",
|
|
24
28
|
"url": "https://github.com/sah-memela"
|
|
@@ -45,10 +49,12 @@
|
|
|
45
49
|
"test": "yarn node --experimental-vm-modules $(yarn bin jest)"
|
|
46
50
|
},
|
|
47
51
|
"dependencies": {
|
|
48
|
-
"@lowdefy/ajv": "4.0.0-alpha.
|
|
49
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
50
|
-
"@lowdefy/node-utils": "4.0.0-alpha.
|
|
51
|
-
"@lowdefy/nunjucks": "4.0.0-alpha.
|
|
52
|
+
"@lowdefy/ajv": "4.0.0-alpha.8",
|
|
53
|
+
"@lowdefy/helpers": "4.0.0-alpha.8",
|
|
54
|
+
"@lowdefy/node-utils": "4.0.0-alpha.8",
|
|
55
|
+
"@lowdefy/nunjucks": "4.0.0-alpha.8",
|
|
56
|
+
"@lowdefy/operators": "4.0.0-alpha.8",
|
|
57
|
+
"@lowdefy/operators-js": "4.0.0-alpha.8",
|
|
52
58
|
"ajv": "8.9.0",
|
|
53
59
|
"json5": "2.2.0",
|
|
54
60
|
"uuid": "8.3.2",
|
|
@@ -57,28 +63,27 @@
|
|
|
57
63
|
},
|
|
58
64
|
"devDependencies": {
|
|
59
65
|
"@jest/globals": "27.5.1",
|
|
60
|
-
"@lowdefy/actions-core": "4.0.0-alpha.
|
|
61
|
-
"@lowdefy/blocks-antd": "4.0.0-alpha.
|
|
62
|
-
"@lowdefy/blocks-basic": "4.0.0-alpha.
|
|
63
|
-
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.
|
|
64
|
-
"@lowdefy/blocks-echarts": "4.0.0-alpha.
|
|
65
|
-
"@lowdefy/blocks-loaders": "4.0.0-alpha.
|
|
66
|
-
"@lowdefy/blocks-markdown": "4.0.0-alpha.
|
|
67
|
-
"@lowdefy/connection-axios-http": "4.0.0-alpha.
|
|
68
|
-
"@lowdefy/connection-elasticsearch": "4.0.0-alpha.
|
|
69
|
-
"@lowdefy/connection-google-sheets": "4.0.0-alpha.
|
|
70
|
-
"@lowdefy/connection-knex": "4.0.0-alpha.
|
|
71
|
-
"@lowdefy/connection-mongodb": "4.0.0-alpha.
|
|
72
|
-
"@lowdefy/connection-redis": "4.0.0-alpha.
|
|
73
|
-
"@lowdefy/connection-sendgrid": "4.0.0-alpha.
|
|
74
|
-
"@lowdefy/connection-stripe": "4.0.0-alpha.
|
|
75
|
-
"@lowdefy/operators-change-case": "4.0.0-alpha.
|
|
76
|
-
"@lowdefy/operators-diff": "4.0.0-alpha.
|
|
77
|
-
"@lowdefy/operators-
|
|
78
|
-
"@lowdefy/operators-
|
|
79
|
-
"@lowdefy/operators-
|
|
80
|
-
"@lowdefy/operators-
|
|
81
|
-
"@lowdefy/operators-yaml": "4.0.0-alpha.7",
|
|
66
|
+
"@lowdefy/actions-core": "4.0.0-alpha.8",
|
|
67
|
+
"@lowdefy/blocks-antd": "4.0.0-alpha.8",
|
|
68
|
+
"@lowdefy/blocks-basic": "4.0.0-alpha.8",
|
|
69
|
+
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.8",
|
|
70
|
+
"@lowdefy/blocks-echarts": "4.0.0-alpha.8",
|
|
71
|
+
"@lowdefy/blocks-loaders": "4.0.0-alpha.8",
|
|
72
|
+
"@lowdefy/blocks-markdown": "4.0.0-alpha.8",
|
|
73
|
+
"@lowdefy/connection-axios-http": "4.0.0-alpha.8",
|
|
74
|
+
"@lowdefy/connection-elasticsearch": "4.0.0-alpha.8",
|
|
75
|
+
"@lowdefy/connection-google-sheets": "4.0.0-alpha.8",
|
|
76
|
+
"@lowdefy/connection-knex": "4.0.0-alpha.8",
|
|
77
|
+
"@lowdefy/connection-mongodb": "4.0.0-alpha.8",
|
|
78
|
+
"@lowdefy/connection-redis": "4.0.0-alpha.8",
|
|
79
|
+
"@lowdefy/connection-sendgrid": "4.0.0-alpha.8",
|
|
80
|
+
"@lowdefy/connection-stripe": "4.0.0-alpha.8",
|
|
81
|
+
"@lowdefy/operators-change-case": "4.0.0-alpha.8",
|
|
82
|
+
"@lowdefy/operators-diff": "4.0.0-alpha.8",
|
|
83
|
+
"@lowdefy/operators-mql": "4.0.0-alpha.8",
|
|
84
|
+
"@lowdefy/operators-nunjucks": "4.0.0-alpha.8",
|
|
85
|
+
"@lowdefy/operators-uuid": "4.0.0-alpha.8",
|
|
86
|
+
"@lowdefy/operators-yaml": "4.0.0-alpha.8",
|
|
82
87
|
"@swc/cli": "0.1.55",
|
|
83
88
|
"@swc/core": "1.2.135",
|
|
84
89
|
"@swc/jest": "0.2.17",
|
|
@@ -87,5 +92,5 @@
|
|
|
87
92
|
"publishConfig": {
|
|
88
93
|
"access": "public"
|
|
89
94
|
},
|
|
90
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
|
|
91
96
|
}
|