@intentset/publisher 0.14.0 → 0.15.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 +12 -4
- package/dist/help.d.ts +3 -5
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +0 -1
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/publish.d.ts +3 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +14 -10
- package/dist/publish.js.map +1 -1
- package/dist/snapshot.d.ts +28 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +8 -0
- package/dist/snapshot.js.map +1 -0
- package/package.json +3 -3
- package/src/help.ts +3 -6
- package/src/index.ts +1 -0
- package/src/publish.ts +16 -11
- package/src/snapshot.ts +32 -0
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Publishes reviewed knowledge for one audience and release (`spec/publication.md`): it projects the graph deny by
|
|
4
4
|
default, checks that no excluded record's title or path leaks, and writes Markset documents with their provenance,
|
|
5
|
-
an index, retrieval chunks,
|
|
5
|
+
an index, retrieval chunks, `help.json`, the tips a product shows beside its controls, and `snapshot.json`, the one
|
|
6
|
+
file that names the commit and graph hash it was published from.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
@@ -25,9 +26,16 @@ installed. The command is always `@intentset/cli`'s: this package has no `intent
|
|
|
25
26
|
for `intentset` alone would fetch an unrelated unscoped package from the registry.
|
|
26
27
|
|
|
27
28
|
From code, `publish(graph, registries, request, { snapshot, publishedAt })` returns the documents, the index, the help
|
|
28
|
-
file and the diagnostics, and refuses the whole request when any field is missing or undeclared
|
|
29
|
-
snapshot, the commit and graph hash the run read, is named
|
|
30
|
-
what it was made from by its sources' hashes
|
|
29
|
+
file, the snapshot file and the diagnostics, and refuses the whole request when any field is missing or undeclared
|
|
30
|
+
(PUB001). The snapshot, the commit and graph hash the run read, is named in `snapshot.json` and nowhere else; each
|
|
31
|
+
document pins what it was made from by its sources' hashes. So publishing the same knowledge at two commits writes
|
|
32
|
+
the same bytes in every file but that one.
|
|
33
|
+
|
|
34
|
+
**When the output is committed.** Publish with `--no-snapshot`, or ignore `snapshot.json` in version control. The
|
|
35
|
+
commit it names is the one checked out when the command ran, which is never the commit that will contain the output,
|
|
36
|
+
and it differs on every branch that changed a record, so branches would conflict on it. Git already records where
|
|
37
|
+
committed output came from. Keep the file when the output is deployed or handed to another system: nothing else says
|
|
38
|
+
which state of the model the documents were made from.
|
|
31
39
|
`@intentset/help` reads the help file in the product.
|
|
32
40
|
|
|
33
41
|
## Learn more
|
package/dist/help.d.ts
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
* see it, and nothing else of that artifact is carried: never its title, path,
|
|
12
12
|
* status or prose. Two documents tipping one ID: the lower knowledge ID wins.
|
|
13
13
|
*
|
|
14
|
-
* It
|
|
15
|
-
*
|
|
14
|
+
* It carries no snapshot: the run names the commit and graph hash it was
|
|
15
|
+
* published from in the snapshot file alone (snapshot.ts, ADR 0021), so this
|
|
16
|
+
* file's bytes change only when a tip, a published document or the request does.
|
|
16
17
|
*/
|
|
17
18
|
import type { Graph, Visibility } from "@intentset/core";
|
|
18
|
-
import type { Snapshot } from "./project.ts";
|
|
19
19
|
import type { PublicationRequest } from "./request.ts";
|
|
20
20
|
export declare const HELP_PROFILE = "intentset/help/0.2";
|
|
21
21
|
/** The file's name beside the published documents. */
|
|
@@ -37,7 +37,6 @@ export interface HelpFile {
|
|
|
37
37
|
profile: typeof HELP_PROFILE;
|
|
38
38
|
derived: true;
|
|
39
39
|
projection: Visibility;
|
|
40
|
-
snapshot: Snapshot;
|
|
41
40
|
audience: string;
|
|
42
41
|
availability: {
|
|
43
42
|
product: string;
|
|
@@ -53,7 +52,6 @@ export interface HelpFile {
|
|
|
53
52
|
tips: Record<string, HelpTip>;
|
|
54
53
|
}
|
|
55
54
|
export interface HelpOptions {
|
|
56
|
-
snapshot: Snapshot;
|
|
57
55
|
publishedAt: string;
|
|
58
56
|
}
|
|
59
57
|
/** The help file for the documents a run published, which are given by knowledge ID. */
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAY,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,sDAAsD;AACtD,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,OAAO;IACtB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,YAAY,CAAC;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACnG,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,WAAW,GACnB,QAAQ,CA+BV"}
|
package/dist/help.js
CHANGED
|
@@ -24,7 +24,6 @@ export function helpFile(graph, publishedIds, request, options) {
|
|
|
24
24
|
profile: HELP_PROFILE,
|
|
25
25
|
derived: true,
|
|
26
26
|
projection: request.visibility,
|
|
27
|
-
snapshot: { commit: options.snapshot.commit, graphHash: options.snapshot.graphHash },
|
|
28
27
|
audience: request.audience,
|
|
29
28
|
availability: {
|
|
30
29
|
product: request.product,
|
package/dist/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC;AACjD,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAkCrC,wFAAwF;AACxF,MAAM,UAAU,QAAQ,CACtB,KAAY,EACZ,YAA+B,EAC/B,OAA2B,EAC3B,OAAoB;IAEpB,MAAM,GAAG,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnD,MAAM,SAAS,GAAoB,EAAE,CAAC;IACtC,MAAM,IAAI,GAA4B,EAAE,CAAC;IAC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I,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;SACxD;QACD,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS;QACT,IAAI;KACL,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export { type PublicationIndex, type PublishOptions, type PublishResult, type Pu
|
|
|
12
12
|
export { type Reference, type ReferenceKind, checkReferences, checkTitles, findReferences, resolveTarget, titlePattern, } from "./references.ts";
|
|
13
13
|
export { type IndexedRequest, PROJECTION_ADMITS, type PublicationRequest, REQUEST_DIMENSIONS, type RequestDimension, admits, checkRequest, indexedRequest, } from "./request.ts";
|
|
14
14
|
export { CURRENT_PIN, PIN_KINDS, type PinKind, REVIEW_EXTENSION, type ReviewRecord, type ReviewStatus, bindReviewPins, knowledgeReport, pinHash, readReviewRecord, reviewSources, reviewStatus, } from "./review.ts";
|
|
15
|
+
export { SNAPSHOT_FILE, SNAPSHOT_PROFILE, type SnapshotFile, snapshotFile } from "./snapshot.ts";
|
|
15
16
|
export { YamlEmitError, type YamlValue, emitYaml } from "./yaml.ts";
|
|
16
17
|
//# 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;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,eAAe,EACf,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,eAAe,EACf,cAAc,EACd,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,aAAa,EAClB,OAAO,EACP,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,cAAc,EACnB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,SAAS,EACT,KAAK,OAAO,EACZ,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,cAAc,EACd,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WA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AK,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,5 +12,6 @@ export { REFUSAL_REASONS, publish, renderDocument, } from "./publish.js";
|
|
|
12
12
|
export { checkReferences, checkTitles, findReferences, resolveTarget, titlePattern, } from "./references.js";
|
|
13
13
|
export { PROJECTION_ADMITS, REQUEST_DIMENSIONS, admits, checkRequest, indexedRequest, } from "./request.js";
|
|
14
14
|
export { CURRENT_PIN, PIN_KINDS, REVIEW_EXTENSION, bindReviewPins, knowledgeReport, pinHash, readReviewRecord, reviewSources, reviewStatus, } from "./review.js";
|
|
15
|
+
export { SNAPSHOT_FILE, SNAPSHOT_PROFILE, snapshotFile } from "./snapshot.js";
|
|
15
16
|
export { YamlEmitError, emitYaml } from "./yaml.js";
|
|
16
17
|
//# 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;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAmD,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAGL,eAAe,EACf,mBAAmB,EAGnB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,YAAY,EAKZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EAMjB,eAAe,EACf,cAAc,EACd,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAKL,eAAe,EAEf,OAAO,EACP,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAElB,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,SAAS,EAET,gBAAgB,EAGhB,cAAc,EACd,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAkB,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAmD,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAGL,eAAe,EACf,mBAAmB,EAGnB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,YAAY,EAKZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EAMjB,eAAe,EACf,cAAc,EACd,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAKL,eAAe,EAEf,OAAO,EACP,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAElB,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,SAAS,EAET,gBAAgB,EAGhB,cAAc,EACd,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,aAAa,EAAkB,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/publish.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type HelpFile } from "./help.ts";
|
|
|
4
4
|
import { type Snapshot } from "./project.ts";
|
|
5
5
|
import { type IndexedRequest, type PublicationRequest } from "./request.ts";
|
|
6
6
|
import type { ReviewStatus } from "./review.ts";
|
|
7
|
+
import { type SnapshotFile } from "./snapshot.ts";
|
|
7
8
|
/** Why a document that passed the projection was still not published. */
|
|
8
9
|
export declare const REFUSAL_REASONS: readonly ["reference", "title", "directive", "markset"];
|
|
9
10
|
export type RefusalReason = (typeof REFUSAL_REASONS)[number];
|
|
@@ -19,7 +20,6 @@ export interface PublishedDocument extends GeneratedDocument {
|
|
|
19
20
|
html?: string;
|
|
20
21
|
}
|
|
21
22
|
export interface PublicationIndex {
|
|
22
|
-
snapshot: Snapshot;
|
|
23
23
|
/** The request without authorization flags, or null when it was refused. */
|
|
24
24
|
request: IndexedRequest | null;
|
|
25
25
|
published: string[];
|
|
@@ -31,6 +31,8 @@ export interface PublishResult {
|
|
|
31
31
|
index: PublicationIndex;
|
|
32
32
|
/** The help file (spec/publication.md §5), or null when the request was refused. */
|
|
33
33
|
help: HelpFile | null;
|
|
34
|
+
/** The snapshot file (spec/publication.md §6): the only part of the result that names the snapshot. */
|
|
35
|
+
snapshot: SnapshotFile;
|
|
34
36
|
diagnostics: Diagnostic[];
|
|
35
37
|
ok: boolean;
|
|
36
38
|
}
|
package/dist/publish.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AA+BA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,KA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,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,uGAAuG;IACvG,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,EAAE,EAAE,OAAO,CAAC;CACb;AAED,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,cAAc,GACtB,aAAa,CA+Ef;AAUD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,GAAG,MAAM,CAOpF"}
|
package/dist/publish.js
CHANGED
|
@@ -13,17 +13,20 @@
|
|
|
13
13
|
* here is refused in turn; this repeats until nothing more is refused.
|
|
14
14
|
*
|
|
15
15
|
* The help file (help.ts) carries every published document's tips, keyed by
|
|
16
|
-
* the ID each explains, for a product's runtime
|
|
17
|
-
* documents do not (ADR 0019): it is the same for all of them and moves with
|
|
18
|
-
* any record, so a document's bytes would change on every record change.
|
|
16
|
+
* the ID each explains, for a product's runtime.
|
|
19
17
|
*
|
|
20
|
-
* The index is what a customer-facing tool may read (Core §10): the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* published.
|
|
18
|
+
* The index is what a customer-facing tool may read (Core §10): the request
|
|
19
|
+
* without its authorization flags, the published IDs, and the number of
|
|
20
|
+
* artifacts excluded for each reason. It names nothing that was not published.
|
|
24
21
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* The snapshot file (snapshot.ts) is the one place a publication names the
|
|
23
|
+
* commit and graph hash it was made from (ADR 0019, ADR 0021). Both move with
|
|
24
|
+
* every commit that changes a record, so no document, chunk, index or help
|
|
25
|
+
* file carries them: their bytes change only when what they say does.
|
|
26
|
+
*
|
|
27
|
+
* Deterministic: the same graph, request and `publishedAt` give the same
|
|
28
|
+
* documents, index and help file, whatever the commit; the snapshot file is
|
|
29
|
+
* the same bytes for the same snapshot.
|
|
27
30
|
*/
|
|
28
31
|
import { readFileSync } from "node:fs";
|
|
29
32
|
import { canonicalJson, hasErrors, sortDiagnostics, } from "@intentset/core";
|
|
@@ -35,6 +38,7 @@ import { helpFile } from "./help.js";
|
|
|
35
38
|
import { project } from "./project.js";
|
|
36
39
|
import { checkReferences, checkTitles } from "./references.js";
|
|
37
40
|
import { admits, indexedRequest } from "./request.js";
|
|
41
|
+
import { snapshotFile } from "./snapshot.js";
|
|
38
42
|
/** Why a document that passed the projection was still not published. */
|
|
39
43
|
export const REFUSAL_REASONS = ["reference", "title", "directive", "markset"];
|
|
40
44
|
export function publish(graph, registries, request, options) {
|
|
@@ -104,8 +108,8 @@ export function publish(graph, registries, request, options) {
|
|
|
104
108
|
help: req === null
|
|
105
109
|
? null
|
|
106
110
|
: helpFile(graph, documents.map((document) => document.id), req, options),
|
|
111
|
+
snapshot: snapshotFile(options.snapshot),
|
|
107
112
|
index: {
|
|
108
|
-
snapshot: { commit: options.snapshot.commit, graphHash: options.snapshot.graphHash },
|
|
109
113
|
request: req === null ? null : indexedRequest(req),
|
|
110
114
|
published: documents.map((document) => document.id),
|
|
111
115
|
excludedCounts,
|
package/dist/publish.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAKL,aAAa,EACb,SAAS,EACT,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAA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G,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1G,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The snapshot file (spec/publication.md §6): the commit and graph hash a
|
|
3
|
+
* publication was made from, in a file of its own beside the documents.
|
|
4
|
+
*
|
|
5
|
+
* It is the one file of a publication that names the snapshot (ADR 0021).
|
|
6
|
+
* Both values move with every commit that changes a record, so any other
|
|
7
|
+
* file that carried them would be rewritten by every publication, whatever
|
|
8
|
+
* it says; with them here, the documents, the index, the help file and the
|
|
9
|
+
* chunks are the same bytes for the same model, request and `publishedAt`,
|
|
10
|
+
* at any commit. The file carries nothing of the request, so every
|
|
11
|
+
* projection published in one run writes the same bytes.
|
|
12
|
+
*/
|
|
13
|
+
import type { Snapshot } from "./project.ts";
|
|
14
|
+
export declare const SNAPSHOT_PROFILE = "intentset/snapshot/0.2";
|
|
15
|
+
/** The file's name beside the published documents. */
|
|
16
|
+
export declare const SNAPSHOT_FILE = "snapshot.json";
|
|
17
|
+
/** `snapshot.json`, in the order it is written. */
|
|
18
|
+
export interface SnapshotFile {
|
|
19
|
+
profile: typeof SNAPSHOT_PROFILE;
|
|
20
|
+
derived: true;
|
|
21
|
+
/** The commit published from, or null when none could be read. */
|
|
22
|
+
commit: string | null;
|
|
23
|
+
/** The hash of the graph published from. */
|
|
24
|
+
graphHash: string;
|
|
25
|
+
}
|
|
26
|
+
/** The snapshot file for a publication made from `snapshot`. */
|
|
27
|
+
export declare function snapshotFile(snapshot: Snapshot): SnapshotFile;
|
|
28
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,sDAAsD;AACtD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,gBAAgB,CAAC;IACjC,OAAO,EAAE,IAAI,CAAC;IACd,kEAAkE;IAClE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAE7D"}
|
package/dist/snapshot.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SNAPSHOT_PROFILE = "intentset/snapshot/0.2";
|
|
2
|
+
/** The file's name beside the published documents. */
|
|
3
|
+
export const SNAPSHOT_FILE = "snapshot.json";
|
|
4
|
+
/** The snapshot file for a publication made from `snapshot`. */
|
|
5
|
+
export function snapshotFile(snapshot) {
|
|
6
|
+
return { profile: SNAPSHOT_PROFILE, derived: true, commit: snapshot.commit, graphHash: snapshot.graphHash };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AACzD,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAY7C,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,QAAkB;IAC7C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;AAC9G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentset/publisher",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Audience and release projection of reviewed knowledge into Markset documents with provenance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intentset",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@intentset/core": "^0.
|
|
39
|
-
"@intentset/markset-adapter": "^0.
|
|
38
|
+
"@intentset/core": "^0.15.0",
|
|
39
|
+
"@intentset/markset-adapter": "^0.15.0",
|
|
40
40
|
"@markset-lang/parser": "0.4.1",
|
|
41
41
|
"@markset-lang/render-html": "0.4.1"
|
|
42
42
|
}
|
package/src/help.ts
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* see it, and nothing else of that artifact is carried: never its title, path,
|
|
12
12
|
* status or prose. Two documents tipping one ID: the lower knowledge ID wins.
|
|
13
13
|
*
|
|
14
|
-
* It
|
|
15
|
-
*
|
|
14
|
+
* It carries no snapshot: the run names the commit and graph hash it was
|
|
15
|
+
* published from in the snapshot file alone (snapshot.ts, ADR 0021), so this
|
|
16
|
+
* file's bytes change only when a tip, a published document or the request does.
|
|
16
17
|
*/
|
|
17
18
|
import type { Artifact, Graph, Visibility } from "@intentset/core";
|
|
18
19
|
import { compareStrings } from "./diagnostic.ts";
|
|
19
|
-
import type { Snapshot } from "./project.ts";
|
|
20
20
|
import type { PublicationRequest } from "./request.ts";
|
|
21
21
|
|
|
22
22
|
export const HELP_PROFILE = "intentset/help/0.2";
|
|
@@ -42,7 +42,6 @@ export interface HelpFile {
|
|
|
42
42
|
profile: typeof HELP_PROFILE;
|
|
43
43
|
derived: true;
|
|
44
44
|
projection: Visibility;
|
|
45
|
-
snapshot: Snapshot;
|
|
46
45
|
audience: string;
|
|
47
46
|
availability: { product: string; release: string; role: string; edition: string; flags: string[] };
|
|
48
47
|
publishedAt: string;
|
|
@@ -53,7 +52,6 @@ export interface HelpFile {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
export interface HelpOptions {
|
|
56
|
-
snapshot: Snapshot;
|
|
57
55
|
publishedAt: string;
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -82,7 +80,6 @@ export function helpFile(
|
|
|
82
80
|
profile: HELP_PROFILE,
|
|
83
81
|
derived: true,
|
|
84
82
|
projection: request.visibility,
|
|
85
|
-
snapshot: { commit: options.snapshot.commit, graphHash: options.snapshot.graphHash },
|
|
86
83
|
audience: request.audience,
|
|
87
84
|
availability: {
|
|
88
85
|
product: request.product,
|
package/src/index.ts
CHANGED
package/src/publish.ts
CHANGED
|
@@ -13,17 +13,20 @@
|
|
|
13
13
|
* here is refused in turn; this repeats until nothing more is refused.
|
|
14
14
|
*
|
|
15
15
|
* The help file (help.ts) carries every published document's tips, keyed by
|
|
16
|
-
* the ID each explains, for a product's runtime
|
|
17
|
-
* documents do not (ADR 0019): it is the same for all of them and moves with
|
|
18
|
-
* any record, so a document's bytes would change on every record change.
|
|
16
|
+
* the ID each explains, for a product's runtime.
|
|
19
17
|
*
|
|
20
|
-
* The index is what a customer-facing tool may read (Core §10): the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* published.
|
|
18
|
+
* The index is what a customer-facing tool may read (Core §10): the request
|
|
19
|
+
* without its authorization flags, the published IDs, and the number of
|
|
20
|
+
* artifacts excluded for each reason. It names nothing that was not published.
|
|
24
21
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* The snapshot file (snapshot.ts) is the one place a publication names the
|
|
23
|
+
* commit and graph hash it was made from (ADR 0019, ADR 0021). Both move with
|
|
24
|
+
* every commit that changes a record, so no document, chunk, index or help
|
|
25
|
+
* file carries them: their bytes change only when what they say does.
|
|
26
|
+
*
|
|
27
|
+
* Deterministic: the same graph, request and `publishedAt` give the same
|
|
28
|
+
* documents, index and help file, whatever the commit; the snapshot file is
|
|
29
|
+
* the same bytes for the same snapshot.
|
|
27
30
|
*/
|
|
28
31
|
import { readFileSync } from "node:fs";
|
|
29
32
|
import {
|
|
@@ -44,6 +47,7 @@ import { type ExclusionReason, type Snapshot, project } from "./project.ts";
|
|
|
44
47
|
import { checkReferences, checkTitles } from "./references.ts";
|
|
45
48
|
import { type IndexedRequest, type PublicationRequest, admits, indexedRequest } from "./request.ts";
|
|
46
49
|
import type { ReviewStatus } from "./review.ts";
|
|
50
|
+
import { type SnapshotFile, snapshotFile } from "./snapshot.ts";
|
|
47
51
|
|
|
48
52
|
/** Why a document that passed the projection was still not published. */
|
|
49
53
|
export const REFUSAL_REASONS = ["reference", "title", "directive", "markset"] as const;
|
|
@@ -63,7 +67,6 @@ export interface PublishedDocument extends GeneratedDocument {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
export interface PublicationIndex {
|
|
66
|
-
snapshot: Snapshot;
|
|
67
70
|
/** The request without authorization flags, or null when it was refused. */
|
|
68
71
|
request: IndexedRequest | null;
|
|
69
72
|
published: string[];
|
|
@@ -76,6 +79,8 @@ export interface PublishResult {
|
|
|
76
79
|
index: PublicationIndex;
|
|
77
80
|
/** The help file (spec/publication.md §5), or null when the request was refused. */
|
|
78
81
|
help: HelpFile | null;
|
|
82
|
+
/** The snapshot file (spec/publication.md §6): the only part of the result that names the snapshot. */
|
|
83
|
+
snapshot: SnapshotFile;
|
|
79
84
|
diagnostics: Diagnostic[];
|
|
80
85
|
ok: boolean;
|
|
81
86
|
}
|
|
@@ -155,8 +160,8 @@ export function publish(
|
|
|
155
160
|
req,
|
|
156
161
|
options,
|
|
157
162
|
),
|
|
163
|
+
snapshot: snapshotFile(options.snapshot),
|
|
158
164
|
index: {
|
|
159
|
-
snapshot: { commit: options.snapshot.commit, graphHash: options.snapshot.graphHash },
|
|
160
165
|
request: req === null ? null : indexedRequest(req),
|
|
161
166
|
published: documents.map((document) => document.id),
|
|
162
167
|
excludedCounts,
|
package/src/snapshot.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The snapshot file (spec/publication.md §6): the commit and graph hash a
|
|
3
|
+
* publication was made from, in a file of its own beside the documents.
|
|
4
|
+
*
|
|
5
|
+
* It is the one file of a publication that names the snapshot (ADR 0021).
|
|
6
|
+
* Both values move with every commit that changes a record, so any other
|
|
7
|
+
* file that carried them would be rewritten by every publication, whatever
|
|
8
|
+
* it says; with them here, the documents, the index, the help file and the
|
|
9
|
+
* chunks are the same bytes for the same model, request and `publishedAt`,
|
|
10
|
+
* at any commit. The file carries nothing of the request, so every
|
|
11
|
+
* projection published in one run writes the same bytes.
|
|
12
|
+
*/
|
|
13
|
+
import type { Snapshot } from "./project.ts";
|
|
14
|
+
|
|
15
|
+
export const SNAPSHOT_PROFILE = "intentset/snapshot/0.2";
|
|
16
|
+
/** The file's name beside the published documents. */
|
|
17
|
+
export const SNAPSHOT_FILE = "snapshot.json";
|
|
18
|
+
|
|
19
|
+
/** `snapshot.json`, in the order it is written. */
|
|
20
|
+
export interface SnapshotFile {
|
|
21
|
+
profile: typeof SNAPSHOT_PROFILE;
|
|
22
|
+
derived: true;
|
|
23
|
+
/** The commit published from, or null when none could be read. */
|
|
24
|
+
commit: string | null;
|
|
25
|
+
/** The hash of the graph published from. */
|
|
26
|
+
graphHash: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The snapshot file for a publication made from `snapshot`. */
|
|
30
|
+
export function snapshotFile(snapshot: Snapshot): SnapshotFile {
|
|
31
|
+
return { profile: SNAPSHOT_PROFILE, derived: true, commit: snapshot.commit, graphHash: snapshot.graphHash };
|
|
32
|
+
}
|