@leitwerk-dev/process-sdk 0.1.9 → 0.2.1
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/browser-ui-extension.d.ts +20 -0
- package/dist/browser-ui-extension.d.ts.map +1 -1
- package/dist/capabilities.d.ts +6 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
- package/dist/chunk-5R6MVLHC.js.map +1 -0
- package/dist/chunk-DVXW2ZUV.js +1 -0
- package/dist/chunk-DVXW2ZUV.js.map +1 -0
- package/dist/{chunk-TRQJ5PRM.js → chunk-I7U6HCLN.js} +1 -11
- package/dist/chunk-I7U6HCLN.js.map +1 -0
- package/dist/{chunk-5RJZ2E7D.js → chunk-TM2LTSW4.js} +2 -6
- package/dist/chunk-TM2LTSW4.js.map +1 -0
- package/dist/codecs.d.ts +1 -0
- package/dist/codecs.d.ts.map +1 -1
- package/dist/commit-message.d.ts +5 -0
- package/dist/commit-message.d.ts.map +1 -1
- package/dist/core-capabilities.d.ts +396 -44
- package/dist/core-capabilities.d.ts.map +1 -1
- package/dist/define-process.d.ts +209 -64
- package/dist/define-process.d.ts.map +1 -1
- package/dist/event-bus.d.ts +1 -0
- package/dist/event-bus.d.ts.map +1 -1
- package/dist/{extension-api-BBcwktmc.d.ts → extension-api-B4gG5w1K.d.ts} +1111 -153
- package/dist/extension-api.d.ts +481 -38
- package/dist/extension-api.d.ts.map +1 -1
- package/dist/external-action-source.d.ts +9 -0
- package/dist/external-action-source.d.ts.map +1 -0
- package/dist/external-source-poll.d.ts +22 -0
- package/dist/external-source-poll.d.ts.map +1 -0
- package/dist/flow.d.ts +380 -107
- package/dist/flow.d.ts.map +1 -1
- package/dist/form-contract.d.ts +1 -1
- package/dist/form-contract.d.ts.map +1 -1
- package/dist/fs-utils.d.ts +6 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/git-binary.d.ts +2 -1
- package/dist/git-binary.d.ts.map +1 -1
- package/dist/git-binary.js +25 -33
- package/dist/git-binary.js.map +1 -1
- package/dist/graph-fragments.d.ts +16 -0
- package/dist/graph-fragments.d.ts.map +1 -1
- package/dist/host-capabilities.d.ts +9 -3
- package/dist/host-capabilities.d.ts.map +1 -1
- package/dist/index.d.ts +40 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4876 -29
- package/dist/index.js.map +1 -1
- package/dist/integration-http.d.ts +32 -0
- package/dist/integration-http.d.ts.map +1 -0
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/leaf-outcome-renderer.d.ts +35 -0
- package/dist/leaf-outcome-renderer.d.ts.map +1 -1
- package/dist/leaf-outcome-renderer.js +86 -64
- package/dist/leaf-outcome-renderer.js.map +1 -1
- package/dist/leaf-outcomes.d.ts +3 -0
- package/dist/leaf-outcomes.d.ts.map +1 -1
- package/dist/model-provider.d.ts +144 -12
- package/dist/model-provider.d.ts.map +1 -1
- package/dist/pi-config-public.d.ts +2 -0
- package/dist/pi-config-public.d.ts.map +1 -0
- package/dist/pi-config-public.js +15 -0
- package/dist/pi-config-public.js.map +1 -0
- package/dist/pi-config.d.ts +41 -5
- package/dist/pi-config.d.ts.map +1 -1
- package/dist/pi-config.js +20 -180
- package/dist/pi-config.js.map +1 -1
- package/dist/process-definition-internals.d.ts +4 -0
- package/dist/process-definition-internals.d.ts.map +1 -1
- package/dist/process-flow-view.d.ts +2 -0
- package/dist/process-flow-view.d.ts.map +1 -1
- package/dist/process-graph.d.ts +34 -0
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-launcher-builder.d.ts +5 -0
- package/dist/process-launcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-builder.d.ts +5 -0
- package/dist/process-watcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-source.d.ts +3 -1
- package/dist/process-watcher-source.d.ts.map +1 -1
- package/dist/project-binding.d.ts +13 -0
- package/dist/project-binding.d.ts.map +1 -0
- package/dist/registry-utils.d.ts +6 -0
- package/dist/registry-utils.d.ts.map +1 -1
- package/dist/repository-feedback.d.ts +47 -0
- package/dist/repository-feedback.d.ts.map +1 -0
- package/dist/repository-git-env.d.ts +8 -2
- package/dist/repository-git-env.d.ts.map +1 -1
- package/dist/repository-http.d.ts +31 -0
- package/dist/repository-http.d.ts.map +1 -0
- package/dist/repository-https.d.ts +3 -0
- package/dist/repository-https.d.ts.map +1 -0
- package/dist/repository-issue-watcher.d.ts +51 -0
- package/dist/repository-issue-watcher.d.ts.map +1 -0
- package/dist/repository-reconciliation.d.ts +5 -0
- package/dist/repository-reconciliation.d.ts.map +1 -0
- package/dist/repository-source-config.d.ts +58 -0
- package/dist/repository-source-config.d.ts.map +1 -0
- package/dist/repository-types.d.ts +63 -0
- package/dist/repository-types.d.ts.map +1 -0
- package/dist/review-flow-public.d.ts +2 -0
- package/dist/review-flow-public.d.ts.map +1 -0
- package/dist/review-flow-public.js +11 -0
- package/dist/review-flow-public.js.map +1 -0
- package/dist/review-flow.d.ts +6 -0
- package/dist/review-flow.d.ts.map +1 -1
- package/dist/review-flow.js +12 -43
- package/dist/review-flow.js.map +1 -1
- package/dist/runtime-internals-public.d.ts +2 -0
- package/dist/runtime-internals-public.d.ts.map +1 -0
- package/dist/runtime-internals-public.js +16 -0
- package/dist/runtime-internals-public.js.map +1 -0
- package/dist/runtime-internals.js +19 -2
- package/dist/runtime-internals.js.map +1 -1
- package/dist/server-events.d.ts +67 -0
- package/dist/server-events.d.ts.map +1 -1
- package/dist/server-process-builder.d.ts +7 -0
- package/dist/server-process-builder.d.ts.map +1 -1
- package/dist/state-helpers.d.ts +8 -0
- package/dist/state-helpers.d.ts.map +1 -1
- package/dist/subprocess-env.d.ts +4 -0
- package/dist/subprocess-env.d.ts.map +1 -1
- package/dist/tool-arguments.d.ts +9 -0
- package/dist/tool-arguments.d.ts.map +1 -0
- package/dist/tool-renderers.d.ts +6 -0
- package/dist/tool-renderers.d.ts.map +1 -1
- package/dist/turn-semantics.d.ts +18 -6
- package/dist/turn-semantics.d.ts.map +1 -1
- package/dist/types.d.ts +209 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/ui-process-builder.d.ts +5 -0
- package/dist/ui-process-builder.d.ts.map +1 -1
- package/dist/worker-process-builder.d.ts +5 -0
- package/dist/worker-process-builder.d.ts.map +1 -1
- package/package.json +17 -15
- package/src/browser-ui-extension.ts +20 -0
- package/src/capabilities.ts +9 -1
- package/src/codecs.ts +1 -0
- package/src/commit-message.ts +5 -0
- package/src/core-capabilities.ts +464 -59
- package/src/define-process.ts +384 -332
- package/src/event-bus.ts +1 -0
- package/src/extension-api.ts +521 -41
- package/src/external-action-source.ts +17 -0
- package/src/external-source-poll.ts +61 -0
- package/src/flow.ts +674 -677
- package/src/form-contract.ts +0 -4
- package/src/fs-utils.ts +21 -2
- package/src/git-binary.ts +2 -1
- package/src/graph-fragments.ts +16 -0
- package/src/host-capabilities.ts +9 -6
- package/src/index.ts +51 -206
- package/src/integration-http.ts +70 -0
- package/src/json-data.ts +25 -0
- package/src/leaf-outcome-renderer.ts +35 -0
- package/src/leaf-outcomes.ts +4 -9
- package/src/model-provider.ts +179 -43
- package/src/pi-config-public.ts +7 -0
- package/src/pi-config.ts +48 -8
- package/src/process-definition-internals.ts +4 -0
- package/src/process-flow-view.ts +34 -88
- package/src/process-graph.ts +59 -51
- package/src/process-launcher-builder.ts +5 -0
- package/src/process-watcher-builder.ts +5 -0
- package/src/process-watcher-source.ts +9 -10
- package/src/project-binding.ts +40 -0
- package/src/registry-utils.ts +7 -5
- package/src/repository-feedback.ts +85 -0
- package/src/repository-git-env.ts +40 -2
- package/src/repository-http.ts +88 -0
- package/src/repository-https.ts +22 -0
- package/src/repository-issue-watcher.ts +122 -0
- package/src/repository-reconciliation.ts +30 -0
- package/src/repository-source-config.ts +79 -0
- package/src/repository-types.ts +63 -0
- package/src/review-flow-public.ts +5 -0
- package/src/review-flow.ts +6 -0
- package/src/runtime-internals-public.ts +7 -0
- package/src/server-events.ts +67 -0
- package/src/server-process-builder.ts +10 -1
- package/src/state-helpers.ts +14 -4
- package/src/subprocess-env.ts +9 -0
- package/src/tool-arguments.ts +39 -0
- package/src/tool-renderers.ts +6 -0
- package/src/turn-semantics.ts +45 -76
- package/src/types.ts +216 -44
- package/src/ui-process-builder.ts +8 -1
- package/src/worker-process-builder.ts +8 -1
- package/dist/browser-ui-extension.js +0 -2
- package/dist/browser-ui-extension.js.map +0 -1
- package/dist/capabilities.js +0 -7
- package/dist/capabilities.js.map +0 -1
- package/dist/chunk-5RJZ2E7D.js.map +0 -1
- package/dist/chunk-LIIP7FMU.js.map +0 -1
- package/dist/chunk-TRQJ5PRM.js.map +0 -1
- package/dist/codecs.js +0 -9
- package/dist/codecs.js.map +0 -1
- package/dist/commit-message.js +0 -3
- package/dist/commit-message.js.map +0 -1
- package/dist/core-capabilities.js +0 -6
- package/dist/core-capabilities.js.map +0 -1
- package/dist/define-process.js +0 -1078
- package/dist/define-process.js.map +0 -1
- package/dist/event-bus.js +0 -31
- package/dist/event-bus.js.map +0 -1
- package/dist/extension-api.js +0 -5
- package/dist/extension-api.js.map +0 -1
- package/dist/flow.js +0 -1645
- package/dist/flow.js.map +0 -1
- package/dist/form-contract.js +0 -2
- package/dist/form-contract.js.map +0 -1
- package/dist/fs-utils.js +0 -23
- package/dist/fs-utils.js.map +0 -1
- package/dist/graph-fragments.js +0 -57
- package/dist/graph-fragments.js.map +0 -1
- package/dist/host-capabilities.js +0 -42
- package/dist/host-capabilities.js.map +0 -1
- package/dist/launcher-contract.js +0 -2
- package/dist/launcher-contract.js.map +0 -1
- package/dist/leaf-outcomes.js +0 -52
- package/dist/leaf-outcomes.js.map +0 -1
- package/dist/model-provider.js +0 -171
- package/dist/model-provider.js.map +0 -1
- package/dist/process-definition-internals.js +0 -25
- package/dist/process-definition-internals.js.map +0 -1
- package/dist/process-flow-view.js +0 -418
- package/dist/process-flow-view.js.map +0 -1
- package/dist/process-graph.js +0 -212
- package/dist/process-graph.js.map +0 -1
- package/dist/process-launcher-builder.js +0 -43
- package/dist/process-launcher-builder.js.map +0 -1
- package/dist/process-watcher-builder.js +0 -40
- package/dist/process-watcher-builder.js.map +0 -1
- package/dist/process-watcher-source.js +0 -52
- package/dist/process-watcher-source.js.map +0 -1
- package/dist/registry-utils.js +0 -18
- package/dist/registry-utils.js.map +0 -1
- package/dist/repository-git-env.js +0 -26
- package/dist/repository-git-env.js.map +0 -1
- package/dist/server-events.js +0 -2
- package/dist/server-events.js.map +0 -1
- package/dist/server-process-builder.js +0 -52
- package/dist/server-process-builder.js.map +0 -1
- package/dist/state-helpers.js +0 -18
- package/dist/state-helpers.js.map +0 -1
- package/dist/subprocess-env.js +0 -34
- package/dist/subprocess-env.js.map +0 -1
- package/dist/tool-renderers.js +0 -63
- package/dist/tool-renderers.js.map +0 -1
- package/dist/turn-semantics.js +0 -365
- package/dist/turn-semantics.js.map +0 -1
- package/dist/types.js +0 -23
- package/dist/types.js.map +0 -1
- package/dist/ui-process-builder.js +0 -30
- package/dist/ui-process-builder.js.map +0 -1
- package/dist/worker-process-builder.js +0 -22
- package/dist/worker-process-builder.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** An HTTP failure without provider response bodies or credentials. @internal */
|
|
2
|
+
export class IntegrationHttpError extends Error {
|
|
3
|
+
/** @internal */
|
|
4
|
+
constructor(
|
|
5
|
+
/** @internal */
|
|
6
|
+
readonly status: number,
|
|
7
|
+
message: string,
|
|
8
|
+
) {
|
|
9
|
+
super(message);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Shared transport; extensions own endpoint paths, credentials, and response types. @public */
|
|
14
|
+
export class IntegrationHttpClient {
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor(
|
|
17
|
+
private readonly provider: string,
|
|
18
|
+
private readonly baseUrl: string,
|
|
19
|
+
private readonly headers: Record<string, string>,
|
|
20
|
+
private readonly pagination = {
|
|
21
|
+
/** @internal */
|
|
22
|
+
key: "per_page",
|
|
23
|
+
/** @internal */
|
|
24
|
+
size: 100,
|
|
25
|
+
},
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
protected async response(path: string, init: RequestInit = {}): Promise<Response> {
|
|
30
|
+
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
31
|
+
...init,
|
|
32
|
+
headers: {
|
|
33
|
+
...this.headers,
|
|
34
|
+
...(init.body ? { "Content-Type": "application/json" } : {}),
|
|
35
|
+
...init.headers,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok)
|
|
39
|
+
throw new IntegrationHttpError(
|
|
40
|
+
response.status,
|
|
41
|
+
`${this.provider} ${init.method ?? "GET"} ${path} failed with ${response.status}`,
|
|
42
|
+
);
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
protected async request<T>(path: string, init: RequestInit = {}): Promise<T> {
|
|
48
|
+
const response = await this.response(path, init);
|
|
49
|
+
return response.status === 204 ? (undefined as T) : response.json();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
protected writeJson<T>(path: string, method: string, body: unknown, signal?: AbortSignal) {
|
|
54
|
+
return this.request<T>(path, { method, body: JSON.stringify(body), signal });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
protected async pages<T>(path: string, signal?: AbortSignal): Promise<T[]> {
|
|
59
|
+
const items: T[] = [];
|
|
60
|
+
const { key, size } = this.pagination;
|
|
61
|
+
for (let page = 1; ; page++) {
|
|
62
|
+
const separator = path.includes("?") ? "&" : "?";
|
|
63
|
+
const batch = await this.request<T[]>(`${path}${separator}${key}=${size}&page=${page}`, {
|
|
64
|
+
signal,
|
|
65
|
+
});
|
|
66
|
+
items.push(...batch);
|
|
67
|
+
if (batch.length < size) return items;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/json-data.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Validate and detach JSON data without silently dropping unsupported values. @internal */
|
|
2
|
+
export function parseJsonData(
|
|
3
|
+
value: unknown,
|
|
4
|
+
message = "Value must be JSON-serializable",
|
|
5
|
+
): unknown {
|
|
6
|
+
const ancestors = new Set<object>();
|
|
7
|
+
function parse(value: unknown): unknown {
|
|
8
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
9
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
10
|
+
if (!value || typeof value !== "object" || ancestors.has(value)) throw new Error(message);
|
|
11
|
+
ancestors.add(value);
|
|
12
|
+
try {
|
|
13
|
+
if (Array.isArray(value)) return Array.from(value, parse);
|
|
14
|
+
if (
|
|
15
|
+
![Object.prototype, null].includes(Object.getPrototypeOf(value)) ||
|
|
16
|
+
Object.getOwnPropertySymbols(value).length
|
|
17
|
+
)
|
|
18
|
+
throw new Error(message);
|
|
19
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, parse(item)]));
|
|
20
|
+
} finally {
|
|
21
|
+
ancestors.delete(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return parse(value);
|
|
25
|
+
}
|
|
@@ -1,33 +1,53 @@
|
|
|
1
1
|
import escapeHtml from "escape-html";
|
|
2
2
|
|
|
3
|
+
/** @internal */
|
|
3
4
|
export interface LeafOutcomeRendererMeta {
|
|
5
|
+
/** @internal */
|
|
4
6
|
instanceId: string;
|
|
7
|
+
/** @internal */
|
|
5
8
|
snapshotId: string;
|
|
9
|
+
/** @internal */
|
|
6
10
|
leafEntryId: string;
|
|
11
|
+
/** @internal */
|
|
7
12
|
turnRecordId: string | null;
|
|
13
|
+
/** @internal */
|
|
8
14
|
createdAt: string;
|
|
15
|
+
/** @internal */
|
|
9
16
|
schemaVersion: number | null;
|
|
17
|
+
/** @internal */
|
|
10
18
|
lifecycleStatus?: string | null;
|
|
19
|
+
/** @internal */
|
|
11
20
|
selectedTurnId?: string | null;
|
|
21
|
+
/** @internal */
|
|
12
22
|
processUpdatedAt?: string | null;
|
|
13
23
|
}
|
|
14
24
|
|
|
25
|
+
/** @internal */
|
|
15
26
|
export interface LeafOutcomeRendererRuntime {
|
|
27
|
+
/** @internal */
|
|
16
28
|
apiVersion: 1;
|
|
29
|
+
/** @internal */
|
|
17
30
|
markdown: {
|
|
31
|
+
/** @internal */
|
|
18
32
|
render(markdown: string): string;
|
|
19
33
|
};
|
|
34
|
+
/** @internal */
|
|
20
35
|
server: {
|
|
36
|
+
/** @internal */
|
|
21
37
|
resolveUrl(path: string): string;
|
|
38
|
+
/** @internal */
|
|
22
39
|
fetch(path: string, init?: RequestInit): Promise<Response>;
|
|
23
40
|
};
|
|
41
|
+
/** @internal */
|
|
24
42
|
formatRelativeTime(iso: string): string;
|
|
25
43
|
}
|
|
26
44
|
|
|
45
|
+
/** @internal */
|
|
27
46
|
export function escapeLeafOutcomeHtml(value: string): string {
|
|
28
47
|
return escapeHtml(value);
|
|
29
48
|
}
|
|
30
49
|
|
|
50
|
+
/** @internal */
|
|
31
51
|
export function normalizeLeafOutcomeOptionalText(value: unknown): string | null {
|
|
32
52
|
if (typeof value !== "string") {
|
|
33
53
|
return null;
|
|
@@ -36,55 +56,68 @@ export function normalizeLeafOutcomeOptionalText(value: unknown): string | null
|
|
|
36
56
|
return trimmed === "" ? null : trimmed;
|
|
37
57
|
}
|
|
38
58
|
|
|
59
|
+
/** @internal */
|
|
39
60
|
const LeafOutcomeElementBase = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement;
|
|
40
61
|
|
|
62
|
+
/** @internal */
|
|
41
63
|
export abstract class LeafOutcomeCustomElement<TPayload> extends LeafOutcomeElementBase {
|
|
64
|
+
/** @internal */
|
|
42
65
|
protected readonly shadowRootRef: ShadowRoot;
|
|
43
66
|
private payloadValue: TPayload | null = null;
|
|
44
67
|
private runtimeValue: LeafOutcomeRendererRuntime | null = null;
|
|
45
68
|
private metaValue: LeafOutcomeRendererMeta | null = null;
|
|
46
69
|
private signaledReady = false;
|
|
47
70
|
|
|
71
|
+
/** @internal */
|
|
48
72
|
constructor() {
|
|
49
73
|
super();
|
|
50
74
|
this.shadowRootRef = this.attachShadow({ mode: "open" });
|
|
51
75
|
}
|
|
52
76
|
|
|
77
|
+
/** @internal */
|
|
53
78
|
set payload(value: TPayload | null) {
|
|
54
79
|
this.payloadValue = value;
|
|
55
80
|
this.renderContent();
|
|
56
81
|
}
|
|
57
82
|
|
|
83
|
+
/** @internal */
|
|
58
84
|
get payload(): TPayload | null {
|
|
59
85
|
return this.payloadValue;
|
|
60
86
|
}
|
|
61
87
|
|
|
88
|
+
/** @internal */
|
|
62
89
|
set runtime(value: LeafOutcomeRendererRuntime | null) {
|
|
63
90
|
this.runtimeValue = value;
|
|
64
91
|
this.renderContent();
|
|
65
92
|
}
|
|
66
93
|
|
|
94
|
+
/** @internal */
|
|
67
95
|
get runtime(): LeafOutcomeRendererRuntime | null {
|
|
68
96
|
return this.runtimeValue;
|
|
69
97
|
}
|
|
70
98
|
|
|
99
|
+
/** @internal */
|
|
71
100
|
set meta(value: LeafOutcomeRendererMeta | null) {
|
|
72
101
|
this.metaValue = value;
|
|
73
102
|
this.renderContent();
|
|
74
103
|
}
|
|
75
104
|
|
|
105
|
+
/** @internal */
|
|
76
106
|
get meta(): LeafOutcomeRendererMeta | null {
|
|
77
107
|
return this.metaValue;
|
|
78
108
|
}
|
|
79
109
|
|
|
110
|
+
/** @internal */
|
|
80
111
|
connectedCallback(): void {
|
|
81
112
|
this.renderContent();
|
|
82
113
|
}
|
|
83
114
|
|
|
115
|
+
/** @internal */
|
|
84
116
|
protected canRender(): this is this & { runtime: LeafOutcomeRendererRuntime } {
|
|
85
117
|
return this.isConnected && this.runtimeValue !== null;
|
|
86
118
|
}
|
|
87
119
|
|
|
120
|
+
/** @internal */
|
|
88
121
|
protected emitReady(): void {
|
|
89
122
|
if (this.signaledReady) {
|
|
90
123
|
return;
|
|
@@ -98,6 +131,7 @@ export abstract class LeafOutcomeCustomElement<TPayload> extends LeafOutcomeElem
|
|
|
98
131
|
);
|
|
99
132
|
}
|
|
100
133
|
|
|
134
|
+
/** @internal */
|
|
101
135
|
protected emitError(code: string, message: string): void {
|
|
102
136
|
this.dispatchEvent(
|
|
103
137
|
new CustomEvent("o2-leaf-outcome-error", {
|
|
@@ -108,5 +142,6 @@ export abstract class LeafOutcomeCustomElement<TPayload> extends LeafOutcomeElem
|
|
|
108
142
|
);
|
|
109
143
|
}
|
|
110
144
|
|
|
145
|
+
/** @internal */
|
|
111
146
|
protected abstract renderContent(): void;
|
|
112
147
|
}
|
package/src/leaf-outcomes.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
import { copiedUnknownRecordSchema as unknownRecordSchema } from "@leitwerk-dev/domain";
|
|
1
2
|
import * as v from "valibot";
|
|
2
3
|
import type { LeafOutcomeCaptureResult, ProcessLeafOutcomeDefinition } from "./extension-api.js";
|
|
3
4
|
|
|
4
|
-
const unknownRecordSchema = v.pipe(
|
|
5
|
-
v.unknown(),
|
|
6
|
-
v.check(
|
|
7
|
-
(value) => typeof value === "object" && value !== null && !Array.isArray(value),
|
|
8
|
-
"Expected object",
|
|
9
|
-
),
|
|
10
|
-
v.record(v.string(), v.unknown()),
|
|
11
|
-
);
|
|
12
|
-
|
|
13
5
|
function isNonEmptyString(value: unknown): value is string {
|
|
14
6
|
return typeof value === "string" && value.trim() !== "";
|
|
15
7
|
}
|
|
16
8
|
|
|
9
|
+
/** @internal */
|
|
17
10
|
export function validateProcessLeafOutcomeDefinition(def: ProcessLeafOutcomeDefinition): string[] {
|
|
18
11
|
const errors: string[] = [];
|
|
19
12
|
if (!isNonEmptyString(def.rendererId)) {
|
|
@@ -25,6 +18,7 @@ export function validateProcessLeafOutcomeDefinition(def: ProcessLeafOutcomeDefi
|
|
|
25
18
|
return errors;
|
|
26
19
|
}
|
|
27
20
|
|
|
21
|
+
/** @internal */
|
|
28
22
|
export function validateLeafOutcomeCaptureResult(
|
|
29
23
|
result: unknown,
|
|
30
24
|
expectedRendererId?: string,
|
|
@@ -62,6 +56,7 @@ export function validateLeafOutcomeCaptureResult(
|
|
|
62
56
|
return errors;
|
|
63
57
|
}
|
|
64
58
|
|
|
59
|
+
/** @internal */
|
|
65
60
|
export function normalizeLeafOutcomeCaptureResult(
|
|
66
61
|
result: LeafOutcomeCaptureResult,
|
|
67
62
|
): LeafOutcomeCaptureResult {
|