@uru-intelligence/app 1.0.0 → 2.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/README.md +83 -9
- package/dist/dampers.d.ts +7 -74
- package/dist/dampers.js +36 -131
- package/dist/dataset-boundary.d.ts +31 -0
- package/dist/dataset-boundary.js +292 -0
- package/dist/datasets.d.ts +4 -4
- package/dist/datasets.js +110 -80
- package/dist/{errorResponse.d.ts → error-response.d.ts} +1 -1
- package/dist/error-response.js +11 -0
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +52 -49
- package/dist/invocations.d.ts +7 -0
- package/dist/invocations.js +27 -0
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +23 -23
- package/dist/transport-json.d.ts +7 -0
- package/dist/transport-json.js +92 -0
- package/dist/transport.d.ts +14 -13
- package/dist/transport.js +496 -443
- package/dist/types.d.ts +90 -42
- package/dist/types.js +2 -2
- package/package.json +61 -59
- package/dist/errorResponse.js +0 -11
package/dist/types.d.ts
CHANGED
|
@@ -9,12 +9,17 @@
|
|
|
9
9
|
* the barrel. Publishing turns barrel exports into permanent promises, so the
|
|
10
10
|
* cycle was broken instead of documented.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* All imports are type-only. JSON values belong to the HTTP edge, not to a
|
|
13
|
+
* domain model's inheritance hierarchy.
|
|
14
14
|
*/
|
|
15
|
-
import type { UruRunawayDamperOptions } from
|
|
15
|
+
import type { UruRunawayDamperOptions } from "./dampers.js";
|
|
16
|
+
import type { RuntimeJsonObject, RuntimeJsonValue } from "./transport-json.js";
|
|
17
|
+
/** Parse an untrusted result. Throw when the value does not match its model. */
|
|
18
|
+
export type UruResultDecoder<TResult> = (value: unknown) => TResult;
|
|
19
|
+
/** Transport only calls fetch; runtime-specific properties are not required. */
|
|
20
|
+
type RuntimeFetch = (...args: Parameters<typeof fetch>) => ReturnType<typeof fetch>;
|
|
16
21
|
/** The kinds of capability a Uru app can declare and this client can invoke. */
|
|
17
|
-
export type UruAppRuntimeCapabilityType =
|
|
22
|
+
export type UruAppRuntimeCapabilityType = "query" | "action" | "job" | "endpoint" | "server_function";
|
|
18
23
|
/**
|
|
19
24
|
* Normalized lifecycle state of one invocation.
|
|
20
25
|
*
|
|
@@ -22,15 +27,15 @@ export type UruAppRuntimeCapabilityType = 'query' | 'action' | 'job' | 'endpoint
|
|
|
22
27
|
* may add a state before this package knows about it, and a client that threw
|
|
23
28
|
* on an unrecognised state would break on a backend deploy.
|
|
24
29
|
*/
|
|
25
|
-
export type UruAppRuntimeState =
|
|
30
|
+
export type UruAppRuntimeState = "idle" | "queued" | "running" | "polling" | "cached" | "stale" | "refreshing" | "refreshed" | "succeeded" | "failed" | "rate_limited" | "budget_blocked" | "service_unavailable" | "canceled";
|
|
26
31
|
/** Lifecycle transitions reported to `onEvent` / `onStatus`. */
|
|
27
|
-
export type UruAppRuntimeEventType =
|
|
32
|
+
export type UruAppRuntimeEventType = "started" | "status" | "completed" | "failed" | "canceled";
|
|
28
33
|
/** One lifecycle notification for an in-flight invocation. */
|
|
29
34
|
export interface UruAppRuntimeEvent<TResult = unknown> {
|
|
30
35
|
type: UruAppRuntimeEventType;
|
|
31
|
-
state:
|
|
36
|
+
state: string;
|
|
32
37
|
deploymentId: string;
|
|
33
|
-
capabilityType?:
|
|
38
|
+
capabilityType?: string | undefined;
|
|
34
39
|
capabilityName?: string | undefined;
|
|
35
40
|
executionId?: string | null | undefined;
|
|
36
41
|
requestId?: string | null | undefined;
|
|
@@ -38,7 +43,7 @@ export interface UruAppRuntimeEvent<TResult = unknown> {
|
|
|
38
43
|
error?: string | null | undefined;
|
|
39
44
|
retryAfterSeconds?: number | null | undefined;
|
|
40
45
|
cacheStatus?: string | null | undefined;
|
|
41
|
-
diagnostics?:
|
|
46
|
+
diagnostics?: RuntimeJsonObject | undefined;
|
|
42
47
|
}
|
|
43
48
|
/** Per-call options accepted by every capability method. */
|
|
44
49
|
export interface UruAppRuntimeInvocationOptions {
|
|
@@ -48,19 +53,24 @@ export interface UruAppRuntimeInvocationOptions {
|
|
|
48
53
|
requestId?: string;
|
|
49
54
|
onEvent?: (event: UruAppRuntimeEvent) => void;
|
|
50
55
|
onStatus?: (event: UruAppRuntimeEvent) => void;
|
|
56
|
+
decodeResult?: UruResultDecoder<unknown>;
|
|
57
|
+
}
|
|
58
|
+
/** A typed result requires runtime proof supplied by the caller. */
|
|
59
|
+
export interface UruDecodedInvocationOptions<TResult> extends UruAppRuntimeInvocationOptions {
|
|
60
|
+
decodeResult: UruResultDecoder<TResult>;
|
|
51
61
|
}
|
|
52
62
|
/** The normalized envelope every capability invocation resolves to. */
|
|
53
63
|
export interface UruAppRuntimeInvocationResponse<TResult = unknown> {
|
|
54
64
|
ok: boolean;
|
|
55
|
-
status:
|
|
56
|
-
state:
|
|
65
|
+
status: string;
|
|
66
|
+
state: string;
|
|
57
67
|
deploymentId: string;
|
|
58
|
-
capabilityType:
|
|
68
|
+
capabilityType: string;
|
|
59
69
|
capabilityName: string;
|
|
60
70
|
result?: TResult | null;
|
|
61
71
|
executionId?: string | null;
|
|
62
72
|
pending: boolean;
|
|
63
|
-
diagnostics:
|
|
73
|
+
diagnostics: RuntimeJsonObject;
|
|
64
74
|
}
|
|
65
75
|
/** The normalized envelope a job-status poll resolves to. */
|
|
66
76
|
export interface UruAppRuntimeExecutionStatus<TResult = unknown> {
|
|
@@ -68,7 +78,7 @@ export interface UruAppRuntimeExecutionStatus<TResult = unknown> {
|
|
|
68
78
|
pending?: boolean;
|
|
69
79
|
result?: TResult | null;
|
|
70
80
|
error?: string | null;
|
|
71
|
-
state?:
|
|
81
|
+
state?: string;
|
|
72
82
|
status?: string | null;
|
|
73
83
|
executionId?: string | null;
|
|
74
84
|
statusUrl?: string | null;
|
|
@@ -77,28 +87,45 @@ export interface UruAppRuntimeExecutionStatus<TResult = unknown> {
|
|
|
77
87
|
executor?: string | null;
|
|
78
88
|
executorKind?: string | null;
|
|
79
89
|
}
|
|
90
|
+
/** Input is untrusted until the transport validates it as a JSON object. */
|
|
91
|
+
export interface UruCapabilityInvoker {
|
|
92
|
+
<TResult>(name: string, input: unknown, options: UruDecodedInvocationOptions<TResult>): Promise<UruAppRuntimeInvocationResponse<TResult>>;
|
|
93
|
+
(name: string, input?: unknown, options?: UruAppRuntimeInvocationOptions): Promise<UruAppRuntimeInvocationResponse>;
|
|
94
|
+
}
|
|
95
|
+
export interface UruJobStatusInvoker {
|
|
96
|
+
<TResult>(executionId: string, options: UruDecodedInvocationOptions<TResult>): Promise<UruAppRuntimeExecutionStatus<TResult>>;
|
|
97
|
+
(executionId: string, options?: UruAppRuntimeInvocationOptions): Promise<UruAppRuntimeExecutionStatus>;
|
|
98
|
+
}
|
|
99
|
+
export interface UruCancelJobInvoker {
|
|
100
|
+
<TResult>(executionId: string, options: UruDecodedInvocationOptions<TResult>): Promise<UruAppRuntimeInvocationResponse<TResult>>;
|
|
101
|
+
(executionId: string, options?: UruAppRuntimeInvocationOptions): Promise<UruAppRuntimeInvocationResponse>;
|
|
102
|
+
}
|
|
103
|
+
export interface UruActionInvoker {
|
|
104
|
+
<TResult>(name: string, input: unknown, options: UruDecodedInvocationOptions<TResult>): Promise<TResult | null | undefined>;
|
|
105
|
+
(name: string, input?: unknown, options?: UruAppRuntimeInvocationOptions): Promise<unknown>;
|
|
106
|
+
}
|
|
80
107
|
/** The capability-invocation client returned by `createUruAppRuntimeClient`. */
|
|
81
108
|
export interface UruAppRuntimeClient {
|
|
82
|
-
query
|
|
83
|
-
action
|
|
84
|
-
job
|
|
85
|
-
endpoint
|
|
86
|
-
serverFunction
|
|
87
|
-
jobStatus
|
|
88
|
-
cancelJob
|
|
109
|
+
query: UruCapabilityInvoker;
|
|
110
|
+
action: UruCapabilityInvoker;
|
|
111
|
+
job: UruCapabilityInvoker;
|
|
112
|
+
endpoint: UruCapabilityInvoker;
|
|
113
|
+
serverFunction: UruCapabilityInvoker;
|
|
114
|
+
jobStatus: UruJobStatusInvoker;
|
|
115
|
+
cancelJob: UruCancelJobInvoker;
|
|
89
116
|
}
|
|
90
117
|
/** Comparison operators accepted by a Dataset `where` clause. */
|
|
91
|
-
export type UruDatasetWhereOperator =
|
|
118
|
+
export type UruDatasetWhereOperator = "eq" | "neq" | "ne" | "gt" | "gte" | "lt" | "lte" | "ilike" | "in" | "nin" | "not_in" | "is_null";
|
|
92
119
|
/** One server-side filter condition. */
|
|
93
120
|
export interface UruDatasetWhereClause {
|
|
94
121
|
field: string;
|
|
95
|
-
op:
|
|
96
|
-
value?:
|
|
122
|
+
op: string;
|
|
123
|
+
value?: RuntimeJsonValue;
|
|
97
124
|
}
|
|
98
125
|
/** One server-side sort condition. */
|
|
99
126
|
export interface UruDatasetSortClause {
|
|
100
127
|
field: string;
|
|
101
|
-
direction:
|
|
128
|
+
direction: "asc" | "desc";
|
|
102
129
|
}
|
|
103
130
|
/**
|
|
104
131
|
* A server-side Dataset read.
|
|
@@ -114,21 +141,25 @@ export interface UruDatasetQuery {
|
|
|
114
141
|
includeDeleted?: boolean;
|
|
115
142
|
select?: readonly string[];
|
|
116
143
|
search?: string;
|
|
117
|
-
filter?:
|
|
144
|
+
filter?: RuntimeJsonObject;
|
|
118
145
|
where?: readonly UruDatasetWhereClause[];
|
|
119
146
|
sort?: readonly UruDatasetSortClause[];
|
|
120
|
-
aggregate?:
|
|
147
|
+
aggregate?: RuntimeJsonObject;
|
|
121
148
|
before?: string;
|
|
122
149
|
cursor?: string;
|
|
123
150
|
}
|
|
124
151
|
/** One page of Dataset rows, plus the total when `includeTotal` asked for it. */
|
|
125
|
-
export interface UruDatasetRowsResult<TRow
|
|
152
|
+
export interface UruDatasetRowsResult<TRow = UruDatasetRow> {
|
|
126
153
|
rows: TRow[];
|
|
127
154
|
total?: number | null;
|
|
128
|
-
|
|
155
|
+
limit?: number;
|
|
156
|
+
offset?: number;
|
|
157
|
+
aggregates?: RuntimeJsonObject | null;
|
|
158
|
+
nextCursor?: string | null;
|
|
159
|
+
sourceMeta?: RuntimeJsonObject | null;
|
|
129
160
|
}
|
|
130
|
-
/** One
|
|
131
|
-
export type UruDatasetRow =
|
|
161
|
+
/** One validated wire row. A caller can decode it into a domain model. */
|
|
162
|
+
export type UruDatasetRow = RuntimeJsonObject;
|
|
132
163
|
/** The envelope every Dataset write resolves to. */
|
|
133
164
|
export interface UruDatasetMutationResult<TResult = unknown> {
|
|
134
165
|
ok: boolean;
|
|
@@ -136,7 +167,7 @@ export interface UruDatasetMutationResult<TResult = unknown> {
|
|
|
136
167
|
deploymentId?: string;
|
|
137
168
|
datasetId?: string | null;
|
|
138
169
|
result: TResult;
|
|
139
|
-
diagnostics?:
|
|
170
|
+
diagnostics?: RuntimeJsonObject;
|
|
140
171
|
}
|
|
141
172
|
/** Bounds and targets for a `datasets.sqlWrite` statement. */
|
|
142
173
|
export interface UruDatasetSqlWriteOptions {
|
|
@@ -151,24 +182,40 @@ export interface UruDatasetSqlWriteOptions {
|
|
|
151
182
|
maxAffected?: number;
|
|
152
183
|
timeoutMs?: number;
|
|
153
184
|
}
|
|
185
|
+
export interface UruDatasetQueryRows {
|
|
186
|
+
<TRow>(datasetRef: string, query: UruDatasetQuery | undefined, decodeRow: UruResultDecoder<TRow>): Promise<UruDatasetRowsResult<TRow>>;
|
|
187
|
+
(datasetRef: string, query?: UruDatasetQuery): Promise<UruDatasetRowsResult>;
|
|
188
|
+
}
|
|
189
|
+
export interface UruDatasetRowMutation {
|
|
190
|
+
<TResult>(datasetRef: string, rows: readonly unknown[], decodeResult: UruResultDecoder<TResult>): Promise<UruDatasetMutationResult<TResult>>;
|
|
191
|
+
(datasetRef: string, rows: readonly unknown[]): Promise<UruDatasetMutationResult>;
|
|
192
|
+
}
|
|
193
|
+
export interface UruDatasetIdMutation {
|
|
194
|
+
<TResult>(datasetRef: string, rowIds: readonly string[], decodeResult: UruResultDecoder<TResult>): Promise<UruDatasetMutationResult<TResult>>;
|
|
195
|
+
(datasetRef: string, rowIds: readonly string[]): Promise<UruDatasetMutationResult>;
|
|
196
|
+
}
|
|
197
|
+
export interface UruDatasetSqlWrite {
|
|
198
|
+
<TResult>(sql: string, options: UruDatasetSqlWriteOptions, decodeResult: UruResultDecoder<TResult>): Promise<UruDatasetMutationResult<TResult>>;
|
|
199
|
+
(sql: string, options: UruDatasetSqlWriteOptions): Promise<UruDatasetMutationResult>;
|
|
200
|
+
}
|
|
154
201
|
/** The Dataset read/write surface hung off a server context. */
|
|
155
202
|
export interface UruDatasetsContext {
|
|
156
|
-
queryRows:
|
|
157
|
-
insertRows:
|
|
158
|
-
upsertRows:
|
|
159
|
-
deleteRows:
|
|
160
|
-
restoreRows:
|
|
161
|
-
sqlWrite:
|
|
203
|
+
queryRows: UruDatasetQueryRows;
|
|
204
|
+
insertRows: UruDatasetRowMutation;
|
|
205
|
+
upsertRows: UruDatasetRowMutation;
|
|
206
|
+
deleteRows: UruDatasetIdMutation;
|
|
207
|
+
restoreRows: UruDatasetIdMutation;
|
|
208
|
+
sqlWrite: UruDatasetSqlWrite;
|
|
162
209
|
}
|
|
163
210
|
/** Everything a Uru server runtime hands an app. */
|
|
164
211
|
export interface UruServerContext {
|
|
165
212
|
datasets: UruDatasetsContext;
|
|
166
213
|
app: UruAppRuntimeClient;
|
|
167
214
|
actions: {
|
|
168
|
-
run:
|
|
215
|
+
run: UruActionInvoker;
|
|
169
216
|
};
|
|
170
217
|
jobs: {
|
|
171
|
-
start:
|
|
218
|
+
start: UruCapabilityInvoker;
|
|
172
219
|
};
|
|
173
220
|
secrets: {
|
|
174
221
|
has: (name: string) => boolean;
|
|
@@ -190,7 +237,7 @@ export interface UruProviderRuntimeEnvironment {
|
|
|
190
237
|
/** Options for `createUruServerContext`. */
|
|
191
238
|
export interface CreateUruServerContextOptions {
|
|
192
239
|
/** Override the `fetch` used for every call. Defaults to `globalThis.fetch`. */
|
|
193
|
-
fetch?:
|
|
240
|
+
fetch?: RuntimeFetch;
|
|
194
241
|
}
|
|
195
242
|
/** Options for `createUruAppRuntimeClient`. */
|
|
196
243
|
export interface CreateUruAppRuntimeClientOptions {
|
|
@@ -199,7 +246,7 @@ export interface CreateUruAppRuntimeClientOptions {
|
|
|
199
246
|
runtimeBasePath?: string;
|
|
200
247
|
publicPageSlug?: string;
|
|
201
248
|
providerRuntime?: boolean;
|
|
202
|
-
fetch?:
|
|
249
|
+
fetch?: RuntimeFetch;
|
|
203
250
|
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
204
251
|
/**
|
|
205
252
|
* Client-side runaway dampers (P2 cost-safety). Every field defaults; pass
|
|
@@ -209,3 +256,4 @@ export interface CreateUruAppRuntimeClientOptions {
|
|
|
209
256
|
*/
|
|
210
257
|
dampers?: UruRunawayDamperOptions;
|
|
211
258
|
}
|
|
259
|
+
export {};
|
package/dist/types.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the barrel. Publishing turns barrel exports into permanent promises, so the
|
|
10
10
|
* cycle was broken instead of documented.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* All imports are type-only. JSON values belong to the HTTP edge, not to a
|
|
13
|
+
* domain model's inheritance hierarchy.
|
|
14
14
|
*/
|
|
15
15
|
export {};
|
package/package.json
CHANGED
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"name": "@uru-intelligence/app",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Runtime client for Uru Gems: capability calls, Datasets, jobs and secrets",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"gem",
|
|
8
|
+
"runtime",
|
|
9
|
+
"sdk",
|
|
10
|
+
"uru"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/Ignition-Forward/uru-workspace-platform/tree/development/packages/app#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Ignition-Forward/uru-workspace-platform/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Ignition-Forward/uru-workspace-platform.git",
|
|
20
|
+
"directory": "packages/app"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
18
35
|
},
|
|
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
|
-
"check:package": "node ../../scripts/checks/check-app-package-publishable.mjs",
|
|
48
|
-
"check:node-floor": "node ../../scripts/checks/check-app-package-node-floor.mjs"
|
|
49
|
-
},
|
|
50
|
-
"packageManager": "bun@1.3.13",
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": ">=22.12.0"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"publint": "0.3.24",
|
|
56
|
-
"typescript": "7.0.2"
|
|
57
|
-
},
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"access": "public",
|
|
60
|
-
"provenance": false
|
|
61
|
-
}
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"provenance": false
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"clean": "rm -rf dist",
|
|
45
|
+
"prepack": "bun run clean && bun run build",
|
|
46
|
+
"type-check": "tsc --noEmit",
|
|
47
|
+
"lint": "node ../../scripts/run-with-repo-node.mjs oxlint --type-aware --deny-warnings -c ../../oxlint.config.mts .",
|
|
48
|
+
"lint:fix": "node ../../scripts/run-with-repo-node.mjs oxlint --type-aware --deny-warnings -c ../../oxlint.config.mts --fix .",
|
|
49
|
+
"test": "bun test",
|
|
50
|
+
"test:unit": "bun test",
|
|
51
|
+
"check:package": "node ../../scripts/checks/check-app-package-publishable.mjs",
|
|
52
|
+
"check:node-floor": "node ../../scripts/checks/check-app-package-node-floor.mjs"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "24.13.3",
|
|
56
|
+
"bun-types": "1.3.13",
|
|
57
|
+
"publint": "0.3.24",
|
|
58
|
+
"typescript": "7.0.2"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=22.12.0"
|
|
62
|
+
},
|
|
63
|
+
"packageManager": "bun@1.3.13"
|
|
62
64
|
}
|
package/dist/errorResponse.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function isRecord(value) {
|
|
2
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
3
|
-
}
|
|
4
|
-
/** Read the canonical owned HTTP error envelope without accepting removed aliases. */
|
|
5
|
-
export function runtimeErrorMessage(body, fallback) {
|
|
6
|
-
if (!isRecord(body) || !isRecord(body.error)) {
|
|
7
|
-
return fallback;
|
|
8
|
-
}
|
|
9
|
-
const message = body.error.message;
|
|
10
|
-
return typeof message === 'string' && message.trim() ? message : fallback;
|
|
11
|
-
}
|