@contractspec/example.versioned-knowledge-base 1.56.1 → 1.58.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/.turbo/turbo-build.log +53 -48
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +30 -0
- package/dist/browser/docs/index.js +44 -0
- package/dist/browser/docs/versioned-knowledge-base.docblock.js +44 -0
- package/dist/browser/entities/index.js +74 -0
- package/dist/browser/entities/models.js +74 -0
- package/dist/browser/events.js +101 -0
- package/dist/browser/example.js +35 -0
- package/dist/browser/handlers/index.js +115 -0
- package/dist/browser/handlers/memory.handlers.js +115 -0
- package/dist/browser/index.js +586 -0
- package/dist/browser/operations/index.js +257 -0
- package/dist/browser/operations/kb.js +257 -0
- package/dist/browser/versioned-knowledge-base.feature.js +36 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +45 -1
- package/dist/docs/versioned-knowledge-base.docblock.d.ts +2 -1
- package/dist/docs/versioned-knowledge-base.docblock.d.ts.map +1 -0
- package/dist/docs/versioned-knowledge-base.docblock.js +42 -28
- package/dist/entities/index.d.ts +2 -2
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +75 -3
- package/dist/entities/models.d.ts +127 -132
- package/dist/entities/models.d.ts.map +1 -1
- package/dist/entities/models.js +69 -145
- package/dist/events.d.ts +52 -58
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +92 -114
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +33 -46
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +116 -3
- package/dist/handlers/memory.handlers.d.ts +62 -64
- package/dist/handlers/memory.handlers.d.ts.map +1 -1
- package/dist/handlers/memory.handlers.js +110 -97
- package/dist/handlers/memory.handlers.test.d.ts +2 -0
- package/dist/handlers/memory.handlers.test.d.ts.map +1 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +587 -11
- package/dist/node/docs/index.js +44 -0
- package/dist/node/docs/versioned-knowledge-base.docblock.js +44 -0
- package/dist/node/entities/index.js +74 -0
- package/dist/node/entities/models.js +74 -0
- package/dist/node/events.js +101 -0
- package/dist/node/example.js +35 -0
- package/dist/node/handlers/index.js +115 -0
- package/dist/node/handlers/memory.handlers.js +115 -0
- package/dist/node/index.js +586 -0
- package/dist/node/operations/index.js +257 -0
- package/dist/node/operations/kb.js +257 -0
- package/dist/node/versioned-knowledge-base.feature.js +36 -0
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +257 -2
- package/dist/operations/kb.d.ts +252 -258
- package/dist/operations/kb.d.ts.map +1 -1
- package/dist/operations/kb.js +246 -244
- package/dist/versioned-knowledge-base.feature.d.ts +1 -6
- package/dist/versioned-knowledge-base.feature.d.ts.map +1 -1
- package/dist/versioned-knowledge-base.feature.js +35 -68
- package/package.json +141 -38
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -47
- package/dist/docs/versioned-knowledge-base.docblock.js.map +0 -1
- package/dist/entities/models.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/memory.handlers.js.map +0 -1
- package/dist/operations/kb.js.map +0 -1
- package/dist/versioned-knowledge-base.feature.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,31 +1,45 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/docs/versioned-knowledge-base.docblock.ts
|
|
1
3
|
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
4
|
+
var docBlocks = [
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.versioned-knowledge-base.goal",
|
|
7
|
+
title: "Versioned Knowledge Base \u2014 Goal",
|
|
8
|
+
summary: "Curated KB with immutable sources, versioned rules, and published snapshots referenced by answers.",
|
|
9
|
+
kind: "goal",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/versioned-knowledge-base/goal",
|
|
12
|
+
tags: ["knowledge", "versioning", "snapshots", "traceability"],
|
|
13
|
+
body: `## Why it matters
|
|
14
|
+
- Separates raw sources from curated knowledge.
|
|
15
|
+
- Ensures assistant answers cite a published snapshot.
|
|
16
|
+
- Makes change review and safe regeneration possible.
|
|
2
17
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
summary: "Entities, contracts, and events for the versioned KB example.",
|
|
23
|
-
kind: "reference",
|
|
24
|
-
visibility: "public",
|
|
25
|
-
route: "/docs/examples/versioned-knowledge-base",
|
|
26
|
-
tags: ["knowledge", "reference"],
|
|
27
|
-
body: `## Contracts\n- kb.ingestSource\n- kb.upsertRuleVersion\n- kb.approveRuleVersion\n- kb.publishSnapshot\n- kb.search\n\n## Events\n- kb.source.ingested\n- kb.ruleVersion.created\n- kb.ruleVersion.approved\n- kb.snapshot.published`
|
|
28
|
-
}]);
|
|
18
|
+
## Core invariants
|
|
19
|
+
- Sources are immutable and content-addressed (hash).
|
|
20
|
+
- Rule versions must cite at least one source.
|
|
21
|
+
- Snapshots include only approved rule versions.`
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "docs.examples.versioned-knowledge-base.reference",
|
|
25
|
+
title: "Versioned Knowledge Base \u2014 Reference",
|
|
26
|
+
summary: "Entities, contracts, and events for the versioned KB example.",
|
|
27
|
+
kind: "reference",
|
|
28
|
+
visibility: "public",
|
|
29
|
+
route: "/docs/examples/versioned-knowledge-base",
|
|
30
|
+
tags: ["knowledge", "reference"],
|
|
31
|
+
body: `## Contracts
|
|
32
|
+
- kb.ingestSource
|
|
33
|
+
- kb.upsertRuleVersion
|
|
34
|
+
- kb.approveRuleVersion
|
|
35
|
+
- kb.publishSnapshot
|
|
36
|
+
- kb.search
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
## Events
|
|
39
|
+
- kb.source.ingested
|
|
40
|
+
- kb.ruleVersion.created
|
|
41
|
+
- kb.ruleVersion.approved
|
|
42
|
+
- kb.snapshot.published`
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
registerDocBlocks(docBlocks);
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from './models';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/dist/entities/index.js
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/models.ts
|
|
3
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
4
|
+
var SourceDocumentModel = defineSchemaModel({
|
|
5
|
+
name: "SourceDocument",
|
|
6
|
+
description: "Immutable raw source document metadata referencing a stored file.",
|
|
7
|
+
fields: {
|
|
8
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
+
fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
13
|
+
hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var SourceRefModel = defineSchemaModel({
|
|
18
|
+
name: "SourceRef",
|
|
19
|
+
description: "Reference to a source document used to justify a rule version.",
|
|
20
|
+
fields: {
|
|
21
|
+
sourceDocumentId: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var RuleModel = defineSchemaModel({
|
|
29
|
+
name: "Rule",
|
|
30
|
+
description: "Curated rule (stable identity) with topic + jurisdiction scope.",
|
|
31
|
+
fields: {
|
|
32
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
+
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var RuleVersionModel = defineSchemaModel({
|
|
38
|
+
name: "RuleVersion",
|
|
39
|
+
description: "A versioned rule content with source references and approval status.",
|
|
40
|
+
fields: {
|
|
41
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
+
ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
+
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
+
version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
46
|
+
content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
+
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },
|
|
48
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
+
approvedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
50
|
+
approvedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
51
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var KBSnapshotModel = defineSchemaModel({
|
|
55
|
+
name: "KBSnapshot",
|
|
56
|
+
description: "Published KB snapshot (as-of) referencing approved rule versions.",
|
|
57
|
+
fields: {
|
|
58
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
60
|
+
asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
61
|
+
includedRuleVersionIds: {
|
|
62
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
63
|
+
isArray: true,
|
|
64
|
+
isOptional: false
|
|
65
|
+
},
|
|
66
|
+
publishedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
SourceRefModel,
|
|
71
|
+
SourceDocumentModel,
|
|
72
|
+
RuleVersionModel,
|
|
73
|
+
RuleModel,
|
|
74
|
+
KBSnapshotModel
|
|
75
|
+
};
|
|
@@ -1,139 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: _contractspec_lib_schema84.FieldType<string, string>;
|
|
31
|
-
isOptional: false;
|
|
32
|
-
};
|
|
1
|
+
export declare const SourceDocumentModel: import("@contractspec/lib.schema").SchemaModel<{
|
|
2
|
+
id: {
|
|
3
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
4
|
+
isOptional: false;
|
|
5
|
+
};
|
|
6
|
+
jurisdiction: {
|
|
7
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
8
|
+
isOptional: false;
|
|
9
|
+
};
|
|
10
|
+
authority: {
|
|
11
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
12
|
+
isOptional: false;
|
|
13
|
+
};
|
|
14
|
+
title: {
|
|
15
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
16
|
+
isOptional: false;
|
|
17
|
+
};
|
|
18
|
+
fetchedAt: {
|
|
19
|
+
type: import("@contractspec/lib.schema").FieldType<Date, string>;
|
|
20
|
+
isOptional: false;
|
|
21
|
+
};
|
|
22
|
+
hash: {
|
|
23
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
24
|
+
isOptional: false;
|
|
25
|
+
};
|
|
26
|
+
fileId: {
|
|
27
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
28
|
+
isOptional: false;
|
|
29
|
+
};
|
|
33
30
|
}>;
|
|
34
|
-
declare const SourceRefModel:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
export declare const SourceRefModel: import("@contractspec/lib.schema").SchemaModel<{
|
|
32
|
+
sourceDocumentId: {
|
|
33
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
34
|
+
isOptional: false;
|
|
35
|
+
};
|
|
36
|
+
excerpt: {
|
|
37
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
38
|
+
isOptional: true;
|
|
39
|
+
};
|
|
43
40
|
}>;
|
|
44
|
-
declare const RuleModel:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
export declare const RuleModel: import("@contractspec/lib.schema").SchemaModel<{
|
|
42
|
+
id: {
|
|
43
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
44
|
+
isOptional: false;
|
|
45
|
+
};
|
|
46
|
+
jurisdiction: {
|
|
47
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
48
|
+
isOptional: false;
|
|
49
|
+
};
|
|
50
|
+
topicKey: {
|
|
51
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
52
|
+
isOptional: false;
|
|
53
|
+
};
|
|
57
54
|
}>;
|
|
58
|
-
declare const RuleVersionModel:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
55
|
+
export declare const RuleVersionModel: import("@contractspec/lib.schema").SchemaModel<{
|
|
56
|
+
id: {
|
|
57
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
58
|
+
isOptional: false;
|
|
59
|
+
};
|
|
60
|
+
ruleId: {
|
|
61
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
62
|
+
isOptional: false;
|
|
63
|
+
};
|
|
64
|
+
jurisdiction: {
|
|
65
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
66
|
+
isOptional: false;
|
|
67
|
+
};
|
|
68
|
+
topicKey: {
|
|
69
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
70
|
+
isOptional: false;
|
|
71
|
+
};
|
|
72
|
+
version: {
|
|
73
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
74
|
+
isOptional: false;
|
|
75
|
+
};
|
|
76
|
+
content: {
|
|
77
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
78
|
+
isOptional: false;
|
|
79
|
+
};
|
|
80
|
+
sourceRefs: {
|
|
81
|
+
type: import("@contractspec/lib.schema").SchemaModel<{
|
|
82
|
+
sourceDocumentId: {
|
|
83
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
84
|
+
isOptional: false;
|
|
85
|
+
};
|
|
86
|
+
excerpt: {
|
|
87
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
88
|
+
isOptional: true;
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
91
|
+
isArray: true;
|
|
92
|
+
isOptional: false;
|
|
93
|
+
};
|
|
94
|
+
status: {
|
|
95
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
96
|
+
isOptional: false;
|
|
97
|
+
};
|
|
98
|
+
approvedBy: {
|
|
99
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
100
|
+
isOptional: true;
|
|
101
|
+
};
|
|
102
|
+
approvedAt: {
|
|
103
|
+
type: import("@contractspec/lib.schema").FieldType<Date, string>;
|
|
91
104
|
isOptional: true;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
status: {
|
|
98
|
-
type: _contractspec_lib_schema84.FieldType<string, string>;
|
|
99
|
-
isOptional: false;
|
|
100
|
-
};
|
|
101
|
-
approvedBy: {
|
|
102
|
-
type: _contractspec_lib_schema84.FieldType<string, string>;
|
|
103
|
-
isOptional: true;
|
|
104
|
-
};
|
|
105
|
-
approvedAt: {
|
|
106
|
-
type: _contractspec_lib_schema84.FieldType<Date, string>;
|
|
107
|
-
isOptional: true;
|
|
108
|
-
};
|
|
109
|
-
createdAt: {
|
|
110
|
-
type: _contractspec_lib_schema84.FieldType<Date, string>;
|
|
111
|
-
isOptional: false;
|
|
112
|
-
};
|
|
105
|
+
};
|
|
106
|
+
createdAt: {
|
|
107
|
+
type: import("@contractspec/lib.schema").FieldType<Date, string>;
|
|
108
|
+
isOptional: false;
|
|
109
|
+
};
|
|
113
110
|
}>;
|
|
114
|
-
declare const KBSnapshotModel:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
export declare const KBSnapshotModel: import("@contractspec/lib.schema").SchemaModel<{
|
|
112
|
+
id: {
|
|
113
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
114
|
+
isOptional: false;
|
|
115
|
+
};
|
|
116
|
+
jurisdiction: {
|
|
117
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
118
|
+
isOptional: false;
|
|
119
|
+
};
|
|
120
|
+
asOfDate: {
|
|
121
|
+
type: import("@contractspec/lib.schema").FieldType<Date, string>;
|
|
122
|
+
isOptional: false;
|
|
123
|
+
};
|
|
124
|
+
includedRuleVersionIds: {
|
|
125
|
+
type: import("@contractspec/lib.schema").FieldType<string, string>;
|
|
126
|
+
isArray: true;
|
|
127
|
+
isOptional: false;
|
|
128
|
+
};
|
|
129
|
+
publishedAt: {
|
|
130
|
+
type: import("@contractspec/lib.schema").FieldType<Date, string>;
|
|
131
|
+
isOptional: false;
|
|
132
|
+
};
|
|
136
133
|
}>;
|
|
137
|
-
//#endregion
|
|
138
|
-
export { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel };
|
|
139
134
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/entities/models.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;EAUzB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;EASpB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;EAe1B,CAAC"}
|
package/dist/entities/models.js
CHANGED
|
@@ -1,151 +1,75 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/models.ts
|
|
1
3
|
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isOptional: false
|
|
15
|
-
},
|
|
16
|
-
authority: {
|
|
17
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
-
isOptional: false
|
|
19
|
-
},
|
|
20
|
-
title: {
|
|
21
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
-
isOptional: false
|
|
23
|
-
},
|
|
24
|
-
fetchedAt: {
|
|
25
|
-
type: ScalarTypeEnum.DateTime(),
|
|
26
|
-
isOptional: false
|
|
27
|
-
},
|
|
28
|
-
hash: {
|
|
29
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
30
|
-
isOptional: false
|
|
31
|
-
},
|
|
32
|
-
fileId: {
|
|
33
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
-
isOptional: false
|
|
35
|
-
}
|
|
36
|
-
}
|
|
4
|
+
var SourceDocumentModel = defineSchemaModel({
|
|
5
|
+
name: "SourceDocument",
|
|
6
|
+
description: "Immutable raw source document metadata referencing a stored file.",
|
|
7
|
+
fields: {
|
|
8
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
+
fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
13
|
+
hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
15
|
+
}
|
|
37
16
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
isOptional: true
|
|
49
|
-
}
|
|
50
|
-
}
|
|
17
|
+
var SourceRefModel = defineSchemaModel({
|
|
18
|
+
name: "SourceRef",
|
|
19
|
+
description: "Reference to a source document used to justify a rule version.",
|
|
20
|
+
fields: {
|
|
21
|
+
sourceDocumentId: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
26
|
+
}
|
|
51
27
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
jurisdiction: {
|
|
61
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
62
|
-
isOptional: false
|
|
63
|
-
},
|
|
64
|
-
topicKey: {
|
|
65
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
-
isOptional: false
|
|
67
|
-
}
|
|
68
|
-
}
|
|
28
|
+
var RuleModel = defineSchemaModel({
|
|
29
|
+
name: "Rule",
|
|
30
|
+
description: "Curated rule (stable identity) with topic + jurisdiction scope.",
|
|
31
|
+
fields: {
|
|
32
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
+
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
35
|
+
}
|
|
69
36
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
topicKey: {
|
|
87
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
88
|
-
isOptional: false
|
|
89
|
-
},
|
|
90
|
-
version: {
|
|
91
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
92
|
-
isOptional: false
|
|
93
|
-
},
|
|
94
|
-
content: {
|
|
95
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
96
|
-
isOptional: false
|
|
97
|
-
},
|
|
98
|
-
sourceRefs: {
|
|
99
|
-
type: SourceRefModel,
|
|
100
|
-
isArray: true,
|
|
101
|
-
isOptional: false
|
|
102
|
-
},
|
|
103
|
-
status: {
|
|
104
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
105
|
-
isOptional: false
|
|
106
|
-
},
|
|
107
|
-
approvedBy: {
|
|
108
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
109
|
-
isOptional: true
|
|
110
|
-
},
|
|
111
|
-
approvedAt: {
|
|
112
|
-
type: ScalarTypeEnum.DateTime(),
|
|
113
|
-
isOptional: true
|
|
114
|
-
},
|
|
115
|
-
createdAt: {
|
|
116
|
-
type: ScalarTypeEnum.DateTime(),
|
|
117
|
-
isOptional: false
|
|
118
|
-
}
|
|
119
|
-
}
|
|
37
|
+
var RuleVersionModel = defineSchemaModel({
|
|
38
|
+
name: "RuleVersion",
|
|
39
|
+
description: "A versioned rule content with source references and approval status.",
|
|
40
|
+
fields: {
|
|
41
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
+
ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
+
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
+
version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
46
|
+
content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
+
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },
|
|
48
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
+
approvedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
50
|
+
approvedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
51
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
52
|
+
}
|
|
120
53
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
isOptional: false
|
|
136
|
-
},
|
|
137
|
-
includedRuleVersionIds: {
|
|
138
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
139
|
-
isArray: true,
|
|
140
|
-
isOptional: false
|
|
141
|
-
},
|
|
142
|
-
publishedAt: {
|
|
143
|
-
type: ScalarTypeEnum.DateTime(),
|
|
144
|
-
isOptional: false
|
|
145
|
-
}
|
|
146
|
-
}
|
|
54
|
+
var KBSnapshotModel = defineSchemaModel({
|
|
55
|
+
name: "KBSnapshot",
|
|
56
|
+
description: "Published KB snapshot (as-of) referencing approved rule versions.",
|
|
57
|
+
fields: {
|
|
58
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
+
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
60
|
+
asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
61
|
+
includedRuleVersionIds: {
|
|
62
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
63
|
+
isArray: true,
|
|
64
|
+
isOptional: false
|
|
65
|
+
},
|
|
66
|
+
publishedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
67
|
+
}
|
|
147
68
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
69
|
+
export {
|
|
70
|
+
SourceRefModel,
|
|
71
|
+
SourceDocumentModel,
|
|
72
|
+
RuleVersionModel,
|
|
73
|
+
RuleModel,
|
|
74
|
+
KBSnapshotModel
|
|
75
|
+
};
|