@lowdefy/build 5.0.0 → 5.2.0

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.
Files changed (53) hide show
  1. package/dist/build/buildApi/buildRoutine/countStepTypes.js +3 -0
  2. package/dist/build/buildApi/buildRoutine/setStepId.js +3 -2
  3. package/dist/build/buildApi/buildRoutine/validateStep.js +19 -0
  4. package/dist/build/buildApi/validateEndpoint.js +10 -0
  5. package/dist/build/buildApi/validateStepReferences.js +4 -4
  6. package/dist/build/buildAuth/buildApiAuth.js +2 -1
  7. package/dist/build/buildAuth/buildPageAuth.js +2 -1
  8. package/dist/build/buildAuth/getApiRoles.js +12 -6
  9. package/dist/build/buildAuth/getPageRoles.js +12 -6
  10. package/dist/build/buildAuth/getProtectedApi.js +3 -2
  11. package/dist/build/buildAuth/getProtectedPages.js +3 -2
  12. package/dist/build/buildAuth/matchPattern.js +22 -0
  13. package/dist/build/buildConnections.js +42 -4
  14. package/dist/build/buildJs/jsMapParser.js +25 -12
  15. package/dist/build/buildJs/writeJs.js +2 -2
  16. package/dist/build/buildMenu.js +41 -0
  17. package/dist/build/buildModuleDefs.js +97 -0
  18. package/dist/build/buildModules.js +96 -0
  19. package/dist/build/buildPages/buildBlock/buildBlock.js +2 -2
  20. package/dist/build/buildPages/buildBlock/buildEvents.js +16 -1
  21. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +2 -1
  22. package/dist/build/buildPages/buildBlock/validateBlock.js +3 -3
  23. package/dist/build/buildPages/buildPage.js +1 -0
  24. package/dist/build/buildPages/validateCallApiRefs.js +31 -0
  25. package/dist/build/buildRefs/getModuleRefContent.js +81 -0
  26. package/dist/build/buildRefs/makeRefDefinition.js +6 -0
  27. package/dist/build/buildRefs/walker.js +424 -44
  28. package/dist/build/fetchGitHubModule.js +94 -0
  29. package/dist/build/fetchModules.js +60 -0
  30. package/dist/build/full/buildPages.js +10 -1
  31. package/dist/build/full/writePages.js +1 -1
  32. package/dist/build/jit/buildPageJit.js +34 -4
  33. package/dist/build/jit/collectSkeletonSourceFiles.js +8 -0
  34. package/dist/build/jit/createPageRegistry.js +10 -1
  35. package/dist/build/jit/shallowBuild.js +22 -11
  36. package/dist/build/jit/writePageJit.js +2 -2
  37. package/dist/build/jit/writeSourcelessPages.js +1 -1
  38. package/dist/build/parseModuleSource.js +48 -0
  39. package/dist/build/registerModules.js +242 -0
  40. package/dist/build/resolveDepTarget.js +43 -0
  41. package/dist/build/resolveModuleDependencies.js +60 -0
  42. package/dist/build/resolveModuleOperators.js +27 -0
  43. package/dist/build/testSchema.js +22 -11
  44. package/dist/build/writePluginImports/writeGlobalsCss.js +30 -1
  45. package/dist/createContext.js +4 -0
  46. package/dist/defaultPackages.js +51 -0
  47. package/dist/defaultTypesMap.js +515 -355
  48. package/dist/index.js +16 -1
  49. package/dist/indexDev.js +3 -1
  50. package/dist/lowdefySchema.js +58 -0
  51. package/dist/scripts/generateDefaultTypes.js +1 -34
  52. package/package.json +46 -41
  53. package/dist/build/jit/stripPageContent.js +0 -29
package/dist/index.js CHANGED
@@ -28,6 +28,8 @@ import buildImports from './build/buildImports/buildImports.js';
28
28
  import buildJs from './build/full/buildJs.js';
29
29
  import buildLogger from './build/buildLogger.js';
30
30
  import buildMenu from './build/buildMenu.js';
31
+ import buildModuleDefs from './build/buildModuleDefs.js';
32
+ import buildModules from './build/buildModules.js';
31
33
  import buildPages from './build/full/buildPages.js';
32
34
  import buildRefs from './build/buildRefs/buildRefs.js';
33
35
  import collectPageContent from './build/collectPageContent.js';
@@ -58,8 +60,14 @@ async function build(options) {
58
60
  let context;
59
61
  try {
60
62
  context = createContext(options);
63
+ // Phase 1: Build module definitions
64
+ // Parses lowdefy.yaml, resolves module refs, populates context.modules
65
+ await buildModuleDefs({
66
+ context
67
+ });
61
68
  let components;
62
69
  try {
70
+ // Phase 2: Ref resolution (handles _ref: { module, component/menu })
63
71
  components = await buildRefs({
64
72
  context
65
73
  });
@@ -73,17 +81,24 @@ async function build(options) {
73
81
  }
74
82
  // Stop if buildRefs collected any errors (YAML parse, missing files, etc.)
75
83
  logCollectedErrors(context);
84
+ // Phase 3: Process modules — scopes IDs, merges into components
85
+ buildModules({
86
+ components,
87
+ context
88
+ });
76
89
  // Build steps - collect all errors before stopping
77
90
  // addKeys runs first so testSchema has ~k markers for error location info
78
91
  tryBuildStep(addKeys, 'addKeys', {
79
92
  components,
80
93
  context
81
94
  });
95
+ // testSchema emits warnings (not errors) — focused validations in each
96
+ // build step provide better error messages with full context
82
97
  tryBuildStep(testSchema, 'testSchema', {
83
98
  components,
84
99
  context
85
100
  });
86
- // Schema errors mean structurally invalid data - stop before processing further
101
+ // Stop if addKeys collected any errors (e.g. invalid ~ignoreBuildChecks)
87
102
  logCollectedErrors(context);
88
103
  tryBuildStep(buildApp, 'buildApp', {
89
104
  components,
package/dist/indexDev.js CHANGED
@@ -12,7 +12,9 @@
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
- */ export { default as shallowBuild } from './build/jit/shallowBuild.js';
15
+ */ export { default as buildModuleDefs } from './build/buildModuleDefs.js';
16
+ export { default as buildModules } from './build/buildModules.js';
17
+ export { default as shallowBuild } from './build/jit/shallowBuild.js';
16
18
  export { default as buildPageJit } from './build/jit/buildPageJit.js';
17
19
  export { default as createPageRegistry } from './build/jit/createPageRegistry.js';
18
20
  export { default as createContext } from './createContext.js';
@@ -1531,6 +1531,64 @@ export default {
1531
1531
  type: 'App "pages" should be an array.'
1532
1532
  }
1533
1533
  },
1534
+ modules: {
1535
+ type: 'array',
1536
+ items: {
1537
+ type: 'object',
1538
+ required: [
1539
+ 'id',
1540
+ 'source'
1541
+ ],
1542
+ properties: {
1543
+ '~r': {},
1544
+ '~l': {},
1545
+ id: {
1546
+ type: 'string',
1547
+ errorMessage: {
1548
+ type: 'Module "id" should be a string.'
1549
+ }
1550
+ },
1551
+ source: {
1552
+ type: 'string',
1553
+ errorMessage: {
1554
+ type: 'Module "source" should be a string.'
1555
+ }
1556
+ },
1557
+ vars: {
1558
+ type: 'object',
1559
+ errorMessage: {
1560
+ type: 'Module "vars" should be an object.'
1561
+ }
1562
+ },
1563
+ connections: {
1564
+ type: 'object',
1565
+ errorMessage: {
1566
+ type: 'Module "connections" should be an object.'
1567
+ }
1568
+ },
1569
+ dependencies: {
1570
+ type: 'object',
1571
+ additionalProperties: {
1572
+ type: 'string'
1573
+ },
1574
+ errorMessage: {
1575
+ type: 'Module "dependencies" should be an object with string values.'
1576
+ }
1577
+ }
1578
+ },
1579
+ additionalProperties: false,
1580
+ errorMessage: {
1581
+ type: 'Module should be an object.',
1582
+ required: {
1583
+ id: 'Module should have required property "id".',
1584
+ source: 'Module should have required property "source".'
1585
+ }
1586
+ }
1587
+ },
1588
+ errorMessage: {
1589
+ type: 'App "modules" should be an array.'
1590
+ }
1591
+ },
1534
1592
  logger: {
1535
1593
  type: 'object',
1536
1594
  additionalProperties: false,
@@ -16,40 +16,7 @@
16
16
  */ import path from 'path';
17
17
  import { readFile, writeFile } from '@lowdefy/node-utils';
18
18
  import createPluginTypesMap from '../utils/createPluginTypesMap.js';
19
- const defaultPackages = [
20
- '@lowdefy/actions-core',
21
- '@lowdefy/actions-pdf-make',
22
- '@lowdefy/blocks-aggrid',
23
- '@lowdefy/blocks-antd',
24
- '@lowdefy/blocks-basic',
25
- '@lowdefy/blocks-echarts',
26
- '@lowdefy/blocks-google-maps',
27
- '@lowdefy/blocks-loaders',
28
- '@lowdefy/blocks-markdown',
29
- '@lowdefy/blocks-qr',
30
- '@lowdefy/connection-axios-http',
31
- '@lowdefy/connection-elasticsearch',
32
- '@lowdefy/connection-test',
33
- '@lowdefy/connection-google-sheets',
34
- '@lowdefy/connection-knex',
35
- '@lowdefy/connection-mongodb',
36
- '@lowdefy/connection-redis',
37
- '@lowdefy/connection-sendgrid',
38
- '@lowdefy/connection-stripe',
39
- '@lowdefy/operators-change-case',
40
- '@lowdefy/operators-diff',
41
- '@lowdefy/operators-js',
42
- '@lowdefy/operators-jsonata',
43
- '@lowdefy/operators-dayjs',
44
- '@lowdefy/operators-mql',
45
- '@lowdefy/operators-nunjucks',
46
- '@lowdefy/operators-uuid',
47
- '@lowdefy/operators-yaml',
48
- '@lowdefy/plugin-auth0',
49
- '@lowdefy/plugin-aws',
50
- '@lowdefy/plugin-csv',
51
- '@lowdefy/plugin-next-auth'
52
- ];
19
+ import defaultPackages from '../defaultPackages.js';
53
20
  async function generateDefaultTypesMap() {
54
21
  const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
55
22
  const defaultTypesMap = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/build",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -45,56 +45,61 @@
45
45
  "dist/*"
46
46
  ],
47
47
  "dependencies": {
48
- "@lowdefy/ajv": "5.0.0",
49
- "@lowdefy/block-utils": "5.0.0",
50
- "@lowdefy/blocks-basic": "5.0.0",
51
- "@lowdefy/blocks-loaders": "5.0.0",
52
- "@lowdefy/errors": "5.0.0",
53
- "@lowdefy/helpers": "5.0.0",
54
- "@lowdefy/node-utils": "5.0.0",
55
- "@lowdefy/nunjucks": "5.0.0",
56
- "@lowdefy/operators": "5.0.0",
57
- "@lowdefy/operators-js": "5.0.0",
48
+ "@lowdefy/ajv": "5.2.0",
49
+ "@lowdefy/block-utils": "5.2.0",
50
+ "@lowdefy/blocks-basic": "5.2.0",
51
+ "@lowdefy/blocks-loaders": "5.2.0",
52
+ "@lowdefy/errors": "5.2.0",
53
+ "@lowdefy/helpers": "5.2.0",
54
+ "@lowdefy/node-utils": "5.2.0",
55
+ "@lowdefy/nunjucks": "5.2.0",
56
+ "@lowdefy/operators": "5.2.0",
57
+ "@lowdefy/operators-js": "5.2.0",
58
58
  "ajv": "8.12.0",
59
59
  "json5": "2.2.3",
60
+ "picomatch": "4.0.1",
61
+ "semver": "7.5.4",
62
+ "tar": "6.2.1",
60
63
  "yaml": "2.3.4",
61
64
  "yargs": "17.7.2"
62
65
  },
63
66
  "devDependencies": {
64
67
  "@jest/globals": "28.1.3",
65
- "@lowdefy/actions-core": "5.0.0",
66
- "@lowdefy/actions-pdf-make": "5.0.0",
67
- "@lowdefy/blocks-aggrid": "5.0.0",
68
- "@lowdefy/blocks-antd": "5.0.0",
69
- "@lowdefy/blocks-echarts": "5.0.0",
70
- "@lowdefy/blocks-google-maps": "5.0.0",
71
- "@lowdefy/blocks-markdown": "5.0.0",
72
- "@lowdefy/blocks-qr": "5.0.0",
73
- "@lowdefy/connection-axios-http": "5.0.0",
74
- "@lowdefy/connection-elasticsearch": "5.0.0",
75
- "@lowdefy/connection-test": "5.0.0",
76
- "@lowdefy/connection-google-sheets": "5.0.0",
77
- "@lowdefy/connection-knex": "5.0.0",
78
- "@lowdefy/connection-mongodb": "5.0.0",
79
- "@lowdefy/connection-redis": "5.0.0",
80
- "@lowdefy/connection-sendgrid": "5.0.0",
81
- "@lowdefy/connection-stripe": "5.0.0",
82
- "@lowdefy/operators-change-case": "5.0.0",
83
- "@lowdefy/operators-diff": "5.0.0",
84
- "@lowdefy/operators-jsonata": "5.0.0",
85
- "@lowdefy/operators-dayjs": "5.0.0",
86
- "@lowdefy/operators-mql": "5.0.0",
87
- "@lowdefy/operators-nunjucks": "5.0.0",
88
- "@lowdefy/operators-uuid": "5.0.0",
89
- "@lowdefy/operators-yaml": "5.0.0",
90
- "@lowdefy/plugin-auth0": "5.0.0",
91
- "@lowdefy/plugin-aws": "5.0.0",
92
- "@lowdefy/plugin-csv": "5.0.0",
93
- "@lowdefy/plugin-next-auth": "5.0.0",
68
+ "@lowdefy/actions-core": "5.2.0",
69
+ "@lowdefy/actions-pdf-make": "5.2.0",
70
+ "@lowdefy/blocks-aggrid": "5.2.0",
71
+ "@lowdefy/blocks-antd": "5.2.0",
72
+ "@lowdefy/blocks-diff": "5.2.0",
73
+ "@lowdefy/blocks-echarts": "5.2.0",
74
+ "@lowdefy/blocks-google-maps": "5.2.0",
75
+ "@lowdefy/blocks-markdown": "5.2.0",
76
+ "@lowdefy/blocks-qr": "5.2.0",
77
+ "@lowdefy/blocks-tiptap": "5.2.0",
78
+ "@lowdefy/connection-axios-http": "5.2.0",
79
+ "@lowdefy/connection-elasticsearch": "5.2.0",
80
+ "@lowdefy/connection-test": "5.2.0",
81
+ "@lowdefy/connection-google-sheets": "5.2.0",
82
+ "@lowdefy/connection-knex": "5.2.0",
83
+ "@lowdefy/connection-mongodb": "5.2.0",
84
+ "@lowdefy/connection-redis": "5.2.0",
85
+ "@lowdefy/connection-sendgrid": "5.2.0",
86
+ "@lowdefy/connection-stripe": "5.2.0",
87
+ "@lowdefy/operators-change-case": "5.2.0",
88
+ "@lowdefy/operators-diff": "5.2.0",
89
+ "@lowdefy/operators-jsonata": "5.2.0",
90
+ "@lowdefy/operators-dayjs": "5.2.0",
91
+ "@lowdefy/operators-mql": "5.2.0",
92
+ "@lowdefy/operators-nunjucks": "5.2.0",
93
+ "@lowdefy/operators-uuid": "5.2.0",
94
+ "@lowdefy/operators-yaml": "5.2.0",
95
+ "@lowdefy/plugin-auth0": "5.2.0",
96
+ "@lowdefy/plugin-aws": "5.2.0",
97
+ "@lowdefy/plugin-csv": "5.2.0",
98
+ "@lowdefy/plugin-next-auth": "5.2.0",
94
99
  "@swc/cli": "0.8.0",
95
100
  "@swc/core": "1.15.18",
96
101
  "@swc/jest": "0.2.39",
97
- "@lowdefy/logger": "5.0.0",
102
+ "@lowdefy/logger": "5.2.0",
98
103
  "jest": "28.1.3",
99
104
  "pino": "8.16.2"
100
105
  },
@@ -1,29 +0,0 @@
1
- /*
2
- Copyright 2020-2026 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
- import PAGE_CONTENT_KEYS from './pageContentKeys.js';
17
- function stripPageContent({ components, context }) {
18
- for (const page of components.pages ?? []){
19
- // Only strip pages that have a source ref (will be JIT-rebuilt).
20
- // Inline pages (no ~r) must keep their content for buildShallowPages.
21
- const keyMapEntry = context.keyMap[page['~k']];
22
- const refId = keyMapEntry?.['~r'] ?? null;
23
- if (type.isNone(refId)) continue;
24
- for (const key of PAGE_CONTENT_KEYS){
25
- delete page[key];
26
- }
27
- }
28
- }
29
- export default stripPageContent;