@usehercules/sdk 1.14.3 → 1.14.5

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 (148) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/client.d.mts +3 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -7
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -7
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/env.js +2 -2
  12. package/internal/utils/env.js.map +1 -1
  13. package/internal/utils/env.mjs +2 -2
  14. package/internal/utils/env.mjs.map +1 -1
  15. package/internal/utils/query.d.mts +2 -0
  16. package/internal/utils/query.d.mts.map +1 -0
  17. package/internal/utils/query.d.ts +2 -0
  18. package/internal/utils/query.d.ts.map +1 -0
  19. package/internal/utils/query.js +10 -0
  20. package/internal/utils/query.js.map +1 -0
  21. package/internal/utils/query.mjs +6 -0
  22. package/internal/utils/query.mjs.map +1 -0
  23. package/internal/utils.d.mts +1 -0
  24. package/internal/utils.d.ts +1 -0
  25. package/internal/utils.js +1 -0
  26. package/internal/utils.js.map +1 -1
  27. package/internal/utils.mjs +1 -0
  28. package/package.json +7 -1
  29. package/resources/commerce/coupons.d.mts +1 -1
  30. package/resources/commerce/coupons.d.mts.map +1 -1
  31. package/resources/commerce/coupons.d.ts +1 -1
  32. package/resources/commerce/coupons.d.ts.map +1 -1
  33. package/resources/commerce/coupons.js +1 -1
  34. package/resources/commerce/coupons.js.map +1 -1
  35. package/resources/commerce/coupons.mjs +1 -1
  36. package/resources/commerce/coupons.mjs.map +1 -1
  37. package/resources/commerce/customers.d.mts +3 -3
  38. package/resources/commerce/customers.d.mts.map +1 -1
  39. package/resources/commerce/customers.d.ts +3 -3
  40. package/resources/commerce/customers.d.ts.map +1 -1
  41. package/resources/commerce/customers.js +3 -3
  42. package/resources/commerce/customers.js.map +1 -1
  43. package/resources/commerce/customers.mjs +3 -3
  44. package/resources/commerce/customers.mjs.map +1 -1
  45. package/resources/commerce/features.d.mts +1 -1
  46. package/resources/commerce/features.d.mts.map +1 -1
  47. package/resources/commerce/features.d.ts +1 -1
  48. package/resources/commerce/features.d.ts.map +1 -1
  49. package/resources/commerce/features.js +1 -1
  50. package/resources/commerce/features.js.map +1 -1
  51. package/resources/commerce/features.mjs +1 -1
  52. package/resources/commerce/features.mjs.map +1 -1
  53. package/resources/commerce/products/products.d.mts +1 -1
  54. package/resources/commerce/products/products.d.mts.map +1 -1
  55. package/resources/commerce/products/products.d.ts +1 -1
  56. package/resources/commerce/products/products.d.ts.map +1 -1
  57. package/resources/commerce/products/products.js +1 -1
  58. package/resources/commerce/products/products.js.map +1 -1
  59. package/resources/commerce/products/products.mjs +1 -1
  60. package/resources/commerce/products/products.mjs.map +1 -1
  61. package/resources/content/assets.d.mts +1 -1
  62. package/resources/content/assets.d.mts.map +1 -1
  63. package/resources/content/assets.d.ts +1 -1
  64. package/resources/content/assets.d.ts.map +1 -1
  65. package/resources/content/assets.js +1 -1
  66. package/resources/content/assets.js.map +1 -1
  67. package/resources/content/assets.mjs +1 -1
  68. package/resources/content/assets.mjs.map +1 -1
  69. package/resources/content/collections/collections.d.mts +1 -1
  70. package/resources/content/collections/collections.d.mts.map +1 -1
  71. package/resources/content/collections/collections.d.ts +1 -1
  72. package/resources/content/collections/collections.d.ts.map +1 -1
  73. package/resources/content/collections/collections.js +1 -1
  74. package/resources/content/collections/collections.js.map +1 -1
  75. package/resources/content/collections/collections.mjs +1 -1
  76. package/resources/content/collections/collections.mjs.map +1 -1
  77. package/resources/content/entries.d.mts +6 -22
  78. package/resources/content/entries.d.mts.map +1 -1
  79. package/resources/content/entries.d.ts +6 -22
  80. package/resources/content/entries.d.ts.map +1 -1
  81. package/resources/content/entries.js +2 -2
  82. package/resources/content/entries.js.map +1 -1
  83. package/resources/content/entries.mjs +2 -2
  84. package/resources/content/entries.mjs.map +1 -1
  85. package/resources/content/locales.d.mts +1 -1
  86. package/resources/content/locales.d.mts.map +1 -1
  87. package/resources/content/locales.d.ts +1 -1
  88. package/resources/content/locales.d.ts.map +1 -1
  89. package/resources/content/locales.js +1 -1
  90. package/resources/content/locales.js.map +1 -1
  91. package/resources/content/locales.mjs +1 -1
  92. package/resources/content/locales.mjs.map +1 -1
  93. package/resources/content/releases/releases.d.mts +1 -1
  94. package/resources/content/releases/releases.d.mts.map +1 -1
  95. package/resources/content/releases/releases.d.ts +1 -1
  96. package/resources/content/releases/releases.d.ts.map +1 -1
  97. package/resources/content/releases/releases.js +1 -1
  98. package/resources/content/releases/releases.js.map +1 -1
  99. package/resources/content/releases/releases.mjs +1 -1
  100. package/resources/content/releases/releases.mjs.map +1 -1
  101. package/resources/email/email.d.mts +53 -4
  102. package/resources/email/email.d.mts.map +1 -1
  103. package/resources/email/email.d.ts +53 -4
  104. package/resources/email/email.d.ts.map +1 -1
  105. package/resources/email/email.js.map +1 -1
  106. package/resources/email/email.mjs.map +1 -1
  107. package/resources/email/identities.d.mts +50 -12
  108. package/resources/email/identities.d.mts.map +1 -1
  109. package/resources/email/identities.d.ts +50 -12
  110. package/resources/email/identities.d.ts.map +1 -1
  111. package/resources/email/identities.js +2 -2
  112. package/resources/email/identities.js.map +1 -1
  113. package/resources/email/identities.mjs +2 -2
  114. package/resources/email/identities.mjs.map +1 -1
  115. package/resources/email/index.d.mts +2 -2
  116. package/resources/email/index.d.mts.map +1 -1
  117. package/resources/email/index.d.ts +2 -2
  118. package/resources/email/index.d.ts.map +1 -1
  119. package/resources/email/index.js.map +1 -1
  120. package/resources/email/index.mjs.map +1 -1
  121. package/resources/index.d.mts +1 -1
  122. package/resources/index.d.mts.map +1 -1
  123. package/resources/index.d.ts +1 -1
  124. package/resources/index.d.ts.map +1 -1
  125. package/resources/index.js.map +1 -1
  126. package/resources/index.mjs.map +1 -1
  127. package/src/client.ts +20 -9
  128. package/src/internal/utils/env.ts +2 -2
  129. package/src/internal/utils/query.ts +7 -0
  130. package/src/internal/utils.ts +1 -0
  131. package/src/resources/commerce/coupons.ts +1 -5
  132. package/src/resources/commerce/customers.ts +3 -7
  133. package/src/resources/commerce/features.ts +1 -5
  134. package/src/resources/commerce/products/products.ts +1 -5
  135. package/src/resources/content/assets.ts +1 -5
  136. package/src/resources/content/collections/collections.ts +1 -1
  137. package/src/resources/content/entries.ts +6 -34
  138. package/src/resources/content/locales.ts +1 -5
  139. package/src/resources/content/releases/releases.ts +1 -5
  140. package/src/resources/email/email.ts +64 -1
  141. package/src/resources/email/identities.ts +59 -12
  142. package/src/resources/email/index.ts +2 -0
  143. package/src/resources/index.ts +1 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.ts +1 -1
  147. package/version.js +1 -1
  148. package/version.mjs +1 -1
@@ -1,7 +1,7 @@
1
1
  export { Commerce, type Currency, type CommerceCancelResponse, type CommerceCheckResponse, type CommerceCheckoutResponse, type CommerceCancelParams, type CommerceCheckParams, type CommerceCheckoutParams, } from "./commerce/commerce.mjs";
2
2
  export { Content } from "./content/content.mjs";
3
3
  export { Domains, type Domain, type DomainListParams, type DomainsCursorIDPage } from "./domains.mjs";
4
- export { EmailResource, type Attachment, type Email, type EmailSendResponse, type EmailListParams, type EmailSendParams, type EmailsCursorIDPage, } from "./email/email.mjs";
4
+ export { EmailResource, type Attachment, type Email, type EmailGetResponse, type EmailSendResponse, type EmailListParams, type EmailSendParams, type EmailsCursorIDPage, } from "./email/email.mjs";
5
5
  export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.mjs";
6
6
  export { PushNotifications, type PushNotificationEnableResponse, type PushNotificationIdentifyResponse, type PushNotificationSendResponse, type PushNotificationSubscribeResponse, type PushNotificationUnsubscribeResponse, type PushNotificationIdentifyParams, type PushNotificationSendParams, type PushNotificationSubscribeParams, type PushNotificationUnsubscribeParams, } from "./push-notifications/push-notifications.mjs";
7
7
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE;OACzE,EACL,aAAa,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB;OACM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE;OAC9E,EACL,iBAAiB,EACjB,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,GACvC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE;OACzE,EACL,aAAa,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB;OACM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE;OAC9E,EACL,iBAAiB,EACjB,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,GACvC"}
@@ -1,7 +1,7 @@
1
1
  export { Commerce, type Currency, type CommerceCancelResponse, type CommerceCheckResponse, type CommerceCheckoutResponse, type CommerceCancelParams, type CommerceCheckParams, type CommerceCheckoutParams, } from "./commerce/commerce.js";
2
2
  export { Content } from "./content/content.js";
3
3
  export { Domains, type Domain, type DomainListParams, type DomainsCursorIDPage } from "./domains.js";
4
- export { EmailResource, type Attachment, type Email, type EmailSendResponse, type EmailListParams, type EmailSendParams, type EmailsCursorIDPage, } from "./email/email.js";
4
+ export { EmailResource, type Attachment, type Email, type EmailGetResponse, type EmailSendResponse, type EmailListParams, type EmailSendParams, type EmailsCursorIDPage, } from "./email/email.js";
5
5
  export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.js";
6
6
  export { PushNotifications, type PushNotificationEnableResponse, type PushNotificationIdentifyResponse, type PushNotificationSendResponse, type PushNotificationSubscribeResponse, type PushNotificationUnsubscribeResponse, type PushNotificationIdentifyParams, type PushNotificationSendParams, type PushNotificationSubscribeParams, type PushNotificationUnsubscribeParams, } from "./push-notifications/push-notifications.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE;OACzE,EACL,aAAa,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB;OACM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE;OAC9E,EACL,iBAAiB,EACjB,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,GACvC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE;OACzE,EACL,aAAa,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB;OACM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE;OAC9E,EACL,iBAAiB,EACjB,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,GACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,mDAS6B;AAR3B,oGAAA,QAAQ,OAAA;AASV,gDAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,wCAAkG;AAAzF,kGAAA,OAAO,OAAA;AAChB,0CAQuB;AAPrB,sGAAA,aAAa,OAAA;AAQf,oCAAqG;AAA5F,8FAAA,KAAK,OAAA;AACd,iFAWiD;AAV/C,uHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,mDAS6B;AAR3B,oGAAA,QAAQ,OAAA;AASV,gDAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,wCAAkG;AAAzF,kGAAA,OAAO,OAAA;AAChB,0CASuB;AARrB,sGAAA,aAAa,OAAA;AASf,oCAAqG;AAA5F,8FAAA,KAAK,OAAA;AACd,iFAWiD;AAV/C,uHAAA,iBAAiB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAQT;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAgE;OACzE,EACL,aAAa,GAOd;OACM,EAAE,KAAK,EAAuE;OAC9E,EACL,iBAAiB,GAUlB"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAQT;OACM,EAAE,OAAO,EAAE;OACX,EAAE,OAAO,EAAgE;OACzE,EACL,aAAa,GAQd;OACM,EAAE,KAAK,EAAuE;OAC9E,EACL,iBAAiB,GAUlB"}
package/src/client.ts CHANGED
@@ -11,7 +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
+ import { stringifyQuery } from './internal/utils/query';
15
15
  import { VERSION } from './version';
16
16
  import * as Errors from './core/error';
17
17
  import * as Pagination from './core/pagination';
@@ -35,6 +35,7 @@ import { Content } from './resources/content/content';
35
35
  import {
36
36
  Attachment,
37
37
  Email,
38
+ EmailGetResponse,
38
39
  EmailListParams,
39
40
  EmailResource,
40
41
  EmailSendParams,
@@ -263,8 +264,8 @@ export class Hercules {
263
264
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
264
265
  }
265
266
 
266
- protected stringifyQuery(query: Record<string, unknown>): string {
267
- return qs.stringify(query, { arrayFormat: 'comma' });
267
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
268
+ return stringifyQuery(query);
268
269
  }
269
270
 
270
271
  private getUserAgent(): string {
@@ -296,12 +297,13 @@ export class Hercules {
296
297
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
297
298
 
298
299
  const defaultQuery = this.defaultQuery();
299
- if (!isEmptyObj(defaultQuery)) {
300
- query = { ...defaultQuery, ...query };
300
+ const pathQuery = Object.fromEntries(url.searchParams);
301
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
302
+ query = { ...pathQuery, ...defaultQuery, ...query };
301
303
  }
302
304
 
303
305
  if (typeof query === 'object' && query && !Array.isArray(query)) {
304
- url.search = this.stringifyQuery(query as Record<string, unknown>);
306
+ url.search = this.stringifyQuery(query);
305
307
  }
306
308
 
307
309
  return url.toString();
@@ -630,9 +632,9 @@ export class Hercules {
630
632
  }
631
633
  }
632
634
 
633
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
634
- // just do what it says, but otherwise calculate a default
635
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
635
+ // If the API asks us to wait a certain amount of time, just do what it
636
+ // says, but otherwise calculate a default
637
+ if (timeoutMillis === undefined) {
636
638
  const maxRetries = options.maxRetries ?? this.maxRetries;
637
639
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
638
640
  }
@@ -759,6 +761,14 @@ export class Hercules {
759
761
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
760
762
  ) {
761
763
  return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
764
+ } else if (
765
+ typeof body === 'object' &&
766
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
767
+ ) {
768
+ return {
769
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
770
+ body: this.stringifyQuery(body),
771
+ };
762
772
  } else {
763
773
  return this.#encoder({ body, headers });
764
774
  }
@@ -848,6 +858,7 @@ export declare namespace Hercules {
848
858
  EmailResource as EmailResource,
849
859
  type Attachment as Attachment,
850
860
  type Email as Email,
861
+ type EmailGetResponse as EmailGetResponse,
851
862
  type EmailSendResponse as EmailSendResponse,
852
863
  type EmailsCursorIDPage as EmailsCursorIDPage,
853
864
  type EmailListParams as EmailListParams,
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as qs from '../qs/stringify';
4
+
5
+ export function stringifyQuery(query: object | Record<string, unknown>) {
6
+ return qs.stringify(query, { arrayFormat: 'comma' });
7
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -35,11 +35,7 @@ export class Coupons extends APIResource {
35
35
  * );
36
36
  * ```
37
37
  */
38
- update(
39
- couponID: string,
40
- body: CouponUpdateParams | null | undefined = {},
41
- options?: RequestOptions,
42
- ): APIPromise<Coupon> {
38
+ update(couponID: string, body: CouponUpdateParams, options?: RequestOptions): APIPromise<Coupon> {
43
39
  return this._client.patch(path`/v1/commerce/coupons/${couponID}`, { body, ...options });
44
40
  }
45
41
 
@@ -18,7 +18,7 @@ export class Customers extends APIResource {
18
18
  * const customer = await client.commerce.customers.create();
19
19
  * ```
20
20
  */
21
- create(body: CustomerCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<Customer> {
21
+ create(body: CustomerCreateParams, options?: RequestOptions): APIPromise<Customer> {
22
22
  return this._client.post('/v1/commerce/customers', { body, ...options });
23
23
  }
24
24
 
@@ -33,11 +33,7 @@ export class Customers extends APIResource {
33
33
  * );
34
34
  * ```
35
35
  */
36
- update(
37
- customerID: string,
38
- body: CustomerUpdateParams | null | undefined = {},
39
- options?: RequestOptions,
40
- ): APIPromise<Customer> {
36
+ update(customerID: string, body: CustomerUpdateParams, options?: RequestOptions): APIPromise<Customer> {
41
37
  return this._client.patch(path`/v1/commerce/customers/${customerID}`, { body, ...options });
42
38
  }
43
39
 
@@ -75,7 +71,7 @@ export class Customers extends APIResource {
75
71
  */
76
72
  billingPortal(
77
73
  customerID: string,
78
- body: CustomerBillingPortalParams | null | undefined = {},
74
+ body: CustomerBillingPortalParams,
79
75
  options?: RequestOptions,
80
76
  ): APIPromise<CustomerBillingPortalResponse> {
81
77
  return this._client.post(path`/v1/commerce/customers/${customerID}/billing_portal`, { body, ...options });
@@ -33,11 +33,7 @@ export class Features extends APIResource {
33
33
  * );
34
34
  * ```
35
35
  */
36
- update(
37
- featureID: string,
38
- body: FeatureUpdateParams | null | undefined = {},
39
- options?: RequestOptions,
40
- ): APIPromise<Feature> {
36
+ update(featureID: string, body: FeatureUpdateParams, options?: RequestOptions): APIPromise<Feature> {
41
37
  return this._client.patch(path`/v1/commerce/features/${featureID}`, { body, ...options });
42
38
  }
43
39
 
@@ -61,11 +61,7 @@ export class Products extends APIResource {
61
61
  * );
62
62
  * ```
63
63
  */
64
- update(
65
- productID: string,
66
- body: ProductUpdateParams | null | undefined = {},
67
- options?: RequestOptions,
68
- ): APIPromise<Product> {
64
+ update(productID: string, body: ProductUpdateParams, options?: RequestOptions): APIPromise<Product> {
69
65
  return this._client.patch(path`/v1/commerce/products/${productID}`, { body, ...options });
70
66
  }
71
67
 
@@ -21,11 +21,7 @@ export class Assets extends APIResource {
21
21
  * Updates asset metadata including URL, folder, title, description, and custom
22
22
  * metadata.
23
23
  */
24
- update(
25
- assetID: string,
26
- body: AssetUpdateParams | null | undefined = {},
27
- options?: RequestOptions,
28
- ): APIPromise<Asset> {
24
+ update(assetID: string, body: AssetUpdateParams, options?: RequestOptions): APIPromise<Asset> {
29
25
  return this._client.patch(path`/v1/content/assets/${assetID}`, { body, ...options });
30
26
  }
31
27
 
@@ -26,7 +26,7 @@ export class Collections extends APIResource {
26
26
  */
27
27
  update(
28
28
  collectionID: string,
29
- body: CollectionUpdateParams | null | undefined = {},
29
+ body: CollectionUpdateParams,
30
30
  options?: RequestOptions,
31
31
  ): APIPromise<Collection> {
32
32
  return this._client.patch(path`/v1/content/collections/${collectionID}`, { body, ...options });
@@ -20,11 +20,7 @@ export class Entries extends APIResource {
20
20
  * fields are modified. Use the version parameter for optimistic locking to prevent
21
21
  * concurrent update conflicts.
22
22
  */
23
- update(
24
- entryID: string,
25
- body: EntryUpdateParams | null | undefined = {},
26
- options?: RequestOptions,
27
- ): APIPromise<Entry> {
23
+ update(entryID: string, body: EntryUpdateParams, options?: RequestOptions): APIPromise<Entry> {
28
24
  return this._client.patch(path`/v1/content/entries/${entryID}`, { body, ...options });
29
25
  }
30
26
 
@@ -61,11 +57,7 @@ export class Entries extends APIResource {
61
57
  * publishing for a future time. Publishing validates that all required fields have
62
58
  * values.
63
59
  */
64
- publish(
65
- entryID: string,
66
- body: EntryPublishParams | null | undefined = {},
67
- options?: RequestOptions,
68
- ): APIPromise<Entry> {
60
+ publish(entryID: string, body: EntryPublishParams, options?: RequestOptions): APIPromise<Entry> {
69
61
  return this._client.post(path`/v1/content/entries/${entryID}/publish`, { body, ...options });
70
62
  }
71
63
 
@@ -101,16 +93,11 @@ export interface Entry {
101
93
  created: string;
102
94
 
103
95
  /**
104
- * Field values. For localized fields: { fieldApiId: { locale: value } }. For
105
- * non-localized: { fieldApiId: value }
96
+ * Field values. Localization is field-level: localized fields use { fieldApiId: {
97
+ * locale: value } }, non-localized use { fieldApiId: value }.
106
98
  */
107
99
  fields: { [key: string]: unknown };
108
100
 
109
- /**
110
- * Primary locale for this entry
111
- */
112
- locale: string;
113
-
114
101
  /**
115
102
  * Publishing status: draft, published, or archived
116
103
  */
@@ -165,16 +152,11 @@ export interface EntryCreateParams {
165
152
  id?: string;
166
153
 
167
154
  /**
168
- * Field values. For localized fields: { fieldApiId: { locale: value } }. For
169
- * non-localized: { fieldApiId: value }
155
+ * Field values. Localization is field-level: localized fields use { fieldApiId: {
156
+ * locale: value } }, non-localized use { fieldApiId: value }.
170
157
  */
171
158
  fields?: { [key: string]: unknown };
172
159
 
173
- /**
174
- * Primary locale for this entry
175
- */
176
- locale?: string;
177
-
178
160
  /**
179
161
  * Initial status (default: draft)
180
162
  */
@@ -188,11 +170,6 @@ export interface EntryUpdateParams {
188
170
  */
189
171
  fields?: { [key: string]: unknown };
190
172
 
191
- /**
192
- * Primary locale
193
- */
194
- locale?: string;
195
-
196
173
  /**
197
174
  * Expected version for optimistic locking. Update fails if version mismatch.
198
175
  */
@@ -215,11 +192,6 @@ export interface EntryListParams extends CursorIDPageParams {
215
192
  */
216
193
  include_depth?: number;
217
194
 
218
- /**
219
- * Filter by primary locale
220
- */
221
- locale?: string;
222
-
223
195
  /**
224
196
  * JSON-encoded sort order. Example: {"field":"publishedAt","direction":"desc"}
225
197
  */
@@ -20,11 +20,7 @@ export class Locales extends APIResource {
20
20
  * Updates a locale's configuration including name, fallback, default status, and
21
21
  * active status.
22
22
  */
23
- update(
24
- localeCode: string,
25
- body: LocaleUpdateParams | null | undefined = {},
26
- options?: RequestOptions,
27
- ): APIPromise<Locale> {
23
+ update(localeCode: string, body: LocaleUpdateParams, options?: RequestOptions): APIPromise<Locale> {
28
24
  return this._client.patch(path`/v1/content/locales/${localeCode}`, { body, ...options });
29
25
  }
30
26
 
@@ -23,11 +23,7 @@ export class Releases extends APIResource {
23
23
  /**
24
24
  * Updates a release name and description. Only draft releases can be updated.
25
25
  */
26
- update(
27
- releaseID: string,
28
- body: ReleaseUpdateParams | null | undefined = {},
29
- options?: RequestOptions,
30
- ): APIPromise<Release> {
26
+ update(releaseID: string, body: ReleaseUpdateParams, options?: RequestOptions): APIPromise<Release> {
31
27
  return this._client.patch(path`/v1/content/releases/${releaseID}`, { body, ...options });
32
28
  }
33
29
 
@@ -8,6 +8,7 @@ import {
8
8
  Identity,
9
9
  IdentityCreateParams,
10
10
  IdentityListParams,
11
+ IdentityVerifyParams,
11
12
  } from './identities';
12
13
  import { APIPromise } from '../../core/api-promise';
13
14
  import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../core/pagination';
@@ -35,7 +36,7 @@ export class EmailResource extends APIResource {
35
36
  /**
36
37
  * Retrieves a single email by its unique identifier.
37
38
  */
38
- get(emailID: string, options?: RequestOptions): APIPromise<Email> {
39
+ get(emailID: string, options?: RequestOptions): APIPromise<EmailGetResponse> {
39
40
  return this._client.get(path`/v1/email/${emailID}`, options);
40
41
  }
41
42
 
@@ -120,6 +121,66 @@ export interface Email {
120
121
  reply_to?: Array<string> | null;
121
122
  }
122
123
 
124
+ /**
125
+ * A sent email object with full body content
126
+ */
127
+ export interface EmailGetResponse {
128
+ /**
129
+ * Unique identifier for the email
130
+ */
131
+ id: string;
132
+
133
+ /**
134
+ * Timestamp when the email was sent
135
+ */
136
+ created_at: string;
137
+
138
+ /**
139
+ * Sender email address
140
+ */
141
+ from: string;
142
+
143
+ /**
144
+ * Email subject line
145
+ */
146
+ subject: string;
147
+
148
+ /**
149
+ * Recipient email addresses
150
+ */
151
+ to: Array<string>;
152
+
153
+ /**
154
+ * Blind carbon copy recipients
155
+ */
156
+ bcc?: Array<string> | null;
157
+
158
+ /**
159
+ * Carbon copy recipients
160
+ */
161
+ cc?: Array<string> | null;
162
+
163
+ /**
164
+ * The HTML version of the message body
165
+ */
166
+ html?: string | null;
167
+
168
+ /**
169
+ * The most recent event for this email
170
+ */
171
+ last_event?: 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | null;
172
+
173
+ /**
174
+ * Reply-to addresses
175
+ */
176
+ reply_to?: Array<string> | null;
177
+
178
+ /**
179
+ * The plain text version of the message body
180
+ */
181
+ text?: string | null;
182
+ }
183
+
123
184
  /**
124
185
  * Response after sending an email
125
186
  */
@@ -213,6 +274,7 @@ export declare namespace EmailResource {
213
274
  export {
214
275
  type Attachment as Attachment,
215
276
  type Email as Email,
277
+ type EmailGetResponse as EmailGetResponse,
216
278
  type EmailSendResponse as EmailSendResponse,
217
279
  type EmailsCursorIDPage as EmailsCursorIDPage,
218
280
  type EmailListParams as EmailListParams,
@@ -225,5 +287,6 @@ export declare namespace EmailResource {
225
287
  type IdentitiesCursorIDPage as IdentitiesCursorIDPage,
226
288
  type IdentityCreateParams as IdentityCreateParams,
227
289
  type IdentityListParams as IdentityListParams,
290
+ type IdentityVerifyParams as IdentityVerifyParams,
228
291
  };
229
292
  }
@@ -51,8 +51,8 @@ export class Identities extends APIResource {
51
51
  * Triggers a manual recheck of the identity's verification status against AWS SES.
52
52
  * Returns the identity with its updated status.
53
53
  */
54
- verify(identityID: string, options?: RequestOptions): APIPromise<Identity> {
55
- return this._client.post(path`/v1/email/identities/${identityID}/verify`, options);
54
+ verify(identityID: string, body: IdentityVerifyParams, options?: RequestOptions): APIPromise<Identity> {
55
+ return this._client.post(path`/v1/email/identities/${identityID}/verify`, { body, ...options });
56
56
  }
57
57
  }
58
58
 
@@ -72,6 +72,11 @@ export interface Identity {
72
72
  */
73
73
  created_at: string;
74
74
 
75
+ /**
76
+ * Whether a custom MAIL FROM domain is enabled for SPF alignment
77
+ */
78
+ mail_from_enabled: boolean;
79
+
75
80
  /**
76
81
  * The verification status of the identity
77
82
  */
@@ -88,6 +93,12 @@ export interface Identity {
88
93
  */
89
94
  value: string;
90
95
 
96
+ /**
97
+ * The subdomain prefix used for the custom MAIL FROM domain (e.g. 'mail' for
98
+ * mail.yourdomain.com)
99
+ */
100
+ mail_from_subdomain?: string | null;
101
+
91
102
  /**
92
103
  * DNS records required for verification (only present for domain identities)
93
104
  */
@@ -126,26 +137,62 @@ export namespace Identity {
126
137
  }
127
138
  }
128
139
 
129
- export interface IdentityCreateParams {
130
- /**
131
- * The type of identity to create. Use 'email' for a single address or 'domain' for
132
- * an entire domain.
133
- */
134
- type: 'email' | 'domain';
140
+ export type IdentityCreateParams = IdentityCreateParams.Variant0 | IdentityCreateParams.Variant1;
135
141
 
136
- /**
137
- * The email address or domain name to verify
138
- */
139
- value: string;
142
+ export declare namespace IdentityCreateParams {
143
+ export interface Variant0 {
144
+ /**
145
+ * Create an email address identity
146
+ */
147
+ type: 'email';
148
+
149
+ /**
150
+ * The email address to verify
151
+ */
152
+ value: string;
153
+ }
154
+
155
+ export interface Variant1 {
156
+ /**
157
+ * Create a domain identity
158
+ */
159
+ type: 'domain';
160
+
161
+ /**
162
+ * The domain name to verify
163
+ */
164
+ value: string;
165
+
166
+ /**
167
+ * Enable a custom MAIL FROM domain for SPF alignment. When enabled, additional DNS
168
+ * records are required.
169
+ */
170
+ mail_from_enabled?: boolean;
171
+
172
+ /**
173
+ * The subdomain prefix for the custom MAIL FROM domain (e.g. 'mail' for
174
+ * mail.yourdomain.com). Defaults to 'mail'.
175
+ */
176
+ mail_from_subdomain?: string;
177
+ }
140
178
  }
141
179
 
142
180
  export interface IdentityListParams extends CursorIDPageParams {}
143
181
 
182
+ export interface IdentityVerifyParams {
183
+ /**
184
+ * If true and the identity is an unverified email address, resend the verification
185
+ * email.
186
+ */
187
+ resend?: boolean;
188
+ }
189
+
144
190
  export declare namespace Identities {
145
191
  export {
146
192
  type Identity as Identity,
147
193
  type IdentitiesCursorIDPage as IdentitiesCursorIDPage,
148
194
  type IdentityCreateParams as IdentityCreateParams,
149
195
  type IdentityListParams as IdentityListParams,
196
+ type IdentityVerifyParams as IdentityVerifyParams,
150
197
  };
151
198
  }
@@ -4,6 +4,7 @@ export {
4
4
  EmailResource,
5
5
  type Attachment,
6
6
  type Email,
7
+ type EmailGetResponse,
7
8
  type EmailSendResponse,
8
9
  type EmailListParams,
9
10
  type EmailSendParams,
@@ -14,5 +15,6 @@ export {
14
15
  type Identity,
15
16
  type IdentityCreateParams,
16
17
  type IdentityListParams,
18
+ type IdentityVerifyParams,
17
19
  type IdentitiesCursorIDPage,
18
20
  } from './identities';
@@ -16,6 +16,7 @@ export {
16
16
  EmailResource,
17
17
  type Attachment,
18
18
  type Email,
19
+ type EmailGetResponse,
19
20
  type EmailSendResponse,
20
21
  type EmailListParams,
21
22
  type EmailSendParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.14.3'; // x-release-please-version
1
+ export const VERSION = '1.14.5'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.14.3";
1
+ export declare const VERSION = "1.14.5";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.14.3";
1
+ export declare const VERSION = "1.14.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.14.3'; // x-release-please-version
4
+ exports.VERSION = '1.14.5'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.14.3'; // x-release-please-version
1
+ export const VERSION = '1.14.5'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map