@peac/control 0.9.18

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/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /**
3
+ * PEAC Control
4
+ *
5
+ * Control engine interfaces, generic constraint helpers, and validation.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getStateSummary = exports.resetState = exports.isStateExpired = exports.updateStateAfterUse = exports.createControlState = exports.enforceMandate = exports.enforceCombinedMandate = exports.enforceBudgetMandate = exports.enforceUsageMandate = exports.enforceTemporalMandate = exports.enforceControlBlock = exports.enforceConstraint = exports.enforceCombinedConstraint = exports.enforceBudgetConstraint = exports.enforceUsageConstraint = exports.enforceTemporalConstraint = exports.MandateSchema = exports.CombinedMandateSchema = exports.BudgetMandateSchema = exports.UsageMandateSchema = exports.TemporalMandateSchema = exports.ChainControlBlockSchema = exports.ControlStepSchema = exports.ControlDecisionSchema = exports.ControlLicensingModeSchema = exports.ControlPurposeSchema = exports.ControlStateSchema = exports.ControlBlockSchema = exports.ConstraintSchema = exports.CombinedConstraintSchema = exports.BudgetConstraintSchema = exports.UsageConstraintSchema = exports.TemporalConstraintSchema = exports.ControlEngineRegistry = void 0;
11
+ var adapter_1 = require("./adapter");
12
+ Object.defineProperty(exports, "ControlEngineRegistry", { enumerable: true, get: function () { return adapter_1.ControlEngineRegistry; } });
13
+ // Validators
14
+ var validators_1 = require("./validators");
15
+ Object.defineProperty(exports, "TemporalConstraintSchema", { enumerable: true, get: function () { return validators_1.TemporalConstraintSchema; } });
16
+ Object.defineProperty(exports, "UsageConstraintSchema", { enumerable: true, get: function () { return validators_1.UsageConstraintSchema; } });
17
+ Object.defineProperty(exports, "BudgetConstraintSchema", { enumerable: true, get: function () { return validators_1.BudgetConstraintSchema; } });
18
+ Object.defineProperty(exports, "CombinedConstraintSchema", { enumerable: true, get: function () { return validators_1.CombinedConstraintSchema; } });
19
+ Object.defineProperty(exports, "ConstraintSchema", { enumerable: true, get: function () { return validators_1.ConstraintSchema; } });
20
+ Object.defineProperty(exports, "ControlBlockSchema", { enumerable: true, get: function () { return validators_1.ControlBlockSchema; } });
21
+ Object.defineProperty(exports, "ControlStateSchema", { enumerable: true, get: function () { return validators_1.ControlStateSchema; } });
22
+ // CAL semantic validators (v0.9.16+)
23
+ Object.defineProperty(exports, "ControlPurposeSchema", { enumerable: true, get: function () { return validators_1.ControlPurposeSchema; } });
24
+ Object.defineProperty(exports, "ControlLicensingModeSchema", { enumerable: true, get: function () { return validators_1.ControlLicensingModeSchema; } });
25
+ Object.defineProperty(exports, "ControlDecisionSchema", { enumerable: true, get: function () { return validators_1.ControlDecisionSchema; } });
26
+ Object.defineProperty(exports, "ControlStepSchema", { enumerable: true, get: function () { return validators_1.ControlStepSchema; } });
27
+ Object.defineProperty(exports, "ChainControlBlockSchema", { enumerable: true, get: function () { return validators_1.ChainControlBlockSchema; } });
28
+ // Deprecated validator aliases (will be removed in v0.9.17)
29
+ var validators_2 = require("./validators");
30
+ Object.defineProperty(exports, "TemporalMandateSchema", { enumerable: true, get: function () { return validators_2.TemporalConstraintSchema; } });
31
+ Object.defineProperty(exports, "UsageMandateSchema", { enumerable: true, get: function () { return validators_2.UsageConstraintSchema; } });
32
+ Object.defineProperty(exports, "BudgetMandateSchema", { enumerable: true, get: function () { return validators_2.BudgetConstraintSchema; } });
33
+ Object.defineProperty(exports, "CombinedMandateSchema", { enumerable: true, get: function () { return validators_2.CombinedConstraintSchema; } });
34
+ Object.defineProperty(exports, "MandateSchema", { enumerable: true, get: function () { return validators_2.ConstraintSchema; } });
35
+ // Enforcement
36
+ var enforcement_1 = require("./enforcement");
37
+ Object.defineProperty(exports, "enforceTemporalConstraint", { enumerable: true, get: function () { return enforcement_1.enforceTemporalConstraint; } });
38
+ Object.defineProperty(exports, "enforceUsageConstraint", { enumerable: true, get: function () { return enforcement_1.enforceUsageConstraint; } });
39
+ Object.defineProperty(exports, "enforceBudgetConstraint", { enumerable: true, get: function () { return enforcement_1.enforceBudgetConstraint; } });
40
+ Object.defineProperty(exports, "enforceCombinedConstraint", { enumerable: true, get: function () { return enforcement_1.enforceCombinedConstraint; } });
41
+ Object.defineProperty(exports, "enforceConstraint", { enumerable: true, get: function () { return enforcement_1.enforceConstraint; } });
42
+ Object.defineProperty(exports, "enforceControlBlock", { enumerable: true, get: function () { return enforcement_1.enforceControlBlock; } });
43
+ // Deprecated enforcement aliases (will be removed in v0.9.17)
44
+ var enforcement_2 = require("./enforcement");
45
+ Object.defineProperty(exports, "enforceTemporalMandate", { enumerable: true, get: function () { return enforcement_2.enforceTemporalConstraint; } });
46
+ Object.defineProperty(exports, "enforceUsageMandate", { enumerable: true, get: function () { return enforcement_2.enforceUsageConstraint; } });
47
+ Object.defineProperty(exports, "enforceBudgetMandate", { enumerable: true, get: function () { return enforcement_2.enforceBudgetConstraint; } });
48
+ Object.defineProperty(exports, "enforceCombinedMandate", { enumerable: true, get: function () { return enforcement_2.enforceCombinedConstraint; } });
49
+ Object.defineProperty(exports, "enforceMandate", { enumerable: true, get: function () { return enforcement_2.enforceConstraint; } });
50
+ // State management
51
+ var state_1 = require("./state");
52
+ Object.defineProperty(exports, "createControlState", { enumerable: true, get: function () { return state_1.createControlState; } });
53
+ Object.defineProperty(exports, "updateStateAfterUse", { enumerable: true, get: function () { return state_1.updateStateAfterUse; } });
54
+ Object.defineProperty(exports, "isStateExpired", { enumerable: true, get: function () { return state_1.isStateExpired; } });
55
+ Object.defineProperty(exports, "resetState", { enumerable: true, get: function () { return state_1.resetState; } });
56
+ Object.defineProperty(exports, "getStateSummary", { enumerable: true, get: function () { return state_1.getStateSummary; } });
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA;AAoC9B,aAAa;AACb,2CAcsB;AAbpB,sHAAA,wBAAwB,OAAA;AACxB,mHAAA,qBAAqB,OAAA;AACrB,oHAAA,sBAAsB,OAAA;AACtB,sHAAA,wBAAwB,OAAA;AACxB,8GAAA,gBAAgB,OAAA;AAChB,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,qCAAqC;AACrC,kHAAA,oBAAoB,OAAA;AACpB,wHAAA,0BAA0B,OAAA;AAC1B,mHAAA,qBAAqB,OAAA;AACrB,+GAAA,iBAAiB,OAAA;AACjB,qHAAA,uBAAuB,OAAA;AAGzB,4DAA4D;AAC5D,2CAMsB;AALpB,mHAAA,wBAAwB,OAAyB;AACjD,gHAAA,qBAAqB,OAAsB;AAC3C,iHAAA,sBAAsB,OAAuB;AAC7C,mHAAA,wBAAwB,OAAyB;AACjD,2GAAA,gBAAgB,OAAiB;AAGnC,cAAc;AACd,6CAOuB;AANrB,wHAAA,yBAAyB,OAAA;AACzB,qHAAA,sBAAsB,OAAA;AACtB,sHAAA,uBAAuB,OAAA;AACvB,wHAAA,yBAAyB,OAAA;AACzB,gHAAA,iBAAiB,OAAA;AACjB,kHAAA,mBAAmB,OAAA;AAGrB,8DAA8D;AAC9D,6CAMuB;AALrB,qHAAA,yBAAyB,OAA0B;AACnD,kHAAA,sBAAsB,OAAuB;AAC7C,mHAAA,uBAAuB,OAAwB;AAC/C,qHAAA,yBAAyB,OAA0B;AACnD,6GAAA,iBAAiB,OAAkB;AAGrC,mBAAmB;AACnB,iCAMiB;AALf,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,mBAAmB,OAAA;AACnB,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * PEAC Control Abstraction Layer (CAL) State Management
3
+ *
4
+ * State tracking and updates for control blocks.
5
+ */
6
+ import type { ControlState, Constraint } from './types';
7
+ /**
8
+ * Create initial control state
9
+ */
10
+ export declare function createControlState(receiptId: string, constraint: Constraint): ControlState;
11
+ /**
12
+ * Update state after usage
13
+ */
14
+ export declare function updateStateAfterUse(state: ControlState, amount?: number): ControlState;
15
+ /**
16
+ * Check if state is expired
17
+ */
18
+ export declare function isStateExpired(state: ControlState): boolean;
19
+ /**
20
+ * Reset state (for windowed mandates)
21
+ */
22
+ export declare function resetState(state: ControlState): ControlState;
23
+ /**
24
+ * Get state summary for debugging
25
+ */
26
+ export declare function getStateSummary(state: ControlState): string;
27
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAExD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,YAAY,CAQ1F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAYtF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CA+D3D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAQ5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA4B3D"}
package/dist/state.js ADDED
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ /**
3
+ * PEAC Control Abstraction Layer (CAL) State Management
4
+ *
5
+ * State tracking and updates for control blocks.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createControlState = createControlState;
9
+ exports.updateStateAfterUse = updateStateAfterUse;
10
+ exports.isStateExpired = isStateExpired;
11
+ exports.resetState = resetState;
12
+ exports.getStateSummary = getStateSummary;
13
+ /**
14
+ * Create initial control state
15
+ */
16
+ function createControlState(receiptId, constraint) {
17
+ return {
18
+ receipt_id: receiptId,
19
+ constraint,
20
+ usage_count: 0,
21
+ spent_amount: 0,
22
+ metadata: {},
23
+ };
24
+ }
25
+ /**
26
+ * Update state after usage
27
+ */
28
+ function updateStateAfterUse(state, amount) {
29
+ const currentTime = Math.floor(Date.now() / 1000);
30
+ const usageCount = (state.usage_count ?? 0) + 1;
31
+ const spentAmount = (state.spent_amount ?? 0) + (amount ?? 0);
32
+ return {
33
+ ...state,
34
+ usage_count: usageCount,
35
+ spent_amount: spentAmount,
36
+ first_use: state.first_use ?? currentTime,
37
+ last_use: currentTime,
38
+ };
39
+ }
40
+ /**
41
+ * Check if state is expired
42
+ */
43
+ function isStateExpired(state) {
44
+ const { constraint: mandate } = state;
45
+ const currentTime = Math.floor(Date.now() / 1000);
46
+ // Check temporal expiry
47
+ if (mandate.type === 'temporal') {
48
+ if (mandate.valid_until !== undefined && currentTime > mandate.valid_until) {
49
+ return true;
50
+ }
51
+ if (mandate.duration !== undefined && state.first_use !== undefined) {
52
+ const expiresAt = state.first_use + mandate.duration;
53
+ if (currentTime > expiresAt) {
54
+ return true;
55
+ }
56
+ }
57
+ }
58
+ // Check combined mandate temporal expiry
59
+ if (mandate.type === 'combined' && mandate.temporal) {
60
+ if (mandate.temporal.valid_until !== undefined && currentTime > mandate.temporal.valid_until) {
61
+ return true;
62
+ }
63
+ if (mandate.temporal.duration !== undefined && state.first_use !== undefined) {
64
+ const expiresAt = state.first_use + mandate.temporal.duration;
65
+ if (currentTime > expiresAt) {
66
+ return true;
67
+ }
68
+ }
69
+ }
70
+ // Check window expiry for usage mandates
71
+ if (mandate.type === 'usage' && mandate.window !== undefined && state.first_use !== undefined) {
72
+ const windowExpiry = state.first_use + mandate.window;
73
+ if (currentTime > windowExpiry) {
74
+ return true;
75
+ }
76
+ }
77
+ // Check window expiry for budget mandates
78
+ if (mandate.type === 'budget' && mandate.window !== undefined && state.first_use !== undefined) {
79
+ const windowExpiry = state.first_use + mandate.window;
80
+ if (currentTime > windowExpiry) {
81
+ return true;
82
+ }
83
+ }
84
+ // Check window expiry for combined mandates
85
+ if (mandate.type === 'combined') {
86
+ if (mandate.usage?.window !== undefined && state.first_use !== undefined) {
87
+ const windowExpiry = state.first_use + mandate.usage.window;
88
+ if (currentTime > windowExpiry) {
89
+ return true;
90
+ }
91
+ }
92
+ if (mandate.budget?.window !== undefined && state.first_use !== undefined) {
93
+ const windowExpiry = state.first_use + mandate.budget.window;
94
+ if (currentTime > windowExpiry) {
95
+ return true;
96
+ }
97
+ }
98
+ }
99
+ return false;
100
+ }
101
+ /**
102
+ * Reset state (for windowed mandates)
103
+ */
104
+ function resetState(state) {
105
+ return {
106
+ ...state,
107
+ usage_count: 0,
108
+ spent_amount: 0,
109
+ first_use: undefined,
110
+ last_use: undefined,
111
+ };
112
+ }
113
+ /**
114
+ * Get state summary for debugging
115
+ */
116
+ function getStateSummary(state) {
117
+ const parts = [];
118
+ if (state.usage_count !== undefined && state.usage_count > 0) {
119
+ parts.push(`uses: ${state.usage_count}`);
120
+ }
121
+ if (state.spent_amount !== undefined && state.spent_amount > 0) {
122
+ const currency = state.constraint.type === 'budget'
123
+ ? state.constraint.currency
124
+ : state.constraint.type === 'combined' && state.constraint.budget
125
+ ? state.constraint.budget.currency
126
+ : 'units';
127
+ parts.push(`spent: ${state.spent_amount} ${currency}`);
128
+ }
129
+ if (state.first_use !== undefined) {
130
+ const date = new Date(state.first_use * 1000).toISOString();
131
+ parts.push(`first: ${date}`);
132
+ }
133
+ if (state.last_use !== undefined) {
134
+ const date = new Date(state.last_use * 1000).toISOString();
135
+ parts.push(`last: ${date}`);
136
+ }
137
+ return parts.join(', ');
138
+ }
139
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAOH,gDAQC;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AAC;IAED,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,IAAI,KAAK,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;QAC/D,MAAM,QAAQ,GACZ,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ;YAChC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ;YAC3B,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM;gBAC/D,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ;gBAClC,CAAC,CAAC,OAAO,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,YAAY,IAAI,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3D,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * PEAC Control Types
3
+ */
4
+ export type { ControlBlock, ControlStep, ControlDecision, ControlValidationResult, ControlPurpose, ControlLicensingMode, } from '@peac/schema';
5
+ import type { ConstraintType, TemporalConstraint, UsageConstraint, BudgetConstraint, CombinedConstraint, Constraint, ConstraintEnforcementResult } from './constraints';
6
+ export type { ConstraintType, TemporalConstraint, UsageConstraint, BudgetConstraint, CombinedConstraint, Constraint, ConstraintEnforcementResult, };
7
+ export type MandateType = ConstraintType;
8
+ export type TemporalMandate = TemporalConstraint;
9
+ export type UsageMandate = UsageConstraint;
10
+ export type BudgetMandate = BudgetConstraint;
11
+ export type CombinedMandate = CombinedConstraint;
12
+ export type Mandate = Constraint;
13
+ export type EnforcementResult = ConstraintEnforcementResult;
14
+ export interface ControlState {
15
+ receipt_id: string;
16
+ constraint: Constraint;
17
+ usage_count?: number;
18
+ spent_amount?: number;
19
+ first_use?: number;
20
+ last_use?: number;
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,uBAAuB,EAEvB,cAAc,EACd,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,2BAA2B,GAC5B,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC;AACzC,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AACjD,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAC3C,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAC7C,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC;AACjC,MAAM,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AAG5D,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * PEAC Control Types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}