@lowdefy/build 4.0.0-alpha.1 → 4.0.0-alpha.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 +37 -42
- package/dist/build/addDefaultPages/addDefaultPages.js +7 -3
- package/dist/build/buildAuth/buildAuth.js +1 -1
- package/dist/build/buildAuth/getPageRoles.js +2 -3
- package/dist/build/buildAuth/getProtectedPages.js +1 -1
- package/dist/build/buildConnections.js +2 -3
- package/dist/build/buildIcons.js +91 -0
- package/dist/build/buildMenu.js +1 -1
- package/dist/build/buildPages/buildBlock/buildBlock.js +6 -2
- package/dist/build/buildPages/buildBlock/buildEvents.js +5 -2
- package/dist/build/buildPages/buildBlock/buildRequests.js +2 -3
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +4 -6
- 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 +1 -1
- package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
- package/dist/build/buildPages/buildBlock/validateBlock.js +2 -3
- package/dist/build/buildPages/buildPage.js +1 -1
- package/dist/build/buildPages/buildPages.js +1 -1
- package/dist/build/buildRefs/buildRefs.js +3 -3
- package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
- package/dist/build/buildRefs/getConfigFile.js +1 -1
- package/dist/build/buildRefs/getRefContent.js +2 -2
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +1 -1
- package/dist/build/buildRefs/getUserJavascriptFunction.js +7 -4
- package/dist/build/buildRefs/makeRefDefinition.js +2 -3
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +3 -3
- package/dist/build/buildRefs/populateRefs.js +1 -1
- package/dist/build/buildRefs/recursiveBuild.js +10 -5
- package/dist/build/buildRefs/runRefResolver.js +1 -1
- package/dist/build/buildRefs/runTransformer.js +8 -4
- package/dist/build/buildStyles.js +29 -0
- package/dist/build/buildTypes.js +50 -44
- package/dist/build/cleanBuildDirectory.js +2 -2
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/testSchema.js +1 -1
- package/dist/build/updateServerPackageJson.js +46 -0
- package/dist/build/validateApp.js +3 -5
- package/dist/build/validateConfig.js +13 -9
- package/dist/build/writeApp.js +2 -6
- package/dist/build/writeConfig.js +2 -6
- package/dist/build/writeConnections.js +2 -5
- package/dist/build/writeGlobal.js +3 -7
- package/dist/build/writeMenus.js +2 -5
- package/dist/build/writePages.js +3 -14
- package/dist/build/writePluginImports/generateImportFile.js +36 -0
- package/dist/build/writePluginImports/writeActionImports.js +22 -0
- package/dist/build/writePluginImports/writeBlockImports.js +6 -23
- package/dist/build/writePluginImports/writeConnectionImports.js +6 -23
- package/dist/build/writePluginImports/writeIconImports.js +31 -0
- package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
- package/dist/build/writePluginImports/writeStyleImports.js +28 -0
- package/dist/build/writeRequests.js +3 -8
- package/dist/build/writeTypes.js +2 -5
- package/dist/defaultTypesMap.json +1598 -0
- package/dist/index.js +143 -111
- package/dist/lowdefySchema.js +72 -24
- package/dist/scripts/generateDefaultTypes.js +42 -76
- package/dist/scripts/run.js +13 -12
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +3 -6
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsTransform.js +2 -2
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +2 -2
- package/dist/test/testContext.js +12 -19
- 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 +85 -0
- package/dist/utils/formatErrorMessage.js +2 -2
- package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +3 -3
- package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +4 -7
- package/package.json +47 -16
- package/dist/defaultTypes.json +0 -60
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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,40 +12,50 @@
|
|
|
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';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
18
|
+
import createPluginTypesMap from './utils/createPluginTypesMap.js';
|
|
19
|
+
import createReadConfigFile from './utils/readConfigFile.js';
|
|
20
|
+
import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
|
|
19
21
|
import addDefaultPages from './build/addDefaultPages/addDefaultPages.js';
|
|
20
22
|
import buildAuth from './build/buildAuth/buildAuth.js';
|
|
21
23
|
import buildConnections from './build/buildConnections.js';
|
|
24
|
+
import buildIcons from './build/buildIcons.js';
|
|
22
25
|
import buildMenu from './build/buildMenu.js';
|
|
23
26
|
import buildPages from './build/buildPages/buildPages.js';
|
|
24
27
|
import buildRefs from './build/buildRefs/buildRefs.js';
|
|
28
|
+
import buildStyles from './build/buildStyles.js';
|
|
25
29
|
import buildTypes from './build/buildTypes.js';
|
|
26
30
|
import cleanBuildDirectory from './build/cleanBuildDirectory.js';
|
|
31
|
+
import copyPublicFolder from './build/copyPublicFolder.js';
|
|
27
32
|
import testSchema from './build/testSchema.js';
|
|
28
33
|
import validateApp from './build/validateApp.js';
|
|
29
34
|
import validateConfig from './build/validateConfig.js';
|
|
35
|
+
import updateServerPackageJson from './build/updateServerPackageJson.js';
|
|
30
36
|
import writeApp from './build/writeApp.js';
|
|
37
|
+
import writeActionImports from './build/writePluginImports/writeActionImports.js';
|
|
31
38
|
import writeBlockImports from './build/writePluginImports/writeBlockImports.js';
|
|
32
|
-
import writeConnectionImports from './build/writePluginImports/writeConnectionImports.js';
|
|
33
39
|
import writeConfig from './build/writeConfig.js';
|
|
40
|
+
import writeConnectionImports from './build/writePluginImports/writeConnectionImports.js';
|
|
34
41
|
import writeConnections from './build/writeConnections.js';
|
|
35
42
|
import writeGlobal from './build/writeGlobal.js';
|
|
43
|
+
import writeIconImports from './build/writePluginImports/writeIconImports.js';
|
|
36
44
|
import writeMenus from './build/writeMenus.js';
|
|
45
|
+
import writeOperatorImports from './build/writePluginImports/writeOperatorImports.js';
|
|
37
46
|
import writePages from './build/writePages.js';
|
|
38
47
|
import writeRequests from './build/writeRequests.js';
|
|
48
|
+
import writeStyleImports from './build/writePluginImports/writeStyleImports.js';
|
|
39
49
|
import writeTypes from './build/writeTypes.js';
|
|
40
|
-
async function createContext(
|
|
41
|
-
const
|
|
42
|
-
const defaultTypes = JSON.parse(await readFile(new URL('./defaultTypes.json', import.meta.url).pathname));
|
|
43
|
-
// 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));
|
|
44
52
|
const context = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
directories,
|
|
54
|
+
logger,
|
|
55
|
+
readConfigFile: createReadConfigFile({
|
|
56
|
+
directories
|
|
57
|
+
}),
|
|
58
|
+
refResolver,
|
|
49
59
|
typeCounters: {
|
|
50
60
|
actions: createCounter(),
|
|
51
61
|
blocks: createCounter(),
|
|
@@ -56,110 +66,132 @@ async function createContext(options) {
|
|
|
56
66
|
server: createCounter()
|
|
57
67
|
}
|
|
58
68
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
refResolver,
|
|
64
|
-
types: defaultTypes,
|
|
69
|
+
typesMap: mergeObjects([
|
|
70
|
+
defaultTypesMap,
|
|
71
|
+
customTypesMap
|
|
72
|
+
]),
|
|
65
73
|
writeBuildArtifact: createWriteBuildArtifact({
|
|
66
|
-
|
|
74
|
+
directories
|
|
67
75
|
})
|
|
68
76
|
};
|
|
69
77
|
return context;
|
|
70
78
|
}
|
|
71
79
|
async function build(options) {
|
|
72
80
|
const context = await createContext(options);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
81
|
+
const components = await buildRefs({
|
|
82
|
+
context
|
|
83
|
+
});
|
|
84
|
+
await testSchema({
|
|
85
|
+
components,
|
|
86
|
+
context
|
|
87
|
+
});
|
|
88
|
+
await validateApp({
|
|
89
|
+
components,
|
|
90
|
+
context
|
|
91
|
+
});
|
|
92
|
+
await validateConfig({
|
|
93
|
+
components,
|
|
94
|
+
context
|
|
95
|
+
});
|
|
96
|
+
await addDefaultPages({
|
|
97
|
+
components,
|
|
98
|
+
context
|
|
99
|
+
});
|
|
100
|
+
await buildAuth({
|
|
101
|
+
components,
|
|
102
|
+
context
|
|
103
|
+
});
|
|
104
|
+
await buildConnections({
|
|
105
|
+
components,
|
|
106
|
+
context
|
|
107
|
+
});
|
|
108
|
+
await buildPages({
|
|
109
|
+
components,
|
|
110
|
+
context
|
|
111
|
+
});
|
|
112
|
+
await buildMenu({
|
|
113
|
+
components,
|
|
114
|
+
context
|
|
115
|
+
});
|
|
116
|
+
await buildTypes({
|
|
117
|
+
components,
|
|
118
|
+
context
|
|
119
|
+
});
|
|
120
|
+
await buildIcons({
|
|
121
|
+
components,
|
|
122
|
+
context
|
|
123
|
+
});
|
|
124
|
+
await buildStyles({
|
|
125
|
+
components,
|
|
126
|
+
context
|
|
127
|
+
});
|
|
128
|
+
await cleanBuildDirectory({
|
|
129
|
+
context
|
|
130
|
+
});
|
|
131
|
+
await writeActionImports({
|
|
132
|
+
components,
|
|
133
|
+
context
|
|
134
|
+
});
|
|
135
|
+
await writeApp({
|
|
136
|
+
components,
|
|
137
|
+
context
|
|
138
|
+
});
|
|
139
|
+
await writeConnections({
|
|
140
|
+
components,
|
|
141
|
+
context
|
|
142
|
+
});
|
|
143
|
+
await writeRequests({
|
|
144
|
+
components,
|
|
145
|
+
context
|
|
146
|
+
});
|
|
147
|
+
await writePages({
|
|
148
|
+
components,
|
|
149
|
+
context
|
|
150
|
+
});
|
|
151
|
+
await writeConfig({
|
|
152
|
+
components,
|
|
153
|
+
context
|
|
154
|
+
});
|
|
155
|
+
await writeGlobal({
|
|
156
|
+
components,
|
|
157
|
+
context
|
|
158
|
+
});
|
|
159
|
+
await writeMenus({
|
|
160
|
+
components,
|
|
161
|
+
context
|
|
162
|
+
});
|
|
163
|
+
await writeTypes({
|
|
164
|
+
components,
|
|
165
|
+
context
|
|
166
|
+
});
|
|
167
|
+
await writeBlockImports({
|
|
168
|
+
components,
|
|
169
|
+
context
|
|
170
|
+
});
|
|
171
|
+
await writeConnectionImports({
|
|
172
|
+
components,
|
|
173
|
+
context
|
|
174
|
+
});
|
|
175
|
+
await writeOperatorImports({
|
|
176
|
+
components,
|
|
177
|
+
context
|
|
178
|
+
});
|
|
179
|
+
await writeStyleImports({
|
|
180
|
+
components,
|
|
181
|
+
context
|
|
182
|
+
});
|
|
183
|
+
await writeIconImports({
|
|
184
|
+
components,
|
|
185
|
+
context
|
|
186
|
+
});
|
|
187
|
+
await updateServerPackageJson({
|
|
188
|
+
components,
|
|
189
|
+
context
|
|
190
|
+
});
|
|
191
|
+
await copyPublicFolder({
|
|
192
|
+
components,
|
|
193
|
+
context
|
|
194
|
+
});
|
|
163
195
|
}
|
|
164
|
-
export { createContext };
|
|
196
|
+
export { createContext, createPluginTypesMap };
|
|
165
197
|
export default build;
|
package/dist/lowdefySchema.js
CHANGED
|
@@ -24,12 +24,9 @@ export default {
|
|
|
24
24
|
type: 'Action "id" should be a string.'
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
messages: {
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
skip: {
|
|
32
|
-
},
|
|
27
|
+
messages: {},
|
|
28
|
+
params: {},
|
|
29
|
+
skip: {},
|
|
33
30
|
type: {
|
|
34
31
|
type: 'string',
|
|
35
32
|
errorMessage: {
|
|
@@ -235,10 +232,10 @@ export default {
|
|
|
235
232
|
type: 'Block "layout" should be an object.'
|
|
236
233
|
}
|
|
237
234
|
},
|
|
238
|
-
|
|
235
|
+
skeleton: {
|
|
239
236
|
type: 'object',
|
|
240
237
|
errorMessage: {
|
|
241
|
-
type: 'Block "
|
|
238
|
+
type: 'Block "skeleton" should be an object.'
|
|
242
239
|
}
|
|
243
240
|
},
|
|
244
241
|
style: {
|
|
@@ -247,8 +244,8 @@ export default {
|
|
|
247
244
|
type: 'Block "style" should be an object.'
|
|
248
245
|
}
|
|
249
246
|
},
|
|
250
|
-
visible: {
|
|
251
|
-
},
|
|
247
|
+
visible: {},
|
|
248
|
+
loading: {},
|
|
252
249
|
blocks: {
|
|
253
250
|
type: 'array',
|
|
254
251
|
items: {
|
|
@@ -267,8 +264,7 @@ export default {
|
|
|
267
264
|
type: 'Block "requests" should be an array.'
|
|
268
265
|
}
|
|
269
266
|
},
|
|
270
|
-
required: {
|
|
271
|
-
},
|
|
267
|
+
required: {},
|
|
272
268
|
validate: {
|
|
273
269
|
type: 'array',
|
|
274
270
|
items: {
|
|
@@ -541,6 +537,41 @@ export default {
|
|
|
541
537
|
}
|
|
542
538
|
}
|
|
543
539
|
},
|
|
540
|
+
plugin: {
|
|
541
|
+
type: 'object',
|
|
542
|
+
additionalProperties: false,
|
|
543
|
+
required: [
|
|
544
|
+
'name',
|
|
545
|
+
'version'
|
|
546
|
+
],
|
|
547
|
+
properties: {
|
|
548
|
+
name: {
|
|
549
|
+
type: 'string',
|
|
550
|
+
errorMessage: {
|
|
551
|
+
type: 'Plugin "name" should be a string.'
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
version: {
|
|
555
|
+
type: 'string',
|
|
556
|
+
errorMessage: {
|
|
557
|
+
type: 'Plugin "version" should be a string.'
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
typePrefix: {
|
|
561
|
+
type: 'string',
|
|
562
|
+
errorMessage: {
|
|
563
|
+
type: 'Plugin "typePrefix" should be a string.'
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
errorMessage: {
|
|
568
|
+
type: 'Plugin should be an object.',
|
|
569
|
+
required: {
|
|
570
|
+
name: 'Plugin should have required property "name".',
|
|
571
|
+
version: 'Plugin should have required property "version".'
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
},
|
|
544
575
|
request: {
|
|
545
576
|
type: 'object',
|
|
546
577
|
additionalProperties: false,
|
|
@@ -630,6 +661,16 @@ export default {
|
|
|
630
661
|
},
|
|
631
662
|
additionalProperties: false,
|
|
632
663
|
properties: {
|
|
664
|
+
auth: {
|
|
665
|
+
$ref: '#/definitions/authConfig'
|
|
666
|
+
},
|
|
667
|
+
basePath: {
|
|
668
|
+
type: 'string',
|
|
669
|
+
description: 'App base path to apply to all routes. Base path must start with "/".',
|
|
670
|
+
errorMessage: {
|
|
671
|
+
type: 'App "config.basePath" should be a string.'
|
|
672
|
+
}
|
|
673
|
+
},
|
|
633
674
|
homePageId: {
|
|
634
675
|
type: 'string',
|
|
635
676
|
description: 'Page id to use as homepage. When visiting home route "/", the router will redirect to this page. If not provided, the first page in default or first menu will be used as the homePageId.',
|
|
@@ -637,23 +678,30 @@ export default {
|
|
|
637
678
|
type: 'App "config.homePageId" should be a string.'
|
|
638
679
|
}
|
|
639
680
|
},
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
},
|
|
645
|
-
types: {
|
|
646
|
-
type: 'object',
|
|
647
|
-
patternProperties: {
|
|
648
|
-
'^.*$': {
|
|
649
|
-
url: 'string',
|
|
681
|
+
theme: {
|
|
682
|
+
type: 'object',
|
|
650
683
|
errorMessage: {
|
|
651
|
-
|
|
684
|
+
type: 'App "config.theme" should be an object.'
|
|
685
|
+
},
|
|
686
|
+
properties: {
|
|
687
|
+
lessVariables: {
|
|
688
|
+
type: 'object',
|
|
689
|
+
description: 'App theme less variables.',
|
|
690
|
+
errorMessage: {
|
|
691
|
+
type: 'App "config.theme.lessVariables" should be an object.'
|
|
692
|
+
}
|
|
693
|
+
}
|
|
652
694
|
}
|
|
653
695
|
}
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
plugins: {
|
|
699
|
+
type: 'array',
|
|
700
|
+
items: {
|
|
701
|
+
$ref: '#/definitions/plugin'
|
|
654
702
|
},
|
|
655
703
|
errorMessage: {
|
|
656
|
-
type: 'App "
|
|
704
|
+
type: 'App "plugins" should be an array.'
|
|
657
705
|
}
|
|
658
706
|
},
|
|
659
707
|
global: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
Copyright 2020-
|
|
3
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
you may not use this file except in compliance with the License.
|
|
@@ -14,93 +14,59 @@
|
|
|
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
|
+
'@lowdefy/actions-core',
|
|
21
|
+
'@lowdefy/blocks-antd',
|
|
20
22
|
'@lowdefy/blocks-basic',
|
|
21
|
-
'@lowdefy/
|
|
23
|
+
'@lowdefy/blocks-color-selectors',
|
|
24
|
+
'@lowdefy/blocks-echarts',
|
|
25
|
+
'@lowdefy/blocks-loaders',
|
|
26
|
+
'@lowdefy/blocks-markdown',
|
|
27
|
+
'@lowdefy/connection-axios-http',
|
|
28
|
+
'@lowdefy/connection-elasticsearch',
|
|
29
|
+
'@lowdefy/connection-google-sheets',
|
|
30
|
+
'@lowdefy/connection-knex',
|
|
31
|
+
'@lowdefy/connection-mongodb',
|
|
32
|
+
'@lowdefy/connection-redis',
|
|
33
|
+
'@lowdefy/connection-sendgrid',
|
|
34
|
+
'@lowdefy/connection-stripe',
|
|
35
|
+
'@lowdefy/operators-change-case',
|
|
36
|
+
'@lowdefy/operators-diff',
|
|
37
|
+
'@lowdefy/operators-js',
|
|
38
|
+
'@lowdefy/operators-mql',
|
|
39
|
+
'@lowdefy/operators-nunjucks',
|
|
40
|
+
'@lowdefy/operators-uuid',
|
|
41
|
+
'@lowdefy/operators-yaml',
|
|
22
42
|
];
|
|
23
|
-
function
|
|
24
|
-
if (type.isArray(typeNames)) {
|
|
25
|
-
typeNames.forEach((typeName)=>{
|
|
26
|
-
store[typeName] = {
|
|
27
|
-
package: packageName,
|
|
28
|
-
version
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function generateDefaultTypes() {
|
|
43
|
+
async function generateDefaultTypesMap() {
|
|
34
44
|
const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
|
|
35
|
-
const
|
|
36
|
-
actions: {
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
connections: {
|
|
41
|
-
},
|
|
42
|
-
requests: {
|
|
43
|
-
},
|
|
45
|
+
const defaultTypesMap = {
|
|
46
|
+
actions: {},
|
|
47
|
+
blocks: {},
|
|
48
|
+
connections: {},
|
|
49
|
+
icons: {},
|
|
44
50
|
operators: {
|
|
45
|
-
client: {
|
|
46
|
-
}
|
|
47
|
-
server: {
|
|
48
|
-
}
|
|
51
|
+
client: {},
|
|
52
|
+
server: {}
|
|
49
53
|
},
|
|
50
|
-
|
|
54
|
+
requests: {},
|
|
55
|
+
styles: {
|
|
56
|
+
packages: {},
|
|
57
|
+
blocks: {}
|
|
58
|
+
}
|
|
51
59
|
};
|
|
52
60
|
await Promise.all(defaultPackages.map(async (packageName)=>{
|
|
53
61
|
const { default: types } = await import(`${packageName}/types`);
|
|
54
|
-
const version = packageFile.devDependencies[packageName];
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
packageName,
|
|
59
|
-
version
|
|
60
|
-
});
|
|
61
|
-
createTypeDefinitions({
|
|
62
|
-
typeNames: types.blocks,
|
|
63
|
-
store: defaultTypes.blocks,
|
|
62
|
+
const version = packageFile.devDependencies[packageName] || packageFile.dependencies[packageName];
|
|
63
|
+
createPluginTypesMap({
|
|
64
|
+
packageTypes: types,
|
|
65
|
+
typesMap: defaultTypesMap,
|
|
64
66
|
packageName,
|
|
65
67
|
version
|
|
66
68
|
});
|
|
67
|
-
createTypeDefinitions({
|
|
68
|
-
typeNames: types.connections,
|
|
69
|
-
store: defaultTypes.connections,
|
|
70
|
-
packageName,
|
|
71
|
-
version
|
|
72
|
-
});
|
|
73
|
-
createTypeDefinitions({
|
|
74
|
-
typeNames: types.requests,
|
|
75
|
-
store: defaultTypes.requests,
|
|
76
|
-
packageName,
|
|
77
|
-
version
|
|
78
|
-
});
|
|
79
|
-
createTypeDefinitions({
|
|
80
|
-
typeNames: type.isObject(types.operators) ? types.operators.client : [],
|
|
81
|
-
store: defaultTypes.operators.client,
|
|
82
|
-
packageName,
|
|
83
|
-
version
|
|
84
|
-
});
|
|
85
|
-
createTypeDefinitions({
|
|
86
|
-
typeNames: type.isObject(types.operators) ? types.operators.server : [],
|
|
87
|
-
store: defaultTypes.operators.server,
|
|
88
|
-
packageName,
|
|
89
|
-
version
|
|
90
|
-
});
|
|
91
|
-
if (type.isArray(types.styles)) {
|
|
92
|
-
types.styles.forEach((pathName)=>{
|
|
93
|
-
defaultTypes.styles.push({
|
|
94
|
-
path: pathName,
|
|
95
|
-
package: packageName,
|
|
96
|
-
version: packageFile.devDependencies[packageName]
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
69
|
}));
|
|
101
|
-
await writeFile(
|
|
102
|
-
filePath: path.resolve(process.cwd(), './dist/defaultTypes.json'),
|
|
103
|
-
content: JSON.stringify(defaultTypes, null, 2)
|
|
104
|
-
});
|
|
70
|
+
await writeFile(path.resolve(process.cwd(), './dist/defaultTypesMap.json'), JSON.stringify(defaultTypesMap, null, 2));
|
|
105
71
|
}
|
|
106
|
-
|
|
72
|
+
generateDefaultTypesMap();
|
package/dist/scripts/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
Copyright 2020-
|
|
3
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
you may not use this file except in compliance with the License.
|
|
@@ -14,18 +14,19 @@
|
|
|
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 yargs from 'yargs';
|
|
18
|
+
import { hideBin } from 'yargs/helpers';
|
|
17
19
|
import build from '../index.js';
|
|
20
|
+
const argv = yargs(hideBin(process.argv)).argv;
|
|
18
21
|
async function run() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
console.error(e);
|
|
29
|
-
}
|
|
22
|
+
await build({
|
|
23
|
+
logger: console,
|
|
24
|
+
refResolver: argv.refResolver || process.env.LOWDEFY_BUILD_REF_RESOLVER,
|
|
25
|
+
directories: {
|
|
26
|
+
build: path.resolve(argv.buildDirectory || process.env.LOWDEFY_DIRECTORY_BUILD || path.join(process.cwd(), 'build')),
|
|
27
|
+
config: path.resolve(argv.configDirectory || process.env.LOWDEFY_DIRECTORY_CONFIG || process.cwd()),
|
|
28
|
+
server: path.resolve(argv.serverDirectory || process.env.LOWDEFY_DIRECTORY_SERVER || process.cwd())
|
|
29
|
+
}
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
run();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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,11 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return new Promise((resolve)=>setTimeout(resolve, ms)
|
|
17
|
-
);
|
|
18
|
-
};
|
|
15
|
+
*/ import { wait } from '@lowdefy/helpers';
|
|
19
16
|
async function asyncFn() {
|
|
20
17
|
await wait(20);
|
|
21
18
|
return {
|
|
22
19
|
async: true
|
|
23
20
|
};
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
export default asyncFn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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,4 +15,4 @@
|
|
|
15
15
|
*/ function resolver() {
|
|
16
16
|
throw new Error('Test error');
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
export default resolver;
|