@atscript/moost-db 0.1.75 → 0.1.77
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 +3016 -2300
- package/dist/index.d.cts +251 -66
- package/dist/index.d.mts +251 -66
- package/dist/index.mjs +2841 -2276
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TAtscriptAnnotatedType,
|
|
3
|
+
TAtscriptDataType,
|
|
4
|
+
TSerializeOptions,
|
|
5
|
+
TSerializedAnnotatedType,
|
|
6
|
+
Validator,
|
|
7
|
+
} from "@atscript/typescript/utils";
|
|
2
8
|
import { HttpError } from "@moostjs/event-http";
|
|
3
9
|
import * as _$moost from "moost";
|
|
4
10
|
import { Mate, Moost, TConsoleBase, TMateParamMeta, TMoostMetadata } from "moost";
|
|
5
11
|
import * as _$_uniqu_url0 from "@uniqu/url";
|
|
6
12
|
import { parseUrl } from "@uniqu/url";
|
|
7
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
AtscriptDbReadable,
|
|
15
|
+
AtscriptDbTable,
|
|
16
|
+
FilterExpr,
|
|
17
|
+
FlatOf,
|
|
18
|
+
TCrudOp,
|
|
19
|
+
TCrudPermissions,
|
|
20
|
+
TCrudPermissions as TCrudPermissions$1,
|
|
21
|
+
TDbActionInfo,
|
|
22
|
+
TDbActionInfo as TDbActionInfo$1,
|
|
23
|
+
TDbActionIntent,
|
|
24
|
+
TDbActionIntent as TDbActionIntent$1,
|
|
25
|
+
TDbActionLevel,
|
|
26
|
+
TDbActionLevel as TDbActionLevel$1,
|
|
27
|
+
TDbActionProcessor,
|
|
28
|
+
TDbFieldMeta,
|
|
29
|
+
TIdentification,
|
|
30
|
+
TMetaResponse,
|
|
31
|
+
Uniquery,
|
|
32
|
+
UniqueryControls,
|
|
33
|
+
} from "@atscript/db";
|
|
8
34
|
import * as _$_wooksjs_event_core0 from "@wooksjs/event-core";
|
|
9
35
|
|
|
10
36
|
//#region src/as-readable.controller.d.ts
|
|
@@ -48,7 +74,10 @@ interface ReadableGates {
|
|
|
48
74
|
* handlers that match the data source's contract (DB readables route into
|
|
49
75
|
* aggregate/vector/search; value-help controllers just filter/sort/paginate).
|
|
50
76
|
*/
|
|
51
|
-
declare abstract class AsReadableController<
|
|
77
|
+
declare abstract class AsReadableController<
|
|
78
|
+
T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType,
|
|
79
|
+
DataType = TAtscriptDataType<T>,
|
|
80
|
+
> {
|
|
52
81
|
/** The Atscript interface this controller serves. */
|
|
53
82
|
protected readonly boundType: T;
|
|
54
83
|
/** Short human-readable name for logging (usually the table/source name). */
|
|
@@ -97,15 +126,25 @@ declare abstract class AsReadableController<T extends TAtscriptAnnotatedType = T
|
|
|
97
126
|
protected get queryControlsValidator(): Validator<any, unknown>;
|
|
98
127
|
protected get pagesControlsValidator(): Validator<any, unknown>;
|
|
99
128
|
protected get getOneControlsValidator(): Validator<any, unknown>;
|
|
100
|
-
protected validateControls(
|
|
129
|
+
protected validateControls(
|
|
130
|
+
controls: Record<string, unknown>,
|
|
131
|
+
type: "query" | "pages" | "getOne",
|
|
132
|
+
): string | undefined;
|
|
101
133
|
protected validateInsights(insights: Map<string, unknown>): string | undefined;
|
|
102
|
-
protected validateParsed(
|
|
134
|
+
protected validateParsed(
|
|
135
|
+
parsed: Uniquery,
|
|
136
|
+
type: "query" | "pages" | "getOne",
|
|
137
|
+
): HttpError | undefined;
|
|
103
138
|
/**
|
|
104
139
|
* Shared filter/sort/search gate check. Subclasses assemble a {@link ReadableGates}
|
|
105
140
|
* config per request (or once in the constructor when static) and call this to
|
|
106
141
|
* get a uniform HTTP 400 response for any offending field/control.
|
|
107
142
|
*/
|
|
108
|
-
protected checkGates(
|
|
143
|
+
protected checkGates(
|
|
144
|
+
filter: FilterExpr | undefined,
|
|
145
|
+
controls: Record<string, unknown>,
|
|
146
|
+
gates: ReadableGates,
|
|
147
|
+
): HttpError | undefined;
|
|
109
148
|
protected parseQueryString(url: string): _$_uniqu_url0.UrlQuery;
|
|
110
149
|
/**
|
|
111
150
|
* Parse a URL keeping only `$*` control keywords; report whether any
|
|
@@ -174,7 +213,10 @@ declare abstract class AsReadableController<T extends TAtscriptAnnotatedType = T
|
|
|
174
213
|
* For write operations (insert, replace, update, delete), use {@link AsDbController}.
|
|
175
214
|
* For views, use {@link AsDbViewController}.
|
|
176
215
|
*/
|
|
177
|
-
declare class AsDbReadableController<
|
|
216
|
+
declare class AsDbReadableController<
|
|
217
|
+
T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType,
|
|
218
|
+
DataType = TAtscriptDataType<T>,
|
|
219
|
+
> extends AsReadableController<T, DataType> {
|
|
178
220
|
/** Reference to the underlying readable (table or view). */
|
|
179
221
|
protected readable: AtscriptDbReadable<T>;
|
|
180
222
|
private readonly _gates;
|
|
@@ -196,9 +238,16 @@ declare class AsDbReadableController<T extends TAtscriptAnnotatedType = TAtscrip
|
|
|
196
238
|
* adapter, not an annotation the user could add to bypass it. Sort uses
|
|
197
239
|
* adapter capability differently and is enforced at the SQL builder layer.
|
|
198
240
|
*/
|
|
199
|
-
protected checkGates(
|
|
241
|
+
protected checkGates(
|
|
242
|
+
filter: FilterExpr | undefined,
|
|
243
|
+
controls: Record<string, unknown>,
|
|
244
|
+
gates: ReadableGates,
|
|
245
|
+
): HttpError | undefined;
|
|
200
246
|
/** Validates $with relations against the readable. */
|
|
201
|
-
protected validateParsed(
|
|
247
|
+
protected validateParsed(
|
|
248
|
+
parsed: Uniquery,
|
|
249
|
+
type: "query" | "pages" | "getOne",
|
|
250
|
+
): HttpError | undefined;
|
|
202
251
|
/**
|
|
203
252
|
* Compute an embedding vector from a search term.
|
|
204
253
|
* Override in subclass to integrate with your embedding provider (OpenAI, etc.).
|
|
@@ -221,7 +270,9 @@ declare class AsDbReadableController<T extends TAtscriptAnnotatedType = TAtscrip
|
|
|
221
270
|
* Transform projection before querying.
|
|
222
271
|
* May return a Promise for async lookups.
|
|
223
272
|
*/
|
|
224
|
-
protected transformProjection(
|
|
273
|
+
protected transformProjection(
|
|
274
|
+
projection?: UniqueryControls["$select"],
|
|
275
|
+
): UniqueryControls["$select"] | undefined | Promise<UniqueryControls["$select"] | undefined>;
|
|
225
276
|
private widenPreferredIdProjection;
|
|
226
277
|
private _widenArrayProjection;
|
|
227
278
|
private _widenMapProjection;
|
|
@@ -260,13 +311,16 @@ declare class AsDbReadableController<T extends TAtscriptAnnotatedType = TAtscrip
|
|
|
260
311
|
/**
|
|
261
312
|
* **GET /pages** — returns paginated records with metadata.
|
|
262
313
|
*/
|
|
263
|
-
pages(url: string): Promise<
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
314
|
+
pages(url: string): Promise<
|
|
315
|
+
| {
|
|
316
|
+
data: DataType[];
|
|
317
|
+
page: number;
|
|
318
|
+
itemsPerPage: number;
|
|
319
|
+
pages: number;
|
|
320
|
+
count: number;
|
|
321
|
+
}
|
|
322
|
+
| HttpError
|
|
323
|
+
>;
|
|
270
324
|
/**
|
|
271
325
|
* **GET /one/:id** — retrieves a single record by ID or unique property.
|
|
272
326
|
* The id-filter is AND-combined with {@link transformOne} so row-level
|
|
@@ -302,7 +356,10 @@ declare class AsDbReadableController<T extends TAtscriptAnnotatedType = TAtscrip
|
|
|
302
356
|
* export class UsersController extends AsDbController<typeof UserModel> {}
|
|
303
357
|
* ```
|
|
304
358
|
*/
|
|
305
|
-
declare class AsDbController<
|
|
359
|
+
declare class AsDbController<
|
|
360
|
+
T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType,
|
|
361
|
+
DataType = TAtscriptDataType<T>,
|
|
362
|
+
> extends AsDbReadableController<T, DataType> {
|
|
306
363
|
/** Reference to the underlying table (typed for write access). */
|
|
307
364
|
protected get table(): AtscriptDbTable<T>;
|
|
308
365
|
constructor(table: AtscriptDbTable<T>, app: Moost);
|
|
@@ -311,7 +368,10 @@ declare class AsDbController<T extends TAtscriptAnnotatedType = TAtscriptAnnotat
|
|
|
311
368
|
* Intercepts write operations. Return `undefined` to abort.
|
|
312
369
|
* May be async (e.g. to enrich payloads from session / permissions).
|
|
313
370
|
*/
|
|
314
|
-
protected onWrite(
|
|
371
|
+
protected onWrite(
|
|
372
|
+
action: "insert" | "insertMany" | "replace" | "replaceMany" | "update" | "updateMany",
|
|
373
|
+
data: unknown,
|
|
374
|
+
): unknown;
|
|
315
375
|
/**
|
|
316
376
|
* Intercepts delete operations. Return `undefined` to abort.
|
|
317
377
|
* May be async (e.g. to resolve composite ids from external state).
|
|
@@ -379,7 +439,10 @@ interface ValueHelpQuery<T> {
|
|
|
379
439
|
* Value-help is for FK pickers and dictionary surfaces — adding row/table
|
|
380
440
|
* actions there would muddy the contract.
|
|
381
441
|
*/
|
|
382
|
-
declare abstract class AsValueHelpController<
|
|
442
|
+
declare abstract class AsValueHelpController<
|
|
443
|
+
T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType,
|
|
444
|
+
DataType = TAtscriptDataType<T>,
|
|
445
|
+
> extends AsReadableController<T, DataType> {
|
|
383
446
|
/** Per-prop metadata map of the bound interface; eagerly built once. */
|
|
384
447
|
protected readonly fieldMeta: Map<string, Map<string, unknown>>;
|
|
385
448
|
/**
|
|
@@ -408,13 +471,16 @@ declare abstract class AsValueHelpController<T extends TAtscriptAnnotatedType =
|
|
|
408
471
|
/**
|
|
409
472
|
* **GET /pages** — paginated row window plus total count.
|
|
410
473
|
*/
|
|
411
|
-
runPages(url: string): Promise<
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
474
|
+
runPages(url: string): Promise<
|
|
475
|
+
| {
|
|
476
|
+
data: DataType[];
|
|
477
|
+
page: number;
|
|
478
|
+
itemsPerPage: number;
|
|
479
|
+
pages: number;
|
|
480
|
+
count: number;
|
|
481
|
+
}
|
|
482
|
+
| HttpError
|
|
483
|
+
>;
|
|
418
484
|
/**
|
|
419
485
|
* **GET /one/:id** — retrieves a single row by primary key.
|
|
420
486
|
*/
|
|
@@ -463,7 +529,10 @@ declare abstract class AsValueHelpController<T extends TAtscriptAnnotatedType =
|
|
|
463
529
|
* Register under a Moost path with `@Controller('/api/dicts/status')` or the
|
|
464
530
|
* equivalent composition decorator.
|
|
465
531
|
*/
|
|
466
|
-
declare class AsJsonValueHelpController<
|
|
532
|
+
declare class AsJsonValueHelpController<
|
|
533
|
+
T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType,
|
|
534
|
+
DataType = TAtscriptDataType<T>,
|
|
535
|
+
> extends AsValueHelpController<T, DataType> {
|
|
467
536
|
protected rows: DataType[];
|
|
468
537
|
private _pkIndex?;
|
|
469
538
|
constructor(boundType: T, rows: DataType[], app: Moost, controllerName?: string);
|
|
@@ -506,7 +575,10 @@ declare const TABLE_DEF = "__atscript_db_readable_def";
|
|
|
506
575
|
* export class UsersController extends AsDbController<typeof UserModel> {}
|
|
507
576
|
* ```
|
|
508
577
|
*/
|
|
509
|
-
declare const TableController: (
|
|
578
|
+
declare const TableController: (
|
|
579
|
+
table: AtscriptDbTable,
|
|
580
|
+
prefix?: string,
|
|
581
|
+
) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
510
582
|
/**
|
|
511
583
|
* Combines the boilerplate needed to turn an {@link AsDbReadableController}
|
|
512
584
|
* subclass into a fully wired HTTP controller for a given `@db.view` or `@db.table` model.
|
|
@@ -520,7 +592,10 @@ declare const TableController: (table: AtscriptDbTable, prefix?: string) => Meth
|
|
|
520
592
|
* export class ActiveTasksController extends AsDbReadableController<typeof ActiveTasks> {}
|
|
521
593
|
* ```
|
|
522
594
|
*/
|
|
523
|
-
declare const ReadableController: (
|
|
595
|
+
declare const ReadableController: (
|
|
596
|
+
readable: AtscriptDbReadable,
|
|
597
|
+
prefix?: string,
|
|
598
|
+
) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
524
599
|
/**
|
|
525
600
|
* Alias for {@link ReadableController} — use with view-backed controllers.
|
|
526
601
|
*
|
|
@@ -530,7 +605,10 @@ declare const ReadableController: (readable: AtscriptDbReadable, prefix?: string
|
|
|
530
605
|
* export class ActiveTasksController extends AsDbReadableController<typeof ActiveTasks> {}
|
|
531
606
|
* ```
|
|
532
607
|
*/
|
|
533
|
-
declare const ViewController: (
|
|
608
|
+
declare const ViewController: (
|
|
609
|
+
readable: AtscriptDbReadable,
|
|
610
|
+
prefix?: string,
|
|
611
|
+
) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
534
612
|
//#endregion
|
|
535
613
|
//#region src/validation-interceptor.d.ts
|
|
536
614
|
declare const validationErrorTransform: () => _$moost.TInterceptorDef;
|
|
@@ -551,7 +629,9 @@ type TOnDisabledRows = "reject" | "skip";
|
|
|
551
629
|
*/
|
|
552
630
|
type FlatKey<TRow> = unknown extends TRow ? string : keyof FlatOf<TRow> & string;
|
|
553
631
|
/** Row-shape narrowing for the `disabled` predicate. Falls back to `any` when `TRow = unknown`. */
|
|
554
|
-
type DisabledRowsArg<TRow, R extends readonly FlatKey<TRow>[]> = unknown extends TRow
|
|
632
|
+
type DisabledRowsArg<TRow, R extends readonly FlatKey<TRow>[]> = unknown extends TRow
|
|
633
|
+
? any[]
|
|
634
|
+
: Pick<FlatOf<TRow>, R[number] & keyof FlatOf<TRow>>[];
|
|
555
635
|
interface NoGate {
|
|
556
636
|
requiredFields?: never;
|
|
557
637
|
disabled?: never;
|
|
@@ -596,8 +676,12 @@ interface LooseGate {
|
|
|
596
676
|
disabled?: (rows: any[]) => boolean[];
|
|
597
677
|
onDisabledRows?: TOnDisabledRows;
|
|
598
678
|
}
|
|
599
|
-
type GateOpts<TRow, R extends readonly FlatKey<TRow>[]> = unknown extends TRow
|
|
600
|
-
|
|
679
|
+
type GateOpts<TRow, R extends readonly FlatKey<TRow>[]> = unknown extends TRow
|
|
680
|
+
? LooseGate
|
|
681
|
+
: NoGate | WithGate<TRow, R>;
|
|
682
|
+
interface BaseActionOpts extends Partial<
|
|
683
|
+
Omit<TDbActionInfo$1, "name" | "level" | "processor" | "value" | "disabled">
|
|
684
|
+
> {
|
|
601
685
|
/**
|
|
602
686
|
* Bound table reference. REQUIRED on non-`AsDbReadableController` classes
|
|
603
687
|
* when `disabled` is set OR a `@DbActionRow*` parameter is declared.
|
|
@@ -613,7 +697,8 @@ interface BaseActionOpts extends Partial<Omit<TDbActionInfo$1, "name" | "level"
|
|
|
613
697
|
* tuple). Both are inferred at the call site via the decorator's `<TRow>`
|
|
614
698
|
* argument plus `const R` generic.
|
|
615
699
|
*/
|
|
616
|
-
type DbActionOpts<TRow = unknown, R extends readonly FlatKey<TRow>[] = []> = BaseActionOpts &
|
|
700
|
+
type DbActionOpts<TRow = unknown, R extends readonly FlatKey<TRow>[] = []> = BaseActionOpts &
|
|
701
|
+
GateOpts<TRow, R>;
|
|
617
702
|
interface DbActionsEntryCommonBase {
|
|
618
703
|
label: string;
|
|
619
704
|
level: TDbActionLevel$1;
|
|
@@ -627,7 +712,8 @@ interface DbActionsEntryCommonBase {
|
|
|
627
712
|
/** Mirrors {@link TDbActionInfo.shortcut} — single-character UI hint. */
|
|
628
713
|
shortcut?: string;
|
|
629
714
|
}
|
|
630
|
-
type DbActionsEntryWithGate<TRow, R extends readonly FlatKey<TRow>[]> = DbActionsEntryCommonBase &
|
|
715
|
+
type DbActionsEntryWithGate<TRow, R extends readonly FlatKey<TRow>[]> = DbActionsEntryCommonBase &
|
|
716
|
+
GateOpts<TRow, R>;
|
|
631
717
|
/**
|
|
632
718
|
* Class-level dict entry. `value` semantics by processor:
|
|
633
719
|
*
|
|
@@ -636,26 +722,40 @@ type DbActionsEntryWithGate<TRow, R extends readonly FlatKey<TRow>[]> = DbAction
|
|
|
636
722
|
* - `'custom'` — `value` is forbidden in the entry; the meta builder fills it
|
|
637
723
|
* with the dict key.
|
|
638
724
|
*/
|
|
639
|
-
type TDbActionsEntry<TRow = unknown, R extends readonly FlatKey<TRow>[] = []> =
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
725
|
+
type TDbActionsEntry<TRow = unknown, R extends readonly FlatKey<TRow>[] = []> =
|
|
726
|
+
| (DbActionsEntryWithGate<TRow, R> & {
|
|
727
|
+
processor: "navigate";
|
|
728
|
+
value: string;
|
|
729
|
+
})
|
|
730
|
+
| (DbActionsEntryWithGate<TRow, R> & {
|
|
731
|
+
processor: "custom";
|
|
732
|
+
value?: never;
|
|
733
|
+
})
|
|
734
|
+
| (DbActionsEntryWithGate<TRow, R> & {
|
|
735
|
+
processor: "backend";
|
|
736
|
+
value: string;
|
|
737
|
+
});
|
|
649
738
|
/** Distributes `Omit` across the discriminated union members. */
|
|
650
739
|
type DistributiveOmit<T, K extends keyof T> = T extends T ? Omit<T, K> : never;
|
|
651
740
|
/** Same as {@link TDbActionsEntry} but without the `level` field — used by the level-pinned shortcuts. */
|
|
652
|
-
type TDbActionsEntryUnpinned<
|
|
741
|
+
type TDbActionsEntryUnpinned<
|
|
742
|
+
TRow = unknown,
|
|
743
|
+
R extends readonly FlatKey<TRow>[] = [],
|
|
744
|
+
> = DistributiveOmit<TDbActionsEntry<TRow, R>, "level">;
|
|
653
745
|
type DbActionsDictBase = Record<string, unknown>;
|
|
654
746
|
type EntryRequiredFields<E, TRow> = E extends {
|
|
655
747
|
requiredFields: infer R;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
|
|
748
|
+
}
|
|
749
|
+
? R extends readonly FlatKey<TRow>[]
|
|
750
|
+
? R
|
|
751
|
+
: []
|
|
752
|
+
: [];
|
|
753
|
+
type ValidatedDict<TRow, D extends DbActionsDictBase> = {
|
|
754
|
+
[K in keyof D]: TDbActionsEntry<TRow, EntryRequiredFields<D[K], TRow>>;
|
|
755
|
+
};
|
|
756
|
+
type ValidatedUnpinnedDict<TRow, D extends DbActionsDictBase> = {
|
|
757
|
+
[K in keyof D]: TDbActionsEntryUnpinned<TRow, EntryRequiredFields<D[K], TRow>>;
|
|
758
|
+
};
|
|
659
759
|
//#endregion
|
|
660
760
|
//#region src/actions/db-action.decorator.d.ts
|
|
661
761
|
/**
|
|
@@ -670,7 +770,10 @@ type ValidatedUnpinnedDict<TRow, D extends DbActionsDictBase> = { [K in keyof D]
|
|
|
670
770
|
* The `disabled` predicate's `rows` argument is type-narrowed to
|
|
671
771
|
* `Pick<FlatOf<TRow>, R[number]>[]`.
|
|
672
772
|
*/
|
|
673
|
-
declare function DbAction<TRow = unknown, const R extends readonly FlatKey<TRow>[] = []>(
|
|
773
|
+
declare function DbAction<TRow = unknown, const R extends readonly FlatKey<TRow>[] = []>(
|
|
774
|
+
name: string,
|
|
775
|
+
opts?: DbActionOpts<TRow, R>,
|
|
776
|
+
): MethodDecorator;
|
|
674
777
|
//#endregion
|
|
675
778
|
//#region src/actions/db-action-default.decorator.d.ts
|
|
676
779
|
/**
|
|
@@ -763,13 +866,21 @@ declare function DbActionRows(): ParameterDecorator;
|
|
|
763
866
|
* Multiple `@DbActions` (and shortcut) decorators on the same class
|
|
764
867
|
* accumulate.
|
|
765
868
|
*/
|
|
766
|
-
declare function DbActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
869
|
+
declare function DbActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
870
|
+
dict: D & ValidatedDict<TRow, D>,
|
|
871
|
+
): ClassDecorator;
|
|
767
872
|
/** Sugar for `@DbActions` with `level: 'table'` injected into each entry. */
|
|
768
|
-
declare function DbTableActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
873
|
+
declare function DbTableActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
874
|
+
dict: D & ValidatedUnpinnedDict<TRow, D>,
|
|
875
|
+
): ClassDecorator;
|
|
769
876
|
/** Sugar for `@DbActions` with `level: 'row'` injected into each entry. */
|
|
770
|
-
declare function DbRowActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
877
|
+
declare function DbRowActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
878
|
+
dict: D & ValidatedUnpinnedDict<TRow, D>,
|
|
879
|
+
): ClassDecorator;
|
|
771
880
|
/** Sugar for `@DbActions` with `level: 'rows'` injected into each entry. */
|
|
772
|
-
declare function DbRowsActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
881
|
+
declare function DbRowsActions<TRow = unknown, const D extends Record<string, unknown> = {}>(
|
|
882
|
+
dict: D & ValidatedUnpinnedDict<TRow, D>,
|
|
883
|
+
): ClassDecorator;
|
|
773
884
|
//#endregion
|
|
774
885
|
//#region src/actions/db-action-input-form.decorator.d.ts
|
|
775
886
|
/**
|
|
@@ -799,9 +910,11 @@ declare function DbRowsActions<TRow = unknown, const D extends Record<string, un
|
|
|
799
910
|
* @param formType A compiled `.as` interface class (carries `.validator()`,
|
|
800
911
|
* `.metadata`, etc.).
|
|
801
912
|
*/
|
|
802
|
-
declare function InputForm<
|
|
803
|
-
|
|
804
|
-
|
|
913
|
+
declare function InputForm<
|
|
914
|
+
T extends TAtscriptAnnotatedType & {
|
|
915
|
+
readonly name: string;
|
|
916
|
+
},
|
|
917
|
+
>(formType: T): ParameterDecorator;
|
|
805
918
|
//#endregion
|
|
806
919
|
//#region src/actions/discover.d.ts
|
|
807
920
|
/**
|
|
@@ -814,9 +927,16 @@ interface TDbActionEnvelope {
|
|
|
814
927
|
raw: DbActionOpts | TDbActionsEntry;
|
|
815
928
|
}
|
|
816
929
|
/** Lookup helper for `AsReadableController.metaForm()`. */
|
|
817
|
-
declare function getControllerFormType(
|
|
930
|
+
declare function getControllerFormType(
|
|
931
|
+
ctor: Function,
|
|
932
|
+
name: string,
|
|
933
|
+
): TAtscriptAnnotatedType | undefined;
|
|
818
934
|
/** Discover actions on a controller, memoized per ctor. `info`-only callers map `e => e.info`. */
|
|
819
|
-
declare function discoverActions(
|
|
935
|
+
declare function discoverActions(
|
|
936
|
+
controllerCtor: Function,
|
|
937
|
+
app: Moost,
|
|
938
|
+
logger: TConsoleBase,
|
|
939
|
+
): TDbActionEnvelope[];
|
|
820
940
|
//#endregion
|
|
821
941
|
//#region src/actions/id-validation.d.ts
|
|
822
942
|
/** Duck-typed shape; matches `AtscriptDbReadable`'s public surface. */
|
|
@@ -1020,11 +1140,16 @@ interface AtscriptDbParamsMeta {
|
|
|
1020
1140
|
* Class- and prop-meta storage mirror the same shape; param-meta
|
|
1021
1141
|
* storage uses {@link AtscriptDbParamsMeta}.
|
|
1022
1142
|
*/
|
|
1023
|
-
type AtscriptDbMate = Mate<
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}
|
|
1143
|
+
type AtscriptDbMate = Mate<
|
|
1144
|
+
TMoostMetadata &
|
|
1145
|
+
AtscriptDbMeta & {
|
|
1146
|
+
params: (TMateParamMeta & AtscriptDbParamsMeta)[];
|
|
1147
|
+
},
|
|
1148
|
+
TMoostMetadata &
|
|
1149
|
+
AtscriptDbMeta & {
|
|
1150
|
+
params: (TMateParamMeta & AtscriptDbParamsMeta)[];
|
|
1151
|
+
}
|
|
1152
|
+
>;
|
|
1028
1153
|
/**
|
|
1029
1154
|
* Returns the shared moost-mate instance, typed against every key that
|
|
1030
1155
|
* `@atscript/moost-db` writes (see {@link AtscriptDbMeta} +
|
|
@@ -1051,4 +1176,64 @@ declare const QUERY_CONTROLS: readonly string[];
|
|
|
1051
1176
|
declare const PAGES_CONTROLS: readonly string[];
|
|
1052
1177
|
declare const ONE_CONTROLS: readonly string[];
|
|
1053
1178
|
//#endregion
|
|
1054
|
-
export {
|
|
1179
|
+
export {
|
|
1180
|
+
ActionDisabledError,
|
|
1181
|
+
type ActionDisabledErrorBody,
|
|
1182
|
+
AsDbController,
|
|
1183
|
+
AsDbReadableController,
|
|
1184
|
+
AsJsonValueHelpController,
|
|
1185
|
+
AsReadableController,
|
|
1186
|
+
AsValueHelpController,
|
|
1187
|
+
type AtscriptDbMate,
|
|
1188
|
+
type AtscriptDbMeta,
|
|
1189
|
+
type AtscriptDbParamsMeta,
|
|
1190
|
+
DbAction,
|
|
1191
|
+
DbActionDefault,
|
|
1192
|
+
type DbActionEnvelope,
|
|
1193
|
+
DbActionID,
|
|
1194
|
+
DbActionIDs,
|
|
1195
|
+
type DbActionOpts,
|
|
1196
|
+
DbActionRow,
|
|
1197
|
+
DbActionRows,
|
|
1198
|
+
DbActions,
|
|
1199
|
+
DbRowActions,
|
|
1200
|
+
DbRowsActions,
|
|
1201
|
+
DbTableActions,
|
|
1202
|
+
type IdValidationSource,
|
|
1203
|
+
InputForm,
|
|
1204
|
+
ONE_CONTROLS,
|
|
1205
|
+
PAGES_CONTROLS,
|
|
1206
|
+
QUERY_CONTROLS,
|
|
1207
|
+
READABLE_DEF,
|
|
1208
|
+
ReadableController,
|
|
1209
|
+
ReadableGates,
|
|
1210
|
+
TABLE_DEF,
|
|
1211
|
+
type TCrudOp,
|
|
1212
|
+
type TCrudPermissions,
|
|
1213
|
+
type TDbActionInfo,
|
|
1214
|
+
type TDbActionInputFormMeta,
|
|
1215
|
+
type TDbActionIntent,
|
|
1216
|
+
type TDbActionLevel,
|
|
1217
|
+
type TDbActionMeta,
|
|
1218
|
+
type TDbActionParamKind,
|
|
1219
|
+
type TDbActionProcessor,
|
|
1220
|
+
type TDbActionsEntry,
|
|
1221
|
+
type TDbActionsEntryUnpinned,
|
|
1222
|
+
type TDbClassActionMeta,
|
|
1223
|
+
TableController,
|
|
1224
|
+
UseValidationErrorTransform,
|
|
1225
|
+
ValueHelpQuery,
|
|
1226
|
+
ViewController,
|
|
1227
|
+
dbActionBodySlot,
|
|
1228
|
+
dbActionInputSlot,
|
|
1229
|
+
discoverActions,
|
|
1230
|
+
getAtscriptDbMate,
|
|
1231
|
+
getControllerFormType,
|
|
1232
|
+
perRow,
|
|
1233
|
+
useDbActionId,
|
|
1234
|
+
useDbActionIds,
|
|
1235
|
+
useDbActionInput,
|
|
1236
|
+
useDbActionRow,
|
|
1237
|
+
useDbActionRows,
|
|
1238
|
+
validationErrorTransform,
|
|
1239
|
+
};
|