cauthy-auth 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/README.md +52 -2
- package/dist/cauthy-By2cryXN.d.ts +56 -0
- package/dist/cauthy-DsUNqjg6.d.mts +56 -0
- package/dist/cli.js +301 -0
- package/dist/fastify.d.mts +21 -0
- package/dist/fastify.d.ts +21 -0
- package/dist/fastify.js +81 -0
- package/dist/fastify.js.map +1 -0
- package/dist/fastify.mjs +56 -0
- package/dist/fastify.mjs.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +633 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +603 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.d.mts +37 -0
- package/dist/react.d.ts +37 -0
- package/dist/react.js +107 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +81 -0
- package/dist/react.mjs.map +1 -0
- package/dist/theme.d.mts +82 -0
- package/dist/theme.d.ts +82 -0
- package/dist/theme.js +254 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.mjs +226 -0
- package/dist/theme.mjs.map +1 -0
- package/dist/types-BwCjBn-K.d.mts +97 -0
- package/dist/types-BwCjBn-K.d.ts +97 -0
- package/package.json +84 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FastifyReply, FastifyPluginAsync } from 'fastify';
|
|
2
|
+
import { C as Cauthy } from './cauthy-DsUNqjg6.mjs';
|
|
3
|
+
import { S as Session } from './types-BwCjBn-K.mjs';
|
|
4
|
+
|
|
5
|
+
declare module 'fastify' {
|
|
6
|
+
interface FastifyRequest {
|
|
7
|
+
/** Who is signed in, or null. Asked once per request. */
|
|
8
|
+
cauthy(): Promise<Session | null>;
|
|
9
|
+
}
|
|
10
|
+
interface FastifyInstance {
|
|
11
|
+
/** A preHandler that answers 401 unless somebody is signed in. */
|
|
12
|
+
requireSession(request: FastifyRequest, reply: FastifyReply): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
interface CauthyFastifyOptions {
|
|
16
|
+
auth: Cauthy;
|
|
17
|
+
}
|
|
18
|
+
declare const plugin: FastifyPluginAsync<CauthyFastifyOptions>;
|
|
19
|
+
declare const cauthyFastify: FastifyPluginAsync<CauthyFastifyOptions>;
|
|
20
|
+
|
|
21
|
+
export { type CauthyFastifyOptions, cauthyFastify, plugin as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FastifyReply, FastifyPluginAsync } from 'fastify';
|
|
2
|
+
import { C as Cauthy } from './cauthy-By2cryXN.js';
|
|
3
|
+
import { S as Session } from './types-BwCjBn-K.js';
|
|
4
|
+
|
|
5
|
+
declare module 'fastify' {
|
|
6
|
+
interface FastifyRequest {
|
|
7
|
+
/** Who is signed in, or null. Asked once per request. */
|
|
8
|
+
cauthy(): Promise<Session | null>;
|
|
9
|
+
}
|
|
10
|
+
interface FastifyInstance {
|
|
11
|
+
/** A preHandler that answers 401 unless somebody is signed in. */
|
|
12
|
+
requireSession(request: FastifyRequest, reply: FastifyReply): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
interface CauthyFastifyOptions {
|
|
16
|
+
auth: Cauthy;
|
|
17
|
+
}
|
|
18
|
+
declare const plugin: FastifyPluginAsync<CauthyFastifyOptions>;
|
|
19
|
+
declare const cauthyFastify: FastifyPluginAsync<CauthyFastifyOptions>;
|
|
20
|
+
|
|
21
|
+
export { type CauthyFastifyOptions, cauthyFastify, plugin as default };
|
package/dist/fastify.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/fastify.ts
|
|
21
|
+
var fastify_exports = {};
|
|
22
|
+
__export(fastify_exports, {
|
|
23
|
+
cauthyFastify: () => cauthyFastify,
|
|
24
|
+
default: () => fastify_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(fastify_exports);
|
|
27
|
+
function originOf(req) {
|
|
28
|
+
return `${req.protocol}://${req.headers.host ?? "localhost"}`;
|
|
29
|
+
}
|
|
30
|
+
function toWebRequest(req) {
|
|
31
|
+
const headers = new Headers();
|
|
32
|
+
for (const [k, v] of Object.entries(req.headers)) {
|
|
33
|
+
if (Array.isArray(v)) for (const one of v) headers.append(k, one);
|
|
34
|
+
else if (v !== void 0) headers.set(k, v);
|
|
35
|
+
}
|
|
36
|
+
return new Request(new URL(req.url, originOf(req)), { method: req.method, headers });
|
|
37
|
+
}
|
|
38
|
+
var kSession = /* @__PURE__ */ Symbol("cauthy.session");
|
|
39
|
+
var kReply = /* @__PURE__ */ Symbol("cauthy.reply");
|
|
40
|
+
var plugin = async (app, { auth }) => {
|
|
41
|
+
const base = auth.options.basePath;
|
|
42
|
+
app.decorateRequest("cauthy", async function() {
|
|
43
|
+
const self = this;
|
|
44
|
+
self[kSession] ??= (async () => {
|
|
45
|
+
const resolved = await auth.resolve(toWebRequest(this));
|
|
46
|
+
const reply = this[kReply];
|
|
47
|
+
if (resolved.cookies.length > 0 && reply) reply.header("set-cookie", resolved.cookies);
|
|
48
|
+
return resolved.session;
|
|
49
|
+
})();
|
|
50
|
+
return self[kSession];
|
|
51
|
+
});
|
|
52
|
+
app.addHook("onRequest", async (req, reply) => {
|
|
53
|
+
;
|
|
54
|
+
req[kReply] = reply;
|
|
55
|
+
});
|
|
56
|
+
app.decorate("requireSession", async function(request, reply) {
|
|
57
|
+
if (await request.cauthy() === null) {
|
|
58
|
+
await reply.code(401).header("x-cauthy-session", "none").send({ error: "unauthenticated" });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const serve = async (req, reply) => {
|
|
62
|
+
const res = await auth.handler(toWebRequest(req));
|
|
63
|
+
reply.code(res.status);
|
|
64
|
+
res.headers.forEach((value, name) => {
|
|
65
|
+
if (name !== "set-cookie") reply.header(name, value);
|
|
66
|
+
});
|
|
67
|
+
const cookies = res.headers.getSetCookie();
|
|
68
|
+
if (cookies.length > 0) reply.header("set-cookie", cookies);
|
|
69
|
+
return reply.send(res.body === null ? null : Buffer.from(await res.arrayBuffer()));
|
|
70
|
+
};
|
|
71
|
+
app.route({ method: ["GET", "POST"], url: `${base}/*`, handler: serve });
|
|
72
|
+
};
|
|
73
|
+
plugin[/* @__PURE__ */ Symbol.for("skip-override")] = true;
|
|
74
|
+
plugin[/* @__PURE__ */ Symbol.for("fastify.display-name")] = "cauthy-auth";
|
|
75
|
+
var cauthyFastify = plugin;
|
|
76
|
+
var fastify_default = plugin;
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
cauthyFastify
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=fastify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fastify.ts"],"sourcesContent":["// Fastify: the routes, and who is signed in on every request.\n//\n// await app.register(cauthyFastify, { auth })\n//\n// app.get('/api/me', async (req, reply) => {\n// const session = await req.cauthy()\n// if (!session) return reply.code(401).send({ error: 'unauthenticated' })\n// return session.user\n// })\n//\n// app.get('/api/books', { preHandler: app.requireSession }, async (req) => { … })\n//\n// Here a session that needs renewing is renewed on the spot: Fastify has the\n// reply in hand, so the new cookie always goes back.\n\nimport type { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest } from 'fastify'\nimport type { Cauthy } from './cauthy'\nimport type { Session } from './types'\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n /** Who is signed in, or null. Asked once per request. */\n cauthy(): Promise<Session | null>\n }\n interface FastifyInstance {\n /** A preHandler that answers 401 unless somebody is signed in. */\n requireSession(request: FastifyRequest, reply: FastifyReply): Promise<void>\n }\n}\n\nexport interface CauthyFastifyOptions {\n auth: Cauthy\n}\n\nfunction originOf(req: FastifyRequest): string {\n return `${req.protocol}://${req.headers.host ?? 'localhost'}`\n}\n\nfunction toWebRequest(req: FastifyRequest): Request {\n const headers = new Headers()\n for (const [k, v] of Object.entries(req.headers)) {\n if (Array.isArray(v)) for (const one of v) headers.append(k, one)\n else if (v !== undefined) headers.set(k, v)\n }\n // The routes read no body: what they need is in the URL and the cookies.\n return new Request(new URL(req.url, originOf(req)), { method: req.method, headers })\n}\n\nconst kSession = Symbol('cauthy.session')\nconst kReply = Symbol('cauthy.reply')\n\nconst plugin: FastifyPluginAsync<CauthyFastifyOptions> = async (app: FastifyInstance, { auth }) => {\n const base = auth.options.basePath\n\n app.decorateRequest('cauthy', async function (this: FastifyRequest): Promise<Session | null> {\n const self = this as FastifyRequest & { [kSession]?: Promise<Session | null> }\n self[kSession] ??= (async () => {\n const resolved = await auth.resolve(toWebRequest(this))\n // Set through the raw response so the cookie leaves whatever the route\n // answers with, even an error.\n const reply = (this as FastifyRequest & { [kReply]?: FastifyReply })[kReply]\n if (resolved.cookies.length > 0 && reply) reply.header('set-cookie', resolved.cookies)\n return resolved.session\n })()\n return self[kSession]\n })\n\n app.addHook('onRequest', async (req, reply) => {\n ;(req as FastifyRequest & { [kReply]?: FastifyReply })[kReply] = reply\n })\n\n app.decorate('requireSession', async function (request: FastifyRequest, reply: FastifyReply): Promise<void> {\n if ((await request.cauthy()) === null) {\n await reply.code(401).header('x-cauthy-session', 'none').send({ error: 'unauthenticated' })\n }\n })\n\n const serve = async (req: FastifyRequest, reply: FastifyReply) => {\n const res = await auth.handler(toWebRequest(req))\n reply.code(res.status)\n res.headers.forEach((value, name) => {\n if (name !== 'set-cookie') reply.header(name, value)\n })\n const cookies = res.headers.getSetCookie()\n if (cookies.length > 0) reply.header('set-cookie', cookies)\n return reply.send(res.body === null ? null : Buffer.from(await res.arrayBuffer()))\n }\n app.route({ method: ['GET', 'POST'], url: `${base}/*`, handler: serve })\n}\n\n\n// Outside encapsulation: `req.cauthy()` and `requireSession` are for the whole\n// application, not only for routes registered beside this plugin.\n;(plugin as unknown as Record<symbol, boolean>)[Symbol.for('skip-override')] = true\n;(plugin as unknown as Record<symbol, unknown>)[Symbol.for('fastify.display-name')] = 'cauthy-auth'\n\nexport const cauthyFastify = plugin\nexport default plugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCA,SAAS,SAAS,KAA6B;AAC7C,SAAO,GAAG,IAAI,QAAQ,MAAM,IAAI,QAAQ,QAAQ,WAAW;AAC7D;AAEA,SAAS,aAAa,KAA8B;AAClD,QAAM,UAAU,IAAI,QAAQ;AAC5B,aAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,IAAI,OAAO,GAAG;AAChD,QAAI,MAAM,QAAQ,CAAC,EAAG,YAAW,OAAO,EAAG,SAAQ,OAAO,GAAG,GAAG;AAAA,aACvD,MAAM,OAAW,SAAQ,IAAI,GAAG,CAAC;AAAA,EAC5C;AAEA,SAAO,IAAI,QAAQ,IAAI,IAAI,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,QAAQ,IAAI,QAAQ,QAAQ,CAAC;AAC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I,MAAM,EAAE,QAAQ,CAAC,OAAO,MAAM,GAAG,KAAK,GAAG,IAAI,MAAM,SAAS,MAAM,CAAC;AACzE;AAKE,OAA8C,uBAAO,IAAI,eAAe,CAAC,IAAI;AAC7E,OAA8C,uBAAO,IAAI,sBAAsB,CAAC,IAAI;AAE/E,IAAM,gBAAgB;AAC7B,IAAO,kBAAQ;","names":[]}
|
package/dist/fastify.mjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/fastify.ts
|
|
2
|
+
function originOf(req) {
|
|
3
|
+
return `${req.protocol}://${req.headers.host ?? "localhost"}`;
|
|
4
|
+
}
|
|
5
|
+
function toWebRequest(req) {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
for (const [k, v] of Object.entries(req.headers)) {
|
|
8
|
+
if (Array.isArray(v)) for (const one of v) headers.append(k, one);
|
|
9
|
+
else if (v !== void 0) headers.set(k, v);
|
|
10
|
+
}
|
|
11
|
+
return new Request(new URL(req.url, originOf(req)), { method: req.method, headers });
|
|
12
|
+
}
|
|
13
|
+
var kSession = /* @__PURE__ */ Symbol("cauthy.session");
|
|
14
|
+
var kReply = /* @__PURE__ */ Symbol("cauthy.reply");
|
|
15
|
+
var plugin = async (app, { auth }) => {
|
|
16
|
+
const base = auth.options.basePath;
|
|
17
|
+
app.decorateRequest("cauthy", async function() {
|
|
18
|
+
const self = this;
|
|
19
|
+
self[kSession] ??= (async () => {
|
|
20
|
+
const resolved = await auth.resolve(toWebRequest(this));
|
|
21
|
+
const reply = this[kReply];
|
|
22
|
+
if (resolved.cookies.length > 0 && reply) reply.header("set-cookie", resolved.cookies);
|
|
23
|
+
return resolved.session;
|
|
24
|
+
})();
|
|
25
|
+
return self[kSession];
|
|
26
|
+
});
|
|
27
|
+
app.addHook("onRequest", async (req, reply) => {
|
|
28
|
+
;
|
|
29
|
+
req[kReply] = reply;
|
|
30
|
+
});
|
|
31
|
+
app.decorate("requireSession", async function(request, reply) {
|
|
32
|
+
if (await request.cauthy() === null) {
|
|
33
|
+
await reply.code(401).header("x-cauthy-session", "none").send({ error: "unauthenticated" });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const serve = async (req, reply) => {
|
|
37
|
+
const res = await auth.handler(toWebRequest(req));
|
|
38
|
+
reply.code(res.status);
|
|
39
|
+
res.headers.forEach((value, name) => {
|
|
40
|
+
if (name !== "set-cookie") reply.header(name, value);
|
|
41
|
+
});
|
|
42
|
+
const cookies = res.headers.getSetCookie();
|
|
43
|
+
if (cookies.length > 0) reply.header("set-cookie", cookies);
|
|
44
|
+
return reply.send(res.body === null ? null : Buffer.from(await res.arrayBuffer()));
|
|
45
|
+
};
|
|
46
|
+
app.route({ method: ["GET", "POST"], url: `${base}/*`, handler: serve });
|
|
47
|
+
};
|
|
48
|
+
plugin[/* @__PURE__ */ Symbol.for("skip-override")] = true;
|
|
49
|
+
plugin[/* @__PURE__ */ Symbol.for("fastify.display-name")] = "cauthy-auth";
|
|
50
|
+
var cauthyFastify = plugin;
|
|
51
|
+
var fastify_default = plugin;
|
|
52
|
+
export {
|
|
53
|
+
cauthyFastify,
|
|
54
|
+
fastify_default as default
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=fastify.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fastify.ts"],"sourcesContent":["// Fastify: the routes, and who is signed in on every request.\n//\n// await app.register(cauthyFastify, { auth })\n//\n// app.get('/api/me', async (req, reply) => {\n// const session = await req.cauthy()\n// if (!session) return reply.code(401).send({ error: 'unauthenticated' })\n// return session.user\n// })\n//\n// app.get('/api/books', { preHandler: app.requireSession }, async (req) => { … })\n//\n// Here a session that needs renewing is renewed on the spot: Fastify has the\n// reply in hand, so the new cookie always goes back.\n\nimport type { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest } from 'fastify'\nimport type { Cauthy } from './cauthy'\nimport type { Session } from './types'\n\ndeclare module 'fastify' {\n interface FastifyRequest {\n /** Who is signed in, or null. Asked once per request. */\n cauthy(): Promise<Session | null>\n }\n interface FastifyInstance {\n /** A preHandler that answers 401 unless somebody is signed in. */\n requireSession(request: FastifyRequest, reply: FastifyReply): Promise<void>\n }\n}\n\nexport interface CauthyFastifyOptions {\n auth: Cauthy\n}\n\nfunction originOf(req: FastifyRequest): string {\n return `${req.protocol}://${req.headers.host ?? 'localhost'}`\n}\n\nfunction toWebRequest(req: FastifyRequest): Request {\n const headers = new Headers()\n for (const [k, v] of Object.entries(req.headers)) {\n if (Array.isArray(v)) for (const one of v) headers.append(k, one)\n else if (v !== undefined) headers.set(k, v)\n }\n // The routes read no body: what they need is in the URL and the cookies.\n return new Request(new URL(req.url, originOf(req)), { method: req.method, headers })\n}\n\nconst kSession = Symbol('cauthy.session')\nconst kReply = Symbol('cauthy.reply')\n\nconst plugin: FastifyPluginAsync<CauthyFastifyOptions> = async (app: FastifyInstance, { auth }) => {\n const base = auth.options.basePath\n\n app.decorateRequest('cauthy', async function (this: FastifyRequest): Promise<Session | null> {\n const self = this as FastifyRequest & { [kSession]?: Promise<Session | null> }\n self[kSession] ??= (async () => {\n const resolved = await auth.resolve(toWebRequest(this))\n // Set through the raw response so the cookie leaves whatever the route\n // answers with, even an error.\n const reply = (this as FastifyRequest & { [kReply]?: FastifyReply })[kReply]\n if (resolved.cookies.length > 0 && reply) reply.header('set-cookie', resolved.cookies)\n return resolved.session\n })()\n return self[kSession]\n })\n\n app.addHook('onRequest', async (req, reply) => {\n ;(req as FastifyRequest & { [kReply]?: FastifyReply })[kReply] = reply\n })\n\n app.decorate('requireSession', async function (request: FastifyRequest, reply: FastifyReply): Promise<void> {\n if ((await request.cauthy()) === null) {\n await reply.code(401).header('x-cauthy-session', 'none').send({ error: 'unauthenticated' })\n }\n })\n\n const serve = async (req: FastifyRequest, reply: FastifyReply) => {\n const res = await auth.handler(toWebRequest(req))\n reply.code(res.status)\n res.headers.forEach((value, name) => {\n if (name !== 'set-cookie') reply.header(name, value)\n })\n const cookies = res.headers.getSetCookie()\n if (cookies.length > 0) reply.header('set-cookie', cookies)\n return reply.send(res.body === null ? null : Buffer.from(await res.arrayBuffer()))\n }\n app.route({ method: ['GET', 'POST'], url: `${base}/*`, handler: serve })\n}\n\n\n// Outside encapsulation: `req.cauthy()` and `requireSession` are for the whole\n// application, not only for routes registered beside this plugin.\n;(plugin as unknown as Record<symbol, boolean>)[Symbol.for('skip-override')] = true\n;(plugin as unknown as Record<symbol, unknown>)[Symbol.for('fastify.display-name')] = 'cauthy-auth'\n\nexport const cauthyFastify = plugin\nexport default plugin\n"],"mappings":";AAkCA,SAAS,SAAS,KAA6B;AAC7C,SAAO,GAAG,IAAI,QAAQ,MAAM,IAAI,QAAQ,QAAQ,WAAW;AAC7D;AAEA,SAAS,aAAa,KAA8B;AAClD,QAAM,UAAU,IAAI,QAAQ;AAC5B,aAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,IAAI,OAAO,GAAG;AAChD,QAAI,MAAM,QAAQ,CAAC,EAAG,YAAW,OAAO,EAAG,SAAQ,OAAO,GAAG,GAAG;AAAA,aACvD,MAAM,OAAW,SAAQ,IAAI,GAAG,CAAC;AAAA,EAC5C;AAEA,SAAO,IAAI,QAAQ,IAAI,IAAI,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,QAAQ,IAAI,QAAQ,QAAQ,CAAC;AACrF;AAEA,IAAM,WAAW,uBAAO,gBAAgB;AACxC,IAAM,SAAS,uBAAO,cAAc;AAEpC,IAAM,SAAmD,OAAO,KAAsB,EAAE,KAAK,MAAM;AACjG,QAAM,OAAO,KAAK,QAAQ;AAE1B,MAAI,gBAAgB,UAAU,iBAA+D;AAC3F,UAAM,OAAO;AACb,SAAK,QAAQ,OAAO,YAAY;AAC9B,YAAM,WAAW,MAAM,KAAK,QAAQ,aAAa,IAAI,CAAC;AAGtD,YAAM,QAAS,KAAsD,MAAM;AAC3E,UAAI,SAAS,QAAQ,SAAS,KAAK,MAAO,OAAM,OAAO,cAAc,S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ions, J as JsonValue, P as PublicSession, S as Session, b as SessionOrganization, c as SessionStatus, d as SessionUser } from './types-BwCjBn-K.mjs';
|
|
3
|
+
export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, pushTheme, themeFromStackmyth } from './theme.mjs';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { C as Cauthy, R as Resolved, c as createCauthy } from './cauthy-By2cryXN.js';
|
|
2
|
+
export { C as CauthyConfigError, a as CauthyOptions, J as JsonValue, P as PublicSession, S as Session, b as SessionOrganization, c as SessionStatus, d as SessionUser } from './types-BwCjBn-K.js';
|
|
3
|
+
export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, pushTheme, themeFromStackmyth } from './theme.js';
|