@azure/container-registry 1.1.0-beta.2 → 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.
Files changed (44) hide show
  1. package/README.md +174 -4
  2. package/dist/index.js +366 -154
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/constants.js +1 -1
  5. package/dist-esm/src/constants.js.map +1 -1
  6. package/dist-esm/src/containerRegistryClient.js +15 -12
  7. package/dist-esm/src/containerRegistryClient.js.map +1 -1
  8. package/dist-esm/src/containerRepository.js +12 -5
  9. package/dist-esm/src/containerRepository.js.map +1 -1
  10. package/dist-esm/src/{blob/containerRegistryBlobClient.js → content/containerRegistryContentClient.js} +91 -58
  11. package/dist-esm/src/content/containerRegistryContentClient.js.map +1 -0
  12. package/dist-esm/src/{blob → content}/index.js +1 -1
  13. package/dist-esm/src/content/index.js.map +1 -0
  14. package/dist-esm/src/content/models.js +17 -0
  15. package/dist-esm/src/content/models.js.map +1 -0
  16. package/dist-esm/src/generated/generatedClient.js +28 -2
  17. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  18. package/dist-esm/src/generated/generatedClientContext.js +1 -1
  19. package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
  20. package/dist-esm/src/generated/models/index.js +17 -0
  21. package/dist-esm/src/generated/models/index.js.map +1 -1
  22. package/dist-esm/src/generated/models/mappers.js +7 -1
  23. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  24. package/dist-esm/src/generated/operations/containerRegistry.js +0 -14
  25. package/dist-esm/src/generated/operations/containerRegistry.js.map +1 -1
  26. package/dist-esm/src/generated/operations/containerRegistryBlob.js +4 -8
  27. package/dist-esm/src/generated/operations/containerRegistryBlob.js.map +1 -1
  28. package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js.map +1 -1
  29. package/dist-esm/src/index.js +1 -1
  30. package/dist-esm/src/index.js.map +1 -1
  31. package/dist-esm/src/models.js +4 -1
  32. package/dist-esm/src/models.js.map +1 -1
  33. package/dist-esm/src/registryArtifact.js +12 -5
  34. package/dist-esm/src/registryArtifact.js.map +1 -1
  35. package/dist-esm/src/utils/helpers.js +30 -16
  36. package/dist-esm/src/utils/helpers.js.map +1 -1
  37. package/dist-esm/src/utils/retriableReadableStream.js +116 -0
  38. package/dist-esm/src/utils/retriableReadableStream.js.map +1 -0
  39. package/package.json +8 -5
  40. package/types/container-registry.d.ts +181 -145
  41. package/dist-esm/src/blob/containerRegistryBlobClient.js.map +0 -1
  42. package/dist-esm/src/blob/index.js.map +0 -1
  43. package/dist-esm/src/blob/models.js +0 -4
  44. package/dist-esm/src/blob/models.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/container-registry",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0",
4
4
  "description": "An isomorphic client library for the Azure Container Registry service.",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -19,6 +19,10 @@
19
19
  {
20
20
  "path": "swagger/README.md",
21
21
  "prefix": "package-version"
22
+ },
23
+ {
24
+ "path": "src/constants.ts",
25
+ "prefix": "const SDK_VERSION"
22
26
  }
23
27
  ]
24
28
  },
@@ -73,6 +77,7 @@
73
77
  "sideEffects": false,
74
78
  "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
75
79
  "dependencies": {
80
+ "@azure/abort-controller": "^1.1.0",
76
81
  "@azure/core-auth": "^1.3.0",
77
82
  "@azure/core-client": "^1.6.2",
78
83
  "@azure/core-rest-pipeline": "^1.8.0",
@@ -87,7 +92,7 @@
87
92
  "@azure/identity": "^2.1.0-beta.2",
88
93
  "@azure/test-utils": "^1.0.0",
89
94
  "@azure-tools/test-credential": "^1.0.0",
90
- "@azure-tools/test-recorder": "^2.0.0",
95
+ "@azure-tools/test-recorder": "^3.0.0",
91
96
  "@microsoft/api-extractor": "^7.31.1",
92
97
  "@types/chai": "^4.1.6",
93
98
  "@types/chai-as-promised": "^7.1.0",
@@ -102,10 +107,8 @@
102
107
  "karma": "^6.2.0",
103
108
  "karma-chrome-launcher": "^3.0.0",
104
109
  "karma-coverage": "^2.0.0",
105
- "karma-edge-launcher": "^0.4.2",
106
110
  "karma-env-preprocessor": "^0.1.1",
107
111
  "karma-firefox-launcher": "^1.1.0",
108
- "karma-ie-launcher": "^1.0.0",
109
112
  "karma-junit-reporter": "^2.0.1",
110
113
  "karma-mocha": "^2.0.1",
111
114
  "karma-mocha-reporter": "^2.2.5",
@@ -115,7 +118,7 @@
115
118
  "nyc": "^15.0.0",
116
119
  "prettier": "^2.5.1",
117
120
  "rimraf": "^3.0.0",
118
- "typescript": "~4.8.0",
121
+ "typescript": "~5.0.0",
119
122
  "util": "^0.12.1"
120
123
  },
121
124
  "//sampleConfiguration": {
@@ -147,97 +147,6 @@ export declare interface ArtifactTagProperties {
147
147
  canRead?: boolean;
148
148
  }
149
149
 
150
- /**
151
- * The Azure Container Registry blob client, responsible for uploading and downloading blobs and manifests, the building blocks of artifacts.
152
- */
153
- export declare class ContainerRegistryBlobClient {
154
- /**
155
- * The Azure Container Registry endpoint.
156
- */
157
- readonly endpoint: string;
158
- /**
159
- * The name of the repository that logically groups the artifact parts.
160
- */
161
- readonly repositoryName: string;
162
- private client;
163
- /**
164
- * Creates an instance of a ContainerRegistryBlobClient for managing container images and artifacts.
165
- *
166
- * Example usage:
167
- * ```ts
168
- * import { ContainerRegistryBlobClient } from "@azure/container-registry";
169
- * import { DefaultAzureCredential} from "@azure/identity";
170
- *
171
- * const client = new ContainerRegistryBlobClient(
172
- * "<container registry API endpoint>",
173
- * "<repository name>",
174
- * new DefaultAzureCredential()
175
- * );
176
- * ```
177
- * @param endpoint - the URL endpoint of the container registry
178
- * @param repositoryName - the name of the repository that logically groups the artifact parts
179
- * @param credential - used to authenticate requests to the service
180
- * @param options - optional configuration used to send requests to the service
181
- */
182
- constructor(endpoint: string, repositoryName: string, credential: TokenCredential, options: ContainerRegistryBlobClientOptions);
183
- /**
184
- * Delete a blob.
185
- * @param digest - the digest of the blob to delete
186
- * @param options - optional configuration used to send requests to the service
187
- */
188
- deleteBlob(digest: string, options?: DeleteBlobOptions): Promise<void>;
189
- /**
190
- * Upload a manifest for an OCI artifact.
191
- *
192
- * @param manifest - the manifest to upload. If a resettable stream (a factory function that returns a stream) is provided, it may be called multiple times. Each time the function is called, a fresh stream should be returned.
193
- */
194
- uploadManifest(manifest: (() => NodeJS.ReadableStream) | NodeJS.ReadableStream | OciManifest, options?: UploadManifestOptions): Promise<UploadManifestResult>;
195
- /**
196
- * Downloads the manifest for an OCI artifact
197
- *
198
- * @param tagOrDigest - a tag or digest that identifies the artifact
199
- * @returns - the downloaded manifest
200
- */
201
- downloadManifest(tagOrDigest: string, options?: DownloadManifestOptions): Promise<DownloadManifestResult>;
202
- /**
203
- * Delete a manifest. Doing so effectively deletes an artifact from the registry.
204
- *
205
- * @param digest - the digest of the manifest to delete
206
- * @param options - optional configuration used to send requests to the service
207
- */
208
- deleteManifest(digest: string, options?: DeleteManifestOptions): Promise<void>;
209
- /**
210
- * Upload an artifact blob.
211
- *
212
- * @param blobStream - the stream containing the blob data.
213
- */
214
- uploadBlob(blobStream: NodeJS.ReadableStream, options?: UploadBlobOptions): Promise<UploadBlobResult>;
215
- /**
216
- * Download a blob that is part of an artifact.
217
- *
218
- * @param digest - the digest of the blob to download
219
- * @param options - optional configuration used to send requests to the service
220
- * @returns - the downloaded blob
221
- */
222
- downloadBlob(digest: string, options?: DownloadBlobOptions): Promise<DownloadBlobResult>;
223
- }
224
-
225
- /**
226
- * Client options used to configure Container Registry Blob API requests.
227
- */
228
- export declare interface ContainerRegistryBlobClientOptions extends CommonClientOptions {
229
- /**
230
- * Gets or sets the audience to use for authentication with Azure Active Directory.
231
- * The authentication scope will be set from this audience.
232
- * See {@link KnownContainerRegistryAudience} for known audience values.
233
- */
234
- audience: string;
235
- /**
236
- * The version of service API to make calls against.
237
- */
238
- serviceVersion?: "2021-07-01";
239
- }
240
-
241
150
  /**
242
151
  * The client class used to interact with the Container Registry service.
243
152
  */
@@ -364,6 +273,97 @@ export declare interface ContainerRegistryClientOptions extends CommonClientOpti
364
273
  serviceVersion?: "2021-07-01";
365
274
  }
366
275
 
276
+ /**
277
+ * The Azure Container Registry blob client, responsible for uploading and downloading blobs and manifests, the building blocks of artifacts.
278
+ */
279
+ export declare class ContainerRegistryContentClient {
280
+ /**
281
+ * The Azure Container Registry endpoint.
282
+ */
283
+ readonly endpoint: string;
284
+ /**
285
+ * The name of the repository that logically groups the artifact parts.
286
+ */
287
+ readonly repositoryName: string;
288
+ private client;
289
+ /**
290
+ * Creates an instance of a ContainerRegistryContentClient for managing container images and artifacts.
291
+ *
292
+ * Example usage:
293
+ * ```ts
294
+ * import { ContainerRegistryContentClient } from "@azure/container-registry";
295
+ * import { DefaultAzureCredential} from "@azure/identity";
296
+ *
297
+ * const client = new ContainerRegistryContentClient(
298
+ * "<container registry API endpoint>",
299
+ * "<repository name>",
300
+ * new DefaultAzureCredential()
301
+ * );
302
+ * ```
303
+ * @param endpoint - the URL endpoint of the container registry
304
+ * @param repositoryName - the name of the repository that logically groups the artifact parts
305
+ * @param credential - used to authenticate requests to the service
306
+ * @param options - optional configuration used to send requests to the service
307
+ */
308
+ constructor(endpoint: string, repositoryName: string, credential: TokenCredential, options?: ContainerRegistryContentClientOptions);
309
+ /**
310
+ * Delete a blob.
311
+ * @param digest - the digest of the blob to delete
312
+ * @param options - optional configuration used to send requests to the service
313
+ */
314
+ deleteBlob(digest: string, options?: DeleteBlobOptions): Promise<void>;
315
+ /**
316
+ * Upload a manifest for an OCI artifact.
317
+ *
318
+ * @param manifest - the manifest to upload.
319
+ */
320
+ setManifest(manifest: Buffer | NodeJS.ReadableStream | OciImageManifest | Record<string, unknown>, options?: SetManifestOptions): Promise<SetManifestResult>;
321
+ /**
322
+ * Downloads the manifest for an OCI artifact.
323
+ *
324
+ * @param tagOrDigest - a tag or digest that identifies the artifact
325
+ * @returns - the downloaded manifest.
326
+ */
327
+ getManifest(tagOrDigest: string, options?: GetManifestOptions): Promise<GetManifestResult>;
328
+ /**
329
+ * Delete a manifest. Doing so effectively deletes an artifact from the registry.
330
+ *
331
+ * @param digest - the digest of the manifest to delete
332
+ * @param options - optional configuration used to send requests to the service
333
+ */
334
+ deleteManifest(digest: string, options?: DeleteManifestOptions): Promise<void>;
335
+ /**
336
+ * Upload an artifact blob.
337
+ *
338
+ * @param blobStream - the stream containing the blob data.
339
+ */
340
+ uploadBlob(blob: NodeJS.ReadableStream | Buffer, options?: UploadBlobOptions): Promise<UploadBlobResult>;
341
+ /**
342
+ * Download a blob that is part of an artifact.
343
+ *
344
+ * @param digest - the digest of the blob to download
345
+ * @param options - optional configuration used to send requests to the service
346
+ * @returns - the downloaded blob
347
+ */
348
+ downloadBlob(digest: string, options?: DownloadBlobOptions): Promise<DownloadBlobResult>;
349
+ }
350
+
351
+ /**
352
+ * Client options used to configure Container Registry Blob API requests.
353
+ */
354
+ export declare interface ContainerRegistryContentClientOptions extends CommonClientOptions {
355
+ /**
356
+ * Gets or sets the audience to use for authentication with Azure Active Directory.
357
+ * The authentication scope will be set from this audience.
358
+ * See {@link KnownContainerRegistryAudience} for known audience values.
359
+ */
360
+ audience?: string;
361
+ /**
362
+ * The version of service API to make calls against.
363
+ */
364
+ serviceVersion?: "2021-07-01";
365
+ }
366
+
367
367
  /**
368
368
  * A `repository` in a container registry is a logical grouping of images or artifacts that share the same name. For example,
369
369
  * different versions of a `hello-world` application could have tags `v1` and `v2`, and be grouped by the repository `hello-world`.
@@ -564,31 +564,35 @@ export declare interface DownloadBlobResult {
564
564
  /**
565
565
  * Options for confguring the download manifest operation.
566
566
  */
567
- export declare interface DownloadManifestOptions extends OperationOptions {
567
+ export declare interface GetManifestOptions extends OperationOptions {
568
+ }
569
+
570
+ /**
571
+ * Options for the `getManifestProperties` method of `RegistryArtifact`.
572
+ */
573
+ export declare interface GetManifestPropertiesOptions extends OperationOptions {
568
574
  }
569
575
 
570
576
  /**
571
577
  * The result from downloading a manifest from the registry.
572
578
  */
573
- export declare interface DownloadManifestResult {
579
+ export declare interface GetManifestResult {
574
580
  /**
575
581
  * The digest of the downloaded manifest as calculated by the registry.
576
582
  */
577
583
  digest: string;
578
584
  /**
579
- * The OCI manifest that was downloaded.
585
+ * Media type of the downloaded manifest as indicated by the Content-Type response header.
580
586
  */
581
- manifest: OciManifest;
587
+ mediaType: string;
582
588
  /**
583
- * The manifest stream that was downloaded.
589
+ * The raw content of the manifest that was downloaded.
584
590
  */
585
- manifestStream: NodeJS.ReadableStream;
586
- }
587
-
588
- /**
589
- * Options for the `getManifestProperties` method of `RegistryArtifact`.
590
- */
591
- export declare interface GetManifestPropertiesOptions extends OperationOptions {
591
+ content: Buffer;
592
+ /**
593
+ * The deserialized manifest
594
+ */
595
+ manifest: Record<string, unknown>;
592
596
  }
593
597
 
594
598
  /**
@@ -675,7 +679,10 @@ export declare enum KnownArtifactOperatingSystem {
675
679
  export declare enum KnownContainerRegistryAudience {
676
680
  /** Azure China */
677
681
  AzureResourceManagerChina = "https://management.chinacloudapi.cn",
678
- /** Azure Gemany */
682
+ /**
683
+ * Azure Germany
684
+ * @deprecated Azure Germany is being deprecated in favor of standard nonsovereign Azure regions in Germany.
685
+ */
679
686
  AzureResourceManagerGermany = "https://management.microsoftazure.de",
680
687
  /** Azure Government */
681
688
  AzureResourceManagerGovernment = "https://management.usgovcloudapi.net",
@@ -683,6 +690,20 @@ export declare enum KnownContainerRegistryAudience {
683
690
  AzureResourceManagerPublicCloud = "https://management.azure.com"
684
691
  }
685
692
 
693
+ /**
694
+ * Known media type values for Docker and OCI manifests.
695
+ */
696
+ export declare enum KnownManifestMediaType {
697
+ /**
698
+ * The media type for an OCI image manifest. This format is described at https://github.com/opencontainers/image-spec/blob/main/manifest.md.
699
+ */
700
+ OciImageManifest = "application/vnd.oci.image.manifest.v1+json",
701
+ /**
702
+ * The media type for a Docker Image Manifest, Version 2, Schema 2. This format is described at https://docs.docker.com/registry/spec/manifest-v2-2/.
703
+ */
704
+ DockerManifest = "application/vnd.docker.distribution.manifest.v2+json"
705
+ }
706
+
686
707
  /**
687
708
  * Options for the `listRegistryArtifacts` method of `ContainerRepository`.
688
709
  */
@@ -715,38 +736,38 @@ export declare interface ManifestPageResponse extends Array<ArtifactManifestProp
715
736
  continuationToken?: string;
716
737
  }
717
738
 
718
- /** Additional information provided through arbitrary metadata */
719
- export declare interface OciAnnotations {
739
+ /** Additional information provided through arbitrary metadata.
740
+ * See the specification at https://github.com/opencontainers/image-spec/blob/main/annotations.md for more information.
741
+ */
742
+ export declare interface OciAnnotations extends Record<string, unknown> {
720
743
  /** Date and time on which the image was built (string, date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6) */
721
- createdOn?: Date;
744
+ "org.opencontainers.image.created"?: string;
722
745
  /** Contact details of the people or organization responsible for the image. */
723
- authors?: string;
746
+ "org.opencontainers.image.authors"?: string;
724
747
  /** URL to find more information on the image. */
725
- url?: string;
748
+ "org.opencontainers.image.url"?: string;
726
749
  /** URL to get documentation on the image. */
727
- documentation?: string;
750
+ "org.opencontainers.image.documentation"?: string;
728
751
  /** URL to get source code for building the image. */
729
- source?: string;
752
+ "org.opencontainers.image.source"?: string;
730
753
  /** Version of the packaged software. The version MAY match a label or tag in the source code repository, may also be Semantic versioning-compatible */
731
- version?: string;
754
+ "org.opencontainers.image.version"?: string;
732
755
  /** Source control revision identifier for the packaged software. */
733
- revision?: string;
756
+ "org.opencontainers.image.revision"?: string;
734
757
  /** Name of the distributing entity, organization or individual. */
735
- vendor?: string;
758
+ "org.opencontainers.image.vendor"?: string;
736
759
  /** License(s) under which contained software is distributed as an SPDX License Expression. */
737
- licenses?: string;
760
+ "org.opencontainers.image.licenses"?: string;
738
761
  /** Name of the reference for a target. */
739
- name?: string;
762
+ "org.opencontainers.image.ref.name"?: string;
740
763
  /** Human-readable title of the image */
741
- title?: string;
764
+ "org.opencontainers.image.title"?: string;
742
765
  /** Human-readable description of the software packaged in the image */
743
- description?: string;
744
- /** Additional properties */
745
- [additionalProperties: string]: unknown;
766
+ "org.opencontainers.image.description"?: string;
746
767
  }
747
768
 
748
769
  /** Docker V2 image layer descriptor including config and layers. */
749
- export declare interface OciBlobDescriptor {
770
+ export declare interface OciDescriptor {
750
771
  /** Layer media type */
751
772
  mediaType: string;
752
773
  /** Layer size */
@@ -759,17 +780,24 @@ export declare interface OciBlobDescriptor {
759
780
  annotations?: OciAnnotations;
760
781
  }
761
782
 
762
- /** Returns the requested OCI Manifest file. */
763
- export declare interface OciManifest {
783
+ /**
784
+ * Type representing an OCI image manifest (manifest of media type "application/vnd.oci.image.manifest.v1+json").
785
+ * See the specification at https://github.com/opencontainers/image-spec/blob/main/manifest.md for more information.
786
+ */
787
+ export declare type OciImageManifest = {
764
788
  /** Schema version */
765
- schemaVersion: number;
789
+ schemaVersion: 2;
790
+ /** The media type, when used, must be application/vnd.oci.image.manifest.v1+json. */
791
+ mediaType?: `${KnownManifestMediaType.OciImageManifest}`;
792
+ /** When the manifest is used for an artifact, the type of said artifact. */
793
+ artifactType?: string;
766
794
  /** V2 image config descriptor */
767
- config?: OciBlobDescriptor;
795
+ config: OciDescriptor;
768
796
  /** List of V2 image layer information */
769
- layers?: OciBlobDescriptor[];
797
+ layers: OciDescriptor[];
770
798
  /** Additional information provided through arbitrary metadata. */
771
799
  annotations?: OciAnnotations;
772
- }
800
+ };
773
801
 
774
802
  /**
775
803
  * `Artifact` is the general term for items stored in a container registry,
@@ -907,6 +935,30 @@ export declare interface RepositoryPageResponse extends Array<string> {
907
935
  continuationToken?: string;
908
936
  }
909
937
 
938
+ /**
939
+ * Options for configuring the upload manifest operation.
940
+ */
941
+ export declare interface SetManifestOptions extends OperationOptions {
942
+ /**
943
+ * Media type of the uploaded manifest
944
+ */
945
+ mediaType?: string;
946
+ /**
947
+ * Tag to give the uploaded manifest
948
+ */
949
+ tag?: string;
950
+ }
951
+
952
+ /**
953
+ * The result from uploading a manifest to the registry.
954
+ */
955
+ export declare interface SetManifestResult {
956
+ /**
957
+ * The digest of the uploaded manifest, calculated by the registry.
958
+ */
959
+ digest: string;
960
+ }
961
+
910
962
  /**
911
963
  * Contains response data for the listTags operation.
912
964
  */
@@ -973,26 +1025,10 @@ export declare interface UploadBlobResult {
973
1025
  * The digest of the uploaded blob.
974
1026
  */
975
1027
  digest: string;
976
- }
977
-
978
- /**
979
- * Options for configuring the upload manifest operation.
980
- */
981
- export declare interface UploadManifestOptions extends OperationOptions {
982
1028
  /**
983
- * Tag to give the uploaded manifest
1029
+ * The size of the uploaded blob in bytes.
984
1030
  */
985
- tag: string;
986
- }
987
-
988
- /**
989
- * The result from uploading a manifest to the registry.
990
- */
991
- export declare interface UploadManifestResult {
992
- /**
993
- * The digest of the uploaded manifest, calculated by the registry.
994
- */
995
- digest: string;
1031
+ sizeInBytes: number;
996
1032
  }
997
1033
 
998
1034
  export { }
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerRegistryBlobClient.js","sourceRoot":"","sources":["../../../src/blob/containerRegistryBlobClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAEL,+BAA+B,EAC/B,SAAS,GACV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,uCAAuC,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAclD,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAuB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,aAAa,E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AAc,CAAC,CAAC;YAE3F,IAAI,MAAM,KAAK,kBAAkB,EAAE;gBACjC,MAAM,IAAI,mBAAmB,CAC3B,qEAAqE,CACtE,CAAC;aACH;YAED,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CACvB,MAAc,EACd,UAA+B,EAAE;QAEjC,OAAO,aAAa,CAAC,QAAQ,CAC3B,0CAA0C,EAC1C,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAC5E,IAAI,CAAC,cAAc,EACnB,MAAM,EACN,cAAc,CACf,CAAC;YAEF,OAAO;gBACL,MAAM;gBACN,OAAO,EAAE,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;aACjD,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n InternalPipelineOptions,\n bearerTokenAuthenticationPolicy,\n RestError,\n} from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { GeneratedClient } from \"../generated\";\nimport { ChallengeHandler } from \"../containerRegistryChallengeHandler\";\nimport { ContainerRegistryRefreshTokenCredential } from \"../containerRegistryTokenCredential\";\nimport { logger } from \"../logger\";\nimport { calculateDigest } from \"../utils/digest\";\nimport {\n DeleteBlobOptions,\n DeleteManifestOptions,\n DownloadBlobOptions,\n DownloadBlobResult,\n DownloadManifestOptions,\n DownloadManifestResult,\n OciManifest,\n UploadBlobOptions,\n UploadBlobResult,\n UploadManifestOptions,\n UploadManifestResult,\n} from \"./models\";\nimport * as Mappers from \"../generated/models/mappers\";\nimport { CommonClientOptions, createSerializer } from \"@azure/core-client\";\nimport { readChunksFromStream, readStreamToEnd } from \"../utils/helpers\";\nimport { Readable } from \"stream\";\nimport { tracingClient } from \"../tracing\";\nimport crypto from \"crypto\";\n\nconst LATEST_API_VERSION = \"2021-07-01\";\n\nconst CHUNK_SIZE = 4 * 1024 * 1024; // 4 MB\n\nenum KnownManifestMediaType {\n OciManifestMediaType = \"application/vnd.oci.image.manifest.v1+json\",\n}\n\nfunction isReadableStream(body: any): body is NodeJS.ReadableStream {\n return body && typeof body.pipe === \"function\";\n}\n\nfunction assertHasProperty<T, U extends keyof T>(\n obj: T,\n property: U\n): asserts obj is T & Required<Pick<T, U>> {\n if (!Object.prototype.hasOwnProperty.call(obj, property)) {\n throw new RestError(`Expected property ${String(property)} to be defined.`);\n }\n}\n\n/**\n * Error thrown when the Docker content digest returned from the\n * server does not match the digest calculated from the content.\n */\nexport class DigestMismatchError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"DigestMismatchError\";\n }\n}\n\n/**\n * Client options used to configure Container Registry Blob API requests.\n */\nexport interface ContainerRegistryBlobClientOptions extends CommonClientOptions {\n /**\n * Gets or sets the audience to use for authentication with Azure Active Directory.\n * The authentication scope will be set from this audience.\n * See {@link KnownContainerRegistryAudience} for known audience values.\n */\n audience: string;\n /**\n * The version of service API to make calls against.\n */\n serviceVersion?: \"2021-07-01\";\n}\n\nconst serializer = createSerializer(Mappers, /* isXML */ false);\n\n/**\n * The Azure Container Registry blob client, responsible for uploading and downloading blobs and manifests, the building blocks of artifacts.\n */\nexport class ContainerRegistryBlobClient {\n /**\n * The Azure Container Registry endpoint.\n */\n public readonly endpoint: string;\n\n /**\n * The name of the repository that logically groups the artifact parts.\n */\n public readonly repositoryName: string;\n\n private client: GeneratedClient;\n\n /**\n * Creates an instance of a ContainerRegistryBlobClient for managing container images and artifacts.\n *\n * Example usage:\n * ```ts\n * import { ContainerRegistryBlobClient } from \"@azure/container-registry\";\n * import { DefaultAzureCredential} from \"@azure/identity\";\n *\n * const client = new ContainerRegistryBlobClient(\n * \"<container registry API endpoint>\",\n * \"<repository name>\",\n * new DefaultAzureCredential()\n * );\n * ```\n * @param endpoint - the URL endpoint of the container registry\n * @param repositoryName - the name of the repository that logically groups the artifact parts\n * @param credential - used to authenticate requests to the service\n * @param options - optional configuration used to send requests to the service\n */\n constructor(\n endpoint: string,\n repositoryName: string,\n credential: TokenCredential,\n options: ContainerRegistryBlobClientOptions\n ) {\n if (!endpoint) {\n throw new Error(\"invalid endpoint\");\n }\n\n this.endpoint = endpoint;\n this.repositoryName = repositoryName;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n // This array contains header names we want to log that are not already\n // included as safe. Unknown/unsafe headers are logged as \"<REDACTED>\".\n additionalAllowedQueryParameters: [\n \"last\",\n \"n\",\n \"orderby\",\n \"digest\",\n \"_nouploadcache\",\n \"_state\",\n ],\n },\n };\n\n const defaultScope = `${options.audience}/.default`;\n const serviceVersion = options.serviceVersion ?? LATEST_API_VERSION;\n const authClient = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);\n this.client = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: [defaultScope],\n challengeCallbacks: new ChallengeHandler(\n new ContainerRegistryRefreshTokenCredential(authClient, defaultScope, credential)\n ),\n })\n );\n }\n\n /**\n * Delete a blob.\n * @param digest - the digest of the blob to delete\n * @param options - optional configuration used to send requests to the service\n */\n public async deleteBlob(digest: string, options: DeleteBlobOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.deleteBlob\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistryBlob.deleteBlob(\n this.repositoryName,\n digest,\n updatedOptions\n );\n }\n );\n }\n\n /**\n * Upload a manifest for an OCI artifact.\n *\n * @param manifest - the manifest to upload. If a resettable stream (a factory function that returns a stream) is provided, it may be called multiple times. Each time the function is called, a fresh stream should be returned.\n */\n public async uploadManifest(\n manifest: (() => NodeJS.ReadableStream) | NodeJS.ReadableStream | OciManifest,\n options?: UploadManifestOptions\n ): Promise<UploadManifestResult> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.uploadManifest\",\n options ?? {},\n async (updatedOptions) => {\n let manifestBody: Buffer | (() => NodeJS.ReadableStream);\n let tagOrDigest: string | undefined = options?.tag;\n\n if (isReadableStream(manifest)) {\n manifestBody = await readStreamToEnd(manifest);\n tagOrDigest ??= await calculateDigest(manifestBody);\n } else if (typeof manifest === \"function\") {\n manifestBody = manifest;\n tagOrDigest ??= await calculateDigest(manifestBody());\n } else {\n const serialized = serializer.serialize(Mappers.OCIManifest, manifest);\n manifestBody = Buffer.from(JSON.stringify(serialized));\n tagOrDigest ??= await calculateDigest(manifestBody);\n }\n\n const createManifestResult = await this.client.containerRegistry.createManifest(\n this.repositoryName,\n tagOrDigest,\n manifestBody,\n { contentType: KnownManifestMediaType.OciManifestMediaType, ...updatedOptions }\n );\n\n assertHasProperty(createManifestResult, \"dockerContentDigest\");\n\n return { digest: createManifestResult.dockerContentDigest };\n }\n );\n }\n\n /**\n * Downloads the manifest for an OCI artifact\n *\n * @param tagOrDigest - a tag or digest that identifies the artifact\n * @returns - the downloaded manifest\n */\n public async downloadManifest(\n tagOrDigest: string,\n options: DownloadManifestOptions = {}\n ): Promise<DownloadManifestResult> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.downloadManifest\",\n options,\n async (updatedOptions) => {\n const { dockerContentDigest, readableStreamBody } =\n await this.client.containerRegistry.getManifest(this.repositoryName, tagOrDigest, {\n accept: KnownManifestMediaType.OciManifestMediaType,\n ...updatedOptions,\n });\n\n const bodyData = readableStreamBody\n ? await readStreamToEnd(readableStreamBody)\n : Buffer.alloc(0);\n\n const expectedDigest = await calculateDigest(bodyData);\n\n if (dockerContentDigest !== expectedDigest) {\n throw new DigestMismatchError(\n \"Digest of blob to upload does not match the digest from the server.\"\n );\n }\n\n const manifest = serializer.deserialize(\n Mappers.OCIManifest,\n JSON.parse(bodyData.toString()),\n \"OCIManifest\"\n );\n\n return {\n digest: dockerContentDigest,\n manifest,\n manifestStream: Readable.from(bodyData),\n };\n }\n );\n }\n\n /**\n * Delete a manifest. Doing so effectively deletes an artifact from the registry.\n *\n * @param digest - the digest of the manifest to delete\n * @param options - optional configuration used to send requests to the service\n */\n public async deleteManifest(digest: string, options: DeleteManifestOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.deleteManifest\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistry.deleteManifest(\n this.repositoryName,\n digest,\n updatedOptions\n );\n }\n );\n }\n\n /**\n * Upload an artifact blob.\n *\n * @param blobStream - the stream containing the blob data.\n */\n public async uploadBlob(\n blobStream: NodeJS.ReadableStream,\n options: UploadBlobOptions = {}\n ): Promise<UploadBlobResult> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.uploadBlob\",\n options,\n async (updatedOptions) => {\n const startUploadResult = await this.client.containerRegistryBlob.startUpload(\n this.repositoryName,\n updatedOptions\n );\n\n assertHasProperty(startUploadResult, \"location\");\n let location = startUploadResult.location.substring(1);\n\n const chunks = readChunksFromStream(blobStream, CHUNK_SIZE);\n const hash = crypto.createHash(\"sha256\");\n\n for await (const chunk of chunks) {\n hash.write(chunk);\n const result = await this.client.containerRegistryBlob.uploadChunk(\n location,\n chunk,\n updatedOptions\n );\n assertHasProperty(result, \"location\");\n location = result.location.substring(1);\n }\n\n hash.end();\n const digest = `sha256:${hash.digest(\"hex\")}`;\n\n const { dockerContentDigest: digestFromResponse } =\n await this.client.containerRegistryBlob.completeUpload(digest, location, updatedOptions);\n\n if (digest !== digestFromResponse) {\n throw new DigestMismatchError(\n \"Digest of blob to upload does not match the digest from the server.\"\n );\n }\n\n return { digest };\n }\n );\n }\n\n /**\n * Download a blob that is part of an artifact.\n *\n * @param digest - the digest of the blob to download\n * @param options - optional configuration used to send requests to the service\n * @returns - the downloaded blob\n */\n public async downloadBlob(\n digest: string,\n options: DownloadBlobOptions = {}\n ): Promise<DownloadBlobResult> {\n return tracingClient.withSpan(\n \"ContainerRegistryBlobClient.downloadBlob\",\n options,\n async (updatedOptions) => {\n const { readableStreamBody } = await this.client.containerRegistryBlob.getBlob(\n this.repositoryName,\n digest,\n updatedOptions\n );\n\n return {\n digest,\n content: readableStreamBody ?? Readable.from([]),\n };\n }\n );\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/blob/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./models\";\nexport * from \"./containerRegistryBlobClient\";\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=models.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/blob/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Options for configuring the upload manifest operation.\n */\nexport interface UploadManifestOptions extends OperationOptions {\n /**\n * Tag to give the uploaded manifest\n */\n tag: string;\n}\n\n/**\n * The result from uploading a blob to the registry.\n */\nexport interface UploadBlobResult {\n /**\n * The digest of the uploaded blob.\n */\n digest: string;\n}\n\n/**\n * The result from downloading a manifest from the registry.\n */\nexport interface DownloadManifestResult {\n /**\n * The digest of the downloaded manifest as calculated by the registry.\n */\n digest: string;\n\n /**\n * The OCI manifest that was downloaded.\n */\n manifest: OciManifest;\n\n /**\n * The manifest stream that was downloaded.\n */\n manifestStream: NodeJS.ReadableStream;\n}\n\n/**\n * The result from downloading a blob from the registry.\n */\nexport interface DownloadBlobResult {\n /**\n * The blob's digest, calculated by the resgistry.\n */\n digest: string;\n\n /**\n * The blob content.\n */\n content: NodeJS.ReadableStream;\n}\n\n/**\n * The result from uploading a manifest to the registry.\n */\nexport interface UploadManifestResult {\n /**\n * The digest of the uploaded manifest, calculated by the registry.\n */\n digest: string;\n}\n\n/** Docker V2 image layer descriptor including config and layers. */\nexport interface OciBlobDescriptor {\n /** Layer media type */\n mediaType: string;\n /** Layer size */\n size: number;\n /** Layer digest */\n digest: string;\n /** Specifies a list of URIs from which this object may be downloaded. */\n urls?: string[];\n /** Additional information provided through arbitrary metadata. */\n annotations?: OciAnnotations;\n}\n\n/** Returns the requested OCI Manifest file. */\nexport interface OciManifest {\n /** Schema version */\n schemaVersion: number;\n /** V2 image config descriptor */\n config?: OciBlobDescriptor;\n /** List of V2 image layer information */\n layers?: OciBlobDescriptor[];\n /** Additional information provided through arbitrary metadata. */\n annotations?: OciAnnotations;\n}\n\n/** Additional information provided through arbitrary metadata */\nexport interface OciAnnotations {\n /** Date and time on which the image was built (string, date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6) */\n createdOn?: Date;\n /** Contact details of the people or organization responsible for the image. */\n authors?: string;\n /** URL to find more information on the image. */\n url?: string;\n /** URL to get documentation on the image. */\n documentation?: string;\n /** URL to get source code for building the image. */\n source?: string;\n /** Version of the packaged software. The version MAY match a label or tag in the source code repository, may also be Semantic versioning-compatible */\n version?: string;\n /** Source control revision identifier for the packaged software. */\n revision?: string;\n /** Name of the distributing entity, organization or individual. */\n vendor?: string;\n /** License(s) under which contained software is distributed as an SPDX License Expression. */\n licenses?: string;\n /** Name of the reference for a target. */\n name?: string;\n /** Human-readable title of the image */\n title?: string;\n /** Human-readable description of the software packaged in the image */\n description?: string;\n /** Additional properties */\n [additionalProperties: string]: unknown;\n}\n\n/**\n * Options for confguring the delete blob operation.\n */\nexport interface DeleteBlobOptions extends OperationOptions {}\n\n/**\n * Options for confguring the delete manifest operation.\n */\nexport interface DeleteManifestOptions extends OperationOptions {}\n\n/**\n * Options for configuring the upload blob operation.\n */\nexport interface UploadBlobOptions extends OperationOptions {}\n\n/**\n * Options for confguring the download blob operation.\n */\nexport interface DownloadBlobOptions extends OperationOptions {}\n\n/**\n * Options for confguring the download manifest operation.\n */\nexport interface DownloadManifestOptions extends OperationOptions {}\n"]}