@micacms/runtime 0.4.1 → 0.5.0-rc.1
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 +2 -2
- package/dist/app.d.ts +8 -37
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +7 -42
- package/dist/app.js.map +1 -1
- package/dist/config.d.ts +12 -82
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -82
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +37 -66
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +24 -75
- package/dist/context.js.map +1 -1
- package/dist/http.d.ts +8 -16
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +6 -13
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +13 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/routes/admin-content.d.ts +4 -17
- package/dist/routes/admin-content.d.ts.map +1 -1
- package/dist/routes/admin-content.js +11 -51
- package/dist/routes/admin-content.js.map +1 -1
- package/dist/routes/admin-media.d.ts +3 -14
- package/dist/routes/admin-media.d.ts.map +1 -1
- package/dist/routes/admin-media.js +7 -29
- package/dist/routes/admin-media.js.map +1 -1
- package/dist/routes/admin-staging.d.ts +4 -9
- package/dist/routes/admin-staging.d.ts.map +1 -1
- package/dist/routes/admin-staging.js +31 -18
- package/dist/routes/admin-staging.js.map +1 -1
- package/dist/routes/admin-system.d.ts +2 -8
- package/dist/routes/admin-system.d.ts.map +1 -1
- package/dist/routes/admin-system.js +9 -44
- package/dist/routes/admin-system.js.map +1 -1
- package/dist/routes/health.d.ts +3 -10
- package/dist/routes/health.d.ts.map +1 -1
- package/dist/routes/health.js +9 -26
- package/dist/routes/health.js.map +1 -1
- package/dist/schema.d.ts +10 -38
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +14 -65
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +2 -10
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -9
- package/dist/server.js.map +1 -1
- package/dist/services/changes.d.ts +150 -0
- package/dist/services/changes.d.ts.map +1 -0
- package/dist/services/changes.js +339 -0
- package/dist/services/changes.js.map +1 -0
- package/dist/services/content-store.d.ts +61 -0
- package/dist/services/content-store.d.ts.map +1 -0
- package/dist/services/content-store.js +330 -0
- package/dist/services/content-store.js.map +1 -0
- package/dist/services/media.d.ts +9 -29
- package/dist/services/media.d.ts.map +1 -1
- package/dist/services/media.js +17 -57
- package/dist/services/media.js.map +1 -1
- package/dist/services/staging.d.ts +35 -167
- package/dist/services/staging.d.ts.map +1 -1
- package/dist/services/staging.js +195 -458
- package/dist/services/staging.js.map +1 -1
- package/dist/workspace/developer.d.ts +14 -0
- package/dist/workspace/developer.d.ts.map +1 -0
- package/dist/workspace/developer.js +31 -0
- package/dist/workspace/developer.js.map +1 -0
- package/dist/workspace/files.d.ts +70 -0
- package/dist/workspace/files.d.ts.map +1 -0
- package/dist/workspace/files.js +176 -0
- package/dist/workspace/files.js.map +1 -0
- package/dist/workspace/git.d.ts +45 -0
- package/dist/workspace/git.d.ts.map +1 -0
- package/dist/workspace/git.js +68 -0
- package/dist/workspace/git.js.map +1 -0
- package/dist/workspace/locks.d.ts +33 -0
- package/dist/workspace/locks.d.ts.map +1 -0
- package/dist/workspace/locks.js +76 -0
- package/dist/workspace/locks.js.map +1 -0
- package/dist/workspace/policy.d.ts +92 -0
- package/dist/workspace/policy.d.ts.map +1 -0
- package/dist/workspace/policy.js +7 -0
- package/dist/workspace/policy.js.map +1 -0
- package/dist/workspace/tree.d.ts +73 -0
- package/dist/workspace/tree.d.ts.map +1 -0
- package/dist/workspace/tree.js +229 -0
- package/dist/workspace/tree.js.map +1 -0
- package/package.json +2 -3
- package/dist/db/driver.d.ts +0 -35
- package/dist/db/driver.d.ts.map +0 -1
- package/dist/db/driver.js +0 -95
- package/dist/db/driver.js.map +0 -1
- package/dist/lib/git.d.ts +0 -29
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js +0 -62
- package/dist/lib/git.js.map +0 -1
- package/dist/services/staging-local.d.ts +0 -58
- package/dist/services/staging-local.d.ts.map +0 -1
- package/dist/services/staging-local.js +0 -391
- package/dist/services/staging-local.js.map +0 -1
package/dist/context.d.ts
CHANGED
|
@@ -1,62 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Everything is constructed here and passed down explicitly — no module-level
|
|
6
|
-
* singletons, no service locator. The composing app builds the connector and,
|
|
7
|
-
* where one exists, the draft store and the database; the runtime receives
|
|
8
|
-
* them and never asks where they came from. That is what keeps this package
|
|
9
|
-
* authentication-neutral and database-free on a developer's machine: the
|
|
10
|
-
* local editor simply never hands it either.
|
|
2
|
+
* Builds the runtime's services for one site, with no module-level singletons.
|
|
3
|
+
* The app supplies the working tree's files and the owner policy, so the
|
|
4
|
+
* runtime stays authentication-neutral.
|
|
11
5
|
*/
|
|
12
|
-
import {
|
|
13
|
-
import type { DraftStore, RepositoryConnector, Site } from "@micacms/core";
|
|
6
|
+
import type { Site } from "@micacms/core";
|
|
14
7
|
import type { RuntimeConfig } from "./config.js";
|
|
15
8
|
import { type Logger } from "./lib/logger.js";
|
|
16
9
|
import { type RateLimiter } from "./lib/rate-limit.js";
|
|
17
10
|
import { type MediaService } from "./services/media.js";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* means several processes.
|
|
26
|
-
*/
|
|
11
|
+
import type { ContentStagingService } from "./services/changes.js";
|
|
12
|
+
import { type ContentStore } from "./services/content-store.js";
|
|
13
|
+
import { type WorkspaceLocks } from "./workspace/locks.js";
|
|
14
|
+
import type { OwnerPolicy } from "./workspace/policy.js";
|
|
15
|
+
import type { ContentFiles } from "./workspace/files.js";
|
|
16
|
+
import type { GitTree } from "./workspace/tree.js";
|
|
17
|
+
/** The one site this process serves. Several sites means several processes. */
|
|
27
18
|
export interface SiteContext {
|
|
28
|
-
/** Identifies this site in logs.
|
|
19
|
+
/** Identifies this site in logs. */
|
|
29
20
|
id: string;
|
|
30
21
|
/** The content model, read from the repository at startup. */
|
|
31
22
|
model: Site;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
* staged overlay — saves land in the draft, and only the staging service's
|
|
35
|
-
* Publish reaches the repository itself.
|
|
36
|
-
*/
|
|
37
|
-
contentRepository: RepositoryConnector;
|
|
23
|
+
/** The working tree's files behind the workspace locks. Only Publish makes a commit. */
|
|
24
|
+
contentRepository: ContentFiles;
|
|
38
25
|
/**
|
|
39
26
|
* Revision of `.mica/schema.json` when the model was loaded. The publish
|
|
40
|
-
* drift gate compares against it
|
|
27
|
+
* drift gate compares against it.
|
|
41
28
|
*/
|
|
42
29
|
schemaRevision: string | null;
|
|
43
30
|
}
|
|
44
31
|
export declare const DEFAULT_SITE_ID = "default";
|
|
45
|
-
/**
|
|
46
|
-
* What the composing app wants the System page to say about itself — the
|
|
47
|
-
* facts the runtime cannot know because they belong to the composition:
|
|
48
|
-
* whether there is a database, how this deployment authenticates, and which
|
|
49
|
-
* rule admits people.
|
|
50
|
-
*/
|
|
32
|
+
/** Facts about the composition that the System page shows and the runtime cannot know. */
|
|
51
33
|
export interface OperationalInfo {
|
|
52
34
|
/** How this deployment authenticates, in words. */
|
|
53
35
|
auth: string;
|
|
54
|
-
/** Null where there is no database, which is the local editor's answer. */
|
|
55
|
-
database: {
|
|
56
|
-
path: string;
|
|
57
|
-
version: number;
|
|
58
|
-
bytes: number | null;
|
|
59
|
-
} | null;
|
|
60
36
|
/** What decides who may edit, in the operator's own words. */
|
|
61
37
|
admission?: string;
|
|
62
38
|
dataDir?: string;
|
|
@@ -65,6 +41,17 @@ export interface OperationalInfo {
|
|
|
65
41
|
/** Names of the secrets this process generated for itself. */
|
|
66
42
|
generatedSecrets?: string[];
|
|
67
43
|
}
|
|
44
|
+
/** What /ready asks the composition. */
|
|
45
|
+
export interface RuntimeHealth {
|
|
46
|
+
/**
|
|
47
|
+
* Whether the site can be edited, with short reason codes. Never names the
|
|
48
|
+
* repository: the endpoint is public.
|
|
49
|
+
*/
|
|
50
|
+
ready?: () => {
|
|
51
|
+
ok: boolean;
|
|
52
|
+
reasons: string[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
68
55
|
export interface RuntimeContext {
|
|
69
56
|
config: RuntimeConfig;
|
|
70
57
|
site: SiteContext;
|
|
@@ -77,44 +64,28 @@ export interface RuntimeContext {
|
|
|
77
64
|
limiters: {
|
|
78
65
|
api: RateLimiter;
|
|
79
66
|
};
|
|
80
|
-
/** App-supplied: what the System page says about the composition. */
|
|
81
67
|
operational(): OperationalInfo;
|
|
82
|
-
|
|
83
|
-
health: {
|
|
84
|
-
database?: () => void;
|
|
85
|
-
};
|
|
86
|
-
/** Releases timers, and whatever the app added on top. */
|
|
68
|
+
health: RuntimeHealth;
|
|
87
69
|
shutdown(): Promise<void>;
|
|
88
70
|
}
|
|
89
71
|
export interface CreateRuntimeContextOptions {
|
|
90
72
|
config: RuntimeConfig;
|
|
91
73
|
model: Site;
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Where saves accumulate when the repository is remote. Absent means the
|
|
96
|
-
* working tree is the draft workspace — the local editor, or a self-hosted
|
|
97
|
-
* deployment with a checkout beside it.
|
|
98
|
-
*/
|
|
99
|
-
drafts?: DraftStore;
|
|
74
|
+
/** The working tree's files, without locks. The app builds it. */
|
|
75
|
+
files: ContentFiles;
|
|
100
76
|
/** Revision of the manifest the model was read from. Null when unknown. */
|
|
101
77
|
schemaRevision?: string | null;
|
|
102
78
|
siteId?: string;
|
|
103
79
|
logger?: Logger;
|
|
104
80
|
operational?: () => OperationalInfo;
|
|
105
|
-
health?:
|
|
106
|
-
|
|
107
|
-
|
|
81
|
+
health?: RuntimeHealth;
|
|
82
|
+
/** Who owns the working tree. Defaults to the developer. */
|
|
83
|
+
policy?: OwnerPolicy;
|
|
84
|
+
/** Shared with the owner's own work on the tree, such as a sync. */
|
|
85
|
+
locks?: WorkspaceLocks;
|
|
86
|
+
/** See `WorkingTreeStagingDeps.tree`. */
|
|
87
|
+
tree?: GitTree;
|
|
108
88
|
onShutdown?: () => void | Promise<void>;
|
|
109
89
|
}
|
|
110
90
|
export declare function createRuntimeContext(options: CreateRuntimeContextOptions): RuntimeContext;
|
|
111
|
-
/**
|
|
112
|
-
* The one place that decides how Mica reaches a configured content
|
|
113
|
-
* repository. Every mode produces the same interface, so nothing downstream
|
|
114
|
-
* can tell which one it got.
|
|
115
|
-
*
|
|
116
|
-
* The local editor does not call this — it *is* the local connector — but the
|
|
117
|
-
* self-hosted app serves whichever repository its environment names.
|
|
118
|
-
*/
|
|
119
|
-
export declare function createConnector(config: RuntimeConfig): RepositoryConnector;
|
|
120
91
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAAqC,KAAK,cAAc,EAAE,M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AClB,CAAC;IACF,WAAW,IAAI,eAAe,CAAC;IAC/B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,IAAI,CAAC;IACZ,kEAAkE;IAClE,KAAK,EAAE,YAAY,CAAC;IACpB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,eAAe,CAAC;IACpC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oEAAoE;IACpE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,yCAAyC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,cAAc,CA8DzF"}
|
package/dist/context.js
CHANGED
|
@@ -1,60 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Everything is constructed here and passed down explicitly — no module-level
|
|
6
|
-
* singletons, no service locator. The composing app builds the connector and,
|
|
7
|
-
* where one exists, the draft store and the database; the runtime receives
|
|
8
|
-
* them and never asks where they came from. That is what keeps this package
|
|
9
|
-
* authentication-neutral and database-free on a developer's machine: the
|
|
10
|
-
* local editor simply never hands it either.
|
|
2
|
+
* Builds the runtime's services for one site, with no module-level singletons.
|
|
3
|
+
* The app supplies the working tree's files and the owner policy, so the
|
|
4
|
+
* runtime stays authentication-neutral.
|
|
11
5
|
*/
|
|
12
|
-
import { createContentStore, githubConnector, gitlabConnector, localConnector, stagedConnector, } from "@micacms/connectors";
|
|
13
6
|
import { createLogger } from "./lib/logger.js";
|
|
14
7
|
import { createRateLimiter } from "./lib/rate-limit.js";
|
|
15
8
|
import { createMediaService } from "./services/media.js";
|
|
16
|
-
import {
|
|
17
|
-
import { createWorkingTreeStagingService } from "./services/staging
|
|
9
|
+
import { createContentStore } from "./services/content-store.js";
|
|
10
|
+
import { createWorkingTreeStagingService } from "./services/staging.js";
|
|
11
|
+
import { createWorkspaceLocks, lockedFiles } from "./workspace/locks.js";
|
|
18
12
|
export const DEFAULT_SITE_ID = "default";
|
|
19
13
|
export function createRuntimeContext(options) {
|
|
20
|
-
const { config, model
|
|
14
|
+
const { config, model } = options;
|
|
21
15
|
const logger = options.logger ??
|
|
22
16
|
createLogger({
|
|
23
17
|
level: config.LOG_LEVEL,
|
|
24
18
|
pretty: !config.isProduction,
|
|
25
19
|
});
|
|
26
20
|
const schemaRevision = options.schemaRevision ?? null;
|
|
21
|
+
// Services write through the lock wrapper; staging takes the locks itself.
|
|
22
|
+
const locks = options.locks ?? createWorkspaceLocks();
|
|
27
23
|
const site = {
|
|
28
24
|
id: options.siteId ?? DEFAULT_SITE_ID,
|
|
29
25
|
model,
|
|
30
|
-
contentRepository:
|
|
26
|
+
contentRepository: lockedFiles(options.files, locks.tree),
|
|
31
27
|
schemaRevision,
|
|
32
28
|
};
|
|
33
29
|
const services = {
|
|
34
30
|
content: createContentStore(model, site.contentRepository),
|
|
35
31
|
media: createMediaService({
|
|
36
|
-
|
|
32
|
+
files: site.contentRepository,
|
|
37
33
|
maxBytes: config.MAX_UPLOAD_BYTES,
|
|
38
34
|
}),
|
|
39
|
-
staging:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
contentRoot: config.contentRoot,
|
|
51
|
-
schemaRevision,
|
|
52
|
-
publishEnabled: config.MICA_LOCAL_PUBLISH,
|
|
53
|
-
logger,
|
|
54
|
-
}),
|
|
35
|
+
staging: createWorkingTreeStagingService({
|
|
36
|
+
model,
|
|
37
|
+
files: options.files,
|
|
38
|
+
contentRoot: config.contentRoot,
|
|
39
|
+
schemaRevision,
|
|
40
|
+
publishEnabled: config.MICA_LOCAL_PUBLISH,
|
|
41
|
+
logger,
|
|
42
|
+
locks,
|
|
43
|
+
...(options.policy ? { policy: options.policy } : {}),
|
|
44
|
+
...(options.tree ? { tree: options.tree } : {}),
|
|
45
|
+
}),
|
|
55
46
|
};
|
|
56
47
|
const limiters = {
|
|
57
|
-
// Generous:
|
|
48
|
+
// Generous: it stops runaway scripts, it does not shape traffic.
|
|
58
49
|
api: createRateLimiter({ limit: 600, windowMs: 60_000 }),
|
|
59
50
|
};
|
|
60
51
|
return {
|
|
@@ -64,7 +55,7 @@ export function createRuntimeContext(options) {
|
|
|
64
55
|
services,
|
|
65
56
|
limiters,
|
|
66
57
|
operational: options.operational ??
|
|
67
|
-
(() => ({ auth: "unspecified"
|
|
58
|
+
(() => ({ auth: "unspecified" })),
|
|
68
59
|
health: options.health ?? {},
|
|
69
60
|
async shutdown() {
|
|
70
61
|
limiters.api.stop();
|
|
@@ -72,46 +63,4 @@ export function createRuntimeContext(options) {
|
|
|
72
63
|
},
|
|
73
64
|
};
|
|
74
65
|
}
|
|
75
|
-
/**
|
|
76
|
-
* The one place that decides how Mica reaches a configured content
|
|
77
|
-
* repository. Every mode produces the same interface, so nothing downstream
|
|
78
|
-
* can tell which one it got.
|
|
79
|
-
*
|
|
80
|
-
* The local editor does not call this — it *is* the local connector — but the
|
|
81
|
-
* self-hosted app serves whichever repository its environment names.
|
|
82
|
-
*/
|
|
83
|
-
export function createConnector(config) {
|
|
84
|
-
const author = { name: "Mica CMS", email: "mica@localhost" };
|
|
85
|
-
const require = (value, what) => {
|
|
86
|
-
if (!value) {
|
|
87
|
-
throw new Error(`REPOSITORY is "${config.REPOSITORY}" but ${what} is not set.`);
|
|
88
|
-
}
|
|
89
|
-
return value;
|
|
90
|
-
};
|
|
91
|
-
switch (config.REPOSITORY) {
|
|
92
|
-
case "github": {
|
|
93
|
-
const project = require(config.REPOSITORY_PROJECT, "REPOSITORY_PROJECT");
|
|
94
|
-
return githubConnector({
|
|
95
|
-
owner: project.split("/")[0],
|
|
96
|
-
repo: project.split("/").slice(1).join("/"),
|
|
97
|
-
branch: config.REPOSITORY_BRANCH,
|
|
98
|
-
root: config.REPOSITORY_ROOT,
|
|
99
|
-
token: require(config.REPOSITORY_TOKEN, "REPOSITORY_TOKEN"),
|
|
100
|
-
apiBase: config.REPOSITORY_API_BASE,
|
|
101
|
-
author,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
case "gitlab":
|
|
105
|
-
return gitlabConnector({
|
|
106
|
-
project: require(config.REPOSITORY_PROJECT, "REPOSITORY_PROJECT"),
|
|
107
|
-
branch: config.REPOSITORY_BRANCH,
|
|
108
|
-
root: config.REPOSITORY_ROOT,
|
|
109
|
-
token: require(config.REPOSITORY_TOKEN, "REPOSITORY_TOKEN"),
|
|
110
|
-
apiBase: config.REPOSITORY_API_BASE,
|
|
111
|
-
author,
|
|
112
|
-
});
|
|
113
|
-
case "local":
|
|
114
|
-
return localConnector({ root: config.contentRoot });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
66
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAqB,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;YACN,KAAK;YACL,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChD,CAAC;KACH,CAAC;IAEF,MAAM,QAAQ,GAAG;QACf,iEAAiE;QACjE,GAAG,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;KACzD,CAAC;IAEF,OAAO;QACL,MAAM;QACN,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,WAAW,EACT,OAAO,CAAC,WAAW;YACnB,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;QACnC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;QAE5B,KAAK,CAAC,QAAQ;YACZ,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared HTTP types and small request helpers.
|
|
3
|
-
*/
|
|
4
1
|
import type { Context } from "hono";
|
|
5
2
|
import type { AccessContext } from "@micacms/core";
|
|
6
3
|
import type { RuntimeContext } from "./context.js";
|
|
@@ -11,31 +8,26 @@ export interface Env {
|
|
|
11
8
|
logger: Logger;
|
|
12
9
|
requestId: string;
|
|
13
10
|
/**
|
|
14
|
-
* Who this request acts as.
|
|
15
|
-
*
|
|
16
|
-
* therefore present on every admin route. The runtime consumes it and
|
|
17
|
-
* never produces it: which is the whole of being authentication-neutral.
|
|
11
|
+
* Who this request acts as. The auth surface's gate sets it on every admin
|
|
12
|
+
* route; the runtime never sets it.
|
|
18
13
|
*/
|
|
19
14
|
access: AccessContext;
|
|
20
15
|
};
|
|
21
16
|
}
|
|
22
17
|
/**
|
|
23
|
-
* Client IP. `X-Forwarded-For`
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* entries to its left are whatever the client sent (#149).
|
|
18
|
+
* Client IP. Reads `X-Forwarded-For` only with TRUST_PROXY, or a client could
|
|
19
|
+
* spoof its address past the rate limit. The right-most entry is the address
|
|
20
|
+
* the proxy saw; the entries to its left come from the client.
|
|
27
21
|
*/
|
|
28
22
|
export declare function clientIp(c: Context<Env>): string;
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Null in the local editor, where the connector falls back to the developer's
|
|
33
|
-
* own Git identity — which is the right name for a change made on their
|
|
34
|
-
* machine, and one Mica has no business overwriting.
|
|
24
|
+
* The commit author. Null in the local editor, where the commit keeps the
|
|
25
|
+
* developer's own Git identity.
|
|
35
26
|
*/
|
|
36
27
|
export declare function actorOf(c: Context<Env>): {
|
|
37
28
|
id: string;
|
|
38
29
|
email: string;
|
|
30
|
+
name: string;
|
|
39
31
|
} | null;
|
|
40
32
|
/** Parses a positive integer query parameter, falling back when absent. */
|
|
41
33
|
export declare function intParam(value: string | undefined, fallback: number, max: number): number;
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,GAAG;IAClB,SAAS,EAAE;QACT,GAAG,EAAE,cAAc,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB;;;WAGG;QACH,MAAM,EAAE,aAAa,CAAC;KACvB,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAWhD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAG3F;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAIzF"}
|
package/dist/http.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Client IP. `X-Forwarded-For` is only consulted when TRUST_PROXY is set —
|
|
6
|
-
* otherwise a client could spoof its own address and bypass rate limiting.
|
|
7
|
-
* Behind one proxy, the right-most entry is the address that proxy saw; the
|
|
8
|
-
* entries to its left are whatever the client sent (#149).
|
|
2
|
+
* Client IP. Reads `X-Forwarded-For` only with TRUST_PROXY, or a client could
|
|
3
|
+
* spoof its address past the rate limit. The right-most entry is the address
|
|
4
|
+
* the proxy saw; the entries to its left come from the client.
|
|
9
5
|
*/
|
|
10
6
|
export function clientIp(c) {
|
|
11
7
|
const { config } = c.get("ctx");
|
|
@@ -19,15 +15,12 @@ export function clientIp(c) {
|
|
|
19
15
|
return info?.incoming?.socket?.remoteAddress ?? "unknown";
|
|
20
16
|
}
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* Null in the local editor, where the connector falls back to the developer's
|
|
25
|
-
* own Git identity — which is the right name for a change made on their
|
|
26
|
-
* machine, and one Mica has no business overwriting.
|
|
18
|
+
* The commit author. Null in the local editor, where the commit keeps the
|
|
19
|
+
* developer's own Git identity.
|
|
27
20
|
*/
|
|
28
21
|
export function actorOf(c) {
|
|
29
22
|
const identity = c.get("access")?.identity;
|
|
30
|
-
return identity ? { id: identity.subject, email: identity.email } : null;
|
|
23
|
+
return identity ? { id: identity.subject, email: identity.email, name: identity.name } : null;
|
|
31
24
|
}
|
|
32
25
|
/** Parses a positive integer query parameter, falling back when absent. */
|
|
33
26
|
export function intParam(value, fallback, max) {
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAe;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QAClD,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACxB,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,CAAC,GAAyE,CAAC;IACzF,OAAO,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,IAAI,SAAS,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,CAAe;IACrC,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC3C,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAChG,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,QAAQ,CAAC,KAAyB,EAAE,QAAgB,EAAE,GAAW;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @micacms/runtime
|
|
3
|
-
*
|
|
4
|
-
* One Hono API over one `SiteContext`: content, media, staging and system
|
|
5
|
-
* routes, with the question "who is this request?" answered by whatever
|
|
6
|
-
* `AuthSurface` the composing app hands in. `@micacms/editor` composes it
|
|
7
|
-
* with no authentication at all behind a loopback bind; `@micacms/self-hosted`
|
|
8
|
-
* composes it behind `@micacms/auth-oidc`. This package must never import an
|
|
9
|
-
* auth implementation — that direction is what protects the local
|
|
10
|
-
* distribution.
|
|
2
|
+
* @micacms/runtime: the single-site, authentication-neutral Mica runtime.
|
|
3
|
+
* It must never import an auth implementation; the composing app supplies the `AuthSurface`.
|
|
11
4
|
*/
|
|
12
5
|
export { createApp, allowAll, type AuthSurface, type CreateAppOptions } from "./app.js";
|
|
13
|
-
export {
|
|
14
|
-
export { bool, ConfigError, deriveRuntime, describeConfigIssues, list, loadEnvFile, LOOPBACK,
|
|
6
|
+
export { createRuntimeContext, DEFAULT_SITE_ID, type CreateRuntimeContextOptions, type OperationalInfo, type RuntimeContext, type RuntimeHealth, type SiteContext, } from "./context.js";
|
|
7
|
+
export { bool, ConfigError, deriveRuntime, describeConfigIssues, list, loadEnvFile, LOOPBACK, runtimeEnv, withoutBlanks, type RuntimeConfig, type RuntimeEnv, } from "./config.js";
|
|
15
8
|
export { startServer, type StartServerOptions } from "./server.js";
|
|
16
9
|
export { actorOf, clientIp, intParam, type Env } from "./http.js";
|
|
17
10
|
export { checkSchema, loadSchema, SchemaError, schemaFingerprint, schemaOrigin } from "./schema.js";
|
|
@@ -23,9 +16,15 @@ export { createRateLimiter, type RateLimiter } from "./lib/rate-limit.js";
|
|
|
23
16
|
export { randomToken } from "./lib/id.js";
|
|
24
17
|
export { DEFAULT_BASE_URL, DEFAULT_PORT } from "./lib/ports.js";
|
|
25
18
|
export { VERSION } from "./lib/version.js";
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export { createWorkingTreeStagingService, type WorkingTreeStagingDeps, } from "./services/staging-local.js";
|
|
19
|
+
export { analyseChanges, classifyPath, describeProblems, flattenProblems, type AnnotatedChange, type ChangeOwner, type ContentStagingService, type RepositoryInfo, type PublishInput, type StagingProblem, type StagingStatus, type StagingValidation, } from "./services/changes.js";
|
|
20
|
+
export { createWorkingTreeStagingService, type WorkingTreeStagingDeps, } from "./services/staging.js";
|
|
29
21
|
export { createMediaService, formatBytes, type MediaFile, type MediaService } from "./services/media.js";
|
|
22
|
+
export { createContentStore, ContentError, ValidationError, type ContentStore, type SavedEntry, type SaveEntryInput, } from "./services/content-store.js";
|
|
23
|
+
export { checkChangePaths, ConflictError, contentFiles, FilesError, type Author, type ContentFiles, type ContentFilesOptions, type FileChange, type FileChanges, } from "./workspace/files.js";
|
|
24
|
+
export { developerEnvironment, firstLine, GitError, gitRunner, type GitCallOptions, type GitRunner, type GitRunnerOptions, } from "./workspace/git.js";
|
|
25
|
+
export { createMutex, createReadWriteLock, createWorkspaceLocks, lockedFiles, type Mutex, type ReadWriteLock, type WorkspaceLocks, } from "./workspace/locks.js";
|
|
26
|
+
export type { OwnerPolicy, PublishAvailability, RepositoryDescription, SyncConflict, SyncStatus, } from "./workspace/policy.js";
|
|
27
|
+
export { developerPolicy, type DeveloperPolicyOptions } from "./workspace/developer.js";
|
|
28
|
+
export { commitPaths, headRevision, headSource, inRepo, listTreeChanges, LITERAL, locateTree, parseStatus, recommitPaths, type GitTree, type TreeChange, } from "./workspace/tree.js";
|
|
30
29
|
export { schemaStats } from "./lib/schema-stats.js";
|
|
31
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,IAAI,EACJ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,QAAQ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,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,GACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,eAAe,EACf,OAAO,EACP,UAAU,EACV,WAAW,EACX,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @micacms/runtime
|
|
3
|
-
*
|
|
4
|
-
* One Hono API over one `SiteContext`: content, media, staging and system
|
|
5
|
-
* routes, with the question "who is this request?" answered by whatever
|
|
6
|
-
* `AuthSurface` the composing app hands in. `@micacms/editor` composes it
|
|
7
|
-
* with no authentication at all behind a loopback bind; `@micacms/self-hosted`
|
|
8
|
-
* composes it behind `@micacms/auth-oidc`. This package must never import an
|
|
9
|
-
* auth implementation — that direction is what protects the local
|
|
10
|
-
* distribution.
|
|
2
|
+
* @micacms/runtime: the single-site, authentication-neutral Mica runtime.
|
|
3
|
+
* It must never import an auth implementation; the composing app supplies the `AuthSurface`.
|
|
11
4
|
*/
|
|
12
5
|
export { createApp, allowAll } from "./app.js";
|
|
13
|
-
export {
|
|
14
|
-
export { bool, ConfigError, deriveRuntime, describeConfigIssues, list, loadEnvFile, LOOPBACK,
|
|
6
|
+
export { createRuntimeContext, DEFAULT_SITE_ID, } from "./context.js";
|
|
7
|
+
export { bool, ConfigError, deriveRuntime, describeConfigIssues, list, loadEnvFile, LOOPBACK, runtimeEnv, withoutBlanks, } from "./config.js";
|
|
15
8
|
export { startServer } from "./server.js";
|
|
16
9
|
export { actorOf, clientIp, intParam } from "./http.js";
|
|
17
10
|
export { checkSchema, loadSchema, SchemaError, schemaFingerprint, schemaOrigin } from "./schema.js";
|
|
@@ -23,9 +16,14 @@ export { createRateLimiter } from "./lib/rate-limit.js";
|
|
|
23
16
|
export { randomToken } from "./lib/id.js";
|
|
24
17
|
export { DEFAULT_BASE_URL, DEFAULT_PORT } from "./lib/ports.js";
|
|
25
18
|
export { VERSION } from "./lib/version.js";
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export { createWorkingTreeStagingService, } from "./services/staging-local.js";
|
|
19
|
+
export { analyseChanges, classifyPath, describeProblems, flattenProblems, } from "./services/changes.js";
|
|
20
|
+
export { createWorkingTreeStagingService, } from "./services/staging.js";
|
|
29
21
|
export { createMediaService, formatBytes } from "./services/media.js";
|
|
22
|
+
export { createContentStore, ContentError, ValidationError, } from "./services/content-store.js";
|
|
23
|
+
export { checkChangePaths, ConflictError, contentFiles, FilesError, } from "./workspace/files.js";
|
|
24
|
+
export { developerEnvironment, firstLine, GitError, gitRunner, } from "./workspace/git.js";
|
|
25
|
+
export { createMutex, createReadWriteLock, createWorkspaceLocks, lockedFiles, } from "./workspace/locks.js";
|
|
26
|
+
export { developerPolicy } from "./workspace/developer.js";
|
|
27
|
+
export { commitPaths, headRevision, headSource, inRepo, listTreeChanges, LITERAL, locateTree, parseStatus, recommitPaths, } from "./workspace/tree.js";
|
|
30
28
|
export { schemaStats } from "./lib/schema-stats.js";
|
|
31
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAA2C,MAAM,UAAU,CAAC;AACxF,OAAO,EACL,oBAAoB,EACpB,eAAe,GAMhB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,IAAI,EACJ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAA2B,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAY,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,gBAAgB,GAGjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAShB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,GAEhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAqC,MAAM,qBAAqB,CAAC;AACzG,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,GAIhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,UAAU,GAMX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,SAAS,GAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,GAIZ,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EAAE,eAAe,EAA+B,MAAM,0BAA0B,CAAC;AACxF,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,eAAe,EACf,OAAO,EACP,UAAU,EACV,WAAW,EACX,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Admin
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* validation, slugs and layout lives in the store, which is shared with the
|
|
6
|
-
* Astro build rather than reimplemented here.
|
|
7
|
-
*
|
|
8
|
-
* Three things shape this surface:
|
|
9
|
-
*
|
|
10
|
-
* - An entry is addressed by `collection/slug`. The path in the API is the
|
|
11
|
-
* path in the repository, so a URL here can be read off a diff.
|
|
12
|
-
* - There are no revision endpoints. Git is the history.
|
|
13
|
-
* - There is no status endpoint. Committed is published, and a draft is
|
|
14
|
-
* unsaved work in the editor that never reaches the server.
|
|
15
|
-
*
|
|
16
|
-
* `revision` is what makes concurrent editing safe: an opaque token naming the
|
|
17
|
-
* version an editor opened, sent back with the save.
|
|
2
|
+
* Admin routes for entries and singletons. The content store holds every rule;
|
|
3
|
+
* these routes only parse and serialize. The API path is the repository path,
|
|
4
|
+
* Git is the history, and `revision` makes concurrent edits safe.
|
|
18
5
|
*/
|
|
19
6
|
import { Hono } from "hono";
|
|
20
|
-
import {
|
|
7
|
+
import type { Env } from "../http.js";
|
|
21
8
|
export declare function adminContentRoutes(): Hono<Env>;
|
|
22
9
|
//# sourceMappingURL=admin-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-content.d.ts","sourceRoot":"","sources":["../../src/routes/admin-content.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"admin-content.d.ts","sourceRoot":"","sources":["../../src/routes/admin-content.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAiCtC,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,GAAG,CAAC,CAoJ9C"}
|