@getivy/node-sdk 0.1.0-alpha.2 → 0.1.0-alpha.20
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 +209 -0
- package/LICENSE +1 -1
- package/README.md +18 -18
- package/_shims/index.d.ts +2 -0
- package/_shims/index.js +5 -1
- package/_shims/index.mjs +5 -1
- package/core.d.ts +12 -1
- package/core.d.ts.map +1 -1
- package/core.js +29 -20
- package/core.js.map +1 -1
- package/core.mjs +31 -22
- package/core.mjs.map +1 -1
- package/error.d.ts +2 -2
- package/error.d.ts.map +1 -1
- package/error.js +4 -4
- package/error.js.map +1 -1
- package/error.mjs +2 -2
- package/error.mjs.map +1 -1
- package/index.d.mts +15 -12
- package/index.d.ts +15 -12
- package/index.d.ts.map +1 -1
- package/index.js +45 -42
- package/index.js.map +1 -1
- package/index.mjs +43 -40
- package/index.mjs.map +1 -1
- package/package.json +3 -3
- package/resource.d.ts +3 -3
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/banks.d.ts +12 -0
- package/resources/banks.d.ts.map +1 -1
- package/resources/charges.d.ts +0 -13
- package/resources/charges.d.ts.map +1 -1
- package/resources/checkoutsession.d.ts +444 -1305
- package/resources/checkoutsession.d.ts.map +1 -1
- package/resources/customers.d.ts +41 -4
- package/resources/customers.d.ts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/orders.d.ts +89 -659
- package/resources/orders.d.ts.map +1 -1
- package/resources/orders.js +0 -6
- package/resources/orders.js.map +1 -1
- package/resources/orders.mjs +0 -6
- package/resources/orders.mjs.map +1 -1
- package/resources/refunds.d.ts +1 -1
- package/resources/refunds.d.ts.map +1 -1
- package/resources/webhooksubscription.d.ts +155 -0
- package/resources/webhooksubscription.d.ts.map +1 -0
- package/resources/webhooksubscription.js +42 -0
- package/resources/webhooksubscription.js.map +1 -0
- package/resources/webhooksubscription.mjs +38 -0
- package/resources/webhooksubscription.mjs.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +18 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/_shims/index.d.ts +2 -0
- package/src/_shims/index.js +5 -1
- package/src/_shims/index.mjs +5 -1
- package/src/core.ts +49 -22
- package/src/error.ts +2 -2
- package/src/index.ts +57 -36
- package/src/resource.ts +3 -3
- package/src/resources/banks.ts +15 -0
- package/src/resources/charges.ts +0 -13
- package/src/resources/checkoutsession.ts +2103 -4416
- package/src/resources/customers.ts +46 -4
- package/src/resources/index.ts +14 -7
- package/src/resources/orders.ts +107 -1635
- package/src/resources/refunds.ts +0 -1
- package/src/resources/webhooksubscription.ts +353 -0
- package/src/resources.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,214 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.20 (2025-04-23)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* **ci:** add timeout thresholds for CI jobs ([bd427a9](https://github.com/getivy/node-sdk/commit/bd427a996739ce322e2690f9be56d96b047be835))
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.19 (2025-04-22)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** api update ([4b3aaa3](https://github.com/getivy/node-sdk/commit/4b3aaa3c3be6bd40b6dcdae0a16e38ab7b081810))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* **client:** minor internal fixes ([917a84f](https://github.com/getivy/node-sdk/commit/917a84fa087781253e424b94a69a1d0f9b0cac39))
|
|
23
|
+
* **internal:** reduce CI branch coverage ([58b3582](https://github.com/getivy/node-sdk/commit/58b358286e010d79632cb28c3899d6fb9f073fbf))
|
|
24
|
+
* **internal:** upload builds and expand CI branch coverage ([4a4ef94](https://github.com/getivy/node-sdk/commit/4a4ef94db865d54ad808f3b660a9cda92a6f3ea4))
|
|
25
|
+
|
|
26
|
+
## 0.1.0-alpha.18 (2025-04-05)
|
|
27
|
+
|
|
28
|
+
Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **mcp:** remove unused tools.ts ([#60](https://github.com/getivy/node-sdk/issues/60)) ([a8760f5](https://github.com/getivy/node-sdk/commit/a8760f530c370cdb1330b7a7ac863ece7ef3b29a))
|
|
33
|
+
|
|
34
|
+
## 0.1.0-alpha.17 (2025-04-04)
|
|
35
|
+
|
|
36
|
+
Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17)
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* **api:** improve type resolution when importing as a package ([#58](https://github.com/getivy/node-sdk/issues/58)) ([ff07294](https://github.com/getivy/node-sdk/commit/ff07294f2d4c61678dd6e4c13bb51071faf77648))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Chores
|
|
44
|
+
|
|
45
|
+
* **internal:** add aliases for Record and Array ([#56](https://github.com/getivy/node-sdk/issues/56)) ([c732666](https://github.com/getivy/node-sdk/commit/c7326668b1a15c39f7e66229b54f7014da8f77f9))
|
|
46
|
+
|
|
47
|
+
## 0.1.0-alpha.16 (2025-04-03)
|
|
48
|
+
|
|
49
|
+
Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.15...v0.1.0-alpha.16)
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* **client:** send `X-Stainless-Timeout` in seconds ([#53](https://github.com/getivy/node-sdk/issues/53)) ([be0cdd9](https://github.com/getivy/node-sdk/commit/be0cdd9ea9f87eb340598ef2057747c0a0191f8f))
|
|
54
|
+
|
|
55
|
+
## 0.1.0-alpha.15 (2025-04-01)
|
|
56
|
+
|
|
57
|
+
Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.14...v0.1.0-alpha.15)
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* **api:** api update ([#50](https://github.com/getivy/node-sdk/issues/50)) ([8c70bdb](https://github.com/getivy/node-sdk/commit/8c70bdb2e6cb1ea986eed278c5e8852518df104e))
|
|
62
|
+
|
|
63
|
+
## 0.1.0-alpha.14 (2025-03-28)
|
|
64
|
+
|
|
65
|
+
Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)
|
|
66
|
+
|
|
67
|
+
### Bug Fixes
|
|
68
|
+
|
|
69
|
+
* **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#48](https://github.com/getivy/node-sdk/issues/48)) ([6f39951](https://github.com/getivy/node-sdk/commit/6f399518f7a8440ffed3b9914598ce244c337882))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Chores
|
|
73
|
+
|
|
74
|
+
* sync repo ([5279e35](https://github.com/getivy/node-sdk/commit/5279e350838ba18149093dd03cbad5fa72f1a1b9))
|
|
75
|
+
|
|
76
|
+
## 0.1.0-alpha.13 (2025-03-22)
|
|
77
|
+
|
|
78
|
+
Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
* avoid type error in certain environments ([#45](https://github.com/getivy/node-sdk/issues/45)) ([11bfff3](https://github.com/getivy/node-sdk/commit/11bfff38b058a21983ff0dbbd5a549b78468a82f))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Chores
|
|
86
|
+
|
|
87
|
+
* **exports:** cleaner resource index imports ([#42](https://github.com/getivy/node-sdk/issues/42)) ([07616a4](https://github.com/getivy/node-sdk/commit/07616a4bab7cfc6ebf10c63f01d12f9acbee2343))
|
|
88
|
+
* **exports:** stop using path fallbacks ([#44](https://github.com/getivy/node-sdk/issues/44)) ([42c9fdf](https://github.com/getivy/node-sdk/commit/42c9fdfb7b28708f4e7fbd8fc974cf89ccd901d4))
|
|
89
|
+
|
|
90
|
+
## 0.1.0-alpha.12 (2025-03-19)
|
|
91
|
+
|
|
92
|
+
Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
* **api:** api update ([#39](https://github.com/getivy/node-sdk/issues/39)) ([531c64f](https://github.com/getivy/node-sdk/commit/531c64fb2d52d43ef57f4057c5b7befa09b63269))
|
|
97
|
+
|
|
98
|
+
## 0.1.0-alpha.11 (2025-03-18)
|
|
99
|
+
|
|
100
|
+
Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
|
|
101
|
+
|
|
102
|
+
### Features
|
|
103
|
+
|
|
104
|
+
* **api:** api update ([#36](https://github.com/getivy/node-sdk/issues/36)) ([d4b2635](https://github.com/getivy/node-sdk/commit/d4b263518633163ed363afcae5d66a4f0f669d89))
|
|
105
|
+
|
|
106
|
+
## 0.1.0-alpha.10 (2025-03-17)
|
|
107
|
+
|
|
108
|
+
Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)
|
|
109
|
+
|
|
110
|
+
### Features
|
|
111
|
+
|
|
112
|
+
* add SKIP_BREW env var to ./scripts/bootstrap ([#30](https://github.com/getivy/node-sdk/issues/30)) ([0009679](https://github.com/getivy/node-sdk/commit/0009679eeba8b6654193ffc65c7895e12ad31bf6))
|
|
113
|
+
* **api:** api update ([#34](https://github.com/getivy/node-sdk/issues/34)) ([6e52bc0](https://github.com/getivy/node-sdk/commit/6e52bc0fef3a20aa9d810750267f9d1385925560))
|
|
114
|
+
* **client:** accept RFC6838 JSON content types ([#32](https://github.com/getivy/node-sdk/issues/32)) ([3943434](https://github.com/getivy/node-sdk/commit/3943434a79f0492a270f447ed5706db33f467493))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Chores
|
|
118
|
+
|
|
119
|
+
* **internal:** remove extra empty newlines ([#33](https://github.com/getivy/node-sdk/issues/33)) ([3c11c3d](https://github.com/getivy/node-sdk/commit/3c11c3d7971818ed0c96e75be16401f9f6160e87))
|
|
120
|
+
|
|
121
|
+
## 0.1.0-alpha.9 (2025-03-10)
|
|
122
|
+
|
|
123
|
+
Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* **api:** api update ([#21](https://github.com/getivy/node-sdk/issues/21)) ([63972e6](https://github.com/getivy/node-sdk/commit/63972e6a2ebc3447561ccb8f5f375615fb8250e4))
|
|
128
|
+
* **api:** api update ([#24](https://github.com/getivy/node-sdk/issues/24)) ([c03ed8c](https://github.com/getivy/node-sdk/commit/c03ed8cfd6571f23cfedefbb570ebbacf3daba1d))
|
|
129
|
+
* **api:** api update ([#27](https://github.com/getivy/node-sdk/issues/27)) ([c30ea9c](https://github.com/getivy/node-sdk/commit/c30ea9c2a82964d1aac048cbfc7b3a6886bee4c7))
|
|
130
|
+
* **api:** update via SDK Studio ([ed5a37f](https://github.com/getivy/node-sdk/commit/ed5a37f56573ec6a3fcaae1a1bf0edec0da3b74f))
|
|
131
|
+
* **api:** update via SDK Studio ([b8a961d](https://github.com/getivy/node-sdk/commit/b8a961dcfec045b258f340b9ee743105833071da))
|
|
132
|
+
* **api:** update via SDK Studio ([9c6f365](https://github.com/getivy/node-sdk/commit/9c6f36551629b2476f4fd50516e73d7c4707f7d1))
|
|
133
|
+
* **api:** update via SDK Studio ([#10](https://github.com/getivy/node-sdk/issues/10)) ([e6b5adc](https://github.com/getivy/node-sdk/commit/e6b5adc8525a780dfb43c622ca9cb00e7a686e98))
|
|
134
|
+
* **api:** update via SDK Studio ([#2](https://github.com/getivy/node-sdk/issues/2)) ([88067d6](https://github.com/getivy/node-sdk/commit/88067d63c922baf59467c2eda5d635d71672fac4))
|
|
135
|
+
* **api:** update via SDK Studio ([#7](https://github.com/getivy/node-sdk/issues/7)) ([0dd1768](https://github.com/getivy/node-sdk/commit/0dd1768db9340175f7a764989c6a6ed87d555bde))
|
|
136
|
+
* **client:** send `X-Stainless-Timeout` header ([#13](https://github.com/getivy/node-sdk/issues/13)) ([fa2e014](https://github.com/getivy/node-sdk/commit/fa2e01482420ebf48a5880383c9af1a6ddf8e003))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Bug Fixes
|
|
140
|
+
|
|
141
|
+
* **client:** fix export map for index exports ([#15](https://github.com/getivy/node-sdk/issues/15)) ([a01d56e](https://github.com/getivy/node-sdk/commit/a01d56eebddae147256017740a582ae04f3c4fbf))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Chores
|
|
145
|
+
|
|
146
|
+
* **internal:** fix devcontainers setup ([#17](https://github.com/getivy/node-sdk/issues/17)) ([90840e8](https://github.com/getivy/node-sdk/commit/90840e8eebdae48b5e243a5a86dc332107afbd72))
|
|
147
|
+
* update SDK settings ([#4](https://github.com/getivy/node-sdk/issues/4)) ([5ad2a27](https://github.com/getivy/node-sdk/commit/5ad2a277eb6aaa5ce18c13e6bd5b309fbba15888))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Documentation
|
|
151
|
+
|
|
152
|
+
* update URLs from stainlessapi.com to stainless.com ([#20](https://github.com/getivy/node-sdk/issues/20)) ([5acd5d3](https://github.com/getivy/node-sdk/commit/5acd5d34d35e44eecfe4bfb8aae066fb759652e1))
|
|
153
|
+
|
|
154
|
+
## 0.1.0-alpha.8 (2025-03-07)
|
|
155
|
+
|
|
156
|
+
Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)
|
|
157
|
+
|
|
158
|
+
### Features
|
|
159
|
+
|
|
160
|
+
* **api:** api update ([#24](https://github.com/getivy/node-sdk/issues/24)) ([01600b1](https://github.com/getivy/node-sdk/commit/01600b1ccbac0968d4639bf7d6511fa9821d0893))
|
|
161
|
+
|
|
162
|
+
## 0.1.0-alpha.7 (2025-02-28)
|
|
163
|
+
|
|
164
|
+
Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
|
|
165
|
+
|
|
166
|
+
### Features
|
|
167
|
+
|
|
168
|
+
* **api:** api update ([#21](https://github.com/getivy/node-sdk/issues/21)) ([c25ee4f](https://github.com/getivy/node-sdk/commit/c25ee4f9c9e0bdf251551a04f473bc941cebf943))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### Documentation
|
|
172
|
+
|
|
173
|
+
* update URLs from stainlessapi.com to stainless.com ([#20](https://github.com/getivy/node-sdk/issues/20)) ([6ee5acd](https://github.com/getivy/node-sdk/commit/6ee5acdd016a35a2cab1024eacde67440bde79d8))
|
|
174
|
+
|
|
175
|
+
## 0.1.0-alpha.6 (2025-02-22)
|
|
176
|
+
|
|
177
|
+
Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
|
|
178
|
+
|
|
179
|
+
### Chores
|
|
180
|
+
|
|
181
|
+
* **internal:** fix devcontainers setup ([#17](https://github.com/getivy/node-sdk/issues/17)) ([90840e8](https://github.com/getivy/node-sdk/commit/90840e8eebdae48b5e243a5a86dc332107afbd72))
|
|
182
|
+
|
|
183
|
+
## 0.1.0-alpha.5 (2025-02-14)
|
|
184
|
+
|
|
185
|
+
Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
|
|
186
|
+
|
|
187
|
+
### Features
|
|
188
|
+
|
|
189
|
+
* **client:** send `X-Stainless-Timeout` header ([#13](https://github.com/getivy/node-sdk/issues/13)) ([10e28f6](https://github.com/getivy/node-sdk/commit/10e28f6b1367a97d270886934ff39373a729deda))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Bug Fixes
|
|
193
|
+
|
|
194
|
+
* **client:** fix export map for index exports ([#15](https://github.com/getivy/node-sdk/issues/15)) ([08099f5](https://github.com/getivy/node-sdk/commit/08099f5c46df5d9c3123365f13ef0aca7e933c45))
|
|
195
|
+
|
|
196
|
+
## 0.1.0-alpha.4 (2025-01-29)
|
|
197
|
+
|
|
198
|
+
Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
|
|
199
|
+
|
|
200
|
+
### Features
|
|
201
|
+
|
|
202
|
+
* **api:** update via SDK Studio ([#10](https://github.com/getivy/node-sdk/issues/10)) ([7d501d6](https://github.com/getivy/node-sdk/commit/7d501d651b25856b2ff13d3553d2c2fb5fdb487a))
|
|
203
|
+
|
|
204
|
+
## 0.1.0-alpha.3 (2025-01-29)
|
|
205
|
+
|
|
206
|
+
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
|
|
207
|
+
|
|
208
|
+
### Features
|
|
209
|
+
|
|
210
|
+
* **api:** update via SDK Studio ([#7](https://github.com/getivy/node-sdk/issues/7)) ([de06aed](https://github.com/getivy/node-sdk/commit/de06aedf8b9d166836867ba72bd229557b29cf46))
|
|
211
|
+
|
|
3
212
|
## 0.1.0-alpha.2 (2025-01-29)
|
|
4
213
|
|
|
5
214
|
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/getivy/node-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2025
|
|
189
|
+
Copyright 2025 Ivy
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ivy Node API Library
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/@getivy/node-sdk) 
|
|
4
4
|
|
|
5
|
-
This library provides convenient access to the
|
|
5
|
+
This library provides convenient access to the Ivy REST API from server-side TypeScript or JavaScript.
|
|
6
6
|
|
|
7
7
|
The REST API documentation can be found on [docs.getivy.de](https://docs.getivy.de). The full API of this library can be found in [api.md](api.md).
|
|
8
8
|
|
|
9
|
-
It is generated with [Stainless](https://www.
|
|
9
|
+
It is generated with [Stainless](https://www.stainless.com/).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -20,9 +20,9 @@ The full API of this library can be found in [api.md](api.md).
|
|
|
20
20
|
|
|
21
21
|
<!-- prettier-ignore -->
|
|
22
22
|
```js
|
|
23
|
-
import
|
|
23
|
+
import Ivy from '@getivy/node-sdk';
|
|
24
24
|
|
|
25
|
-
const client = new
|
|
25
|
+
const client = new Ivy({
|
|
26
26
|
environment: 'sandbox', // defaults to 'production'
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -41,15 +41,15 @@ This library includes TypeScript definitions for all request params and response
|
|
|
41
41
|
|
|
42
42
|
<!-- prettier-ignore -->
|
|
43
43
|
```ts
|
|
44
|
-
import
|
|
44
|
+
import Ivy from '@getivy/node-sdk';
|
|
45
45
|
|
|
46
|
-
const client = new
|
|
46
|
+
const client = new Ivy({
|
|
47
47
|
environment: 'sandbox', // defaults to 'production'
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
async function main() {
|
|
51
|
-
const params:
|
|
52
|
-
const customer:
|
|
51
|
+
const params: Ivy.CustomerCreateParams = { email: 'REPLACE_ME' };
|
|
52
|
+
const customer: Ivy.CustomerCreateResponse = await client.customers.create(params);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
main();
|
|
@@ -67,7 +67,7 @@ a subclass of `APIError` will be thrown:
|
|
|
67
67
|
```ts
|
|
68
68
|
async function main() {
|
|
69
69
|
const customer = await client.customers.create({ email: 'REPLACE_ME' }).catch(async (err) => {
|
|
70
|
-
if (err instanceof
|
|
70
|
+
if (err instanceof Ivy.APIError) {
|
|
71
71
|
console.log(err.status); // 400
|
|
72
72
|
console.log(err.name); // BadRequestError
|
|
73
73
|
console.log(err.headers); // {server: 'nginx', ...}
|
|
@@ -104,7 +104,7 @@ You can use the `maxRetries` option to configure or disable this:
|
|
|
104
104
|
<!-- prettier-ignore -->
|
|
105
105
|
```js
|
|
106
106
|
// Configure the default for all requests:
|
|
107
|
-
const client = new
|
|
107
|
+
const client = new Ivy({
|
|
108
108
|
maxRetries: 0, // default is 2
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -121,7 +121,7 @@ Requests time out after 1 minute by default. You can configure this with a `time
|
|
|
121
121
|
<!-- prettier-ignore -->
|
|
122
122
|
```ts
|
|
123
123
|
// Configure the default for all requests:
|
|
124
|
-
const client = new
|
|
124
|
+
const client = new Ivy({
|
|
125
125
|
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
|
|
126
126
|
});
|
|
127
127
|
|
|
@@ -145,7 +145,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
|
|
|
145
145
|
|
|
146
146
|
<!-- prettier-ignore -->
|
|
147
147
|
```ts
|
|
148
|
-
const client = new
|
|
148
|
+
const client = new Ivy();
|
|
149
149
|
|
|
150
150
|
const response = await client.customers.create({ email: 'REPLACE_ME' }).asResponse();
|
|
151
151
|
console.log(response.headers.get('X-My-Header'));
|
|
@@ -208,13 +208,13 @@ By default, this library uses `node-fetch` in Node, and expects a global `fetch`
|
|
|
208
208
|
|
|
209
209
|
If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
|
|
210
210
|
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
|
|
211
|
-
add the following import before your first import `from "
|
|
211
|
+
add the following import before your first import `from "Ivy"`:
|
|
212
212
|
|
|
213
213
|
```ts
|
|
214
214
|
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
|
|
215
215
|
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
|
|
216
216
|
import '@getivy/node-sdk/shims/web';
|
|
217
|
-
import
|
|
217
|
+
import Ivy from '@getivy/node-sdk';
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
To do the inverse, add `import "@getivy/node-sdk/shims/node"` (which does import polyfills).
|
|
@@ -227,9 +227,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
|
|
|
227
227
|
|
|
228
228
|
```ts
|
|
229
229
|
import { fetch } from 'undici'; // as one example
|
|
230
|
-
import
|
|
230
|
+
import Ivy from '@getivy/node-sdk';
|
|
231
231
|
|
|
232
|
-
const client = new
|
|
232
|
+
const client = new Ivy({
|
|
233
233
|
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
|
|
234
234
|
console.log('About to make a request', url, init);
|
|
235
235
|
const response = await fetch(url, init);
|
|
@@ -254,7 +254,7 @@ import http from 'http';
|
|
|
254
254
|
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
255
255
|
|
|
256
256
|
// Configure the default for all requests:
|
|
257
|
-
const client = new
|
|
257
|
+
const client = new Ivy({
|
|
258
258
|
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
|
|
259
259
|
});
|
|
260
260
|
|
package/_shims/index.d.ts
CHANGED
|
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
|
|
|
79
79
|
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
|
|
80
80
|
|
|
81
81
|
export function isFsReadStream(value: any): value is FsReadStream;
|
|
82
|
+
|
|
83
|
+
export const init: () => void;
|
package/_shims/index.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const shims = require('./registry');
|
|
5
5
|
const auto = require('@getivy/node-sdk/_shims/auto/runtime');
|
|
6
|
-
|
|
6
|
+
exports.init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
for (const property of Object.keys(shims)) {
|
|
8
10
|
Object.defineProperty(exports, property, {
|
|
9
11
|
get() {
|
|
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
|
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
exports.init();
|
package/_shims/index.mjs
CHANGED
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as shims from './registry.mjs';
|
|
5
5
|
import * as auto from '@getivy/node-sdk/_shims/auto/runtime';
|
|
6
|
-
|
|
6
|
+
export const init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
export * from './registry.mjs';
|
|
10
|
+
|
|
11
|
+
init();
|
package/core.d.ts
CHANGED
|
@@ -6,6 +6,17 @@ export { type Response };
|
|
|
6
6
|
import { BlobLike } from "./uploads.js";
|
|
7
7
|
export { maybeMultipartFormRequestOptions, multipartFormRequestOptions, createForm, type Uploadable, } from "./uploads.js";
|
|
8
8
|
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Array` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*/
|
|
13
|
+
type _Array<T> = Array<T>;
|
|
14
|
+
/**
|
|
15
|
+
* An alias to the builtin `Record` type so we can
|
|
16
|
+
* easily alias it in import statements if there are name clashes.
|
|
17
|
+
*/
|
|
18
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
19
|
+
export type { _Array as Array, _Record as Record };
|
|
9
20
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
10
21
|
type APIResponseProps = {
|
|
11
22
|
response: Response;
|
|
@@ -97,7 +108,7 @@ export declare abstract class APIClient {
|
|
|
97
108
|
private methodRequest;
|
|
98
109
|
getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(path: string, Page: new (...args: any[]) => PageClass, opts?: RequestOptions<any>): PagePromise<PageClass, Item>;
|
|
99
110
|
private calculateContentLength;
|
|
100
|
-
buildRequest<Req>(
|
|
111
|
+
buildRequest<Req>(inputOptions: FinalRequestOptions<Req>, { retryCount }?: {
|
|
101
112
|
retryCount?: number;
|
|
102
113
|
}): {
|
|
103
114
|
req: RequestInit;
|
package/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;AACA,OAAO,EAEL,QAAQ,EAIT,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAEV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;AACA,OAAO,EAEL,QAAQ,EAIT,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAEV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;AACzB,OAAO,EAAE,QAAQ,EAA+B,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EAAE,MAAM,IAAI,KAAK,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAEnD,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,OAA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6 +16,8 @@ exports.isObj = exports.toBase64 = exports.getHeader = exports.getRequiredHeader
|
|
|
16
16
|
const version_1 = require("./version.js");
|
|
17
17
|
const error_1 = require("./error.js");
|
|
18
18
|
const index_1 = require("./_shims/index.js");
|
|
19
|
+
// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
|
|
20
|
+
(0, index_1.init)();
|
|
19
21
|
const uploads_1 = require("./uploads.js");
|
|
20
22
|
var uploads_2 = require("./uploads.js");
|
|
21
23
|
Object.defineProperty(exports, "maybeMultipartFormRequestOptions", { enumerable: true, get: function () { return uploads_2.maybeMultipartFormRequestOptions; } });
|
|
@@ -31,7 +33,8 @@ async function defaultParseResponse(props) {
|
|
|
31
33
|
return response;
|
|
32
34
|
}
|
|
33
35
|
const contentType = response.headers.get('content-type');
|
|
34
|
-
const
|
|
36
|
+
const mediaType = contentType?.split(';')[0]?.trim();
|
|
37
|
+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
35
38
|
if (isJSON) {
|
|
36
39
|
const json = await response.json();
|
|
37
40
|
debug('response', response.status, response.url, response.headers, json);
|
|
@@ -190,7 +193,8 @@ class APIClient {
|
|
|
190
193
|
}
|
|
191
194
|
return null;
|
|
192
195
|
}
|
|
193
|
-
buildRequest(
|
|
196
|
+
buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
197
|
+
const options = { ...inputOptions };
|
|
194
198
|
const { method, path, query, headers: headers = {} } = options;
|
|
195
199
|
const body = ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
|
|
196
200
|
options.body
|
|
@@ -201,9 +205,9 @@ class APIClient {
|
|
|
201
205
|
const url = this.buildURL(path, query);
|
|
202
206
|
if ('timeout' in options)
|
|
203
207
|
validatePositiveInteger('timeout', options.timeout);
|
|
204
|
-
|
|
208
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
205
209
|
const httpAgent = options.httpAgent ?? this.httpAgent ?? (0, index_1.getDefaultAgent)(url);
|
|
206
|
-
const minAgentTimeout = timeout + 1000;
|
|
210
|
+
const minAgentTimeout = options.timeout + 1000;
|
|
207
211
|
if (typeof httpAgent?.options?.timeout === 'number' &&
|
|
208
212
|
minAgentTimeout > (httpAgent.options.timeout ?? 0)) {
|
|
209
213
|
// Allow any given request to bump our agent active socket timeout.
|
|
@@ -213,9 +217,9 @@ class APIClient {
|
|
|
213
217
|
httpAgent.options.timeout = minAgentTimeout;
|
|
214
218
|
}
|
|
215
219
|
if (this.idempotencyHeader && method !== 'get') {
|
|
216
|
-
if (!
|
|
217
|
-
|
|
218
|
-
headers[this.idempotencyHeader] =
|
|
220
|
+
if (!inputOptions.idempotencyKey)
|
|
221
|
+
inputOptions.idempotencyKey = this.defaultIdempotencyKey();
|
|
222
|
+
headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
|
|
219
223
|
}
|
|
220
224
|
const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
|
|
221
225
|
const req = {
|
|
@@ -227,7 +231,7 @@ class APIClient {
|
|
|
227
231
|
// not compatible with standard web types
|
|
228
232
|
signal: options.signal ?? null,
|
|
229
233
|
};
|
|
230
|
-
return { req, url, timeout };
|
|
234
|
+
return { req, url, timeout: options.timeout };
|
|
231
235
|
}
|
|
232
236
|
buildHeaders({ options, headers, contentLength, retryCount, }) {
|
|
233
237
|
const reqHeaders = {};
|
|
@@ -241,13 +245,18 @@ class APIClient {
|
|
|
241
245
|
if ((0, uploads_1.isMultipartBody)(options.body) && index_1.kind !== 'node') {
|
|
242
246
|
delete reqHeaders['content-type'];
|
|
243
247
|
}
|
|
244
|
-
// Don't set
|
|
245
|
-
//
|
|
246
|
-
//
|
|
248
|
+
// Don't set theses headers if they were already set or removed through default headers or by the caller.
|
|
249
|
+
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
|
|
250
|
+
// for the removal case.
|
|
247
251
|
if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-retry-count') === undefined &&
|
|
248
252
|
(0, exports.getHeader)(headers, 'x-stainless-retry-count') === undefined) {
|
|
249
253
|
reqHeaders['x-stainless-retry-count'] = String(retryCount);
|
|
250
254
|
}
|
|
255
|
+
if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-timeout') === undefined &&
|
|
256
|
+
(0, exports.getHeader)(headers, 'x-stainless-timeout') === undefined &&
|
|
257
|
+
options.timeout) {
|
|
258
|
+
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
|
|
259
|
+
}
|
|
251
260
|
this.validateHeaders(reqHeaders, headers);
|
|
252
261
|
return reqHeaders;
|
|
253
262
|
}
|
|
@@ -345,7 +354,7 @@ class APIClient {
|
|
|
345
354
|
if (value === null) {
|
|
346
355
|
return `${encodeURIComponent(key)}=`;
|
|
347
356
|
}
|
|
348
|
-
throw new error_1.
|
|
357
|
+
throw new error_1.IvyError(`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.`);
|
|
349
358
|
})
|
|
350
359
|
.join('&');
|
|
351
360
|
}
|
|
@@ -453,7 +462,7 @@ class AbstractPage {
|
|
|
453
462
|
async getNextPage() {
|
|
454
463
|
const nextInfo = this.nextPageInfo();
|
|
455
464
|
if (!nextInfo) {
|
|
456
|
-
throw new error_1.
|
|
465
|
+
throw new error_1.IvyError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
|
|
457
466
|
}
|
|
458
467
|
const nextOptions = { ...this.options };
|
|
459
468
|
if ('params' in nextInfo && typeof nextOptions.query === 'object') {
|
|
@@ -698,10 +707,10 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
698
707
|
exports.sleep = sleep;
|
|
699
708
|
const validatePositiveInteger = (name, n) => {
|
|
700
709
|
if (typeof n !== 'number' || !Number.isInteger(n)) {
|
|
701
|
-
throw new error_1.
|
|
710
|
+
throw new error_1.IvyError(`${name} must be an integer`);
|
|
702
711
|
}
|
|
703
712
|
if (n < 0) {
|
|
704
|
-
throw new error_1.
|
|
713
|
+
throw new error_1.IvyError(`${name} must be a positive integer`);
|
|
705
714
|
}
|
|
706
715
|
return n;
|
|
707
716
|
};
|
|
@@ -719,7 +728,7 @@ const castToError = (err) => {
|
|
|
719
728
|
exports.castToError = castToError;
|
|
720
729
|
const ensurePresent = (value) => {
|
|
721
730
|
if (value == null)
|
|
722
|
-
throw new error_1.
|
|
731
|
+
throw new error_1.IvyError(`Expected a value to be given but received ${value} instead.`);
|
|
723
732
|
return value;
|
|
724
733
|
};
|
|
725
734
|
exports.ensurePresent = ensurePresent;
|
|
@@ -745,7 +754,7 @@ const coerceInteger = (value) => {
|
|
|
745
754
|
return Math.round(value);
|
|
746
755
|
if (typeof value === 'string')
|
|
747
756
|
return parseInt(value, 10);
|
|
748
|
-
throw new error_1.
|
|
757
|
+
throw new error_1.IvyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
|
|
749
758
|
};
|
|
750
759
|
exports.coerceInteger = coerceInteger;
|
|
751
760
|
const coerceFloat = (value) => {
|
|
@@ -753,7 +762,7 @@ const coerceFloat = (value) => {
|
|
|
753
762
|
return value;
|
|
754
763
|
if (typeof value === 'string')
|
|
755
764
|
return parseFloat(value);
|
|
756
|
-
throw new error_1.
|
|
765
|
+
throw new error_1.IvyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
|
|
757
766
|
};
|
|
758
767
|
exports.coerceFloat = coerceFloat;
|
|
759
768
|
const coerceBoolean = (value) => {
|
|
@@ -823,7 +832,7 @@ function applyHeadersMut(targetHeaders, newHeaders) {
|
|
|
823
832
|
}
|
|
824
833
|
function debug(action, ...args) {
|
|
825
834
|
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
|
|
826
|
-
console.log(`
|
|
835
|
+
console.log(`Ivy:DEBUG:${action}`, ...args);
|
|
827
836
|
}
|
|
828
837
|
}
|
|
829
838
|
exports.debug = debug;
|
|
@@ -898,7 +907,7 @@ const toBase64 = (str) => {
|
|
|
898
907
|
if (typeof btoa !== 'undefined') {
|
|
899
908
|
return btoa(str);
|
|
900
909
|
}
|
|
901
|
-
throw new error_1.
|
|
910
|
+
throw new error_1.IvyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined');
|
|
902
911
|
};
|
|
903
912
|
exports.toBase64 = toBase64;
|
|
904
913
|
function isObj(obj) {
|