@stigg/typescript 0.1.0-alpha.3 → 0.1.0-alpha.7

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.
Files changed (204) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +9 -0
  3. package/client.d.mts +6 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +16 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +17 -22
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/internal/qs/formats.d.mts +7 -0
  18. package/internal/qs/formats.d.mts.map +1 -0
  19. package/internal/qs/formats.d.ts +7 -0
  20. package/internal/qs/formats.d.ts.map +1 -0
  21. package/internal/qs/formats.js +13 -0
  22. package/internal/qs/formats.js.map +1 -0
  23. package/internal/qs/formats.mjs +9 -0
  24. package/internal/qs/formats.mjs.map +1 -0
  25. package/internal/qs/index.d.mts +10 -0
  26. package/internal/qs/index.d.mts.map +1 -0
  27. package/internal/qs/index.d.ts +10 -0
  28. package/internal/qs/index.d.ts.map +1 -0
  29. package/internal/qs/index.js +14 -0
  30. package/internal/qs/index.js.map +1 -0
  31. package/internal/qs/index.mjs +10 -0
  32. package/internal/qs/index.mjs.map +1 -0
  33. package/internal/qs/stringify.d.mts +3 -0
  34. package/internal/qs/stringify.d.mts.map +1 -0
  35. package/internal/qs/stringify.d.ts +3 -0
  36. package/internal/qs/stringify.d.ts.map +1 -0
  37. package/internal/qs/stringify.js +277 -0
  38. package/internal/qs/stringify.js.map +1 -0
  39. package/internal/qs/stringify.mjs +274 -0
  40. package/internal/qs/stringify.mjs.map +1 -0
  41. package/internal/qs/types.d.mts +57 -0
  42. package/internal/qs/types.d.mts.map +1 -0
  43. package/internal/qs/types.d.ts +57 -0
  44. package/internal/qs/types.d.ts.map +1 -0
  45. package/internal/qs/types.js +3 -0
  46. package/internal/qs/types.js.map +1 -0
  47. package/internal/qs/types.mjs +2 -0
  48. package/internal/qs/types.mjs.map +1 -0
  49. package/internal/qs/utils.d.mts +15 -0
  50. package/internal/qs/utils.d.mts.map +1 -0
  51. package/internal/qs/utils.d.ts +15 -0
  52. package/internal/qs/utils.d.ts.map +1 -0
  53. package/internal/qs/utils.js +230 -0
  54. package/internal/qs/utils.js.map +1 -0
  55. package/internal/qs/utils.mjs +217 -0
  56. package/internal/qs/utils.mjs.map +1 -0
  57. package/package.json +1 -1
  58. package/resources/index.d.mts +1 -1
  59. package/resources/index.d.mts.map +1 -1
  60. package/resources/index.d.ts +1 -1
  61. package/resources/index.d.ts.map +1 -1
  62. package/resources/index.js.map +1 -1
  63. package/resources/index.mjs +1 -1
  64. package/resources/index.mjs.map +1 -1
  65. package/resources/v1/coupons.d.mts +55 -96
  66. package/resources/v1/coupons.d.mts.map +1 -1
  67. package/resources/v1/coupons.d.ts +55 -96
  68. package/resources/v1/coupons.d.ts.map +1 -1
  69. package/resources/v1/coupons.js +4 -3
  70. package/resources/v1/coupons.js.map +1 -1
  71. package/resources/v1/coupons.mjs +4 -3
  72. package/resources/v1/coupons.mjs.map +1 -1
  73. package/resources/v1/customers/customers.d.mts +170 -46
  74. package/resources/v1/customers/customers.d.mts.map +1 -1
  75. package/resources/v1/customers/customers.d.ts +170 -46
  76. package/resources/v1/customers/customers.d.ts.map +1 -1
  77. package/resources/v1/customers/customers.js +32 -15
  78. package/resources/v1/customers/customers.js.map +1 -1
  79. package/resources/v1/customers/customers.mjs +32 -15
  80. package/resources/v1/customers/customers.mjs.map +1 -1
  81. package/resources/v1/customers/index.d.mts +2 -2
  82. package/resources/v1/customers/index.d.mts.map +1 -1
  83. package/resources/v1/customers/index.d.ts +2 -2
  84. package/resources/v1/customers/index.d.ts.map +1 -1
  85. package/resources/v1/customers/index.js +3 -3
  86. package/resources/v1/customers/index.js.map +1 -1
  87. package/resources/v1/customers/index.mjs +1 -1
  88. package/resources/v1/customers/index.mjs.map +1 -1
  89. package/resources/v1/customers/payment-method.d.mts +4 -2
  90. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  91. package/resources/v1/customers/payment-method.d.ts +4 -2
  92. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  93. package/resources/v1/customers/payment-method.js +4 -2
  94. package/resources/v1/customers/payment-method.js.map +1 -1
  95. package/resources/v1/customers/payment-method.mjs +4 -2
  96. package/resources/v1/customers/payment-method.mjs.map +1 -1
  97. package/resources/v1/customers/promotional-entitlements.d.mts +352 -0
  98. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
  99. package/resources/v1/customers/promotional-entitlements.d.ts +352 -0
  100. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
  101. package/resources/v1/customers/promotional-entitlements.js +25 -0
  102. package/resources/v1/customers/promotional-entitlements.js.map +1 -0
  103. package/resources/v1/customers/promotional-entitlements.mjs +21 -0
  104. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
  105. package/resources/v1/events.d.mts +63 -0
  106. package/resources/v1/events.d.mts.map +1 -0
  107. package/resources/v1/events.d.ts +63 -0
  108. package/resources/v1/events.d.ts.map +1 -0
  109. package/resources/v1/events.js +16 -0
  110. package/resources/v1/events.js.map +1 -0
  111. package/resources/v1/events.mjs +12 -0
  112. package/resources/v1/events.mjs.map +1 -0
  113. package/resources/v1/index.d.mts +7 -4
  114. package/resources/v1/index.d.mts.map +1 -1
  115. package/resources/v1/index.d.ts +7 -4
  116. package/resources/v1/index.d.ts.map +1 -1
  117. package/resources/v1/index.js +7 -1
  118. package/resources/v1/index.js.map +1 -1
  119. package/resources/v1/index.mjs +4 -1
  120. package/resources/v1/index.mjs.map +1 -1
  121. package/resources/v1/products.d.mts +126 -0
  122. package/resources/v1/products.d.mts.map +1 -0
  123. package/resources/v1/products.d.ts +126 -0
  124. package/resources/v1/products.d.ts.map +1 -0
  125. package/resources/v1/products.js +19 -0
  126. package/resources/v1/products.js.map +1 -0
  127. package/resources/v1/products.mjs +15 -0
  128. package/resources/v1/products.mjs.map +1 -0
  129. package/resources/v1/subscriptions/future-update.d.mts +9 -22
  130. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  131. package/resources/v1/subscriptions/future-update.d.ts +9 -22
  132. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  133. package/resources/v1/subscriptions/future-update.js +3 -2
  134. package/resources/v1/subscriptions/future-update.js.map +1 -1
  135. package/resources/v1/subscriptions/future-update.mjs +3 -2
  136. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  137. package/resources/v1/subscriptions/index.d.mts +2 -2
  138. package/resources/v1/subscriptions/index.d.mts.map +1 -1
  139. package/resources/v1/subscriptions/index.d.ts +2 -2
  140. package/resources/v1/subscriptions/index.d.ts.map +1 -1
  141. package/resources/v1/subscriptions/index.js.map +1 -1
  142. package/resources/v1/subscriptions/index.mjs +1 -1
  143. package/resources/v1/subscriptions/index.mjs.map +1 -1
  144. package/resources/v1/subscriptions/subscriptions.d.mts +987 -949
  145. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  146. package/resources/v1/subscriptions/subscriptions.d.ts +987 -949
  147. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  148. package/resources/v1/subscriptions/subscriptions.js +39 -11
  149. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  150. package/resources/v1/subscriptions/subscriptions.mjs +40 -12
  151. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  152. package/resources/v1/usage.d.mts +230 -0
  153. package/resources/v1/usage.d.mts.map +1 -0
  154. package/resources/v1/usage.d.ts +230 -0
  155. package/resources/v1/usage.d.ts.map +1 -0
  156. package/resources/v1/usage.js +24 -0
  157. package/resources/v1/usage.js.map +1 -0
  158. package/resources/v1/usage.mjs +20 -0
  159. package/resources/v1/usage.mjs.map +1 -0
  160. package/resources/v1/v1.d.mts +18 -172
  161. package/resources/v1/v1.d.mts.map +1 -1
  162. package/resources/v1/v1.d.ts +18 -172
  163. package/resources/v1/v1.d.ts.map +1 -1
  164. package/resources/v1/v1.js +12 -12
  165. package/resources/v1/v1.js.map +1 -1
  166. package/resources/v1/v1.mjs +12 -12
  167. package/resources/v1/v1.mjs.map +1 -1
  168. package/src/client.ts +25 -40
  169. package/src/internal/parse.ts +6 -0
  170. package/src/internal/qs/LICENSE.md +13 -0
  171. package/src/internal/qs/README.md +3 -0
  172. package/src/internal/qs/formats.ts +10 -0
  173. package/src/internal/qs/index.ts +13 -0
  174. package/src/internal/qs/stringify.ts +385 -0
  175. package/src/internal/qs/types.ts +71 -0
  176. package/src/internal/qs/utils.ts +265 -0
  177. package/src/resources/index.ts +1 -7
  178. package/src/resources/v1/coupons.ts +63 -231
  179. package/src/resources/v1/customers/customers.ts +234 -60
  180. package/src/resources/v1/customers/index.ts +13 -2
  181. package/src/resources/v1/customers/payment-method.ts +4 -2
  182. package/src/resources/v1/customers/promotional-entitlements.ts +468 -0
  183. package/src/resources/v1/events.ts +74 -0
  184. package/src/resources/v1/index.ts +28 -15
  185. package/src/resources/v1/products.ts +162 -0
  186. package/src/resources/v1/subscriptions/future-update.ts +9 -30
  187. package/src/resources/v1/subscriptions/index.ts +8 -11
  188. package/src/resources/v1/subscriptions/subscriptions.ts +2699 -2280
  189. package/src/resources/v1/usage.ts +284 -0
  190. package/src/resources/v1/v1.ts +72 -220
  191. package/src/version.ts +1 -1
  192. package/version.d.mts +1 -1
  193. package/version.d.ts +1 -1
  194. package/version.js +1 -1
  195. package/version.mjs +1 -1
  196. package/resources/v1/customers/usage.d.mts +0 -4
  197. package/resources/v1/customers/usage.d.mts.map +0 -1
  198. package/resources/v1/customers/usage.d.ts +0 -4
  199. package/resources/v1/customers/usage.d.ts.map +0 -1
  200. package/resources/v1/customers/usage.js +0 -9
  201. package/resources/v1/customers/usage.js.map +0 -1
  202. package/resources/v1/customers/usage.mjs +0 -5
  203. package/resources/v1/customers/usage.mjs.map +0 -1
  204. package/src/resources/v1/customers/usage.ts +0 -5
@@ -1,184 +1,30 @@
1
1
  import { APIResource } from "../../core/resource.js";
2
2
  import * as CouponsAPI from "./coupons.js";
3
- import { CouponCreateParams, CouponCreateResponse, CouponListParams, CouponListResponse, CouponListResponsesMyCursorIDPage, CouponRetrieveResponse, Coupons } from "./coupons.js";
3
+ import { Coupon, CouponCreateParams, CouponListParams, CouponListResponse, CouponListResponsesMyCursorIDPage, Coupons } from "./coupons.js";
4
+ import * as EventsAPI from "./events.js";
5
+ import { EventReportParams, EventReportResponse, Events } from "./events.js";
6
+ import * as ProductsAPI from "./products.js";
7
+ import { ProductListProductsParams, ProductListProductsResponse, ProductListProductsResponsesMyCursorIDPage, Products } from "./products.js";
8
+ import * as UsageAPI from "./usage.js";
9
+ import { Usage, UsageHistoryParams, UsageHistoryResponse, UsageReportParams, UsageReportResponse } from "./usage.js";
4
10
  import * as CustomersAPI from "./customers/customers.js";
5
- import { CustomerCreateParams, CustomerListParams, CustomerListResponse, CustomerListResponsesMyCursorIDPage, CustomerResponse, CustomerUpdateParams, Customers } from "./customers/customers.js";
11
+ import { CustomerImportParams, CustomerImportResponse, CustomerListParams, CustomerListResourcesParams, CustomerListResourcesResponse, CustomerListResourcesResponsesMyCursorIDPage, CustomerListResponse, CustomerListResponsesMyCursorIDPage, CustomerProvisionParams, CustomerResponse, CustomerUpdateParams, Customers } from "./customers/customers.js";
6
12
  import * as SubscriptionsAPI from "./subscriptions/subscriptions.js";
7
- import { SubscriptionCreateParams, SubscriptionCreateResponse, SubscriptionDelegateParams, SubscriptionDelegateResponse, SubscriptionListParams, SubscriptionListResponse, SubscriptionListResponsesMyCursorIDPage, SubscriptionMigrateParams, SubscriptionMigrateResponse, SubscriptionPreviewParams, SubscriptionPreviewResponse, SubscriptionRetrieveResponse, SubscriptionTransferParams, SubscriptionTransferResponse, Subscriptions } from "./subscriptions/subscriptions.js";
8
- import { APIPromise } from "../../core/api-promise.js";
9
- import { RequestOptions } from "../../internal/request-options.js";
13
+ import { Subscription, SubscriptionCancelParams, SubscriptionDelegateParams, SubscriptionImportParams, SubscriptionImportResponse, SubscriptionListParams, SubscriptionListResponse, SubscriptionListResponsesMyCursorIDPage, SubscriptionMigrateParams, SubscriptionPreviewParams, SubscriptionPreviewResponse, SubscriptionProvisionParams, SubscriptionProvisionResponse, SubscriptionTransferParams, SubscriptionUpdateParams, Subscriptions } from "./subscriptions/subscriptions.js";
10
14
  export declare class V1 extends APIResource {
11
15
  customers: CustomersAPI.Customers;
12
16
  subscriptions: SubscriptionsAPI.Subscriptions;
13
17
  coupons: CouponsAPI.Coupons;
14
- /**
15
- * Report usage events
16
- */
17
- createEvent(body: V1CreateEventParams, options?: RequestOptions): APIPromise<V1CreateEventResponse>;
18
- /**
19
- * Report usage measurements
20
- */
21
- createUsage(body: V1CreateUsageParams, options?: RequestOptions): APIPromise<V1CreateUsageResponse>;
22
- }
23
- /**
24
- * Response object
25
- */
26
- export interface V1CreateEventResponse {
27
- /**
28
- * Empty success response confirming that events were successfully ingested and
29
- * queued for processing by Stigg's metering system.
30
- */
31
- data: unknown;
32
- }
33
- /**
34
- * Response containing reported usage measurements with current usage values,
35
- * period information, and reset dates for each measurement.
36
- */
37
- export interface V1CreateUsageResponse {
38
- /**
39
- * Array of usage measurements with current values and period info
40
- */
41
- data: Array<V1CreateUsageResponse.Data>;
42
- }
43
- export declare namespace V1CreateUsageResponse {
44
- /**
45
- * Recorded usage with period info
46
- */
47
- interface Data {
48
- /**
49
- * Unique identifier for the entity
50
- */
51
- id: string;
52
- /**
53
- * Timestamp of when the record was created
54
- */
55
- createdAt: string;
56
- /**
57
- * Customer id
58
- */
59
- customerId: string;
60
- /**
61
- * Feature id
62
- */
63
- featureId: string;
64
- /**
65
- * Timestamp
66
- */
67
- timestamp: string;
68
- /**
69
- * The usage measurement record
70
- */
71
- value: number;
72
- /**
73
- * The current measured usage value
74
- */
75
- currentUsage?: number | null;
76
- /**
77
- * The date when the next usage reset will occur
78
- */
79
- nextResetDate?: string | null;
80
- /**
81
- * Resource id
82
- */
83
- resourceId?: string | null;
84
- /**
85
- * The end date of the usage period in which this measurement resides (for
86
- * entitlements with a reset period)
87
- */
88
- usagePeriodEnd?: string | null;
89
- /**
90
- * The start date of the usage period in which this measurement resides (for
91
- * entitlements with a reset period)
92
- */
93
- usagePeriodStart?: string | null;
94
- }
95
- }
96
- export interface V1CreateEventParams {
97
- /**
98
- * A list of usage events to report
99
- */
100
- events: Array<V1CreateEventParams.Event>;
101
- }
102
- export declare namespace V1CreateEventParams {
103
- /**
104
- * Raw usage event
105
- */
106
- interface Event {
107
- /**
108
- * Customer id
109
- */
110
- customerId: string;
111
- /**
112
- * The name of the usage event
113
- */
114
- eventName: string;
115
- /**
116
- * Idempotency key
117
- */
118
- idempotencyKey: string;
119
- /**
120
- * Dimensions associated with the usage event
121
- */
122
- dimensions?: {
123
- [key: string]: string | number | boolean;
124
- };
125
- /**
126
- * Resource id
127
- */
128
- resourceId?: string | null;
129
- /**
130
- * Timestamp
131
- */
132
- timestamp?: string;
133
- }
134
- }
135
- export interface V1CreateUsageParams {
136
- /**
137
- * A list of usage reports to be submitted in bulk
138
- */
139
- usages: Array<V1CreateUsageParams.Usage>;
140
- }
141
- export declare namespace V1CreateUsageParams {
142
- /**
143
- * Single usage measurement
144
- */
145
- interface Usage {
146
- /**
147
- * Customer id
148
- */
149
- customerId: string;
150
- /**
151
- * Feature id
152
- */
153
- featureId: string;
154
- /**
155
- * The value to report for usage
156
- */
157
- value: number;
158
- /**
159
- * Timestamp of when the record was created
160
- */
161
- createdAt?: string;
162
- /**
163
- * Additional dimensions for the usage report
164
- */
165
- dimensions?: {
166
- [key: string]: string | number | boolean;
167
- };
168
- /**
169
- * Resource id
170
- */
171
- resourceId?: string | null;
172
- /**
173
- * The method by which the usage value should be updated
174
- */
175
- updateBehavior?: 'DELTA' | 'SET';
176
- }
18
+ events: EventsAPI.Events;
19
+ usage: UsageAPI.Usage;
20
+ products: ProductsAPI.Products;
177
21
  }
178
22
  export declare namespace V1 {
179
- export { type V1CreateEventResponse as V1CreateEventResponse, type V1CreateUsageResponse as V1CreateUsageResponse, type V1CreateEventParams as V1CreateEventParams, type V1CreateUsageParams as V1CreateUsageParams, };
180
- export { Customers as Customers, type CustomerResponse as CustomerResponse, type CustomerListResponse as CustomerListResponse, type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, };
181
- export { Subscriptions as Subscriptions, type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionRetrieveResponse as SubscriptionRetrieveResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionDelegateResponse as SubscriptionDelegateResponse, type SubscriptionMigrateResponse as SubscriptionMigrateResponse, type SubscriptionPreviewResponse as SubscriptionPreviewResponse, type SubscriptionTransferResponse as SubscriptionTransferResponse, type SubscriptionListResponsesMyCursorIDPage as SubscriptionListResponsesMyCursorIDPage, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionDelegateParams as SubscriptionDelegateParams, type SubscriptionMigrateParams as SubscriptionMigrateParams, type SubscriptionPreviewParams as SubscriptionPreviewParams, type SubscriptionTransferParams as SubscriptionTransferParams, };
182
- export { Coupons as Coupons, type CouponCreateResponse as CouponCreateResponse, type CouponRetrieveResponse as CouponRetrieveResponse, type CouponListResponse as CouponListResponse, type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponListParams as CouponListParams, };
23
+ export { Customers as Customers, type CustomerResponse as CustomerResponse, type CustomerListResponse as CustomerListResponse, type CustomerImportResponse as CustomerImportResponse, type CustomerListResourcesResponse as CustomerListResourcesResponse, type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage, type CustomerListResourcesResponsesMyCursorIDPage as CustomerListResourcesResponsesMyCursorIDPage, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerImportParams as CustomerImportParams, type CustomerListResourcesParams as CustomerListResourcesParams, type CustomerProvisionParams as CustomerProvisionParams, };
24
+ export { Subscriptions as Subscriptions, type Subscription as Subscription, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionImportResponse as SubscriptionImportResponse, type SubscriptionPreviewResponse as SubscriptionPreviewResponse, type SubscriptionProvisionResponse as SubscriptionProvisionResponse, type SubscriptionListResponsesMyCursorIDPage as SubscriptionListResponsesMyCursorIDPage, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionCancelParams as SubscriptionCancelParams, type SubscriptionDelegateParams as SubscriptionDelegateParams, type SubscriptionImportParams as SubscriptionImportParams, type SubscriptionMigrateParams as SubscriptionMigrateParams, type SubscriptionPreviewParams as SubscriptionPreviewParams, type SubscriptionProvisionParams as SubscriptionProvisionParams, type SubscriptionTransferParams as SubscriptionTransferParams, };
25
+ export { Coupons as Coupons, type Coupon as Coupon, type CouponListResponse as CouponListResponse, type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponListParams as CouponListParams, };
26
+ export { Events as Events, type EventReportResponse as EventReportResponse, type EventReportParams as EventReportParams, };
27
+ export { Usage as Usage, type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
28
+ export { Products as Products, type ProductListProductsResponse as ProductListProductsResponse, type ProductListProductsResponsesMyCursorIDPage as ProductListProductsResponsesMyCursorIDPage, type ProductListProductsParams as ProductListProductsParams, };
183
29
  }
184
30
  //# sourceMappingURL=v1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../src/resources/v1/v1.ts"],"names":[],"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,IAAI,uCAAuC,EACvF,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EACL,KAAK,IAAI,KAAK,EACd,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,0CAA0C,IAAI,0CAA0C,EAC7F,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
@@ -6,6 +6,12 @@ const tslib_1 = require("../../internal/tslib.js");
6
6
  const resource_1 = require("../../core/resource.js");
7
7
  const CouponsAPI = tslib_1.__importStar(require("./coupons.js"));
8
8
  const coupons_1 = require("./coupons.js");
9
+ const EventsAPI = tslib_1.__importStar(require("./events.js"));
10
+ const events_1 = require("./events.js");
11
+ const ProductsAPI = tslib_1.__importStar(require("./products.js"));
12
+ const products_1 = require("./products.js");
13
+ const UsageAPI = tslib_1.__importStar(require("./usage.js"));
14
+ const usage_1 = require("./usage.js");
9
15
  const CustomersAPI = tslib_1.__importStar(require("./customers/customers.js"));
10
16
  const customers_1 = require("./customers/customers.js");
11
17
  const SubscriptionsAPI = tslib_1.__importStar(require("./subscriptions/subscriptions.js"));
@@ -16,22 +22,16 @@ class V1 extends resource_1.APIResource {
16
22
  this.customers = new CustomersAPI.Customers(this._client);
17
23
  this.subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
18
24
  this.coupons = new CouponsAPI.Coupons(this._client);
19
- }
20
- /**
21
- * Report usage events
22
- */
23
- createEvent(body, options) {
24
- return this._client.post('/api/v1/events', { body, ...options });
25
- }
26
- /**
27
- * Report usage measurements
28
- */
29
- createUsage(body, options) {
30
- return this._client.post('/api/v1/usage', { body, ...options });
25
+ this.events = new EventsAPI.Events(this._client);
26
+ this.usage = new UsageAPI.Usage(this._client);
27
+ this.products = new ProductsAPI.Products(this._client);
31
28
  }
32
29
  }
33
30
  exports.V1 = V1;
34
31
  V1.Customers = customers_1.Customers;
35
32
  V1.Subscriptions = subscriptions_1.Subscriptions;
36
33
  V1.Coupons = coupons_1.Coupons;
34
+ V1.Events = events_1.Events;
35
+ V1.Usage = usage_1.Usage;
36
+ V1.Products = products_1.Products;
37
37
  //# sourceMappingURL=v1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"v1.js","sourceRoot":"","sources":["../../src/resources/v1/v1.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,iEAAwC;AACxC,0CAQmB;AACnB,+EAAsD;AACtD,wDAQ+B;AAC/B,2FAAkE;AAClE,oEAgBuC;AAIvC,MAAa,EAAG,SAAQ,sBAAW;IAAnC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAA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,CAAC,CAAC;QACnE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;CAAA;AAPD,gBAOC;AAED,EAAE,CAAC,SAAS,GAAG,qBAAS,CAAC;AACzB,EAAE,CAAC,aAAa,GAAG,6BAAa,CAAC;AACjC,EAAE,CAAC,OAAO,GAAG,iBAAO,CAAC;AACrB,EAAE,CAAC,MAAM,GAAG,eAAM,CAAC;AACnB,EAAE,CAAC,KAAK,GAAG,aAAK,CAAC;AACjB,EAAE,CAAC,QAAQ,GAAG,mBAAQ,CAAC"}
@@ -2,6 +2,12 @@
2
2
  import { APIResource } from "../../core/resource.mjs";
3
3
  import * as CouponsAPI from "./coupons.mjs";
4
4
  import { Coupons, } from "./coupons.mjs";
5
+ import * as EventsAPI from "./events.mjs";
6
+ import { Events } from "./events.mjs";
7
+ import * as ProductsAPI from "./products.mjs";
8
+ import { Products, } from "./products.mjs";
9
+ import * as UsageAPI from "./usage.mjs";
10
+ import { Usage, } from "./usage.mjs";
5
11
  import * as CustomersAPI from "./customers/customers.mjs";
6
12
  import { Customers, } from "./customers/customers.mjs";
7
13
  import * as SubscriptionsAPI from "./subscriptions/subscriptions.mjs";
@@ -12,21 +18,15 @@ export class V1 extends APIResource {
12
18
  this.customers = new CustomersAPI.Customers(this._client);
13
19
  this.subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
14
20
  this.coupons = new CouponsAPI.Coupons(this._client);
15
- }
16
- /**
17
- * Report usage events
18
- */
19
- createEvent(body, options) {
20
- return this._client.post('/api/v1/events', { body, ...options });
21
- }
22
- /**
23
- * Report usage measurements
24
- */
25
- createUsage(body, options) {
26
- return this._client.post('/api/v1/usage', { body, ...options });
21
+ this.events = new EventsAPI.Events(this._client);
22
+ this.usage = new UsageAPI.Usage(this._client);
23
+ this.products = new ProductsAPI.Products(this._client);
27
24
  }
28
25
  }
29
26
  V1.Customers = Customers;
30
27
  V1.Subscriptions = Subscriptions;
31
28
  V1.Coupons = Coupons;
29
+ V1.Events = Events;
30
+ V1.Usage = Usage;
31
+ V1.Products = Products;
32
32
  //# sourceMappingURL=v1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"v1.mjs","sourceRoot":"","sources":["../../src/resources/v1/v1.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAOL,OAAO,GACR;OACM,KAAK,YAAY;OACjB,EAOL,SAAS,GACV;OACM,KAAK,gBAAgB;OACrB,EAeL,aAAa,GACd;AAID,MAAM,OAAO,EAAG,SAAQ,WAAW;IAAnC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,kBAAa,GAAmC,IAAI,gBAAgB,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjG,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAerE,CAAC;IAbC;;OAEG;IACH,WAAW,CAAC,IAAyB,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,IAAyB,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AAqLD,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;AACzB,EAAE,CAAC,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/src/client.ts CHANGED
@@ -11,6 +11,7 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
+ import * as qs from './internal/qs';
14
15
  import { VERSION } from './version';
15
16
  import * as Errors from './core/error';
16
17
  import * as Pagination from './core/pagination';
@@ -18,13 +19,7 @@ import { AbstractPage, type MyCursorIDPageParams, MyCursorIDPageResponse } from
18
19
  import * as Uploads from './core/uploads';
19
20
  import * as API from './resources/index';
20
21
  import { APIPromise } from './core/api-promise';
21
- import {
22
- V1,
23
- V1CreateEventParams,
24
- V1CreateEventResponse,
25
- V1CreateUsageParams,
26
- V1CreateUsageResponse,
27
- } from './resources/v1/v1';
22
+ import { V1 } from './resources/v1/v1';
28
23
  import { type Fetch } from './internal/builtin-types';
29
24
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
30
25
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -135,7 +130,7 @@ export class Stigg {
135
130
  * API Client for interfacing with the Stigg API.
136
131
  *
137
132
  * @param {string | undefined} [opts.apiKey=process.env['STIGG_API_KEY'] ?? undefined]
138
- * @param {string} [opts.baseURL=process.env['STIGG_BASE_URL'] ?? https://api.example.com] - Override the default base URL for the API.
133
+ * @param {string} [opts.baseURL=process.env['STIGG_BASE_URL'] ?? https://api.stigg.io] - Override the default base URL for the API.
139
134
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
140
135
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
141
136
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -157,7 +152,7 @@ export class Stigg {
157
152
  const options: ClientOptions = {
158
153
  apiKey,
159
154
  ...opts,
160
- baseURL: baseURL || `https://api.example.com`,
155
+ baseURL: baseURL || `https://api.stigg.io`,
161
156
  };
162
157
 
163
158
  this.baseURL = options.baseURL!;
@@ -203,7 +198,7 @@ export class Stigg {
203
198
  * Check whether the base URL is set to its default.
204
199
  */
205
200
  #baseURLOverridden(): boolean {
206
- return this.baseURL !== 'https://api.example.com';
201
+ return this.baseURL !== 'https://api.stigg.io';
207
202
  }
208
203
 
209
204
  protected defaultQuery(): Record<string, string | undefined> | undefined {
@@ -218,24 +213,8 @@ export class Stigg {
218
213
  return buildHeaders([{ 'X-API-KEY': this.apiKey }]);
219
214
  }
220
215
 
221
- /**
222
- * Basic re-implementation of `qs.stringify` for primitive types.
223
- */
224
216
  protected stringifyQuery(query: Record<string, unknown>): string {
225
- return Object.entries(query)
226
- .filter(([_, value]) => typeof value !== 'undefined')
227
- .map(([key, value]) => {
228
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
229
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
230
- }
231
- if (value === null) {
232
- return `${encodeURIComponent(key)}=`;
233
- }
234
- throw new Errors.StiggError(
235
- `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.`,
236
- );
237
- })
238
- .join('&');
217
+ return qs.stringify(query, { arrayFormat: 'comma' });
239
218
  }
240
219
 
241
220
  private getUserAgent(): string {
@@ -456,7 +435,7 @@ export class Stigg {
456
435
  loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
457
436
 
458
437
  const errText = await response.text().catch((err: any) => castToError(err).message);
459
- const errJSON = safeJSON(errText);
438
+ const errJSON = safeJSON(errText) as any;
460
439
  const errMessage = errJSON ? undefined : errText;
461
440
 
462
441
  loggerFor(this).debug(
@@ -493,9 +472,14 @@ export class Stigg {
493
472
  getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
494
473
  path: string,
495
474
  Page: new (...args: any[]) => PageClass,
496
- opts?: RequestOptions,
475
+ opts?: PromiseOrValue<RequestOptions>,
497
476
  ): Pagination.PagePromise<PageClass, Item> {
498
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
477
+ return this.requestAPIList(
478
+ Page,
479
+ opts && 'then' in opts ?
480
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
481
+ : { method: 'get', path, ...opts },
482
+ );
499
483
  }
500
484
 
501
485
  requestAPIList<
@@ -503,7 +487,7 @@ export class Stigg {
503
487
  PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
504
488
  >(
505
489
  Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
506
- options: FinalRequestOptions,
490
+ options: PromiseOrValue<FinalRequestOptions>,
507
491
  ): Pagination.PagePromise<PageClass, Item> {
508
492
  const request = this.makeRequest(options, null, undefined);
509
493
  return new Pagination.PagePromise<PageClass, Item>(this as any as Stigg, request, Page);
@@ -516,9 +500,10 @@ export class Stigg {
516
500
  controller: AbortController,
517
501
  ): Promise<Response> {
518
502
  const { signal, method, ...options } = init || {};
519
- if (signal) signal.addEventListener('abort', () => controller.abort());
503
+ const abort = this._makeAbort(controller);
504
+ if (signal) signal.addEventListener('abort', abort, { once: true });
520
505
 
521
- const timeout = setTimeout(() => controller.abort(), ms);
506
+ const timeout = setTimeout(abort, ms);
522
507
 
523
508
  const isReadableBody =
524
509
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -685,6 +670,12 @@ export class Stigg {
685
670
  return headers.values;
686
671
  }
687
672
 
673
+ private _makeAbort(controller: AbortController) {
674
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
675
+ // would capture all request options, and cause a memory leak.
676
+ return () => controller.abort();
677
+ }
678
+
688
679
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
689
680
  bodyHeaders: HeadersLike;
690
681
  body: BodyInit | undefined;
@@ -755,11 +746,5 @@ export declare namespace Stigg {
755
746
  type MyCursorIDPageResponse as MyCursorIDPageResponse,
756
747
  };
757
748
 
758
- export {
759
- V1 as V1,
760
- type V1CreateEventResponse as V1CreateEventResponse,
761
- type V1CreateUsageResponse as V1CreateUsageResponse,
762
- type V1CreateEventParams as V1CreateEventParams,
763
- type V1CreateUsageParams as V1CreateUsageParams,
764
- };
749
+ export { V1 as V1 };
765
750
  }
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Stigg, props: APIResponseP
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }
@@ -0,0 +1,13 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,3 @@
1
+ # qs
2
+
3
+ This is a vendored version of [neoqs](https://github.com/PuruVJ/neoqs) which is a TypeScript rewrite of [qs](https://github.com/ljharb/qs), a query string library.
@@ -0,0 +1,10 @@
1
+ import type { Format } from './types';
2
+
3
+ export const default_format: Format = 'RFC3986';
4
+ export const default_formatter = (v: PropertyKey) => String(v);
5
+ export const formatters: Record<Format, (str: PropertyKey) => string> = {
6
+ RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'),
7
+ RFC3986: default_formatter,
8
+ };
9
+ export const RFC1738 = 'RFC1738';
10
+ export const RFC3986 = 'RFC3986';
@@ -0,0 +1,13 @@
1
+ import { default_format, formatters, RFC1738, RFC3986 } from './formats';
2
+
3
+ const formats = {
4
+ formatters,
5
+ RFC1738,
6
+ RFC3986,
7
+ default: default_format,
8
+ };
9
+
10
+ export { stringify } from './stringify';
11
+ export { formats };
12
+
13
+ export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types';