@azure/arm-cloudhealth 1.0.0-alpha.20250701.1 → 1.0.0-alpha.20250723.1
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/authenticationSettings/operations.js +34 -12
- package/dist/browser/api/authenticationSettings/operations.js.map +1 -1
- package/dist/browser/api/cloudHealthContext.js +12 -9
- package/dist/browser/api/cloudHealthContext.js.map +1 -1
- package/dist/browser/api/discoveryRules/operations.js +35 -13
- package/dist/browser/api/discoveryRules/operations.js.map +1 -1
- package/dist/browser/api/entities/operations.js +35 -13
- package/dist/browser/api/entities/operations.js.map +1 -1
- package/dist/browser/api/healthModels/operations.js +58 -24
- package/dist/browser/api/healthModels/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/relationships/operations.js +35 -13
- package/dist/browser/api/relationships/operations.js.map +1 -1
- package/dist/browser/api/signalDefinitions/operations.js +35 -13
- package/dist/browser/api/signalDefinitions/operations.js.map +1 -1
- package/dist/browser/classic/authenticationSettings/index.js +3 -1
- package/dist/browser/classic/authenticationSettings/index.js.map +1 -1
- package/dist/browser/classic/discoveryRules/index.js +3 -1
- package/dist/browser/classic/discoveryRules/index.js.map +1 -1
- package/dist/browser/classic/entities/index.js +3 -1
- package/dist/browser/classic/entities/index.js.map +1 -1
- package/dist/browser/classic/healthModels/index.js +3 -1
- package/dist/browser/classic/healthModels/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/relationships/index.js +3 -1
- package/dist/browser/classic/relationships/index.js.map +1 -1
- package/dist/browser/classic/signalDefinitions/index.js +3 -1
- package/dist/browser/classic/signalDefinitions/index.js.map +1 -1
- package/dist/browser/cloudHealthClient.js +22 -3
- package/dist/browser/cloudHealthClient.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/authenticationSettings/operations.js +34 -12
- package/dist/commonjs/api/authenticationSettings/operations.js.map +1 -1
- package/dist/commonjs/api/cloudHealthContext.js +12 -9
- package/dist/commonjs/api/cloudHealthContext.js.map +1 -1
- package/dist/commonjs/api/discoveryRules/operations.js +35 -13
- package/dist/commonjs/api/discoveryRules/operations.js.map +1 -1
- package/dist/commonjs/api/entities/operations.js +35 -13
- package/dist/commonjs/api/entities/operations.js.map +1 -1
- package/dist/commonjs/api/healthModels/operations.js +58 -24
- package/dist/commonjs/api/healthModels/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/relationships/operations.js +35 -13
- package/dist/commonjs/api/relationships/operations.js.map +1 -1
- package/dist/commonjs/api/signalDefinitions/operations.js +35 -13
- package/dist/commonjs/api/signalDefinitions/operations.js.map +1 -1
- package/dist/commonjs/classic/authenticationSettings/index.js +3 -1
- package/dist/commonjs/classic/authenticationSettings/index.js.map +1 -1
- package/dist/commonjs/classic/discoveryRules/index.js +3 -1
- package/dist/commonjs/classic/discoveryRules/index.js.map +1 -1
- package/dist/commonjs/classic/entities/index.js +3 -1
- package/dist/commonjs/classic/entities/index.js.map +1 -1
- package/dist/commonjs/classic/healthModels/index.js +3 -1
- package/dist/commonjs/classic/healthModels/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/relationships/index.js +3 -1
- package/dist/commonjs/classic/relationships/index.js.map +1 -1
- package/dist/commonjs/classic/signalDefinitions/index.js +3 -1
- package/dist/commonjs/classic/signalDefinitions/index.js.map +1 -1
- package/dist/commonjs/cloudHealthClient.js +22 -3
- package/dist/commonjs/cloudHealthClient.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/esm/api/authenticationSettings/operations.js +34 -12
- package/dist/esm/api/authenticationSettings/operations.js.map +1 -1
- package/dist/esm/api/cloudHealthContext.js +12 -9
- package/dist/esm/api/cloudHealthContext.js.map +1 -1
- package/dist/esm/api/discoveryRules/operations.js +35 -13
- package/dist/esm/api/discoveryRules/operations.js.map +1 -1
- package/dist/esm/api/entities/operations.js +35 -13
- package/dist/esm/api/entities/operations.js.map +1 -1
- package/dist/esm/api/healthModels/operations.js +58 -24
- package/dist/esm/api/healthModels/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/relationships/operations.js +35 -13
- package/dist/esm/api/relationships/operations.js.map +1 -1
- package/dist/esm/api/signalDefinitions/operations.js +35 -13
- package/dist/esm/api/signalDefinitions/operations.js.map +1 -1
- package/dist/esm/classic/authenticationSettings/index.js +3 -1
- package/dist/esm/classic/authenticationSettings/index.js.map +1 -1
- package/dist/esm/classic/discoveryRules/index.js +3 -1
- package/dist/esm/classic/discoveryRules/index.js.map +1 -1
- package/dist/esm/classic/entities/index.js +3 -1
- package/dist/esm/classic/entities/index.js.map +1 -1
- package/dist/esm/classic/healthModels/index.js +3 -1
- package/dist/esm/classic/healthModels/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/relationships/index.js +3 -1
- package/dist/esm/classic/relationships/index.js.map +1 -1
- package/dist/esm/classic/signalDefinitions/index.js +3 -1
- package/dist/esm/classic/signalDefinitions/index.js.map +1 -1
- package/dist/esm/cloudHealthClient.js +22 -3
- package/dist/esm/cloudHealthClient.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/authenticationSettings/operations.js +34 -12
- package/dist/react-native/api/authenticationSettings/operations.js.map +1 -1
- package/dist/react-native/api/cloudHealthContext.js +12 -9
- package/dist/react-native/api/cloudHealthContext.js.map +1 -1
- package/dist/react-native/api/discoveryRules/operations.js +35 -13
- package/dist/react-native/api/discoveryRules/operations.js.map +1 -1
- package/dist/react-native/api/entities/operations.js +35 -13
- package/dist/react-native/api/entities/operations.js.map +1 -1
- package/dist/react-native/api/healthModels/operations.js +58 -24
- package/dist/react-native/api/healthModels/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/relationships/operations.js +35 -13
- package/dist/react-native/api/relationships/operations.js.map +1 -1
- package/dist/react-native/api/signalDefinitions/operations.js +35 -13
- package/dist/react-native/api/signalDefinitions/operations.js.map +1 -1
- package/dist/react-native/classic/authenticationSettings/index.js +3 -1
- package/dist/react-native/classic/authenticationSettings/index.js.map +1 -1
- package/dist/react-native/classic/discoveryRules/index.js +3 -1
- package/dist/react-native/classic/discoveryRules/index.js.map +1 -1
- package/dist/react-native/classic/entities/index.js +3 -1
- package/dist/react-native/classic/entities/index.js.map +1 -1
- package/dist/react-native/classic/healthModels/index.js +3 -1
- package/dist/react-native/classic/healthModels/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/relationships/index.js +3 -1
- package/dist/react-native/classic/relationships/index.js.map +1 -1
- package/dist/react-native/classic/signalDefinitions/index.js +3 -1
- package/dist/react-native/classic/signalDefinitions/index.js.map +1 -1
- package/dist/react-native/cloudHealthClient.js +22 -3
- package/dist/react-native/cloudHealthClient.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-cloudhealth-api-authenticationSettings.api.md → arm-cloudhealth-api-authenticationSettings-node.api.md} +40 -40
- package/review/{arm-cloudhealth-api-discoveryRules.api.md → arm-cloudhealth-api-discoveryRules-node.api.md} +41 -41
- package/review/{arm-cloudhealth-api-entities.api.md → arm-cloudhealth-api-entities-node.api.md} +41 -41
- package/review/{arm-cloudhealth-api-healthModels.api.md → arm-cloudhealth-api-healthModels-node.api.md} +59 -59
- package/review/{arm-cloudhealth-api.api.md → arm-cloudhealth-api-node.api.md} +27 -27
- package/review/{arm-cloudhealth-api-operations.api.md → arm-cloudhealth-api-operations-node.api.md} +19 -19
- package/review/{arm-cloudhealth-api-relationships.api.md → arm-cloudhealth-api-relationships-node.api.md} +41 -41
- package/review/{arm-cloudhealth-api-signalDefinitions.api.md → arm-cloudhealth-api-signalDefinitions-node.api.md} +41 -41
- package/review/{arm-cloudhealth-models.api.md → arm-cloudhealth-models-node.api.md} +535 -535
- package/review/{arm-cloudhealth.api.md → arm-cloudhealth-node.api.md} +759 -759
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/entities/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA+ElC,wDAIC;AAzED,oEAAmG;AAwCnG,SAAS,YAAY,CAAC,OAA2B;IAC/C,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAAiD,EACjD,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,OAAsC,EACtC,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;QAC9E,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,QAAgB,EAChB,OAA8C,EAC9C,EAAE,CAAC,IAAA,8BAAc,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC/F,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,OAAmC,EACnC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAA2B;IAChE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/entities/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA+ElC,wDAIC;AAzED,oEAAmG;AAwCnG,SAAS,YAAY,CAAC,OAA2B;IAC/C,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAAiD,EACjD,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,OAAsC,EACtC,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;QAC9E,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,QAAgB,EAChB,OAA8C,EAC9C,EAAE,CAAC,IAAA,8BAAc,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC/F,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,UAAkB,EAClB,OAAmC,EACnC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAA2B;IAChE,OAAO;QACL,GAAG,YAAY,CAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CloudHealthContext } from \"../../api/cloudHealthContext.js\";\nimport { Entity } from \"../../models/models.js\";\nimport {\n EntitiesListByHealthModelOptionalParams,\n EntitiesDeleteOptionalParams,\n EntitiesCreateOrUpdateOptionalParams,\n EntitiesGetOptionalParams,\n} from \"../../api/entities/options.js\";\nimport { listByHealthModel, $delete, createOrUpdate, get } from \"../../api/entities/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Entities operations. */\nexport interface EntitiesOperations {\n /** List Entity resources by HealthModel */\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: EntitiesListByHealthModelOptionalParams,\n ) => PagedAsyncIterableIterator<Entity>;\n /** Delete a Entity */\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 healthModelName: string,\n entityName: string,\n options?: EntitiesDeleteOptionalParams,\n ) => Promise<void>;\n /** Create a Entity */\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n entityName: string,\n resource: Entity,\n options?: EntitiesCreateOrUpdateOptionalParams,\n ) => Promise<Entity>;\n /** Get a Entity */\n get: (\n resourceGroupName: string,\n healthModelName: string,\n entityName: string,\n options?: EntitiesGetOptionalParams,\n ) => Promise<Entity>;\n}\n\nfunction _getEntities(context: CloudHealthContext) {\n return {\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: EntitiesListByHealthModelOptionalParams,\n ) => listByHealthModel(context, resourceGroupName, healthModelName, options),\n delete: (\n resourceGroupName: string,\n healthModelName: string,\n entityName: string,\n options?: EntitiesDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, healthModelName, entityName, options),\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n entityName: string,\n resource: Entity,\n options?: EntitiesCreateOrUpdateOptionalParams,\n ) => createOrUpdate(context, resourceGroupName, healthModelName, entityName, resource, options),\n get: (\n resourceGroupName: string,\n healthModelName: string,\n entityName: string,\n options?: EntitiesGetOptionalParams,\n ) => get(context, resourceGroupName, healthModelName, entityName, options),\n };\n}\n\nexport function _getEntitiesOperations(context: CloudHealthContext): EntitiesOperations {\n return {\n ..._getEntities(context),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/healthModels/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoGlC,gEAIC;AA5FD,wEAO8C;AAgD9C,SAAS,gBAAgB,CAAC,OAA2B;IACnD,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAsD,EAAE,EAAE,CAC7E,IAAA,kCAAkB,EAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAuD,EACvD,EAAE,CAAC,IAAA,mCAAmB,EAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,OAA0C,EAC1C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAClE,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,UAA6B,EAC7B,OAA0C,EAC1C,EAAE,CAAC,IAAA,sBAAM,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;QAC7E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,QAAqB,EACrB,OAA0C,EAC1C,EAAE,CAAC,IAAA,sBAAM,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC3E,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,OAAuC,EACvC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,OAA2B;IACpE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/healthModels/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoGlC,gEAIC;AA5FD,wEAO8C;AAgD9C,SAAS,gBAAgB,CAAC,OAA2B;IACnD,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAsD,EAAE,EAAE,CAC7E,IAAA,kCAAkB,EAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAuD,EACvD,EAAE,CAAC,IAAA,mCAAmB,EAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,OAA0C,EAC1C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAClE,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,UAA6B,EAC7B,OAA0C,EAC1C,EAAE,CAAC,IAAA,sBAAM,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC;QAC7E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,QAAqB,EACrB,OAA0C,EAC1C,EAAE,CAAC,IAAA,sBAAM,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC3E,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,OAAuC,EACvC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,OAA2B;IACpE,OAAO;QACL,GAAG,gBAAgB,CAAC,OAAO,CAAC;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CloudHealthContext } from \"../../api/cloudHealthContext.js\";\nimport { HealthModel, HealthModelUpdate } from \"../../models/models.js\";\nimport {\n HealthModelsListBySubscriptionOptionalParams,\n HealthModelsListByResourceGroupOptionalParams,\n HealthModelsDeleteOptionalParams,\n HealthModelsUpdateOptionalParams,\n HealthModelsCreateOptionalParams,\n HealthModelsGetOptionalParams,\n} from \"../../api/healthModels/options.js\";\nimport {\n listBySubscription,\n listByResourceGroup,\n $delete,\n update,\n create,\n get,\n} from \"../../api/healthModels/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a HealthModels operations. */\nexport interface HealthModelsOperations {\n /** List HealthModel resources by subscription ID */\n listBySubscription: (\n options?: HealthModelsListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<HealthModel>;\n /** List HealthModel resources by resource group */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: HealthModelsListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<HealthModel>;\n /** Delete a HealthModel */\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 healthModelName: string,\n options?: HealthModelsDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** Update a HealthModel */\n update: (\n resourceGroupName: string,\n healthModelName: string,\n properties: HealthModelUpdate,\n options?: HealthModelsUpdateOptionalParams,\n ) => PollerLike<OperationState<HealthModel>, HealthModel>;\n /** Create a HealthModel */\n create: (\n resourceGroupName: string,\n healthModelName: string,\n resource: HealthModel,\n options?: HealthModelsCreateOptionalParams,\n ) => PollerLike<OperationState<HealthModel>, HealthModel>;\n /** Get a HealthModel */\n get: (\n resourceGroupName: string,\n healthModelName: string,\n options?: HealthModelsGetOptionalParams,\n ) => Promise<HealthModel>;\n}\n\nfunction _getHealthModels(context: CloudHealthContext) {\n return {\n listBySubscription: (options?: HealthModelsListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: HealthModelsListByResourceGroupOptionalParams,\n ) => listByResourceGroup(context, resourceGroupName, options),\n delete: (\n resourceGroupName: string,\n healthModelName: string,\n options?: HealthModelsDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, healthModelName, options),\n update: (\n resourceGroupName: string,\n healthModelName: string,\n properties: HealthModelUpdate,\n options?: HealthModelsUpdateOptionalParams,\n ) => update(context, resourceGroupName, healthModelName, properties, options),\n create: (\n resourceGroupName: string,\n healthModelName: string,\n resource: HealthModel,\n options?: HealthModelsCreateOptionalParams,\n ) => create(context, resourceGroupName, healthModelName, resource, options),\n get: (\n resourceGroupName: string,\n healthModelName: string,\n options?: HealthModelsGetOptionalParams,\n ) => get(context, resourceGroupName, healthModelName, options),\n };\n}\n\nexport function _getHealthModelsOperations(context: CloudHealthContext): HealthModelsOperations {\n return {\n ..._getHealthModels(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;;AAoBlC,4DAIC;AAnBD,sEAA0D;AAS1D,SAAS,cAAc,CAAC,OAA2B;IACjD,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAA,oBAAI,EAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAA2B;IAClE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,4DAIC;AAnBD,sEAA0D;AAS1D,SAAS,cAAc,CAAC,OAA2B;IACjD,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAA,oBAAI,EAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAA2B;IAClE,OAAO;QACL,GAAG,cAAc,CAAC,OAAO,CAAC;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CloudHealthContext } from \"../../api/cloudHealthContext.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: CloudHealthContext) {\n return {\n list: (options?: OperationsListOptionalParams) => list(context, options),\n };\n}\n\nexport function _getOperationsOperations(context: CloudHealthContext): OperationsOperations {\n return {\n ..._getOperations(context),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/relationships/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4FlC,kEAIC;AAtFD,yEAK+C;AAwC/C,SAAS,iBAAiB,CAAC,OAA2B;IACpD,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAAsD,EACtD,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,OAA2C,EAC3C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,CAAC;QACpF,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,QAAsB,EACtB,OAAmD,EACnD,EAAE,CACF,IAAA,8BAAc,EACZ,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,OAAO,CACR;QACH,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,OAAwC,EACxC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,CAAC;KACjF,CAAC;AACJ,CAAC;AAED,SAAgB,2BAA2B,CAAC,OAA2B;IACrE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/relationships/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4FlC,kEAIC;AAtFD,yEAK+C;AAwC/C,SAAS,iBAAiB,CAAC,OAA2B;IACpD,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAAsD,EACtD,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,OAA2C,EAC3C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,CAAC;QACpF,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,QAAsB,EACtB,OAAmD,EACnD,EAAE,CACF,IAAA,8BAAc,EACZ,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,OAAO,CACR;QACH,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,gBAAwB,EACxB,OAAwC,EACxC,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,CAAC;KACjF,CAAC;AACJ,CAAC;AAED,SAAgB,2BAA2B,CAAC,OAA2B;IACrE,OAAO;QACL,GAAG,iBAAiB,CAAC,OAAO,CAAC;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CloudHealthContext } from \"../../api/cloudHealthContext.js\";\nimport { Relationship } from \"../../models/models.js\";\nimport {\n RelationshipsListByHealthModelOptionalParams,\n RelationshipsDeleteOptionalParams,\n RelationshipsCreateOrUpdateOptionalParams,\n RelationshipsGetOptionalParams,\n} from \"../../api/relationships/options.js\";\nimport {\n listByHealthModel,\n $delete,\n createOrUpdate,\n get,\n} from \"../../api/relationships/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Relationships operations. */\nexport interface RelationshipsOperations {\n /** List Relationship resources by HealthModel */\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: RelationshipsListByHealthModelOptionalParams,\n ) => PagedAsyncIterableIterator<Relationship>;\n /** Delete a Relationship */\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 healthModelName: string,\n relationshipName: string,\n options?: RelationshipsDeleteOptionalParams,\n ) => Promise<void>;\n /** Create a Relationship */\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n relationshipName: string,\n resource: Relationship,\n options?: RelationshipsCreateOrUpdateOptionalParams,\n ) => Promise<Relationship>;\n /** Get a Relationship */\n get: (\n resourceGroupName: string,\n healthModelName: string,\n relationshipName: string,\n options?: RelationshipsGetOptionalParams,\n ) => Promise<Relationship>;\n}\n\nfunction _getRelationships(context: CloudHealthContext) {\n return {\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: RelationshipsListByHealthModelOptionalParams,\n ) => listByHealthModel(context, resourceGroupName, healthModelName, options),\n delete: (\n resourceGroupName: string,\n healthModelName: string,\n relationshipName: string,\n options?: RelationshipsDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, healthModelName, relationshipName, options),\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n relationshipName: string,\n resource: Relationship,\n options?: RelationshipsCreateOrUpdateOptionalParams,\n ) =>\n createOrUpdate(\n context,\n resourceGroupName,\n healthModelName,\n relationshipName,\n resource,\n options,\n ),\n get: (\n resourceGroupName: string,\n healthModelName: string,\n relationshipName: string,\n options?: RelationshipsGetOptionalParams,\n ) => get(context, resourceGroupName, healthModelName, relationshipName, options),\n };\n}\n\nexport function _getRelationshipsOperations(context: CloudHealthContext): RelationshipsOperations {\n return {\n ..._getRelationships(context),\n };\n}\n"]}
|
|
@@ -13,6 +13,8 @@ function _getSignalDefinitions(context) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
function _getSignalDefinitionsOperations(context) {
|
|
16
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
..._getSignalDefinitions(context),
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/signalDefinitions/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4FlC,0EAMC;AAxFD,6EAKmD;AAwCnD,SAAS,qBAAqB,CAAC,OAA2B;IACxD,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAA0D,EAC1D,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,OAA+C,EAC/C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,CAAC;QACxF,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,QAA0B,EAC1B,OAAuD,EACvD,EAAE,CACF,IAAA,8BAAc,EACZ,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,OAAO,CACR;QACH,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,OAA4C,EAC5C,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,CAAC;KACrF,CAAC;AACJ,CAAC;AAED,SAAgB,+BAA+B,CAC7C,OAA2B;IAE3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/signalDefinitions/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4FlC,0EAMC;AAxFD,6EAKmD;AAwCnD,SAAS,qBAAqB,CAAC,OAA2B;IACxD,OAAO;QACL,iBAAiB,EAAE,CACjB,iBAAyB,EACzB,eAAuB,EACvB,OAA0D,EAC1D,EAAE,CAAC,IAAA,iCAAiB,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,OAA+C,EAC/C,EAAE,CAAC,IAAA,uBAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,CAAC;QACxF,cAAc,EAAE,CACd,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,QAA0B,EAC1B,OAAuD,EACvD,EAAE,CACF,IAAA,8BAAc,EACZ,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,OAAO,CACR;QACH,GAAG,EAAE,CACH,iBAAyB,EACzB,eAAuB,EACvB,oBAA4B,EAC5B,OAA4C,EAC5C,EAAE,CAAC,IAAA,mBAAG,EAAC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,CAAC;KACrF,CAAC;AACJ,CAAC;AAED,SAAgB,+BAA+B,CAC7C,OAA2B;IAE3B,OAAO;QACL,GAAG,qBAAqB,CAAC,OAAO,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CloudHealthContext } from \"../../api/cloudHealthContext.js\";\nimport { SignalDefinition } from \"../../models/models.js\";\nimport {\n SignalDefinitionsListByHealthModelOptionalParams,\n SignalDefinitionsDeleteOptionalParams,\n SignalDefinitionsCreateOrUpdateOptionalParams,\n SignalDefinitionsGetOptionalParams,\n} from \"../../api/signalDefinitions/options.js\";\nimport {\n listByHealthModel,\n $delete,\n createOrUpdate,\n get,\n} from \"../../api/signalDefinitions/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a SignalDefinitions operations. */\nexport interface SignalDefinitionsOperations {\n /** List SignalDefinition resources by HealthModel */\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: SignalDefinitionsListByHealthModelOptionalParams,\n ) => PagedAsyncIterableIterator<SignalDefinition>;\n /** Delete a SignalDefinition */\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 healthModelName: string,\n signalDefinitionName: string,\n options?: SignalDefinitionsDeleteOptionalParams,\n ) => Promise<void>;\n /** Create a SignalDefinition */\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n signalDefinitionName: string,\n resource: SignalDefinition,\n options?: SignalDefinitionsCreateOrUpdateOptionalParams,\n ) => Promise<SignalDefinition>;\n /** Get a SignalDefinition */\n get: (\n resourceGroupName: string,\n healthModelName: string,\n signalDefinitionName: string,\n options?: SignalDefinitionsGetOptionalParams,\n ) => Promise<SignalDefinition>;\n}\n\nfunction _getSignalDefinitions(context: CloudHealthContext) {\n return {\n listByHealthModel: (\n resourceGroupName: string,\n healthModelName: string,\n options?: SignalDefinitionsListByHealthModelOptionalParams,\n ) => listByHealthModel(context, resourceGroupName, healthModelName, options),\n delete: (\n resourceGroupName: string,\n healthModelName: string,\n signalDefinitionName: string,\n options?: SignalDefinitionsDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, healthModelName, signalDefinitionName, options),\n createOrUpdate: (\n resourceGroupName: string,\n healthModelName: string,\n signalDefinitionName: string,\n resource: SignalDefinition,\n options?: SignalDefinitionsCreateOrUpdateOptionalParams,\n ) =>\n createOrUpdate(\n context,\n resourceGroupName,\n healthModelName,\n signalDefinitionName,\n resource,\n options,\n ),\n get: (\n resourceGroupName: string,\n healthModelName: string,\n signalDefinitionName: string,\n options?: SignalDefinitionsGetOptionalParams,\n ) => get(context, resourceGroupName, healthModelName, signalDefinitionName, options),\n };\n}\n\nexport function _getSignalDefinitionsOperations(\n context: CloudHealthContext,\n): SignalDefinitionsOperations {\n return {\n ..._getSignalDefinitions(context),\n };\n}\n"]}
|
|
@@ -12,13 +12,18 @@ const index_js_6 = require("./classic/signalDefinitions/index.js");
|
|
|
12
12
|
const index_js_7 = require("./classic/healthModels/index.js");
|
|
13
13
|
const index_js_8 = require("./classic/operations/index.js");
|
|
14
14
|
class CloudHealthClient {
|
|
15
|
+
_client;
|
|
16
|
+
/** The pipeline used by this client to make requests */
|
|
17
|
+
pipeline;
|
|
15
18
|
constructor(credential, subscriptionId, options = {}) {
|
|
16
|
-
|
|
17
|
-
const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
|
|
19
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
18
20
|
const userAgentPrefix = prefixFromOptions
|
|
19
21
|
? `${prefixFromOptions} azsdk-js-client`
|
|
20
22
|
: `azsdk-js-client`;
|
|
21
|
-
this._client = (0, index_js_1.createCloudHealth)(credential, subscriptionId,
|
|
23
|
+
this._client = (0, index_js_1.createCloudHealth)(credential, subscriptionId, {
|
|
24
|
+
...options,
|
|
25
|
+
userAgentOptions: { userAgentPrefix },
|
|
26
|
+
});
|
|
22
27
|
this.pipeline = this._client.pipeline;
|
|
23
28
|
this.discoveryRules = (0, index_js_2._getDiscoveryRulesOperations)(this._client);
|
|
24
29
|
this.relationships = (0, index_js_3._getRelationshipsOperations)(this._client);
|
|
@@ -28,6 +33,20 @@ class CloudHealthClient {
|
|
|
28
33
|
this.healthModels = (0, index_js_7._getHealthModelsOperations)(this._client);
|
|
29
34
|
this.operations = (0, index_js_8._getOperationsOperations)(this._client);
|
|
30
35
|
}
|
|
36
|
+
/** The operation groups for discoveryRules */
|
|
37
|
+
discoveryRules;
|
|
38
|
+
/** The operation groups for relationships */
|
|
39
|
+
relationships;
|
|
40
|
+
/** The operation groups for entities */
|
|
41
|
+
entities;
|
|
42
|
+
/** The operation groups for authenticationSettings */
|
|
43
|
+
authenticationSettings;
|
|
44
|
+
/** The operation groups for signalDefinitions */
|
|
45
|
+
signalDefinitions;
|
|
46
|
+
/** The operation groups for healthModels */
|
|
47
|
+
healthModels;
|
|
48
|
+
/** The operation groups for operations */
|
|
49
|
+
operations;
|
|
31
50
|
}
|
|
32
51
|
exports.CloudHealthClient = CloudHealthClient;
|
|
33
52
|
//# sourceMappingURL=cloudHealthClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudHealthClient.js","sourceRoot":"","sources":["../../src/cloudHealthClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,6CAIwB;AACxB,gEAG2C;AAC3C,+DAG0C;AAC1C,0DAAyF;AACzF,wEAGmD;AACnD,mEAG8C;AAC9C,8DAGyC;AACzC,4DAA+F;AAM/F,MAAa,iBAAiB;
|
|
1
|
+
{"version":3,"file":"cloudHealthClient.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U,GAAG,IAAA,mCAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,8CAA8C;IAC9B,cAAc,CAA2B;IACzD,6CAA6C;IAC7B,aAAa,CAA0B;IACvD,wCAAwC;IACxB,QAAQ,CAAqB;IAC7C,sDAAsD;IACtC,sBAAsB,CAAmC;IACzE,iDAAiD;IACjC,iBAAiB,CAA8B;IAC/D,4CAA4C;IAC5B,YAAY,CAAyB;IACrD,0CAA0C;IAC1B,UAAU,CAAuB;CAClD;AA1CD,8CA0CC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n createCloudHealth,\n CloudHealthContext,\n CloudHealthClientOptionalParams,\n} from \"./api/index.js\";\nimport {\n DiscoveryRulesOperations,\n _getDiscoveryRulesOperations,\n} from \"./classic/discoveryRules/index.js\";\nimport {\n RelationshipsOperations,\n _getRelationshipsOperations,\n} from \"./classic/relationships/index.js\";\nimport { EntitiesOperations, _getEntitiesOperations } from \"./classic/entities/index.js\";\nimport {\n AuthenticationSettingsOperations,\n _getAuthenticationSettingsOperations,\n} from \"./classic/authenticationSettings/index.js\";\nimport {\n SignalDefinitionsOperations,\n _getSignalDefinitionsOperations,\n} from \"./classic/signalDefinitions/index.js\";\nimport {\n HealthModelsOperations,\n _getHealthModelsOperations,\n} from \"./classic/healthModels/index.js\";\nimport { OperationsOperations, _getOperationsOperations } from \"./classic/operations/index.js\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport { CloudHealthClientOptionalParams } from \"./api/cloudHealthContext.js\";\n\nexport class CloudHealthClient {\n private _client: CloudHealthContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n constructor(\n credential: TokenCredential,\n subscriptionId: string,\n options: CloudHealthClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createCloudHealth(credential, subscriptionId, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.discoveryRules = _getDiscoveryRulesOperations(this._client);\n this.relationships = _getRelationshipsOperations(this._client);\n this.entities = _getEntitiesOperations(this._client);\n this.authenticationSettings = _getAuthenticationSettingsOperations(this._client);\n this.signalDefinitions = _getSignalDefinitionsOperations(this._client);\n this.healthModels = _getHealthModelsOperations(this._client);\n this.operations = _getOperationsOperations(this._client);\n }\n\n /** The operation groups for discoveryRules */\n public readonly discoveryRules: DiscoveryRulesOperations;\n /** The operation groups for relationships */\n public readonly relationships: RelationshipsOperations;\n /** The operation groups for entities */\n public readonly entities: EntitiesOperations;\n /** The operation groups for authenticationSettings */\n public readonly authenticationSettings: AuthenticationSettingsOperations;\n /** The operation groups for signalDefinitions */\n public readonly signalDefinitions: SignalDefinitionsOperations;\n /** The operation groups for healthModels */\n public readonly healthModels: HealthModelsOperations;\n /** The operation groups for operations */\n public readonly operations: OperationsOperations;\n}\n"]}
|
|
@@ -12,21 +12,20 @@ const core_lro_1 = require("@azure/core-lro");
|
|
|
12
12
|
* needs to be constructed after the original one is not in scope.
|
|
13
13
|
*/
|
|
14
14
|
function restorePoller(client, serializedState, sourceOperation, options) {
|
|
15
|
-
var _a, _b, _c;
|
|
16
15
|
const pollerConfig = (0, core_lro_1.deserializeState)(serializedState).config;
|
|
17
16
|
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
18
17
|
if (!initialRequestUrl || !requestMethod) {
|
|
19
|
-
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation
|
|
18
|
+
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
|
|
20
19
|
}
|
|
21
|
-
const resourceLocationConfig = metadata
|
|
22
|
-
const { deserializer, expectedStatuses = [] } =
|
|
23
|
-
const deserializeHelper =
|
|
20
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
21
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
22
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
24
23
|
if (!deserializeHelper) {
|
|
25
|
-
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation
|
|
24
|
+
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
26
25
|
}
|
|
27
|
-
return (0, pollingHelpers_js_1.getLongRunningPoller)(
|
|
28
|
-
updateIntervalInMs: options
|
|
29
|
-
abortSignal: options
|
|
26
|
+
return (0, pollingHelpers_js_1.getLongRunningPoller)(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
27
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
28
|
+
abortSignal: options?.abortSignal,
|
|
30
29
|
resourceLocationConfig,
|
|
31
30
|
restoreFrom: serializedState,
|
|
32
31
|
initialRequestUrl,
|
|
@@ -41,7 +40,6 @@ const deserializeMap = {
|
|
|
41
40
|
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CloudHealth/healthmodels/{healthModelName}": { deserializer: operations_js_1._createDeserialize, expectedStatuses: ["200", "201"] },
|
|
42
41
|
};
|
|
43
42
|
function getDeserializationHelper(urlStr, method) {
|
|
44
|
-
var _a, _b, _c, _d;
|
|
45
43
|
const path = new URL(urlStr).pathname;
|
|
46
44
|
const pathParts = path.split("/");
|
|
47
45
|
// Traverse list to match the longest candidate
|
|
@@ -61,13 +59,13 @@ function getDeserializationHelper(urlStr, method) {
|
|
|
61
59
|
// track if we have found a match to return the values found.
|
|
62
60
|
let found = true;
|
|
63
61
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
64
|
-
if (
|
|
65
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
62
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
63
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
66
64
|
// If the current part of the candidate is a "template" part
|
|
67
65
|
// Try to use the suffix of pattern to match the path
|
|
68
66
|
// {guid} ==> $
|
|
69
67
|
// {guid}:export ==> :export$
|
|
70
|
-
const isMatched = new RegExp(`${
|
|
68
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
71
69
|
if (!isMatched) {
|
|
72
70
|
found = false;
|
|
73
71
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqClC,sCAoCC;AAtED,oEAI0C;AAC1C,0EAA0E;AAG1E,8CAKyB;AAgBzB;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,MAAyB,EACzB,eAAuB,EACvB,eAAiF,EACjF,OAAuC
|
|
1
|
+
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqClC,sCAoCC;AAtED,oEAI0C;AAC1C,0EAA0E;AAG1E,8CAKyB;AAgBzB;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,MAAyB,EACzB,eAAuB,EACvB,eAAiF,EACjF,OAAuC;IAEvC,MAAM,YAAY,GAAG,IAAA,2BAAgB,EAAC,eAAe,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;IACpE,IAAI,CAAC,iBAAiB,IAAI,CAAC,aAAa,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,6BAA6B,eAAe,wBAAwB,eAAe,EAAE,IAAI,EAAE,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AS,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 { CloudHealthClient } from \"./cloudHealthClient.js\";\nimport {\n _$deleteDeserialize,\n _updateDeserialize,\n _createDeserialize,\n} from \"./api/healthModels/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: CloudHealthClient,\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.CloudHealth/healthmodels/{healthModelName}\":\n {\n deserializer: _$deleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CloudHealth/healthmodels/{healthModelName}\":\n { deserializer: _updateDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CloudHealth/healthmodels/{healthModelName}\":\n { deserializer: _createDeserialize, expectedStatuses: [\"200\", \"201\"] },\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"]}
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.buildPagedAsyncIterator = buildPagedAsyncIterator;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
6
|
const core_client_1 = require("@azure-rest/core-client");
|
|
8
7
|
const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
|
9
8
|
/**
|
|
10
9
|
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
11
10
|
*/
|
|
12
11
|
function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const nextLinkName = (_b = options.nextLinkName) !== null && _b !== void 0 ? _b : "nextLink";
|
|
12
|
+
const itemName = options.itemName ?? "value";
|
|
13
|
+
const nextLinkName = options.nextLinkName ?? "nextLink";
|
|
16
14
|
const pagedResult = {
|
|
17
15
|
getPage: async (pageLink) => {
|
|
18
16
|
const result = pageLink === undefined
|
|
@@ -28,7 +26,7 @@ function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody
|
|
|
28
26
|
};
|
|
29
27
|
},
|
|
30
28
|
byPage: (settings) => {
|
|
31
|
-
const { continuationToken } = settings
|
|
29
|
+
const { continuationToken } = settings ?? {};
|
|
32
30
|
return getPageAsyncIterator(pagedResult, {
|
|
33
31
|
pageLink: continuationToken,
|
|
34
32
|
});
|
|
@@ -44,7 +42,6 @@ function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody
|
|
|
44
42
|
* @returns a paged async iterator that iterates over results.
|
|
45
43
|
*/
|
|
46
44
|
function getPagedAsyncIterator(pagedResult) {
|
|
47
|
-
var _a;
|
|
48
45
|
const iter = getItemAsyncIterator(pagedResult);
|
|
49
46
|
return {
|
|
50
47
|
next() {
|
|
@@ -53,55 +50,39 @@ function getPagedAsyncIterator(pagedResult) {
|
|
|
53
50
|
[Symbol.asyncIterator]() {
|
|
54
51
|
return this;
|
|
55
52
|
},
|
|
56
|
-
byPage:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
byPage: pagedResult?.byPage ??
|
|
54
|
+
((settings) => {
|
|
55
|
+
const { continuationToken } = settings ?? {};
|
|
56
|
+
return getPageAsyncIterator(pagedResult, {
|
|
57
|
+
pageLink: continuationToken,
|
|
58
|
+
});
|
|
59
|
+
}),
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
function getItemAsyncIterator(pagedResult) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
for (var _d = true, pages_1 = tslib_1.__asyncValues(pages), pages_1_1; pages_1_1 = yield tslib_1.__await(pages_1.next()), _a = pages_1_1.done, !_a; _d = true) {
|
|
70
|
-
_c = pages_1_1.value;
|
|
71
|
-
_d = false;
|
|
72
|
-
const page = _c;
|
|
73
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
77
|
-
finally {
|
|
78
|
-
try {
|
|
79
|
-
if (!_d && !_a && (_b = pages_1.return)) yield tslib_1.__await(_b.call(pages_1));
|
|
80
|
-
}
|
|
81
|
-
finally { if (e_1) throw e_1.error; }
|
|
82
|
-
}
|
|
83
|
-
});
|
|
62
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
63
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
64
|
+
for await (const page of pages) {
|
|
65
|
+
yield* page;
|
|
66
|
+
}
|
|
84
67
|
}
|
|
85
|
-
function getPageAsyncIterator(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
async function* getPageAsyncIterator(pagedResult, options = {}) {
|
|
69
|
+
const { pageLink } = options;
|
|
70
|
+
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
|
|
71
|
+
if (!response) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let result = response.page;
|
|
75
|
+
result.continuationToken = response.nextPageLink;
|
|
76
|
+
yield result;
|
|
77
|
+
while (response.nextPageLink) {
|
|
78
|
+
response = await pagedResult.getPage(response.nextPageLink);
|
|
89
79
|
if (!response) {
|
|
90
|
-
return
|
|
80
|
+
return;
|
|
91
81
|
}
|
|
92
|
-
|
|
82
|
+
result = response.page;
|
|
93
83
|
result.continuationToken = response.nextPageLink;
|
|
94
|
-
yield
|
|
95
|
-
|
|
96
|
-
response = yield tslib_1.__await(pagedResult.getPage(response.nextPageLink));
|
|
97
|
-
if (!response) {
|
|
98
|
-
return yield tslib_1.__await(void 0);
|
|
99
|
-
}
|
|
100
|
-
result = response.page;
|
|
101
|
-
result.continuationToken = response.nextPageLink;
|
|
102
|
-
yield yield tslib_1.__await(result);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
84
|
+
yield result;
|
|
85
|
+
}
|
|
105
86
|
}
|
|
106
87
|
/**
|
|
107
88
|
* Gets for the value of nextLink in the body
|
|
@@ -127,7 +108,7 @@ function getElements(body, itemName) {
|
|
|
127
108
|
if (!Array.isArray(value)) {
|
|
128
109
|
throw new core_rest_pipeline_1.RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
129
110
|
}
|
|
130
|
-
return value
|
|
111
|
+
return value ?? [];
|
|
131
112
|
}
|
|
132
113
|
/**
|
|
133
114
|
* 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;;AAqFlC,0DAqCC;;AAxHD,yDAAyF;AACzF,kEAAsD;AA+EtD;;GAEG;AACH,SAAgB,uBAA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A0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,IAAA,6BAAe,EACnB,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;;AAqFlC,0DAqCC;AAxHD,yDAAyF;AACzF,kEAAsD;AA+EtD;;GAEG;AACH,SAAgB,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;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,YAAY,CAAC,CAAC;YACpD,MAAM,MAAM,GAAG,WAAW,CAAW,OAAO,EAAE,QAAQ,CAAU,CAAC;YACjE,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,QAAQ;aACvB,CAAC;QACJ,CAAC;QACD,MAAM,EAAE,CAAC,QAAwB,EAAE,EAAE;YACnC,MAAM,EAAE,iBAAiB,EAAE,GAAG,Q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AI,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,IAAA,6BAAe,EACnB,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"]}
|
|
@@ -21,23 +21,22 @@ function getLongRunningPoller(client, processResponseBody, expectedStatuses, opt
|
|
|
21
21
|
return getLroResponse(initialResponse, expectedStatuses);
|
|
22
22
|
},
|
|
23
23
|
sendPollRequest: async (path, pollOptions) => {
|
|
24
|
-
var _a, _b, _c, _d, _e, _f;
|
|
25
24
|
// The poll request would both listen to the user provided abort signal and the poller's own abort signal
|
|
26
25
|
function abortListener() {
|
|
27
26
|
pollAbortController.abort();
|
|
28
27
|
}
|
|
29
28
|
const abortSignal = pollAbortController.signal;
|
|
30
|
-
if (
|
|
29
|
+
if (options.abortSignal?.aborted) {
|
|
31
30
|
pollAbortController.abort();
|
|
32
31
|
}
|
|
33
|
-
else if (
|
|
32
|
+
else if (pollOptions?.abortSignal?.aborted) {
|
|
34
33
|
pollAbortController.abort();
|
|
35
34
|
}
|
|
36
35
|
else if (!abortSignal.aborted) {
|
|
37
|
-
|
|
36
|
+
options.abortSignal?.addEventListener("abort", abortListener, {
|
|
38
37
|
once: true,
|
|
39
38
|
});
|
|
40
|
-
|
|
39
|
+
pollOptions?.abortSignal?.addEventListener("abort", abortListener, {
|
|
41
40
|
once: true,
|
|
42
41
|
});
|
|
43
42
|
}
|
|
@@ -46,16 +45,16 @@ function getLongRunningPoller(client, processResponseBody, expectedStatuses, opt
|
|
|
46
45
|
response = await client.pathUnchecked(path).get({ abortSignal });
|
|
47
46
|
}
|
|
48
47
|
finally {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
options.abortSignal?.removeEventListener("abort", abortListener);
|
|
49
|
+
pollOptions?.abortSignal?.removeEventListener("abort", abortListener);
|
|
51
50
|
}
|
|
52
51
|
return getLroResponse(response, expectedStatuses);
|
|
53
52
|
},
|
|
54
53
|
};
|
|
55
54
|
return (0, core_lro_1.createHttpPoller)(poller, {
|
|
56
|
-
intervalInMs: options
|
|
57
|
-
resourceLocationConfig: options
|
|
58
|
-
restoreFrom: options
|
|
55
|
+
intervalInMs: options?.updateIntervalInMs,
|
|
56
|
+
resourceLocationConfig: options?.resourceLocationConfig,
|
|
57
|
+
restoreFrom: options?.restoreFrom,
|
|
59
58
|
processResult: (result) => {
|
|
60
59
|
return processResponseBody(result);
|
|
61
60
|
},
|
|
@@ -73,7 +72,11 @@ function getLroResponse(response, expectedStatuses) {
|
|
|
73
72
|
}
|
|
74
73
|
return {
|
|
75
74
|
flatResponse: response,
|
|
76
|
-
rawResponse:
|
|
75
|
+
rawResponse: {
|
|
76
|
+
...response,
|
|
77
|
+
statusCode: Number.parseInt(response.status),
|
|
78
|
+
body: response.body,
|
|
79
|
+
},
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
//# sourceMappingURL=pollingHelpers.js.map
|