@mandaitor/taxonomy-core 0.2.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.
@@ -0,0 +1,4 @@
1
+ export type { TaxonomyAction, TaxonomyResourcePattern, ResourceParameter, TaxonomyConstraintTemplate, TaxonomyMandateTemplate, IndustryTaxonomy, ValidationResult, ValidationError, } from "./types";
2
+ export { validateScope, validateConstraints, matchResourcePattern, getHighRiskActions, } from "./validator";
3
+ export { taxonomyRegistry, registerTaxonomy, getTaxonomy, listTaxonomies, lookupAction, lookupTemplate, searchActions, } from "./registry";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ // @mandaitor/taxonomy-core — Public API
2
+ // Single entry point for all taxonomy-core consumers.
3
+ // ── Validator ──
4
+ export { validateScope, validateConstraints, matchResourcePattern, getHighRiskActions, } from "./validator";
5
+ // ── Registry ──
6
+ export { taxonomyRegistry, registerTaxonomy, getTaxonomy, listTaxonomies, lookupAction, lookupTemplate, searchActions, } from "./registry";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,sDAAsD;AActD,kBAAkB;AAClB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,iBAAiB;AACjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { IndustryTaxonomy, TaxonomyAction, TaxonomyMandateTemplate } from "./types";
2
+ /**
3
+ * In-memory registry of loaded industry taxonomies.
4
+ * Singleton pattern — one registry per process.
5
+ */
6
+ declare class TaxonomyRegistry {
7
+ private taxonomies;
8
+ /**
9
+ * Register a taxonomy instance.
10
+ * @param taxonomy - The taxonomy to register
11
+ * @throws Error if the same id+version is already registered
12
+ */
13
+ register(taxonomy: IndustryTaxonomy): void;
14
+ /**
15
+ * Get a specific taxonomy by ID and optional version.
16
+ * If version is omitted, returns the latest registered version.
17
+ */
18
+ get(id: string, version?: string): IndustryTaxonomy | undefined;
19
+ /**
20
+ * List all registered taxonomy IDs with their latest versions.
21
+ */
22
+ list(): Array<{
23
+ id: string;
24
+ version: string;
25
+ name: string;
26
+ }>;
27
+ /**
28
+ * Look up a specific action across all taxonomies.
29
+ * Returns the taxonomy ID and the action definition.
30
+ */
31
+ lookupAction(actionId: string): {
32
+ taxonomyId: string;
33
+ action: TaxonomyAction;
34
+ } | undefined;
35
+ /**
36
+ * Look up a mandate template across all taxonomies.
37
+ */
38
+ lookupTemplate(templateId: string): {
39
+ taxonomyId: string;
40
+ template: TaxonomyMandateTemplate;
41
+ } | undefined;
42
+ /**
43
+ * Search actions across all taxonomies by tag or keyword.
44
+ */
45
+ searchActions(query: string): Array<{
46
+ taxonomyId: string;
47
+ action: TaxonomyAction;
48
+ }>;
49
+ /**
50
+ * Remove a taxonomy from the registry.
51
+ */
52
+ unregister(id: string, version?: string): boolean;
53
+ /** Clear all registered taxonomies. */
54
+ clear(): void;
55
+ }
56
+ export declare const taxonomyRegistry: TaxonomyRegistry;
57
+ export declare const registerTaxonomy: (t: IndustryTaxonomy) => void;
58
+ export declare const getTaxonomy: (id: string, v?: string) => IndustryTaxonomy | undefined;
59
+ export declare const listTaxonomies: () => {
60
+ id: string;
61
+ version: string;
62
+ name: string;
63
+ }[];
64
+ export declare const lookupAction: (id: string) => {
65
+ taxonomyId: string;
66
+ action: TaxonomyAction;
67
+ } | undefined;
68
+ export declare const lookupTemplate: (id: string) => {
69
+ taxonomyId: string;
70
+ template: TaxonomyMandateTemplate;
71
+ } | undefined;
72
+ export declare const searchActions: (q: string) => {
73
+ taxonomyId: string;
74
+ action: TaxonomyAction;
75
+ }[];
76
+ export {};
77
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEzF;;;GAGG;AACH,cAAM,gBAAgB;IACpB,OAAO,CAAC,UAAU,CAAoD;IAEtE;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAa1C;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAkB/D;;OAEG;IACH,IAAI,IAAI,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAW5D;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,GAAG,SAAS;IAU1F;;OAEG;IACH,cAAc,CACZ,UAAU,EAAE,MAAM,GACjB;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,uBAAuB,CAAA;KAAE,GAAG,SAAS;IAUxE;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC;IAmBnF;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAOjD,uCAAuC;IACvC,KAAK,IAAI,IAAI;CAGd;AAGD,eAAO,MAAM,gBAAgB,kBAAyB,CAAC;AAGvD,eAAO,MAAM,gBAAgB,GAAI,GAAG,gBAAgB,SAAiC,CAAC;AACtF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,EAAE,IAAI,MAAM,iCAAgC,CAAC;AACnF,eAAO,MAAM,cAAc;QApFL,MAAM;aAAW,MAAM;UAAQ,MAAM;GAoFA,CAAC;AAC5D,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM;gBAtES,MAAM;YAAU,cAAc;aAsED,CAAC;AAC9E,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM;gBAxDtB,MAAM;cAAY,uBAAuB;aAwDqB,CAAC;AAClF,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM;gBA5Ca,MAAM;YAAU,cAAc;GA4CL,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * In-memory registry of loaded industry taxonomies.
3
+ * Singleton pattern — one registry per process.
4
+ */
5
+ class TaxonomyRegistry {
6
+ taxonomies = new Map();
7
+ /**
8
+ * Register a taxonomy instance.
9
+ * @param taxonomy - The taxonomy to register
10
+ * @throws Error if the same id+version is already registered
11
+ */
12
+ register(taxonomy) {
13
+ if (!this.taxonomies.has(taxonomy.id)) {
14
+ this.taxonomies.set(taxonomy.id, new Map());
15
+ }
16
+ const versions = this.taxonomies.get(taxonomy.id);
17
+ if (versions.has(taxonomy.version)) {
18
+ throw new Error(`Taxonomy "${taxonomy.id}" version ${taxonomy.version} is already registered`);
19
+ }
20
+ versions.set(taxonomy.version, taxonomy);
21
+ }
22
+ /**
23
+ * Get a specific taxonomy by ID and optional version.
24
+ * If version is omitted, returns the latest registered version.
25
+ */
26
+ get(id, version) {
27
+ const versions = this.taxonomies.get(id);
28
+ if (!versions || versions.size === 0)
29
+ return undefined;
30
+ if (version)
31
+ return versions.get(version);
32
+ // Return latest version (simple semver sort)
33
+ const sorted = [...versions.keys()].sort((a, b) => {
34
+ const pa = a.split(".").map(Number);
35
+ const pb = b.split(".").map(Number);
36
+ for (let i = 0; i < 3; i++) {
37
+ if ((pa[i] || 0) !== (pb[i] || 0))
38
+ return (pb[i] || 0) - (pa[i] || 0);
39
+ }
40
+ return 0;
41
+ });
42
+ return versions.get(sorted[0]);
43
+ }
44
+ /**
45
+ * List all registered taxonomy IDs with their latest versions.
46
+ */
47
+ list() {
48
+ const result = [];
49
+ for (const [id] of this.taxonomies) {
50
+ const latest = this.get(id);
51
+ if (latest) {
52
+ result.push({ id, version: latest.version, name: latest.name });
53
+ }
54
+ }
55
+ return result;
56
+ }
57
+ /**
58
+ * Look up a specific action across all taxonomies.
59
+ * Returns the taxonomy ID and the action definition.
60
+ */
61
+ lookupAction(actionId) {
62
+ for (const [taxonomyId] of this.taxonomies) {
63
+ const taxonomy = this.get(taxonomyId);
64
+ if (!taxonomy)
65
+ continue;
66
+ const action = taxonomy.actions.find((a) => a.id === actionId);
67
+ if (action)
68
+ return { taxonomyId, action };
69
+ }
70
+ return undefined;
71
+ }
72
+ /**
73
+ * Look up a mandate template across all taxonomies.
74
+ */
75
+ lookupTemplate(templateId) {
76
+ for (const [taxonomyId] of this.taxonomies) {
77
+ const taxonomy = this.get(taxonomyId);
78
+ if (!taxonomy)
79
+ continue;
80
+ const template = taxonomy.mandateTemplates.find((t) => t.id === templateId);
81
+ if (template)
82
+ return { taxonomyId, template };
83
+ }
84
+ return undefined;
85
+ }
86
+ /**
87
+ * Search actions across all taxonomies by tag or keyword.
88
+ */
89
+ searchActions(query) {
90
+ const q = query.toLowerCase();
91
+ const results = [];
92
+ for (const [taxonomyId] of this.taxonomies) {
93
+ const taxonomy = this.get(taxonomyId);
94
+ if (!taxonomy)
95
+ continue;
96
+ for (const action of taxonomy.actions) {
97
+ if (action.id.toLowerCase().includes(q) ||
98
+ action.label.toLowerCase().includes(q) ||
99
+ action.tags.some((t) => t.toLowerCase().includes(q))) {
100
+ results.push({ taxonomyId, action });
101
+ }
102
+ }
103
+ }
104
+ return results;
105
+ }
106
+ /**
107
+ * Remove a taxonomy from the registry.
108
+ */
109
+ unregister(id, version) {
110
+ if (version) {
111
+ return this.taxonomies.get(id)?.delete(version) ?? false;
112
+ }
113
+ return this.taxonomies.delete(id);
114
+ }
115
+ /** Clear all registered taxonomies. */
116
+ clear() {
117
+ this.taxonomies.clear();
118
+ }
119
+ }
120
+ // Singleton instance
121
+ export const taxonomyRegistry = new TaxonomyRegistry();
122
+ // Convenience functions
123
+ export const registerTaxonomy = (t) => taxonomyRegistry.register(t);
124
+ export const getTaxonomy = (id, v) => taxonomyRegistry.get(id, v);
125
+ export const listTaxonomies = () => taxonomyRegistry.list();
126
+ export const lookupAction = (id) => taxonomyRegistry.lookupAction(id);
127
+ export const lookupTemplate = (id) => taxonomyRegistry.lookupTemplate(id);
128
+ export const searchActions = (q) => taxonomyRegistry.searchActions(q);
129
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,gBAAgB;IACZ,UAAU,GAAG,IAAI,GAAG,EAAyC,CAAC;IAEtE;;;;OAIG;IACH,QAAQ,CAAC,QAA0B;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAA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EG;IACH,UAAU,CAAC,EAAU,EAAE,OAAgB;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,uCAAuC;IACvC,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEvD,wBAAwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,CAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * An Action defines a specific operation that can be delegated.
3
+ * Actions follow a hierarchical naming convention: {domain}.{category}.{operation}
4
+ */
5
+ export interface TaxonomyAction {
6
+ /** Unique action identifier, e.g. "construction.validation.approve" */
7
+ id: string;
8
+ /** Human-readable label (supports i18n keys) */
9
+ label: string;
10
+ /** Detailed description of what this action authorizes */
11
+ description: string;
12
+ /** Risk level determines default approval requirements */
13
+ riskLevel: "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
14
+ /** Whether this action requires human-in-the-loop confirmation */
15
+ requiresHumanApproval: boolean;
16
+ /** Parent action ID for hierarchical grouping */
17
+ parentAction?: string;
18
+ /** Tags for filtering and categorization */
19
+ tags: string[];
20
+ }
21
+ /**
22
+ * A Resource Pattern defines the URI structure for resources
23
+ * that actions can operate on.
24
+ */
25
+ export interface TaxonomyResourcePattern {
26
+ /** Pattern name, e.g. "project-zone-trade" */
27
+ name: string;
28
+ /** URI template with placeholders: "monco:project:{projectId}/zone:{zoneId}/*" */
29
+ pattern: string;
30
+ /** Description of what this resource represents */
31
+ description: string;
32
+ /** Parameter definitions for the URI template */
33
+ parameters: ResourceParameter[];
34
+ }
35
+ export interface ResourceParameter {
36
+ name: string;
37
+ type: "string" | "enum" | "uuid";
38
+ description: string;
39
+ enumValues?: string[];
40
+ required: boolean;
41
+ }
42
+ /**
43
+ * A Constraint Template defines reusable constraint configurations.
44
+ */
45
+ export interface TaxonomyConstraintTemplate {
46
+ /** Unique constraint ID, e.g. "construction.time.project-duration" */
47
+ id: string;
48
+ /** Template name, e.g. "time-limited" */
49
+ name: string;
50
+ description: string;
51
+ /** Type of constraint, e.g. "TIME", "TRANSACTION", "ESCALATION", "RATE_LIMIT" */
52
+ type: string;
53
+ /** The constraint schema (JSON Schema subset) */
54
+ schema: Record<string, unknown>;
55
+ /** Default values for this constraint */
56
+ defaults: Record<string, unknown>;
57
+ }
58
+ /**
59
+ * A Mandate Template is a pre-built delegation pattern
60
+ * combining actions, resources, and constraints for common use cases.
61
+ */
62
+ export interface TaxonomyMandateTemplate {
63
+ /** Template ID, e.g. "construction.automated-validation" */
64
+ id: string;
65
+ /** Human-readable name */
66
+ name: string;
67
+ description: string;
68
+ /** The industry vertical this template belongs to */
69
+ vertical: string;
70
+ /** Pre-configured scope */
71
+ scope: {
72
+ actions: string[];
73
+ resourcePatterns: string[];
74
+ effect: "ALLOW" | "DENY";
75
+ conditions?: Record<string, unknown>;
76
+ };
77
+ /** Pre-configured constraints with sensible defaults */
78
+ constraints: {
79
+ time?: {
80
+ defaultDuration: string;
81
+ };
82
+ transactionLimits?: Record<string, unknown>;
83
+ escalationRules?: Record<string, unknown>;
84
+ rateLimits?: Record<string, unknown>;
85
+ };
86
+ /** Required delegate type */
87
+ delegateType: "AGENT" | "NATURAL_PERSON" | "LEGAL_ENTITY" | "ANY";
88
+ }
89
+ /**
90
+ * The main interface every industry taxonomy must implement.
91
+ */
92
+ export interface IndustryTaxonomy {
93
+ /** Taxonomy identifier, e.g. "construction" */
94
+ id: string;
95
+ /** Semantic version */
96
+ version: string;
97
+ /** Human-readable name */
98
+ name: string;
99
+ /** All registered actions */
100
+ actions: TaxonomyAction[];
101
+ /** All resource patterns */
102
+ resourcePatterns: TaxonomyResourcePattern[];
103
+ /** All constraint templates */
104
+ constraintTemplates: TaxonomyConstraintTemplate[];
105
+ /** All mandate templates */
106
+ mandateTemplates: TaxonomyMandateTemplate[];
107
+ /** Validate a scope against this taxonomy */
108
+ validateScope(scope: unknown): ValidationResult;
109
+ /** Validate constraints against this taxonomy */
110
+ validateConstraints(constraints: unknown): ValidationResult;
111
+ }
112
+ export interface ValidationResult {
113
+ valid: boolean;
114
+ errors: ValidationError[];
115
+ }
116
+ export interface ValidationError {
117
+ path: string;
118
+ message: string;
119
+ code: string;
120
+ }
121
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,K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,GAAG,gBAAgB,CAAC;CAC7D;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // @mandaitor/taxonomy-core — Base types for all industry taxonomies
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oEAAoE"}
@@ -0,0 +1,26 @@
1
+ import type { IndustryTaxonomy, ValidationResult, TaxonomyAction } from "./types";
2
+ /**
3
+ * Validate a scope object against a taxonomy.
4
+ * Checks that all actions exist and all resource patterns are valid.
5
+ */
6
+ export declare function validateScope(taxonomy: IndustryTaxonomy, scope: {
7
+ actions?: string[];
8
+ resources?: string[];
9
+ effect?: string;
10
+ }): ValidationResult;
11
+ /**
12
+ * Validate constraints against taxonomy rules.
13
+ * Checks time bounds, transaction limits, and risk-level requirements.
14
+ */
15
+ export declare function validateConstraints(taxonomy: IndustryTaxonomy, constraints: Record<string, unknown>, scopeActions?: string[]): ValidationResult;
16
+ /**
17
+ * Match a resource URI against a pattern template.
18
+ * Supports {param} placeholders and * wildcards.
19
+ */
20
+ export declare function matchResourcePattern(pattern: string, resource: string): boolean;
21
+ /**
22
+ * Get all actions that require human approval for a given scope.
23
+ * Useful for UI warnings and escalation configuration.
24
+ */
25
+ export declare function getHighRiskActions(taxonomy: IndustryTaxonomy, actionIds: string[]): TaxonomyAction[];
26
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAmB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEnG;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,gBAAgB,CAqDlB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,YAAY,GAAE,MAAM,EAAO,GAC1B,gBAAgB,CA0ClB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK/E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,MAAM,EAAE,GAClB,cAAc,EAAE,CAElB"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Validate a scope object against a taxonomy.
3
+ * Checks that all actions exist and all resource patterns are valid.
4
+ */
5
+ export function validateScope(taxonomy, scope) {
6
+ const errors = [];
7
+ const validActionIds = new Set(taxonomy.actions.map((a) => a.id));
8
+ // Validate effect
9
+ if (scope.effect && !["ALLOW", "DENY"].includes(scope.effect)) {
10
+ errors.push({
11
+ path: "scope.effect",
12
+ message: `Invalid effect: "${scope.effect}". Must be ALLOW or DENY.`,
13
+ code: "INVALID_EFFECT",
14
+ });
15
+ }
16
+ // Validate actions
17
+ for (const action of scope.actions || []) {
18
+ if (!validActionIds.has(action)) {
19
+ // Check if it's a wildcard pattern (e.g. "construction.validation.*")
20
+ const isWildcard = action.endsWith(".*");
21
+ if (isWildcard) {
22
+ const prefix = action.slice(0, -2);
23
+ const hasMatch = taxonomy.actions.some((a) => a.id.startsWith(prefix));
24
+ if (!hasMatch) {
25
+ errors.push({
26
+ path: `scope.actions[${action}]`,
27
+ message: `No actions match wildcard pattern: ${action}`,
28
+ code: "NO_WILDCARD_MATCH",
29
+ });
30
+ }
31
+ }
32
+ else {
33
+ errors.push({
34
+ path: `scope.actions[${action}]`,
35
+ message: `Unknown action: ${action}`,
36
+ code: "UNKNOWN_ACTION",
37
+ });
38
+ }
39
+ }
40
+ }
41
+ // Validate resource URIs against patterns
42
+ for (const resource of scope.resources || []) {
43
+ const matchesAny = taxonomy.resourcePatterns.some((pattern) => matchResourcePattern(pattern.pattern, resource));
44
+ if (!matchesAny) {
45
+ errors.push({
46
+ path: `scope.resources[${resource}]`,
47
+ message: `Resource does not match any registered pattern: ${resource}`,
48
+ code: "INVALID_RESOURCE",
49
+ });
50
+ }
51
+ }
52
+ return { valid: errors.length === 0, errors };
53
+ }
54
+ /**
55
+ * Validate constraints against taxonomy rules.
56
+ * Checks time bounds, transaction limits, and risk-level requirements.
57
+ */
58
+ export function validateConstraints(taxonomy, constraints, scopeActions = []) {
59
+ const errors = [];
60
+ // Check if high-risk actions have required constraints
61
+ const highRiskActions = taxonomy.actions.filter((a) => scopeActions.includes(a.id) && a.requiresHumanApproval);
62
+ if (highRiskActions.length > 0) {
63
+ const hasEscalation = constraints.escalation_rules !== undefined;
64
+ const hasHumanConfirm = constraints.require_human_confirmation === true;
65
+ if (!hasEscalation && !hasHumanConfirm) {
66
+ errors.push({
67
+ path: "constraints",
68
+ message: `High-risk actions (${highRiskActions.map((a) => a.id).join(", ")}) require escalation_rules or require_human_confirmation`,
69
+ code: "MISSING_ESCALATION",
70
+ });
71
+ }
72
+ }
73
+ // Validate time constraints
74
+ if (constraints.time && typeof constraints.time === "object") {
75
+ const time = constraints.time;
76
+ if (time.expires_at) {
77
+ const expiry = new Date(time.expires_at);
78
+ if (isNaN(expiry.getTime())) {
79
+ errors.push({
80
+ path: "constraints.time.expires_at",
81
+ message: "Invalid ISO 8601 timestamp",
82
+ code: "INVALID_TIMESTAMP",
83
+ });
84
+ }
85
+ else if (expiry <= new Date()) {
86
+ errors.push({
87
+ path: "constraints.time.expires_at",
88
+ message: "Expiry date must be in the future",
89
+ code: "EXPIRED_TIMESTAMP",
90
+ });
91
+ }
92
+ }
93
+ }
94
+ return { valid: errors.length === 0, errors };
95
+ }
96
+ /**
97
+ * Match a resource URI against a pattern template.
98
+ * Supports {param} placeholders and * wildcards.
99
+ */
100
+ export function matchResourcePattern(pattern, resource) {
101
+ // Convert pattern to regex: {param} -> [^/]+ and * -> .*
102
+ const regexStr = pattern.replace(/{[^}]+}/g, "[^:/]+").replace(/\*/g, ".*");
103
+ const regex = new RegExp(`^${regexStr}$`);
104
+ return regex.test(resource);
105
+ }
106
+ /**
107
+ * Get all actions that require human approval for a given scope.
108
+ * Useful for UI warnings and escalation configuration.
109
+ */
110
+ export function getHighRiskActions(taxonomy, actionIds) {
111
+ return taxonomy.actions.filter((a) => actionIds.includes(a.id) && a.requiresHumanApproval);
112
+ }
113
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA0B,EAC1B,KAAoE;IAEpE,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAElE,kBAAkB;IAClB,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,oBAAoB,KAAK,CAAC,MAAM,2BAA2B;Y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AC,CAAC,qBAAqB,CAAC,CAAC;AAC7F,CAAC"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@mandaitor/taxonomy-core",
3
+ "version": "0.2.0",
4
+ "description": "Mandaitor — Core taxonomy types, interfaces, and validation",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "devDependencies": {
18
+ "typescript": "^5.6.0",
19
+ "vitest": "^2.0.0"
20
+ },
21
+ "publishConfig": {
22
+ "registry": "https://registry.npmjs.org",
23
+ "access": "public"
24
+ },
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/C4RR13P0TT3R/mandaitor.git",
29
+ "directory": "packages/taxonomy-core"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "test": "vitest run",
34
+ "test:unit": "vitest run",
35
+ "typecheck": "tsc --noEmit",
36
+ "lint": "eslint src/",
37
+ "lint:fix": "eslint src/ --fix",
38
+ "clean": "rm -rf dist tsconfig.tsbuildinfo"
39
+ }
40
+ }