@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.
- package/README.md +174 -4
- package/dist/index.js +366 -154
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/containerRegistryClient.js +15 -12
- package/dist-esm/src/containerRegistryClient.js.map +1 -1
- package/dist-esm/src/containerRepository.js +12 -5
- package/dist-esm/src/containerRepository.js.map +1 -1
- package/dist-esm/src/{blob/containerRegistryBlobClient.js → content/containerRegistryContentClient.js} +91 -58
- package/dist-esm/src/content/containerRegistryContentClient.js.map +1 -0
- package/dist-esm/src/{blob → content}/index.js +1 -1
- package/dist-esm/src/content/index.js.map +1 -0
- package/dist-esm/src/content/models.js +17 -0
- package/dist-esm/src/content/models.js.map +1 -0
- package/dist-esm/src/generated/generatedClient.js +28 -2
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +17 -0
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +7 -1
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistry.js +0 -14
- package/dist-esm/src/generated/operations/containerRegistry.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistryBlob.js +4 -8
- package/dist-esm/src/generated/operations/containerRegistryBlob.js.map +1 -1
- package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models.js +4 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/registryArtifact.js +12 -5
- package/dist-esm/src/registryArtifact.js.map +1 -1
- package/dist-esm/src/utils/helpers.js +30 -16
- package/dist-esm/src/utils/helpers.js.map +1 -1
- package/dist-esm/src/utils/retriableReadableStream.js +116 -0
- package/dist-esm/src/utils/retriableReadableStream.js.map +1 -0
- package/package.json +8 -5
- package/types/container-registry.d.ts +181 -145
- package/dist-esm/src/blob/containerRegistryBlobClient.js.map +0 -1
- package/dist-esm/src/blob/index.js.map +0 -1
- package/dist-esm/src/blob/models.js +0 -4
- package/dist-esm/src/blob/models.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var coreTracing = require('@azure/core-tracing');
|
|
|
11
11
|
var coreClient = require('@azure/core-client');
|
|
12
12
|
var crypto = require('crypto');
|
|
13
13
|
var stream = require('stream');
|
|
14
|
+
var abortController = require('@azure/abort-controller');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
@@ -1022,7 +1023,7 @@ const Annotations = {
|
|
|
1022
1023
|
className: "Annotations",
|
|
1023
1024
|
additionalProperties: { type: { name: "Object" } },
|
|
1024
1025
|
modelProperties: {
|
|
1025
|
-
|
|
1026
|
+
created: {
|
|
1026
1027
|
serializedName: "org\\.opencontainers\\.image\\.created",
|
|
1027
1028
|
type: {
|
|
1028
1029
|
name: "DateTime"
|
|
@@ -1589,6 +1590,12 @@ const ContainerRegistryGetManifestHeaders = {
|
|
|
1589
1590
|
type: {
|
|
1590
1591
|
name: "String"
|
|
1591
1592
|
}
|
|
1593
|
+
},
|
|
1594
|
+
mediaType: {
|
|
1595
|
+
serializedName: "content-type",
|
|
1596
|
+
type: {
|
|
1597
|
+
name: "String"
|
|
1598
|
+
}
|
|
1592
1599
|
}
|
|
1593
1600
|
}
|
|
1594
1601
|
}
|
|
@@ -2525,7 +2532,7 @@ class ContainerRegistryImpl {
|
|
|
2525
2532
|
}
|
|
2526
2533
|
}
|
|
2527
2534
|
// Operation Specifications
|
|
2528
|
-
const serializer$
|
|
2535
|
+
const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
2529
2536
|
const checkDockerV2SupportOperationSpec = {
|
|
2530
2537
|
path: "/v2/",
|
|
2531
2538
|
httpMethod: "GET",
|
|
@@ -2537,7 +2544,7 @@ const checkDockerV2SupportOperationSpec = {
|
|
|
2537
2544
|
},
|
|
2538
2545
|
urlParameters: [url],
|
|
2539
2546
|
headerParameters: [accept],
|
|
2540
|
-
serializer: serializer$
|
|
2547
|
+
serializer: serializer$2
|
|
2541
2548
|
};
|
|
2542
2549
|
const getManifestOperationSpec = {
|
|
2543
2550
|
path: "/v2/{name}/manifests/{reference}",
|
|
@@ -2556,7 +2563,7 @@ const getManifestOperationSpec = {
|
|
|
2556
2563
|
},
|
|
2557
2564
|
urlParameters: [url, name, reference],
|
|
2558
2565
|
headerParameters: [accept, accept1],
|
|
2559
|
-
serializer: serializer$
|
|
2566
|
+
serializer: serializer$2
|
|
2560
2567
|
};
|
|
2561
2568
|
const createManifestOperationSpec = {
|
|
2562
2569
|
path: "/v2/{name}/manifests/{reference}",
|
|
@@ -2573,7 +2580,7 @@ const createManifestOperationSpec = {
|
|
|
2573
2580
|
urlParameters: [url, name, reference],
|
|
2574
2581
|
headerParameters: [accept2, contentType],
|
|
2575
2582
|
mediaType: "binary",
|
|
2576
|
-
serializer: serializer$
|
|
2583
|
+
serializer: serializer$2
|
|
2577
2584
|
};
|
|
2578
2585
|
const deleteManifestOperationSpec = {
|
|
2579
2586
|
path: "/v2/{name}/manifests/{reference}",
|
|
@@ -2587,7 +2594,7 @@ const deleteManifestOperationSpec = {
|
|
|
2587
2594
|
},
|
|
2588
2595
|
urlParameters: [url, name, reference],
|
|
2589
2596
|
headerParameters: [accept],
|
|
2590
|
-
serializer: serializer$
|
|
2597
|
+
serializer: serializer$2
|
|
2591
2598
|
};
|
|
2592
2599
|
const getRepositoriesOperationSpec = {
|
|
2593
2600
|
path: "/acr/v1/_catalog",
|
|
@@ -2604,7 +2611,7 @@ const getRepositoriesOperationSpec = {
|
|
|
2604
2611
|
queryParameters: [last, n, apiVersion],
|
|
2605
2612
|
urlParameters: [url],
|
|
2606
2613
|
headerParameters: [accept],
|
|
2607
|
-
serializer: serializer$
|
|
2614
|
+
serializer: serializer$2
|
|
2608
2615
|
};
|
|
2609
2616
|
const getPropertiesOperationSpec = {
|
|
2610
2617
|
path: "/acr/v1/{name}",
|
|
@@ -2620,7 +2627,7 @@ const getPropertiesOperationSpec = {
|
|
|
2620
2627
|
queryParameters: [apiVersion],
|
|
2621
2628
|
urlParameters: [url, name],
|
|
2622
2629
|
headerParameters: [accept],
|
|
2623
|
-
serializer: serializer$
|
|
2630
|
+
serializer: serializer$2
|
|
2624
2631
|
};
|
|
2625
2632
|
const deleteRepositoryOperationSpec = {
|
|
2626
2633
|
path: "/acr/v1/{name}",
|
|
@@ -2635,7 +2642,7 @@ const deleteRepositoryOperationSpec = {
|
|
|
2635
2642
|
queryParameters: [apiVersion],
|
|
2636
2643
|
urlParameters: [url, name],
|
|
2637
2644
|
headerParameters: [accept],
|
|
2638
|
-
serializer: serializer$
|
|
2645
|
+
serializer: serializer$2
|
|
2639
2646
|
};
|
|
2640
2647
|
const updatePropertiesOperationSpec = {
|
|
2641
2648
|
path: "/acr/v1/{name}",
|
|
@@ -2653,7 +2660,7 @@ const updatePropertiesOperationSpec = {
|
|
|
2653
2660
|
urlParameters: [url, name],
|
|
2654
2661
|
headerParameters: [accept, contentType1],
|
|
2655
2662
|
mediaType: "json",
|
|
2656
|
-
serializer: serializer$
|
|
2663
|
+
serializer: serializer$2
|
|
2657
2664
|
};
|
|
2658
2665
|
const getTagsOperationSpec = {
|
|
2659
2666
|
path: "/acr/v1/{name}/_tags",
|
|
@@ -2676,7 +2683,7 @@ const getTagsOperationSpec = {
|
|
|
2676
2683
|
],
|
|
2677
2684
|
urlParameters: [url, name],
|
|
2678
2685
|
headerParameters: [accept],
|
|
2679
|
-
serializer: serializer$
|
|
2686
|
+
serializer: serializer$2
|
|
2680
2687
|
};
|
|
2681
2688
|
const getTagPropertiesOperationSpec = {
|
|
2682
2689
|
path: "/acr/v1/{name}/_tags/{reference}",
|
|
@@ -2692,7 +2699,7 @@ const getTagPropertiesOperationSpec = {
|
|
|
2692
2699
|
queryParameters: [apiVersion],
|
|
2693
2700
|
urlParameters: [url, name, reference],
|
|
2694
2701
|
headerParameters: [accept],
|
|
2695
|
-
serializer: serializer$
|
|
2702
|
+
serializer: serializer$2
|
|
2696
2703
|
};
|
|
2697
2704
|
const updateTagAttributesOperationSpec = {
|
|
2698
2705
|
path: "/acr/v1/{name}/_tags/{reference}",
|
|
@@ -2710,7 +2717,7 @@ const updateTagAttributesOperationSpec = {
|
|
|
2710
2717
|
urlParameters: [url, name, reference],
|
|
2711
2718
|
headerParameters: [accept, contentType1],
|
|
2712
2719
|
mediaType: "json",
|
|
2713
|
-
serializer: serializer$
|
|
2720
|
+
serializer: serializer$2
|
|
2714
2721
|
};
|
|
2715
2722
|
const deleteTagOperationSpec = {
|
|
2716
2723
|
path: "/acr/v1/{name}/_tags/{reference}",
|
|
@@ -2725,7 +2732,7 @@ const deleteTagOperationSpec = {
|
|
|
2725
2732
|
queryParameters: [apiVersion],
|
|
2726
2733
|
urlParameters: [url, name, reference],
|
|
2727
2734
|
headerParameters: [accept],
|
|
2728
|
-
serializer: serializer$
|
|
2735
|
+
serializer: serializer$2
|
|
2729
2736
|
};
|
|
2730
2737
|
const getManifestsOperationSpec = {
|
|
2731
2738
|
path: "/acr/v1/{name}/_manifests",
|
|
@@ -2747,7 +2754,7 @@ const getManifestsOperationSpec = {
|
|
|
2747
2754
|
],
|
|
2748
2755
|
urlParameters: [url, name],
|
|
2749
2756
|
headerParameters: [accept],
|
|
2750
|
-
serializer: serializer$
|
|
2757
|
+
serializer: serializer$2
|
|
2751
2758
|
};
|
|
2752
2759
|
const getManifestPropertiesOperationSpec = {
|
|
2753
2760
|
path: "/acr/v1/{name}/_manifests/{digest}",
|
|
@@ -2763,7 +2770,7 @@ const getManifestPropertiesOperationSpec = {
|
|
|
2763
2770
|
queryParameters: [apiVersion],
|
|
2764
2771
|
urlParameters: [url, name, digest1],
|
|
2765
2772
|
headerParameters: [accept],
|
|
2766
|
-
serializer: serializer$
|
|
2773
|
+
serializer: serializer$2
|
|
2767
2774
|
};
|
|
2768
2775
|
const updateManifestPropertiesOperationSpec = {
|
|
2769
2776
|
path: "/acr/v1/{name}/_manifests/{digest}",
|
|
@@ -2781,7 +2788,7 @@ const updateManifestPropertiesOperationSpec = {
|
|
|
2781
2788
|
urlParameters: [url, name, digest1],
|
|
2782
2789
|
headerParameters: [accept, contentType1],
|
|
2783
2790
|
mediaType: "json",
|
|
2784
|
-
serializer: serializer$
|
|
2791
|
+
serializer: serializer$2
|
|
2785
2792
|
};
|
|
2786
2793
|
const getRepositoriesNextOperationSpec = {
|
|
2787
2794
|
path: "{nextLink}",
|
|
@@ -2795,10 +2802,9 @@ const getRepositoriesNextOperationSpec = {
|
|
|
2795
2802
|
bodyMapper: AcrErrors
|
|
2796
2803
|
}
|
|
2797
2804
|
},
|
|
2798
|
-
queryParameters: [last, n, apiVersion],
|
|
2799
2805
|
urlParameters: [url, nextLink],
|
|
2800
2806
|
headerParameters: [accept],
|
|
2801
|
-
serializer: serializer$
|
|
2807
|
+
serializer: serializer$2
|
|
2802
2808
|
};
|
|
2803
2809
|
const getTagsNextOperationSpec = {
|
|
2804
2810
|
path: "{nextLink}",
|
|
@@ -2812,16 +2818,9 @@ const getTagsNextOperationSpec = {
|
|
|
2812
2818
|
bodyMapper: AcrErrors
|
|
2813
2819
|
}
|
|
2814
2820
|
},
|
|
2815
|
-
queryParameters: [
|
|
2816
|
-
last,
|
|
2817
|
-
n,
|
|
2818
|
-
apiVersion,
|
|
2819
|
-
orderby,
|
|
2820
|
-
digest
|
|
2821
|
-
],
|
|
2822
2821
|
urlParameters: [url, name, nextLink],
|
|
2823
2822
|
headerParameters: [accept],
|
|
2824
|
-
serializer: serializer$
|
|
2823
|
+
serializer: serializer$2
|
|
2825
2824
|
};
|
|
2826
2825
|
const getManifestsNextOperationSpec = {
|
|
2827
2826
|
path: "{nextLink}",
|
|
@@ -2835,15 +2834,9 @@ const getManifestsNextOperationSpec = {
|
|
|
2835
2834
|
bodyMapper: AcrErrors
|
|
2836
2835
|
}
|
|
2837
2836
|
},
|
|
2838
|
-
queryParameters: [
|
|
2839
|
-
last,
|
|
2840
|
-
n,
|
|
2841
|
-
apiVersion,
|
|
2842
|
-
orderby
|
|
2843
|
-
],
|
|
2844
2837
|
urlParameters: [url, name, nextLink],
|
|
2845
2838
|
headerParameters: [accept],
|
|
2846
|
-
serializer: serializer$
|
|
2839
|
+
serializer: serializer$2
|
|
2847
2840
|
};
|
|
2848
2841
|
|
|
2849
2842
|
/*
|
|
@@ -2892,12 +2885,12 @@ class ContainerRegistryBlobImpl {
|
|
|
2892
2885
|
/**
|
|
2893
2886
|
* Mount a blob identified by the `mount` parameter from another repository.
|
|
2894
2887
|
* @param name Name of the image (including the namespace)
|
|
2895
|
-
* @param mount Digest of blob to mount from the source repository.
|
|
2896
2888
|
* @param fromParam Name of the source repository.
|
|
2889
|
+
* @param mount Digest of blob to mount from the source repository.
|
|
2897
2890
|
* @param options The options parameters.
|
|
2898
2891
|
*/
|
|
2899
|
-
mountBlob(name,
|
|
2900
|
-
return this.client.sendOperationRequest({ name,
|
|
2892
|
+
mountBlob(name, fromParam, mount, options) {
|
|
2893
|
+
return this.client.sendOperationRequest({ name, fromParam, mount, options }, mountBlobOperationSpec);
|
|
2901
2894
|
}
|
|
2902
2895
|
/**
|
|
2903
2896
|
* Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the
|
|
@@ -2972,7 +2965,7 @@ class ContainerRegistryBlobImpl {
|
|
|
2972
2965
|
}
|
|
2973
2966
|
}
|
|
2974
2967
|
// Operation Specifications
|
|
2975
|
-
const serializer$
|
|
2968
|
+
const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
2976
2969
|
const getBlobOperationSpec = {
|
|
2977
2970
|
path: "/v2/{name}/blobs/{digest}",
|
|
2978
2971
|
httpMethod: "GET",
|
|
@@ -2991,7 +2984,7 @@ const getBlobOperationSpec = {
|
|
|
2991
2984
|
},
|
|
2992
2985
|
urlParameters: [url, name, digest1],
|
|
2993
2986
|
headerParameters: [accept3],
|
|
2994
|
-
serializer: serializer$
|
|
2987
|
+
serializer: serializer$1
|
|
2995
2988
|
};
|
|
2996
2989
|
const checkBlobExistsOperationSpec = {
|
|
2997
2990
|
path: "/v2/{name}/blobs/{digest}",
|
|
@@ -3009,24 +3002,20 @@ const checkBlobExistsOperationSpec = {
|
|
|
3009
3002
|
},
|
|
3010
3003
|
urlParameters: [url, name, digest1],
|
|
3011
3004
|
headerParameters: [accept],
|
|
3012
|
-
serializer: serializer$
|
|
3005
|
+
serializer: serializer$1
|
|
3013
3006
|
};
|
|
3014
3007
|
const deleteBlobOperationSpec = {
|
|
3015
3008
|
path: "/v2/{name}/blobs/{digest}",
|
|
3016
3009
|
httpMethod: "DELETE",
|
|
3017
3010
|
responses: {
|
|
3018
3011
|
202: {
|
|
3019
|
-
bodyMapper: {
|
|
3020
|
-
type: { name: "Stream" },
|
|
3021
|
-
serializedName: "parsedResponse"
|
|
3022
|
-
},
|
|
3023
3012
|
headersMapper: ContainerRegistryBlobDeleteBlobHeaders
|
|
3024
3013
|
},
|
|
3014
|
+
404: {},
|
|
3025
3015
|
default: {}
|
|
3026
3016
|
},
|
|
3027
3017
|
urlParameters: [url, name, digest1],
|
|
3028
|
-
|
|
3029
|
-
serializer: serializer$2
|
|
3018
|
+
serializer: serializer$1
|
|
3030
3019
|
};
|
|
3031
3020
|
const mountBlobOperationSpec = {
|
|
3032
3021
|
path: "/v2/{name}/blobs/uploads/",
|
|
@@ -3042,7 +3031,7 @@ const mountBlobOperationSpec = {
|
|
|
3042
3031
|
queryParameters: [fromParam, mount],
|
|
3043
3032
|
urlParameters: [url, name],
|
|
3044
3033
|
headerParameters: [accept],
|
|
3045
|
-
serializer: serializer$
|
|
3034
|
+
serializer: serializer$1
|
|
3046
3035
|
};
|
|
3047
3036
|
const getUploadStatusOperationSpec = {
|
|
3048
3037
|
path: "/{nextBlobUuidLink}",
|
|
@@ -3057,7 +3046,7 @@ const getUploadStatusOperationSpec = {
|
|
|
3057
3046
|
},
|
|
3058
3047
|
urlParameters: [url, nextLink1],
|
|
3059
3048
|
headerParameters: [accept],
|
|
3060
|
-
serializer: serializer$
|
|
3049
|
+
serializer: serializer$1
|
|
3061
3050
|
};
|
|
3062
3051
|
const uploadChunkOperationSpec = {
|
|
3063
3052
|
path: "/{nextBlobUuidLink}",
|
|
@@ -3074,7 +3063,7 @@ const uploadChunkOperationSpec = {
|
|
|
3074
3063
|
urlParameters: [url, nextLink1],
|
|
3075
3064
|
headerParameters: [accept2, contentType2],
|
|
3076
3065
|
mediaType: "binary",
|
|
3077
|
-
serializer: serializer$
|
|
3066
|
+
serializer: serializer$1
|
|
3078
3067
|
};
|
|
3079
3068
|
const completeUploadOperationSpec = {
|
|
3080
3069
|
path: "/{nextBlobUuidLink}",
|
|
@@ -3092,7 +3081,7 @@ const completeUploadOperationSpec = {
|
|
|
3092
3081
|
urlParameters: [url, nextLink1],
|
|
3093
3082
|
headerParameters: [accept2, contentType2],
|
|
3094
3083
|
mediaType: "binary",
|
|
3095
|
-
serializer: serializer$
|
|
3084
|
+
serializer: serializer$1
|
|
3096
3085
|
};
|
|
3097
3086
|
const cancelUploadOperationSpec = {
|
|
3098
3087
|
path: "/{nextBlobUuidLink}",
|
|
@@ -3105,7 +3094,7 @@ const cancelUploadOperationSpec = {
|
|
|
3105
3094
|
},
|
|
3106
3095
|
urlParameters: [url, nextLink1],
|
|
3107
3096
|
headerParameters: [accept],
|
|
3108
|
-
serializer: serializer$
|
|
3097
|
+
serializer: serializer$1
|
|
3109
3098
|
};
|
|
3110
3099
|
const startUploadOperationSpec = {
|
|
3111
3100
|
path: "/v2/{name}/blobs/uploads/",
|
|
@@ -3120,7 +3109,7 @@ const startUploadOperationSpec = {
|
|
|
3120
3109
|
},
|
|
3121
3110
|
urlParameters: [url, name],
|
|
3122
3111
|
headerParameters: [accept],
|
|
3123
|
-
serializer: serializer$
|
|
3112
|
+
serializer: serializer$1
|
|
3124
3113
|
};
|
|
3125
3114
|
const getChunkOperationSpec = {
|
|
3126
3115
|
path: "/v2/{name}/blobs/{digest}",
|
|
@@ -3137,7 +3126,7 @@ const getChunkOperationSpec = {
|
|
|
3137
3126
|
},
|
|
3138
3127
|
urlParameters: [url, name, digest1],
|
|
3139
3128
|
headerParameters: [accept3, range],
|
|
3140
|
-
serializer: serializer$
|
|
3129
|
+
serializer: serializer$1
|
|
3141
3130
|
};
|
|
3142
3131
|
const checkChunkExistsOperationSpec = {
|
|
3143
3132
|
path: "/v2/{name}/blobs/{digest}",
|
|
@@ -3152,7 +3141,7 @@ const checkChunkExistsOperationSpec = {
|
|
|
3152
3141
|
},
|
|
3153
3142
|
urlParameters: [url, name, digest1],
|
|
3154
3143
|
headerParameters: [accept, range],
|
|
3155
|
-
serializer: serializer$
|
|
3144
|
+
serializer: serializer$1
|
|
3156
3145
|
};
|
|
3157
3146
|
|
|
3158
3147
|
/*
|
|
@@ -3194,7 +3183,7 @@ class AuthenticationImpl {
|
|
|
3194
3183
|
}
|
|
3195
3184
|
}
|
|
3196
3185
|
// Operation Specifications
|
|
3197
|
-
const serializer
|
|
3186
|
+
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
3198
3187
|
const exchangeAadAccessTokenForAcrRefreshTokenOperationSpec = {
|
|
3199
3188
|
path: "/oauth2/exchange",
|
|
3200
3189
|
httpMethod: "POST",
|
|
@@ -3216,7 +3205,7 @@ const exchangeAadAccessTokenForAcrRefreshTokenOperationSpec = {
|
|
|
3216
3205
|
queryParameters: [apiVersion],
|
|
3217
3206
|
urlParameters: [url],
|
|
3218
3207
|
headerParameters: [contentType3, accept4],
|
|
3219
|
-
serializer
|
|
3208
|
+
serializer
|
|
3220
3209
|
};
|
|
3221
3210
|
const exchangeAcrRefreshTokenForAcrAccessTokenOperationSpec = {
|
|
3222
3211
|
path: "/oauth2/token",
|
|
@@ -3238,7 +3227,7 @@ const exchangeAcrRefreshTokenForAcrAccessTokenOperationSpec = {
|
|
|
3238
3227
|
queryParameters: [apiVersion],
|
|
3239
3228
|
urlParameters: [url],
|
|
3240
3229
|
headerParameters: [contentType3, accept4],
|
|
3241
|
-
serializer
|
|
3230
|
+
serializer
|
|
3242
3231
|
};
|
|
3243
3232
|
|
|
3244
3233
|
/*
|
|
@@ -3271,13 +3260,13 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
|
3271
3260
|
const defaults = {
|
|
3272
3261
|
requestContentType: "application/json; charset=utf-8"
|
|
3273
3262
|
};
|
|
3274
|
-
const packageDetails = `azsdk-js-container-registry/1.1.0-beta.
|
|
3263
|
+
const packageDetails = `azsdk-js-container-registry/1.1.0-beta.4`;
|
|
3275
3264
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
3276
3265
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
3277
3266
|
: `${packageDetails}`;
|
|
3278
3267
|
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
3279
3268
|
userAgentPrefix
|
|
3280
|
-
},
|
|
3269
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{url}" });
|
|
3281
3270
|
super(optionsWithDefaults);
|
|
3282
3271
|
// Parameter assignments
|
|
3283
3272
|
this.url = url;
|
|
@@ -3285,12 +3274,38 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
|
3285
3274
|
this.containerRegistry = new ContainerRegistryImpl(this);
|
|
3286
3275
|
this.containerRegistryBlob = new ContainerRegistryBlobImpl(this);
|
|
3287
3276
|
this.authentication = new AuthenticationImpl(this);
|
|
3277
|
+
this.addCustomApiVersionPolicy(apiVersion);
|
|
3278
|
+
}
|
|
3279
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
3280
|
+
addCustomApiVersionPolicy(apiVersion) {
|
|
3281
|
+
if (!apiVersion) {
|
|
3282
|
+
return;
|
|
3283
|
+
}
|
|
3284
|
+
const apiVersionPolicy = {
|
|
3285
|
+
name: "CustomApiVersionPolicy",
|
|
3286
|
+
async sendRequest(request, next) {
|
|
3287
|
+
const param = request.url.split("?");
|
|
3288
|
+
if (param.length > 1) {
|
|
3289
|
+
const newParams = param[1].split("&").map((item) => {
|
|
3290
|
+
if (item.indexOf("api-version") > -1) {
|
|
3291
|
+
return "api-version=" + apiVersion;
|
|
3292
|
+
}
|
|
3293
|
+
else {
|
|
3294
|
+
return item;
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
3298
|
+
}
|
|
3299
|
+
return next(request);
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
3288
3303
|
}
|
|
3289
3304
|
}
|
|
3290
3305
|
|
|
3291
3306
|
// Copyright (c) Microsoft Corporation.
|
|
3292
3307
|
// Licensed under the MIT license.
|
|
3293
|
-
const SDK_VERSION = "1.1.0
|
|
3308
|
+
const SDK_VERSION = "1.1.0";
|
|
3294
3309
|
|
|
3295
3310
|
// Copyright (c) Microsoft Corporation.
|
|
3296
3311
|
/** @internal */
|
|
@@ -3318,40 +3333,54 @@ function extractNextLink(value) {
|
|
|
3318
3333
|
function isDigest(tagOrDigest) {
|
|
3319
3334
|
return tagOrDigest.includes(":");
|
|
3320
3335
|
}
|
|
3321
|
-
async function readStreamToEnd(stream) {
|
|
3336
|
+
async function readStreamToEnd(stream, maxLength) {
|
|
3322
3337
|
const buffers = [];
|
|
3338
|
+
let bytesRead = 0;
|
|
3323
3339
|
return new Promise((resolve, reject) => {
|
|
3324
|
-
stream.on("data", (chunk) =>
|
|
3340
|
+
stream.on("data", (chunk) => {
|
|
3341
|
+
buffers.push(chunk);
|
|
3342
|
+
bytesRead += chunk.length;
|
|
3343
|
+
if (maxLength && bytesRead > maxLength) {
|
|
3344
|
+
reject(new Error(`Stream exceeded maximum allowed length of ${maxLength} bytes.`));
|
|
3345
|
+
}
|
|
3346
|
+
});
|
|
3325
3347
|
stream.on("end", () => resolve(Buffer.concat(buffers)));
|
|
3326
3348
|
stream.on("error", (err) => reject(err));
|
|
3327
3349
|
});
|
|
3328
3350
|
}
|
|
3329
3351
|
function readChunksFromStream(stream, chunkSize) {
|
|
3330
3352
|
return tslib.__asyncGenerator(this, arguments, function* readChunksFromStream_1() {
|
|
3331
|
-
var e_1,
|
|
3353
|
+
var _a, e_1, _b, _c;
|
|
3332
3354
|
let chunk = Buffer.alloc(chunkSize);
|
|
3333
3355
|
let chunkCursor = 0;
|
|
3334
3356
|
try {
|
|
3335
|
-
for (var stream_1 = tslib.__asyncValues(stream), stream_1_1; stream_1_1 = yield tslib.__await(stream_1.next()),
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
const
|
|
3341
|
-
dataCursor
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
chunkCursor
|
|
3346
|
-
|
|
3357
|
+
for (var _d = true, stream_1 = tslib.__asyncValues(stream), stream_1_1; stream_1_1 = yield tslib.__await(stream_1.next()), _a = stream_1_1.done, !_a;) {
|
|
3358
|
+
_c = stream_1_1.value;
|
|
3359
|
+
_d = false;
|
|
3360
|
+
try {
|
|
3361
|
+
const data = _c;
|
|
3362
|
+
const dataAsBuffer = Buffer.isBuffer(data) ? data : Buffer.from(data, "utf8");
|
|
3363
|
+
let dataCursor = 0;
|
|
3364
|
+
while (dataCursor < dataAsBuffer.length) {
|
|
3365
|
+
const bytesCopied = dataAsBuffer.copy(chunk, chunkCursor, dataCursor);
|
|
3366
|
+
dataCursor += bytesCopied;
|
|
3367
|
+
chunkCursor += bytesCopied;
|
|
3368
|
+
if (chunkCursor >= chunkSize) {
|
|
3369
|
+
yield yield tslib.__await(chunk);
|
|
3370
|
+
chunkCursor = 0;
|
|
3371
|
+
chunk = Buffer.alloc(chunkSize);
|
|
3372
|
+
}
|
|
3347
3373
|
}
|
|
3348
3374
|
}
|
|
3375
|
+
finally {
|
|
3376
|
+
_d = true;
|
|
3377
|
+
}
|
|
3349
3378
|
}
|
|
3350
3379
|
}
|
|
3351
3380
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3352
3381
|
finally {
|
|
3353
3382
|
try {
|
|
3354
|
-
if (
|
|
3383
|
+
if (!_d && !_a && (_b = stream_1.return)) yield tslib.__await(_b.call(stream_1));
|
|
3355
3384
|
}
|
|
3356
3385
|
finally { if (e_1) throw e_1.error; }
|
|
3357
3386
|
}
|
|
@@ -3843,17 +3872,24 @@ class RegistryArtifactImpl {
|
|
|
3843
3872
|
}
|
|
3844
3873
|
listTagsItems(options = {}) {
|
|
3845
3874
|
return tslib.__asyncGenerator(this, arguments, function* listTagsItems_1() {
|
|
3846
|
-
var e_1,
|
|
3875
|
+
var _a, e_1, _b, _c;
|
|
3847
3876
|
try {
|
|
3848
|
-
for (var
|
|
3849
|
-
|
|
3850
|
-
|
|
3877
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listTagsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
3878
|
+
_c = _f.value;
|
|
3879
|
+
_d = false;
|
|
3880
|
+
try {
|
|
3881
|
+
const page = _c;
|
|
3882
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
3883
|
+
}
|
|
3884
|
+
finally {
|
|
3885
|
+
_d = true;
|
|
3886
|
+
}
|
|
3851
3887
|
}
|
|
3852
3888
|
}
|
|
3853
3889
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3854
3890
|
finally {
|
|
3855
3891
|
try {
|
|
3856
|
-
if (
|
|
3892
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
3857
3893
|
}
|
|
3858
3894
|
finally { if (e_1) throw e_1.error; }
|
|
3859
3895
|
}
|
|
@@ -4025,17 +4061,24 @@ class ContainerRepositoryImpl {
|
|
|
4025
4061
|
}
|
|
4026
4062
|
listManifestsItems(options = {}) {
|
|
4027
4063
|
return tslib.__asyncGenerator(this, arguments, function* listManifestsItems_1() {
|
|
4028
|
-
var e_1,
|
|
4064
|
+
var _a, e_1, _b, _c;
|
|
4029
4065
|
try {
|
|
4030
|
-
for (var
|
|
4031
|
-
|
|
4032
|
-
|
|
4066
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listManifestsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
4067
|
+
_c = _f.value;
|
|
4068
|
+
_d = false;
|
|
4069
|
+
try {
|
|
4070
|
+
const page = _c;
|
|
4071
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
4072
|
+
}
|
|
4073
|
+
finally {
|
|
4074
|
+
_d = true;
|
|
4075
|
+
}
|
|
4033
4076
|
}
|
|
4034
4077
|
}
|
|
4035
4078
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4036
4079
|
finally {
|
|
4037
4080
|
try {
|
|
4038
|
-
if (
|
|
4081
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
4039
4082
|
}
|
|
4040
4083
|
finally { if (e_1) throw e_1.error; }
|
|
4041
4084
|
}
|
|
@@ -4147,7 +4190,7 @@ const LATEST_API_VERSION$1 = "2021-07-01";
|
|
|
4147
4190
|
*/
|
|
4148
4191
|
class ContainerRegistryClient {
|
|
4149
4192
|
constructor(endpoint, credentialOrOptions, clientOptions = {}) {
|
|
4150
|
-
var _a;
|
|
4193
|
+
var _a, _b;
|
|
4151
4194
|
if (!endpoint) {
|
|
4152
4195
|
throw new Error("invalid endpoint");
|
|
4153
4196
|
}
|
|
@@ -4167,12 +4210,8 @@ class ContainerRegistryClient {
|
|
|
4167
4210
|
// included as safe. Unknown/unsafe headers are logged as "<REDACTED>".
|
|
4168
4211
|
additionalAllowedQueryParameters: ["last", "n", "orderby", "digest"],
|
|
4169
4212
|
} });
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
throw new Error("ContainerRegistryClientOptions.audience must be set to initialize ContainerRegistryClient.");
|
|
4173
|
-
}
|
|
4174
|
-
const defaultScope = `${options.audience}/.default`;
|
|
4175
|
-
const serviceVersion = (_a = options.serviceVersion) !== null && _a !== void 0 ? _a : LATEST_API_VERSION$1;
|
|
4213
|
+
const defaultScope = `${(_a = options.audience) !== null && _a !== void 0 ? _a : "https://containerregistry.azure.net"}/.default`;
|
|
4214
|
+
const serviceVersion = (_b = options.serviceVersion) !== null && _b !== void 0 ? _b : LATEST_API_VERSION$1;
|
|
4176
4215
|
const authClient = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);
|
|
4177
4216
|
this.client = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);
|
|
4178
4217
|
this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
@@ -4275,17 +4314,24 @@ class ContainerRegistryClient {
|
|
|
4275
4314
|
}
|
|
4276
4315
|
listRepositoryItems(options = {}) {
|
|
4277
4316
|
return tslib.__asyncGenerator(this, arguments, function* listRepositoryItems_1() {
|
|
4278
|
-
var e_1,
|
|
4317
|
+
var _a, e_1, _b, _c;
|
|
4279
4318
|
try {
|
|
4280
|
-
for (var
|
|
4281
|
-
|
|
4282
|
-
|
|
4319
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listRepositoriesPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
4320
|
+
_c = _f.value;
|
|
4321
|
+
_d = false;
|
|
4322
|
+
try {
|
|
4323
|
+
const page = _c;
|
|
4324
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
4325
|
+
}
|
|
4326
|
+
finally {
|
|
4327
|
+
_d = true;
|
|
4328
|
+
}
|
|
4283
4329
|
}
|
|
4284
4330
|
}
|
|
4285
4331
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4286
4332
|
finally {
|
|
4287
4333
|
try {
|
|
4288
|
-
if (
|
|
4334
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
4289
4335
|
}
|
|
4290
4336
|
finally { if (e_1) throw e_1.error; }
|
|
4291
4337
|
}
|
|
@@ -4329,7 +4375,10 @@ exports.KnownContainerRegistryAudience = void 0;
|
|
|
4329
4375
|
(function (KnownContainerRegistryAudience) {
|
|
4330
4376
|
/** Azure China */
|
|
4331
4377
|
KnownContainerRegistryAudience["AzureResourceManagerChina"] = "https://management.chinacloudapi.cn";
|
|
4332
|
-
/**
|
|
4378
|
+
/**
|
|
4379
|
+
* Azure Germany
|
|
4380
|
+
* @deprecated Azure Germany is being deprecated in favor of standard nonsovereign Azure regions in Germany.
|
|
4381
|
+
*/
|
|
4333
4382
|
KnownContainerRegistryAudience["AzureResourceManagerGermany"] = "https://management.microsoftazure.de";
|
|
4334
4383
|
/** Azure Government */
|
|
4335
4384
|
KnownContainerRegistryAudience["AzureResourceManagerGovernment"] = "https://management.usgovcloudapi.net";
|
|
@@ -4403,6 +4452,23 @@ exports.KnownArtifactOperatingSystem = void 0;
|
|
|
4403
4452
|
KnownArtifactOperatingSystem["Windows"] = "windows";
|
|
4404
4453
|
})(exports.KnownArtifactOperatingSystem || (exports.KnownArtifactOperatingSystem = {}));
|
|
4405
4454
|
|
|
4455
|
+
// Copyright (c) Microsoft Corporation.
|
|
4456
|
+
// Licensed under the MIT license.
|
|
4457
|
+
/**
|
|
4458
|
+
* Known media type values for Docker and OCI manifests.
|
|
4459
|
+
*/
|
|
4460
|
+
exports.KnownManifestMediaType = void 0;
|
|
4461
|
+
(function (KnownManifestMediaType) {
|
|
4462
|
+
/**
|
|
4463
|
+
* The media type for an OCI image manifest. This format is described at https://github.com/opencontainers/image-spec/blob/main/manifest.md.
|
|
4464
|
+
*/
|
|
4465
|
+
KnownManifestMediaType["OciImageManifest"] = "application/vnd.oci.image.manifest.v1+json";
|
|
4466
|
+
/**
|
|
4467
|
+
* 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/.
|
|
4468
|
+
*/
|
|
4469
|
+
KnownManifestMediaType["DockerManifest"] = "application/vnd.docker.distribution.manifest.v2+json";
|
|
4470
|
+
})(exports.KnownManifestMediaType || (exports.KnownManifestMediaType = {}));
|
|
4471
|
+
|
|
4406
4472
|
// Copyright (c) Microsoft Corporation.
|
|
4407
4473
|
function calculateDigest(bufferOrStream) {
|
|
4408
4474
|
const hash = crypto__default["default"].createHash("sha256");
|
|
@@ -4421,13 +4487,130 @@ function calculateDigest(bufferOrStream) {
|
|
|
4421
4487
|
}
|
|
4422
4488
|
}
|
|
4423
4489
|
|
|
4490
|
+
// Copyright (c) Microsoft Corporation.
|
|
4491
|
+
/**
|
|
4492
|
+
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
|
4493
|
+
*
|
|
4494
|
+
* A Node.js ReadableStream will internally retry when internal ReadableStream unexpected ends.
|
|
4495
|
+
*/
|
|
4496
|
+
class RetriableReadableStream extends stream.Readable {
|
|
4497
|
+
/**
|
|
4498
|
+
* Creates an instance of RetriableReadableStream.
|
|
4499
|
+
*
|
|
4500
|
+
* @param source - The current ReadableStream returned from getter
|
|
4501
|
+
* @param getter - A method calling downloading request returning
|
|
4502
|
+
* a new ReadableStream from specified offset
|
|
4503
|
+
* @param offset - Offset position in original data source to read
|
|
4504
|
+
* @param count - How much data in original data source to read
|
|
4505
|
+
* @param options -
|
|
4506
|
+
*/
|
|
4507
|
+
constructor(source, getter, offset, count, options = {}) {
|
|
4508
|
+
super({ highWaterMark: options.highWaterMark });
|
|
4509
|
+
this.source = source;
|
|
4510
|
+
this.getter = getter;
|
|
4511
|
+
this.offset = offset;
|
|
4512
|
+
this.retries = 0;
|
|
4513
|
+
this.sourceDataHandler = (data) => {
|
|
4514
|
+
var _a, _b;
|
|
4515
|
+
if (this.options.doInjectErrorOnce) {
|
|
4516
|
+
this.options.doInjectErrorOnce = undefined;
|
|
4517
|
+
this.source.pause();
|
|
4518
|
+
this.sourceErrorOrEndHandler();
|
|
4519
|
+
this.source.destroy();
|
|
4520
|
+
return;
|
|
4521
|
+
}
|
|
4522
|
+
this.offset += data.length;
|
|
4523
|
+
if (this.offset > this.end + 1) {
|
|
4524
|
+
this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`));
|
|
4525
|
+
}
|
|
4526
|
+
(_a = this.onData) === null || _a === void 0 ? void 0 : _a.call(this, data);
|
|
4527
|
+
(_b = this.onProgress) === null || _b === void 0 ? void 0 : _b.call(this, { loadedBytes: this.offset - this.start });
|
|
4528
|
+
if (!this.push(data)) {
|
|
4529
|
+
this.source.pause();
|
|
4530
|
+
}
|
|
4531
|
+
};
|
|
4532
|
+
this.sourceAbortedHandler = () => {
|
|
4533
|
+
const abortError = new abortController.AbortError("The operation was aborted.");
|
|
4534
|
+
this.destroy(abortError);
|
|
4535
|
+
};
|
|
4536
|
+
this.sourceErrorOrEndHandler = (err) => {
|
|
4537
|
+
var _a;
|
|
4538
|
+
if (err && err.name === "AbortError") {
|
|
4539
|
+
this.destroy(err);
|
|
4540
|
+
return;
|
|
4541
|
+
}
|
|
4542
|
+
this.removeSourceEventHandlers();
|
|
4543
|
+
if (this.offset - 1 === this.end) {
|
|
4544
|
+
(_a = this.onEnd) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
4545
|
+
this.push(null);
|
|
4546
|
+
}
|
|
4547
|
+
else if (this.offset <= this.end) {
|
|
4548
|
+
if (this.retries < this.maxRetryRequests) {
|
|
4549
|
+
this.retries += 1;
|
|
4550
|
+
this.getter(this.offset)
|
|
4551
|
+
.then((newSource) => {
|
|
4552
|
+
this.source = newSource;
|
|
4553
|
+
this.setSourceEventHandlers();
|
|
4554
|
+
return;
|
|
4555
|
+
})
|
|
4556
|
+
.catch((error) => {
|
|
4557
|
+
this.destroy(error);
|
|
4558
|
+
});
|
|
4559
|
+
}
|
|
4560
|
+
else {
|
|
4561
|
+
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
else {
|
|
4565
|
+
this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`));
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
this.getter = getter;
|
|
4569
|
+
this.start = offset;
|
|
4570
|
+
this.end = offset + count - 1;
|
|
4571
|
+
this.maxRetryRequests =
|
|
4572
|
+
options.maxRetryRequests && options.maxRetryRequests >= 0 ? options.maxRetryRequests : 0;
|
|
4573
|
+
this.onData = options.onData;
|
|
4574
|
+
this.onEnd = options.onEnd;
|
|
4575
|
+
this.onProgress = options.onProgress;
|
|
4576
|
+
this.options = options;
|
|
4577
|
+
this.setSourceEventHandlers();
|
|
4578
|
+
}
|
|
4579
|
+
_read() {
|
|
4580
|
+
this.source.resume();
|
|
4581
|
+
}
|
|
4582
|
+
setSourceEventHandlers() {
|
|
4583
|
+
this.source.on("data", this.sourceDataHandler);
|
|
4584
|
+
this.source.on("end", this.sourceErrorOrEndHandler);
|
|
4585
|
+
this.source.on("error", this.sourceErrorOrEndHandler);
|
|
4586
|
+
// needed for Node14
|
|
4587
|
+
this.source.on("aborted", this.sourceAbortedHandler);
|
|
4588
|
+
}
|
|
4589
|
+
removeSourceEventHandlers() {
|
|
4590
|
+
this.source.removeListener("data", this.sourceDataHandler);
|
|
4591
|
+
this.source.removeListener("end", this.sourceErrorOrEndHandler);
|
|
4592
|
+
this.source.removeListener("error", this.sourceErrorOrEndHandler);
|
|
4593
|
+
this.source.removeListener("aborted", this.sourceAbortedHandler);
|
|
4594
|
+
}
|
|
4595
|
+
_destroy(error, callback) {
|
|
4596
|
+
// remove listener from source and release source
|
|
4597
|
+
this.removeSourceEventHandlers();
|
|
4598
|
+
this.source.destroy();
|
|
4599
|
+
callback(error === null ? undefined : error);
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4424
4603
|
// Copyright (c) Microsoft Corporation.
|
|
4425
4604
|
const LATEST_API_VERSION = "2021-07-01";
|
|
4426
4605
|
const CHUNK_SIZE = 4 * 1024 * 1024; // 4 MB
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
KnownManifestMediaType
|
|
4430
|
-
|
|
4606
|
+
const MAX_MANIFEST_SIZE_BYTES = 4 * 1024 * 1024; // 4 MB
|
|
4607
|
+
const ACCEPTED_MANIFEST_MEDIA_TYPES = [
|
|
4608
|
+
exports.KnownManifestMediaType.OciImageManifest,
|
|
4609
|
+
exports.KnownManifestMediaType.DockerManifest,
|
|
4610
|
+
"application/vnd.oci.image.index.v1+json",
|
|
4611
|
+
"application/vnd.docker.distribution.manifest.list.v2+json",
|
|
4612
|
+
"application/vnd.docker.container.image.v1+json",
|
|
4613
|
+
];
|
|
4431
4614
|
function isReadableStream(body) {
|
|
4432
4615
|
return body && typeof body.pipe === "function";
|
|
4433
4616
|
}
|
|
@@ -4446,20 +4629,19 @@ class DigestMismatchError extends Error {
|
|
|
4446
4629
|
this.name = "DigestMismatchError";
|
|
4447
4630
|
}
|
|
4448
4631
|
}
|
|
4449
|
-
const serializer = coreClient.createSerializer(Mappers, /* isXML */ false);
|
|
4450
4632
|
/**
|
|
4451
4633
|
* The Azure Container Registry blob client, responsible for uploading and downloading blobs and manifests, the building blocks of artifacts.
|
|
4452
4634
|
*/
|
|
4453
|
-
class
|
|
4635
|
+
class ContainerRegistryContentClient {
|
|
4454
4636
|
/**
|
|
4455
|
-
* Creates an instance of a
|
|
4637
|
+
* Creates an instance of a ContainerRegistryContentClient for managing container images and artifacts.
|
|
4456
4638
|
*
|
|
4457
4639
|
* Example usage:
|
|
4458
4640
|
* ```ts
|
|
4459
|
-
* import {
|
|
4641
|
+
* import { ContainerRegistryContentClient } from "@azure/container-registry";
|
|
4460
4642
|
* import { DefaultAzureCredential} from "@azure/identity";
|
|
4461
4643
|
*
|
|
4462
|
-
* const client = new
|
|
4644
|
+
* const client = new ContainerRegistryContentClient(
|
|
4463
4645
|
* "<container registry API endpoint>",
|
|
4464
4646
|
* "<repository name>",
|
|
4465
4647
|
* new DefaultAzureCredential()
|
|
@@ -4470,8 +4652,8 @@ class ContainerRegistryBlobClient {
|
|
|
4470
4652
|
* @param credential - used to authenticate requests to the service
|
|
4471
4653
|
* @param options - optional configuration used to send requests to the service
|
|
4472
4654
|
*/
|
|
4473
|
-
constructor(endpoint, repositoryName, credential, options) {
|
|
4474
|
-
var _a;
|
|
4655
|
+
constructor(endpoint, repositoryName, credential, options = {}) {
|
|
4656
|
+
var _a, _b;
|
|
4475
4657
|
if (!endpoint) {
|
|
4476
4658
|
throw new Error("invalid endpoint");
|
|
4477
4659
|
}
|
|
@@ -4490,8 +4672,8 @@ class ContainerRegistryBlobClient {
|
|
|
4490
4672
|
"_state",
|
|
4491
4673
|
],
|
|
4492
4674
|
} });
|
|
4493
|
-
const defaultScope = `${options.audience}/.default`;
|
|
4494
|
-
const serviceVersion = (
|
|
4675
|
+
const defaultScope = `${(_a = options.audience) !== null && _a !== void 0 ? _a : "https://containerregistry.azure.net"}/.default`;
|
|
4676
|
+
const serviceVersion = (_b = options.serviceVersion) !== null && _b !== void 0 ? _b : LATEST_API_VERSION;
|
|
4495
4677
|
const authClient = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);
|
|
4496
4678
|
this.client = new GeneratedClient(endpoint, serviceVersion, internalPipelineOptions);
|
|
4497
4679
|
this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
@@ -4506,58 +4688,62 @@ class ContainerRegistryBlobClient {
|
|
|
4506
4688
|
* @param options - optional configuration used to send requests to the service
|
|
4507
4689
|
*/
|
|
4508
4690
|
async deleteBlob(digest, options = {}) {
|
|
4509
|
-
return tracingClient.withSpan("
|
|
4691
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.deleteBlob", options, async (updatedOptions) => {
|
|
4510
4692
|
await this.client.containerRegistryBlob.deleteBlob(this.repositoryName, digest, updatedOptions);
|
|
4511
4693
|
});
|
|
4512
4694
|
}
|
|
4513
4695
|
/**
|
|
4514
4696
|
* Upload a manifest for an OCI artifact.
|
|
4515
4697
|
*
|
|
4516
|
-
* @param manifest - the manifest to upload.
|
|
4698
|
+
* @param manifest - the manifest to upload.
|
|
4517
4699
|
*/
|
|
4518
|
-
async
|
|
4519
|
-
return tracingClient.withSpan("
|
|
4700
|
+
async setManifest(manifest, options = {}) {
|
|
4701
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.uploadManifest", options, async (updatedOptions) => {
|
|
4702
|
+
var _a;
|
|
4520
4703
|
let manifestBody;
|
|
4521
4704
|
let tagOrDigest = options === null || options === void 0 ? void 0 : options.tag;
|
|
4522
|
-
if (
|
|
4705
|
+
if (Buffer.isBuffer(manifest)) {
|
|
4706
|
+
manifestBody = manifest;
|
|
4707
|
+
tagOrDigest !== null && tagOrDigest !== void 0 ? tagOrDigest : (tagOrDigest = await calculateDigest(manifest));
|
|
4708
|
+
}
|
|
4709
|
+
else if (isReadableStream(manifest)) {
|
|
4523
4710
|
manifestBody = await readStreamToEnd(manifest);
|
|
4524
4711
|
tagOrDigest !== null && tagOrDigest !== void 0 ? tagOrDigest : (tagOrDigest = await calculateDigest(manifestBody));
|
|
4525
4712
|
}
|
|
4526
|
-
else if (typeof manifest === "function") {
|
|
4527
|
-
manifestBody = manifest;
|
|
4528
|
-
tagOrDigest !== null && tagOrDigest !== void 0 ? tagOrDigest : (tagOrDigest = await calculateDigest(manifestBody()));
|
|
4529
|
-
}
|
|
4530
4713
|
else {
|
|
4531
|
-
|
|
4532
|
-
manifestBody = Buffer.from(JSON.stringify(serialized));
|
|
4714
|
+
manifestBody = Buffer.from(JSON.stringify(manifest));
|
|
4533
4715
|
tagOrDigest !== null && tagOrDigest !== void 0 ? tagOrDigest : (tagOrDigest = await calculateDigest(manifestBody));
|
|
4534
4716
|
}
|
|
4535
|
-
const createManifestResult = await this.client.containerRegistry.createManifest(this.repositoryName, tagOrDigest, manifestBody, Object.assign({ contentType: KnownManifestMediaType.
|
|
4717
|
+
const createManifestResult = await this.client.containerRegistry.createManifest(this.repositoryName, tagOrDigest, manifestBody, Object.assign({ contentType: (_a = options === null || options === void 0 ? void 0 : options.mediaType) !== null && _a !== void 0 ? _a : exports.KnownManifestMediaType.OciImageManifest }, updatedOptions));
|
|
4536
4718
|
assertHasProperty(createManifestResult, "dockerContentDigest");
|
|
4537
4719
|
return { digest: createManifestResult.dockerContentDigest };
|
|
4538
4720
|
});
|
|
4539
4721
|
}
|
|
4540
4722
|
/**
|
|
4541
|
-
* Downloads the manifest for an OCI artifact
|
|
4723
|
+
* Downloads the manifest for an OCI artifact.
|
|
4542
4724
|
*
|
|
4543
4725
|
* @param tagOrDigest - a tag or digest that identifies the artifact
|
|
4544
|
-
* @returns - the downloaded manifest
|
|
4726
|
+
* @returns - the downloaded manifest.
|
|
4545
4727
|
*/
|
|
4546
|
-
async
|
|
4547
|
-
return tracingClient.withSpan("
|
|
4548
|
-
const
|
|
4549
|
-
|
|
4550
|
-
|
|
4728
|
+
async getManifest(tagOrDigest, options = {}) {
|
|
4729
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.downloadManifest", options, async (updatedOptions) => {
|
|
4730
|
+
const response = await this.client.containerRegistry.getManifest(this.repositoryName, tagOrDigest, Object.assign({ accept: ACCEPTED_MANIFEST_MEDIA_TYPES.join(", ") }, updatedOptions));
|
|
4731
|
+
assertHasProperty(response, "mediaType");
|
|
4732
|
+
const content = response.readableStreamBody
|
|
4733
|
+
? await readStreamToEnd(response.readableStreamBody, MAX_MANIFEST_SIZE_BYTES)
|
|
4551
4734
|
: Buffer.alloc(0);
|
|
4552
|
-
const expectedDigest = await calculateDigest(
|
|
4553
|
-
if (
|
|
4554
|
-
throw new DigestMismatchError("Digest of
|
|
4735
|
+
const expectedDigest = await calculateDigest(content);
|
|
4736
|
+
if (isDigest(tagOrDigest) && expectedDigest !== tagOrDigest) {
|
|
4737
|
+
throw new DigestMismatchError("Digest of downloaded manifest does not match the input digest");
|
|
4738
|
+
}
|
|
4739
|
+
if (response.dockerContentDigest !== expectedDigest) {
|
|
4740
|
+
throw new DigestMismatchError("Computed digest of downloaded manifest does not match the value of the Docker-Content-Digest header");
|
|
4555
4741
|
}
|
|
4556
|
-
const manifest = serializer.deserialize(OCIManifest, JSON.parse(bodyData.toString()), "OCIManifest");
|
|
4557
4742
|
return {
|
|
4558
|
-
digest: dockerContentDigest,
|
|
4559
|
-
|
|
4560
|
-
|
|
4743
|
+
digest: response.dockerContentDigest,
|
|
4744
|
+
mediaType: response.mediaType,
|
|
4745
|
+
content,
|
|
4746
|
+
manifest: JSON.parse(content.toString("utf-8")),
|
|
4561
4747
|
};
|
|
4562
4748
|
});
|
|
4563
4749
|
}
|
|
@@ -4568,7 +4754,7 @@ class ContainerRegistryBlobClient {
|
|
|
4568
4754
|
* @param options - optional configuration used to send requests to the service
|
|
4569
4755
|
*/
|
|
4570
4756
|
async deleteManifest(digest, options = {}) {
|
|
4571
|
-
return tracingClient.withSpan("
|
|
4757
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.deleteManifest", options, async (updatedOptions) => {
|
|
4572
4758
|
await this.client.containerRegistry.deleteManifest(this.repositoryName, digest, updatedOptions);
|
|
4573
4759
|
});
|
|
4574
4760
|
}
|
|
@@ -4577,27 +4763,37 @@ class ContainerRegistryBlobClient {
|
|
|
4577
4763
|
*
|
|
4578
4764
|
* @param blobStream - the stream containing the blob data.
|
|
4579
4765
|
*/
|
|
4580
|
-
async uploadBlob(
|
|
4581
|
-
return tracingClient.withSpan("
|
|
4582
|
-
var e_1,
|
|
4766
|
+
async uploadBlob(blob, options = {}) {
|
|
4767
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.uploadBlob", options, async (updatedOptions) => {
|
|
4768
|
+
var _a, e_1, _b, _c;
|
|
4769
|
+
const blobStream = Buffer.isBuffer(blob) ? stream.Readable.from(blob) : blob;
|
|
4583
4770
|
const startUploadResult = await this.client.containerRegistryBlob.startUpload(this.repositoryName, updatedOptions);
|
|
4584
4771
|
assertHasProperty(startUploadResult, "location");
|
|
4585
4772
|
let location = startUploadResult.location.substring(1);
|
|
4586
4773
|
const chunks = readChunksFromStream(blobStream, CHUNK_SIZE);
|
|
4587
4774
|
const hash = crypto__default["default"].createHash("sha256");
|
|
4775
|
+
let bytesUploaded = 0;
|
|
4588
4776
|
try {
|
|
4589
|
-
for (var chunks_1 = tslib.__asyncValues(chunks), chunks_1_1; chunks_1_1 = await chunks_1.next(),
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4777
|
+
for (var _d = true, chunks_1 = tslib.__asyncValues(chunks), chunks_1_1; chunks_1_1 = await chunks_1.next(), _a = chunks_1_1.done, !_a;) {
|
|
4778
|
+
_c = chunks_1_1.value;
|
|
4779
|
+
_d = false;
|
|
4780
|
+
try {
|
|
4781
|
+
const chunk = _c;
|
|
4782
|
+
hash.write(chunk);
|
|
4783
|
+
const result = await this.client.containerRegistryBlob.uploadChunk(location, chunk, updatedOptions);
|
|
4784
|
+
bytesUploaded += chunk.byteLength;
|
|
4785
|
+
assertHasProperty(result, "location");
|
|
4786
|
+
location = result.location.substring(1);
|
|
4787
|
+
}
|
|
4788
|
+
finally {
|
|
4789
|
+
_d = true;
|
|
4790
|
+
}
|
|
4595
4791
|
}
|
|
4596
4792
|
}
|
|
4597
4793
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4598
4794
|
finally {
|
|
4599
4795
|
try {
|
|
4600
|
-
if (
|
|
4796
|
+
if (!_d && !_a && (_b = chunks_1.return)) await _b.call(chunks_1);
|
|
4601
4797
|
}
|
|
4602
4798
|
finally { if (e_1) throw e_1.error; }
|
|
4603
4799
|
}
|
|
@@ -4607,7 +4803,7 @@ class ContainerRegistryBlobClient {
|
|
|
4607
4803
|
if (digest !== digestFromResponse) {
|
|
4608
4804
|
throw new DigestMismatchError("Digest of blob to upload does not match the digest from the server.");
|
|
4609
4805
|
}
|
|
4610
|
-
return { digest };
|
|
4806
|
+
return { digest, sizeInBytes: bytesUploaded };
|
|
4611
4807
|
});
|
|
4612
4808
|
}
|
|
4613
4809
|
/**
|
|
@@ -4618,17 +4814,33 @@ class ContainerRegistryBlobClient {
|
|
|
4618
4814
|
* @returns - the downloaded blob
|
|
4619
4815
|
*/
|
|
4620
4816
|
async downloadBlob(digest, options = {}) {
|
|
4621
|
-
return tracingClient.withSpan("
|
|
4622
|
-
const
|
|
4817
|
+
return tracingClient.withSpan("ContainerRegistryContentClient.downloadBlob", options, async (updatedOptions) => {
|
|
4818
|
+
const initialResponse = await this.client.containerRegistryBlob.getBlob(this.repositoryName, digest, updatedOptions);
|
|
4819
|
+
assertHasProperty(initialResponse, "readableStreamBody");
|
|
4820
|
+
assertHasProperty(initialResponse, "contentLength");
|
|
4821
|
+
const hash = crypto__default["default"].createHash("sha256");
|
|
4623
4822
|
return {
|
|
4624
4823
|
digest,
|
|
4625
|
-
content:
|
|
4824
|
+
content: new RetriableReadableStream(initialResponse.readableStreamBody, async (pos) => {
|
|
4825
|
+
const retryResponse = await this.client.containerRegistryBlob.getChunk(this.repositoryName, digest, `${pos}-`, updatedOptions);
|
|
4826
|
+
assertHasProperty(retryResponse, "readableStreamBody");
|
|
4827
|
+
return retryResponse.readableStreamBody;
|
|
4828
|
+
}, 0, initialResponse.contentLength, {
|
|
4829
|
+
onData: (data) => hash.write(data),
|
|
4830
|
+
onEnd: () => {
|
|
4831
|
+
hash.end();
|
|
4832
|
+
const calculatedDigest = `sha256:${hash.digest("hex")}`;
|
|
4833
|
+
if (digest !== calculatedDigest) {
|
|
4834
|
+
throw new DigestMismatchError("Digest calculated from downloaded blob content does not match digest requested.");
|
|
4835
|
+
}
|
|
4836
|
+
},
|
|
4837
|
+
}),
|
|
4626
4838
|
};
|
|
4627
4839
|
});
|
|
4628
4840
|
}
|
|
4629
4841
|
}
|
|
4630
4842
|
|
|
4631
|
-
exports.ContainerRegistryBlobClient = ContainerRegistryBlobClient;
|
|
4632
4843
|
exports.ContainerRegistryClient = ContainerRegistryClient;
|
|
4844
|
+
exports.ContainerRegistryContentClient = ContainerRegistryContentClient;
|
|
4633
4845
|
exports.DigestMismatchError = DigestMismatchError;
|
|
4634
4846
|
//# sourceMappingURL=index.js.map
|