@source-repo/rpc-cli 3.0.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/LICENSE +21 -0
- package/README.md +1131 -0
- package/dist/bench.d.ts +66 -0
- package/dist/bench.d.ts.map +1 -0
- package/dist/bench.js +109 -0
- package/dist/bench.js.map +1 -0
- package/dist/broker.d.ts +61 -0
- package/dist/broker.d.ts.map +1 -0
- package/dist/broker.js +56 -0
- package/dist/broker.js.map +1 -0
- package/dist/bus.d.ts +142 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +272 -0
- package/dist/bus.js.map +1 -0
- package/dist/bus.types.json +269 -0
- package/dist/conform.d.ts +75 -0
- package/dist/conform.d.ts.map +1 -0
- package/dist/conform.js +152 -0
- package/dist/conform.js.map +1 -0
- package/dist/console.d.ts +285 -0
- package/dist/console.d.ts.map +1 -0
- package/dist/console.js +686 -0
- package/dist/console.js.map +1 -0
- package/dist/console.types.json +1730 -0
- package/dist/extract.d.ts +37 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +272 -0
- package/dist/extract.js.map +1 -0
- package/dist/fake.d.ts +58 -0
- package/dist/fake.d.ts.map +1 -0
- package/dist/fake.js +164 -0
- package/dist/fake.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +905 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +15 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +507 -0
- package/dist/mcp.js.map +1 -0
- package/dist/network.d.ts +58 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +64 -0
- package/dist/network.js.map +1 -0
- package/dist/record.d.ts +74 -0
- package/dist/record.d.ts.map +1 -0
- package/dist/record.js +221 -0
- package/dist/record.js.map +1 -0
- package/dist/tapping.d.ts +11 -0
- package/dist/tapping.d.ts.map +1 -0
- package/dist/tapping.js +71 -0
- package/dist/tapping.js.map +1 -0
- package/dist/verbs.d.ts +59 -0
- package/dist/verbs.d.ts.map +1 -0
- package/dist/verbs.js +324 -0
- package/dist/verbs.js.map +1 -0
- package/dist/web/app.css +1 -0
- package/dist/web/app.js +2063 -0
- package/dist/web/app.js.map +1 -0
- package/dist/web/index.html +13 -0
- package/package.json +65 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Node, Type } from 'ts-morph';
|
|
2
|
+
import type { RpcSchema, TypeNode } from '@source-repo/rpc';
|
|
3
|
+
/**
|
|
4
|
+
* Reads a contract out of TypeScript source.
|
|
5
|
+
*
|
|
6
|
+
* The rule that keeps this honest: anything the type language cannot represent is reported, never
|
|
7
|
+
* emitted as `any`. A schema that quietly degrades on the hard cases is worse than no schema,
|
|
8
|
+
* because it still looks like protection while checking nothing.
|
|
9
|
+
*
|
|
10
|
+
* Static analysis only - no user code is executed - so the namespace has to be declared in the
|
|
11
|
+
* source with @rpcNamespace rather than inferred from an exposeClassInstance call somewhere else.
|
|
12
|
+
*/
|
|
13
|
+
export interface Diagnostic {
|
|
14
|
+
/** Where the problem is, e.g. "Plant.writeSetpoint argument 0". */
|
|
15
|
+
where: string;
|
|
16
|
+
reason: string;
|
|
17
|
+
file?: string;
|
|
18
|
+
line?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ExtractResult {
|
|
21
|
+
schema: RpcSchema;
|
|
22
|
+
diagnostics: Diagnostic[];
|
|
23
|
+
}
|
|
24
|
+
interface Context {
|
|
25
|
+
types: {
|
|
26
|
+
[name: string]: TypeNode;
|
|
27
|
+
};
|
|
28
|
+
diagnostics: Diagnostic[];
|
|
29
|
+
/** Named types currently being converted, so a recursive one becomes a ref instead of looping. */
|
|
30
|
+
inProgress: Set<string>;
|
|
31
|
+
where: string;
|
|
32
|
+
node: Node;
|
|
33
|
+
}
|
|
34
|
+
export declare const typeToNode: (type: Type, context: Context, depth?: number) => TypeNode;
|
|
35
|
+
export declare const extractSchema: (tsConfigFilePath: string) => ExtractResult;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,IAAI,EAAe,IAAI,EAAE,MAAM,UAAU,CAAA;AACvF,OAAO,KAAK,EAAqD,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE9G;;;;;;;;;GASG;AAEH,MAAM,WAAW,UAAU;IACvB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,SAAS,CAAA;IACjB,WAAW,EAAE,UAAU,EAAE,CAAA;CAC5B;AAED,UAAU,OAAO;IACb,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;IACnC,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,kGAAkG;IAClG,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,IAAI,CAAA;CACb;AA4BD,eAAO,MAAM,UAAU,SAAU,IAAI,WAAW,OAAO,qBAAc,QA4CpE,CAAA;AAkJD,eAAO,MAAM,aAAa,qBAAsB,MAAM,KAAG,aAiDxD,CAAA"}
|
package/dist/extract.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { resolve as resolvePath, dirname } from 'node:path';
|
|
2
|
+
import { Node, Project, ts } from 'ts-morph';
|
|
3
|
+
const fail = (context, reason) => {
|
|
4
|
+
context.diagnostics.push({
|
|
5
|
+
where: context.where,
|
|
6
|
+
reason,
|
|
7
|
+
file: context.node.getSourceFile().getFilePath(),
|
|
8
|
+
line: context.node.getStartLineNumber()
|
|
9
|
+
});
|
|
10
|
+
// Returned so extraction can continue and report everything at once. The caller refuses the
|
|
11
|
+
// whole run when any diagnostic was raised, so this never reaches a schema file.
|
|
12
|
+
return { kind: 'any' };
|
|
13
|
+
};
|
|
14
|
+
/** The name to key a shared or recursive type under, or undefined for an anonymous shape. */
|
|
15
|
+
const nameOf = (type) => {
|
|
16
|
+
// An instantiated generic has a symbol but not a usable name: Record<string, number> and
|
|
17
|
+
// Record<string, string> share the symbol `Record`, so keying both under it would silently make
|
|
18
|
+
// the second a reference to the first's value type. Inline them instead.
|
|
19
|
+
if (type.getAliasTypeArguments().length || type.getTypeArguments().length)
|
|
20
|
+
return undefined;
|
|
21
|
+
const alias = type.getAliasSymbol()?.getName();
|
|
22
|
+
if (alias && alias !== '__type')
|
|
23
|
+
return alias;
|
|
24
|
+
const symbol = type.getSymbol()?.getName();
|
|
25
|
+
return symbol && symbol !== '__type' && symbol !== '__object' ? symbol : undefined;
|
|
26
|
+
};
|
|
27
|
+
const isPromise = (type) => type.getSymbol()?.getName() === 'Promise';
|
|
28
|
+
export const typeToNode = (type, context, depth = 0) => {
|
|
29
|
+
if (depth > 24)
|
|
30
|
+
return fail(context, 'nests deeper than the extractor follows');
|
|
31
|
+
if (type.isAny() || type.isUnknown())
|
|
32
|
+
return { kind: 'any' };
|
|
33
|
+
if (type.isTypeParameter())
|
|
34
|
+
return fail(context, `is generic (${type.getText()}), which has no runtime type to check`);
|
|
35
|
+
if (type.getCallSignatures().length)
|
|
36
|
+
return fail(context, 'is a function, which cannot be checked on the wire');
|
|
37
|
+
if (type.isString())
|
|
38
|
+
return { kind: 'string' };
|
|
39
|
+
if (type.isNumber())
|
|
40
|
+
return { kind: 'number' };
|
|
41
|
+
if (type.isBoolean())
|
|
42
|
+
return { kind: 'boolean' };
|
|
43
|
+
if (type.isNull())
|
|
44
|
+
return { kind: 'null' };
|
|
45
|
+
if (type.isStringLiteral())
|
|
46
|
+
return { kind: 'literal', value: type.getLiteralValue() };
|
|
47
|
+
if (type.isNumberLiteral())
|
|
48
|
+
return { kind: 'literal', value: type.getLiteralValue() };
|
|
49
|
+
if (type.isBooleanLiteral())
|
|
50
|
+
return { kind: 'literal', value: type.getText() === 'true' };
|
|
51
|
+
const symbolName = type.getSymbol()?.getName();
|
|
52
|
+
// Both are values under MsgPack rather than encodings of them.
|
|
53
|
+
if (symbolName === 'Date')
|
|
54
|
+
return { kind: 'date' };
|
|
55
|
+
if (symbolName === 'Uint8Array')
|
|
56
|
+
return { kind: 'bytes' };
|
|
57
|
+
if (symbolName === 'Map' || symbolName === 'Set')
|
|
58
|
+
return fail(context, `is a ${symbolName}, which MsgPack does not carry; use an object or an array`);
|
|
59
|
+
if (type.isTuple())
|
|
60
|
+
return { kind: 'tuple', items: type.getTupleElements().map((element) => typeToNode(element, context, depth + 1)) };
|
|
61
|
+
if (type.isArray()) {
|
|
62
|
+
const element = type.getArrayElementType();
|
|
63
|
+
return element ? { kind: 'array', items: typeToNode(element, context, depth + 1) } : fail(context, 'is an array of an unknown element type');
|
|
64
|
+
}
|
|
65
|
+
// A named union or object becomes a reference. Registering only objects meant a recursive
|
|
66
|
+
// union - a value type, an AST node - was expanded inline until it ran out of depth.
|
|
67
|
+
const name = nameOf(type);
|
|
68
|
+
if (name && (type.isUnion() || type.isObject())) {
|
|
69
|
+
if (context.inProgress.has(name) || context.types[name])
|
|
70
|
+
return { kind: 'ref', name };
|
|
71
|
+
context.inProgress.add(name);
|
|
72
|
+
context.types[name] = { kind: 'any' }; // placeholder, so a member referring back resolves
|
|
73
|
+
context.types[name] = type.isUnion() ? unionToNode(type, context, depth) : objectToNode(type, context, depth);
|
|
74
|
+
context.inProgress.delete(name);
|
|
75
|
+
return { kind: 'ref', name };
|
|
76
|
+
}
|
|
77
|
+
if (type.isUnion())
|
|
78
|
+
return unionToNode(type, context, depth);
|
|
79
|
+
if (type.isObject())
|
|
80
|
+
return objectToNode(type, context, depth);
|
|
81
|
+
return fail(context, `has no representation in the schema type language (${type.getText()})`);
|
|
82
|
+
};
|
|
83
|
+
const unionToNode = (type, context, depth) => {
|
|
84
|
+
// undefined in a union means optional, which the parameter and field layers handle.
|
|
85
|
+
const options = type.getUnionTypes().filter((option) => !option.isUndefined());
|
|
86
|
+
if (!options.length)
|
|
87
|
+
return fail(context, 'is undefined only');
|
|
88
|
+
if (options.length === 1)
|
|
89
|
+
return typeToNode(options[0], context, depth + 1);
|
|
90
|
+
// A boolean surfaces as true | false; collapse it back.
|
|
91
|
+
if (options.length === 2 && options.every((option) => option.isBooleanLiteral()))
|
|
92
|
+
return { kind: 'boolean' };
|
|
93
|
+
return { kind: 'union', options: options.map((option) => typeToNode(option, context, depth + 1)) };
|
|
94
|
+
};
|
|
95
|
+
const objectToNode = (type, context, depth) => {
|
|
96
|
+
// getProperties() cannot see an index signature, so a dictionary has to be recognised here or
|
|
97
|
+
// it would be described as an object permitting no properties at all, refusing every value.
|
|
98
|
+
const indexed = type.getStringIndexType() ?? type.getNumberIndexType();
|
|
99
|
+
if (indexed) {
|
|
100
|
+
// Both at once would need a type that is part record and part object. Refused rather than
|
|
101
|
+
// guessed: dropping either half produces a contract that looks checked and is not.
|
|
102
|
+
if (type.getProperties().length)
|
|
103
|
+
return fail(context, 'has both declared properties and an index signature, which the schema type language cannot describe yet');
|
|
104
|
+
// A numeric index is still a string key on the wire, since JS object keys always are.
|
|
105
|
+
const numeric = !type.getStringIndexType();
|
|
106
|
+
return { kind: 'record', values: typeToNode(indexed, context, depth + 1), ...(numeric ? { keyPattern: '^-?\\d+$' } : {}) };
|
|
107
|
+
}
|
|
108
|
+
const fields = {};
|
|
109
|
+
for (const property of type.getProperties()) {
|
|
110
|
+
const propertyType = property.getTypeAtLocation(context.node);
|
|
111
|
+
const optional = property.isOptional() || propertyType.isNullable();
|
|
112
|
+
const nested = { ...context, where: `${context.where}.${property.getName()}` };
|
|
113
|
+
fields[property.getName()] = { type: typeToNode(propertyType, nested, depth + 1), ...(optional ? { optional: true } : {}) };
|
|
114
|
+
}
|
|
115
|
+
return { kind: 'object', fields };
|
|
116
|
+
};
|
|
117
|
+
const hasDecorator = (node, name) => node.getDecorators().some((decorator) => decorator.getName() === name);
|
|
118
|
+
/** A string property of an object literal passed to a decorator, when it is written as a literal. */
|
|
119
|
+
const literalOption = (argument, option) => {
|
|
120
|
+
if (!Node.isObjectLiteralExpression(argument))
|
|
121
|
+
return undefined;
|
|
122
|
+
const property = argument.getProperty(option);
|
|
123
|
+
if (!Node.isPropertyAssignment(property))
|
|
124
|
+
return undefined;
|
|
125
|
+
const initializer = property.getInitializer();
|
|
126
|
+
return Node.isStringLiteral(initializer) ? initializer.getLiteralValue() : undefined;
|
|
127
|
+
};
|
|
128
|
+
const SEMANTICS = new Set(['query', 'idempotent-command', 'non-repeatable-command']);
|
|
129
|
+
/**
|
|
130
|
+
* What `@rpc({ semantics: '…' })` declares, if anything.
|
|
131
|
+
*
|
|
132
|
+
* Part of the contract rather than of the implementation: it is a promise about whether a caller
|
|
133
|
+
* may repeat the call, and `check` compares it between versions like any other part of the shape.
|
|
134
|
+
*/
|
|
135
|
+
const declaredSemantics = (method, context) => {
|
|
136
|
+
const decorator = method.getDecorators().find((candidate) => candidate.getName() === 'rpc');
|
|
137
|
+
const declared = literalOption(decorator?.getArguments()[0], 'semantics');
|
|
138
|
+
if (declared === undefined)
|
|
139
|
+
return undefined;
|
|
140
|
+
if (!SEMANTICS.has(declared)) {
|
|
141
|
+
// Named rather than dropped: a typo here would quietly publish a contract saying nothing
|
|
142
|
+
// about a method whose author thought they had said something about it.
|
|
143
|
+
context.diagnostics.push({
|
|
144
|
+
where: context.where,
|
|
145
|
+
reason: `declares semantics '${declared}', which is not one of ${[...SEMANTICS].join(', ')}`,
|
|
146
|
+
file: method.getSourceFile().getFilePath(),
|
|
147
|
+
line: method.getStartLineNumber()
|
|
148
|
+
});
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return declared;
|
|
152
|
+
};
|
|
153
|
+
const namespaceDeclaration = (declaration) => {
|
|
154
|
+
const decorator = declaration.getDecorators().find((candidate) => candidate.getName() === 'rpcNamespace');
|
|
155
|
+
if (!decorator)
|
|
156
|
+
return undefined;
|
|
157
|
+
const [nameArgument, optionsArgument] = decorator.getArguments();
|
|
158
|
+
const name = Node.isStringLiteral(nameArgument) ? nameArgument.getLiteralValue() : undefined;
|
|
159
|
+
if (!name)
|
|
160
|
+
return undefined;
|
|
161
|
+
let version;
|
|
162
|
+
if (Node.isObjectLiteralExpression(optionsArgument)) {
|
|
163
|
+
const property = optionsArgument.getProperty('version');
|
|
164
|
+
if (Node.isPropertyAssignment(property)) {
|
|
165
|
+
const initializer = property.getInitializer();
|
|
166
|
+
if (Node.isStringLiteral(initializer))
|
|
167
|
+
version = initializer.getLiteralValue();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { name, version };
|
|
171
|
+
};
|
|
172
|
+
const methodToSchema = (method, context) => {
|
|
173
|
+
const params = [];
|
|
174
|
+
const paramNames = [];
|
|
175
|
+
let rest;
|
|
176
|
+
for (const parameter of method.getParameters()) {
|
|
177
|
+
const at = { ...context, where: `${context.where} argument ${params.length}`, node: parameter };
|
|
178
|
+
if (parameter.isRestParameter()) {
|
|
179
|
+
const element = parameter.getType().getArrayElementType();
|
|
180
|
+
rest = element ? typeToNode(element, at) : fail(at, 'is a rest parameter of an unknown element type');
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const node = typeToNode(parameter.getType(), at);
|
|
184
|
+
// An optional parameter is expressed as a union admitting null, which is what the
|
|
185
|
+
// validator reads to decide how few arguments a caller may send.
|
|
186
|
+
params.push(parameter.isOptional() ? { kind: 'union', options: [node, { kind: 'literal', value: null }] } : node);
|
|
187
|
+
paramNames.push(parameter.getName());
|
|
188
|
+
}
|
|
189
|
+
let returnType = method.getReturnType();
|
|
190
|
+
if (isPromise(returnType))
|
|
191
|
+
returnType = returnType.getTypeArguments()[0] ?? returnType;
|
|
192
|
+
const returns = returnType.isVoid() || returnType.isUndefined() ? undefined : typeToNode(returnType, { ...context, where: `${context.where} return` });
|
|
193
|
+
const semantics = declaredSemantics(method, context);
|
|
194
|
+
return {
|
|
195
|
+
params,
|
|
196
|
+
...(paramNames.length ? { paramNames } : {}),
|
|
197
|
+
...(rest ? { rest } : {}),
|
|
198
|
+
...(returns ? { returns } : {}),
|
|
199
|
+
...(semantics ? { semantics } : {})
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Events are declared as a property type rather than inferred from emit() calls, which cannot be
|
|
204
|
+
* read statically with any confidence:
|
|
205
|
+
*
|
|
206
|
+
* ```typescript
|
|
207
|
+
* declare rpcEvents: { alarm: [message: string] }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
const eventsFromDeclaration = (declaration, context) => {
|
|
211
|
+
const property = declaration.getProperty('rpcEvents');
|
|
212
|
+
if (!property)
|
|
213
|
+
return undefined;
|
|
214
|
+
const events = {};
|
|
215
|
+
for (const event of property.getType().getProperties()) {
|
|
216
|
+
const at = { ...context, where: `${context.where} event ${event.getName()}`, node: property };
|
|
217
|
+
const tuple = event.getTypeAtLocation(property);
|
|
218
|
+
if (!tuple.isTuple()) {
|
|
219
|
+
fail(at, 'must be declared as a tuple of its arguments, e.g. [message: string]');
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
events[event.getName()] = { params: tuple.getTupleElements().map((element) => typeToNode(element, at)) };
|
|
223
|
+
}
|
|
224
|
+
return Object.keys(events).length ? events : undefined;
|
|
225
|
+
};
|
|
226
|
+
export const extractSchema = (tsConfigFilePath) => {
|
|
227
|
+
const project = new Project({ tsConfigFilePath });
|
|
228
|
+
// Exactly what include/files/exclude resolve to, asked of TypeScript rather than inferred.
|
|
229
|
+
// Resolving types pulls dependencies into the project, and `extract --project` should describe
|
|
230
|
+
// this project rather than every decorated class it happens to import.
|
|
231
|
+
const configured = ts.parseJsonConfigFileContent(ts.readConfigFile(tsConfigFilePath, ts.sys.readFile).config, ts.sys, dirname(resolvePath(tsConfigFilePath)));
|
|
232
|
+
const own = new Set(configured.fileNames.map((file) => resolvePath(file)));
|
|
233
|
+
const diagnostics = [];
|
|
234
|
+
const types = {};
|
|
235
|
+
const namespaces = {};
|
|
236
|
+
for (const sourceFile of project.getSourceFiles().filter((file) => own.has(resolvePath(file.getFilePath())))) {
|
|
237
|
+
for (const declaration of sourceFile.getClasses()) {
|
|
238
|
+
const declared = namespaceDeclaration(declaration);
|
|
239
|
+
if (!declared)
|
|
240
|
+
continue;
|
|
241
|
+
const methods = {};
|
|
242
|
+
const context = { types, diagnostics, inProgress: new Set(), where: declaration.getName() ?? 'class', node: declaration };
|
|
243
|
+
for (const method of declaration.getMethods()) {
|
|
244
|
+
if (!hasDecorator(method, 'rpc'))
|
|
245
|
+
continue;
|
|
246
|
+
methods[method.getName()] = methodToSchema(method, { ...context, where: `${declared.name}.${method.getName()}`, node: method });
|
|
247
|
+
}
|
|
248
|
+
if (!Object.keys(methods).length) {
|
|
249
|
+
diagnostics.push({
|
|
250
|
+
where: declared.name,
|
|
251
|
+
reason: 'declares @rpcNamespace but marks no @rpc methods, so it would expose nothing',
|
|
252
|
+
file: sourceFile.getFilePath(),
|
|
253
|
+
line: declaration.getStartLineNumber()
|
|
254
|
+
});
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const events = eventsFromDeclaration(declaration, { ...context, where: declared.name });
|
|
258
|
+
namespaces[declared.name] = { ...(declared.version ? { version: declared.version } : {}), methods, ...(events ? { events } : {}) };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// One unrepresentable type reaches every leaf beneath it, so the same complaint repeats.
|
|
262
|
+
const seen = new Set();
|
|
263
|
+
const unique = diagnostics.filter((diagnostic) => {
|
|
264
|
+
const key = `${diagnostic.where}|${diagnostic.reason}`;
|
|
265
|
+
if (seen.has(key))
|
|
266
|
+
return false;
|
|
267
|
+
seen.add(key);
|
|
268
|
+
return true;
|
|
269
|
+
});
|
|
270
|
+
return { schema: { schema: 1, ...(Object.keys(types).length ? { types } : {}), namespaces }, diagnostics: unique };
|
|
271
|
+
};
|
|
272
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAuC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAQ,MAAM,UAAU,CAAA;AAoCvF,MAAM,IAAI,GAAG,CAAC,OAAgB,EAAE,MAAc,EAAY,EAAE;IACxD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;QACrB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE;QAChD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;KAC1C,CAAC,CAAA;IACF,4FAA4F;IAC5F,iFAAiF;IACjF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC,CAAA;AAED,6FAA6F;AAC7F,MAAM,MAAM,GAAG,CAAC,IAAU,EAAE,EAAE;IAC1B,yFAAyF;IACzF,gGAAgG;IAChG,yEAAyE;IACzE,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC,MAAM;QAAE,OAAO,SAAS,CAAA;IAC3F,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,CAAA;IAC9C,IAAI,KAAK,IAAI,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAA;IAC1C,OAAO,MAAM,I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OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;YACvF,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;QACtI,CAAC;IACL,CAAC;IAED,yFAAyF;IACzF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAC7C,MAAM,GAAG,GAAG,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,CAAA;QACtD,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAA;QAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACb,OAAO,IAAI,CAAA;IACf,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAA;AACtH,CAAC,CAAA"}
|
package/dist/fake.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { RpcServer, type RpcSchema, type TypeNode } from '@source-repo/rpc';
|
|
2
|
+
import { type NetworkOptions } from './network.js';
|
|
3
|
+
/**
|
|
4
|
+
* A peer built from a contract rather than from code: it answers every method the contract declares
|
|
5
|
+
* with a value of the declared shape, and refuses a call the contract would refuse.
|
|
6
|
+
*
|
|
7
|
+
* The point is to have something to develop against. An HMI cannot be worked on without the plant
|
|
8
|
+
* it talks to, a console cannot be exercised without a peer to select, and a test that needs a
|
|
9
|
+
* device which times out or throws needs a device willing to do that on request - which a real one
|
|
10
|
+
* is not. The contract is already extracted and committed for the deployed peer, so standing a
|
|
11
|
+
* stand-in up from it costs nothing and cannot drift: `source-rpc check` fails the build if it does.
|
|
12
|
+
*
|
|
13
|
+
* Generated values are deterministic. A fake whose readings wander is nicer to look at and useless
|
|
14
|
+
* to assert on, and `--script` is there for when a particular answer is what the test needs.
|
|
15
|
+
*/
|
|
16
|
+
/** Canned answers, deliberate failures and events on a timer. All optional. */
|
|
17
|
+
export interface FakeScript {
|
|
18
|
+
/** `plant.read` -> the value to answer with, instead of one generated from the contract. */
|
|
19
|
+
returns?: {
|
|
20
|
+
[target: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* `plant.writeSetpoint` -> an RPC error code to answer with: Exception, Unauthorized,
|
|
24
|
+
* InvalidParams, and so on. `Timeout` is the special one - the call is never answered at all,
|
|
25
|
+
* which is the failure an HMI handles worst and can otherwise only be staged by pulling a cable.
|
|
26
|
+
*/
|
|
27
|
+
fails?: {
|
|
28
|
+
[target: string]: string;
|
|
29
|
+
};
|
|
30
|
+
/** Events to emit on a timer, for the receiving end of an HMI that has nothing to receive. */
|
|
31
|
+
emits?: {
|
|
32
|
+
event: string;
|
|
33
|
+
every: number;
|
|
34
|
+
params?: unknown[];
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
export interface FakeOptions extends NetworkOptions {
|
|
38
|
+
/** The contract to serve. Every namespace in it is exposed. */
|
|
39
|
+
schema: RpcSchema;
|
|
40
|
+
script?: FakeScript;
|
|
41
|
+
}
|
|
42
|
+
/** Whether something handed over as a contract is one, so the wrong object is refused kindly. */
|
|
43
|
+
export declare const looksLikeSchema: (value: unknown) => value is RpcSchema;
|
|
44
|
+
/**
|
|
45
|
+
* A value of the declared shape.
|
|
46
|
+
*
|
|
47
|
+
* Bounds are honoured where the type language carries them, because a fake that answers 3000 where
|
|
48
|
+
* the contract says 0..2000 would be refused by the very validator this exists to exercise. What it
|
|
49
|
+
* cannot honour is `pattern`: satisfying an arbitrary regular expression is a different problem, so
|
|
50
|
+
* a constrained string comes back as the placeholder and is documented as such.
|
|
51
|
+
*/
|
|
52
|
+
export declare const sampleFor: (type: TypeNode | undefined, types: RpcSchema['types'], seen?: Set<string>, depth?: number) => unknown;
|
|
53
|
+
export declare const startFake: (options: FakeOptions) => Promise<{
|
|
54
|
+
network: RpcServer;
|
|
55
|
+
namespaces: string[];
|
|
56
|
+
close: () => Promise<void>;
|
|
57
|
+
}>;
|
|
58
|
+
//# sourceMappingURL=fake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake.d.ts","sourceRoot":"","sources":["../src/fake.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAErE;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IACvB,4FAA4F;IAC5F,OAAO,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACpC,8FAA8F;IAC9F,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;KAAE,EAAE,CAAA;CACjE;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IAC/C,+DAA+D;IAC/D,MAAM,EAAE,SAAS,CAAA;IACjB,MAAM,CAAC,EAAE,UAAU,CAAA;CACtB;AAED,iGAAiG;AACjG,eAAO,MAAM,eAAe,UAAW,OAAO,KAAG,KAAK,IAAI,SAC0E,CAAA;AAcpI;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,SAAU,QAAQ,GAAG,SAAS,SAAS,SAAS,CAAC,OAAO,CAAC,SAAQ,GAAG,CAAC,MAAM,CAAC,qBAA0B,OA8D3H,CAAA;AA8BD,eAAO,MAAM,SAAS,YAAmB,WAAW;;;;EA6CnD,CAAA"}
|
package/dist/fake.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { RpcServer } from '@source-repo/rpc';
|
|
3
|
+
import { networkTransports } from './network.js';
|
|
4
|
+
/** Whether something handed over as a contract is one, so the wrong object is refused kindly. */
|
|
5
|
+
export const looksLikeSchema = (value) => !!value && typeof value === 'object' && !!value.namespaces && typeof value.namespaces === 'object';
|
|
6
|
+
/** The code that means "never answer" rather than "answer with this error". */
|
|
7
|
+
const NEVER_ANSWERS = 'Timeout';
|
|
8
|
+
/**
|
|
9
|
+
* How deep a generated value goes before it stops. A recursive type - the schema's own TypeNode is
|
|
10
|
+
* one - would otherwise descend forever, and a sample twenty levels down says nothing a sample two
|
|
11
|
+
* levels down does not.
|
|
12
|
+
*/
|
|
13
|
+
const MAX_DEPTH = 6;
|
|
14
|
+
const SAMPLE_TEXT = 'sample';
|
|
15
|
+
/**
|
|
16
|
+
* A value of the declared shape.
|
|
17
|
+
*
|
|
18
|
+
* Bounds are honoured where the type language carries them, because a fake that answers 3000 where
|
|
19
|
+
* the contract says 0..2000 would be refused by the very validator this exists to exercise. What it
|
|
20
|
+
* cannot honour is `pattern`: satisfying an arbitrary regular expression is a different problem, so
|
|
21
|
+
* a constrained string comes back as the placeholder and is documented as such.
|
|
22
|
+
*/
|
|
23
|
+
export const sampleFor = (type, types, seen = new Set(), depth = 0) => {
|
|
24
|
+
if (!type || depth > MAX_DEPTH)
|
|
25
|
+
return null;
|
|
26
|
+
switch (type.kind) {
|
|
27
|
+
case 'any':
|
|
28
|
+
case 'null':
|
|
29
|
+
return null;
|
|
30
|
+
case 'boolean':
|
|
31
|
+
return true;
|
|
32
|
+
case 'number': {
|
|
33
|
+
// Inside the declared range, and the low end of it when only one side is given: a
|
|
34
|
+
// setpoint that starts at its maximum is a surprising thing for a fake to assert.
|
|
35
|
+
if (type.min !== undefined && type.max !== undefined) {
|
|
36
|
+
const middle = (type.min + type.max) / 2;
|
|
37
|
+
return type.integer ? Math.round(middle) : middle;
|
|
38
|
+
}
|
|
39
|
+
const value = type.min ?? (type.max !== undefined ? Math.min(0, type.max) : 0);
|
|
40
|
+
return type.integer ? Math.round(value) : value;
|
|
41
|
+
}
|
|
42
|
+
case 'string': {
|
|
43
|
+
let text = SAMPLE_TEXT;
|
|
44
|
+
if (type.minLength !== undefined && text.length < type.minLength)
|
|
45
|
+
text = text.padEnd(type.minLength, 'x');
|
|
46
|
+
if (type.maxLength !== undefined && text.length > type.maxLength)
|
|
47
|
+
text = text.slice(0, type.maxLength);
|
|
48
|
+
return text;
|
|
49
|
+
}
|
|
50
|
+
case 'bytes':
|
|
51
|
+
return Uint8Array.from([0x00, 0x01, 0x02, 0x03].slice(0, type.maxBytes ?? 4));
|
|
52
|
+
case 'date':
|
|
53
|
+
// The one value that is not fixed. A device reporting the epoch reads as a broken clock.
|
|
54
|
+
return new Date();
|
|
55
|
+
case 'literal':
|
|
56
|
+
return type.value;
|
|
57
|
+
case 'array':
|
|
58
|
+
return type.maxItems === 0 ? [] : [sampleFor(type.items, types, seen, depth + 1)];
|
|
59
|
+
case 'tuple':
|
|
60
|
+
return type.items.map((item) => sampleFor(item, types, seen, depth + 1));
|
|
61
|
+
case 'object':
|
|
62
|
+
// Required fields only, the same rule the console's argument forms use when they
|
|
63
|
+
// pre-fill a shape: an optional field is optional, and inventing one is not more honest.
|
|
64
|
+
return Object.fromEntries(Object.entries(type.fields)
|
|
65
|
+
.filter(([, field]) => !field.optional)
|
|
66
|
+
.map(([name, field]) => [name, sampleFor(field.type, types, seen, depth + 1)]));
|
|
67
|
+
case 'record':
|
|
68
|
+
// A key pattern cannot be satisfied in general, and an empty dictionary is a valid one.
|
|
69
|
+
if (type.keyPattern || type.maxEntries === 0)
|
|
70
|
+
return {};
|
|
71
|
+
return { [SAMPLE_TEXT]: sampleFor(type.values, types, seen, depth + 1) };
|
|
72
|
+
case 'union': {
|
|
73
|
+
// The first option that is not the null half of an optional: `mode?: 'auto' | 'manual'`
|
|
74
|
+
// should come back as 'auto' rather than as nothing at all.
|
|
75
|
+
const options = type.options.filter((option) => !(option.kind === 'literal' && option.value === null));
|
|
76
|
+
return sampleFor(options[0] ?? type.options[0], types, seen, depth + 1);
|
|
77
|
+
}
|
|
78
|
+
case 'ref': {
|
|
79
|
+
// Broken on the way back round: a type that contains itself has no finite sample.
|
|
80
|
+
if (seen.has(type.name))
|
|
81
|
+
return null;
|
|
82
|
+
const resolved = types?.[type.name];
|
|
83
|
+
return sampleFor(resolved, types, new Set([...seen, type.name]), depth + 1);
|
|
84
|
+
}
|
|
85
|
+
default:
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* One namespace as an object whose own properties are its methods.
|
|
91
|
+
*
|
|
92
|
+
* An EventEmitter, because the RPC layer only accepts a subscription to an instance that is one,
|
|
93
|
+
* and the methods are own properties because that is what `exposeObject` publishes - a plain
|
|
94
|
+
* object's methods are invisible to `exposeClassInstance`, which reads the prototype chain.
|
|
95
|
+
*/
|
|
96
|
+
class Fake extends EventEmitter {
|
|
97
|
+
}
|
|
98
|
+
const buildNamespace = (name, namespace, types, script) => {
|
|
99
|
+
// Named, so a console describing this peer says `Fake` where a real one names its class. That
|
|
100
|
+
// line is the only place the browser says out loud that it is not talking to a device.
|
|
101
|
+
const instance = new Fake();
|
|
102
|
+
for (const [method, described] of Object.entries(namespace.methods)) {
|
|
103
|
+
const target = `${name}.${method}`;
|
|
104
|
+
instance[method] = async () => {
|
|
105
|
+
const failure = script?.fails?.[target];
|
|
106
|
+
// Never answered rather than answered with a timeout: a caller has to see the call go
|
|
107
|
+
// unanswered for its own timeout to be what fires, which is the behaviour being staged.
|
|
108
|
+
if (failure === NEVER_ANSWERS)
|
|
109
|
+
return await new Promise(() => { });
|
|
110
|
+
if (failure)
|
|
111
|
+
throw Object.assign(new Error(`${target} is set to fail`), { code: failure });
|
|
112
|
+
if (script?.returns && target in script.returns)
|
|
113
|
+
return script.returns[target];
|
|
114
|
+
return sampleFor(described.returns, types);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return instance;
|
|
118
|
+
};
|
|
119
|
+
export const startFake = async (options) => {
|
|
120
|
+
const namespaces = Object.entries(options.schema.namespaces).filter(([name]) => name !== 'msgrpc');
|
|
121
|
+
if (!namespaces.length)
|
|
122
|
+
throw new Error('startFake: the contract describes no namespaces to serve');
|
|
123
|
+
// Built here rather than through connectNetwork, which makes a window onto the network; this
|
|
124
|
+
// one is a peer that serves. The schema is handed over so the fake refuses exactly what the real
|
|
125
|
+
// peer would - a stand-in that accepts calls the device rejects teaches the wrong lesson.
|
|
126
|
+
const network = new RpcServer({
|
|
127
|
+
name: options.name,
|
|
128
|
+
callTimeout: options.callTimeout,
|
|
129
|
+
readyTimeout: 15000,
|
|
130
|
+
schema: options.schema,
|
|
131
|
+
exposeIntrospection: true,
|
|
132
|
+
transports: networkTransports(options)
|
|
133
|
+
});
|
|
134
|
+
const instances = new Map();
|
|
135
|
+
for (const [name, namespace] of namespaces) {
|
|
136
|
+
const instance = buildNamespace(name, namespace, options.schema.types, options.script);
|
|
137
|
+
network.exposeObject(instance, name);
|
|
138
|
+
instances.set(name, instance);
|
|
139
|
+
}
|
|
140
|
+
await network.ready();
|
|
141
|
+
// Emitted on a timer, with parameters of the declared shape unless the script supplies them.
|
|
142
|
+
const timers = (options.script?.emits ?? []).map((emit) => {
|
|
143
|
+
const dot = emit.event.lastIndexOf('.');
|
|
144
|
+
const namespace = dot > 0 ? emit.event.slice(0, dot) : '';
|
|
145
|
+
const event = dot > 0 ? emit.event.slice(dot + 1) : emit.event;
|
|
146
|
+
const instance = instances.get(namespace);
|
|
147
|
+
if (!instance)
|
|
148
|
+
throw new Error(`startFake: nothing called '${namespace}' to emit ${emit.event} from`);
|
|
149
|
+
const declared = options.schema.namespaces[namespace]?.events?.[event];
|
|
150
|
+
const params = emit.params ?? (declared?.params ?? []).map((type) => sampleFor(type, options.schema.types));
|
|
151
|
+
// Unref'd: a fake with an emitter should not be the reason a process refuses to exit.
|
|
152
|
+
return setInterval(() => instance.emit(event, ...params), Math.max(emit.every, 50)).unref();
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
network,
|
|
156
|
+
namespaces: namespaces.map(([name]) => name),
|
|
157
|
+
close: async () => {
|
|
158
|
+
for (const timer of timers)
|
|
159
|
+
clearInterval(timer);
|
|
160
|
+
await network.close();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=fake.js.map
|
package/dist/fake.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake.js","sourceRoot":"","sources":["../src/fake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,SAAS,EAAuD,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,iBAAiB,EAAuB,MAAM,cAAc,CAAA;AAoCrE,iGAAiG;AACjG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAAsB,EAAE,CAClE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAE,KAAmB,CAAC,UAAU,IAAI,OAAQ,KAAmB,CAAC,UAAU,KAAK,QAAQ,CAAA;AAEpI,+EAA+E;AAC/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