@azure/container-registry 1.0.0-beta.3 → 1.0.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/CHANGELOG.md +32 -0
- package/README.md +70 -37
- package/dist/index.js +1255 -1123
- package/dist/index.js.map +1 -1
- package/dist-esm/src/containerRegistryChallengeHandler.js +35 -38
- package/dist-esm/src/containerRegistryChallengeHandler.js.map +1 -1
- package/dist-esm/src/containerRegistryClient.js +69 -50
- package/dist-esm/src/containerRegistryClient.js.map +1 -1
- package/dist-esm/src/containerRegistryTokenCredential.js +39 -126
- package/dist-esm/src/containerRegistryTokenCredential.js.map +1 -1
- package/dist-esm/src/containerRepository.js +100 -63
- package/dist-esm/src/containerRepository.js.map +1 -1
- package/dist-esm/src/generated/generatedClient.js +7 -6
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +13 -2
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/generated/index.js +1 -0
- package/dist-esm/src/generated/index.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +61 -1
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +514 -557
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +87 -7
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/operations/authentication.js +28 -8
- package/dist-esm/src/generated/operations/authentication.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistry.js +27 -7
- package/dist-esm/src/generated/operations/containerRegistry.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistryBlob.js +2 -2
- package/dist-esm/src/generated/operations/containerRegistryBlob.js.map +1 -1
- package/dist-esm/src/generated/operationsInterfaces/authentication.js +9 -0
- package/dist-esm/src/generated/operationsInterfaces/authentication.js.map +1 -0
- package/dist-esm/src/generated/operationsInterfaces/containerRegistry.js +9 -0
- package/dist-esm/src/generated/operationsInterfaces/containerRegistry.js.map +1 -0
- package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js +9 -0
- package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js.map +1 -0
- package/dist-esm/src/generated/operationsInterfaces/index.js +11 -0
- package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models.js +43 -2
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/registryArtifact.js +176 -135
- package/dist-esm/src/registryArtifact.js.map +1 -1
- package/dist-esm/src/tracing.js +1 -1
- package/dist-esm/src/tracing.js.map +1 -1
- package/dist-esm/src/transformations.js +2 -2
- package/dist-esm/src/transformations.js.map +1 -1
- package/dist-esm/src/{base64.browser.js → utils/base64.browser.js} +0 -0
- package/dist-esm/src/utils/base64.browser.js.map +1 -0
- package/dist-esm/src/{base64.js → utils/base64.js} +0 -0
- package/dist-esm/src/utils/base64.js.map +1 -0
- package/dist-esm/src/{utils.js → utils/helpers.js} +1 -1
- package/dist-esm/src/utils/helpers.js.map +1 -0
- package/dist-esm/src/{tokenCycler.js → utils/tokenCycler.js} +29 -34
- package/dist-esm/src/utils/tokenCycler.js.map +1 -0
- package/dist-esm/src/{url.browser.js → utils/url.browser.js} +0 -0
- package/dist-esm/src/utils/url.browser.js.map +1 -0
- package/dist-esm/src/{url.js → utils/url.js} +0 -0
- package/dist-esm/src/utils/url.js.map +1 -0
- package/dist-esm/src/{wwwAuthenticateParser.js → utils/wwwAuthenticateParser.js} +0 -0
- package/dist-esm/src/utils/wwwAuthenticateParser.js.map +1 -0
- package/package.json +22 -25
- package/types/container-registry.d.ts +258 -83
- package/dist-esm/src/base64.browser.js.map +0 -1
- package/dist-esm/src/base64.js.map +0 -1
- package/dist-esm/src/constants.js +0 -4
- package/dist-esm/src/constants.js.map +0 -1
- package/dist-esm/src/tokenCycler.js.map +0 -1
- package/dist-esm/src/url.browser.js.map +0 -1
- package/dist-esm/src/url.js.map +0 -1
- package/dist-esm/src/utils.js.map +0 -1
- package/dist-esm/src/wwwAuthenticateParser.js.map +0 -1
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference lib="esnext.asynciterable" />
|
|
3
|
+
|
|
3
4
|
import { OperationOptions } from '@azure/core-client';
|
|
4
5
|
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
5
6
|
import { PipelineOptions } from '@azure/core-rest-pipeline';
|
|
6
7
|
import { TokenCredential } from '@azure/core-auth';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Defines values for ArtifactManifestOrder.
|
|
11
|
+
* this contains the known values that the service supports.
|
|
12
|
+
* ### Know values supported by the service
|
|
13
|
+
* **LastUpdatedOnDescending**: Order registry artifacts by LastUpdatedOn field, from most recently updated to least recently updated.
|
|
14
|
+
* **LastUpdatedOnAscending**: Order registry artifacts by LastUpdatedOn field, from least recently updated to most recently updated.
|
|
15
|
+
*/
|
|
16
|
+
export declare type ArtifactManifestOrder = "LastUpdatedOnDescending" | "LastUpdatedOnAscending";
|
|
17
|
+
|
|
8
18
|
/** Manifest attributes details */
|
|
9
19
|
export declare interface ArtifactManifestPlatform {
|
|
10
20
|
/**
|
|
@@ -45,7 +55,7 @@ export declare interface ArtifactManifestProperties {
|
|
|
45
55
|
* Image size
|
|
46
56
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
47
57
|
*/
|
|
48
|
-
readonly
|
|
58
|
+
readonly sizeInBytes?: number;
|
|
49
59
|
/**
|
|
50
60
|
* Created time
|
|
51
61
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
@@ -86,10 +96,19 @@ export declare interface ArtifactManifestProperties {
|
|
|
86
96
|
canRead?: boolean;
|
|
87
97
|
}
|
|
88
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Defines values for ArtifactTagOrder.
|
|
101
|
+
* this contains the known values that the service supports.
|
|
102
|
+
* ### Know values supported by the service
|
|
103
|
+
* **LastUpdatedOnDescending**: Order tags by LastUpdatedOn field, from most recently updated to least recently updated.
|
|
104
|
+
* **LastUpdatedOnAscending**: Order tags by LastUpdatedOn field, from least recently updated to most recently updated.
|
|
105
|
+
*/
|
|
106
|
+
export declare type ArtifactTagOrder = "LastUpdatedOnDescending" | "LastUpdatedOnAscending";
|
|
107
|
+
|
|
89
108
|
/** Tag attributes */
|
|
90
109
|
export declare interface ArtifactTagProperties {
|
|
91
110
|
/**
|
|
92
|
-
* Registry login server name.
|
|
111
|
+
* Registry login server name. This is likely to be similar to {registry-name}.azurecr.io.
|
|
93
112
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
94
113
|
*/
|
|
95
114
|
readonly registryLoginServer: string;
|
|
@@ -150,7 +169,7 @@ export declare class ContainerRegistryClient {
|
|
|
150
169
|
* new DefaultAzureCredential()
|
|
151
170
|
* );
|
|
152
171
|
* ```
|
|
153
|
-
* @param endpoint - the URL
|
|
172
|
+
* @param endpoint - the URL endpoint of the container registry
|
|
154
173
|
* @param credential - used to authenticate requests to the service
|
|
155
174
|
* @param options - optional configuration used to send requests to the service
|
|
156
175
|
*/
|
|
@@ -158,6 +177,8 @@ export declare class ContainerRegistryClient {
|
|
|
158
177
|
/**
|
|
159
178
|
* Creates an instance of a ContainerRegistryClient to interact with
|
|
160
179
|
* an Azure Container Registry that has anonymous pull access enabled.
|
|
180
|
+
* Only operations that support anonymous access are enabled. Other service
|
|
181
|
+
* methods will throw errors.
|
|
161
182
|
*
|
|
162
183
|
* Example usage:
|
|
163
184
|
* ```ts
|
|
@@ -167,41 +188,68 @@ export declare class ContainerRegistryClient {
|
|
|
167
188
|
* "<container registry API endpoint>",
|
|
168
189
|
* );
|
|
169
190
|
* ```
|
|
170
|
-
* @param endpoint - the URL
|
|
191
|
+
* @param endpoint - the URL endpoint of the container registry
|
|
171
192
|
* @param options - optional configuration used to send requests to the service
|
|
172
193
|
*/
|
|
173
194
|
constructor(endpoint: string, options?: ContainerRegistryClientOptions);
|
|
174
195
|
/**
|
|
175
|
-
* Deletes the repository identified by the given name.
|
|
196
|
+
* Deletes the repository identified by the given name and all associated artifacts.
|
|
176
197
|
*
|
|
177
198
|
* @param repositoryName - the name of repository to delete
|
|
178
199
|
* @param options - optional configuration for the operation
|
|
179
200
|
*/
|
|
180
201
|
deleteRepository(repositoryName: string, options?: DeleteRepositoryOptions): Promise<void>;
|
|
181
202
|
/**
|
|
182
|
-
* Returns an
|
|
203
|
+
* Returns an instance of {@link RegistryArtifact} for calling service methods related to the artifact specified by `repositoryName` and `tagOrDigest`.
|
|
183
204
|
*
|
|
184
205
|
* @param repositoryName - the name of repository
|
|
185
206
|
* @param tagOrDigest - tag or digest of the artifact to retrieve
|
|
186
207
|
*/
|
|
187
208
|
getArtifact(repositoryName: string, tagOrDigest: string): RegistryArtifact;
|
|
188
209
|
/**
|
|
189
|
-
* Returns
|
|
210
|
+
* Returns an instance of {@link ContainerRepository} for calling service methods related to the repository specified by `repositoryName`.
|
|
190
211
|
*
|
|
191
|
-
* @param repositoryName - the name of repository
|
|
192
|
-
* @param options - optional configuration for the operation
|
|
212
|
+
* @param repositoryName - the name of repository
|
|
193
213
|
*/
|
|
194
214
|
getRepository(repositoryName: string): ContainerRepository;
|
|
195
215
|
/**
|
|
196
|
-
*
|
|
216
|
+
* Returns an async iterable iterator to list names of repositories in this registry.
|
|
197
217
|
*
|
|
198
218
|
* Example usage:
|
|
199
|
-
* ```
|
|
200
|
-
* let client = new ContainerRegistryClient(url,
|
|
219
|
+
* ```javascript
|
|
220
|
+
* let client = new ContainerRegistryClient(url, credential);
|
|
201
221
|
* for await (const repository of client.listRepositoryNames()) {
|
|
202
222
|
* console.log("repository name: ", repository);
|
|
203
223
|
* }
|
|
204
224
|
* ```
|
|
225
|
+
*
|
|
226
|
+
* Example using `iter.next()`:
|
|
227
|
+
*
|
|
228
|
+
* ```javascript
|
|
229
|
+
* let iter = client.listRepositoryNames();
|
|
230
|
+
* let item = await iter.next();
|
|
231
|
+
* while (!item.done) {
|
|
232
|
+
* console.log(`repository name: ${item.value}`);
|
|
233
|
+
* item = await iter.next();
|
|
234
|
+
* }
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* Example using `byPage()`:
|
|
238
|
+
*
|
|
239
|
+
* ```javascript
|
|
240
|
+
* const pages = client.listRepositoryNames().byPage({ maxPageSize: 2 });
|
|
241
|
+
* let page = await pages.next();
|
|
242
|
+
* let i = 1;
|
|
243
|
+
* while (!page.done) {
|
|
244
|
+
* if (page.value) {
|
|
245
|
+
* console.log(`-- page ${i++}`);
|
|
246
|
+
* for (const name of page.value) {
|
|
247
|
+
* console.log(` repository name: ${name}`);
|
|
248
|
+
* }
|
|
249
|
+
* }
|
|
250
|
+
* page = await pages.next();
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
205
253
|
* @param options -
|
|
206
254
|
*/
|
|
207
255
|
listRepositoryNames(options?: ListRepositoriesOptions): PagedAsyncIterableIterator<string, RepositoryPageResponse>;
|
|
@@ -214,19 +262,23 @@ export declare class ContainerRegistryClient {
|
|
|
214
262
|
*/
|
|
215
263
|
export declare interface ContainerRegistryClientOptions extends PipelineOptions {
|
|
216
264
|
/**
|
|
217
|
-
* Gets or sets the
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* where <resource-id> is one of the Resource IDs listed at
|
|
221
|
-
* https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities#azure-resource-manager.
|
|
222
|
-
* For example, to connect to the Azure Germany cloud, create a client with
|
|
223
|
-
* this set to "https://management.microsoftazure.de/.default".
|
|
265
|
+
* Gets or sets the audience to use for authentication with Azure Active Directory.
|
|
266
|
+
* The authentication scope will be set from this audience.
|
|
267
|
+
* See {@link KnownContainerRegistryAudience} for known audience values.
|
|
224
268
|
*/
|
|
225
|
-
|
|
269
|
+
audience?: string;
|
|
270
|
+
/**
|
|
271
|
+
* The version of service API to make calls against.
|
|
272
|
+
*/
|
|
273
|
+
serviceVersion?: "2021-07-01";
|
|
226
274
|
}
|
|
227
275
|
|
|
228
276
|
/**
|
|
229
|
-
*
|
|
277
|
+
* A `repository` in a container registry is a logical grouping of images or artifacts that share the same name. For example,
|
|
278
|
+
* different versions of a `hello-world` application could have tags `v1` and `v2`, and be grouped by the repository `hello-world`.
|
|
279
|
+
*
|
|
280
|
+
* The {@link ContainerRepository} interface is a helper that groups information and operations about a repository in this
|
|
281
|
+
* container registry.
|
|
230
282
|
*/
|
|
231
283
|
export declare interface ContainerRepository {
|
|
232
284
|
/**
|
|
@@ -238,37 +290,81 @@ export declare interface ContainerRepository {
|
|
|
238
290
|
*/
|
|
239
291
|
readonly name: string;
|
|
240
292
|
/**
|
|
241
|
-
* Deletes this repository.
|
|
293
|
+
* Deletes this repository and all artifacts that are part of its logical group.
|
|
242
294
|
*
|
|
243
295
|
* @param options - optional configuration for the operation
|
|
244
296
|
*/
|
|
245
297
|
delete(options?: DeleteRepositoryOptions): Promise<void>;
|
|
246
298
|
/**
|
|
247
|
-
* Returns an instance of RegistryArtifact.
|
|
299
|
+
* Returns an helper instance of {@link RegistryArtifact} for the given tag or digest.
|
|
248
300
|
* @param tagOrDigest - the tag or digest of the artifact
|
|
249
301
|
*/
|
|
250
302
|
getArtifact(tagOrDigest: string): RegistryArtifact;
|
|
251
303
|
/**
|
|
252
|
-
* Retrieves properties of this repository.
|
|
304
|
+
* Retrieves the properties of this repository.
|
|
253
305
|
* @param options -
|
|
254
306
|
*/
|
|
255
307
|
getProperties(options?: GetRepositoryPropertiesOptions): Promise<ContainerRepositoryProperties>;
|
|
256
308
|
/**
|
|
257
|
-
* Updates repository
|
|
309
|
+
* Updates the properties of this repository.
|
|
310
|
+
*
|
|
311
|
+
* Example usage:
|
|
312
|
+
*
|
|
313
|
+
* ```javascript
|
|
314
|
+
* const client = new ContainerRegistryClient(url, credential);
|
|
315
|
+
* const repository = client.getRepository(repositoryName)
|
|
316
|
+
* const updated = await repository.updateProperties({
|
|
317
|
+
* canDelete: false,
|
|
318
|
+
* canList: false,
|
|
319
|
+
* canRead: false,
|
|
320
|
+
* canWrite: false
|
|
321
|
+
* });
|
|
322
|
+
* ```
|
|
258
323
|
* @param options -
|
|
259
324
|
*/
|
|
260
325
|
updateProperties(options: UpdateRepositoryPropertiesOptions): Promise<ContainerRepositoryProperties>;
|
|
261
326
|
/**
|
|
262
|
-
*
|
|
327
|
+
* Returns an async iterable iterator to list manifest properties.
|
|
328
|
+
* This is useful for determining the collection of artifacts associated with
|
|
329
|
+
* this repository, as each artifact is uniquely identified by its manifest.
|
|
263
330
|
*
|
|
264
|
-
* Example
|
|
265
|
-
*
|
|
266
|
-
*
|
|
331
|
+
* Example using `for-await-of` syntax:
|
|
332
|
+
*
|
|
333
|
+
* ```javascript
|
|
334
|
+
* const client = new ContainerRegistryClient(url, credential);
|
|
267
335
|
* const repository = client.getRepository(repositoryName)
|
|
268
336
|
* for await (const manifest of repository.listManifestProperties()) {
|
|
269
337
|
* console.log("manifest: ", manifest);
|
|
270
338
|
* }
|
|
271
339
|
* ```
|
|
340
|
+
*
|
|
341
|
+
* Example using `iter.next()`:
|
|
342
|
+
*
|
|
343
|
+
* ```javascript
|
|
344
|
+
* const iter = repository.listManifestProperties();
|
|
345
|
+
* let item = await iter.next();
|
|
346
|
+
* while (!item.done) {
|
|
347
|
+
* console.log("manifest properties: ", item.value);
|
|
348
|
+
* item = await iter.next();
|
|
349
|
+
* }
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* Example using `byPage()`:
|
|
353
|
+
*
|
|
354
|
+
* ```javascript
|
|
355
|
+
* const pages = repository.listManifestProperties().byPage({ maxPageSize: 2 });
|
|
356
|
+
* let page = await pages.next();
|
|
357
|
+
* let i = 1;
|
|
358
|
+
* while (!page.done) {
|
|
359
|
+
* if (page.value) {
|
|
360
|
+
* console.log(`-- page ${i++}`);
|
|
361
|
+
* for (const manifestProperties of page.value) {
|
|
362
|
+
* console.log(` manifest properties: ${manifestProperties}`);
|
|
363
|
+
* }
|
|
364
|
+
* }
|
|
365
|
+
* page = await pages.next();
|
|
366
|
+
* }
|
|
367
|
+
* ```
|
|
272
368
|
* @param options -
|
|
273
369
|
*/
|
|
274
370
|
listManifestProperties(options?: ListManifestPropertiesOptions): PagedAsyncIterableIterator<ArtifactManifestProperties>;
|
|
@@ -277,7 +373,7 @@ export declare interface ContainerRepository {
|
|
|
277
373
|
/** Properties of this repository. */
|
|
278
374
|
export declare interface ContainerRepositoryProperties {
|
|
279
375
|
/**
|
|
280
|
-
* Registry login server name.
|
|
376
|
+
* Registry login server name. This is likely to be similar to {registry-name}.azurecr.io.
|
|
281
377
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
282
378
|
*/
|
|
283
379
|
readonly registryLoginServer: string;
|
|
@@ -314,8 +410,6 @@ export declare interface ContainerRepositoryProperties {
|
|
|
314
410
|
canList?: boolean;
|
|
315
411
|
/** Read enabled */
|
|
316
412
|
canRead?: boolean;
|
|
317
|
-
/** Enables Teleport functionality on new images in the repository improving Container startup performance */
|
|
318
|
-
teleportEnabled?: boolean;
|
|
319
413
|
}
|
|
320
414
|
|
|
321
415
|
/**
|
|
@@ -355,50 +449,91 @@ export declare interface GetTagPropertiesOptions extends OperationOptions {
|
|
|
355
449
|
}
|
|
356
450
|
|
|
357
451
|
/**
|
|
358
|
-
* Defines known
|
|
452
|
+
* Defines known artifact architectures that the service supports.
|
|
359
453
|
*/
|
|
360
454
|
export declare enum KnownArtifactArchitecture {
|
|
455
|
+
/** i386 */
|
|
361
456
|
I386 = "386",
|
|
457
|
+
/** AMD64 */
|
|
362
458
|
Amd64 = "amd64",
|
|
459
|
+
/** ARM */
|
|
363
460
|
Arm = "arm",
|
|
461
|
+
/** ARM64 */
|
|
364
462
|
Arm64 = "arm64",
|
|
463
|
+
/** MIPS */
|
|
365
464
|
Mips = "mips",
|
|
465
|
+
/** MIPSLE */
|
|
366
466
|
MipsLe = "mipsle",
|
|
467
|
+
/** MIPS64 */
|
|
367
468
|
Mips64 = "mips64",
|
|
469
|
+
/** MIPS64LE */
|
|
368
470
|
Mips64Le = "mips64le",
|
|
471
|
+
/** PPC64 */
|
|
369
472
|
Ppc64 = "ppc64",
|
|
473
|
+
/** PPC64LE */
|
|
370
474
|
Ppc64Le = "ppc64le",
|
|
475
|
+
/** RISCv64 */
|
|
371
476
|
RiscV64 = "riscv64",
|
|
477
|
+
/** s390x */
|
|
372
478
|
S390X = "s390x",
|
|
479
|
+
/** Wasm */
|
|
373
480
|
Wasm = "wasm"
|
|
374
481
|
}
|
|
375
482
|
|
|
376
483
|
/**
|
|
377
|
-
* Defines known
|
|
484
|
+
* Defines known artifact platform's operating systems that the service supports.
|
|
378
485
|
*/
|
|
379
486
|
export declare enum KnownArtifactOperatingSystem {
|
|
487
|
+
/** Aix */
|
|
380
488
|
Aix = "aix",
|
|
489
|
+
/** Android */
|
|
381
490
|
Android = "android",
|
|
491
|
+
/** Darwin */
|
|
382
492
|
Darwin = "darwin",
|
|
493
|
+
/** Dragonfly */
|
|
383
494
|
Dragonfly = "dragonfly",
|
|
495
|
+
/** FreeBSD */
|
|
384
496
|
FreeBsd = "freebsd",
|
|
497
|
+
/** Illumos */
|
|
385
498
|
Illumos = "illumos",
|
|
499
|
+
/** iOS */
|
|
386
500
|
iOS = "ios",
|
|
501
|
+
/** JS */
|
|
387
502
|
JS = "js",
|
|
503
|
+
/** Linux */
|
|
388
504
|
Linux = "linux",
|
|
505
|
+
/** NetBSD */
|
|
389
506
|
NetBsd = "netbsd",
|
|
507
|
+
/** OpenBSD */
|
|
390
508
|
OpenBsd = "openbsd",
|
|
509
|
+
/** Plan9 */
|
|
391
510
|
Plan9 = "plan9",
|
|
511
|
+
/** Solaris */
|
|
392
512
|
Solaris = "solaris",
|
|
513
|
+
/** Windows */
|
|
393
514
|
Windows = "windows"
|
|
394
515
|
}
|
|
395
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Defines known cloud audiences for Azure Container Registry.
|
|
519
|
+
*/
|
|
520
|
+
export declare enum KnownContainerRegistryAudience {
|
|
521
|
+
/** Azure China */
|
|
522
|
+
AzureResourceManagerChina = "https://management.chinacloudapi.cn",
|
|
523
|
+
/** Azure Gemany */
|
|
524
|
+
AzureResourceManagerGermany = "https://management.microsoftazure.de",
|
|
525
|
+
/** Azure Government */
|
|
526
|
+
AzureResourceManagerGovernment = "https://management.usgovcloudapi.net",
|
|
527
|
+
/** Azure Public Cloud */
|
|
528
|
+
AzureResourceManagerPublicCloud = "https://management.azure.com"
|
|
529
|
+
}
|
|
530
|
+
|
|
396
531
|
/**
|
|
397
532
|
* Options for the `listRegistryArtifacts` method of `ContainerRepository`.
|
|
398
533
|
*/
|
|
399
534
|
export declare interface ListManifestPropertiesOptions extends OperationOptions {
|
|
400
|
-
/**
|
|
401
|
-
|
|
535
|
+
/** order in which the manifest properties are returned */
|
|
536
|
+
order?: ArtifactManifestOrder;
|
|
402
537
|
}
|
|
403
538
|
|
|
404
539
|
/**
|
|
@@ -411,19 +546,10 @@ export declare interface ListRepositoriesOptions extends OperationOptions {
|
|
|
411
546
|
* Options for the `listTagProperties` method of `RegistryArtifact`.
|
|
412
547
|
*/
|
|
413
548
|
export declare interface ListTagPropertiesOptions extends OperationOptions {
|
|
414
|
-
/**
|
|
415
|
-
|
|
549
|
+
/** order in which the tags are returned */
|
|
550
|
+
order?: ArtifactTagOrder;
|
|
416
551
|
}
|
|
417
552
|
|
|
418
|
-
/**
|
|
419
|
-
* Defines values for RegistryArtifactOrderBy.
|
|
420
|
-
* this contains the known values that the service supports.
|
|
421
|
-
* ### Know values supported by the service
|
|
422
|
-
* **LastUpdatedOnDescending**: Order registry artifacts by LastUpdatedOn field, from most recently updated to least recently updated.
|
|
423
|
-
* **LastUpdatedOnAscending**: Order registry artifacts by LastUpdatedOn field, from least recently updated to most recently updated.
|
|
424
|
-
*/
|
|
425
|
-
export declare type ManifestOrderBy = "LastUpdatedOnDescending" | "LastUpdatedOnAscending";
|
|
426
|
-
|
|
427
553
|
/**
|
|
428
554
|
* Contains response data for the listManifests operation.
|
|
429
555
|
*/
|
|
@@ -435,7 +561,12 @@ export declare interface ManifestPageResponse extends Array<ArtifactManifestProp
|
|
|
435
561
|
}
|
|
436
562
|
|
|
437
563
|
/**
|
|
438
|
-
*
|
|
564
|
+
* `Artifact` is the general term for items stored in a container registry,
|
|
565
|
+
* and can include Docker images or other Open Container Initiative (OCI) artifact types.
|
|
566
|
+
*
|
|
567
|
+
* The {@link RegistryArtifact} interface is a helper that groups information and operations about an image
|
|
568
|
+
* or artifact in a container registry.
|
|
569
|
+
*
|
|
439
570
|
*/
|
|
440
571
|
export declare interface RegistryArtifact {
|
|
441
572
|
/**
|
|
@@ -451,43 +582,70 @@ export declare interface RegistryArtifact {
|
|
|
451
582
|
*/
|
|
452
583
|
readonly fullyQualifiedReference: string;
|
|
453
584
|
/**
|
|
454
|
-
* Deletes this artifact.
|
|
585
|
+
* Deletes this registry artifact by deleting its manifest.
|
|
455
586
|
* @param options -
|
|
456
587
|
*/
|
|
457
588
|
delete(options?: DeleteArtifactOptions): Promise<void>;
|
|
458
589
|
/**
|
|
459
|
-
* Deletes a tag.
|
|
460
|
-
* @param tag - the name of the tag to
|
|
590
|
+
* Deletes a tag. This removes the tag from the artifact and its manifest.
|
|
591
|
+
* @param tag - the name of the tag to delete.
|
|
461
592
|
* @param options -
|
|
462
593
|
*/
|
|
463
594
|
deleteTag(tag: string, options?: DeleteTagOptions): Promise<void>;
|
|
464
595
|
/**
|
|
465
|
-
* Retrieves properties of this
|
|
596
|
+
* Retrieves the properties of the manifest that uniquely identifies this artifact.
|
|
466
597
|
* @param options -
|
|
467
598
|
*/
|
|
468
599
|
getManifestProperties(options?: GetManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
|
|
469
600
|
/**
|
|
470
|
-
* Updates
|
|
601
|
+
* Updates the properties of the artifact's manifest.
|
|
602
|
+
*
|
|
603
|
+
* Example usage:
|
|
604
|
+
*
|
|
605
|
+
* ```javascript
|
|
606
|
+
* const client = new ContainerRegistryClient(url, credential);
|
|
607
|
+
* const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)
|
|
608
|
+
* const updated = await artifact.updateManifestProperties({
|
|
609
|
+
* canDelete: false,
|
|
610
|
+
* canList: false,
|
|
611
|
+
* canRead: false,
|
|
612
|
+
* canWrite: false
|
|
613
|
+
* });
|
|
614
|
+
* ```
|
|
471
615
|
* @param options -
|
|
472
616
|
*/
|
|
473
|
-
updateManifestProperties(options
|
|
617
|
+
updateManifestProperties(options: UpdateManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
|
|
474
618
|
/**
|
|
475
|
-
* Retrieves properties of
|
|
619
|
+
* Retrieves the properties of the specified tag.
|
|
476
620
|
* @param tag - the tag to retrieve properties.
|
|
477
621
|
* @param options -
|
|
478
622
|
*/
|
|
479
623
|
getTagProperties(tag: string, options?: GetTagPropertiesOptions): Promise<ArtifactTagProperties>;
|
|
480
624
|
/**
|
|
481
|
-
* Updates
|
|
482
|
-
*
|
|
625
|
+
* Updates the properties of a given tag.
|
|
626
|
+
*
|
|
627
|
+
* Example usage:
|
|
628
|
+
*
|
|
629
|
+
* ```javascript
|
|
630
|
+
* const client = new ContainerRegistryClient(url, credential);
|
|
631
|
+
* const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)
|
|
632
|
+
* const updated = await artifact.updateTagProperties(tag, {
|
|
633
|
+
* canDelete: false,
|
|
634
|
+
* canList: false,
|
|
635
|
+
* canRead: false,
|
|
636
|
+
* canWrite: false
|
|
637
|
+
* });
|
|
638
|
+
* ```
|
|
639
|
+
* @param tag - name of the tag to update properties on
|
|
483
640
|
* @param options -
|
|
484
641
|
*/
|
|
485
642
|
updateTagProperties(tag: string, options: UpdateTagPropertiesOptions): Promise<ArtifactTagProperties>;
|
|
486
643
|
/**
|
|
487
|
-
*
|
|
644
|
+
* Returns an async iterable iterator to list the tags that uniquely identify this artifact and the properties of each.
|
|
488
645
|
*
|
|
489
|
-
* Example
|
|
490
|
-
*
|
|
646
|
+
* Example using `for-await-of` syntax:
|
|
647
|
+
*
|
|
648
|
+
* ```javascript
|
|
491
649
|
* const client = new ContainerRegistryClient(url, credentials);
|
|
492
650
|
* const repository = client.getRepository(repositoryName);
|
|
493
651
|
* const artifact = repository.getArtifact(digest)
|
|
@@ -495,6 +653,34 @@ export declare interface RegistryArtifact {
|
|
|
495
653
|
* console.log("tag: ", tag);
|
|
496
654
|
* }
|
|
497
655
|
* ```
|
|
656
|
+
*
|
|
657
|
+
* Example using `iter.next()`:
|
|
658
|
+
*
|
|
659
|
+
* ```javascript
|
|
660
|
+
* const iter = artifact.listTagProperties();
|
|
661
|
+
* let item = await iter.next();
|
|
662
|
+
* while (!item.done) {
|
|
663
|
+
* console.log("tag properties: ", item.value);
|
|
664
|
+
* item = await iter.next();
|
|
665
|
+
* }
|
|
666
|
+
* ```
|
|
667
|
+
*
|
|
668
|
+
* Example using `byPage()`:
|
|
669
|
+
*
|
|
670
|
+
* ```javascript
|
|
671
|
+
* const pages = artifact.listTagProperties().byPage({ maxPageSize: 2 });
|
|
672
|
+
* let page = await pages.next();
|
|
673
|
+
* let i = 1;
|
|
674
|
+
* while (!page.done) {
|
|
675
|
+
* if (page.value) {
|
|
676
|
+
* console.log(`-- page ${i++}`);
|
|
677
|
+
* for (const tagProperties of page.value) {
|
|
678
|
+
* console.log(` repository name: ${tagProperties}`);
|
|
679
|
+
* }
|
|
680
|
+
* }
|
|
681
|
+
* page = await pages.next();
|
|
682
|
+
* }
|
|
683
|
+
* ```
|
|
498
684
|
* @param options -
|
|
499
685
|
*/
|
|
500
686
|
listTagProperties(options?: ListTagPropertiesOptions): PagedAsyncIterableIterator<ArtifactTagProperties>;
|
|
@@ -510,15 +696,6 @@ export declare interface RepositoryPageResponse extends Array<string> {
|
|
|
510
696
|
continuationToken?: string;
|
|
511
697
|
}
|
|
512
698
|
|
|
513
|
-
/**
|
|
514
|
-
* Defines values for TagOrderBy.
|
|
515
|
-
* this contains the known values that the service supports.
|
|
516
|
-
* ### Know values supported by the service
|
|
517
|
-
* **LastUpdatedOnDescending**: Order tags by LastUpdatedOn field, from most recently updated to least recently updated.
|
|
518
|
-
* **LastUpdatedOnAscending**: Order tags by LastUpdatedOn field, from least recently updated to most recently updated.
|
|
519
|
-
*/
|
|
520
|
-
export declare type TagOrderBy = "LastUpdatedOnDescending" | "LastUpdatedOnAscending";
|
|
521
|
-
|
|
522
699
|
/**
|
|
523
700
|
* Contains response data for the listTags operation.
|
|
524
701
|
*/
|
|
@@ -533,13 +710,13 @@ export declare interface TagPageResponse extends Array<ArtifactTagProperties> {
|
|
|
533
710
|
* Options for the `updateManifestProperties` method of `RegistryArtifact`.
|
|
534
711
|
*/
|
|
535
712
|
export declare interface UpdateManifestPropertiesOptions extends OperationOptions {
|
|
536
|
-
/**
|
|
713
|
+
/** Whether or not this manifest can be deleted */
|
|
537
714
|
canDelete?: boolean;
|
|
538
|
-
/**
|
|
715
|
+
/** Whether or not this manifest can be written to */
|
|
539
716
|
canWrite?: boolean;
|
|
540
|
-
/**
|
|
717
|
+
/** Whether or not to include this manifest when listing manifest properties */
|
|
541
718
|
canList?: boolean;
|
|
542
|
-
/**
|
|
719
|
+
/** Whether or not this manifest can be read */
|
|
543
720
|
canRead?: boolean;
|
|
544
721
|
}
|
|
545
722
|
|
|
@@ -547,29 +724,27 @@ export declare interface UpdateManifestPropertiesOptions extends OperationOption
|
|
|
547
724
|
* Options for the `setProperties` method of `ContainerRepository`.
|
|
548
725
|
*/
|
|
549
726
|
export declare interface UpdateRepositoryPropertiesOptions extends OperationOptions {
|
|
550
|
-
/**
|
|
727
|
+
/** Whether or not this repository can be deleted */
|
|
551
728
|
canDelete?: boolean;
|
|
552
|
-
/**
|
|
729
|
+
/** Whether or not this repository can be written to */
|
|
553
730
|
canWrite?: boolean;
|
|
554
|
-
/**
|
|
731
|
+
/** Whether or not include this repository when listing repositories */
|
|
555
732
|
canList?: boolean;
|
|
556
|
-
/**
|
|
733
|
+
/** Whether or not this repository can be read */
|
|
557
734
|
canRead?: boolean;
|
|
558
|
-
/** Enables Teleport functionality on new images in the repository improving Container startup performance */
|
|
559
|
-
teleportEnabled?: boolean;
|
|
560
735
|
}
|
|
561
736
|
|
|
562
737
|
/**
|
|
563
738
|
* Options for the `updateTagProperties` method of `RegistryArtifact`.
|
|
564
739
|
*/
|
|
565
740
|
export declare interface UpdateTagPropertiesOptions extends OperationOptions {
|
|
566
|
-
/**
|
|
741
|
+
/** Whether or not this tag can be deleted */
|
|
567
742
|
canDelete?: boolean;
|
|
568
|
-
/**
|
|
743
|
+
/** Whether or not this tag can be written to */
|
|
569
744
|
canWrite?: boolean;
|
|
570
|
-
/**
|
|
745
|
+
/** Whether or not to include this tag when listing tags */
|
|
571
746
|
canList?: boolean;
|
|
572
|
-
/**
|
|
747
|
+
/** Whether or not this tag can be read */
|
|
573
748
|
canRead?: boolean;
|
|
574
749
|
}
|
|
575
750
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base64.browser.js","sourceRoot":"","sources":["../../src/base64.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB;IAChD,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// eslint-disable-next-line @azure/azure-sdk/ts-no-namespaces\ndeclare global {\n function atob(input: string): string;\n}\n\n/**\n * Base64 decode\n *\n * @internal\n * @param encodedString -\n * @returns\n\n */\nexport function base64decode(encodedString: string): string {\n return atob(encodedString);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/base64.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Base64 decode\n *\n * @internal\n * @param encodedString -\n * @returns\n */\nexport function base64decode(encodedString: string): string {\n return Buffer.from(encodedString, \"base64\").toString();\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.3\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCycler.js","sourceRoot":"","sources":["../../src/tokenCycler.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\n\nfunction delay<T>(t: number, value?: T): Promise<T | void> {\n return new Promise((resolve) => setTimeout(() => resolve(value), t));\n}\n/**\n * A function that gets a promise of an access token and allows providing\n * options.\n *\n * @param options - the options to pass to the underlying token provider\n */\nexport type AccessTokenGetter<T extends GetTokenOptions> = (\n scopes: string | string[],\n options: T\n) => Promise<AccessToken>;\n\n/**\n * The response of the\n */\nexport interface AccessTokenRefresher<T extends GetTokenOptions> {\n cachedToken?: AccessToken;\n getToken: AccessTokenGetter<T>;\n}\n\nexport interface TokenCyclerOptions {\n /**\n * The window of time before token expiration during which the token will be\n * considered unusable due to risk of the token expiring before sending the\n * request.\n *\n * This will only become meaningful if the refresh fails for over\n * (refreshWindow - forcedRefreshWindow) milliseconds.\n */\n forcedRefreshWindowInMs: number;\n /**\n * Interval in milliseconds to retry failed token refreshes.\n */\n retryIntervalInMs: number;\n /**\n * The window of time before token expiration during which\n * we will attempt to refresh the token.\n */\n refreshWindowInMs: number;\n}\n\n// Default options for the cycler if none are provided\nexport const DEFAULT_CYCLER_OPTIONS: TokenCyclerOptions = {\n forcedRefreshWindowInMs: 1000, // Force waiting for a refresh 1s before the token expires\n retryIntervalInMs: 3000, // Allow refresh attempts every 3s\n refreshWindowInMs: 1000 * 60 * 2 // Start refreshing 2m before expiry\n};\n\n/**\n * Converts an an unreliable access token getter (which may resolve with null)\n * into an AccessTokenGetter by retrying the unreliable getter in a regular\n * interval.\n *\n * @param getAccessToken - A function that produces a promise of an access token that may fail by returning null.\n * @param retryIntervalInMs - The time (in milliseconds) to wait between retry attempts.\n * @param refreshTimeout - The timestamp after which the refresh attempt will fail, throwing an exception.\n * @returns - A promise that, if it resolves, will resolve with an access token.\n */\nasync function beginRefresh(\n getAccessToken: () => Promise<AccessToken | null>,\n retryIntervalInMs: number,\n refreshTimeout: number\n): Promise<AccessToken> {\n // This wrapper handles exceptions gracefully as long as we haven't exceeded\n // the timeout.\n async function tryGetAccessToken(): Promise<AccessToken | null> {\n if (Date.now() < refreshTimeout) {\n try {\n return await getAccessToken();\n } catch {\n return null;\n }\n } else {\n const finalToken = await getAccessToken();\n\n // Timeout is up, so throw if it's still null\n if (finalToken === null) {\n throw new Error(\"Failed to refresh access token.\");\n }\n\n return finalToken;\n }\n }\n\n let token: AccessToken | null = await tryGetAccessToken();\n\n while (token === null) {\n await delay(retryIntervalInMs);\n\n token = await tryGetAccessToken();\n }\n\n return token;\n}\n\n/**\n * Creates a token cycler from a credential, scopes, and optional settings.\n *\n * A token cycler represents a way to reliably retrieve a valid access token\n * from a TokenCredential. It will handle initializing the token, refreshing it\n * when it nears expiration, and synchronizes refresh attempts to avoid\n * concurrency hazards.\n *\n * @param credential - the underlying TokenCredential that provides the access\n * token\n * @param tokenCyclerOptions - optionally override default settings for the cycler\n *\n * @returns - a function that reliably produces a valid access token\n */\nexport function createTokenCycler<T extends GetTokenOptions>(\n credential: TokenCredential,\n tokenCyclerOptions?: Partial<TokenCyclerOptions>\n): AccessTokenRefresher<T> {\n let refreshWorker: Promise<AccessToken> | null = null;\n let token: AccessToken | null = null;\n\n const options = {\n ...DEFAULT_CYCLER_OPTIONS,\n ...tokenCyclerOptions\n };\n\n /**\n * This little holder defines several predicates that we use to construct\n * the rules of refreshing the token.\n */\n const cycler = {\n /**\n * Produces true if a refresh job is currently in progress.\n */\n get isRefreshing(): boolean {\n return refreshWorker !== null;\n },\n /**\n * Produces true if the cycler SHOULD refresh (we are within the refresh\n * window and not already refreshing)\n */\n get shouldRefresh(): boolean {\n return (\n !cycler.isRefreshing &&\n (token?.expiresOnTimestamp ?? 0) - options.refreshWindowInMs < Date.now()\n );\n },\n /**\n * Produces true if the cycler MUST refresh (null or nearly-expired\n * token).\n */\n get mustRefresh(): boolean {\n return (\n token === null || token.expiresOnTimestamp - options.forcedRefreshWindowInMs < Date.now()\n );\n }\n };\n\n /**\n * Starts a refresh job or returns the existing job if one is already\n * running.\n */\n function refresh(scopes: string | string[], getTokenOptions: T): Promise<AccessToken> {\n if (!cycler.isRefreshing) {\n // We bind `scopes` here to avoid passing it around a lot\n const tryGetAccessToken = (): Promise<AccessToken | null> =>\n credential.getToken(scopes, getTokenOptions);\n\n // Take advantage of promise chaining to insert an assignment to `token`\n // before the refresh can be considered done.\n refreshWorker = beginRefresh(\n tryGetAccessToken,\n options.retryIntervalInMs,\n // If we don't have a token, then we should timeout immediately\n token?.expiresOnTimestamp ?? Date.now()\n )\n .then((_token) => {\n refreshWorker = null;\n token = _token;\n return token;\n })\n .catch((reason) => {\n // We also should reset the refresher if we enter a failed state. All\n // existing awaiters will throw, but subsequent requests will start a\n // new retry chain.\n refreshWorker = null;\n token = null;\n throw reason;\n });\n }\n\n return refreshWorker as Promise<AccessToken>;\n }\n\n return {\n get cachedToken(): AccessToken | undefined {\n return token || undefined;\n },\n getToken: async (scopes: string | string[], tokenOptions: T): Promise<AccessToken> => {\n //\n // Simple rules:\n // - If we MUST refresh, then return the refresh task, blocking\n // the pipeline until a token is available.\n // - If we SHOULD refresh, then run refresh but don't return it\n // (we can still use the cached token).\n // - Return the token, since it's fine if we didn't return in\n // step 1.\n //\n if (cycler.mustRefresh) return refresh(scopes, tokenOptions);\n\n if (cycler.shouldRefresh) {\n refresh(scopes, tokenOptions);\n }\n\n return token as AccessToken;\n }\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url.browser.js","sourceRoot":"","sources":["../../src/url.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,GAAG,GAAG,GAAG,CAAC;AAChB,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nconst url = URL;\nconst urlSearchParams = URLSearchParams;\n\nexport { url as URL, urlSearchParams as URLSearchParams };\n"]}
|
package/dist-esm/src/url.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/url.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { URL, URLSearchParams } from \"url\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,kCAAkC;IAClC,oDAAoD;IACpD,4CAA4C;IAC5C,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,WAAmB;IAC1C,OAAO,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Extract the path part from the next link value returned by the service,\n * @internal\n */\nexport function extractNextLink(value: string | undefined): string | undefined {\n // The link value has this pattern\n // `</acr/v1/name/...&n=2&orderby=>; rel=\"next\"`\n // and we only want the part inside of <...>\n return value?.substr(1, value.indexOf(\">\") - 1);\n}\n\n/**\n * Checks whether a string is a digest\n * @internal\n */\nexport function isDigest(tagOrDigest: string): boolean {\n return tagOrDigest.includes(\":\");\n}\n"]}
|