@azure/arm-hardwaresecuritymodules 2.0.0-alpha.20250717.3 → 2.0.0-alpha.20250722.2
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/dist/browser/api/azureDedicatedHSMResourceProviderContext.js +16 -10
- package/dist/browser/api/azureDedicatedHSMResourceProviderContext.js.map +1 -1
- package/dist/browser/api/cloudHsmClusterBackupStatus/operations.js +10 -5
- package/dist/browser/api/cloudHsmClusterBackupStatus/operations.js.map +1 -1
- package/dist/browser/api/cloudHsmClusterPrivateEndpointConnections/operations.js +28 -11
- package/dist/browser/api/cloudHsmClusterPrivateEndpointConnections/operations.js.map +1 -1
- package/dist/browser/api/cloudHsmClusterPrivateLinkResources/operations.js +8 -3
- package/dist/browser/api/cloudHsmClusterPrivateLinkResources/operations.js.map +1 -1
- package/dist/browser/api/cloudHsmClusterRestoreStatus/operations.js +10 -5
- package/dist/browser/api/cloudHsmClusterRestoreStatus/operations.js.map +1 -1
- package/dist/browser/api/cloudHsmClusters/operations.js +111 -49
- package/dist/browser/api/cloudHsmClusters/operations.js.map +1 -1
- package/dist/browser/api/dedicatedHsm/operations.js +68 -29
- package/dist/browser/api/dedicatedHsm/operations.js.map +1 -1
- package/dist/browser/api/operations/operations.js +8 -3
- package/dist/browser/api/operations/operations.js.map +1 -1
- package/dist/browser/api/privateEndpointConnections/operations.js +8 -3
- package/dist/browser/api/privateEndpointConnections/operations.js.map +1 -1
- package/dist/browser/azureDedicatedHSMResourceProvider.js +24 -3
- package/dist/browser/azureDedicatedHSMResourceProvider.js.map +1 -1
- package/dist/browser/classic/cloudHsmClusterBackupStatus/index.js +3 -1
- package/dist/browser/classic/cloudHsmClusterBackupStatus/index.js.map +1 -1
- package/dist/browser/classic/cloudHsmClusterPrivateEndpointConnections/index.js +3 -1
- package/dist/browser/classic/cloudHsmClusterPrivateEndpointConnections/index.js.map +1 -1
- package/dist/browser/classic/cloudHsmClusterPrivateLinkResources/index.js +3 -1
- package/dist/browser/classic/cloudHsmClusterPrivateLinkResources/index.js.map +1 -1
- package/dist/browser/classic/cloudHsmClusterRestoreStatus/index.js +3 -1
- package/dist/browser/classic/cloudHsmClusterRestoreStatus/index.js.map +1 -1
- package/dist/browser/classic/cloudHsmClusters/index.js +3 -1
- package/dist/browser/classic/cloudHsmClusters/index.js.map +1 -1
- package/dist/browser/classic/dedicatedHsm/index.js +3 -1
- package/dist/browser/classic/dedicatedHsm/index.js.map +1 -1
- package/dist/browser/classic/operations/index.js +3 -1
- package/dist/browser/classic/operations/index.js.map +1 -1
- package/dist/browser/classic/privateEndpointConnections/index.js +3 -1
- package/dist/browser/classic/privateEndpointConnections/index.js.map +1 -1
- package/dist/browser/restorePollerHelpers.js +11 -13
- package/dist/browser/restorePollerHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pagingHelpers.js +31 -50
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pollingHelpers.js +14 -11
- package/dist/browser/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/urlTemplate.js +2 -2
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/api/azureDedicatedHSMResourceProviderContext.js +16 -10
- package/dist/commonjs/api/azureDedicatedHSMResourceProviderContext.js.map +1 -1
- package/dist/commonjs/api/cloudHsmClusterBackupStatus/operations.js +10 -5
- package/dist/commonjs/api/cloudHsmClusterBackupStatus/operations.js.map +1 -1
- package/dist/commonjs/api/cloudHsmClusterPrivateEndpointConnections/operations.js +28 -11
- package/dist/commonjs/api/cloudHsmClusterPrivateEndpointConnections/operations.js.map +1 -1
- package/dist/commonjs/api/cloudHsmClusterPrivateLinkResources/operations.js +8 -3
- package/dist/commonjs/api/cloudHsmClusterPrivateLinkResources/operations.js.map +1 -1
- package/dist/commonjs/api/cloudHsmClusterRestoreStatus/operations.js +10 -5
- package/dist/commonjs/api/cloudHsmClusterRestoreStatus/operations.js.map +1 -1
- package/dist/commonjs/api/cloudHsmClusters/operations.js +111 -49
- package/dist/commonjs/api/cloudHsmClusters/operations.js.map +1 -1
- package/dist/commonjs/api/dedicatedHsm/operations.js +68 -29
- package/dist/commonjs/api/dedicatedHsm/operations.js.map +1 -1
- package/dist/commonjs/api/operations/operations.js +8 -3
- package/dist/commonjs/api/operations/operations.js.map +1 -1
- package/dist/commonjs/api/privateEndpointConnections/operations.js +8 -3
- package/dist/commonjs/api/privateEndpointConnections/operations.js.map +1 -1
- package/dist/commonjs/azureDedicatedHSMResourceProvider.js +24 -3
- package/dist/commonjs/azureDedicatedHSMResourceProvider.js.map +1 -1
- package/dist/commonjs/classic/cloudHsmClusterBackupStatus/index.js +3 -1
- package/dist/commonjs/classic/cloudHsmClusterBackupStatus/index.js.map +1 -1
- package/dist/commonjs/classic/cloudHsmClusterPrivateEndpointConnections/index.js +3 -1
- package/dist/commonjs/classic/cloudHsmClusterPrivateEndpointConnections/index.js.map +1 -1
- package/dist/commonjs/classic/cloudHsmClusterPrivateLinkResources/index.js +3 -1
- package/dist/commonjs/classic/cloudHsmClusterPrivateLinkResources/index.js.map +1 -1
- package/dist/commonjs/classic/cloudHsmClusterRestoreStatus/index.js +3 -1
- package/dist/commonjs/classic/cloudHsmClusterRestoreStatus/index.js.map +1 -1
- package/dist/commonjs/classic/cloudHsmClusters/index.js +3 -1
- package/dist/commonjs/classic/cloudHsmClusters/index.js.map +1 -1
- package/dist/commonjs/classic/dedicatedHsm/index.js +3 -1
- package/dist/commonjs/classic/dedicatedHsm/index.js.map +1 -1
- package/dist/commonjs/classic/operations/index.js +3 -1
- package/dist/commonjs/classic/operations/index.js.map +1 -1
- package/dist/commonjs/classic/privateEndpointConnections/index.js +3 -1
- package/dist/commonjs/classic/privateEndpointConnections/index.js.map +1 -1
- package/dist/commonjs/restorePollerHelpers.js +11 -13
- package/dist/commonjs/restorePollerHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pagingHelpers.js +31 -50
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pollingHelpers.js +14 -11
- package/dist/commonjs/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/urlTemplate.js +2 -2
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/api/azureDedicatedHSMResourceProviderContext.js +16 -10
- package/dist/esm/api/azureDedicatedHSMResourceProviderContext.js.map +1 -1
- package/dist/esm/api/cloudHsmClusterBackupStatus/operations.js +10 -5
- package/dist/esm/api/cloudHsmClusterBackupStatus/operations.js.map +1 -1
- package/dist/esm/api/cloudHsmClusterPrivateEndpointConnections/operations.js +28 -11
- package/dist/esm/api/cloudHsmClusterPrivateEndpointConnections/operations.js.map +1 -1
- package/dist/esm/api/cloudHsmClusterPrivateLinkResources/operations.js +8 -3
- package/dist/esm/api/cloudHsmClusterPrivateLinkResources/operations.js.map +1 -1
- package/dist/esm/api/cloudHsmClusterRestoreStatus/operations.js +10 -5
- package/dist/esm/api/cloudHsmClusterRestoreStatus/operations.js.map +1 -1
- package/dist/esm/api/cloudHsmClusters/operations.js +111 -49
- package/dist/esm/api/cloudHsmClusters/operations.js.map +1 -1
- package/dist/esm/api/dedicatedHsm/operations.js +68 -29
- package/dist/esm/api/dedicatedHsm/operations.js.map +1 -1
- package/dist/esm/api/operations/operations.js +8 -3
- package/dist/esm/api/operations/operations.js.map +1 -1
- package/dist/esm/api/privateEndpointConnections/operations.js +8 -3
- package/dist/esm/api/privateEndpointConnections/operations.js.map +1 -1
- package/dist/esm/azureDedicatedHSMResourceProvider.js +24 -3
- package/dist/esm/azureDedicatedHSMResourceProvider.js.map +1 -1
- package/dist/esm/classic/cloudHsmClusterBackupStatus/index.js +3 -1
- package/dist/esm/classic/cloudHsmClusterBackupStatus/index.js.map +1 -1
- package/dist/esm/classic/cloudHsmClusterPrivateEndpointConnections/index.js +3 -1
- package/dist/esm/classic/cloudHsmClusterPrivateEndpointConnections/index.js.map +1 -1
- package/dist/esm/classic/cloudHsmClusterPrivateLinkResources/index.js +3 -1
- package/dist/esm/classic/cloudHsmClusterPrivateLinkResources/index.js.map +1 -1
- package/dist/esm/classic/cloudHsmClusterRestoreStatus/index.js +3 -1
- package/dist/esm/classic/cloudHsmClusterRestoreStatus/index.js.map +1 -1
- package/dist/esm/classic/cloudHsmClusters/index.js +3 -1
- package/dist/esm/classic/cloudHsmClusters/index.js.map +1 -1
- package/dist/esm/classic/dedicatedHsm/index.js +3 -1
- package/dist/esm/classic/dedicatedHsm/index.js.map +1 -1
- package/dist/esm/classic/operations/index.js +3 -1
- package/dist/esm/classic/operations/index.js.map +1 -1
- package/dist/esm/classic/privateEndpointConnections/index.js +3 -1
- package/dist/esm/classic/privateEndpointConnections/index.js.map +1 -1
- package/dist/esm/restorePollerHelpers.js +11 -13
- package/dist/esm/restorePollerHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pagingHelpers.js +31 -50
- package/dist/esm/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pollingHelpers.js +14 -11
- package/dist/esm/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/urlTemplate.js +2 -2
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
- package/dist/react-native/api/azureDedicatedHSMResourceProviderContext.js +16 -10
- package/dist/react-native/api/azureDedicatedHSMResourceProviderContext.js.map +1 -1
- package/dist/react-native/api/cloudHsmClusterBackupStatus/operations.js +10 -5
- package/dist/react-native/api/cloudHsmClusterBackupStatus/operations.js.map +1 -1
- package/dist/react-native/api/cloudHsmClusterPrivateEndpointConnections/operations.js +28 -11
- package/dist/react-native/api/cloudHsmClusterPrivateEndpointConnections/operations.js.map +1 -1
- package/dist/react-native/api/cloudHsmClusterPrivateLinkResources/operations.js +8 -3
- package/dist/react-native/api/cloudHsmClusterPrivateLinkResources/operations.js.map +1 -1
- package/dist/react-native/api/cloudHsmClusterRestoreStatus/operations.js +10 -5
- package/dist/react-native/api/cloudHsmClusterRestoreStatus/operations.js.map +1 -1
- package/dist/react-native/api/cloudHsmClusters/operations.js +111 -49
- package/dist/react-native/api/cloudHsmClusters/operations.js.map +1 -1
- package/dist/react-native/api/dedicatedHsm/operations.js +68 -29
- package/dist/react-native/api/dedicatedHsm/operations.js.map +1 -1
- package/dist/react-native/api/operations/operations.js +8 -3
- package/dist/react-native/api/operations/operations.js.map +1 -1
- package/dist/react-native/api/privateEndpointConnections/operations.js +8 -3
- package/dist/react-native/api/privateEndpointConnections/operations.js.map +1 -1
- package/dist/react-native/azureDedicatedHSMResourceProvider.js +24 -3
- package/dist/react-native/azureDedicatedHSMResourceProvider.js.map +1 -1
- package/dist/react-native/classic/cloudHsmClusterBackupStatus/index.js +3 -1
- package/dist/react-native/classic/cloudHsmClusterBackupStatus/index.js.map +1 -1
- package/dist/react-native/classic/cloudHsmClusterPrivateEndpointConnections/index.js +3 -1
- package/dist/react-native/classic/cloudHsmClusterPrivateEndpointConnections/index.js.map +1 -1
- package/dist/react-native/classic/cloudHsmClusterPrivateLinkResources/index.js +3 -1
- package/dist/react-native/classic/cloudHsmClusterPrivateLinkResources/index.js.map +1 -1
- package/dist/react-native/classic/cloudHsmClusterRestoreStatus/index.js +3 -1
- package/dist/react-native/classic/cloudHsmClusterRestoreStatus/index.js.map +1 -1
- package/dist/react-native/classic/cloudHsmClusters/index.js +3 -1
- package/dist/react-native/classic/cloudHsmClusters/index.js.map +1 -1
- package/dist/react-native/classic/dedicatedHsm/index.js +3 -1
- package/dist/react-native/classic/dedicatedHsm/index.js.map +1 -1
- package/dist/react-native/classic/operations/index.js +3 -1
- package/dist/react-native/classic/operations/index.js.map +1 -1
- package/dist/react-native/classic/privateEndpointConnections/index.js +3 -1
- package/dist/react-native/classic/privateEndpointConnections/index.js.map +1 -1
- package/dist/react-native/restorePollerHelpers.js +11 -13
- package/dist/react-native/restorePollerHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.js +31 -50
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pollingHelpers.js +14 -11
- package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/urlTemplate.js +2 -2
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
- package/package.json +2 -2
- package/review/arm-hardwaresecuritymodules-api-cloudHsmClusterBackupStatus-node.api.md +22 -22
- package/review/arm-hardwaresecuritymodules-api-cloudHsmClusterPrivateEndpointConnections-node.api.md +36 -36
- package/review/arm-hardwaresecuritymodules-api-cloudHsmClusterPrivateLinkResources-node.api.md +19 -19
- package/review/arm-hardwaresecuritymodules-api-cloudHsmClusterRestoreStatus-node.api.md +22 -22
- package/review/arm-hardwaresecuritymodules-api-cloudHsmClusters-node.api.md +96 -96
- package/review/arm-hardwaresecuritymodules-api-dedicatedHsm-node.api.md +68 -68
- package/review/arm-hardwaresecuritymodules-api-node.api.md +27 -27
- package/review/arm-hardwaresecuritymodules-api-operations-node.api.md +19 -19
- package/review/arm-hardwaresecuritymodules-api-privateEndpointConnections-node.api.md +19 -19
- package/review/arm-hardwaresecuritymodules-models-node.api.md +471 -471
- package/review/arm-hardwaresecuritymodules-node.api.md +703 -703
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/cloudHsmClusterRestoreStatus/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAC;AAc3E,SAAS,gCAAgC,CAAC,OAAiD;IACzF,OAAO;QACL,GAAG,EAAE,CACH,iBAAyB,EACzB,mBAA2B,EAC3B,KAAa,EACb,OAAuD,EACvD,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0CAA0C,CACxD,OAAiD;IAEjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/cloudHsmClusterRestoreStatus/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAC;AAc3E,SAAS,gCAAgC,CAAC,OAAiD;IACzF,OAAO;QACL,GAAG,EAAE,CACH,iBAAyB,EACzB,mBAA2B,EAC3B,KAAa,EACb,OAAuD,EACvD,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0CAA0C,CACxD,OAAiD;IAEjD,OAAO;QACL,GAAG,gCAAgC,CAAC,OAAO,CAAC;KAC7C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProviderContext } from \"../../api/azureDedicatedHSMResourceProviderContext.js\";\nimport { CloudHsmClusterRestoreStatusGetOptionalParams } from \"../../api/cloudHsmClusterRestoreStatus/options.js\";\nimport { get } from \"../../api/cloudHsmClusterRestoreStatus/operations.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a CloudHsmClusterRestoreStatus operations. */\nexport interface CloudHsmClusterRestoreStatusOperations {\n /** Gets the restore operation status of the specified Cloud HSM Cluster */\n get: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n jobId: string,\n options?: CloudHsmClusterRestoreStatusGetOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n}\n\nfunction _getCloudHsmClusterRestoreStatus(context: AzureDedicatedHSMResourceProviderContext) {\n return {\n get: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n jobId: string,\n options?: CloudHsmClusterRestoreStatusGetOptionalParams,\n ) => get(context, resourceGroupName, cloudHsmClusterName, jobId, options),\n };\n}\n\nexport function _getCloudHsmClusterRestoreStatusOperations(\n context: AzureDedicatedHSMResourceProviderContext,\n): CloudHsmClusterRestoreStatusOperations {\n return {\n ..._getCloudHsmClusterRestoreStatus(context),\n };\n}\n"]}
|
|
@@ -16,6 +16,8 @@ function _getCloudHsmClusters(context) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
export function _getCloudHsmClustersOperations(context) {
|
|
19
|
-
return
|
|
19
|
+
return {
|
|
20
|
+
..._getCloudHsmClusters(context),
|
|
21
|
+
};
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/cloudHsmClusters/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsBlC,OAAO,EACL,OAAO,EACP,yBAAyB,EACzB,MAAM,EACN,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,cAAc,EACd,GAAG,GACJ,MAAM,0CAA0C,CAAC;AAyElD,SAAS,oBAAoB,CAAC,OAAiD;IAC7E,OAAO;QACL,OAAO,EAAE,CACP,iBAAyB,EACzB,mBAA2B,EAC3B,wBAAkD,EAClD,OAA+C,EAC/C,EAAE,CACF,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,OAAO,CAAC;QAC7F,yBAAyB,EAAE,CACzB,iBAAyB,EACzB,mBAA2B,EAC3B,OAAiE,EACjE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,OAAO,CAAC;QACxF,MAAM,EAAE,CACN,iBAAyB,EACzB,mBAA2B,EAC3B,OAA8C,EAC9C,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,OAAO,CAAC;QACrE,wBAAwB,EAAE,CACxB,iBAAyB,EACzB,mBA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AI,EAAE,OAAO,CAAC;QAC3E,cAAc,EAAE,CACd,iBAAyB,EACzB,mBAA2B,EAC3B,IAAqB,EACrB,OAAsD,EACtD,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,CAAC;QACnF,GAAG,EAAE,CACH,iBAAyB,EACzB,mBAA2B,EAC3B,OAA2C,EAC3C,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,OAAO,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,OAAiD;IAEjD,OAAO;QACL,GAAG,oBAAoB,CAAC,OAAO,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProviderContext } from \"../../api/azureDedicatedHSMResourceProviderContext.js\";\nimport {\n CloudHsmCluster,\n CloudHsmClusterPatchParameters,\n BackupResult,\n RestoreRequestProperties,\n RestoreResult,\n} from \"../../models/models.js\";\nimport {\n CloudHsmClustersRestoreOptionalParams,\n CloudHsmClustersValidateRestorePropertiesOptionalParams,\n CloudHsmClustersBackupOptionalParams,\n CloudHsmClustersValidateBackupPropertiesOptionalParams,\n CloudHsmClustersListBySubscriptionOptionalParams,\n CloudHsmClustersListByResourceGroupOptionalParams,\n CloudHsmClustersDeleteOptionalParams,\n CloudHsmClustersUpdateOptionalParams,\n CloudHsmClustersCreateOrUpdateOptionalParams,\n CloudHsmClustersGetOptionalParams,\n} from \"../../api/cloudHsmClusters/options.js\";\nimport {\n restore,\n validateRestoreProperties,\n backup,\n validateBackupProperties,\n listBySubscription,\n listByResourceGroup,\n $delete,\n update,\n createOrUpdate,\n get,\n} from \"../../api/cloudHsmClusters/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a CloudHsmClusters operations. */\nexport interface CloudHsmClustersOperations {\n /** Restores all key materials of a specified Cloud HSM Cluster */\n restore: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n restoreRequestProperties: RestoreRequestProperties,\n options?: CloudHsmClustersRestoreOptionalParams,\n ) => PollerLike<OperationState<RestoreResult>, RestoreResult>;\n /** Queued validating pre restore operation */\n validateRestoreProperties: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersValidateRestorePropertiesOptionalParams,\n ) => PollerLike<OperationState<RestoreResult>, RestoreResult>;\n /** Create a backup of the Cloud HSM Cluster in the specified subscription */\n backup: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersBackupOptionalParams,\n ) => PollerLike<OperationState<BackupResult>, BackupResult>;\n /** Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in the specified subscription. */\n validateBackupProperties: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersValidateBackupPropertiesOptionalParams,\n ) => PollerLike<OperationState<BackupResult>, BackupResult>;\n /** The List operation gets information about the Cloud HSM Clusters associated with the subscription. */\n listBySubscription: (\n options?: CloudHsmClustersListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<CloudHsmCluster>;\n /** The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the specified resource group. */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: CloudHsmClustersListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<CloudHsmCluster>;\n /** Deletes the specified Cloud HSM Cluster */\n /**\n * @fixme delete is a reserved word that cannot be used as an operation name.\n * Please add @clientName(\"clientName\") or @clientName(\"<JS-Specific-Name>\", \"javascript\")\n * to the operation to override the generated name.\n */\n delete: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** Update a Cloud HSM Cluster in the specified subscription. */\n update: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n body: CloudHsmClusterPatchParameters,\n options?: CloudHsmClustersUpdateOptionalParams,\n ) => PollerLike<OperationState<CloudHsmCluster>, CloudHsmCluster>;\n /** Create or Update a Cloud HSM Cluster in the specified subscription. */\n createOrUpdate: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n body: CloudHsmCluster,\n options?: CloudHsmClustersCreateOrUpdateOptionalParams,\n ) => PollerLike<OperationState<CloudHsmCluster>, CloudHsmCluster>;\n /** Gets the specified Cloud HSM Cluster */\n get: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersGetOptionalParams,\n ) => Promise<CloudHsmCluster>;\n}\n\nfunction _getCloudHsmClusters(context: AzureDedicatedHSMResourceProviderContext) {\n return {\n restore: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n restoreRequestProperties: RestoreRequestProperties,\n options?: CloudHsmClustersRestoreOptionalParams,\n ) =>\n restore(context, resourceGroupName, cloudHsmClusterName, restoreRequestProperties, options),\n validateRestoreProperties: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersValidateRestorePropertiesOptionalParams,\n ) => validateRestoreProperties(context, resourceGroupName, cloudHsmClusterName, options),\n backup: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersBackupOptionalParams,\n ) => backup(context, resourceGroupName, cloudHsmClusterName, options),\n validateBackupProperties: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersValidateBackupPropertiesOptionalParams,\n ) => validateBackupProperties(context, resourceGroupName, cloudHsmClusterName, options),\n listBySubscription: (options?: CloudHsmClustersListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: CloudHsmClustersListByResourceGroupOptionalParams,\n ) => listByResourceGroup(context, resourceGroupName, options),\n delete: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, cloudHsmClusterName, options),\n update: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n body: CloudHsmClusterPatchParameters,\n options?: CloudHsmClustersUpdateOptionalParams,\n ) => update(context, resourceGroupName, cloudHsmClusterName, body, options),\n createOrUpdate: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n body: CloudHsmCluster,\n options?: CloudHsmClustersCreateOrUpdateOptionalParams,\n ) => createOrUpdate(context, resourceGroupName, cloudHsmClusterName, body, options),\n get: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: CloudHsmClustersGetOptionalParams,\n ) => get(context, resourceGroupName, cloudHsmClusterName, options),\n };\n}\n\nexport function _getCloudHsmClustersOperations(\n context: AzureDedicatedHSMResourceProviderContext,\n): CloudHsmClustersOperations {\n return {\n ..._getCloudHsmClusters(context),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/dedicatedHsm/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,OAAO,EACL,wCAAwC,EACxC,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,cAAc,EACd,GAAG,GACJ,MAAM,sCAAsC,CAAC;AAsD9C,SAAS,gBAAgB,CAAC,OAAiD;IACzE,OAAO;QACL,wCAAwC,EAAE,CACxC,iBAAyB,EACzB,IAAY,EACZ,OAA4E,EAC5E,EAAE,CAAC,wCAAwC,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC;QACxF,kBAAkB,EAAE,CAAC,OAAsD,EAAE,EAAE,CAC7E,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAuD,EACvD,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CAA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D,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CAAC,iBAAyB,EAAE,IAAY,EAAE,OAA0C,EAAE,EAAE,CAC9F,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC;QACpD,MAAM,EAAE,CACN,iBAAyB,EACzB,IAAY,EACZ,UAAuC,EACvC,OAA0C,EAC1C,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;QAClE,cAAc,EAAE,CACd,iBAAyB,EACzB,IAAY,EACZ,UAAwB,EACxB,OAAkD,EAClD,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;QAC1E,GAAG,EAAE,CAAC,iBAAyB,EAAE,IAAY,EAAE,OAAuC,EAAE,EAAE,CACxF,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,OAAiD;IAEjD,OAAO;QACL,GAAG,gBAAgB,CAAC,OAAO,CAAC;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProviderContext } from \"../../api/azureDedicatedHSMResourceProviderContext.js\";\nimport {\n DedicatedHsm,\n DedicatedHsmPatchParameters,\n OutboundEnvironmentEndpoint,\n} from \"../../models/models.js\";\nimport {\n DedicatedHsmListOutboundNetworkDependenciesEndpointsOptionalParams,\n DedicatedHsmListBySubscriptionOptionalParams,\n DedicatedHsmListByResourceGroupOptionalParams,\n DedicatedHsmDeleteOptionalParams,\n DedicatedHsmUpdateOptionalParams,\n DedicatedHsmCreateOrUpdateOptionalParams,\n DedicatedHsmGetOptionalParams,\n} from \"../../api/dedicatedHsm/options.js\";\nimport {\n listOutboundNetworkDependenciesEndpoints,\n listBySubscription,\n listByResourceGroup,\n $delete,\n update,\n createOrUpdate,\n get,\n} from \"../../api/dedicatedHsm/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a DedicatedHsm operations. */\nexport interface DedicatedHsmOperations {\n /** Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. The operation returns properties of each egress endpoint. */\n listOutboundNetworkDependenciesEndpoints: (\n resourceGroupName: string,\n name: string,\n options?: DedicatedHsmListOutboundNetworkDependenciesEndpointsOptionalParams,\n ) => PagedAsyncIterableIterator<OutboundEnvironmentEndpoint>;\n /** The List operation gets information about the dedicated HSMs associated with the subscription. */\n listBySubscription: (\n options?: DedicatedHsmListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<DedicatedHsm>;\n /** The List operation gets information about the dedicated HSMs associated with the subscription and within the specified resource group. */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: DedicatedHsmListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<DedicatedHsm>;\n /** Deletes the specified Azure Dedicated HSM. */\n /**\n * @fixme delete is a reserved word that cannot be used as an operation name.\n * Please add @clientName(\"clientName\") or @clientName(\"<JS-Specific-Name>\", \"javascript\")\n * to the operation to override the generated name.\n */\n delete: (\n resourceGroupName: string,\n name: string,\n options?: DedicatedHsmDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** Update a dedicated HSM in the specified subscription. */\n update: (\n resourceGroupName: string,\n name: string,\n parameters: DedicatedHsmPatchParameters,\n options?: DedicatedHsmUpdateOptionalParams,\n ) => PollerLike<OperationState<DedicatedHsm>, DedicatedHsm>;\n /** Create or Update a dedicated HSM in the specified subscription. */\n createOrUpdate: (\n resourceGroupName: string,\n name: string,\n parameters: DedicatedHsm,\n options?: DedicatedHsmCreateOrUpdateOptionalParams,\n ) => PollerLike<OperationState<DedicatedHsm>, DedicatedHsm>;\n /** Gets the specified Azure dedicated HSM. */\n get: (\n resourceGroupName: string,\n name: string,\n options?: DedicatedHsmGetOptionalParams,\n ) => Promise<DedicatedHsm>;\n}\n\nfunction _getDedicatedHsm(context: AzureDedicatedHSMResourceProviderContext) {\n return {\n listOutboundNetworkDependenciesEndpoints: (\n resourceGroupName: string,\n name: string,\n options?: DedicatedHsmListOutboundNetworkDependenciesEndpointsOptionalParams,\n ) => listOutboundNetworkDependenciesEndpoints(context, resourceGroupName, name, options),\n listBySubscription: (options?: DedicatedHsmListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: DedicatedHsmListByResourceGroupOptionalParams,\n ) => listByResourceGroup(context, resourceGroupName, options),\n delete: (resourceGroupName: string, name: string, options?: DedicatedHsmDeleteOptionalParams) =>\n $delete(context, resourceGroupName, name, options),\n update: (\n resourceGroupName: string,\n name: string,\n parameters: DedicatedHsmPatchParameters,\n options?: DedicatedHsmUpdateOptionalParams,\n ) => update(context, resourceGroupName, name, parameters, options),\n createOrUpdate: (\n resourceGroupName: string,\n name: string,\n parameters: DedicatedHsm,\n options?: DedicatedHsmCreateOrUpdateOptionalParams,\n ) => createOrUpdate(context, resourceGroupName, name, parameters, options),\n get: (resourceGroupName: string, name: string, options?: DedicatedHsmGetOptionalParams) =>\n get(context, resourceGroupName, name, options),\n };\n}\n\nexport function _getDedicatedHsmOperations(\n context: AzureDedicatedHSMResourceProviderContext,\n): DedicatedHsmOperations {\n return {\n ..._getDedicatedHsm(context),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAS1D,SAAS,cAAc,CAAC,OAAiD;IACvE,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAiD;IAEjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAS1D,SAAS,cAAc,CAAC,OAAiD;IACvE,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAiD;IAEjD,OAAO;QACL,GAAG,cAAc,CAAC,OAAO,CAAC;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProviderContext } from \"../../api/azureDedicatedHSMResourceProviderContext.js\";\nimport { Operation } from \"../../models/models.js\";\nimport { OperationsListOptionalParams } from \"../../api/operations/options.js\";\nimport { list } from \"../../api/operations/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Operations operations. */\nexport interface OperationsOperations {\n /** List the operations for the provider */\n list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator<Operation>;\n}\n\nfunction _getOperations(context: AzureDedicatedHSMResourceProviderContext) {\n return {\n list: (options?: OperationsListOptionalParams) => list(context, options),\n };\n}\n\nexport function _getOperationsOperations(\n context: AzureDedicatedHSMResourceProviderContext,\n): OperationsOperations {\n return {\n ..._getOperations(context),\n };\n}\n"]}
|
|
@@ -7,6 +7,8 @@ function _getPrivateEndpointConnections(context) {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export function _getPrivateEndpointConnectionsOperations(context) {
|
|
10
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
..._getPrivateEndpointConnections(context),
|
|
12
|
+
};
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/privateEndpointConnections/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAa3F,SAAS,8BAA8B,CAAC,OAAiD;IACvF,OAAO;QACL,qBAAqB,EAAE,CACrB,iBAAyB,EACzB,mBAA2B,EAC3B,OAAuE,EACvE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,OAAO,CAAC;KACrF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,OAAiD;IAEjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/privateEndpointConnections/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAa3F,SAAS,8BAA8B,CAAC,OAAiD;IACvF,OAAO;QACL,qBAAqB,EAAE,CACrB,iBAAyB,EACzB,mBAA2B,EAC3B,OAAuE,EACvE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,OAAO,CAAC;KACrF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,OAAiD;IAEjD,OAAO;QACL,GAAG,8BAA8B,CAAC,OAAO,CAAC;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProviderContext } from \"../../api/azureDedicatedHSMResourceProviderContext.js\";\nimport { PrivateEndpointConnection } from \"../../models/models.js\";\nimport { PrivateEndpointConnectionsListByCloudHsmClusterOptionalParams } from \"../../api/privateEndpointConnections/options.js\";\nimport { listByCloudHsmCluster } from \"../../api/privateEndpointConnections/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a PrivateEndpointConnections operations. */\nexport interface PrivateEndpointConnectionsOperations {\n /** The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster */\n listByCloudHsmCluster: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: PrivateEndpointConnectionsListByCloudHsmClusterOptionalParams,\n ) => PagedAsyncIterableIterator<PrivateEndpointConnection>;\n}\n\nfunction _getPrivateEndpointConnections(context: AzureDedicatedHSMResourceProviderContext) {\n return {\n listByCloudHsmCluster: (\n resourceGroupName: string,\n cloudHsmClusterName: string,\n options?: PrivateEndpointConnectionsListByCloudHsmClusterOptionalParams,\n ) => listByCloudHsmCluster(context, resourceGroupName, cloudHsmClusterName, options),\n };\n}\n\nexport function _getPrivateEndpointConnectionsOperations(\n context: AzureDedicatedHSMResourceProviderContext,\n): PrivateEndpointConnectionsOperations {\n return {\n ..._getPrivateEndpointConnections(context),\n };\n}\n"]}
|
|
@@ -13,21 +13,20 @@ import { deserializeState, } from "@azure/core-lro";
|
|
|
13
13
|
* needs to be constructed after the original one is not in scope.
|
|
14
14
|
*/
|
|
15
15
|
export function restorePoller(client, serializedState, sourceOperation, options) {
|
|
16
|
-
var _a, _b, _c;
|
|
17
16
|
const pollerConfig = deserializeState(serializedState).config;
|
|
18
17
|
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
19
18
|
if (!initialRequestUrl || !requestMethod) {
|
|
20
|
-
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation
|
|
19
|
+
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
|
|
21
20
|
}
|
|
22
|
-
const resourceLocationConfig = metadata
|
|
23
|
-
const { deserializer, expectedStatuses = [] } =
|
|
24
|
-
const deserializeHelper =
|
|
21
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
22
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
23
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
25
24
|
if (!deserializeHelper) {
|
|
26
|
-
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation
|
|
25
|
+
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
27
26
|
}
|
|
28
|
-
return getLongRunningPoller(
|
|
29
|
-
updateIntervalInMs: options
|
|
30
|
-
abortSignal: options
|
|
27
|
+
return getLongRunningPoller(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
28
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
29
|
+
abortSignal: options?.abortSignal,
|
|
31
30
|
resourceLocationConfig,
|
|
32
31
|
restoreFrom: serializedState,
|
|
33
32
|
initialRequestUrl,
|
|
@@ -76,7 +75,6 @@ const deserializeMap = {
|
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
77
|
function getDeserializationHelper(urlStr, method) {
|
|
79
|
-
var _a, _b, _c, _d;
|
|
80
78
|
const path = new URL(urlStr).pathname;
|
|
81
79
|
const pathParts = path.split("/");
|
|
82
80
|
// Traverse list to match the longest candidate
|
|
@@ -96,13 +94,13 @@ function getDeserializationHelper(urlStr, method) {
|
|
|
96
94
|
// track if we have found a match to return the values found.
|
|
97
95
|
let found = true;
|
|
98
96
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
99
|
-
if (
|
|
100
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
97
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
98
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
101
99
|
// If the current part of the candidate is a "template" part
|
|
102
100
|
// Try to use the suffix of pattern to match the path
|
|
103
101
|
// {guid} ==> $
|
|
104
102
|
// {guid}:export ==> :export$
|
|
105
|
-
const isMatched = new RegExp(`${
|
|
103
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
106
104
|
if (!isMatched) {
|
|
107
105
|
found = false;
|
|
108
106
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,IAAI,4DAA4D,EAAE,MAAM,+DAA+D,CAAC;AACpK,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,eAAe,IAAI,0CAA0C,EAAE,MAAM,iDAAiD,CAAC;AAChI,OAAO,EACL,mBAAmB,EACnB,qCAAqC,EACrC,kBAAkB,EAClB,oCAAoC,EACpC,mBAAmB,IAAI,mCAAmC,EAC1D,kBAAkB,IAAI,kCAAkC,EACxD,0BAA0B,IAAI,0CAA0C,GACzE,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAGL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAgBzB;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAyC,EACzC,eAAuB,EACvB,eAAiF,EACjF,OAAuC;;IAEvC,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,GA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,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAC1E,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProvider } from \"./azureDedicatedHSMResourceProvider.js\";\nimport {\n _$deleteDeserialize,\n _updateDeserialize,\n _createOrUpdateDeserialize,\n} from \"./api/dedicatedHsm/operations.js\";\nimport { _$deleteDeserialize as _$deleteDeserializeCloudHsmClusterPrivateEndpointConnections } from \"./api/cloudHsmClusterPrivateEndpointConnections/operations.js\";\nimport { _getDeserialize } from \"./api/cloudHsmClusterRestoreStatus/operations.js\";\nimport { _getDeserialize as _getDeserializeCloudHsmClusterBackupStatus } from \"./api/cloudHsmClusterBackupStatus/operations.js\";\nimport {\n _restoreDeserialize,\n _validateRestorePropertiesDeserialize,\n _backupDeserialize,\n _validateBackupPropertiesDeserialize,\n _$deleteDeserialize as _$deleteDeserializeCloudHsmClusters,\n _updateDeserialize as _updateDeserializeCloudHsmClusters,\n _createOrUpdateDeserialize as _createOrUpdateDeserializeCloudHsmClusters,\n} from \"./api/cloudHsmClusters/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: AzureDedicatedHSMResourceProvider,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n {\n deserializer: _$deleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n { deserializer: _updateDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n {\n deserializer: _createOrUpdateDeserialize,\n expectedStatuses: [\"200\", \"201\"],\n },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}\":\n {\n deserializer: _$deleteDeserializeCloudHsmClusterPrivateEndpointConnections,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}\":\n { deserializer: _getDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backupOperationStatus/{jobId}\":\n {\n deserializer: _getDeserializeCloudHsmClusterBackupStatus,\n expectedStatuses: [\"200\", \"202\"],\n },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore\":\n { deserializer: _restoreDeserialize, expectedStatuses: [\"202\", \"200\"] },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties\":\n {\n deserializer: _validateRestorePropertiesDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup\":\n { deserializer: _backupDeserialize, expectedStatuses: [\"202\", \"200\"] },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties\":\n {\n deserializer: _validateBackupPropertiesDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _$deleteDeserializeCloudHsmClusters,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _updateDeserializeCloudHsmClusters,\n expectedStatuses: [\"200\", \"202\"],\n },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _createOrUpdateDeserializeCloudHsmClusters,\n expectedStatuses: [\"200\", \"201\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(p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qD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureDedicatedHSMResourceProvider } from \"./azureDedicatedHSMResourceProvider.js\";\nimport {\n _$deleteDeserialize,\n _updateDeserialize,\n _createOrUpdateDeserialize,\n} from \"./api/dedicatedHsm/operations.js\";\nimport { _$deleteDeserialize as _$deleteDeserializeCloudHsmClusterPrivateEndpointConnections } from \"./api/cloudHsmClusterPrivateEndpointConnections/operations.js\";\nimport { _getDeserialize } from \"./api/cloudHsmClusterRestoreStatus/operations.js\";\nimport { _getDeserialize as _getDeserializeCloudHsmClusterBackupStatus } from \"./api/cloudHsmClusterBackupStatus/operations.js\";\nimport {\n _restoreDeserialize,\n _validateRestorePropertiesDeserialize,\n _backupDeserialize,\n _validateBackupPropertiesDeserialize,\n _$deleteDeserialize as _$deleteDeserializeCloudHsmClusters,\n _updateDeserialize as _updateDeserializeCloudHsmClusters,\n _createOrUpdateDeserialize as _createOrUpdateDeserializeCloudHsmClusters,\n} from \"./api/cloudHsmClusters/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: AzureDedicatedHSMResourceProvider,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n {\n deserializer: _$deleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n { deserializer: _updateDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}\":\n {\n deserializer: _createOrUpdateDeserialize,\n expectedStatuses: [\"200\", \"201\"],\n },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}\":\n {\n deserializer: _$deleteDeserializeCloudHsmClusterPrivateEndpointConnections,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}\":\n { deserializer: _getDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backupOperationStatus/{jobId}\":\n {\n deserializer: _getDeserializeCloudHsmClusterBackupStatus,\n expectedStatuses: [\"200\", \"202\"],\n },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore\":\n { deserializer: _restoreDeserialize, expectedStatuses: [\"202\", \"200\"] },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties\":\n {\n deserializer: _validateRestorePropertiesDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup\":\n { deserializer: _backupDeserialize, expectedStatuses: [\"202\", \"200\"] },\n \"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties\":\n {\n deserializer: _validateBackupPropertiesDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _$deleteDeserializeCloudHsmClusters,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _updateDeserializeCloudHsmClusters,\n expectedStatuses: [\"200\", \"202\"],\n },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}\":\n {\n deserializer: _createOrUpdateDeserializeCloudHsmClusters,\n expectedStatuses: [\"200\", \"201\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
3
|
import { createRestError } from "@azure-rest/core-client";
|
|
5
4
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
6
5
|
/**
|
|
7
6
|
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
8
7
|
*/
|
|
9
8
|
export function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const nextLinkName = (_b = options.nextLinkName) !== null && _b !== void 0 ? _b : "nextLink";
|
|
9
|
+
const itemName = options.itemName ?? "value";
|
|
10
|
+
const nextLinkName = options.nextLinkName ?? "nextLink";
|
|
13
11
|
const pagedResult = {
|
|
14
12
|
getPage: async (pageLink) => {
|
|
15
13
|
const result = pageLink === undefined
|
|
@@ -25,7 +23,7 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
25
23
|
};
|
|
26
24
|
},
|
|
27
25
|
byPage: (settings) => {
|
|
28
|
-
const { continuationToken } = settings
|
|
26
|
+
const { continuationToken } = settings ?? {};
|
|
29
27
|
return getPageAsyncIterator(pagedResult, {
|
|
30
28
|
pageLink: continuationToken,
|
|
31
29
|
});
|
|
@@ -41,7 +39,6 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
41
39
|
* @returns a paged async iterator that iterates over results.
|
|
42
40
|
*/
|
|
43
41
|
function getPagedAsyncIterator(pagedResult) {
|
|
44
|
-
var _a;
|
|
45
42
|
const iter = getItemAsyncIterator(pagedResult);
|
|
46
43
|
return {
|
|
47
44
|
next() {
|
|
@@ -50,55 +47,39 @@ function getPagedAsyncIterator(pagedResult) {
|
|
|
50
47
|
[Symbol.asyncIterator]() {
|
|
51
48
|
return this;
|
|
52
49
|
},
|
|
53
|
-
byPage:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
byPage: pagedResult?.byPage ??
|
|
51
|
+
((settings) => {
|
|
52
|
+
const { continuationToken } = settings ?? {};
|
|
53
|
+
return getPageAsyncIterator(pagedResult, {
|
|
54
|
+
pageLink: continuationToken,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
|
-
function getItemAsyncIterator(pagedResult) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (var _d = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _d = true) {
|
|
67
|
-
_c = pages_1_1.value;
|
|
68
|
-
_d = false;
|
|
69
|
-
const page = _c;
|
|
70
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
|
-
finally {
|
|
75
|
-
try {
|
|
76
|
-
if (!_d && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
|
|
77
|
-
}
|
|
78
|
-
finally { if (e_1) throw e_1.error; }
|
|
79
|
-
}
|
|
80
|
-
});
|
|
59
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
60
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
61
|
+
for await (const page of pages) {
|
|
62
|
+
yield* page;
|
|
63
|
+
}
|
|
81
64
|
}
|
|
82
|
-
function getPageAsyncIterator(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
async function* getPageAsyncIterator(pagedResult, options = {}) {
|
|
66
|
+
const { pageLink } = options;
|
|
67
|
+
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
|
|
68
|
+
if (!response) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let result = response.page;
|
|
72
|
+
result.continuationToken = response.nextPageLink;
|
|
73
|
+
yield result;
|
|
74
|
+
while (response.nextPageLink) {
|
|
75
|
+
response = await pagedResult.getPage(response.nextPageLink);
|
|
86
76
|
if (!response) {
|
|
87
|
-
return
|
|
77
|
+
return;
|
|
88
78
|
}
|
|
89
|
-
|
|
79
|
+
result = response.page;
|
|
90
80
|
result.continuationToken = response.nextPageLink;
|
|
91
|
-
yield
|
|
92
|
-
|
|
93
|
-
response = yield __await(pagedResult.getPage(response.nextPageLink));
|
|
94
|
-
if (!response) {
|
|
95
|
-
return yield __await(void 0);
|
|
96
|
-
}
|
|
97
|
-
result = response.page;
|
|
98
|
-
result.continuationToken = response.nextPageLink;
|
|
99
|
-
yield yield __await(result);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
81
|
+
yield result;
|
|
82
|
+
}
|
|
102
83
|
}
|
|
103
84
|
/**
|
|
104
85
|
* Gets for the value of nextLink in the body
|
|
@@ -124,7 +105,7 @@ function getElements(body, itemName) {
|
|
|
124
105
|
if (!Array.isArray(value)) {
|
|
125
106
|
throw new RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
126
107
|
}
|
|
127
|
-
return value
|
|
108
|
+
return value ?? [];
|
|
128
109
|
}
|
|
129
110
|
/**
|
|
130
111
|
* Checks if a request failed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA+EtD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAMrC,MAAc,EACd,kBAAgD,EAChD,mBAAgE,EAChE,gBAA0B,EAC1B,UAA0C,EAAE;;IAE5C,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC;IAC7C,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,UAAU,CAAC;IACxD,MAAM,WAAW,GAAgD;QAC/D,OAAO,EAAE,KAAK,EAAE,QAAiB,EAAE,EAAE;YACnC,MAAM,MAAM,GACV,QAAQ,KAAK,SAAS;gBACpB,CAAC,CAAC,MAAM,kBAAkB,EAAE;gBAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;YACjD,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,MAAmB,CAAC,CAAC;YAC/D,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,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F,MAAM,IAAI,SAAS,CACjB,iBAAiB,YAAY,oDAAoD,OAAO,QAAQ,EAAE,CACnG,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA+EtD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAMrC,MAAc,EACd,kBAAgD,EAChD,mBAAgE,EAChE,gBAA0B,EAC1B,UAA0C,EAAE;IAE5C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;IAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,UAAU,CAAC;IACxD,MAAM,WAAW,GAAgD;Q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AAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACzF,MAAM,IAAI,SAAS,CACjB,iBAAiB,YAAY,oDAAoD,OAAO,QAAQ,EAAE,CACnG,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
|
|
@@ -18,23 +18,22 @@ export function getLongRunningPoller(client, processResponseBody, expectedStatus
|
|
|
18
18
|
return getLroResponse(initialResponse, expectedStatuses);
|
|
19
19
|
},
|
|
20
20
|
sendPollRequest: async (path, pollOptions) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f;
|
|
22
21
|
// The poll request would both listen to the user provided abort signal and the poller's own abort signal
|
|
23
22
|
function abortListener() {
|
|
24
23
|
pollAbortController.abort();
|
|
25
24
|
}
|
|
26
25
|
const abortSignal = pollAbortController.signal;
|
|
27
|
-
if (
|
|
26
|
+
if (options.abortSignal?.aborted) {
|
|
28
27
|
pollAbortController.abort();
|
|
29
28
|
}
|
|
30
|
-
else if (
|
|
29
|
+
else if (pollOptions?.abortSignal?.aborted) {
|
|
31
30
|
pollAbortController.abort();
|
|
32
31
|
}
|
|
33
32
|
else if (!abortSignal.aborted) {
|
|
34
|
-
|
|
33
|
+
options.abortSignal?.addEventListener("abort", abortListener, {
|
|
35
34
|
once: true,
|
|
36
35
|
});
|
|
37
|
-
|
|
36
|
+
pollOptions?.abortSignal?.addEventListener("abort", abortListener, {
|
|
38
37
|
once: true,
|
|
39
38
|
});
|
|
40
39
|
}
|
|
@@ -43,16 +42,16 @@ export function getLongRunningPoller(client, processResponseBody, expectedStatus
|
|
|
43
42
|
response = await client.pathUnchecked(path).get({ abortSignal });
|
|
44
43
|
}
|
|
45
44
|
finally {
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
options.abortSignal?.removeEventListener("abort", abortListener);
|
|
46
|
+
pollOptions?.abortSignal?.removeEventListener("abort", abortListener);
|
|
48
47
|
}
|
|
49
48
|
return getLroResponse(response, expectedStatuses);
|
|
50
49
|
},
|
|
51
50
|
};
|
|
52
51
|
return createHttpPoller(poller, {
|
|
53
|
-
intervalInMs: options
|
|
54
|
-
resourceLocationConfig: options
|
|
55
|
-
restoreFrom: options
|
|
52
|
+
intervalInMs: options?.updateIntervalInMs,
|
|
53
|
+
resourceLocationConfig: options?.resourceLocationConfig,
|
|
54
|
+
restoreFrom: options?.restoreFrom,
|
|
56
55
|
processResult: (result) => {
|
|
57
56
|
return processResponseBody(result);
|
|
58
57
|
},
|
|
@@ -70,7 +69,11 @@ function getLroResponse(response, expectedStatuses) {
|
|
|
70
69
|
}
|
|
71
70
|
return {
|
|
72
71
|
flatResponse: response,
|
|
73
|
-
rawResponse:
|
|
72
|
+
rawResponse: {
|
|
73
|
+
...response,
|
|
74
|
+
statusCode: Number.parseInt(response.status),
|
|
75
|
+
body: response.body,
|
|
76
|
+
},
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
79
|
//# sourceMappingURL=pollingHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pollingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAiC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA4BzF,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,mBAA4D,EAC5D,gBAA0B,EAC1B,OAA+C;IAE/C,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;IACpD,IAAI,CAAC,WAAW,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,IAAI,eAAe,GAA0B,SAAS,CAAC;IACvD,MAAM,mBAAmB,GAAG,IAAI,eAAe,EAAE,CAAC;IAClD,MAAM,MAAM,GAAgC;QAC1C,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;YACnF,CAAC;YACD,eAAe,GAAG,MAAM,kBAAkB,EAAE,CAAC;YAC7C,OAAO,cAAc,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAC3D,CAAC;QACD,eAAe,EAAE,KAAK,EACpB,IAAY,EACZ,WAEC,EACD,EAAE
|
|
1
|
+
{"version":3,"file":"pollingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pollingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAiC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA4BzF,MA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ed under the MIT License.\n\nimport {\n PollerLike,\n OperationState,\n ResourceLocationConfig,\n RunningOperation,\n createHttpPoller,\n OperationResponse,\n} from \"@azure/core-lro\";\n\nimport { Client, PathUncheckedResponse, createRestError } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\n\nexport interface GetLongRunningPollerOptions<TResponse> {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The potential location of the result of the LRO if specified by the LRO extension in the swagger.\n */\n resourceLocationConfig?: ResourceLocationConfig;\n /**\n * The original url of the LRO\n * Should not be null when restoreFrom is set\n */\n initialRequestUrl?: string;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n restoreFrom?: string;\n /**\n * The function to get the initial response\n */\n getInitialResponse?: () => PromiseLike<TResponse>;\n}\nexport function getLongRunningPoller<TResponse extends PathUncheckedResponse, TResult = void>(\n client: Client,\n processResponseBody: (result: TResponse) => Promise<TResult>,\n expectedStatuses: string[],\n options: GetLongRunningPollerOptions<TResponse>,\n): PollerLike<OperationState<TResult>, TResult> {\n const { restoreFrom, getInitialResponse } = options;\n if (!restoreFrom && !getInitialResponse) {\n throw new Error(\"Either restoreFrom or getInitialResponse must be specified\");\n }\n let initialResponse: TResponse | undefined = undefined;\n const pollAbortController = new AbortController();\n const poller: RunningOperation<TResponse> = {\n sendInitialRequest: async () => {\n if (!getInitialResponse) {\n throw new Error(\"getInitialResponse is required when initializing a new poller\");\n }\n initialResponse = await getInitialResponse();\n return getLroResponse(initialResponse, expectedStatuses);\n },\n sendPollRequest: async (\n path: string,\n pollOptions?: {\n abortSignal?: AbortSignalLike;\n },\n ) => {\n // The poll request would both listen to the user provided abort signal and the poller's own abort signal\n function abortListener(): void {\n pollAbortController.abort();\n }\n const abortSignal = pollAbortController.signal;\n if (options.abortSignal?.aborted) {\n pollAbortController.abort();\n } else if (pollOptions?.abortSignal?.aborted) {\n pollAbortController.abort();\n } else if (!abortSignal.aborted) {\n options.abortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n pollOptions?.abortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client.pathUnchecked(path).get({ abortSignal });\n } finally {\n options.abortSignal?.removeEventListener(\"abort\", abortListener);\n pollOptions?.abortSignal?.removeEventListener(\"abort\", abortListener);\n }\n\n return getLroResponse(response as TResponse, expectedStatuses);\n },\n };\n return createHttpPoller(poller, {\n intervalInMs: options?.updateIntervalInMs,\n resourceLocationConfig: options?.resourceLocationConfig,\n restoreFrom: options?.restoreFrom,\n processResult: (result: unknown) => {\n return processResponseBody(result as TResponse);\n },\n });\n}\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @param deserializeFn - deserialize function to convert Rest response to modular output\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResponse extends PathUncheckedResponse>(\n response: TResponse,\n expectedStatuses: string[],\n): OperationResponse<TResponse> {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(response);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// helpers
|
|
5
5
|
// ---------------------
|
|
6
6
|
function encodeComponent(val, reserved, op) {
|
|
7
|
-
return (reserved
|
|
7
|
+
return (reserved ?? op === "+") || op === "#"
|
|
8
8
|
? encodeReservedComponent(val)
|
|
9
9
|
: encodeRFC3986URIComponent(val);
|
|
10
10
|
}
|
|
@@ -157,7 +157,7 @@ export function expandUrlTemplate(template, context, option) {
|
|
|
157
157
|
varValue: context[varMatch[1]],
|
|
158
158
|
varName: varMatch[1],
|
|
159
159
|
modifier: varMatch[2] || varMatch[3],
|
|
160
|
-
reserved: option
|
|
160
|
+
reserved: option?.allowReserved,
|
|
161
161
|
});
|
|
162
162
|
if (varValue) {
|
|
163
163
|
result.push(varValue);
|