@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.
Files changed (72) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +70 -37
  3. package/dist/index.js +1255 -1123
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/containerRegistryChallengeHandler.js +35 -38
  6. package/dist-esm/src/containerRegistryChallengeHandler.js.map +1 -1
  7. package/dist-esm/src/containerRegistryClient.js +69 -50
  8. package/dist-esm/src/containerRegistryClient.js.map +1 -1
  9. package/dist-esm/src/containerRegistryTokenCredential.js +39 -126
  10. package/dist-esm/src/containerRegistryTokenCredential.js.map +1 -1
  11. package/dist-esm/src/containerRepository.js +100 -63
  12. package/dist-esm/src/containerRepository.js.map +1 -1
  13. package/dist-esm/src/generated/generatedClient.js +7 -6
  14. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  15. package/dist-esm/src/generated/generatedClientContext.js +13 -2
  16. package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
  17. package/dist-esm/src/generated/index.js +1 -0
  18. package/dist-esm/src/generated/index.js.map +1 -1
  19. package/dist-esm/src/generated/models/index.js +61 -1
  20. package/dist-esm/src/generated/models/index.js.map +1 -1
  21. package/dist-esm/src/generated/models/mappers.js +514 -557
  22. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  23. package/dist-esm/src/generated/models/parameters.js +87 -7
  24. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  25. package/dist-esm/src/generated/operations/authentication.js +28 -8
  26. package/dist-esm/src/generated/operations/authentication.js.map +1 -1
  27. package/dist-esm/src/generated/operations/containerRegistry.js +27 -7
  28. package/dist-esm/src/generated/operations/containerRegistry.js.map +1 -1
  29. package/dist-esm/src/generated/operations/containerRegistryBlob.js +2 -2
  30. package/dist-esm/src/generated/operations/containerRegistryBlob.js.map +1 -1
  31. package/dist-esm/src/generated/operationsInterfaces/authentication.js +9 -0
  32. package/dist-esm/src/generated/operationsInterfaces/authentication.js.map +1 -0
  33. package/dist-esm/src/generated/operationsInterfaces/containerRegistry.js +9 -0
  34. package/dist-esm/src/generated/operationsInterfaces/containerRegistry.js.map +1 -0
  35. package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js +9 -0
  36. package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js.map +1 -0
  37. package/dist-esm/src/generated/operationsInterfaces/index.js +11 -0
  38. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  39. package/dist-esm/src/index.js.map +1 -1
  40. package/dist-esm/src/models.js +43 -2
  41. package/dist-esm/src/models.js.map +1 -1
  42. package/dist-esm/src/registryArtifact.js +176 -135
  43. package/dist-esm/src/registryArtifact.js.map +1 -1
  44. package/dist-esm/src/tracing.js +1 -1
  45. package/dist-esm/src/tracing.js.map +1 -1
  46. package/dist-esm/src/transformations.js +2 -2
  47. package/dist-esm/src/transformations.js.map +1 -1
  48. package/dist-esm/src/{base64.browser.js → utils/base64.browser.js} +0 -0
  49. package/dist-esm/src/utils/base64.browser.js.map +1 -0
  50. package/dist-esm/src/{base64.js → utils/base64.js} +0 -0
  51. package/dist-esm/src/utils/base64.js.map +1 -0
  52. package/dist-esm/src/{utils.js → utils/helpers.js} +1 -1
  53. package/dist-esm/src/utils/helpers.js.map +1 -0
  54. package/dist-esm/src/{tokenCycler.js → utils/tokenCycler.js} +29 -34
  55. package/dist-esm/src/utils/tokenCycler.js.map +1 -0
  56. package/dist-esm/src/{url.browser.js → utils/url.browser.js} +0 -0
  57. package/dist-esm/src/utils/url.browser.js.map +1 -0
  58. package/dist-esm/src/{url.js → utils/url.js} +0 -0
  59. package/dist-esm/src/utils/url.js.map +1 -0
  60. package/dist-esm/src/{wwwAuthenticateParser.js → utils/wwwAuthenticateParser.js} +0 -0
  61. package/dist-esm/src/utils/wwwAuthenticateParser.js.map +1 -0
  62. package/package.json +22 -25
  63. package/types/container-registry.d.ts +258 -83
  64. package/dist-esm/src/base64.browser.js.map +0 -1
  65. package/dist-esm/src/base64.js.map +0 -1
  66. package/dist-esm/src/constants.js +0 -4
  67. package/dist-esm/src/constants.js.map +0 -1
  68. package/dist-esm/src/tokenCycler.js.map +0 -1
  69. package/dist-esm/src/url.browser.js.map +0 -1
  70. package/dist-esm/src/url.js.map +0 -1
  71. package/dist-esm/src/utils.js.map +0 -1
  72. package/dist-esm/src/wwwAuthenticateParser.js.map +0 -1
@@ -1,42 +1,83 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  /**
4
- * Defines known {@link ArtifactArchitecture} that the service supports.
4
+ * Defines known cloud audiences for Azure Container Registry.
5
+ */
6
+ export var KnownContainerRegistryAudience;
7
+ (function (KnownContainerRegistryAudience) {
8
+ /** Azure China */
9
+ KnownContainerRegistryAudience["AzureResourceManagerChina"] = "https://management.chinacloudapi.cn";
10
+ /** Azure Gemany */
11
+ KnownContainerRegistryAudience["AzureResourceManagerGermany"] = "https://management.microsoftazure.de";
12
+ /** Azure Government */
13
+ KnownContainerRegistryAudience["AzureResourceManagerGovernment"] = "https://management.usgovcloudapi.net";
14
+ /** Azure Public Cloud */
15
+ KnownContainerRegistryAudience["AzureResourceManagerPublicCloud"] = "https://management.azure.com";
16
+ })(KnownContainerRegistryAudience || (KnownContainerRegistryAudience = {}));
17
+ /**
18
+ * Defines known artifact architectures that the service supports.
5
19
  */
6
20
  export var KnownArtifactArchitecture;
7
21
  (function (KnownArtifactArchitecture) {
22
+ /** i386 */
8
23
  KnownArtifactArchitecture["I386"] = "386";
24
+ /** AMD64 */
9
25
  KnownArtifactArchitecture["Amd64"] = "amd64";
26
+ /** ARM */
10
27
  KnownArtifactArchitecture["Arm"] = "arm";
28
+ /** ARM64 */
11
29
  KnownArtifactArchitecture["Arm64"] = "arm64";
30
+ /** MIPS */
12
31
  KnownArtifactArchitecture["Mips"] = "mips";
32
+ /** MIPSLE */
13
33
  KnownArtifactArchitecture["MipsLe"] = "mipsle";
34
+ /** MIPS64 */
14
35
  KnownArtifactArchitecture["Mips64"] = "mips64";
36
+ /** MIPS64LE */
15
37
  KnownArtifactArchitecture["Mips64Le"] = "mips64le";
38
+ /** PPC64 */
16
39
  KnownArtifactArchitecture["Ppc64"] = "ppc64";
40
+ /** PPC64LE */
17
41
  KnownArtifactArchitecture["Ppc64Le"] = "ppc64le";
42
+ /** RISCv64 */
18
43
  KnownArtifactArchitecture["RiscV64"] = "riscv64";
44
+ /** s390x */
19
45
  KnownArtifactArchitecture["S390X"] = "s390x";
46
+ /** Wasm */
20
47
  KnownArtifactArchitecture["Wasm"] = "wasm";
21
48
  })(KnownArtifactArchitecture || (KnownArtifactArchitecture = {}));
22
49
  /**
23
- * Defines known {@link ArtifactOperatingSystem} values that the service supports.
50
+ * Defines known artifact platform's operating systems that the service supports.
24
51
  */
25
52
  export var KnownArtifactOperatingSystem;
26
53
  (function (KnownArtifactOperatingSystem) {
54
+ /** Aix */
27
55
  KnownArtifactOperatingSystem["Aix"] = "aix";
56
+ /** Android */
28
57
  KnownArtifactOperatingSystem["Android"] = "android";
58
+ /** Darwin */
29
59
  KnownArtifactOperatingSystem["Darwin"] = "darwin";
60
+ /** Dragonfly */
30
61
  KnownArtifactOperatingSystem["Dragonfly"] = "dragonfly";
62
+ /** FreeBSD */
31
63
  KnownArtifactOperatingSystem["FreeBsd"] = "freebsd";
64
+ /** Illumos */
32
65
  KnownArtifactOperatingSystem["Illumos"] = "illumos";
66
+ /** iOS */
33
67
  KnownArtifactOperatingSystem["iOS"] = "ios";
68
+ /** JS */
34
69
  KnownArtifactOperatingSystem["JS"] = "js";
70
+ /** Linux */
35
71
  KnownArtifactOperatingSystem["Linux"] = "linux";
72
+ /** NetBSD */
36
73
  KnownArtifactOperatingSystem["NetBsd"] = "netbsd";
74
+ /** OpenBSD */
37
75
  KnownArtifactOperatingSystem["OpenBsd"] = "openbsd";
76
+ /** Plan9 */
38
77
  KnownArtifactOperatingSystem["Plan9"] = "plan9";
78
+ /** Solaris */
39
79
  KnownArtifactOperatingSystem["Solaris"] = "solaris";
80
+ /** Windows */
40
81
  KnownArtifactOperatingSystem["Windows"] = "windows";
41
82
  })(KnownArtifactOperatingSystem || (KnownArtifactOperatingSystem = {}));
42
83
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAN,IAAY,yBAcX;AAdD,WAAY,yBAAyB;IACnC,yCAAY,CAAA;IACZ,4CAAe,CAAA;IACf,wCAAW,CAAA;IACX,4CAAe,CAAA;IACf,0CAAa,CAAA;IACb,8CAAiB,CAAA;IACjB,8CAAiB,CAAA;IACjB,kDAAqB,CAAA;IACrB,4CAAe,CAAA;IACf,gDAAmB,CAAA;IACnB,gDAAmB,CAAA;IACnB,4CAAe,CAAA;IACf,0CAAa,CAAA;AACf,CAAC,EAdW,yBAAyB,KAAzB,yBAAyB,QAcpC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,4BAeX;AAfD,WAAY,4BAA4B;IACtC,2CAAW,CAAA;IACX,mDAAmB,CAAA;IACnB,iDAAiB,CAAA;IACjB,uDAAuB,CAAA;IACvB,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;IACnB,2CAAW,CAAA;IACX,yCAAS,CAAA;IACT,+CAAe,CAAA;IACf,iDAAiB,CAAA;IACjB,mDAAmB,CAAA;IACnB,+CAAe,CAAA;IACf,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;AACrB,CAAC,EAfW,4BAA4B,KAA5B,4BAA4B,QAevC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { ContainerRepositoryProperties, ArtifactTagProperties } from \"./generated\";\n\nimport { ArtifactTagProperties } from \"./generated\";\n\n/**\n * Defines known {@link ArtifactArchitecture} that the service supports.\n */\nexport enum KnownArtifactArchitecture {\n I386 = \"386\",\n Amd64 = \"amd64\",\n Arm = \"arm\",\n Arm64 = \"arm64\",\n Mips = \"mips\",\n MipsLe = \"mipsle\",\n Mips64 = \"mips64\",\n Mips64Le = \"mips64le\",\n Ppc64 = \"ppc64\",\n Ppc64Le = \"ppc64le\",\n RiscV64 = \"riscv64\",\n S390X = \"s390x\",\n Wasm = \"wasm\"\n}\n\n/**\n * Defines known {@link ArtifactOperatingSystem} values that the service supports.\n */\nexport enum KnownArtifactOperatingSystem {\n Aix = \"aix\",\n Android = \"android\",\n Darwin = \"darwin\",\n Dragonfly = \"dragonfly\",\n FreeBsd = \"freebsd\",\n Illumos = \"illumos\",\n iOS = \"ios\",\n JS = \"js\",\n Linux = \"linux\",\n NetBsd = \"netbsd\",\n OpenBsd = \"openbsd\",\n Plan9 = \"plan9\",\n Solaris = \"solaris\",\n Windows = \"windows\"\n}\n\n/** Manifest attributes details */\nexport interface ArtifactManifestPlatform {\n /**\n * Manifest digest\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly digest: string;\n /**\n * CPU architecture. See {@link KnownArtifactArchitecture} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly architecture?: string;\n /**\n * Operating system. See {@link KnownArtifactOperatingSystem} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly operatingSystem?: string;\n}\n\n/** Manifest attributes details */\nexport interface ArtifactManifestProperties {\n /**\n * Registry login server name. This is likely to be similar to <registry-name>.azurecr.io\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly registryLoginServer: string;\n /**\n * Repository name\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly repositoryName: string;\n /**\n * Manifest\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly digest: string;\n /**\n * Image size\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly size?: number;\n /**\n * Created time\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly createdOn: Date;\n /**\n * Last update time\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly lastUpdatedOn: Date;\n /**\n * CPU architecture. See {@link KnownArtifactArchitecture} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly architecture?: string;\n /**\n * Operating system. See {@link KnownArtifactOperatingSystem} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly operatingSystem?: string;\n /**\n * List of manifests referenced by this manifest list. List will be empty if this manifest is not a manifest list.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly relatedArtifacts: ArtifactManifestPlatform[];\n /**\n * List of tags\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly tags: string[];\n /** Delete enabled */\n canDelete?: boolean;\n /** Write enabled */\n canWrite?: boolean;\n /** List enabled */\n canList?: boolean;\n /** Read enabled */\n canRead?: boolean;\n}\n\n/**\n * Defines values for TagOrderBy.\n * this contains the known values that the service supports.\n * ### Know values supported by the service\n * **LastUpdatedOnDescending**: Order tags by LastUpdatedOn field, from most recently updated to least recently updated.\n * **LastUpdatedOnAscending**: Order tags by LastUpdatedOn field, from least recently updated to most recently updated.\n */\nexport type TagOrderBy = \"LastUpdatedOnDescending\" | \"LastUpdatedOnAscending\";\n\n/**\n * Defines values for RegistryArtifactOrderBy.\n * this contains the known values that the service supports.\n * ### Know values supported by the service\n * **LastUpdatedOnDescending**: Order registry artifacts by LastUpdatedOn field, from most recently updated to least recently updated.\n * **LastUpdatedOnAscending**: Order registry artifacts by LastUpdatedOn field, from least recently updated to most recently updated.\n */\nexport type ManifestOrderBy = \"LastUpdatedOnDescending\" | \"LastUpdatedOnAscending\";\n\n/**\n * Contains response data for the listRepositoryNames operation.\n */\nexport interface RepositoryPageResponse extends Array<string> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n\n/**\n * Contains response data for the listManifests operation.\n */\nexport interface ManifestPageResponse extends Array<ArtifactManifestProperties> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n\n/**\n * Contains response data for the listTags operation.\n */\nexport interface TagPageResponse extends Array<ArtifactTagProperties> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAN,IAAY,8BASX;AATD,WAAY,8BAA8B;IACxC,kBAAkB;IAClB,mGAAiE,CAAA;IACjE,mBAAmB;IACnB,sGAAoE,CAAA;IACpE,uBAAuB;IACvB,yGAAuE,CAAA;IACvE,yBAAyB;IACzB,kGAAgE,CAAA;AAClE,CAAC,EATW,8BAA8B,KAA9B,8BAA8B,QASzC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,yBA2BX;AA3BD,WAAY,yBAAyB;IACnC,WAAW;IACX,yCAAY,CAAA;IACZ,YAAY;IACZ,4CAAe,CAAA;IACf,UAAU;IACV,wCAAW,CAAA;IACX,YAAY;IACZ,4CAAe,CAAA;IACf,WAAW;IACX,0CAAa,CAAA;IACb,aAAa;IACb,8CAAiB,CAAA;IACjB,aAAa;IACb,8CAAiB,CAAA;IACjB,eAAe;IACf,kDAAqB,CAAA;IACrB,YAAY;IACZ,4CAAe,CAAA;IACf,cAAc;IACd,gDAAmB,CAAA;IACnB,cAAc;IACd,gDAAmB,CAAA;IACnB,YAAY;IACZ,4CAAe,CAAA;IACf,WAAW;IACX,0CAAa,CAAA;AACf,CAAC,EA3BW,yBAAyB,KAAzB,yBAAyB,QA2BpC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,4BA6BX;AA7BD,WAAY,4BAA4B;IACtC,UAAU;IACV,2CAAW,CAAA;IACX,cAAc;IACd,mDAAmB,CAAA;IACnB,aAAa;IACb,iDAAiB,CAAA;IACjB,gBAAgB;IAChB,uDAAuB,CAAA;IACvB,cAAc;IACd,mDAAmB,CAAA;IACnB,cAAc;IACd,mDAAmB,CAAA;IACnB,UAAU;IACV,2CAAW,CAAA;IACX,SAAS;IACT,yCAAS,CAAA;IACT,YAAY;IACZ,+CAAe,CAAA;IACf,aAAa;IACb,iDAAiB,CAAA;IACjB,cAAc;IACd,mDAAmB,CAAA;IACnB,YAAY;IACZ,+CAAe,CAAA;IACf,cAAc;IACd,mDAAmB,CAAA;IACnB,cAAc;IACd,mDAAmB,CAAA;AACrB,CAAC,EA7BW,4BAA4B,KAA5B,4BAA4B,QA6BvC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { ContainerRepositoryProperties, ArtifactTagProperties } from \"./generated\";\n\nimport { ArtifactTagProperties } from \"./generated\";\n\n/**\n * Defines known cloud audiences for Azure Container Registry.\n */\nexport enum KnownContainerRegistryAudience {\n /** Azure China */\n AzureResourceManagerChina = \"https://management.chinacloudapi.cn\",\n /** Azure Gemany */\n AzureResourceManagerGermany = \"https://management.microsoftazure.de\",\n /** Azure Government */\n AzureResourceManagerGovernment = \"https://management.usgovcloudapi.net\",\n /** Azure Public Cloud */\n AzureResourceManagerPublicCloud = \"https://management.azure.com\",\n}\n\n/**\n * Defines known artifact architectures that the service supports.\n */\nexport enum KnownArtifactArchitecture {\n /** i386 */\n I386 = \"386\",\n /** AMD64 */\n Amd64 = \"amd64\",\n /** ARM */\n Arm = \"arm\",\n /** ARM64 */\n Arm64 = \"arm64\",\n /** MIPS */\n Mips = \"mips\",\n /** MIPSLE */\n MipsLe = \"mipsle\",\n /** MIPS64 */\n Mips64 = \"mips64\",\n /** MIPS64LE */\n Mips64Le = \"mips64le\",\n /** PPC64 */\n Ppc64 = \"ppc64\",\n /** PPC64LE */\n Ppc64Le = \"ppc64le\",\n /** RISCv64 */\n RiscV64 = \"riscv64\",\n /** s390x */\n S390X = \"s390x\",\n /** Wasm */\n Wasm = \"wasm\",\n}\n\n/**\n * Defines known artifact platform's operating systems that the service supports.\n */\nexport enum KnownArtifactOperatingSystem {\n /** Aix */\n Aix = \"aix\",\n /** Android */\n Android = \"android\",\n /** Darwin */\n Darwin = \"darwin\",\n /** Dragonfly */\n Dragonfly = \"dragonfly\",\n /** FreeBSD */\n FreeBsd = \"freebsd\",\n /** Illumos */\n Illumos = \"illumos\",\n /** iOS */\n iOS = \"ios\",\n /** JS */\n JS = \"js\",\n /** Linux */\n Linux = \"linux\",\n /** NetBSD */\n NetBsd = \"netbsd\",\n /** OpenBSD */\n OpenBsd = \"openbsd\",\n /** Plan9 */\n Plan9 = \"plan9\",\n /** Solaris */\n Solaris = \"solaris\",\n /** Windows */\n Windows = \"windows\",\n}\n\n/** Manifest attributes details */\nexport interface ArtifactManifestPlatform {\n /**\n * Manifest digest\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly digest: string;\n /**\n * CPU architecture. See {@link KnownArtifactArchitecture} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly architecture?: string;\n /**\n * Operating system. See {@link KnownArtifactOperatingSystem} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly operatingSystem?: string;\n}\n\n/** Manifest attributes details */\nexport interface ArtifactManifestProperties {\n /**\n * Registry login server name. This is likely to be similar to <registry-name>.azurecr.io\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly registryLoginServer: string;\n /**\n * Repository name\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly repositoryName: string;\n /**\n * Manifest\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly digest: string;\n /**\n * Image size\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly sizeInBytes?: number;\n /**\n * Created time\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly createdOn: Date;\n /**\n * Last update time\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly lastUpdatedOn: Date;\n /**\n * CPU architecture. See {@link KnownArtifactArchitecture} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly architecture?: string;\n /**\n * Operating system. See {@link KnownArtifactOperatingSystem} for values supported by the service.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly operatingSystem?: string;\n /**\n * List of manifests referenced by this manifest list. List will be empty if this manifest is not a manifest list.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly relatedArtifacts: ArtifactManifestPlatform[];\n /**\n * List of tags\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly tags: string[];\n /** Delete enabled */\n canDelete?: boolean;\n /** Write enabled */\n canWrite?: boolean;\n /** List enabled */\n canList?: boolean;\n /** Read enabled */\n canRead?: boolean;\n}\n\n/**\n * Defines values for ArtifactTagOrder.\n * this contains the known values that the service supports.\n * ### Know values supported by the service\n * **LastUpdatedOnDescending**: Order tags by LastUpdatedOn field, from most recently updated to least recently updated.\n * **LastUpdatedOnAscending**: Order tags by LastUpdatedOn field, from least recently updated to most recently updated.\n */\nexport type ArtifactTagOrder = \"LastUpdatedOnDescending\" | \"LastUpdatedOnAscending\";\n\n/**\n * Defines values for ArtifactManifestOrder.\n * this contains the known values that the service supports.\n * ### Know values supported by the service\n * **LastUpdatedOnDescending**: Order registry artifacts by LastUpdatedOn field, from most recently updated to least recently updated.\n * **LastUpdatedOnAscending**: Order registry artifacts by LastUpdatedOn field, from least recently updated to most recently updated.\n */\nexport type ArtifactManifestOrder = \"LastUpdatedOnDescending\" | \"LastUpdatedOnAscending\";\n\n/**\n * Contains response data for the listRepositoryNames operation.\n */\nexport interface RepositoryPageResponse extends Array<string> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n\n/**\n * Contains response data for the listManifests operation.\n */\nexport interface ManifestPageResponse extends Array<ArtifactManifestProperties> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n\n/**\n * Contains response data for the listTags operation.\n */\nexport interface TagPageResponse extends Array<ArtifactTagProperties> {\n /**\n * Continuation token to pass to `byPage()` to resume listing of more results if available.\n */\n continuationToken?: string;\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter } from "tslib";
3
+ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
4
  import { SpanStatusCode } from "@azure/core-tracing";
5
5
  import "@azure/core-paging";
6
- import { URL } from "./url";
6
+ import { URL } from "./utils/url";
7
7
  import { createSpan } from "./tracing";
8
- import { extractNextLink, isDigest } from "./utils";
8
+ import { extractNextLink, isDigest } from "./utils/helpers";
9
9
  import { toArtifactManifestProperties, toServiceTagOrderBy } from "./transformations";
10
10
  /**
11
11
  * The client class used to interact with the Container Registry service.
@@ -36,163 +36,176 @@ export class RegistryArtifactImpl {
36
36
  /**
37
37
  * digest of this artifact.
38
38
  */
39
- getDigest() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- if (this.digest) {
42
- return this.digest;
43
- }
44
- if (!isDigest(this.tagOrDigest)) {
45
- this.digest = (yield this.getTagProperties(this.tagOrDigest)).digest;
46
- }
47
- else {
48
- this.digest = this.tagOrDigest;
49
- }
39
+ async getDigest() {
40
+ if (this.digest) {
50
41
  return this.digest;
51
- });
42
+ }
43
+ if (!isDigest(this.tagOrDigest)) {
44
+ this.digest = (await this.getTagProperties(this.tagOrDigest)).digest;
45
+ }
46
+ else {
47
+ this.digest = this.tagOrDigest;
48
+ }
49
+ return this.digest;
52
50
  }
53
51
  /**
54
- * Deletes this artifact.
52
+ * Deletes this registry artifact by deleting its manifest.
55
53
  * @param options -
56
54
  */
57
- delete(options = {}) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const { span, updatedOptions } = createSpan("RegistryArtifact-delete", options);
60
- try {
61
- yield this.client.containerRegistry.deleteManifest(this.repositoryName, yield this.getDigest(), updatedOptions);
62
- }
63
- catch (e) {
64
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
65
- throw e;
66
- }
67
- finally {
68
- span.end();
69
- }
70
- });
55
+ async delete(options = {}) {
56
+ const { span, updatedOptions } = createSpan("RegistryArtifact-delete", options);
57
+ try {
58
+ await this.client.containerRegistry.deleteManifest(this.repositoryName, await this.getDigest(), updatedOptions);
59
+ }
60
+ catch (e) {
61
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
62
+ throw e;
63
+ }
64
+ finally {
65
+ span.end();
66
+ }
71
67
  }
72
68
  /**
73
- * Deletes a tag.
74
- * @param tag - the name of the tag to be deleted.
69
+ * Deletes a tag. This removes the tag from the artifact and its manifest.
70
+ * @param tag - the name of the tag to delete.
75
71
  * @param options -
76
72
  */
77
- deleteTag(tag, options = {}) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- if (!tag) {
80
- throw new Error("invalid tag");
81
- }
82
- const { span, updatedOptions } = createSpan("RegistryArtifact-deleteTag", options);
83
- try {
84
- yield this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);
85
- }
86
- catch (e) {
87
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
88
- throw e;
89
- }
90
- finally {
91
- span.end();
92
- }
93
- });
73
+ async deleteTag(tag, options = {}) {
74
+ if (!tag) {
75
+ throw new Error("invalid tag");
76
+ }
77
+ const { span, updatedOptions } = createSpan("RegistryArtifact-deleteTag", options);
78
+ try {
79
+ await this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);
80
+ }
81
+ catch (e) {
82
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
83
+ throw e;
84
+ }
85
+ finally {
86
+ span.end();
87
+ }
94
88
  }
95
89
  /**
96
- * Retrieves properties of this registry artifact.
90
+ * Retrieves the properties of the manifest that uniquely identifies this artifact.
97
91
  * @param options -
98
92
  */
99
- getManifestProperties(options = {}) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- const { span, updatedOptions } = createSpan("RegistryArtifact-getManifestProperties", options);
102
- try {
103
- const result = yield this.client.containerRegistry.getManifestProperties(this.repositoryName, yield this.getDigest(), updatedOptions);
104
- return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer);
105
- }
106
- catch (e) {
107
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
108
- throw e;
109
- }
110
- finally {
111
- span.end();
112
- }
113
- });
93
+ async getManifestProperties(options = {}) {
94
+ const { span, updatedOptions } = createSpan("RegistryArtifact-getManifestProperties", options);
95
+ try {
96
+ const result = await this.client.containerRegistry.getManifestProperties(this.repositoryName, await this.getDigest(), updatedOptions);
97
+ return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer);
98
+ }
99
+ catch (e) {
100
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
101
+ throw e;
102
+ }
103
+ finally {
104
+ span.end();
105
+ }
114
106
  }
115
107
  /**
116
- * Updates manifest artifact attributes.
108
+ * Updates the properties of the artifact's manifest.
109
+ *
110
+ * Example usage:
111
+ *
112
+ * ```javascript
113
+ * const client = new ContainerRegistryClient(url, credential);
114
+ * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)
115
+ * const updated = await artifact.updateManifestProperties({
116
+ * canDelete: false,
117
+ * canList: false,
118
+ * canRead: false,
119
+ * canWrite: false
120
+ * });
121
+ * ```
117
122
  * @param options -
118
123
  */
119
- updateManifestProperties(options = {}) {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- const { span, updatedOptions } = createSpan("RegistryArtifact-updateManifestProperties", Object.assign(Object.assign({}, options), { value: {
122
- canDelete: options.canDelete,
123
- canWrite: options.canWrite,
124
- canList: options.canList,
125
- canRead: options.canRead
126
- } }));
127
- try {
128
- const result = yield this.client.containerRegistry.updateManifestProperties(this.repositoryName, yield this.getDigest(), updatedOptions);
129
- return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer);
130
- }
131
- catch (e) {
132
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
133
- throw e;
134
- }
135
- finally {
136
- span.end();
137
- }
138
- });
124
+ async updateManifestProperties(options) {
125
+ const { span, updatedOptions } = createSpan("RegistryArtifact-updateManifestProperties", Object.assign(Object.assign({}, options), { value: {
126
+ canDelete: options.canDelete,
127
+ canWrite: options.canWrite,
128
+ canList: options.canList,
129
+ canRead: options.canRead,
130
+ } }));
131
+ try {
132
+ const result = await this.client.containerRegistry.updateManifestProperties(this.repositoryName, await this.getDigest(), updatedOptions);
133
+ return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer);
134
+ }
135
+ catch (e) {
136
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
137
+ throw e;
138
+ }
139
+ finally {
140
+ span.end();
141
+ }
139
142
  }
140
143
  /**
141
- * Retrieves properties of a tag.
144
+ * Retrieves the properties of the specified tag.
142
145
  * @param tag - the tag to retrieve properties.
143
146
  * @param options -
144
147
  */
145
- getTagProperties(tag, options = {}) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- if (!tag) {
148
- throw new Error("invalid tag");
149
- }
150
- const { span, updatedOptions } = createSpan("RegistryArtifact-getTagProperties", options);
151
- try {
152
- return yield this.client.containerRegistry.getTagProperties(this.repositoryName, tag, updatedOptions);
153
- }
154
- catch (e) {
155
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
156
- throw e;
157
- }
158
- finally {
159
- span.end();
160
- }
161
- });
148
+ async getTagProperties(tag, options = {}) {
149
+ if (!tag) {
150
+ throw new Error("invalid tag");
151
+ }
152
+ const { span, updatedOptions } = createSpan("RegistryArtifact-getTagProperties", options);
153
+ try {
154
+ return await this.client.containerRegistry.getTagProperties(this.repositoryName, tag, updatedOptions);
155
+ }
156
+ catch (e) {
157
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
158
+ throw e;
159
+ }
160
+ finally {
161
+ span.end();
162
+ }
162
163
  }
163
164
  /**
164
- * Updates tag properties.
165
- * @param tag - name of the tag
165
+ * Updates the properties of a given tag.
166
+ *
167
+ * Example usage:
168
+ *
169
+ * ```javascript
170
+ * const client = new ContainerRegistryClient(url, credential);
171
+ * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)
172
+ * const updated = await artifact.updateTagProperties(tag, {
173
+ * canDelete: false,
174
+ * canList: false,
175
+ * canRead: false,
176
+ * canWrite: false
177
+ * });
178
+ * ```
179
+ * @param tag - name of the tag to update properties on
166
180
  * @param options -
167
181
  */
168
- updateTagProperties(tag, options) {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- if (!tag) {
171
- throw new Error("invalid tag");
172
- }
173
- const { span, updatedOptions } = createSpan("RegistryArtifact-updateTagProperties", Object.assign(Object.assign({}, options), { value: {
174
- canDelete: options.canDelete,
175
- canWrite: options.canWrite,
176
- canList: options.canList,
177
- canRead: options.canRead
178
- } }));
179
- try {
180
- return yield this.client.containerRegistry.updateTagAttributes(this.repositoryName, tag, updatedOptions);
181
- }
182
- catch (e) {
183
- span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
184
- throw e;
185
- }
186
- finally {
187
- span.end();
188
- }
189
- });
182
+ async updateTagProperties(tag, options) {
183
+ if (!tag) {
184
+ throw new Error("invalid tag");
185
+ }
186
+ const { span, updatedOptions } = createSpan("RegistryArtifact-updateTagProperties", Object.assign(Object.assign({}, options), { value: {
187
+ canDelete: options.canDelete,
188
+ canWrite: options.canWrite,
189
+ canList: options.canList,
190
+ canRead: options.canRead,
191
+ } }));
192
+ try {
193
+ return await this.client.containerRegistry.updateTagAttributes(this.repositoryName, tag, updatedOptions);
194
+ }
195
+ catch (e) {
196
+ span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
197
+ throw e;
198
+ }
199
+ finally {
200
+ span.end();
201
+ }
190
202
  }
191
203
  /**
192
- * Iterates tags.
204
+ * Returns an async iterable iterator to list the tags that uniquely identify this artifact and the properties of each.
193
205
  *
194
- * Example usage:
195
- * ```ts
206
+ * Example using `for-await-of` syntax:
207
+ *
208
+ * ```javascript
196
209
  * const client = new ContainerRegistryClient(url, credentials);
197
210
  * const repository = client.getRepository(repositoryName);
198
211
  * const artifact = repository.getArtifact(digest)
@@ -200,6 +213,34 @@ export class RegistryArtifactImpl {
200
213
  * console.log("tag: ", tag);
201
214
  * }
202
215
  * ```
216
+ *
217
+ * Example using `iter.next()`:
218
+ *
219
+ * ```javascript
220
+ * const iter = artifact.listTagProperties();
221
+ * let item = await iter.next();
222
+ * while (!item.done) {
223
+ * console.log("tag properties: ", item.value);
224
+ * item = await iter.next();
225
+ * }
226
+ * ```
227
+ *
228
+ * Example using `byPage()`:
229
+ *
230
+ * ```javascript
231
+ * const pages = artifact.listTagProperties().byPage({ maxPageSize: 2 });
232
+ * let page = await pages.next();
233
+ * let i = 1;
234
+ * while (!page.done) {
235
+ * if (page.value) {
236
+ * console.log(`-- page ${i++}`);
237
+ * for (const tagProperties of page.value) {
238
+ * console.log(` repository name: ${tagProperties}`);
239
+ * }
240
+ * }
241
+ * page = await pages.next();
242
+ * }
243
+ * ```
203
244
  * @param options -
204
245
  */
205
246
  listTagProperties(options = {}) {
@@ -211,7 +252,7 @@ export class RegistryArtifactImpl {
211
252
  [Symbol.asyncIterator]() {
212
253
  return this;
213
254
  },
214
- byPage: (settings = {}) => this.listTagsPage(settings, options)
255
+ byPage: (settings = {}) => this.listTagsPage(settings, options),
215
256
  };
216
257
  }
217
258
  listTagsItems(options = {}) {
@@ -234,7 +275,7 @@ export class RegistryArtifactImpl {
234
275
  }
235
276
  listTagsPage(continuationState, options = {}) {
236
277
  return __asyncGenerator(this, arguments, function* listTagsPage_1() {
237
- const orderby = toServiceTagOrderBy(options.orderBy);
278
+ const orderby = toServiceTagOrderBy(options.order);
238
279
  if (!continuationState.continuationToken) {
239
280
  const optionsComplete = Object.assign(Object.assign({}, options), { n: continuationState.maxPageSize, orderby });
240
281
  const currentPage = yield __await(this.client.containerRegistry.getTags(this.repositoryName, optionsComplete));
@@ -245,7 +286,7 @@ export class RegistryArtifactImpl {
245
286
  });
246
287
  yield yield __await(Object.defineProperty(array, "continuationToken", {
247
288
  value: continuationState.continuationToken,
248
- enumerable: true
289
+ enumerable: true,
249
290
  }));
250
291
  }
251
292
  }
@@ -258,7 +299,7 @@ export class RegistryArtifactImpl {
258
299
  });
259
300
  yield yield __await(Object.defineProperty(array, "continuationToken", {
260
301
  value: continuationState.continuationToken,
261
- enumerable: true
302
+ enumerable: true,
262
303
  }));
263
304
  }
264
305
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registryArtifact.js","sourceRoot":"","sources":["../../src/registryArtifact.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,oBAAoB,CAAC;AAS5B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAkItF;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAkB/B;;;;;;OAMG;IACH,YACE,gBAAwB,EACxB,cAAsB,EACd,WAAmB,EAC3B,MAAuB;QADf,gBAAW,GAAX,WAAW,CAAQ;QAG3B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QAErC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;YAC1B,IAAI,CAAC,uBAAuB,GAAG,GAAG,SAAS,CAAC,QAAQ,IAAI,cAAc,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;SACzF;aAAM;YACL,IAAI,CAAC,uBAAuB,GAAG,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AAiB,EAAE;gBAC1C,MAAM,WAAW,GAAG,cAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,WAAW,CACjE,IAAI,CAAC,cAAc,EACnB,iBAAiB,CAAC,iBAAiB,EACnC,OAAO,CACR,CAAA,CAAC;gBACF,iBAAiB,CAAC,iBAAiB,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACxE,IAAI,WAAW,CAAC,iBAAiB,EAAE;oBACjC,MAAM,KAAK,GAAG,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACpD,uBACE,mBAAmB,EAAE,WAAW,CAAC,mBAAmB,EACpD,cAAc,EAAE,WAAW,CAAC,UAAU,IACnC,CAAC,EACJ;oBACJ,CAAC,CAAC,CAAC;oBACH,oBAAM,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE;wBACtD,KAAK,EAAE,iBAAiB,CAAC,iBAAiB;wBAC1C,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAA,CAAC;iBACJ;aACF;QACH,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport \"@azure/core-paging\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nimport {\n ArtifactTagProperties,\n ArtifactManifestProperties,\n TagOrderBy,\n TagPageResponse\n} from \"./models\";\nimport { URL } from \"./url\";\nimport { createSpan } from \"./tracing\";\nimport { GeneratedClient } from \"./generated\";\nimport { extractNextLink, isDigest } from \"./utils\";\nimport { toArtifactManifestProperties, toServiceTagOrderBy } from \"./transformations\";\n\n/**\n * Options for the `delete` method of `RegistryArtifact`.\n */\nexport interface DeleteArtifactOptions extends OperationOptions {}\n/**\n * Options for the `deleteTag` method of `RegistryArtifact`.\n */\nexport interface DeleteTagOptions extends OperationOptions {}\n/**\n * Options for the `getManifestProperties` method of `RegistryArtifact`.\n */\nexport interface GetManifestPropertiesOptions extends OperationOptions {}\n/**\n * Options for the `getTagProperties` method of `RegistryArtifact`.\n */\nexport interface GetTagPropertiesOptions extends OperationOptions {}\n\n/**\n * Options for the `updateTagProperties` method of `RegistryArtifact`.\n */\nexport interface UpdateTagPropertiesOptions extends OperationOptions {\n /** Delete enabled */\n canDelete?: boolean;\n /** Write enabled */\n canWrite?: boolean;\n /** List enabled */\n canList?: boolean;\n /** Read enabled */\n canRead?: boolean;\n}\n\n/**\n * Options for the `updateManifestProperties` method of `RegistryArtifact`.\n */\nexport interface UpdateManifestPropertiesOptions extends OperationOptions {\n /** Delete enabled */\n canDelete?: boolean;\n /** Write enabled */\n canWrite?: boolean;\n /** List enabled */\n canList?: boolean;\n /** Read enabled */\n canRead?: boolean;\n}\n\n/**\n * Options for the `listTagProperties` method of `RegistryArtifact`.\n */\nexport interface ListTagPropertiesOptions extends OperationOptions {\n /** orderby query parameter */\n orderBy?: TagOrderBy;\n}\n\n/**\n * The helper used to interact with the Container Registry artifact.\n */\nexport interface RegistryArtifact {\n /**\n * The Azure Container Registry endpoint.\n */\n readonly registryEndpoint: string;\n /**\n * Repository name.\n */\n readonly repositoryName: string;\n /**\n * fully qualified reference of the artifact.\n */\n readonly fullyQualifiedReference: string;\n /**\n * Deletes this artifact.\n * @param options -\n */\n delete(options?: DeleteArtifactOptions): Promise<void>;\n /**\n * Deletes a tag.\n * @param tag - the name of the tag to be deleted.\n * @param options -\n */\n deleteTag(tag: string, options?: DeleteTagOptions): Promise<void>;\n /**\n * Retrieves properties of this registry artifact.\n * @param options -\n */\n getManifestProperties(\n options?: GetManifestPropertiesOptions\n ): Promise<ArtifactManifestProperties>;\n /**\n * Updates manifest artifact attributes.\n * @param options -\n */\n updateManifestProperties(\n options?: UpdateManifestPropertiesOptions\n ): Promise<ArtifactManifestProperties>;\n /**\n * Retrieves properties of a tag.\n * @param tag - the tag to retrieve properties.\n * @param options -\n */\n getTagProperties(tag: string, options?: GetTagPropertiesOptions): Promise<ArtifactTagProperties>;\n /**\n * Updates tag properties.\n * @param tag - name of the tag\n * @param options -\n */\n updateTagProperties(\n tag: string,\n options: UpdateTagPropertiesOptions\n ): Promise<ArtifactTagProperties>;\n /**\n * Iterates tags.\n *\n * Example usage:\n * ```ts\n * const client = new ContainerRegistryClient(url, credentials);\n * const repository = client.getRepository(repositoryName);\n * const artifact = repository.getArtifact(digest)\n * for await (const tag of artifact.listTagProperties()) {\n * console.log(\"tag: \", tag);\n * }\n * ```\n * @param options -\n */\n listTagProperties(\n options?: ListTagPropertiesOptions\n ): PagedAsyncIterableIterator<ArtifactTagProperties>;\n}\n\n/**\n * The client class used to interact with the Container Registry service.\n * @internal\n */\nexport class RegistryArtifactImpl {\n private client: GeneratedClient;\n /**\n * The Azure Container Registry endpoint.\n */\n public readonly registryEndpoint: string;\n /**\n * Repository name.\n */\n public readonly repositoryName: string;\n\n /**\n * Name of the form 'registry-login-server/repository-name\\@digest' or\n * 'registry-login-server/repository-name:tag'\n */\n public readonly fullyQualifiedReference: string;\n\n private digest?: string;\n /**\n * Creates an instance of a RegistryArtifact.\n * @param registryEndpoint - the URL to the Container Registry endpoint\n * @param repositoryName - the name of the repository\n * @param tagOrDigest - the tag or digest of this artifact\n * @param client - the generated client that interacts with service\n */\n constructor(\n registryEndpoint: string,\n repositoryName: string,\n private tagOrDigest: string,\n client: GeneratedClient\n ) {\n this.registryEndpoint = registryEndpoint;\n this.repositoryName = repositoryName;\n\n const parsedUrl = new URL(registryEndpoint);\n if (isDigest(tagOrDigest)) {\n this.digest = tagOrDigest;\n this.fullyQualifiedReference = `${parsedUrl.hostname}/${repositoryName}@${this.digest}`;\n } else {\n this.fullyQualifiedReference = `${parsedUrl.hostname}/${repositoryName}:${tagOrDigest}`;\n }\n\n this.client = client;\n }\n\n /**\n * digest of this artifact.\n */\n private async getDigest(): Promise<string> {\n if (this.digest) {\n return this.digest;\n }\n\n if (!isDigest(this.tagOrDigest)) {\n this.digest = (await this.getTagProperties(this.tagOrDigest)).digest;\n } else {\n this.digest = this.tagOrDigest;\n }\n\n return this.digest;\n }\n\n /**\n * Deletes this artifact.\n * @param options -\n */\n public async delete(options: DeleteArtifactOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-delete\", options);\n\n try {\n await this.client.containerRegistry.deleteManifest(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a tag.\n * @param tag - the name of the tag to be deleted.\n * @param options -\n */\n public async deleteTag(tag: string, options: DeleteTagOptions = {}): Promise<void> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-deleteTag\", options);\n\n try {\n await this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves properties of this registry artifact.\n * @param options -\n */\n public async getManifestProperties(\n options: GetManifestPropertiesOptions = {}\n ): Promise<ArtifactManifestProperties> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-getManifestProperties\", options);\n\n try {\n const result = await this.client.containerRegistry.getManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer!);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Updates manifest artifact attributes.\n * @param options -\n */\n public async updateManifestProperties(\n options: UpdateManifestPropertiesOptions = {}\n ): Promise<ArtifactManifestProperties> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-updateManifestProperties\", {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead\n }\n });\n\n try {\n const result = await this.client.containerRegistry.updateManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer!);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves properties of a tag.\n * @param tag - the tag to retrieve properties.\n * @param options -\n */\n public async getTagProperties(\n tag: string,\n options: GetTagPropertiesOptions = {}\n ): Promise<ArtifactTagProperties> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-getTagProperties\", options);\n try {\n return await this.client.containerRegistry.getTagProperties(\n this.repositoryName,\n tag,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Updates tag properties.\n * @param tag - name of the tag\n * @param options -\n */\n public async updateTagProperties(\n tag: string,\n options: UpdateTagPropertiesOptions\n ): Promise<ArtifactTagProperties> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-updateTagProperties\", {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead\n }\n });\n\n try {\n return await this.client.containerRegistry.updateTagAttributes(\n this.repositoryName,\n tag,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates tags.\n *\n * Example usage:\n * ```ts\n * const client = new ContainerRegistryClient(url, credentials);\n * const repository = client.getRepository(repositoryName);\n * const artifact = repository.getArtifact(digest)\n * for await (const tag of artifact.listTagProperties()) {\n * console.log(\"tag: \", tag);\n * }\n * ```\n * @param options -\n */\n public listTagProperties(\n options: ListTagPropertiesOptions = {}\n ): PagedAsyncIterableIterator<ArtifactTagProperties, TagPageResponse> {\n const iter = this.listTagsItems(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.listTagsPage(settings, options)\n };\n }\n\n private async *listTagsItems(\n options: ListTagPropertiesOptions = {}\n ): AsyncIterableIterator<ArtifactTagProperties> {\n for await (const page of this.listTagsPage({}, options)) {\n yield* page;\n }\n }\n\n private async *listTagsPage(\n continuationState: PageSettings,\n options: ListTagPropertiesOptions = {}\n ): AsyncIterableIterator<TagPageResponse> {\n const orderby = toServiceTagOrderBy(options.orderBy);\n if (!continuationState.continuationToken) {\n const optionsComplete = {\n ...options,\n n: continuationState.maxPageSize,\n orderby\n };\n const currentPage = await this.client.containerRegistry.getTags(\n this.repositoryName,\n optionsComplete\n );\n continuationState.continuationToken = extractNextLink(currentPage.link);\n if (currentPage.tagAttributeBases) {\n const array = currentPage.tagAttributeBases.map((t) => {\n return {\n registryLoginServer: currentPage.registryLoginServer,\n repositoryName: currentPage.repository,\n ...t\n };\n });\n yield Object.defineProperty(array, \"continuationToken\", {\n value: continuationState.continuationToken,\n enumerable: true\n });\n }\n }\n while (continuationState.continuationToken) {\n const currentPage = await this.client.containerRegistry.getTagsNext(\n this.repositoryName,\n continuationState.continuationToken,\n options\n );\n continuationState.continuationToken = extractNextLink(currentPage.link);\n if (currentPage.tagAttributeBases) {\n const array = currentPage.tagAttributeBases.map((t) => {\n return {\n registryLoginServer: currentPage.registryLoginServer,\n repositoryName: currentPage.repository,\n ...t\n };\n });\n yield Object.defineProperty(array, \"continuationToken\", {\n value: continuationState.continuationToken,\n enumerable: true\n });\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"registryArtifact.js","sourceRoot":"","sources":["../../src/registryArtifact.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC,OAAO,EAAE,cAA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,CAAC,CAAC,EAAE,EAAE;wBACpD,uBACE,mBAAmB,EAAE,WAAW,CAAC,mBAAmB,EACpD,cAAc,EAAE,WAAW,CAAC,UAAU,IACnC,CAAC,EACJ;oBACJ,CAAC,CAAC,CAAC;oBACH,oBAAM,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE;wBACtD,KAAK,EAAE,iBAAiB,CAAC,iBAAiB;wBAC1C,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAA,CAAC;iBACJ;aACF;QACH,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport \"@azure/core-paging\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nimport {\n ArtifactTagProperties,\n ArtifactManifestProperties,\n ArtifactTagOrder,\n TagPageResponse,\n} from \"./models\";\nimport { URL } from \"./utils/url\";\nimport { createSpan } from \"./tracing\";\nimport { GeneratedClient } from \"./generated\";\nimport { extractNextLink, isDigest } from \"./utils/helpers\";\nimport { toArtifactManifestProperties, toServiceTagOrderBy } from \"./transformations\";\n\n/**\n * Options for the `delete` method of `RegistryArtifact`.\n */\nexport interface DeleteArtifactOptions extends OperationOptions {}\n/**\n * Options for the `deleteTag` method of `RegistryArtifact`.\n */\nexport interface DeleteTagOptions extends OperationOptions {}\n/**\n * Options for the `getManifestProperties` method of `RegistryArtifact`.\n */\nexport interface GetManifestPropertiesOptions extends OperationOptions {}\n/**\n * Options for the `getTagProperties` method of `RegistryArtifact`.\n */\nexport interface GetTagPropertiesOptions extends OperationOptions {}\n\n/**\n * Options for the `updateTagProperties` method of `RegistryArtifact`.\n */\nexport interface UpdateTagPropertiesOptions extends OperationOptions {\n /** Whether or not this tag can be deleted */\n canDelete?: boolean;\n /** Whether or not this tag can be written to */\n canWrite?: boolean;\n /** Whether or not to include this tag when listing tags */\n canList?: boolean;\n /** Whether or not this tag can be read */\n canRead?: boolean;\n}\n\n/**\n * Options for the `updateManifestProperties` method of `RegistryArtifact`.\n */\nexport interface UpdateManifestPropertiesOptions extends OperationOptions {\n /** Whether or not this manifest can be deleted */\n canDelete?: boolean;\n /** Whether or not this manifest can be written to */\n canWrite?: boolean;\n /** Whether or not to include this manifest when listing manifest properties */\n canList?: boolean;\n /** Whether or not this manifest can be read */\n canRead?: boolean;\n}\n\n/**\n * Options for the `listTagProperties` method of `RegistryArtifact`.\n */\nexport interface ListTagPropertiesOptions extends OperationOptions {\n /** order in which the tags are returned */\n order?: ArtifactTagOrder;\n}\n\n/**\n * `Artifact` is the general term for items stored in a container registry,\n * and can include Docker images or other Open Container Initiative (OCI) artifact types.\n *\n * The {@link RegistryArtifact} interface is a helper that groups information and operations about an image\n * or artifact in a container registry.\n *\n */\nexport interface RegistryArtifact {\n /**\n * The Azure Container Registry endpoint.\n */\n readonly registryEndpoint: string;\n /**\n * Repository name.\n */\n readonly repositoryName: string;\n /**\n * fully qualified reference of the artifact.\n */\n readonly fullyQualifiedReference: string;\n /**\n * Deletes this registry artifact by deleting its manifest.\n * @param options -\n */\n delete(options?: DeleteArtifactOptions): Promise<void>;\n /**\n * Deletes a tag. This removes the tag from the artifact and its manifest.\n * @param tag - the name of the tag to delete.\n * @param options -\n */\n deleteTag(tag: string, options?: DeleteTagOptions): Promise<void>;\n /**\n * Retrieves the properties of the manifest that uniquely identifies this artifact.\n * @param options -\n */\n getManifestProperties(\n options?: GetManifestPropertiesOptions\n ): Promise<ArtifactManifestProperties>;\n /**\n * Updates the properties of the artifact's manifest.\n *\n * Example usage:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credential);\n * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)\n * const updated = await artifact.updateManifestProperties({\n * canDelete: false,\n * canList: false,\n * canRead: false,\n * canWrite: false\n * });\n * ```\n * @param options -\n */\n updateManifestProperties(\n options: UpdateManifestPropertiesOptions\n ): Promise<ArtifactManifestProperties>;\n /**\n * Retrieves the properties of the specified tag.\n * @param tag - the tag to retrieve properties.\n * @param options -\n */\n getTagProperties(tag: string, options?: GetTagPropertiesOptions): Promise<ArtifactTagProperties>;\n /**\n * Updates the properties of a given tag.\n *\n * Example usage:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credential);\n * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)\n * const updated = await artifact.updateTagProperties(tag, {\n * canDelete: false,\n * canList: false,\n * canRead: false,\n * canWrite: false\n * });\n * ```\n * @param tag - name of the tag to update properties on\n * @param options -\n */\n updateTagProperties(\n tag: string,\n options: UpdateTagPropertiesOptions\n ): Promise<ArtifactTagProperties>;\n /**\n * Returns an async iterable iterator to list the tags that uniquely identify this artifact and the properties of each.\n *\n * Example using `for-await-of` syntax:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credentials);\n * const repository = client.getRepository(repositoryName);\n * const artifact = repository.getArtifact(digest)\n * for await (const tag of artifact.listTagProperties()) {\n * console.log(\"tag: \", tag);\n * }\n * ```\n *\n * Example using `iter.next()`:\n *\n * ```javascript\n * const iter = artifact.listTagProperties();\n * let item = await iter.next();\n * while (!item.done) {\n * console.log(\"tag properties: \", item.value);\n * item = await iter.next();\n * }\n * ```\n *\n * Example using `byPage()`:\n *\n * ```javascript\n * const pages = artifact.listTagProperties().byPage({ maxPageSize: 2 });\n * let page = await pages.next();\n * let i = 1;\n * while (!page.done) {\n * if (page.value) {\n * console.log(`-- page ${i++}`);\n * for (const tagProperties of page.value) {\n * console.log(` repository name: ${tagProperties}`);\n * }\n * }\n * page = await pages.next();\n * }\n * ```\n * @param options -\n */\n listTagProperties(\n options?: ListTagPropertiesOptions\n ): PagedAsyncIterableIterator<ArtifactTagProperties>;\n}\n\n/**\n * The client class used to interact with the Container Registry service.\n * @internal\n */\nexport class RegistryArtifactImpl {\n private client: GeneratedClient;\n /**\n * The Azure Container Registry endpoint.\n */\n public readonly registryEndpoint: string;\n /**\n * Repository name.\n */\n public readonly repositoryName: string;\n\n /**\n * Name of the form 'registry-login-server/repository-name\\@digest' or\n * 'registry-login-server/repository-name:tag'\n */\n public readonly fullyQualifiedReference: string;\n\n private digest?: string;\n /**\n * Creates an instance of a RegistryArtifact.\n * @param registryEndpoint - the URL to the Container Registry endpoint\n * @param repositoryName - the name of the repository\n * @param tagOrDigest - the tag or digest of this artifact\n * @param client - the generated client that interacts with service\n */\n constructor(\n registryEndpoint: string,\n repositoryName: string,\n private tagOrDigest: string,\n client: GeneratedClient\n ) {\n this.registryEndpoint = registryEndpoint;\n this.repositoryName = repositoryName;\n\n const parsedUrl = new URL(registryEndpoint);\n if (isDigest(tagOrDigest)) {\n this.digest = tagOrDigest;\n this.fullyQualifiedReference = `${parsedUrl.hostname}/${repositoryName}@${this.digest}`;\n } else {\n this.fullyQualifiedReference = `${parsedUrl.hostname}/${repositoryName}:${tagOrDigest}`;\n }\n\n this.client = client;\n }\n\n /**\n * digest of this artifact.\n */\n private async getDigest(): Promise<string> {\n if (this.digest) {\n return this.digest;\n }\n\n if (!isDigest(this.tagOrDigest)) {\n this.digest = (await this.getTagProperties(this.tagOrDigest)).digest;\n } else {\n this.digest = this.tagOrDigest;\n }\n\n return this.digest;\n }\n\n /**\n * Deletes this registry artifact by deleting its manifest.\n * @param options -\n */\n public async delete(options: DeleteArtifactOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-delete\", options);\n\n try {\n await this.client.containerRegistry.deleteManifest(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a tag. This removes the tag from the artifact and its manifest.\n * @param tag - the name of the tag to delete.\n * @param options -\n */\n public async deleteTag(tag: string, options: DeleteTagOptions = {}): Promise<void> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-deleteTag\", options);\n\n try {\n await this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves the properties of the manifest that uniquely identifies this artifact.\n * @param options -\n */\n public async getManifestProperties(\n options: GetManifestPropertiesOptions = {}\n ): Promise<ArtifactManifestProperties> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-getManifestProperties\", options);\n\n try {\n const result = await this.client.containerRegistry.getManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer!);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Updates the properties of the artifact's manifest.\n *\n * Example usage:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credential);\n * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)\n * const updated = await artifact.updateManifestProperties({\n * canDelete: false,\n * canList: false,\n * canRead: false,\n * canWrite: false\n * });\n * ```\n * @param options -\n */\n public async updateManifestProperties(\n options: UpdateManifestPropertiesOptions\n ): Promise<ArtifactManifestProperties> {\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-updateManifestProperties\", {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n });\n\n try {\n const result = await this.client.containerRegistry.updateManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(result, this.repositoryName, result.registryLoginServer!);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves the properties of the specified tag.\n * @param tag - the tag to retrieve properties.\n * @param options -\n */\n public async getTagProperties(\n tag: string,\n options: GetTagPropertiesOptions = {}\n ): Promise<ArtifactTagProperties> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-getTagProperties\", options);\n try {\n return await this.client.containerRegistry.getTagProperties(\n this.repositoryName,\n tag,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Updates the properties of a given tag.\n *\n * Example usage:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credential);\n * const artifact = client.getArtifact(repositoryName, artifactTagOrDigest)\n * const updated = await artifact.updateTagProperties(tag, {\n * canDelete: false,\n * canList: false,\n * canRead: false,\n * canWrite: false\n * });\n * ```\n * @param tag - name of the tag to update properties on\n * @param options -\n */\n public async updateTagProperties(\n tag: string,\n options: UpdateTagPropertiesOptions\n ): Promise<ArtifactTagProperties> {\n if (!tag) {\n throw new Error(\"invalid tag\");\n }\n\n const { span, updatedOptions } = createSpan(\"RegistryArtifact-updateTagProperties\", {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n });\n\n try {\n return await this.client.containerRegistry.updateTagAttributes(\n this.repositoryName,\n tag,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Returns an async iterable iterator to list the tags that uniquely identify this artifact and the properties of each.\n *\n * Example using `for-await-of` syntax:\n *\n * ```javascript\n * const client = new ContainerRegistryClient(url, credentials);\n * const repository = client.getRepository(repositoryName);\n * const artifact = repository.getArtifact(digest)\n * for await (const tag of artifact.listTagProperties()) {\n * console.log(\"tag: \", tag);\n * }\n * ```\n *\n * Example using `iter.next()`:\n *\n * ```javascript\n * const iter = artifact.listTagProperties();\n * let item = await iter.next();\n * while (!item.done) {\n * console.log(\"tag properties: \", item.value);\n * item = await iter.next();\n * }\n * ```\n *\n * Example using `byPage()`:\n *\n * ```javascript\n * const pages = artifact.listTagProperties().byPage({ maxPageSize: 2 });\n * let page = await pages.next();\n * let i = 1;\n * while (!page.done) {\n * if (page.value) {\n * console.log(`-- page ${i++}`);\n * for (const tagProperties of page.value) {\n * console.log(` repository name: ${tagProperties}`);\n * }\n * }\n * page = await pages.next();\n * }\n * ```\n * @param options -\n */\n public listTagProperties(\n options: ListTagPropertiesOptions = {}\n ): PagedAsyncIterableIterator<ArtifactTagProperties, TagPageResponse> {\n const iter = this.listTagsItems(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => this.listTagsPage(settings, options),\n };\n }\n\n private async *listTagsItems(\n options: ListTagPropertiesOptions = {}\n ): AsyncIterableIterator<ArtifactTagProperties> {\n for await (const page of this.listTagsPage({}, options)) {\n yield* page;\n }\n }\n\n private async *listTagsPage(\n continuationState: PageSettings,\n options: ListTagPropertiesOptions = {}\n ): AsyncIterableIterator<TagPageResponse> {\n const orderby = toServiceTagOrderBy(options.order);\n if (!continuationState.continuationToken) {\n const optionsComplete = {\n ...options,\n n: continuationState.maxPageSize,\n orderby,\n };\n const currentPage = await this.client.containerRegistry.getTags(\n this.repositoryName,\n optionsComplete\n );\n continuationState.continuationToken = extractNextLink(currentPage.link);\n if (currentPage.tagAttributeBases) {\n const array = currentPage.tagAttributeBases.map((t) => {\n return {\n registryLoginServer: currentPage.registryLoginServer,\n repositoryName: currentPage.repository,\n ...t,\n };\n });\n yield Object.defineProperty(array, \"continuationToken\", {\n value: continuationState.continuationToken,\n enumerable: true,\n });\n }\n }\n while (continuationState.continuationToken) {\n const currentPage = await this.client.containerRegistry.getTagsNext(\n this.repositoryName,\n continuationState.continuationToken,\n options\n );\n continuationState.continuationToken = extractNextLink(currentPage.link);\n if (currentPage.tagAttributeBases) {\n const array = currentPage.tagAttributeBases.map((t) => {\n return {\n registryLoginServer: currentPage.registryLoginServer,\n repositoryName: currentPage.repository,\n ...t,\n };\n });\n yield Object.defineProperty(array, \"continuationToken\", {\n value: continuationState.continuationToken,\n enumerable: true,\n });\n }\n }\n }\n}\n"]}
@@ -12,6 +12,6 @@ import { createSpanFunction } from "@azure/core-tracing";
12
12
  */
13
13
  export const createSpan = createSpanFunction({
14
14
  namespace: "Azure.Containers",
15
- packagePrefix: "Azure.Containers.ContainerRegistry"
15
+ packagePrefix: "Azure.Containers.ContainerRegistry",
16
16
  });
17
17
  //# sourceMappingURL=tracing.js.map