@azure/container-registry 1.1.0-beta.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -4
- package/dist/index.js +366 -154
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/containerRegistryClient.js +15 -12
- package/dist-esm/src/containerRegistryClient.js.map +1 -1
- package/dist-esm/src/containerRepository.js +12 -5
- package/dist-esm/src/containerRepository.js.map +1 -1
- package/dist-esm/src/{blob/containerRegistryBlobClient.js → content/containerRegistryContentClient.js} +91 -58
- package/dist-esm/src/content/containerRegistryContentClient.js.map +1 -0
- package/dist-esm/src/{blob → content}/index.js +1 -1
- package/dist-esm/src/content/index.js.map +1 -0
- package/dist-esm/src/content/models.js +17 -0
- package/dist-esm/src/content/models.js.map +1 -0
- package/dist-esm/src/generated/generatedClient.js +28 -2
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +17 -0
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +7 -1
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistry.js +0 -14
- package/dist-esm/src/generated/operations/containerRegistry.js.map +1 -1
- package/dist-esm/src/generated/operations/containerRegistryBlob.js +4 -8
- package/dist-esm/src/generated/operations/containerRegistryBlob.js.map +1 -1
- package/dist-esm/src/generated/operationsInterfaces/containerRegistryBlob.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models.js +4 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/registryArtifact.js +12 -5
- package/dist-esm/src/registryArtifact.js.map +1 -1
- package/dist-esm/src/utils/helpers.js +30 -16
- package/dist-esm/src/utils/helpers.js.map +1 -1
- package/dist-esm/src/utils/retriableReadableStream.js +116 -0
- package/dist-esm/src/utils/retriableReadableStream.js.map +1 -0
- package/package.json +8 -5
- package/types/container-registry.d.ts +181 -145
- package/dist-esm/src/blob/containerRegistryBlobClient.js.map +0 -1
- package/dist-esm/src/blob/index.js.map +0 -1
- package/dist-esm/src/blob/models.js +0 -4
- package/dist-esm/src/blob/models.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerRegistryBlob.js","sourceRoot":"","sources":["../../../../src/generated/operations/containerRegistryBlob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AA0BnD,yDAAyD;AACzD,MAAM,OAAO,yBAAyB;IAGpC;;;OAGG;IACH,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CACL,IAAY,EACZ,MAAc,EACd,OAAoD;QAEpD,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EACzB,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,eAAe,CACb,IAAY,EACZ,MAAc,EACd,OAA4D;QAE5D,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EACzB,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,UAAU,CACR,IAAY,EACZ,MAAc,EACd,OAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,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M;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,aAAa,EAAE,OAAO,CAAC,4CAA4C;SACpE;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,SAAS;SAC9B;KACF;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC;IACpE,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC;IACvD,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { ContainerRegistryBlob } from \"../operationsInterfaces\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { GeneratedClient } from \"../generatedClient\";\nimport {\n ContainerRegistryBlobGetBlobOptionalParams,\n ContainerRegistryBlobGetBlobResponse,\n ContainerRegistryBlobCheckBlobExistsOptionalParams,\n ContainerRegistryBlobCheckBlobExistsResponse,\n ContainerRegistryBlobDeleteBlobOptionalParams,\n ContainerRegistryBlobDeleteBlobResponse,\n ContainerRegistryBlobMountBlobOptionalParams,\n ContainerRegistryBlobMountBlobResponse,\n ContainerRegistryBlobGetUploadStatusOptionalParams,\n ContainerRegistryBlobGetUploadStatusResponse,\n ContainerRegistryBlobUploadChunkOptionalParams,\n ContainerRegistryBlobUploadChunkResponse,\n ContainerRegistryBlobCompleteUploadOptionalParams,\n ContainerRegistryBlobCompleteUploadResponse,\n ContainerRegistryBlobCancelUploadOptionalParams,\n ContainerRegistryBlobStartUploadOptionalParams,\n ContainerRegistryBlobStartUploadResponse,\n ContainerRegistryBlobGetChunkOptionalParams,\n ContainerRegistryBlobGetChunkResponse,\n ContainerRegistryBlobCheckChunkExistsOptionalParams,\n ContainerRegistryBlobCheckChunkExistsResponse\n} from \"../models\";\n\n/** Class containing ContainerRegistryBlob operations. */\nexport class ContainerRegistryBlobImpl implements ContainerRegistryBlob {\n private readonly client: GeneratedClient;\n\n /**\n * Initialize a new instance of the class ContainerRegistryBlob class.\n * @param client Reference to the service client\n */\n constructor(client: GeneratedClient) {\n this.client = client;\n }\n\n /**\n * Retrieve the blob from the registry identified by digest.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n getBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobGetBlobOptionalParams\n ): Promise<ContainerRegistryBlobGetBlobResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n getBlobOperationSpec\n );\n }\n\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n checkBlobExists(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobCheckBlobExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckBlobExistsResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n checkBlobExistsOperationSpec\n );\n }\n\n /**\n * Removes an already uploaded blob.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n deleteBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobDeleteBlobOptionalParams\n ): Promise<ContainerRegistryBlobDeleteBlobResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n deleteBlobOperationSpec\n );\n }\n\n /**\n * Mount a blob identified by the `mount` parameter from another repository.\n * @param name Name of the image (including the namespace)\n * @param mount Digest of blob to mount from the source repository.\n * @param fromParam Name of the source repository.\n * @param options The options parameters.\n */\n mountBlob(\n name: string,\n mount: string,\n fromParam: string,\n options?: ContainerRegistryBlobMountBlobOptionalParams\n ): Promise<ContainerRegistryBlobMountBlobResponse> {\n return this.client.sendOperationRequest(\n { name, mount, fromParam, options },\n mountBlobOperationSpec\n );\n }\n\n /**\n * Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the\n * current status of a resumable upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n getUploadStatus(\n nextLink: string,\n options?: ContainerRegistryBlobGetUploadStatusOptionalParams\n ): Promise<ContainerRegistryBlobGetUploadStatusResponse> {\n return this.client.sendOperationRequest(\n { nextLink, options },\n getUploadStatusOperationSpec\n );\n }\n\n /**\n * Upload a stream of data without completing the upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param value Raw data of blob\n * @param options The options parameters.\n */\n uploadChunk(\n nextLink: string,\n value: coreRestPipeline.RequestBodyType,\n options?: ContainerRegistryBlobUploadChunkOptionalParams\n ): Promise<ContainerRegistryBlobUploadChunkResponse> {\n return this.client.sendOperationRequest(\n { nextLink, value, options },\n uploadChunkOperationSpec\n );\n }\n\n /**\n * Complete the upload, providing all the data in the body, if necessary. A request without a body will\n * just complete the upload with previously uploaded content.\n * @param digest Digest of a BLOB\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n completeUpload(\n digest: string,\n nextLink: string,\n options?: ContainerRegistryBlobCompleteUploadOptionalParams\n ): Promise<ContainerRegistryBlobCompleteUploadResponse> {\n return this.client.sendOperationRequest(\n { digest, nextLink, options },\n completeUploadOperationSpec\n );\n }\n\n /**\n * Cancel outstanding upload processes, releasing associated resources. If this is not called, the\n * unfinished uploads will eventually timeout.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n cancelUpload(\n nextLink: string,\n options?: ContainerRegistryBlobCancelUploadOptionalParams\n ): Promise<void> {\n return this.client.sendOperationRequest(\n { nextLink, options },\n cancelUploadOperationSpec\n );\n }\n\n /**\n * Initiate a resumable blob upload with an empty request body.\n * @param name Name of the image (including the namespace)\n * @param options The options parameters.\n */\n startUpload(\n name: string,\n options?: ContainerRegistryBlobStartUploadOptionalParams\n ): Promise<ContainerRegistryBlobStartUploadResponse> {\n return this.client.sendOperationRequest(\n { name, options },\n startUploadOperationSpec\n );\n }\n\n /**\n * Retrieve the blob from the registry identified by `digest`. This endpoint may also support RFC7233\n * compliant range requests. Support can be detected by issuing a HEAD request. If the header\n * `Accept-Range: bytes` is returned, range requests can be used to fetch partial content.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n getChunk(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobGetChunkOptionalParams\n ): Promise<ContainerRegistryBlobGetChunkResponse> {\n return this.client.sendOperationRequest(\n { name, digest, range, options },\n getChunkOperationSpec\n );\n }\n\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n checkChunkExists(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobCheckChunkExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckChunkExistsResponse> {\n return this.client.sendOperationRequest(\n { name, digest, range, options },\n checkChunkExistsOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: {\n type: { name: \"Stream\" },\n serializedName: \"parsedResponse\"\n },\n headersMapper: Mappers.ContainerRegistryBlobGetBlobHeaders\n },\n 307: {\n headersMapper: Mappers.ContainerRegistryBlobGetBlobHeaders\n },\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept3],\n serializer\n};\nconst checkBlobExistsOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"HEAD\",\n responses: {\n 200: {\n headersMapper: Mappers.ContainerRegistryBlobCheckBlobExistsHeaders\n },\n 307: {\n headersMapper: Mappers.ContainerRegistryBlobCheckBlobExistsHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst deleteBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"DELETE\",\n responses: {\n 202: {\n bodyMapper: {\n type: { name: \"Stream\" },\n serializedName: \"parsedResponse\"\n },\n headersMapper: Mappers.ContainerRegistryBlobDeleteBlobHeaders\n },\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept3],\n serializer\n};\nconst mountBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/uploads/\",\n httpMethod: \"POST\",\n responses: {\n 201: {\n headersMapper: Mappers.ContainerRegistryBlobMountBlobHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n queryParameters: [Parameters.fromParam, Parameters.mount],\n urlParameters: [Parameters.url, Parameters.name],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getUploadStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"GET\",\n responses: {\n 204: {\n headersMapper: Mappers.ContainerRegistryBlobGetUploadStatusHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst uploadChunkOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"PATCH\",\n responses: {\n 202: {\n headersMapper: Mappers.ContainerRegistryBlobUploadChunkHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n requestBody: Parameters.value3,\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept2, Parameters.contentType2],\n mediaType: \"binary\",\n serializer\n};\nconst completeUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"PUT\",\n responses: {\n 201: {\n headersMapper: Mappers.ContainerRegistryBlobCompleteUploadHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n requestBody: Parameters.value4,\n queryParameters: [Parameters.digest2],\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept2, Parameters.contentType2],\n mediaType: \"binary\",\n serializer\n};\nconst cancelUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"DELETE\",\n responses: {\n 204: {},\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst startUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/uploads/\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.ContainerRegistryBlobStartUploadHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getChunkOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"GET\",\n responses: {\n 206: {\n bodyMapper: {\n type: { name: \"Stream\" },\n serializedName: \"parsedResponse\"\n },\n headersMapper: Mappers.ContainerRegistryBlobGetChunkHeaders\n },\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept3, Parameters.range],\n serializer\n};\nconst checkChunkExistsOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"HEAD\",\n responses: {\n 200: {\n headersMapper: Mappers.ContainerRegistryBlobCheckChunkExistsHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept, Parameters.range],\n serializer\n};\n"]}
|
|
1
|
+
{"version":3,"file":"containerRegistryBlob.js","sourceRoot":"","sources":["../../../../src/generated/operations/containerRegistryBlob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AA0BnD,yDAAyD;AACzD,MAAM,OAAO,yBAAyB;IAGpC;;;OAGG;IACH,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CACL,IAAY,EACZ,MAAc,EACd,OAAoD;QAEpD,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EACzB,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,eAAe,CACb,IAAY,EACZ,MAAc,EACd,OAA4D;QAE5D,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EACzB,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,UAAU,CACR,IAAY,EACZ,MAAc,EACd,OAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EACzB,uBAAuB,CACxB,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CACP,IAAY,EACZ,SAAiB,E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U,CAAC,OAAO,CAAC;IACpE,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC;IACvD,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { ContainerRegistryBlob } from \"../operationsInterfaces\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { GeneratedClient } from \"../generatedClient\";\nimport {\n ContainerRegistryBlobGetBlobOptionalParams,\n ContainerRegistryBlobGetBlobResponse,\n ContainerRegistryBlobCheckBlobExistsOptionalParams,\n ContainerRegistryBlobCheckBlobExistsResponse,\n ContainerRegistryBlobDeleteBlobOptionalParams,\n ContainerRegistryBlobDeleteBlobResponse,\n ContainerRegistryBlobMountBlobOptionalParams,\n ContainerRegistryBlobMountBlobResponse,\n ContainerRegistryBlobGetUploadStatusOptionalParams,\n ContainerRegistryBlobGetUploadStatusResponse,\n ContainerRegistryBlobUploadChunkOptionalParams,\n ContainerRegistryBlobUploadChunkResponse,\n ContainerRegistryBlobCompleteUploadOptionalParams,\n ContainerRegistryBlobCompleteUploadResponse,\n ContainerRegistryBlobCancelUploadOptionalParams,\n ContainerRegistryBlobStartUploadOptionalParams,\n ContainerRegistryBlobStartUploadResponse,\n ContainerRegistryBlobGetChunkOptionalParams,\n ContainerRegistryBlobGetChunkResponse,\n ContainerRegistryBlobCheckChunkExistsOptionalParams,\n ContainerRegistryBlobCheckChunkExistsResponse\n} from \"../models\";\n\n/** Class containing ContainerRegistryBlob operations. */\nexport class ContainerRegistryBlobImpl implements ContainerRegistryBlob {\n private readonly client: GeneratedClient;\n\n /**\n * Initialize a new instance of the class ContainerRegistryBlob class.\n * @param client Reference to the service client\n */\n constructor(client: GeneratedClient) {\n this.client = client;\n }\n\n /**\n * Retrieve the blob from the registry identified by digest.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n getBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobGetBlobOptionalParams\n ): Promise<ContainerRegistryBlobGetBlobResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n getBlobOperationSpec\n );\n }\n\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n checkBlobExists(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobCheckBlobExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckBlobExistsResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n checkBlobExistsOperationSpec\n );\n }\n\n /**\n * Removes an already uploaded blob.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n deleteBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobDeleteBlobOptionalParams\n ): Promise<ContainerRegistryBlobDeleteBlobResponse> {\n return this.client.sendOperationRequest(\n { name, digest, options },\n deleteBlobOperationSpec\n );\n }\n\n /**\n * Mount a blob identified by the `mount` parameter from another repository.\n * @param name Name of the image (including the namespace)\n * @param fromParam Name of the source repository.\n * @param mount Digest of blob to mount from the source repository.\n * @param options The options parameters.\n */\n mountBlob(\n name: string,\n fromParam: string,\n mount: string,\n options?: ContainerRegistryBlobMountBlobOptionalParams\n ): Promise<ContainerRegistryBlobMountBlobResponse> {\n return this.client.sendOperationRequest(\n { name, fromParam, mount, options },\n mountBlobOperationSpec\n );\n }\n\n /**\n * Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the\n * current status of a resumable upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n getUploadStatus(\n nextLink: string,\n options?: ContainerRegistryBlobGetUploadStatusOptionalParams\n ): Promise<ContainerRegistryBlobGetUploadStatusResponse> {\n return this.client.sendOperationRequest(\n { nextLink, options },\n getUploadStatusOperationSpec\n );\n }\n\n /**\n * Upload a stream of data without completing the upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param value Raw data of blob\n * @param options The options parameters.\n */\n uploadChunk(\n nextLink: string,\n value: coreRestPipeline.RequestBodyType,\n options?: ContainerRegistryBlobUploadChunkOptionalParams\n ): Promise<ContainerRegistryBlobUploadChunkResponse> {\n return this.client.sendOperationRequest(\n { nextLink, value, options },\n uploadChunkOperationSpec\n );\n }\n\n /**\n * Complete the upload, providing all the data in the body, if necessary. A request without a body will\n * just complete the upload with previously uploaded content.\n * @param digest Digest of a BLOB\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n completeUpload(\n digest: string,\n nextLink: string,\n options?: ContainerRegistryBlobCompleteUploadOptionalParams\n ): Promise<ContainerRegistryBlobCompleteUploadResponse> {\n return this.client.sendOperationRequest(\n { digest, nextLink, options },\n completeUploadOperationSpec\n );\n }\n\n /**\n * Cancel outstanding upload processes, releasing associated resources. If this is not called, the\n * unfinished uploads will eventually timeout.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n cancelUpload(\n nextLink: string,\n options?: ContainerRegistryBlobCancelUploadOptionalParams\n ): Promise<void> {\n return this.client.sendOperationRequest(\n { nextLink, options },\n cancelUploadOperationSpec\n );\n }\n\n /**\n * Initiate a resumable blob upload with an empty request body.\n * @param name Name of the image (including the namespace)\n * @param options The options parameters.\n */\n startUpload(\n name: string,\n options?: ContainerRegistryBlobStartUploadOptionalParams\n ): Promise<ContainerRegistryBlobStartUploadResponse> {\n return this.client.sendOperationRequest(\n { name, options },\n startUploadOperationSpec\n );\n }\n\n /**\n * Retrieve the blob from the registry identified by `digest`. This endpoint may also support RFC7233\n * compliant range requests. Support can be detected by issuing a HEAD request. If the header\n * `Accept-Range: bytes` is returned, range requests can be used to fetch partial content.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n getChunk(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobGetChunkOptionalParams\n ): Promise<ContainerRegistryBlobGetChunkResponse> {\n return this.client.sendOperationRequest(\n { name, digest, range, options },\n getChunkOperationSpec\n );\n }\n\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n checkChunkExists(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobCheckChunkExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckChunkExistsResponse> {\n return this.client.sendOperationRequest(\n { name, digest, range, options },\n checkChunkExistsOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: {\n type: { name: \"Stream\" },\n serializedName: \"parsedResponse\"\n },\n headersMapper: Mappers.ContainerRegistryBlobGetBlobHeaders\n },\n 307: {\n headersMapper: Mappers.ContainerRegistryBlobGetBlobHeaders\n },\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept3],\n serializer\n};\nconst checkBlobExistsOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"HEAD\",\n responses: {\n 200: {\n headersMapper: Mappers.ContainerRegistryBlobCheckBlobExistsHeaders\n },\n 307: {\n headersMapper: Mappers.ContainerRegistryBlobCheckBlobExistsHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst deleteBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"DELETE\",\n responses: {\n 202: {\n headersMapper: Mappers.ContainerRegistryBlobDeleteBlobHeaders\n },\n 404: {},\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n serializer\n};\nconst mountBlobOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/uploads/\",\n httpMethod: \"POST\",\n responses: {\n 201: {\n headersMapper: Mappers.ContainerRegistryBlobMountBlobHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n queryParameters: [Parameters.fromParam, Parameters.mount],\n urlParameters: [Parameters.url, Parameters.name],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getUploadStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"GET\",\n responses: {\n 204: {\n headersMapper: Mappers.ContainerRegistryBlobGetUploadStatusHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst uploadChunkOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"PATCH\",\n responses: {\n 202: {\n headersMapper: Mappers.ContainerRegistryBlobUploadChunkHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n requestBody: Parameters.value3,\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept2, Parameters.contentType2],\n mediaType: \"binary\",\n serializer\n};\nconst completeUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"PUT\",\n responses: {\n 201: {\n headersMapper: Mappers.ContainerRegistryBlobCompleteUploadHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n requestBody: Parameters.value4,\n queryParameters: [Parameters.digest2],\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept2, Parameters.contentType2],\n mediaType: \"binary\",\n serializer\n};\nconst cancelUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/{nextBlobUuidLink}\",\n httpMethod: \"DELETE\",\n responses: {\n 204: {},\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.nextLink1],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst startUploadOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/uploads/\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.ContainerRegistryBlobStartUploadHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getChunkOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"GET\",\n responses: {\n 206: {\n bodyMapper: {\n type: { name: \"Stream\" },\n serializedName: \"parsedResponse\"\n },\n headersMapper: Mappers.ContainerRegistryBlobGetChunkHeaders\n },\n default: {}\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept3, Parameters.range],\n serializer\n};\nconst checkChunkExistsOperationSpec: coreClient.OperationSpec = {\n path: \"/v2/{name}/blobs/{digest}\",\n httpMethod: \"HEAD\",\n responses: {\n 200: {\n headersMapper: Mappers.ContainerRegistryBlobCheckChunkExistsHeaders\n },\n default: {\n bodyMapper: Mappers.AcrErrors\n }\n },\n urlParameters: [Parameters.url, Parameters.name, Parameters.digest1],\n headerParameters: [Parameters.accept, Parameters.range],\n serializer\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerRegistryBlob.js","sourceRoot":"","sources":["../../../../src/generated/operationsInterfaces/containerRegistryBlob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n ContainerRegistryBlobGetBlobOptionalParams,\n ContainerRegistryBlobGetBlobResponse,\n ContainerRegistryBlobCheckBlobExistsOptionalParams,\n ContainerRegistryBlobCheckBlobExistsResponse,\n ContainerRegistryBlobDeleteBlobOptionalParams,\n ContainerRegistryBlobDeleteBlobResponse,\n ContainerRegistryBlobMountBlobOptionalParams,\n ContainerRegistryBlobMountBlobResponse,\n ContainerRegistryBlobGetUploadStatusOptionalParams,\n ContainerRegistryBlobGetUploadStatusResponse,\n ContainerRegistryBlobUploadChunkOptionalParams,\n ContainerRegistryBlobUploadChunkResponse,\n ContainerRegistryBlobCompleteUploadOptionalParams,\n ContainerRegistryBlobCompleteUploadResponse,\n ContainerRegistryBlobCancelUploadOptionalParams,\n ContainerRegistryBlobStartUploadOptionalParams,\n ContainerRegistryBlobStartUploadResponse,\n ContainerRegistryBlobGetChunkOptionalParams,\n ContainerRegistryBlobGetChunkResponse,\n ContainerRegistryBlobCheckChunkExistsOptionalParams,\n ContainerRegistryBlobCheckChunkExistsResponse\n} from \"../models\";\n\n/** Interface representing a ContainerRegistryBlob. */\nexport interface ContainerRegistryBlob {\n /**\n * Retrieve the blob from the registry identified by digest.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n getBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobGetBlobOptionalParams\n ): Promise<ContainerRegistryBlobGetBlobResponse>;\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n checkBlobExists(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobCheckBlobExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckBlobExistsResponse>;\n /**\n * Removes an already uploaded blob.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n deleteBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobDeleteBlobOptionalParams\n ): Promise<ContainerRegistryBlobDeleteBlobResponse>;\n /**\n * Mount a blob identified by the `mount` parameter from another repository.\n * @param name Name of the image (including the namespace)\n * @param
|
|
1
|
+
{"version":3,"file":"containerRegistryBlob.js","sourceRoot":"","sources":["../../../../src/generated/operationsInterfaces/containerRegistryBlob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n ContainerRegistryBlobGetBlobOptionalParams,\n ContainerRegistryBlobGetBlobResponse,\n ContainerRegistryBlobCheckBlobExistsOptionalParams,\n ContainerRegistryBlobCheckBlobExistsResponse,\n ContainerRegistryBlobDeleteBlobOptionalParams,\n ContainerRegistryBlobDeleteBlobResponse,\n ContainerRegistryBlobMountBlobOptionalParams,\n ContainerRegistryBlobMountBlobResponse,\n ContainerRegistryBlobGetUploadStatusOptionalParams,\n ContainerRegistryBlobGetUploadStatusResponse,\n ContainerRegistryBlobUploadChunkOptionalParams,\n ContainerRegistryBlobUploadChunkResponse,\n ContainerRegistryBlobCompleteUploadOptionalParams,\n ContainerRegistryBlobCompleteUploadResponse,\n ContainerRegistryBlobCancelUploadOptionalParams,\n ContainerRegistryBlobStartUploadOptionalParams,\n ContainerRegistryBlobStartUploadResponse,\n ContainerRegistryBlobGetChunkOptionalParams,\n ContainerRegistryBlobGetChunkResponse,\n ContainerRegistryBlobCheckChunkExistsOptionalParams,\n ContainerRegistryBlobCheckChunkExistsResponse\n} from \"../models\";\n\n/** Interface representing a ContainerRegistryBlob. */\nexport interface ContainerRegistryBlob {\n /**\n * Retrieve the blob from the registry identified by digest.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n getBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobGetBlobOptionalParams\n ): Promise<ContainerRegistryBlobGetBlobResponse>;\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n checkBlobExists(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobCheckBlobExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckBlobExistsResponse>;\n /**\n * Removes an already uploaded blob.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param options The options parameters.\n */\n deleteBlob(\n name: string,\n digest: string,\n options?: ContainerRegistryBlobDeleteBlobOptionalParams\n ): Promise<ContainerRegistryBlobDeleteBlobResponse>;\n /**\n * Mount a blob identified by the `mount` parameter from another repository.\n * @param name Name of the image (including the namespace)\n * @param fromParam Name of the source repository.\n * @param mount Digest of blob to mount from the source repository.\n * @param options The options parameters.\n */\n mountBlob(\n name: string,\n fromParam: string,\n mount: string,\n options?: ContainerRegistryBlobMountBlobOptionalParams\n ): Promise<ContainerRegistryBlobMountBlobResponse>;\n /**\n * Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the\n * current status of a resumable upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n getUploadStatus(\n nextLink: string,\n options?: ContainerRegistryBlobGetUploadStatusOptionalParams\n ): Promise<ContainerRegistryBlobGetUploadStatusResponse>;\n /**\n * Upload a stream of data without completing the upload.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param value Raw data of blob\n * @param options The options parameters.\n */\n uploadChunk(\n nextLink: string,\n value: coreRestPipeline.RequestBodyType,\n options?: ContainerRegistryBlobUploadChunkOptionalParams\n ): Promise<ContainerRegistryBlobUploadChunkResponse>;\n /**\n * Complete the upload, providing all the data in the body, if necessary. A request without a body will\n * just complete the upload with previously uploaded content.\n * @param digest Digest of a BLOB\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n completeUpload(\n digest: string,\n nextLink: string,\n options?: ContainerRegistryBlobCompleteUploadOptionalParams\n ): Promise<ContainerRegistryBlobCompleteUploadResponse>;\n /**\n * Cancel outstanding upload processes, releasing associated resources. If this is not called, the\n * unfinished uploads will eventually timeout.\n * @param nextLink Link acquired from upload start or previous chunk. Note, do not include initial /\n * (must do substring(1) )\n * @param options The options parameters.\n */\n cancelUpload(\n nextLink: string,\n options?: ContainerRegistryBlobCancelUploadOptionalParams\n ): Promise<void>;\n /**\n * Initiate a resumable blob upload with an empty request body.\n * @param name Name of the image (including the namespace)\n * @param options The options parameters.\n */\n startUpload(\n name: string,\n options?: ContainerRegistryBlobStartUploadOptionalParams\n ): Promise<ContainerRegistryBlobStartUploadResponse>;\n /**\n * Retrieve the blob from the registry identified by `digest`. This endpoint may also support RFC7233\n * compliant range requests. Support can be detected by issuing a HEAD request. If the header\n * `Accept-Range: bytes` is returned, range requests can be used to fetch partial content.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n getChunk(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobGetChunkOptionalParams\n ): Promise<ContainerRegistryBlobGetChunkResponse>;\n /**\n * Same as GET, except only the headers are returned.\n * @param name Name of the image (including the namespace)\n * @param digest Digest of a BLOB\n * @param range Format : bytes=<start>-<end>, HTTP Range header specifying blob chunk.\n * @param options The options parameters.\n */\n checkChunkExists(\n name: string,\n digest: string,\n range: string,\n options?: ContainerRegistryBlobCheckChunkExistsOptionalParams\n ): Promise<ContainerRegistryBlobCheckChunkExistsResponse>;\n}\n"]}
|
package/dist-esm/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,2BAA2B,CAAC;AAkB1C,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,2BAA2B,CAAC;AAkB1C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./containerRegistryClient\";\nexport {\n ContainerRepository,\n DeleteRepositoryOptions,\n GetRepositoryPropertiesOptions,\n UpdateRepositoryPropertiesOptions,\n ListManifestPropertiesOptions,\n} from \"./containerRepository\";\nexport {\n RegistryArtifact,\n DeleteArtifactOptions,\n DeleteTagOptions,\n GetManifestPropertiesOptions,\n GetTagPropertiesOptions,\n UpdateManifestPropertiesOptions,\n UpdateTagPropertiesOptions,\n ListTagPropertiesOptions,\n} from \"./registryArtifact\";\nexport * from \"./models\";\nexport * from \"./content\";\n"]}
|
package/dist-esm/src/models.js
CHANGED
|
@@ -7,7 +7,10 @@ export var KnownContainerRegistryAudience;
|
|
|
7
7
|
(function (KnownContainerRegistryAudience) {
|
|
8
8
|
/** Azure China */
|
|
9
9
|
KnownContainerRegistryAudience["AzureResourceManagerChina"] = "https://management.chinacloudapi.cn";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Azure Germany
|
|
12
|
+
* @deprecated Azure Germany is being deprecated in favor of standard nonsovereign Azure regions in Germany.
|
|
13
|
+
*/
|
|
11
14
|
KnownContainerRegistryAudience["AzureResourceManagerGermany"] = "https://management.microsoftazure.de";
|
|
12
15
|
/** Azure Government */
|
|
13
16
|
KnownContainerRegistryAudience["AzureResourceManagerGovernment"] = "https://management.usgovcloudapi.net";
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAN,IAAY,8BAYX;AAZD,WAAY,8BAA8B;IACxC,kBAAkB;IAClB,mGAAiE,CAAA;IACjE;;;OAGG;IACH,sGAAoE,CAAA;IACpE,uBAAuB;IACvB,yGAAuE,CAAA;IACvE,yBAAyB;IACzB,kGAAgE,CAAA;AAClE,CAAC,EAZW,8BAA8B,KAA9B,8BAA8B,QAYzC;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 /**\n * Azure Germany\n * @deprecated Azure Germany is being deprecated in favor of standard nonsovereign Azure regions in Germany.\n */\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"]}
|
|
@@ -207,17 +207,24 @@ export class RegistryArtifactImpl {
|
|
|
207
207
|
}
|
|
208
208
|
listTagsItems(options = {}) {
|
|
209
209
|
return __asyncGenerator(this, arguments, function* listTagsItems_1() {
|
|
210
|
-
var e_1,
|
|
210
|
+
var _a, e_1, _b, _c;
|
|
211
211
|
try {
|
|
212
|
-
for (var
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
for (var _d = true, _e = __asyncValues(this.listTagsPage({}, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
213
|
+
_c = _f.value;
|
|
214
|
+
_d = false;
|
|
215
|
+
try {
|
|
216
|
+
const page = _c;
|
|
217
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
_d = true;
|
|
221
|
+
}
|
|
215
222
|
}
|
|
216
223
|
}
|
|
217
224
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
218
225
|
finally {
|
|
219
226
|
try {
|
|
220
|
-
if (
|
|
227
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
221
228
|
}
|
|
222
229
|
finally { if (e_1) throw e_1.error; }
|
|
223
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registryArtifact.js","sourceRoot":"","sources":["../../src/registryArtifact.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC,OAAO,oBAAoB,CAAC;AAS5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,QAAQ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C,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 \"@azure/core-paging\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nimport {\n ArtifactTagProperties,\n ArtifactManifestProperties,\n ArtifactTagOrder,\n TagPageResponse,\n} from \"./models\";\nimport { tracingClient } 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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.delete\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistry.deleteManifest(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.deleteTag\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.getManifestProperties\",\n options,\n async (updatedOptions) => {\n const result = await this.client.containerRegistry.getManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(\n result,\n this.repositoryName,\n result.registryLoginServer!\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.updateManifestProperties\",\n {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n },\n async (updatedOptions) => {\n const result = await this.client.containerRegistry.updateManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(\n result,\n this.repositoryName,\n result.registryLoginServer!\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.getTagProperties\",\n options,\n (updatedOptions) => {\n return this.client.containerRegistry.getTagProperties(\n this.repositoryName,\n tag,\n updatedOptions\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.updateTagProperties\",\n {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n },\n (updatedOptions) => {\n return this.client.containerRegistry.updateTagAttributes(\n this.repositoryName,\n tag,\n updatedOptions\n );\n }\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"]}
|
|
1
|
+
{"version":3,"file":"registryArtifact.js","sourceRoot":"","sources":["../../src/registryArtifact.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC,OAAO,oBAAoB,CAAC;AAS5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA8LtF;;;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,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,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;YACD,OAAO,iBAAiB,CAAC,iBAAiB,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 \"@azure/core-paging\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nimport {\n ArtifactTagProperties,\n ArtifactManifestProperties,\n ArtifactTagOrder,\n TagPageResponse,\n} from \"./models\";\nimport { tracingClient } 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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.delete\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistry.deleteManifest(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.deleteTag\",\n options,\n async (updatedOptions) => {\n await this.client.containerRegistry.deleteTag(this.repositoryName, tag, updatedOptions);\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.getManifestProperties\",\n options,\n async (updatedOptions) => {\n const result = await this.client.containerRegistry.getManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(\n result,\n this.repositoryName,\n result.registryLoginServer!\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.updateManifestProperties\",\n {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n },\n async (updatedOptions) => {\n const result = await this.client.containerRegistry.updateManifestProperties(\n this.repositoryName,\n await this.getDigest(),\n updatedOptions\n );\n return toArtifactManifestProperties(\n result,\n this.repositoryName,\n result.registryLoginServer!\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.getTagProperties\",\n options,\n (updatedOptions) => {\n return this.client.containerRegistry.getTagProperties(\n this.repositoryName,\n tag,\n updatedOptions\n );\n }\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 return tracingClient.withSpan(\n \"RegistryArtifactImpl.updateTagProperties\",\n {\n ...options,\n value: {\n canDelete: options.canDelete,\n canWrite: options.canWrite,\n canList: options.canList,\n canRead: options.canRead,\n },\n },\n (updatedOptions) => {\n return this.client.containerRegistry.updateTagAttributes(\n this.repositoryName,\n tag,\n updatedOptions\n );\n }\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"]}
|
|
@@ -18,40 +18,54 @@ export function extractNextLink(value) {
|
|
|
18
18
|
export function isDigest(tagOrDigest) {
|
|
19
19
|
return tagOrDigest.includes(":");
|
|
20
20
|
}
|
|
21
|
-
export async function readStreamToEnd(stream) {
|
|
21
|
+
export async function readStreamToEnd(stream, maxLength) {
|
|
22
22
|
const buffers = [];
|
|
23
|
+
let bytesRead = 0;
|
|
23
24
|
return new Promise((resolve, reject) => {
|
|
24
|
-
stream.on("data", (chunk) =>
|
|
25
|
+
stream.on("data", (chunk) => {
|
|
26
|
+
buffers.push(chunk);
|
|
27
|
+
bytesRead += chunk.length;
|
|
28
|
+
if (maxLength && bytesRead > maxLength) {
|
|
29
|
+
reject(new Error(`Stream exceeded maximum allowed length of ${maxLength} bytes.`));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
25
32
|
stream.on("end", () => resolve(Buffer.concat(buffers)));
|
|
26
33
|
stream.on("error", (err) => reject(err));
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
36
|
export function readChunksFromStream(stream, chunkSize) {
|
|
30
37
|
return __asyncGenerator(this, arguments, function* readChunksFromStream_1() {
|
|
31
|
-
var e_1,
|
|
38
|
+
var _a, e_1, _b, _c;
|
|
32
39
|
let chunk = Buffer.alloc(chunkSize);
|
|
33
40
|
let chunkCursor = 0;
|
|
34
41
|
try {
|
|
35
|
-
for (var stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
dataCursor
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
chunkCursor
|
|
46
|
-
|
|
42
|
+
for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a;) {
|
|
43
|
+
_c = stream_1_1.value;
|
|
44
|
+
_d = false;
|
|
45
|
+
try {
|
|
46
|
+
const data = _c;
|
|
47
|
+
const dataAsBuffer = Buffer.isBuffer(data) ? data : Buffer.from(data, "utf8");
|
|
48
|
+
let dataCursor = 0;
|
|
49
|
+
while (dataCursor < dataAsBuffer.length) {
|
|
50
|
+
const bytesCopied = dataAsBuffer.copy(chunk, chunkCursor, dataCursor);
|
|
51
|
+
dataCursor += bytesCopied;
|
|
52
|
+
chunkCursor += bytesCopied;
|
|
53
|
+
if (chunkCursor >= chunkSize) {
|
|
54
|
+
yield yield __await(chunk);
|
|
55
|
+
chunkCursor = 0;
|
|
56
|
+
chunk = Buffer.alloc(chunkSize);
|
|
57
|
+
}
|
|
47
58
|
}
|
|
48
59
|
}
|
|
60
|
+
finally {
|
|
61
|
+
_d = true;
|
|
62
|
+
}
|
|
49
63
|
}
|
|
50
64
|
}
|
|
51
65
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52
66
|
finally {
|
|
53
67
|
try {
|
|
54
|
-
if (
|
|
68
|
+
if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
|
|
55
69
|
}
|
|
56
70
|
finally { if (e_1) throw e_1.error; }
|
|
57
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.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;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.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;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAA6B,EAC7B,SAAkB;IAElB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,OAAO,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AAK,CAAA,CAAC;4BACZ,WAAW,GAAG,CAAC,CAAC;4BAChB,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;yBACjC;qBACF;;;;;aACF;;;;;;;;;QAED,IAAI,WAAW,GAAG,CAAC,EAAE;YACnB,oBAAM,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,CAAA,CAAC;SACtC;IACH,CAAC;CAAA","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\nexport async function readStreamToEnd(\n stream: NodeJS.ReadableStream,\n maxLength?: number\n): Promise<Buffer> {\n const buffers: Buffer[] = [];\n let bytesRead = 0;\n\n return new Promise((resolve, reject) => {\n stream.on(\"data\", (chunk) => {\n buffers.push(chunk);\n bytesRead += chunk.length;\n\n if (maxLength && bytesRead > maxLength) {\n reject(new Error(`Stream exceeded maximum allowed length of ${maxLength} bytes.`));\n }\n });\n stream.on(\"end\", () => resolve(Buffer.concat(buffers)));\n stream.on(\"error\", (err) => reject(err));\n });\n}\n\nexport async function* readChunksFromStream(\n stream: NodeJS.ReadableStream,\n chunkSize: number\n): AsyncGenerator<Buffer> {\n let chunk = Buffer.alloc(chunkSize);\n let chunkCursor = 0;\n\n for await (const data of stream) {\n const dataAsBuffer = Buffer.isBuffer(data) ? data : Buffer.from(data, \"utf8\");\n let dataCursor = 0;\n\n while (dataCursor < dataAsBuffer.length) {\n const bytesCopied = dataAsBuffer.copy(chunk, chunkCursor, dataCursor);\n dataCursor += bytesCopied;\n chunkCursor += bytesCopied;\n if (chunkCursor >= chunkSize) {\n yield chunk;\n chunkCursor = 0;\n chunk = Buffer.alloc(chunkSize);\n }\n }\n }\n\n if (chunkCursor > 0) {\n yield chunk.subarray(0, chunkCursor);\n }\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { AbortError } from "@azure/abort-controller";
|
|
4
|
+
import { Readable } from "stream";
|
|
5
|
+
/**
|
|
6
|
+
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
|
7
|
+
*
|
|
8
|
+
* A Node.js ReadableStream will internally retry when internal ReadableStream unexpected ends.
|
|
9
|
+
*/
|
|
10
|
+
export class RetriableReadableStream extends Readable {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of RetriableReadableStream.
|
|
13
|
+
*
|
|
14
|
+
* @param source - The current ReadableStream returned from getter
|
|
15
|
+
* @param getter - A method calling downloading request returning
|
|
16
|
+
* a new ReadableStream from specified offset
|
|
17
|
+
* @param offset - Offset position in original data source to read
|
|
18
|
+
* @param count - How much data in original data source to read
|
|
19
|
+
* @param options -
|
|
20
|
+
*/
|
|
21
|
+
constructor(source, getter, offset, count, options = {}) {
|
|
22
|
+
super({ highWaterMark: options.highWaterMark });
|
|
23
|
+
this.source = source;
|
|
24
|
+
this.getter = getter;
|
|
25
|
+
this.offset = offset;
|
|
26
|
+
this.retries = 0;
|
|
27
|
+
this.sourceDataHandler = (data) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
if (this.options.doInjectErrorOnce) {
|
|
30
|
+
this.options.doInjectErrorOnce = undefined;
|
|
31
|
+
this.source.pause();
|
|
32
|
+
this.sourceErrorOrEndHandler();
|
|
33
|
+
this.source.destroy();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.offset += data.length;
|
|
37
|
+
if (this.offset > this.end + 1) {
|
|
38
|
+
this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`));
|
|
39
|
+
}
|
|
40
|
+
(_a = this.onData) === null || _a === void 0 ? void 0 : _a.call(this, data);
|
|
41
|
+
(_b = this.onProgress) === null || _b === void 0 ? void 0 : _b.call(this, { loadedBytes: this.offset - this.start });
|
|
42
|
+
if (!this.push(data)) {
|
|
43
|
+
this.source.pause();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this.sourceAbortedHandler = () => {
|
|
47
|
+
const abortError = new AbortError("The operation was aborted.");
|
|
48
|
+
this.destroy(abortError);
|
|
49
|
+
};
|
|
50
|
+
this.sourceErrorOrEndHandler = (err) => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (err && err.name === "AbortError") {
|
|
53
|
+
this.destroy(err);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.removeSourceEventHandlers();
|
|
57
|
+
if (this.offset - 1 === this.end) {
|
|
58
|
+
(_a = this.onEnd) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
59
|
+
this.push(null);
|
|
60
|
+
}
|
|
61
|
+
else if (this.offset <= this.end) {
|
|
62
|
+
if (this.retries < this.maxRetryRequests) {
|
|
63
|
+
this.retries += 1;
|
|
64
|
+
this.getter(this.offset)
|
|
65
|
+
.then((newSource) => {
|
|
66
|
+
this.source = newSource;
|
|
67
|
+
this.setSourceEventHandlers();
|
|
68
|
+
return;
|
|
69
|
+
})
|
|
70
|
+
.catch((error) => {
|
|
71
|
+
this.destroy(error);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
this.getter = getter;
|
|
83
|
+
this.start = offset;
|
|
84
|
+
this.end = offset + count - 1;
|
|
85
|
+
this.maxRetryRequests =
|
|
86
|
+
options.maxRetryRequests && options.maxRetryRequests >= 0 ? options.maxRetryRequests : 0;
|
|
87
|
+
this.onData = options.onData;
|
|
88
|
+
this.onEnd = options.onEnd;
|
|
89
|
+
this.onProgress = options.onProgress;
|
|
90
|
+
this.options = options;
|
|
91
|
+
this.setSourceEventHandlers();
|
|
92
|
+
}
|
|
93
|
+
_read() {
|
|
94
|
+
this.source.resume();
|
|
95
|
+
}
|
|
96
|
+
setSourceEventHandlers() {
|
|
97
|
+
this.source.on("data", this.sourceDataHandler);
|
|
98
|
+
this.source.on("end", this.sourceErrorOrEndHandler);
|
|
99
|
+
this.source.on("error", this.sourceErrorOrEndHandler);
|
|
100
|
+
// needed for Node14
|
|
101
|
+
this.source.on("aborted", this.sourceAbortedHandler);
|
|
102
|
+
}
|
|
103
|
+
removeSourceEventHandlers() {
|
|
104
|
+
this.source.removeListener("data", this.sourceDataHandler);
|
|
105
|
+
this.source.removeListener("end", this.sourceErrorOrEndHandler);
|
|
106
|
+
this.source.removeListener("error", this.sourceErrorOrEndHandler);
|
|
107
|
+
this.source.removeListener("aborted", this.sourceAbortedHandler);
|
|
108
|
+
}
|
|
109
|
+
_destroy(error, callback) {
|
|
110
|
+
// remove listener from source and release source
|
|
111
|
+
this.removeSourceEventHandlers();
|
|
112
|
+
this.source.destroy();
|
|
113
|
+
callback(error === null ? undefined : error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=retriableReadableStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retriableReadableStream.js","sourceRoot":"","sources":["../../../src/utils/retriableReadableStream.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC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oBAAoB,CAAC,CAAC;IACvD,CAAC;IAEO,yBAAyB;QAC/B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACnE,CAAC;IAgFD,QAAQ,CAAC,KAAmB,EAAE,QAAiC;QAC7D,iDAAiD;QACjD,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAChC,IAAI,CAAC,MAAmB,CAAC,OAAO,EAAE,CAAC;QAEpC,QAAQ,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport { TransferProgressEvent } from \"@azure/core-rest-pipeline\";\nimport { Readable } from \"stream\";\n\nexport type ReadableStreamGetter = (offset: number) => Promise<NodeJS.ReadableStream>;\n\nexport interface RetriableReadableStreamOptions {\n /**\n * Max retry count (greater than or equal to 0), undefined or invalid value means no retry\n */\n maxRetryRequests?: number;\n\n /**\n * Read progress event handler\n */\n onProgress?: (progress: TransferProgressEvent) => void;\n\n /**\n * On data event handler\n */\n onData?: (data: Buffer) => void;\n\n /**\n * On end (success) event handler\n */\n onEnd?: () => void;\n\n /**\n * Debug purpose only. Used to inject an unexpected end to existing internal stream,\n * to test stream retry works well or not.\n *\n * When assign it to true, for next incoming \"data\" event of internal stream,\n * RetriableReadableStream will try to emit an \"end\" event to existing internal\n * stream to force it end and start retry from the breaking point.\n * The value will then update to \"undefined\", once the injection works.\n */\n doInjectErrorOnce?: boolean;\n\n /**\n * A threshold, not a limit. Dictates the amount of data that a stream buffers before it stops asking for more data.\n */\n highWaterMark?: number;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * A Node.js ReadableStream will internally retry when internal ReadableStream unexpected ends.\n */\nexport class RetriableReadableStream extends Readable {\n private start: number;\n private end: number;\n private retries: number = 0;\n private maxRetryRequests: number;\n private onData?: (data: Buffer) => void;\n private onEnd?: () => void;\n private onProgress?: (progress: TransferProgressEvent) => void;\n private options: RetriableReadableStreamOptions;\n\n /**\n * Creates an instance of RetriableReadableStream.\n *\n * @param source - The current ReadableStream returned from getter\n * @param getter - A method calling downloading request returning\n * a new ReadableStream from specified offset\n * @param offset - Offset position in original data source to read\n * @param count - How much data in original data source to read\n * @param options -\n */\n public constructor(\n private source: NodeJS.ReadableStream,\n private getter: ReadableStreamGetter,\n private offset: number,\n count: number,\n options: RetriableReadableStreamOptions = {}\n ) {\n super({ highWaterMark: options.highWaterMark });\n this.getter = getter;\n this.start = offset;\n this.end = offset + count - 1;\n this.maxRetryRequests =\n options.maxRetryRequests && options.maxRetryRequests >= 0 ? options.maxRetryRequests : 0;\n this.onData = options.onData;\n this.onEnd = options.onEnd;\n this.onProgress = options.onProgress;\n this.options = options;\n\n this.setSourceEventHandlers();\n }\n\n public _read(): void {\n this.source.resume();\n }\n\n private setSourceEventHandlers() {\n this.source.on(\"data\", this.sourceDataHandler);\n this.source.on(\"end\", this.sourceErrorOrEndHandler);\n this.source.on(\"error\", this.sourceErrorOrEndHandler);\n // needed for Node14\n this.source.on(\"aborted\", this.sourceAbortedHandler);\n }\n\n private removeSourceEventHandlers() {\n this.source.removeListener(\"data\", this.sourceDataHandler);\n this.source.removeListener(\"end\", this.sourceErrorOrEndHandler);\n this.source.removeListener(\"error\", this.sourceErrorOrEndHandler);\n this.source.removeListener(\"aborted\", this.sourceAbortedHandler);\n }\n\n private sourceDataHandler = (data: Buffer) => {\n if (this.options.doInjectErrorOnce) {\n this.options.doInjectErrorOnce = undefined;\n this.source.pause();\n this.sourceErrorOrEndHandler();\n (this.source as Readable).destroy();\n return;\n }\n\n this.offset += data.length;\n\n if (this.offset > this.end + 1) {\n this.destroy(\n new Error(\n `Data corruption failure: Received more data than original request, data needed offset is ${\n this.end\n }, received offset: ${this.offset - 1}`\n )\n );\n }\n\n this.onData?.(data);\n this.onProgress?.({ loadedBytes: this.offset - this.start });\n\n if (!this.push(data)) {\n this.source.pause();\n }\n };\n\n private sourceAbortedHandler = () => {\n const abortError = new AbortError(\"The operation was aborted.\");\n this.destroy(abortError);\n };\n\n private sourceErrorOrEndHandler = (err?: Error) => {\n if (err && err.name === \"AbortError\") {\n this.destroy(err);\n return;\n }\n\n this.removeSourceEventHandlers();\n if (this.offset - 1 === this.end) {\n this.onEnd?.();\n this.push(null);\n } else if (this.offset <= this.end) {\n if (this.retries < this.maxRetryRequests) {\n this.retries += 1;\n this.getter(this.offset)\n .then((newSource) => {\n this.source = newSource;\n this.setSourceEventHandlers();\n return;\n })\n .catch((error) => {\n this.destroy(error);\n });\n } else {\n this.destroy(\n new Error(\n `Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${\n this.offset - 1\n }, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${\n this.maxRetryRequests\n }`\n )\n );\n }\n } else {\n this.destroy(\n new Error(\n `Data corruption failure: Received more data than original request, data needed offset is ${\n this.end\n }, received offset: ${this.offset - 1}`\n )\n );\n }\n };\n\n _destroy(error: Error | null, callback: (error?: Error) => void): void {\n // remove listener from source and release source\n this.removeSourceEventHandlers();\n (this.source as Readable).destroy();\n\n callback(error === null ? undefined : error);\n }\n}\n"]}
|