@reeve-iot/workflow-client 0.0.0-stage → 1.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 +77 -2
- package/dist/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +86 -0
- package/dist/client.js.map +1 -0
- package/dist/generate.d.ts +35 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +141 -0
- package/dist/generate.js.map +1 -0
- package/dist/generated/editor.d.ts +271 -0
- package/dist/generated/editor.d.ts.map +1 -0
- package/dist/generated/editor.js +14 -0
- package/dist/generated/editor.js.map +1 -0
- package/dist/generated/types.d.ts +495 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +17 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/surface.d.ts +42 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +20 -0
- package/dist/surface.js.map +1 -0
- package/package.json +43 -4
- package/surface.editor.json +979 -0
- package/surface.json +1450 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reeve Workflow Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @reeve-iot/workflow-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A typed HTTP client for the workflow endpoints that `ReeveWorkflow.AspNetCore` and `ReeveWorkflow.Editor` mount. The
|
|
4
|
+
types are not written by hand: the server publishes a description of its routing table and this package generates its
|
|
5
|
+
operations from it, so an endpoint that changes shape is a compile error here, not a surprise at run time. Part of
|
|
6
|
+
[Reeve Workflow](https://github.com/reeve-iot/reeve-workflow).
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @reeve-iot/workflow-client
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
No peer dependencies. The package holds no graph state, no editor and no design system, and
|
|
15
|
+
[`@reeve-iot/workflow-core`](https://github.com/reeve-iot/reeve-workflow/tree/main/packages/core) does not depend on it.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createWorkflowClient, WorkflowApiError } from '@reeve-iot/workflow-client'
|
|
21
|
+
|
|
22
|
+
const client = createWorkflowClient({
|
|
23
|
+
baseUrl: 'https://workflows.example.com',
|
|
24
|
+
headers: () => ({ Authorization: `Bearer ${token()}` }),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const workflows = await client.getWorkflows()
|
|
28
|
+
const detail = await client.getWorkflow({ id: workflows[0]!.id })
|
|
29
|
+
const page = await client.getExecutions({ id: detail.id, take: 25, hasErrors: true })
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The client has no auth, caching or retry policy of its own. `headers` is where a host puts its token (as a function if
|
|
33
|
+
the token expires), and `fetch` is where it wraps anything else.
|
|
34
|
+
|
|
35
|
+
`createWorkflowEditorClient` is the same for the write side (create, update, publish, roll back, versions, analysis).
|
|
36
|
+
`getPortTypes()` on it answers the port-type vocabulary the server's compiler enforces; `readPortTypeVocabulary` in
|
|
37
|
+
[`@reeve-iot/workflow-adapters`](https://github.com/reeve-iot/reeve-workflow/tree/main/packages/adapters) seeds an editor registry from it.
|
|
38
|
+
|
|
39
|
+
## Errors
|
|
40
|
+
|
|
41
|
+
Every non-2xx answer throws a `WorkflowApiError` carrying the status, the parsed body and the response headers: the
|
|
42
|
+
`ProblemDetails` the server sent, or the conflict shape for a 409. A body that is not JSON, which is what a gateway
|
|
43
|
+
tends to answer with, comes through as the raw text with its status intact.
|
|
44
|
+
|
|
45
|
+
- A 400 from publish, rollback or execute is a `CompilationProblemDetails` whose `diagnostics` are the compiler's; it
|
|
46
|
+
is empty when something else refused.
|
|
47
|
+
- A 503 carries `Retry-After` (`error.headers.get('Retry-After')`). From publish, rollback or `getVersionCompilation` it
|
|
48
|
+
means the server could not tell whether a version compiles: nothing was done and the same request may succeed
|
|
49
|
+
later. From execute it means the same and nothing ran; the refused start is kept as one failed run whose
|
|
50
|
+
`failureReason` is `compilation-unanswered`, which `hasErrors=true` lists.
|
|
51
|
+
- A 503 from a create, or from an update that asked to publish, means the save was stored but publishing could not be
|
|
52
|
+
finished. Its body (`WorkflowSaveUnpublishedProblemDetails`) carries the workflow and the draft the save left, so
|
|
53
|
+
publish that draft rather than send the create again.
|
|
54
|
+
|
|
55
|
+
A create or update that does not compile answers with the workflow and its `draftVersionId` set;
|
|
56
|
+
`getVersionCompilation({ versionId })` on the editor client gives that draft's diagnostics.
|
|
57
|
+
|
|
58
|
+
## Compilation sweep
|
|
59
|
+
|
|
60
|
+
`getInvalidCompilations({ skip, take })` checks a page of up to `take` (at most 50) of the caller's workflows that
|
|
61
|
+
have a current version; `invalid` is the subset that does not compile. Page by `totalCount` and never stop on a short
|
|
62
|
+
or empty `invalid`: the page compiles only when `failed` is empty too. It reads only the caller's own workflows; the
|
|
63
|
+
check over every workflow before a deploy is the server's `WorkflowCompilationSweepRunner.RunOnceAsync` (see
|
|
64
|
+
[docs/operations/upgrading.md](https://github.com/reeve-iot/reeve-workflow/blob/main/docs/operations/upgrading.md)).
|
|
65
|
+
|
|
66
|
+
## Where the types come from
|
|
67
|
+
|
|
68
|
+
`surface.json` and `surface.editor.json` are copies of what the server packages publish, and the typed operations in
|
|
69
|
+
`src/generated` are generated from them and committed. A test fails when the generated files and the surfaces
|
|
70
|
+
disagree.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
See the [main README](https://github.com/reeve-iot/reeve-workflow#readme) and [docs](https://github.com/reeve-iot/reeve-workflow/tree/main/docs).
|
|
75
|
+
|
|
76
|
+
## Licence
|
|
77
|
+
|
|
78
|
+
MIT.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { WorkflowOperations } from './generated/types.js';
|
|
2
|
+
import type { WorkflowEditorOperations } from './generated/editor.js';
|
|
3
|
+
/** The operations the Executor's surface declares, by name. */
|
|
4
|
+
export type WorkflowOperationName = keyof WorkflowOperations;
|
|
5
|
+
/** The operations the Editor's surface declares, by name. */
|
|
6
|
+
export type WorkflowEditorOperationName = keyof WorkflowEditorOperations;
|
|
7
|
+
type Operation = {
|
|
8
|
+
readonly args: unknown;
|
|
9
|
+
readonly result: unknown;
|
|
10
|
+
};
|
|
11
|
+
type OperationSet<Ops> = {
|
|
12
|
+
readonly [K in keyof Ops]: Operation;
|
|
13
|
+
};
|
|
14
|
+
type ArgsOf<Ops extends OperationSet<Ops>, K extends keyof Ops> = Ops[K]['args'];
|
|
15
|
+
type Method<Ops extends OperationSet<Ops>, K extends keyof Ops> = Record<never, never> extends ArgsOf<Ops, K> ? (args?: ArgsOf<Ops, K>, init?: WorkflowCallOptions) => Promise<Ops[K]['result']> : (args: ArgsOf<Ops, K>, init?: WorkflowCallOptions) => Promise<Ops[K]['result']>;
|
|
16
|
+
/** What a single call may carry beside its arguments. */
|
|
17
|
+
export interface WorkflowCallOptions {
|
|
18
|
+
/** Aborting it abandons the request: the call rejects with the fetch's own abort error. */
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/** Every operation of one surface, as a method. */
|
|
22
|
+
export type ClientOf<Ops extends OperationSet<Ops>> = {
|
|
23
|
+
readonly [K in keyof Ops]: Method<Ops, K>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Every operation the Executor publishes, as a method. The type is derived from the generated surface,
|
|
27
|
+
* so an endpoint that changes shape fails to compile here rather than failing in a caller at run time.
|
|
28
|
+
*/
|
|
29
|
+
export type WorkflowClient = ClientOf<WorkflowOperations>;
|
|
30
|
+
/**
|
|
31
|
+
* Every operation the Editor publishes. A separate client, because it is a separate product.
|
|
32
|
+
*
|
|
33
|
+
* `createWorkflow` and `updateWorkflow` resolve to the workflow alone. A save that does not compile is kept as
|
|
34
|
+
* the draft, and nothing in that answer says why: when `draftVersionId` is set where you asked to publish, call
|
|
35
|
+
* `getVersionCompilation({ versionId: draftVersionId })` for its diagnostics.
|
|
36
|
+
*/
|
|
37
|
+
export type WorkflowEditorClient = ClientOf<WorkflowEditorOperations>;
|
|
38
|
+
/**
|
|
39
|
+
* Thrown for any response the server did not answer 2xx with. `body` is the problem document as sent, and
|
|
40
|
+
* `headers` the response's own, so a 503's `Retry-After` can be read.
|
|
41
|
+
*/
|
|
42
|
+
export declare class WorkflowApiError extends Error {
|
|
43
|
+
readonly status: number;
|
|
44
|
+
readonly operation: string;
|
|
45
|
+
readonly body: unknown;
|
|
46
|
+
readonly headers: Headers;
|
|
47
|
+
constructor(status: number, operation: string, body: unknown, headers?: Headers);
|
|
48
|
+
}
|
|
49
|
+
export interface WorkflowClientOptions {
|
|
50
|
+
/** Where the surface is mounted, e.g. `https://host` or `https://host/reeve`. */
|
|
51
|
+
readonly baseUrl: string;
|
|
52
|
+
/** Supplied so a host can add auth, retries or its own instrumentation. Defaults to global fetch. */
|
|
53
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
54
|
+
/** Merged into every request. A function is called per request, for a token that expires. */
|
|
55
|
+
readonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Builds a client over the Executor's published surface. It carries no auth, no caching and no retry
|
|
59
|
+
* policy: those are the host's, and a client that guessed at them would be one more thing to work around.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createWorkflowClient(options: WorkflowClientOptions): WorkflowClient;
|
|
62
|
+
/**
|
|
63
|
+
* Builds a client over the Editor's published surface. Separate from the one above because the two are
|
|
64
|
+
* separate products: a host that mounted only the Executor has nothing for these methods to reach.
|
|
65
|
+
*/
|
|
66
|
+
export declare function createWorkflowEditorClient(options: WorkflowClientOptions): WorkflowEditorClient;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAErE,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAAG,MAAM,kBAAkB,CAAA;AAE5D,6DAA6D;AAC7D,MAAM,MAAM,2BAA2B,GAAG,MA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c,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAAA;AAErE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO;gBAHhB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,OAAuB;CAK5C;AAED,MAAM,WAAW,qBAAqB;IACpC,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,qGAAqG;IACrG,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IACxC,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;CAC/F;AAuED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAEnF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAE/F"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { WORKFLOW_ROUTES } from './generated/types.js';
|
|
2
|
+
import { WORKFLOW_EDITOR_ROUTES } from './generated/editor.js';
|
|
3
|
+
/**
|
|
4
|
+
* Thrown for any response the server did not answer 2xx with. `body` is the problem document as sent, and
|
|
5
|
+
* `headers` the response's own, so a 503's `Retry-After` can be read.
|
|
6
|
+
*/
|
|
7
|
+
export class WorkflowApiError extends Error {
|
|
8
|
+
status;
|
|
9
|
+
operation;
|
|
10
|
+
body;
|
|
11
|
+
headers;
|
|
12
|
+
constructor(status, operation, body, headers = new Headers()) {
|
|
13
|
+
super(`${operation} answered ${String(status)}`);
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.operation = operation;
|
|
16
|
+
this.body = body;
|
|
17
|
+
this.headers = headers;
|
|
18
|
+
this.name = 'WorkflowApiError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function url(baseUrl, operation, route, args) {
|
|
22
|
+
const path = route.path.replace(/\{(\w+)\}/g, (_, name) => {
|
|
23
|
+
const value = args[name];
|
|
24
|
+
if (value === undefined || value === null)
|
|
25
|
+
throw new TypeError(`${operation} needs a value for the path parameter ${name}`);
|
|
26
|
+
return encodeURIComponent(String(value));
|
|
27
|
+
});
|
|
28
|
+
const query = new URLSearchParams();
|
|
29
|
+
for (const name of route.query) {
|
|
30
|
+
const value = args[name];
|
|
31
|
+
if (value !== undefined && value !== null)
|
|
32
|
+
query.append(name, String(value));
|
|
33
|
+
}
|
|
34
|
+
const search = query.toString();
|
|
35
|
+
return `${baseUrl.replace(/\/+$/, '')}${path}${search === '' ? '' : `?${search}`}`;
|
|
36
|
+
}
|
|
37
|
+
function build(routes, options) {
|
|
38
|
+
const send = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
39
|
+
async function call(operation, route, args, init) {
|
|
40
|
+
const extra = typeof options.headers === 'function' ? options.headers() : (options.headers ?? {});
|
|
41
|
+
const hasBody = 'body' in args && args['body'] !== undefined;
|
|
42
|
+
const response = await send(url(options.baseUrl, operation, route, args), {
|
|
43
|
+
method: route.method,
|
|
44
|
+
headers: { Accept: 'application/json', ...(hasBody ? { 'Content-Type': 'application/json' } : {}), ...extra },
|
|
45
|
+
...(hasBody ? { body: JSON.stringify(args['body']) } : {}),
|
|
46
|
+
...(init?.signal === undefined ? {} : { signal: init.signal }),
|
|
47
|
+
});
|
|
48
|
+
const text = await response.text();
|
|
49
|
+
let parsed;
|
|
50
|
+
try {
|
|
51
|
+
parsed = text === '' ? undefined : JSON.parse(text);
|
|
52
|
+
}
|
|
53
|
+
catch (cause) {
|
|
54
|
+
if (!response.ok)
|
|
55
|
+
throw new WorkflowApiError(response.status, operation, text, response.headers);
|
|
56
|
+
throw cause;
|
|
57
|
+
}
|
|
58
|
+
if (!response.ok)
|
|
59
|
+
throw new WorkflowApiError(response.status, operation, parsed, response.headers);
|
|
60
|
+
if (route.empty)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (parsed === undefined)
|
|
63
|
+
throw new TypeError(`${operation} answered ${String(response.status)} with no body`);
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
66
|
+
const client = {};
|
|
67
|
+
for (const [operation, route] of Object.entries(routes)) {
|
|
68
|
+
client[operation] = (args = {}, init) => call(operation, route, args, init);
|
|
69
|
+
}
|
|
70
|
+
return client;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Builds a client over the Executor's published surface. It carries no auth, no caching and no retry
|
|
74
|
+
* policy: those are the host's, and a client that guessed at them would be one more thing to work around.
|
|
75
|
+
*/
|
|
76
|
+
export function createWorkflowClient(options) {
|
|
77
|
+
return build(WORKFLOW_ROUTES, options);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Builds a client over the Editor's published surface. Separate from the one above because the two are
|
|
81
|
+
* separate products: a host that mounted only the Executor has nothing for these methods to reach.
|
|
82
|
+
*/
|
|
83
|
+
export function createWorkflowEditorClient(options) {
|
|
84
|
+
return build(WORKFLOW_EDITOR_ROUTES, options);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,sBAAsB,EAAE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AE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC7E,CAAC;IAED,OAAO,MAAuB,CAAA;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA8B;IACjE,OAAO,KAAK,CAAqB,eAAe,EAAE,OAAO,CAAC,CAAA;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA8B;IACvE,OAAO,KAAK,CAA2B,sBAAsB,EAAE,OAAO,CAAC,CAAA;AACzE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Surface, SurfaceEndpoint } from './surface.js';
|
|
2
|
+
/**
|
|
3
|
+
* Translates one term of the surface's type grammar into TypeScript. Read right to left: a trailing `?`
|
|
4
|
+
* binds loosest, so `X[]?` is a nullable array and `X?[]` is an array of nullable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function translate(term: string): string;
|
|
7
|
+
/** Strips the route constraints the server's template carries: `{id:guid}` is `{id}` to a caller. */
|
|
8
|
+
export declare function templateOf(path: string): string;
|
|
9
|
+
/** What one success resolves to, and whether the client should expect a body at all. */
|
|
10
|
+
export declare function successOf(endpoint: SurfaceEndpoint): {
|
|
11
|
+
readonly type: string;
|
|
12
|
+
readonly empty: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** What the generated module calls the two things it exports, and which pair of files it belongs to. */
|
|
15
|
+
export interface GeneratedNames {
|
|
16
|
+
readonly operations: string;
|
|
17
|
+
readonly routes: string;
|
|
18
|
+
/** The surface document this module is generated from, named in its header. */
|
|
19
|
+
readonly surface: string;
|
|
20
|
+
/** This module's own file name, so the header names the right file to compare against. */
|
|
21
|
+
readonly module: string;
|
|
22
|
+
}
|
|
23
|
+
/** Shapes another generated module already declares, so a second one imports them instead of redeclaring. */
|
|
24
|
+
export interface SharedShapes {
|
|
25
|
+
/** The module specifier to import them from, e.g. `./types.js`. */
|
|
26
|
+
readonly module: string;
|
|
27
|
+
/** The surface those shapes were generated from. */
|
|
28
|
+
readonly surface: Surface;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The whole generated module: one interface per shape, one entry per operation, and a route table the
|
|
32
|
+
* client builds URLs from. Deterministic — the same surface always produces the same text.
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateTypes(surface: Surface, names?: GeneratedNames, shared?: SharedShapes): string;
|
|
35
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAA;AAmB9E;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9C;AAED,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAevG;AAqBD,wGAAwG;AACxG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,6GAA6G;AAC7G,MAAM,WAAW,YAAY;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAcD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,cAA+B,EACtC,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,CAgER"}
|
package/dist/generate.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
function header(names) {
|
|
2
|
+
return [
|
|
3
|
+
`// Generated from ${names.surface} by generateTypes(). Do not edit by hand.`,
|
|
4
|
+
`// generated.test.ts writes ${names.module}.actual beside this file when the two disagree.`,
|
|
5
|
+
].join('\n');
|
|
6
|
+
}
|
|
7
|
+
const SCALARS = {
|
|
8
|
+
string: 'string',
|
|
9
|
+
uuid: 'string',
|
|
10
|
+
'date-time': 'string',
|
|
11
|
+
integer: 'number',
|
|
12
|
+
number: 'number',
|
|
13
|
+
boolean: 'boolean',
|
|
14
|
+
unknown: 'unknown',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Translates one term of the surface's type grammar into TypeScript. Read right to left: a trailing `?`
|
|
18
|
+
* binds loosest, so `X[]?` is a nullable array and `X?[]` is an array of nullable.
|
|
19
|
+
*/
|
|
20
|
+
export function translate(term) {
|
|
21
|
+
// `unknown` already admits null, and `unknown | null` is a redundant constituent a linter rejects.
|
|
22
|
+
if (term.endsWith('?')) {
|
|
23
|
+
const inner = translate(term.slice(0, -1));
|
|
24
|
+
return inner === 'unknown' ? inner : `${inner} | null`;
|
|
25
|
+
}
|
|
26
|
+
if (term.endsWith('[]'))
|
|
27
|
+
return `ReadonlyArray<${translate(term.slice(0, -2))}>`;
|
|
28
|
+
if (term.startsWith('map<') && term.endsWith('>'))
|
|
29
|
+
return `Readonly<Record<string, ${translate(term.slice(4, -1))}>>`;
|
|
30
|
+
if (term.startsWith('#'))
|
|
31
|
+
return term.slice(1);
|
|
32
|
+
const scalar = SCALARS[term];
|
|
33
|
+
if (scalar === undefined)
|
|
34
|
+
throw new Error(`Unknown type term in surface: ${term}`);
|
|
35
|
+
return scalar;
|
|
36
|
+
}
|
|
37
|
+
/** Strips the route constraints the server's template carries: `{id:guid}` is `{id}` to a caller. */
|
|
38
|
+
export function templateOf(path) {
|
|
39
|
+
return `/${path.replace(/\{(\w+):[^}]+\}/g, '{$1}')}`;
|
|
40
|
+
}
|
|
41
|
+
/** What one success resolves to, and whether the client should expect a body at all. */
|
|
42
|
+
export function successOf(endpoint) {
|
|
43
|
+
const ok = endpoint.responses.filter((r) => r.status >= 200 && r.status < 300);
|
|
44
|
+
if (ok.length !== 1)
|
|
45
|
+
throw new Error(`${endpoint.operation} declares ${String(ok.length)} success responses; a client method returns one thing`);
|
|
46
|
+
const [only] = ok;
|
|
47
|
+
if (only?.type !== undefined)
|
|
48
|
+
return { type: translate(only.type), empty: false };
|
|
49
|
+
// 204 is the one bodiless success with a settled meaning. Any other status with no shape is a
|
|
50
|
+
// declaration nobody finished, and generating `void` for it would hide that.
|
|
51
|
+
if (only?.status === 204)
|
|
52
|
+
return { type: 'void', empty: true };
|
|
53
|
+
throw new Error(`${endpoint.operation} declares a success with no shape; the client would resolve to undefined ` +
|
|
54
|
+
'while its type promised a value, so decide what a bodiless success means before generating one');
|
|
55
|
+
}
|
|
56
|
+
function argsOf(endpoint) {
|
|
57
|
+
const fields = [];
|
|
58
|
+
const named = new Set();
|
|
59
|
+
const add = (p) => {
|
|
60
|
+
if (named.has(p.name))
|
|
61
|
+
throw new Error(`${endpoint.operation} names ${p.name} twice`);
|
|
62
|
+
named.add(p.name);
|
|
63
|
+
fields.push(` readonly ${p.name}${p.required ? '' : '?'}: ${translate(p.type)}`);
|
|
64
|
+
};
|
|
65
|
+
endpoint.pathParameters.forEach(add);
|
|
66
|
+
endpoint.queryParameters.forEach(add);
|
|
67
|
+
if (endpoint.requestBody !== undefined) {
|
|
68
|
+
if (named.has('body'))
|
|
69
|
+
throw new Error(`${endpoint.operation} has a parameter named body`);
|
|
70
|
+
fields.push(` readonly body${endpoint.requestBody.required ? '' : '?'}: ${translate(endpoint.requestBody.type)}`);
|
|
71
|
+
}
|
|
72
|
+
return fields.length === 0 ? 'Record<never, never>' : `{\n${fields.join('\n')}\n }`;
|
|
73
|
+
}
|
|
74
|
+
const EXECUTOR_NAMES = {
|
|
75
|
+
operations: 'WorkflowOperations',
|
|
76
|
+
routes: 'WORKFLOW_ROUTES',
|
|
77
|
+
surface: 'surface.json',
|
|
78
|
+
module: 'types.ts',
|
|
79
|
+
};
|
|
80
|
+
function shapeOf(type) {
|
|
81
|
+
const properties = type.properties.map((p) => ` readonly ${p.name}: ${translate(p.type)}`);
|
|
82
|
+
return `interface ${type.name} {\n${properties.join('\n')}\n}`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The whole generated module: one interface per shape, one entry per operation, and a route table the
|
|
86
|
+
* client builds URLs from. Deterministic — the same surface always produces the same text.
|
|
87
|
+
*/
|
|
88
|
+
export function generateTypes(surface, names = EXECUTOR_NAMES, shared) {
|
|
89
|
+
const already = new Map((shared?.surface.types ?? []).map((type) => [type.name, shapeOf(type)]));
|
|
90
|
+
const imported = [];
|
|
91
|
+
const shapes = [];
|
|
92
|
+
for (const type of surface.types) {
|
|
93
|
+
const mine = shapeOf(type);
|
|
94
|
+
const theirs = already.get(type.name);
|
|
95
|
+
if (theirs === undefined) {
|
|
96
|
+
shapes.push(`export ${mine}`);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
// Two surfaces describing one name differently would generate a client that compiles and sends the
|
|
100
|
+
// wrong body to one of the two servers. Imported, so there is one declaration or an error.
|
|
101
|
+
if (theirs !== mine)
|
|
102
|
+
throw new Error(`${type.name} is described differently by ${surface.source} and ${shared?.surface.source ?? 'the shared surface'}`);
|
|
103
|
+
imported.push(type.name);
|
|
104
|
+
}
|
|
105
|
+
const operations = surface.endpoints.map((endpoint) => {
|
|
106
|
+
const query = endpoint.queryParameters.map((p) => `'${p.name}'`).join(' | ');
|
|
107
|
+
return [
|
|
108
|
+
` readonly ${endpoint.operation}: {`,
|
|
109
|
+
` readonly method: '${endpoint.method}'`,
|
|
110
|
+
` readonly path: '${templateOf(endpoint.path)}'`,
|
|
111
|
+
` readonly query: ${query === '' ? 'never' : query}`,
|
|
112
|
+
` readonly args: ${argsOf(endpoint)}`,
|
|
113
|
+
` readonly result: ${successOf(endpoint).type}`,
|
|
114
|
+
' }',
|
|
115
|
+
].join('\n');
|
|
116
|
+
});
|
|
117
|
+
const routes = surface.endpoints.map((endpoint) => ` ${endpoint.operation}: { method: '${endpoint.method}', path: '${templateOf(endpoint.path)}', query: [${endpoint.queryParameters
|
|
118
|
+
.map((p) => `'${p.name}'`)
|
|
119
|
+
.join(', ')}], empty: ${String(successOf(endpoint).empty)} },`);
|
|
120
|
+
const body = [
|
|
121
|
+
shapes.join('\n\n'),
|
|
122
|
+
'',
|
|
123
|
+
`export interface ${names.operations} {`,
|
|
124
|
+
operations.join('\n'),
|
|
125
|
+
'}',
|
|
126
|
+
'',
|
|
127
|
+
`export const ${names.routes} = {`,
|
|
128
|
+
routes.join('\n'),
|
|
129
|
+
'} as const satisfies Readonly<',
|
|
130
|
+
` Record<keyof ${names.operations}, ` +
|
|
131
|
+
'{ method: string; path: string; query: readonly string[]; empty: boolean }>',
|
|
132
|
+
'>',
|
|
133
|
+
'',
|
|
134
|
+
].join('\n');
|
|
135
|
+
// Only the shared shapes this module actually names: an import nobody uses is a compile error under
|
|
136
|
+
// noUnusedLocals, and the closure of a surface is wider than the text generated from it.
|
|
137
|
+
const used = imported.filter((name) => new RegExp(`\\b${name}\\b`).test(body));
|
|
138
|
+
const importLine = used.length === 0 ? [] : [`import type { ${used.join(', ')} } from '${shared?.module ?? ''}'`, ''];
|
|
139
|
+
return [header(names), '', ...importLine, body].join('\n');
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,SAAS,MAAM,CAAC,KAAqB;IACnC,OAAO;QACL,qBAAqB,KAAK,CAAC,OAAO,2CAA2C;QAC7E,+BAA+B,KAAK,CAAC,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