@crvouga/mockingbird-service-resend 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 +18 -18
- package/SUPPORT.md +21 -3
- package/THIRD_PARTY_NOTICES.md +39 -0
- package/dist/chunk-M73LWCCP.js +67 -0
- package/dist/chunk-M73LWCCP.js.map +7 -0
- package/dist/{chunk-SF5RM4JA.js → chunk-WMQIKI4U.js} +61 -7
- package/dist/chunk-WMQIKI4U.js.map +7 -0
- package/dist/{chunk-U5432PUK.js → chunk-XQ4BQDIK.js} +4509 -2297
- package/dist/chunk-XQ4BQDIK.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 +157 -52
- package/dist/index.js +2 -1
- package/dist/server.d.ts +238 -115
- package/dist/server.js +3 -2
- package/openapi.yaml +1728 -727
- package/package.json +16 -7
- package/routes.json +23 -0
- package/dist/chunk-SF5RM4JA.js.map +0 -7
- package/dist/chunk-U5432PUK.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/cli.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n/// <reference types=\"node\" />\nimport { runCli, serveCommand } from \"@crvouga/mockingbird-adapter-node\"\nimport { serveTarget } from \"./server.js\"\n\nconst code = await runCli(\n {\n bin: \"mockingbird-resend\",\n description: \"stateful Resend email API mock\",\n commands: { serve: serveCommand(serveTarget) },\n },\n process.argv.slice(2),\n)\nif (code !== 0) process.exitCode = code\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;AAKA,IAAM,OAAO,MAAM;AAAA,EACjB;AAAA,IACE,KAAK;AAAA,IACL,aAAa;AAAA,IACb,UAAU,EAAE,OAAO,aAAa,WAAW,EAAE;AAAA,EAC/C;AAAA,EACA,QAAQ,KAAK,MAAM,CAAC;AACtB;AACA,IAAI,SAAS,EAAG,SAAQ,WAAW;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createHash,
|
|
3
|
+
createHmac,
|
|
4
|
+
randomBytes,
|
|
5
|
+
randomUUID,
|
|
6
|
+
timingSafeEqual
|
|
7
|
+
} from "./chunk-M73LWCCP.js";
|
|
8
|
+
export {
|
|
9
|
+
createHash,
|
|
10
|
+
createHmac,
|
|
11
|
+
randomBytes,
|
|
12
|
+
randomUUID,
|
|
13
|
+
timingSafeEqual
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=crypto-I5AVO7Q3.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
randomUUID
|
|
3
|
+
} from "./chunk-M73LWCCP.js";
|
|
4
|
+
|
|
5
|
+
// ../../http/provider/dist/vendor/clerk/helpers.js
|
|
6
|
+
function generateClerkId(prefix) {
|
|
7
|
+
const compact = randomUUID().replace(/-/g, "");
|
|
8
|
+
return `${prefix}${compact.slice(0, 24)}`;
|
|
9
|
+
}
|
|
10
|
+
function nowUnix(clockNow = Date.now) {
|
|
11
|
+
return Math.floor(clockNow() / 1e3);
|
|
12
|
+
}
|
|
13
|
+
function createDefaultUser(clockNow = Date.now) {
|
|
14
|
+
const now = nowUnix(clockNow);
|
|
15
|
+
return {
|
|
16
|
+
clerk_id: generateClerkId("user_"),
|
|
17
|
+
username: null,
|
|
18
|
+
first_name: "Test",
|
|
19
|
+
last_name: "User",
|
|
20
|
+
image_url: null,
|
|
21
|
+
profile_image_url: null,
|
|
22
|
+
external_id: null,
|
|
23
|
+
primary_email_address_id: null,
|
|
24
|
+
primary_phone_number_id: null,
|
|
25
|
+
password_enabled: true,
|
|
26
|
+
password_hash: "test_password",
|
|
27
|
+
totp_enabled: false,
|
|
28
|
+
backup_code_enabled: false,
|
|
29
|
+
two_factor_enabled: false,
|
|
30
|
+
banned: false,
|
|
31
|
+
locked: false,
|
|
32
|
+
public_metadata: {},
|
|
33
|
+
private_metadata: {},
|
|
34
|
+
unsafe_metadata: {},
|
|
35
|
+
last_active_at: null,
|
|
36
|
+
last_sign_in_at: null,
|
|
37
|
+
created_at_unix: now,
|
|
38
|
+
updated_at_unix: now
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function createDefaultEmailAddress(userId, email, primary, clockNow = Date.now) {
|
|
42
|
+
const now = nowUnix(clockNow);
|
|
43
|
+
return {
|
|
44
|
+
email_id: generateClerkId("idn_"),
|
|
45
|
+
email_address: email,
|
|
46
|
+
user_id: userId,
|
|
47
|
+
verification_status: "verified",
|
|
48
|
+
verification_strategy: "email_code",
|
|
49
|
+
is_primary: primary,
|
|
50
|
+
reserved: false,
|
|
51
|
+
created_at_unix: now,
|
|
52
|
+
updated_at_unix: now
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function createDefaultOrganization(clockNow = Date.now) {
|
|
56
|
+
const now = nowUnix(clockNow);
|
|
57
|
+
return {
|
|
58
|
+
clerk_id: generateClerkId("org_"),
|
|
59
|
+
name: "My Company",
|
|
60
|
+
slug: "my-company",
|
|
61
|
+
image_url: null,
|
|
62
|
+
has_logo: false,
|
|
63
|
+
members_count: 0,
|
|
64
|
+
pending_invitations_count: 0,
|
|
65
|
+
public_metadata: {},
|
|
66
|
+
private_metadata: {},
|
|
67
|
+
max_allowed_memberships: null,
|
|
68
|
+
admin_delete_enabled: true,
|
|
69
|
+
created_at_unix: now,
|
|
70
|
+
updated_at_unix: now
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function userDisplayName(user) {
|
|
74
|
+
const combined = [user.first_name, user.last_name].filter(Boolean).join(" ");
|
|
75
|
+
return combined || user.username || "User";
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
createDefaultEmailAddress,
|
|
79
|
+
createDefaultOrganization,
|
|
80
|
+
createDefaultUser,
|
|
81
|
+
generateClerkId,
|
|
82
|
+
nowUnix,
|
|
83
|
+
userDisplayName
|
|
84
|
+
};
|
|
85
|
+
/*! Adapted from vercel-labs/emulate (Apache-2.0), modified for Mockingbird. See port.json, LICENSE_EMULATE and THIRD_PARTY_NOTICES.md. */
|
|
86
|
+
//# sourceMappingURL=helpers-BMHFVPFA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../http/provider/src/vendor/clerk/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["/*! Adapted from vercel-labs/emulate (Apache-2.0), modified for Mockingbird. See port.json, LICENSE_EMULATE and THIRD_PARTY_NOTICES.md. */\nimport { randomUUID } from \"../core/crypto.js\";\nimport type { ClerkUser, ClerkEmailAddress, ClerkOrganization } from \"./entities.js\";\n\nexport function generateClerkId(prefix: string): string {\n const compact = randomUUID().replace(/-/g, \"\");\n return `${prefix}${compact.slice(0, 24)}`;\n}\n\nexport function nowUnix(clockNow: () => number = Date.now): number {\n return Math.floor(clockNow() / 1000);\n}\n\nexport function createDefaultUser(clockNow: () => number = Date.now): Omit<ClerkUser, \"id\" | \"created_at\" | \"updated_at\"> {\n const now = nowUnix(clockNow);\n return {\n clerk_id: generateClerkId(\"user_\"),\n username: null,\n first_name: \"Test\",\n last_name: \"User\",\n image_url: null,\n profile_image_url: null,\n external_id: null,\n primary_email_address_id: null,\n primary_phone_number_id: null,\n password_enabled: true,\n password_hash: \"test_password\",\n totp_enabled: false,\n backup_code_enabled: false,\n two_factor_enabled: false,\n banned: false,\n locked: false,\n public_metadata: {},\n private_metadata: {},\n unsafe_metadata: {},\n last_active_at: null,\n last_sign_in_at: null,\n created_at_unix: now,\n updated_at_unix: now,\n };\n}\n\nexport function createDefaultEmailAddress(\n userId: string,\n email: string,\n primary: boolean, clockNow: () => number = Date.now,\n): Omit<ClerkEmailAddress, \"id\" | \"created_at\" | \"updated_at\"> {\n const now = nowUnix(clockNow);\n return {\n email_id: generateClerkId(\"idn_\"),\n email_address: email,\n user_id: userId,\n verification_status: \"verified\",\n verification_strategy: \"email_code\",\n is_primary: primary,\n reserved: false,\n created_at_unix: now,\n updated_at_unix: now,\n };\n}\n\nexport function createDefaultOrganization(clockNow: () => number = Date.now): Omit<ClerkOrganization, \"id\" | \"created_at\" | \"updated_at\"> {\n const now = nowUnix(clockNow);\n return {\n clerk_id: generateClerkId(\"org_\"),\n name: \"My Company\",\n slug: \"my-company\",\n image_url: null,\n has_logo: false,\n members_count: 0,\n pending_invitations_count: 0,\n public_metadata: {},\n private_metadata: {},\n max_allowed_memberships: null,\n admin_delete_enabled: true,\n created_at_unix: now,\n updated_at_unix: now,\n };\n}\n\nexport function userDisplayName(user: Pick<ClerkUser, \"first_name\" | \"last_name\" | \"username\">): string {\n const combined = [user.first_name, user.last_name].filter(Boolean).join(\" \");\n return combined || user.username || \"User\";\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAIM,SAAU,gBAAgB,QAAc;AAC5C,QAAM,UAAU,WAAU,EAAG,QAAQ,MAAM,EAAE;AAC7C,SAAO,GAAG,MAAM,GAAG,QAAQ,MAAM,GAAG,EAAE,CAAC;AACzC;AAEM,SAAU,QAAQ,WAAyB,KAAK,KAAG;AACvD,SAAO,KAAK,MAAM,SAAQ,IAAK,GAAI;AACrC;AAEM,SAAU,kBAAkB,WAAyB,KAAK,KAAG;AACjE,QAAM,MAAM,QAAQ,QAAQ;AAC5B,SAAO;IACL,UAAU,gBAAgB,OAAO;IACjC,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,mBAAmB;IACnB,aAAa;IACb,0BAA0B;IAC1B,yBAAyB;IACzB,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,QAAQ;IACR,QAAQ;IACR,iBAAiB,CAAA;IACjB,kBAAkB,CAAA;IAClB,iBAAiB,CAAA;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;;AAErB;AAEM,SAAU,0BACd,QACA,OACA,SAAkB,WAAyB,KAAK,KAAG;AAEnD,QAAM,MAAM,QAAQ,QAAQ;AAC5B,SAAO;IACL,UAAU,gBAAgB,MAAM;IAChC,eAAe;IACf,SAAS;IACT,qBAAqB;IACrB,uBAAuB;IACvB,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,iBAAiB;;AAErB;AAEM,SAAU,0BAA0B,WAAyB,KAAK,KAAG;AACzE,QAAM,MAAM,QAAQ,QAAQ;AAC5B,SAAO;IACL,UAAU,gBAAgB,MAAM;IAChC,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU;IACV,eAAe;IACf,2BAA2B;IAC3B,iBAAiB,CAAA;IACjB,kBAAkB,CAAA;IAClB,yBAAyB;IACzB,sBAAsB;IACtB,iBAAiB;IACjB,iBAAiB;;AAErB;AAEM,SAAU,gBAAgB,MAA8D;AAC5F,QAAM,WAAW,CAAC,KAAK,YAAY,KAAK,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAC3E,SAAO,YAAY,KAAK,YAAY;AACtC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ interface FetchAPI$1 {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
14
|
-
type SqliteValue$
|
|
14
|
+
type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
|
|
15
15
|
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
16
|
-
type SqliteRunResult$
|
|
16
|
+
type SqliteRunResult$2 = {
|
|
17
17
|
changes: number;
|
|
18
18
|
lastInsertRowid: number | bigint;
|
|
19
19
|
};
|
|
@@ -22,10 +22,10 @@ type SqliteRunResult$1 = {
|
|
|
22
22
|
*
|
|
23
23
|
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
24
24
|
*/
|
|
25
|
-
interface SqliteStatement$
|
|
26
|
-
run(...params: SqliteValue$
|
|
27
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$
|
|
28
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$
|
|
25
|
+
interface SqliteStatement$2 {
|
|
26
|
+
run(...params: SqliteValue$2[]): SqliteRunResult$2;
|
|
27
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
|
|
28
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Sync SQLite client port owned by Mockingbird.
|
|
@@ -33,54 +33,79 @@ interface SqliteStatement$1 {
|
|
|
33
33
|
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
34
34
|
* `bun:sqlite` instances all work when they expose this surface.
|
|
35
35
|
*/
|
|
36
|
-
interface SqliteClient$
|
|
36
|
+
interface SqliteClient$2 {
|
|
37
37
|
exec(sql: string): void;
|
|
38
|
-
prepare(sql: string): SqliteStatement$
|
|
38
|
+
prepare(sql: string): SqliteStatement$2;
|
|
39
39
|
transaction<T>(fn: () => T): T;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
/** Options every provider constructor accepts. */
|
|
43
|
+
type APIOptions$1 = {
|
|
44
|
+
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
45
|
+
sqlite?: SqliteClient$2;
|
|
46
|
+
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
47
|
+
now?: () => number;
|
|
48
|
+
/**
|
|
49
|
+
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
50
|
+
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
51
|
+
*/
|
|
52
|
+
namespace?: string;
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
|
|
55
|
+
interface AuthUser {
|
|
56
|
+
login: string;
|
|
57
|
+
id: number;
|
|
58
|
+
scopes: string[];
|
|
59
|
+
installation?: AuthInstallation;
|
|
60
|
+
}
|
|
61
|
+
interface AuthInstallation {
|
|
62
|
+
installationId: number;
|
|
63
|
+
appId: number;
|
|
64
|
+
accountId: number;
|
|
65
|
+
accountType: "User" | "Organization";
|
|
66
|
+
permissions: Record<string, string>;
|
|
67
|
+
repositoryIds: number[];
|
|
68
|
+
repositorySelection: "all" | "selected";
|
|
69
|
+
}
|
|
70
|
+
interface AuthFallback {
|
|
71
|
+
login: string;
|
|
72
|
+
id: number;
|
|
73
|
+
scopes: string[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface ResendSeedConfig {
|
|
77
|
+
port?: number;
|
|
78
|
+
domains?: Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
region?: string;
|
|
81
|
+
}>;
|
|
82
|
+
contacts?: Array<{
|
|
83
|
+
email: string;
|
|
84
|
+
first_name?: string;
|
|
85
|
+
last_name?: string;
|
|
86
|
+
audience?: string;
|
|
81
87
|
}>;
|
|
82
88
|
}
|
|
83
89
|
|
|
90
|
+
type ProviderOptions = APIOptions$1 & {
|
|
91
|
+
baseUrl?: string;
|
|
92
|
+
tokens?: Record<string, AuthUser>;
|
|
93
|
+
fallbackUser?: AuthFallback;
|
|
94
|
+
publicNamespace?: string;
|
|
95
|
+
adminPrefix?: string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type MountedAPI = FetchAPI & {
|
|
99
|
+
readonly prefix: string;
|
|
100
|
+
GET: FetchHandler;
|
|
101
|
+
POST: FetchHandler;
|
|
102
|
+
PUT: FetchHandler;
|
|
103
|
+
PATCH: FetchHandler;
|
|
104
|
+
DELETE: FetchHandler;
|
|
105
|
+
HEAD: FetchHandler;
|
|
106
|
+
OPTIONS: FetchHandler;
|
|
107
|
+
};
|
|
108
|
+
|
|
84
109
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
85
110
|
type CheckpointId = string;
|
|
86
111
|
/** An immutable node in a timeline's checkpoint DAG. */
|
|
@@ -170,6 +195,79 @@ declare class Timeline<T> {
|
|
|
170
195
|
interface FetchAPI {
|
|
171
196
|
fetch(request: Request): Promise<Response>;
|
|
172
197
|
}
|
|
198
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
199
|
+
type FetchHandler = (request: Request) => Promise<Response>;
|
|
200
|
+
|
|
201
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
202
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
203
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
204
|
+
type SqliteRunResult$1 = {
|
|
205
|
+
changes: number;
|
|
206
|
+
lastInsertRowid: number | bigint;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
210
|
+
*
|
|
211
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
212
|
+
*/
|
|
213
|
+
interface SqliteStatement$1 {
|
|
214
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
215
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
216
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
220
|
+
*
|
|
221
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
222
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
223
|
+
*/
|
|
224
|
+
interface SqliteClient$1 {
|
|
225
|
+
exec(sql: string): void;
|
|
226
|
+
prepare(sql: string): SqliteStatement$1;
|
|
227
|
+
transaction<T>(fn: () => T): T;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
231
|
+
type Stored<T> = {
|
|
232
|
+
seq: number;
|
|
233
|
+
value: T;
|
|
234
|
+
};
|
|
235
|
+
type ListRecordsOptions<T> = {
|
|
236
|
+
/** Keep only records passing the predicate. */
|
|
237
|
+
where?: (value: T, seq: number) => boolean;
|
|
238
|
+
/** Sort order; default newest first. */
|
|
239
|
+
order?: "newest" | "oldest";
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
243
|
+
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
244
|
+
*/
|
|
245
|
+
declare class Collection<T> {
|
|
246
|
+
private readonly sqlite;
|
|
247
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
248
|
+
readonly namespace: string;
|
|
249
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
250
|
+
readonly collectionName: string;
|
|
251
|
+
constructor(sqlite: SqliteClient$1,
|
|
252
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
253
|
+
namespace: string,
|
|
254
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
255
|
+
collectionName: string);
|
|
256
|
+
private bumpCollectionSeq;
|
|
257
|
+
nextSequence(): number;
|
|
258
|
+
get(id: string): T | undefined;
|
|
259
|
+
has(id: string): boolean;
|
|
260
|
+
/** Insert a new record, assigning it the next sequence number. */
|
|
261
|
+
insert(id: string, value: T): Stored<T>;
|
|
262
|
+
/** Replace an existing record's value, keeping its position. */
|
|
263
|
+
update(id: string, value: T): Stored<T> | undefined;
|
|
264
|
+
delete(id: string): boolean;
|
|
265
|
+
/** How many records the collection holds, without reading them. */
|
|
266
|
+
count(): number;
|
|
267
|
+
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
268
|
+
id: string;
|
|
269
|
+
}>;
|
|
270
|
+
}
|
|
173
271
|
|
|
174
272
|
/** Options every provider constructor accepts. */
|
|
175
273
|
type APIOptions = {
|
|
@@ -630,6 +728,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
630
728
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
631
729
|
stop?(): void;
|
|
632
730
|
readonly name: string;
|
|
731
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
732
|
+
mount(prefix: string): MountedAPI;
|
|
633
733
|
readonly sqlite: SqliteClient$1;
|
|
634
734
|
readonly clock: Clock;
|
|
635
735
|
readonly faults: FaultRegistry;
|
|
@@ -763,6 +863,7 @@ type SentEmail = {
|
|
|
763
863
|
idempotencyKey: string | null;
|
|
764
864
|
scheduledAt: string | null;
|
|
765
865
|
createdAt: string;
|
|
866
|
+
lastEvent?: string;
|
|
766
867
|
};
|
|
767
868
|
type ReceivedAttachmentRecord = {
|
|
768
869
|
id: string;
|
|
@@ -970,10 +1071,10 @@ type OpenAPIDocument = {
|
|
|
970
1071
|
};
|
|
971
1072
|
|
|
972
1073
|
declare const document: OpenAPIDocument;
|
|
973
|
-
type OperationId = "ListEmails" | "SendEmail" | "GetEmail" | "ListReceivedEmails" | "GetReceivedEmail" | "ListReceivedEmailAttachments" | "DownloadReceivedAttachment";
|
|
974
|
-
type SupportedOperationId = "ListEmails" | "SendEmail" | "GetEmail" | "ListReceivedEmails" | "GetReceivedEmail" | "ListReceivedEmailAttachments" | "DownloadReceivedAttachment";
|
|
975
|
-
declare const operationIds: readonly ["ListEmails", "SendEmail", "GetEmail", "ListReceivedEmails", "GetReceivedEmail", "ListReceivedEmailAttachments", "DownloadReceivedAttachment"];
|
|
976
|
-
declare const supportedOperationIds: readonly ["ListEmails", "SendEmail", "GetEmail", "ListReceivedEmails", "GetReceivedEmail", "ListReceivedEmailAttachments", "DownloadReceivedAttachment"];
|
|
1074
|
+
type OperationId = "ListEmails" | "SendEmail" | "GetEmail" | "ListReceivedEmails" | "GetReceivedEmail" | "ListReceivedEmailAttachments" | "DownloadReceivedAttachment" | "DELETE /api-keys/:id" | "DELETE /audiences/:audience_id/contacts/:id" | "DELETE /audiences/:id" | "GET /domains/:id" | "DELETE /domains/:id" | "GET /api-keys" | "POST /api-keys" | "GET /audiences" | "POST /audiences" | "GET /audiences/:audience_id/contacts" | "POST /audiences/:audience_id/contacts" | "GET /domains" | "POST /domains" | "GET /inbox" | "GET /inbox/:id" | "POST /domains/:id/verify" | "POST /emails/:id/cancel" | "POST /emails/batch";
|
|
1075
|
+
type SupportedOperationId = "ListEmails" | "SendEmail" | "GetEmail" | "ListReceivedEmails" | "GetReceivedEmail" | "ListReceivedEmailAttachments" | "DownloadReceivedAttachment" | "DELETE /api-keys/:id" | "DELETE /audiences/:audience_id/contacts/:id" | "DELETE /audiences/:id" | "GET /domains/:id" | "DELETE /domains/:id" | "GET /api-keys" | "POST /api-keys" | "GET /audiences" | "POST /audiences" | "GET /audiences/:audience_id/contacts" | "POST /audiences/:audience_id/contacts" | "GET /domains" | "POST /domains" | "GET /inbox" | "GET /inbox/:id" | "POST /domains/:id/verify" | "POST /emails/:id/cancel" | "POST /emails/batch";
|
|
1076
|
+
declare const operationIds: readonly ["ListEmails", "SendEmail", "GetEmail", "ListReceivedEmails", "GetReceivedEmail", "ListReceivedEmailAttachments", "DownloadReceivedAttachment", "DELETE /api-keys/:id", "DELETE /audiences/:audience_id/contacts/:id", "DELETE /audiences/:id", "GET /domains/:id", "DELETE /domains/:id", "GET /api-keys", "POST /api-keys", "GET /audiences", "POST /audiences", "GET /audiences/:audience_id/contacts", "POST /audiences/:audience_id/contacts", "GET /domains", "POST /domains", "GET /inbox", "GET /inbox/:id", "POST /domains/:id/verify", "POST /emails/:id/cancel", "POST /emails/batch"];
|
|
1077
|
+
declare const supportedOperationIds: readonly ["ListEmails", "SendEmail", "GetEmail", "ListReceivedEmails", "GetReceivedEmail", "ListReceivedEmailAttachments", "DownloadReceivedAttachment", "DELETE /api-keys/:id", "DELETE /audiences/:audience_id/contacts/:id", "DELETE /audiences/:id", "GET /domains/:id", "DELETE /domains/:id", "GET /api-keys", "POST /api-keys", "GET /audiences", "POST /audiences", "GET /audiences/:audience_id/contacts", "POST /audiences/:audience_id/contacts", "GET /domains", "POST /domains", "GET /inbox", "GET /inbox/:id", "POST /domains/:id/verify", "POST /emails/:id/cancel", "POST /emails/batch"];
|
|
977
1078
|
|
|
978
1079
|
/**
|
|
979
1080
|
* Every named Resend misbehaviour our consumer branches on, switched on with
|
|
@@ -1003,7 +1104,7 @@ type ForwardStats = {
|
|
|
1003
1104
|
* reads codes and links through the Mailosaur SDK. Resolves `true` when the inbox took it.
|
|
1004
1105
|
*/
|
|
1005
1106
|
declare const forwardToInbox: (target: ForwardTarget, email: SentEmail, namespace: string) => Promise<boolean>;
|
|
1006
|
-
type ResendRuntimeOptions = {
|
|
1107
|
+
type ResendRuntimeOptions = Pick<ResendAPIOptions, "fixtures" | "baseUrl" | "tokens"> & {
|
|
1007
1108
|
sqlite?: SqliteClient;
|
|
1008
1109
|
clock?: Clock;
|
|
1009
1110
|
seed?: number | string;
|
|
@@ -1101,7 +1202,8 @@ type SendOutcomeEvent = {
|
|
|
1101
1202
|
namespace: string;
|
|
1102
1203
|
emailId?: string;
|
|
1103
1204
|
};
|
|
1104
|
-
type ResendAPIOptions = APIOptions & {
|
|
1205
|
+
type ResendAPIOptions = APIOptions & Pick<ProviderOptions, "tokens" | "baseUrl" | "publicNamespace" | "adminPrefix"> & {
|
|
1206
|
+
fixtures?: ResendSeedConfig;
|
|
1105
1207
|
/** The public namespace name, for `/__admin/ns/<name>` download URLs. Default: the default namespace. */
|
|
1106
1208
|
adminPrefix?: string;
|
|
1107
1209
|
publicNamespace?: string;
|
|
@@ -1121,6 +1223,8 @@ declare class ResendAPI implements FetchAPI$1 {
|
|
|
1121
1223
|
readonly app: Hono;
|
|
1122
1224
|
readonly sqlite: SqliteClient;
|
|
1123
1225
|
readonly state: ResendState;
|
|
1226
|
+
private tail;
|
|
1227
|
+
private readonly expansion;
|
|
1124
1228
|
private readonly service;
|
|
1125
1229
|
private readonly now;
|
|
1126
1230
|
private readonly adminPrefix;
|
|
@@ -1131,6 +1235,7 @@ declare class ResendAPI implements FetchAPI$1 {
|
|
|
1131
1235
|
private readonly outcomeCounts;
|
|
1132
1236
|
constructor(options?: ResendAPIOptions);
|
|
1133
1237
|
fetch(request: Request): Promise<Response>;
|
|
1238
|
+
private handleFetch;
|
|
1134
1239
|
reset(): Promise<void>;
|
|
1135
1240
|
/** Accepted sends whose response was lost, those lost responses, and idempotent replays. */
|
|
1136
1241
|
sendOutcomes(): Record<SendOutcome, number>;
|