@contractual/differs.json-schema 0.1.0-dev.0 → 0.1.0-dev.3

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/types.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  /**
2
- * Internal types for JSON Schema structural differ
2
+ * Strands API types for JSON Schema comparison
3
+ *
4
+ * These types are specific to the Strands-compatible comparison API.
5
+ * Core schema diffing types are in @contractual/differs.core.
3
6
  */
4
7
  /**
5
8
  * Strands compatibility classification for a trace
@@ -55,222 +58,4 @@ export interface CompareOptions {
55
58
  * Supported JSON Schema drafts
56
59
  */
57
60
  export type JsonSchemaDraft = 'draft-07' | 'draft-2019-09' | 'draft-2020-12';
58
- /**
59
- * JSON Schema type values
60
- */
61
- export type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
62
- /**
63
- * Normalized type representation (always an array for comparison)
64
- */
65
- export type NormalizedType = JSONSchemaType[];
66
- /**
67
- * JSON Schema constraint keys that can be tightened or loosened
68
- */
69
- export type ConstraintKey = 'minimum' | 'maximum' | 'exclusiveMinimum' | 'exclusiveMaximum' | 'minLength' | 'maxLength' | 'minItems' | 'maxItems' | 'minProperties' | 'maxProperties' | 'minContains' | 'maxContains' | 'pattern' | 'multipleOf' | 'uniqueItems';
70
- /**
71
- * Constraint comparison direction
72
- */
73
- export type ConstraintDirection = 'min' | 'max' | 'exact';
74
- /**
75
- * Constraint metadata for determining tightened vs loosened
76
- */
77
- export interface ConstraintMeta {
78
- readonly key: ConstraintKey;
79
- readonly direction: ConstraintDirection;
80
- }
81
- /**
82
- * Map of constraint keys to their comparison direction
83
- */
84
- export declare const CONSTRAINT_DIRECTION: Record<ConstraintKey, ConstraintDirection>;
85
- /**
86
- * All constraint keys for iteration
87
- */
88
- export declare const CONSTRAINT_KEYS: ConstraintKey[];
89
- /**
90
- * Composition keywords in JSON Schema
91
- */
92
- export type CompositionKeyword = 'anyOf' | 'oneOf' | 'allOf' | 'if' | 'then' | 'else' | 'not';
93
- /**
94
- * All composition keywords for iteration
95
- */
96
- export declare const COMPOSITION_KEYWORDS: CompositionKeyword[];
97
- /**
98
- * Metadata keys that are compared (patch-level changes)
99
- */
100
- export type MetadataKey = 'description' | 'title' | 'default' | 'examples';
101
- /**
102
- * All metadata keys for iteration
103
- */
104
- export declare const METADATA_KEYS: MetadataKey[];
105
- /**
106
- * Annotation keys (patch-level changes per Strands API)
107
- */
108
- export type AnnotationKey = 'deprecated' | 'readOnly' | 'writeOnly';
109
- /**
110
- * All annotation keys for iteration
111
- */
112
- export declare const ANNOTATION_KEYS: AnnotationKey[];
113
- /**
114
- * Content keywords (patch-level changes per Strands API)
115
- */
116
- export type ContentKey = 'contentEncoding' | 'contentMediaType' | 'contentSchema';
117
- /**
118
- * All content keys for iteration
119
- */
120
- export declare const CONTENT_KEYS: ContentKey[];
121
- /**
122
- * Resolved JSON Schema object (refs already resolved)
123
- */
124
- export interface ResolvedSchema {
125
- $schema?: string;
126
- $id?: string;
127
- $ref?: string;
128
- $defs?: Record<string, ResolvedSchema>;
129
- type?: JSONSchemaType | JSONSchemaType[];
130
- title?: string;
131
- description?: string;
132
- default?: unknown;
133
- examples?: unknown[];
134
- deprecated?: boolean;
135
- readOnly?: boolean;
136
- writeOnly?: boolean;
137
- enum?: unknown[];
138
- const?: unknown;
139
- format?: string;
140
- minimum?: number;
141
- maximum?: number;
142
- exclusiveMinimum?: number;
143
- exclusiveMaximum?: number;
144
- multipleOf?: number;
145
- minLength?: number;
146
- maxLength?: number;
147
- pattern?: string;
148
- contentEncoding?: string;
149
- contentMediaType?: string;
150
- contentSchema?: ResolvedSchema;
151
- properties?: Record<string, ResolvedSchema>;
152
- required?: string[];
153
- additionalProperties?: boolean | ResolvedSchema;
154
- minProperties?: number;
155
- maxProperties?: number;
156
- propertyNames?: ResolvedSchema;
157
- patternProperties?: Record<string, ResolvedSchema>;
158
- dependentRequired?: Record<string, string[]>;
159
- dependentSchemas?: Record<string, ResolvedSchema>;
160
- unevaluatedProperties?: boolean | ResolvedSchema;
161
- items?: ResolvedSchema | ResolvedSchema[];
162
- prefixItems?: ResolvedSchema[];
163
- minItems?: number;
164
- maxItems?: number;
165
- uniqueItems?: boolean;
166
- contains?: ResolvedSchema;
167
- minContains?: number;
168
- maxContains?: number;
169
- unevaluatedItems?: boolean | ResolvedSchema;
170
- anyOf?: ResolvedSchema[];
171
- oneOf?: ResolvedSchema[];
172
- allOf?: ResolvedSchema[];
173
- if?: ResolvedSchema;
174
- then?: ResolvedSchema;
175
- else?: ResolvedSchema;
176
- not?: ResolvedSchema;
177
- [key: string]: unknown;
178
- }
179
- /**
180
- * Walker context for tracking traversal state
181
- */
182
- export interface WalkerContext {
183
- /** Current JSON Pointer path */
184
- readonly path: string;
185
- /** Depth of recursion (for cycle detection) */
186
- readonly depth: number;
187
- /** Maximum allowed depth */
188
- readonly maxDepth: number;
189
- }
190
- /**
191
- * Default maximum recursion depth
192
- */
193
- export declare const DEFAULT_MAX_DEPTH = 100;
194
- /**
195
- * Type guard to check if value is a schema object
196
- */
197
- export declare function isSchemaObject(value: unknown): value is ResolvedSchema;
198
- /**
199
- * Type guard to check if value is an array of schemas
200
- */
201
- export declare function isSchemaArray(value: unknown): value is ResolvedSchema[];
202
- /**
203
- * Normalize type to array for consistent comparison
204
- */
205
- export declare function normalizeType(type: JSONSchemaType | JSONSchemaType[] | undefined): NormalizedType;
206
- /**
207
- * Check if two arrays have the same elements (order-independent)
208
- */
209
- export declare function arraysEqual<T>(a: T[], b: T[]): boolean;
210
- /**
211
- * Deep equality check for JSON values
212
- */
213
- export declare function deepEqual(a: unknown, b: unknown): boolean;
214
- /**
215
- * Escape JSON Pointer segment according to RFC 6901
216
- */
217
- export declare function escapeJsonPointer(segment: string): string;
218
- /**
219
- * Join path segments into a JSON Pointer
220
- */
221
- export declare function joinPath(basePath: string, ...segments: string[]): string;
222
- /**
223
- * Severity classification for detected changes
224
- */
225
- export type ChangeSeverity = 'breaking' | 'non-breaking' | 'patch' | 'unknown';
226
- /**
227
- * Suggested semver bump based on detected changes
228
- */
229
- export type SuggestedBump = 'major' | 'minor' | 'patch' | 'none';
230
- /**
231
- * A single change detected between two spec versions
232
- */
233
- export interface Change {
234
- path: string;
235
- severity: ChangeSeverity;
236
- category: string;
237
- message: string;
238
- oldValue?: unknown;
239
- newValue?: unknown;
240
- }
241
- /**
242
- * Summary counts of changes by severity
243
- */
244
- export interface DiffSummary {
245
- breaking: number;
246
- nonBreaking: number;
247
- patch: number;
248
- unknown: number;
249
- }
250
- /**
251
- * Result of comparing two spec versions
252
- */
253
- export interface DiffResult {
254
- contract: string;
255
- changes: Change[];
256
- summary: DiffSummary;
257
- suggestedBump: SuggestedBump;
258
- }
259
- /**
260
- * All possible structural change types for classification
261
- */
262
- export type ChangeType = 'property-added' | 'property-removed' | 'required-added' | 'required-removed' | 'type-changed' | 'type-narrowed' | 'type-widened' | 'enum-value-added' | 'enum-value-removed' | 'enum-added' | 'enum-removed' | 'constraint-tightened' | 'constraint-loosened' | 'format-changed' | 'format-added' | 'format-removed' | 'additional-properties-denied' | 'additional-properties-allowed' | 'additional-properties-changed' | 'property-names-changed' | 'dependent-required-added' | 'dependent-required-removed' | 'dependent-schemas-changed' | 'unevaluated-properties-changed' | 'items-changed' | 'min-items-increased' | 'max-items-decreased' | 'min-contains-changed' | 'max-contains-changed' | 'unevaluated-items-changed' | 'ref-target-changed' | 'description-changed' | 'title-changed' | 'default-changed' | 'examples-changed' | 'deprecated-changed' | 'read-only-changed' | 'write-only-changed' | 'content-encoding-changed' | 'content-media-type-changed' | 'content-schema-changed' | 'anyof-option-added' | 'anyof-option-removed' | 'oneof-option-added' | 'oneof-option-removed' | 'allof-member-added' | 'allof-member-removed' | 'not-schema-changed' | 'if-then-else-changed' | 'composition-changed' | 'unknown-change';
263
- /**
264
- * Raw change detected by a differ before severity classification
265
- */
266
- export interface RawChange {
267
- path: string;
268
- type: ChangeType;
269
- oldValue?: unknown;
270
- newValue?: unknown;
271
- }
272
- /**
273
- * Mapping from change types to their severity classification
274
- */
275
- export declare const CHANGE_TYPE_SEVERITY: Record<ChangeType, ChangeSeverity>;
276
61
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,YAAY,GAAG,SAAS,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;IAChC,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5C,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iEA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G;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;IAChC,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5C,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,yCAAyC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,eAAe,GAAG,eAAe,CAAC"}
package/dist/types.js CHANGED
@@ -1,210 +1,8 @@
1
1
  /**
2
- * Internal types for JSON Schema structural differ
2
+ * Strands API types for JSON Schema comparison
3
+ *
4
+ * These types are specific to the Strands-compatible comparison API.
5
+ * Core schema diffing types are in @contractual/differs.core.
3
6
  */
4
- /**
5
- * Map of constraint keys to their comparison direction
6
- */
7
- export const CONSTRAINT_DIRECTION = {
8
- minimum: 'min',
9
- maximum: 'max',
10
- exclusiveMinimum: 'min',
11
- exclusiveMaximum: 'max',
12
- minLength: 'min',
13
- maxLength: 'max',
14
- minItems: 'min',
15
- maxItems: 'max',
16
- minProperties: 'min',
17
- maxProperties: 'max',
18
- minContains: 'min',
19
- maxContains: 'max',
20
- pattern: 'exact',
21
- multipleOf: 'exact',
22
- uniqueItems: 'exact',
23
- };
24
- /**
25
- * All constraint keys for iteration
26
- */
27
- export const CONSTRAINT_KEYS = [
28
- 'minimum',
29
- 'maximum',
30
- 'exclusiveMinimum',
31
- 'exclusiveMaximum',
32
- 'minLength',
33
- 'maxLength',
34
- 'minItems',
35
- 'maxItems',
36
- 'minProperties',
37
- 'maxProperties',
38
- 'minContains',
39
- 'maxContains',
40
- 'pattern',
41
- 'multipleOf',
42
- 'uniqueItems',
43
- ];
44
- /**
45
- * All composition keywords for iteration
46
- */
47
- export const COMPOSITION_KEYWORDS = [
48
- 'anyOf',
49
- 'oneOf',
50
- 'allOf',
51
- 'if',
52
- 'then',
53
- 'else',
54
- 'not',
55
- ];
56
- /**
57
- * All metadata keys for iteration
58
- */
59
- export const METADATA_KEYS = ['description', 'title', 'default', 'examples'];
60
- /**
61
- * All annotation keys for iteration
62
- */
63
- export const ANNOTATION_KEYS = ['deprecated', 'readOnly', 'writeOnly'];
64
- /**
65
- * All content keys for iteration
66
- */
67
- export const CONTENT_KEYS = ['contentEncoding', 'contentMediaType', 'contentSchema'];
68
- /**
69
- * Default maximum recursion depth
70
- */
71
- export const DEFAULT_MAX_DEPTH = 100;
72
- /**
73
- * Type guard to check if value is a schema object
74
- */
75
- export function isSchemaObject(value) {
76
- return typeof value === 'object' && value !== null && !Array.isArray(value);
77
- }
78
- /**
79
- * Type guard to check if value is an array of schemas
80
- */
81
- export function isSchemaArray(value) {
82
- return Array.isArray(value) && value.every(isSchemaObject);
83
- }
84
- /**
85
- * Normalize type to array for consistent comparison
86
- */
87
- export function normalizeType(type) {
88
- if (type === undefined) {
89
- return [];
90
- }
91
- if (Array.isArray(type)) {
92
- return [...type].sort();
93
- }
94
- return [type];
95
- }
96
- /**
97
- * Check if two arrays have the same elements (order-independent)
98
- */
99
- export function arraysEqual(a, b) {
100
- if (a.length !== b.length)
101
- return false;
102
- const sortedA = [...a].sort();
103
- const sortedB = [...b].sort();
104
- return sortedA.every((val, idx) => val === sortedB[idx]);
105
- }
106
- /**
107
- * Deep equality check for JSON values
108
- */
109
- export function deepEqual(a, b) {
110
- if (a === b) {
111
- return true;
112
- }
113
- if (typeof a !== typeof b) {
114
- return false;
115
- }
116
- if (a === null || b === null)
117
- return a === b;
118
- if (Array.isArray(a) && Array.isArray(b)) {
119
- if (a.length !== b.length)
120
- return false;
121
- return a.every((val, idx) => deepEqual(val, b[idx]));
122
- }
123
- if (typeof a === 'object' && typeof b === 'object') {
124
- const aObj = a;
125
- const bObj = b;
126
- const aKeys = Object.keys(aObj);
127
- const bKeys = Object.keys(bObj);
128
- if (aKeys.length !== bKeys.length)
129
- return false;
130
- return aKeys.every((key) => deepEqual(aObj[key], bObj[key]));
131
- }
132
- return false;
133
- }
134
- /**
135
- * Escape JSON Pointer segment according to RFC 6901
136
- */
137
- export function escapeJsonPointer(segment) {
138
- return segment.replace(/~/g, '~0').replace(/\//g, '~1');
139
- }
140
- /**
141
- * Join path segments into a JSON Pointer
142
- */
143
- export function joinPath(basePath, ...segments) {
144
- const escaped = segments.map(escapeJsonPointer);
145
- if (basePath === '') {
146
- return escaped.length > 0 ? '/' + escaped.join('/') : '';
147
- }
148
- return basePath + '/' + escaped.join('/');
149
- }
150
- /**
151
- * Mapping from change types to their severity classification
152
- */
153
- export const CHANGE_TYPE_SEVERITY = {
154
- // Breaking changes (major)
155
- 'property-removed': 'breaking',
156
- 'required-added': 'breaking',
157
- 'type-changed': 'breaking',
158
- 'type-narrowed': 'breaking',
159
- 'enum-value-removed': 'breaking',
160
- 'enum-added': 'breaking',
161
- 'constraint-tightened': 'breaking',
162
- 'additional-properties-denied': 'breaking',
163
- 'items-changed': 'breaking',
164
- 'min-items-increased': 'breaking',
165
- 'max-items-decreased': 'breaking',
166
- 'ref-target-changed': 'breaking',
167
- 'dependent-required-added': 'breaking',
168
- 'anyof-option-added': 'breaking',
169
- 'oneof-option-added': 'breaking',
170
- 'allof-member-added': 'breaking',
171
- 'not-schema-changed': 'breaking',
172
- // Non-breaking changes (minor)
173
- 'property-added': 'non-breaking',
174
- 'required-removed': 'non-breaking',
175
- 'type-widened': 'non-breaking',
176
- 'enum-value-added': 'non-breaking',
177
- 'enum-removed': 'non-breaking',
178
- 'constraint-loosened': 'non-breaking',
179
- 'additional-properties-allowed': 'non-breaking',
180
- 'additional-properties-changed': 'non-breaking',
181
- 'dependent-required-removed': 'non-breaking',
182
- 'anyof-option-removed': 'non-breaking',
183
- 'oneof-option-removed': 'non-breaking',
184
- 'allof-member-removed': 'non-breaking',
185
- // Patch-level changes
186
- 'format-added': 'patch',
187
- 'format-removed': 'patch',
188
- 'format-changed': 'patch',
189
- 'description-changed': 'patch',
190
- 'title-changed': 'patch',
191
- 'default-changed': 'patch',
192
- 'examples-changed': 'patch',
193
- 'deprecated-changed': 'patch',
194
- 'read-only-changed': 'patch',
195
- 'write-only-changed': 'patch',
196
- 'content-encoding-changed': 'patch',
197
- 'content-media-type-changed': 'patch',
198
- 'content-schema-changed': 'patch',
199
- // Unknown (manual review)
200
- 'property-names-changed': 'unknown',
201
- 'dependent-schemas-changed': 'unknown',
202
- 'unevaluated-properties-changed': 'unknown',
203
- 'unevaluated-items-changed': 'unknown',
204
- 'min-contains-changed': 'unknown',
205
- 'max-contains-changed': 'unknown',
206
- 'if-then-else-changed': 'unknown',
207
- 'composition-changed': 'unknown',
208
- 'unknown-change': 'unknown',
209
- };
7
+ export {};
210
8
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyHH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA+C;IAC9E,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,OAAO;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM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E,SAAS;IACtC,sBAAsB,EAAE,SAAS;IACjC,sBAAsB,EAAE,SAAS;IACjC,sBAAsB,EAAE,SAAS;IACjC,qBAAqB,EAAE,SAAS;IAChC,gBAAgB,EAAE,SAAS;CAC5B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractual/differs.json-schema",
3
- "version": "0.1.0-dev.0",
3
+ "version": "0.1.0-dev.3",
4
4
  "description": "Detect breaking changes between JSON Schema versions with semantic classification",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,6 +47,10 @@
47
47
  "dist",
48
48
  "README.md"
49
49
  ],
50
+ "dependencies": {
51
+ "@contractual/differs.core": "0.1.0-dev.3",
52
+ "@contractual/types": "0.1.0-dev.3"
53
+ },
50
54
  "devDependencies": {
51
55
  "rimraf": "^5.0.5",
52
56
  "vitest": "^3.0.3"
@@ -55,5 +59,5 @@
55
59
  "access": "public",
56
60
  "provenance": true
57
61
  },
58
- "gitHead": "a18dcec2397cf45cbd4ba86461d378ccd71ba657"
62
+ "gitHead": "6a8c46482574388069e19a8fee69c097c8a5ec47"
59
63
  }
@@ -1,87 +0,0 @@
1
- /**
2
- * JSON Schema Change Classifiers
3
- *
4
- * Classifies raw structural changes into severity levels for semantic versioning.
5
- * Follows API compatibility principles where breaking changes require major bumps,
6
- * additive changes require minor bumps, and metadata changes are patches.
7
- */
8
- import type { RawChange, ChangeType, ChangeSeverity } from './types.js';
9
- /**
10
- * Export classification sets for external analysis
11
- */
12
- export declare const CLASSIFICATION_SETS: {
13
- readonly breaking: ReadonlySet<ChangeType>;
14
- readonly nonBreaking: ReadonlySet<ChangeType>;
15
- readonly patch: ReadonlySet<ChangeType>;
16
- readonly unknown: ReadonlySet<ChangeType>;
17
- };
18
- /**
19
- * Classify a raw change into a severity level
20
- *
21
- * Uses the Strands API classification rules where:
22
- * - Breaking changes require major version bump
23
- * - Non-breaking changes require minor version bump
24
- * - Patch changes are metadata/annotation only
25
- * - Unknown changes require manual review
26
- *
27
- * @param change - The raw change to classify
28
- * @returns The severity classification
29
- *
30
- * @example
31
- * ```typescript
32
- * const change: RawChange = {
33
- * path: '/properties/name',
34
- * type: 'property-removed',
35
- * oldValue: { type: 'string' },
36
- * };
37
- * const severity = classify(change);
38
- * // severity === 'breaking'
39
- * ```
40
- */
41
- export declare function classify(change: RawChange): ChangeSeverity;
42
- /**
43
- * Classify a property-added change with schema context
44
- *
45
- * Property additions are breaking if the property is required,
46
- * otherwise they are non-breaking (additive).
47
- *
48
- * @param change - The property-added change
49
- * @param newSchema - The new schema for context (to check required array)
50
- * @returns The severity classification
51
- *
52
- * @example
53
- * ```typescript
54
- * const change: RawChange = {
55
- * path: '/properties/email',
56
- * type: 'property-added',
57
- * newValue: { type: 'string', format: 'email' },
58
- * };
59
- *
60
- * const schema = {
61
- * type: 'object',
62
- * properties: { email: { type: 'string', format: 'email' } },
63
- * required: ['email'], // email is required!
64
- * };
65
- *
66
- * const severity = classifyPropertyAdded(change, schema);
67
- * // severity === 'breaking' (because email is in required[])
68
- * ```
69
- */
70
- export declare function classifyPropertyAdded(change: RawChange, newSchema: unknown): ChangeSeverity;
71
- /**
72
- * Batch classify multiple changes
73
- *
74
- * @param changes - Array of raw changes
75
- * @param newSchema - Optional schema for context-aware classification
76
- * @returns Map of change to severity
77
- */
78
- export declare function classifyAll(changes: readonly RawChange[], newSchema?: unknown): Map<RawChange, ChangeSeverity>;
79
- /**
80
- * Get a human-readable message for a classified change
81
- *
82
- * @param change - The raw change
83
- * @param severity - The classified severity
84
- * @returns Human-readable description
85
- */
86
- export declare function getChangeMessage(change: RawChange, severity: ChangeSeverity): string;
87
- //# sourceMappingURL=classifiers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classifiers.d.ts","sourceRoot":"","sources":["../src/classifiers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA6HxE;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAsB1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAG,cAAc,CA6B3F;AAgGD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,SAAS,CAAC,EAAE,OAAO,GAClB,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAYhC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,CAapF"}