camara-sdk 0.1.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/CHANGELOG.md +9 -0
- package/LICENSE +201 -0
- package/README.md +355 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +294 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +294 -0
- package/client.d.ts.map +1 -0
- package/client.js +611 -0
- package/client.js.map +1 -0
- package/client.mjs +607 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +138 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/callforwardingsignal.d.mts +94 -0
- package/resources/callforwardingsignal.d.mts.map +1 -0
- package/resources/callforwardingsignal.d.ts +94 -0
- package/resources/callforwardingsignal.d.ts.map +1 -0
- package/resources/callforwardingsignal.js +54 -0
- package/resources/callforwardingsignal.js.map +1 -0
- package/resources/callforwardingsignal.mjs +50 -0
- package/resources/callforwardingsignal.mjs.map +1 -0
- package/resources/connectednetworktype/connectednetworktype.d.mts +10 -0
- package/resources/connectednetworktype/connectednetworktype.d.mts.map +1 -0
- package/resources/connectednetworktype/connectednetworktype.d.ts +10 -0
- package/resources/connectednetworktype/connectednetworktype.d.ts.map +1 -0
- package/resources/connectednetworktype/connectednetworktype.js +17 -0
- package/resources/connectednetworktype/connectednetworktype.js.map +1 -0
- package/resources/connectednetworktype/connectednetworktype.mjs +12 -0
- package/resources/connectednetworktype/connectednetworktype.mjs.map +1 -0
- package/resources/connectednetworktype/index.d.mts +3 -0
- package/resources/connectednetworktype/index.d.mts.map +1 -0
- package/resources/connectednetworktype/index.d.ts +3 -0
- package/resources/connectednetworktype/index.d.ts.map +1 -0
- package/resources/connectednetworktype/index.js +9 -0
- package/resources/connectednetworktype/index.js.map +1 -0
- package/resources/connectednetworktype/index.mjs +4 -0
- package/resources/connectednetworktype/index.mjs.map +1 -0
- package/resources/connectednetworktype/subscriptions.d.mts +380 -0
- package/resources/connectednetworktype/subscriptions.d.mts.map +1 -0
- package/resources/connectednetworktype/subscriptions.d.ts +380 -0
- package/resources/connectednetworktype/subscriptions.d.ts.map +1 -0
- package/resources/connectednetworktype/subscriptions.js +114 -0
- package/resources/connectednetworktype/subscriptions.js.map +1 -0
- package/resources/connectednetworktype/subscriptions.mjs +110 -0
- package/resources/connectednetworktype/subscriptions.mjs.map +1 -0
- package/resources/connectednetworktype.d.mts +2 -0
- package/resources/connectednetworktype.d.mts.map +1 -0
- package/resources/connectednetworktype.d.ts +2 -0
- package/resources/connectednetworktype.d.ts.map +1 -0
- package/resources/connectednetworktype.js +6 -0
- package/resources/connectednetworktype.js.map +1 -0
- package/resources/connectednetworktype.mjs +3 -0
- package/resources/connectednetworktype.mjs.map +1 -0
- package/resources/connectivityinsights/connectivityinsights.d.mts +10 -0
- package/resources/connectivityinsights/connectivityinsights.d.mts.map +1 -0
- package/resources/connectivityinsights/connectivityinsights.d.ts +10 -0
- package/resources/connectivityinsights/connectivityinsights.d.ts.map +1 -0
- package/resources/connectivityinsights/connectivityinsights.js +17 -0
- package/resources/connectivityinsights/connectivityinsights.js.map +1 -0
- package/resources/connectivityinsights/connectivityinsights.mjs +12 -0
- package/resources/connectivityinsights/connectivityinsights.mjs.map +1 -0
- package/resources/connectivityinsights/index.d.mts +3 -0
- package/resources/connectivityinsights/index.d.mts.map +1 -0
- package/resources/connectivityinsights/index.d.ts +3 -0
- package/resources/connectivityinsights/index.d.ts.map +1 -0
- package/resources/connectivityinsights/index.js +9 -0
- package/resources/connectivityinsights/index.js.map +1 -0
- package/resources/connectivityinsights/index.mjs +4 -0
- package/resources/connectivityinsights/index.mjs.map +1 -0
- package/resources/connectivityinsights/subscriptions.d.mts +445 -0
- package/resources/connectivityinsights/subscriptions.d.mts.map +1 -0
- package/resources/connectivityinsights/subscriptions.d.ts +445 -0
- package/resources/connectivityinsights/subscriptions.d.ts.map +1 -0
- package/resources/connectivityinsights/subscriptions.js +106 -0
- package/resources/connectivityinsights/subscriptions.js.map +1 -0
- package/resources/connectivityinsights/subscriptions.mjs +102 -0
- package/resources/connectivityinsights/subscriptions.mjs.map +1 -0
- package/resources/connectivityinsights.d.mts +2 -0
- package/resources/connectivityinsights.d.mts.map +1 -0
- package/resources/connectivityinsights.d.ts +2 -0
- package/resources/connectivityinsights.d.ts.map +1 -0
- package/resources/connectivityinsights.js +6 -0
- package/resources/connectivityinsights.js.map +1 -0
- package/resources/connectivityinsights.mjs +3 -0
- package/resources/connectivityinsights.mjs.map +1 -0
- package/resources/customerinsights/customerinsights.d.mts +10 -0
- package/resources/customerinsights/customerinsights.d.mts.map +1 -0
- package/resources/customerinsights/customerinsights.d.ts +10 -0
- package/resources/customerinsights/customerinsights.d.ts.map +1 -0
- package/resources/customerinsights/customerinsights.js +17 -0
- package/resources/customerinsights/customerinsights.js.map +1 -0
- package/resources/customerinsights/customerinsights.mjs +12 -0
- package/resources/customerinsights/customerinsights.mjs.map +1 -0
- package/resources/customerinsights/index.d.mts +3 -0
- package/resources/customerinsights/index.d.mts.map +1 -0
- package/resources/customerinsights/index.d.ts +3 -0
- package/resources/customerinsights/index.d.ts.map +1 -0
- package/resources/customerinsights/index.js +9 -0
- package/resources/customerinsights/index.js.map +1 -0
- package/resources/customerinsights/index.mjs +4 -0
- package/resources/customerinsights/index.mjs.map +1 -0
- package/resources/customerinsights/scoring.d.mts +71 -0
- package/resources/customerinsights/scoring.d.mts.map +1 -0
- package/resources/customerinsights/scoring.d.ts +71 -0
- package/resources/customerinsights/scoring.d.ts.map +1 -0
- package/resources/customerinsights/scoring.js +34 -0
- package/resources/customerinsights/scoring.js.map +1 -0
- package/resources/customerinsights/scoring.mjs +30 -0
- package/resources/customerinsights/scoring.mjs.map +1 -0
- package/resources/customerinsights.d.mts +2 -0
- package/resources/customerinsights.d.mts.map +1 -0
- package/resources/customerinsights.d.ts +2 -0
- package/resources/customerinsights.d.ts.map +1 -0
- package/resources/customerinsights.js +6 -0
- package/resources/customerinsights.js.map +1 -0
- package/resources/customerinsights.mjs +3 -0
- package/resources/customerinsights.mjs.map +1 -0
- package/resources/deviceidentifier.d.mts +334 -0
- package/resources/deviceidentifier.d.mts.map +1 -0
- package/resources/deviceidentifier.d.ts +334 -0
- package/resources/deviceidentifier.d.ts.map +1 -0
- package/resources/deviceidentifier.js +70 -0
- package/resources/deviceidentifier.js.map +1 -0
- package/resources/deviceidentifier.mjs +66 -0
- package/resources/deviceidentifier.mjs.map +1 -0
- package/resources/devicelocation/devicelocation.d.mts +10 -0
- package/resources/devicelocation/devicelocation.d.mts.map +1 -0
- package/resources/devicelocation/devicelocation.d.ts +10 -0
- package/resources/devicelocation/devicelocation.d.ts.map +1 -0
- package/resources/devicelocation/devicelocation.js +17 -0
- package/resources/devicelocation/devicelocation.js.map +1 -0
- package/resources/devicelocation/devicelocation.mjs +12 -0
- package/resources/devicelocation/devicelocation.mjs.map +1 -0
- package/resources/devicelocation/index.d.mts +3 -0
- package/resources/devicelocation/index.d.mts.map +1 -0
- package/resources/devicelocation/index.d.ts +3 -0
- package/resources/devicelocation/index.d.ts.map +1 -0
- package/resources/devicelocation/index.js +9 -0
- package/resources/devicelocation/index.js.map +1 -0
- package/resources/devicelocation/index.mjs +4 -0
- package/resources/devicelocation/index.mjs.map +1 -0
- package/resources/devicelocation/subscriptions.d.mts +448 -0
- package/resources/devicelocation/subscriptions.d.mts.map +1 -0
- package/resources/devicelocation/subscriptions.d.ts +448 -0
- package/resources/devicelocation/subscriptions.d.ts.map +1 -0
- package/resources/devicelocation/subscriptions.js +115 -0
- package/resources/devicelocation/subscriptions.js.map +1 -0
- package/resources/devicelocation/subscriptions.mjs +111 -0
- package/resources/devicelocation/subscriptions.mjs.map +1 -0
- package/resources/devicelocation.d.mts +2 -0
- package/resources/devicelocation.d.mts.map +1 -0
- package/resources/devicelocation.d.ts +2 -0
- package/resources/devicelocation.d.ts.map +1 -0
- package/resources/devicelocation.js +6 -0
- package/resources/devicelocation.js.map +1 -0
- package/resources/devicelocation.mjs +3 -0
- package/resources/devicelocation.mjs.map +1 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.d.mts +10 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.d.mts.map +1 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.d.ts +10 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.d.ts.map +1 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.js +17 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.js.map +1 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.mjs +12 -0
- package/resources/devicereachabilitystatus/devicereachabilitystatus.mjs.map +1 -0
- package/resources/devicereachabilitystatus/index.d.mts +3 -0
- package/resources/devicereachabilitystatus/index.d.mts.map +1 -0
- package/resources/devicereachabilitystatus/index.d.ts +3 -0
- package/resources/devicereachabilitystatus/index.d.ts.map +1 -0
- package/resources/devicereachabilitystatus/index.js +9 -0
- package/resources/devicereachabilitystatus/index.js.map +1 -0
- package/resources/devicereachabilitystatus/index.mjs +4 -0
- package/resources/devicereachabilitystatus/index.mjs.map +1 -0
- package/resources/devicereachabilitystatus/subscriptions.d.mts +387 -0
- package/resources/devicereachabilitystatus/subscriptions.d.mts.map +1 -0
- package/resources/devicereachabilitystatus/subscriptions.d.ts +387 -0
- package/resources/devicereachabilitystatus/subscriptions.d.ts.map +1 -0
- package/resources/devicereachabilitystatus/subscriptions.js +114 -0
- package/resources/devicereachabilitystatus/subscriptions.js.map +1 -0
- package/resources/devicereachabilitystatus/subscriptions.mjs +110 -0
- package/resources/devicereachabilitystatus/subscriptions.mjs.map +1 -0
- package/resources/devicereachabilitystatus.d.mts +2 -0
- package/resources/devicereachabilitystatus.d.mts.map +1 -0
- package/resources/devicereachabilitystatus.d.ts +2 -0
- package/resources/devicereachabilitystatus.d.ts.map +1 -0
- package/resources/devicereachabilitystatus.js +6 -0
- package/resources/devicereachabilitystatus.js.map +1 -0
- package/resources/devicereachabilitystatus.mjs +3 -0
- package/resources/devicereachabilitystatus.mjs.map +1 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.d.mts +10 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.d.mts.map +1 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.d.ts +10 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.d.ts.map +1 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.js +17 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.js.map +1 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.mjs +12 -0
- package/resources/deviceroamingstatus/deviceroamingstatus.mjs.map +1 -0
- package/resources/deviceroamingstatus/index.d.mts +3 -0
- package/resources/deviceroamingstatus/index.d.mts.map +1 -0
- package/resources/deviceroamingstatus/index.d.ts +3 -0
- package/resources/deviceroamingstatus/index.d.ts.map +1 -0
- package/resources/deviceroamingstatus/index.js +9 -0
- package/resources/deviceroamingstatus/index.js.map +1 -0
- package/resources/deviceroamingstatus/index.mjs +4 -0
- package/resources/deviceroamingstatus/index.mjs.map +1 -0
- package/resources/deviceroamingstatus/subscriptions.d.mts +391 -0
- package/resources/deviceroamingstatus/subscriptions.d.mts.map +1 -0
- package/resources/deviceroamingstatus/subscriptions.d.ts +391 -0
- package/resources/deviceroamingstatus/subscriptions.d.ts.map +1 -0
- package/resources/deviceroamingstatus/subscriptions.js +113 -0
- package/resources/deviceroamingstatus/subscriptions.js.map +1 -0
- package/resources/deviceroamingstatus/subscriptions.mjs +109 -0
- package/resources/deviceroamingstatus/subscriptions.mjs.map +1 -0
- package/resources/deviceroamingstatus.d.mts +2 -0
- package/resources/deviceroamingstatus.d.mts.map +1 -0
- package/resources/deviceroamingstatus.d.ts +2 -0
- package/resources/deviceroamingstatus.d.ts.map +1 -0
- package/resources/deviceroamingstatus.js +6 -0
- package/resources/deviceroamingstatus.js.map +1 -0
- package/resources/deviceroamingstatus.mjs +3 -0
- package/resources/deviceroamingstatus.mjs.map +1 -0
- package/resources/deviceswap.d.mts +81 -0
- package/resources/deviceswap.d.mts.map +1 -0
- package/resources/deviceswap.d.ts +81 -0
- package/resources/deviceswap.d.ts.map +1 -0
- package/resources/deviceswap.js +51 -0
- package/resources/deviceswap.js.map +1 -0
- package/resources/deviceswap.mjs +47 -0
- package/resources/deviceswap.mjs.map +1 -0
- package/resources/index.d.mts +21 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +21 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +45 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +22 -0
- package/resources/index.mjs.map +1 -0
- package/resources/knowyourcustomerageverification.d.mts +168 -0
- package/resources/knowyourcustomerageverification.d.mts.map +1 -0
- package/resources/knowyourcustomerageverification.d.ts +168 -0
- package/resources/knowyourcustomerageverification.d.ts.map +1 -0
- package/resources/knowyourcustomerageverification.js +67 -0
- package/resources/knowyourcustomerageverification.js.map +1 -0
- package/resources/knowyourcustomerageverification.mjs +63 -0
- package/resources/knowyourcustomerageverification.mjs.map +1 -0
- package/resources/knowyourcustomerfill-in.d.mts +165 -0
- package/resources/knowyourcustomerfill-in.d.mts.map +1 -0
- package/resources/knowyourcustomerfill-in.d.ts +165 -0
- package/resources/knowyourcustomerfill-in.d.ts.map +1 -0
- package/resources/knowyourcustomerfill-in.js +33 -0
- package/resources/knowyourcustomerfill-in.js.map +1 -0
- package/resources/knowyourcustomerfill-in.mjs +29 -0
- package/resources/knowyourcustomerfill-in.mjs.map +1 -0
- package/resources/knowyourcustomermatch.d.mts +492 -0
- package/resources/knowyourcustomermatch.d.mts.map +1 -0
- package/resources/knowyourcustomermatch.d.ts +492 -0
- package/resources/knowyourcustomermatch.d.ts.map +1 -0
- package/resources/knowyourcustomermatch.js +85 -0
- package/resources/knowyourcustomermatch.js.map +1 -0
- package/resources/knowyourcustomermatch.mjs +81 -0
- package/resources/knowyourcustomermatch.mjs.map +1 -0
- package/resources/numberrecycling.d.mts +47 -0
- package/resources/numberrecycling.d.mts.map +1 -0
- package/resources/numberrecycling.d.ts +47 -0
- package/resources/numberrecycling.d.ts.map +1 -0
- package/resources/numberrecycling.js +32 -0
- package/resources/numberrecycling.js.map +1 -0
- package/resources/numberrecycling.mjs +28 -0
- package/resources/numberrecycling.mjs.map +1 -0
- package/resources/otpvalidation.d.mts +77 -0
- package/resources/otpvalidation.d.mts.map +1 -0
- package/resources/otpvalidation.d.ts +77 -0
- package/resources/otpvalidation.d.ts.map +1 -0
- package/resources/otpvalidation.js +56 -0
- package/resources/otpvalidation.js.map +1 -0
- package/resources/otpvalidation.mjs +52 -0
- package/resources/otpvalidation.mjs.map +1 -0
- package/resources/populationdensitydata.d.mts +180 -0
- package/resources/populationdensitydata.d.mts.map +1 -0
- package/resources/populationdensitydata.d.ts +180 -0
- package/resources/populationdensitydata.d.ts.map +1 -0
- package/resources/populationdensitydata.js +47 -0
- package/resources/populationdensitydata.js.map +1 -0
- package/resources/populationdensitydata.mjs +43 -0
- package/resources/populationdensitydata.mjs.map +1 -0
- package/resources/qualityondemand.d.mts +406 -0
- package/resources/qualityondemand.d.mts.map +1 -0
- package/resources/qualityondemand.d.ts +406 -0
- package/resources/qualityondemand.d.ts.map +1 -0
- package/resources/qualityondemand.js +73 -0
- package/resources/qualityondemand.js.map +1 -0
- package/resources/qualityondemand.mjs +69 -0
- package/resources/qualityondemand.mjs.map +1 -0
- package/resources/regiondevicecount.d.mts +178 -0
- package/resources/regiondevicecount.d.mts.map +1 -0
- package/resources/regiondevicecount.d.ts +178 -0
- package/resources/regiondevicecount.d.ts.map +1 -0
- package/resources/regiondevicecount.js +57 -0
- package/resources/regiondevicecount.js.map +1 -0
- package/resources/regiondevicecount.mjs +53 -0
- package/resources/regiondevicecount.mjs.map +1 -0
- package/resources/simswap/index.d.mts +3 -0
- package/resources/simswap/index.d.mts.map +1 -0
- package/resources/simswap/index.d.ts +3 -0
- package/resources/simswap/index.d.ts.map +1 -0
- package/resources/simswap/index.js +9 -0
- package/resources/simswap/index.js.map +1 -0
- package/resources/simswap/index.mjs +4 -0
- package/resources/simswap/index.mjs.map +1 -0
- package/resources/simswap/simswap.d.mts +10 -0
- package/resources/simswap/simswap.d.mts.map +1 -0
- package/resources/simswap/simswap.d.ts +10 -0
- package/resources/simswap/simswap.d.ts.map +1 -0
- package/resources/simswap/simswap.js +17 -0
- package/resources/simswap/simswap.js.map +1 -0
- package/resources/simswap/simswap.mjs +12 -0
- package/resources/simswap/simswap.mjs.map +1 -0
- package/resources/simswap/subscriptions.d.mts +264 -0
- package/resources/simswap/subscriptions.d.mts.map +1 -0
- package/resources/simswap/subscriptions.d.ts +264 -0
- package/resources/simswap/subscriptions.d.ts.map +1 -0
- package/resources/simswap/subscriptions.js +109 -0
- package/resources/simswap/subscriptions.js.map +1 -0
- package/resources/simswap/subscriptions.mjs +105 -0
- package/resources/simswap/subscriptions.mjs.map +1 -0
- package/resources/simswap.d.mts +2 -0
- package/resources/simswap.d.mts.map +1 -0
- package/resources/simswap.d.ts +2 -0
- package/resources/simswap.d.ts.map +1 -0
- package/resources/simswap.js +6 -0
- package/resources/simswap.js.map +1 -0
- package/resources/simswap.mjs +3 -0
- package/resources/simswap.mjs.map +1 -0
- package/resources/tenure.d.mts +59 -0
- package/resources/tenure.d.mts.map +1 -0
- package/resources/tenure.d.ts +59 -0
- package/resources/tenure.d.ts.map +1 -0
- package/resources/tenure.js +33 -0
- package/resources/tenure.js.map +1 -0
- package/resources/tenure.mjs +29 -0
- package/resources/tenure.mjs.map +1 -0
- package/resources/webrtc/index.d.mts +3 -0
- package/resources/webrtc/index.d.mts.map +1 -0
- package/resources/webrtc/index.d.ts +3 -0
- package/resources/webrtc/index.d.ts.map +1 -0
- package/resources/webrtc/index.js +9 -0
- package/resources/webrtc/index.js.map +1 -0
- package/resources/webrtc/index.mjs +4 -0
- package/resources/webrtc/index.mjs.map +1 -0
- package/resources/webrtc/sessions.d.mts +358 -0
- package/resources/webrtc/sessions.d.mts.map +1 -0
- package/resources/webrtc/sessions.d.ts +358 -0
- package/resources/webrtc/sessions.d.ts.map +1 -0
- package/resources/webrtc/sessions.js +115 -0
- package/resources/webrtc/sessions.js.map +1 -0
- package/resources/webrtc/sessions.mjs +111 -0
- package/resources/webrtc/sessions.mjs.map +1 -0
- package/resources/webrtc/webrtc.d.mts +10 -0
- package/resources/webrtc/webrtc.d.mts.map +1 -0
- package/resources/webrtc/webrtc.d.ts +10 -0
- package/resources/webrtc/webrtc.d.ts.map +1 -0
- package/resources/webrtc/webrtc.js +17 -0
- package/resources/webrtc/webrtc.js.map +1 -0
- package/resources/webrtc/webrtc.mjs +12 -0
- package/resources/webrtc/webrtc.mjs.map +1 -0
- package/resources/webrtc.d.mts +2 -0
- package/resources/webrtc.d.mts.map +1 -0
- package/resources/webrtc.d.ts +2 -0
- package/resources/webrtc.d.ts.map +1 -0
- package/resources/webrtc.js +6 -0
- package/resources/webrtc.js.map +1 -0
- package/resources/webrtc.mjs +3 -0
- package/resources/webrtc.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +1146 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/callforwardingsignal.ts +140 -0
- package/src/resources/connectednetworktype/connectednetworktype.ts +39 -0
- package/src/resources/connectednetworktype/index.ts +16 -0
- package/src/resources/connectednetworktype/subscriptions.ts +485 -0
- package/src/resources/connectednetworktype.ts +3 -0
- package/src/resources/connectivityinsights/connectivityinsights.ts +39 -0
- package/src/resources/connectivityinsights/index.ts +16 -0
- package/src/resources/connectivityinsights/subscriptions.ts +556 -0
- package/src/resources/connectivityinsights.ts +3 -0
- package/src/resources/customerinsights/customerinsights.ts +19 -0
- package/src/resources/customerinsights/index.ts +4 -0
- package/src/resources/customerinsights/scoring.ts +94 -0
- package/src/resources/customerinsights.ts +3 -0
- package/src/resources/deviceidentifier.ts +418 -0
- package/src/resources/devicelocation/devicelocation.ts +43 -0
- package/src/resources/devicelocation/index.ts +18 -0
- package/src/resources/devicelocation/subscriptions.ts +558 -0
- package/src/resources/devicelocation.ts +3 -0
- package/src/resources/devicereachabilitystatus/devicereachabilitystatus.ts +39 -0
- package/src/resources/devicereachabilitystatus/index.ts +16 -0
- package/src/resources/devicereachabilitystatus/subscriptions.ts +494 -0
- package/src/resources/devicereachabilitystatus.ts +3 -0
- package/src/resources/deviceroamingstatus/deviceroamingstatus.ts +39 -0
- package/src/resources/deviceroamingstatus/index.ts +16 -0
- package/src/resources/deviceroamingstatus/subscriptions.ts +499 -0
- package/src/resources/deviceroamingstatus.ts +3 -0
- package/src/resources/deviceswap.ts +122 -0
- package/src/resources/index.ts +85 -0
- package/src/resources/knowyourcustomerageverification.ts +206 -0
- package/src/resources/knowyourcustomerfill-in.ts +219 -0
- package/src/resources/knowyourcustomermatch.ts +585 -0
- package/src/resources/numberrecycling.ts +71 -0
- package/src/resources/otpvalidation.ts +116 -0
- package/src/resources/populationdensitydata.ts +217 -0
- package/src/resources/qualityondemand.ts +493 -0
- package/src/resources/regiondevicecount.ts +216 -0
- package/src/resources/simswap/index.ts +16 -0
- package/src/resources/simswap/simswap.ts +39 -0
- package/src/resources/simswap/subscriptions.ts +357 -0
- package/src/resources/simswap.ts +3 -0
- package/src/resources/tenure.ts +78 -0
- package/src/resources/webrtc/index.ts +12 -0
- package/src/resources/webrtc/sessions.ts +519 -0
- package/src/resources/webrtc/webrtc.ts +31 -0
- package/src/resources/webrtc.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
package/client.mjs
ADDED
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
var _Camara_instances, _a, _Camara_encoder, _Camara_baseURLOverridden;
|
|
3
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
|
|
4
|
+
import { uuid4 } from "./internal/utils/uuid.mjs";
|
|
5
|
+
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
|
|
6
|
+
import { sleep } from "./internal/utils/sleep.mjs";
|
|
7
|
+
import { castToError, isAbortError } from "./internal/errors.mjs";
|
|
8
|
+
import { getPlatformHeaders } from "./internal/detect-platform.mjs";
|
|
9
|
+
import * as Shims from "./internal/shims.mjs";
|
|
10
|
+
import * as Opts from "./internal/request-options.mjs";
|
|
11
|
+
import { VERSION } from "./version.mjs";
|
|
12
|
+
import * as Errors from "./core/error.mjs";
|
|
13
|
+
import * as Uploads from "./core/uploads.mjs";
|
|
14
|
+
import * as API from "./resources/index.mjs";
|
|
15
|
+
import { APIPromise } from "./core/api-promise.mjs";
|
|
16
|
+
import { Callforwardingsignal, } from "./resources/callforwardingsignal.mjs";
|
|
17
|
+
import { Deviceidentifier, } from "./resources/deviceidentifier.mjs";
|
|
18
|
+
import { Deviceswap, } from "./resources/deviceswap.mjs";
|
|
19
|
+
import { Knowyourcustomerageverification, } from "./resources/knowyourcustomerageverification.mjs";
|
|
20
|
+
import { KnowyourcustomerfillIn, } from "./resources/knowyourcustomerfill-in.mjs";
|
|
21
|
+
import { Knowyourcustomermatch, } from "./resources/knowyourcustomermatch.mjs";
|
|
22
|
+
import { Numberrecycling, } from "./resources/numberrecycling.mjs";
|
|
23
|
+
import { Otpvalidation, } from "./resources/otpvalidation.mjs";
|
|
24
|
+
import { Populationdensitydata, } from "./resources/populationdensitydata.mjs";
|
|
25
|
+
import { Qualityondemand, } from "./resources/qualityondemand.mjs";
|
|
26
|
+
import { Regiondevicecount, } from "./resources/regiondevicecount.mjs";
|
|
27
|
+
import { Tenure } from "./resources/tenure.mjs";
|
|
28
|
+
import { Connectednetworktype } from "./resources/connectednetworktype/connectednetworktype.mjs";
|
|
29
|
+
import { Connectivityinsights } from "./resources/connectivityinsights/connectivityinsights.mjs";
|
|
30
|
+
import { Customerinsights } from "./resources/customerinsights/customerinsights.mjs";
|
|
31
|
+
import { Devicelocation } from "./resources/devicelocation/devicelocation.mjs";
|
|
32
|
+
import { Devicereachabilitystatus } from "./resources/devicereachabilitystatus/devicereachabilitystatus.mjs";
|
|
33
|
+
import { Deviceroamingstatus } from "./resources/deviceroamingstatus/deviceroamingstatus.mjs";
|
|
34
|
+
import { Simswap } from "./resources/simswap/simswap.mjs";
|
|
35
|
+
import { Webrtc } from "./resources/webrtc/webrtc.mjs";
|
|
36
|
+
import { buildHeaders } from "./internal/headers.mjs";
|
|
37
|
+
import { readEnv } from "./internal/utils/env.mjs";
|
|
38
|
+
import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
|
|
39
|
+
import { isEmptyObj } from "./internal/utils/values.mjs";
|
|
40
|
+
/**
|
|
41
|
+
* API Client for interfacing with the Camara API.
|
|
42
|
+
*/
|
|
43
|
+
export class Camara {
|
|
44
|
+
/**
|
|
45
|
+
* API Client for interfacing with the Camara API.
|
|
46
|
+
*
|
|
47
|
+
* @param {string | undefined} [opts.deviceLocationNotificationsAPIKey=process.env['CAMARA_DEVICE_LOCATION_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
48
|
+
* @param {string | undefined} [opts.notificationsAPIKey=process.env['CAMARA_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
49
|
+
* @param {string | undefined} [opts.populationDensityDataNotificationsAPIKey=process.env['CAMARA_POPULATION_DENSITY_DATA_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
50
|
+
* @param {string | undefined} [opts.regionDeviceCountNotificationsAPIKey=process.env['CAMARA_REGION_DEVICE_COUNT_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
51
|
+
* @param {string | undefined} [opts.connectivityInsightsNotificationsAPIKey=process.env['CAMARA_CONNECTIVITY_INSIGHTS_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
52
|
+
* @param {string | undefined} [opts.simSwapNotificationsAPIKey=process.env['CAMARA_SIM_SWAP_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
53
|
+
* @param {string | undefined} [opts.deviceRoamingStatusNotificationsAPIKey=process.env['CAMARA_DEVICE_ROAMING_STATUS_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
54
|
+
* @param {string | undefined} [opts.deviceReachabilityStatusNotificationsAPIKey=process.env['CAMARA_DEVICE_REACHABILITY_STATUS_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
55
|
+
* @param {string | undefined} [opts.connectedNetworkTypeNotificationsAPIKey=process.env['CAMARA_CONNECTED_NETWORK_TYPE_NOTIFICATIONS_API_KEY'] ?? undefined]
|
|
56
|
+
* @param {string} [opts.baseURL=process.env['CAMARA_BASE_URL'] ?? https://api.example.com/camara] - Override the default base URL for the API.
|
|
57
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
58
|
+
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
59
|
+
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
60
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
61
|
+
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
62
|
+
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
63
|
+
*/
|
|
64
|
+
constructor({ baseURL = readEnv('CAMARA_BASE_URL'), deviceLocationNotificationsAPIKey = readEnv('CAMARA_DEVICE_LOCATION_NOTIFICATIONS_API_KEY'), notificationsAPIKey = readEnv('CAMARA_NOTIFICATIONS_API_KEY'), populationDensityDataNotificationsAPIKey = readEnv('CAMARA_POPULATION_DENSITY_DATA_NOTIFICATIONS_API_KEY'), regionDeviceCountNotificationsAPIKey = readEnv('CAMARA_REGION_DEVICE_COUNT_NOTIFICATIONS_API_KEY'), connectivityInsightsNotificationsAPIKey = readEnv('CAMARA_CONNECTIVITY_INSIGHTS_NOTIFICATIONS_API_KEY'), simSwapNotificationsAPIKey = readEnv('CAMARA_SIM_SWAP_NOTIFICATIONS_API_KEY'), deviceRoamingStatusNotificationsAPIKey = readEnv('CAMARA_DEVICE_ROAMING_STATUS_NOTIFICATIONS_API_KEY'), deviceReachabilityStatusNotificationsAPIKey = readEnv('CAMARA_DEVICE_REACHABILITY_STATUS_NOTIFICATIONS_API_KEY'), connectedNetworkTypeNotificationsAPIKey = readEnv('CAMARA_CONNECTED_NETWORK_TYPE_NOTIFICATIONS_API_KEY'), ...opts } = {}) {
|
|
65
|
+
_Camara_instances.add(this);
|
|
66
|
+
_Camara_encoder.set(this, void 0);
|
|
67
|
+
this.customerinsights = new API.Customerinsights(this);
|
|
68
|
+
this.deviceswap = new API.Deviceswap(this);
|
|
69
|
+
this.knowyourcustomerageverification = new API.Knowyourcustomerageverification(this);
|
|
70
|
+
this.knowyourcustomerfillIn = new API.KnowyourcustomerfillIn(this);
|
|
71
|
+
this.knowyourcustomermatch = new API.Knowyourcustomermatch(this);
|
|
72
|
+
this.tenure = new API.Tenure(this);
|
|
73
|
+
this.numberrecycling = new API.Numberrecycling(this);
|
|
74
|
+
this.otpvalidation = new API.Otpvalidation(this);
|
|
75
|
+
this.callforwardingsignal = new API.Callforwardingsignal(this);
|
|
76
|
+
this.devicelocation = new API.Devicelocation(this);
|
|
77
|
+
this.populationdensitydata = new API.Populationdensitydata(this);
|
|
78
|
+
this.regiondevicecount = new API.Regiondevicecount(this);
|
|
79
|
+
this.webrtc = new API.Webrtc(this);
|
|
80
|
+
this.connectivityinsights = new API.Connectivityinsights(this);
|
|
81
|
+
this.qualityondemand = new API.Qualityondemand(this);
|
|
82
|
+
this.deviceidentifier = new API.Deviceidentifier(this);
|
|
83
|
+
this.simswap = new API.Simswap(this);
|
|
84
|
+
this.deviceroamingstatus = new API.Deviceroamingstatus(this);
|
|
85
|
+
this.devicereachabilitystatus = new API.Devicereachabilitystatus(this);
|
|
86
|
+
this.connectednetworktype = new API.Connectednetworktype(this);
|
|
87
|
+
if (deviceLocationNotificationsAPIKey === undefined) {
|
|
88
|
+
throw new Errors.CamaraError("The CAMARA_DEVICE_LOCATION_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an deviceLocationNotificationsAPIKey option, like new Camara({ deviceLocationNotificationsAPIKey: 'My Device Location Notifications API Key' }).");
|
|
89
|
+
}
|
|
90
|
+
if (notificationsAPIKey === undefined) {
|
|
91
|
+
throw new Errors.CamaraError("The CAMARA_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an notificationsAPIKey option, like new Camara({ notificationsAPIKey: 'My Notifications API Key' }).");
|
|
92
|
+
}
|
|
93
|
+
if (populationDensityDataNotificationsAPIKey === undefined) {
|
|
94
|
+
throw new Errors.CamaraError("The CAMARA_POPULATION_DENSITY_DATA_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an populationDensityDataNotificationsAPIKey option, like new Camara({ populationDensityDataNotificationsAPIKey: 'My Population Density Data Notifications API Key' }).");
|
|
95
|
+
}
|
|
96
|
+
if (regionDeviceCountNotificationsAPIKey === undefined) {
|
|
97
|
+
throw new Errors.CamaraError("The CAMARA_REGION_DEVICE_COUNT_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an regionDeviceCountNotificationsAPIKey option, like new Camara({ regionDeviceCountNotificationsAPIKey: 'My Region Device Count Notifications API Key' }).");
|
|
98
|
+
}
|
|
99
|
+
if (connectivityInsightsNotificationsAPIKey === undefined) {
|
|
100
|
+
throw new Errors.CamaraError("The CAMARA_CONNECTIVITY_INSIGHTS_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an connectivityInsightsNotificationsAPIKey option, like new Camara({ connectivityInsightsNotificationsAPIKey: 'My Connectivity Insights Notifications API Key' }).");
|
|
101
|
+
}
|
|
102
|
+
if (simSwapNotificationsAPIKey === undefined) {
|
|
103
|
+
throw new Errors.CamaraError("The CAMARA_SIM_SWAP_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an simSwapNotificationsAPIKey option, like new Camara({ simSwapNotificationsAPIKey: 'My Sim Swap Notifications API Key' }).");
|
|
104
|
+
}
|
|
105
|
+
if (deviceRoamingStatusNotificationsAPIKey === undefined) {
|
|
106
|
+
throw new Errors.CamaraError("The CAMARA_DEVICE_ROAMING_STATUS_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an deviceRoamingStatusNotificationsAPIKey option, like new Camara({ deviceRoamingStatusNotificationsAPIKey: 'My Device Roaming Status Notifications API Key' }).");
|
|
107
|
+
}
|
|
108
|
+
if (deviceReachabilityStatusNotificationsAPIKey === undefined) {
|
|
109
|
+
throw new Errors.CamaraError("The CAMARA_DEVICE_REACHABILITY_STATUS_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an deviceReachabilityStatusNotificationsAPIKey option, like new Camara({ deviceReachabilityStatusNotificationsAPIKey: 'My Device Reachability Status Notifications API Key' }).");
|
|
110
|
+
}
|
|
111
|
+
if (connectedNetworkTypeNotificationsAPIKey === undefined) {
|
|
112
|
+
throw new Errors.CamaraError("The CAMARA_CONNECTED_NETWORK_TYPE_NOTIFICATIONS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Camara client with an connectedNetworkTypeNotificationsAPIKey option, like new Camara({ connectedNetworkTypeNotificationsAPIKey: 'My Connected Network Type Notifications API Key' }).");
|
|
113
|
+
}
|
|
114
|
+
const options = {
|
|
115
|
+
deviceLocationNotificationsAPIKey,
|
|
116
|
+
notificationsAPIKey,
|
|
117
|
+
populationDensityDataNotificationsAPIKey,
|
|
118
|
+
regionDeviceCountNotificationsAPIKey,
|
|
119
|
+
connectivityInsightsNotificationsAPIKey,
|
|
120
|
+
simSwapNotificationsAPIKey,
|
|
121
|
+
deviceRoamingStatusNotificationsAPIKey,
|
|
122
|
+
deviceReachabilityStatusNotificationsAPIKey,
|
|
123
|
+
connectedNetworkTypeNotificationsAPIKey,
|
|
124
|
+
...opts,
|
|
125
|
+
baseURL: baseURL || `https://api.example.com/camara`,
|
|
126
|
+
};
|
|
127
|
+
this.baseURL = options.baseURL;
|
|
128
|
+
this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
|
|
129
|
+
this.logger = options.logger ?? console;
|
|
130
|
+
const defaultLogLevel = 'warn';
|
|
131
|
+
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
132
|
+
this.logLevel = defaultLogLevel;
|
|
133
|
+
this.logLevel =
|
|
134
|
+
parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
|
|
135
|
+
parseLogLevel(readEnv('CAMARA_LOG'), "process.env['CAMARA_LOG']", this) ??
|
|
136
|
+
defaultLogLevel;
|
|
137
|
+
this.fetchOptions = options.fetchOptions;
|
|
138
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
139
|
+
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
140
|
+
__classPrivateFieldSet(this, _Camara_encoder, Opts.FallbackEncoder, "f");
|
|
141
|
+
this._options = options;
|
|
142
|
+
this.deviceLocationNotificationsAPIKey = deviceLocationNotificationsAPIKey;
|
|
143
|
+
this.notificationsAPIKey = notificationsAPIKey;
|
|
144
|
+
this.populationDensityDataNotificationsAPIKey = populationDensityDataNotificationsAPIKey;
|
|
145
|
+
this.regionDeviceCountNotificationsAPIKey = regionDeviceCountNotificationsAPIKey;
|
|
146
|
+
this.connectivityInsightsNotificationsAPIKey = connectivityInsightsNotificationsAPIKey;
|
|
147
|
+
this.simSwapNotificationsAPIKey = simSwapNotificationsAPIKey;
|
|
148
|
+
this.deviceRoamingStatusNotificationsAPIKey = deviceRoamingStatusNotificationsAPIKey;
|
|
149
|
+
this.deviceReachabilityStatusNotificationsAPIKey = deviceReachabilityStatusNotificationsAPIKey;
|
|
150
|
+
this.connectedNetworkTypeNotificationsAPIKey = connectedNetworkTypeNotificationsAPIKey;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
154
|
+
*/
|
|
155
|
+
withOptions(options) {
|
|
156
|
+
const client = new this.constructor({
|
|
157
|
+
...this._options,
|
|
158
|
+
baseURL: this.baseURL,
|
|
159
|
+
maxRetries: this.maxRetries,
|
|
160
|
+
timeout: this.timeout,
|
|
161
|
+
logger: this.logger,
|
|
162
|
+
logLevel: this.logLevel,
|
|
163
|
+
fetch: this.fetch,
|
|
164
|
+
fetchOptions: this.fetchOptions,
|
|
165
|
+
deviceLocationNotificationsAPIKey: this.deviceLocationNotificationsAPIKey,
|
|
166
|
+
notificationsAPIKey: this.notificationsAPIKey,
|
|
167
|
+
populationDensityDataNotificationsAPIKey: this.populationDensityDataNotificationsAPIKey,
|
|
168
|
+
regionDeviceCountNotificationsAPIKey: this.regionDeviceCountNotificationsAPIKey,
|
|
169
|
+
connectivityInsightsNotificationsAPIKey: this.connectivityInsightsNotificationsAPIKey,
|
|
170
|
+
simSwapNotificationsAPIKey: this.simSwapNotificationsAPIKey,
|
|
171
|
+
deviceRoamingStatusNotificationsAPIKey: this.deviceRoamingStatusNotificationsAPIKey,
|
|
172
|
+
deviceReachabilityStatusNotificationsAPIKey: this.deviceReachabilityStatusNotificationsAPIKey,
|
|
173
|
+
connectedNetworkTypeNotificationsAPIKey: this.connectedNetworkTypeNotificationsAPIKey,
|
|
174
|
+
...options,
|
|
175
|
+
});
|
|
176
|
+
return client;
|
|
177
|
+
}
|
|
178
|
+
defaultQuery() {
|
|
179
|
+
return this._options.defaultQuery;
|
|
180
|
+
}
|
|
181
|
+
validateHeaders({ values, nulls }) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
async authHeaders(opts) {
|
|
185
|
+
return buildHeaders([
|
|
186
|
+
await this.deviceLocationnotificationsBearerAuth(opts),
|
|
187
|
+
await this.notificationsBearerAuth(opts),
|
|
188
|
+
await this.populationDensityDatanotificationsBearerAuth(opts),
|
|
189
|
+
await this.regionDeviceCountnotificationsBearerAuth(opts),
|
|
190
|
+
await this.connectivityInsightsnotificationsBearerAuth(opts),
|
|
191
|
+
await this.simSwapnotificationsBearerAuth(opts),
|
|
192
|
+
await this.deviceRoamingStatusnotificationsBearerAuth(opts),
|
|
193
|
+
await this.deviceReachabilityStatusnotificationsBearerAuth(opts),
|
|
194
|
+
await this.connectedNetworkTypenotificationsBearerAuth(opts),
|
|
195
|
+
]);
|
|
196
|
+
}
|
|
197
|
+
async deviceLocationnotificationsBearerAuth(opts) {
|
|
198
|
+
return buildHeaders([{ Authorization: `Bearer ${this.deviceLocationNotificationsAPIKey}` }]);
|
|
199
|
+
}
|
|
200
|
+
async notificationsBearerAuth(opts) {
|
|
201
|
+
return buildHeaders([{ Authorization: `Bearer ${this.notificationsAPIKey}` }]);
|
|
202
|
+
}
|
|
203
|
+
async populationDensityDatanotificationsBearerAuth(opts) {
|
|
204
|
+
return buildHeaders([{ Authorization: `Bearer ${this.populationDensityDataNotificationsAPIKey}` }]);
|
|
205
|
+
}
|
|
206
|
+
async regionDeviceCountnotificationsBearerAuth(opts) {
|
|
207
|
+
return buildHeaders([{ Authorization: `Bearer ${this.regionDeviceCountNotificationsAPIKey}` }]);
|
|
208
|
+
}
|
|
209
|
+
async connectivityInsightsnotificationsBearerAuth(opts) {
|
|
210
|
+
return buildHeaders([{ Authorization: `Bearer ${this.connectivityInsightsNotificationsAPIKey}` }]);
|
|
211
|
+
}
|
|
212
|
+
async simSwapnotificationsBearerAuth(opts) {
|
|
213
|
+
return buildHeaders([{ Authorization: `Bearer ${this.simSwapNotificationsAPIKey}` }]);
|
|
214
|
+
}
|
|
215
|
+
async deviceRoamingStatusnotificationsBearerAuth(opts) {
|
|
216
|
+
return buildHeaders([{ Authorization: `Bearer ${this.deviceRoamingStatusNotificationsAPIKey}` }]);
|
|
217
|
+
}
|
|
218
|
+
async deviceReachabilityStatusnotificationsBearerAuth(opts) {
|
|
219
|
+
return buildHeaders([{ Authorization: `Bearer ${this.deviceReachabilityStatusNotificationsAPIKey}` }]);
|
|
220
|
+
}
|
|
221
|
+
async connectedNetworkTypenotificationsBearerAuth(opts) {
|
|
222
|
+
return buildHeaders([{ Authorization: `Bearer ${this.connectedNetworkTypeNotificationsAPIKey}` }]);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
226
|
+
*/
|
|
227
|
+
stringifyQuery(query) {
|
|
228
|
+
return Object.entries(query)
|
|
229
|
+
.filter(([_, value]) => typeof value !== 'undefined')
|
|
230
|
+
.map(([key, value]) => {
|
|
231
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
232
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
233
|
+
}
|
|
234
|
+
if (value === null) {
|
|
235
|
+
return `${encodeURIComponent(key)}=`;
|
|
236
|
+
}
|
|
237
|
+
throw new Errors.CamaraError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
|
|
238
|
+
})
|
|
239
|
+
.join('&');
|
|
240
|
+
}
|
|
241
|
+
getUserAgent() {
|
|
242
|
+
return `${this.constructor.name}/JS ${VERSION}`;
|
|
243
|
+
}
|
|
244
|
+
defaultIdempotencyKey() {
|
|
245
|
+
return `stainless-node-retry-${uuid4()}`;
|
|
246
|
+
}
|
|
247
|
+
makeStatusError(status, error, message, headers) {
|
|
248
|
+
return Errors.APIError.generate(status, error, message, headers);
|
|
249
|
+
}
|
|
250
|
+
buildURL(path, query, defaultBaseURL) {
|
|
251
|
+
const baseURL = (!__classPrivateFieldGet(this, _Camara_instances, "m", _Camara_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
|
|
252
|
+
const url = isAbsoluteURL(path) ?
|
|
253
|
+
new URL(path)
|
|
254
|
+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
255
|
+
const defaultQuery = this.defaultQuery();
|
|
256
|
+
if (!isEmptyObj(defaultQuery)) {
|
|
257
|
+
query = { ...defaultQuery, ...query };
|
|
258
|
+
}
|
|
259
|
+
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
260
|
+
url.search = this.stringifyQuery(query);
|
|
261
|
+
}
|
|
262
|
+
return url.toString();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
266
|
+
*/
|
|
267
|
+
async prepareOptions(options) { }
|
|
268
|
+
/**
|
|
269
|
+
* Used as a callback for mutating the given `RequestInit` object.
|
|
270
|
+
*
|
|
271
|
+
* This is useful for cases where you want to add certain headers based off of
|
|
272
|
+
* the request properties, e.g. `method` or `url`.
|
|
273
|
+
*/
|
|
274
|
+
async prepareRequest(request, { url, options }) { }
|
|
275
|
+
get(path, opts) {
|
|
276
|
+
return this.methodRequest('get', path, opts);
|
|
277
|
+
}
|
|
278
|
+
post(path, opts) {
|
|
279
|
+
return this.methodRequest('post', path, opts);
|
|
280
|
+
}
|
|
281
|
+
patch(path, opts) {
|
|
282
|
+
return this.methodRequest('patch', path, opts);
|
|
283
|
+
}
|
|
284
|
+
put(path, opts) {
|
|
285
|
+
return this.methodRequest('put', path, opts);
|
|
286
|
+
}
|
|
287
|
+
delete(path, opts) {
|
|
288
|
+
return this.methodRequest('delete', path, opts);
|
|
289
|
+
}
|
|
290
|
+
methodRequest(method, path, opts) {
|
|
291
|
+
return this.request(Promise.resolve(opts).then((opts) => {
|
|
292
|
+
return { method, path, ...opts };
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
request(options, remainingRetries = null) {
|
|
296
|
+
return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
|
|
297
|
+
}
|
|
298
|
+
async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
|
|
299
|
+
const options = await optionsInput;
|
|
300
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
301
|
+
if (retriesRemaining == null) {
|
|
302
|
+
retriesRemaining = maxRetries;
|
|
303
|
+
}
|
|
304
|
+
await this.prepareOptions(options);
|
|
305
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
306
|
+
retryCount: maxRetries - retriesRemaining,
|
|
307
|
+
});
|
|
308
|
+
await this.prepareRequest(req, { url, options });
|
|
309
|
+
/** Not an API request ID, just for correlating local log entries. */
|
|
310
|
+
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
|
|
311
|
+
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
|
|
312
|
+
const startTime = Date.now();
|
|
313
|
+
loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
|
|
314
|
+
retryOfRequestLogID,
|
|
315
|
+
method: options.method,
|
|
316
|
+
url,
|
|
317
|
+
options,
|
|
318
|
+
headers: req.headers,
|
|
319
|
+
}));
|
|
320
|
+
if (options.signal?.aborted) {
|
|
321
|
+
throw new Errors.APIUserAbortError();
|
|
322
|
+
}
|
|
323
|
+
const controller = new AbortController();
|
|
324
|
+
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
325
|
+
const headersTime = Date.now();
|
|
326
|
+
if (response instanceof globalThis.Error) {
|
|
327
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
328
|
+
if (options.signal?.aborted) {
|
|
329
|
+
throw new Errors.APIUserAbortError();
|
|
330
|
+
}
|
|
331
|
+
// detect native connection timeout errors
|
|
332
|
+
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
|
|
333
|
+
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
|
|
334
|
+
// others do not provide enough information to distinguish timeouts from other connection errors
|
|
335
|
+
const isTimeout = isAbortError(response) ||
|
|
336
|
+
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
|
|
337
|
+
if (retriesRemaining) {
|
|
338
|
+
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
|
|
339
|
+
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({
|
|
340
|
+
retryOfRequestLogID,
|
|
341
|
+
url,
|
|
342
|
+
durationMs: headersTime - startTime,
|
|
343
|
+
message: response.message,
|
|
344
|
+
}));
|
|
345
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
346
|
+
}
|
|
347
|
+
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
|
|
348
|
+
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({
|
|
349
|
+
retryOfRequestLogID,
|
|
350
|
+
url,
|
|
351
|
+
durationMs: headersTime - startTime,
|
|
352
|
+
message: response.message,
|
|
353
|
+
}));
|
|
354
|
+
if (isTimeout) {
|
|
355
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
356
|
+
}
|
|
357
|
+
throw new Errors.APIConnectionError({ cause: response });
|
|
358
|
+
}
|
|
359
|
+
const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
360
|
+
if (!response.ok) {
|
|
361
|
+
const shouldRetry = await this.shouldRetry(response);
|
|
362
|
+
if (retriesRemaining && shouldRetry) {
|
|
363
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
364
|
+
// We don't need the body of this response.
|
|
365
|
+
await Shims.CancelReadableStream(response.body);
|
|
366
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
367
|
+
loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
|
|
368
|
+
retryOfRequestLogID,
|
|
369
|
+
url: response.url,
|
|
370
|
+
status: response.status,
|
|
371
|
+
headers: response.headers,
|
|
372
|
+
durationMs: headersTime - startTime,
|
|
373
|
+
}));
|
|
374
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
|
|
375
|
+
}
|
|
376
|
+
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
|
|
377
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
378
|
+
const errText = await response.text().catch((err) => castToError(err).message);
|
|
379
|
+
const errJSON = safeJSON(errText);
|
|
380
|
+
const errMessage = errJSON ? undefined : errText;
|
|
381
|
+
loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
|
|
382
|
+
retryOfRequestLogID,
|
|
383
|
+
url: response.url,
|
|
384
|
+
status: response.status,
|
|
385
|
+
headers: response.headers,
|
|
386
|
+
message: errMessage,
|
|
387
|
+
durationMs: Date.now() - startTime,
|
|
388
|
+
}));
|
|
389
|
+
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
|
|
390
|
+
throw err;
|
|
391
|
+
}
|
|
392
|
+
loggerFor(this).info(responseInfo);
|
|
393
|
+
loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({
|
|
394
|
+
retryOfRequestLogID,
|
|
395
|
+
url: response.url,
|
|
396
|
+
status: response.status,
|
|
397
|
+
headers: response.headers,
|
|
398
|
+
durationMs: headersTime - startTime,
|
|
399
|
+
}));
|
|
400
|
+
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
401
|
+
}
|
|
402
|
+
async fetchWithTimeout(url, init, ms, controller) {
|
|
403
|
+
const { signal, method, ...options } = init || {};
|
|
404
|
+
if (signal)
|
|
405
|
+
signal.addEventListener('abort', () => controller.abort());
|
|
406
|
+
const timeout = setTimeout(() => controller.abort(), ms);
|
|
407
|
+
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
|
|
408
|
+
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
409
|
+
const fetchOptions = {
|
|
410
|
+
signal: controller.signal,
|
|
411
|
+
...(isReadableBody ? { duplex: 'half' } : {}),
|
|
412
|
+
method: 'GET',
|
|
413
|
+
...options,
|
|
414
|
+
};
|
|
415
|
+
if (method) {
|
|
416
|
+
// Custom methods like 'patch' need to be uppercased
|
|
417
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
418
|
+
fetchOptions.method = method.toUpperCase();
|
|
419
|
+
}
|
|
420
|
+
try {
|
|
421
|
+
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
422
|
+
return await this.fetch.call(undefined, url, fetchOptions);
|
|
423
|
+
}
|
|
424
|
+
finally {
|
|
425
|
+
clearTimeout(timeout);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
async shouldRetry(response) {
|
|
429
|
+
// Note this is not a standard header.
|
|
430
|
+
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
431
|
+
// If the server explicitly says whether or not to retry, obey.
|
|
432
|
+
if (shouldRetryHeader === 'true')
|
|
433
|
+
return true;
|
|
434
|
+
if (shouldRetryHeader === 'false')
|
|
435
|
+
return false;
|
|
436
|
+
// Retry on request timeouts.
|
|
437
|
+
if (response.status === 408)
|
|
438
|
+
return true;
|
|
439
|
+
// Retry on lock timeouts.
|
|
440
|
+
if (response.status === 409)
|
|
441
|
+
return true;
|
|
442
|
+
// Retry on rate limits.
|
|
443
|
+
if (response.status === 429)
|
|
444
|
+
return true;
|
|
445
|
+
// Retry internal errors.
|
|
446
|
+
if (response.status >= 500)
|
|
447
|
+
return true;
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
|
|
451
|
+
let timeoutMillis;
|
|
452
|
+
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
|
|
453
|
+
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
|
|
454
|
+
if (retryAfterMillisHeader) {
|
|
455
|
+
const timeoutMs = parseFloat(retryAfterMillisHeader);
|
|
456
|
+
if (!Number.isNaN(timeoutMs)) {
|
|
457
|
+
timeoutMillis = timeoutMs;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
461
|
+
const retryAfterHeader = responseHeaders?.get('retry-after');
|
|
462
|
+
if (retryAfterHeader && !timeoutMillis) {
|
|
463
|
+
const timeoutSeconds = parseFloat(retryAfterHeader);
|
|
464
|
+
if (!Number.isNaN(timeoutSeconds)) {
|
|
465
|
+
timeoutMillis = timeoutSeconds * 1000;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
|
|
472
|
+
// just do what it says, but otherwise calculate a default
|
|
473
|
+
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
|
|
474
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
475
|
+
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
476
|
+
}
|
|
477
|
+
await sleep(timeoutMillis);
|
|
478
|
+
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
|
|
479
|
+
}
|
|
480
|
+
calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
|
|
481
|
+
const initialRetryDelay = 0.5;
|
|
482
|
+
const maxRetryDelay = 8.0;
|
|
483
|
+
const numRetries = maxRetries - retriesRemaining;
|
|
484
|
+
// Apply exponential backoff, but not more than the max.
|
|
485
|
+
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
|
|
486
|
+
// Apply some jitter, take up to at most 25 percent of the retry time.
|
|
487
|
+
const jitter = 1 - Math.random() * 0.25;
|
|
488
|
+
return sleepSeconds * jitter * 1000;
|
|
489
|
+
}
|
|
490
|
+
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
491
|
+
const options = { ...inputOptions };
|
|
492
|
+
const { method, path, query, defaultBaseURL } = options;
|
|
493
|
+
const url = this.buildURL(path, query, defaultBaseURL);
|
|
494
|
+
if ('timeout' in options)
|
|
495
|
+
validatePositiveInteger('timeout', options.timeout);
|
|
496
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
497
|
+
const { bodyHeaders, body } = this.buildBody({ options });
|
|
498
|
+
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
499
|
+
const req = {
|
|
500
|
+
method,
|
|
501
|
+
headers: reqHeaders,
|
|
502
|
+
...(options.signal && { signal: options.signal }),
|
|
503
|
+
...(globalThis.ReadableStream &&
|
|
504
|
+
body instanceof globalThis.ReadableStream && { duplex: 'half' }),
|
|
505
|
+
...(body && { body }),
|
|
506
|
+
...(this.fetchOptions ?? {}),
|
|
507
|
+
...(options.fetchOptions ?? {}),
|
|
508
|
+
};
|
|
509
|
+
return { req, url, timeout: options.timeout };
|
|
510
|
+
}
|
|
511
|
+
async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
|
|
512
|
+
let idempotencyHeaders = {};
|
|
513
|
+
if (this.idempotencyHeader && method !== 'get') {
|
|
514
|
+
if (!options.idempotencyKey)
|
|
515
|
+
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
516
|
+
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
517
|
+
}
|
|
518
|
+
const headers = buildHeaders([
|
|
519
|
+
idempotencyHeaders,
|
|
520
|
+
{
|
|
521
|
+
Accept: 'application/json',
|
|
522
|
+
'User-Agent': this.getUserAgent(),
|
|
523
|
+
'X-Stainless-Retry-Count': String(retryCount),
|
|
524
|
+
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
525
|
+
...getPlatformHeaders(),
|
|
526
|
+
},
|
|
527
|
+
await this.authHeaders(options),
|
|
528
|
+
this._options.defaultHeaders,
|
|
529
|
+
bodyHeaders,
|
|
530
|
+
options.headers,
|
|
531
|
+
]);
|
|
532
|
+
this.validateHeaders(headers);
|
|
533
|
+
return headers.values;
|
|
534
|
+
}
|
|
535
|
+
buildBody({ options: { body, headers: rawHeaders } }) {
|
|
536
|
+
if (!body) {
|
|
537
|
+
return { bodyHeaders: undefined, body: undefined };
|
|
538
|
+
}
|
|
539
|
+
const headers = buildHeaders([rawHeaders]);
|
|
540
|
+
if (
|
|
541
|
+
// Pass raw type verbatim
|
|
542
|
+
ArrayBuffer.isView(body) ||
|
|
543
|
+
body instanceof ArrayBuffer ||
|
|
544
|
+
body instanceof DataView ||
|
|
545
|
+
(typeof body === 'string' &&
|
|
546
|
+
// Preserve legacy string encoding behavior for now
|
|
547
|
+
headers.values.has('content-type')) ||
|
|
548
|
+
// `Blob` is superset of `File`
|
|
549
|
+
(globalThis.Blob && body instanceof globalThis.Blob) ||
|
|
550
|
+
// `FormData` -> `multipart/form-data`
|
|
551
|
+
body instanceof FormData ||
|
|
552
|
+
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
553
|
+
body instanceof URLSearchParams ||
|
|
554
|
+
// Send chunked stream (each chunk has own `length`)
|
|
555
|
+
(globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
|
|
556
|
+
return { bodyHeaders: undefined, body: body };
|
|
557
|
+
}
|
|
558
|
+
else if (typeof body === 'object' &&
|
|
559
|
+
(Symbol.asyncIterator in body ||
|
|
560
|
+
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
|
|
561
|
+
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
return __classPrivateFieldGet(this, _Camara_encoder, "f").call(this, { body, headers });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
_a = Camara, _Camara_encoder = new WeakMap(), _Camara_instances = new WeakSet(), _Camara_baseURLOverridden = function _Camara_baseURLOverridden() {
|
|
569
|
+
return this.baseURL !== 'https://api.example.com/camara';
|
|
570
|
+
};
|
|
571
|
+
Camara.Camara = _a;
|
|
572
|
+
Camara.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
573
|
+
Camara.CamaraError = Errors.CamaraError;
|
|
574
|
+
Camara.APIError = Errors.APIError;
|
|
575
|
+
Camara.APIConnectionError = Errors.APIConnectionError;
|
|
576
|
+
Camara.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
577
|
+
Camara.APIUserAbortError = Errors.APIUserAbortError;
|
|
578
|
+
Camara.NotFoundError = Errors.NotFoundError;
|
|
579
|
+
Camara.ConflictError = Errors.ConflictError;
|
|
580
|
+
Camara.RateLimitError = Errors.RateLimitError;
|
|
581
|
+
Camara.BadRequestError = Errors.BadRequestError;
|
|
582
|
+
Camara.AuthenticationError = Errors.AuthenticationError;
|
|
583
|
+
Camara.InternalServerError = Errors.InternalServerError;
|
|
584
|
+
Camara.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
585
|
+
Camara.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
586
|
+
Camara.toFile = Uploads.toFile;
|
|
587
|
+
Camara.Customerinsights = Customerinsights;
|
|
588
|
+
Camara.Deviceswap = Deviceswap;
|
|
589
|
+
Camara.Knowyourcustomerageverification = Knowyourcustomerageverification;
|
|
590
|
+
Camara.KnowyourcustomerfillIn = KnowyourcustomerfillIn;
|
|
591
|
+
Camara.Knowyourcustomermatch = Knowyourcustomermatch;
|
|
592
|
+
Camara.Tenure = Tenure;
|
|
593
|
+
Camara.Numberrecycling = Numberrecycling;
|
|
594
|
+
Camara.Otpvalidation = Otpvalidation;
|
|
595
|
+
Camara.Callforwardingsignal = Callforwardingsignal;
|
|
596
|
+
Camara.Devicelocation = Devicelocation;
|
|
597
|
+
Camara.Populationdensitydata = Populationdensitydata;
|
|
598
|
+
Camara.Regiondevicecount = Regiondevicecount;
|
|
599
|
+
Camara.Webrtc = Webrtc;
|
|
600
|
+
Camara.Connectivityinsights = Connectivityinsights;
|
|
601
|
+
Camara.Qualityondemand = Qualityondemand;
|
|
602
|
+
Camara.Deviceidentifier = Deviceidentifier;
|
|
603
|
+
Camara.Simswap = Simswap;
|
|
604
|
+
Camara.Deviceroamingstatus = Deviceroamingstatus;
|
|
605
|
+
Camara.Devicereachabilitystatus = Devicereachabilitystatus;
|
|
606
|
+
Camara.Connectednetworktype = Connectednetworktype;
|
|
607
|
+
//# sourceMappingURL=client.mjs.map
|