@lantharos/pult 0.8.0 → 0.9.0
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 +38 -14
- package/cli.mjs +350 -124
- package/index.d.mts +135 -96
- package/index.mjs +171 -77
- package/package.json +21 -2
- package/{schema-CzG8J_9_.mjs → schema-DuTVNptF.mjs} +65 -42
- package/cli.d.mts +0 -1
- package/stub.d.mts +0 -11
package/index.d.mts
CHANGED
|
@@ -12,11 +12,6 @@ interface SendResult {
|
|
|
12
12
|
reopened: boolean;
|
|
13
13
|
occurrences: number;
|
|
14
14
|
}
|
|
15
|
-
interface ActionResult {
|
|
16
|
-
message?: string;
|
|
17
|
-
blocks?: Block[];
|
|
18
|
-
running?: boolean;
|
|
19
|
-
}
|
|
20
15
|
interface IncomingMessage {
|
|
21
16
|
thread: string;
|
|
22
17
|
from: string;
|
|
@@ -77,7 +72,7 @@ interface FlagState extends FlagValue {
|
|
|
77
72
|
//#region ../protocol/src/status.d.ts
|
|
78
73
|
type ComponentState = "operational" | "degraded" | "partial" | "down" | "maintenance";
|
|
79
74
|
//#endregion
|
|
80
|
-
//#region ../protocol/src/console.d.ts
|
|
75
|
+
//#region ../protocol/src/console/console.d.ts
|
|
81
76
|
interface ItemSummary {
|
|
82
77
|
id: string;
|
|
83
78
|
inbox: string;
|
|
@@ -368,6 +363,17 @@ interface PageDef {
|
|
|
368
363
|
params: JsonSchema | null;
|
|
369
364
|
blocks: Block[] | null;
|
|
370
365
|
}
|
|
366
|
+
interface SpaceDef {
|
|
367
|
+
name: string;
|
|
368
|
+
source: string;
|
|
369
|
+
label: string;
|
|
370
|
+
icon: string;
|
|
371
|
+
home: string | null;
|
|
372
|
+
inboxes: string[];
|
|
373
|
+
resources: string[];
|
|
374
|
+
pages: string[];
|
|
375
|
+
flags: string[];
|
|
376
|
+
}
|
|
371
377
|
interface FlagDef {
|
|
372
378
|
source: string;
|
|
373
379
|
label: string;
|
|
@@ -409,13 +415,13 @@ interface StatusLogo {
|
|
|
409
415
|
light: string;
|
|
410
416
|
dark: string;
|
|
411
417
|
}
|
|
412
|
-
interface StatusDef {
|
|
418
|
+
interface StatusDef<Component extends string = string> {
|
|
413
419
|
source: string;
|
|
414
420
|
title: string;
|
|
415
421
|
logo: StatusLogo | null;
|
|
416
422
|
website: string | null;
|
|
417
423
|
css: string | null;
|
|
418
|
-
components: Record<
|
|
424
|
+
components: Record<Component, StatusComponentDef>;
|
|
419
425
|
alert: Recipient[];
|
|
420
426
|
after: number;
|
|
421
427
|
}
|
|
@@ -425,7 +431,7 @@ type Delivery = {
|
|
|
425
431
|
mode: "webhook";
|
|
426
432
|
path: string;
|
|
427
433
|
};
|
|
428
|
-
interface Manifest {
|
|
434
|
+
interface Manifest<Component extends string = string> {
|
|
429
435
|
project: string;
|
|
430
436
|
version: string;
|
|
431
437
|
environments: string[];
|
|
@@ -438,8 +444,9 @@ interface Manifest {
|
|
|
438
444
|
pages: Record<string, PageDef>;
|
|
439
445
|
flags: Record<string, FlagDef>;
|
|
440
446
|
roles: Record<string, RoleDef>;
|
|
447
|
+
spaces: SpaceDef[];
|
|
441
448
|
notify: Record<string, NotifyDef>;
|
|
442
|
-
status: StatusDef | null;
|
|
449
|
+
status: StatusDef<Component> | null;
|
|
443
450
|
}
|
|
444
451
|
//#endregion
|
|
445
452
|
//#region src/schema.d.ts
|
|
@@ -452,9 +459,10 @@ export declare class ValidationError extends Error {
|
|
|
452
459
|
constructor(issues: readonly StandardSchemaV1.Issue[]);
|
|
453
460
|
}
|
|
454
461
|
//#endregion
|
|
455
|
-
//#region src/define/
|
|
462
|
+
//#region src/define/core.d.ts
|
|
456
463
|
declare const KIND: unique symbol;
|
|
457
|
-
type
|
|
464
|
+
type Awaitable<T> = T | Promise<T>;
|
|
465
|
+
type Kind = "resource" | "action" | "inbox" | "role" | "view" | "page" | "flag" | "notify" | "space" | "status" | "config";
|
|
458
466
|
interface Located {
|
|
459
467
|
readonly [KIND]: Kind;
|
|
460
468
|
readonly origin: Origin;
|
|
@@ -465,7 +473,6 @@ interface Origin {
|
|
|
465
473
|
}
|
|
466
474
|
//#endregion
|
|
467
475
|
//#region src/define/resource.d.ts
|
|
468
|
-
type Awaitable$2<T> = T | Promise<T>;
|
|
469
476
|
interface ActionContext<R, I> {
|
|
470
477
|
record: R;
|
|
471
478
|
input: I;
|
|
@@ -473,8 +480,12 @@ interface ActionContext<R, I> {
|
|
|
473
480
|
item: string | null;
|
|
474
481
|
progress: (fraction: number | null, note?: string) => Promise<void>;
|
|
475
482
|
}
|
|
476
|
-
type ActionReturn = undefined | string |
|
|
477
|
-
|
|
483
|
+
type ActionReturn = undefined | string | {
|
|
484
|
+
message?: string;
|
|
485
|
+
blocks?: BlockInput[];
|
|
486
|
+
};
|
|
487
|
+
type ActionInput<S> = S extends AnySchema ? InferOutput<S> : Record<string, never>;
|
|
488
|
+
type Prefill<S> = S extends AnySchema ? Partial<InferInput<S>> : Record<string, never>;
|
|
478
489
|
type ChoiceInput = string | {
|
|
479
490
|
value: string;
|
|
480
491
|
label: string;
|
|
@@ -488,11 +499,11 @@ interface ActionOptions<R, S> {
|
|
|
488
499
|
approval?: boolean;
|
|
489
500
|
background?: boolean;
|
|
490
501
|
when?: (record: R) => boolean;
|
|
491
|
-
defaults?: (record: R) => Partial<ActionInput
|
|
492
|
-
pick?: { [K in keyof ActionInput
|
|
493
|
-
choices?: { [K in keyof ActionInput
|
|
494
|
-
preview?: (context: ActionContext<R, ActionInput
|
|
495
|
-
run: (context: ActionContext<R, ActionInput
|
|
502
|
+
defaults?: (record: R) => Partial<ActionInput<S>>;
|
|
503
|
+
pick?: { [K in keyof ActionInput<S>]?: string; };
|
|
504
|
+
choices?: { [K in keyof ActionInput<S>]?: (record: R) => Awaitable<ChoiceInput[]>; };
|
|
505
|
+
preview?: (context: ActionContext<R, ActionInput<S>>) => Awaitable<BlockInput[]>;
|
|
506
|
+
run: (context: ActionContext<R, ActionInput<S>>) => Awaitable<ActionReturn>;
|
|
496
507
|
}
|
|
497
508
|
interface ActionRef {
|
|
498
509
|
readonly id: string;
|
|
@@ -516,7 +527,7 @@ type ActionFactory<R> = <S extends AnySchema | undefined = undefined>(options: A
|
|
|
516
527
|
interface Relation<R = any> {
|
|
517
528
|
resource: string;
|
|
518
529
|
label?: string;
|
|
519
|
-
list: (record: R, limit: number) => Awaitable
|
|
530
|
+
list: (record: R, limit: number) => Awaitable<unknown[]>;
|
|
520
531
|
}
|
|
521
532
|
interface ListQuery<F> {
|
|
522
533
|
query: string;
|
|
@@ -526,21 +537,21 @@ interface ListQuery<F> {
|
|
|
526
537
|
}
|
|
527
538
|
interface ListOptions<R, F extends AnySchema | undefined> {
|
|
528
539
|
filters?: F;
|
|
529
|
-
run: (query: ListQuery<F extends AnySchema ? InferOutput<F> : Record<string, never>>) => Awaitable
|
|
540
|
+
run: (query: ListQuery<F extends AnySchema ? InferOutput<F> : Record<string, never>>) => Awaitable<{
|
|
530
541
|
records: R[];
|
|
531
542
|
cursor?: string | null;
|
|
532
543
|
}>;
|
|
533
544
|
}
|
|
534
545
|
interface ResourceOptions<R, A, F extends AnySchema | undefined> {
|
|
535
|
-
get: (id: string) => Awaitable
|
|
536
|
-
find?: (query: string, limit: number) => Awaitable
|
|
546
|
+
get: (id: string) => Awaitable<R | null | undefined>;
|
|
547
|
+
find?: (query: string, limit: number) => Awaitable<R[]>;
|
|
537
548
|
list?: ListOptions<R, F>;
|
|
538
549
|
id?: (record: R) => string;
|
|
539
550
|
title: (record: R) => string;
|
|
540
551
|
subtitle?: (record: R) => string | undefined;
|
|
541
552
|
fields?: (record: R) => Record<string, FieldInput>;
|
|
542
553
|
url?: (record: R) => string | undefined;
|
|
543
|
-
render?: (record: R) => Awaitable
|
|
554
|
+
render?: (record: R) => Awaitable<BlockInput[]>;
|
|
544
555
|
label?: string;
|
|
545
556
|
plural?: string;
|
|
546
557
|
icon?: string;
|
|
@@ -557,7 +568,7 @@ interface Resource<R = any, A = any> extends Located {
|
|
|
557
568
|
}
|
|
558
569
|
export declare function resource<R, A extends Record<string, unknown> = Record<never, never>, F extends AnySchema | undefined = undefined>(name: string, options: ResourceOptions<R, A, F>): Resource<R, A>;
|
|
559
570
|
//#endregion
|
|
560
|
-
//#region src/define/triage.d.ts
|
|
571
|
+
//#region src/define/inbox/triage.d.ts
|
|
561
572
|
declare const answer: unique symbol;
|
|
562
573
|
type Question<T> = TriageQuestion & {
|
|
563
574
|
readonly [answer]?: T;
|
|
@@ -571,7 +582,7 @@ type Answers<Q extends Record<string, Question<unknown>>> = { [K in keyof Q]: Q[
|
|
|
571
582
|
interface Rule<A> {
|
|
572
583
|
name?: string;
|
|
573
584
|
live?: boolean;
|
|
574
|
-
when
|
|
585
|
+
when(answers: A): boolean;
|
|
575
586
|
then: TriageDecision | TriageDecision[];
|
|
576
587
|
}
|
|
577
588
|
interface Triage<Q extends Record<string, Question<unknown>> = Record<string, Question<unknown>>> {
|
|
@@ -586,10 +597,9 @@ export declare function triage<Q extends Record<string, Question<unknown>>>(opti
|
|
|
586
597
|
}): Triage<Q>;
|
|
587
598
|
export declare const setState: (state: string) => TriageDecision;
|
|
588
599
|
export declare const tag: (name: string) => TriageDecision;
|
|
589
|
-
export declare const run: (action:
|
|
600
|
+
export declare const run: <S>(action: Action<any, S>, input?: Prefill<S>) => TriageDecision;
|
|
590
601
|
//#endregion
|
|
591
|
-
//#region src/define/inbox.d.ts
|
|
592
|
-
type Awaitable$1<T> = T | Promise<T>;
|
|
602
|
+
//#region src/define/inbox/inbox.d.ts
|
|
593
603
|
type Duration = `${number}${"m" | "h" | "d"}`;
|
|
594
604
|
interface ItemView<D> {
|
|
595
605
|
title: string;
|
|
@@ -612,18 +622,18 @@ interface InboxOptions<S extends Schema | undefined> {
|
|
|
612
622
|
reopenFrom?: string[];
|
|
613
623
|
data?: S;
|
|
614
624
|
title?: (data: InboxData<S>) => string;
|
|
615
|
-
render?: (item: ItemView<InboxData<S>>) => Awaitable
|
|
625
|
+
render?: (item: ItemView<InboxData<S>>) => Awaitable<BlockInput[]>;
|
|
616
626
|
columns?: string[];
|
|
617
627
|
intake?: boolean | {
|
|
618
628
|
title?: string;
|
|
619
629
|
description?: string;
|
|
620
630
|
};
|
|
621
|
-
triage?: Triage
|
|
631
|
+
triage?: Triage;
|
|
622
632
|
reply?: {
|
|
623
633
|
to: (item: ItemView<InboxData<S>>) => string | undefined;
|
|
624
|
-
send: (email: OutgoingEmail<InboxData<S>>) => Awaitable
|
|
634
|
+
send: (email: OutgoingEmail<InboxData<S>>) => Awaitable<void>;
|
|
625
635
|
};
|
|
626
|
-
onState?: (change: StateChange<InboxData<S>>) => Awaitable
|
|
636
|
+
onState?: (change: StateChange<InboxData<S>>) => Awaitable<void>;
|
|
627
637
|
sla?: Record<string, Duration>;
|
|
628
638
|
}
|
|
629
639
|
interface OutgoingEmail<D> {
|
|
@@ -660,13 +670,13 @@ interface Inbox<S extends Schema | undefined = any> extends Located {
|
|
|
660
670
|
}
|
|
661
671
|
export declare function inbox<S extends Schema | undefined = undefined>(name: string, options: InboxOptions<S>): Inbox<S>;
|
|
662
672
|
//#endregion
|
|
663
|
-
//#region src/define/flag.d.ts
|
|
673
|
+
//#region src/define/controls/flag.d.ts
|
|
664
674
|
interface Guard {
|
|
665
675
|
inbox: Inbox;
|
|
666
676
|
perHour: number;
|
|
667
677
|
then?: "pause" | "revert";
|
|
668
678
|
}
|
|
669
|
-
interface
|
|
679
|
+
interface FlagOptions<A = undefined> {
|
|
670
680
|
label?: string;
|
|
671
681
|
description?: string;
|
|
672
682
|
target?: Resource;
|
|
@@ -676,27 +686,26 @@ interface FlagOptionsBase<A> {
|
|
|
676
686
|
approval?: boolean;
|
|
677
687
|
}
|
|
678
688
|
type Attributes<A> = A extends AnySchema ? Partial<InferOutput<A>> : Record<string, Attribute | null | undefined>;
|
|
679
|
-
type FlagContext<A> = {
|
|
689
|
+
type FlagContext<A = undefined> = {
|
|
680
690
|
key?: string;
|
|
681
691
|
} & Attributes<A>;
|
|
682
692
|
interface Flag<T = unknown, A = unknown> extends Located {
|
|
683
693
|
readonly name: string;
|
|
684
|
-
readonly options:
|
|
694
|
+
readonly options: FlagOptions<AnySchema> & {
|
|
685
695
|
value?: AnySchema;
|
|
686
696
|
default: T;
|
|
687
697
|
};
|
|
688
698
|
readonly context?: FlagContext<A>;
|
|
689
699
|
}
|
|
690
|
-
export declare function flag<A extends AnySchema | undefined = undefined>(name: string, options?:
|
|
700
|
+
export declare function flag<A extends AnySchema | undefined = undefined>(name: string, options?: FlagOptions<A> & {
|
|
691
701
|
default?: boolean;
|
|
692
702
|
}): Flag<boolean, A>;
|
|
693
|
-
export declare function flag<S extends AnySchema, A extends AnySchema | undefined = undefined>(name: string, options:
|
|
703
|
+
export declare function flag<S extends AnySchema, A extends AnySchema | undefined = undefined>(name: string, options: FlagOptions<A> & {
|
|
694
704
|
value: S;
|
|
695
705
|
default: InferOutput<S>;
|
|
696
706
|
}): Flag<InferOutput<S>, A>;
|
|
697
707
|
//#endregion
|
|
698
|
-
//#region src/define/
|
|
699
|
-
type Awaitable<T> = T | Promise<T>;
|
|
708
|
+
//#region src/define/inbox/view.d.ts
|
|
700
709
|
type Filter = Omit<ViewFilter, "state"> & {
|
|
701
710
|
state?: string | string[];
|
|
702
711
|
};
|
|
@@ -713,24 +722,6 @@ interface View extends Located {
|
|
|
713
722
|
readonly options: ViewOptions;
|
|
714
723
|
}
|
|
715
724
|
export declare function view(name: string, options: ViewOptions): View;
|
|
716
|
-
type Params<P> = P extends AnySchema ? InferOutput<P> : Record<string, never>;
|
|
717
|
-
interface PageContext<P> {
|
|
718
|
-
params: P;
|
|
719
|
-
actor: Actor;
|
|
720
|
-
}
|
|
721
|
-
type PageContent<P> = BlockInput[] | ((context: PageContext<Params<P>>) => Awaitable<BlockInput[]>);
|
|
722
|
-
interface PageOptions<P extends AnySchema | undefined> {
|
|
723
|
-
label?: string;
|
|
724
|
-
icon?: string;
|
|
725
|
-
params?: P;
|
|
726
|
-
render: PageContent<P>;
|
|
727
|
-
}
|
|
728
|
-
interface Page extends Located {
|
|
729
|
-
readonly name: string;
|
|
730
|
-
readonly options: PageOptions<any>;
|
|
731
|
-
}
|
|
732
|
-
export declare function page<P extends AnySchema | undefined = undefined>(name: string, options: PageOptions<P>): Page;
|
|
733
|
-
export declare function home<P extends AnySchema | undefined = undefined>(options: PageContent<P> | PageOptions<P>): Page;
|
|
734
725
|
//#endregion
|
|
735
726
|
//#region src/blocks.d.ts
|
|
736
727
|
type FieldInput = FieldValue | Date | undefined;
|
|
@@ -740,7 +731,11 @@ interface PendingAttachment {
|
|
|
740
731
|
contentType: string;
|
|
741
732
|
data: Blob | ArrayBuffer | Uint8Array;
|
|
742
733
|
}
|
|
743
|
-
|
|
734
|
+
interface ColumnsInput {
|
|
735
|
+
type: "columns";
|
|
736
|
+
columns: BlockInput[][];
|
|
737
|
+
}
|
|
738
|
+
type BlockInput = Block | PendingAttachment | ColumnsInput;
|
|
744
739
|
type ResourceLike = string | {
|
|
745
740
|
readonly name: string;
|
|
746
741
|
};
|
|
@@ -760,13 +755,18 @@ declare function chart(inbox: Inbox, options?: {
|
|
|
760
755
|
title?: string;
|
|
761
756
|
}): Block;
|
|
762
757
|
type Listing = Inbox | View;
|
|
763
|
-
type
|
|
764
|
-
|
|
765
|
-
action: ActionInput;
|
|
758
|
+
type ActionTarget = Action | string;
|
|
759
|
+
interface ButtonOptions {
|
|
766
760
|
record?: string;
|
|
767
|
-
input?: Record<string, unknown>;
|
|
768
761
|
label?: string;
|
|
769
|
-
}
|
|
762
|
+
}
|
|
763
|
+
type ButtonInput<S = any> = ActionTarget | (ButtonOptions & {
|
|
764
|
+
action: string;
|
|
765
|
+
input?: Record<string, unknown>;
|
|
766
|
+
}) | (ButtonOptions & {
|
|
767
|
+
action: Action<any, S>;
|
|
768
|
+
input?: Prefill<S>;
|
|
769
|
+
});
|
|
770
770
|
export declare const b: {
|
|
771
771
|
markdown: (text: string) => Block;
|
|
772
772
|
fields: (fields: Record<string, FieldInput>) => Block;
|
|
@@ -795,9 +795,9 @@ export declare const b: {
|
|
|
795
795
|
value: FieldInput;
|
|
796
796
|
note?: string;
|
|
797
797
|
}>) => Block;
|
|
798
|
-
actions: (...buttons: ButtonInput[]) => Block;
|
|
799
|
-
form: (action: ButtonInput) => Block;
|
|
800
|
-
columns: (...columns: BlockInput[][]) =>
|
|
798
|
+
actions: <S extends unknown[]>(...buttons: { [K in keyof S]: ButtonInput<S[K]>; }) => Block;
|
|
799
|
+
form: <S>(action: ButtonInput<S>) => Block;
|
|
800
|
+
columns: (...columns: BlockInput[][]) => BlockInput;
|
|
801
801
|
count: (target: Listing, options?: {
|
|
802
802
|
filter?: Filter;
|
|
803
803
|
label?: string;
|
|
@@ -807,8 +807,8 @@ export declare const b: {
|
|
|
807
807
|
label?: string;
|
|
808
808
|
limit?: number;
|
|
809
809
|
}) => Block;
|
|
810
|
-
flag: (flag: Flag
|
|
811
|
-
edit: (value: FieldInput, action:
|
|
810
|
+
flag: (flag: Flag) => Block;
|
|
811
|
+
edit: (value: FieldInput, action: ActionTarget, options?: {
|
|
812
812
|
record?: string;
|
|
813
813
|
field?: string;
|
|
814
814
|
}) => FieldValue;
|
|
@@ -827,14 +827,34 @@ interface Config extends Located {
|
|
|
827
827
|
}
|
|
828
828
|
export declare function defineConfig(options: ConfigOptions): Config;
|
|
829
829
|
//#endregion
|
|
830
|
-
//#region src/define/
|
|
830
|
+
//#region src/define/console/page.d.ts
|
|
831
|
+
type Params<P> = P extends AnySchema ? InferOutput<P> : Record<string, never>;
|
|
832
|
+
interface PageContext<P> {
|
|
833
|
+
params: P;
|
|
834
|
+
actor: Actor;
|
|
835
|
+
}
|
|
836
|
+
type PageContent<P> = BlockInput[] | ((context: PageContext<Params<P>>) => Awaitable<BlockInput[]>);
|
|
837
|
+
interface PageOptions<P extends AnySchema | undefined> {
|
|
838
|
+
label?: string;
|
|
839
|
+
icon?: string;
|
|
840
|
+
params?: P;
|
|
841
|
+
render: PageContent<P>;
|
|
842
|
+
}
|
|
843
|
+
interface Page extends Located {
|
|
844
|
+
readonly name: string;
|
|
845
|
+
readonly options: PageOptions<any>;
|
|
846
|
+
}
|
|
847
|
+
export declare function page<P extends AnySchema | undefined = undefined>(name: string, options: PageOptions<P>): Page;
|
|
848
|
+
export declare function home<P extends AnySchema | undefined = undefined>(options: PageContent<P> | PageOptions<P>): Page;
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/define/console/role.d.ts
|
|
831
851
|
interface RoleOptions {
|
|
832
852
|
label?: string;
|
|
833
853
|
inboxes?: Inbox[];
|
|
834
854
|
resources?: Resource[];
|
|
835
855
|
actions?: ActionRef[];
|
|
836
856
|
pages?: Page[];
|
|
837
|
-
flags?: Flag
|
|
857
|
+
flags?: Flag[];
|
|
838
858
|
reveal?: boolean;
|
|
839
859
|
status?: boolean;
|
|
840
860
|
}
|
|
@@ -844,7 +864,24 @@ interface Role extends Located {
|
|
|
844
864
|
}
|
|
845
865
|
export declare function role(name: string, options: RoleOptions): Role;
|
|
846
866
|
//#endregion
|
|
847
|
-
//#region src/define/
|
|
867
|
+
//#region src/define/console/space.d.ts
|
|
868
|
+
interface SpaceOptions {
|
|
869
|
+
label?: string;
|
|
870
|
+
icon?: string;
|
|
871
|
+
home?: Page | PageContent<undefined>;
|
|
872
|
+
inboxes?: Inbox[];
|
|
873
|
+
resources?: Resource[];
|
|
874
|
+
pages?: Page[];
|
|
875
|
+
flags?: Flag[];
|
|
876
|
+
}
|
|
877
|
+
interface Space extends Located {
|
|
878
|
+
readonly name: string;
|
|
879
|
+
readonly options: SpaceOptions;
|
|
880
|
+
readonly home: Page | null;
|
|
881
|
+
}
|
|
882
|
+
export declare function space(name: string, options: SpaceOptions): Space;
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/define/inbox/notify.d.ts
|
|
848
885
|
interface Channel {
|
|
849
886
|
readonly channel: string;
|
|
850
887
|
}
|
|
@@ -860,7 +897,7 @@ interface Notify extends Located {
|
|
|
860
897
|
}
|
|
861
898
|
export declare function notify(name: string, options: NotifyOptions): Notify;
|
|
862
899
|
//#endregion
|
|
863
|
-
//#region src/define/status.d.ts
|
|
900
|
+
//#region src/define/controls/status.d.ts
|
|
864
901
|
interface StatusComponent {
|
|
865
902
|
label: string;
|
|
866
903
|
description?: string;
|
|
@@ -884,12 +921,6 @@ interface Status extends Located {
|
|
|
884
921
|
}
|
|
885
922
|
export declare function status(options: StatusOptions): Status;
|
|
886
923
|
//#endregion
|
|
887
|
-
//#region src/client/dispatch.d.ts
|
|
888
|
-
interface Project {
|
|
889
|
-
manifest: Manifest;
|
|
890
|
-
modules: Record<string, () => Promise<Record<string, unknown>>>;
|
|
891
|
-
}
|
|
892
|
-
//#endregion
|
|
893
924
|
//#region src/client/transport.d.ts
|
|
894
925
|
type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
895
926
|
export declare class PultError extends Error {
|
|
@@ -898,32 +929,42 @@ export declare class PultError extends Error {
|
|
|
898
929
|
constructor(message: string, status: number, code?: string | undefined);
|
|
899
930
|
}
|
|
900
931
|
//#endregion
|
|
932
|
+
//#region src/client/dispatch.d.ts
|
|
933
|
+
interface Project<Component extends string = string> {
|
|
934
|
+
manifest: Manifest<Component>;
|
|
935
|
+
modules: Record<string, () => Promise<Record<string, unknown>>>;
|
|
936
|
+
}
|
|
937
|
+
//#endregion
|
|
901
938
|
//#region src/client/socket.d.ts
|
|
902
939
|
interface Connection {
|
|
903
940
|
close(): void;
|
|
904
941
|
}
|
|
905
942
|
//#endregion
|
|
906
943
|
//#region src/client/pult.d.ts
|
|
907
|
-
interface PultOptions {
|
|
944
|
+
interface PultOptions<Component extends string = string> {
|
|
908
945
|
key?: string;
|
|
909
|
-
project: Project
|
|
946
|
+
project: Project<Component>;
|
|
910
947
|
url?: string;
|
|
911
948
|
fetch?: Fetch;
|
|
912
949
|
}
|
|
913
|
-
interface
|
|
950
|
+
interface Suggestion<S = any> {
|
|
951
|
+
action: Action<any, S>;
|
|
952
|
+
input?: Prefill<S>;
|
|
953
|
+
reason?: string;
|
|
954
|
+
}
|
|
955
|
+
interface SendOptions<S extends Schema | undefined, Suggested extends unknown[] = unknown[]> {
|
|
914
956
|
title?: string;
|
|
915
957
|
fingerprint?: string;
|
|
916
958
|
record?: string;
|
|
917
959
|
data: InboxInput<S>;
|
|
918
960
|
tags?: string[];
|
|
919
|
-
suggest?: {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}[];
|
|
961
|
+
suggest?: { [K in keyof Suggested]: Suggestion<Suggested[K]>; };
|
|
962
|
+
}
|
|
963
|
+
interface ListenOptions {
|
|
964
|
+
onStatus?: (status: "connected" | "disconnected") => void;
|
|
924
965
|
}
|
|
925
|
-
export declare function createPult({ key, project, url, fetch }: PultOptions): {
|
|
926
|
-
send: <S extends Schema | undefined>(inbox: Inbox<S>, item: SendOptions<S>) => Promise<SendResult>;
|
|
966
|
+
export declare function createPult<Component extends string = string>({ key, project, url, fetch }: PultOptions<Component>): {
|
|
967
|
+
send: <S extends Schema | undefined, Suggested extends unknown[]>(inbox: Inbox<S>, item: SendOptions<S, Suggested>) => Promise<SendResult>;
|
|
927
968
|
log: (resource: Resource, id: string, text: string, options?: {
|
|
928
969
|
blocks?: BlockInput[];
|
|
929
970
|
by?: string;
|
|
@@ -933,11 +974,9 @@ export declare function createPult({ key, project, url, fetch }: PultOptions): {
|
|
|
933
974
|
} | null>;
|
|
934
975
|
flag: <T, A>(definition: Flag<T, A>, context?: string | FlagContext<A>) => Promise<T>;
|
|
935
976
|
status: {
|
|
936
|
-
set(component:
|
|
977
|
+
set(component: Component, state: ComponentState): Promise<void>;
|
|
937
978
|
};
|
|
938
|
-
listen: (options?:
|
|
939
|
-
onStatus?: (status: "connected" | "disconnected") => void;
|
|
940
|
-
}) => Connection;
|
|
979
|
+
listen: (options?: ListenOptions) => Connection;
|
|
941
980
|
handler: () => (request: Request, context?: {
|
|
942
981
|
waitUntil(work: Promise<unknown>): void;
|
|
943
982
|
}) => Promise<Response>;
|
|
@@ -947,4 +986,4 @@ export declare function createPult({ key, project, url, fetch }: PultOptions): {
|
|
|
947
986
|
};
|
|
948
987
|
type Pult = ReturnType<typeof createPult>;
|
|
949
988
|
//#endregion
|
|
950
|
-
export type { Action, ActionContext, Actor, Block, Channel, ComponentState, Config, Duration, Flag, Inbox, ItemView, ListQuery, Manifest, Notify, OutgoingEmail, Page, PageContext, Project, Pult, Relation, Resource, Role, SendOptions, SendResult, StateChange, Status, View };
|
|
989
|
+
export type { Action, ActionContext, ActionOptions, ActionRef, Actor, Block, BlockInput, ButtonInput, Channel, ComponentState, Config, ConfigOptions, Duration, FieldInput, Flag, FlagContext, FlagOptions, Guard, Inbox, InboxOptions, ItemView, ListOptions, ListQuery, ListenOptions, Manifest, Notify, NotifyOptions, OutgoingEmail, Page, PageContext, PageOptions, Project, Pult, PultOptions, Question, Relation, Resource, ResourceOptions, Role, RoleOptions, Rule, SendOptions, SendResult, Space, SpaceOptions, StandaloneOptions, StateChange, Status, StatusOptions, Suggestion, Triage, View, ViewOptions };
|