@crvouga/mockingbird-service-slack 3.1.0 → 3.2.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/API_EVIDENCE.md +3 -0
- package/CHANGELOG.md +8 -2
- package/LICENSE_EMULATE +202 -0
- package/SUPPORT.md +56 -2
- package/THIRD_PARTY_NOTICES.md +39 -0
- package/dist/{chunk-A2QC6SAR.js → chunk-B4MV67Z4.js} +9500 -2841
- package/dist/chunk-B4MV67Z4.js.map +7 -0
- package/dist/{chunk-AJMQBCFN.js → chunk-IM5DJEPT.js} +58 -4
- package/dist/chunk-IM5DJEPT.js.map +7 -0
- package/dist/chunk-M73LWCCP.js +67 -0
- package/dist/chunk-M73LWCCP.js.map +7 -0
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/crypto-I5AVO7Q3.js +15 -0
- package/dist/crypto-I5AVO7Q3.js.map +7 -0
- package/dist/helpers-BMHFVPFA.js +86 -0
- package/dist/helpers-BMHFVPFA.js.map +7 -0
- package/dist/index.d.ts +235 -52
- package/dist/index.js +2 -1
- package/dist/server.d.ts +315 -114
- package/dist/server.js +3 -2
- package/openapi.yaml +4081 -1945
- package/package.json +14 -5
- package/routes.json +72 -0
- package/dist/chunk-A2QC6SAR.js.map +0 -7
- package/dist/chunk-AJMQBCFN.js.map +0 -7
package/dist/server.d.ts
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
2
|
import { Hono } from 'hono';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type MountedAPI$1 = FetchAPI$2 & {
|
|
5
|
+
readonly prefix: string;
|
|
6
|
+
GET: FetchHandler$1;
|
|
7
|
+
POST: FetchHandler$1;
|
|
8
|
+
PUT: FetchHandler$1;
|
|
9
|
+
PATCH: FetchHandler$1;
|
|
10
|
+
DELETE: FetchHandler$1;
|
|
11
|
+
HEAD: FetchHandler$1;
|
|
12
|
+
OPTIONS: FetchHandler$1;
|
|
10
13
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Prepared statement bound to a {@link SqliteClient}.
|
|
13
|
-
*
|
|
14
|
-
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
15
|
-
*/
|
|
16
|
-
interface SqliteStatement$2 {
|
|
17
|
-
run(...params: SqliteValue$2[]): SqliteRunResult$2;
|
|
18
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
|
|
19
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Sync SQLite client port owned by Mockingbird.
|
|
23
|
-
*
|
|
24
|
-
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
25
|
-
* `bun:sqlite` instances all work when they expose this surface.
|
|
26
|
-
*/
|
|
27
|
-
interface SqliteClient$2 {
|
|
28
|
-
exec(sql: string): void;
|
|
29
|
-
prepare(sql: string): SqliteStatement$2;
|
|
30
|
-
transaction<T>(fn: () => T): T;
|
|
31
|
-
}
|
|
32
14
|
|
|
33
15
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
34
16
|
type CheckpointId$1 = string;
|
|
@@ -119,6 +101,37 @@ declare class Timeline$1<T> {
|
|
|
119
101
|
interface FetchAPI$2 {
|
|
120
102
|
fetch(request: Request): Promise<Response>;
|
|
121
103
|
}
|
|
104
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
105
|
+
type FetchHandler$1 = (request: Request) => Promise<Response>;
|
|
106
|
+
|
|
107
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
108
|
+
type SqliteValue$3 = null | number | bigint | string | Uint8Array | boolean;
|
|
109
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
110
|
+
type SqliteRunResult$3 = {
|
|
111
|
+
changes: number;
|
|
112
|
+
lastInsertRowid: number | bigint;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
116
|
+
*
|
|
117
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
118
|
+
*/
|
|
119
|
+
interface SqliteStatement$3 {
|
|
120
|
+
run(...params: SqliteValue$3[]): SqliteRunResult$3;
|
|
121
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$3[]): T[];
|
|
122
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$3[]): T | undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
126
|
+
*
|
|
127
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
128
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
129
|
+
*/
|
|
130
|
+
interface SqliteClient$3 {
|
|
131
|
+
exec(sql: string): void;
|
|
132
|
+
prepare(sql: string): SqliteStatement$3;
|
|
133
|
+
transaction<T>(fn: () => T): T;
|
|
134
|
+
}
|
|
122
135
|
|
|
123
136
|
/**
|
|
124
137
|
* The single source of time for a service.
|
|
@@ -535,7 +548,9 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
|
535
548
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
536
549
|
stop?(): void;
|
|
537
550
|
readonly name: string;
|
|
538
|
-
|
|
551
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
552
|
+
mount(prefix: string): MountedAPI$1;
|
|
553
|
+
readonly sqlite: SqliteClient$3;
|
|
539
554
|
readonly clock: Clock$1;
|
|
540
555
|
readonly faults: FaultRegistry$1;
|
|
541
556
|
readonly metrics: Metrics$1;
|
|
@@ -601,6 +616,9 @@ type CommonServeOptions = {
|
|
|
601
616
|
adminKey: string | undefined;
|
|
602
617
|
seed: string | undefined;
|
|
603
618
|
onLog: ((entry: RequestLog$1) => void) | undefined;
|
|
619
|
+
/** Synthetic provider fixture objects supplied by a fleet entry. */
|
|
620
|
+
fixtures?: Record<string, unknown>;
|
|
621
|
+
baseUrl?: string;
|
|
604
622
|
};
|
|
605
623
|
/**
|
|
606
624
|
* What a service contributes to `serve`: how to build its runtime from CLI flags,
|
|
@@ -619,76 +637,16 @@ type ServeTarget = {
|
|
|
619
637
|
listening?(server: Listening): void;
|
|
620
638
|
};
|
|
621
639
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
*
|
|
632
|
-
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
633
|
-
*/
|
|
634
|
-
interface SqliteStatement$1 {
|
|
635
|
-
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
636
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
637
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Sync SQLite client port owned by Mockingbird.
|
|
641
|
-
*
|
|
642
|
-
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
643
|
-
* `bun:sqlite` instances all work when they expose this surface.
|
|
644
|
-
*/
|
|
645
|
-
interface SqliteClient$1 {
|
|
646
|
-
exec(sql: string): void;
|
|
647
|
-
prepare(sql: string): SqliteStatement$1;
|
|
648
|
-
transaction<T>(fn: () => T): T;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
652
|
-
type Stored<T> = {
|
|
653
|
-
seq: number;
|
|
654
|
-
value: T;
|
|
655
|
-
};
|
|
656
|
-
type ListRecordsOptions<T> = {
|
|
657
|
-
/** Keep only records passing the predicate. */
|
|
658
|
-
where?: (value: T, seq: number) => boolean;
|
|
659
|
-
/** Sort order; default newest first. */
|
|
660
|
-
order?: "newest" | "oldest";
|
|
640
|
+
type MountedAPI = FetchAPI$1 & {
|
|
641
|
+
readonly prefix: string;
|
|
642
|
+
GET: FetchHandler;
|
|
643
|
+
POST: FetchHandler;
|
|
644
|
+
PUT: FetchHandler;
|
|
645
|
+
PATCH: FetchHandler;
|
|
646
|
+
DELETE: FetchHandler;
|
|
647
|
+
HEAD: FetchHandler;
|
|
648
|
+
OPTIONS: FetchHandler;
|
|
661
649
|
};
|
|
662
|
-
/**
|
|
663
|
-
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
664
|
-
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
665
|
-
*/
|
|
666
|
-
declare class Collection<T> {
|
|
667
|
-
private readonly sqlite;
|
|
668
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
669
|
-
readonly namespace: string;
|
|
670
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
671
|
-
readonly collectionName: string;
|
|
672
|
-
constructor(sqlite: SqliteClient$1,
|
|
673
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
674
|
-
namespace: string,
|
|
675
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
676
|
-
collectionName: string);
|
|
677
|
-
private bumpCollectionSeq;
|
|
678
|
-
nextSequence(): number;
|
|
679
|
-
get(id: string): T | undefined;
|
|
680
|
-
has(id: string): boolean;
|
|
681
|
-
/** Insert a new record, assigning it the next sequence number. */
|
|
682
|
-
insert(id: string, value: T): Stored<T>;
|
|
683
|
-
/** Replace an existing record's value, keeping its position. */
|
|
684
|
-
update(id: string, value: T): Stored<T> | undefined;
|
|
685
|
-
delete(id: string): boolean;
|
|
686
|
-
/** How many records the collection holds, without reading them. */
|
|
687
|
-
count(): number;
|
|
688
|
-
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
689
|
-
id: string;
|
|
690
|
-
}>;
|
|
691
|
-
}
|
|
692
650
|
|
|
693
651
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
694
652
|
type CheckpointId = string;
|
|
@@ -779,11 +737,84 @@ declare class Timeline<T> {
|
|
|
779
737
|
interface FetchAPI$1 {
|
|
780
738
|
fetch(request: Request): Promise<Response>;
|
|
781
739
|
}
|
|
740
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
741
|
+
type FetchHandler = (request: Request) => Promise<Response>;
|
|
742
|
+
|
|
743
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
744
|
+
type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
|
|
745
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
746
|
+
type SqliteRunResult$2 = {
|
|
747
|
+
changes: number;
|
|
748
|
+
lastInsertRowid: number | bigint;
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
752
|
+
*
|
|
753
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
754
|
+
*/
|
|
755
|
+
interface SqliteStatement$2 {
|
|
756
|
+
run(...params: SqliteValue$2[]): SqliteRunResult$2;
|
|
757
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
|
|
758
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
762
|
+
*
|
|
763
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
764
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
765
|
+
*/
|
|
766
|
+
interface SqliteClient$2 {
|
|
767
|
+
exec(sql: string): void;
|
|
768
|
+
prepare(sql: string): SqliteStatement$2;
|
|
769
|
+
transaction<T>(fn: () => T): T;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
773
|
+
type Stored<T> = {
|
|
774
|
+
seq: number;
|
|
775
|
+
value: T;
|
|
776
|
+
};
|
|
777
|
+
type ListRecordsOptions<T> = {
|
|
778
|
+
/** Keep only records passing the predicate. */
|
|
779
|
+
where?: (value: T, seq: number) => boolean;
|
|
780
|
+
/** Sort order; default newest first. */
|
|
781
|
+
order?: "newest" | "oldest";
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
785
|
+
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
786
|
+
*/
|
|
787
|
+
declare class Collection<T> {
|
|
788
|
+
private readonly sqlite;
|
|
789
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
790
|
+
readonly namespace: string;
|
|
791
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
792
|
+
readonly collectionName: string;
|
|
793
|
+
constructor(sqlite: SqliteClient$2,
|
|
794
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
795
|
+
namespace: string,
|
|
796
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
797
|
+
collectionName: string);
|
|
798
|
+
private bumpCollectionSeq;
|
|
799
|
+
nextSequence(): number;
|
|
800
|
+
get(id: string): T | undefined;
|
|
801
|
+
has(id: string): boolean;
|
|
802
|
+
/** Insert a new record, assigning it the next sequence number. */
|
|
803
|
+
insert(id: string, value: T): Stored<T>;
|
|
804
|
+
/** Replace an existing record's value, keeping its position. */
|
|
805
|
+
update(id: string, value: T): Stored<T> | undefined;
|
|
806
|
+
delete(id: string): boolean;
|
|
807
|
+
/** How many records the collection holds, without reading them. */
|
|
808
|
+
count(): number;
|
|
809
|
+
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
810
|
+
id: string;
|
|
811
|
+
}>;
|
|
812
|
+
}
|
|
782
813
|
|
|
783
814
|
/** Options every provider constructor accepts. */
|
|
784
|
-
type APIOptions = {
|
|
815
|
+
type APIOptions$1 = {
|
|
785
816
|
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
786
|
-
sqlite?: SqliteClient$
|
|
817
|
+
sqlite?: SqliteClient$2;
|
|
787
818
|
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
788
819
|
now?: () => number;
|
|
789
820
|
/**
|
|
@@ -1208,7 +1239,9 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1208
1239
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
1209
1240
|
stop?(): void;
|
|
1210
1241
|
readonly name: string;
|
|
1211
|
-
|
|
1242
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
1243
|
+
mount(prefix: string): MountedAPI;
|
|
1244
|
+
readonly sqlite: SqliteClient$2;
|
|
1212
1245
|
readonly clock: Clock;
|
|
1213
1246
|
readonly faults: FaultRegistry;
|
|
1214
1247
|
readonly metrics: Metrics;
|
|
@@ -1275,7 +1308,7 @@ type OutboxQuery = {
|
|
|
1275
1308
|
};
|
|
1276
1309
|
declare class OutboxStore<T extends OutboxItem = OutboxItem> {
|
|
1277
1310
|
private readonly items;
|
|
1278
|
-
constructor(sqlite: SqliteClient$
|
|
1311
|
+
constructor(sqlite: SqliteClient$2, namespace: string, name?: string);
|
|
1279
1312
|
record(item: T): T;
|
|
1280
1313
|
get(id: string): T | undefined;
|
|
1281
1314
|
update(id: string, item: T): void;
|
|
@@ -1284,9 +1317,9 @@ declare class OutboxStore<T extends OutboxItem = OutboxItem> {
|
|
|
1284
1317
|
}
|
|
1285
1318
|
|
|
1286
1319
|
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
1287
|
-
type SqliteValue = null | number | bigint | string | Uint8Array | boolean;
|
|
1320
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
1288
1321
|
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
1289
|
-
type SqliteRunResult = {
|
|
1322
|
+
type SqliteRunResult$1 = {
|
|
1290
1323
|
changes: number;
|
|
1291
1324
|
lastInsertRowid: number | bigint;
|
|
1292
1325
|
};
|
|
@@ -1295,10 +1328,10 @@ type SqliteRunResult = {
|
|
|
1295
1328
|
*
|
|
1296
1329
|
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
1297
1330
|
*/
|
|
1298
|
-
interface SqliteStatement {
|
|
1299
|
-
run(...params: SqliteValue[]): SqliteRunResult;
|
|
1300
|
-
all<T = Record<string, unknown>>(...params: SqliteValue[]): T[];
|
|
1301
|
-
get<T = Record<string, unknown>>(...params: SqliteValue[]): T | undefined;
|
|
1331
|
+
interface SqliteStatement$1 {
|
|
1332
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
1333
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
1334
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
1302
1335
|
}
|
|
1303
1336
|
/**
|
|
1304
1337
|
* Sync SQLite client port owned by Mockingbird.
|
|
@@ -1306,9 +1339,9 @@ interface SqliteStatement {
|
|
|
1306
1339
|
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
1307
1340
|
* `bun:sqlite` instances all work when they expose this surface.
|
|
1308
1341
|
*/
|
|
1309
|
-
interface SqliteClient {
|
|
1342
|
+
interface SqliteClient$1 {
|
|
1310
1343
|
exec(sql: string): void;
|
|
1311
|
-
prepare(sql: string): SqliteStatement;
|
|
1344
|
+
prepare(sql: string): SqliteStatement$1;
|
|
1312
1345
|
transaction<T>(fn: () => T): T;
|
|
1313
1346
|
}
|
|
1314
1347
|
|
|
@@ -1322,6 +1355,170 @@ interface FetchAPI {
|
|
|
1322
1355
|
fetch(request: Request): Promise<Response>;
|
|
1323
1356
|
}
|
|
1324
1357
|
|
|
1358
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
1359
|
+
type SqliteValue = null | number | bigint | string | Uint8Array | boolean;
|
|
1360
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
1361
|
+
type SqliteRunResult = {
|
|
1362
|
+
changes: number;
|
|
1363
|
+
lastInsertRowid: number | bigint;
|
|
1364
|
+
};
|
|
1365
|
+
/**
|
|
1366
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
1367
|
+
*
|
|
1368
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
1369
|
+
*/
|
|
1370
|
+
interface SqliteStatement {
|
|
1371
|
+
run(...params: SqliteValue[]): SqliteRunResult;
|
|
1372
|
+
all<T = Record<string, unknown>>(...params: SqliteValue[]): T[];
|
|
1373
|
+
get<T = Record<string, unknown>>(...params: SqliteValue[]): T | undefined;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
1377
|
+
*
|
|
1378
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
1379
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
1380
|
+
*/
|
|
1381
|
+
interface SqliteClient {
|
|
1382
|
+
exec(sql: string): void;
|
|
1383
|
+
prepare(sql: string): SqliteStatement;
|
|
1384
|
+
transaction<T>(fn: () => T): T;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/** Options every provider constructor accepts. */
|
|
1388
|
+
type APIOptions = {
|
|
1389
|
+
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
1390
|
+
sqlite?: SqliteClient;
|
|
1391
|
+
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
1392
|
+
now?: () => number;
|
|
1393
|
+
/**
|
|
1394
|
+
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
1395
|
+
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
1396
|
+
*/
|
|
1397
|
+
namespace?: string;
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
interface AuthUser {
|
|
1401
|
+
login: string;
|
|
1402
|
+
id: number;
|
|
1403
|
+
scopes: string[];
|
|
1404
|
+
installation?: AuthInstallation;
|
|
1405
|
+
}
|
|
1406
|
+
interface AuthInstallation {
|
|
1407
|
+
installationId: number;
|
|
1408
|
+
appId: number;
|
|
1409
|
+
accountId: number;
|
|
1410
|
+
accountType: "User" | "Organization";
|
|
1411
|
+
permissions: Record<string, string>;
|
|
1412
|
+
repositoryIds: number[];
|
|
1413
|
+
repositorySelection: "all" | "selected";
|
|
1414
|
+
}
|
|
1415
|
+
interface AuthFallback {
|
|
1416
|
+
login: string;
|
|
1417
|
+
id: number;
|
|
1418
|
+
scopes: string[];
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/*! Adapted from vercel-labs/emulate (Apache-2.0), modified for Mockingbird. See port.json, LICENSE_EMULATE and THIRD_PARTY_NOTICES.md. */
|
|
1422
|
+
|
|
1423
|
+
interface SlackUserProfile {
|
|
1424
|
+
display_name: string;
|
|
1425
|
+
real_name: string;
|
|
1426
|
+
email: string;
|
|
1427
|
+
image_48: string;
|
|
1428
|
+
image_192: string;
|
|
1429
|
+
title?: string;
|
|
1430
|
+
phone?: string;
|
|
1431
|
+
skype?: string;
|
|
1432
|
+
real_name_normalized?: string;
|
|
1433
|
+
display_name_normalized?: string;
|
|
1434
|
+
fields?: Record<string, {
|
|
1435
|
+
value: string;
|
|
1436
|
+
alt?: string;
|
|
1437
|
+
label?: string;
|
|
1438
|
+
}>;
|
|
1439
|
+
status_text?: string;
|
|
1440
|
+
status_emoji?: string;
|
|
1441
|
+
status_emoji_display_info?: Record<string, unknown>[];
|
|
1442
|
+
status_expiration?: number;
|
|
1443
|
+
avatar_hash?: string;
|
|
1444
|
+
start_date?: string;
|
|
1445
|
+
pronouns?: string;
|
|
1446
|
+
huddle_state?: string;
|
|
1447
|
+
huddle_state_expiration_ts?: number;
|
|
1448
|
+
first_name?: string;
|
|
1449
|
+
last_name?: string;
|
|
1450
|
+
image_24?: string;
|
|
1451
|
+
image_32?: string;
|
|
1452
|
+
image_72?: string;
|
|
1453
|
+
image_512?: string;
|
|
1454
|
+
}
|
|
1455
|
+
type SlackPresence = "active" | "away";
|
|
1456
|
+
type SlackTokenType = "bot" | "user" | "test";
|
|
1457
|
+
|
|
1458
|
+
interface SlackSeedConfig {
|
|
1459
|
+
port?: number;
|
|
1460
|
+
team?: {
|
|
1461
|
+
name?: string;
|
|
1462
|
+
domain?: string;
|
|
1463
|
+
};
|
|
1464
|
+
users?: Array<{
|
|
1465
|
+
name: string;
|
|
1466
|
+
real_name?: string;
|
|
1467
|
+
email?: string;
|
|
1468
|
+
is_admin?: boolean;
|
|
1469
|
+
profile?: Partial<SlackUserProfile>;
|
|
1470
|
+
presence?: SlackPresence;
|
|
1471
|
+
}>;
|
|
1472
|
+
channels?: Array<{
|
|
1473
|
+
name: string;
|
|
1474
|
+
topic?: string;
|
|
1475
|
+
purpose?: string;
|
|
1476
|
+
is_private?: boolean;
|
|
1477
|
+
}>;
|
|
1478
|
+
bots?: Array<{
|
|
1479
|
+
name: string;
|
|
1480
|
+
}>;
|
|
1481
|
+
oauth_apps?: Array<{
|
|
1482
|
+
app_id?: string;
|
|
1483
|
+
client_id: string;
|
|
1484
|
+
client_secret: string;
|
|
1485
|
+
name: string;
|
|
1486
|
+
redirect_uris: string[];
|
|
1487
|
+
scopes?: string[] | string;
|
|
1488
|
+
user_scopes?: string[] | string;
|
|
1489
|
+
bot_id?: string;
|
|
1490
|
+
bot_user_id?: string;
|
|
1491
|
+
bot_name?: string;
|
|
1492
|
+
}>;
|
|
1493
|
+
tokens?: Array<{
|
|
1494
|
+
token: string;
|
|
1495
|
+
type?: SlackTokenType;
|
|
1496
|
+
user?: string;
|
|
1497
|
+
user_id?: string;
|
|
1498
|
+
scopes?: string[] | string;
|
|
1499
|
+
app_id?: string;
|
|
1500
|
+
client_id?: string;
|
|
1501
|
+
team_id?: string;
|
|
1502
|
+
bot_id?: string;
|
|
1503
|
+
bot_user_id?: string;
|
|
1504
|
+
authed_user_id?: string;
|
|
1505
|
+
}>;
|
|
1506
|
+
incoming_webhooks?: Array<{
|
|
1507
|
+
channel: string;
|
|
1508
|
+
label?: string;
|
|
1509
|
+
}>;
|
|
1510
|
+
strict_scopes?: boolean;
|
|
1511
|
+
signing_secret?: string;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
type ProviderOptions = APIOptions & {
|
|
1515
|
+
baseUrl?: string;
|
|
1516
|
+
tokens?: Record<string, AuthUser>;
|
|
1517
|
+
fallbackUser?: AuthFallback;
|
|
1518
|
+
publicNamespace?: string;
|
|
1519
|
+
adminPrefix?: string;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1325
1522
|
/**
|
|
1326
1523
|
* One message the app "sent": an incoming-webhook post or a Web API post. The outbox is the
|
|
1327
1524
|
* point of this mock, so it keeps the text and blocks (the request journal never does).
|
|
@@ -1439,7 +1636,7 @@ declare class SlackState {
|
|
|
1439
1636
|
readonly settings: Collection<Settings>;
|
|
1440
1637
|
/** Only its sequence is used: the microsecond part of every `ts`. */
|
|
1441
1638
|
private readonly tsCounter;
|
|
1442
|
-
constructor(sqlite: SqliteClient, namespace: string, seed: {
|
|
1639
|
+
constructor(sqlite: SqliteClient$1, namespace: string, seed: {
|
|
1443
1640
|
settings: Partial<Settings>;
|
|
1444
1641
|
});
|
|
1445
1642
|
/** Re-apply the default workspace after a reset. */
|
|
@@ -1455,7 +1652,8 @@ declare class SlackState {
|
|
|
1455
1652
|
findMessage(channel: string, ts: string): SlackMessage | undefined;
|
|
1456
1653
|
}
|
|
1457
1654
|
|
|
1458
|
-
type SlackAPIOptions = APIOptions & {
|
|
1655
|
+
type SlackAPIOptions = APIOptions$1 & Pick<ProviderOptions, "tokens" | "baseUrl" | "publicNamespace" | "adminPrefix"> & {
|
|
1656
|
+
fixtures?: SlackSeedConfig;
|
|
1459
1657
|
/** Initial per-namespace settings (workspace identity, accepted tokens, strict channels). */
|
|
1460
1658
|
settings?: Partial<Settings>;
|
|
1461
1659
|
/**
|
|
@@ -1472,13 +1670,16 @@ type SlackAPIOptions = APIOptions & {
|
|
|
1472
1670
|
*/
|
|
1473
1671
|
declare class SlackAPI implements FetchAPI {
|
|
1474
1672
|
readonly app: Hono;
|
|
1475
|
-
readonly sqlite: SqliteClient;
|
|
1673
|
+
readonly sqlite: SqliteClient$1;
|
|
1476
1674
|
readonly state: SlackState;
|
|
1675
|
+
private tail;
|
|
1676
|
+
private readonly expansion;
|
|
1477
1677
|
private readonly service;
|
|
1478
1678
|
private readonly now;
|
|
1479
1679
|
private readonly namespaceName;
|
|
1480
1680
|
constructor(options?: SlackAPIOptions);
|
|
1481
1681
|
fetch(request: Request): Promise<Response>;
|
|
1682
|
+
private handleFetch;
|
|
1482
1683
|
reset(): Promise<void>;
|
|
1483
1684
|
/** Every message in the outbox, oldest first. */
|
|
1484
1685
|
messages(): SlackMessage[];
|
|
@@ -1520,8 +1721,8 @@ declare class SlackAPI implements FetchAPI {
|
|
|
1520
1721
|
private openView;
|
|
1521
1722
|
}
|
|
1522
1723
|
|
|
1523
|
-
type SlackRuntimeOptions = {
|
|
1524
|
-
sqlite?: SqliteClient;
|
|
1724
|
+
type SlackRuntimeOptions = Pick<SlackAPIOptions, "fixtures" | "baseUrl" | "tokens"> & {
|
|
1725
|
+
sqlite?: SqliteClient$1;
|
|
1525
1726
|
clock?: Clock;
|
|
1526
1727
|
seed?: number | string;
|
|
1527
1728
|
adminPrefix?: string;
|
package/dist/server.js
CHANGED