@atscript/db-client 0.1.140 → 0.1.141

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/index.cjs CHANGED
@@ -26,7 +26,8 @@ var ClientError = class extends Error {
26
26
  * `name === 'ActionDisabledError'`. The transport / status / base body are
27
27
  * identical to a generic `ClientError`; this subclass adds typed accessors
28
28
  * so consumers can write `catch (e) { if (e instanceof ActionDisabledError) … }`
29
- * to access `action` / `id` / `ids` without indexing into `body`.
29
+ * to access `action` / `id` / `ids` / `reason` / `reasons` without indexing
30
+ * into `body`.
30
31
  */
31
32
  var ActionDisabledError = class extends ClientError {
32
33
  name = "ActionDisabledError";
@@ -42,6 +43,26 @@ var ActionDisabledError = class extends ClientError {
42
43
  get ids() {
43
44
  return this.body.ids;
44
45
  }
46
+ /**
47
+ * Human-readable reason shared by every rejected row — present only when
48
+ * the server's `disabled` predicate returned one. `message` already
49
+ * carries it.
50
+ *
51
+ * @since 0.1.141
52
+ */
53
+ get reason() {
54
+ return this.body.reason;
55
+ }
56
+ /**
57
+ * `'rows'`-level only: per-row reasons index-aligned with {@link ids}
58
+ * (`null` where that row has none). Present only when at least one
59
+ * rejected row carries a reason.
60
+ *
61
+ * @since 0.1.141
62
+ */
63
+ get reasons() {
64
+ return this.body.reasons;
65
+ }
45
66
  };
46
67
  /**
47
68
  * Typed marker thrown by `Client._send` when the server response body's
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as TDbDeleteResult, C as OwnOf, D as RowOf, E as RelationInfo, F as Uniquery, I as UniqueryControls, L as ValidGroupBy, M as TDbInsertResult, N as TDbUpdateResult, O as SearchIndexInfo, P as TypedWithRelation, R as WeekStart, S as NavOf, T as PatchOf, _ as DbRow, a as ValidatorMode, b as IdOf, c as AggregateResult, d as BucketUnit, f as CalendarBucketLabel, g as DbPatch, h as DataOf, j as TDbInsertManyResult, k as ServerError, l as AtscriptClientShape, m as ClientResponse, n as ClientValidator, p as ClientOptions, r as ClientValidatorOptions, s as AggregateQuery, t as ClientValidationError, u as BucketExpr, v as FieldMeta, w as PageResult, x as MetaResponse, y as FilterExpr } from "./validator-D6V_8Fxi.cjs";
1
+ import { A as TDbDeleteResult, C as OwnOf, D as RowOf, E as RelationInfo, F as Uniquery, I as UniqueryControls, L as ValidGroupBy, M as TDbInsertResult, N as TDbUpdateResult, O as SearchIndexInfo, P as TypedWithRelation, R as WeekStart, S as NavOf, T as PatchOf, _ as DbRow, a as ValidatorMode, b as IdOf, c as AggregateResult, d as BucketUnit, f as CalendarBucketLabel, g as DbPatch, h as DataOf, j as TDbInsertManyResult, k as ServerError, l as AtscriptClientShape, m as ClientResponse, n as ClientValidator, p as ClientOptions, r as ClientValidatorOptions, s as AggregateQuery, t as ClientValidationError, u as BucketExpr, v as FieldMeta, w as PageResult, x as MetaResponse, y as FilterExpr } from "./validator-810-rhnQ.cjs";
2
2
  import { AggregateExpr, AggregateQuery as AggregateQuery$1, AggregateResult as AggregateResult$1, BucketExpr as BucketExpr$1, Uniquery as Uniquery$1, UniqueryControls as UniqueryControls$1, ValidGroupBy as ValidGroupBy$1, bucketStartInstant, nextBucketLabel } from "@uniqu/core";
3
3
  import { TAtscriptAnnotatedType, TSerializedAnnotatedType } from "@atscript/typescript/utils";
4
4
  import { TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor, TDbDeleteResult as TDbDeleteResult$1, TDbInsertManyResult as TDbInsertManyResult$1, TDbInsertResult as TDbInsertResult$1, TDbUpdateResult as TDbUpdateResult$1 } from "@atscript/db";
@@ -264,13 +264,18 @@ interface ActionDisabledErrorBody extends ServerError {
264
264
  action: string;
265
265
  id?: Record<string, unknown>;
266
266
  ids?: Record<string, unknown>[];
267
+ /** Reason shared by every rejected row, when the server's predicate gave one. @since 0.1.141 */
268
+ reason?: string;
269
+ /** `'rows'` level: index-aligned with `ids`, `null` = no reason for that row. @since 0.1.141 */
270
+ reasons?: (string | null)[];
267
271
  }
268
272
  /**
269
273
  * Typed marker thrown by `Client._send` when the server response body's
270
274
  * `name === 'ActionDisabledError'`. The transport / status / base body are
271
275
  * identical to a generic `ClientError`; this subclass adds typed accessors
272
276
  * so consumers can write `catch (e) { if (e instanceof ActionDisabledError) … }`
273
- * to access `action` / `id` / `ids` without indexing into `body`.
277
+ * to access `action` / `id` / `ids` / `reason` / `reasons` without indexing
278
+ * into `body`.
274
279
  */
275
280
  declare class ActionDisabledError extends ClientError {
276
281
  name: string;
@@ -280,6 +285,22 @@ declare class ActionDisabledError extends ClientError {
280
285
  get id(): Record<string, unknown> | undefined;
281
286
  /** Present only for `'rows'`-level rejections (full list of failing IDs). */
282
287
  get ids(): Record<string, unknown>[] | undefined;
288
+ /**
289
+ * Human-readable reason shared by every rejected row — present only when
290
+ * the server's `disabled` predicate returned one. `message` already
291
+ * carries it.
292
+ *
293
+ * @since 0.1.141
294
+ */
295
+ get reason(): string | undefined;
296
+ /**
297
+ * `'rows'`-level only: per-row reasons index-aligned with {@link ids}
298
+ * (`null` where that row has none). Present only when at least one
299
+ * rejected row carries a reason.
300
+ *
301
+ * @since 0.1.141
302
+ */
303
+ get reasons(): (string | null)[] | undefined;
283
304
  }
284
305
  /**
285
306
  * Wire-body shape for 409 OCC `version_mismatch` responses. Extends the base
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as TDbDeleteResult, C as OwnOf, D as RowOf, E as RelationInfo, F as Uniquery, I as UniqueryControls, L as ValidGroupBy, M as TDbInsertResult, N as TDbUpdateResult, O as SearchIndexInfo, P as TypedWithRelation, R as WeekStart, S as NavOf, T as PatchOf, _ as DbRow, a as ValidatorMode, b as IdOf, c as AggregateResult, d as BucketUnit, f as CalendarBucketLabel, g as DbPatch, h as DataOf, j as TDbInsertManyResult, k as ServerError, l as AtscriptClientShape, m as ClientResponse, n as ClientValidator, p as ClientOptions, r as ClientValidatorOptions, s as AggregateQuery, t as ClientValidationError, u as BucketExpr, v as FieldMeta, w as PageResult, x as MetaResponse, y as FilterExpr } from "./validator-B_AWTflO.mjs";
1
+ import { A as TDbDeleteResult, C as OwnOf, D as RowOf, E as RelationInfo, F as Uniquery, I as UniqueryControls, L as ValidGroupBy, M as TDbInsertResult, N as TDbUpdateResult, O as SearchIndexInfo, P as TypedWithRelation, R as WeekStart, S as NavOf, T as PatchOf, _ as DbRow, a as ValidatorMode, b as IdOf, c as AggregateResult, d as BucketUnit, f as CalendarBucketLabel, g as DbPatch, h as DataOf, j as TDbInsertManyResult, k as ServerError, l as AtscriptClientShape, m as ClientResponse, n as ClientValidator, p as ClientOptions, r as ClientValidatorOptions, s as AggregateQuery, t as ClientValidationError, u as BucketExpr, v as FieldMeta, w as PageResult, x as MetaResponse, y as FilterExpr } from "./validator-CIm1ZCS5.mjs";
2
2
  import { TAtscriptAnnotatedType, TSerializedAnnotatedType } from "@atscript/typescript/utils";
3
3
  import { AggregateExpr, AggregateQuery as AggregateQuery$1, AggregateResult as AggregateResult$1, BucketExpr as BucketExpr$1, Uniquery as Uniquery$1, UniqueryControls as UniqueryControls$1, ValidGroupBy as ValidGroupBy$1, bucketStartInstant, nextBucketLabel } from "@uniqu/core";
4
4
  import { TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor, TDbDeleteResult as TDbDeleteResult$1, TDbInsertManyResult as TDbInsertManyResult$1, TDbInsertResult as TDbInsertResult$1, TDbUpdateResult as TDbUpdateResult$1 } from "@atscript/db";
@@ -264,13 +264,18 @@ interface ActionDisabledErrorBody extends ServerError {
264
264
  action: string;
265
265
  id?: Record<string, unknown>;
266
266
  ids?: Record<string, unknown>[];
267
+ /** Reason shared by every rejected row, when the server's predicate gave one. @since 0.1.141 */
268
+ reason?: string;
269
+ /** `'rows'` level: index-aligned with `ids`, `null` = no reason for that row. @since 0.1.141 */
270
+ reasons?: (string | null)[];
267
271
  }
268
272
  /**
269
273
  * Typed marker thrown by `Client._send` when the server response body's
270
274
  * `name === 'ActionDisabledError'`. The transport / status / base body are
271
275
  * identical to a generic `ClientError`; this subclass adds typed accessors
272
276
  * so consumers can write `catch (e) { if (e instanceof ActionDisabledError) … }`
273
- * to access `action` / `id` / `ids` without indexing into `body`.
277
+ * to access `action` / `id` / `ids` / `reason` / `reasons` without indexing
278
+ * into `body`.
274
279
  */
275
280
  declare class ActionDisabledError extends ClientError {
276
281
  name: string;
@@ -280,6 +285,22 @@ declare class ActionDisabledError extends ClientError {
280
285
  get id(): Record<string, unknown> | undefined;
281
286
  /** Present only for `'rows'`-level rejections (full list of failing IDs). */
282
287
  get ids(): Record<string, unknown>[] | undefined;
288
+ /**
289
+ * Human-readable reason shared by every rejected row — present only when
290
+ * the server's `disabled` predicate returned one. `message` already
291
+ * carries it.
292
+ *
293
+ * @since 0.1.141
294
+ */
295
+ get reason(): string | undefined;
296
+ /**
297
+ * `'rows'`-level only: per-row reasons index-aligned with {@link ids}
298
+ * (`null` where that row has none). Present only when at least one
299
+ * rejected row carries a reason.
300
+ *
301
+ * @since 0.1.141
302
+ */
303
+ get reasons(): (string | null)[] | undefined;
283
304
  }
284
305
  /**
285
306
  * Wire-body shape for 409 OCC `version_mismatch` responses. Extends the base
package/dist/index.mjs CHANGED
@@ -25,7 +25,8 @@ var ClientError = class extends Error {
25
25
  * `name === 'ActionDisabledError'`. The transport / status / base body are
26
26
  * identical to a generic `ClientError`; this subclass adds typed accessors
27
27
  * so consumers can write `catch (e) { if (e instanceof ActionDisabledError) … }`
28
- * to access `action` / `id` / `ids` without indexing into `body`.
28
+ * to access `action` / `id` / `ids` / `reason` / `reasons` without indexing
29
+ * into `body`.
29
30
  */
30
31
  var ActionDisabledError = class extends ClientError {
31
32
  name = "ActionDisabledError";
@@ -41,6 +42,26 @@ var ActionDisabledError = class extends ClientError {
41
42
  get ids() {
42
43
  return this.body.ids;
43
44
  }
45
+ /**
46
+ * Human-readable reason shared by every rejected row — present only when
47
+ * the server's `disabled` predicate returned one. `message` already
48
+ * carries it.
49
+ *
50
+ * @since 0.1.141
51
+ */
52
+ get reason() {
53
+ return this.body.reason;
54
+ }
55
+ /**
56
+ * `'rows'`-level only: per-row reasons index-aligned with {@link ids}
57
+ * (`null` where that row has none). Present only when at least one
58
+ * rejected row carries a reason.
59
+ *
60
+ * @since 0.1.141
61
+ */
62
+ get reasons() {
63
+ return this.body.reasons;
64
+ }
44
65
  };
45
66
  /**
46
67
  * Typed marker thrown by `Client._send` when the server response body's
@@ -1,7 +1,7 @@
1
- import { TAtscriptAnnotatedType, TAtscriptTypeObject } from "@atscript/typescript/utils";
2
1
  import { AggregateQuery as AggregateQuery$1, AggregateResult as AggregateResult$1, BucketExpr as BucketExpr$1, BucketUnit, CalendarBucketLabel, FilterExpr, TypedWithRelation, Uniquery as Uniquery$1, UniqueryControls as UniqueryControls$1, ValidGroupBy as ValidGroupBy$1, WeekStart } from "@uniqu/core";
3
- import { DbValidationContext, ValidatorMode, ValidatorMode as ValidatorMode$1 } from "@atscript/db/validator";
2
+ import { TAtscriptAnnotatedType, TAtscriptTypeObject } from "@atscript/typescript/utils";
4
3
  import { DbPatch, DbResponse, DbRow, TDbDeleteResult as TDbDeleteResult$1, TDbInsertManyResult as TDbInsertManyResult$1, TDbInsertResult as TDbInsertResult$1, TDbUpdateResult as TDbUpdateResult$1, TFieldMeta, TMetaResponse, TRelationInfo, TSearchIndexInfo } from "@atscript/db";
4
+ import { DbValidationContext, ValidatorMode, ValidatorMode as ValidatorMode$1 } from "@atscript/db/validator";
5
5
 
6
6
  //#region src/types.d.ts
7
7
  /**
@@ -113,8 +113,8 @@ type IdOf<T> = T extends {
113
113
  * query, mirroring the backend's `DbResponse<Data, Nav, Q>` algebra. Nav
114
114
  * properties are stripped by default and re-added only for relations the
115
115
  * caller listed in `$with`. When `T` carries no nav-prop brand, `DbResponse`
116
- * short-circuits to the data type. `$actions` is always optional — the
117
- * server emits it only when the request set `?$actions=true`.
116
+ * short-circuits to the data type. `$actions` / `$disabledReasons` are always
117
+ * optional — the server emits them only when the request set `?$actions=true`.
118
118
  */
119
119
  type ClientResponse<T, Q> = DbResponse<DataOf<T>, NavOf<T>, Q> & {
120
120
  /**
@@ -123,6 +123,14 @@ type ClientResponse<T, Q> = DbResponse<DataOf<T>, NavOf<T>, Q> & {
123
123
  * this row.
124
124
  */
125
125
  $actions?: string[];
126
+ /**
127
+ * Action name → human-readable reason, for actions disabled on this row
128
+ * whose `disabled` predicate returned a reason string. Present only on
129
+ * rows with at least one such reason; keys never appear in `$actions`.
130
+ *
131
+ * @since 0.1.141
132
+ */
133
+ $disabledReasons?: Record<string, string>;
126
134
  };
127
135
  //#endregion
128
136
  //#region src/validator.d.ts
@@ -1,7 +1,7 @@
1
- import { AggregateQuery as AggregateQuery$1, AggregateResult as AggregateResult$1, BucketExpr as BucketExpr$1, BucketUnit, CalendarBucketLabel, FilterExpr, TypedWithRelation, Uniquery as Uniquery$1, UniqueryControls as UniqueryControls$1, ValidGroupBy as ValidGroupBy$1, WeekStart } from "@uniqu/core";
2
1
  import { TAtscriptAnnotatedType, TAtscriptTypeObject } from "@atscript/typescript/utils";
3
- import { DbPatch, DbResponse, DbRow, TDbDeleteResult as TDbDeleteResult$1, TDbInsertManyResult as TDbInsertManyResult$1, TDbInsertResult as TDbInsertResult$1, TDbUpdateResult as TDbUpdateResult$1, TFieldMeta, TMetaResponse, TRelationInfo, TSearchIndexInfo } from "@atscript/db";
2
+ import { AggregateQuery as AggregateQuery$1, AggregateResult as AggregateResult$1, BucketExpr as BucketExpr$1, BucketUnit, CalendarBucketLabel, FilterExpr, TypedWithRelation, Uniquery as Uniquery$1, UniqueryControls as UniqueryControls$1, ValidGroupBy as ValidGroupBy$1, WeekStart } from "@uniqu/core";
4
3
  import { DbValidationContext, ValidatorMode, ValidatorMode as ValidatorMode$1 } from "@atscript/db/validator";
4
+ import { DbPatch, DbResponse, DbRow, TDbDeleteResult as TDbDeleteResult$1, TDbInsertManyResult as TDbInsertManyResult$1, TDbInsertResult as TDbInsertResult$1, TDbUpdateResult as TDbUpdateResult$1, TFieldMeta, TMetaResponse, TRelationInfo, TSearchIndexInfo } from "@atscript/db";
5
5
 
6
6
  //#region src/types.d.ts
7
7
  /**
@@ -113,8 +113,8 @@ type IdOf<T> = T extends {
113
113
  * query, mirroring the backend's `DbResponse<Data, Nav, Q>` algebra. Nav
114
114
  * properties are stripped by default and re-added only for relations the
115
115
  * caller listed in `$with`. When `T` carries no nav-prop brand, `DbResponse`
116
- * short-circuits to the data type. `$actions` is always optional — the
117
- * server emits it only when the request set `?$actions=true`.
116
+ * short-circuits to the data type. `$actions` / `$disabledReasons` are always
117
+ * optional — the server emits them only when the request set `?$actions=true`.
118
118
  */
119
119
  type ClientResponse<T, Q> = DbResponse<DataOf<T>, NavOf<T>, Q> & {
120
120
  /**
@@ -123,6 +123,14 @@ type ClientResponse<T, Q> = DbResponse<DataOf<T>, NavOf<T>, Q> & {
123
123
  * this row.
124
124
  */
125
125
  $actions?: string[];
126
+ /**
127
+ * Action name → human-readable reason, for actions disabled on this row
128
+ * whose `disabled` predicate returned a reason string. Present only on
129
+ * rows with at least one such reason; keys never appear in `$actions`.
130
+ *
131
+ * @since 0.1.141
132
+ */
133
+ $disabledReasons?: Record<string, string>;
126
134
  };
127
135
  //#endregion
128
136
  //#region src/validator.d.ts
@@ -1,2 +1,2 @@
1
- import { a as ValidatorMode, i as DbValidationContext, n as ClientValidator, o as createClientValidator, r as ClientValidatorOptions, t as ClientValidationError } from "./validator-D6V_8Fxi.cjs";
1
+ import { a as ValidatorMode, i as DbValidationContext, n as ClientValidator, o as createClientValidator, r as ClientValidatorOptions, t as ClientValidationError } from "./validator-810-rhnQ.cjs";
2
2
  export { ClientValidationError, ClientValidator, ClientValidatorOptions, type DbValidationContext, type ValidatorMode, createClientValidator };
@@ -1,2 +1,2 @@
1
- import { a as ValidatorMode, i as DbValidationContext, n as ClientValidator, o as createClientValidator, r as ClientValidatorOptions, t as ClientValidationError } from "./validator-B_AWTflO.mjs";
1
+ import { a as ValidatorMode, i as DbValidationContext, n as ClientValidator, o as createClientValidator, r as ClientValidatorOptions, t as ClientValidationError } from "./validator-CIm1ZCS5.mjs";
2
2
  export { ClientValidationError, ClientValidator, ClientValidatorOptions, type DbValidationContext, type ValidatorMode, createClientValidator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db-client",
3
- "version": "0.1.140",
3
+ "version": "0.1.141",
4
4
  "description": "Browser-compatible HTTP client for @atscript/moost-db REST endpoints.",
5
5
  "keywords": [
6
6
  "atscript",
@@ -47,14 +47,14 @@
47
47
  "@uniqu/url": "^0.1.11"
48
48
  },
49
49
  "devDependencies": {
50
- "@atscript/core": "^0.1.92",
51
- "@atscript/typescript": "^0.1.92",
52
- "unplugin-atscript": "^0.1.92",
53
- "@atscript/db": "0.1.140"
50
+ "@atscript/core": "^0.1.95",
51
+ "@atscript/typescript": "^0.1.95",
52
+ "unplugin-atscript": "^0.1.95",
53
+ "@atscript/db": "0.1.141"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@atscript/db": "^0.1.44",
57
- "@atscript/typescript": "^0.1.92"
57
+ "@atscript/typescript": "^0.1.95"
58
58
  },
59
59
  "scripts": {
60
60
  "postinstall": "asc -f dts",