@bbthorson/atproto-cf-auth 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -20
- package/dist/accounts.d.ts +91 -0
- package/dist/accounts.js +179 -0
- package/dist/accounts.js.map +1 -0
- package/dist/client.d.ts +19 -17
- package/dist/client.js +28 -30
- package/dist/client.js.map +1 -1
- package/dist/controller.d.ts +96 -0
- package/dist/controller.js +169 -0
- package/dist/controller.js.map +1 -0
- package/dist/element.css +283 -0
- package/dist/element.js +284 -58
- package/dist/element.js.map +1 -1
- package/dist/search.d.ts +16 -0
- package/dist/search.js +38 -0
- package/dist/search.js.map +1 -0
- package/dist/server/auth.d.ts +141 -6
- package/dist/server/auth.js +193 -59
- package/dist/server/auth.js.map +1 -1
- package/dist/server/handoff.d.ts +1 -1
- package/dist/server/handoff.js +1 -1
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.js +3 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/lock.d.ts +1 -1
- package/dist/server/stores/postgres.d.ts +30 -0
- package/dist/server/stores/postgres.js +54 -0
- package/dist/server/stores/postgres.js.map +1 -0
- package/dist/shared.d.ts +7 -1
- package/dist/shared.js +25 -2
- package/dist/shared.js.map +1 -1
- package/package.json +10 -5
package/dist/server/handoff.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Key } from "@atproto/oauth-client";
|
|
2
2
|
/**
|
|
3
3
|
* The wire half of accepting a session handed over outside the redirect flow
|
|
4
|
-
* (`
|
|
4
|
+
* (`AtprotoAuth.obtainSession`): a JSON POST to an authorization server's own
|
|
5
5
|
* endpoint, made the way a token request is made. The client authenticates as
|
|
6
6
|
* itself (its `client_id`, and a signed assertion when it is confidential) and
|
|
7
7
|
* proves possession of the key the tokens will be bound to (DPoP, answering
|
package/dist/server/handoff.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toB64url } from "./seal.js";
|
|
2
2
|
/**
|
|
3
3
|
* The wire half of accepting a session handed over outside the redirect flow
|
|
4
|
-
* (`
|
|
4
|
+
* (`AtprotoAuth.obtainSession`): a JSON POST to an authorization server's own
|
|
5
5
|
* endpoint, made the way a token request is made. The client authenticates as
|
|
6
6
|
* itself (its `client_id`, and a signed assertion when it is confidential) and
|
|
7
7
|
* proves possession of the key the tokens will be bound to (DPoP, answering
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createAtprotoAuth, type AuthorizeInput, type AuthorizeOptions, type AuthorizeTarget, type AuthorizeResult, type AtprotoAuth, type AtprotoAuthOptions, type SignInErrorEvent, type SignInEvent, type SignInFlow, } from "./auth.js";
|
|
2
2
|
export { joinScopes, pdsServesMethod, type ConditionalScope, type PdsInfo, type PdsServesMethodOptions, } from "./scopes.js";
|
|
3
3
|
export { ObtainSessionError } from "./handoff.js";
|
|
4
4
|
export type { AuthStore } from "./stores/types.js";
|
|
@@ -6,5 +6,6 @@ export { AuthLock, durableObjectLock, type DurableObjectLockOptions, type Durabl
|
|
|
6
6
|
export { d1Store, type D1DatabaseLike, type D1PreparedStatementLike } from "./stores/d1.js";
|
|
7
7
|
export { kvStore, type KVNamespaceLike } from "./stores/kv.js";
|
|
8
8
|
export { memoryStore } from "./stores/memory.js";
|
|
9
|
-
export {
|
|
9
|
+
export { postgresStore, type PostgresStoreOptions, type SqlQuery } from "./stores/postgres.js";
|
|
10
|
+
export { AUTH_ERROR_MESSAGES, AUTH_ERROR_PARAM, AuthError, isAuthErrorCode, isValidHandle, normalizeHandle, normalizeServer, type AuthErrorCode, type User, } from "../shared.js";
|
|
10
11
|
export type { OAuthSession, RuntimeLock } from "@atproto/oauth-client";
|
package/dist/server/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createAtprotoAuth, } from "./auth.js";
|
|
2
2
|
export { joinScopes, pdsServesMethod, } from "./scopes.js";
|
|
3
3
|
export { ObtainSessionError } from "./handoff.js";
|
|
4
4
|
export { AuthLock, durableObjectLock, } from "./lock.js";
|
|
5
5
|
export { d1Store } from "./stores/d1.js";
|
|
6
6
|
export { kvStore } from "./stores/kv.js";
|
|
7
7
|
export { memoryStore } from "./stores/memory.js";
|
|
8
|
-
export {
|
|
8
|
+
export { postgresStore } from "./stores/postgres.js";
|
|
9
|
+
export { AUTH_ERROR_MESSAGES, AUTH_ERROR_PARAM, AuthError, isAuthErrorCode, isValidHandle, normalizeHandle, normalizeServer, } from "../shared.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAUlB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,eAAe,GAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EACL,QAAQ,EACR,iBAAiB,GAGlB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAqD,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAwB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAA4C,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,GAGhB,MAAM,cAAc,CAAC"}
|
package/dist/server/lock.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { RuntimeLock } from "@atproto/oauth-client";
|
|
|
16
16
|
* ```ts
|
|
17
17
|
* // worker entry
|
|
18
18
|
* export { AuthLock } from "@bbthorson/atproto-cf-auth/server";
|
|
19
|
-
*
|
|
19
|
+
* createAtprotoAuth({ ..., requestLock: durableObjectLock(env.AUTH_LOCK) });
|
|
20
20
|
* ```
|
|
21
21
|
*
|
|
22
22
|
* ```toml
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AuthStore } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Runs one parameterised statement (`$1`, `$2`, …) and resolves to its rows,
|
|
4
|
+
* either as an array or as `{ rows }`. Fits, as they are:
|
|
5
|
+
*
|
|
6
|
+
* - Neon serverless: `neon(url).query` (or `(text, params) => sql.query(text, params)`)
|
|
7
|
+
* - node-postgres / Hyperdrive: `(text, params) => pool.query(text, params)`
|
|
8
|
+
* - PGlite: `(text, params) => db.query(text, params)`
|
|
9
|
+
*/
|
|
10
|
+
export type SqlQuery = (text: string, params: unknown[]) => Promise<unknown>;
|
|
11
|
+
export interface PostgresStoreOptions {
|
|
12
|
+
/** Default `bsky_auth`. May be schema-qualified (`auth.bsky_auth`). */
|
|
13
|
+
table?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Default true: `CREATE TABLE IF NOT EXISTS` on first use. Turn it off when
|
|
16
|
+
* migrations own the schema; the table must then match the one below.
|
|
17
|
+
*/
|
|
18
|
+
createTable?: boolean;
|
|
19
|
+
now?: () => number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Postgres (Neon, Hyperdrive, PGlite, anything that runs a parameterised
|
|
23
|
+
* query). Strongly consistent, like D1. One table:
|
|
24
|
+
*
|
|
25
|
+
* CREATE TABLE bsky_auth (key text PRIMARY KEY, value text NOT NULL, expires_at bigint NOT NULL)
|
|
26
|
+
*
|
|
27
|
+
* `expires_at` is milliseconds since the epoch. Expired rows are swept
|
|
28
|
+
* whenever a new sign-in starts.
|
|
29
|
+
*/
|
|
30
|
+
export declare function postgresStore(query: SqlQuery, options?: PostgresStoreOptions): AuthStore;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const IDENT = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$/;
|
|
2
|
+
/**
|
|
3
|
+
* Postgres (Neon, Hyperdrive, PGlite, anything that runs a parameterised
|
|
4
|
+
* query). Strongly consistent, like D1. One table:
|
|
5
|
+
*
|
|
6
|
+
* CREATE TABLE bsky_auth (key text PRIMARY KEY, value text NOT NULL, expires_at bigint NOT NULL)
|
|
7
|
+
*
|
|
8
|
+
* `expires_at` is milliseconds since the epoch. Expired rows are swept
|
|
9
|
+
* whenever a new sign-in starts.
|
|
10
|
+
*/
|
|
11
|
+
export function postgresStore(query, options = {}) {
|
|
12
|
+
const table = options.table ?? "bsky_auth";
|
|
13
|
+
if (!IDENT.test(table))
|
|
14
|
+
throw new Error(`postgresStore: invalid table name ${JSON.stringify(table)}`);
|
|
15
|
+
const now = options.now ?? Date.now;
|
|
16
|
+
const createTable = options.createTable ?? true;
|
|
17
|
+
const run = async (text, params) => {
|
|
18
|
+
const result = await query(text, params);
|
|
19
|
+
const rows = Array.isArray(result)
|
|
20
|
+
? result
|
|
21
|
+
: typeof result === "object" && result !== null && "rows" in result && Array.isArray(result.rows)
|
|
22
|
+
? result.rows
|
|
23
|
+
: [];
|
|
24
|
+
return rows.filter((row) => typeof row === "object" && row !== null);
|
|
25
|
+
};
|
|
26
|
+
let ready;
|
|
27
|
+
const ensureTable = () => {
|
|
28
|
+
if (!createTable)
|
|
29
|
+
return Promise.resolve();
|
|
30
|
+
return (ready ??= run(`CREATE TABLE IF NOT EXISTS ${table} (key text PRIMARY KEY, value text NOT NULL, expires_at bigint NOT NULL)`, []).then(() => undefined, (err) => {
|
|
31
|
+
ready = undefined; // retry next time rather than wedge the isolate
|
|
32
|
+
throw err;
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
async get(key) {
|
|
37
|
+
await ensureTable();
|
|
38
|
+
const [row] = await run(`SELECT value FROM ${table} WHERE key = $1 AND expires_at > $2`, [key, now()]);
|
|
39
|
+
return typeof row?.["value"] === "string" ? row["value"] : undefined;
|
|
40
|
+
},
|
|
41
|
+
async set(key, value, ttlSeconds) {
|
|
42
|
+
await ensureTable();
|
|
43
|
+
if (key.startsWith("state:"))
|
|
44
|
+
await run(`DELETE FROM ${table} WHERE expires_at <= $1`, [now()]);
|
|
45
|
+
await run(`INSERT INTO ${table} (key, value, expires_at) VALUES ($1, $2, $3)
|
|
46
|
+
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, expires_at = EXCLUDED.expires_at`, [key, value, now() + Math.ceil(ttlSeconds * 1000)]);
|
|
47
|
+
},
|
|
48
|
+
async delete(key) {
|
|
49
|
+
await ensureTable();
|
|
50
|
+
await run(`DELETE FROM ${table} WHERE key = $1`, [key]);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../../src/server/stores/postgres.ts"],"names":[],"mappings":"AAuBA,MAAM,KAAK,GAAG,qDAAqD,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,UAAgC,EAAE;IAC/E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,WAAW,CAAC;IAC3C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtG,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACpC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC;IAEhD,MAAM,GAAG,GAAG,KAAK,EAAE,I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AG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU;YAC9B,MAAM,WAAW,EAAE,CAAC;YACpB,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,MAAM,GAAG,CAAC,eAAe,KAAK,yBAAyB,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAChG,MAAM,GAAG,CACP,eAAe,KAAK;kGACsE,EAC1F,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CACnD,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,GAAG;YACd,MAAM,WAAW,EAAE,CAAC;YACpB,MAAM,GAAG,CAAC,eAAe,KAAK,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface User {
|
|
|
11
11
|
/** ISO timestamp of the sign-in that created this session. */
|
|
12
12
|
signedInAt: string;
|
|
13
13
|
}
|
|
14
|
-
export type AuthErrorCode = "invalid_handle" | "handle_not_found" | "authorize_failed" | "access_denied" | "callback_failed" | "browser_mismatch" | "use_loopback_ip" | "not_configured" | "network_error";
|
|
14
|
+
export type AuthErrorCode = "invalid_handle" | "invalid_server" | "sign_up_unavailable" | "handle_not_found" | "authorize_failed" | "access_denied" | "callback_failed" | "browser_mismatch" | "use_loopback_ip" | "not_configured" | "network_error";
|
|
15
15
|
/** Default English copy. Apps with their own voice can map codes themselves. */
|
|
16
16
|
export declare const AUTH_ERROR_MESSAGES: Readonly<Record<AuthErrorCode, string>>;
|
|
17
17
|
export declare function isAuthErrorCode(value: unknown): value is AuthErrorCode;
|
|
@@ -39,3 +39,9 @@ export declare function isValidHandle(value: string): boolean;
|
|
|
39
39
|
* else would make the sign-in flow an open redirect.
|
|
40
40
|
*/
|
|
41
41
|
export declare function safeReturnTo(value: unknown): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Turn a server address someone typed or an app configured (`bsky.social`,
|
|
44
|
+
* `https://bsky.social/`) into an https origin, or `undefined` when it isn't
|
|
45
|
+
* one. Only https: authorization servers are reached over it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function normalizeServer(input: string): string | undefined;
|
package/dist/shared.js
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/** Default English copy. Apps with their own voice can map codes themselves. */
|
|
7
7
|
export const AUTH_ERROR_MESSAGES = {
|
|
8
|
-
invalid_handle: "That doesn't look like a
|
|
8
|
+
invalid_handle: "That doesn't look like a handle. Try something like you.bsky.social.",
|
|
9
|
+
invalid_server: "That doesn't look like a server address. Try something like bsky.social.",
|
|
10
|
+
sign_up_unavailable: "That server doesn't offer sign-up here. Try another, or sign in with an account you have.",
|
|
9
11
|
handle_not_found: "We couldn't find that handle. Double-check it and try again.",
|
|
10
|
-
authorize_failed: "Your
|
|
12
|
+
authorize_failed: "Your account's server didn't respond. Try again in a moment.",
|
|
11
13
|
access_denied: "Sign-in was cancelled.",
|
|
12
14
|
callback_failed: "Sign-in didn't finish. Please try again.",
|
|
13
15
|
browser_mismatch: "Sign-in was started in a different browser or tab. Please start again here.",
|
|
@@ -71,4 +73,25 @@ export function safeReturnTo(value) {
|
|
|
71
73
|
return undefined;
|
|
72
74
|
return value;
|
|
73
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Turn a server address someone typed or an app configured (`bsky.social`,
|
|
78
|
+
* `https://bsky.social/`) into an https origin, or `undefined` when it isn't
|
|
79
|
+
* one. Only https: authorization servers are reached over it.
|
|
80
|
+
*/
|
|
81
|
+
export function normalizeServer(input) {
|
|
82
|
+
let value = input.normalize("NFKC").trim();
|
|
83
|
+
if (!value)
|
|
84
|
+
return undefined;
|
|
85
|
+
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(value))
|
|
86
|
+
value = `https://${value}`;
|
|
87
|
+
try {
|
|
88
|
+
const url = new URL(value);
|
|
89
|
+
if (url.protocol !== "https:" || url.username || url.password || !url.hostname.includes("."))
|
|
90
|
+
return undefined;
|
|
91
|
+
return url.origin;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
74
97
|
//# sourceMappingURL=shared.js.map
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAA4C;IAC1E,cAAc,EAAE,sEAAsE;IACtF,cAAc,EAAE,0EAA0E;IAC1F,mBAAmB,EAAE,2FAA2F;IAChH,gBAAgB,EAAE,8DAA8D;IAChF,gBAAgB,EAAE,8DAA8D;IAChF,aAAa,EAAE,wBAAwB;IACvC,eAAe,EAAE,0CAA0C;IAC3D,gBAAgB,EAAE,6EAA6E;IAC/F,eAAe,EAAE,yEAAyE;IAC1F,cAAc,EAAE,0CAA0C;IAC1D,aAAa,EAAE,oEAAoE;CACpF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AACvG,CAAC;AAED,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEvB;IADX,YACW,IAAmB,EAC5B,UAAkB,mBAAmB,CAAC,IAAI,CAAC;QAE3C,KAAK,CAAC,OAAO,CAAC,CAA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AAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1E,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACtG,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,IAAI,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,KAAK,GAAG,WAAW,KAAK,EAAE,CAAC;IACxE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/G,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbthorson/atproto-cf-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Bluesky (AT-Proto OAuth) sign-in for apps on Cloudflare Workers: server handlers, D1/KV session stores, and framework-free browser primitives.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"url": "git+https://github.com/bbthorson/atproto-cf-auth.git"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": [
|
|
12
|
-
"./dist/element.js"
|
|
12
|
+
"./dist/element.js",
|
|
13
|
+
"*.css"
|
|
13
14
|
],
|
|
14
15
|
"exports": {
|
|
15
16
|
"./server": {
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
"./element": {
|
|
24
25
|
"types": "./dist/element.d.ts",
|
|
25
26
|
"default": "./dist/element.js"
|
|
26
|
-
}
|
|
27
|
+
},
|
|
28
|
+
"./element.css": "./dist/element.css"
|
|
27
29
|
},
|
|
28
30
|
"files": [
|
|
29
31
|
"dist",
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"LICENSE"
|
|
32
34
|
],
|
|
33
35
|
"scripts": {
|
|
34
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
36
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/element.css dist/element.css",
|
|
35
37
|
"typecheck": "tsc --noEmit",
|
|
36
38
|
"test": "vitest run",
|
|
37
39
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
"@atproto/oauth-client": "^0.8.9"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
48
|
+
"@electric-sql/pglite": "^0.5.17",
|
|
46
49
|
"@types/node": "^22.10.5",
|
|
47
50
|
"happy-dom": "^20.0.0",
|
|
48
51
|
"typescript": "^5.7.2",
|
|
@@ -57,7 +60,9 @@
|
|
|
57
60
|
"oauth",
|
|
58
61
|
"cloudflare-workers",
|
|
59
62
|
"d1",
|
|
60
|
-
"web-component"
|
|
63
|
+
"web-component",
|
|
64
|
+
"typeahead",
|
|
65
|
+
"postgres"
|
|
61
66
|
],
|
|
62
67
|
"publishConfig": {
|
|
63
68
|
"access": "public"
|