@okfit/core 0.9.2 → 0.10.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/Actor.js +21 -2
- package/Concept.js +2 -0
- package/Diagnostic.js +4 -1
- package/Generated.js +7 -10
- package/Integrity.js +40 -0
- package/OkfitConfig.js +28 -7
- package/README.md +1 -1
- package/index.d.ts +100 -24
- package/index.js +4 -3
- package/internal/conceptDecode.js +3 -1
- package/internal/lintRules.js +40 -1
- package/package.json +9 -9
package/Actor.js
CHANGED
|
@@ -10,6 +10,13 @@ const form = (actor) => {
|
|
|
10
10
|
const prefix = colon === -1 ? "" : actor.slice(0, colon);
|
|
11
11
|
return prefix === "human" ? "human" : prefix === "process" ? "process" : "other";
|
|
12
12
|
};
|
|
13
|
+
const GLOB_RE = /[*?]/u;
|
|
14
|
+
const ESCAPE_RE = /[.+^${}()|[\]\\/]/gu;
|
|
15
|
+
/** `*` is any run of non-whitespace, `?` one non-whitespace character; everything else is literal. */
|
|
16
|
+
const patternRegExp = (pattern) => new RegExp(`^${[...pattern].map((char) => char === "*" ? "\\S*" : char === "?" ? "\\S" : char.replace(ESCAPE_RE, "\\$&")).join("")}$`, "iu");
|
|
17
|
+
const isPattern = (value) => GLOB_RE.test(value);
|
|
18
|
+
const matches = (actor, pattern) => patternRegExp(pattern).test(actor);
|
|
19
|
+
const allowed = (actor, humans) => humans.length === 0 || humans.some((pattern) => matches(actor, pattern));
|
|
13
20
|
/**
|
|
14
21
|
* Branded, pattern-checked actor codec with prefix classification statics.
|
|
15
22
|
* @public
|
|
@@ -24,8 +31,20 @@ const Actor = Object.assign(Schema.String.pipe(Schema.check(Schema.isPattern(ACT
|
|
|
24
31
|
]
|
|
25
32
|
}), {
|
|
26
33
|
isHuman,
|
|
27
|
-
form
|
|
34
|
+
form,
|
|
35
|
+
matches,
|
|
36
|
+
allowed,
|
|
37
|
+
isPattern
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Branded, pattern-checked `[actors].humans` entry codec.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
const ActorPattern = Schema.String.pipe(Schema.check(Schema.isPattern(ACTOR_RE, { message: "Expected <prefix>:<id> (globs * and ? allowed in the id) with no whitespace" })), Schema.brand("ActorPattern")).annotate({
|
|
44
|
+
title: "Actor or actor glob",
|
|
45
|
+
description: "An actor id (\"human:spencer\") or an id glob (\"human:spencer*\"; * matches any run of characters, ? one), matched case-insensitively.",
|
|
46
|
+
examples: ["human:spencer", "human:spencer*"]
|
|
28
47
|
});
|
|
29
48
|
|
|
30
49
|
//#endregion
|
|
31
|
-
export { Actor };
|
|
50
|
+
export { Actor, ActorPattern };
|
package/Concept.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AttestedComputation } from "./AttestedComputation.js";
|
|
2
2
|
import { Timestamp } from "./Timestamp.js";
|
|
3
3
|
import { Generated } from "./Generated.js";
|
|
4
|
+
import { Integrity } from "./Integrity.js";
|
|
4
5
|
import { Source, UsageWindow } from "./Source.js";
|
|
5
6
|
import { Status } from "./Status.js";
|
|
6
7
|
import { Verification } from "./Verification.js";
|
|
@@ -35,6 +36,7 @@ var Concept = class extends Schema.Class("Concept")({
|
|
|
35
36
|
verified: Schema.optionalKey(Verification.List),
|
|
36
37
|
status: Schema.optionalKey(Status),
|
|
37
38
|
stale_after: Schema.optionalKey(Timestamp),
|
|
39
|
+
integrity: Schema.optionalKey(Integrity),
|
|
38
40
|
attested: Schema.optionalKey(AttestedComputation),
|
|
39
41
|
extensions: Schema.Record(Schema.String, Schema.Unknown),
|
|
40
42
|
raw: Schema.Record(Schema.String, Schema.Unknown)
|
package/Diagnostic.js
CHANGED
|
@@ -44,7 +44,10 @@ const LintCode = Schema.Literals([
|
|
|
44
44
|
"generated-missing",
|
|
45
45
|
"publication-drift",
|
|
46
46
|
"publication-orphan",
|
|
47
|
-
"surface-unmatched"
|
|
47
|
+
"surface-unmatched",
|
|
48
|
+
"verified-drift",
|
|
49
|
+
"actor-email",
|
|
50
|
+
"verified-actor-unknown"
|
|
48
51
|
]);
|
|
49
52
|
/** @public */
|
|
50
53
|
const DiagnosticCode = Schema.Union([ConformanceCode, LintCode]);
|
package/Generated.js
CHANGED
|
@@ -3,14 +3,6 @@ import { Timestamp } from "./Timestamp.js";
|
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region src/Generated.ts
|
|
6
|
-
const SHA256_HEX_RE = /^[0-9a-f]{64}$/u;
|
|
7
|
-
/**
|
|
8
|
-
* A lowercase 64-character hex sha256 digest of a concept's body, as `@okfit/profiles`'
|
|
9
|
-
* `Derivation.bodyDigest` computes it (issue #19). Optional: every concept stamped before
|
|
10
|
-
* this field existed lacks it, and core itself never computes one -- it only holds the field.
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
const BodySha256 = Schema.String.pipe(Schema.check(Schema.isPattern(SHA256_HEX_RE, { message: "Expected a lowercase 64-character hex sha256 digest" })));
|
|
14
6
|
/**
|
|
15
7
|
* Who last generated a concept's content, and when.
|
|
16
8
|
* @public
|
|
@@ -18,11 +10,16 @@ const BodySha256 = Schema.String.pipe(Schema.check(Schema.isPattern(SHA256_HEX_R
|
|
|
18
10
|
var Generated = class extends Schema.Class("Generated")({
|
|
19
11
|
by: Actor,
|
|
20
12
|
at: Schema.optionalKey(Timestamp),
|
|
21
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Legacy (pre-integrity) body digest, read only as a migration fallback and never
|
|
15
|
+
* written. Lenient on purpose: a malformed legacy value must never fail the
|
|
16
|
+
* `generated` family and drop `by`/`at`. `okfit sync` moves it to `integrity.generated.body`.
|
|
17
|
+
*/
|
|
18
|
+
body_sha256: Schema.optionalKey(Schema.String)
|
|
22
19
|
}) {
|
|
23
20
|
/** The `by` used when a legacy v0.1 `timestamp` is folded into `generated.at` (D-15); v0.1 has no actor. */
|
|
24
21
|
static LEGACY_BY = "process:legacy-timestamp";
|
|
25
22
|
};
|
|
26
23
|
|
|
27
24
|
//#endregion
|
|
28
|
-
export {
|
|
25
|
+
export { Generated };
|
package/Integrity.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Actor } from "./Actor.js";
|
|
2
|
+
import { Timestamp } from "./Timestamp.js";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
|
|
5
|
+
//#region src/Integrity.ts
|
|
6
|
+
const DIGEST_RE = /^[0-9a-f]{16}$/u;
|
|
7
|
+
/**
|
|
8
|
+
* An okfit digest: the first 16 lowercase hex characters (64 bits) of SHA-256 over the
|
|
9
|
+
* input bytes `@okfit/profiles` defines. A signal, not a tamper seal. Core holds the
|
|
10
|
+
* shape and never computes one.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
const Digest = Schema.String.pipe(Schema.check(Schema.isPattern(DIGEST_RE, { message: "Expected a lowercase 16-character hex digest" })));
|
|
14
|
+
/**
|
|
15
|
+
* The body digest as of `generated.at`.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
var IntegrityGenerated = class extends Schema.Class("IntegrityGenerated")({ body: Digest }) {};
|
|
19
|
+
/**
|
|
20
|
+
* Binds one `human:` `verified` entry (joined on `by` and `at`) to the content it covered.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
var IntegrityVerified = class extends Schema.Class("IntegrityVerified")({
|
|
24
|
+
by: Actor,
|
|
25
|
+
at: Timestamp,
|
|
26
|
+
content: Digest
|
|
27
|
+
}) {};
|
|
28
|
+
/**
|
|
29
|
+
* okfit's own top-level frontmatter family, the only place okfit stores digests
|
|
30
|
+
* (OKF v0.2 section 4.1 extension key). Spec families such as `generated` and
|
|
31
|
+
* `verified` stay exactly as the spec defines them.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
var Integrity = class extends Schema.Class("Integrity")({
|
|
35
|
+
generated: Schema.optionalKey(IntegrityGenerated),
|
|
36
|
+
verified: Schema.optionalKey(IntegrityVerified)
|
|
37
|
+
}) {};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Digest, Integrity, IntegrityGenerated, IntegrityVerified };
|
package/OkfitConfig.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Actor } from "./Actor.js";
|
|
1
|
+
import { Actor, ActorPattern } from "./Actor.js";
|
|
2
2
|
import { Duration, Effect, Option, Schema, SchemaGetter, SchemaIssue, SchemaTransformation } from "effect";
|
|
3
3
|
import { ConfigFile, TomlCodec } from "@effected/config-file";
|
|
4
4
|
import { HostedSchema } from "@effected/schemastore";
|
|
@@ -186,6 +186,16 @@ const LintTable = Schema.Struct({
|
|
|
186
186
|
description: "An actor's prefix is not human, process, or a producer shape. Default \"info\".",
|
|
187
187
|
default: "info"
|
|
188
188
|
})),
|
|
189
|
+
actor_email: Schema.optionalKey(LintLevel.annotate({
|
|
190
|
+
title: "actor-email",
|
|
191
|
+
description: "An actor in generated.by, verified[].by, integrity.verified.by or [actors].humans contains \"@\", so an email address or domain is stored in the bundle or its config. Use a human:<id> without the domain. Default \"warn\".",
|
|
192
|
+
default: "warn"
|
|
193
|
+
})),
|
|
194
|
+
verified_actor_unknown: Schema.optionalKey(LintLevel.annotate({
|
|
195
|
+
title: "verified-actor-unknown",
|
|
196
|
+
description: "A human verified[].by or integrity.verified.by matches no entry of a non-empty [actors].humans. Silent when the list is empty. Default \"warn\".",
|
|
197
|
+
default: "warn"
|
|
198
|
+
})),
|
|
189
199
|
legacy_timestamp: Schema.optionalKey(LintLevel.annotate({
|
|
190
200
|
title: "legacy-timestamp",
|
|
191
201
|
description: "A concept uses the legacy timestamp field instead of generated.at. Default \"info\".",
|
|
@@ -198,7 +208,7 @@ const LintTable = Schema.Struct({
|
|
|
198
208
|
})),
|
|
199
209
|
stale: Schema.optionalKey(LintLevel.annotate({
|
|
200
210
|
title: "stale",
|
|
201
|
-
description: "A concept
|
|
211
|
+
description: "A concept is past its stale_after instant. Default \"info\".",
|
|
202
212
|
default: "info"
|
|
203
213
|
})),
|
|
204
214
|
walk_unreadable: Schema.optionalKey(LintLevel.annotate({
|
|
@@ -211,6 +221,11 @@ const LintTable = Schema.Struct({
|
|
|
211
221
|
description: "A committed concept's generated.at is missing or does not match its last body-changing commit, and is not otherwise authoritative (issue #19: a stamp recorded during the unchanged-body run survives a squash/rebase merge). Default \"warn\".",
|
|
212
222
|
default: "warn"
|
|
213
223
|
})),
|
|
224
|
+
verified_drift: Schema.optionalKey(LintLevel.annotate({
|
|
225
|
+
title: "verified-drift",
|
|
226
|
+
description: "A concept's latest human verification no longer covers its current content: the body or authored frontmatter changed since, the binding (integrity.verified) is missing, a later human entry is unbound, or the bound verifier is not in a non-empty [actors].humans. Draft and deprecated concepts are exempt, since okfit verify refuses them. A signal to re-verify, not a gate. Default \"warn\".",
|
|
227
|
+
default: "warn"
|
|
228
|
+
})),
|
|
214
229
|
status_missing: Schema.optionalKey(LintLevel.annotate({
|
|
215
230
|
title: "status-missing",
|
|
216
231
|
description: "A concept carries neither status nor verified, so it silently reads as stable (issue #110). Off by default because the spec reads an absent status as stable; the software-project profile raises it to \"warn\".",
|
|
@@ -228,12 +243,12 @@ const LintTable = Schema.Struct({
|
|
|
228
243
|
})),
|
|
229
244
|
publication_drift: Schema.optionalKey(LintLevel.annotate({
|
|
230
245
|
title: "publication-drift",
|
|
231
|
-
description: "A Publication's renders[].
|
|
246
|
+
description: "A Publication's renders[].body is missing or no longer matches the current body of the concept it names, so the published page may restate stale facts. Default \"warn\".",
|
|
232
247
|
default: "warn"
|
|
233
248
|
})),
|
|
234
249
|
publication_orphan: Schema.optionalKey(LintLevel.annotate({
|
|
235
250
|
title: "publication-orphan",
|
|
236
|
-
description: "A Publication's surface or renders[].path does not resolve to a concept, or renders is not a list of { path,
|
|
251
|
+
description: "A Publication's surface or renders[].path does not resolve to a concept, or renders is not a list of { path, body } entries. Default \"error\".",
|
|
237
252
|
default: "error"
|
|
238
253
|
})),
|
|
239
254
|
surface_unmatched: Schema.optionalKey(LintLevel.annotate({
|
|
@@ -299,11 +314,11 @@ const okfitConfigFields = Schema.Struct({
|
|
|
299
314
|
title: "Agent actor",
|
|
300
315
|
description: "The actor id an agent writes as `generated.by`."
|
|
301
316
|
})),
|
|
302
|
-
humans: Schema.optionalKey(Schema.Array(
|
|
317
|
+
humans: Schema.optionalKey(Schema.Array(ActorPattern).annotate({
|
|
303
318
|
title: "Human actors",
|
|
304
|
-
description: "
|
|
319
|
+
description: "The humans allowed to verify concepts in this bundle: \"human:<id>\" ids or id globs (\"human:spencer*\"). Empty or absent lets any resolved identity verify; non-empty makes it an allow-list for okfit verify and the trust signal. Never an email address.",
|
|
305
320
|
default: [],
|
|
306
|
-
examples: [["human:spencer"]]
|
|
321
|
+
examples: [["human:spencer"], ["human:spencer", "human:team-*"]]
|
|
307
322
|
}))
|
|
308
323
|
}).annotate({
|
|
309
324
|
title: "Actor identities",
|
|
@@ -448,11 +463,14 @@ const LINT_KEY = {
|
|
|
448
463
|
"footnote-undefined": "footnote_undefined",
|
|
449
464
|
"log-frontmatter": "log_frontmatter",
|
|
450
465
|
"actor-prefix-unknown": "actor_prefix_unknown",
|
|
466
|
+
"actor-email": "actor_email",
|
|
467
|
+
"verified-actor-unknown": "verified_actor_unknown",
|
|
451
468
|
"legacy-timestamp": "legacy_timestamp",
|
|
452
469
|
"config-unknown-key": "config_unknown_key",
|
|
453
470
|
stale: "stale",
|
|
454
471
|
"walk-unreadable": "walk_unreadable",
|
|
455
472
|
"generated-at-drift": "generated_at_drift",
|
|
473
|
+
"verified-drift": "verified_drift",
|
|
456
474
|
"status-missing": "status_missing",
|
|
457
475
|
"source-resource-missing": "source_resource_missing",
|
|
458
476
|
"generated-missing": "generated_missing",
|
|
@@ -473,11 +491,14 @@ const DEFAULT_LINT = {
|
|
|
473
491
|
footnote_undefined: "warn",
|
|
474
492
|
log_frontmatter: "warn",
|
|
475
493
|
actor_prefix_unknown: "info",
|
|
494
|
+
actor_email: "warn",
|
|
495
|
+
verified_actor_unknown: "warn",
|
|
476
496
|
legacy_timestamp: "info",
|
|
477
497
|
config_unknown_key: "warn",
|
|
478
498
|
stale: "info",
|
|
479
499
|
walk_unreadable: "warn",
|
|
480
500
|
generated_at_drift: "warn",
|
|
501
|
+
verified_drift: "warn",
|
|
481
502
|
status_missing: "off",
|
|
482
503
|
source_resource_missing: "warn",
|
|
483
504
|
generated_missing: "warn",
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @okfit/core
|
|
2
2
|
|
|
3
|
-
Spec-level [Open Knowledge Format (OKF)](https://github.com/GoogleCloudPlatform/knowledge-
|
|
3
|
+
Spec-level [Open Knowledge Format (OKF)](https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/main/SPEC.md) v0.2 support for [Effect](https://effect.website): frontmatter schemas, bundle loading, the concept link graph, trust and staleness derivation, and conformance validation.
|
|
4
4
|
|
|
5
5
|
> **Pre-release.** Part of the `@okfit/*` kit, in early development against a single pinned Effect v4 prerelease.
|
|
6
6
|
|
package/index.d.ts
CHANGED
|
@@ -21,7 +21,25 @@ type ActorForm = "producer" | "human" | "process" | "other";
|
|
|
21
21
|
export declare const Actor: Schema.Codec<Actor, string> & {
|
|
22
22
|
readonly isHuman: (actor: string) => boolean;
|
|
23
23
|
readonly form: (actor: string) => ActorForm;
|
|
24
|
+
/** True when the actor equals the pattern, case-insensitively; `*` and `?` are the only wildcards. */
|
|
25
|
+
readonly matches: (actor: string, pattern: string) => boolean;
|
|
26
|
+
/** True when `humans` is empty, else when the actor matches at least one entry. */
|
|
27
|
+
readonly allowed: (actor: string, humans: ReadonlyArray<string>) => boolean;
|
|
28
|
+
/** True when the value contains a glob character (`*` or `?`). */
|
|
29
|
+
readonly isPattern: (value: string) => boolean;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* An `[actors].humans` entry: an exact actor id, or an id glob (`*`, `?`)
|
|
33
|
+
* such as `human:spencer*`. Same grammar as {@link (Actor:variable)}; the
|
|
34
|
+
* glob characters are already legal id characters.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export type ActorPattern = string & Brand.Brand<"ActorPattern">;
|
|
38
|
+
/**
|
|
39
|
+
* Branded, pattern-checked `[actors].humans` entry codec.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare const ActorPattern: Schema.Codec<ActorPattern, string>;
|
|
25
43
|
//#endregion
|
|
26
44
|
//#region src/AttestedComputation.d.ts
|
|
27
45
|
declare const ComputationParameter_base: Schema.Class<ComputationParameter, Schema.Struct<{
|
|
@@ -66,24 +84,20 @@ declare const AttestedComputation_base: Schema.Class<AttestedComputation, Schema
|
|
|
66
84
|
export declare class AttestedComputation extends AttestedComputation_base {}
|
|
67
85
|
//#endregion
|
|
68
86
|
//#region src/Generated.d.ts
|
|
69
|
-
/**
|
|
70
|
-
* A lowercase 64-character hex sha256 digest of a concept's body, as `@okfit/profiles`'
|
|
71
|
-
* `Derivation.bodyDigest` computes it (issue #19). Optional: every concept stamped before
|
|
72
|
-
* this field existed lacks it, and core itself never computes one -- it only holds the field.
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
export declare const BodySha256: Schema.String;
|
|
76
|
-
/**
|
|
77
|
-
* The type of {@link (BodySha256:variable)}.
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export type BodySha256 = typeof BodySha256.Type;
|
|
81
87
|
declare const Generated_base: Schema.Class<Generated, Schema.Struct<{
|
|
82
88
|
readonly by: Schema.Codec<Actor, string, never, never> & {
|
|
83
89
|
readonly isHuman: (actor: string) => boolean;
|
|
84
90
|
readonly form: (actor: string) => ActorForm;
|
|
91
|
+
readonly matches: (actor: string, pattern: string) => boolean;
|
|
92
|
+
readonly allowed: (actor: string, humans: ReadonlyArray<string>) => boolean;
|
|
93
|
+
readonly isPattern: (value: string) => boolean;
|
|
85
94
|
};
|
|
86
95
|
readonly at: Schema.optionalKey<Schema.Codec<import("effect/DateTime").Utc, string, never, never>>;
|
|
96
|
+
/**
|
|
97
|
+
* Legacy (pre-integrity) body digest, read only as a migration fallback and never
|
|
98
|
+
* written. Lenient on purpose: a malformed legacy value must never fail the
|
|
99
|
+
* `generated` family and drop `by`/`at`. `okfit sync` moves it to `integrity.generated.body`.
|
|
100
|
+
*/
|
|
87
101
|
readonly body_sha256: Schema.optionalKey<Schema.String>;
|
|
88
102
|
}>, {}>;
|
|
89
103
|
/**
|
|
@@ -95,6 +109,55 @@ export declare class Generated extends Generated_base {
|
|
|
95
109
|
static readonly LEGACY_BY: Actor;
|
|
96
110
|
}
|
|
97
111
|
//#endregion
|
|
112
|
+
//#region src/Integrity.d.ts
|
|
113
|
+
/**
|
|
114
|
+
* An okfit digest: the first 16 lowercase hex characters (64 bits) of SHA-256 over the
|
|
115
|
+
* input bytes `@okfit/profiles` defines. A signal, not a tamper seal. Core holds the
|
|
116
|
+
* shape and never computes one.
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare const Digest: Schema.String;
|
|
120
|
+
/**
|
|
121
|
+
* The type of {@link (Digest:variable)}.
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export type Digest = typeof Digest.Type;
|
|
125
|
+
declare const IntegrityGenerated_base: Schema.Class<IntegrityGenerated, Schema.Struct<{
|
|
126
|
+
readonly body: Schema.String;
|
|
127
|
+
}>, {}>;
|
|
128
|
+
/**
|
|
129
|
+
* The body digest as of `generated.at`.
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export declare class IntegrityGenerated extends IntegrityGenerated_base {}
|
|
133
|
+
declare const IntegrityVerified_base: Schema.Class<IntegrityVerified, Schema.Struct<{
|
|
134
|
+
readonly by: Schema.Codec<Actor, string, never, never> & {
|
|
135
|
+
readonly isHuman: (actor: string) => boolean;
|
|
136
|
+
readonly form: (actor: string) => ActorForm;
|
|
137
|
+
readonly matches: (actor: string, pattern: string) => boolean;
|
|
138
|
+
readonly allowed: (actor: string, humans: ReadonlyArray<string>) => boolean;
|
|
139
|
+
readonly isPattern: (value: string) => boolean;
|
|
140
|
+
};
|
|
141
|
+
readonly at: Schema.Codec<import("effect/DateTime").Utc, string, never, never>;
|
|
142
|
+
readonly content: Schema.String;
|
|
143
|
+
}>, {}>;
|
|
144
|
+
/**
|
|
145
|
+
* Binds one `human:` `verified` entry (joined on `by` and `at`) to the content it covered.
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
export declare class IntegrityVerified extends IntegrityVerified_base {}
|
|
149
|
+
declare const Integrity_base: Schema.Class<Integrity, Schema.Struct<{
|
|
150
|
+
readonly generated: Schema.optionalKey<typeof IntegrityGenerated>;
|
|
151
|
+
readonly verified: Schema.optionalKey<typeof IntegrityVerified>;
|
|
152
|
+
}>, {}>;
|
|
153
|
+
/**
|
|
154
|
+
* okfit's own top-level frontmatter family, the only place okfit stores digests
|
|
155
|
+
* (OKF v0.2 section 4.1 extension key). Spec families such as `generated` and
|
|
156
|
+
* `verified` stay exactly as the spec defines them.
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
export declare class Integrity extends Integrity_base {}
|
|
160
|
+
//#endregion
|
|
98
161
|
//#region src/Source.d.ts
|
|
99
162
|
declare const UsageWindow_base: Schema.Class<UsageWindow, Schema.Struct<{
|
|
100
163
|
readonly from: Schema.Codec<import("effect/DateTime").Utc, string, never, never>;
|
|
@@ -112,6 +175,9 @@ declare const Source_base: Schema.Class<Source, Schema.Struct<{
|
|
|
112
175
|
readonly author: Schema.optionalKey<Schema.Codec<Actor, string, never, never> & {
|
|
113
176
|
readonly isHuman: (actor: string) => boolean;
|
|
114
177
|
readonly form: (actor: string) => ActorForm;
|
|
178
|
+
readonly matches: (actor: string, pattern: string) => boolean;
|
|
179
|
+
readonly allowed: (actor: string, humans: ReadonlyArray<string>) => boolean;
|
|
180
|
+
readonly isPattern: (value: string) => boolean;
|
|
115
181
|
}>;
|
|
116
182
|
readonly usage_count: Schema.optionalKey<Schema.Union<readonly [Schema.Number, Schema.FiniteFromString]>>;
|
|
117
183
|
readonly last_modified: Schema.optionalKey<Schema.Codec<import("effect/DateTime").Utc, string, never, never>>;
|
|
@@ -128,6 +194,9 @@ declare const Verification_base: Schema.Class<Verification, Schema.Struct<{
|
|
|
128
194
|
readonly by: Schema.Codec<Actor, string, never, never> & {
|
|
129
195
|
readonly isHuman: (actor: string) => boolean;
|
|
130
196
|
readonly form: (actor: string) => ActorForm;
|
|
197
|
+
readonly matches: (actor: string, pattern: string) => boolean;
|
|
198
|
+
readonly allowed: (actor: string, humans: ReadonlyArray<string>) => boolean;
|
|
199
|
+
readonly isPattern: (value: string) => boolean;
|
|
131
200
|
};
|
|
132
201
|
readonly at: Schema.Codec<import("effect/DateTime").Utc, string, never, never>;
|
|
133
202
|
}>, {}>;
|
|
@@ -165,6 +234,7 @@ declare const Concept_base: Schema.Class<Concept, Schema.Struct<{
|
|
|
165
234
|
readonly verified: Schema.optionalKey<Schema.decodeTo<Schema.$Array<Schema.toType<typeof Verification>>, Schema.Union<readonly [typeof Verification, Schema.$Array<typeof Verification>]>, never, never>>;
|
|
166
235
|
readonly status: Schema.optionalKey<Schema.Literals<readonly ["draft", "stable", "deprecated"]>>;
|
|
167
236
|
readonly stale_after: Schema.optionalKey<Schema.Codec<import("effect/DateTime").Utc, string, never, never>>;
|
|
237
|
+
readonly integrity: Schema.optionalKey<typeof Integrity>;
|
|
168
238
|
readonly attested: Schema.optionalKey<typeof AttestedComputation>;
|
|
169
239
|
readonly extensions: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
170
240
|
readonly raw: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
@@ -207,11 +277,11 @@ export declare const ConformanceCode: Schema.Literals<readonly ["frontmatter-mis
|
|
|
207
277
|
/** @public */
|
|
208
278
|
export type ConformanceCode = typeof ConformanceCode.Type;
|
|
209
279
|
/** Severity from `OkfitConfig` (D-34). @public */
|
|
210
|
-
export declare const LintCode: Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched"]>;
|
|
280
|
+
export declare const LintCode: Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched", "verified-drift", "actor-email", "verified-actor-unknown"]>;
|
|
211
281
|
/** @public */
|
|
212
282
|
export type LintCode = typeof LintCode.Type;
|
|
213
283
|
/** @public */
|
|
214
|
-
export declare const DiagnosticCode: Schema.Union<readonly [Schema.Literals<readonly ["frontmatter-missing", "frontmatter-unclosed", "frontmatter-unparseable", "type-missing", "index-frontmatter", "index-malformed", "log-heading-invalid", "log-malformed"]>, Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched"]>]>;
|
|
284
|
+
export declare const DiagnosticCode: Schema.Union<readonly [Schema.Literals<readonly ["frontmatter-missing", "frontmatter-unclosed", "frontmatter-unparseable", "type-missing", "index-frontmatter", "index-malformed", "log-heading-invalid", "log-malformed"]>, Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched", "verified-drift", "actor-email", "verified-actor-unknown"]>]>;
|
|
215
285
|
/** @public */
|
|
216
286
|
export type DiagnosticCode = typeof DiagnosticCode.Type;
|
|
217
287
|
declare const DiagnosticRange_base: Schema.Class<DiagnosticRange, Schema.Struct<{
|
|
@@ -245,7 +315,7 @@ export declare class DiagnosticRange extends DiagnosticRange_base {
|
|
|
245
315
|
declare const Diagnostic_base: Schema.Class<Diagnostic, Schema.Struct<{
|
|
246
316
|
readonly file: Schema.String;
|
|
247
317
|
readonly range: Schema.optionalKey<typeof DiagnosticRange>;
|
|
248
|
-
readonly code: Schema.Union<readonly [Schema.Literals<readonly ["frontmatter-missing", "frontmatter-unclosed", "frontmatter-unparseable", "type-missing", "index-frontmatter", "index-malformed", "log-heading-invalid", "log-malformed"]>, Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched"]>]>;
|
|
318
|
+
readonly code: Schema.Union<readonly [Schema.Literals<readonly ["frontmatter-missing", "frontmatter-unclosed", "frontmatter-unparseable", "type-missing", "index-frontmatter", "index-malformed", "log-heading-invalid", "log-malformed"]>, Schema.Literals<readonly ["broken-links", "missing-index", "unknown-type", "required-key-missing", "field-value-unknown", "require-verified-unmet", "family-invalid", "computation-runtime-missing", "footnote-source-unknown", "footnote-undefined", "log-frontmatter", "actor-prefix-unknown", "legacy-timestamp", "config-unknown-key", "stale", "walk-unreadable", "generated-at-drift", "status-missing", "source-resource-missing", "generated-missing", "publication-drift", "publication-orphan", "surface-unmatched", "verified-drift", "actor-email", "verified-actor-unknown"]>]>;
|
|
249
319
|
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
|
|
250
320
|
readonly message: Schema.String;
|
|
251
321
|
}>, {}>;
|
|
@@ -657,11 +727,14 @@ export declare const LintTable: Schema.Struct<{
|
|
|
657
727
|
readonly footnote_undefined: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
658
728
|
readonly log_frontmatter: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
659
729
|
readonly actor_prefix_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
730
|
+
readonly actor_email: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
731
|
+
readonly verified_actor_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
660
732
|
readonly legacy_timestamp: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
661
733
|
readonly config_unknown_key: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
662
734
|
readonly stale: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
663
735
|
readonly walk_unreadable: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
664
736
|
readonly generated_at_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
737
|
+
readonly verified_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
665
738
|
readonly status_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
666
739
|
readonly source_resource_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
667
740
|
readonly generated_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
@@ -692,10 +765,7 @@ declare const okfitConfigFields: Schema.Struct<{
|
|
|
692
765
|
}>>;
|
|
693
766
|
readonly actors: Schema.optionalKey<Schema.Struct<{
|
|
694
767
|
readonly agent: Schema.optionalKey<Schema.Codec<Actor, string, never, never>>;
|
|
695
|
-
readonly humans: Schema.optionalKey<Schema.$Array<Schema.Codec<
|
|
696
|
-
readonly isHuman: (actor: string) => boolean;
|
|
697
|
-
readonly form: (actor: string) => ActorForm;
|
|
698
|
-
}>>;
|
|
768
|
+
readonly humans: Schema.optionalKey<Schema.$Array<Schema.Codec<ActorPattern, string, never, never>>>;
|
|
699
769
|
}>>;
|
|
700
770
|
readonly lint: Schema.optionalKey<Schema.Struct<{
|
|
701
771
|
readonly broken_links: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
@@ -710,11 +780,14 @@ declare const okfitConfigFields: Schema.Struct<{
|
|
|
710
780
|
readonly footnote_undefined: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
711
781
|
readonly log_frontmatter: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
712
782
|
readonly actor_prefix_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
783
|
+
readonly actor_email: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
784
|
+
readonly verified_actor_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
713
785
|
readonly legacy_timestamp: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
714
786
|
readonly config_unknown_key: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
715
787
|
readonly stale: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
716
788
|
readonly walk_unreadable: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
717
789
|
readonly generated_at_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
790
|
+
readonly verified_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
718
791
|
readonly status_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
719
792
|
readonly source_resource_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
720
793
|
readonly generated_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
@@ -798,10 +871,7 @@ export declare const okfitConfigDocumentFields: Schema.StructWithRest<Schema.Str
|
|
|
798
871
|
}>>;
|
|
799
872
|
readonly actors: Schema.optionalKey<Schema.Struct<{
|
|
800
873
|
readonly agent: Schema.optionalKey<Schema.Codec<Actor, string, never, never>>;
|
|
801
|
-
readonly humans: Schema.optionalKey<Schema.$Array<Schema.Codec<
|
|
802
|
-
readonly isHuman: (actor: string) => boolean;
|
|
803
|
-
readonly form: (actor: string) => ActorForm;
|
|
804
|
-
}>>;
|
|
874
|
+
readonly humans: Schema.optionalKey<Schema.$Array<Schema.Codec<ActorPattern, string, never, never>>>;
|
|
805
875
|
}>>;
|
|
806
876
|
readonly lint: Schema.optionalKey<Schema.Struct<{
|
|
807
877
|
readonly broken_links: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
@@ -816,11 +886,14 @@ export declare const okfitConfigDocumentFields: Schema.StructWithRest<Schema.Str
|
|
|
816
886
|
readonly footnote_undefined: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
817
887
|
readonly log_frontmatter: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
818
888
|
readonly actor_prefix_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
889
|
+
readonly actor_email: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
890
|
+
readonly verified_actor_unknown: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
819
891
|
readonly legacy_timestamp: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
820
892
|
readonly config_unknown_key: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
821
893
|
readonly stale: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
822
894
|
readonly walk_unreadable: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
823
895
|
readonly generated_at_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
896
|
+
readonly verified_drift: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
824
897
|
readonly status_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
825
898
|
readonly source_resource_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
826
899
|
readonly generated_missing: Schema.optionalKey<Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
|
|
@@ -892,7 +965,7 @@ declare const OkfitConfigFile_base: import("effect/Context").ServiceClass<OkfitC
|
|
|
892
965
|
};
|
|
893
966
|
readonly actors?: {
|
|
894
967
|
readonly agent?: Actor;
|
|
895
|
-
readonly humans?: readonly
|
|
968
|
+
readonly humans?: readonly ActorPattern[];
|
|
896
969
|
};
|
|
897
970
|
readonly lint?: {
|
|
898
971
|
readonly broken_links?: "error" | "info" | "off" | "warn";
|
|
@@ -907,11 +980,14 @@ declare const OkfitConfigFile_base: import("effect/Context").ServiceClass<OkfitC
|
|
|
907
980
|
readonly footnote_undefined?: "error" | "info" | "off" | "warn";
|
|
908
981
|
readonly log_frontmatter?: "error" | "info" | "off" | "warn";
|
|
909
982
|
readonly actor_prefix_unknown?: "error" | "info" | "off" | "warn";
|
|
983
|
+
readonly actor_email?: "error" | "info" | "off" | "warn";
|
|
984
|
+
readonly verified_actor_unknown?: "error" | "info" | "off" | "warn";
|
|
910
985
|
readonly legacy_timestamp?: "error" | "info" | "off" | "warn";
|
|
911
986
|
readonly config_unknown_key?: "error" | "info" | "off" | "warn";
|
|
912
987
|
readonly stale?: "error" | "info" | "off" | "warn";
|
|
913
988
|
readonly walk_unreadable?: "error" | "info" | "off" | "warn";
|
|
914
989
|
readonly generated_at_drift?: "error" | "info" | "off" | "warn";
|
|
990
|
+
readonly verified_drift?: "error" | "info" | "off" | "warn";
|
|
915
991
|
readonly status_missing?: "error" | "info" | "off" | "warn";
|
|
916
992
|
readonly source_resource_missing?: "error" | "info" | "off" | "warn";
|
|
917
993
|
readonly generated_missing?: "error" | "info" | "off" | "warn";
|
package/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Actor } from "./Actor.js";
|
|
1
|
+
import { Actor, ActorPattern } from "./Actor.js";
|
|
2
2
|
import { AttestedComputation, ComputationAttester, ComputationExecutor, ComputationParameter } from "./AttestedComputation.js";
|
|
3
3
|
import { Timestamp } from "./Timestamp.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Generated } from "./Generated.js";
|
|
5
|
+
import { Digest, Integrity, IntegrityGenerated, IntegrityVerified } from "./Integrity.js";
|
|
5
6
|
import { Source, UsageWindow } from "./Source.js";
|
|
6
7
|
import { Status } from "./Status.js";
|
|
7
8
|
import { Verification } from "./Verification.js";
|
|
@@ -25,4 +26,4 @@ import { Validate } from "./Validate.js";
|
|
|
25
26
|
const OKF_SPEC_VERSION = "0.2";
|
|
26
27
|
|
|
27
28
|
//#endregion
|
|
28
|
-
export { ATTESTED_COMPUTATION_TYPE, Actor,
|
|
29
|
+
export { ATTESTED_COMPUTATION_TYPE, Actor, ActorPattern, AttestedComputation, Bundle, BundleDepthExceededError, BundleReadError, BundleRootNotFoundError, CONFIG_SCHEMA_VERSION, ComputationAttester, ComputationExecutor, ComputationParameter, Concept, ConceptId, ConformanceCode, Derive, Diagnostic, DiagnosticCode, DiagnosticRange, DiagnosticSeverity, Digest, FieldDeclaration, Generated, Graph, GraphNodeKind, IndexDocument, IndexEntry, IndexSection, Integrity, IntegrityGenerated, IntegrityVerified, LinkGraph, LintCode, LintLevel, LintTable, LoadedBundle, LoadedConcept, LogDocument, LogGroup, LogItem, OKF_SPEC_VERSION, OkfitConfig, OkfitConfigFile, SCHEMA_DIRECTIVE, Source, StaleAfterDuration, Staleness, Status, TagDeclaration, Timestamp, TrustTier, TypeDeclaration, UsageWindow, Validate, Verification, okfitConfigDocumentFields, okfitConfigSchemaHost };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AttestedComputation } from "../AttestedComputation.js";
|
|
2
2
|
import { Timestamp } from "../Timestamp.js";
|
|
3
3
|
import { Generated } from "../Generated.js";
|
|
4
|
+
import { Integrity } from "../Integrity.js";
|
|
4
5
|
import { Source, UsageWindow } from "../Source.js";
|
|
5
6
|
import { Status } from "../Status.js";
|
|
6
7
|
import { Verification } from "../Verification.js";
|
|
@@ -28,7 +29,8 @@ const FAMILY_SCHEMAS = {
|
|
|
28
29
|
generated: Generated,
|
|
29
30
|
verified: Verification.List,
|
|
30
31
|
status: Status,
|
|
31
|
-
stale_after: Timestamp
|
|
32
|
+
stale_after: Timestamp,
|
|
33
|
+
integrity: Integrity
|
|
32
34
|
};
|
|
33
35
|
const FAMILY_KEYS = Object.keys(FAMILY_SCHEMAS);
|
|
34
36
|
const PARSE_OPTIONS = { errors: "all" };
|
package/internal/lintRules.js
CHANGED
|
@@ -85,6 +85,43 @@ const actorPrefixUnknown = perConcept("actor-prefix-unknown", (concept) => {
|
|
|
85
85
|
}
|
|
86
86
|
return out;
|
|
87
87
|
});
|
|
88
|
+
/** Every actor-valued frontmatter field of a concept, with the path that names it. */
|
|
89
|
+
const actorsOf = (concept) => {
|
|
90
|
+
const verifiedPath = (index) => Array.isArray(concept.frontmatter.raw.verified) ? [
|
|
91
|
+
"verified",
|
|
92
|
+
index,
|
|
93
|
+
"by"
|
|
94
|
+
] : ["verified", "by"];
|
|
95
|
+
const binding = concept.frontmatter.integrity?.verified;
|
|
96
|
+
return [
|
|
97
|
+
...concept.frontmatter.generated === void 0 ? [] : [{
|
|
98
|
+
by: concept.frontmatter.generated.by,
|
|
99
|
+
path: ["generated", "by"]
|
|
100
|
+
}],
|
|
101
|
+
...(concept.frontmatter.verified ?? []).map((entry, index) => ({
|
|
102
|
+
by: entry.by,
|
|
103
|
+
path: verifiedPath(index)
|
|
104
|
+
})),
|
|
105
|
+
...binding === void 0 ? [] : [{
|
|
106
|
+
by: binding.by,
|
|
107
|
+
path: [
|
|
108
|
+
"integrity",
|
|
109
|
+
"verified",
|
|
110
|
+
"by"
|
|
111
|
+
]
|
|
112
|
+
}]
|
|
113
|
+
];
|
|
114
|
+
};
|
|
115
|
+
const EMAIL_HINT = "okfit never stores email addresses; use a human:<id> without the domain";
|
|
116
|
+
const actorEmail = rule("actor-email", (context, severity) => [...(context.config.actors?.humans ?? []).filter((entry) => entry.includes("@")).map((entry) => diagnostic("", "actor-email", severity, `actors.humans entry "${entry}" contains "@"; ${EMAIL_HINT}`, void 0)), ...[...context.bundle.concepts.values()].flatMap((concept) => actorsOf(concept).filter((candidate) => candidate.by.includes("@")).map((candidate) => diagnostic(concept.path, "actor-email", severity, `Actor "${candidate.by}" contains "@"; ${EMAIL_HINT}`, frontmatterPathRange(concept.document, candidate.path))))]);
|
|
117
|
+
const verifiedActorUnknown = perConcept("verified-actor-unknown", (concept, context) => {
|
|
118
|
+
const humans = context.config.actors?.humans ?? [];
|
|
119
|
+
if (humans.length === 0) return [];
|
|
120
|
+
return actorsOf(concept).filter((candidate) => candidate.path[0] !== "generated").filter((candidate) => Actor.isHuman(candidate.by) && !Actor.allowed(candidate.by, humans)).map((candidate) => ({
|
|
121
|
+
message: `Verifier "${candidate.by}" matches no entry of actors.humans; add it there, or have a listed human re-verify`,
|
|
122
|
+
path: candidate.path
|
|
123
|
+
}));
|
|
124
|
+
});
|
|
88
125
|
const stale = perConcept("stale", (concept, context) => context.now !== void 0 && concept.frontmatter.stale_after !== void 0 && Derive.isStale(concept.frontmatter, context.now) ? [{
|
|
89
126
|
message: `Concept is stale since ${DateTime.formatIso(concept.frontmatter.stale_after)}`,
|
|
90
127
|
path: ["stale_after"]
|
|
@@ -234,6 +271,8 @@ const LINT_RULES = [
|
|
|
234
271
|
statusMissing,
|
|
235
272
|
generatedMissing,
|
|
236
273
|
actorPrefixUnknown,
|
|
274
|
+
actorEmail,
|
|
275
|
+
verifiedActorUnknown,
|
|
237
276
|
footnoteSourceUnknown,
|
|
238
277
|
footnoteUndefined,
|
|
239
278
|
brokenLinks,
|
|
@@ -242,4 +281,4 @@ const LINT_RULES = [
|
|
|
242
281
|
];
|
|
243
282
|
|
|
244
283
|
//#endregion
|
|
245
|
-
export { LINT_RULES, actorPrefixUnknown, brokenLinks, configUnknownKey, fieldValueUnknown, footnoteSourceUnknown, footnoteUndefined, generatedMissing, missingIndex, requireVerifiedUnmet, requiredKeyMissing, stale, statusMissing, unknownType };
|
|
284
|
+
export { LINT_RULES, actorEmail, actorPrefixUnknown, brokenLinks, configUnknownKey, fieldValueUnknown, footnoteSourceUnknown, footnoteUndefined, generatedMissing, missingIndex, requireVerifiedUnmet, requiredKeyMissing, stale, statusMissing, unknownType, verifiedActorUnknown };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okfit/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Spec-level Open Knowledge Format (OKF) v0.2 schemas, bundle loading, graph, derivation, and validation for Effect.",
|
|
6
6
|
"keywords": [
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@effected/config-file": "^0.
|
|
41
|
-
"@effected/glob": "^0.
|
|
42
|
-
"@effected/jsonc": "^0.
|
|
43
|
-
"@effected/markdown": "^0.
|
|
44
|
-
"@effected/schemastore": "^0.
|
|
45
|
-
"@effected/toml": "^0.
|
|
46
|
-
"@effected/walker": "^0.
|
|
47
|
-
"@effected/yaml": "^0.
|
|
40
|
+
"@effected/config-file": "^0.15.0",
|
|
41
|
+
"@effected/glob": "^0.11.0",
|
|
42
|
+
"@effected/jsonc": "^0.16.0",
|
|
43
|
+
"@effected/markdown": "^0.16.0",
|
|
44
|
+
"@effected/schemastore": "^0.22.0",
|
|
45
|
+
"@effected/toml": "^0.12.0",
|
|
46
|
+
"@effected/walker": "^0.16.0",
|
|
47
|
+
"@effected/yaml": "^0.20.0",
|
|
48
48
|
"effect": "^4.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|