@synopackageland/cli 0.47.3 → 0.48.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.
- package/CHANGELOG.md +13 -0
- package/README.md +36 -19
- package/assets/go/route-audit/main.go +1 -1
- package/assets/init-compose.md +1 -1
- package/dist/add.js +10 -0
- package/dist/cli.js +9 -1
- package/dist/ctl/ai-tools.d.ts +29 -0
- package/dist/ctl/ai-tools.js +28 -0
- package/dist/ctl/cli.d.ts +5 -2
- package/dist/ctl/cli.js +34 -1
- package/dist/ctl/descriptor.d.ts +7 -3
- package/dist/ctl/descriptor.js +24 -4
- package/dist/ctl/generate.d.ts +1 -0
- package/dist/ctl/generate.js +16 -0
- package/dist/ctl/import-openapi.d.ts +8 -0
- package/dist/ctl/import-openapi.js +149 -0
- package/dist/ctl/registry.d.ts +47 -0
- package/dist/ctl/registry.js +119 -0
- package/dist/error-registry.js +6 -3
- package/dist/init-upstream.js +3 -2
- package/dist/init.js +22 -4
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/standalone/api-description-inspect.js +3 -0
- package/dist/standalone/api-description.d.ts +6 -1
- package/dist/standalone/api-description.js +35 -57
- package/dist/standalone/api-permissions.d.ts +3 -1
- package/dist/standalone/api-permissions.js +14 -6
- package/dist/standalone/bridge-build.js +8 -2
- package/dist/standalone/bridge-runtime.d.ts +1 -0
- package/dist/standalone/bridge-runtime.js +1 -0
- package/dist/standalone/build.js +1 -0
- package/dist/standalone/dsm-window.js +2 -1
- package/dist/standalone/manifest.d.ts +1 -0
- package/dist/standalone/manifest.js +17 -3
- package/dist/standalone/operation-registry.d.ts +13 -0
- package/dist/standalone/operation-registry.js +83 -0
- package/docs/ctl-external.md +5 -2
- package/package.json +2 -2
- package/schema/synopkgland-api-v2.schema.json +504 -0
- package/skills/SKILL.md +19 -10
- package/skills/reference/compose.md +3 -3
- package/skills/reference/create.md +8 -8
- package/skills/reference/ctl.md +81 -40
- package/skills/reference/files.md +1 -1
- package/skills/reference/identity-gateway.md +13 -19
- package/skills/reference/identity.md +3 -4
- package/skills/reference/install.md +2 -2
- package/skills/reference/portal.md +1 -1
- package/skills/reference/upstream-fork.md +11 -7
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { appSdkVersion, sdkSource } from '../runtime/sdk-source.js';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { readRegistry, registryFile, registryArtifacts, registryPermissions, writeGenerated, checkRouteEquality } from '../ctl/registry.js';
|
|
5
|
+
import { makeDescriptor, validateDescriptor, flowMethods } from '../ctl/descriptor.js';
|
|
6
|
+
import { readApiPermissions, API_PERMISSIONS_FILE } from './api-permissions.js';
|
|
7
|
+
import { sdkBackend } from './manifest.js';
|
|
8
|
+
import { describeApiRoutes } from './api-description.js';
|
|
9
|
+
export function operationRegistry(m) {
|
|
10
|
+
if (!m.ctl?.registry)
|
|
11
|
+
throw Error('CTL_REGISTRY_REQUIRED: declare ctl.registry with a synopkgland.api v2 spec.');
|
|
12
|
+
return readRegistry(registryFile(m.root, m.ctl.registry));
|
|
13
|
+
}
|
|
14
|
+
export function registryDescriptor(m, registry = operationRegistry(m)) {
|
|
15
|
+
const operations = registry.operations;
|
|
16
|
+
const bindings = Object.fromEntries(Object.entries(operations).map(([name, op]) => [name, { effect: op.effect, permission: op.permission }]));
|
|
17
|
+
if (m.capabilities.identity)
|
|
18
|
+
for (const name of ['identity.session', 'identity.logout'])
|
|
19
|
+
bindings[name] = { effect: 'write', permission: 'public' };
|
|
20
|
+
const commands = Object.fromEntries(Object.entries(operations).filter(([, op]) => op.ai !== 'hidden'));
|
|
21
|
+
const external = m.ctl?.external;
|
|
22
|
+
if (external)
|
|
23
|
+
for (const entry of Object.values(external)) {
|
|
24
|
+
const op = operations[entry.method];
|
|
25
|
+
if (!op || op.ai !== 'hidden' || op.permission !== 'administrators' || op.effect !== 'destructive')
|
|
26
|
+
throw Error('CTL_EXTERNAL_ENTRY: external entry must be a hidden destructive administrator operation.');
|
|
27
|
+
}
|
|
28
|
+
const description = makeDescriptor({ package: { id: m.package, version: m.spkVersion, displayName: m.displayname }, aliases: m.ctl?.aliases ?? [m.package.toLowerCase()], provenance: { developedBy: m.ctl?.developedBy ?? 'unknown', generator: 'synopkgland-cli' }, entry: m.entry ?? 'policy', transport: { path: `/webman/3rdparty/${m.package}/cgi/api.cgi`, auth: m.capabilities.identity ? 'dsm-app-session' : 'dsm-session' }, operations, commands, bindings, ...(external ? { external } : {}) });
|
|
29
|
+
return validateDescriptor(description, m.package, m.spkVersion);
|
|
30
|
+
}
|
|
31
|
+
/** Generation writes metadata only. The exporter constructs routes without running handlers. */
|
|
32
|
+
export async function generateOperations(m, run, check = false, bridgeMethods) {
|
|
33
|
+
const source = operationRegistry(m);
|
|
34
|
+
const registry = structuredClone(source);
|
|
35
|
+
if (m.backend.kind === 'binary' || m.compose)
|
|
36
|
+
throw Error('CTL_UNSUPPORTED_BACKEND: operation registry requires the SDK native runtime.');
|
|
37
|
+
const backend = sdkBackend(m);
|
|
38
|
+
const { sdk } = readApiPermissions(backend, m.capabilities, source.operations);
|
|
39
|
+
const sdkNames = new Set(Object.values(sdk).flatMap(group => Object.keys(group)));
|
|
40
|
+
const appRegistry = { ...registry, operations: Object.fromEntries(Object.entries(registry.operations).filter(([name]) => !sdkNames.has(name))) };
|
|
41
|
+
writeGenerated(join(backend.dir, API_PERMISSIONS_FILE[backend.kind]), registryPermissions(appRegistry), check);
|
|
42
|
+
const runtimeFile = backend.kind === 'go' ? join(backend.dir, 'internal', 'api', 'operations.json') : join(backend.dir, 'synopkgland-operations.json');
|
|
43
|
+
if (!check && backend.kind === 'go' && !existsSync(runtimeFile))
|
|
44
|
+
writeGenerated(runtimeFile, JSON.stringify(source, null, 2) + '\n', false);
|
|
45
|
+
const routes = await describeApiRoutes(m, bridgeMethods, run);
|
|
46
|
+
const owned = routes.filter(route => sdkNames.has(route.method) && !['identity.status', 'identity.login', 'identity.session', 'identity.logout'].includes(route.method));
|
|
47
|
+
if (owned.length) {
|
|
48
|
+
const version = appSdkVersion(backend);
|
|
49
|
+
if (!version)
|
|
50
|
+
throw Error('CTL_SDK_CATALOG_REQUIRED: pin the SDK operation catalog.');
|
|
51
|
+
const catalog = readRegistry(join(sdkSource(version).goDir, 'api', 'operations.json'));
|
|
52
|
+
for (const route of owned)
|
|
53
|
+
if (!registry.operations[route.method]) {
|
|
54
|
+
const spec = catalog.operations[route.method];
|
|
55
|
+
if (!spec)
|
|
56
|
+
throw Error('CTL_SDK_CATALOG_REQUIRED: SDK route has no spec: ' + route.method);
|
|
57
|
+
registry.operations[route.method] = { ...structuredClone(spec), permission: route.permission };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
writeGenerated(runtimeFile, JSON.stringify(registry, null, 2) + '\n', check);
|
|
61
|
+
checkRouteEquality(registry, routes);
|
|
62
|
+
const kinds = new Map(routes.map(route => [route.method, route.kind ?? 'json']));
|
|
63
|
+
if (m.ctl?.external) {
|
|
64
|
+
if (m.capabilities.identity)
|
|
65
|
+
throw Error('CTL_EXTERNAL_TRANSPORT: external entries require DSM session transport.');
|
|
66
|
+
for (const entry of Object.values(m.ctl.external))
|
|
67
|
+
if (kinds.get(entry.method) !== 'json')
|
|
68
|
+
throw Error('CTL_EXTERNAL_ENTRY: external entries require JSON RPC handlers.');
|
|
69
|
+
}
|
|
70
|
+
for (const [name, op] of Object.entries(registry.operations))
|
|
71
|
+
if (op.ai !== 'hidden') {
|
|
72
|
+
for (const method of flowMethods(op.flow))
|
|
73
|
+
if (['http', 'integration'].includes(kinds.get(method) ?? ''))
|
|
74
|
+
throw Error('CTL_FLOW_UNSUPPORTED: exposed flows require RPC or SDK transfer handlers: ' + name);
|
|
75
|
+
}
|
|
76
|
+
if (m.entry === 'admin-only' && Object.values(registry.operations).some(op => op.permission !== 'administrators' && op.permission !== 'integration'))
|
|
77
|
+
throw Error('CTL_ROUTE_MISMATCH: administrator entry requires administrator operation permissions.');
|
|
78
|
+
const description = registryDescriptor(m, registry);
|
|
79
|
+
registryArtifacts(m.root, registry, check);
|
|
80
|
+
writeGenerated(join(m.root, 'generated', 'synopkgland-api.json'), JSON.stringify(description, null, 2) + '\n', check);
|
|
81
|
+
writeGenerated(join(m.root, 'generated', 'ctl.json'), JSON.stringify({ commands: description.payload.commands }, null, 2) + '\n', check);
|
|
82
|
+
return { description, registry: { ...Object.fromEntries(routes.map(r => [r.method, r.permission])), ...(m.capabilities.identity ? { 'identity.session': 'public', 'identity.logout': 'public' } : {}) } };
|
|
83
|
+
}
|
package/docs/ctl-external.md
CHANGED
|
@@ -27,7 +27,8 @@ App with explicit ordinary ctl commands, extend `dsm-package.yaml`:
|
|
|
27
27
|
```yaml
|
|
28
28
|
ctl:
|
|
29
29
|
enabled: true
|
|
30
|
-
|
|
30
|
+
registry: operations.json
|
|
31
|
+
# Keep the App's existing aliases and developedBy here.
|
|
31
32
|
external:
|
|
32
33
|
example-external-v1:
|
|
33
34
|
method: bridge.external
|
|
@@ -35,7 +36,9 @@ ctl:
|
|
|
35
36
|
|
|
36
37
|
The existing route registry must export `bridge.external` as an administrator
|
|
37
38
|
RPC method (or have an administrator-only App entry). Build rejects missing,
|
|
38
|
-
nonadministrator and raw HTTP routes.
|
|
39
|
+
nonadministrator and raw HTTP routes. Declare the adapter once in the registry as `ai: hidden`, `effect: destructive`
|
|
40
|
+
and `permission: administrators`, with params/result schemas and an invoke flow.
|
|
41
|
+
Run `ctl generate` and `ctl generate --check`. The generated v2 descriptor adds:
|
|
39
42
|
|
|
40
43
|
```json
|
|
41
44
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@napi-rs/keyring": "^2.1.1",
|
|
32
|
-
"@synopackageland/templates": "~0.
|
|
32
|
+
"@synopackageland/templates": "~0.39.0",
|
|
33
33
|
"ajv": "^8.17.1",
|
|
34
34
|
"commander": "^13.1.0",
|
|
35
35
|
"json-canonicalize": "^3.0.1",
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Syno Package Land API description v2",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"format": {
|
|
8
|
+
"const": "synopkgland.api"
|
|
9
|
+
},
|
|
10
|
+
"version": {
|
|
11
|
+
"const": 2
|
|
12
|
+
},
|
|
13
|
+
"payload": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"package": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"properties": {
|
|
21
|
+
"id": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.+-]{0,127}$"
|
|
24
|
+
},
|
|
25
|
+
"version": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1,
|
|
28
|
+
"maxLength": 128
|
|
29
|
+
},
|
|
30
|
+
"displayName": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"minLength": 1,
|
|
33
|
+
"maxLength": 1024
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": [
|
|
37
|
+
"id",
|
|
38
|
+
"version",
|
|
39
|
+
"displayName"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"aliases": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"uniqueItems": true,
|
|
45
|
+
"maxItems": 8,
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9-]{0,63}$"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"provenance": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"properties": {
|
|
55
|
+
"developedBy": {
|
|
56
|
+
"enum": [
|
|
57
|
+
"synopkgland",
|
|
58
|
+
"third-party",
|
|
59
|
+
"unknown"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"generator": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"minLength": 1,
|
|
65
|
+
"maxLength": 1024
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"required": [
|
|
69
|
+
"developedBy",
|
|
70
|
+
"generator"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"entry": {
|
|
74
|
+
"enum": [
|
|
75
|
+
"policy",
|
|
76
|
+
"admin-only",
|
|
77
|
+
"app-privilege"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"transport": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"properties": {
|
|
84
|
+
"path": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "^/webman/3rdparty/[A-Za-z][A-Za-z0-9_.+-]{0,127}/cgi/api\\.cgi$"
|
|
87
|
+
},
|
|
88
|
+
"auth": {
|
|
89
|
+
"enum": [
|
|
90
|
+
"dsm-session",
|
|
91
|
+
"dsm-app-session"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"required": [
|
|
96
|
+
"path",
|
|
97
|
+
"auth"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"bindings": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"minProperties": 1,
|
|
103
|
+
"maxProperties": 1024,
|
|
104
|
+
"propertyNames": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"maxLength": 128,
|
|
107
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"additionalProperties": false,
|
|
112
|
+
"properties": {
|
|
113
|
+
"effect": {
|
|
114
|
+
"enum": [
|
|
115
|
+
"read",
|
|
116
|
+
"write",
|
|
117
|
+
"destructive"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"permission": {
|
|
121
|
+
"enum": [
|
|
122
|
+
"public",
|
|
123
|
+
"authenticated",
|
|
124
|
+
"administrators",
|
|
125
|
+
"integration"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": [
|
|
130
|
+
"effect",
|
|
131
|
+
"permission"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"commands": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"minProperties": 0,
|
|
138
|
+
"maxProperties": 1024,
|
|
139
|
+
"propertyNames": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"maxLength": 128,
|
|
142
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
143
|
+
},
|
|
144
|
+
"additionalProperties": {
|
|
145
|
+
"$ref": "#/$defs/operation"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"external": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"minProperties": 1,
|
|
151
|
+
"maxProperties": 16,
|
|
152
|
+
"propertyNames": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"pattern": "^[a-z][a-z0-9-]{0,63}$"
|
|
155
|
+
},
|
|
156
|
+
"additionalProperties": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"additionalProperties": false,
|
|
159
|
+
"properties": {
|
|
160
|
+
"method": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"maxLength": 128,
|
|
163
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"required": [
|
|
167
|
+
"method"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"operations": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"maxProperties": 1024,
|
|
174
|
+
"additionalProperties": {
|
|
175
|
+
"$ref": "#/$defs/operation"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"required": [
|
|
180
|
+
"package",
|
|
181
|
+
"aliases",
|
|
182
|
+
"provenance",
|
|
183
|
+
"entry",
|
|
184
|
+
"transport",
|
|
185
|
+
"bindings",
|
|
186
|
+
"commands",
|
|
187
|
+
"operations"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"sha256": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"required": [
|
|
196
|
+
"format",
|
|
197
|
+
"version",
|
|
198
|
+
"payload",
|
|
199
|
+
"sha256"
|
|
200
|
+
],
|
|
201
|
+
"$defs": {
|
|
202
|
+
"operation": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"additionalProperties": false,
|
|
205
|
+
"properties": {
|
|
206
|
+
"summary": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"minLength": 1,
|
|
209
|
+
"maxLength": 1024
|
|
210
|
+
},
|
|
211
|
+
"cli": {
|
|
212
|
+
"type": "array",
|
|
213
|
+
"minItems": 1,
|
|
214
|
+
"maxItems": 8,
|
|
215
|
+
"items": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"maxLength": 64,
|
|
218
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"effect": {
|
|
222
|
+
"enum": [
|
|
223
|
+
"read",
|
|
224
|
+
"write",
|
|
225
|
+
"destructive"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"permission": {
|
|
229
|
+
"enum": [
|
|
230
|
+
"public",
|
|
231
|
+
"authenticated",
|
|
232
|
+
"administrators",
|
|
233
|
+
"integration"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"paramsSchema": {
|
|
237
|
+
"type": "object"
|
|
238
|
+
},
|
|
239
|
+
"resultSchema": {
|
|
240
|
+
"type": "object"
|
|
241
|
+
},
|
|
242
|
+
"examples": {
|
|
243
|
+
"type": "array",
|
|
244
|
+
"maxItems": 16,
|
|
245
|
+
"items": {
|
|
246
|
+
"type": "object"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"flow": {
|
|
250
|
+
"oneOf": [
|
|
251
|
+
{
|
|
252
|
+
"type": "object",
|
|
253
|
+
"additionalProperties": false,
|
|
254
|
+
"properties": {
|
|
255
|
+
"type": {
|
|
256
|
+
"const": "invoke"
|
|
257
|
+
},
|
|
258
|
+
"method": {
|
|
259
|
+
"type": "string",
|
|
260
|
+
"maxLength": 128,
|
|
261
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"required": [
|
|
265
|
+
"type",
|
|
266
|
+
"method"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "object",
|
|
271
|
+
"additionalProperties": false,
|
|
272
|
+
"properties": {
|
|
273
|
+
"type": {
|
|
274
|
+
"const": "ndjson"
|
|
275
|
+
},
|
|
276
|
+
"method": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"maxLength": 128,
|
|
279
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"required": [
|
|
283
|
+
"type",
|
|
284
|
+
"method"
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"type": "object",
|
|
289
|
+
"additionalProperties": false,
|
|
290
|
+
"properties": {
|
|
291
|
+
"type": {
|
|
292
|
+
"const": "upload"
|
|
293
|
+
},
|
|
294
|
+
"method": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"maxLength": 128,
|
|
297
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
298
|
+
},
|
|
299
|
+
"fileParam": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"minLength": 1,
|
|
302
|
+
"maxLength": 1024
|
|
303
|
+
},
|
|
304
|
+
"parentParam": {
|
|
305
|
+
"type": "string",
|
|
306
|
+
"minLength": 1,
|
|
307
|
+
"maxLength": 1024
|
|
308
|
+
},
|
|
309
|
+
"nameParam": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"minLength": 1,
|
|
312
|
+
"maxLength": 1024
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"required": [
|
|
316
|
+
"type",
|
|
317
|
+
"method",
|
|
318
|
+
"fileParam",
|
|
319
|
+
"parentParam",
|
|
320
|
+
"nameParam"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"type": "object",
|
|
325
|
+
"additionalProperties": false,
|
|
326
|
+
"properties": {
|
|
327
|
+
"type": {
|
|
328
|
+
"const": "paginate"
|
|
329
|
+
},
|
|
330
|
+
"method": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"maxLength": 128,
|
|
333
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
334
|
+
},
|
|
335
|
+
"items": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"minLength": 1,
|
|
338
|
+
"maxLength": 1024
|
|
339
|
+
},
|
|
340
|
+
"offsetParam": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"minLength": 1,
|
|
343
|
+
"maxLength": 1024
|
|
344
|
+
},
|
|
345
|
+
"limitParam": {
|
|
346
|
+
"type": "string",
|
|
347
|
+
"minLength": 1,
|
|
348
|
+
"maxLength": 1024
|
|
349
|
+
},
|
|
350
|
+
"pageSize": {
|
|
351
|
+
"type": "integer",
|
|
352
|
+
"minimum": 1,
|
|
353
|
+
"maximum": 1000
|
|
354
|
+
},
|
|
355
|
+
"maxPages": {
|
|
356
|
+
"type": "integer",
|
|
357
|
+
"minimum": 1,
|
|
358
|
+
"maximum": 1000
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"required": [
|
|
362
|
+
"type",
|
|
363
|
+
"method",
|
|
364
|
+
"items",
|
|
365
|
+
"offsetParam",
|
|
366
|
+
"limitParam",
|
|
367
|
+
"pageSize",
|
|
368
|
+
"maxPages"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"type": "object",
|
|
373
|
+
"additionalProperties": false,
|
|
374
|
+
"properties": {
|
|
375
|
+
"type": {
|
|
376
|
+
"const": "job"
|
|
377
|
+
},
|
|
378
|
+
"start": {
|
|
379
|
+
"type": "string",
|
|
380
|
+
"maxLength": 128,
|
|
381
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
382
|
+
},
|
|
383
|
+
"poll": {
|
|
384
|
+
"type": "string",
|
|
385
|
+
"maxLength": 128,
|
|
386
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
387
|
+
},
|
|
388
|
+
"result": {
|
|
389
|
+
"type": "string",
|
|
390
|
+
"maxLength": 128,
|
|
391
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
392
|
+
},
|
|
393
|
+
"jobId": {
|
|
394
|
+
"type": "string",
|
|
395
|
+
"minLength": 1,
|
|
396
|
+
"maxLength": 1024
|
|
397
|
+
},
|
|
398
|
+
"idParam": {
|
|
399
|
+
"type": "string",
|
|
400
|
+
"minLength": 1,
|
|
401
|
+
"maxLength": 1024
|
|
402
|
+
},
|
|
403
|
+
"state": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"minLength": 1,
|
|
406
|
+
"maxLength": 1024
|
|
407
|
+
},
|
|
408
|
+
"done": {
|
|
409
|
+
"type": "array",
|
|
410
|
+
"minItems": 1,
|
|
411
|
+
"items": {
|
|
412
|
+
"type": "string",
|
|
413
|
+
"minLength": 1,
|
|
414
|
+
"maxLength": 1024
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
"failed": {
|
|
418
|
+
"type": "array",
|
|
419
|
+
"items": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"minLength": 1,
|
|
422
|
+
"maxLength": 1024
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
"intervalMs": {
|
|
426
|
+
"type": "integer",
|
|
427
|
+
"minimum": 10,
|
|
428
|
+
"maximum": 60000
|
|
429
|
+
},
|
|
430
|
+
"timeoutMs": {
|
|
431
|
+
"type": "integer",
|
|
432
|
+
"minimum": 10,
|
|
433
|
+
"maximum": 3600000
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
"required": [
|
|
437
|
+
"type",
|
|
438
|
+
"start",
|
|
439
|
+
"poll",
|
|
440
|
+
"jobId",
|
|
441
|
+
"idParam",
|
|
442
|
+
"state",
|
|
443
|
+
"done",
|
|
444
|
+
"failed",
|
|
445
|
+
"intervalMs",
|
|
446
|
+
"timeoutMs"
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
"ai": {
|
|
452
|
+
"enum": [
|
|
453
|
+
"read",
|
|
454
|
+
"preview",
|
|
455
|
+
"draft",
|
|
456
|
+
"human-only",
|
|
457
|
+
"hidden"
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
"preview": {
|
|
461
|
+
"type": "string"
|
|
462
|
+
},
|
|
463
|
+
"longRunning": {
|
|
464
|
+
"type": "boolean"
|
|
465
|
+
},
|
|
466
|
+
"upstream": {
|
|
467
|
+
"type": "object",
|
|
468
|
+
"additionalProperties": false,
|
|
469
|
+
"required": [
|
|
470
|
+
"method",
|
|
471
|
+
"path"
|
|
472
|
+
],
|
|
473
|
+
"properties": {
|
|
474
|
+
"method": {
|
|
475
|
+
"enum": [
|
|
476
|
+
"GET",
|
|
477
|
+
"HEAD",
|
|
478
|
+
"OPTIONS",
|
|
479
|
+
"POST",
|
|
480
|
+
"PUT",
|
|
481
|
+
"PATCH",
|
|
482
|
+
"DELETE"
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
"path": {
|
|
486
|
+
"type": "string",
|
|
487
|
+
"pattern": "^/"
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"required": [
|
|
493
|
+
"summary",
|
|
494
|
+
"cli",
|
|
495
|
+
"effect",
|
|
496
|
+
"permission",
|
|
497
|
+
"flow",
|
|
498
|
+
"ai",
|
|
499
|
+
"paramsSchema",
|
|
500
|
+
"resultSchema"
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|