@open-operational-state/types 0.1.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/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @open-operational-state/types
2
+
3
+ Canonical TypeScript interfaces for the [Open Operational State](https://github.com/open-operational-state) core model.
4
+
5
+ This package is the shared contract surface for all tooling packages. It contains zero runtime logic — only type declarations, constants, and type guards.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ bun add @open-operational-state/types
11
+ ```
12
+
13
+ ## API
14
+
15
+ ### Core Interfaces
16
+
17
+ | Interface | Description |
18
+ |---|---|
19
+ | `Snapshot` | Root operational-state document |
20
+ | `Subject` | Identity and metadata for the observed service |
21
+ | `Timing` | Observation, reporting, and state-change timestamps |
22
+ | `Evidence` | Supporting data for a condition assessment |
23
+ | `Scope` | Geographic or environmental scope |
24
+ | `CheckEntry` | Flat check (used in `health-response` format) |
25
+ | `ComponentEntry` | Nested component (used in `service-status` format) |
26
+ | `DependencyEntry` | Nested dependency (used in `service-status` format) |
27
+ | `DiscoveryDocument` | `/.well-known/operational-state` document |
28
+ | `ResourceEntry` | Single resource in a discovery document |
29
+ | `ValidationResult` | Validation output with errors and warnings |
30
+ | `ConformanceResult` | Conformance level assessment |
31
+
32
+ ### Condition Vocabulary
33
+
34
+ ```js
35
+ import { LIVENESS_CONDITIONS, READINESS_CONDITIONS, HEALTH_CONDITIONS } from '@open-operational-state/types';
36
+ import { isHealthCondition, isExtensionCondition, conditionSeverity } from '@open-operational-state/types';
37
+
38
+ isHealthCondition( 'operational' ); // true
39
+ isExtensionCondition( 'x-acme-drain' ); // true
40
+
41
+ conditionSeverity( 'operational' ); // 1 (lowest orderable)
42
+ conditionSeverity( 'down' ); // 5 (highest orderable)
43
+ ```
44
+
45
+ ### Profile Helpers
46
+
47
+ ```js
48
+ import { PROFILE_REQUIREMENTS, isProfileId, satisfiedProfiles } from '@open-operational-state/types';
49
+
50
+ isProfileId( 'health' ); // true
51
+ isProfileId( 'custom' ); // false
52
+
53
+ satisfiedProfiles( 'status' ); // ['liveness', 'readiness', 'health', 'status']
54
+ ```
55
+
56
+ ## Dependencies
57
+
58
+ None. This package has zero external dependencies.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Condition Vocabularies
3
+ *
4
+ * Normative condition values per profile, derived from
5
+ * status-spec/spec/condition-vocabularies.md.
6
+ */
7
+ export declare const LIVENESS_CONDITIONS: readonly ["alive", "unreachable"];
8
+ export type LivenessCondition = typeof LIVENESS_CONDITIONS[number];
9
+ export declare const READINESS_CONDITIONS: readonly ["ready", "initializing", "not-ready"];
10
+ export type ReadinessCondition = typeof READINESS_CONDITIONS[number];
11
+ export declare const HEALTH_ORDERABLE_CONDITIONS: readonly ["operational", "degraded", "partial-outage", "major-outage", "down"];
12
+ export type HealthOrderableCondition = typeof HEALTH_ORDERABLE_CONDITIONS[number];
13
+ export declare const HEALTH_CATEGORICAL_CONDITIONS: readonly ["maintenance", "unknown"];
14
+ export type HealthCategoricalCondition = typeof HEALTH_CATEGORICAL_CONDITIONS[number];
15
+ export declare const HEALTH_CONDITIONS: readonly ["operational", "degraded", "partial-outage", "major-outage", "down", "maintenance", "unknown"];
16
+ export type HealthCondition = HealthOrderableCondition | HealthCategoricalCondition;
17
+ export type StatusCondition = HealthCondition;
18
+ export declare function isExtensionCondition(value: string): boolean;
19
+ export type Condition = LivenessCondition | ReadinessCondition | HealthCondition | string;
20
+ export declare function isLivenessCondition(value: string): value is LivenessCondition;
21
+ export declare function isReadinessCondition(value: string): value is ReadinessCondition;
22
+ export declare function isHealthOrderableCondition(value: string): value is HealthOrderableCondition;
23
+ export declare function isHealthCategoricalCondition(value: string): value is HealthCategoricalCondition;
24
+ export declare function isHealthCondition(value: string): value is HealthCondition;
25
+ /**
26
+ * Returns the numeric severity of an orderable condition value.
27
+ * Lower numbers indicate better operational state.
28
+ *
29
+ * Returns `undefined` for categorical or extension values.
30
+ */
31
+ export declare function conditionSeverity(value: string): number | undefined;
32
+ /**
33
+ * Returns true if the condition value is orderable (has defined severity).
34
+ */
35
+ export declare function isOrderableCondition(value: string): boolean;
36
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../src/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,mBAAmB,mCAAsC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAMnE,eAAO,MAAM,oBAAoB,iDAAoD,CAAC;AACtF,MAAM,MAAM,kBAAkB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAMrE,eAAO,MAAM,2BAA2B,gFAM9B,CAAC;AACX,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAElF,eAAO,MAAM,6BAA6B,qCAAwC,CAAC;AACnF,MAAM,MAAM,0BAA0B,GAAG,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;AAEtF,eAAO,MAAM,iBAAiB,0GAGpB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,wBAAwB,GAAG,0BAA0B,CAAC;AAMpF,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;AAQ9C,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,MAAM,GAAI,OAAO,CAE7D;AAMD,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,eAAe,GAAG,MAAM,CAAC;AAM1F,wBAAgB,mBAAmB,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,iBAAiB,CAE/E;AAED,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,kBAAkB,CAEjF;AAED,wBAAgB,0BAA0B,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,wBAAwB,CAE7F;AAED,wBAAgB,4BAA4B,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,0BAA0B,CAEjG;AAED,wBAAgB,iBAAiB,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,eAAe,CAE3E;AAyBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAE,KAAK,EAAE,MAAM,GAAI,MAAM,GAAG,SAAS,CAErE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,MAAM,GAAI,OAAO,CAE7D"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Condition Vocabularies
3
+ *
4
+ * Normative condition values per profile, derived from
5
+ * status-spec/spec/condition-vocabularies.md.
6
+ */
7
+ // ---------------------------------------------------------------------------
8
+ // Liveness vocabulary (orderable)
9
+ // ---------------------------------------------------------------------------
10
+ export const LIVENESS_CONDITIONS = ['alive', 'unreachable'];
11
+ // ---------------------------------------------------------------------------
12
+ // Readiness vocabulary (orderable)
13
+ // ---------------------------------------------------------------------------
14
+ export const READINESS_CONDITIONS = ['ready', 'initializing', 'not-ready'];
15
+ // ---------------------------------------------------------------------------
16
+ // Health vocabulary — orderable core + categorical extensions
17
+ // ---------------------------------------------------------------------------
18
+ export const HEALTH_ORDERABLE_CONDITIONS = [
19
+ 'operational',
20
+ 'degraded',
21
+ 'partial-outage',
22
+ 'major-outage',
23
+ 'down',
24
+ ];
25
+ export const HEALTH_CATEGORICAL_CONDITIONS = ['maintenance', 'unknown'];
26
+ export const HEALTH_CONDITIONS = [
27
+ ...HEALTH_ORDERABLE_CONDITIONS,
28
+ ...HEALTH_CATEGORICAL_CONDITIONS,
29
+ ];
30
+ // ---------------------------------------------------------------------------
31
+ // Extension value pattern
32
+ // ---------------------------------------------------------------------------
33
+ const EXTENSION_PATTERN = /^x-[a-z][a-z0-9]*-[a-z][a-z0-9-]*$/;
34
+ export function isExtensionCondition(value) {
35
+ return EXTENSION_PATTERN.test(value);
36
+ }
37
+ // ---------------------------------------------------------------------------
38
+ // Type guards
39
+ // ---------------------------------------------------------------------------
40
+ export function isLivenessCondition(value) {
41
+ return LIVENESS_CONDITIONS.includes(value);
42
+ }
43
+ export function isReadinessCondition(value) {
44
+ return READINESS_CONDITIONS.includes(value);
45
+ }
46
+ export function isHealthOrderableCondition(value) {
47
+ return HEALTH_ORDERABLE_CONDITIONS.includes(value);
48
+ }
49
+ export function isHealthCategoricalCondition(value) {
50
+ return HEALTH_CATEGORICAL_CONDITIONS.includes(value);
51
+ }
52
+ export function isHealthCondition(value) {
53
+ return isHealthOrderableCondition(value) || isHealthCategoricalCondition(value);
54
+ }
55
+ // ---------------------------------------------------------------------------
56
+ // Severity ordering (lower = better)
57
+ //
58
+ // Only orderable values have a defined severity. Categorical and extension
59
+ // values return `undefined`.
60
+ // ---------------------------------------------------------------------------
61
+ const ORDERABLE_SEVERITY = {
62
+ // Liveness (1–2)
63
+ alive: 1,
64
+ unreachable: 2,
65
+ // Readiness (1–3)
66
+ ready: 1,
67
+ initializing: 2,
68
+ 'not-ready': 3,
69
+ // Health orderable (1–5)
70
+ operational: 1,
71
+ degraded: 2,
72
+ 'partial-outage': 3,
73
+ 'major-outage': 4,
74
+ down: 5,
75
+ };
76
+ /**
77
+ * Returns the numeric severity of an orderable condition value.
78
+ * Lower numbers indicate better operational state.
79
+ *
80
+ * Returns `undefined` for categorical or extension values.
81
+ */
82
+ export function conditionSeverity(value) {
83
+ return ORDERABLE_SEVERITY[value];
84
+ }
85
+ /**
86
+ * Returns true if the condition value is orderable (has defined severity).
87
+ */
88
+ export function isOrderableCondition(value) {
89
+ return ORDERABLE_SEVERITY[value] !== undefined;
90
+ }
91
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../src/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAE,OAAO,EAAE,aAAa,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AA4B,CAAE,KAAK,CAAE,CAAC;AACxF,CAAC;AAED,8EAA8E;AAC9E,qCAAqC;AACrC,EAAE;AACF,4EAA4E;AAC5E,6BAA6B;AAC7B,8EAA8E;AAE9E,MAAM,kBAAkB,GAA2B;IAC/C,iBAAiB;IACjB,KAAK,EAAE,CAAC;IACR,WAAW,EAAE,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,CAAC;IACR,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,yBAAyB;IACzB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,gBAAgB,EAAE,CAAC;IACnB,cAAc,EAAE,CAAC;IACjB,IAAI,EAAE,CAAC;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAE,KAAa;IAC5C,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAE,KAAa;IAC/C,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AACnD,CAAC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @open-operational-state/types
3
+ *
4
+ * Canonical TypeScript types for the Open Operational State core model.
5
+ *
6
+ * This package is the shared contract surface. It contains only interfaces,
7
+ * type aliases, constants, and type guards — no runtime logic beyond
8
+ * trivial constant lookups. Zero external dependencies.
9
+ */
10
+ export { type Condition, type LivenessCondition, type ReadinessCondition, type HealthOrderableCondition, type HealthCategoricalCondition, type HealthCondition, type StatusCondition, LIVENESS_CONDITIONS, READINESS_CONDITIONS, HEALTH_ORDERABLE_CONDITIONS, HEALTH_CATEGORICAL_CONDITIONS, HEALTH_CONDITIONS, isExtensionCondition, isLivenessCondition, isReadinessCondition, isHealthOrderableCondition, isHealthCategoricalCondition, isHealthCondition, isOrderableCondition, conditionSeverity, } from './conditions.js';
11
+ export { type ProfileId, type RequirementLevel, type ProfileRequirements, PROFILE_IDS, isProfileId, PROFILE_REQUIREMENTS, satisfiedProfiles, } from './profiles.js';
12
+ export declare const PROVENANCE_TYPES: readonly ["self-reported", "externally-observed", "derived", "manually-declared"];
13
+ export type Provenance = typeof PROVENANCE_TYPES[number];
14
+ export declare function isProvenance(value: string): value is Provenance;
15
+ export interface Subject {
16
+ id: string;
17
+ description?: string;
18
+ /** Service version — used in service-status serialization */
19
+ version?: string;
20
+ /** Contact URI — used in service-status serialization */
21
+ contact?: string;
22
+ }
23
+ export interface Timing {
24
+ /** RFC 3339 — when the condition was observed */
25
+ observed?: string;
26
+ /** RFC 3339 — when the condition was communicated */
27
+ reported?: string;
28
+ /** RFC 3339 — when the condition last transitioned */
29
+ stateChanged?: string;
30
+ }
31
+ export interface Evidence {
32
+ /** Kind of check or observation */
33
+ type: string;
34
+ /** Supplementary information */
35
+ detail?: string;
36
+ /** Measured value */
37
+ observedValue?: unknown;
38
+ /** Unit of measurement */
39
+ observedUnit?: string;
40
+ }
41
+ export interface Scope {
42
+ type: string;
43
+ identifier?: string;
44
+ }
45
+ export interface CheckEntry {
46
+ condition: string;
47
+ role?: 'component' | 'dependency';
48
+ timing?: Timing;
49
+ provenance?: Provenance | string;
50
+ evidence?: Evidence;
51
+ }
52
+ export interface ComponentEntry {
53
+ id: string;
54
+ description?: string;
55
+ condition: string;
56
+ criticality?: 'critical' | 'important' | 'informational';
57
+ timing?: Timing;
58
+ provenance?: Provenance | string;
59
+ evidence?: Evidence;
60
+ /** Nested sub-components (multi-level hierarchy) */
61
+ components?: ComponentEntry[];
62
+ }
63
+ export interface DependencyEntry {
64
+ id: string;
65
+ description?: string;
66
+ condition: string;
67
+ criticality?: 'critical' | 'important' | 'informational';
68
+ timing?: Timing;
69
+ provenance?: Provenance | string;
70
+ evidence?: Evidence;
71
+ }
72
+ export interface IncidentUpdate {
73
+ timestamp: string;
74
+ message: string;
75
+ }
76
+ export interface Incident {
77
+ id: string;
78
+ title: string;
79
+ condition: string;
80
+ started: string;
81
+ resolved?: string;
82
+ affectedComponents?: string[];
83
+ updates?: IncidentUpdate[];
84
+ }
85
+ export interface Snapshot {
86
+ condition: string;
87
+ profiles: string[];
88
+ subject: Subject;
89
+ timing?: Timing;
90
+ provenance?: Provenance | string;
91
+ evidence?: Evidence;
92
+ scope?: Scope;
93
+ /** health-response flat checks */
94
+ checks?: Record<string, CheckEntry>;
95
+ /** service-status nested components */
96
+ components?: ComponentEntry[];
97
+ /** service-status nested dependencies */
98
+ dependencies?: DependencyEntry[];
99
+ /** service-status incidents (informational extension) */
100
+ incidents?: Incident[];
101
+ /** Link relations */
102
+ links?: Record<string, string>;
103
+ }
104
+ export interface ValidationError {
105
+ path: string;
106
+ message: string;
107
+ code: string;
108
+ }
109
+ export interface ValidationWarning {
110
+ path: string;
111
+ message: string;
112
+ code: string;
113
+ }
114
+ export interface ValidationResult {
115
+ valid: boolean;
116
+ errors: ValidationError[];
117
+ warnings: ValidationWarning[];
118
+ }
119
+ export interface ParseError {
120
+ message: string;
121
+ code: string;
122
+ }
123
+ export interface ParseWarning {
124
+ message: string;
125
+ code: string;
126
+ }
127
+ export interface ParseResult {
128
+ /** The parsed snapshot, or null if parsing failed completely */
129
+ snapshot: Snapshot | null;
130
+ /** Non-fatal errors encountered during parsing */
131
+ errors: ParseError[];
132
+ /** Warnings about ambiguous or lossy interpretation */
133
+ warnings: ParseWarning[];
134
+ }
135
+ export interface ResourceEntry {
136
+ href: string;
137
+ profiles: string[];
138
+ serialization: string;
139
+ auth?: 'none' | 'required';
140
+ description?: string;
141
+ }
142
+ export interface DiscoveryDocument {
143
+ version: string;
144
+ subject: Subject;
145
+ resources: ResourceEntry[];
146
+ }
147
+ export type ConformanceLevel = 'basic' | 'standard' | 'extended';
148
+ export interface ConformanceResult {
149
+ level: ConformanceLevel | null;
150
+ basic: boolean;
151
+ standard: boolean;
152
+ extended: boolean;
153
+ errors: ValidationError[];
154
+ warnings: ValidationWarning[];
155
+ }
156
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+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Ae,EAAE,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAMD,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IACxB,gEAAgE;IAChE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,kDAAkD;IAClD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,uDAAuD;IACvD,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B;AAMD,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,aAAa,EAAE,CAAC;CAC9B;AAMD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CACjC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @open-operational-state/types
3
+ *
4
+ * Canonical TypeScript types for the Open Operational State core model.
5
+ *
6
+ * This package is the shared contract surface. It contains only interfaces,
7
+ * type aliases, constants, and type guards — no runtime logic beyond
8
+ * trivial constant lookups. Zero external dependencies.
9
+ */
10
+ // ---------------------------------------------------------------------------
11
+ // Re-exports
12
+ // ---------------------------------------------------------------------------
13
+ export { LIVENESS_CONDITIONS, READINESS_CONDITIONS, HEALTH_ORDERABLE_CONDITIONS, HEALTH_CATEGORICAL_CONDITIONS, HEALTH_CONDITIONS, isExtensionCondition, isLivenessCondition, isReadinessCondition, isHealthOrderableCondition, isHealthCategoricalCondition, isHealthCondition, isOrderableCondition, conditionSeverity, } from './conditions.js';
14
+ export { PROFILE_IDS, isProfileId, PROFILE_REQUIREMENTS, satisfiedProfiles, } from './profiles.js';
15
+ // ---------------------------------------------------------------------------
16
+ // Provenance
17
+ // ---------------------------------------------------------------------------
18
+ export const PROVENANCE_TYPES = [
19
+ 'self-reported',
20
+ 'externally-observed',
21
+ 'derived',
22
+ 'manually-declared',
23
+ ];
24
+ export function isProvenance(value) {
25
+ return PROVENANCE_TYPES.includes(value);
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,OAAO,EAQH,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAIH,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,eAAe;IACf,qBAAqB;IACrB,SAAS;IACT,mBAAmB;CACb,CAAC;AAIX,MAAM,UAAU,YAAY,CAAE,KAAa;IACvC,OAAS,gBAAuC,CAAC,QAAQ,CAAE,KAAK,CAAE,CAAC;AACvE,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Profile Definitions
3
+ *
4
+ * Profile identifiers, requirement matrices, and hierarchy,
5
+ * derived from status-spec/spec/profiles.md.
6
+ */
7
+ export declare const PROFILE_IDS: readonly ["liveness", "readiness", "health", "status"];
8
+ export type ProfileId = typeof PROFILE_IDS[number];
9
+ export declare function isProfileId(value: string): value is ProfileId;
10
+ export type RequirementLevel = 'MUST' | 'SHOULD' | 'MAY' | 'NONE';
11
+ export interface ProfileRequirements {
12
+ subject: RequirementLevel;
13
+ condition: RequirementLevel;
14
+ timing: RequirementLevel;
15
+ evidence: RequirementLevel;
16
+ components: RequirementLevel;
17
+ dependencies: RequirementLevel;
18
+ provenance: RequirementLevel;
19
+ scope: RequirementLevel;
20
+ }
21
+ /**
22
+ * Normative requirement matrix per profile.
23
+ *
24
+ * Maps directly to the table in profiles.md §Required and Optional Concepts.
25
+ * "—" in the spec table is represented as 'NONE'.
26
+ */
27
+ export declare const PROFILE_REQUIREMENTS: Record<ProfileId, ProfileRequirements>;
28
+ /**
29
+ * Returns the profiles that this profile automatically satisfies,
30
+ * based on the conceptual hierarchy.
31
+ *
32
+ * Example: 'health' → ['health', 'readiness', 'liveness']
33
+ */
34
+ export declare function satisfiedProfiles(profile: ProfileId): ProfileId[];
35
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,WAAW,wDAA2D,CAAC;AACpF,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEnD,wBAAgB,WAAW,CAAE,KAAK,EAAE,MAAM,GAAI,KAAK,IAAI,SAAS,CAE/D;AAMD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAyCvE,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAE,OAAO,EAAE,SAAS,GAAI,SAAS,EAAE,CAInE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Profile Definitions
3
+ *
4
+ * Profile identifiers, requirement matrices, and hierarchy,
5
+ * derived from status-spec/spec/profiles.md.
6
+ */
7
+ // ---------------------------------------------------------------------------
8
+ // Profile identifiers
9
+ // ---------------------------------------------------------------------------
10
+ export const PROFILE_IDS = ['liveness', 'readiness', 'health', 'status'];
11
+ export function isProfileId(value) {
12
+ return PROFILE_IDS.includes(value);
13
+ }
14
+ /**
15
+ * Normative requirement matrix per profile.
16
+ *
17
+ * Maps directly to the table in profiles.md §Required and Optional Concepts.
18
+ * "—" in the spec table is represented as 'NONE'.
19
+ */
20
+ export const PROFILE_REQUIREMENTS = {
21
+ liveness: {
22
+ subject: 'MUST',
23
+ condition: 'MUST',
24
+ timing: 'MAY',
25
+ evidence: 'NONE',
26
+ components: 'NONE',
27
+ dependencies: 'NONE',
28
+ provenance: 'NONE',
29
+ scope: 'NONE',
30
+ },
31
+ readiness: {
32
+ subject: 'MUST',
33
+ condition: 'MUST',
34
+ timing: 'MAY',
35
+ evidence: 'NONE',
36
+ components: 'NONE',
37
+ dependencies: 'MAY',
38
+ provenance: 'NONE',
39
+ scope: 'NONE',
40
+ },
41
+ health: {
42
+ subject: 'MUST',
43
+ condition: 'MUST',
44
+ timing: 'MUST',
45
+ evidence: 'SHOULD',
46
+ components: 'MAY',
47
+ dependencies: 'MAY',
48
+ provenance: 'SHOULD',
49
+ scope: 'MAY',
50
+ },
51
+ status: {
52
+ subject: 'MUST',
53
+ condition: 'MUST',
54
+ timing: 'MUST',
55
+ evidence: 'MUST',
56
+ components: 'MUST',
57
+ dependencies: 'MUST',
58
+ provenance: 'MUST',
59
+ scope: 'MAY',
60
+ },
61
+ };
62
+ // ---------------------------------------------------------------------------
63
+ // Profile hierarchy
64
+ //
65
+ // Status ⊃ Health ⊃ Readiness ⊃ Liveness
66
+ // Each profile's index in PROFILE_IDS is coincidentally its hierarchy level.
67
+ // ---------------------------------------------------------------------------
68
+ /**
69
+ * Returns the profiles that this profile automatically satisfies,
70
+ * based on the conceptual hierarchy.
71
+ *
72
+ * Example: 'health' → ['health', 'readiness', 'liveness']
73
+ */
74
+ export function satisfiedProfiles(profile) {
75
+ const idx = PROFILE_IDS.indexOf(profile);
76
+ // Include the profile itself and all profiles below it in the hierarchy
77
+ return PROFILE_IDS.slice(0, idx + 1).reverse();
78
+ }
79
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAW,CAAC;AAGpF,MAAM,UAAU,WAAW,CAAE,KAAa;IACtC,OAAS,WAAkC,CAAC,QAAQ,CAAE,KAAK,CAAE,CAAC;AAClE,CAAC;AAmBD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAA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-0,0 +1,35 @@
1
+ {
2
+ "name": "@open-operational-state/types",
3
+ "version": "0.1.0",
4
+ "description": "Canonical TypeScript interfaces for the Open Operational State core model",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/open-operational-state/status-tooling.git",
24
+ "directory": "packages/types"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "clean": "rm -rf dist",
29
+ "typecheck": "tsc --noEmit",
30
+ "test": "echo 'No tests yet'"
31
+ },
32
+ "devDependencies": {
33
+ "typescript": "^5.8.0"
34
+ }
35
+ }