@usehercules/sdk 1.14.0 → 1.14.2

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 (136) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +9 -0
  3. package/client.d.mts +13 -4
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +13 -4
  6. package/client.d.ts.map +1 -1
  7. package/client.js +21 -5
  8. package/client.js.map +1 -1
  9. package/client.mjs +21 -5
  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/package.json +1 -1
  18. package/resources/content/{models/models.d.mts → collections/collections.d.mts} +88 -87
  19. package/resources/content/collections/collections.d.mts.map +1 -0
  20. package/resources/content/{models/models.d.ts → collections/collections.d.ts} +88 -87
  21. package/resources/content/collections/collections.d.ts.map +1 -0
  22. package/resources/content/collections/collections.js +58 -0
  23. package/resources/content/collections/collections.js.map +1 -0
  24. package/resources/content/collections/collections.mjs +53 -0
  25. package/resources/content/collections/collections.mjs.map +1 -0
  26. package/resources/content/{models → collections}/fields.d.mts +23 -22
  27. package/resources/content/collections/fields.d.mts.map +1 -0
  28. package/resources/content/{models → collections}/fields.d.ts +23 -22
  29. package/resources/content/collections/fields.d.ts.map +1 -0
  30. package/resources/content/collections/fields.js +41 -0
  31. package/resources/content/collections/fields.js.map +1 -0
  32. package/resources/content/collections/fields.mjs +37 -0
  33. package/resources/content/collections/fields.mjs.map +1 -0
  34. package/resources/content/collections/index.d.mts +3 -0
  35. package/resources/content/collections/index.d.mts.map +1 -0
  36. package/resources/content/collections/index.d.ts +3 -0
  37. package/resources/content/collections/index.d.ts.map +1 -0
  38. package/resources/content/{models → collections}/index.js +3 -3
  39. package/resources/content/collections/index.js.map +1 -0
  40. package/resources/content/{models → collections}/index.mjs +1 -1
  41. package/resources/content/collections/index.mjs.map +1 -0
  42. package/resources/content/collections.d.mts +2 -0
  43. package/resources/content/collections.d.mts.map +1 -0
  44. package/resources/content/collections.d.ts +2 -0
  45. package/resources/content/collections.d.ts.map +1 -0
  46. package/resources/content/{models.js → collections.js} +2 -2
  47. package/resources/content/collections.js.map +1 -0
  48. package/resources/content/{models.mjs → collections.mjs} +2 -2
  49. package/resources/content/collections.mjs.map +1 -0
  50. package/resources/content/content.d.mts +4 -4
  51. package/resources/content/content.d.mts.map +1 -1
  52. package/resources/content/content.d.ts +4 -4
  53. package/resources/content/content.d.ts.map +1 -1
  54. package/resources/content/content.js +4 -4
  55. package/resources/content/content.js.map +1 -1
  56. package/resources/content/content.mjs +4 -4
  57. package/resources/content/content.mjs.map +1 -1
  58. package/resources/content/entries.d.mts +18 -18
  59. package/resources/content/entries.d.mts.map +1 -1
  60. package/resources/content/entries.d.ts +18 -18
  61. package/resources/content/entries.d.ts.map +1 -1
  62. package/resources/content/entries.js +2 -2
  63. package/resources/content/entries.mjs +2 -2
  64. package/resources/content/index.d.mts +1 -1
  65. package/resources/content/index.d.mts.map +1 -1
  66. package/resources/content/index.d.ts +1 -1
  67. package/resources/content/index.d.ts.map +1 -1
  68. package/resources/content/index.js +3 -3
  69. package/resources/content/index.js.map +1 -1
  70. package/resources/content/index.mjs +1 -1
  71. package/resources/content/index.mjs.map +1 -1
  72. package/resources/domains.d.mts +54 -0
  73. package/resources/domains.d.mts.map +1 -0
  74. package/resources/domains.d.ts +54 -0
  75. package/resources/domains.d.ts.map +1 -0
  76. package/resources/domains.js +21 -0
  77. package/resources/domains.js.map +1 -0
  78. package/resources/domains.mjs +17 -0
  79. package/resources/domains.mjs.map +1 -0
  80. package/resources/files.d.mts +8 -6
  81. package/resources/files.d.mts.map +1 -1
  82. package/resources/files.d.ts +8 -6
  83. package/resources/files.d.ts.map +1 -1
  84. package/resources/files.js +3 -2
  85. package/resources/files.js.map +1 -1
  86. package/resources/files.mjs +3 -2
  87. package/resources/files.mjs.map +1 -1
  88. package/resources/index.d.mts +1 -0
  89. package/resources/index.d.mts.map +1 -1
  90. package/resources/index.d.ts +1 -0
  91. package/resources/index.d.ts.map +1 -1
  92. package/resources/index.js +3 -1
  93. package/resources/index.js.map +1 -1
  94. package/resources/index.mjs +1 -0
  95. package/resources/index.mjs.map +1 -1
  96. package/src/client.ts +34 -7
  97. package/src/internal/parse.ts +6 -0
  98. package/src/resources/content/{models/models.ts → collections/collections.ts} +112 -108
  99. package/src/resources/content/{models → collections}/fields.ts +39 -27
  100. package/src/resources/content/{models → collections}/index.ts +8 -8
  101. package/src/resources/content/{models.ts → collections.ts} +1 -1
  102. package/src/resources/content/content.ts +16 -16
  103. package/src/resources/content/entries.ts +20 -20
  104. package/src/resources/content/index.ts +9 -9
  105. package/src/resources/domains.ts +74 -0
  106. package/src/resources/files.ts +8 -6
  107. package/src/resources/index.ts +1 -0
  108. package/src/version.ts +1 -1
  109. package/version.d.mts +1 -1
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
  112. package/version.mjs +1 -1
  113. package/resources/content/models/fields.d.mts.map +0 -1
  114. package/resources/content/models/fields.d.ts.map +0 -1
  115. package/resources/content/models/fields.js +0 -37
  116. package/resources/content/models/fields.js.map +0 -1
  117. package/resources/content/models/fields.mjs +0 -33
  118. package/resources/content/models/fields.mjs.map +0 -1
  119. package/resources/content/models/index.d.mts +0 -3
  120. package/resources/content/models/index.d.mts.map +0 -1
  121. package/resources/content/models/index.d.ts +0 -3
  122. package/resources/content/models/index.d.ts.map +0 -1
  123. package/resources/content/models/index.js.map +0 -1
  124. package/resources/content/models/index.mjs.map +0 -1
  125. package/resources/content/models/models.d.mts.map +0 -1
  126. package/resources/content/models/models.d.ts.map +0 -1
  127. package/resources/content/models/models.js +0 -54
  128. package/resources/content/models/models.js.map +0 -1
  129. package/resources/content/models/models.mjs +0 -49
  130. package/resources/content/models/models.mjs.map +0 -1
  131. package/resources/content/models.d.mts +0 -2
  132. package/resources/content/models.d.mts.map +0 -1
  133. package/resources/content/models.d.ts +0 -2
  134. package/resources/content/models.d.ts.map +0 -1
  135. package/resources/content/models.js.map +0 -1
  136. package/resources/content/models.mjs.map +0 -1
@@ -7,8 +7,9 @@ const pagination_1 = require("../core/pagination.js");
7
7
  const path_1 = require("../internal/utils/path.js");
8
8
  /**
9
9
  * Upload, retrieve, and list files and media associated with a website.
10
- * Upload is a two-step process: first create an upload to get a presigned URL,
11
- * then complete the upload after putting the file content to the presigned URL.
10
+ * Upload is a two-step process: first call create to get an upload URL,
11
+ * then PUT the file content to that URL. The PUT response returns the
12
+ * completed MediaFile object. No separate complete call is needed.
12
13
  */
13
14
  class Files extends resource_1.APIResource {
14
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAAwF;AAExF,oDAA8C;AAE9C;;;;GAIG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;OAGG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,yBAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAc,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AAlBD,sBAkBC"}
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAAwF;AAExF,oDAA8C;AAE9C;;;;;GAKG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;OAGG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,yBAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAc,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AAlBD,sBAkBC"}
@@ -4,8 +4,9 @@ import { CursorIDPage } from "../core/pagination.mjs";
4
4
  import { path } from "../internal/utils/path.mjs";
5
5
  /**
6
6
  * Upload, retrieve, and list files and media associated with a website.
7
- * Upload is a two-step process: first create an upload to get a presigned URL,
8
- * then complete the upload after putting the file content to the presigned URL.
7
+ * Upload is a two-step process: first call create to get an upload URL,
8
+ * then PUT the file content to that URL. The PUT response returns the
9
+ * completed MediaFile object. No separate complete call is needed.
9
10
  */
10
11
  export class Files extends APIResource {
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAwC;OAEtD,EAAE,IAAI,EAAE;AAEf;;;;GAIG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,YAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAc,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF"}
1
+ {"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAwC;OAEtD,EAAE,IAAI,EAAE;AAEf;;;;;GAKG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,YAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAc,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -1,5 +1,6 @@
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
+ export { Domains, type Domain, type DomainListParams, type DomainsCursorIDPage } from "./domains.mjs";
3
4
  export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.mjs";
4
5
  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";
5
6
  //# 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,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,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,5 +1,6 @@
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
+ export { Domains, type Domain, type DomainListParams, type DomainsCursorIDPage } from "./domains.js";
3
4
  export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.js";
4
5
  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";
5
6
  //# 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,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,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,11 +1,13 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PushNotifications = exports.Files = exports.Content = exports.Commerce = void 0;
4
+ exports.PushNotifications = exports.Files = exports.Domains = exports.Content = exports.Commerce = void 0;
5
5
  var commerce_1 = require("./commerce/commerce.js");
6
6
  Object.defineProperty(exports, "Commerce", { enumerable: true, get: function () { return commerce_1.Commerce; } });
7
7
  var content_1 = require("./content/content.js");
8
8
  Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return content_1.Content; } });
9
+ var domains_1 = require("./domains.js");
10
+ Object.defineProperty(exports, "Domains", { enumerable: true, get: function () { return domains_1.Domains; } });
9
11
  var files_1 = require("./files.js");
10
12
  Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
11
13
  var push_notifications_1 = require("./push-notifications/push-notifications.js");
@@ -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,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,oCAAqG;AAA5F,8FAAA,KAAK,OAAA;AACd,iFAWiD;AAV/C,uHAAA,iBAAiB,OAAA"}
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  export { Commerce, } from "./commerce/commerce.mjs";
3
3
  export { Content } from "./content/content.mjs";
4
+ export { Domains } from "./domains.mjs";
4
5
  export { Files } from "./files.mjs";
5
6
  export { PushNotifications, } from "./push-notifications/push-notifications.mjs";
6
7
  //# sourceMappingURL=index.mjs.map
@@ -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,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,EAAE,KAAK,EAAuE;OAC9E,EACL,iBAAiB,GAUlB"}
package/src/client.ts CHANGED
@@ -19,6 +19,7 @@ import { AbstractPage, type CursorIDPageParams, CursorIDPageResponse } from './c
19
19
  import * as Uploads from './core/uploads';
20
20
  import * as API from './resources/index';
21
21
  import { APIPromise } from './core/api-promise';
22
+ import { Domain, DomainListParams, Domains, DomainsCursorIDPage } from './resources/domains';
22
23
  import { File, FileListParams, Files, FilesCursorIDPage, Upload } from './resources/files';
23
24
  import {
24
25
  Commerce,
@@ -512,9 +513,14 @@ export class Hercules {
512
513
  getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
513
514
  path: string,
514
515
  Page: new (...args: any[]) => PageClass,
515
- opts?: RequestOptions,
516
+ opts?: PromiseOrValue<RequestOptions>,
516
517
  ): Pagination.PagePromise<PageClass, Item> {
517
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
518
+ return this.requestAPIList(
519
+ Page,
520
+ opts && 'then' in opts ?
521
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
522
+ : { method: 'get', path, ...opts },
523
+ );
518
524
  }
519
525
 
520
526
  requestAPIList<
@@ -522,7 +528,7 @@ export class Hercules {
522
528
  PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
523
529
  >(
524
530
  Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
525
- options: FinalRequestOptions,
531
+ options: PromiseOrValue<FinalRequestOptions>,
526
532
  ): Pagination.PagePromise<PageClass, Item> {
527
533
  const request = this.makeRequest(options, null, undefined);
528
534
  return new Pagination.PagePromise<PageClass, Item>(this as any as Hercules, request, Page);
@@ -535,9 +541,10 @@ export class Hercules {
535
541
  controller: AbortController,
536
542
  ): Promise<Response> {
537
543
  const { signal, method, ...options } = init || {};
538
- if (signal) signal.addEventListener('abort', () => controller.abort());
544
+ const abort = this._makeAbort(controller);
545
+ if (signal) signal.addEventListener('abort', abort, { once: true });
539
546
 
540
- const timeout = setTimeout(() => controller.abort(), ms);
547
+ const timeout = setTimeout(abort, ms);
541
548
 
542
549
  const isReadableBody =
543
550
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -705,6 +712,12 @@ export class Hercules {
705
712
  return headers.values;
706
713
  }
707
714
 
715
+ private _makeAbort(controller: AbortController) {
716
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
717
+ // would capture all request options, and cause a memory leak.
718
+ return () => controller.abort();
719
+ }
720
+
708
721
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
709
722
  bodyHeaders: HeadersLike;
710
723
  body: BodyInit | undefined;
@@ -769,10 +782,16 @@ export class Hercules {
769
782
  * Content APIs are currently in beta.
770
783
  */
771
784
  content: API.Content = new API.Content(this);
785
+ /**
786
+ * List custom domains linked to a website, including Cloudflare verification
787
+ * and SSL status.
788
+ */
789
+ domains: API.Domains = new API.Domains(this);
772
790
  /**
773
791
  * Upload, retrieve, and list files and media associated with a website.
774
- * Upload is a two-step process: first create an upload to get a presigned URL,
775
- * then complete the upload after putting the file content to the presigned URL.
792
+ * Upload is a two-step process: first call create to get an upload URL,
793
+ * then PUT the file content to that URL. The PUT response returns the
794
+ * completed MediaFile object. No separate complete call is needed.
776
795
  */
777
796
  files: API.Files = new API.Files(this);
778
797
  pushNotifications: API.PushNotifications = new API.PushNotifications(this);
@@ -780,6 +799,7 @@ export class Hercules {
780
799
 
781
800
  Hercules.Commerce = Commerce;
782
801
  Hercules.Content = Content;
802
+ Hercules.Domains = Domains;
783
803
  Hercules.Files = Files;
784
804
  Hercules.PushNotifications = PushNotifications;
785
805
 
@@ -802,6 +822,13 @@ export declare namespace Hercules {
802
822
 
803
823
  export { Content as Content };
804
824
 
825
+ export {
826
+ Domains as Domains,
827
+ type Domain as Domain,
828
+ type DomainsCursorIDPage as DomainsCursorIDPage,
829
+ type DomainListParams as DomainListParams,
830
+ };
831
+
805
832
  export {
806
833
  Files as Files,
807
834
  type File as File,
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Hercules, props: APIRespon
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
  }
@@ -8,61 +8,116 @@ import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../cor
8
8
  import { RequestOptions } from '../../../internal/request-options';
9
9
  import { path } from '../../../internal/utils/path';
10
10
 
11
- export class Models extends APIResource {
11
+ export class Collections extends APIResource {
12
12
  fields: FieldsAPI.Fields = new FieldsAPI.Fields(this._client);
13
13
 
14
14
  /**
15
- * Creates a new content model with optional initial fields. Content models define
16
- * the schema for entries. Example models: 'Blog Post', 'Product', 'Author'.
15
+ * Creates a new content collection with optional initial fields. Content
16
+ * collections define the schema for entries. Example collections: 'Blog Post',
17
+ * 'Product', 'Author'.
17
18
  */
18
- create(body: ModelCreateParams, options?: RequestOptions): APIPromise<Model> {
19
- return this._client.post('/v1/content/models', { body, ...options });
19
+ create(body: CollectionCreateParams, options?: RequestOptions): APIPromise<Collection> {
20
+ return this._client.post('/v1/content/collections', { body, ...options });
20
21
  }
21
22
 
22
23
  /**
23
- * Updates an existing content model. Use this to modify the name, description, or
24
- * lock status. The api_id cannot be changed after creation.
24
+ * Updates an existing content collection. Use this to modify the name,
25
+ * description, or lock status. The api_id cannot be changed after creation.
25
26
  */
26
27
  update(
27
- modelID: string,
28
- body: ModelUpdateParams | null | undefined = {},
28
+ collectionID: string,
29
+ body: CollectionUpdateParams | null | undefined = {},
29
30
  options?: RequestOptions,
30
- ): APIPromise<Model> {
31
- return this._client.patch(path`/v1/content/models/${modelID}`, { body, ...options });
31
+ ): APIPromise<Collection> {
32
+ return this._client.patch(path`/v1/content/collections/${collectionID}`, { body, ...options });
32
33
  }
33
34
 
34
35
  /**
35
- * Retrieves a paginated list of content models. Content models define the
36
- * schema/structure for content entries.
36
+ * Retrieves a paginated list of content collections. Content collections define
37
+ * the schema/structure for content entries.
37
38
  */
38
39
  list(
39
- query: ModelListParams | null | undefined = {},
40
+ query: CollectionListParams | null | undefined = {},
40
41
  options?: RequestOptions,
41
- ): PagePromise<ModelsCursorIDPage, Model> {
42
- return this._client.getAPIList('/v1/content/models', CursorIDPage<Model>, { query, ...options });
42
+ ): PagePromise<CollectionsCursorIDPage, Collection> {
43
+ return this._client.getAPIList('/v1/content/collections', CursorIDPage<Collection>, {
44
+ query,
45
+ ...options,
46
+ });
43
47
  }
44
48
 
45
49
  /**
46
- * Archives a content model, hiding it from the API. Existing entries are
50
+ * Archives a content collection, hiding it from the API. Existing entries are
47
51
  * preserved. Use this instead of deletion to maintain data integrity.
48
52
  */
49
- archive(modelID: string, options?: RequestOptions): APIPromise<Model> {
50
- return this._client.delete(path`/v1/content/models/${modelID}`, options);
53
+ archive(collectionID: string, options?: RequestOptions): APIPromise<Collection> {
54
+ return this._client.delete(path`/v1/content/collections/${collectionID}`, options);
51
55
  }
52
56
 
53
57
  /**
54
- * Retrieves a content model by ID. Returns the model object including all field
55
- * definitions.
58
+ * Retrieves a content collection by ID. Returns the collection object including
59
+ * all field definitions.
56
60
  */
57
- get(modelID: string, options?: RequestOptions): APIPromise<Model> {
58
- return this._client.get(path`/v1/content/models/${modelID}`, options);
61
+ get(collectionID: string, options?: RequestOptions): APIPromise<Collection> {
62
+ return this._client.get(path`/v1/content/collections/${collectionID}`, options);
59
63
  }
60
64
  }
61
65
 
62
- export type ModelsCursorIDPage = CursorIDPage<Model>;
66
+ export type CollectionsCursorIDPage = CursorIDPage<Collection>;
63
67
 
64
68
  /**
65
- * A field definition within a content model
69
+ * A content collection defines the schema/structure for content entries. Each
70
+ * collection has fields that define what data entries can contain.
71
+ */
72
+ export interface Collection {
73
+ /**
74
+ * Unique identifier for the content collection
75
+ */
76
+ id: string;
77
+
78
+ /**
79
+ * API identifier for the collection (camelCase, e.g., 'blogPost', 'product')
80
+ */
81
+ api_id: string;
82
+
83
+ /**
84
+ * Timestamp when the collection was created
85
+ */
86
+ created: string;
87
+
88
+ /**
89
+ * Whether field modifications are locked (for production safety)
90
+ */
91
+ locked: boolean;
92
+
93
+ /**
94
+ * Display name for the collection
95
+ */
96
+ name: string;
97
+
98
+ /**
99
+ * Timestamp when the collection was last updated
100
+ */
101
+ updated: string;
102
+
103
+ /**
104
+ * Schema version number
105
+ */
106
+ version: number;
107
+
108
+ /**
109
+ * Description of the collection
110
+ */
111
+ description?: string | null;
112
+
113
+ /**
114
+ * Fields defined in this collection
115
+ */
116
+ fields?: Array<Field>;
117
+ }
118
+
119
+ /**
120
+ * A field definition within a content collection
66
121
  */
67
122
  export interface Field {
68
123
  /**
@@ -107,7 +162,7 @@ export interface Field {
107
162
  description?: string | null;
108
163
 
109
164
  /**
110
- * Display order within the model
165
+ * Display order within the collection
111
166
  */
112
167
  display_order?: number;
113
168
 
@@ -128,14 +183,14 @@ export namespace Field {
128
183
  */
129
184
  export interface Validation {
130
185
  /**
131
- * Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
186
+ * Allowed collection apiIds for reference fields
132
187
  */
133
- allowed_mime_types?: Array<string>;
188
+ allowed_collections?: Array<string>;
134
189
 
135
190
  /**
136
- * Allowed model apiIds for reference fields
191
+ * Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
137
192
  */
138
- allowed_models?: Array<string>;
193
+ allowed_mime_types?: Array<string>;
139
194
 
140
195
  /**
141
196
  * Allowed values for enum fields
@@ -190,88 +245,37 @@ export namespace Field {
190
245
  }
191
246
  }
192
247
 
193
- /**
194
- * A content model defines the schema/structure for content entries. Each model has
195
- * fields that define what data entries can contain.
196
- */
197
- export interface Model {
198
- /**
199
- * Unique identifier for the content model
200
- */
201
- id: string;
202
-
248
+ export interface CollectionCreateParams {
203
249
  /**
204
- * API identifier for the model (camelCase, e.g., 'blogPost', 'product')
250
+ * API identifier for the collection (camelCase, e.g., 'blogPost')
205
251
  */
206
252
  api_id: string;
207
253
 
208
254
  /**
209
- * Timestamp when the model was created
210
- */
211
- created: string;
212
-
213
- /**
214
- * Whether field modifications are locked (for production safety)
215
- */
216
- locked: boolean;
217
-
218
- /**
219
- * Display name for the model
255
+ * Display name for the collection
220
256
  */
221
257
  name: string;
222
258
 
223
259
  /**
224
- * Timestamp when the model was last updated
225
- */
226
- updated: string;
227
-
228
- /**
229
- * Schema version number
230
- */
231
- version: number;
232
-
233
- /**
234
- * Description of the model
235
- */
236
- description?: string | null;
237
-
238
- /**
239
- * Fields defined in this model
240
- */
241
- fields?: Array<Field>;
242
- }
243
-
244
- export interface ModelCreateParams {
245
- /**
246
- * API identifier for the model (camelCase, e.g., 'blogPost')
247
- */
248
- api_id: string;
249
-
250
- /**
251
- * Display name for the model
252
- */
253
- name: string;
254
-
255
- /**
256
- * Optional custom ID for the model. Must start with 'cm\_'. If not provided, one
257
- * will be generated.
260
+ * Optional custom ID for the collection. Must start with 'cm\_'. If not provided,
261
+ * one will be generated.
258
262
  */
259
263
  id?: string;
260
264
 
261
265
  /**
262
- * Description of the model
266
+ * Description of the collection
263
267
  */
264
268
  description?: string;
265
269
 
266
270
  /**
267
- * Initial fields to create with the model
271
+ * Initial fields to create with the collection
268
272
  */
269
- fields?: Array<ModelCreateParams.Field>;
273
+ fields?: Array<CollectionCreateParams.Field>;
270
274
  }
271
275
 
272
- export namespace ModelCreateParams {
276
+ export namespace CollectionCreateParams {
273
277
  /**
274
- * Request to add a new field to a content model
278
+ * Request to add a new field to a content collection
275
279
  */
276
280
  export interface Field {
277
281
  /**
@@ -312,7 +316,7 @@ export namespace ModelCreateParams {
312
316
  description?: string;
313
317
 
314
318
  /**
315
- * Display order within the model
319
+ * Display order within the collection
316
320
  */
317
321
  display_order?: number;
318
322
 
@@ -333,14 +337,14 @@ export namespace ModelCreateParams {
333
337
  */
334
338
  export interface Validation {
335
339
  /**
336
- * Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
340
+ * Allowed collection apiIds for reference fields
337
341
  */
338
- allowed_mime_types?: Array<string>;
342
+ allowed_collections?: Array<string>;
339
343
 
340
344
  /**
341
- * Allowed model apiIds for reference fields
345
+ * Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
342
346
  */
343
- allowed_models?: Array<string>;
347
+ allowed_mime_types?: Array<string>;
344
348
 
345
349
  /**
346
350
  * Allowed values for enum fields
@@ -396,35 +400,35 @@ export namespace ModelCreateParams {
396
400
  }
397
401
  }
398
402
 
399
- export interface ModelUpdateParams {
403
+ export interface CollectionUpdateParams {
400
404
  /**
401
- * Description of the model
405
+ * Description of the collection
402
406
  */
403
407
  description?: string;
404
408
 
405
409
  /**
406
- * Lock the model to prevent field modifications
410
+ * Lock the collection to prevent field modifications
407
411
  */
408
412
  locked?: boolean;
409
413
 
410
414
  /**
411
- * Display name for the model
415
+ * Display name for the collection
412
416
  */
413
417
  name?: string;
414
418
  }
415
419
 
416
- export interface ModelListParams extends CursorIDPageParams {}
420
+ export interface CollectionListParams extends CursorIDPageParams {}
417
421
 
418
- Models.Fields = Fields;
422
+ Collections.Fields = Fields;
419
423
 
420
- export declare namespace Models {
424
+ export declare namespace Collections {
421
425
  export {
426
+ type Collection as Collection,
422
427
  type Field as Field,
423
- type Model as Model,
424
- type ModelsCursorIDPage as ModelsCursorIDPage,
425
- type ModelCreateParams as ModelCreateParams,
426
- type ModelUpdateParams as ModelUpdateParams,
427
- type ModelListParams as ModelListParams,
428
+ type CollectionsCursorIDPage as CollectionsCursorIDPage,
429
+ type CollectionCreateParams as CollectionCreateParams,
430
+ type CollectionUpdateParams as CollectionUpdateParams,
431
+ type CollectionListParams as CollectionListParams,
428
432
  };
429
433
 
430
434
  export {