@atscript/odata-client 0.0.1 → 0.0.3
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 +10 -4
- package/dist/index.cjs +28 -7
- package/dist/index.d.cts +9 -8
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +29 -8
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ server in between. It is a `ClientLike` of `@atscript/db-client` (every public m
|
|
|
32
32
|
pnpm add @atscript/odata-client @atscript/db-client @atscript/db @atscript/typescript @uniqu/core
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Needs `@atscript/db` and `@atscript/db-client` 0.1.
|
|
35
|
+
Needs `@atscript/db` and `@atscript/db-client` 0.1.201 or newer and `@atscript/typescript` 0.2.26
|
|
36
36
|
or newer.
|
|
37
37
|
|
|
38
38
|
The models come from the generator of `@atscript/odata`, and the screens from Atscript UI: see
|
|
@@ -162,7 +162,10 @@ it is given, draft or active.
|
|
|
162
162
|
|
|
163
163
|
The metadata advertises exactly that: `crud` lists the reads the entity set supports and the
|
|
164
164
|
writes it allows, `actions` the operations bound to the set, and every field carries the sort and filter capabilities
|
|
165
|
-
the service declares.
|
|
165
|
+
the service declares. An OData v4 set is searchable unless its `SearchRestrictions` say otherwise;
|
|
166
|
+
for a v4 service that refuses `$search` and declares nothing, register it with `search: false`:
|
|
167
|
+
its sets are then searchable only where the metadata declares it (a `SearchRestrictions` record
|
|
168
|
+
whose `Searchable` is not false). The served type keeps the `db.*` annotations moost-db serves, currency,
|
|
166
169
|
unit and precision among them.
|
|
167
170
|
|
|
168
171
|
Relations of `$with` are read through `$expand` in the same request, with their filter, selection
|
|
@@ -209,7 +212,8 @@ await odata.call("Z_RECALC", { params: { Plant: "1000" } });
|
|
|
209
212
|
```
|
|
210
213
|
|
|
211
214
|
`row` sends its `__etag` as `If-Match` on a call that writes (a function, and a call on the
|
|
212
|
-
collection, sends `If-Match: *` on a set with a version token
|
|
215
|
+
collection, sends `If-Match: *` on a set with a version token; a `412` to it is a `404`
|
|
216
|
+
`NOT_FOUND`: the row is gone); the third
|
|
213
217
|
argument takes `signal` and `locale` (sent as `Accept-Language`, as the clients send
|
|
214
218
|
atscript-ui's). The parameters are validated against the live type (`ClientValidationError`); `extra` sends
|
|
215
219
|
parameters an OData v2 import does not declare, untyped (OData v4 refuses it). An operation the
|
|
@@ -385,7 +389,9 @@ codes):
|
|
|
385
389
|
`NOT_FOUND`, both with moost-db's body;
|
|
386
390
|
- parameters of an operation its type rejects are a `ClientValidationError`, before any call;
|
|
387
391
|
- a login page answered instead of data is a `ClientError` with status `401`
|
|
388
|
-
(`UNEXPECTED_CONTENT`)
|
|
392
|
+
(`UNEXPECTED_CONTENT`), and so is a redirect answering a write: a write is never followed to
|
|
393
|
+
another address (a redirect to another origin without CORS headers is a network error, a
|
|
394
|
+
`TransportError`: the browser checks CORS on the `3xx` first);
|
|
389
395
|
- every call of an entity set the live service lacks is a `ClientError` 404 `NOT_FOUND`, the body
|
|
390
396
|
a Moost server answers;
|
|
391
397
|
- a network failure or an aborted call is a `TransportError`.
|
package/dist/index.cjs
CHANGED
|
@@ -147,7 +147,12 @@ function abortCause(error) {
|
|
|
147
147
|
cause.name = /timed out/i.test(error.message) ? "TimeoutError" : "AbortError";
|
|
148
148
|
return cause;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* A page where data was asked for, or a redirect of a write (`hint: "redirected"`): what a login
|
|
152
|
+
* or single-sign-on redirect leads to.
|
|
153
|
+
*/
|
|
154
|
+
function isLoginLike(error) {
|
|
155
|
+
if (error.hint === "redirected") return true;
|
|
151
156
|
const type = error.headers["content-type"] ?? "";
|
|
152
157
|
return /html/i.test(type) || typeof error.body === "string" && /^\uFEFF?\s*<(?:!doctype\s+html|html[\s>])/i.test(error.body);
|
|
153
158
|
}
|
|
@@ -156,7 +161,7 @@ function fromODataError(error, context) {
|
|
|
156
161
|
switch (error.kind) {
|
|
157
162
|
case "network": return new _atscript_db_client.TransportError(method, url, error.message, error.cause ?? error);
|
|
158
163
|
case "aborted": return new _atscript_db_client.TransportError(method, url, error.message, abortCause(error));
|
|
159
|
-
case "unexpected-content": return
|
|
164
|
+
case "unexpected-content": return isLoginLike(error) ? new _atscript_db_client.ClientError(401, body(401, error.message, "UNEXPECTED_CONTENT", [])) : new _atscript_db_client.TransportError(method, url, error.message, error);
|
|
160
165
|
default: return new _atscript_db_client.ClientError(error.status, body(error.status, error.message, error.code, (0, _atscript_odata.messageEntries)(error, context)));
|
|
161
166
|
}
|
|
162
167
|
}
|
|
@@ -205,7 +210,7 @@ function causedAs(client, error) {
|
|
|
205
210
|
* | `ODataError` `504` | `ClientError` 504, `STORE_TIMEOUT` |
|
|
206
211
|
* | `ODataError` `5xx` (other than `501`) | `ClientError` 502, `STORE_FAILED` |
|
|
207
212
|
* | `ODataError` `http` / `csrf` (other) | `ClientError` with the HTTP status, the service's code and messages |
|
|
208
|
-
* | `ODataError` `unexpected-content`, an HTML page
|
|
213
|
+
* | `ODataError` `unexpected-content`, an HTML page or a redirect | `ClientError` 401, `UNEXPECTED_CONTENT` |
|
|
209
214
|
* | `ODataError` `unexpected-content`, otherwise | `TransportError`: a `2xx` answer that cannot be read |
|
|
210
215
|
* | `ODataError` `network` / `aborted` | `TransportError` (`aborted` is `true` for an aborted call) |
|
|
211
216
|
* | `ODataServiceError` (other), an unreadable body | `TransportError`: the service answered, the answer is not usable |
|
|
@@ -225,7 +230,13 @@ function toClientError(error, context = {}) {
|
|
|
225
230
|
return withCause(new _atscript_db_client.ClientError(status, body(status, message, code, entries)), error);
|
|
226
231
|
}
|
|
227
232
|
if ((0, _atscript_odata.isODataError)(error)) return fromODataError(error, context);
|
|
228
|
-
if ((0, _atscript_odata.isODataServiceError)(error))
|
|
233
|
+
if ((0, _atscript_odata.isODataServiceError)(error)) {
|
|
234
|
+
const { method, url } = (0, _atscript_odata.isODataError)(error.cause) ? error.cause.request : {
|
|
235
|
+
method: "GET",
|
|
236
|
+
url: error.link ?? context.url ?? ""
|
|
237
|
+
};
|
|
238
|
+
return new _atscript_db_client.TransportError(method, url, error.message, error);
|
|
239
|
+
}
|
|
229
240
|
if ((0, _atscript_odata.isODataPayloadError)(error)) return new _atscript_db_client.TransportError("GET", context.url ?? "", error.message, error);
|
|
230
241
|
return error;
|
|
231
242
|
}
|
|
@@ -1244,11 +1255,19 @@ var ODataEntityClient = class {
|
|
|
1244
1255
|
},
|
|
1245
1256
|
params
|
|
1246
1257
|
};
|
|
1247
|
-
|
|
1258
|
+
const connection = this.connected().operations;
|
|
1259
|
+
const mapped = (error) => toClientError(error, {
|
|
1260
|
+
...this.errorContext,
|
|
1261
|
+
parameters: (0, _atscript_odata.runParameters)(connection, run)
|
|
1262
|
+
});
|
|
1263
|
+
const call = () => callOperation(connection, run, this.init(void 0)).catch((error) => {
|
|
1264
|
+
throw mapped(error);
|
|
1265
|
+
});
|
|
1266
|
+
if (action.info.level !== "rows") return call();
|
|
1248
1267
|
if (id !== void 0 && !Array.isArray(id)) throw new TypeError(`client.action("${name}"): rows-level actions require an array of identifier objects; received ${shapeOf(id)}.`);
|
|
1249
1268
|
const rows = await this.actionRows(action, id ?? []);
|
|
1250
1269
|
run.rows = rows;
|
|
1251
|
-
return rowsAnswer(await
|
|
1270
|
+
return rowsAnswer(await call(), rows, this.describe().key, mapped);
|
|
1252
1271
|
});
|
|
1253
1272
|
}
|
|
1254
1273
|
geoSearch() {
|
|
@@ -1916,9 +1935,11 @@ function createODataClientFactory(options) {
|
|
|
1916
1935
|
} : answer;
|
|
1917
1936
|
} catch (error) {
|
|
1918
1937
|
const entitySet = runEntitySet(run);
|
|
1938
|
+
const parameters = (0, _atscript_odata.runParameters)(connection, run);
|
|
1919
1939
|
throw toClientError(error, {
|
|
1920
1940
|
model: connection.service.model,
|
|
1921
|
-
entitySet
|
|
1941
|
+
entitySet,
|
|
1942
|
+
parameters
|
|
1922
1943
|
});
|
|
1923
1944
|
}
|
|
1924
1945
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AtscriptClientShape, ClientError, ClientLike, ClientOptions, MetaResponse, ServerError, TClientCallOptions, TDbActionInfo } from "@atscript/db-client";
|
|
2
|
-
import { ODataCallAnswer, ODataCallInit, ODataCallInput, ODataConnection, ODataOperationConnection, ODataOperationRef, ODataService, ODataSourceOptions, ProtocolContext, ServiceModel } from "@atscript/odata";
|
|
2
|
+
import { ODataCallAnswer, ODataCallInit, ODataCallInput, ODataConnection, ODataMessageContext, ODataOperationConnection, ODataOperationRef, ODataService, ODataSourceOptions, ProtocolContext, ServiceModel } from "@atscript/odata";
|
|
3
3
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
4
4
|
|
|
5
5
|
//#region src/batch.d.ts
|
|
@@ -494,7 +494,8 @@ type ODataClientErrorEntry = NonNullable<ServerError["errors"]>[number];
|
|
|
494
494
|
* (`UNSUPPORTED_ON_V2`: a filter or sort of a relation), as moost-db answers the core's
|
|
495
495
|
* `NOT_SUPPORTED`
|
|
496
496
|
* - `UNEXPECTED_CONTENT` (401): the service answered with an HTML page where data was asked for,
|
|
497
|
-
* which is what a login or
|
|
497
|
+
* or with a redirect where a write was sent (never followed), which is what a login or
|
|
498
|
+
* single-sign-on redirect leads to
|
|
498
499
|
* - `CAS_NOT_SUPPORTED` (on the entry of a 400 `NOT_SUPPORTED`): a write carries a `$cas` that is
|
|
499
500
|
* not the entity set's version token: an insert, an entity set that declares no optimistic
|
|
500
501
|
* concurrency, an integer version, or a `$cas` that differs from the token the row carries
|
|
@@ -511,11 +512,11 @@ type ODataClientErrorEntry = NonNullable<ServerError["errors"]>[number];
|
|
|
511
512
|
* body: `kind: "version_mismatch"` and the entity's current token, read after the `412`
|
|
512
513
|
*/
|
|
513
514
|
type ODataClientErrorCode = "NOT_SUPPORTED" | "UNEXPECTED_CONTENT" | "CAS_NOT_SUPPORTED" | "UNSUPPORTED_ARRAY_OPERATOR" | "UNSUPPORTED_FIELD_OPERATOR" | "NOT_FOUND" | "VERSION_MISMATCH";
|
|
514
|
-
/**
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
515
|
+
/**
|
|
516
|
+
* What an error is about, for mapping service message targets to field paths: the core's message
|
|
517
|
+
* context (model, entity set, an operation's parameters) and the client's URL.
|
|
518
|
+
*/
|
|
519
|
+
interface ODataClientErrorContext extends ODataMessageContext {
|
|
519
520
|
/** The URL the client is known by, named in a `TransportError` that has no request of its own. */
|
|
520
521
|
url?: string;
|
|
521
522
|
}
|
|
@@ -557,7 +558,7 @@ declare function messagePath(target: string | undefined, context?: ODataClientEr
|
|
|
557
558
|
* | `ODataError` `504` | `ClientError` 504, `STORE_TIMEOUT` |
|
|
558
559
|
* | `ODataError` `5xx` (other than `501`) | `ClientError` 502, `STORE_FAILED` |
|
|
559
560
|
* | `ODataError` `http` / `csrf` (other) | `ClientError` with the HTTP status, the service's code and messages |
|
|
560
|
-
* | `ODataError` `unexpected-content`, an HTML page
|
|
561
|
+
* | `ODataError` `unexpected-content`, an HTML page or a redirect | `ClientError` 401, `UNEXPECTED_CONTENT` |
|
|
561
562
|
* | `ODataError` `unexpected-content`, otherwise | `TransportError`: a `2xx` answer that cannot be read |
|
|
562
563
|
* | `ODataError` `network` / `aborted` | `TransportError` (`aborted` is `true` for an aborted call) |
|
|
563
564
|
* | `ODataServiceError` (other), an unreadable body | `TransportError`: the service answered, the answer is not usable |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AtscriptClientShape, ClientError, ClientLike, ClientOptions, MetaResponse, ServerError, TClientCallOptions, TDbActionInfo, VersionMismatchError } from "@atscript/db-client";
|
|
2
|
-
import { ODataCallAnswer, ODataCallInit, ODataCallInput, ODataConnection, ODataOperationConnection, ODataOperationRef, ODataService, ODataSourceOptions, ProtocolContext, ServiceModel } from "@atscript/odata";
|
|
2
|
+
import { ODataCallAnswer, ODataCallInit, ODataCallInput, ODataConnection, ODataMessageContext, ODataOperationConnection, ODataOperationRef, ODataService, ODataSourceOptions, ProtocolContext, ServiceModel } from "@atscript/odata";
|
|
3
3
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
4
4
|
|
|
5
5
|
//#region src/batch.d.ts
|
|
@@ -494,7 +494,8 @@ type ODataClientErrorEntry = NonNullable<ServerError["errors"]>[number];
|
|
|
494
494
|
* (`UNSUPPORTED_ON_V2`: a filter or sort of a relation), as moost-db answers the core's
|
|
495
495
|
* `NOT_SUPPORTED`
|
|
496
496
|
* - `UNEXPECTED_CONTENT` (401): the service answered with an HTML page where data was asked for,
|
|
497
|
-
* which is what a login or
|
|
497
|
+
* or with a redirect where a write was sent (never followed), which is what a login or
|
|
498
|
+
* single-sign-on redirect leads to
|
|
498
499
|
* - `CAS_NOT_SUPPORTED` (on the entry of a 400 `NOT_SUPPORTED`): a write carries a `$cas` that is
|
|
499
500
|
* not the entity set's version token: an insert, an entity set that declares no optimistic
|
|
500
501
|
* concurrency, an integer version, or a `$cas` that differs from the token the row carries
|
|
@@ -511,11 +512,11 @@ type ODataClientErrorEntry = NonNullable<ServerError["errors"]>[number];
|
|
|
511
512
|
* body: `kind: "version_mismatch"` and the entity's current token, read after the `412`
|
|
512
513
|
*/
|
|
513
514
|
type ODataClientErrorCode = "NOT_SUPPORTED" | "UNEXPECTED_CONTENT" | "CAS_NOT_SUPPORTED" | "UNSUPPORTED_ARRAY_OPERATOR" | "UNSUPPORTED_FIELD_OPERATOR" | "NOT_FOUND" | "VERSION_MISMATCH";
|
|
514
|
-
/**
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
515
|
+
/**
|
|
516
|
+
* What an error is about, for mapping service message targets to field paths: the core's message
|
|
517
|
+
* context (model, entity set, an operation's parameters) and the client's URL.
|
|
518
|
+
*/
|
|
519
|
+
interface ODataClientErrorContext extends ODataMessageContext {
|
|
519
520
|
/** The URL the client is known by, named in a `TransportError` that has no request of its own. */
|
|
520
521
|
url?: string;
|
|
521
522
|
}
|
|
@@ -557,7 +558,7 @@ declare function messagePath(target: string | undefined, context?: ODataClientEr
|
|
|
557
558
|
* | `ODataError` `504` | `ClientError` 504, `STORE_TIMEOUT` |
|
|
558
559
|
* | `ODataError` `5xx` (other than `501`) | `ClientError` 502, `STORE_FAILED` |
|
|
559
560
|
* | `ODataError` `http` / `csrf` (other) | `ClientError` with the HTTP status, the service's code and messages |
|
|
560
|
-
* | `ODataError` `unexpected-content`, an HTML page
|
|
561
|
+
* | `ODataError` `unexpected-content`, an HTML page or a redirect | `ClientError` 401, `UNEXPECTED_CONTENT` |
|
|
561
562
|
* | `ODataError` `unexpected-content`, otherwise | `TransportError`: a `2xx` answer that cannot be read |
|
|
562
563
|
* | `ODataError` `network` / `aborted` | `TransportError` (`aborted` is `true` for an aborted call) |
|
|
563
564
|
* | `ODataServiceError` (other), an unreadable body | `TransportError`: the service answered, the answer is not usable |
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionNotFoundError, Client, ClientError, ClientValidationError, TransportError, VersionMismatchError } from "@atscript/db-client";
|
|
2
|
-
import { ODataQueryError, ODataWriteError, VERSION_TOKEN, aggregateSpecFromUniquery, allowedWrites, changeByKey, createODataSource, createSession, dbFailureOf, demandsOtherFilter, describeEntitySet, describeField, dialectFor, formatKey, headersKey, isODataError, isODataPayloadError, isODataServiceError, messageEntries, messagePath as messagePath$1, metadataDigest, operationOf, operationWrites, operationsOf, opsLayout, readSpecFromUniquery, rowsFailure, runOperation, sendEach, sendsRowToken, structuredMembers, withLocale, writeFailureOf, writeRefusal } from "@atscript/odata";
|
|
2
|
+
import { ODataQueryError, ODataWriteError, VERSION_TOKEN, aggregateSpecFromUniquery, allowedWrites, changeByKey, createODataSource, createSession, dbFailureOf, demandsOtherFilter, describeEntitySet, describeField, dialectFor, formatKey, headersKey, isODataError, isODataPayloadError, isODataServiceError, messageEntries, messagePath as messagePath$1, metadataDigest, operationOf, operationWrites, operationsOf, opsLayout, readSpecFromUniquery, rowsFailure, runOperation, runParameters, sendEach, sendsRowToken, structuredMembers, withLocale, writeFailureOf, writeRefusal } from "@atscript/odata";
|
|
3
3
|
import { ValidatorError, isAnnotatedType } from "@atscript/typescript/utils";
|
|
4
4
|
import { serializeMetaType } from "@atscript/db/meta";
|
|
5
5
|
//#region src/errors.ts
|
|
@@ -146,7 +146,12 @@ function abortCause(error) {
|
|
|
146
146
|
cause.name = /timed out/i.test(error.message) ? "TimeoutError" : "AbortError";
|
|
147
147
|
return cause;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
/**
|
|
150
|
+
* A page where data was asked for, or a redirect of a write (`hint: "redirected"`): what a login
|
|
151
|
+
* or single-sign-on redirect leads to.
|
|
152
|
+
*/
|
|
153
|
+
function isLoginLike(error) {
|
|
154
|
+
if (error.hint === "redirected") return true;
|
|
150
155
|
const type = error.headers["content-type"] ?? "";
|
|
151
156
|
return /html/i.test(type) || typeof error.body === "string" && /^\uFEFF?\s*<(?:!doctype\s+html|html[\s>])/i.test(error.body);
|
|
152
157
|
}
|
|
@@ -155,7 +160,7 @@ function fromODataError(error, context) {
|
|
|
155
160
|
switch (error.kind) {
|
|
156
161
|
case "network": return new TransportError(method, url, error.message, error.cause ?? error);
|
|
157
162
|
case "aborted": return new TransportError(method, url, error.message, abortCause(error));
|
|
158
|
-
case "unexpected-content": return
|
|
163
|
+
case "unexpected-content": return isLoginLike(error) ? new ClientError(401, body(401, error.message, "UNEXPECTED_CONTENT", [])) : new TransportError(method, url, error.message, error);
|
|
159
164
|
default: return new ClientError(error.status, body(error.status, error.message, error.code, messageEntries(error, context)));
|
|
160
165
|
}
|
|
161
166
|
}
|
|
@@ -204,7 +209,7 @@ function causedAs(client, error) {
|
|
|
204
209
|
* | `ODataError` `504` | `ClientError` 504, `STORE_TIMEOUT` |
|
|
205
210
|
* | `ODataError` `5xx` (other than `501`) | `ClientError` 502, `STORE_FAILED` |
|
|
206
211
|
* | `ODataError` `http` / `csrf` (other) | `ClientError` with the HTTP status, the service's code and messages |
|
|
207
|
-
* | `ODataError` `unexpected-content`, an HTML page
|
|
212
|
+
* | `ODataError` `unexpected-content`, an HTML page or a redirect | `ClientError` 401, `UNEXPECTED_CONTENT` |
|
|
208
213
|
* | `ODataError` `unexpected-content`, otherwise | `TransportError`: a `2xx` answer that cannot be read |
|
|
209
214
|
* | `ODataError` `network` / `aborted` | `TransportError` (`aborted` is `true` for an aborted call) |
|
|
210
215
|
* | `ODataServiceError` (other), an unreadable body | `TransportError`: the service answered, the answer is not usable |
|
|
@@ -224,7 +229,13 @@ function toClientError(error, context = {}) {
|
|
|
224
229
|
return withCause(new ClientError(status, body(status, message, code, entries)), error);
|
|
225
230
|
}
|
|
226
231
|
if (isODataError(error)) return fromODataError(error, context);
|
|
227
|
-
if (isODataServiceError(error))
|
|
232
|
+
if (isODataServiceError(error)) {
|
|
233
|
+
const { method, url } = isODataError(error.cause) ? error.cause.request : {
|
|
234
|
+
method: "GET",
|
|
235
|
+
url: error.link ?? context.url ?? ""
|
|
236
|
+
};
|
|
237
|
+
return new TransportError(method, url, error.message, error);
|
|
238
|
+
}
|
|
228
239
|
if (isODataPayloadError(error)) return new TransportError("GET", context.url ?? "", error.message, error);
|
|
229
240
|
return error;
|
|
230
241
|
}
|
|
@@ -1243,11 +1254,19 @@ var ODataEntityClient = class {
|
|
|
1243
1254
|
},
|
|
1244
1255
|
params
|
|
1245
1256
|
};
|
|
1246
|
-
|
|
1257
|
+
const connection = this.connected().operations;
|
|
1258
|
+
const mapped = (error) => toClientError(error, {
|
|
1259
|
+
...this.errorContext,
|
|
1260
|
+
parameters: runParameters(connection, run)
|
|
1261
|
+
});
|
|
1262
|
+
const call = () => callOperation(connection, run, this.init(void 0)).catch((error) => {
|
|
1263
|
+
throw mapped(error);
|
|
1264
|
+
});
|
|
1265
|
+
if (action.info.level !== "rows") return call();
|
|
1247
1266
|
if (id !== void 0 && !Array.isArray(id)) throw new TypeError(`client.action("${name}"): rows-level actions require an array of identifier objects; received ${shapeOf(id)}.`);
|
|
1248
1267
|
const rows = await this.actionRows(action, id ?? []);
|
|
1249
1268
|
run.rows = rows;
|
|
1250
|
-
return rowsAnswer(await
|
|
1269
|
+
return rowsAnswer(await call(), rows, this.describe().key, mapped);
|
|
1251
1270
|
});
|
|
1252
1271
|
}
|
|
1253
1272
|
geoSearch() {
|
|
@@ -1915,9 +1934,11 @@ function createODataClientFactory(options) {
|
|
|
1915
1934
|
} : answer;
|
|
1916
1935
|
} catch (error) {
|
|
1917
1936
|
const entitySet = runEntitySet(run);
|
|
1937
|
+
const parameters = runParameters(connection, run);
|
|
1918
1938
|
throw toClientError(error, {
|
|
1919
1939
|
model: connection.service.model,
|
|
1920
|
-
entitySet
|
|
1940
|
+
entitySet,
|
|
1941
|
+
parameters
|
|
1921
1942
|
});
|
|
1922
1943
|
}
|
|
1923
1944
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/odata-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Browser client that talks OData directly and looks like an Atscript DB client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@atscript/odata": "^0.0.
|
|
40
|
+
"@atscript/odata": "^0.0.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@atscript/core": "^0.2.
|
|
44
|
-
"@atscript/db": "^0.1.
|
|
45
|
-
"@atscript/db-client": "^0.1.
|
|
46
|
-
"@atscript/typescript": "^0.2.
|
|
47
|
-
"@atscript/ui": "^0.1.
|
|
48
|
-
"@atscript/ui-table": "^0.1.
|
|
43
|
+
"@atscript/core": "^0.2.26",
|
|
44
|
+
"@atscript/db": "^0.1.201",
|
|
45
|
+
"@atscript/db-client": "^0.1.201",
|
|
46
|
+
"@atscript/typescript": "^0.2.26",
|
|
47
|
+
"@atscript/ui": "^0.1.196",
|
|
48
|
+
"@atscript/ui-table": "^0.1.196",
|
|
49
49
|
"@uniqu/core": "^0.2.2",
|
|
50
|
-
"unplugin-atscript": "^0.2.
|
|
50
|
+
"unplugin-atscript": "^0.2.26"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atscript/db": "^0.1.
|
|
54
|
-
"@atscript/db-client": "^0.1.
|
|
55
|
-
"@atscript/typescript": "^0.2.
|
|
53
|
+
"@atscript/db": "^0.1.201",
|
|
54
|
+
"@atscript/db-client": "^0.1.201",
|
|
55
|
+
"@atscript/typescript": "^0.2.26",
|
|
56
56
|
"@uniqu/core": "^0.2.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|