@canon-protocol/types 8.0.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/dist/ctl/models/enums.d.ts +58 -0
- package/dist/ctl/models/enums.js +64 -0
- package/dist/ctl/models/types.d.ts +169 -0
- package/dist/ctl/models/types.js +5 -0
- package/dist/ctl/parsing/enums.d.ts +38 -0
- package/dist/ctl/parsing/enums.js +44 -0
- package/dist/ctl/parsing/types.d.ts +89 -0
- package/dist/ctl/parsing/types.js +5 -0
- package/dist/ctl/rendering/types.d.ts +39 -0
- package/dist/ctl/rendering/types.js +5 -0
- package/dist/ctl/resolution/enums.d.ts +34 -0
- package/dist/ctl/resolution/enums.js +40 -0
- package/dist/ctl/resolution/types.d.ts +156 -0
- package/dist/ctl/resolution/types.js +5 -0
- package/dist/ctl/validation/types.d.ts +10 -0
- package/dist/ctl/validation/types.js +5 -0
- package/dist/document/constants/types.d.ts +5 -0
- package/dist/document/constants/types.js +5 -0
- package/dist/document/filtering/index.d.ts +13 -0
- package/dist/document/filtering/index.js +5 -0
- package/dist/document/filtering/types.d.ts +14 -0
- package/dist/document/filtering/types.js +5 -0
- package/dist/document/models/enums.d.ts +21 -0
- package/dist/document/models/enums.js +26 -0
- package/dist/document/models/index.d.ts +47 -0
- package/dist/document/models/index.js +5 -0
- package/dist/document/models/types.d.ts +194 -0
- package/dist/document/models/types.js +5 -0
- package/dist/document/parsing/index.d.ts +19 -0
- package/dist/document/parsing/index.js +5 -0
- package/dist/document/parsing/types.d.ts +10 -0
- package/dist/document/parsing/types.js +5 -0
- package/dist/document/repositories/enums.d.ts +17 -0
- package/dist/document/repositories/enums.js +22 -0
- package/dist/document/repositories/types.d.ts +103 -0
- package/dist/document/repositories/types.js +5 -0
- package/dist/document/storage/index.d.ts +25 -0
- package/dist/document/storage/index.js +5 -0
- package/dist/document/storage/types.d.ts +5 -0
- package/dist/document/storage/types.js +5 -0
- package/dist/exporters/ctl/markdown/types.d.ts +10 -0
- package/dist/exporters/ctl/markdown/types.js +5 -0
- package/dist/object/canons/types.d.ts +17 -0
- package/dist/object/canons/types.js +5 -0
- package/dist/object/parsing/index.d.ts +21 -0
- package/dist/object/parsing/index.js +5 -0
- package/dist/object/parsing/types.d.ts +43 -0
- package/dist/object/parsing/types.js +5 -0
- package/dist/object/resolution/types.d.ts +116 -0
- package/dist/object/resolution/types.js +5 -0
- package/dist/object/statements/index.d.ts +2 -0
- package/dist/object/statements/index.js +5 -0
- package/dist/object/statements/types.d.ts +20 -0
- package/dist/object/statements/types.js +5 -0
- package/dist/object/uris/types.d.ts +17 -0
- package/dist/object/uris/types.js +5 -0
- package/dist/object/validation/enums.d.ts +13 -0
- package/dist/object/validation/enums.js +18 -0
- package/dist/object/validation/index.d.ts +19 -0
- package/dist/object/validation/index.js +5 -0
- package/dist/object/validation/rules/document/index.d.ts +17 -0
- package/dist/object/validation/rules/document/index.js +5 -0
- package/dist/object/validation/rules/document/types.d.ts +52 -0
- package/dist/object/validation/rules/document/types.js +5 -0
- package/dist/object/validation/rules/repository/index.d.ts +19 -0
- package/dist/object/validation/rules/repository/index.js +5 -0
- package/dist/object/validation/rules/repository/types.d.ts +148 -0
- package/dist/object/validation/rules/repository/types.js +5 -0
- package/dist/object/validation/types.d.ts +134 -0
- package/dist/object/validation/types.js +5 -0
- package/dist/registry/models/types.d.ts +253 -0
- package/dist/registry/models/types.js +5 -0
- package/dist/registry/oauth/types.d.ts +192 -0
- package/dist/registry/oauth/types.js +5 -0
- package/dist/registry/providers/enums.d.ts +8 -0
- package/dist/registry/providers/enums.js +13 -0
- package/dist/registry/providers/git/types.d.ts +43 -0
- package/dist/registry/providers/git/types.js +5 -0
- package/dist/registry/providers/github/models/types.d.ts +35 -0
- package/dist/registry/providers/github/models/types.js +5 -0
- package/dist/registry/providers/github/types.d.ts +30 -0
- package/dist/registry/providers/github/types.js +5 -0
- package/dist/registry/providers/index.d.ts +29 -0
- package/dist/registry/providers/index.js +5 -0
- package/dist/registry/providers/oci/types.d.ts +17 -0
- package/dist/registry/providers/oci/types.js +5 -0
- package/dist/registry/providers/types.d.ts +15 -0
- package/dist/registry/providers/types.js +5 -0
- package/dist/registry/services/index.d.ts +9 -0
- package/dist/registry/services/index.js +5 -0
- package/dist/registry/services/types.d.ts +153 -0
- package/dist/registry/services/types.js +5 -0
- package/package.json +99 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ICanonDocumentRepository } from '../../../../document/models/index';
|
|
2
|
+
import { CanonDocument } from '../../../../document/models/types';
|
|
3
|
+
import { CanonUri } from '../../../../object/uris/types';
|
|
4
|
+
import { IRepositoryValidationRule } from '../../../../object/validation/rules/repository/index';
|
|
5
|
+
import { OntologyValidationError } from '../../../../object/validation/types';
|
|
6
|
+
/**
|
|
7
|
+
* Validates that references to entities or properties are unambiguous. When multiple imports define the same entity/property name, namespace aliases MUST be used to disambiguate (e.g., 'people.name' vs 'heroes.name'). When only one source defines an entity, aliases are optional. Design Philosophy: - Aliases are document-scoped only (not transitive) - Aliases are required ONLY when ambiguity exists - Aliases are optional when references are unambiguous
|
|
8
|
+
*/
|
|
9
|
+
export interface AmbiguousReferenceRule extends IRepositoryValidationRule {
|
|
10
|
+
readonly ruleName: string;
|
|
11
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validates that all classes used as entity types are properly defined or imported
|
|
15
|
+
*/
|
|
16
|
+
export interface ClassDefinitionRule extends IRepositoryValidationRule {
|
|
17
|
+
readonly ruleName: string;
|
|
18
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Detects circular dependencies in class hierarchies (subClassOf chains)
|
|
22
|
+
*/
|
|
23
|
+
export interface ClassHierarchyCycleRule extends IRepositoryValidationRule {
|
|
24
|
+
readonly ruleName: string;
|
|
25
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validates that properties used on Class and Property definitions are actually defined. When a class or property definition uses a property (e.g., "icon: ✅"), this rule ensures that the property "icon" is defined as an ObjectProperty or DatatypeProperty either locally or in imported namespaces.
|
|
29
|
+
*/
|
|
30
|
+
export interface DefinitionPropertyReferenceRule extends IRepositoryValidationRule {
|
|
31
|
+
readonly ruleName: string;
|
|
32
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
33
|
+
}
|
|
34
|
+
export interface ImportErrorDetails {
|
|
35
|
+
message: string;
|
|
36
|
+
suggestion: string;
|
|
37
|
+
expectedValue: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates that all imported namespaces actually exist in the repository and that version constraints can be satisfied
|
|
41
|
+
*/
|
|
42
|
+
export interface ImportExistenceRule extends IRepositoryValidationRule {
|
|
43
|
+
readonly ruleName: string;
|
|
44
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validates that properties used in entity instances are actually defined. When an entity instance uses a property (e.g., "assignedTo: some-agent"), this rule ensures that the property "assignedTo" is defined as an ObjectProperty or DatatypeProperty either locally or in imported namespaces.
|
|
48
|
+
*/
|
|
49
|
+
export interface InstancePropertyReferenceRule extends IRepositoryValidationRule {
|
|
50
|
+
readonly ruleName: string;
|
|
51
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Detects circular dependencies in namespace imports. Circular dependencies prevent proper package resolution, so these must be caught during validation.
|
|
55
|
+
*/
|
|
56
|
+
export interface NamespaceImportCycleRule extends IRepositoryValidationRule {
|
|
57
|
+
readonly ruleName: string;
|
|
58
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validates that namespaces for ObjectProperty range classes are imported
|
|
62
|
+
*/
|
|
63
|
+
export interface ObjectPropertyImportRule extends IRepositoryValidationRule {
|
|
64
|
+
readonly ruleName: string;
|
|
65
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validates that ALL ObjectProperty values point to existing entities. Uses TypeResolver to determine which properties are ObjectProperties (explicit or inferred from range).
|
|
69
|
+
*/
|
|
70
|
+
export interface ObjectPropertyValueValidationRule extends IRepositoryValidationRule {
|
|
71
|
+
readonly ruleName: string;
|
|
72
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates that properties are only used on instances of their declared domain class. Ensures properties are used on the correct types (domain validation).
|
|
76
|
+
*/
|
|
77
|
+
export interface PropertyDomainRule extends IRepositoryValidationRule {
|
|
78
|
+
readonly ruleName: string;
|
|
79
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Detects circular dependencies in property hierarchies (subPropertyOf chains)
|
|
83
|
+
*/
|
|
84
|
+
export interface PropertyHierarchyCycleRule extends IRepositoryValidationRule {
|
|
85
|
+
readonly ruleName: string;
|
|
86
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
87
|
+
}
|
|
88
|
+
export interface PropertyInfo {
|
|
89
|
+
propertyType: string;
|
|
90
|
+
range?: string | null | undefined;
|
|
91
|
+
rangeUri?: CanonUri | null | undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates that property range references point to valid types. For ObjectProperty, ensures the range refers to a defined class. For DatatypeProperty, ensures the range is a valid primitive type.
|
|
95
|
+
*/
|
|
96
|
+
export interface PropertyRangeReferenceRule extends IRepositoryValidationRule {
|
|
97
|
+
readonly ruleName: string;
|
|
98
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Validates that all property definitions have a 'range' specified. This is required for type inference and proper semantic validation.
|
|
102
|
+
*/
|
|
103
|
+
export interface PropertyRangeRequiredRule extends IRepositoryValidationRule {
|
|
104
|
+
readonly ruleName: string;
|
|
105
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Validates that instance property values match their declared property types and ranges. Prevents setting complex objects on DatatypeProperties and ensures ObjectProperty values are valid.
|
|
109
|
+
*/
|
|
110
|
+
export interface PropertyValueTypeRule extends IRepositoryValidationRule {
|
|
111
|
+
readonly ruleName: string;
|
|
112
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validates that subClassOf references point to existing classes
|
|
116
|
+
*/
|
|
117
|
+
export interface SubClassOfReferenceRule extends IRepositoryValidationRule {
|
|
118
|
+
readonly ruleName: string;
|
|
119
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates that subPropertyOf references point to existing properties
|
|
123
|
+
*/
|
|
124
|
+
export interface SubPropertyOfReferenceRule extends IRepositoryValidationRule {
|
|
125
|
+
readonly ruleName: string;
|
|
126
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Validates that there are no ambiguous type references when multiple imported namespaces define the same type. Suggests using namespace aliases to resolve ambiguity.
|
|
130
|
+
*/
|
|
131
|
+
export interface TypeAmbiguityRule extends IRepositoryValidationRule {
|
|
132
|
+
readonly ruleName: string;
|
|
133
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Validates that ObjectProperty instance references (Reference Statements) can be resolved. Checks that when an entity references another entity via an ObjectProperty, the referenced entity exists in the current document or imported namespaces.
|
|
137
|
+
*/
|
|
138
|
+
export interface UnresolvedReferenceRule extends IRepositoryValidationRule {
|
|
139
|
+
readonly ruleName: string;
|
|
140
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Validates that XSD namespace is imported when DatatypeProperty uses XSD types
|
|
144
|
+
*/
|
|
145
|
+
export interface XsdImportRule extends IRepositoryValidationRule {
|
|
146
|
+
readonly ruleName: string;
|
|
147
|
+
validateAsync(document: CanonDocument, repository: ICanonDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
148
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ICanonDocumentRepository } from '../../document/models/index';
|
|
2
|
+
import { CanonDocument } from '../../document/models/types';
|
|
3
|
+
import { PropertyMetadata } from '../../object/parsing/types';
|
|
4
|
+
import { ValidationSeverity } from '../../object/validation/enums';
|
|
5
|
+
import { ICanonObjectValidator } from '../../object/validation/index';
|
|
6
|
+
import { IDocumentValidationRule } from '../../object/validation/rules/document/index';
|
|
7
|
+
import { IRepositoryValidationRule } from '../../object/validation/rules/repository/index';
|
|
8
|
+
/**
|
|
9
|
+
* Main validator for Canon documents at the ontology level
|
|
10
|
+
*/
|
|
11
|
+
export interface CanonObjectValidator extends ICanonObjectValidator {
|
|
12
|
+
/**
|
|
13
|
+
* Gets or sets whether to include warnings in validation results
|
|
14
|
+
*/
|
|
15
|
+
includeWarnings: boolean;
|
|
16
|
+
validateAsync(document: CanonDocument, repository?: ICanonDocumentRepository | null): Promise<OntologyValidationResult>;
|
|
17
|
+
validateYamlAsync(yamlText: string, repository?: ICanonDocumentRepository | null): Promise<OntologyValidationResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a custom document validation rule
|
|
20
|
+
*/
|
|
21
|
+
addDocumentRule(rule: IDocumentValidationRule): void;
|
|
22
|
+
/**
|
|
23
|
+
* Adds a custom repository validation rule
|
|
24
|
+
*/
|
|
25
|
+
addRepositoryRule(rule: IRepositoryValidationRule): void;
|
|
26
|
+
/**
|
|
27
|
+
* Removes a document validation rule by type
|
|
28
|
+
*/
|
|
29
|
+
removeDocumentRule<T>(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Removes a repository validation rule by type
|
|
32
|
+
*/
|
|
33
|
+
removeRepositoryRule<T>(): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a validation error or warning for ontological issues
|
|
37
|
+
*/
|
|
38
|
+
export interface OntologyValidationError {
|
|
39
|
+
/**
|
|
40
|
+
* The type of validation rule that was violated
|
|
41
|
+
*/
|
|
42
|
+
ruleType: string;
|
|
43
|
+
/**
|
|
44
|
+
* Severity level of the issue
|
|
45
|
+
*/
|
|
46
|
+
severity: ValidationSeverity;
|
|
47
|
+
/**
|
|
48
|
+
* Line number in the source file where the error occurred (if available)
|
|
49
|
+
*/
|
|
50
|
+
lineNumber?: number | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Column number in the source file where the error occurred (if available, primarily for parse errors)
|
|
53
|
+
*/
|
|
54
|
+
column?: number | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The resource (class, property, instance) where the error occurred
|
|
57
|
+
*/
|
|
58
|
+
resourceName?: string | null | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The property within the entity where the error occurred
|
|
61
|
+
*/
|
|
62
|
+
propertyName?: string | null | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The full path to the property, including nested paths and array indices. Examples: "hasTasks[0].hasDependency.dependsOn", "flowsThrough[2]", "simpleProperty" Used for positioning diagnostics in deeply nested structures.
|
|
65
|
+
*/
|
|
66
|
+
propertyPath?: string | null | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Human-readable error message
|
|
69
|
+
*/
|
|
70
|
+
message: string;
|
|
71
|
+
/**
|
|
72
|
+
* Suggestion for how to fix the issue
|
|
73
|
+
*/
|
|
74
|
+
suggestion?: string | null | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* The actual value that caused the validation error
|
|
77
|
+
*/
|
|
78
|
+
actualValue?: string | null | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The expected or corrected value
|
|
81
|
+
*/
|
|
82
|
+
expectedValue?: string | null | undefined;
|
|
83
|
+
toString(): string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Result of ontology validation for a Canon document
|
|
87
|
+
*/
|
|
88
|
+
export interface OntologyValidationResult {
|
|
89
|
+
/**
|
|
90
|
+
* Whether the validation passed without errors
|
|
91
|
+
*/
|
|
92
|
+
isValid: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* List of validation errors found
|
|
95
|
+
*/
|
|
96
|
+
errors: Array<OntologyValidationError>;
|
|
97
|
+
/**
|
|
98
|
+
* List of validation warnings (non-fatal issues)
|
|
99
|
+
*/
|
|
100
|
+
warnings: Array<OntologyValidationError>;
|
|
101
|
+
/**
|
|
102
|
+
* Total count of issues (errors + warnings)
|
|
103
|
+
*/
|
|
104
|
+
readonly totalIssues: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Context for validation operations, carrying metadata needed for type inference and validation
|
|
108
|
+
*/
|
|
109
|
+
export interface ValidationContext {
|
|
110
|
+
/**
|
|
111
|
+
* The parent property metadata for the current embedded object being validated. Used to infer the expected type from the property's range.
|
|
112
|
+
*/
|
|
113
|
+
parentProperty?: PropertyMetadata | null | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* All resolved documents in the current validation scope (includes imports)
|
|
116
|
+
*/
|
|
117
|
+
resolvedDocuments: Array<CanonDocument>;
|
|
118
|
+
/**
|
|
119
|
+
* The current path in the document hierarchy (for error reporting)
|
|
120
|
+
*/
|
|
121
|
+
currentResourcePath?: string | null | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the inferred type for the current embedded object based on parent property's range
|
|
124
|
+
*/
|
|
125
|
+
getInferredType(): string | null;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a new validation context with updated parent property metadata
|
|
128
|
+
*/
|
|
129
|
+
withParentProperty(metadata: PropertyMetadata | null): ValidationContext;
|
|
130
|
+
/**
|
|
131
|
+
* Creates a new validation context with updated resource path
|
|
132
|
+
*/
|
|
133
|
+
withPath(path: string): ValidationContext;
|
|
134
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canon CLI configuration loaded from system and user config files Supports registry overrides, discovery settings, and enterprise deployments
|
|
3
|
+
*/
|
|
4
|
+
export interface CanonConfiguration {
|
|
5
|
+
/**
|
|
6
|
+
* Registry overrides by domain pattern (supports wildcards)
|
|
7
|
+
*/
|
|
8
|
+
registryOverrides: Record<string, RegistryOverride>;
|
|
9
|
+
/**
|
|
10
|
+
* Discovery service settings
|
|
11
|
+
*/
|
|
12
|
+
discovery: DiscoverySettings;
|
|
13
|
+
/**
|
|
14
|
+
* Find registry override for a given domain Supports exact match and wildcard patterns (*.acme.internal)
|
|
15
|
+
*/
|
|
16
|
+
getOverride(domain: string): RegistryOverride | null;
|
|
17
|
+
/**
|
|
18
|
+
* Merge another configuration into this one Used to combine system and user configs (user overrides system)
|
|
19
|
+
*/
|
|
20
|
+
merge(other: CanonConfiguration): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents a single locked package entry
|
|
24
|
+
*/
|
|
25
|
+
export interface CanonLockEntry {
|
|
26
|
+
/**
|
|
27
|
+
* The resolved version (e.g., "1.0.0")
|
|
28
|
+
*/
|
|
29
|
+
version: string;
|
|
30
|
+
/**
|
|
31
|
+
* The full OCI reference where this package was resolved from (e.g., "ghcr.io/canon-protocol-org/core-rdf:1.0.1")
|
|
32
|
+
*/
|
|
33
|
+
resolved: string;
|
|
34
|
+
/**
|
|
35
|
+
* Content integrity hash (SHA256 digest from OCI manifest) Format: "sha256:abc123..."
|
|
36
|
+
*/
|
|
37
|
+
integrity: string;
|
|
38
|
+
/**
|
|
39
|
+
* Direct dependencies of this package (namespace → version) e.g., {"canon-protocol.org/core-rdfs": "1.0.1", "canon-protocol.org/core-owl": "1.0.1"}
|
|
40
|
+
*/
|
|
41
|
+
dependencies?: Record<string, string> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Timestamp when this package was installed
|
|
44
|
+
*/
|
|
45
|
+
installedAt?: unknown | null | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents the canon.lock file that locks package versions for reproducible builds. Similar to package-lock.json (npm) or Cargo.lock (Rust).
|
|
49
|
+
*/
|
|
50
|
+
export interface CanonLockFile {
|
|
51
|
+
/**
|
|
52
|
+
* Lock file format version (currently "1")
|
|
53
|
+
*/
|
|
54
|
+
version: string;
|
|
55
|
+
/**
|
|
56
|
+
* Map of package references to resolved package information Key format: "publisher/package" (e.g., "canon-protocol.org/core-rdf")
|
|
57
|
+
*/
|
|
58
|
+
packages: Record<string, CanonLockEntry>;
|
|
59
|
+
/**
|
|
60
|
+
* Timestamp when this lock file was last updated
|
|
61
|
+
*/
|
|
62
|
+
lastUpdated?: unknown | null | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Represents a Canon package reference that can be resolved from an OCI registry. Supports multiple formats: - Short form: "canon-protocol.org/core-rdf" or "canon-protocol.org/core-rdf@1.0.1" - Full OCI reference: "ghcr.io/canon-protocol-org/core-rdf:1.0.1"
|
|
66
|
+
*/
|
|
67
|
+
export interface CanonPackageReference {
|
|
68
|
+
/**
|
|
69
|
+
* The registry hostname (e.g., "ghcr.io", "docker.io", "harbor.company.internal") If null, the default registry from configuration will be used.
|
|
70
|
+
*/
|
|
71
|
+
registry?: string | null | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The publisher/organization (e.g., "canon-protocol", "stories")
|
|
74
|
+
*/
|
|
75
|
+
publisher: string;
|
|
76
|
+
/**
|
|
77
|
+
* The package name (e.g., "rdf", "trading")
|
|
78
|
+
*/
|
|
79
|
+
package_: string;
|
|
80
|
+
/**
|
|
81
|
+
* The version or tag (e.g., "1.0.0", "latest") If null, will resolve to latest or use version from lock file.
|
|
82
|
+
*/
|
|
83
|
+
version?: string | null | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* The original reference string as provided by the user
|
|
86
|
+
*/
|
|
87
|
+
originalReference: string;
|
|
88
|
+
/**
|
|
89
|
+
* Convert to OCI reference format (registry/publisher/package:version)
|
|
90
|
+
*/
|
|
91
|
+
toOciReference(defaultRegistry?: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Convert to Canon import format (publisher/package@version)
|
|
94
|
+
*/
|
|
95
|
+
toCanonImport(): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get the file path for this package in the .canon/ directory Format: .canon/publisher/package@version.can.yml
|
|
98
|
+
*/
|
|
99
|
+
getLocalFilePath(workspaceRoot: string): string;
|
|
100
|
+
toString(): string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Configuration for Canon registry settings (.canonrc or canon.json). Allows users to customize registry behavior, auth, mirrors, etc.
|
|
104
|
+
*/
|
|
105
|
+
export interface CanonRegistryConfig {
|
|
106
|
+
/**
|
|
107
|
+
* Registry configuration options
|
|
108
|
+
*/
|
|
109
|
+
registries: RegistryConfiguration;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Configuration for a custom/private registry
|
|
113
|
+
*/
|
|
114
|
+
export interface CustomRegistryConfig {
|
|
115
|
+
/**
|
|
116
|
+
* The full URL of the registry (e.g., "https://harbor.company.internal")
|
|
117
|
+
*/
|
|
118
|
+
url?: string | null | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Authentication method: - "docker-config" - use ~/.docker/config.json - "azure-cli" - use Azure CLI for ACR - "aws-cli" - use AWS CLI for ECR - "gcloud-cli" - use Google Cloud CLI for GAR - "github-token" - use GITHUB_TOKEN environment variable - "env" - use environment variables (CANON_USERNAME, CANON_PASSWORD) - "token" - use static token from config
|
|
121
|
+
*/
|
|
122
|
+
auth: string;
|
|
123
|
+
/**
|
|
124
|
+
* Static token (only used if Auth = "token") Not recommended for sensitive credentials - use credential helpers instead
|
|
125
|
+
*/
|
|
126
|
+
token?: string | null | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Whether to use HTTPS (default: true)
|
|
129
|
+
*/
|
|
130
|
+
useHttps: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether to skip TLS verification (insecure, for development only)
|
|
133
|
+
*/
|
|
134
|
+
skipTlsVerify: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Discovery service settings
|
|
138
|
+
*/
|
|
139
|
+
export interface DiscoverySettings {
|
|
140
|
+
/**
|
|
141
|
+
* Enable/disable .well-known discovery globally Set to false for air-gapped environments
|
|
142
|
+
*/
|
|
143
|
+
enabled?: boolean | null | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Timeout for .well-known fetches in seconds
|
|
146
|
+
*/
|
|
147
|
+
timeout?: number | null | undefined;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Configuration for publishing packages
|
|
151
|
+
*/
|
|
152
|
+
export interface PublishingConfiguration {
|
|
153
|
+
/**
|
|
154
|
+
* Default registry to publish to (e.g., "ghcr.io")
|
|
155
|
+
*/
|
|
156
|
+
registry?: string | null | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Default namespace/publisher (e.g., "my-org")
|
|
159
|
+
*/
|
|
160
|
+
namespace_?: string | null | undefined;
|
|
161
|
+
}
|
|
162
|
+
export interface RegistryConfiguration {
|
|
163
|
+
/**
|
|
164
|
+
* Default registry to use for package resolution (e.g., "ghcr.io", "docker.io", "harbor.company.internal")
|
|
165
|
+
*/
|
|
166
|
+
default_: string;
|
|
167
|
+
/**
|
|
168
|
+
* List of mirror registries to try if default fails (e.g., ["ghcr.io", "docker.io"])
|
|
169
|
+
*/
|
|
170
|
+
mirrors: Array<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Custom registry configurations by hostname Allows specifying auth methods and URLs for private registries
|
|
173
|
+
*/
|
|
174
|
+
custom: Record<string, CustomRegistryConfig>;
|
|
175
|
+
/**
|
|
176
|
+
* Publishing configuration (where to publish packages)
|
|
177
|
+
*/
|
|
178
|
+
publishing?: PublishingConfiguration | null | undefined;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Represents registry discovery metadata from .well-known/canon-registry.can.yml Enables domain-based publishers to specify where their packages are hosted
|
|
182
|
+
*/
|
|
183
|
+
export interface RegistryMetadata {
|
|
184
|
+
/**
|
|
185
|
+
* Discovery protocol version (currently "1")
|
|
186
|
+
*/
|
|
187
|
+
version: string;
|
|
188
|
+
/**
|
|
189
|
+
* OCI registry hostname (e.g., "ghcr.io", "harbor.company.com:5000")
|
|
190
|
+
*/
|
|
191
|
+
registry: string;
|
|
192
|
+
/**
|
|
193
|
+
* Namespace/account on the registry (can contain slashes for nested paths, or be empty) Examples: - "username" (GitHub, Docker Hub) - "project/repo" (Google Artifact Registry) - "" (Azure ACR, AWS ECR with account in hostname)
|
|
194
|
+
*/
|
|
195
|
+
namespace_: string;
|
|
196
|
+
/**
|
|
197
|
+
* URI scheme for registry connection (default: "https") Set to "http" for insecure private registries
|
|
198
|
+
*/
|
|
199
|
+
scheme: string;
|
|
200
|
+
/**
|
|
201
|
+
* Cache time-to-live in seconds (default: 3600 = 1 hour)
|
|
202
|
+
*/
|
|
203
|
+
ttl: number;
|
|
204
|
+
/**
|
|
205
|
+
* Optional human-readable description
|
|
206
|
+
*/
|
|
207
|
+
description?: string | null | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Optional contact URL (e.g., contact form, GitHub issues, support page)
|
|
210
|
+
*/
|
|
211
|
+
contactUrl?: string | null | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Timestamp when this metadata was cached
|
|
214
|
+
*/
|
|
215
|
+
cachedAt: unknown;
|
|
216
|
+
/**
|
|
217
|
+
* Construct OCI reference from discovered metadata
|
|
218
|
+
*/
|
|
219
|
+
toOciReference(package_: string, version: string): string;
|
|
220
|
+
/**
|
|
221
|
+
* Check if cached metadata is still valid based on TTL
|
|
222
|
+
*/
|
|
223
|
+
isExpired(): boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Registry override configuration for a domain pattern
|
|
227
|
+
*/
|
|
228
|
+
export interface RegistryOverride {
|
|
229
|
+
/**
|
|
230
|
+
* OCI registry hostname (e.g., "harbor.acme.com")
|
|
231
|
+
*/
|
|
232
|
+
registry: string;
|
|
233
|
+
/**
|
|
234
|
+
* Namespace on the registry (can contain slashes or be empty)
|
|
235
|
+
*/
|
|
236
|
+
namespace_: string;
|
|
237
|
+
/**
|
|
238
|
+
* Skip .well-known discovery and use this override directly If false, tries .well-known first, falls back to this override
|
|
239
|
+
*/
|
|
240
|
+
skipDiscovery: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Optional URI scheme (default: https)
|
|
243
|
+
*/
|
|
244
|
+
scheme: string;
|
|
245
|
+
/**
|
|
246
|
+
* Optional TTL override for cached metadata
|
|
247
|
+
*/
|
|
248
|
+
ttl?: number | null | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Convert to RegistryMetadata for use by discovery service
|
|
251
|
+
*/
|
|
252
|
+
toMetadata(): RegistryMetadata;
|
|
253
|
+
}
|