@kanonak-protocol/types 1.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 +33 -0
- package/dist/ctl/models/enums.d.ts +58 -0
- package/dist/ctl/models/enums.js +1 -0
- package/dist/ctl/models/types.d.ts +169 -0
- package/dist/ctl/models/types.js +0 -0
- package/dist/ctl/parsing/enums.d.ts +38 -0
- package/dist/ctl/parsing/enums.js +1 -0
- package/dist/ctl/parsing/types.d.ts +89 -0
- package/dist/ctl/parsing/types.js +0 -0
- package/dist/ctl/rendering/types.d.ts +39 -0
- package/dist/ctl/rendering/types.js +0 -0
- package/dist/ctl/resolution/enums.d.ts +34 -0
- package/dist/ctl/resolution/enums.js +1 -0
- package/dist/ctl/resolution/types.d.ts +156 -0
- package/dist/ctl/resolution/types.js +0 -0
- package/dist/ctl/validation/types.d.ts +10 -0
- package/dist/ctl/validation/types.js +0 -0
- package/dist/document/constants/types.d.ts +5 -0
- package/dist/document/constants/types.js +0 -0
- package/dist/document/filtering/index.d.ts +13 -0
- package/dist/document/filtering/index.js +0 -0
- package/dist/document/filtering/types.d.ts +14 -0
- package/dist/document/filtering/types.js +0 -0
- package/dist/document/models/enums.d.ts +21 -0
- package/dist/document/models/enums.js +1 -0
- package/dist/document/models/index.d.ts +47 -0
- package/dist/document/models/index.js +1 -0
- package/dist/document/models/types.d.ts +194 -0
- package/dist/document/models/types.js +0 -0
- package/dist/document/parsing/index.d.ts +19 -0
- package/dist/document/parsing/index.js +1 -0
- package/dist/document/parsing/types.d.ts +10 -0
- package/dist/document/parsing/types.js +0 -0
- package/dist/document/repositories/enums.d.ts +17 -0
- package/dist/document/repositories/enums.js +1 -0
- package/dist/document/repositories/types.d.ts +103 -0
- package/dist/document/repositories/types.js +0 -0
- package/dist/document/storage/index.d.ts +25 -0
- package/dist/document/storage/index.js +0 -0
- package/dist/document/storage/types.d.ts +5 -0
- package/dist/document/storage/types.js +0 -0
- package/dist/exporters/ctl/markdown/types.d.ts +10 -0
- package/dist/exporters/ctl/markdown/types.js +0 -0
- package/dist/object/kanonaks/types.d.ts +17 -0
- package/dist/object/kanonaks/types.js +0 -0
- package/dist/object/parsing/index.d.ts +21 -0
- package/dist/object/parsing/index.js +1 -0
- package/dist/object/parsing/types.d.ts +43 -0
- package/dist/object/parsing/types.js +0 -0
- package/dist/object/resolution/types.d.ts +116 -0
- package/dist/object/resolution/types.js +0 -0
- package/dist/object/statements/index.d.ts +2 -0
- package/dist/object/statements/index.js +0 -0
- package/dist/object/statements/types.d.ts +20 -0
- package/dist/object/statements/types.js +0 -0
- package/dist/object/uris/types.d.ts +17 -0
- package/dist/object/uris/types.js +0 -0
- package/dist/object/validation/enums.d.ts +13 -0
- package/dist/object/validation/enums.js +1 -0
- package/dist/object/validation/index.d.ts +19 -0
- package/dist/object/validation/index.js +1 -0
- package/dist/object/validation/rules/document/index.d.ts +17 -0
- package/dist/object/validation/rules/document/index.js +1 -0
- package/dist/object/validation/rules/document/types.d.ts +52 -0
- package/dist/object/validation/rules/document/types.js +0 -0
- package/dist/object/validation/rules/repository/index.d.ts +19 -0
- package/dist/object/validation/rules/repository/index.js +1 -0
- package/dist/object/validation/rules/repository/types.d.ts +148 -0
- package/dist/object/validation/rules/repository/types.js +0 -0
- package/dist/object/validation/types.d.ts +134 -0
- package/dist/object/validation/types.js +0 -0
- package/dist/registry/models/types.d.ts +253 -0
- package/dist/registry/models/types.js +0 -0
- package/dist/registry/oauth/types.d.ts +192 -0
- package/dist/registry/oauth/types.js +0 -0
- package/dist/registry/providers/enums.d.ts +8 -0
- package/dist/registry/providers/enums.js +1 -0
- package/dist/registry/providers/git/types.d.ts +43 -0
- package/dist/registry/providers/git/types.js +0 -0
- package/dist/registry/providers/github/models/types.d.ts +35 -0
- package/dist/registry/providers/github/models/types.js +0 -0
- package/dist/registry/providers/github/types.d.ts +30 -0
- package/dist/registry/providers/github/types.js +0 -0
- package/dist/registry/providers/index.d.ts +29 -0
- package/dist/registry/providers/index.js +0 -0
- package/dist/registry/providers/oci/types.d.ts +17 -0
- package/dist/registry/providers/oci/types.js +0 -0
- package/dist/registry/providers/types.d.ts +15 -0
- package/dist/registry/providers/types.js +0 -0
- package/dist/registry/services/index.d.ts +9 -0
- package/dist/registry/services/index.js +0 -0
- package/dist/registry/services/types.d.ts +153 -0
- package/dist/registry/services/types.js +0 -0
- package/package.json +177 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanonak CLI configuration loaded from system and user config files Supports registry overrides, discovery settings, and enterprise deployments
|
|
3
|
+
*/
|
|
4
|
+
export interface KanonakConfiguration {
|
|
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: KanonakConfiguration): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents a single locked package entry
|
|
24
|
+
*/
|
|
25
|
+
export interface KanonakLockEntry {
|
|
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/kanonak-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., {"kanonak.org/core-rdfs": "1.0.1", "kanonak.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 kanonak.lock file that locks package versions for reproducible builds. Similar to package-lock.json (npm) or Cargo.lock (Rust).
|
|
49
|
+
*/
|
|
50
|
+
export interface KanonakLockFile {
|
|
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., "kanonak.org/core-rdf")
|
|
57
|
+
*/
|
|
58
|
+
packages: Record<string, KanonakLockEntry>;
|
|
59
|
+
/**
|
|
60
|
+
* Timestamp when this lock file was last updated
|
|
61
|
+
*/
|
|
62
|
+
lastUpdated?: unknown | null | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Represents a package reference that can be resolved from an OCI registry. Supports multiple formats: - Short form: "kanonak.org/core-rdf" or "kanonak.org/core-rdf@1.0.1" - Full OCI reference: "ghcr.io/kanonak-protocol-org/core-rdf:1.0.1"
|
|
66
|
+
*/
|
|
67
|
+
export interface KanonakPackageReference {
|
|
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., "kanonak-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 Kanonak import format (publisher/package@version)
|
|
94
|
+
*/
|
|
95
|
+
toKanonakImport(): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get the file path for this package in the .kanonak/ directory Format: .kanonak/publisher/package@version.kan.yml
|
|
98
|
+
*/
|
|
99
|
+
getLocalFilePath(workspaceRoot: string): string;
|
|
100
|
+
toString(): string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Configuration for Kanonak registry settings (.kanonakrc or kanonak.json). Allows users to customize registry behavior, auth, mirrors, etc.
|
|
104
|
+
*/
|
|
105
|
+
export interface KanonakRegistryConfig {
|
|
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 (KANONAK_USERNAME, KANONAK_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/kanonak-registry.kan.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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth callback result.
|
|
3
|
+
*/
|
|
4
|
+
export interface CallbackResult {
|
|
5
|
+
code?: string | null | undefined;
|
|
6
|
+
state?: string | null | undefined;
|
|
7
|
+
error?: string | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Dynamic client registration response (RFC 7591).
|
|
11
|
+
*/
|
|
12
|
+
export interface ClientRegistration {
|
|
13
|
+
clientId?: string | null | undefined;
|
|
14
|
+
clientSecret?: string | null | undefined;
|
|
15
|
+
clientIdIssuedAt?: number | null | undefined;
|
|
16
|
+
clientSecretExpiresAt?: number | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Local HTTP server for OAuth callback.
|
|
20
|
+
*/
|
|
21
|
+
export interface LocalCallbackServer {
|
|
22
|
+
startAsync(ct: AbortSignal): Promise<[string, number]>;
|
|
23
|
+
waitForCallbackAsync(ct: AbortSignal): Promise<CallbackResult | null>;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stores OAuth credentials per domain in ~/.kanonak/credentials.json. Vendor-agnostic - works with any OAuth-enabled Git registry.
|
|
28
|
+
*/
|
|
29
|
+
export interface OAuthCredentialStore {
|
|
30
|
+
/**
|
|
31
|
+
* Get stored credentials for a host.
|
|
32
|
+
*/
|
|
33
|
+
getAsync(host: string, ct?: AbortSignal): Promise<StoredCredential | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Store credentials for a host.
|
|
36
|
+
*/
|
|
37
|
+
storeAsync(host: string, credential: StoredCredential, ct?: AbortSignal): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove credentials for a host.
|
|
40
|
+
*/
|
|
41
|
+
removeAsync(host: string, ct?: AbortSignal): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* List all hosts with stored credentials.
|
|
44
|
+
*/
|
|
45
|
+
listHostsAsync(ct?: AbortSignal): Promise<readonly string[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if credentials exist and are valid for a host.
|
|
48
|
+
*/
|
|
49
|
+
hasValidCredentialAsync(host: string, ct?: AbortSignal): Promise<boolean>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Discovers OAuth server metadata using RFC 8414. Vendor-agnostic - works with any OAuth 2.0 compliant server.
|
|
53
|
+
*/
|
|
54
|
+
export interface OAuthDiscoveryService {
|
|
55
|
+
/**
|
|
56
|
+
* Discover OAuth server metadata for a host. Tries RFC 8414 .well-known/oauth-authorization-server first.
|
|
57
|
+
*/
|
|
58
|
+
discoverAsync(host: string, ct?: AbortSignal): Promise<OAuthServerMetadata | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Check if a host supports OAuth discovery.
|
|
61
|
+
*/
|
|
62
|
+
supportsOAuthAsync(host: string, ct?: AbortSignal): Promise<boolean>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* OAuth 2.0 Authorization Code Flow with PKCE. Supports dynamic client registration (RFC 7591). Vendor-agnostic - works with any OAuth 2.0 compliant server.
|
|
66
|
+
*/
|
|
67
|
+
export interface OAuthFlowService {
|
|
68
|
+
/**
|
|
69
|
+
* Perform the full OAuth authorization flow for a host. 1. Discover OAuth endpoints 2. Register client dynamically (if supported) 3. Open browser for authorization 4. Receive callback with authorization code 5. Exchange code for tokens 6. Store credentials
|
|
70
|
+
*/
|
|
71
|
+
authorizeAsync(host: string, scopes: Array<string>, ct?: AbortSignal): Promise<OAuthResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Refresh an expired access token.
|
|
74
|
+
*/
|
|
75
|
+
refreshTokenAsync(host: string, ct?: AbortSignal): Promise<OAuthResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Revoke tokens and remove credentials for a host.
|
|
78
|
+
*/
|
|
79
|
+
logoutAsync(host: string, ct?: AbortSignal): Promise<OAuthResult>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Result of an OAuth operation.
|
|
83
|
+
*/
|
|
84
|
+
export interface OAuthResult {
|
|
85
|
+
isSuccess: boolean;
|
|
86
|
+
host?: string | null | undefined;
|
|
87
|
+
errorMessage?: string | null | undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* OAuth 2.0 Authorization Server Metadata (RFC 8414).
|
|
91
|
+
*/
|
|
92
|
+
export interface OAuthServerMetadata {
|
|
93
|
+
/**
|
|
94
|
+
* Authorization server's issuer identifier.
|
|
95
|
+
*/
|
|
96
|
+
issuer?: string | null | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* URL of the authorization endpoint.
|
|
99
|
+
*/
|
|
100
|
+
authorizationEndpoint?: string | null | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* URL of the token endpoint.
|
|
103
|
+
*/
|
|
104
|
+
tokenEndpoint?: string | null | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* URL of the dynamic client registration endpoint (RFC 7591).
|
|
107
|
+
*/
|
|
108
|
+
registrationEndpoint?: string | null | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* URL of the token revocation endpoint (RFC 7009).
|
|
111
|
+
*/
|
|
112
|
+
revocationEndpoint?: string | null | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* JSON array of supported scopes.
|
|
115
|
+
*/
|
|
116
|
+
scopesSupported?: Array<string> | null | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* JSON array of supported response types.
|
|
119
|
+
*/
|
|
120
|
+
responseTypesSupported?: Array<string> | null | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* JSON array of supported grant types.
|
|
123
|
+
*/
|
|
124
|
+
grantTypesSupported?: Array<string> | null | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* JSON array of supported PKCE code challenge methods.
|
|
127
|
+
*/
|
|
128
|
+
codeChallengeMethodsSupported?: Array<string> | null | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* JSON array of supported token endpoint auth methods.
|
|
131
|
+
*/
|
|
132
|
+
tokenEndpointAuthMethodsSupported?: Array<string> | null | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Check if PKCE with S256 is supported.
|
|
135
|
+
*/
|
|
136
|
+
readonly supportsPkceS256: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Check if dynamic client registration is supported.
|
|
139
|
+
*/
|
|
140
|
+
readonly supportsDynamicRegistration: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Check if authorization code flow is supported.
|
|
143
|
+
*/
|
|
144
|
+
readonly supportsAuthorizationCode: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* OAuth credential stored per host.
|
|
148
|
+
*/
|
|
149
|
+
export interface StoredCredential {
|
|
150
|
+
/**
|
|
151
|
+
* OAuth client ID (from dynamic registration or pre-configured).
|
|
152
|
+
*/
|
|
153
|
+
clientId?: string | null | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* OAuth client secret (optional, for confidential clients).
|
|
156
|
+
*/
|
|
157
|
+
clientSecret?: string | null | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* OAuth access token for API calls.
|
|
160
|
+
*/
|
|
161
|
+
accessToken?: string | null | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* OAuth refresh token for obtaining new access tokens.
|
|
164
|
+
*/
|
|
165
|
+
refreshToken?: string | null | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* When the access token expires.
|
|
168
|
+
*/
|
|
169
|
+
expiresAt?: unknown | null | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* OAuth server metadata (cached for refresh).
|
|
172
|
+
*/
|
|
173
|
+
tokenEndpoint?: string | null | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Check if the access token is expired (with 5 minute buffer).
|
|
176
|
+
*/
|
|
177
|
+
readonly isExpired: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Check if the credential has a valid access token.
|
|
180
|
+
*/
|
|
181
|
+
readonly hasValidToken: boolean;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* OAuth token response.
|
|
185
|
+
*/
|
|
186
|
+
export interface TokenResponse {
|
|
187
|
+
accessToken?: string | null | undefined;
|
|
188
|
+
tokenType?: string | null | undefined;
|
|
189
|
+
expiresIn?: number | null | undefined;
|
|
190
|
+
refreshToken?: string | null | undefined;
|
|
191
|
+
scope?: string | null | undefined;
|
|
192
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=(l=>(l[l.Install=0]="Install",l[l.Publish=1]="Publish",l[l.Delete=2]="Delete",l))(u||{});export{u as RegistryOperation};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IRegistryProvider } from '../../../registry/providers/index';
|
|
2
|
+
import { IKanonakRegistryService } from '../../../registry/services/index';
|
|
3
|
+
/**
|
|
4
|
+
* Git credential (username + password/token).
|
|
5
|
+
*/
|
|
6
|
+
export interface GitCredential {
|
|
7
|
+
readonly username: string;
|
|
8
|
+
readonly password: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic credential provider for Git registries. Supports OAuth tokens, environment variables, and git credential helpers. Vendor-agnostic - no hardcoded registry names.
|
|
12
|
+
*/
|
|
13
|
+
export interface GitCredentialProvider {
|
|
14
|
+
/**
|
|
15
|
+
* Get credentials for a Git host. Tries multiple sources in order: OAuth store, environment, git credential helper.
|
|
16
|
+
*/
|
|
17
|
+
getCredentialAsync(gitHost: string, ct?: AbortSignal): Promise<GitCredential | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if credentials exist for a host.
|
|
20
|
+
*/
|
|
21
|
+
hasCredentialAsync(gitHost: string, ct?: AbortSignal): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export interface GitPackageReference {
|
|
24
|
+
registry: string;
|
|
25
|
+
publisher: string;
|
|
26
|
+
package_: string;
|
|
27
|
+
version?: string | null | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Git-based registry provider. Uses Git Smart HTTP protocol to clone/fetch Kanonak packages. Vendor-agnostic - works with any Git registry supporting Smart HTTP.
|
|
31
|
+
*/
|
|
32
|
+
export interface GitRegistryProvider extends IRegistryProvider {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Set the registry service for transitive dependency installation.
|
|
36
|
+
*/
|
|
37
|
+
setRegistryService(registryService: IKanonakRegistryService): void;
|
|
38
|
+
supportsRegistry(registryUrl: string): boolean;
|
|
39
|
+
installPackageAsync(packageRef: string, publisherDomain: string, workspaceRoot: string): Promise<string>;
|
|
40
|
+
publishPackageAsync(filePath: string, registry: string, publisher?: string | null): Promise<void>;
|
|
41
|
+
deletePackageVersionAsync(publisher: string, package_: string, version: string, registry: string): Promise<void>;
|
|
42
|
+
deleteEntirePackageAsync(publisher: string, package_: string, registry: string): Promise<void>;
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container metadata including tags
|
|
3
|
+
*/
|
|
4
|
+
export interface GitHubContainerMetadata {
|
|
5
|
+
/**
|
|
6
|
+
* List of tags associated with this version
|
|
7
|
+
*/
|
|
8
|
+
tags?: Array<string> | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Metadata for a GitHub package version
|
|
12
|
+
*/
|
|
13
|
+
export interface GitHubPackageMetadata {
|
|
14
|
+
/**
|
|
15
|
+
* Container-specific metadata
|
|
16
|
+
*/
|
|
17
|
+
container?: GitHubContainerMetadata | null | undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents a package version in GitHub Container Registry
|
|
21
|
+
*/
|
|
22
|
+
export interface GitHubPackageVersion {
|
|
23
|
+
/**
|
|
24
|
+
* Numeric ID used for deletion operations
|
|
25
|
+
*/
|
|
26
|
+
id: number;
|
|
27
|
+
/**
|
|
28
|
+
* Version name (usually the digest)
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* Package metadata including tags
|
|
33
|
+
*/
|
|
34
|
+
metadata?: GitHubPackageMetadata | null | undefined;
|
|
35
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GitHubPackageVersion } from '../../../registry/providers/github/models/types';
|
|
2
|
+
import { IRegistryProvider } from '../../../registry/providers/index';
|
|
3
|
+
/**
|
|
4
|
+
* HTTP client for GitHub Container Registry API operations
|
|
5
|
+
*/
|
|
6
|
+
export interface GitHubApiClient {
|
|
7
|
+
/**
|
|
8
|
+
* Get all versions of a package
|
|
9
|
+
*/
|
|
10
|
+
getPackageVersionsAsync(owner: string, packageName: string): Promise<Array<GitHubPackageVersion>>;
|
|
11
|
+
/**
|
|
12
|
+
* Delete a specific package version by ID
|
|
13
|
+
*/
|
|
14
|
+
deletePackageVersionAsync(owner: string, packageName: string, versionId: number): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete an entire package (all versions)
|
|
17
|
+
*/
|
|
18
|
+
deleteEntirePackageAsync(owner: string, packageName: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* GitHub Container Registry (ghcr.io) provider using GitHub REST API for operations not supported by OCI spec (like deletions)
|
|
22
|
+
*/
|
|
23
|
+
export interface GitHubRegistryProvider extends IRegistryProvider {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
supportsRegistry(registryUrl: string): boolean;
|
|
26
|
+
installPackageAsync(packageRef: string, publisherDomain: string, workspaceRoot: string): Promise<string>;
|
|
27
|
+
publishPackageAsync(filePath: string, registry: string, publisher?: string | null): Promise<void>;
|
|
28
|
+
deletePackageVersionAsync(publisher: string, package_: string, version: string, registry: string): Promise<void>;
|
|
29
|
+
deleteEntirePackageAsync(publisher: string, package_: string, registry: string): Promise<void>;
|
|
30
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for registry-specific operations. Implementations handle provider-specific logic (GitHub, Azure, Docker Hub, etc.)
|
|
3
|
+
*/
|
|
4
|
+
export interface IRegistryProvider {
|
|
5
|
+
/**
|
|
6
|
+
* Provider name for logging/debugging
|
|
7
|
+
*/
|
|
8
|
+
readonly name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Check if this provider supports the given registry URL
|
|
11
|
+
*/
|
|
12
|
+
supportsRegistry(registryUrl: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Install package from registry
|
|
15
|
+
*/
|
|
16
|
+
installPackageAsync(packageRef: string, publisherDomain: string, workspaceRoot: string): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Publish package to registry
|
|
19
|
+
*/
|
|
20
|
+
publishPackageAsync(filePath: string, registry: string, publisher?: string | null): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Delete a specific version of a package from registry
|
|
23
|
+
*/
|
|
24
|
+
deletePackageVersionAsync(publisher: string, package_: string, version: string, registry: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete entire package (all versions) from registry
|
|
27
|
+
*/
|
|
28
|
+
deleteEntirePackageAsync(publisher: string, package_: string, registry: string): Promise<void>;
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IRegistryProvider } from '../../../registry/providers/index';
|
|
2
|
+
import { IKanonakRegistryService } from '../../../registry/services/index';
|
|
3
|
+
/**
|
|
4
|
+
* OCI registry provider using ORAS library. Works with any OCI-compliant registry (Docker Hub, Azure ACR, Harbor, etc.)
|
|
5
|
+
*/
|
|
6
|
+
export interface OciRegistryProvider extends IRegistryProvider {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Set the registry service for transitive dependency installation. This is a setter injection to avoid circular dependency during construction.
|
|
10
|
+
*/
|
|
11
|
+
setRegistryService(registryService: IKanonakRegistryService): void;
|
|
12
|
+
supportsRegistry(registryUrl: string): boolean;
|
|
13
|
+
installPackageAsync(packageRef: string, publisherDomain: string, workspaceRoot: string): Promise<string>;
|
|
14
|
+
publishPackageAsync(filePath: string, registry: string, publisher?: string | null): Promise<void>;
|
|
15
|
+
deletePackageVersionAsync(publisher: string, package_: string, version: string, registry: string): Promise<void>;
|
|
16
|
+
deleteEntirePackageAsync(publisher: string, package_: string, registry: string): Promise<void>;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RegistryOperation } from '../../registry/providers/enums';
|
|
2
|
+
import { IRegistryProvider } from '../../registry/providers/index';
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating the appropriate registry provider based on registry URL. Uses strategy pattern to select provider-specific implementations.
|
|
5
|
+
*/
|
|
6
|
+
export interface RegistryProviderFactory {
|
|
7
|
+
/**
|
|
8
|
+
* Get the appropriate provider for the given registry URL. Returns the first provider that supports the registry, or falls back to OCI provider for all other registries.
|
|
9
|
+
*/
|
|
10
|
+
getProvider(registryUrl: string): IRegistryProvider;
|
|
11
|
+
/**
|
|
12
|
+
* Get a provider for a specific operation type. Some providers only support certain operations (e.g., GitHub only supports delete).
|
|
13
|
+
*/
|
|
14
|
+
getProviderForOperation(registryUrl: string, operation: RegistryOperation): IRegistryProvider;
|
|
15
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for package registry operations. Enables dependency injection and prevents circular dependencies.
|
|
3
|
+
*/
|
|
4
|
+
export interface IKanonakRegistryService {
|
|
5
|
+
/**
|
|
6
|
+
* Install a package from a registry. Downloads the package to .kanonak/ directory and updates kanonak.lock. Uses domain-based discovery for all publishers (all publishers are domains).
|
|
7
|
+
*/
|
|
8
|
+
installPackageAsync(packageRef: string, workspaceRoot: string): Promise<string>;
|
|
9
|
+
}
|
|
File without changes
|