@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.
Files changed (76) hide show
  1. package/.turbo/turbo-build.log +53 -48
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +30 -0
  4. package/dist/browser/docs/index.js +44 -0
  5. package/dist/browser/docs/versioned-knowledge-base.docblock.js +44 -0
  6. package/dist/browser/entities/index.js +74 -0
  7. package/dist/browser/entities/models.js +74 -0
  8. package/dist/browser/events.js +101 -0
  9. package/dist/browser/example.js +35 -0
  10. package/dist/browser/handlers/index.js +115 -0
  11. package/dist/browser/handlers/memory.handlers.js +115 -0
  12. package/dist/browser/index.js +586 -0
  13. package/dist/browser/operations/index.js +257 -0
  14. package/dist/browser/operations/kb.js +257 -0
  15. package/dist/browser/versioned-knowledge-base.feature.js +36 -0
  16. package/dist/docs/index.d.ts +2 -1
  17. package/dist/docs/index.d.ts.map +1 -0
  18. package/dist/docs/index.js +45 -1
  19. package/dist/docs/versioned-knowledge-base.docblock.d.ts +2 -1
  20. package/dist/docs/versioned-knowledge-base.docblock.d.ts.map +1 -0
  21. package/dist/docs/versioned-knowledge-base.docblock.js +42 -28
  22. package/dist/entities/index.d.ts +2 -2
  23. package/dist/entities/index.d.ts.map +1 -0
  24. package/dist/entities/index.js +75 -3
  25. package/dist/entities/models.d.ts +127 -132
  26. package/dist/entities/models.d.ts.map +1 -1
  27. package/dist/entities/models.js +69 -145
  28. package/dist/events.d.ts +52 -58
  29. package/dist/events.d.ts.map +1 -1
  30. package/dist/events.js +92 -114
  31. package/dist/example.d.ts +2 -6
  32. package/dist/example.d.ts.map +1 -1
  33. package/dist/example.js +33 -46
  34. package/dist/handlers/index.d.ts +2 -2
  35. package/dist/handlers/index.d.ts.map +1 -0
  36. package/dist/handlers/index.js +116 -3
  37. package/dist/handlers/memory.handlers.d.ts +62 -64
  38. package/dist/handlers/memory.handlers.d.ts.map +1 -1
  39. package/dist/handlers/memory.handlers.js +110 -97
  40. package/dist/handlers/memory.handlers.test.d.ts +2 -0
  41. package/dist/handlers/memory.handlers.test.d.ts.map +1 -0
  42. package/dist/index.d.ts +13 -9
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +587 -11
  45. package/dist/node/docs/index.js +44 -0
  46. package/dist/node/docs/versioned-knowledge-base.docblock.js +44 -0
  47. package/dist/node/entities/index.js +74 -0
  48. package/dist/node/entities/models.js +74 -0
  49. package/dist/node/events.js +101 -0
  50. package/dist/node/example.js +35 -0
  51. package/dist/node/handlers/index.js +115 -0
  52. package/dist/node/handlers/memory.handlers.js +115 -0
  53. package/dist/node/index.js +586 -0
  54. package/dist/node/operations/index.js +257 -0
  55. package/dist/node/operations/kb.js +257 -0
  56. package/dist/node/versioned-knowledge-base.feature.js +36 -0
  57. package/dist/operations/index.d.ts +2 -2
  58. package/dist/operations/index.d.ts.map +1 -0
  59. package/dist/operations/index.js +257 -2
  60. package/dist/operations/kb.d.ts +252 -258
  61. package/dist/operations/kb.d.ts.map +1 -1
  62. package/dist/operations/kb.js +246 -244
  63. package/dist/versioned-knowledge-base.feature.d.ts +1 -6
  64. package/dist/versioned-knowledge-base.feature.d.ts.map +1 -1
  65. package/dist/versioned-knowledge-base.feature.js +35 -68
  66. package/package.json +141 -38
  67. package/tsdown.config.js +1 -2
  68. package/.turbo/turbo-build$colon$bundle.log +0 -47
  69. package/dist/docs/versioned-knowledge-base.docblock.js.map +0 -1
  70. package/dist/entities/models.js.map +0 -1
  71. package/dist/events.js.map +0 -1
  72. package/dist/example.js.map +0 -1
  73. package/dist/handlers/memory.handlers.js.map +0 -1
  74. package/dist/operations/kb.js.map +0 -1
  75. package/dist/versioned-knowledge-base.feature.js.map +0 -1
  76. 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
- //#region src/docs/versioned-knowledge-base.docblock.ts
4
- registerDocBlocks([{
5
- id: "docs.examples.versioned-knowledge-base.goal",
6
- title: "Versioned Knowledge Base Goal",
7
- summary: "Curated KB with immutable sources, versioned rules, and published snapshots referenced by answers.",
8
- kind: "goal",
9
- visibility: "public",
10
- route: "/docs/examples/versioned-knowledge-base/goal",
11
- tags: [
12
- "knowledge",
13
- "versioning",
14
- "snapshots",
15
- "traceability"
16
- ],
17
- body: `## Why it matters
18
- - Separates raw sources from curated knowledge.\n- Ensures assistant answers cite a published snapshot.\n- Makes change review and safe regeneration possible.\n\n## Core invariants\n- Sources are immutable and content-addressed (hash).\n- Rule versions must cite at least one source.\n- Snapshots include only approved rule versions.`
19
- }, {
20
- id: "docs.examples.versioned-knowledge-base.reference",
21
- title: "Versioned Knowledge Base — Reference",
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
- //#endregion
31
- //# sourceMappingURL=versioned-knowledge-base.docblock.js.map
38
+ ## Events
39
+ - kb.source.ingested
40
+ - kb.ruleVersion.created
41
+ - kb.ruleVersion.approved
42
+ - kb.snapshot.published`
43
+ }
44
+ ];
45
+ registerDocBlocks(docBlocks);
@@ -1,2 +1,2 @@
1
- import { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel } from "./models.js";
2
- export { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel };
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"}
@@ -1,3 +1,75 @@
1
- import { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel } from "./models.js";
2
-
3
- export { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel };
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
- import * as _contractspec_lib_schema84 from "@contractspec/lib.schema";
2
-
3
- //#region src/entities/models.d.ts
4
- declare const SourceDocumentModel: _contractspec_lib_schema84.SchemaModel<{
5
- id: {
6
- type: _contractspec_lib_schema84.FieldType<string, string>;
7
- isOptional: false;
8
- };
9
- jurisdiction: {
10
- type: _contractspec_lib_schema84.FieldType<string, string>;
11
- isOptional: false;
12
- };
13
- authority: {
14
- type: _contractspec_lib_schema84.FieldType<string, string>;
15
- isOptional: false;
16
- };
17
- title: {
18
- type: _contractspec_lib_schema84.FieldType<string, string>;
19
- isOptional: false;
20
- };
21
- fetchedAt: {
22
- type: _contractspec_lib_schema84.FieldType<Date, string>;
23
- isOptional: false;
24
- };
25
- hash: {
26
- type: _contractspec_lib_schema84.FieldType<string, string>;
27
- isOptional: false;
28
- };
29
- fileId: {
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: _contractspec_lib_schema84.SchemaModel<{
35
- sourceDocumentId: {
36
- type: _contractspec_lib_schema84.FieldType<string, string>;
37
- isOptional: false;
38
- };
39
- excerpt: {
40
- type: _contractspec_lib_schema84.FieldType<string, string>;
41
- isOptional: true;
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: _contractspec_lib_schema84.SchemaModel<{
45
- id: {
46
- type: _contractspec_lib_schema84.FieldType<string, string>;
47
- isOptional: false;
48
- };
49
- jurisdiction: {
50
- type: _contractspec_lib_schema84.FieldType<string, string>;
51
- isOptional: false;
52
- };
53
- topicKey: {
54
- type: _contractspec_lib_schema84.FieldType<string, string>;
55
- isOptional: false;
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: _contractspec_lib_schema84.SchemaModel<{
59
- id: {
60
- type: _contractspec_lib_schema84.FieldType<string, string>;
61
- isOptional: false;
62
- };
63
- ruleId: {
64
- type: _contractspec_lib_schema84.FieldType<string, string>;
65
- isOptional: false;
66
- };
67
- jurisdiction: {
68
- type: _contractspec_lib_schema84.FieldType<string, string>;
69
- isOptional: false;
70
- };
71
- topicKey: {
72
- type: _contractspec_lib_schema84.FieldType<string, string>;
73
- isOptional: false;
74
- };
75
- version: {
76
- type: _contractspec_lib_schema84.FieldType<string, string>;
77
- isOptional: false;
78
- };
79
- content: {
80
- type: _contractspec_lib_schema84.FieldType<string, string>;
81
- isOptional: false;
82
- };
83
- sourceRefs: {
84
- type: _contractspec_lib_schema84.SchemaModel<{
85
- sourceDocumentId: {
86
- type: _contractspec_lib_schema84.FieldType<string, string>;
87
- isOptional: false;
88
- };
89
- excerpt: {
90
- type: _contractspec_lib_schema84.FieldType<string, string>;
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
- isArray: true;
95
- isOptional: false;
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: _contractspec_lib_schema84.SchemaModel<{
115
- id: {
116
- type: _contractspec_lib_schema84.FieldType<string, string>;
117
- isOptional: false;
118
- };
119
- jurisdiction: {
120
- type: _contractspec_lib_schema84.FieldType<string, string>;
121
- isOptional: false;
122
- };
123
- asOfDate: {
124
- type: _contractspec_lib_schema84.FieldType<Date, string>;
125
- isOptional: false;
126
- };
127
- includedRuleVersionIds: {
128
- type: _contractspec_lib_schema84.FieldType<string, string>;
129
- isArray: true;
130
- isOptional: false;
131
- };
132
- publishedAt: {
133
- type: _contractspec_lib_schema84.FieldType<Date, string>;
134
- isOptional: false;
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","names":[],"sources":["../../src/entities/models.ts"],"sourcesContent":[],"mappings":";;;cAEa,gDAAmB;;UAa9B,0BAAA,CAAA;IAbW,UAAA,EAAA,KAAA;EAaX,CAAA;;;;;;;;;EAb8B,KAAA,EAAA;IAenB,IAAA,sCAUX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;IAVyB,IAAA,sCAAA,KAAA,EAAA,MAAA,CAAA;IAYd,UASX,EAAA,KAAA;EAAA,CAAA;;;;EAToB,CAAA;EAWT,MAAA,EAAA;IAiBX,IAAA,sCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;cAxCW,2CAAc;;UAUzB,0BAAA,CAAA;;;;;;;;cAEW,sCAAS;;IAWO,IAAA,EAF3B,0BAAA,CAAA,SAE2B,CAAA,MAAA,EAAA,MAAA,CAAA;IAmBhB,UAAA,EAAA,KAeX;EAAA,CAAA;;;;;;;;EAf0B,CAAA;;cAnBf,6CAAgB;;UAiB3B,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,4CAAe;;UAe1B,0BAAA,CAAA"}
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"}
@@ -1,151 +1,75 @@
1
+ // @bun
2
+ // src/entities/models.ts
1
3
  import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
-
3
- //#region src/entities/models.ts
4
- const SourceDocumentModel = defineSchemaModel({
5
- name: "SourceDocument",
6
- description: "Immutable raw source document metadata referencing a stored file.",
7
- fields: {
8
- id: {
9
- type: ScalarTypeEnum.String_unsecure(),
10
- isOptional: false
11
- },
12
- jurisdiction: {
13
- type: ScalarTypeEnum.String_unsecure(),
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
- const SourceRefModel = defineSchemaModel({
39
- name: "SourceRef",
40
- description: "Reference to a source document used to justify a rule version.",
41
- fields: {
42
- sourceDocumentId: {
43
- type: ScalarTypeEnum.String_unsecure(),
44
- isOptional: false
45
- },
46
- excerpt: {
47
- type: ScalarTypeEnum.String_unsecure(),
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
- const RuleModel = defineSchemaModel({
53
- name: "Rule",
54
- description: "Curated rule (stable identity) with topic + jurisdiction scope.",
55
- fields: {
56
- id: {
57
- type: ScalarTypeEnum.String_unsecure(),
58
- isOptional: false
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
- const RuleVersionModel = defineSchemaModel({
71
- name: "RuleVersion",
72
- description: "A versioned rule content with source references and approval status.",
73
- fields: {
74
- id: {
75
- type: ScalarTypeEnum.String_unsecure(),
76
- isOptional: false
77
- },
78
- ruleId: {
79
- type: ScalarTypeEnum.String_unsecure(),
80
- isOptional: false
81
- },
82
- jurisdiction: {
83
- type: ScalarTypeEnum.String_unsecure(),
84
- isOptional: false
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
- const KBSnapshotModel = defineSchemaModel({
122
- name: "KBSnapshot",
123
- description: "Published KB snapshot (as-of) referencing approved rule versions.",
124
- fields: {
125
- id: {
126
- type: ScalarTypeEnum.String_unsecure(),
127
- isOptional: false
128
- },
129
- jurisdiction: {
130
- type: ScalarTypeEnum.String_unsecure(),
131
- isOptional: false
132
- },
133
- asOfDate: {
134
- type: ScalarTypeEnum.DateTime(),
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
- //#endregion
150
- export { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel };
151
- //# sourceMappingURL=models.js.map
69
+ export {
70
+ SourceRefModel,
71
+ SourceDocumentModel,
72
+ RuleVersionModel,
73
+ RuleModel,
74
+ KBSnapshotModel
75
+ };