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