@norskvideo/ctl-dev-kit 0.1.80 → 0.1.81
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/conventions/docs.md +19 -0
- package/doc-guide/build-manual.d.ts +11 -0
- package/doc-guide/bundle.d.ts +14 -2
- package/doc-guide/bundle.js +29 -4
- package/package.json +1 -1
package/conventions/docs.md
CHANGED
|
@@ -148,6 +148,25 @@ single-sourced here and drift-gated:
|
|
|
148
148
|
refuses a repo carrying both, and refuses the public variant when it cannot
|
|
149
149
|
tell the repo's name (`GITHUB_REPOSITORY` in CI, the origin remote locally).
|
|
150
150
|
|
|
151
|
+
### Per-page visibility
|
|
152
|
+
|
|
153
|
+
Every page in `bundle.json` carries a `visibility`, `public` or `possession`,
|
|
154
|
+
defaulting to the bundle's own (`buildBundle(spec, { visibility })`, itself
|
|
155
|
+
`public`). The public fetcher stages only the public pages; the image serves all
|
|
156
|
+
of them either way, so `possession` means "reaches customers only inside the
|
|
157
|
+
image they already run".
|
|
158
|
+
|
|
159
|
+
**No page is special-cased — mark `possession` only when you mean it.** In
|
|
160
|
+
particular `known-limitations` is not the page to hide: a candid limitations
|
|
161
|
+
page is a trust asset for a public product, and hiding the honest page is an odd
|
|
162
|
+
signal to an evaluator.
|
|
163
|
+
|
|
164
|
+
This is not what protects a turnkey, and must not be read as if it were. Turnkey
|
|
165
|
+
privacy is a repo/bundle-level guarantee — the `^norsk-ctl-product-` repo-name
|
|
166
|
+
rule, the registry's `docsVisibility`, the per-repo workflow variant, and the
|
|
167
|
+
fetcher's own gate. A turnkey's whole bundle never reaches the public plane
|
|
168
|
+
whatever its pages say.
|
|
169
|
+
|
|
151
170
|
Either way the image serves the bundle at `/docs` (SDK `serveDocs`), reached
|
|
152
171
|
through the daemon at `/products/<name>/docs/` behind its auth guard and linked
|
|
153
172
|
from the product's hub via `ui.sidebarEntries`. That is the sole channel for a
|
|
@@ -4,6 +4,13 @@ export type Step = {
|
|
|
4
4
|
head: string;
|
|
5
5
|
desc: string;
|
|
6
6
|
};
|
|
7
|
+
/** Where a page may be read. `public` reaches the public docs site; `possession`
|
|
8
|
+
* reaches customers only inside the image they already run. PUBLIC is the
|
|
9
|
+
* default and no page is special-cased -- a candid limitations page is a trust
|
|
10
|
+
* asset, and hiding the honest page is an odd signal to an evaluator (fleet
|
|
11
|
+
* review 03 open question 3). Turnkey privacy is a repo/bundle-level
|
|
12
|
+
* guarantee, never this field. */
|
|
13
|
+
export type PageVisibility = "public" | "possession";
|
|
7
14
|
export type ManualPage = {
|
|
8
15
|
id: string;
|
|
9
16
|
nav: string;
|
|
@@ -14,6 +21,8 @@ export type ManualPage = {
|
|
|
14
21
|
steps: Step[];
|
|
15
22
|
links: string[];
|
|
16
23
|
thin?: boolean;
|
|
24
|
+
/** Overrides the bundle's visibility for this page alone. */
|
|
25
|
+
visibility?: PageVisibility;
|
|
17
26
|
};
|
|
18
27
|
export interface ManualOverview {
|
|
19
28
|
/** The overview <h1>. */
|
|
@@ -50,6 +59,8 @@ export interface ManualDocument {
|
|
|
50
59
|
nav: string;
|
|
51
60
|
title: string;
|
|
52
61
|
markdown: string;
|
|
62
|
+
/** Overrides the bundle's visibility for this page alone. */
|
|
63
|
+
visibility?: PageVisibility;
|
|
53
64
|
}
|
|
54
65
|
export interface ManualSpec {
|
|
55
66
|
/** Sidebar wordmark + document brand. */
|
package/doc-guide/bundle.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type BuildManualResult, type ManualLink, type ManualSpec, type Provenance } from "./build-manual.js";
|
|
2
|
-
export
|
|
1
|
+
import { type BuildManualResult, type ManualLink, type ManualSpec, type PageVisibility, type Provenance } from "./build-manual.js";
|
|
2
|
+
export type { PageVisibility };
|
|
3
|
+
export declare const BUNDLE_SCHEMA_VERSION = 2;
|
|
3
4
|
export interface BundlePageEntry {
|
|
4
5
|
id: string;
|
|
5
6
|
nav: string;
|
|
@@ -7,11 +8,15 @@ export interface BundlePageEntry {
|
|
|
7
8
|
kind: "overview" | "fn" | "ex" | "doc";
|
|
8
9
|
/** Relative to the bundle directory. */
|
|
9
10
|
file: string;
|
|
11
|
+
/** Resolved: the page's own value, else the bundle's. */
|
|
12
|
+
visibility: PageVisibility;
|
|
10
13
|
}
|
|
11
14
|
export interface BundleManifest {
|
|
12
15
|
schemaVersion: number;
|
|
13
16
|
brand: string;
|
|
14
17
|
title: string;
|
|
18
|
+
/** The default every page inherits when it declares none. */
|
|
19
|
+
visibility: PageVisibility;
|
|
15
20
|
provenance: Provenance;
|
|
16
21
|
links: ManualLink[];
|
|
17
22
|
pages: BundlePageEntry[];
|
|
@@ -29,9 +34,16 @@ export interface BuildBundleOptions {
|
|
|
29
34
|
/** Where the bundle is written; created if absent. */
|
|
30
35
|
outDir: string;
|
|
31
36
|
provenance?: Provenance;
|
|
37
|
+
/** Default visibility for every page that declares none. Public: turnkey
|
|
38
|
+
* privacy is enforced at the repo and bundle level, not page by page. */
|
|
39
|
+
visibility?: PageVisibility;
|
|
32
40
|
}
|
|
33
41
|
export interface BuildBundleResult extends BuildManualResult {
|
|
34
42
|
manifest: BundleManifest;
|
|
35
43
|
outDir: string;
|
|
36
44
|
}
|
|
37
45
|
export declare function buildBundle(spec: ManualSpec, opts: BuildBundleOptions): BuildBundleResult;
|
|
46
|
+
/** What the public fetcher may stage. A page entry from a version-1 bundle
|
|
47
|
+
* carries no visibility at all; that reads as `public`, so an older bundle
|
|
48
|
+
* stages exactly as it did before this field existed. */
|
|
49
|
+
export declare function publicPages(manifest: BundleManifest): BundlePageEntry[];
|
package/doc-guide/bundle.js
CHANGED
|
@@ -13,10 +13,14 @@
|
|
|
13
13
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
14
14
|
import { join } from "node:path";
|
|
15
15
|
import { buildManual, } from "./build-manual.js";
|
|
16
|
-
|
|
16
|
+
// 2: every page entry carries a `visibility`, and the manifest carries the
|
|
17
|
+
// bundle's own. A version-1 bundle has neither; `publicPages` reads an absent
|
|
18
|
+
// value as `public`, so an old bundle stages exactly as it did before.
|
|
19
|
+
export const BUNDLE_SCHEMA_VERSION = 2;
|
|
17
20
|
const yamlString = (s) => JSON.stringify(s);
|
|
18
21
|
export function buildBundle(spec, opts) {
|
|
19
22
|
const { docsRoot, outDir } = opts;
|
|
23
|
+
const visibility = opts.visibility ?? "public";
|
|
20
24
|
const provenance = { builtAt: new Date().toISOString(), ...opts.provenance };
|
|
21
25
|
mkdirSync(join(outDir, "pages"), { recursive: true });
|
|
22
26
|
const manual = buildManual(spec, {
|
|
@@ -78,9 +82,23 @@ export function buildBundle(spec, opts) {
|
|
|
78
82
|
].join("\n");
|
|
79
83
|
const documentMarkdown = (d) => ["---", `title: ${yamlString(d.title)}`, `nav: ${yamlString(d.nav)}`, "kind: doc", "---", "", d.markdown].join("\n");
|
|
80
84
|
const pages = [
|
|
81
|
-
{ id: "overview", nav: "Overview", title: ov.headline, kind: "overview", file: "pages/overview.md" },
|
|
82
|
-
...all.map((p) => ({
|
|
83
|
-
|
|
85
|
+
{ id: "overview", nav: "Overview", title: ov.headline, kind: "overview", file: "pages/overview.md", visibility },
|
|
86
|
+
...all.map((p) => ({
|
|
87
|
+
id: p.id,
|
|
88
|
+
nav: p.nav,
|
|
89
|
+
title: p.title,
|
|
90
|
+
kind: p.kind,
|
|
91
|
+
file: `pages/${p.id}.md`,
|
|
92
|
+
visibility: p.visibility ?? visibility,
|
|
93
|
+
})),
|
|
94
|
+
...docs.map((d) => ({
|
|
95
|
+
id: d.id,
|
|
96
|
+
nav: d.nav,
|
|
97
|
+
title: d.title,
|
|
98
|
+
kind: "doc",
|
|
99
|
+
file: `pages/${d.id}.md`,
|
|
100
|
+
visibility: d.visibility ?? visibility,
|
|
101
|
+
})),
|
|
84
102
|
];
|
|
85
103
|
writeFileSync(join(outDir, "pages/overview.md"), overviewMarkdown);
|
|
86
104
|
for (const p of all)
|
|
@@ -94,6 +112,7 @@ export function buildBundle(spec, opts) {
|
|
|
94
112
|
schemaVersion: BUNDLE_SCHEMA_VERSION,
|
|
95
113
|
brand: spec.brand,
|
|
96
114
|
title: spec.title,
|
|
115
|
+
visibility,
|
|
97
116
|
provenance,
|
|
98
117
|
links: spec.links ?? [],
|
|
99
118
|
pages,
|
|
@@ -103,3 +122,9 @@ export function buildBundle(spec, opts) {
|
|
|
103
122
|
writeFileSync(join(outDir, "bundle.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
104
123
|
return { ...manual, manifest, outDir };
|
|
105
124
|
}
|
|
125
|
+
/** What the public fetcher may stage. A page entry from a version-1 bundle
|
|
126
|
+
* carries no visibility at all; that reads as `public`, so an older bundle
|
|
127
|
+
* stages exactly as it did before this field existed. */
|
|
128
|
+
export function publicPages(manifest) {
|
|
129
|
+
return manifest.pages.filter((p) => (p.visibility ?? "public") === "public");
|
|
130
|
+
}
|