@atscript/db 0.1.57 → 0.1.58

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.
@@ -213,8 +213,16 @@ interface TMetaResponse {
213
213
  }
214
214
  /** Where the action applies on the UI. */
215
215
  type TDbActionLevel = "table" | "row" | "rows";
216
- /** Semantic intent the UI maps to its own visual language (color, prominence). */
217
- type TDbActionIntent = "positive" | "negative" | "primary" | "secondary";
216
+ /**
217
+ * Semantic intent the UI maps to its own visual language (color, prominence).
218
+ *
219
+ * Suggested visual prominence (most → least): `negative` > `warning` > `primary`
220
+ * > `positive` > `secondary`. Use `negative` for destructive ops (delete, purge),
221
+ * `warning` for risky-but-non-destructive ops (retry payment, force recompute,
222
+ * reset state), `primary` for the headline action, `positive` for benign
223
+ * confirmations (approve, publish), `secondary` for everything else.
224
+ */
225
+ type TDbActionIntent = "positive" | "negative" | "warning" | "primary" | "secondary";
218
226
  /** How the UI client should handle the action when invoked. */
219
227
  type TDbActionProcessor = "backend" | "navigate" | "custom";
220
228
  /**
@@ -236,7 +244,43 @@ interface TDbActionInfo {
236
244
  description?: string;
237
245
  order?: number;
238
246
  default?: boolean;
239
- promptText?: string;
247
+ /**
248
+ * Confirmation prompt copy. String form is shown verbatim. Tuple form is
249
+ * `[singular, plural]`: the UI picks `[0]` when the action will execute
250
+ * against a single PK (always for `'row'`-level; for `'rows'`-level when the
251
+ * current selection has exactly one PK) and `[1]` otherwise.
252
+ *
253
+ * Placeholder substitution is UI-resolved, not server-parsed. Conventional
254
+ * placeholders: `$1` for the single PK (singular form) and `$N` for the
255
+ * count (plural form), e.g. `['Delete order $1?', 'Delete $N orders?']`.
256
+ */
257
+ promptText?: string | [string, string];
258
+ /**
259
+ * Single-character keyboard shortcut hint. The server stores this verbatim
260
+ * — choice of modifier prefix (Alt+, Ctrl+, bare key) and activation scope
261
+ * (e.g. only when an actions dropdown is open) are UI/UX concerns. Conflict
262
+ * resolution between actions sharing the same key is also up to the UI;
263
+ * the server does no dedup.
264
+ */
265
+ shortcut?: string;
266
+ /**
267
+ * Stringified gate predicate (`fn.toString()`). Present only for `'row'`
268
+ * and `'rows'` level actions whose decorator declared a `disabled` function.
269
+ * The UI evaluates against a level-specific scope to grey-out / hide the
270
+ * button. The server has already enforced this predicate before the
271
+ * action's handler ran — the server is authoritative; this field is purely
272
+ * a UI hint.
273
+ */
274
+ disabled?: string;
275
+ /**
276
+ * Optional dev-supplied list of dot-notation paths over the row that the
277
+ * `disabled` predicate references. Plain `string[]` in v1 (a typed
278
+ * `PathOf<TRow>[]` upgrade is a documented follow-up). The UI unions these
279
+ * into `$select` across all actions on a table. When absent, the UI parses
280
+ * `disabled` itself. When present, the UI uses this list verbatim — the
281
+ * server does NOT auto-derive or merge.
282
+ */
283
+ requiredFields?: string[];
240
284
  }
241
285
  interface TDbInsertResult {
242
286
  insertedId: unknown;
@@ -213,8 +213,16 @@ interface TMetaResponse {
213
213
  }
214
214
  /** Where the action applies on the UI. */
215
215
  type TDbActionLevel = "table" | "row" | "rows";
216
- /** Semantic intent the UI maps to its own visual language (color, prominence). */
217
- type TDbActionIntent = "positive" | "negative" | "primary" | "secondary";
216
+ /**
217
+ * Semantic intent the UI maps to its own visual language (color, prominence).
218
+ *
219
+ * Suggested visual prominence (most → least): `negative` > `warning` > `primary`
220
+ * > `positive` > `secondary`. Use `negative` for destructive ops (delete, purge),
221
+ * `warning` for risky-but-non-destructive ops (retry payment, force recompute,
222
+ * reset state), `primary` for the headline action, `positive` for benign
223
+ * confirmations (approve, publish), `secondary` for everything else.
224
+ */
225
+ type TDbActionIntent = "positive" | "negative" | "warning" | "primary" | "secondary";
218
226
  /** How the UI client should handle the action when invoked. */
219
227
  type TDbActionProcessor = "backend" | "navigate" | "custom";
220
228
  /**
@@ -236,7 +244,43 @@ interface TDbActionInfo {
236
244
  description?: string;
237
245
  order?: number;
238
246
  default?: boolean;
239
- promptText?: string;
247
+ /**
248
+ * Confirmation prompt copy. String form is shown verbatim. Tuple form is
249
+ * `[singular, plural]`: the UI picks `[0]` when the action will execute
250
+ * against a single PK (always for `'row'`-level; for `'rows'`-level when the
251
+ * current selection has exactly one PK) and `[1]` otherwise.
252
+ *
253
+ * Placeholder substitution is UI-resolved, not server-parsed. Conventional
254
+ * placeholders: `$1` for the single PK (singular form) and `$N` for the
255
+ * count (plural form), e.g. `['Delete order $1?', 'Delete $N orders?']`.
256
+ */
257
+ promptText?: string | [string, string];
258
+ /**
259
+ * Single-character keyboard shortcut hint. The server stores this verbatim
260
+ * — choice of modifier prefix (Alt+, Ctrl+, bare key) and activation scope
261
+ * (e.g. only when an actions dropdown is open) are UI/UX concerns. Conflict
262
+ * resolution between actions sharing the same key is also up to the UI;
263
+ * the server does no dedup.
264
+ */
265
+ shortcut?: string;
266
+ /**
267
+ * Stringified gate predicate (`fn.toString()`). Present only for `'row'`
268
+ * and `'rows'` level actions whose decorator declared a `disabled` function.
269
+ * The UI evaluates against a level-specific scope to grey-out / hide the
270
+ * button. The server has already enforced this predicate before the
271
+ * action's handler ran — the server is authoritative; this field is purely
272
+ * a UI hint.
273
+ */
274
+ disabled?: string;
275
+ /**
276
+ * Optional dev-supplied list of dot-notation paths over the row that the
277
+ * `disabled` predicate references. Plain `string[]` in v1 (a typed
278
+ * `PathOf<TRow>[]` upgrade is a documented follow-up). The UI unions these
279
+ * into `$select` across all actions on a table. When absent, the UI parses
280
+ * `disabled` itself. When present, the UI uses this list verbatim — the
281
+ * server does NOT auto-derive or merge.
282
+ */
283
+ requiredFields?: string[];
240
284
  }
241
285
  interface TDbInsertResult {
242
286
  insertedId: unknown;
@@ -1,4 +1,4 @@
1
- import { H as TDbUpdateResult, K as TFkLookupResolver, L as TDbInsertManyResult, R as TDbInsertResult, ct as TableMetadata, j as TDbDeleteResult, o as BaseDbAdapter, rt as TWriteTableResolver, t as AtscriptDbReadable, tt as TTableResolver, ut as TGenericLogger, y as TCascadeResolver } from "./db-readable-BCoBlULR.cjs";
1
+ import { H as TDbUpdateResult, K as TFkLookupResolver, L as TDbInsertManyResult, R as TDbInsertResult, ct as TableMetadata, j as TDbDeleteResult, o as BaseDbAdapter, rt as TWriteTableResolver, t as AtscriptDbReadable, tt as TTableResolver, ut as TGenericLogger, y as TCascadeResolver } from "./db-readable-DN1CJRph.cjs";
2
2
  import { FilterExpr } from "@uniqu/core";
3
3
  import { AtscriptQueryComparison, AtscriptQueryFieldRef, AtscriptQueryFieldRef as AtscriptQueryFieldRef$1, AtscriptQueryNode, AtscriptQueryNode as AtscriptQueryNode$1, AtscriptRef, FlatOf, NavPropsOf, OwnPropsOf, PrimaryKeyOf, TAtscriptAnnotatedType, TAtscriptDataType, Validator } from "@atscript/typescript/utils";
4
4
 
@@ -1,4 +1,4 @@
1
- import { H as TDbUpdateResult, K as TFkLookupResolver, L as TDbInsertManyResult, R as TDbInsertResult, ct as TableMetadata, j as TDbDeleteResult, o as BaseDbAdapter, rt as TWriteTableResolver, t as AtscriptDbReadable, tt as TTableResolver, ut as TGenericLogger, y as TCascadeResolver } from "./db-readable-CrNX04nI.mjs";
1
+ import { H as TDbUpdateResult, K as TFkLookupResolver, L as TDbInsertManyResult, R as TDbInsertResult, ct as TableMetadata, j as TDbDeleteResult, o as BaseDbAdapter, rt as TWriteTableResolver, t as AtscriptDbReadable, tt as TTableResolver, ut as TGenericLogger, y as TCascadeResolver } from "./db-readable-CONS7NPu.mjs";
2
2
  import { AtscriptQueryComparison, AtscriptQueryFieldRef, AtscriptQueryFieldRef as AtscriptQueryFieldRef$1, AtscriptQueryNode, AtscriptQueryNode as AtscriptQueryNode$1, AtscriptRef, FlatOf, NavPropsOf, OwnPropsOf, PrimaryKeyOf, TAtscriptAnnotatedType, TAtscriptDataType, Validator } from "@atscript/typescript/utils";
3
3
  import { FilterExpr } from "@uniqu/core";
4
4
 
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as TSyncColumnResult, A as TDbDefaultValue, B as TDbRelation, C as TCrudPermissions, D as TDbActionProcessor, E as TDbActionLevel, F as TDbIndexField, G as TFieldMeta, H as TDbUpdateResult, I as TDbIndexType, J as TIdDescriptor, K as TFkLookupResolver, L as TDbInsertManyResult, M as TDbFieldMeta, N as TDbForeignKey, O as TDbCollation, P as TDbIndex, Q as TSearchIndexInfo, R as TDbInsertResult, S as TCrudOp, T as TDbActionIntent, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, X as TMetadataOverrides, Y as TMetaResponse, Z as TRelationInfo, _ as NavPropsOf, a as FieldMappingStrategy, at as Uniquery, b as TCascadeTarget, c as AggregateExpr, ct as TableMetadata, d as AggregateResult, dt as UniquSelect, et as TTableOptionDiff, f as AtscriptDbWritable, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TypedWithRelation, j as TDbDeleteResult, k as TDbDefaultFn, l as AggregateFn, lt as NoopLogger, m as DbQuery, n as DbResponse, nt as TValueFormatterPair, o as BaseDbAdapter, ot as UniqueryControls, p as DbControls, q as TFkLookupTarget, r as resolveDesignType, rt as TWriteTableResolver, s as AggregateControls, st as WithRelation, t as AtscriptDbReadable, tt as TTableResolver, u as AggregateQuery, ut as TGenericLogger, v as OwnPropsOf, w as TDbActionInfo, x as TColumnDiff, y as TCascadeResolver, z as TDbReferentialAction } from "./db-readable-BCoBlULR.cjs";
1
+ import { $ as TSyncColumnResult, A as TDbDefaultValue, B as TDbRelation, C as TCrudPermissions, D as TDbActionProcessor, E as TDbActionLevel, F as TDbIndexField, G as TFieldMeta, H as TDbUpdateResult, I as TDbIndexType, J as TIdDescriptor, K as TFkLookupResolver, L as TDbInsertManyResult, M as TDbFieldMeta, N as TDbForeignKey, O as TDbCollation, P as TDbIndex, Q as TSearchIndexInfo, R as TDbInsertResult, S as TCrudOp, T as TDbActionIntent, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, X as TMetadataOverrides, Y as TMetaResponse, Z as TRelationInfo, _ as NavPropsOf, a as FieldMappingStrategy, at as Uniquery, b as TCascadeTarget, c as AggregateExpr, ct as TableMetadata, d as AggregateResult, dt as UniquSelect, et as TTableOptionDiff, f as AtscriptDbWritable, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TypedWithRelation, j as TDbDeleteResult, k as TDbDefaultFn, l as AggregateFn, lt as NoopLogger, m as DbQuery, n as DbResponse, nt as TValueFormatterPair, o as BaseDbAdapter, ot as UniqueryControls, p as DbControls, q as TFkLookupTarget, r as resolveDesignType, rt as TWriteTableResolver, s as AggregateControls, st as WithRelation, t as AtscriptDbReadable, tt as TTableResolver, u as AggregateQuery, ut as TGenericLogger, v as OwnPropsOf, w as TDbActionInfo, x as TColumnDiff, y as TCascadeResolver, z as TDbReferentialAction } from "./db-readable-DN1CJRph.cjs";
2
2
  import { a as $remove, c as $upsert, d as getDbFieldOp, f as isDbFieldOp, i as $mul, l as TDbFieldOp, n as $inc, o as $replace, p as separateFieldOps, r as $insert, s as $update, t as $dec, u as TFieldOps } from "./ops-DXJ4Zw0P.cjs";
3
- import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-BvBklm9J.cjs";
3
+ import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-D1dfFoKL.cjs";
4
4
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-DRGMCEn3.cjs";
5
5
  import { c as TArrayPatch, i as buildValidationContext, l as TDbPatch, n as ValidatorMode, o as forceNavNonOptional, r as buildDbValidator, s as isNavRelation, t as ValidationContext, u as getKeyProps } from "./validator-_z_A3cKa.cjs";
6
6
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as TSyncColumnResult, A as TDbDefaultValue, B as TDbRelation, C as TCrudPermissions, D as TDbActionProcessor, E as TDbActionLevel, F as TDbIndexField, G as TFieldMeta, H as TDbUpdateResult, I as TDbIndexType, J as TIdDescriptor, K as TFkLookupResolver, L as TDbInsertManyResult, M as TDbFieldMeta, N as TDbForeignKey, O as TDbCollation, P as TDbIndex, Q as TSearchIndexInfo, R as TDbInsertResult, S as TCrudOp, T as TDbActionIntent, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, X as TMetadataOverrides, Y as TMetaResponse, Z as TRelationInfo, _ as NavPropsOf, a as FieldMappingStrategy, at as Uniquery, b as TCascadeTarget, c as AggregateExpr, ct as TableMetadata, d as AggregateResult, dt as UniquSelect, et as TTableOptionDiff, f as AtscriptDbWritable, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TypedWithRelation, j as TDbDeleteResult, k as TDbDefaultFn, l as AggregateFn, lt as NoopLogger, m as DbQuery, n as DbResponse, nt as TValueFormatterPair, o as BaseDbAdapter, ot as UniqueryControls, p as DbControls, q as TFkLookupTarget, r as resolveDesignType, rt as TWriteTableResolver, s as AggregateControls, st as WithRelation, t as AtscriptDbReadable, tt as TTableResolver, u as AggregateQuery, ut as TGenericLogger, v as OwnPropsOf, w as TDbActionInfo, x as TColumnDiff, y as TCascadeResolver, z as TDbReferentialAction } from "./db-readable-CrNX04nI.mjs";
1
+ import { $ as TSyncColumnResult, A as TDbDefaultValue, B as TDbRelation, C as TCrudPermissions, D as TDbActionProcessor, E as TDbActionLevel, F as TDbIndexField, G as TFieldMeta, H as TDbUpdateResult, I as TDbIndexType, J as TIdDescriptor, K as TFkLookupResolver, L as TDbInsertManyResult, M as TDbFieldMeta, N as TDbForeignKey, O as TDbCollation, P as TDbIndex, Q as TSearchIndexInfo, R as TDbInsertResult, S as TCrudOp, T as TDbActionIntent, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, X as TMetadataOverrides, Y as TMetaResponse, Z as TRelationInfo, _ as NavPropsOf, a as FieldMappingStrategy, at as Uniquery, b as TCascadeTarget, c as AggregateExpr, ct as TableMetadata, d as AggregateResult, dt as UniquSelect, et as TTableOptionDiff, f as AtscriptDbWritable, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TypedWithRelation, j as TDbDeleteResult, k as TDbDefaultFn, l as AggregateFn, lt as NoopLogger, m as DbQuery, n as DbResponse, nt as TValueFormatterPair, o as BaseDbAdapter, ot as UniqueryControls, p as DbControls, q as TFkLookupTarget, r as resolveDesignType, rt as TWriteTableResolver, s as AggregateControls, st as WithRelation, t as AtscriptDbReadable, tt as TTableResolver, u as AggregateQuery, ut as TGenericLogger, v as OwnPropsOf, w as TDbActionInfo, x as TColumnDiff, y as TCascadeResolver, z as TDbReferentialAction } from "./db-readable-CONS7NPu.mjs";
2
2
  import { a as $remove, c as $upsert, d as getDbFieldOp, f as isDbFieldOp, i as $mul, l as TDbFieldOp, n as $inc, o as $replace, p as separateFieldOps, r as $insert, s as $update, t as $dec, u as TFieldOps } from "./ops-C61kelof.mjs";
3
- import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-CsgCjSMH.mjs";
3
+ import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-DQU38dHk.mjs";
4
4
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-DDvYyv5t.mjs";
5
5
  import { c as TArrayPatch, i as buildValidationContext, l as TDbPatch, n as ValidatorMode, o as forceNavNonOptional, r as buildDbValidator, s as isNavRelation, t as ValidationContext, u as getKeyProps } from "./validator-DttN2e5_.mjs";
6
6
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
package/dist/rel.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TDbRelation, N as TDbForeignKey, ct as TableMetadata, o as BaseDbAdapter, rt as TWriteTableResolver, tt as TTableResolver, ut as TGenericLogger } from "./db-readable-BCoBlULR.cjs";
1
+ import { B as TDbRelation, N as TDbForeignKey, ct as TableMetadata, o as BaseDbAdapter, rt as TWriteTableResolver, tt as TTableResolver, ut as TGenericLogger } from "./db-readable-DN1CJRph.cjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-DRGMCEn3.cjs";
3
3
  import { FilterExpr, WithRelation } from "@uniqu/core";
4
4
  import { Validator } from "@atscript/typescript/utils";
package/dist/rel.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TDbRelation, N as TDbForeignKey, ct as TableMetadata, o as BaseDbAdapter, rt as TWriteTableResolver, tt as TTableResolver, ut as TGenericLogger } from "./db-readable-CrNX04nI.mjs";
1
+ import { B as TDbRelation, N as TDbForeignKey, ct as TableMetadata, o as BaseDbAdapter, rt as TWriteTableResolver, tt as TTableResolver, ut as TGenericLogger } from "./db-readable-CONS7NPu.mjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-DDvYyv5t.mjs";
3
3
  import { Validator } from "@atscript/typescript/utils";
4
4
  import { FilterExpr, WithRelation } from "@uniqu/core";
package/dist/sync.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as TDbDefaultValue, M as TDbFieldMeta, N as TDbForeignKey, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, et as TTableOptionDiff, t as AtscriptDbReadable, ut as TGenericLogger, x as TColumnDiff } from "./db-readable-BCoBlULR.cjs";
2
- import { r as AtscriptDbView, t as DbSpace } from "./db-space-BvBklm9J.cjs";
1
+ import { A as TDbDefaultValue, M as TDbFieldMeta, N as TDbForeignKey, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, et as TTableOptionDiff, t as AtscriptDbReadable, ut as TGenericLogger, x as TColumnDiff } from "./db-readable-DN1CJRph.cjs";
2
+ import { r as AtscriptDbView, t as DbSpace } from "./db-space-D1dfFoKL.cjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
package/dist/sync.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as TDbDefaultValue, M as TDbFieldMeta, N as TDbForeignKey, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, et as TTableOptionDiff, t as AtscriptDbReadable, ut as TGenericLogger, x as TColumnDiff } from "./db-readable-CrNX04nI.mjs";
2
- import { r as AtscriptDbView, t as DbSpace } from "./db-space-CsgCjSMH.mjs";
1
+ import { A as TDbDefaultValue, M as TDbFieldMeta, N as TDbForeignKey, U as TExistingColumn, V as TDbStorageType, W as TExistingTableOption, et as TTableOptionDiff, t as AtscriptDbReadable, ut as TGenericLogger, x as TColumnDiff } from "./db-readable-CONS7NPu.mjs";
2
+ import { r as AtscriptDbView, t as DbSpace } from "./db-space-DQU38dHk.mjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "Database adapter utilities for atscript.",
5
5
  "keywords": [
6
6
  "atscript",