@lowdefy/build 0.0.0-experimental-20250915134255 → 0.0.0-experimental-20251010122007
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/writePluginDocs/writeDocs.js +63 -0
- package/dist/build/writePluginDocs/writePluginDocs.js +103 -0
- package/dist/defaultTypesMap.js +439 -439
- package/dist/index.js +2 -2
- package/package.json +38 -38
- package/dist/build/writePluginSchemas/writeActionSchemas.js +0 -32
- package/dist/build/writePluginSchemas/writeBlockSchemas.js +0 -47
- package/dist/build/writePluginSchemas/writeConnectionSchemas.js +0 -52
- package/dist/build/writePluginSchemas/writeOperatorSchemas.js +0 -62
- package/dist/build/writePluginSchemas/writePluginSchemas.js +0 -38
- package/dist/build/writePluginSchemas/writeRequestSchemas.js +0 -49
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import writeMaps from './build/writeMaps.js';
|
|
|
42
42
|
import writeMenus from './build/writeMenus.js';
|
|
43
43
|
import writePages from './build/writePages.js';
|
|
44
44
|
import writePluginImports from './build/writePluginImports/writePluginImports.js';
|
|
45
|
-
import
|
|
45
|
+
import writePluginDocs from './build/writePluginDocs/writePluginDocs.js';
|
|
46
46
|
import writeRequests from './build/writeRequests.js';
|
|
47
47
|
import writeTypes from './build/writeTypes.js';
|
|
48
48
|
async function build(options) {
|
|
@@ -153,7 +153,7 @@ async function build(options) {
|
|
|
153
153
|
components,
|
|
154
154
|
context
|
|
155
155
|
});
|
|
156
|
-
await
|
|
156
|
+
await writePluginDocs({
|
|
157
157
|
context
|
|
158
158
|
});
|
|
159
159
|
await writeJs({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/build",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20251010122007",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"dist/*"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@lowdefy/ajv": "0.0.0-experimental-
|
|
48
|
-
"@lowdefy/blocks-basic": "0.0.0-experimental-
|
|
49
|
-
"@lowdefy/blocks-loaders": "0.0.0-experimental-
|
|
50
|
-
"@lowdefy/helpers": "0.0.0-experimental-
|
|
51
|
-
"@lowdefy/node-utils": "0.0.0-experimental-
|
|
52
|
-
"@lowdefy/nunjucks": "0.0.0-experimental-
|
|
53
|
-
"@lowdefy/operators": "0.0.0-experimental-
|
|
54
|
-
"@lowdefy/operators-js": "0.0.0-experimental-
|
|
47
|
+
"@lowdefy/ajv": "0.0.0-experimental-20251010122007",
|
|
48
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20251010122007",
|
|
49
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20251010122007",
|
|
50
|
+
"@lowdefy/helpers": "0.0.0-experimental-20251010122007",
|
|
51
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20251010122007",
|
|
52
|
+
"@lowdefy/nunjucks": "0.0.0-experimental-20251010122007",
|
|
53
|
+
"@lowdefy/operators": "0.0.0-experimental-20251010122007",
|
|
54
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20251010122007",
|
|
55
55
|
"ajv": "8.12.0",
|
|
56
56
|
"json5": "2.2.3",
|
|
57
57
|
"yaml": "2.3.4",
|
|
@@ -59,35 +59,35 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@jest/globals": "28.1.3",
|
|
62
|
-
"@lowdefy/actions-core": "0.0.0-experimental-
|
|
63
|
-
"@lowdefy/actions-pdf-make": "0.0.0-experimental-
|
|
64
|
-
"@lowdefy/blocks-aggrid": "0.0.0-experimental-
|
|
65
|
-
"@lowdefy/blocks-algolia": "0.0.0-experimental-
|
|
66
|
-
"@lowdefy/blocks-antd": "0.0.0-experimental-
|
|
67
|
-
"@lowdefy/blocks-color-selectors": "0.0.0-experimental-
|
|
68
|
-
"@lowdefy/blocks-echarts": "0.0.0-experimental-
|
|
69
|
-
"@lowdefy/blocks-google-maps": "0.0.0-experimental-
|
|
70
|
-
"@lowdefy/blocks-markdown": "0.0.0-experimental-
|
|
71
|
-
"@lowdefy/blocks-qr": "0.0.0-experimental-
|
|
72
|
-
"@lowdefy/connection-axios-http": "0.0.0-experimental-
|
|
73
|
-
"@lowdefy/connection-elasticsearch": "0.0.0-experimental-
|
|
74
|
-
"@lowdefy/connection-google-sheets": "0.0.0-experimental-
|
|
75
|
-
"@lowdefy/connection-knex": "0.0.0-experimental-
|
|
76
|
-
"@lowdefy/connection-mongodb": "0.0.0-experimental-
|
|
77
|
-
"@lowdefy/connection-redis": "0.0.0-experimental-
|
|
78
|
-
"@lowdefy/connection-sendgrid": "0.0.0-experimental-
|
|
79
|
-
"@lowdefy/connection-stripe": "0.0.0-experimental-
|
|
80
|
-
"@lowdefy/operators-change-case": "0.0.0-experimental-
|
|
81
|
-
"@lowdefy/operators-diff": "0.0.0-experimental-
|
|
82
|
-
"@lowdefy/operators-moment": "0.0.0-experimental-
|
|
83
|
-
"@lowdefy/operators-mql": "0.0.0-experimental-
|
|
84
|
-
"@lowdefy/operators-nunjucks": "0.0.0-experimental-
|
|
85
|
-
"@lowdefy/operators-uuid": "0.0.0-experimental-
|
|
86
|
-
"@lowdefy/operators-yaml": "0.0.0-experimental-
|
|
87
|
-
"@lowdefy/plugin-auth0": "0.0.0-experimental-
|
|
88
|
-
"@lowdefy/plugin-aws": "0.0.0-experimental-
|
|
89
|
-
"@lowdefy/plugin-csv": "0.0.0-experimental-
|
|
90
|
-
"@lowdefy/plugin-next-auth": "0.0.0-experimental-
|
|
62
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20251010122007",
|
|
63
|
+
"@lowdefy/actions-pdf-make": "0.0.0-experimental-20251010122007",
|
|
64
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20251010122007",
|
|
65
|
+
"@lowdefy/blocks-algolia": "0.0.0-experimental-20251010122007",
|
|
66
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20251010122007",
|
|
67
|
+
"@lowdefy/blocks-color-selectors": "0.0.0-experimental-20251010122007",
|
|
68
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20251010122007",
|
|
69
|
+
"@lowdefy/blocks-google-maps": "0.0.0-experimental-20251010122007",
|
|
70
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20251010122007",
|
|
71
|
+
"@lowdefy/blocks-qr": "0.0.0-experimental-20251010122007",
|
|
72
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20251010122007",
|
|
73
|
+
"@lowdefy/connection-elasticsearch": "0.0.0-experimental-20251010122007",
|
|
74
|
+
"@lowdefy/connection-google-sheets": "0.0.0-experimental-20251010122007",
|
|
75
|
+
"@lowdefy/connection-knex": "0.0.0-experimental-20251010122007",
|
|
76
|
+
"@lowdefy/connection-mongodb": "0.0.0-experimental-20251010122007",
|
|
77
|
+
"@lowdefy/connection-redis": "0.0.0-experimental-20251010122007",
|
|
78
|
+
"@lowdefy/connection-sendgrid": "0.0.0-experimental-20251010122007",
|
|
79
|
+
"@lowdefy/connection-stripe": "0.0.0-experimental-20251010122007",
|
|
80
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20251010122007",
|
|
81
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20251010122007",
|
|
82
|
+
"@lowdefy/operators-moment": "0.0.0-experimental-20251010122007",
|
|
83
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20251010122007",
|
|
84
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20251010122007",
|
|
85
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20251010122007",
|
|
86
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20251010122007",
|
|
87
|
+
"@lowdefy/plugin-auth0": "0.0.0-experimental-20251010122007",
|
|
88
|
+
"@lowdefy/plugin-aws": "0.0.0-experimental-20251010122007",
|
|
89
|
+
"@lowdefy/plugin-csv": "0.0.0-experimental-20251010122007",
|
|
90
|
+
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20251010122007",
|
|
91
91
|
"@swc/cli": "0.1.63",
|
|
92
92
|
"@swc/core": "1.3.99",
|
|
93
93
|
"@swc/jest": "0.2.29",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 writeActionSchemas({ context }) {
|
|
16
|
-
try {
|
|
17
|
-
const actions = context.typesMap.actions || {};
|
|
18
|
-
for (const [actionType, actionConfig] of Object.entries(actions)){
|
|
19
|
-
const actionSchema = {
|
|
20
|
-
type: actionType,
|
|
21
|
-
package: actionConfig.package,
|
|
22
|
-
description: `${actionType} action`
|
|
23
|
-
};
|
|
24
|
-
const schemaFileName = `${actionType}.json`;
|
|
25
|
-
const individualSchemaContent = JSON.stringify(actionSchema, null, 2);
|
|
26
|
-
await context.writeBuildArtifact(`schemas/actions/${schemaFileName}`, individualSchemaContent);
|
|
27
|
-
}
|
|
28
|
-
} catch (error) {
|
|
29
|
-
context.logger.warn('Failed to write action schemas:', error.message);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export default writeActionSchemas;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 fs from 'fs';
|
|
16
|
-
import path from 'path';
|
|
17
|
-
async function writeBlockSchemas({ context }) {
|
|
18
|
-
try {
|
|
19
|
-
const blocks = context.typesMap.blocks || {};
|
|
20
|
-
for (const [blockType, blockConfig] of Object.entries(blocks)){
|
|
21
|
-
const blockSchema = {
|
|
22
|
-
type: blockType,
|
|
23
|
-
package: blockConfig.package,
|
|
24
|
-
description: `${blockType} block`
|
|
25
|
-
};
|
|
26
|
-
// Try to read schema.json from the package
|
|
27
|
-
try {
|
|
28
|
-
const packagePath = path.join(process.cwd(), 'node_modules', blockConfig.package);
|
|
29
|
-
const schemaPath = path.join(packagePath, 'dist', 'blocks', blockConfig.originalTypeName, 'schema.json');
|
|
30
|
-
if (fs.existsSync(schemaPath)) {
|
|
31
|
-
const schemaContent = fs.readFileSync(schemaPath, 'utf8');
|
|
32
|
-
const schema = JSON.parse(schemaContent);
|
|
33
|
-
blockSchema.schema = schema;
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
// Continue without schema if it can't be read
|
|
37
|
-
context.logger.warn(`Could not read schema for ${blockType}:`, error.message);
|
|
38
|
-
}
|
|
39
|
-
const schemaFileName = `${blockType}.json`;
|
|
40
|
-
const individualSchemaContent = JSON.stringify(blockSchema, null, 2);
|
|
41
|
-
await context.writeBuildArtifact(`schemas/blocks/${schemaFileName}`, individualSchemaContent);
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
context.logger.warn('Failed to write block schemas:', error.message);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export default writeBlockSchemas;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 fs from 'fs';
|
|
16
|
-
import path from 'path';
|
|
17
|
-
import writeRequestSchemas from './writeRequestSchemas.js';
|
|
18
|
-
async function writeConnectionSchemas({ context }) {
|
|
19
|
-
try {
|
|
20
|
-
const connections = context.typesMap.connections || {};
|
|
21
|
-
for (const [connectionType, connectionConfig] of Object.entries(connections)){
|
|
22
|
-
const connectionSchema = {
|
|
23
|
-
type: connectionType,
|
|
24
|
-
package: connectionConfig.package,
|
|
25
|
-
description: `${connectionType} connection`
|
|
26
|
-
};
|
|
27
|
-
// Try to read schema.js from the package
|
|
28
|
-
try {
|
|
29
|
-
const packagePath = path.join(process.cwd(), 'node_modules', connectionConfig.package);
|
|
30
|
-
const schemaPath = path.join(packagePath, 'dist', 'connections', connectionConfig.originalTypeName, 'schema.js');
|
|
31
|
-
if (fs.existsSync(schemaPath)) {
|
|
32
|
-
const { default: schema } = await import(`file://${schemaPath}`);
|
|
33
|
-
connectionSchema.schema = schema;
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
// Continue without schema if it can't be read
|
|
37
|
-
context.logger.warn(`Could not read schema for ${connectionType}:`, error.message);
|
|
38
|
-
}
|
|
39
|
-
const schemaFileName = `${connectionType}.json`;
|
|
40
|
-
const individualSchemaContent = JSON.stringify(connectionSchema, null, 2);
|
|
41
|
-
await context.writeBuildArtifact(`schemas/connections/${schemaFileName}`, individualSchemaContent);
|
|
42
|
-
await writeRequestSchemas({
|
|
43
|
-
connectionType,
|
|
44
|
-
context,
|
|
45
|
-
connectionPackage: connectionConfig.package
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
} catch (error) {
|
|
49
|
-
context.logger.warn('Failed to write connection schemas:', error.message);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export default writeConnectionSchemas;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 writeOperatorSchemas({ context }) {
|
|
16
|
-
try {
|
|
17
|
-
const operators = context.typesMap.operators || {};
|
|
18
|
-
const allOperators = {};
|
|
19
|
-
// Process client operators
|
|
20
|
-
if (operators.client) {
|
|
21
|
-
for (const [operatorType, operatorConfig] of Object.entries(operators.client)){
|
|
22
|
-
allOperators[operatorType] = {
|
|
23
|
-
...operatorConfig,
|
|
24
|
-
groups: [
|
|
25
|
-
'client'
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// Process server operators
|
|
31
|
-
if (operators.server) {
|
|
32
|
-
for (const [operatorType, operatorConfig] of Object.entries(operators.server)){
|
|
33
|
-
if (allOperators[operatorType]) {
|
|
34
|
-
// Operator exists in both client and server
|
|
35
|
-
allOperators[operatorType].groups.push('server');
|
|
36
|
-
} else {
|
|
37
|
-
// Operator only in server
|
|
38
|
-
allOperators[operatorType] = {
|
|
39
|
-
...operatorConfig,
|
|
40
|
-
groups: [
|
|
41
|
-
'server'
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
for (const [operatorType, operatorConfig] of Object.entries(allOperators)){
|
|
48
|
-
const operatorSchema = {
|
|
49
|
-
type: operatorType,
|
|
50
|
-
package: operatorConfig.package,
|
|
51
|
-
groups: operatorConfig.groups,
|
|
52
|
-
description: `${operatorType} operator`
|
|
53
|
-
};
|
|
54
|
-
const schemaFileName = `${operatorType}.json`;
|
|
55
|
-
const individualSchemaContent = JSON.stringify(operatorSchema, null, 2);
|
|
56
|
-
await context.writeBuildArtifact(`schemas/operators/${schemaFileName}`, individualSchemaContent);
|
|
57
|
-
}
|
|
58
|
-
} catch (error) {
|
|
59
|
-
context.logger.warn('Failed to write operator schemas:', error.message);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export default writeOperatorSchemas;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 writeActionSchemas from './writeActionSchemas.js';
|
|
16
|
-
import writeBlockSchemas from './writeBlockSchemas.js';
|
|
17
|
-
import writeConnectionSchemas from './writeConnectionSchemas.js';
|
|
18
|
-
import writeOperatorSchemas from './writeOperatorSchemas.js';
|
|
19
|
-
async function writePluginSchemas({ context }) {
|
|
20
|
-
if (context.stage !== 'dev') {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
await Promise.all([
|
|
24
|
-
writeActionSchemas({
|
|
25
|
-
context
|
|
26
|
-
}),
|
|
27
|
-
writeBlockSchemas({
|
|
28
|
-
context
|
|
29
|
-
}),
|
|
30
|
-
writeConnectionSchemas({
|
|
31
|
-
context
|
|
32
|
-
}),
|
|
33
|
-
writeOperatorSchemas({
|
|
34
|
-
context
|
|
35
|
-
})
|
|
36
|
-
]);
|
|
37
|
-
}
|
|
38
|
-
export default writePluginSchemas;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2024 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 fs from 'fs';
|
|
16
|
-
import path from 'path';
|
|
17
|
-
async function writeRequestSchemas({ connectionType, context, connectionPackage }) {
|
|
18
|
-
try {
|
|
19
|
-
const allRequests = context.typesMap.requests || {};
|
|
20
|
-
// Filter requests that belong to this connection package
|
|
21
|
-
const requests = Object.fromEntries(Object.entries(allRequests).filter(([, requestConfig])=>requestConfig.package === connectionPackage));
|
|
22
|
-
for (const [requestType, requestConfig] of Object.entries(requests)){
|
|
23
|
-
const requestSchema = {
|
|
24
|
-
connection: connectionType,
|
|
25
|
-
type: requestType,
|
|
26
|
-
package: requestConfig.package,
|
|
27
|
-
description: `${requestType} request`
|
|
28
|
-
};
|
|
29
|
-
// Try to read schema.js from the package
|
|
30
|
-
try {
|
|
31
|
-
const packagePath = path.join(process.cwd(), 'node_modules', requestConfig.package);
|
|
32
|
-
const schemaPath = path.join(packagePath, 'dist', 'connections', connectionType, requestConfig.originalTypeName, 'schema.js');
|
|
33
|
-
if (fs.existsSync(schemaPath)) {
|
|
34
|
-
const { default: schema } = await import(`file://${schemaPath}`);
|
|
35
|
-
requestSchema.schema = schema;
|
|
36
|
-
}
|
|
37
|
-
} catch (error) {
|
|
38
|
-
// Continue without schema if it can't be read
|
|
39
|
-
context.logger.warn(`Could not read schema for ${requestType}:`, error.message);
|
|
40
|
-
}
|
|
41
|
-
const schemaFileName = `${requestType}.json`;
|
|
42
|
-
const individualSchemaContent = JSON.stringify(requestSchema, null, 2);
|
|
43
|
-
await context.writeBuildArtifact(`schemas/requests/${connectionType}/${schemaFileName}`, individualSchemaContent);
|
|
44
|
-
}
|
|
45
|
-
} catch (error) {
|
|
46
|
-
context.logger.warn('Failed to write request schemas:', error.message);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export default writeRequestSchemas;
|