@wtf/release-oci 3.0.0 → 4.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.
- package/README.md +6 -6
- package/dist/ecosystem.d.ts +3 -9
- package/dist/ecosystem.d.ts.map +1 -1
- package/dist/ecosystem.js +5 -19
- package/dist/ecosystem.js.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -2
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/pages.d.ts +57 -0
- package/dist/pages.d.ts.map +1 -0
- package/dist/pages.js +61 -0
- package/dist/pages.js.map +1 -0
- package/package.json +9 -9
- package/dist/registry.d.ts +0 -71
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -86
- package/dist/registry.js.map +0 -1
package/README.md
CHANGED
|
@@ -52,7 +52,6 @@ of `@wtf/release/driver`, runs the steps of the ecosystem over the images of the
|
|
|
52
52
|
| `source` | The tested image of each: its `repository`, `{image}` the image's own, and its `tag` |
|
|
53
53
|
| `platforms` | The platforms each tested image must be of, as `linux/amd64`: any by default |
|
|
54
54
|
| `crane` | The command of crane: `crane` by default |
|
|
55
|
-
| `registry` | The container registry of GitLab, its `project` and `headers`: the page of each image there |
|
|
56
55
|
|
|
57
56
|
Each step:
|
|
58
57
|
|
|
@@ -63,15 +62,17 @@ Each step:
|
|
|
63
62
|
names, fails (`EOCISMOKE`).
|
|
64
63
|
- `publish` smokes each image, then copies the digest of its tested image to the tag of the version,
|
|
65
64
|
`crane copy <source>@<digest> <image>:<version>`, which mounts each blob of the source's repository
|
|
66
|
-
rather than moving it. It gives each image,
|
|
67
|
-
|
|
65
|
+
rather than moving it. It gives each image, a `Released` of `@wtf/release/forge`: of its page on
|
|
66
|
+
Docker Hub or Quay, which its URL alone names; else of its registry, of the type `container`,
|
|
67
|
+
whose page the forge of the release knows, as the container registry of GitLab or `ghcr.io` of
|
|
68
|
+
GitHub (`./pages`). An image is linked where it lives, never uploaded.
|
|
68
69
|
- `move` points each tag of `moving` at the digest the registry has of the version,
|
|
69
70
|
`crane copy <image>@<digest> <image>:<tag>`. A version the registry has not fails (`EOCIMOVE`).
|
|
70
71
|
|
|
71
72
|
The tag of the version is copied once: a registry that has it at the same digest is skipped, so a
|
|
72
73
|
release that stopped part way is finished by running it again, and at another digest is refused
|
|
73
74
|
(`EOCIRETAG`), as a released version never moves. The tags that move are copied every time. A dry
|
|
74
|
-
run, `release.dryRun`, asks the registry, and copies nothing
|
|
75
|
+
run, `release.dryRun`, asks the registry, and copies nothing. The ecosystem
|
|
75
76
|
writes nothing into git, so it has no `prepare`.
|
|
76
77
|
|
|
77
78
|
```ts
|
|
@@ -141,7 +142,7 @@ build as an argument of its own.
|
|
|
141
142
|
| `./images` | `readImages`, `imagesAt`, `imagesOf`, `imageDirOf`, `repositoryOf` |
|
|
142
143
|
| `./tags` | `checkReleaseTags`, `isImageTag` |
|
|
143
144
|
| `./publish` | `smokeImages`, `publishImages`, `moveImages`, `digestOf`, `platformsOf` |
|
|
144
|
-
| `./
|
|
145
|
+
| `./pages` | `releasedImage`, `imagePageOf`, `repositoryParts` |
|
|
145
146
|
| `./errors` | `OciError`, `OCI_ERRORS` |
|
|
146
147
|
|
|
147
148
|
## Errors
|
|
@@ -156,4 +157,3 @@ build as an argument of its own.
|
|
|
156
157
|
| `EOCIRETAG` | The registry has the version already, at another digest |
|
|
157
158
|
| `EOCITAG` | crane cannot copy the tested image to a tag |
|
|
158
159
|
| `EOCIMOVE` | The registry has not the version, which the tags that move would point at |
|
|
159
|
-
| `EOCILINK` | GitLab cannot give the page of an image in its container registry |
|
package/dist/ecosystem.d.ts
CHANGED
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
import type { ReleasingEcosystem } from '@wtf/release/contract';
|
|
37
37
|
import type { EcosystemContext, Package } from '@wtf/release/ecosystem';
|
|
38
38
|
import type { OciImage } from './index.ts';
|
|
39
|
-
import { type ContainerRegistry } from './registry.ts';
|
|
40
39
|
/** An image as a release reads it: a package of the ecosystem, and the image it is of. */
|
|
41
40
|
export interface OciPackage extends Package {
|
|
42
41
|
/** The image, as `readImages` of `./images` gives it. */
|
|
@@ -103,11 +102,6 @@ export interface OciOptions {
|
|
|
103
102
|
readonly platforms?: readonly string[] | undefined;
|
|
104
103
|
/** The command of crane, by its name on the path or its path: `crane` by default. */
|
|
105
104
|
readonly crane?: string | undefined;
|
|
106
|
-
/**
|
|
107
|
-
* The container registry of GitLab that `publish` asks the page of each image of: none by
|
|
108
|
-
* default, of an image of no page, which the forge of the release is asked of.
|
|
109
|
-
*/
|
|
110
|
-
readonly registry?: ContainerRegistry | undefined;
|
|
111
105
|
}
|
|
112
106
|
/**
|
|
113
107
|
* The repository of each image of `packages`. Throws `EOCIIMAGE`, together, of each image of none.
|
|
@@ -128,9 +122,9 @@ export declare function repositoriesOf(packages: readonly OciPackage[]): string[
|
|
|
128
122
|
* (`EOCISMOKE`), as `smokeImages` of `./publish` does;
|
|
129
123
|
* - `publish` copies the tested image of each image, by its digest, to the tag of the version,
|
|
130
124
|
* skipped of a registry that has it at the same digest and refused at another (`EOCIRETAG`), as
|
|
131
|
-
* `publishImages` of `./publish` does;
|
|
132
|
-
*
|
|
133
|
-
*
|
|
125
|
+
* `publishImages` of `./publish` does; and gives each image, by its repository, of its page on
|
|
126
|
+
* Docker Hub or Quay, else of its registry, whose forge the links of the release ask its page
|
|
127
|
+
* (`releasedImage` of `./pages`); a dry run asks the registry, and copies nothing;
|
|
134
128
|
* - `move` points the tags of `moving` of each image at the digest the registry has of the version,
|
|
135
129
|
* as `moveImages` of `./publish` does (`EOCIMOVE`), and gives each image it moved; a dry run asks
|
|
136
130
|
* the registry, and copies nothing.
|
package/dist/ecosystem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem.d.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AA;CACrB;AAED,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAA;IAC9C,oFAAoF;IACpF,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IAClD,qFAAqF;IACrF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,EAAE,CAexE;AA8CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CA6C9F,CAAA"}
|
package/dist/ecosystem.js
CHANGED
|
@@ -2,7 +2,7 @@ import { throwAll } from '@wtf/release/errors';
|
|
|
2
2
|
import { OciError } from "./errors.js";
|
|
3
3
|
import { imagesAt, readImages } from "./images.js";
|
|
4
4
|
import { moveImages, publishImages, smokeImages } from "./publish.js";
|
|
5
|
-
import {
|
|
5
|
+
import { releasedImage } from "./pages.js";
|
|
6
6
|
import { checkReleaseTags } from "./tags.js";
|
|
7
7
|
/**
|
|
8
8
|
* The images of the repo as a release reads them: each a package named by its repository, or by its
|
|
@@ -119,9 +119,9 @@ const craneOf = (release, options) => ({
|
|
|
119
119
|
* (`EOCISMOKE`), as `smokeImages` of `./publish` does;
|
|
120
120
|
* - `publish` copies the tested image of each image, by its digest, to the tag of the version,
|
|
121
121
|
* skipped of a registry that has it at the same digest and refused at another (`EOCIRETAG`), as
|
|
122
|
-
* `publishImages` of `./publish` does;
|
|
123
|
-
*
|
|
124
|
-
*
|
|
122
|
+
* `publishImages` of `./publish` does; and gives each image, by its repository, of its page on
|
|
123
|
+
* Docker Hub or Quay, else of its registry, whose forge the links of the release ask its page
|
|
124
|
+
* (`releasedImage` of `./pages`); a dry run asks the registry, and copies nothing;
|
|
125
125
|
* - `move` points the tags of `moving` of each image at the digest the registry has of the version,
|
|
126
126
|
* as `moveImages` of `./publish` does (`EOCIMOVE`), and gives each image it moved; a dry run asks
|
|
127
127
|
* the registry, and copies nothing.
|
|
@@ -149,21 +149,7 @@ export const ociEcosystem = {
|
|
|
149
149
|
dryRun: release.dryRun,
|
|
150
150
|
log: release.log
|
|
151
151
|
});
|
|
152
|
-
|
|
153
|
-
const pages = registry === undefined || release.dryRun
|
|
154
|
-
? []
|
|
155
|
-
: await Promise.all(published.map(({ repository }) => registryPageOf({
|
|
156
|
-
fetch: release.platform.fetch,
|
|
157
|
-
project: registry.project,
|
|
158
|
-
repository,
|
|
159
|
-
headers: registry.headers
|
|
160
|
-
})));
|
|
161
|
-
return published.map(({ repository, version }, index) => {
|
|
162
|
-
const page = pages[index];
|
|
163
|
-
return page === undefined
|
|
164
|
-
? { ecosystem: 'oci', name: repository, version }
|
|
165
|
-
: { ecosystem: 'oci', name: repository, version, page };
|
|
166
|
-
});
|
|
152
|
+
return published.map(({ repository, version }) => releasedImage(repository, version));
|
|
167
153
|
},
|
|
168
154
|
async move(release, plan, options) {
|
|
169
155
|
const moved = await moveImages({
|
package/dist/ecosystem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem.js","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ecosystem.js","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,QAA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EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;QACF,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;IACvF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO;QAC/B,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;YAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;YAClC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;YACtC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;QACF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;YACpC,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC,CAAA;IACL,CAAC;CACF,CAAA"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export declare const OCI_ERRORS: {
|
|
|
18
18
|
readonly EOCIRETAG: "The registry has the full version of a release already, at another digest: a released version is never moved.";
|
|
19
19
|
readonly EOCITAG: "crane cannot copy the tested image to a tag of the release.";
|
|
20
20
|
readonly EOCIMOVE: "The registry has not the version of a release, so the tags that move with it have nothing to point at.";
|
|
21
|
-
readonly EOCILINK: "The container registry of GitLab cannot be asked the page of an image, or lists none.";
|
|
22
21
|
};
|
|
23
22
|
/** A code of {@link OCI_ERRORS}. */
|
|
24
23
|
export type OciErrorCode = keyof typeof OCI_ERRORS;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0EAA0E;AAC1E,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0EAA0E;AAC1E,eAAO,MAAM,UAAU;;;;;;;;;CAgBb,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAA;AAElD;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,YAAY;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -17,8 +17,7 @@ export const OCI_ERRORS = {
|
|
|
17
17
|
EOCISMOKE: 'The registry has not the tested image of a release, or crane cannot ask it: there is nothing to copy to the tags of the release.',
|
|
18
18
|
EOCIRETAG: 'The registry has the full version of a release already, at another digest: a released version is never moved.',
|
|
19
19
|
EOCITAG: 'crane cannot copy the tested image to a tag of the release.',
|
|
20
|
-
EOCIMOVE: 'The registry has not the version of a release, so the tags that move with it have nothing to point at.'
|
|
21
|
-
EOCILINK: 'The container registry of GitLab cannot be asked the page of an image, or lists none.'
|
|
20
|
+
EOCIMOVE: 'The registry has not the version of a release, so the tags that move with it have nothing to point at.'
|
|
22
21
|
};
|
|
23
22
|
/**
|
|
24
23
|
* An error of the OCI images, or of the options of the plugin over them: a stable `code`, of
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa,EACX,yIAAyI;IAC3I,SAAS,EACP,8HAA8H;IAChI,UAAU,EACR,4LAA4L;IAC9L,WAAW,EACT,wGAAwG;IAC1G,SAAS,EACP,kIAAkI;IACpI,SAAS,EACP,+GAA+G;IACjH,OAAO,EAAE,6DAA6D;IACtE,QAAQ,EACN,wGAAwG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa,EACX,yIAAyI;IAC3I,SAAS,EACP,8HAA8H;IAChI,UAAU,EACR,4LAA4L;IAC9L,WAAW,EACT,wGAAwG;IAC1G,SAAS,EACP,kIAAkI;IACpI,SAAS,EACP,+GAA+G;IACjH,OAAO,EAAE,6DAA6D;IACtE,QAAQ,EACN,wGAAwG;CAClG,CAAA;AAKV;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* do with: the images of the repo, each folder of a Dockerfile, a Containerfile or a
|
|
7
7
|
* `.devcontainer/devcontainer.json` (`./images`), the tags of a release checked (`./tags`), the
|
|
8
8
|
* tested image of each copied to the tag of its version, and the tags that move pointed at it, by
|
|
9
|
-
* crane (`./publish`), and the
|
|
9
|
+
* crane (`./publish`), and each as the links of its release name it, of its page on Docker Hub or
|
|
10
|
+
* Quay, else of the registry whose forge knows its page (`./pages`). An
|
|
10
11
|
* image is built and tested by its own pipeline; a release copies the image it tested, by its
|
|
11
12
|
* digest, to the tags of its version, so the bytes released are the bytes tested. Each function
|
|
12
13
|
* takes the platform it runs by, of the folder of the repo as its working folder, and runs `git`
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,gFAAgF;IAChF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CACxC;AAED,iFAAiF;AACjF,eAAe,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* do with: the images of the repo, each folder of a Dockerfile, a Containerfile or a
|
|
7
7
|
* `.devcontainer/devcontainer.json` (`./images`), the tags of a release checked (`./tags`), the
|
|
8
8
|
* tested image of each copied to the tag of its version, and the tags that move pointed at it, by
|
|
9
|
-
* crane (`./publish`), and the
|
|
9
|
+
* crane (`./publish`), and each as the links of its release name it, of its page on Docker Hub or
|
|
10
|
+
* Quay, else of the registry whose forge knows its page (`./pages`). An
|
|
10
11
|
* image is built and tested by its own pipeline; a release copies the image it tested, by its
|
|
11
12
|
* digest, to the tags of its version, so the bytes released are the bytes tested. Each function
|
|
12
13
|
* takes the platform it runs by, of the folder of the repo as its working folder, and runs `git`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmB7C,iFAAiF;AACjF,eAAe,YAAY,CAAA"}
|
package/dist/pages.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a release of an image says of it, for the links of its release ({@link releasedImage}): the
|
|
3
|
+
* page of an image of a public registry its URL alone names, Docker Hub's or Quay's
|
|
4
|
+
* ({@link imagePageOf}); and else the registry it was published to, as a `PackageRegistry` of
|
|
5
|
+
* `@wtf/release/forge` of the type `container`, whose page the forge of the release knows, as the
|
|
6
|
+
* container registry of GitLab or `ghcr.io` of GitHub. An image is linked where it lives, never
|
|
7
|
+
* uploaded.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { releasedImage } from '@wtf/release-oci/pages'
|
|
11
|
+
*
|
|
12
|
+
* console.log(releasedImage('docker.io/acme/base', '1.4.2').page)
|
|
13
|
+
* // https://hub.docker.com/r/acme/base/tags?name=1.4.2
|
|
14
|
+
* console.log(releasedImage('registry.gitlab.com/acme/images/base', '1.4.2').registry)
|
|
15
|
+
* // { url: 'https://registry.gitlab.com', type: 'container', name: 'acme/images/base' }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
* @module @wtf/release-oci/pages
|
|
20
|
+
*/
|
|
21
|
+
import type { Released } from '@wtf/release/forge';
|
|
22
|
+
/**
|
|
23
|
+
* The host and the path of a repository, as `registry.gitlab.com` and `acme/images/base`: the host
|
|
24
|
+
* is its first part where that is a host, of a dot or a port, or `localhost`; else Docker Hub's,
|
|
25
|
+
* `docker.io`, and an image of one part is of its official images, `library`.
|
|
26
|
+
*
|
|
27
|
+
* @param repository - The repository, as `registry.gitlab.com/acme/images/base` or `acme/base`.
|
|
28
|
+
* @returns Its host and its path.
|
|
29
|
+
*/
|
|
30
|
+
export declare function repositoryParts(repository: string): {
|
|
31
|
+
host: string;
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The page of an image at a version on a public registry its URL alone names: Docker Hub's, its
|
|
36
|
+
* tags of the name of the version, as `https://hub.docker.com/r/acme/base/tags?name=1.4.2`, or of
|
|
37
|
+
* an official image `https://hub.docker.com/_/debian/tags?name=12`; Quay's, as
|
|
38
|
+
* `https://quay.io/repository/acme/base?tab=tags&tag=1.4.2`. None of any other registry, whose page
|
|
39
|
+
* its forge knows.
|
|
40
|
+
*
|
|
41
|
+
* @param repository - The repository of the image.
|
|
42
|
+
* @param version - The tag of its version.
|
|
43
|
+
* @returns The URL of the page, or `undefined`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function imagePageOf(repository: string, version: string): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* An image a release published, as the links of the release name it: by its repository, of its
|
|
48
|
+
* page where its registry is a public one its URL names ({@link imagePageOf}), else of the
|
|
49
|
+
* registry it was published to, of the type `container`, its URL of its host and its name its path,
|
|
50
|
+
* whose page the forge of the release is asked.
|
|
51
|
+
*
|
|
52
|
+
* @param repository - The repository of the image, as `registry.gitlab.com/acme/images/base`.
|
|
53
|
+
* @param version - The tag of its version.
|
|
54
|
+
* @returns The image released.
|
|
55
|
+
*/
|
|
56
|
+
export declare function releasedImage(repository: string, version: string): Released;
|
|
57
|
+
//# sourceMappingURL=pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAKlD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASnF;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAU3E"}
|
package/dist/pages.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** The hosts of Docker Hub, as a repository names it: none names it too. */
|
|
2
|
+
const DOCKER_HUB = new Set(['docker.io', 'index.docker.io', 'registry-1.docker.io']);
|
|
3
|
+
/**
|
|
4
|
+
* The host and the path of a repository, as `registry.gitlab.com` and `acme/images/base`: the host
|
|
5
|
+
* is its first part where that is a host, of a dot or a port, or `localhost`; else Docker Hub's,
|
|
6
|
+
* `docker.io`, and an image of one part is of its official images, `library`.
|
|
7
|
+
*
|
|
8
|
+
* @param repository - The repository, as `registry.gitlab.com/acme/images/base` or `acme/base`.
|
|
9
|
+
* @returns Its host and its path.
|
|
10
|
+
*/
|
|
11
|
+
export function repositoryParts(repository) {
|
|
12
|
+
const [first = '', ...rest] = repository.split('/');
|
|
13
|
+
if (rest.length > 0 && (/[.:]/.test(first) || first === 'localhost'))
|
|
14
|
+
return { host: first, path: rest.join('/') };
|
|
15
|
+
return { host: 'docker.io', path: rest.length === 0 ? `library/${first}` : repository };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The page of an image at a version on a public registry its URL alone names: Docker Hub's, its
|
|
19
|
+
* tags of the name of the version, as `https://hub.docker.com/r/acme/base/tags?name=1.4.2`, or of
|
|
20
|
+
* an official image `https://hub.docker.com/_/debian/tags?name=12`; Quay's, as
|
|
21
|
+
* `https://quay.io/repository/acme/base?tab=tags&tag=1.4.2`. None of any other registry, whose page
|
|
22
|
+
* its forge knows.
|
|
23
|
+
*
|
|
24
|
+
* @param repository - The repository of the image.
|
|
25
|
+
* @param version - The tag of its version.
|
|
26
|
+
* @returns The URL of the page, or `undefined`.
|
|
27
|
+
*/
|
|
28
|
+
export function imagePageOf(repository, version) {
|
|
29
|
+
const { host, path } = repositoryParts(repository);
|
|
30
|
+
const tag = encodeURIComponent(version);
|
|
31
|
+
if (DOCKER_HUB.has(host))
|
|
32
|
+
return path.startsWith('library/')
|
|
33
|
+
? `https://hub.docker.com/_/${path.slice('library/'.length)}/tags?name=${tag}`
|
|
34
|
+
: `https://hub.docker.com/r/${path}/tags?name=${tag}`;
|
|
35
|
+
if (host === 'quay.io')
|
|
36
|
+
return `https://quay.io/repository/${path}?tab=tags&tag=${tag}`;
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* An image a release published, as the links of the release name it: by its repository, of its
|
|
41
|
+
* page where its registry is a public one its URL names ({@link imagePageOf}), else of the
|
|
42
|
+
* registry it was published to, of the type `container`, its URL of its host and its name its path,
|
|
43
|
+
* whose page the forge of the release is asked.
|
|
44
|
+
*
|
|
45
|
+
* @param repository - The repository of the image, as `registry.gitlab.com/acme/images/base`.
|
|
46
|
+
* @param version - The tag of its version.
|
|
47
|
+
* @returns The image released.
|
|
48
|
+
*/
|
|
49
|
+
export function releasedImage(repository, version) {
|
|
50
|
+
const page = imagePageOf(repository, version);
|
|
51
|
+
if (page !== undefined)
|
|
52
|
+
return { ecosystem: 'oci', name: repository, version, page };
|
|
53
|
+
const { host, path } = repositoryParts(repository);
|
|
54
|
+
return {
|
|
55
|
+
ecosystem: 'oci',
|
|
56
|
+
name: repository,
|
|
57
|
+
version,
|
|
58
|
+
registry: { url: `https://${host}`, type: 'container', name: path }
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AAsBA,4EAA4E;AAC5E,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAC,CAAA;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,UAAU,EAAE,OAAO,CAAC,CAAA;IAC7C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IACpF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;IAClD,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,UAAU;QAChB,OAAO;QACP,QAAQ,EAAE,EAAE,GAAG,EAAE,WAAW,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE;KACpE,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtf/release-oci",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "The OCI images of a repo released and tagged in their registry, of no release tool and no rebuild, each function by the platform it is given: the ecosystem of OCI images, its default export (., ./ecosystem), a releasing ecosystem of the contract of @wtf/release, its steps verify, smoke, publish and move over the plan of a release; the images of a repo, each folder of a Dockerfile, a Containerfile or a .devcontainer/devcontainer.json git tracks, of the working tree or of a commit (./images), the tags of a release checked, its version and the tags that move, as its caller names them (./tags), the tested image of each found by its digest and copied to the tag of the version by crane, a version the registry has at another digest refused, and the tags that move pointed at the digest of the version (./publish), the
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"description": "The OCI images of a repo released and tagged in their registry, of no release tool and no rebuild, each function by the platform it is given: the ecosystem of OCI images, its default export (., ./ecosystem), a releasing ecosystem of the contract of @wtf/release, its steps verify, smoke, publish and move over the plan of a release; the images of a repo, each folder of a Dockerfile, a Containerfile or a .devcontainer/devcontainer.json git tracks, of the working tree or of a commit (./images), the tags of a release checked, its version and the tags that move, as its caller names them (./tags), the tested image of each found by its digest and copied to the tag of the version by crane, a version the registry has at another digest refused, and the tags that move pointed at the digest of the version (./publish), each image as the links of its release name it, of its page on Docker Hub or Quay, else of the registry whose forge knows its page (./pages), and OciError, the class of its errors, with their codes (./errors).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"container",
|
|
7
7
|
"docker",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"types": "./dist/images.d.ts",
|
|
47
47
|
"default": "./dist/images.js"
|
|
48
48
|
},
|
|
49
|
+
"./pages": {
|
|
50
|
+
"types": "./dist/pages.d.ts",
|
|
51
|
+
"default": "./dist/pages.js"
|
|
52
|
+
},
|
|
49
53
|
"./publish": {
|
|
50
54
|
"types": "./dist/publish.d.ts",
|
|
51
55
|
"default": "./dist/publish.js"
|
|
52
56
|
},
|
|
53
|
-
"./registry": {
|
|
54
|
-
"types": "./dist/registry.d.ts",
|
|
55
|
-
"default": "./dist/registry.js"
|
|
56
|
-
},
|
|
57
57
|
"./tags": {
|
|
58
58
|
"types": "./dist/tags.d.ts",
|
|
59
59
|
"default": "./dist/tags.js"
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"build": "tsc -b"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@wtf/platform": "^
|
|
71
|
-
"@wtf/platform-fs": "^1.
|
|
72
|
-
"@wtf/release": "^
|
|
70
|
+
"@wtf/platform": "^3.0.0",
|
|
71
|
+
"@wtf/platform-fs": "^1.1.1",
|
|
72
|
+
"@wtf/release": "^2.0.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^24.10.0",
|
package/dist/registry.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/** A response of the API of GitLab, as a request of {@link RegistryFetch} gives it. */
|
|
2
|
-
export interface RegistryResponse {
|
|
3
|
-
/** Whether its status is of success, 2xx. */
|
|
4
|
-
readonly ok: boolean;
|
|
5
|
-
/** Its status, as `200`. */
|
|
6
|
-
readonly status: number;
|
|
7
|
-
/**
|
|
8
|
-
* Its body, as text.
|
|
9
|
-
*
|
|
10
|
-
* @returns The body.
|
|
11
|
-
*/
|
|
12
|
-
text(): Promise<string>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The `fetch` the API of GitLab is asked by: the platform's, of the Fetch Standard, or a test's.
|
|
16
|
-
*
|
|
17
|
-
* @param url - The URL of the request.
|
|
18
|
-
* @param init - Its method and its headers.
|
|
19
|
-
* @returns What GitLab answered.
|
|
20
|
-
*/
|
|
21
|
-
export type RegistryFetch = (url: string, init: {
|
|
22
|
-
method: string;
|
|
23
|
-
headers: Record<string, string>;
|
|
24
|
-
}) => Promise<RegistryResponse>;
|
|
25
|
-
/** A project of GitLab, of its container registry: as `gitlabProjectOf` of a GitLab client gives it. */
|
|
26
|
-
export interface RegistryProject {
|
|
27
|
-
/** The URL of the API of GitLab, as `https://gitlab.com/api/v4`. */
|
|
28
|
-
readonly api: string;
|
|
29
|
-
/** The project as the API names it: its ID, or its path encoded, as `acme%2Fimages`. */
|
|
30
|
-
readonly id: string;
|
|
31
|
-
/** The path of the project, as `acme/images`. */
|
|
32
|
-
readonly path: string;
|
|
33
|
-
/** The page of the project, as `https://gitlab.com/acme/images`. */
|
|
34
|
-
readonly url: string;
|
|
35
|
-
}
|
|
36
|
-
/** The container registry of a project of GitLab, and the headers its API is asked by. */
|
|
37
|
-
export interface ContainerRegistry {
|
|
38
|
-
/** The project whose container registry holds the images. */
|
|
39
|
-
readonly project: RegistryProject;
|
|
40
|
-
/** The headers the request authenticates by: none of a public project. */
|
|
41
|
-
readonly headers: Readonly<Record<string, string>>;
|
|
42
|
-
}
|
|
43
|
-
/** What {@link registryPageOf} looks up. */
|
|
44
|
-
export interface RegistryQuery extends ContainerRegistry {
|
|
45
|
-
/** The `fetch` the request is made by. */
|
|
46
|
-
readonly fetch: RegistryFetch;
|
|
47
|
-
/** The repository of the image, as `registry.gitlab.com/acme/images/base`. */
|
|
48
|
-
readonly repository: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The page of the image `repository` in the container registry of `project`: the repository of its
|
|
52
|
-
* `location`, of the first page of a hundred, at `<project>/container_registry/<id>`. Throws
|
|
53
|
-
* `EOCILINK` of a request GitLab refuses or that cannot be made, and of a registry that lists no
|
|
54
|
-
* repository of the location.
|
|
55
|
-
*
|
|
56
|
-
* @param query - The `fetch`, the project, the repository and the headers.
|
|
57
|
-
* @returns The URL of the page of the image.
|
|
58
|
-
*/
|
|
59
|
-
export declare function registryPageOf(query: RegistryQuery): Promise<string>;
|
|
60
|
-
/** What {@link checkRegistryAccess} asks: a registry query of no repository. */
|
|
61
|
-
export type RegistryAccess = Omit<RegistryQuery, 'repository'>;
|
|
62
|
-
/**
|
|
63
|
-
* Checks that `headers` may read the container registry of `project`, by one request of no
|
|
64
|
-
* effect, `GET /projects/<id>/registry/repositories?per_page=1`, as {@link registryPageOf} needs it
|
|
65
|
-
* to: a token of the `read_api` or `api` scope may; the job token of a pipeline, `CI_JOB_TOKEN`, may
|
|
66
|
-
* not. Throws `EOCILINK` of a request GitLab refuses or that cannot be made.
|
|
67
|
-
*
|
|
68
|
-
* @param query - The `fetch`, the project and the headers.
|
|
69
|
-
*/
|
|
70
|
-
export declare function checkRegistryAccess(query: RegistryAccess): Promise<void>;
|
|
71
|
-
//# sourceMappingURL=registry.d.ts.map
|
package/dist/registry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAgCA,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CACxB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EA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release of a tag links each image by: the Container Registry API of the project lists its
|
|
4
|
-
* repositories, `GET /projects/<id>/registry/repositories`, each of its `location`, as
|
|
5
|
-
* `registry.gitlab.com/acme/images/base`, and its ID, whose page is
|
|
6
|
-
* `<project>/container_registry/<id>`. An image is linked where it lives, never uploaded.
|
|
7
|
-
* {@link checkRegistryAccess} asks the same API once, before anything is released, whether the
|
|
8
|
-
* headers may read it: GitLab's job token may not, so a run of it alone fails there, not after the
|
|
9
|
-
* images are copied. The ecosystem's `publish` gives each image its page of the registry its options
|
|
10
|
-
* name ({@link ContainerRegistry}).
|
|
11
|
-
*
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { registryPageOf } from '@wtf/release-oci/registry'
|
|
14
|
-
*
|
|
15
|
-
* export const page = await registryPageOf({
|
|
16
|
-
* fetch,
|
|
17
|
-
* project: {
|
|
18
|
-
* api: 'https://gitlab.com/api/v4',
|
|
19
|
-
* id: '7',
|
|
20
|
-
* path: 'acme/images',
|
|
21
|
-
* url: 'https://gitlab.com/acme/images'
|
|
22
|
-
* },
|
|
23
|
-
* repository: 'registry.gitlab.com/acme/images/base',
|
|
24
|
-
* headers: { 'PRIVATE-TOKEN': 'token' }
|
|
25
|
-
* })
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @packageDocumentation
|
|
29
|
-
* @module @wtf/release-oci/registry
|
|
30
|
-
*/
|
|
31
|
-
import { OciError } from "./errors.js";
|
|
32
|
-
/**
|
|
33
|
-
* The page of the image `repository` in the container registry of `project`: the repository of its
|
|
34
|
-
* `location`, of the first page of a hundred, at `<project>/container_registry/<id>`. Throws
|
|
35
|
-
* `EOCILINK` of a request GitLab refuses or that cannot be made, and of a registry that lists no
|
|
36
|
-
* repository of the location.
|
|
37
|
-
*
|
|
38
|
-
* @param query - The `fetch`, the project, the repository and the headers.
|
|
39
|
-
* @returns The URL of the page of the image.
|
|
40
|
-
*/
|
|
41
|
-
export async function registryPageOf(query) {
|
|
42
|
-
const { fetch, project, repository, headers } = query;
|
|
43
|
-
const url = `${project.api}/projects/${project.id}/registry/repositories?per_page=100`;
|
|
44
|
-
let text;
|
|
45
|
-
try {
|
|
46
|
-
const response = await fetch(url, { method: 'GET', headers: { ...headers } });
|
|
47
|
-
text = await response.text();
|
|
48
|
-
if (!response.ok)
|
|
49
|
-
throw new Error(`GitLab answered ${response.status}: ${text}`);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
throw new OciError('EOCILINK', `The container registry of ${project.path} cannot be asked for ${repository}, at ${url}: ${error.message}`, 'Give the run a token that may read the registry of the project, `GITLAB_TOKEN` of the `read_api` scope, and check the URL of GitLab.');
|
|
53
|
-
}
|
|
54
|
-
let listed;
|
|
55
|
-
try {
|
|
56
|
-
listed = JSON.parse(text);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
listed = undefined;
|
|
60
|
-
}
|
|
61
|
-
const found = (Array.isArray(listed) ? listed : []).find(({ location }) => location === repository);
|
|
62
|
-
if (found?.id === undefined)
|
|
63
|
-
throw new OciError('EOCILINK', `The container registry of ${project.path} lists no repository ${repository}.`, 'Publish the image to the registry of the project of the release, whose page the release links: its repository is `CI_REGISTRY_IMAGE`, of its folder.');
|
|
64
|
-
return `${project.url}/container_registry/${found.id}`;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Checks that `headers` may read the container registry of `project`, by one request of no
|
|
68
|
-
* effect, `GET /projects/<id>/registry/repositories?per_page=1`, as {@link registryPageOf} needs it
|
|
69
|
-
* to: a token of the `read_api` or `api` scope may; the job token of a pipeline, `CI_JOB_TOKEN`, may
|
|
70
|
-
* not. Throws `EOCILINK` of a request GitLab refuses or that cannot be made.
|
|
71
|
-
*
|
|
72
|
-
* @param query - The `fetch`, the project and the headers.
|
|
73
|
-
*/
|
|
74
|
-
export async function checkRegistryAccess(query) {
|
|
75
|
-
const { fetch, project, headers } = query;
|
|
76
|
-
const url = `${project.api}/projects/${project.id}/registry/repositories?per_page=1`;
|
|
77
|
-
try {
|
|
78
|
-
const response = await fetch(url, { method: 'GET', headers: { ...headers } });
|
|
79
|
-
if (!response.ok)
|
|
80
|
-
throw new Error(`GitLab answered ${response.status}: ${await response.text()}`);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
throw new OciError('EOCILINK', `The container registry of ${project.path} cannot be read, at ${url}: ${error.message}`, 'Give the run a token that may read the API of the project, `GITLAB_TOKEN` of the `read_api` or `api` scope: GitLab refuses the job token, `CI_JOB_TOKEN`, there.');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=registry.js.map
|
package/dist/registry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AA8DtC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAoB;IACvD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,aAAa,OAAO,CAAC,EAAE,qCAAqC,CAAA;IACtF,IAAI,IAAY,CAAA;IAChB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAA;QAC7E,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC5B,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAA;IAClF,CAAC;IAAC,OAAO,KAAK,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