@cancia/astro 0.11.0 → 0.12.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/dist/chunk-4PYVIIOO.js +25 -0
- package/dist/{chunk-GD37XVES.js → chunk-5R3I5RLT.js} +6 -8
- package/dist/chunk-6GUOGDWO.js +172 -0
- package/dist/chunk-DEI3FBNY.js +65 -0
- package/dist/{chunk-T2GDBQJ7.js → chunk-DOFLZ7KG.js} +5 -6
- package/dist/{chunk-GJIX7MWC.js → chunk-ECPYHIAW.js} +9 -1
- package/dist/{chunk-TUZNTXZR.js → chunk-R7VA3Z5N.js} +8 -2
- package/dist/{chunk-ZPXMPLQU.js → chunk-VF3EXXEM.js} +130 -7
- package/dist/chunk-XZCXWILA.js +145 -0
- package/dist/{upload-DwCGjXbz.d.ts → email-BRK4WAO2.d.ts} +9 -1
- package/dist/endpoints/auth-callback.d.ts +1 -0
- package/dist/endpoints/auth-callback.js +9 -0
- package/dist/endpoints/auth-logout.d.ts +1 -0
- package/dist/endpoints/auth-logout.js +9 -0
- package/dist/endpoints/auth-request.d.ts +18 -0
- package/dist/endpoints/auth-request.js +9 -0
- package/dist/endpoints/auth-session.d.ts +1 -0
- package/dist/endpoints/auth-session.js +9 -0
- package/dist/endpoints/auth.js +10 -2
- package/dist/endpoints/content.js +12 -12
- package/dist/endpoints/lists.js +4 -1
- package/dist/endpoints/publish.js +8 -6
- package/dist/endpoints/schemas.js +5 -2
- package/dist/endpoints/upload.js +7 -6
- package/dist/{git-backed-DtiH52EI.d.ts → git-backed-CwTFfUS4.d.ts} +2 -2
- package/dist/{github-client-Db0pIrqE.d.ts → github-client-Db5EPcSL.d.ts} +1 -1
- package/dist/index.d.ts +32 -6
- package/dist/index.js +117 -27
- package/dist/loader/index.d.ts +12 -2
- package/dist/loader/index.js +1 -1
- package/dist/runtime.d.ts +69 -3
- package/dist/runtime.js +3 -1
- package/dist/storage/index.d.ts +4 -4
- package/dist/{types-BMlLS-OS.d.ts → types-CKzfz5iu.d.ts} +1 -1
- package/package.json +1 -1
package/dist/runtime.d.ts
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UploadHandler } from './
|
|
3
|
-
import {
|
|
1
|
+
import { d as CanciaStorage, C as CanciaStorageV2 } from './types-CKzfz5iu.js';
|
|
2
|
+
import { S as SendLoginEmail, U as UploadHandler } from './email-BRK4WAO2.js';
|
|
3
|
+
import { b as GitHubCommitter } from './github-client-Db5EPcSL.js';
|
|
4
|
+
|
|
5
|
+
/** A live browser session. `id` is the SHA-256 hash of the cookie value. */
|
|
6
|
+
interface SessionRecord {
|
|
7
|
+
/** Hash of the session secret — never the secret itself. */
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
}
|
|
13
|
+
/** A pending, single-use login link. `hash` is the SHA-256 of the emailed token. */
|
|
14
|
+
interface LoginTokenRecord {
|
|
15
|
+
hash: string;
|
|
16
|
+
email: string;
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
}
|
|
19
|
+
interface CanciaAuthStore {
|
|
20
|
+
/** Replace the allow-list with exactly these addresses. Called on boot. */
|
|
21
|
+
seedEditors(site: string, emails: string[]): Promise<void>;
|
|
22
|
+
/** Is this address allowed to sign in? */
|
|
23
|
+
isEditor(site: string, email: string): Promise<boolean>;
|
|
24
|
+
createLoginToken(site: string, rec: LoginTokenRecord): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Atomically redeem a login token: return it and delete it in one step, so
|
|
27
|
+
* two concurrent redemptions of the same link cannot both succeed.
|
|
28
|
+
* Returns null when the hash is unknown (already used, or never existed).
|
|
29
|
+
*/
|
|
30
|
+
consumeLoginToken(site: string, hash: string): Promise<LoginTokenRecord | null>;
|
|
31
|
+
createSession(site: string, rec: SessionRecord): Promise<void>;
|
|
32
|
+
getSession(site: string, id: string): Promise<SessionRecord | null>;
|
|
33
|
+
/** Push a session's expiry out — the sliding half of the window. */
|
|
34
|
+
touchSession(site: string, id: string, expiresAt: string): Promise<void>;
|
|
35
|
+
deleteSession(site: string, id: string): Promise<void>;
|
|
36
|
+
/** Drop expired tokens and sessions. Best-effort housekeeping. */
|
|
37
|
+
purgeExpired(site: string, now: string): Promise<void>;
|
|
38
|
+
}
|
|
4
39
|
|
|
5
40
|
/**
|
|
6
41
|
* The resolved publish mode (034). One of:
|
|
@@ -35,6 +70,23 @@ interface CanciaRuntime {
|
|
|
35
70
|
/** All configured locales, in order with defaultLocale first. */
|
|
36
71
|
locales: string[];
|
|
37
72
|
secret: string | undefined;
|
|
73
|
+
/** Site identifier — scopes auth rows, as it scopes content rows. */
|
|
74
|
+
site: string;
|
|
75
|
+
/**
|
|
76
|
+
* Magic-link auth (042). Undefined when the site has no `editors`, which is
|
|
77
|
+
* the pre-042 world where the bearer token is the only credential. Every
|
|
78
|
+
* caller reads `undefined` as "bearer only", so no separate flag is needed.
|
|
79
|
+
*/
|
|
80
|
+
auth: {
|
|
81
|
+
store: CanciaAuthStore;
|
|
82
|
+
site: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Custom login-email sender. Not baked (it is a function): supplied by the
|
|
86
|
+
* dev hook, and undefined in a fresh SSR process, where the sender is
|
|
87
|
+
* resolved from env instead.
|
|
88
|
+
*/
|
|
89
|
+
sendLoginEmail?: SendLoginEmail;
|
|
38
90
|
uploadHandler: UploadHandler;
|
|
39
91
|
deployHook: string | undefined;
|
|
40
92
|
/**
|
|
@@ -97,6 +149,19 @@ interface BakedR2Config {
|
|
|
97
149
|
}
|
|
98
150
|
interface BakedConfig {
|
|
99
151
|
projectRoot: string;
|
|
152
|
+
/** Site identifier. Non-secret. */
|
|
153
|
+
site?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Addresses allowed to sign in (042). Non-secret — an allow-list is not a
|
|
156
|
+
* credential, and the client needs to know whether to show the login box.
|
|
157
|
+
*/
|
|
158
|
+
editors?: string[];
|
|
159
|
+
/**
|
|
160
|
+
* Where the auth tables live. Same file as the content DB; kept as its own
|
|
161
|
+
* field because a json-file content site still needs somewhere to put
|
|
162
|
+
* sessions, and that somewhere is a sqlite file.
|
|
163
|
+
*/
|
|
164
|
+
authDbPath?: string;
|
|
100
165
|
schemasPath: string | undefined;
|
|
101
166
|
defaultLocale: string;
|
|
102
167
|
locales: string[];
|
|
@@ -154,6 +219,7 @@ declare function setCanciaRuntime(runtime: CanciaRuntime): void;
|
|
|
154
219
|
* vitest's vi.resetModules() (its singletons would otherwise leak across cases).
|
|
155
220
|
*/
|
|
156
221
|
declare function __resetRuntimeForTests(): void;
|
|
222
|
+
|
|
157
223
|
declare function getCanciaRuntime(): CanciaRuntime;
|
|
158
224
|
|
|
159
225
|
export { type BakedConfig, type BakedR2Config, type BakedStorageDescriptor, type CanciaRuntime, type PublishMode, __resetRuntimeForTests, getCanciaRuntime, setBakedConfig, setCanciaRuntime };
|
package/dist/runtime.js
CHANGED
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
getCanciaRuntime,
|
|
4
4
|
setBakedConfig,
|
|
5
5
|
setCanciaRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VF3EXXEM.js";
|
|
7
7
|
import "./chunk-RHFTQW4W.js";
|
|
8
|
+
import "./chunk-4PYVIIOO.js";
|
|
9
|
+
import "./chunk-6GUOGDWO.js";
|
|
8
10
|
import "./chunk-XINNLVZP.js";
|
|
9
11
|
import "./chunk-U7V53JX7.js";
|
|
10
12
|
import "./chunk-S5YLB6P3.js";
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as Rev } from '../types-
|
|
2
|
-
export {
|
|
3
|
-
export { G as GitBackedContentPaths, a as GitBackedControls, b as GitBackedOptions, c as GitBackedStorage, S as SqliteV2Options, d as closeSqliteAdapterV2, e as createGitBackedAdapter, f as createJsonFileAdapter, g as createJsonFileAdapterV2, h as createSQLiteAdapter, i as createSqliteAdapterV2 } from '../git-backed-
|
|
4
|
-
export { C as CommitFile,
|
|
1
|
+
import { R as Rev } from '../types-CKzfz5iu.js';
|
|
2
|
+
export { a as CanciaKVStore, b as CanciaListStore, c as CanciaPageStore, d as CanciaStorage, C as CanciaStorageV2, L as ListEntry, P as PageMeta, e as PageRecord, f as PageSEO, g as RevConflictError } from '../types-CKzfz5iu.js';
|
|
3
|
+
export { G as GitBackedContentPaths, a as GitBackedControls, b as GitBackedOptions, c as GitBackedStorage, S as SqliteV2Options, d as closeSqliteAdapterV2, e as createGitBackedAdapter, f as createJsonFileAdapter, g as createJsonFileAdapterV2, h as createSQLiteAdapter, i as createSqliteAdapterV2 } from '../git-backed-CwTFfUS4.js';
|
|
4
|
+
export { C as CommitFile, G as GitHubClient, a as GitHubClientOptions, b as GitHubCommitter, c as createGitHubClient } from '../github-client-Db5EPcSL.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Canonical JSON: keys sorted alphabetically at every level. Two values that
|
|
@@ -158,4 +158,4 @@ interface CanciaStorageV2 {
|
|
|
158
158
|
lists: CanciaListStore;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
export { type
|
|
161
|
+
export { type CanciaStorageV2 as C, type ListEntry as L, type PageMeta as P, type Rev as R, type CanciaKVStore as a, type CanciaListStore as b, type CanciaPageStore as c, type CanciaStorage as d, type PageRecord as e, type PageSEO as f, RevConflictError as g };
|