@aouda/client 0.1.15 → 0.1.17
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 +1 -1
- package/dist/cli/index.cjs +59 -23
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +59 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-CXfjcF61.d.cts → client-CeON_I6V.d.cts} +91 -7
- package/dist/{client-CXfjcF61.d.ts → client-CeON_I6V.d.ts} +91 -7
- package/dist/index.cjs +59 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +59 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Generate TypeScript types from your Aouda schema (B.8 CLI):
|
|
|
75
75
|
npx @aouda/client generate --server http://localhost:5000 --output ./types/
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
The generated file (e.g. `schema.ts`) exports a `Schema` interface, a `TableName` union, and one interface per table. That shape is compatible with the typed client: use it as the generic for `createAoudaClient<Schema>(options)`.
|
|
78
|
+
The generated file (e.g. `schema.ts`) exports a `Schema` interface, a `TableName` union, and one interface per table. Named-query `*Row` interfaces include `selectExpr` aliases with server-inferred TypeScript types (`Int32` → `number`, uninferable → `unknown`) after generate against a post-S08 server. That shape is compatible with the typed client: use it as the generic for `createAoudaClient<Schema>(options)`.
|
|
79
79
|
|
|
80
80
|
```typescript
|
|
81
81
|
import { createAoudaClient } from '@aouda/client';
|
package/dist/cli/index.cjs
CHANGED
|
@@ -421,7 +421,7 @@ var import_node_url = require("url");
|
|
|
421
421
|
// package.json
|
|
422
422
|
var package_default = {
|
|
423
423
|
name: "@aouda/client",
|
|
424
|
-
version: "0.1.
|
|
424
|
+
version: "0.1.17",
|
|
425
425
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
426
426
|
type: "module",
|
|
427
427
|
main: "./dist/index.cjs",
|
|
@@ -514,9 +514,10 @@ var AoudaError = class extends Error {
|
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
516
|
var AoudaConnectionError = class extends AoudaError {
|
|
517
|
-
constructor(message, cause) {
|
|
517
|
+
constructor(message, cause, rowErrors) {
|
|
518
518
|
super(message);
|
|
519
519
|
this.cause = cause;
|
|
520
|
+
this.rowErrors = rowErrors;
|
|
520
521
|
this.name = "AoudaConnectionError";
|
|
521
522
|
}
|
|
522
523
|
};
|
|
@@ -536,7 +537,7 @@ var AoudaResponseError = class extends AoudaError {
|
|
|
536
537
|
}
|
|
537
538
|
};
|
|
538
539
|
var AoudaApiError = class extends AoudaError {
|
|
539
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
540
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
540
541
|
super(message);
|
|
541
542
|
this.code = code;
|
|
542
543
|
this.statusCode = statusCode;
|
|
@@ -544,36 +545,37 @@ var AoudaApiError = class extends AoudaError {
|
|
|
544
545
|
this.requestId = requestId;
|
|
545
546
|
this.retryAfterSeconds = retryAfterSeconds;
|
|
546
547
|
this.token = token;
|
|
548
|
+
this.rowErrors = rowErrors;
|
|
547
549
|
this.name = "AoudaApiError";
|
|
548
550
|
}
|
|
549
551
|
};
|
|
550
552
|
var AoudaNotFoundError = class extends AoudaApiError {
|
|
551
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
552
|
-
super(message, code, statusCode, details, requestId, retryAfterSeconds, token);
|
|
553
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
554
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors);
|
|
553
555
|
this.name = "AoudaNotFoundError";
|
|
554
556
|
}
|
|
555
557
|
};
|
|
556
558
|
var AoudaConflictError = class extends AoudaApiError {
|
|
557
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
558
|
-
super(message, code, statusCode, details, requestId, retryAfterSeconds, token);
|
|
559
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
560
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors);
|
|
559
561
|
this.name = "AoudaConflictError";
|
|
560
562
|
}
|
|
561
563
|
};
|
|
562
564
|
var AoudaValidationError = class extends AoudaApiError {
|
|
563
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
564
|
-
super(message, code, statusCode, details, requestId, retryAfterSeconds, token);
|
|
565
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
566
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors);
|
|
565
567
|
this.name = "AoudaValidationError";
|
|
566
568
|
}
|
|
567
569
|
};
|
|
568
570
|
var AoudaServerError = class extends AoudaApiError {
|
|
569
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
570
|
-
super(message, code, statusCode, details, requestId, retryAfterSeconds, token);
|
|
571
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
572
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors);
|
|
571
573
|
this.name = "AoudaServerError";
|
|
572
574
|
}
|
|
573
575
|
};
|
|
574
576
|
var AoudaAuthenticationError = class extends AoudaApiError {
|
|
575
|
-
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token) {
|
|
576
|
-
super(message, code, statusCode, details, requestId, retryAfterSeconds, token);
|
|
577
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors) {
|
|
578
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds, token, rowErrors);
|
|
577
579
|
this.name = "AoudaAuthenticationError";
|
|
578
580
|
}
|
|
579
581
|
};
|
|
@@ -1510,6 +1512,10 @@ var ERROR_CODE_MAP = {
|
|
|
1510
1512
|
INVALID_OPERATOR: AoudaValidationError,
|
|
1511
1513
|
INVALID_COLUMN: AoudaValidationError,
|
|
1512
1514
|
INVALID_VALUE: AoudaValidationError,
|
|
1515
|
+
CONSTRAINT_CHECK_VIOLATION: AoudaValidationError,
|
|
1516
|
+
TRANSFORM_DERIVED_READONLY: AoudaValidationError,
|
|
1517
|
+
TRANSFORM_ROUTE_UNMATCHED: AoudaValidationError,
|
|
1518
|
+
TRANSFORM_ROUTE_AMBIGUOUS: AoudaValidationError,
|
|
1513
1519
|
UNSUPPORTED_VERSION: AoudaValidationError,
|
|
1514
1520
|
MALFORMED_REQUEST: AoudaValidationError,
|
|
1515
1521
|
INTERNAL_ERROR: AoudaServerError,
|
|
@@ -1570,6 +1576,9 @@ function parseRetryAfterSeconds(header) {
|
|
|
1570
1576
|
if (!Number.isFinite(n) || n < 0) return void 0;
|
|
1571
1577
|
return n;
|
|
1572
1578
|
}
|
|
1579
|
+
function nonEmptyRowErrors(rowErrors) {
|
|
1580
|
+
return Array.isArray(rowErrors) && rowErrors.length > 0 ? rowErrors : void 0;
|
|
1581
|
+
}
|
|
1573
1582
|
function createApiError(statusCode, statusText, body, retryAfterHeader) {
|
|
1574
1583
|
const message = body.error ?? `${statusCode} ${statusText}`;
|
|
1575
1584
|
const code = body.code ?? "UNKNOWN";
|
|
@@ -1577,7 +1586,16 @@ function createApiError(statusCode, statusText, body, retryAfterHeader) {
|
|
|
1577
1586
|
const requestId = body.requestId;
|
|
1578
1587
|
const retryAfterSeconds = parseRetryAfterSeconds(retryAfterHeader ?? null);
|
|
1579
1588
|
const Ctor = ERROR_CODE_MAP[code] ?? AoudaApiError;
|
|
1580
|
-
return new Ctor(
|
|
1589
|
+
return new Ctor(
|
|
1590
|
+
message,
|
|
1591
|
+
code,
|
|
1592
|
+
statusCode,
|
|
1593
|
+
details,
|
|
1594
|
+
requestId,
|
|
1595
|
+
retryAfterSeconds,
|
|
1596
|
+
body.token,
|
|
1597
|
+
nonEmptyRowErrors(body.rowErrors)
|
|
1598
|
+
);
|
|
1581
1599
|
}
|
|
1582
1600
|
var HttpTransport = class {
|
|
1583
1601
|
constructor(options) {
|
|
@@ -1691,7 +1709,8 @@ var HttpTransport = class {
|
|
|
1691
1709
|
errorBody?.details,
|
|
1692
1710
|
errorBody?.requestId,
|
|
1693
1711
|
void 0,
|
|
1694
|
-
errorBody?.token
|
|
1712
|
+
errorBody?.token,
|
|
1713
|
+
nonEmptyRowErrors(errorBody?.rowErrors)
|
|
1695
1714
|
);
|
|
1696
1715
|
}
|
|
1697
1716
|
if (errorBody?.code != null) {
|
|
@@ -1810,7 +1829,8 @@ var HttpTransport = class {
|
|
|
1810
1829
|
errorBody?.details,
|
|
1811
1830
|
errorBody?.requestId,
|
|
1812
1831
|
void 0,
|
|
1813
|
-
errorBody?.token
|
|
1832
|
+
errorBody?.token,
|
|
1833
|
+
nonEmptyRowErrors(errorBody?.rowErrors)
|
|
1814
1834
|
);
|
|
1815
1835
|
}
|
|
1816
1836
|
if (errorBody?.code != null) {
|
|
@@ -2900,8 +2920,11 @@ var TableWriteStream = class {
|
|
|
2900
2920
|
resolve4?.();
|
|
2901
2921
|
}
|
|
2902
2922
|
_handleServerError(message) {
|
|
2923
|
+
const rowErrors = Array.isArray(message.errors) && message.errors.length > 0 ? message.errors : void 0;
|
|
2903
2924
|
const error = new AoudaConnectionError(
|
|
2904
|
-
`Write stream error (${message.code}): ${message.message}
|
|
2925
|
+
`Write stream error (${message.code}): ${message.message}`,
|
|
2926
|
+
void 0,
|
|
2927
|
+
rowErrors
|
|
2905
2928
|
);
|
|
2906
2929
|
const openReject = this._openReject;
|
|
2907
2930
|
this._openResolve = null;
|
|
@@ -3353,6 +3376,12 @@ var TableQuery = class _TableQuery {
|
|
|
3353
3376
|
* evaluated per row on the server. Computed columns are appended after any physical-column
|
|
3354
3377
|
* `select()` projection.
|
|
3355
3378
|
*
|
|
3379
|
+
* Result types are inferred by the server where the expression permits
|
|
3380
|
+
* (e.g. Int32 → `number`). Uninferable expressions use wire `"Unknown"` /
|
|
3381
|
+
* codegen `unknown`. Computed columns are always nullable. Named-query
|
|
3382
|
+
* `*Row` properties pick this up when regenerated against a post-S08 server.
|
|
3383
|
+
* See aouda-docs/guides/browser-tier-read-limits.md#selectexpr-result-types
|
|
3384
|
+
*
|
|
3356
3385
|
* @param projections - One or more `{ alias, expr }` pairs.
|
|
3357
3386
|
* @returns A new TableQuery with computed columns set.
|
|
3358
3387
|
*
|
|
@@ -4925,14 +4954,21 @@ var BackupAdminApi = class {
|
|
|
4925
4954
|
return this.transport.get(`${BASE_PATH4}/list`);
|
|
4926
4955
|
}
|
|
4927
4956
|
/**
|
|
4928
|
-
* Restore a backup
|
|
4929
|
-
* POST /admin/backup/restore/{id}
|
|
4957
|
+
* Restore a backup. The string form is an exact restore of that id
|
|
4958
|
+
* (`POST /admin/backup/restore/{id}` with `{}`). The object form posts the body to
|
|
4959
|
+
* `POST /admin/backup/restore` and may carry `targetTime` for point-in-time recovery.
|
|
4930
4960
|
*/
|
|
4931
|
-
async restore(
|
|
4932
|
-
|
|
4961
|
+
async restore(input) {
|
|
4962
|
+
if (typeof input === "string") {
|
|
4963
|
+
const encoded = encodeURIComponent(input);
|
|
4964
|
+
return this.transport.post(
|
|
4965
|
+
`${BASE_PATH4}/restore/${encoded}`,
|
|
4966
|
+
{}
|
|
4967
|
+
);
|
|
4968
|
+
}
|
|
4933
4969
|
return this.transport.post(
|
|
4934
|
-
`${BASE_PATH4}/restore
|
|
4935
|
-
|
|
4970
|
+
`${BASE_PATH4}/restore`,
|
|
4971
|
+
input
|
|
4936
4972
|
);
|
|
4937
4973
|
}
|
|
4938
4974
|
/**
|