@pylonts/dsl 1.1.11 → 1.1.13
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/convert.d.ts +6 -8
- package/dist/curd.js +1 -1
- package/dist/dao.d.ts +10 -7
- package/dist/dao.js +20 -7
- package/dist/dsl.d.ts +18 -1
- package/dist/dsl.js +40 -0
- package/dist/dto.d.ts +13 -8
- package/dist/dto.js +68 -13
- package/dist/entity.d.ts +4 -3
- package/dist/entity.js +1 -1
- package/dist/filter.d.ts +6 -4
- package/dist/filter.js +1 -1
- package/dist/flow-script.js +8 -2
- package/dist/flow.d.ts +10 -2
- package/dist/flow.js +44 -4
- package/dist/mermaid-driver.js +2 -2
- package/dist/project.d.ts +5 -2
- package/dist/project.js +21 -2
- package/dist/service.d.ts +13 -8
- package/dist/service.js +1 -1
- package/dist/third-service.d.ts +10 -53
- package/dist/third-service.js +3 -78
- package/dist/typebox-driver.d.ts +0 -6
- package/dist/typebox-driver.js +8 -36
- package/dist/utils.d.ts +2 -2
- package/docs/curd.md +55 -20
- package/docs/dao-generation.md +477 -477
- package/docs/project.md +32 -24
- package/docs/token.md +326 -326
- package/package.json +1 -1
- package/src/action.ts +51 -51
- package/src/controller.ts +53 -53
- package/src/convert.ts +76 -78
- package/src/curd.ts +104 -104
- package/src/dao.ts +504 -485
- package/src/dsl.ts +296 -257
- package/src/dto.ts +323 -266
- package/src/entity.ts +43 -42
- package/src/expr.ts +64 -64
- package/src/filter.ts +71 -69
- package/src/flow-script.ts +702 -695
- package/src/flow.ts +1272 -1226
- package/src/index.ts +46 -46
- package/src/mermaid-driver.ts +339 -339
- package/src/mysql-driver.ts +108 -108
- package/src/project.ts +138 -114
- package/src/service.ts +112 -107
- package/src/third-service.ts +68 -191
- package/src/typebox-driver.ts +234 -268
- package/src/utils.ts +74 -74
package/src/service.ts
CHANGED
|
@@ -1,108 +1,113 @@
|
|
|
1
|
-
import type { SchemaBase } from './dsl.js';
|
|
2
|
-
import type { FrontAppSchema, ProjectApiSchema } from './project.js';
|
|
3
|
-
import type { DtoArrayField, DtoField, DtoMessage, DtoObjectField } from './dto.js';
|
|
4
|
-
import type { ExceptionSchema } from './exception.js';
|
|
5
|
-
import type { FlowSchema } from './flow.js';
|
|
6
|
-
import { exceptionEndNames } from './flow.js';
|
|
7
|
-
|
|
8
|
-
/** A backend service serving
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
api
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
seenFlows.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
1
|
+
import type { CollectionSchemaBase, SchemaBase } from './dsl.js';
|
|
2
|
+
import type { FrontAppSchema, ProjectApiSchema } from './project.js';
|
|
3
|
+
import type { DtoArrayField, DtoField, DtoMessage, DtoObjectField } from './dto.js';
|
|
4
|
+
import type { ExceptionSchema } from './exception.js';
|
|
5
|
+
import type { FlowSchema } from './flow.js';
|
|
6
|
+
import { exceptionEndNames } from './flow.js';
|
|
7
|
+
|
|
8
|
+
/** A backend service serving one frontend app (1:1 module), or a
|
|
9
|
+
* platform-shared domain service (app unset — shared across modules). */
|
|
10
|
+
export interface ServiceSchema extends CollectionSchemaBase {
|
|
11
|
+
type: 'service';
|
|
12
|
+
/** The backend api module this service belongs to (shared instance from
|
|
13
|
+
* project.config.ts apis). Services are always backend-side, so storage is
|
|
14
|
+
* service_schema/{api.name}/{app.name}/service/ — app unset = the api-level
|
|
15
|
+
* common domain layer, stored at service_schema/{api.name}/common/service/. */
|
|
16
|
+
api: ProjectApiSchema;
|
|
17
|
+
/** The frontend app this service serves (shared instance from project.config).
|
|
18
|
+
* Unset = api-level common domain service shared by all modules of the api. */
|
|
19
|
+
app?: FrontAppSchema;
|
|
20
|
+
/** Methods keyed by name — the map key is written back as the method name. */
|
|
21
|
+
methods: Record<string, ServiceMethodSchema>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Method input for defineService: type/schema/name are set by the builder. */
|
|
25
|
+
export type ServiceMethodDef = Omit<ServiceMethodSchema, 'type' | 'schema' | 'name'>;
|
|
26
|
+
|
|
27
|
+
export function defineService(options: {
|
|
28
|
+
name: string;
|
|
29
|
+
api: ProjectApiSchema;
|
|
30
|
+
app?: FrontAppSchema;
|
|
31
|
+
methods: Record<string, ServiceMethodDef>;
|
|
32
|
+
description?: string;
|
|
33
|
+
}): ServiceSchema {
|
|
34
|
+
if (options.app && !options.api.apps.includes(options.app)) {
|
|
35
|
+
throw new Error(`service ${options.name}: api '${options.api.name}' does not serve app '${options.app.name}'`);
|
|
36
|
+
}
|
|
37
|
+
const schema: ServiceSchema = {
|
|
38
|
+
type: 'service',
|
|
39
|
+
name: options.name,
|
|
40
|
+
description: options.description,
|
|
41
|
+
api: options.api,
|
|
42
|
+
app: options.app,
|
|
43
|
+
methods: {},
|
|
44
|
+
};
|
|
45
|
+
for (const key of Object.keys(options.methods)) {
|
|
46
|
+
const method = options.methods[key];
|
|
47
|
+
schema.methods[key] = { type: 'method', schema, ...method, name: key };
|
|
48
|
+
}
|
|
49
|
+
validateFlowBindings(schema);
|
|
50
|
+
return schema;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// A method bound to a flow: the flow's escape set (its exception ends) must
|
|
54
|
+
// equal the method's declared throws, the flow's own args/results (when
|
|
55
|
+
// present) must be the same objects as the method's, and one flow may serve
|
|
56
|
+
// only one method.
|
|
57
|
+
//
|
|
58
|
+
// Notes: (1) the unique-binding check is per defineService call — a flow
|
|
59
|
+
// shared across two service schemas is not detected; (2) escape-set equality
|
|
60
|
+
// means exceptions swallowed by an internal catch (or routed through a
|
|
61
|
+
// catch-all end) disappear from the contract, so the method must not declare
|
|
62
|
+
// them.
|
|
63
|
+
function validateFlowBindings(schema: ServiceSchema): void {
|
|
64
|
+
const seenFlows = new Set<FlowSchema>();
|
|
65
|
+
for (const key of Object.keys(schema.methods)) {
|
|
66
|
+
const m = schema.methods[key];
|
|
67
|
+
if (!m.flow) continue;
|
|
68
|
+
if (seenFlows.has(m.flow)) {
|
|
69
|
+
throw new Error(`service ${schema.name}: flow "${m.flow.name}" is bound to more than one method`);
|
|
70
|
+
}
|
|
71
|
+
seenFlows.add(m.flow);
|
|
72
|
+
if (m.flow.args !== undefined && m.flow.args !== m.args) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`service ${schema.name}: method "${key}" args and its flow "${m.flow.name}" args must be the same object`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if (m.flow.results !== undefined && m.flow.results !== m.results) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`service ${schema.name}: method "${key}" results and its flow "${m.flow.name}" results must be the same object`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const escaped = exceptionEndNames(m.flow);
|
|
83
|
+
const declared = new Set((m.throws ?? []).map((t) => t.name));
|
|
84
|
+
for (const e of escaped) {
|
|
85
|
+
if (!declared.has(e)) {
|
|
86
|
+
throw new Error(`service ${schema.name}: method "${key}" flow escapes ${e} but the method does not declare it`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const d of declared) {
|
|
90
|
+
if (!escaped.has(d)) {
|
|
91
|
+
throw new Error(`service ${schema.name}: method "${key}" declares throw ${d} but its flow never escapes it`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (m.flow.name !== key) {
|
|
95
|
+
console.warn(`service ${schema.name}: method "${key}" flow name "${m.flow.name}" differs from the method key`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** A method exposed by a business service — the contract with the calling
|
|
101
|
+
* frontend. Third-party integration methods are a separate contract
|
|
102
|
+
* (ThirdServiceMethodSchema): they can never bind a flow. */
|
|
103
|
+
export interface ServiceMethodSchema extends SchemaBase {
|
|
104
|
+
type: 'method';
|
|
105
|
+
schema: ServiceSchema;
|
|
106
|
+
args: DtoMessage,
|
|
107
|
+
results : DtoMessage
|
|
108
|
+
/** Exceptions this method may throw (e.g. IOException, CodeException). */
|
|
109
|
+
throws?: ExceptionSchema[];
|
|
110
|
+
/** Implementation flow — the method's logic graph. The method carries the
|
|
111
|
+
* contract (args/results/throws), the flow carries the structure. */
|
|
112
|
+
flow?: FlowSchema;
|
|
108
113
|
}
|
package/src/third-service.ts
CHANGED
|
@@ -1,192 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { ThirdApiSchema } from './project.js';
|
|
5
|
-
|
|
6
|
-
// Third-party integration services.
|
|
7
|
-
// A
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// a local entity column
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
/** A third-party integration service (e.g. tenpay wechat pay).
|
|
14
|
-
* Distinct from ServiceSchema (backend service bound to an app) and
|
|
15
|
-
* ThirdApiSchema (project topology: the dir the integration lives in).
|
|
16
|
-
* Describes the adapter class contract: constructor config + methods. */
|
|
17
|
-
export interface ThirdServiceSchema extends SchemaBase {
|
|
18
|
-
type: 'thirdService';
|
|
19
|
-
/** The third-party system this service integrates (topology reference). */
|
|
20
|
-
schema: ThirdApiSchema;
|
|
21
|
-
/** Methods keyed by name — the map key is written back as the method name. */
|
|
22
|
-
methods: Record<string, ThirdServiceMethodSchema>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** A method
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
refs?: ThirdFieldRef[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Message input for defineThirdMethod: type/schema are set by the builder. */
|
|
73
|
-
export type ThirdMethodDef = Omit<ThirdMethodSchema, 'type' | 'schema'>;
|
|
74
|
-
|
|
75
|
-
/** Build a third-party method message. Writes back name/schema on own fields
|
|
76
|
-
* (top-level and nested); shared entity columns keep their table identity and
|
|
77
|
-
* must be keyed by their column name. */
|
|
78
|
-
export function defineThirdMethod(def: ThirdMethodDef): ThirdMethodSchema {
|
|
79
|
-
const message: ThirdMethodSchema = {
|
|
80
|
-
type: 'thirdMethod',
|
|
81
|
-
name: def.name,
|
|
82
|
-
description: def.description,
|
|
83
|
-
// Filled by defineThirdService.
|
|
84
|
-
schema: undefined as unknown as ThirdServiceMethodSchema,
|
|
85
|
-
fields: def.fields,
|
|
86
|
-
refs: def.refs,
|
|
87
|
-
};
|
|
88
|
-
for (const key of Object.keys(message.fields)) {
|
|
89
|
-
const field = message.fields[key] as Field;
|
|
90
|
-
if (field.schema === undefined) {
|
|
91
|
-
field.name = key;
|
|
92
|
-
field.schema = message;
|
|
93
|
-
} else if (field.schema.type === 'table') {
|
|
94
|
-
// Shared entity column: from() names the projection after field.name, so
|
|
95
|
-
// a mismatched key would silently rename the wire field. Same-fact fields
|
|
96
|
-
// with different names go through refs instead.
|
|
97
|
-
if (field.name !== key) {
|
|
98
|
-
throw new Error(
|
|
99
|
-
`thirdMethod '${message.name}': shared column key '${key}' must match the column name '${field.name}' — ` +
|
|
100
|
-
`same-fact fields with different names go through refs instead`,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
} else if (field.schema !== message) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
`thirdMethod '${message.name}': field '${key}' already belongs to ${field.schema.type} '${field.schema.name}', cannot reuse`,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
writeBackNested(message, field);
|
|
109
|
-
}
|
|
110
|
-
if (message.refs !== undefined) {
|
|
111
|
-
const ownFields = Object.values(message.fields);
|
|
112
|
-
for (const link of message.refs) {
|
|
113
|
-
if (!ownFields.includes(link.field)) {
|
|
114
|
-
throw new Error(`thirdMethod '${message.name}': ref field must be one of its fields`);
|
|
115
|
-
}
|
|
116
|
-
if (link.ref.schema === undefined || link.ref.schema === message) {
|
|
117
|
-
throw new Error(`thirdMethod '${message.name}': ref target '${link.ref.name}' must be defined in another schema`);
|
|
118
|
-
}
|
|
119
|
-
if (link.convert !== undefined) {
|
|
120
|
-
const ends = Object.values(link.convert.rule.ends);
|
|
121
|
-
if (!ends.includes(link.convert.end)) {
|
|
122
|
-
throw new Error(
|
|
123
|
-
`thirdMethod '${message.name}': convert end '${link.convert.end.name}' must be one of rule '${link.convert.rule.name}' ends`,
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return message;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Write back name/schema on nested wire fields (array items, object properties);
|
|
133
|
-
* shared entity columns keep their table identity. */
|
|
134
|
-
function writeBackNested(message: ThirdMethodSchema, field: Field): void {
|
|
135
|
-
if (field.type === 'array') {
|
|
136
|
-
writeBackNested(message, field.items);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (field.type !== 'object') return;
|
|
140
|
-
for (const key of Object.keys(field.properties)) {
|
|
141
|
-
const child = field.properties[key] as Field;
|
|
142
|
-
if (child.schema === undefined) {
|
|
143
|
-
child.name = key;
|
|
144
|
-
child.schema = message;
|
|
145
|
-
}
|
|
146
|
-
writeBackNested(message, child);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** Method input for defineThirdService: name is written back from the methods map key. */
|
|
151
|
-
export interface ThirdServiceMethodDef {
|
|
152
|
-
/** Input message. */
|
|
153
|
-
args: ThirdMethodDef;
|
|
154
|
-
/** Output message. */
|
|
155
|
-
results: ThirdMethodDef;
|
|
156
|
-
/** Exceptions this method may throw (e.g. IOException, CodeException). */
|
|
157
|
-
throws?: ExceptionSchema[];
|
|
158
|
-
description?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function defineThirdService(options: {
|
|
162
|
-
schema: ThirdApiSchema;
|
|
163
|
-
name: string;
|
|
164
|
-
methods: Record<string, ThirdServiceMethodDef>;
|
|
165
|
-
description?: string;
|
|
166
|
-
}): ThirdServiceSchema {
|
|
167
|
-
const schema: ThirdServiceSchema = {
|
|
168
|
-
type: 'thirdService',
|
|
169
|
-
name: options.name,
|
|
170
|
-
description: options.description,
|
|
171
|
-
schema: options.schema,
|
|
172
|
-
methods: {},
|
|
173
|
-
};
|
|
174
|
-
for (const key of Object.keys(options.methods)) {
|
|
175
|
-
const method = options.methods[key] as ThirdServiceMethodDef;
|
|
176
|
-
const methodSchema: ThirdServiceMethodSchema = {
|
|
177
|
-
type: 'method',
|
|
178
|
-
name: key,
|
|
179
|
-
description: method.description,
|
|
180
|
-
schema,
|
|
181
|
-
args: undefined as unknown as ThirdMethodSchema,
|
|
182
|
-
results: undefined as unknown as ThirdMethodSchema,
|
|
183
|
-
throws: method.throws,
|
|
184
|
-
};
|
|
185
|
-
methodSchema.args = defineThirdMethod(method.args);
|
|
186
|
-
methodSchema.results = defineThirdMethod(method.results);
|
|
187
|
-
methodSchema.args.schema = methodSchema;
|
|
188
|
-
methodSchema.results.schema = methodSchema;
|
|
189
|
-
schema.methods[key] = methodSchema;
|
|
190
|
-
}
|
|
191
|
-
return schema;
|
|
1
|
+
import type { SchemaBase } from './dsl.js';
|
|
2
|
+
import type { DtoMessage } from './dto.js';
|
|
3
|
+
import type { ExceptionSchema } from './exception.js';
|
|
4
|
+
import type { ThirdApiSchema } from './project.js';
|
|
5
|
+
|
|
6
|
+
// Third-party integration services.
|
|
7
|
+
// A third-party method's args/results are plain DtoMessages — the same POJO
|
|
8
|
+
// aggregate as any business DTO. Fields reference each other across messages
|
|
9
|
+
// by sharing the Field instance (dtoField(sharedField)): a wire field may be
|
|
10
|
+
// the same object as a local entity column (same fact, same type) or a field
|
|
11
|
+
// of another DtoMessage (same fact, possibly different protocol name).
|
|
12
|
+
|
|
13
|
+
/** A third-party integration service (e.g. tenpay wechat pay).
|
|
14
|
+
* Distinct from ServiceSchema (backend service bound to an app) and
|
|
15
|
+
* ThirdApiSchema (project topology: the dir the integration lives in).
|
|
16
|
+
* Describes the adapter class contract: constructor config + methods. */
|
|
17
|
+
export interface ThirdServiceSchema extends SchemaBase {
|
|
18
|
+
type: 'thirdService';
|
|
19
|
+
/** The third-party system this service integrates (topology reference). */
|
|
20
|
+
schema: ThirdApiSchema;
|
|
21
|
+
/** Methods keyed by name — the map key is written back as the method name. */
|
|
22
|
+
methods: Record<string, ThirdServiceMethodSchema>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A method of a third-party integration service. Same contract shape as
|
|
26
|
+
* ServiceMethodSchema minus flow — the implementation lives in the external
|
|
27
|
+
* system, there is nothing to model. Kept separate so a third method can
|
|
28
|
+
* never bind a flow. */
|
|
29
|
+
export interface ThirdServiceMethodSchema extends SchemaBase {
|
|
30
|
+
type: 'method';
|
|
31
|
+
schema: ThirdServiceSchema;
|
|
32
|
+
/** Input message. */
|
|
33
|
+
args: DtoMessage;
|
|
34
|
+
/** Output message. */
|
|
35
|
+
results: DtoMessage;
|
|
36
|
+
/** Exceptions this method may throw (e.g. IOException, CodeException). */
|
|
37
|
+
throws?: ExceptionSchema[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Method input for defineThirdService: name/schema are set by the builder. */
|
|
41
|
+
export type ThirdServiceMethodDef = Omit<ThirdServiceMethodSchema, 'type' | 'schema' | 'name'>;
|
|
42
|
+
|
|
43
|
+
export function defineThirdService(options: {
|
|
44
|
+
schema: ThirdApiSchema;
|
|
45
|
+
name: string;
|
|
46
|
+
methods: Record<string, ThirdServiceMethodDef>;
|
|
47
|
+
description?: string;
|
|
48
|
+
}): ThirdServiceSchema {
|
|
49
|
+
const schema: ThirdServiceSchema = {
|
|
50
|
+
type: 'thirdService',
|
|
51
|
+
name: options.name,
|
|
52
|
+
description: options.description,
|
|
53
|
+
schema: options.schema,
|
|
54
|
+
methods: {},
|
|
55
|
+
};
|
|
56
|
+
for (const key of Object.keys(options.methods)) {
|
|
57
|
+
const method = options.methods[key];
|
|
58
|
+
schema.methods[key] = {
|
|
59
|
+
type: 'method',
|
|
60
|
+
name: key,
|
|
61
|
+
description: method.description,
|
|
62
|
+
schema,
|
|
63
|
+
args: method.args,
|
|
64
|
+
results: method.results,
|
|
65
|
+
throws: method.throws,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return schema;
|
|
192
69
|
}
|