@midsummer-ai/sdk 0.1.0-staging.4639 → 0.1.0-staging.4718
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/auth/export.d.mts +91 -0
- package/auth/export.mjs +147 -0
- package/auth/impersonate.d.mts +1 -1
- package/auth/impersonate.mjs +3 -2
- package/auth/import.d.mts +28 -21
- package/auth/import.mjs +196 -27
- package/auth/index.d.mts +1 -1
- package/calls/contract.d.mts +1 -1
- package/calls/index.d.mts +1 -1
- package/calls/index.mjs +4 -2
- package/calls/protocol.d.mts +1 -1
- package/calls/react.d.mts +1 -1
- package/calls/stand-in.d.mts +1 -1
- package/here-C2jhTheQ.mjs +1 -1
- package/{impersonate-C7SoVmew.d.mts → impersonate-BI_aYw9e.d.mts} +3 -1
- package/package.json +8 -1
- package/{protocol-Bh5GrnpV.d.mts → protocol-eCEy2GzD.d.mts} +2 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//#region src/auth/export.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An app's users as they leave: the file `midsummer auth export` writes, which `midsummer auth import --from midsummer`
|
|
4
|
+
* takes back unchanged, and the same users in the form Clerk's, Auth0's and Supabase's importers take.
|
|
5
|
+
*
|
|
6
|
+
* The file is JSON Lines: a first line that tells what the file is, then one user a line (`ExportedUser`), as the
|
|
7
|
+
* platform's `auth.user.export` gives them a page at a time. A user's password comes as the hash sign-in keeps it:
|
|
8
|
+
* - `scrypt`: sign-in's own, `<salt>:<key>` in hex, scrypt with N 16384, r 16, p 1 and a 64-byte key, where the salt is
|
|
9
|
+
* the 32 hex characters before the colon taken as text, not as bytes;
|
|
10
|
+
* - `bcrypt`: one an import brought, kept until that person signs in again.
|
|
11
|
+
* Passkeys, two-factor and sessions don't move: a passkey belongs to the app's address, two-factor's secret is sealed
|
|
12
|
+
* under the app's own secret, and a session is a browser's. `midsummer auth export` tells how many users had each.
|
|
13
|
+
*
|
|
14
|
+
* const lines = exportLines(header, users) // the file auth export writes
|
|
15
|
+
* const clerk = asService("clerk", users) // a JSON array of Clerk's create-user bodies
|
|
16
|
+
*/
|
|
17
|
+
/** One user as it leaves: what their sign-in keeps of them, never a session, a token or a secret but their password's hash. */
|
|
18
|
+
interface ExportedUser {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly email: string;
|
|
21
|
+
readonly emailVerified: boolean;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly image: string | null;
|
|
24
|
+
/** When they signed up and last changed, in milliseconds since 1970. */
|
|
25
|
+
readonly createdAt: number;
|
|
26
|
+
readonly updatedAt: number;
|
|
27
|
+
readonly role: string | null;
|
|
28
|
+
readonly banned: boolean;
|
|
29
|
+
readonly banReason: string | null;
|
|
30
|
+
readonly banExpires: number | null;
|
|
31
|
+
readonly publicMetadata: unknown;
|
|
32
|
+
readonly privateMetadata: unknown;
|
|
33
|
+
/** Their password's hash as sign-in keeps it; null for one with no password, or when the export leaves passwords out. */
|
|
34
|
+
readonly password: string | null;
|
|
35
|
+
/** How `password` was made: `scrypt`, sign-in's own, or `bcrypt`, as an import brought it. */
|
|
36
|
+
readonly passwordScheme: "scrypt" | "bcrypt" | null;
|
|
37
|
+
/** The other services they sign in with, such as Google, by that service's own id for them; never a token. */
|
|
38
|
+
readonly accounts: ReadonlyArray<{
|
|
39
|
+
readonly provider: string;
|
|
40
|
+
readonly accountId: string | null;
|
|
41
|
+
}>;
|
|
42
|
+
/** The organizations they are in, by slug, with their role there. */
|
|
43
|
+
readonly organizations: ReadonlyArray<{
|
|
44
|
+
readonly slug: string;
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly role: string;
|
|
47
|
+
}>;
|
|
48
|
+
/** Whether they had two-factor on: it doesn't move, so they turn it on again. */
|
|
49
|
+
readonly twoFactor: boolean;
|
|
50
|
+
/** How many passkeys they had: none move, so they add one again. */
|
|
51
|
+
readonly passkeys: number;
|
|
52
|
+
}
|
|
53
|
+
/** What doesn't move with an export, in the words the file, the CLI and the docs say it. */
|
|
54
|
+
declare const CANNOT_MOVE: ReadonlyArray<string>;
|
|
55
|
+
/** The first line of an export: what the file is, so `auth import --from midsummer` knows it. */
|
|
56
|
+
interface ExportHeader {
|
|
57
|
+
readonly export: "midsummer-auth";
|
|
58
|
+
readonly version: 1;
|
|
59
|
+
readonly database: string;
|
|
60
|
+
readonly exportedAt: string;
|
|
61
|
+
readonly passwords: "included" | "left out";
|
|
62
|
+
readonly cannotMove: ReadonlyArray<string>;
|
|
63
|
+
}
|
|
64
|
+
/** The first line of an export of `database`, made at `now`. */
|
|
65
|
+
declare const exportHeader: (database: string, now: number, passwords: boolean) => ExportHeader;
|
|
66
|
+
/** An export file's lines: its header, then a user a line. Each ends with a newline, so pages are written one after another. */
|
|
67
|
+
declare const exportLines: (users: ReadonlyArray<ExportedUser>, header?: ExportHeader) => string;
|
|
68
|
+
/** Whether a header line is an export's, so a file of another kind is said to be one. */
|
|
69
|
+
declare const isExportHeader: (value: unknown) => value is ExportHeader;
|
|
70
|
+
/** Sign-in's own scrypt hash, `<salt>:<key>` in hex, as `@midsummer-ai/sdk/auth/password` makes it. */
|
|
71
|
+
declare const isOwnScrypt: (hash: string) => boolean;
|
|
72
|
+
/** The services an export can be written for, besides Midsummer's own file. */
|
|
73
|
+
type ExportTarget = "clerk" | "auth0" | "supabase";
|
|
74
|
+
declare const EXPORT_TARGETS: ReadonlyArray<ExportTarget>;
|
|
75
|
+
/** Sign-in's scrypt in Werkzeug's form, `scrypt:N:r:p$salt$key`, as Clerk takes it (`scrypt_werkzeug`). */
|
|
76
|
+
declare const werkzeugOf: (hash: string) => string;
|
|
77
|
+
/** A Werkzeug scrypt with sign-in's own parameters, back in sign-in's form; undefined for any other. */
|
|
78
|
+
declare function fromWerkzeug(digest: string): string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The users as `to`'s importer takes them, and how many kept their password there: a password moves where the service
|
|
81
|
+
* takes its hash's scheme, and anyone else signs in there with a reset, a code or a link.
|
|
82
|
+
* - clerk: a JSON array, each one the body of a create-user call to Clerk's Backend API (`POST /v1/users`);
|
|
83
|
+
* - auth0: a JSON array, the file a bulk user import takes, passwords under `custom_password_hash`;
|
|
84
|
+
* - supabase: `auth.users` as CSV with a header, for `\copy auth.users(...) from 'users.csv' csv header`: bcrypt only.
|
|
85
|
+
*/
|
|
86
|
+
declare function asService(to: ExportTarget, users: ReadonlyArray<ExportedUser>): {
|
|
87
|
+
readonly document: string;
|
|
88
|
+
readonly passwords: number;
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { CANNOT_MOVE, EXPORT_TARGETS, ExportHeader, ExportTarget, ExportedUser, asService, exportHeader, exportLines, fromWerkzeug, isExportHeader, isOwnScrypt, werkzeugOf };
|
package/auth/export.mjs
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
//#region src/auth/export.ts
|
|
2
|
+
/** What doesn't move with an export, in the words the file, the CLI and the docs say it. */
|
|
3
|
+
const CANNOT_MOVE = [
|
|
4
|
+
"Passkeys: a passkey works only at the address it was made for, so each user adds one again after the move.",
|
|
5
|
+
"Two-factor: its secret is sealed under this app's own secret, so each user who had it turns it on again.",
|
|
6
|
+
"Sessions: everyone signs in again where the users go."
|
|
7
|
+
];
|
|
8
|
+
/** The first line of an export of `database`, made at `now`. */
|
|
9
|
+
const exportHeader = (database, now, passwords) => ({
|
|
10
|
+
export: "midsummer-auth",
|
|
11
|
+
version: 1,
|
|
12
|
+
database,
|
|
13
|
+
exportedAt: new Date(now).toISOString(),
|
|
14
|
+
passwords: passwords ? "included" : "left out",
|
|
15
|
+
cannotMove: CANNOT_MOVE
|
|
16
|
+
});
|
|
17
|
+
/** An export file's lines: its header, then a user a line. Each ends with a newline, so pages are written one after another. */
|
|
18
|
+
const exportLines = (users, header) => [...header ? [header] : [], ...users].map((one) => `${JSON.stringify(one)}\n`).join("");
|
|
19
|
+
/** Whether a header line is an export's, so a file of another kind is said to be one. */
|
|
20
|
+
const isExportHeader = (value) => typeof value === "object" && value !== null && value.export === "midsummer-auth";
|
|
21
|
+
/** Sign-in's own scrypt hash, `<salt>:<key>` in hex, as `@midsummer-ai/sdk/auth/password` makes it. */
|
|
22
|
+
const isOwnScrypt = (hash) => /^[0-9a-f]{32}:[0-9a-f]{128}$/.test(hash);
|
|
23
|
+
const EXPORT_TARGETS = [
|
|
24
|
+
"clerk",
|
|
25
|
+
"auth0",
|
|
26
|
+
"supabase"
|
|
27
|
+
];
|
|
28
|
+
/** Sign-in's scrypt in Werkzeug's form, `scrypt:N:r:p$salt$key`, as Clerk takes it (`scrypt_werkzeug`). */
|
|
29
|
+
const werkzeugOf = (hash) => {
|
|
30
|
+
const [salt, key] = hash.split(":");
|
|
31
|
+
return `scrypt:16384:16:1$${salt}$${key}`;
|
|
32
|
+
};
|
|
33
|
+
/** A Werkzeug scrypt with sign-in's own parameters, back in sign-in's form; undefined for any other. */
|
|
34
|
+
function fromWerkzeug(digest) {
|
|
35
|
+
const found = /^scrypt:16384:16:1\$([0-9a-f]{32})\$([0-9a-f]{128})$/.exec(digest);
|
|
36
|
+
return found ? `${found[1]}:${found[2]}` : void 0;
|
|
37
|
+
}
|
|
38
|
+
const object = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
39
|
+
const csv = (value) => /[",\r\n]/.test(value) ? `"${value.replace(/"/g, "\"\"")}"` : value;
|
|
40
|
+
/**
|
|
41
|
+
* The users as `to`'s importer takes them, and how many kept their password there: a password moves where the service
|
|
42
|
+
* takes its hash's scheme, and anyone else signs in there with a reset, a code or a link.
|
|
43
|
+
* - clerk: a JSON array, each one the body of a create-user call to Clerk's Backend API (`POST /v1/users`);
|
|
44
|
+
* - auth0: a JSON array, the file a bulk user import takes, passwords under `custom_password_hash`;
|
|
45
|
+
* - supabase: `auth.users` as CSV with a header, for `\copy auth.users(...) from 'users.csv' csv header`: bcrypt only.
|
|
46
|
+
*/
|
|
47
|
+
function asService(to, users) {
|
|
48
|
+
let passwords = 0;
|
|
49
|
+
if (to === "clerk") {
|
|
50
|
+
const bodies = users.map((user) => {
|
|
51
|
+
const [first, ...rest] = user.name.trim().split(/\s+/);
|
|
52
|
+
const digest = user.passwordScheme === "bcrypt" ? {
|
|
53
|
+
password_digest: user.password,
|
|
54
|
+
password_hasher: "bcrypt"
|
|
55
|
+
} : user.passwordScheme === "scrypt" && user.password ? {
|
|
56
|
+
password_digest: werkzeugOf(user.password),
|
|
57
|
+
password_hasher: "scrypt_werkzeug"
|
|
58
|
+
} : void 0;
|
|
59
|
+
if (digest) passwords++;
|
|
60
|
+
return {
|
|
61
|
+
external_id: user.id,
|
|
62
|
+
email_address: [user.email],
|
|
63
|
+
...first ? { first_name: first } : {},
|
|
64
|
+
...rest.length ? { last_name: rest.join(" ") } : {},
|
|
65
|
+
...digest ?? {},
|
|
66
|
+
...object(user.publicMetadata) ? { public_metadata: user.publicMetadata } : {},
|
|
67
|
+
...object(user.privateMetadata) ? { private_metadata: user.privateMetadata } : {},
|
|
68
|
+
created_at: new Date(user.createdAt).toISOString()
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
document: `${JSON.stringify(bodies, null, 2)}\n`,
|
|
73
|
+
passwords
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (to === "auth0") {
|
|
77
|
+
const entries = users.map((user) => {
|
|
78
|
+
const [salt, key] = user.password?.split(":") ?? [];
|
|
79
|
+
const hash = user.passwordScheme === "bcrypt" ? {
|
|
80
|
+
algorithm: "bcrypt",
|
|
81
|
+
hash: { value: user.password }
|
|
82
|
+
} : user.passwordScheme === "scrypt" && salt && key ? {
|
|
83
|
+
algorithm: "scrypt",
|
|
84
|
+
hash: {
|
|
85
|
+
value: key,
|
|
86
|
+
encoding: "hex"
|
|
87
|
+
},
|
|
88
|
+
salt: {
|
|
89
|
+
value: salt,
|
|
90
|
+
encoding: "utf8"
|
|
91
|
+
},
|
|
92
|
+
keylen: 64,
|
|
93
|
+
cost: 16384,
|
|
94
|
+
blockSize: 16,
|
|
95
|
+
parallelization: 1
|
|
96
|
+
} : void 0;
|
|
97
|
+
if (hash) passwords++;
|
|
98
|
+
return {
|
|
99
|
+
user_id: user.id,
|
|
100
|
+
email: user.email,
|
|
101
|
+
email_verified: user.emailVerified,
|
|
102
|
+
name: user.name,
|
|
103
|
+
...user.image ? { picture: user.image } : {},
|
|
104
|
+
...object(user.publicMetadata) ? { user_metadata: user.publicMetadata } : {},
|
|
105
|
+
...object(user.privateMetadata) ? { app_metadata: user.privateMetadata } : {},
|
|
106
|
+
...hash ? { custom_password_hash: hash } : {}
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
document: `${JSON.stringify(entries, null, 2)}\n`,
|
|
111
|
+
passwords
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const header = [
|
|
115
|
+
"email",
|
|
116
|
+
"encrypted_password",
|
|
117
|
+
"email_confirmed_at",
|
|
118
|
+
"raw_user_meta_data",
|
|
119
|
+
"raw_app_meta_data",
|
|
120
|
+
"created_at",
|
|
121
|
+
"updated_at"
|
|
122
|
+
];
|
|
123
|
+
const rows = users.map((user) => {
|
|
124
|
+
const bcrypt = user.passwordScheme === "bcrypt" ? user.password ?? "" : "";
|
|
125
|
+
if (bcrypt) passwords++;
|
|
126
|
+
const meta = {
|
|
127
|
+
...object(user.publicMetadata) ?? {},
|
|
128
|
+
full_name: user.name,
|
|
129
|
+
...user.image ? { avatar_url: user.image } : {}
|
|
130
|
+
};
|
|
131
|
+
return [
|
|
132
|
+
user.email,
|
|
133
|
+
bcrypt,
|
|
134
|
+
user.emailVerified ? new Date(user.createdAt).toISOString() : "",
|
|
135
|
+
JSON.stringify(meta),
|
|
136
|
+
object(user.privateMetadata) ? JSON.stringify(user.privateMetadata) : "",
|
|
137
|
+
new Date(user.createdAt).toISOString(),
|
|
138
|
+
new Date(user.updatedAt).toISOString()
|
|
139
|
+
].map(csv).join(",");
|
|
140
|
+
});
|
|
141
|
+
return {
|
|
142
|
+
document: `${[header.join(","), ...rows].join("\n")}\n`,
|
|
143
|
+
passwords
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
export { CANNOT_MOVE, EXPORT_TARGETS, asService, exportHeader, exportLines, fromWerkzeug, isExportHeader, isOwnScrypt, werkzeugOf };
|
package/auth/impersonate.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as startImpersonation, n as IMPERSONATION_TOKEN_MS, r as impersonationIdentifier, t as IMPERSONATION_S } from "../impersonate-
|
|
1
|
+
import { i as startImpersonation, n as IMPERSONATION_TOKEN_MS, r as impersonationIdentifier, t as IMPERSONATION_S } from "../impersonate-BI_aYw9e.mjs";
|
|
2
2
|
export { IMPERSONATION_S, IMPERSONATION_TOKEN_MS, impersonationIdentifier, startImpersonation };
|
package/auth/impersonate.mjs
CHANGED
|
@@ -21,13 +21,14 @@ async function impersonationIdentifier(token) {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* A new "sign in as" for `userId`: the token's path to open, the row that lets it in once, and how long the session it
|
|
24
|
-
* makes lasts, in ms.
|
|
24
|
+
* makes lasts, in ms. `token` is the one to use, such as one made again for a retry; a random one when left out.
|
|
25
|
+
* Throws for a reason that isn't 1 to 200 characters.
|
|
25
26
|
*/
|
|
26
27
|
async function startImpersonation(input) {
|
|
27
28
|
const reason = input.reason.trim(), by = input.by.trim();
|
|
28
29
|
if (!reason || reason.length > 200) throw new Error("Say why you're signing in as them, in 1 to 200 characters.");
|
|
29
30
|
if (!by || by.length > 200) throw new Error("Name who is signing in as them, in 1 to 200 characters.");
|
|
30
|
-
const token = base64url(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
|
|
31
|
+
const token = input.token ?? base64url(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
|
|
31
32
|
return {
|
|
32
33
|
path: `/api/auth/impersonate?token=${token}`,
|
|
33
34
|
sessionMs: IMPERSONATION_S * 1e3,
|
package/auth/import.d.mts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
//#region src/auth/import.d.ts
|
|
2
|
-
|
|
3
|
-
* Users brought from another sign-in service: their exports read into one shape, and each user's rows made as
|
|
4
|
-
* `@midsummer-ai/sdk/auth` would make them, so they sign in with the password they had. A bcrypt hash is kept as it
|
|
5
|
-
* came; sign-in checks it and writes the password again in its own hash at that person's first sign-in.
|
|
6
|
-
*
|
|
7
|
-
* const users = parseExport("auth0", await Bun.file("users.json").text())
|
|
8
|
-
* const rows = users.users.map((user) => importRows(user, Date.now()))
|
|
9
|
-
*
|
|
10
|
-
* What each service's export looks like:
|
|
11
|
-
* - Clerk: the CSV the dashboard's export makes (`id`, `first_name`, `last_name`, `primary_email_address`,
|
|
12
|
-
* `verified_email_addresses`, `password_digest`, `password_hasher`, …).
|
|
13
|
-
* - Auth0: one JSON object a line, from a user export job (`email`, `email_verified`, `name`, `picture`,
|
|
14
|
-
* `created_at`, `user_metadata`, `app_metadata`) or the password hash export support sends (`passwordHash`).
|
|
15
|
-
* - Supabase: `auth.users` as CSV with a header (`\copy (select * from auth.users) to 'users.csv' csv header`) or
|
|
16
|
-
* as a JSON array: `email`, `encrypted_password`, `email_confirmed_at`, `raw_user_meta_data`,
|
|
17
|
-
* `raw_app_meta_data`, `created_at`.
|
|
18
|
-
* Nothing is written by parsing; a row that can't be read is listed in `skipped` with why.
|
|
19
|
-
*/
|
|
20
|
-
type ImportSource = "clerk" | "auth0" | "supabase";
|
|
2
|
+
type ImportSource = "clerk" | "auth0" | "supabase" | "midsummer";
|
|
21
3
|
declare const IMPORT_SOURCES: ReadonlyArray<ImportSource>;
|
|
22
4
|
/** One user from an export, in one shape whatever the service. */
|
|
23
5
|
interface ImportedUser {
|
|
@@ -26,10 +8,29 @@ interface ImportedUser {
|
|
|
26
8
|
readonly emailVerified: boolean;
|
|
27
9
|
readonly image?: string;
|
|
28
10
|
readonly createdAt?: number;
|
|
29
|
-
|
|
11
|
+
readonly updatedAt?: number;
|
|
12
|
+
/** A bcrypt hash, or sign-in's own scrypt as `auth export` writes it, when the export had one. */
|
|
30
13
|
readonly passwordHash?: string;
|
|
31
14
|
readonly publicMetadata?: unknown;
|
|
32
15
|
readonly privateMetadata?: unknown;
|
|
16
|
+
/** What only Midsummer's own export carries: the user's role and ban, the services they sign in with, their organizations. */
|
|
17
|
+
readonly role?: string;
|
|
18
|
+
readonly banned?: boolean;
|
|
19
|
+
readonly banReason?: string;
|
|
20
|
+
readonly banExpires?: number;
|
|
21
|
+
readonly accounts?: ReadonlyArray<ImportedAccount>;
|
|
22
|
+
readonly organizations?: ReadonlyArray<ImportedMembership>;
|
|
23
|
+
}
|
|
24
|
+
/** Another service a user signs in with, such as Google, by that service's id for them. */
|
|
25
|
+
interface ImportedAccount {
|
|
26
|
+
readonly providerId: string;
|
|
27
|
+
readonly accountId: string;
|
|
28
|
+
}
|
|
29
|
+
/** An organization a user is in, by slug, and their role there. */
|
|
30
|
+
interface ImportedMembership {
|
|
31
|
+
readonly slug: string;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly role: string;
|
|
33
34
|
}
|
|
34
35
|
/** A user's rows as the platform writes them: the user, and a password sign-in when there is a hash. */
|
|
35
36
|
interface ImportedUserRows {
|
|
@@ -42,6 +43,10 @@ interface ImportedUserRows {
|
|
|
42
43
|
readonly privateMetadata?: unknown;
|
|
43
44
|
readonly createdAt: number;
|
|
44
45
|
readonly updatedAt: number;
|
|
46
|
+
readonly role?: string;
|
|
47
|
+
readonly banned?: boolean;
|
|
48
|
+
readonly banReason?: string;
|
|
49
|
+
readonly banExpires?: number;
|
|
45
50
|
};
|
|
46
51
|
readonly account?: {
|
|
47
52
|
readonly providerId: "credential";
|
|
@@ -49,6 +54,8 @@ interface ImportedUserRows {
|
|
|
49
54
|
readonly createdAt: number;
|
|
50
55
|
readonly updatedAt: number;
|
|
51
56
|
};
|
|
57
|
+
readonly accounts?: ReadonlyArray<ImportedAccount>;
|
|
58
|
+
readonly organizations?: ReadonlyArray<ImportedMembership>;
|
|
52
59
|
}
|
|
53
60
|
/** A bcrypt hash, as Clerk, Auth0 and Supabase export them. */
|
|
54
61
|
declare const isBcrypt: (hash: string) => boolean;
|
|
@@ -68,4 +75,4 @@ declare function parseExport(from: ImportSource, document: string): {
|
|
|
68
75
|
/** One imported user's rows, as sign-in writes a user who signs up: made at `now`, unless the export has when they joined. */
|
|
69
76
|
declare function importRows(user: ImportedUser, now: number): ImportedUserRows;
|
|
70
77
|
//#endregion
|
|
71
|
-
export { IMPORT_SOURCES, ImportSource, ImportedUser, ImportedUserRows, csvRows, importRows, isBcrypt, parseExport };
|
|
78
|
+
export { IMPORT_SOURCES, ImportSource, ImportedAccount, ImportedMembership, ImportedUser, ImportedUserRows, csvRows, importRows, isBcrypt, parseExport };
|
package/auth/import.mjs
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
|
+
import { fromWerkzeug, isExportHeader, isOwnScrypt } from "./export.mjs";
|
|
1
2
|
//#region src/auth/import.ts
|
|
3
|
+
/**
|
|
4
|
+
* Users brought from another sign-in service: their exports read into one shape, and each user's rows made as
|
|
5
|
+
* `@midsummer-ai/sdk/auth` would make them, so they sign in with the password they had. A bcrypt hash is kept as it
|
|
6
|
+
* came; sign-in checks it and writes the password again in its own hash at that person's first sign-in.
|
|
7
|
+
*
|
|
8
|
+
* const users = parseExport("auth0", await Bun.file("users.json").text())
|
|
9
|
+
* const rows = users.users.map((user) => importRows(user, Date.now()))
|
|
10
|
+
*
|
|
11
|
+
* What each service's export looks like:
|
|
12
|
+
* - Clerk: the CSV the dashboard's export makes (`id`, `first_name`, `last_name`, `primary_email_address`,
|
|
13
|
+
* `verified_email_addresses`, `password_digest`, `password_hasher`, …).
|
|
14
|
+
* - Auth0: one JSON object a line, from a user export job (`email`, `email_verified`, `name`, `picture`,
|
|
15
|
+
* `created_at`, `user_metadata`, `app_metadata`) or the password hash export support sends (`passwordHash`).
|
|
16
|
+
* - Supabase: `auth.users` as CSV with a header (`\copy (select * from auth.users) to 'users.csv' csv header`) or
|
|
17
|
+
* as a JSON array: `email`, `encrypted_password`, `email_confirmed_at`, `raw_user_meta_data`,
|
|
18
|
+
* `raw_app_meta_data`, `created_at`.
|
|
19
|
+
* - Midsummer: the file `midsummer auth export` writes (`@midsummer-ai/sdk/auth/export`), JSON Lines, which comes
|
|
20
|
+
* back unchanged: each user with their password's hash, the services they sign in with and their organizations.
|
|
21
|
+
* Clerk's and Auth0's importer files that `auth export --as` writes are read too: a JSON array of Clerk's create-user
|
|
22
|
+
* bodies, and an Auth0 bulk import's JSON array, its passwords under `custom_password_hash`.
|
|
23
|
+
* Nothing is written by parsing; a row that can't be read is listed in `skipped` with why.
|
|
24
|
+
*/
|
|
2
25
|
const IMPORT_SOURCES = [
|
|
3
26
|
"clerk",
|
|
4
27
|
"auth0",
|
|
5
|
-
"supabase"
|
|
28
|
+
"supabase",
|
|
29
|
+
"midsummer"
|
|
6
30
|
];
|
|
7
31
|
/** A bcrypt hash, as Clerk, Auth0 and Supabase export them. */
|
|
8
32
|
const isBcrypt = (hash) => /^\$2[aby]\$\d{2}\$[./A-Za-z0-9]{53}$/.test(hash);
|
|
@@ -73,7 +97,7 @@ function userOf(given) {
|
|
|
73
97
|
emailVerified: given.emailVerified,
|
|
74
98
|
...image && /^https:\/\//.test(image) ? { image } : {},
|
|
75
99
|
...createdAt !== void 0 ? { createdAt } : {},
|
|
76
|
-
...hash && isBcrypt(hash) ? { passwordHash: hash } : {},
|
|
100
|
+
...hash && (isBcrypt(hash) || isOwnScrypt(hash)) ? { passwordHash: hash } : {},
|
|
77
101
|
...publicMetadata ? { publicMetadata } : {},
|
|
78
102
|
...privateMetadata ? { privateMetadata } : {}
|
|
79
103
|
};
|
|
@@ -99,7 +123,76 @@ function parseExport(from, document) {
|
|
|
99
123
|
users.push(made);
|
|
100
124
|
}
|
|
101
125
|
};
|
|
102
|
-
if (from === "
|
|
126
|
+
if (from === "midsummer") {
|
|
127
|
+
const lines = document.replace(/^\uFEFF/, "").split(/\r?\n/);
|
|
128
|
+
let header = false;
|
|
129
|
+
for (const [at, line] of lines.entries()) {
|
|
130
|
+
if (!line.trim()) continue;
|
|
131
|
+
let record;
|
|
132
|
+
try {
|
|
133
|
+
record = JSON.parse(line);
|
|
134
|
+
} catch {
|
|
135
|
+
skipped.push({
|
|
136
|
+
entry: `line ${at + 1}`,
|
|
137
|
+
why: "it isn't JSON"
|
|
138
|
+
});
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (isExportHeader(record)) {
|
|
142
|
+
header = true;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (!header) return {
|
|
146
|
+
users: [],
|
|
147
|
+
skipped: [{
|
|
148
|
+
entry: "the file",
|
|
149
|
+
why: "it isn't a file midsummer auth export wrote: its first line says what it is"
|
|
150
|
+
}]
|
|
151
|
+
};
|
|
152
|
+
const made = userOf({
|
|
153
|
+
email: record.email,
|
|
154
|
+
name: record.name,
|
|
155
|
+
emailVerified: record.emailVerified === true,
|
|
156
|
+
image: record.image,
|
|
157
|
+
createdAt: record.createdAt,
|
|
158
|
+
hash: record.password,
|
|
159
|
+
publicMetadata: record.publicMetadata,
|
|
160
|
+
privateMetadata: record.privateMetadata
|
|
161
|
+
});
|
|
162
|
+
take(text(record.id) ?? `line ${at + 1}`, typeof made === "string" ? made : {
|
|
163
|
+
...made,
|
|
164
|
+
...ownOf(record)
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
} else if (from === "clerk" && document.trimStart().startsWith("[")) {
|
|
168
|
+
let records;
|
|
169
|
+
try {
|
|
170
|
+
records = JSON.parse(document);
|
|
171
|
+
} catch {
|
|
172
|
+
return {
|
|
173
|
+
users: [],
|
|
174
|
+
skipped: [{
|
|
175
|
+
entry: "the file",
|
|
176
|
+
why: "it isn't a JSON array"
|
|
177
|
+
}]
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
for (const [at, record] of records.entries()) {
|
|
181
|
+
const email = Array.isArray(record.email_address) ? record.email_address[0] : record.email_address;
|
|
182
|
+
const hasher = text(record.password_hasher)?.toLowerCase();
|
|
183
|
+
const digest = text(record.password_digest);
|
|
184
|
+
const hash = hasher === "bcrypt" ? digest : hasher === "scrypt_werkzeug" && digest ? fromWerkzeug(digest) : void 0;
|
|
185
|
+
take(text(record.external_id) ?? `entry ${at + 1}`, userOf({
|
|
186
|
+
email,
|
|
187
|
+
name: [text(record.first_name), text(record.last_name)].filter(Boolean).join(" "),
|
|
188
|
+
emailVerified: true,
|
|
189
|
+
createdAt: record.created_at,
|
|
190
|
+
hash,
|
|
191
|
+
publicMetadata: record.public_metadata,
|
|
192
|
+
privateMetadata: record.private_metadata
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
} else if (from === "clerk") for (const [at, record] of csvRecords(document).entries()) {
|
|
103
196
|
const email = record.primary_email_address;
|
|
104
197
|
const verified = (record.verified_email_addresses ?? "").split(/[|,;]/).map((one) => one.trim().toLowerCase());
|
|
105
198
|
const hasher = (record.password_hasher ?? "").trim().toLowerCase();
|
|
@@ -110,31 +203,56 @@ function parseExport(from, document) {
|
|
|
110
203
|
hash: hasher === "bcrypt" ? record.password_digest : void 0
|
|
111
204
|
}));
|
|
112
205
|
}
|
|
113
|
-
else if (from === "auth0")
|
|
114
|
-
|
|
115
|
-
let
|
|
116
|
-
try {
|
|
117
|
-
|
|
206
|
+
else if (from === "auth0") {
|
|
207
|
+
const trimmed = document.trimStart();
|
|
208
|
+
let entries;
|
|
209
|
+
if (trimmed.startsWith("[")) try {
|
|
210
|
+
entries = JSON.parse(trimmed).map((record, at) => ({
|
|
211
|
+
at,
|
|
212
|
+
record
|
|
213
|
+
}));
|
|
118
214
|
} catch {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
215
|
+
return {
|
|
216
|
+
users: [],
|
|
217
|
+
skipped: [{
|
|
218
|
+
entry: "the file",
|
|
219
|
+
why: "it isn't a JSON array"
|
|
220
|
+
}]
|
|
221
|
+
};
|
|
124
222
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
name,
|
|
129
|
-
emailVerified: record.email_verified === true,
|
|
130
|
-
image: record.picture,
|
|
131
|
-
createdAt: record.created_at ?? record.password_set_date,
|
|
132
|
-
hash: record.passwordHash ?? record.password_hash,
|
|
133
|
-
publicMetadata: record.user_metadata,
|
|
134
|
-
privateMetadata: record.app_metadata
|
|
223
|
+
else entries = document.split(/\r?\n/).map((line, at) => ({
|
|
224
|
+
at,
|
|
225
|
+
line
|
|
135
226
|
}));
|
|
136
|
-
|
|
137
|
-
|
|
227
|
+
for (const entry of entries) {
|
|
228
|
+
const at = entry.at;
|
|
229
|
+
let record;
|
|
230
|
+
if ("record" in entry) record = entry.record;
|
|
231
|
+
else {
|
|
232
|
+
if (!entry.line.trim()) continue;
|
|
233
|
+
try {
|
|
234
|
+
record = JSON.parse(entry.line);
|
|
235
|
+
} catch {
|
|
236
|
+
skipped.push({
|
|
237
|
+
entry: `line ${at + 1}`,
|
|
238
|
+
why: "it isn't JSON"
|
|
239
|
+
});
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const name = text(record.name) ?? ([text(record.given_name), text(record.family_name)].filter(Boolean).join(" ") || text(record.nickname));
|
|
244
|
+
take(text(record.user_id) ?? text(record._id?.$oid) ?? `line ${at + 1}`, userOf({
|
|
245
|
+
email: record.email,
|
|
246
|
+
name,
|
|
247
|
+
emailVerified: record.email_verified === true,
|
|
248
|
+
image: record.picture,
|
|
249
|
+
createdAt: record.created_at ?? record.password_set_date,
|
|
250
|
+
hash: record.passwordHash ?? record.password_hash ?? customHash(record.custom_password_hash),
|
|
251
|
+
publicMetadata: record.user_metadata,
|
|
252
|
+
privateMetadata: record.app_metadata
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
138
256
|
const trimmed = document.replace(/^/, "").trimStart();
|
|
139
257
|
let records;
|
|
140
258
|
if (trimmed.startsWith("[")) try {
|
|
@@ -169,6 +287,49 @@ function parseExport(from, document) {
|
|
|
169
287
|
skipped
|
|
170
288
|
};
|
|
171
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* An Auth0 bulk import's `custom_password_hash` as a hash sign-in checks: bcrypt as it is, and scrypt with sign-in's own
|
|
292
|
+
* parameters and a text salt back in sign-in's form. Undefined for any other.
|
|
293
|
+
*/
|
|
294
|
+
function customHash(value) {
|
|
295
|
+
const given = object(value);
|
|
296
|
+
if (!given || typeof given.hash?.value !== "string") return void 0;
|
|
297
|
+
if (given.algorithm === "bcrypt") return given.hash.value;
|
|
298
|
+
const salt = given.salt?.value;
|
|
299
|
+
if (given.algorithm === "scrypt" && given.hash.encoding === "hex" && typeof salt === "string" && (given.salt?.encoding ?? "utf8") === "utf8" && given.keylen === 64 && (given.cost ?? 16384) === 16384 && given.blockSize === 16 && (given.parallelization ?? 1) === 1) return `${salt}:${given.hash.value}`;
|
|
300
|
+
}
|
|
301
|
+
/** What only Midsummer's own export carries of a user, as it wrote them: their role and ban, other services, organizations. */
|
|
302
|
+
function ownOf(record) {
|
|
303
|
+
const accounts = (Array.isArray(record.accounts) ? record.accounts : []).flatMap((one) => {
|
|
304
|
+
const given = object(one);
|
|
305
|
+
const provider = text(given?.provider), accountId = text(given?.accountId);
|
|
306
|
+
return provider && accountId && provider !== "credential" && provider.length <= 100 && accountId.length <= 255 ? [{
|
|
307
|
+
providerId: provider,
|
|
308
|
+
accountId
|
|
309
|
+
}] : [];
|
|
310
|
+
});
|
|
311
|
+
const organizations = (Array.isArray(record.organizations) ? record.organizations : []).flatMap((one) => {
|
|
312
|
+
const given = object(one);
|
|
313
|
+
const slug = text(given?.slug), name = text(given?.name);
|
|
314
|
+
return slug && name ? [{
|
|
315
|
+
slug,
|
|
316
|
+
name,
|
|
317
|
+
role: text(given?.role) ?? "member"
|
|
318
|
+
}] : [];
|
|
319
|
+
});
|
|
320
|
+
const updatedAt = time(record.updatedAt), banExpires = time(record.banExpires);
|
|
321
|
+
return {
|
|
322
|
+
...updatedAt !== void 0 ? { updatedAt } : {},
|
|
323
|
+
...text(record.role) ? { role: text(record.role) } : {},
|
|
324
|
+
...record.banned === true ? {
|
|
325
|
+
banned: true,
|
|
326
|
+
...text(record.banReason) ? { banReason: text(record.banReason) } : {},
|
|
327
|
+
...banExpires !== void 0 ? { banExpires } : {}
|
|
328
|
+
} : {},
|
|
329
|
+
...accounts.length ? { accounts: accounts.slice(0, 10) } : {},
|
|
330
|
+
...organizations.length ? { organizations: organizations.slice(0, 50) } : {}
|
|
331
|
+
};
|
|
332
|
+
}
|
|
172
333
|
/** One imported user's rows, as sign-in writes a user who signs up: made at `now`, unless the export has when they joined. */
|
|
173
334
|
function importRows(user, now) {
|
|
174
335
|
const createdAt = user.createdAt ?? now;
|
|
@@ -181,14 +342,22 @@ function importRows(user, now) {
|
|
|
181
342
|
...user.publicMetadata !== void 0 ? { publicMetadata: user.publicMetadata } : {},
|
|
182
343
|
...user.privateMetadata !== void 0 ? { privateMetadata: user.privateMetadata } : {},
|
|
183
344
|
createdAt,
|
|
184
|
-
updatedAt: now
|
|
345
|
+
updatedAt: user.updatedAt ?? now,
|
|
346
|
+
...user.role !== void 0 ? { role: user.role } : {},
|
|
347
|
+
...user.banned ? {
|
|
348
|
+
banned: true,
|
|
349
|
+
...user.banReason !== void 0 ? { banReason: user.banReason } : {},
|
|
350
|
+
...user.banExpires !== void 0 ? { banExpires: user.banExpires } : {}
|
|
351
|
+
} : {}
|
|
185
352
|
},
|
|
186
353
|
...user.passwordHash ? { account: {
|
|
187
354
|
providerId: "credential",
|
|
188
355
|
password: user.passwordHash,
|
|
189
356
|
createdAt: now,
|
|
190
357
|
updatedAt: now
|
|
191
|
-
} } : {}
|
|
358
|
+
} } : {},
|
|
359
|
+
...user.accounts?.length ? { accounts: user.accounts } : {},
|
|
360
|
+
...user.organizations?.length ? { organizations: user.organizations } : {}
|
|
192
361
|
};
|
|
193
362
|
}
|
|
194
363
|
//#endregion
|
package/auth/index.d.mts
CHANGED
|
@@ -2,6 +2,6 @@ import { n as AuthStore, r as databaseStore, t as AuthCall } from "../store-B3KJ
|
|
|
2
2
|
import { i as SignUpPolicy, n as CaptchaProvider, r as PublicSettings, t as AuthSettings } from "../settings-Dz3irtlu.mjs";
|
|
3
3
|
import { SignInMail, SignInMailKind, checkSignInMail, signInWords } from "./mail.mjs";
|
|
4
4
|
import { _ as AuthEventBatch, a as Auth, c as AuthUserRecord, d as SignedInAgent, f as auth, g as AuthEvent, h as AuthErrorCode, i as AgentKey, l as SESSION_CACHE_S, m as AuthError, n as AUTH_ROUTES, o as AuthOptions, p as createAuth, r as AgentGrant, s as AuthUser, t as AUTH_PATH, u as SignedIn, v as AuthEventType, y as EventSend } from "../index-CkBabhgi.mjs";
|
|
5
|
-
import { t as IMPERSONATION_S } from "../impersonate-
|
|
5
|
+
import { t as IMPERSONATION_S } from "../impersonate-BI_aYw9e.mjs";
|
|
6
6
|
import { i as authFiles } from "../files-CLuPkXhj.mjs";
|
|
7
7
|
export { AUTH_PATH, AUTH_ROUTES, AgentGrant, AgentKey, Auth, type AuthCall, AuthError, type AuthErrorCode, type AuthEvent, type AuthEventBatch, type AuthEventType, AuthOptions, type AuthSettings, type AuthStore, AuthUser, AuthUserRecord, type CaptchaProvider, type EventSend, IMPERSONATION_S, type PublicSettings, SESSION_CACHE_S, type SignInMail, type SignInMailKind, type SignUpPolicy, SignedIn, SignedInAgent, auth, authFiles, checkSignInMail, createAuth, databaseStore, signInWords };
|
package/calls/contract.d.mts
CHANGED
package/calls/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as Json } from "../index-c616Dbux.mjs";
|
|
2
|
-
import { a as CallToken, c as Layer, d as TrackName, r as CallErrorCode } from "../protocol-
|
|
2
|
+
import { a as CallToken, c as Layer, d as TrackName, r as CallErrorCode } from "../protocol-eCEy2GzD.mjs";
|
|
3
3
|
//#region src/calls/index.d.ts
|
|
4
4
|
/** The most a message sent with `send` carries, as JSON. */
|
|
5
5
|
declare const MAX_MESSAGE_BYTES: number;
|
package/calls/index.mjs
CHANGED
|
@@ -524,7 +524,8 @@ function sfuMedia(ctx, auto, declined, offer) {
|
|
|
524
524
|
change("layer", {
|
|
525
525
|
participant: ctx.me,
|
|
526
526
|
mid,
|
|
527
|
-
layer: ask
|
|
527
|
+
layer: ask,
|
|
528
|
+
of: pull.of
|
|
528
529
|
}).then(() => askKey(pull.of, pull.name), () => void 0);
|
|
529
530
|
}
|
|
530
531
|
} catch {} finally {
|
|
@@ -765,7 +766,8 @@ function sfuMedia(ctx, auto, declined, offer) {
|
|
|
765
766
|
await change("layer", {
|
|
766
767
|
participant: ctx.me,
|
|
767
768
|
mid,
|
|
768
|
-
layer
|
|
769
|
+
layer,
|
|
770
|
+
of
|
|
769
771
|
});
|
|
770
772
|
pulledTrack.layer = layer;
|
|
771
773
|
delete pulledTrack.watch;
|
package/calls/protocol.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CallToken, c as Layer, d as TrackName, f as WireParticipant, i as CallOp, l as Sdp, m as WireSignal, n as CALL_STATUS, o as CallWire, p as WireRoom, r as CallErrorCode, s as IceServer, t as CALL_OPS, u as TRACK_KINDS } from "../protocol-
|
|
1
|
+
import { a as CallToken, c as Layer, d as TrackName, f as WireParticipant, i as CallOp, l as Sdp, m as WireSignal, n as CALL_STATUS, o as CallWire, p as WireRoom, r as CallErrorCode, s as IceServer, t as CALL_OPS, u as TRACK_KINDS } from "../protocol-eCEy2GzD.mjs";
|
|
2
2
|
export { CALL_OPS, CALL_STATUS, CallErrorCode, CallOp, CallToken, CallWire, IceServer, Layer, Sdp, TRACK_KINDS, TrackName, WireParticipant, WireRoom, WireSignal };
|
package/calls/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TrackName } from "../protocol-
|
|
1
|
+
import { d as TrackName } from "../protocol-eCEy2GzD.mjs";
|
|
2
2
|
import { Call, CallError, CallState, LocalTrack, Participant, Rtc, TokenSource } from "./index.mjs";
|
|
3
3
|
import { AudioHTMLAttributes, ReactNode, VideoHTMLAttributes } from "react";
|
|
4
4
|
//#region src/calls/react.d.ts
|
package/calls/stand-in.d.mts
CHANGED
package/here-C2jhTheQ.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function processEnv() {
|
|
|
12
12
|
* This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
|
|
13
13
|
* release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
|
|
14
14
|
*/
|
|
15
|
-
const SDK_VERSION = "0.1.0-staging.
|
|
15
|
+
const SDK_VERSION = "0.1.0-staging.4718";
|
|
16
16
|
/**
|
|
17
17
|
* The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
|
|
18
18
|
* <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
|
|
@@ -17,13 +17,15 @@ declare const IMPERSONATION_S: number;
|
|
|
17
17
|
declare function impersonationIdentifier(token: string): Promise<string>;
|
|
18
18
|
/**
|
|
19
19
|
* A new "sign in as" for `userId`: the token's path to open, the row that lets it in once, and how long the session it
|
|
20
|
-
* makes lasts, in ms.
|
|
20
|
+
* makes lasts, in ms. `token` is the one to use, such as one made again for a retry; a random one when left out.
|
|
21
|
+
* Throws for a reason that isn't 1 to 200 characters.
|
|
21
22
|
*/
|
|
22
23
|
declare function startImpersonation(input: {
|
|
23
24
|
readonly userId: string;
|
|
24
25
|
readonly by: string;
|
|
25
26
|
readonly reason: string;
|
|
26
27
|
readonly now: number;
|
|
28
|
+
readonly token?: string;
|
|
27
29
|
}): Promise<{
|
|
28
30
|
readonly path: string;
|
|
29
31
|
readonly sessionMs: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midsummer-ai/sdk",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.4718",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",
|
|
@@ -286,6 +286,10 @@
|
|
|
286
286
|
"./auth/import": {
|
|
287
287
|
"types": "./auth/import.d.mts",
|
|
288
288
|
"import": "./auth/import.mjs"
|
|
289
|
+
},
|
|
290
|
+
"./auth/export": {
|
|
291
|
+
"types": "./auth/export.d.mts",
|
|
292
|
+
"import": "./auth/export.mjs"
|
|
289
293
|
}
|
|
290
294
|
},
|
|
291
295
|
"typesVersions": {
|
|
@@ -496,6 +500,9 @@
|
|
|
496
500
|
],
|
|
497
501
|
"auth/import": [
|
|
498
502
|
"./auth/import.d.mts"
|
|
503
|
+
],
|
|
504
|
+
"auth/export": [
|
|
505
|
+
"./auth/export.d.mts"
|
|
499
506
|
]
|
|
500
507
|
}
|
|
501
508
|
},
|
|
@@ -148,11 +148,13 @@ interface CallWire {
|
|
|
148
148
|
answer: Sdp;
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
|
+
/** `of`, whose video it is, lets the platform read the viewer and the sender together. */
|
|
151
152
|
layer: {
|
|
152
153
|
body: {
|
|
153
154
|
participant: string;
|
|
154
155
|
mid: string;
|
|
155
156
|
layer: Layer;
|
|
157
|
+
of?: string;
|
|
156
158
|
};
|
|
157
159
|
answer: Record<string, never>;
|
|
158
160
|
};
|