@azure/template 1.0.13-beta.5247948 → 1.0.13-beta.5497775
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/LICENSE +1 -1
- package/README.md +48 -53
- package/dist/browser/api/index.d.ts +2 -0
- package/dist/browser/api/index.js +4 -0
- package/dist/browser/api/index.js.map +1 -0
- package/dist/browser/api/widgetAnalyticsContext.d.ts +15 -0
- package/dist/browser/api/widgetAnalyticsContext.js +37 -0
- package/dist/browser/api/widgetAnalyticsContext.js.map +1 -0
- package/dist/browser/api/widgets/index.d.ts +3 -0
- package/dist/browser/api/widgets/index.js +4 -0
- package/dist/browser/api/widgets/index.js.map +1 -0
- package/dist/browser/api/widgets/operations.d.ts +27 -0
- package/dist/browser/api/widgets/operations.js +162 -0
- package/dist/browser/api/widgets/operations.js.map +1 -0
- package/dist/browser/api/widgets/options.d.ts +21 -0
- package/dist/browser/api/widgets/options.js +4 -0
- package/dist/browser/api/widgets/options.js.map +1 -0
- package/dist/browser/classic/index.d.ts +2 -0
- package/dist/browser/classic/index.js +4 -0
- package/dist/browser/classic/index.js.map +1 -0
- package/dist/browser/classic/widgets/index.d.ts +20 -0
- package/dist/browser/classic/widgets/index.js +18 -0
- package/dist/browser/classic/widgets/index.js.map +1 -0
- package/dist/browser/index.d.ts +8 -1
- package/dist/browser/index.js +3 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/logger.d.ts +0 -5
- package/dist/browser/logger.js +0 -5
- package/dist/browser/logger.js.map +1 -1
- package/dist/browser/models/index.d.ts +2 -0
- package/dist/browser/models/index.js +4 -0
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/models.d.ts +74 -0
- package/dist/browser/models/models.js +73 -0
- package/dist/browser/models/models.js.map +1 -0
- package/dist/browser/restorePollerHelpers.d.ts +21 -0
- package/dist/browser/restorePollerHelpers.js +95 -0
- package/dist/browser/restorePollerHelpers.js.map +1 -0
- package/dist/browser/static-helpers/pagingHelpers.d.ts +72 -0
- package/dist/browser/static-helpers/pagingHelpers.js +118 -0
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -0
- package/dist/browser/static-helpers/pollingHelpers.d.ts +30 -0
- package/dist/browser/static-helpers/pollingHelpers.js +79 -0
- package/dist/browser/static-helpers/pollingHelpers.js.map +1 -0
- package/dist/browser/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/browser/static-helpers/urlTemplate.js +185 -0
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -0
- package/dist/browser/widgetAnalyticsClient.d.ts +19 -0
- package/dist/browser/widgetAnalyticsClient.js +31 -0
- package/dist/browser/widgetAnalyticsClient.js.map +1 -0
- package/dist/commonjs/api/index.d.ts +2 -0
- package/dist/commonjs/api/index.js +8 -0
- package/dist/commonjs/api/index.js.map +1 -0
- package/dist/commonjs/api/widgetAnalyticsContext.d.ts +15 -0
- package/dist/commonjs/api/widgetAnalyticsContext.js +40 -0
- package/dist/commonjs/api/widgetAnalyticsContext.js.map +1 -0
- package/dist/commonjs/api/widgets/index.d.ts +3 -0
- package/dist/commonjs/api/widgets/index.js +12 -0
- package/dist/commonjs/api/widgets/index.js.map +1 -0
- package/dist/commonjs/api/widgets/operations.d.ts +27 -0
- package/dist/commonjs/api/widgets/operations.js +179 -0
- package/dist/commonjs/api/widgets/operations.js.map +1 -0
- package/dist/commonjs/api/widgets/options.d.ts +21 -0
- package/dist/commonjs/{constants.js → api/widgets/options.js} +1 -3
- package/dist/commonjs/api/widgets/options.js.map +1 -0
- package/dist/commonjs/classic/index.d.ts +2 -0
- package/dist/commonjs/classic/index.js +5 -0
- package/dist/commonjs/classic/index.js.map +1 -0
- package/dist/commonjs/classic/widgets/index.d.ts +20 -0
- package/dist/commonjs/classic/widgets/index.js +21 -0
- package/dist/commonjs/classic/widgets/index.js.map +1 -0
- package/dist/commonjs/index.d.ts +8 -1
- package/dist/commonjs/index.js +8 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/logger.d.ts +0 -5
- package/dist/commonjs/logger.js +0 -5
- package/dist/commonjs/logger.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.js +9 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/models.d.ts +74 -0
- package/dist/commonjs/models/models.js +84 -0
- package/dist/commonjs/models/models.js.map +1 -0
- package/dist/commonjs/restorePollerHelpers.d.ts +21 -0
- package/dist/commonjs/restorePollerHelpers.js +98 -0
- package/dist/commonjs/restorePollerHelpers.js.map +1 -0
- package/dist/commonjs/static-helpers/pagingHelpers.d.ts +72 -0
- package/dist/commonjs/static-helpers/pagingHelpers.js +121 -0
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -0
- package/dist/commonjs/static-helpers/pollingHelpers.d.ts +30 -0
- package/dist/commonjs/static-helpers/pollingHelpers.js +82 -0
- package/dist/commonjs/static-helpers/pollingHelpers.js.map +1 -0
- package/dist/commonjs/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/commonjs/static-helpers/urlTemplate.js +188 -0
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/widgetAnalyticsClient.d.ts +19 -0
- package/dist/commonjs/widgetAnalyticsClient.js +35 -0
- package/dist/commonjs/widgetAnalyticsClient.js.map +1 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/api/index.js +4 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/api/widgetAnalyticsContext.d.ts +15 -0
- package/dist/esm/api/widgetAnalyticsContext.js +37 -0
- package/dist/esm/api/widgetAnalyticsContext.js.map +1 -0
- package/dist/esm/api/widgets/index.d.ts +3 -0
- package/dist/esm/api/widgets/index.js +4 -0
- package/dist/esm/api/widgets/index.js.map +1 -0
- package/dist/esm/api/widgets/operations.d.ts +27 -0
- package/dist/esm/api/widgets/operations.js +162 -0
- package/dist/esm/api/widgets/operations.js.map +1 -0
- package/dist/esm/api/widgets/options.d.ts +21 -0
- package/dist/esm/api/widgets/options.js +4 -0
- package/dist/esm/api/widgets/options.js.map +1 -0
- package/dist/esm/classic/index.d.ts +2 -0
- package/dist/esm/classic/index.js +4 -0
- package/dist/esm/classic/index.js.map +1 -0
- package/dist/esm/classic/widgets/index.d.ts +20 -0
- package/dist/esm/classic/widgets/index.js +18 -0
- package/dist/esm/classic/widgets/index.js.map +1 -0
- package/dist/esm/index.d.ts +8 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.d.ts +0 -5
- package/dist/esm/logger.js +0 -5
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/models.d.ts +74 -0
- package/dist/esm/models/models.js +73 -0
- package/dist/esm/models/models.js.map +1 -0
- package/dist/esm/restorePollerHelpers.d.ts +21 -0
- package/dist/esm/restorePollerHelpers.js +95 -0
- package/dist/esm/restorePollerHelpers.js.map +1 -0
- package/dist/esm/static-helpers/pagingHelpers.d.ts +72 -0
- package/dist/esm/static-helpers/pagingHelpers.js +118 -0
- package/dist/esm/static-helpers/pagingHelpers.js.map +1 -0
- package/dist/esm/static-helpers/pollingHelpers.d.ts +30 -0
- package/dist/esm/static-helpers/pollingHelpers.js +79 -0
- package/dist/esm/static-helpers/pollingHelpers.js.map +1 -0
- package/dist/esm/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/esm/static-helpers/urlTemplate.js +185 -0
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -0
- package/dist/esm/widgetAnalyticsClient.d.ts +19 -0
- package/dist/esm/widgetAnalyticsClient.js +31 -0
- package/dist/esm/widgetAnalyticsClient.js.map +1 -0
- package/dist/react-native/api/index.d.ts +2 -0
- package/dist/react-native/api/index.js +4 -0
- package/dist/react-native/api/index.js.map +1 -0
- package/dist/react-native/api/widgetAnalyticsContext.d.ts +15 -0
- package/dist/react-native/api/widgetAnalyticsContext.js +37 -0
- package/dist/react-native/api/widgetAnalyticsContext.js.map +1 -0
- package/dist/react-native/api/widgets/index.d.ts +3 -0
- package/dist/react-native/api/widgets/index.js +4 -0
- package/dist/react-native/api/widgets/index.js.map +1 -0
- package/dist/react-native/api/widgets/operations.d.ts +27 -0
- package/dist/react-native/api/widgets/operations.js +162 -0
- package/dist/react-native/api/widgets/operations.js.map +1 -0
- package/dist/react-native/api/widgets/options.d.ts +21 -0
- package/dist/react-native/api/widgets/options.js +4 -0
- package/dist/react-native/api/widgets/options.js.map +1 -0
- package/dist/react-native/classic/index.d.ts +2 -0
- package/dist/react-native/classic/index.js +4 -0
- package/dist/react-native/classic/index.js.map +1 -0
- package/dist/react-native/classic/widgets/index.d.ts +20 -0
- package/dist/react-native/classic/widgets/index.js +18 -0
- package/dist/react-native/classic/widgets/index.js.map +1 -0
- package/dist/react-native/index.d.ts +8 -1
- package/dist/react-native/index.js +3 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/logger.d.ts +0 -5
- package/dist/react-native/logger.js +0 -5
- package/dist/react-native/logger.js.map +1 -1
- package/dist/react-native/models/index.d.ts +2 -0
- package/dist/react-native/models/index.js +4 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/models.d.ts +74 -0
- package/dist/react-native/models/models.js +73 -0
- package/dist/react-native/models/models.js.map +1 -0
- package/dist/react-native/restorePollerHelpers.d.ts +21 -0
- package/dist/react-native/restorePollerHelpers.js +95 -0
- package/dist/react-native/restorePollerHelpers.js.map +1 -0
- package/dist/react-native/static-helpers/pagingHelpers.d.ts +72 -0
- package/dist/react-native/static-helpers/pagingHelpers.js +118 -0
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -0
- package/dist/react-native/static-helpers/pollingHelpers.d.ts +30 -0
- package/dist/react-native/static-helpers/pollingHelpers.js +79 -0
- package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -0
- package/dist/react-native/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/react-native/static-helpers/urlTemplate.js +185 -0
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -0
- package/dist/react-native/widgetAnalyticsClient.d.ts +19 -0
- package/dist/react-native/widgetAnalyticsClient.js +31 -0
- package/dist/react-native/widgetAnalyticsClient.js.map +1 -0
- package/package.json +138 -83
- package/dist/browser/configurationClient.d.ts +0 -64
- package/dist/browser/configurationClient.d.ts.map +0 -1
- package/dist/browser/configurationClient.js +0 -96
- package/dist/browser/configurationClient.js.map +0 -1
- package/dist/browser/constants.d.ts +0 -2
- package/dist/browser/constants.d.ts.map +0 -1
- package/dist/browser/constants.js +0 -4
- package/dist/browser/constants.js.map +0 -1
- package/dist/browser/generated/generatedClient.d.ts +0 -168
- package/dist/browser/generated/generatedClient.d.ts.map +0 -1
- package/dist/browser/generated/generatedClient.js +0 -866
- package/dist/browser/generated/generatedClient.js.map +0 -1
- package/dist/browser/generated/generatedClientContext.d.ts +0 -15
- package/dist/browser/generated/generatedClientContext.d.ts.map +0 -1
- package/dist/browser/generated/generatedClientContext.js +0 -49
- package/dist/browser/generated/generatedClientContext.js.map +0 -1
- package/dist/browser/generated/index.d.ts +0 -4
- package/dist/browser/generated/index.d.ts.map +0 -1
- package/dist/browser/generated/index.js +0 -11
- package/dist/browser/generated/index.js.map +0 -1
- package/dist/browser/generated/lroImpl.d.ts +0 -16
- package/dist/browser/generated/lroImpl.d.ts.map +0 -1
- package/dist/browser/generated/lroImpl.js +0 -33
- package/dist/browser/generated/lroImpl.js.map +0 -1
- package/dist/browser/generated/models/index.d.ts +0 -775
- package/dist/browser/generated/models/index.d.ts.map +0 -1
- package/dist/browser/generated/models/index.js +0 -54
- package/dist/browser/generated/models/index.js.map +0 -1
- package/dist/browser/generated/models/mappers.d.ts +0 -41
- package/dist/browser/generated/models/mappers.d.ts.map +0 -1
- package/dist/browser/generated/models/mappers.js +0 -949
- package/dist/browser/generated/models/mappers.js.map +0 -1
- package/dist/browser/generated/models/parameters.d.ts +0 -35
- package/dist/browser/generated/models/parameters.d.ts.map +0 -1
- package/dist/browser/generated/models/parameters.js +0 -348
- package/dist/browser/generated/models/parameters.js.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/logger.d.ts.map +0 -1
- package/dist/browser/util.d.ts +0 -12
- package/dist/browser/util.d.ts.map +0 -1
- package/dist/browser/util.js +0 -26
- package/dist/browser/util.js.map +0 -1
- package/dist/commonjs/configurationClient.d.ts +0 -64
- package/dist/commonjs/configurationClient.d.ts.map +0 -1
- package/dist/commonjs/configurationClient.js +0 -100
- package/dist/commonjs/configurationClient.js.map +0 -1
- package/dist/commonjs/constants.d.ts +0 -2
- package/dist/commonjs/constants.d.ts.map +0 -1
- package/dist/commonjs/constants.js.map +0 -1
- package/dist/commonjs/generated/generatedClient.d.ts +0 -168
- package/dist/commonjs/generated/generatedClient.d.ts.map +0 -1
- package/dist/commonjs/generated/generatedClient.js +0 -871
- package/dist/commonjs/generated/generatedClient.js.map +0 -1
- package/dist/commonjs/generated/generatedClientContext.d.ts +0 -15
- package/dist/commonjs/generated/generatedClientContext.d.ts.map +0 -1
- package/dist/commonjs/generated/generatedClientContext.js +0 -54
- package/dist/commonjs/generated/generatedClientContext.js.map +0 -1
- package/dist/commonjs/generated/index.d.ts +0 -4
- package/dist/commonjs/generated/index.d.ts.map +0 -1
- package/dist/commonjs/generated/index.js +0 -17
- package/dist/commonjs/generated/index.js.map +0 -1
- package/dist/commonjs/generated/lroImpl.d.ts +0 -16
- package/dist/commonjs/generated/lroImpl.d.ts.map +0 -1
- package/dist/commonjs/generated/lroImpl.js +0 -37
- package/dist/commonjs/generated/lroImpl.js.map +0 -1
- package/dist/commonjs/generated/models/index.d.ts +0 -775
- package/dist/commonjs/generated/models/index.d.ts.map +0 -1
- package/dist/commonjs/generated/models/index.js +0 -57
- package/dist/commonjs/generated/models/index.js.map +0 -1
- package/dist/commonjs/generated/models/mappers.d.ts +0 -41
- package/dist/commonjs/generated/models/mappers.d.ts.map +0 -1
- package/dist/commonjs/generated/models/mappers.js +0 -952
- package/dist/commonjs/generated/models/mappers.js.map +0 -1
- package/dist/commonjs/generated/models/parameters.d.ts +0 -35
- package/dist/commonjs/generated/models/parameters.d.ts.map +0 -1
- package/dist/commonjs/generated/models/parameters.js +0 -351
- package/dist/commonjs/generated/models/parameters.js.map +0 -1
- package/dist/commonjs/index.d.ts.map +0 -1
- package/dist/commonjs/logger.d.ts.map +0 -1
- package/dist/commonjs/util.d.ts +0 -12
- package/dist/commonjs/util.d.ts.map +0 -1
- package/dist/commonjs/util.js +0 -29
- package/dist/commonjs/util.js.map +0 -1
- package/dist/esm/configurationClient.d.ts +0 -64
- package/dist/esm/configurationClient.d.ts.map +0 -1
- package/dist/esm/configurationClient.js +0 -96
- package/dist/esm/configurationClient.js.map +0 -1
- package/dist/esm/constants.d.ts +0 -2
- package/dist/esm/constants.d.ts.map +0 -1
- package/dist/esm/constants.js +0 -4
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/generated/generatedClient.d.ts +0 -168
- package/dist/esm/generated/generatedClient.d.ts.map +0 -1
- package/dist/esm/generated/generatedClient.js +0 -866
- package/dist/esm/generated/generatedClient.js.map +0 -1
- package/dist/esm/generated/generatedClientContext.d.ts +0 -15
- package/dist/esm/generated/generatedClientContext.d.ts.map +0 -1
- package/dist/esm/generated/generatedClientContext.js +0 -49
- package/dist/esm/generated/generatedClientContext.js.map +0 -1
- package/dist/esm/generated/index.d.ts +0 -4
- package/dist/esm/generated/index.d.ts.map +0 -1
- package/dist/esm/generated/index.js +0 -11
- package/dist/esm/generated/index.js.map +0 -1
- package/dist/esm/generated/lroImpl.d.ts +0 -16
- package/dist/esm/generated/lroImpl.d.ts.map +0 -1
- package/dist/esm/generated/lroImpl.js +0 -33
- package/dist/esm/generated/lroImpl.js.map +0 -1
- package/dist/esm/generated/models/index.d.ts +0 -775
- package/dist/esm/generated/models/index.d.ts.map +0 -1
- package/dist/esm/generated/models/index.js +0 -54
- package/dist/esm/generated/models/index.js.map +0 -1
- package/dist/esm/generated/models/mappers.d.ts +0 -41
- package/dist/esm/generated/models/mappers.d.ts.map +0 -1
- package/dist/esm/generated/models/mappers.js +0 -949
- package/dist/esm/generated/models/mappers.js.map +0 -1
- package/dist/esm/generated/models/parameters.d.ts +0 -35
- package/dist/esm/generated/models/parameters.d.ts.map +0 -1
- package/dist/esm/generated/models/parameters.js +0 -348
- package/dist/esm/generated/models/parameters.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/logger.d.ts.map +0 -1
- package/dist/esm/util.d.ts +0 -12
- package/dist/esm/util.d.ts.map +0 -1
- package/dist/esm/util.js +0 -26
- package/dist/esm/util.js.map +0 -1
- package/dist/react-native/configurationClient.d.ts +0 -64
- package/dist/react-native/configurationClient.d.ts.map +0 -1
- package/dist/react-native/configurationClient.js +0 -96
- package/dist/react-native/configurationClient.js.map +0 -1
- package/dist/react-native/constants.d.ts +0 -2
- package/dist/react-native/constants.d.ts.map +0 -1
- package/dist/react-native/constants.js +0 -4
- package/dist/react-native/constants.js.map +0 -1
- package/dist/react-native/generated/generatedClient.d.ts +0 -168
- package/dist/react-native/generated/generatedClient.d.ts.map +0 -1
- package/dist/react-native/generated/generatedClient.js +0 -866
- package/dist/react-native/generated/generatedClient.js.map +0 -1
- package/dist/react-native/generated/generatedClientContext.d.ts +0 -15
- package/dist/react-native/generated/generatedClientContext.d.ts.map +0 -1
- package/dist/react-native/generated/generatedClientContext.js +0 -49
- package/dist/react-native/generated/generatedClientContext.js.map +0 -1
- package/dist/react-native/generated/index.d.ts +0 -4
- package/dist/react-native/generated/index.d.ts.map +0 -1
- package/dist/react-native/generated/index.js +0 -11
- package/dist/react-native/generated/index.js.map +0 -1
- package/dist/react-native/generated/lroImpl.d.ts +0 -16
- package/dist/react-native/generated/lroImpl.d.ts.map +0 -1
- package/dist/react-native/generated/lroImpl.js +0 -33
- package/dist/react-native/generated/lroImpl.js.map +0 -1
- package/dist/react-native/generated/models/index.d.ts +0 -775
- package/dist/react-native/generated/models/index.d.ts.map +0 -1
- package/dist/react-native/generated/models/index.js +0 -54
- package/dist/react-native/generated/models/index.js.map +0 -1
- package/dist/react-native/generated/models/mappers.d.ts +0 -41
- package/dist/react-native/generated/models/mappers.d.ts.map +0 -1
- package/dist/react-native/generated/models/mappers.js +0 -949
- package/dist/react-native/generated/models/mappers.js.map +0 -1
- package/dist/react-native/generated/models/parameters.d.ts +0 -35
- package/dist/react-native/generated/models/parameters.d.ts.map +0 -1
- package/dist/react-native/generated/models/parameters.js +0 -348
- package/dist/react-native/generated/models/parameters.js.map +0 -1
- package/dist/react-native/index.d.ts.map +0 -1
- package/dist/react-native/logger.d.ts.map +0 -1
- package/dist/react-native/util.d.ts +0 -12
- package/dist/react-native/util.d.ts.map +0 -1
- package/dist/react-native/util.js +0 -26
- package/dist/react-native/util.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAwB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAIL,mBAAmB,EAEnB,aAAa,GACd,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n PageSettings,\n ContinuablePage,\n PagedAsyncIterableIterator,\n} from \"./static-helpers/pagingHelpers.js\";\n\nexport { WidgetAnalyticsClient } from \"./widgetAnalyticsClient.js\";\nexport { restorePoller, RestorePollerOptions } from \"./restorePollerHelpers.js\";\nexport {\n WidgetSuite,\n FakedSharedModel,\n ResourceOperationStatusWidgetSuiteWidgetSuiteError,\n KnownOperationState,\n OperationState,\n KnownVersions,\n} from \"./models/index.js\";\nexport { WidgetAnalyticsClientOptionalParams } from \"./api/index.js\";\nexport {\n WidgetsListWidgetsOptionalParams,\n WidgetsDeleteWidgetOptionalParams,\n WidgetsCreateOrUpdateWidgetOptionalParams,\n WidgetsGetWidgetOperationStatusOptionalParams,\n WidgetsGetWidgetOptionalParams,\n} from \"./api/widgets/index.js\";\nexport { WidgetsOperations } from \"./classic/index.js\";\nexport { PageSettings, ContinuablePage, PagedAsyncIterableIterator };\n"]}
|
package/dist/browser/logger.d.ts
CHANGED
package/dist/browser/logger.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { createClientLogger } from "@azure/logger";
|
|
4
|
-
/**
|
|
5
|
-
* The \@azure/logger configuration for this package.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
4
|
export const logger = createClientLogger("template");
|
|
10
5
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"template\");\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAIL,mBAAmB,EAEnB,aAAa,GACd,MAAM,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n WidgetSuite,\n FakedSharedModel,\n ResourceOperationStatusWidgetSuiteWidgetSuiteError,\n KnownOperationState,\n OperationState,\n KnownVersions,\n} from \"./models.js\";\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ErrorModel } from "@azure-rest/core-client";
|
|
2
|
+
/** A widget. */
|
|
3
|
+
export interface WidgetSuite {
|
|
4
|
+
/** The widget name. */
|
|
5
|
+
readonly name: string;
|
|
6
|
+
/** The ID of the widget's manufacturer. */
|
|
7
|
+
manufacturerId: string;
|
|
8
|
+
/** The faked shared model. */
|
|
9
|
+
sharedModel?: FakedSharedModel;
|
|
10
|
+
}
|
|
11
|
+
export declare function widgetSuiteSerializer(item: WidgetSuite): any;
|
|
12
|
+
export declare function widgetSuiteDeserializer(item: any): WidgetSuite;
|
|
13
|
+
/** Faked shared model */
|
|
14
|
+
export interface FakedSharedModel {
|
|
15
|
+
/** The tag. */
|
|
16
|
+
tag: string;
|
|
17
|
+
/** The created date. */
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
}
|
|
20
|
+
export declare function fakedSharedModelSerializer(item: FakedSharedModel): any;
|
|
21
|
+
export declare function fakedSharedModelDeserializer(item: any): FakedSharedModel;
|
|
22
|
+
/** Provides status details for long running operations. */
|
|
23
|
+
export interface ResourceOperationStatusWidgetSuiteWidgetSuiteError {
|
|
24
|
+
/** The unique ID of the operation. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** The status of the operation */
|
|
27
|
+
status: OperationState;
|
|
28
|
+
/** Error object that describes the error when status is "Failed". */
|
|
29
|
+
error?: ErrorModel;
|
|
30
|
+
/** The result of the operation. */
|
|
31
|
+
result?: WidgetSuite;
|
|
32
|
+
}
|
|
33
|
+
export declare function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(item: any): ResourceOperationStatusWidgetSuiteWidgetSuiteError;
|
|
34
|
+
/** Enum describing allowed operation states. */
|
|
35
|
+
export declare enum KnownOperationState {
|
|
36
|
+
/** The operation has not started. */
|
|
37
|
+
NotStarted = "NotStarted",
|
|
38
|
+
/** The operation is in progress. */
|
|
39
|
+
Running = "Running",
|
|
40
|
+
/** The operation has completed successfully. */
|
|
41
|
+
Succeeded = "Succeeded",
|
|
42
|
+
/** The operation has failed. */
|
|
43
|
+
Failed = "Failed",
|
|
44
|
+
/** The operation has been canceled by the user. */
|
|
45
|
+
Canceled = "Canceled"
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Enum describing allowed operation states. \
|
|
49
|
+
* {@link KnownOperationState} can be used interchangeably with OperationState,
|
|
50
|
+
* this enum contains the known values that the service supports.
|
|
51
|
+
* ### Known values supported by the service
|
|
52
|
+
* **NotStarted**: The operation has not started. \
|
|
53
|
+
* **Running**: The operation is in progress. \
|
|
54
|
+
* **Succeeded**: The operation has completed successfully. \
|
|
55
|
+
* **Failed**: The operation has failed. \
|
|
56
|
+
* **Canceled**: The operation has been canceled by the user.
|
|
57
|
+
*/
|
|
58
|
+
export type OperationState = string;
|
|
59
|
+
/** Paged collection of WidgetSuite items */
|
|
60
|
+
export interface _PagedWidgetSuite {
|
|
61
|
+
/** The WidgetSuite items on this page */
|
|
62
|
+
value: WidgetSuite[];
|
|
63
|
+
/** The link to the next page of items */
|
|
64
|
+
nextLink?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function _pagedWidgetSuiteDeserializer(item: any): _PagedWidgetSuite;
|
|
67
|
+
export declare function widgetSuiteArraySerializer(result: Array<WidgetSuite>): any[];
|
|
68
|
+
export declare function widgetSuiteArrayDeserializer(result: Array<WidgetSuite>): any[];
|
|
69
|
+
/** Versions info. */
|
|
70
|
+
export declare enum KnownVersions {
|
|
71
|
+
/** The 2022-12-01 version. */
|
|
72
|
+
V20221201 = "2022-12-01"
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export function widgetSuiteSerializer(item) {
|
|
4
|
+
return {
|
|
5
|
+
manufacturerId: item["manufacturerId"],
|
|
6
|
+
sharedModel: !item["sharedModel"]
|
|
7
|
+
? item["sharedModel"]
|
|
8
|
+
: fakedSharedModelSerializer(item["sharedModel"]),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function widgetSuiteDeserializer(item) {
|
|
12
|
+
return {
|
|
13
|
+
name: item["name"],
|
|
14
|
+
manufacturerId: item["manufacturerId"],
|
|
15
|
+
sharedModel: !item["sharedModel"]
|
|
16
|
+
? item["sharedModel"]
|
|
17
|
+
: fakedSharedModelDeserializer(item["sharedModel"]),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function fakedSharedModelSerializer(item) {
|
|
21
|
+
return { tag: item["tag"], createdAt: item["createdAt"].toISOString() };
|
|
22
|
+
}
|
|
23
|
+
export function fakedSharedModelDeserializer(item) {
|
|
24
|
+
return {
|
|
25
|
+
tag: item["tag"],
|
|
26
|
+
createdAt: new Date(item["createdAt"]),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(item) {
|
|
30
|
+
return {
|
|
31
|
+
id: item["id"],
|
|
32
|
+
status: item["status"],
|
|
33
|
+
error: !item["error"] ? item["error"] : item["error"],
|
|
34
|
+
result: !item["result"] ? item["result"] : widgetSuiteDeserializer(item["result"]),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Enum describing allowed operation states. */
|
|
38
|
+
export var KnownOperationState;
|
|
39
|
+
(function (KnownOperationState) {
|
|
40
|
+
/** The operation has not started. */
|
|
41
|
+
KnownOperationState["NotStarted"] = "NotStarted";
|
|
42
|
+
/** The operation is in progress. */
|
|
43
|
+
KnownOperationState["Running"] = "Running";
|
|
44
|
+
/** The operation has completed successfully. */
|
|
45
|
+
KnownOperationState["Succeeded"] = "Succeeded";
|
|
46
|
+
/** The operation has failed. */
|
|
47
|
+
KnownOperationState["Failed"] = "Failed";
|
|
48
|
+
/** The operation has been canceled by the user. */
|
|
49
|
+
KnownOperationState["Canceled"] = "Canceled";
|
|
50
|
+
})(KnownOperationState || (KnownOperationState = {}));
|
|
51
|
+
export function _pagedWidgetSuiteDeserializer(item) {
|
|
52
|
+
return {
|
|
53
|
+
value: widgetSuiteArrayDeserializer(item["value"]),
|
|
54
|
+
nextLink: item["nextLink"],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function widgetSuiteArraySerializer(result) {
|
|
58
|
+
return result.map((item) => {
|
|
59
|
+
return widgetSuiteSerializer(item);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function widgetSuiteArrayDeserializer(result) {
|
|
63
|
+
return result.map((item) => {
|
|
64
|
+
return widgetSuiteDeserializer(item);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** Versions info. */
|
|
68
|
+
export var KnownVersions;
|
|
69
|
+
(function (KnownVersions) {
|
|
70
|
+
/** The 2022-12-01 version. */
|
|
71
|
+
KnownVersions["V20221201"] = "2022-12-01";
|
|
72
|
+
})(KnownVersions || (KnownVersions = {}));
|
|
73
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,MAAM,UAAU,qBAAqB,CAAC,IAAiB;IACrD,OAAO;QACL,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC;QACtC,WAAW,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC;YAC/B,CAAC,CAAC,IA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ED,gDAAgD;AAChD,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,qCAAqC;IACrC,gDAAyB,CAAA;IACzB,oCAAoC;IACpC,0CAAmB,CAAA;IACnB,gDAAgD;IAChD,8CAAuB,CAAA;IACvB,gCAAgC;IAChC,wCAAiB,CAAA;IACjB,mDAAmD;IACnD,4CAAqB,CAAA;AACvB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAuBD,MAAM,UAAU,6BAA6B,CAAC,IAAS;IACrD,OAAO;QACL,KAAK,EAAE,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAA0B;IACnE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA0B;IACrE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qBAAqB;AACrB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,8BAA8B;IAC9B,yCAAwB,CAAA;AAC1B,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ErrorModel } from \"@azure-rest/core-client\";\n\n/** A widget. */\nexport interface WidgetSuite {\n /** The widget name. */\n readonly name: string;\n /** The ID of the widget's manufacturer. */\n manufacturerId: string;\n /** The faked shared model. */\n sharedModel?: FakedSharedModel;\n}\n\nexport function widgetSuiteSerializer(item: WidgetSuite): any {\n return {\n manufacturerId: item[\"manufacturerId\"],\n sharedModel: !item[\"sharedModel\"]\n ? item[\"sharedModel\"]\n : fakedSharedModelSerializer(item[\"sharedModel\"]),\n };\n}\n\nexport function widgetSuiteDeserializer(item: any): WidgetSuite {\n return {\n name: item[\"name\"],\n manufacturerId: item[\"manufacturerId\"],\n sharedModel: !item[\"sharedModel\"]\n ? item[\"sharedModel\"]\n : fakedSharedModelDeserializer(item[\"sharedModel\"]),\n };\n}\n\n/** Faked shared model */\nexport interface FakedSharedModel {\n /** The tag. */\n tag: string;\n /** The created date. */\n createdAt: Date;\n}\n\nexport function fakedSharedModelSerializer(item: FakedSharedModel): any {\n return { tag: item[\"tag\"], createdAt: item[\"createdAt\"].toISOString() };\n}\n\nexport function fakedSharedModelDeserializer(item: any): FakedSharedModel {\n return {\n tag: item[\"tag\"],\n createdAt: new Date(item[\"createdAt\"]),\n };\n}\n\n/** Provides status details for long running operations. */\nexport interface ResourceOperationStatusWidgetSuiteWidgetSuiteError {\n /** The unique ID of the operation. */\n id: string;\n /** The status of the operation */\n status: OperationState;\n /** Error object that describes the error when status is \"Failed\". */\n error?: ErrorModel;\n /** The result of the operation. */\n result?: WidgetSuite;\n}\n\nexport function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(\n item: any,\n): ResourceOperationStatusWidgetSuiteWidgetSuiteError {\n return {\n id: item[\"id\"],\n status: item[\"status\"],\n error: !item[\"error\"] ? item[\"error\"] : item[\"error\"],\n result: !item[\"result\"] ? item[\"result\"] : widgetSuiteDeserializer(item[\"result\"]),\n };\n}\n\n/** Enum describing allowed operation states. */\nexport enum KnownOperationState {\n /** The operation has not started. */\n NotStarted = \"NotStarted\",\n /** The operation is in progress. */\n Running = \"Running\",\n /** The operation has completed successfully. */\n Succeeded = \"Succeeded\",\n /** The operation has failed. */\n Failed = \"Failed\",\n /** The operation has been canceled by the user. */\n Canceled = \"Canceled\",\n}\n\n/**\n * Enum describing allowed operation states. \\\n * {@link KnownOperationState} can be used interchangeably with OperationState,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **NotStarted**: The operation has not started. \\\n * **Running**: The operation is in progress. \\\n * **Succeeded**: The operation has completed successfully. \\\n * **Failed**: The operation has failed. \\\n * **Canceled**: The operation has been canceled by the user.\n */\nexport type OperationState = string;\n\n/** Paged collection of WidgetSuite items */\nexport interface _PagedWidgetSuite {\n /** The WidgetSuite items on this page */\n value: WidgetSuite[];\n /** The link to the next page of items */\n nextLink?: string;\n}\n\nexport function _pagedWidgetSuiteDeserializer(item: any): _PagedWidgetSuite {\n return {\n value: widgetSuiteArrayDeserializer(item[\"value\"]),\n nextLink: item[\"nextLink\"],\n };\n}\n\nexport function widgetSuiteArraySerializer(result: Array<WidgetSuite>): any[] {\n return result.map((item) => {\n return widgetSuiteSerializer(item);\n });\n}\n\nexport function widgetSuiteArrayDeserializer(result: Array<WidgetSuite>): any[] {\n return result.map((item) => {\n return widgetSuiteDeserializer(item);\n });\n}\n\n/** Versions info. */\nexport enum KnownVersions {\n /** The 2022-12-01 version. */\n V20221201 = \"2022-12-01\",\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WidgetAnalyticsClient } from "./widgetAnalyticsClient.js";
|
|
2
|
+
import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
+
import { AbortSignalLike } from "@azure/abort-controller";
|
|
4
|
+
import { PollerLike, OperationState } from "@azure/core-lro";
|
|
5
|
+
export interface RestorePollerOptions<TResult, TResponse extends PathUncheckedResponse = PathUncheckedResponse> extends OperationOptions {
|
|
6
|
+
/** Delay to wait until next poll, in milliseconds. */
|
|
7
|
+
updateIntervalInMs?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The signal which can be used to abort requests.
|
|
10
|
+
*/
|
|
11
|
+
abortSignal?: AbortSignalLike;
|
|
12
|
+
/** Deserialization function for raw response body */
|
|
13
|
+
processResponseBody?: (result: TResponse) => Promise<TResult>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a poller from the serialized state of another poller. This can be
|
|
17
|
+
* useful when you want to create pollers on a different host or a poller
|
|
18
|
+
* needs to be constructed after the original one is not in scope.
|
|
19
|
+
*/
|
|
20
|
+
export declare function restorePoller<TResponse extends PathUncheckedResponse, TResult>(client: WidgetAnalyticsClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>, options?: RestorePollerOptions<TResult>): PollerLike<OperationState<TResult>, TResult>;
|
|
21
|
+
//# sourceMappingURL=restorePollerHelpers.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { _deleteWidgetDeserialize, _createOrUpdateWidgetDeserialize, } from "./api/widgets/operations.js";
|
|
4
|
+
import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js";
|
|
5
|
+
import { deserializeState, } from "@azure/core-lro";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a poller from the serialized state of another poller. This can be
|
|
8
|
+
* useful when you want to create pollers on a different host or a poller
|
|
9
|
+
* needs to be constructed after the original one is not in scope.
|
|
10
|
+
*/
|
|
11
|
+
export function restorePoller(client, serializedState, sourceOperation, options) {
|
|
12
|
+
const pollerConfig = deserializeState(serializedState).config;
|
|
13
|
+
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
14
|
+
if (!initialRequestUrl || !requestMethod) {
|
|
15
|
+
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
|
|
16
|
+
}
|
|
17
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
18
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
19
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
20
|
+
if (!deserializeHelper) {
|
|
21
|
+
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
22
|
+
}
|
|
23
|
+
return getLongRunningPoller(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
24
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
25
|
+
abortSignal: options?.abortSignal,
|
|
26
|
+
resourceLocationConfig,
|
|
27
|
+
restoreFrom: serializedState,
|
|
28
|
+
initialRequestUrl,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const deserializeMap = {
|
|
32
|
+
"DELETE /widgets/{widgetName}": {
|
|
33
|
+
deserializer: _deleteWidgetDeserialize,
|
|
34
|
+
expectedStatuses: ["202", "200"],
|
|
35
|
+
},
|
|
36
|
+
"PATCH /widgets/{widgetName}": {
|
|
37
|
+
deserializer: _createOrUpdateWidgetDeserialize,
|
|
38
|
+
expectedStatuses: ["201", "200", "202"],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
function getDeserializationHelper(urlStr, method) {
|
|
42
|
+
const path = new URL(urlStr).pathname;
|
|
43
|
+
const pathParts = path.split("/");
|
|
44
|
+
// Traverse list to match the longest candidate
|
|
45
|
+
// matchedLen: the length of candidate path
|
|
46
|
+
// matchedValue: the matched status code array
|
|
47
|
+
let matchedLen = -1, matchedValue;
|
|
48
|
+
// Iterate the responseMap to find a match
|
|
49
|
+
for (const [key, value] of Object.entries(deserializeMap)) {
|
|
50
|
+
// Extracting the path from the map key which is in format
|
|
51
|
+
// GET /path/foo
|
|
52
|
+
if (!key.startsWith(method)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const candidatePath = getPathFromMapKey(key);
|
|
56
|
+
// Get each part of the url path
|
|
57
|
+
const candidateParts = candidatePath.split("/");
|
|
58
|
+
// track if we have found a match to return the values found.
|
|
59
|
+
let found = true;
|
|
60
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
61
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
62
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
63
|
+
// If the current part of the candidate is a "template" part
|
|
64
|
+
// Try to use the suffix of pattern to match the path
|
|
65
|
+
// {guid} ==> $
|
|
66
|
+
// {guid}:export ==> :export$
|
|
67
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
68
|
+
if (!isMatched) {
|
|
69
|
+
found = false;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// If the candidate part is not a template and
|
|
75
|
+
// the parts don't match mark the candidate as not found
|
|
76
|
+
// to move on with the next candidate path.
|
|
77
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
78
|
+
found = false;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// We finished evaluating the current candidate parts
|
|
83
|
+
// Update the matched value if and only if we found the longer pattern
|
|
84
|
+
if (found && candidatePath.length > matchedLen) {
|
|
85
|
+
matchedLen = candidatePath.length;
|
|
86
|
+
matchedValue = value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return matchedValue;
|
|
90
|
+
}
|
|
91
|
+
function getPathFromMapKey(mapKey) {
|
|
92
|
+
const pathStart = mapKey.indexOf("/");
|
|
93
|
+
return mapKey.slice(pathStart);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=restorePollerHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAGL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAgBzB;;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,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;gBAClC,4DAA4D;gBAC5D,qDAAqD;gBACrD,eAAe;gBACf,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,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 { WidgetAnalyticsClient } from \"./widgetAnalyticsClient.js\";\nimport {\n _deleteWidgetDeserialize,\n _createOrUpdateWidgetDeserialize,\n} from \"./api/widgets/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: WidgetAnalyticsClient,\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /widgets/{widgetName}\": {\n deserializer: _deleteWidgetDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"PATCH /widgets/{widgetName}\": {\n deserializer: _createOrUpdateWidgetDeserialize,\n expectedStatuses: [\"201\", \"200\", \"202\"],\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"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the byPage method
|
|
4
|
+
*/
|
|
5
|
+
export interface PageSettings {
|
|
6
|
+
/**
|
|
7
|
+
* A reference to a specific page to start iterating from.
|
|
8
|
+
*/
|
|
9
|
+
continuationToken?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An interface that describes a page of results.
|
|
13
|
+
*/
|
|
14
|
+
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
|
|
15
|
+
/**
|
|
16
|
+
* The token that keeps track of where to continue the iterator
|
|
17
|
+
*/
|
|
18
|
+
continuationToken?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* An interface that allows async iterable iteration both to completion and by page.
|
|
22
|
+
*/
|
|
23
|
+
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
|
|
24
|
+
/**
|
|
25
|
+
* The next method, part of the iteration protocol
|
|
26
|
+
*/
|
|
27
|
+
next(): Promise<IteratorResult<TElement>>;
|
|
28
|
+
/**
|
|
29
|
+
* The connection to the async iterator, part of the iteration protocol
|
|
30
|
+
*/
|
|
31
|
+
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
|
|
32
|
+
/**
|
|
33
|
+
* Return an AsyncIterableIterator that works a page at a time
|
|
34
|
+
*/
|
|
35
|
+
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An interface that describes how to communicate with the service.
|
|
39
|
+
*/
|
|
40
|
+
export interface PagedResult<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
|
|
41
|
+
/**
|
|
42
|
+
* Link to the first page of results.
|
|
43
|
+
*/
|
|
44
|
+
firstPageLink?: string;
|
|
45
|
+
/**
|
|
46
|
+
* A method that returns a page of results.
|
|
47
|
+
*/
|
|
48
|
+
getPage: (pageLink?: string) => Promise<{
|
|
49
|
+
page: TPage;
|
|
50
|
+
nextPageLink?: string;
|
|
51
|
+
} | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* a function to implement the `byPage` method on the paged async iterator.
|
|
54
|
+
*/
|
|
55
|
+
byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
|
|
56
|
+
/**
|
|
57
|
+
* A function to extract elements from a page.
|
|
58
|
+
*/
|
|
59
|
+
toElements?: (page: TPage) => TElement[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options for the paging helper
|
|
63
|
+
*/
|
|
64
|
+
export interface BuildPagedAsyncIteratorOptions {
|
|
65
|
+
itemName?: string;
|
|
66
|
+
nextLinkName?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
70
|
+
*/
|
|
71
|
+
export declare function buildPagedAsyncIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings, TResponse extends PathUncheckedResponse = PathUncheckedResponse>(client: Client, getInitialResponse: () => PromiseLike<TResponse>, processResponseBody: (result: TResponse) => PromiseLike<unknown>, expectedStatuses: string[], options?: BuildPagedAsyncIteratorOptions): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
|
|
72
|
+
//# sourceMappingURL=pagingHelpers.d.ts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createRestError } from "@azure-rest/core-client";
|
|
4
|
+
import { RestError } from "@azure/core-rest-pipeline";
|
|
5
|
+
/**
|
|
6
|
+
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
7
|
+
*/
|
|
8
|
+
export function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
|
|
9
|
+
const itemName = options.itemName ?? "value";
|
|
10
|
+
const nextLinkName = options.nextLinkName ?? "nextLink";
|
|
11
|
+
const pagedResult = {
|
|
12
|
+
getPage: async (pageLink) => {
|
|
13
|
+
const result = pageLink === undefined
|
|
14
|
+
? await getInitialResponse()
|
|
15
|
+
: await client.pathUnchecked(pageLink).get();
|
|
16
|
+
checkPagingRequest(result, expectedStatuses);
|
|
17
|
+
const results = await processResponseBody(result);
|
|
18
|
+
const nextLink = getNextLink(results, nextLinkName);
|
|
19
|
+
const values = getElements(results, itemName);
|
|
20
|
+
return {
|
|
21
|
+
page: values,
|
|
22
|
+
nextPageLink: nextLink,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
byPage: (settings) => {
|
|
26
|
+
const { continuationToken } = settings ?? {};
|
|
27
|
+
return getPageAsyncIterator(pagedResult, {
|
|
28
|
+
pageLink: continuationToken,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return getPagedAsyncIterator(pagedResult);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* returns an async iterator that iterates over results. It also has a `byPage`
|
|
36
|
+
* method that returns pages of items at once.
|
|
37
|
+
*
|
|
38
|
+
* @param pagedResult - an object that specifies how to get pages.
|
|
39
|
+
* @returns a paged async iterator that iterates over results.
|
|
40
|
+
*/
|
|
41
|
+
function getPagedAsyncIterator(pagedResult) {
|
|
42
|
+
const iter = getItemAsyncIterator(pagedResult);
|
|
43
|
+
return {
|
|
44
|
+
next() {
|
|
45
|
+
return iter.next();
|
|
46
|
+
},
|
|
47
|
+
[Symbol.asyncIterator]() {
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
byPage: pagedResult?.byPage ??
|
|
51
|
+
((settings) => {
|
|
52
|
+
const { continuationToken } = settings ?? {};
|
|
53
|
+
return getPageAsyncIterator(pagedResult, {
|
|
54
|
+
pageLink: continuationToken,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
60
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
61
|
+
for await (const page of pages) {
|
|
62
|
+
yield* page;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
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);
|
|
76
|
+
if (!response) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
result = response.page;
|
|
80
|
+
result.continuationToken = response.nextPageLink;
|
|
81
|
+
yield result;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Gets for the value of nextLink in the body
|
|
86
|
+
*/
|
|
87
|
+
function getNextLink(body, nextLinkName) {
|
|
88
|
+
if (!nextLinkName) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const nextLink = body[nextLinkName];
|
|
92
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) {
|
|
93
|
+
throw new RestError(`Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`);
|
|
94
|
+
}
|
|
95
|
+
if (nextLink === null) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
return nextLink;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets the elements of the current request in the body.
|
|
102
|
+
*/
|
|
103
|
+
function getElements(body, itemName) {
|
|
104
|
+
const value = body[itemName];
|
|
105
|
+
if (!Array.isArray(value)) {
|
|
106
|
+
throw new RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
107
|
+
}
|
|
108
|
+
return value ?? [];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a request failed
|
|
112
|
+
*/
|
|
113
|
+
function checkPagingRequest(response, expectedStatuses) {
|
|
114
|
+
if (!expectedStatuses.includes(response.status)) {
|
|
115
|
+
throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=pagingHelpers.js.map
|
|
@@ -0,0 +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,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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AC;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"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro";
|
|
2
|
+
import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
+
import { AbortSignalLike } from "@azure/abort-controller";
|
|
4
|
+
export interface GetLongRunningPollerOptions<TResponse> {
|
|
5
|
+
/** Delay to wait until next poll, in milliseconds. */
|
|
6
|
+
updateIntervalInMs?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The signal which can be used to abort requests.
|
|
9
|
+
*/
|
|
10
|
+
abortSignal?: AbortSignalLike;
|
|
11
|
+
/**
|
|
12
|
+
* The potential location of the result of the LRO if specified by the LRO extension in the swagger.
|
|
13
|
+
*/
|
|
14
|
+
resourceLocationConfig?: ResourceLocationConfig;
|
|
15
|
+
/**
|
|
16
|
+
* The original url of the LRO
|
|
17
|
+
* Should not be null when restoreFrom is set
|
|
18
|
+
*/
|
|
19
|
+
initialRequestUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A serialized poller which can be used to resume an existing paused Long-Running-Operation.
|
|
22
|
+
*/
|
|
23
|
+
restoreFrom?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The function to get the initial response
|
|
26
|
+
*/
|
|
27
|
+
getInitialResponse?: () => PromiseLike<TResponse>;
|
|
28
|
+
}
|
|
29
|
+
export declare function getLongRunningPoller<TResponse extends PathUncheckedResponse, TResult = void>(client: Client, processResponseBody: (result: TResponse) => Promise<TResult>, expectedStatuses: string[], options: GetLongRunningPollerOptions<TResponse>): PollerLike<OperationState<TResult>, TResult>;
|
|
30
|
+
//# sourceMappingURL=pollingHelpers.d.ts.map
|