@crvouga/mockingbird-service-twilio 3.0.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 +16 -4
- package/DISCOVERY.md +2 -2
- package/LICENSE_EMULATE +202 -0
- package/README.md +14 -14
- package/SUPPORT.md +72 -3
- package/THIRD_PARTY_NOTICES.md +39 -0
- package/dist/{chunk-OINOWAF7.js → chunk-JGQUWBT2.js} +61 -7
- package/dist/chunk-JGQUWBT2.js.map +7 -0
- package/dist/chunk-M73LWCCP.js +67 -0
- package/dist/chunk-M73LWCCP.js.map +7 -0
- package/dist/{chunk-64B2VD5D.js → chunk-SOEDG3O2.js} +6837 -3224
- package/dist/chunk-SOEDG3O2.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 +193 -59
- package/dist/index.js +2 -1
- package/dist/server.d.ts +272 -120
- package/dist/server.js +3 -2
- package/openapi.yaml +3604 -863
- package/package.json +16 -7
- package/routes.json +58 -0
- package/dist/chunk-64B2VD5D.js.map +0 -7
- package/dist/chunk-OINOWAF7.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,121 @@ 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
|
+
interface TwilioSeedConfig {
|
|
1422
|
+
port?: number;
|
|
1423
|
+
account?: {
|
|
1424
|
+
sid?: string;
|
|
1425
|
+
auth_token?: string;
|
|
1426
|
+
friendly_name?: string;
|
|
1427
|
+
status?: "active" | "suspended" | "closed";
|
|
1428
|
+
};
|
|
1429
|
+
api_keys?: Array<{
|
|
1430
|
+
sid?: string;
|
|
1431
|
+
secret: string;
|
|
1432
|
+
friendly_name?: string;
|
|
1433
|
+
}>;
|
|
1434
|
+
phone_numbers?: Array<{
|
|
1435
|
+
sid?: string;
|
|
1436
|
+
phone_number: string;
|
|
1437
|
+
friendly_name?: string;
|
|
1438
|
+
sms_url?: string;
|
|
1439
|
+
sms_method?: string;
|
|
1440
|
+
voice_url?: string;
|
|
1441
|
+
voice_method?: string;
|
|
1442
|
+
status_callback?: string;
|
|
1443
|
+
}>;
|
|
1444
|
+
messaging_services?: Array<{
|
|
1445
|
+
sid?: string;
|
|
1446
|
+
friendly_name: string;
|
|
1447
|
+
phone_numbers?: string[];
|
|
1448
|
+
status_callback?: string;
|
|
1449
|
+
inbound_request_url?: string;
|
|
1450
|
+
}>;
|
|
1451
|
+
verify_services?: Array<{
|
|
1452
|
+
sid?: string;
|
|
1453
|
+
friendly_name: string;
|
|
1454
|
+
code?: string;
|
|
1455
|
+
default_channel?: string;
|
|
1456
|
+
}>;
|
|
1457
|
+
conversations?: {
|
|
1458
|
+
services?: Array<{
|
|
1459
|
+
sid?: string;
|
|
1460
|
+
friendly_name: string;
|
|
1461
|
+
}>;
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
type ProviderOptions = APIOptions & {
|
|
1466
|
+
baseUrl?: string;
|
|
1467
|
+
tokens?: Record<string, AuthUser>;
|
|
1468
|
+
fallbackUser?: AuthFallback;
|
|
1469
|
+
publicNamespace?: string;
|
|
1470
|
+
adminPrefix?: string;
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1325
1473
|
/**
|
|
1326
1474
|
* Lookup v2 number validation, modelled on what the live API answers (it is libphonenumber:
|
|
1327
1475
|
* the validation errors are libphonenumber's reasons). Verified live for fictional 555-01xx
|
|
@@ -1371,17 +1519,17 @@ type MessageRecord = {
|
|
|
1371
1519
|
to: string;
|
|
1372
1520
|
from: string | null;
|
|
1373
1521
|
messaging_service_sid: string | null;
|
|
1374
|
-
status: "queued" | "
|
|
1375
|
-
direction: "outbound-api";
|
|
1522
|
+
status: "accepted" | "scheduled" | "canceled" | "queued" | "sending" | "sent" | "failed" | "delivered" | "undelivered" | "receiving" | "received" | "read";
|
|
1523
|
+
direction: "inbound" | "outbound-api" | "outbound-call" | "outbound-reply";
|
|
1376
1524
|
num_segments: string;
|
|
1377
1525
|
num_media: string;
|
|
1378
|
-
price: null;
|
|
1526
|
+
price: string | null;
|
|
1379
1527
|
price_unit: "USD";
|
|
1380
|
-
error_code: null;
|
|
1381
|
-
error_message: null;
|
|
1528
|
+
error_code: number | null;
|
|
1529
|
+
error_message: string | null;
|
|
1382
1530
|
date_created: string;
|
|
1383
1531
|
date_updated: string;
|
|
1384
|
-
date_sent: null;
|
|
1532
|
+
date_sent: string | null;
|
|
1385
1533
|
uri: string;
|
|
1386
1534
|
subresource_uris: {
|
|
1387
1535
|
media: string;
|
|
@@ -1438,7 +1586,7 @@ declare class TwilioState {
|
|
|
1438
1586
|
readonly settings: Collection<VerifySettings>;
|
|
1439
1587
|
readonly outbox: OutboxStore<TwilioOutboxItem>;
|
|
1440
1588
|
private readonly ids;
|
|
1441
|
-
constructor(sqlite: SqliteClient, namespace: string, seed?: Partial<VerifySettings>);
|
|
1589
|
+
constructor(sqlite: SqliteClient$1, namespace: string, seed?: Partial<VerifySettings>);
|
|
1442
1590
|
/** A Twilio sid: two-letter prefix plus 32 hex characters, deterministic per history. */
|
|
1443
1591
|
sid(prefix: string): string;
|
|
1444
1592
|
/** A random-looking but reproducible 6-digit code for a new verification. */
|
|
@@ -1449,7 +1597,8 @@ declare class TwilioState {
|
|
|
1449
1597
|
verificationsTo(to: string, serviceSid?: string): VerificationRecord[];
|
|
1450
1598
|
}
|
|
1451
1599
|
|
|
1452
|
-
type TwilioAPIOptions = APIOptions & {
|
|
1600
|
+
type TwilioAPIOptions = APIOptions$1 & Pick<ProviderOptions, "tokens" | "baseUrl" | "publicNamespace" | "adminPrefix"> & {
|
|
1601
|
+
fixtures?: TwilioSeedConfig;
|
|
1453
1602
|
/** Initial Verify settings for the namespace (fixed code, expiry, attempt limits). */
|
|
1454
1603
|
verify?: Partial<VerifySettings>;
|
|
1455
1604
|
/**
|
|
@@ -1486,13 +1635,16 @@ type PutRecordingInput = {
|
|
|
1486
1635
|
*/
|
|
1487
1636
|
declare class TwilioAPI implements FetchAPI {
|
|
1488
1637
|
readonly app: Hono;
|
|
1489
|
-
readonly sqlite: SqliteClient;
|
|
1638
|
+
readonly sqlite: SqliteClient$1;
|
|
1490
1639
|
readonly state: TwilioState;
|
|
1640
|
+
private tail;
|
|
1641
|
+
private readonly expansion;
|
|
1491
1642
|
private readonly service;
|
|
1492
1643
|
private readonly now;
|
|
1493
1644
|
private readonly accounts;
|
|
1494
1645
|
constructor(options?: TwilioAPIOptions);
|
|
1495
1646
|
fetch(request: Request): Promise<Response>;
|
|
1647
|
+
private handleFetch;
|
|
1496
1648
|
reset(): Promise<void>;
|
|
1497
1649
|
private authenticate;
|
|
1498
1650
|
/** The account a request acts for: the path's, else the Basic username when it is one. */
|
|
@@ -1548,8 +1700,8 @@ type TwilioAppWebhooks = {
|
|
|
1548
1700
|
/** `MessagingServiceSid` of inbound SMS, when the number belongs to one. */
|
|
1549
1701
|
messagingServiceSid?: string;
|
|
1550
1702
|
};
|
|
1551
|
-
type TwilioRuntimeOptions = {
|
|
1552
|
-
sqlite?: SqliteClient;
|
|
1703
|
+
type TwilioRuntimeOptions = Pick<TwilioAPIOptions, "fixtures" | "baseUrl" | "tokens"> & {
|
|
1704
|
+
sqlite?: SqliteClient$1;
|
|
1553
1705
|
clock?: Clock;
|
|
1554
1706
|
seed?: number | string;
|
|
1555
1707
|
adminPrefix?: string;
|
package/dist/server.js
CHANGED