@kustodian/registry 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +78 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @kustodian/registry
2
+
3
+ Container registry client for fetching image tags from Docker Hub and GitHub Container Registry (GHCR).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @kustodian/registry
9
+ ```
10
+
11
+ ## API
12
+
13
+ ### Client Functions
14
+
15
+ - **`parse_image_reference(image: string)`** - Parse an image string into its components (registry, namespace, repository, tag)
16
+ - **`detect_registry_type(image)`** - Auto-detect registry type from an image reference
17
+ - **`create_registry_client(type, config?)`** - Create a client for a specific registry type
18
+ - **`create_client_for_image(image)`** - Create a client with auto-detected type and authentication
19
+ - **`create_dockerhub_client(config?)`** - Create a Docker Hub client
20
+ - **`create_ghcr_client(config?)`** - Create a GitHub Container Registry client
21
+
22
+ ### Authentication
23
+
24
+ - **`get_dockerhub_auth()`** - Get Docker Hub auth from `DOCKER_USERNAME` and `DOCKER_PASSWORD`
25
+ - **`get_ghcr_auth()`** - Get GHCR auth from `GITHUB_TOKEN` or `GH_TOKEN`
26
+ - **`get_auth_for_registry(registry)`** - Get auth for a registry by hostname
27
+
28
+ ### Version Utilities
29
+
30
+ - **`filter_semver_tags(tags, options?)`** - Filter tags to semver-valid versions
31
+ - **`find_latest_matching(versions, constraint?)`** - Find the latest version matching a constraint
32
+ - **`check_version_update(current, available, constraint?)`** - Check if a newer version is available
33
+ - **`DEFAULT_SEMVER_PATTERN`** - Default regex for semver-like tags
34
+
35
+ ### Types
36
+
37
+ - `ImageReferenceType` - Parsed image reference components
38
+ - `RegistryAuthType` - Authentication configuration
39
+ - `RegistryClientType` - Registry client interface
40
+ - `RegistryClientConfigType` - Client configuration options
41
+ - `TagInfoType` - Tag information from registry
42
+ - `VersionCheckResultType` - Version check result
43
+
44
+ ## Usage
45
+
46
+ ```typescript
47
+ import {
48
+ parse_image_reference,
49
+ create_client_for_image,
50
+ filter_semver_tags,
51
+ check_version_update,
52
+ } from '@kustodian/registry';
53
+
54
+ // Parse image reference
55
+ const image = parse_image_reference('ghcr.io/org/app:v1.0.0');
56
+
57
+ // Create client and fetch tags
58
+ const client = create_client_for_image(image);
59
+ const result = await client.list_tags(image);
60
+
61
+ if (result.success) {
62
+ // Filter to semver tags and check for updates
63
+ const versions = filter_semver_tags(result.value);
64
+ const update = check_version_update('1.0.0', versions);
65
+
66
+ if (update.has_update) {
67
+ console.log(`Update available: ${update.latest_version}`);
68
+ }
69
+ }
70
+ ```
71
+
72
+ ## License
73
+
74
+ MIT
75
+
76
+ ## Links
77
+
78
+ - [Repository](https://github.com/lucasilverentand/kustodian)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kustodian/registry",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Container registry client for fetching image tags from Docker Hub and GHCR",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",