increase 0.7.1 → 0.8.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 +71 -0
- package/README.md +8 -4
- package/_shims/ReadableStream.d.ts +38 -0
- package/_shims/ReadableStream.js +5 -0
- package/_shims/ReadableStream.mjs +7 -0
- package/_shims/ReadableStream.node.d.ts +6 -0
- package/_shims/ReadableStream.node.d.ts.map +1 -0
- package/_shims/ReadableStream.node.js +14 -0
- package/_shims/ReadableStream.node.js.map +1 -0
- package/_shims/ReadableStream.node.mjs +3 -0
- package/_shims/ReadableStream.node.mjs.map +1 -0
- package/_shims/fetch.js +1 -1
- package/core.d.ts +11 -10
- package/core.d.ts.map +1 -1
- package/core.js +123 -60
- package/core.js.map +1 -1
- package/core.mjs +113 -20
- package/core.mjs.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.js +12 -3
- package/error.js.map +1 -1
- package/error.mjs +12 -3
- package/error.mjs.map +1 -1
- package/index.d.mts +9 -5
- package/index.d.ts +9 -5
- package/index.d.ts.map +1 -1
- package/index.js +15 -11
- package/index.js.map +1 -1
- package/index.mjs +15 -11
- package/index.mjs.map +1 -1
- package/package.json +4 -4
- package/resources/account-numbers.d.ts.map +1 -1
- package/resources/account-statements.d.ts.map +1 -1
- package/resources/account-transfers.d.ts.map +1 -1
- package/resources/accounts.d.ts.map +1 -1
- package/resources/ach-prenotifications.d.ts.map +1 -1
- package/resources/ach-transfers.d.ts.map +1 -1
- package/resources/balance-lookups.d.ts.map +1 -1
- package/resources/bookkeeping-accounts.d.ts.map +1 -1
- package/resources/bookkeeping-entries.d.ts.map +1 -1
- package/resources/bookkeeping-entry-sets.d.ts.map +1 -1
- package/resources/card-disputes.d.ts.map +1 -1
- package/resources/card-profiles.d.ts +17 -4
- package/resources/card-profiles.d.ts.map +1 -1
- package/resources/card-profiles.js.map +1 -1
- package/resources/card-profiles.mjs.map +1 -1
- package/resources/card-purchase-supplements.d.ts +270 -0
- package/resources/card-purchase-supplements.d.ts.map +1 -0
- package/resources/card-purchase-supplements.js +28 -0
- package/resources/card-purchase-supplements.js.map +1 -0
- package/resources/card-purchase-supplements.mjs +21 -0
- package/resources/card-purchase-supplements.mjs.map +1 -0
- package/resources/cards.d.ts.map +1 -1
- package/resources/check-deposits.d.ts.map +1 -1
- package/resources/check-transfers.d.ts +184 -98
- package/resources/check-transfers.d.ts.map +1 -1
- package/resources/check-transfers.js.map +1 -1
- package/resources/check-transfers.mjs.map +1 -1
- package/resources/declined-transactions.d.ts +9 -7
- package/resources/declined-transactions.d.ts.map +1 -1
- package/resources/declined-transactions.js.map +1 -1
- package/resources/declined-transactions.mjs.map +1 -1
- package/resources/digital-wallet-tokens.d.ts.map +1 -1
- package/resources/documents.d.ts.map +1 -1
- package/resources/entities/beneficial-owners.d.ts +219 -0
- package/resources/entities/beneficial-owners.d.ts.map +1 -0
- package/resources/entities/beneficial-owners.js +18 -0
- package/resources/entities/beneficial-owners.js.map +1 -0
- package/resources/entities/beneficial-owners.mjs +12 -0
- package/resources/entities/beneficial-owners.mjs.map +1 -0
- package/resources/entities/entities.d.ts +4 -0
- package/resources/entities/entities.d.ts.map +1 -1
- package/resources/entities/entities.js +3 -0
- package/resources/entities/entities.js.map +1 -1
- package/resources/entities/entities.mjs +3 -0
- package/resources/entities/entities.mjs.map +1 -1
- package/resources/entities/index.d.ts +1 -0
- package/resources/entities/index.d.ts.map +1 -1
- package/resources/entities/index.js +8 -0
- package/resources/entities/index.js.map +1 -1
- package/resources/entities/index.mjs +1 -0
- package/resources/entities/index.mjs.map +1 -1
- package/resources/entities/supplemental-documents.d.ts.map +1 -1
- package/resources/event-subscriptions.d.ts.map +1 -1
- package/resources/events.d.ts.map +1 -1
- package/resources/exports.d.ts.map +1 -1
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/files.d.ts.map +1 -1
- package/resources/groups.d.ts.map +1 -1
- package/resources/inbound-ach-transfer-returns.d.ts.map +1 -1
- package/resources/inbound-wire-drawdown-requests.d.ts.map +1 -1
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +18 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/limits.d.ts +2 -2
- package/resources/limits.d.ts.map +1 -1
- package/resources/oauth-connections.d.ts.map +1 -1
- package/resources/pending-transactions.d.ts +11 -7
- package/resources/pending-transactions.d.ts.map +1 -1
- package/resources/pending-transactions.js.map +1 -1
- package/resources/pending-transactions.mjs.map +1 -1
- package/resources/programs.d.ts.map +1 -1
- package/resources/real-time-decisions.d.ts +49 -7
- package/resources/real-time-decisions.d.ts.map +1 -1
- package/resources/real-time-decisions.js.map +1 -1
- package/resources/real-time-decisions.mjs.map +1 -1
- package/resources/real-time-payments-transfers.d.ts.map +1 -1
- package/resources/routing-numbers.d.ts.map +1 -1
- package/resources/shared.d.ts +2 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/simulations/account-statements.d.ts.map +1 -1
- package/resources/simulations/ach-transfers.d.ts +952 -26
- package/resources/simulations/ach-transfers.d.ts.map +1 -1
- package/resources/simulations/ach-transfers.js.map +1 -1
- package/resources/simulations/ach-transfers.mjs.map +1 -1
- package/resources/simulations/card-disputes.d.ts.map +1 -1
- package/resources/simulations/card-refunds.d.ts.map +1 -1
- package/resources/simulations/cards.d.ts +20 -14
- package/resources/simulations/cards.d.ts.map +1 -1
- package/resources/simulations/cards.js.map +1 -1
- package/resources/simulations/cards.mjs.map +1 -1
- package/resources/simulations/digital-wallet-token-requests.d.ts.map +1 -1
- package/resources/simulations/documents.d.ts.map +1 -1
- package/resources/simulations/inbound-funds-holds.d.ts +4 -0
- package/resources/simulations/inbound-funds-holds.d.ts.map +1 -1
- package/resources/simulations/inbound-funds-holds.js.map +1 -1
- package/resources/simulations/inbound-funds-holds.mjs.map +1 -1
- package/resources/simulations/inbound-wire-drawdown-requests.d.ts.map +1 -1
- package/resources/simulations/interest-payments.d.ts +951 -19
- package/resources/simulations/interest-payments.d.ts.map +1 -1
- package/resources/simulations/interest-payments.js.map +1 -1
- package/resources/simulations/interest-payments.mjs.map +1 -1
- package/resources/simulations/programs.d.ts.map +1 -1
- package/resources/simulations/real-time-payments-transfers.d.ts +952 -26
- package/resources/simulations/real-time-payments-transfers.d.ts.map +1 -1
- package/resources/simulations/real-time-payments-transfers.js.map +1 -1
- package/resources/simulations/real-time-payments-transfers.mjs.map +1 -1
- package/resources/simulations/simulations.d.ts.map +1 -1
- package/resources/simulations/simulations.js.map +1 -1
- package/resources/simulations/wire-transfers.d.ts +943 -19
- package/resources/simulations/wire-transfers.d.ts.map +1 -1
- package/resources/simulations/wire-transfers.js.map +1 -1
- package/resources/simulations/wire-transfers.mjs.map +1 -1
- package/resources/transactions.d.ts +943 -20
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs.map +1 -1
- package/resources/wire-drawdown-requests.d.ts.map +1 -1
- package/resources/wire-transfers.d.ts.map +1 -1
- package/src/_shims/ReadableStream.d.ts +38 -0
- package/src/_shims/ReadableStream.js +5 -0
- package/src/_shims/ReadableStream.mjs +7 -0
- package/src/_shims/ReadableStream.node.ts +6 -0
- package/src/_shims/fetch.deno.ts +23 -0
- package/src/_shims/fetch.js +1 -1
- package/src/_shims/formdata.deno.ts +16 -0
- package/src/core.ts +130 -21
- package/src/error.ts +11 -1
- package/src/index.ts +23 -16
- package/src/resources/account-numbers.ts +1 -1
- package/src/resources/account-statements.ts +1 -1
- package/src/resources/account-transfers.ts +1 -1
- package/src/resources/accounts.ts +1 -1
- package/src/resources/ach-prenotifications.ts +1 -1
- package/src/resources/ach-transfers.ts +1 -1
- package/src/resources/balance-lookups.ts +1 -1
- package/src/resources/bookkeeping-accounts.ts +1 -1
- package/src/resources/bookkeeping-entries.ts +1 -1
- package/src/resources/bookkeeping-entry-sets.ts +1 -1
- package/src/resources/card-disputes.ts +1 -1
- package/src/resources/card-profiles.ts +19 -5
- package/src/resources/card-purchase-supplements.ts +331 -0
- package/src/resources/cards.ts +1 -1
- package/src/resources/check-deposits.ts +1 -1
- package/src/resources/check-transfers.ts +208 -113
- package/src/resources/declined-transactions.ts +11 -9
- package/src/resources/digital-wallet-tokens.ts +1 -1
- package/src/resources/documents.ts +1 -1
- package/src/resources/entities/beneficial-owners.ts +255 -0
- package/src/resources/entities/entities.ts +6 -1
- package/src/resources/entities/index.ts +1 -0
- package/src/resources/entities/supplemental-documents.ts +1 -1
- package/src/resources/event-subscriptions.ts +1 -1
- package/src/resources/events.ts +1 -1
- package/src/resources/exports.ts +1 -1
- package/src/resources/external-accounts.ts +1 -1
- package/src/resources/files.ts +1 -1
- package/src/resources/groups.ts +1 -1
- package/src/resources/inbound-ach-transfer-returns.ts +1 -1
- package/src/resources/inbound-wire-drawdown-requests.ts +1 -1
- package/src/resources/index.ts +6 -0
- package/src/resources/limits.ts +3 -3
- package/src/resources/oauth-connections.ts +1 -1
- package/src/resources/pending-transactions.ts +14 -9
- package/src/resources/programs.ts +1 -1
- package/src/resources/real-time-decisions.ts +57 -9
- package/src/resources/real-time-payments-transfers.ts +1 -1
- package/src/resources/routing-numbers.ts +1 -1
- package/src/resources/shared.ts +2 -0
- package/src/resources/simulations/account-statements.ts +1 -1
- package/src/resources/simulations/ach-transfers.ts +1091 -30
- package/src/resources/simulations/card-disputes.ts +1 -1
- package/src/resources/simulations/card-refunds.ts +1 -1
- package/src/resources/simulations/cards.ts +24 -17
- package/src/resources/simulations/digital-wallet-token-requests.ts +1 -1
- package/src/resources/simulations/documents.ts +1 -1
- package/src/resources/simulations/inbound-funds-holds.ts +6 -1
- package/src/resources/simulations/inbound-wire-drawdown-requests.ts +1 -1
- package/src/resources/simulations/interest-payments.ts +1091 -22
- package/src/resources/simulations/programs.ts +1 -1
- package/src/resources/simulations/real-time-payments-transfers.ts +1091 -30
- package/src/resources/simulations/simulations.ts +1 -1
- package/src/resources/simulations/wire-transfers.ts +1081 -22
- package/src/resources/transactions.ts +1081 -23
- package/src/resources/wire-drawdown-requests.ts +1 -1
- package/src/resources/wire-transfers.ts +1 -1
- package/src/uploads.ts +7 -6
- package/src/version.ts +1 -1
- package/uploads.d.ts +5 -4
- package/uploads.d.ts.map +1 -1
- package/uploads.js +2 -2
- package/uploads.js.map +1 -1
- package/uploads.mjs +2 -2
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.1](https://github.com/Increase/increase-node/compare/v0.8.0...v0.8.1) (2023-08-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api:** updates ([#95](https://github.com/Increase/increase-node/issues/95)) ([ee5fd92](https://github.com/Increase/increase-node/commit/ee5fd92feacdcf53cd8e5ed63ece2152a47ebe88))
|
|
9
|
+
* **client:** detect browser usage ([#97](https://github.com/Increase/increase-node/issues/97)) ([b2ec59b](https://github.com/Increase/increase-node/commit/b2ec59b2d0f251b6e07b773bea4032ba78e01ef0))
|
|
10
|
+
* **streaming:** add `.toReadableStream()` method ([#99](https://github.com/Increase/increase-node/issues/99)) ([e79f368](https://github.com/Increase/increase-node/commit/e79f36881daa1f8e234dd7d7d9986e4634f11148))
|
|
11
|
+
* **test:** unskip file uploads tests ([#90](https://github.com/Increase/increase-node/issues/90)) ([4a36612](https://github.com/Increase/increase-node/commit/4a36612e01b8592141e9d863e085e2b9c68d1d98))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* fix undefined message in errors ([#83](https://github.com/Increase/increase-node/issues/83)) ([ec9aa0e](https://github.com/Increase/increase-node/commit/ec9aa0e83054cd839fff0716ac545033e470393e))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Refactors
|
|
20
|
+
|
|
21
|
+
* create build for deno.land ([#89](https://github.com/Increase/increase-node/issues/89)) ([895fa10](https://github.com/Increase/increase-node/commit/895fa10e1f02ad909aeaf7cbebeceb0cadc665e1))
|
|
22
|
+
* use destructuring arguments in client constructor and respect false values ([#87](https://github.com/Increase/increase-node/issues/87)) ([381b58f](https://github.com/Increase/increase-node/commit/381b58f36b3073e4ccac184a0795e0a21251c060))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
* **readme:** remove beta status + document versioning policy ([#96](https://github.com/Increase/increase-node/issues/96)) ([dd0bdb9](https://github.com/Increase/increase-node/commit/dd0bdb919a05597f600b3485068410ea8ca5f2f1))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Chores
|
|
31
|
+
|
|
32
|
+
* **internal:** allow the build script to be run without yarn installed ([#88](https://github.com/Increase/increase-node/issues/88)) ([cbdca9c](https://github.com/Increase/increase-node/commit/cbdca9c7743ba059e1b727d6140264dfa3987acc))
|
|
33
|
+
* **internal:** change jest exclude patterns ([#103](https://github.com/Increase/increase-node/issues/103)) ([5bfd043](https://github.com/Increase/increase-node/commit/5bfd0434594ccfe7e896861ed7abc2d613972571))
|
|
34
|
+
* **internal:** fix deno build ([#92](https://github.com/Increase/increase-node/issues/92)) ([e27c547](https://github.com/Increase/increase-node/commit/e27c54761219b02ba98687f0f7c5520e9ab2e4f4))
|
|
35
|
+
* **internal:** fix deno build ([#94](https://github.com/Increase/increase-node/issues/94)) ([3c29918](https://github.com/Increase/increase-node/commit/3c2991833443dafeb3b0ef9300d6bb3659fbfc45))
|
|
36
|
+
* **internal:** minor style update ([#86](https://github.com/Increase/increase-node/issues/86)) ([9361d68](https://github.com/Increase/increase-node/commit/9361d68ad5af41bf5a6ac7232fdc54e3033738c8))
|
|
37
|
+
* **internal:** remove deno build ([#98](https://github.com/Increase/increase-node/issues/98)) ([3cc88f4](https://github.com/Increase/increase-node/commit/3cc88f41ef2bc07b380b6759d9e1f4451e86c15f))
|
|
38
|
+
* **internal:** update eslint ([#101](https://github.com/Increase/increase-node/issues/101)) ([02c5b88](https://github.com/Increase/increase-node/commit/02c5b8843281e6dd5e36dcd11bd3495154d97a03))
|
|
39
|
+
* **internal:** update helpers ([#85](https://github.com/Increase/increase-node/issues/85)) ([9849cdf](https://github.com/Increase/increase-node/commit/9849cdf61246694a7c806452d9d5377fa7b89535))
|
|
40
|
+
* **internal:** update tsconfig-paths dep ([#102](https://github.com/Increase/increase-node/issues/102)) ([7c8d8f2](https://github.com/Increase/increase-node/commit/7c8d8f2a07127a656c7f8e6966bd61b2b2000042))
|
|
41
|
+
* **internal:** update typescript ([#100](https://github.com/Increase/increase-node/issues/100)) ([aa35ddb](https://github.com/Increase/increase-node/commit/aa35ddb9504efbac0f805adf33a7184969caef50))
|
|
42
|
+
|
|
43
|
+
## [0.8.0](https://github.com/Increase/increase-node/compare/v0.7.1...v0.8.0) (2023-07-22)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### ⚠ BREAKING CHANGES
|
|
47
|
+
|
|
48
|
+
* **api:** reorganize `check_transfer` and `network fields; add `request_details`; add `unknown` ([#77](https://github.com/Increase/increase-node/issues/77))
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
* **api:** add fee_period_start and return_of_erroneous_or_reversing_debit ([#81](https://github.com/Increase/increase-node/issues/81)) ([0355030](https://github.com/Increase/increase-node/commit/035503048b9a8def682086e31e1d794a4fbd50d2))
|
|
53
|
+
* **api:** reorganize `check_transfer` and `network fields; add `request_details`; add `unknown` ([#77](https://github.com/Increase/increase-node/issues/77)) ([477ba8c](https://github.com/Increase/increase-node/commit/477ba8c7853fe54bd83fdff6b2c280825a15670b))
|
|
54
|
+
* **client:** export ClientOptions interface ([#76](https://github.com/Increase/increase-node/issues/76)) ([757d3e3](https://github.com/Increase/increase-node/commit/757d3e3edee0471d486f6fd9bd1f2dd3f0fa8f58))
|
|
55
|
+
* **streaming:** make requests immediately throw an error if an aborted signal is passed in ([#80](https://github.com/Increase/increase-node/issues/80)) ([d9e16a4](https://github.com/Increase/increase-node/commit/d9e16a4804f6d7bf377ee58054d2914bebae08c6))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* **client:** fix errors with file uploads in the browser ([#78](https://github.com/Increase/increase-node/issues/78)) ([7ebdd66](https://github.com/Increase/increase-node/commit/7ebdd66c0eaee44aae2ab6ea515f4819bbf31a4f))
|
|
61
|
+
* fix error in environments without `TextEncoder` ([#72](https://github.com/Increase/increase-node/issues/72)) ([699c8e1](https://github.com/Increase/increase-node/commit/699c8e1d56d50feb4ef4f052de012da67efe2b52))
|
|
62
|
+
* fix export map order ([#75](https://github.com/Increase/increase-node/issues/75)) ([5826191](https://github.com/Increase/increase-node/commit/582619146249a2c9a71fae31f2df97a261bda9da))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Chores
|
|
66
|
+
|
|
67
|
+
* **internal:** restructure code to stringify query ([#74](https://github.com/Increase/increase-node/issues/74)) ([71586e2](https://github.com/Increase/increase-node/commit/71586e2ead82fb7f89be90a1dbd5d4132fcf3d8b))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Documentation
|
|
71
|
+
|
|
72
|
+
* **api:** update `model_id` documentation ([#79](https://github.com/Increase/increase-node/issues/79)) ([aee0086](https://github.com/Increase/increase-node/commit/aee00861804949a4eb286bc97da1c3a407ae5df8))
|
|
73
|
+
|
|
3
74
|
## [0.7.1](https://github.com/Increase/increase-node/compare/v0.7.0...v0.7.1) (2023-07-17)
|
|
4
75
|
|
|
5
76
|
|
package/README.md
CHANGED
|
@@ -224,11 +224,15 @@ await increase.accounts.list({ status: 'open' }, {
|
|
|
224
224
|
})
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
##
|
|
227
|
+
## Semantic Versioning
|
|
228
228
|
|
|
229
|
-
This package
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
This package generally attempts to follow [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
230
|
+
|
|
231
|
+
1. Changes that only affect static types, without breaking runtime behavior.
|
|
232
|
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
|
|
233
|
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
234
|
+
|
|
235
|
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
232
236
|
|
|
233
237
|
We are keen for your feedback; please open an [issue](https://www.github.com/increase/increase-node/issues) with questions, bugs, or suggestions.
|
|
234
238
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* >>> Confused? <<<
|
|
7
|
+
*
|
|
8
|
+
* If you're getting errors from these types, try adding "lib": ["DOM"]
|
|
9
|
+
* to your tsconfig.json, or otherwise configure the appropriate builtin
|
|
10
|
+
* `ReadableStream` type for your environment.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
type _ReadableStream<R = any> = unknown extends ReadableStream ? never : ReadableStream<R>;
|
|
15
|
+
declare const _ReadableStream: {
|
|
16
|
+
prototype: _ReadableStream;
|
|
17
|
+
new (
|
|
18
|
+
underlyingSource: _UnderlyingByteSource,
|
|
19
|
+
strategy?: { highWaterMark?: number },
|
|
20
|
+
): _ReadableStream<Uint8Array>;
|
|
21
|
+
new <R = any>(
|
|
22
|
+
underlyingSource: _UnderlyingDefaultSource<R>,
|
|
23
|
+
strategy?: _QueuingStrategy<R>,
|
|
24
|
+
): _ReadableStream<R>;
|
|
25
|
+
new <R = any>(underlyingSource?: _UnderlyingSource<R>, strategy?: _QueuingStrategy<R>): _ReadableStream<R>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
type _UnderlyingSource<R = any> = unknown extends UnderlyingSource ? never : UnderlyingSource<R>;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
type _UnderlyingByteSource = unknown extends UnderlyingByteSource ? never : UnderlyingByteSource;
|
|
32
|
+
type _UnderlyingDefaultSource<R = any> =
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
unknown extends UnderlyingDefaultSource ? never : UnderlyingDefaultSource<R>;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
type _QueuingStrategy<R = any> = unknown extends QueuingStrategy ? never : QueuingStrategy<R>;
|
|
37
|
+
|
|
38
|
+
export { _ReadableStream as ReadableStream };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadableStream.node.d.ts","sourceRoot":"","sources":["../src/_shims/ReadableStream.node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.ReadableStream = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
6
|
+
*/
|
|
7
|
+
const web_streams_polyfill_1 = require('web-streams-polyfill');
|
|
8
|
+
Object.defineProperty(exports, 'ReadableStream', {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return web_streams_polyfill_1.ReadableStream;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=ReadableStream.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadableStream.node.js","sourceRoot":"","sources":["../src/_shims/ReadableStream.node.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAAsD;AAE7C,+FAFA,qCAAc,OAEA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadableStream.node.mjs","sourceRoot":"","sources":["../src/_shims/ReadableStream.node.ts"],"names":[],"mappings":"OAGO,EAAE,cAAc,EAAE,MAAM,sBAAsB;AAErD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/_shims/fetch.js
CHANGED
package/core.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as qs from 'qs';
|
|
2
1
|
import { APIError } from './error.js';
|
|
3
2
|
import type { Readable } from 'increase/_shims/node-readable';
|
|
4
3
|
import { type Agent } from 'increase/_shims/agent';
|
|
@@ -45,15 +44,6 @@ export declare abstract class APIClient {
|
|
|
45
44
|
* Override this to add your own headers validation:
|
|
46
45
|
*/
|
|
47
46
|
protected validateHeaders(headers: Headers, customHeaders: Headers): void;
|
|
48
|
-
/**
|
|
49
|
-
* Override this to add your own qs.stringify options, for example:
|
|
50
|
-
*
|
|
51
|
-
* {
|
|
52
|
-
* ...super.qsOptions(),
|
|
53
|
-
* strictNullHandling: true,
|
|
54
|
-
* }
|
|
55
|
-
*/
|
|
56
|
-
protected qsOptions(): qs.IStringifyOptions | undefined;
|
|
57
47
|
protected defaultIdempotencyKey(): string;
|
|
58
48
|
get<Req extends {}, Rsp>(path: string, opts?: RequestOptions<Req>): Promise<Rsp>;
|
|
59
49
|
post<Req extends {}, Rsp>(path: string, opts?: RequestOptions<Req>): Promise<Rsp>;
|
|
@@ -102,6 +92,7 @@ export declare abstract class APIClient {
|
|
|
102
92
|
options: FinalRequestOptions,
|
|
103
93
|
): PagePromise<PageClass>;
|
|
104
94
|
buildURL<Req>(path: string, query: Req | undefined): string;
|
|
95
|
+
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
105
96
|
fetchWithTimeout(
|
|
106
97
|
url: RequestInfo,
|
|
107
98
|
init: RequestInit | undefined,
|
|
@@ -216,11 +207,21 @@ export type APIResponse<T> = T & {
|
|
|
216
207
|
export declare const safeJSON: (text: string) => any;
|
|
217
208
|
export declare const castToError: (err: any) => Error;
|
|
218
209
|
export declare const ensurePresent: <T>(value: T | null | undefined) => T;
|
|
210
|
+
/**
|
|
211
|
+
* Read an environment variable.
|
|
212
|
+
*
|
|
213
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
214
|
+
*/
|
|
215
|
+
export declare const readEnv: (env: string) => string | undefined;
|
|
219
216
|
export declare const coerceInteger: (value: unknown) => number;
|
|
220
217
|
export declare const coerceFloat: (value: unknown) => number;
|
|
221
218
|
export declare const coerceBoolean: (value: unknown) => boolean;
|
|
219
|
+
export declare const maybeCoerceInteger: (value: unknown) => number | undefined;
|
|
220
|
+
export declare const maybeCoerceFloat: (value: unknown) => number | undefined;
|
|
221
|
+
export declare const maybeCoerceBoolean: (value: unknown) => boolean | undefined;
|
|
222
222
|
export declare function isEmptyObj(obj: Object | null | undefined): boolean;
|
|
223
223
|
export declare function hasOwn(obj: Object, key: string): boolean;
|
|
224
|
+
export declare const isRunningInBrowser: () => boolean;
|
|
224
225
|
export interface HeadersProtocol {
|
|
225
226
|
get: (header: string) => string | null | undefined;
|
|
226
227
|
}
|
package/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;;;AACA,OAAO,EAAE,QAAQ,EAAoE,MAAM,SAAS,CAAC;AACrG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,gCAAgC,EAChC,2BAA2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AAGF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIlE;AAGD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD;AAaD,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACpD;AACD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,eAAe,CAAC;AAE1F,eAAO,MAAM,iBAAiB,YAAa,GAAG,+BAE7C,CAAC;AAEF,eAAO,MAAM,SAAS,YAAa,WAAW,OAAO,MAAM,KAAG,MAAM,GAAG,IAAI,GAAG,SAU7E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAS,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAWzD,CAAC"}
|
package/core.js
CHANGED
|
@@ -1,44 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __createBinding =
|
|
3
|
-
(this && this.__createBinding) ||
|
|
4
|
-
(Object.create ?
|
|
5
|
-
function (o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return m[k];
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}
|
|
18
|
-
: function (o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
});
|
|
22
|
-
var __setModuleDefault =
|
|
23
|
-
(this && this.__setModuleDefault) ||
|
|
24
|
-
(Object.create ?
|
|
25
|
-
function (o, v) {
|
|
26
|
-
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
27
|
-
}
|
|
28
|
-
: function (o, v) {
|
|
29
|
-
o['default'] = v;
|
|
30
|
-
});
|
|
31
|
-
var __importStar =
|
|
32
|
-
(this && this.__importStar) ||
|
|
33
|
-
function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null)
|
|
37
|
-
for (var k in mod)
|
|
38
|
-
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
39
|
-
__setModuleDefault(result, mod);
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
2
|
var __classPrivateFieldSet =
|
|
43
3
|
(this && this.__classPrivateFieldSet) ||
|
|
44
4
|
function (receiver, state, value, kind, f) {
|
|
@@ -71,11 +31,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
71
31
|
exports.toBase64 =
|
|
72
32
|
exports.getHeader =
|
|
73
33
|
exports.isHeadersProtocol =
|
|
34
|
+
exports.isRunningInBrowser =
|
|
74
35
|
exports.hasOwn =
|
|
75
36
|
exports.isEmptyObj =
|
|
37
|
+
exports.maybeCoerceBoolean =
|
|
38
|
+
exports.maybeCoerceFloat =
|
|
39
|
+
exports.maybeCoerceInteger =
|
|
76
40
|
exports.coerceBoolean =
|
|
77
41
|
exports.coerceFloat =
|
|
78
42
|
exports.coerceInteger =
|
|
43
|
+
exports.readEnv =
|
|
79
44
|
exports.ensurePresent =
|
|
80
45
|
exports.castToError =
|
|
81
46
|
exports.safeJSON =
|
|
@@ -89,7 +54,6 @@ exports.toBase64 =
|
|
|
89
54
|
exports.multipartFormRequestOptions =
|
|
90
55
|
exports.maybeMultipartFormRequestOptions =
|
|
91
56
|
void 0;
|
|
92
|
-
const qs = __importStar(require('qs'));
|
|
93
57
|
const version_1 = require('./version.js');
|
|
94
58
|
const error_1 = require('./error.js');
|
|
95
59
|
const agent_1 = require('increase/_shims/agent');
|
|
@@ -156,17 +120,6 @@ class APIClient {
|
|
|
156
120
|
* Override this to add your own headers validation:
|
|
157
121
|
*/
|
|
158
122
|
validateHeaders(headers, customHeaders) {}
|
|
159
|
-
/**
|
|
160
|
-
* Override this to add your own qs.stringify options, for example:
|
|
161
|
-
*
|
|
162
|
-
* {
|
|
163
|
-
* ...super.qsOptions(),
|
|
164
|
-
* strictNullHandling: true,
|
|
165
|
-
* }
|
|
166
|
-
*/
|
|
167
|
-
qsOptions() {
|
|
168
|
-
return {};
|
|
169
|
-
}
|
|
170
123
|
defaultIdempotencyKey() {
|
|
171
124
|
return `stainless-node-retry-${uuid4()}`;
|
|
172
125
|
}
|
|
@@ -193,9 +146,11 @@ class APIClient {
|
|
|
193
146
|
if (typeof Buffer !== 'undefined') {
|
|
194
147
|
return Buffer.byteLength(body, 'utf8').toString();
|
|
195
148
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
149
|
+
if (typeof TextEncoder !== 'undefined') {
|
|
150
|
+
const encoder = new TextEncoder();
|
|
151
|
+
const encoded = encoder.encode(body);
|
|
152
|
+
return encoded.length.toString();
|
|
153
|
+
}
|
|
199
154
|
}
|
|
200
155
|
return null;
|
|
201
156
|
}
|
|
@@ -266,17 +221,20 @@ class APIClient {
|
|
|
266
221
|
return error_1.APIError.generate(status, error, message, headers);
|
|
267
222
|
}
|
|
268
223
|
async request(options, retriesRemaining) {
|
|
269
|
-
var _a, _b;
|
|
224
|
+
var _a, _b, _c;
|
|
270
225
|
if (retriesRemaining === void 0) {
|
|
271
226
|
retriesRemaining = (_a = options.maxRetries) !== null && _a !== void 0 ? _a : this.maxRetries;
|
|
272
227
|
}
|
|
273
228
|
const { req, url, timeout } = this.buildRequest(options);
|
|
274
229
|
await this.prepareRequest(req, { url });
|
|
275
230
|
this.debug('request', url, options, req.headers);
|
|
231
|
+
if ((_b = options.signal) === null || _b === void 0 ? void 0 : _b.aborted) {
|
|
232
|
+
throw new error_1.APIUserAbortError();
|
|
233
|
+
}
|
|
276
234
|
const controller = new AbortController();
|
|
277
235
|
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(exports.castToError);
|
|
278
236
|
if (response instanceof Error) {
|
|
279
|
-
if ((
|
|
237
|
+
if ((_c = options.signal) === null || _c === void 0 ? void 0 : _c.aborted) {
|
|
280
238
|
throw new error_1.APIUserAbortError();
|
|
281
239
|
}
|
|
282
240
|
if (retriesRemaining) {
|
|
@@ -332,10 +290,26 @@ class APIClient {
|
|
|
332
290
|
query = { ...defaultQuery, ...query };
|
|
333
291
|
}
|
|
334
292
|
if (query) {
|
|
335
|
-
url.search =
|
|
293
|
+
url.search = this.stringifyQuery(query);
|
|
336
294
|
}
|
|
337
295
|
return url.toString();
|
|
338
296
|
}
|
|
297
|
+
stringifyQuery(query) {
|
|
298
|
+
return Object.entries(query)
|
|
299
|
+
.filter(([_, value]) => typeof value !== 'undefined')
|
|
300
|
+
.map(([key, value]) => {
|
|
301
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
302
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
303
|
+
}
|
|
304
|
+
if (value === null) {
|
|
305
|
+
return `${encodeURIComponent(key)}=`;
|
|
306
|
+
}
|
|
307
|
+
throw new Error(
|
|
308
|
+
`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.`,
|
|
309
|
+
);
|
|
310
|
+
})
|
|
311
|
+
.join('&');
|
|
312
|
+
}
|
|
339
313
|
async fetchWithTimeout(url, init, ms, controller) {
|
|
340
314
|
const { signal, ...options } = init || {};
|
|
341
315
|
if (signal) signal.addEventListener('abort', () => controller.abort());
|
|
@@ -571,7 +545,18 @@ const getPlatformProperties = () => {
|
|
|
571
545
|
'X-Stainless-Runtime-Version': process.version,
|
|
572
546
|
};
|
|
573
547
|
}
|
|
574
|
-
|
|
548
|
+
const browserInfo = getBrowserInfo();
|
|
549
|
+
if (browserInfo) {
|
|
550
|
+
return {
|
|
551
|
+
'X-Stainless-Lang': 'js',
|
|
552
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
553
|
+
'X-Stainless-OS': 'Unknown',
|
|
554
|
+
'X-Stainless-Arch': 'unknown',
|
|
555
|
+
'X-Stainless-Runtime': `browser:${browserInfo.browser}`,
|
|
556
|
+
'X-Stainless-Runtime-Version': browserInfo.version,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
// TODO add support for Cloudflare workers, etc.
|
|
575
560
|
return {
|
|
576
561
|
'X-Stainless-Lang': 'js',
|
|
577
562
|
'X-Stainless-Package-Version': version_1.VERSION,
|
|
@@ -581,6 +566,32 @@ const getPlatformProperties = () => {
|
|
|
581
566
|
'X-Stainless-Runtime-Version': 'unknown',
|
|
582
567
|
};
|
|
583
568
|
};
|
|
569
|
+
// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
|
|
570
|
+
function getBrowserInfo() {
|
|
571
|
+
if (!navigator || typeof navigator === 'undefined') {
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
574
|
+
// NOTE: The order matters here!
|
|
575
|
+
const browserPatterns = [
|
|
576
|
+
{ key: 'edge', pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
577
|
+
{ key: 'ie', pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
578
|
+
{ key: 'ie', pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
579
|
+
{ key: 'chrome', pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
580
|
+
{ key: 'firefox', pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
581
|
+
{ key: 'safari', pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ },
|
|
582
|
+
];
|
|
583
|
+
// Find the FIRST matching browser
|
|
584
|
+
for (const { key, pattern } of browserPatterns) {
|
|
585
|
+
const match = pattern.exec(navigator.userAgent);
|
|
586
|
+
if (match) {
|
|
587
|
+
const major = match[1] || 0;
|
|
588
|
+
const minor = match[2] || 0;
|
|
589
|
+
const patch = match[3] || 0;
|
|
590
|
+
return { browser: key, version: `${major}.${minor}.${patch}` };
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return null;
|
|
594
|
+
}
|
|
584
595
|
const normalizeArch = (arch) => {
|
|
585
596
|
// Node docs:
|
|
586
597
|
// - https://nodejs.org/api/process.html#processarch
|
|
@@ -635,7 +646,7 @@ const isAbsoluteURL = (url) => {
|
|
|
635
646
|
};
|
|
636
647
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
637
648
|
const validatePositiveInteger = (name, n) => {
|
|
638
|
-
if (!Number.isInteger(n)) {
|
|
649
|
+
if (typeof n !== 'number' || !Number.isInteger(n)) {
|
|
639
650
|
throw new Error(`${name} must be an integer`);
|
|
640
651
|
}
|
|
641
652
|
if (n < 0) {
|
|
@@ -653,6 +664,26 @@ const ensurePresent = (value) => {
|
|
|
653
664
|
return value;
|
|
654
665
|
};
|
|
655
666
|
exports.ensurePresent = ensurePresent;
|
|
667
|
+
/**
|
|
668
|
+
* Read an environment variable.
|
|
669
|
+
*
|
|
670
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
671
|
+
*/
|
|
672
|
+
const readEnv = (env) => {
|
|
673
|
+
var _a, _b, _c, _d;
|
|
674
|
+
if (typeof process !== 'undefined') {
|
|
675
|
+
return (_b = (_a = process.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ?
|
|
676
|
+
_b
|
|
677
|
+
: undefined;
|
|
678
|
+
}
|
|
679
|
+
if (typeof Deno !== 'undefined') {
|
|
680
|
+
return (_d = (_c = Deno.env) === null || _c === void 0 ? void 0 : _c.get) === null || _d === void 0 ?
|
|
681
|
+
void 0
|
|
682
|
+
: _d.call(_c, env);
|
|
683
|
+
}
|
|
684
|
+
return undefined;
|
|
685
|
+
};
|
|
686
|
+
exports.readEnv = readEnv;
|
|
656
687
|
const coerceInteger = (value) => {
|
|
657
688
|
if (typeof value === 'number') return Math.round(value);
|
|
658
689
|
if (typeof value === 'string') return parseInt(value, 10);
|
|
@@ -671,6 +702,27 @@ const coerceBoolean = (value) => {
|
|
|
671
702
|
return Boolean(value);
|
|
672
703
|
};
|
|
673
704
|
exports.coerceBoolean = coerceBoolean;
|
|
705
|
+
const maybeCoerceInteger = (value) => {
|
|
706
|
+
if (value === undefined) {
|
|
707
|
+
return undefined;
|
|
708
|
+
}
|
|
709
|
+
return (0, exports.coerceInteger)(value);
|
|
710
|
+
};
|
|
711
|
+
exports.maybeCoerceInteger = maybeCoerceInteger;
|
|
712
|
+
const maybeCoerceFloat = (value) => {
|
|
713
|
+
if (value === undefined) {
|
|
714
|
+
return undefined;
|
|
715
|
+
}
|
|
716
|
+
return (0, exports.coerceFloat)(value);
|
|
717
|
+
};
|
|
718
|
+
exports.maybeCoerceFloat = maybeCoerceFloat;
|
|
719
|
+
const maybeCoerceBoolean = (value) => {
|
|
720
|
+
if (value === undefined) {
|
|
721
|
+
return undefined;
|
|
722
|
+
}
|
|
723
|
+
return (0, exports.coerceBoolean)(value);
|
|
724
|
+
};
|
|
725
|
+
exports.maybeCoerceBoolean = maybeCoerceBoolean;
|
|
674
726
|
// https://stackoverflow.com/a/34491287
|
|
675
727
|
function isEmptyObj(obj) {
|
|
676
728
|
if (!obj) return true;
|
|
@@ -693,6 +745,17 @@ const uuid4 = () => {
|
|
|
693
745
|
return v.toString(16);
|
|
694
746
|
});
|
|
695
747
|
};
|
|
748
|
+
const isRunningInBrowser = () => {
|
|
749
|
+
return (
|
|
750
|
+
// @ts-ignore
|
|
751
|
+
typeof window !== 'undefined' &&
|
|
752
|
+
// @ts-ignore
|
|
753
|
+
typeof window.document !== 'undefined' &&
|
|
754
|
+
// @ts-ignore
|
|
755
|
+
typeof navigator !== 'undefined'
|
|
756
|
+
);
|
|
757
|
+
};
|
|
758
|
+
exports.isRunningInBrowser = isRunningInBrowser;
|
|
696
759
|
const isHeadersProtocol = (headers) => {
|
|
697
760
|
return typeof (headers === null || headers === void 0 ? void 0 : headers.get) === 'function';
|
|
698
761
|
};
|