@usehercules/sdk 1.14.1 → 1.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +9 -0
- package/client.d.mts +13 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -4
- package/client.d.ts.map +1 -1
- package/client.js +21 -5
- package/client.js.map +1 -1
- package/client.mjs +21 -5
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/content/{models/models.d.mts → collections/collections.d.mts} +88 -87
- package/resources/content/collections/collections.d.mts.map +1 -0
- package/resources/content/{models/models.d.ts → collections/collections.d.ts} +88 -87
- package/resources/content/collections/collections.d.ts.map +1 -0
- package/resources/content/collections/collections.js +58 -0
- package/resources/content/collections/collections.js.map +1 -0
- package/resources/content/collections/collections.mjs +53 -0
- package/resources/content/collections/collections.mjs.map +1 -0
- package/resources/content/{models → collections}/fields.d.mts +23 -22
- package/resources/content/collections/fields.d.mts.map +1 -0
- package/resources/content/{models → collections}/fields.d.ts +23 -22
- package/resources/content/collections/fields.d.ts.map +1 -0
- package/resources/content/collections/fields.js +41 -0
- package/resources/content/collections/fields.js.map +1 -0
- package/resources/content/collections/fields.mjs +37 -0
- package/resources/content/collections/fields.mjs.map +1 -0
- package/resources/content/collections/index.d.mts +3 -0
- package/resources/content/collections/index.d.mts.map +1 -0
- package/resources/content/collections/index.d.ts +3 -0
- package/resources/content/collections/index.d.ts.map +1 -0
- package/resources/content/{models → collections}/index.js +3 -3
- package/resources/content/collections/index.js.map +1 -0
- package/resources/content/{models → collections}/index.mjs +1 -1
- package/resources/content/collections/index.mjs.map +1 -0
- package/resources/content/collections.d.mts +2 -0
- package/resources/content/collections.d.mts.map +1 -0
- package/resources/content/collections.d.ts +2 -0
- package/resources/content/collections.d.ts.map +1 -0
- package/resources/content/{models.js → collections.js} +2 -2
- package/resources/content/collections.js.map +1 -0
- package/resources/content/collections.mjs +3 -0
- package/resources/content/collections.mjs.map +1 -0
- package/resources/content/content.d.mts +4 -4
- package/resources/content/content.d.mts.map +1 -1
- package/resources/content/content.d.ts +4 -4
- package/resources/content/content.d.ts.map +1 -1
- package/resources/content/content.js +4 -4
- package/resources/content/content.js.map +1 -1
- package/resources/content/content.mjs +4 -4
- package/resources/content/content.mjs.map +1 -1
- package/resources/content/entries.d.mts +18 -18
- package/resources/content/entries.d.mts.map +1 -1
- package/resources/content/entries.d.ts +18 -18
- package/resources/content/entries.d.ts.map +1 -1
- package/resources/content/entries.js +2 -2
- package/resources/content/entries.mjs +2 -2
- package/resources/content/index.d.mts +1 -1
- package/resources/content/index.d.mts.map +1 -1
- package/resources/content/index.d.ts +1 -1
- package/resources/content/index.d.ts.map +1 -1
- package/resources/content/index.js +3 -3
- package/resources/content/index.js.map +1 -1
- package/resources/content/index.mjs +1 -1
- package/resources/content/index.mjs.map +1 -1
- package/resources/email/email.d.mts +166 -0
- package/resources/email/email.d.mts.map +1 -0
- package/resources/email/email.d.ts +166 -0
- package/resources/email/email.d.ts.map +1 -0
- package/resources/email/email.js +43 -0
- package/resources/email/email.js.map +1 -0
- package/resources/email/email.mjs +38 -0
- package/resources/email/email.mjs.map +1 -0
- package/resources/email/identities.d.mts +107 -0
- package/resources/email/identities.d.mts.map +1 -0
- package/resources/email/identities.d.ts +107 -0
- package/resources/email/identities.d.ts.map +1 -0
- package/resources/email/identities.js +51 -0
- package/resources/email/identities.js.map +1 -0
- package/resources/email/identities.mjs +47 -0
- package/resources/email/identities.mjs.map +1 -0
- package/resources/email/index.d.mts +3 -0
- package/resources/email/index.d.mts.map +1 -0
- package/resources/email/index.d.ts +3 -0
- package/resources/email/index.d.ts.map +1 -0
- package/resources/email/index.js +9 -0
- package/resources/email/index.js.map +1 -0
- package/resources/email/index.mjs +4 -0
- package/resources/email/index.mjs.map +1 -0
- package/resources/email.d.mts +2 -0
- package/resources/email.d.mts.map +1 -0
- package/resources/email.d.ts +2 -0
- package/resources/email.d.ts.map +1 -0
- package/resources/email.js +6 -0
- package/resources/email.js.map +1 -0
- package/resources/{content/models.mjs → email.mjs} +2 -2
- package/resources/email.mjs.map +1 -0
- package/resources/files.d.mts +8 -6
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +8 -6
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +3 -2
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +3 -2
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +46 -8
- package/src/internal/parse.ts +6 -0
- package/src/resources/content/{models/models.ts → collections/collections.ts} +112 -108
- package/src/resources/content/{models → collections}/fields.ts +39 -27
- package/src/resources/content/{models → collections}/index.ts +8 -8
- package/src/resources/content/collections.ts +3 -0
- package/src/resources/content/content.ts +16 -16
- package/src/resources/content/entries.ts +20 -20
- package/src/resources/content/index.ts +9 -9
- package/src/resources/email/email.ts +229 -0
- package/src/resources/email/identities.ts +151 -0
- package/src/resources/email/index.ts +18 -0
- package/src/resources/{content/models.ts → email.ts} +1 -1
- package/src/resources/files.ts +8 -6
- package/src/resources/index.ts +9 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/content/models/fields.d.mts.map +0 -1
- package/resources/content/models/fields.d.ts.map +0 -1
- package/resources/content/models/fields.js +0 -37
- package/resources/content/models/fields.js.map +0 -1
- package/resources/content/models/fields.mjs +0 -33
- package/resources/content/models/fields.mjs.map +0 -1
- package/resources/content/models/index.d.mts +0 -3
- package/resources/content/models/index.d.mts.map +0 -1
- package/resources/content/models/index.d.ts +0 -3
- package/resources/content/models/index.d.ts.map +0 -1
- package/resources/content/models/index.js.map +0 -1
- package/resources/content/models/index.mjs.map +0 -1
- package/resources/content/models/models.d.mts.map +0 -1
- package/resources/content/models/models.d.ts.map +0 -1
- package/resources/content/models/models.js +0 -54
- package/resources/content/models/models.js.map +0 -1
- package/resources/content/models/models.mjs +0 -49
- package/resources/content/models/models.mjs.map +0 -1
- package/resources/content/models.d.mts +0 -2
- package/resources/content/models.d.mts.map +0 -1
- package/resources/content/models.d.ts +0 -2
- package/resources/content/models.d.ts.map +0 -1
- package/resources/content/models.js.map +0 -1
- package/resources/content/models.mjs.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./email/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/resources/email.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
export * from "./
|
|
3
|
-
//# sourceMappingURL=
|
|
2
|
+
export * from "./email/index.mjs";
|
|
3
|
+
//# sourceMappingURL=email.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.mjs","sourceRoot":"","sources":["../src/resources/email.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/resources/files.d.mts
CHANGED
|
@@ -4,8 +4,9 @@ import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../core/pagi
|
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.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
|
|
8
|
-
* then
|
|
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 declare class Files extends APIResource {
|
|
11
12
|
/**
|
|
@@ -67,12 +68,12 @@ export interface File {
|
|
|
67
68
|
path?: string | null;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
|
-
* Response containing
|
|
71
|
-
*
|
|
71
|
+
* Response containing an upload URL. PUT the file content to upload_url with the
|
|
72
|
+
* provided headers. The PUT response will contain the completed MediaFile object.
|
|
72
73
|
*/
|
|
73
74
|
export interface Upload {
|
|
74
75
|
/**
|
|
75
|
-
* File ID to
|
|
76
|
+
* File ID assigned to this upload
|
|
76
77
|
*/
|
|
77
78
|
id: string;
|
|
78
79
|
/**
|
|
@@ -82,7 +83,8 @@ export interface Upload {
|
|
|
82
83
|
[key: string]: string;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
+
* URL to PUT the file content to. The upload proxy will store the file, create
|
|
87
|
+
* database records, and return the completed MediaFile object in the PUT response.
|
|
86
88
|
*/
|
|
87
89
|
upload_url: string;
|
|
88
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB
|
|
1
|
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,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C;IAE1C;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,yBAAiB,cAAc,CAAC;IAC9B;;OAEG;IACH,UAAiB,OAAO;QACtB;;WAEG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KACd;CACF;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,IAAI,IAAI,IAAI,EACjB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;CACH"}
|
package/resources/files.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../core/pagi
|
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.js";
|
|
5
5
|
/**
|
|
6
6
|
* Upload, retrieve, and list files and media associated with a website.
|
|
7
|
-
* Upload is a two-step process: first create
|
|
8
|
-
* then
|
|
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 declare class Files extends APIResource {
|
|
11
12
|
/**
|
|
@@ -67,12 +68,12 @@ export interface File {
|
|
|
67
68
|
path?: string | null;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
|
-
* Response containing
|
|
71
|
-
*
|
|
71
|
+
* Response containing an upload URL. PUT the file content to upload_url with the
|
|
72
|
+
* provided headers. The PUT response will contain the completed MediaFile object.
|
|
72
73
|
*/
|
|
73
74
|
export interface Upload {
|
|
74
75
|
/**
|
|
75
|
-
* File ID to
|
|
76
|
+
* File ID assigned to this upload
|
|
76
77
|
*/
|
|
77
78
|
id: string;
|
|
78
79
|
/**
|
|
@@ -82,7 +83,8 @@ export interface Upload {
|
|
|
82
83
|
[key: string]: string;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
+
* URL to PUT the file content to. The upload proxy will store the file, create
|
|
87
|
+
* database records, and return the completed MediaFile object in the PUT response.
|
|
86
88
|
*/
|
|
87
89
|
upload_url: string;
|
|
88
90
|
}
|
package/resources/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB;;;;;GAKG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,IAAI,CACF,KAAK,GAAE,cAAc,GAAG,IAAI,GAAG,SAAc,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,iBAAiB,EAAE,IAAI,CAAC;IAIvC;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EA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ACtB;;WAEG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KACd;CACF;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,IAAI,IAAI,IAAI,EACjB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;CACH"}
|
package/resources/files.js
CHANGED
|
@@ -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
|
|
11
|
-
* then
|
|
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
|
/**
|
package/resources/files.js.map
CHANGED
|
@@ -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
|
|
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"}
|
package/resources/files.mjs
CHANGED
|
@@ -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
|
|
8
|
-
* then
|
|
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
|
/**
|
package/resources/files.mjs.map
CHANGED
|
@@ -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
|
|
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"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,6 +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
5
|
export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.mjs";
|
|
5
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";
|
|
6
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,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,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"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,6 +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
5
|
export { Files, type File, type Upload, type FileListParams, type FilesCursorIDPage } from "./files.js";
|
|
5
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";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -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,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,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"}
|
package/resources/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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.Domains = exports.Content = exports.Commerce = void 0;
|
|
4
|
+
exports.PushNotifications = exports.Files = exports.EmailResource = 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
9
|
var domains_1 = require("./domains.js");
|
|
10
10
|
Object.defineProperty(exports, "Domains", { enumerable: true, get: function () { return domains_1.Domains; } });
|
|
11
|
+
var email_1 = require("./email/email.js");
|
|
12
|
+
Object.defineProperty(exports, "EmailResource", { enumerable: true, get: function () { return email_1.EmailResource; } });
|
|
11
13
|
var files_1 = require("./files.js");
|
|
12
14
|
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
|
|
13
15
|
var push_notifications_1 = require("./push-notifications/push-notifications.js");
|
package/resources/index.js.map
CHANGED
|
@@ -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,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,0CAQuB;AAPrB,sGAAA,aAAa,OAAA;AAQf,oCAAqG;AAA5F,8FAAA,KAAK,OAAA;AACd,iFAWiD;AAV/C,uHAAA,iBAAiB,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { Commerce, } from "./commerce/commerce.mjs";
|
|
3
3
|
export { Content } from "./content/content.mjs";
|
|
4
4
|
export { Domains } from "./domains.mjs";
|
|
5
|
+
export { EmailResource, } from "./email/email.mjs";
|
|
5
6
|
export { Files } from "./files.mjs";
|
|
6
7
|
export { PushNotifications, } from "./push-notifications/push-notifications.mjs";
|
|
7
8
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -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,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,GAOd;OACM,EAAE,KAAK,EAAuE;OAC9E,EACL,iBAAiB,GAUlB"}
|
package/src/client.ts
CHANGED
|
@@ -32,6 +32,15 @@ import {
|
|
|
32
32
|
Currency,
|
|
33
33
|
} from './resources/commerce/commerce';
|
|
34
34
|
import { Content } from './resources/content/content';
|
|
35
|
+
import {
|
|
36
|
+
Attachment,
|
|
37
|
+
Email,
|
|
38
|
+
EmailListParams,
|
|
39
|
+
EmailResource,
|
|
40
|
+
EmailSendParams,
|
|
41
|
+
EmailSendResponse,
|
|
42
|
+
EmailsCursorIDPage,
|
|
43
|
+
} from './resources/email/email';
|
|
35
44
|
import {
|
|
36
45
|
PushNotificationEnableResponse,
|
|
37
46
|
PushNotificationIdentifyParams,
|
|
@@ -476,7 +485,7 @@ export class Hercules {
|
|
|
476
485
|
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
477
486
|
|
|
478
487
|
const errText = await response.text().catch((err: any) => castToError(err).message);
|
|
479
|
-
const errJSON = safeJSON(errText);
|
|
488
|
+
const errJSON = safeJSON(errText) as any;
|
|
480
489
|
const errMessage = errJSON ? undefined : errText;
|
|
481
490
|
|
|
482
491
|
loggerFor(this).debug(
|
|
@@ -513,9 +522,14 @@ export class Hercules {
|
|
|
513
522
|
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
514
523
|
path: string,
|
|
515
524
|
Page: new (...args: any[]) => PageClass,
|
|
516
|
-
opts?: RequestOptions
|
|
525
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
517
526
|
): Pagination.PagePromise<PageClass, Item> {
|
|
518
|
-
return this.requestAPIList(
|
|
527
|
+
return this.requestAPIList(
|
|
528
|
+
Page,
|
|
529
|
+
opts && 'then' in opts ?
|
|
530
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
531
|
+
: { method: 'get', path, ...opts },
|
|
532
|
+
);
|
|
519
533
|
}
|
|
520
534
|
|
|
521
535
|
requestAPIList<
|
|
@@ -523,7 +537,7 @@ export class Hercules {
|
|
|
523
537
|
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
524
538
|
>(
|
|
525
539
|
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
526
|
-
options: FinalRequestOptions
|
|
540
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
527
541
|
): Pagination.PagePromise<PageClass, Item> {
|
|
528
542
|
const request = this.makeRequest(options, null, undefined);
|
|
529
543
|
return new Pagination.PagePromise<PageClass, Item>(this as any as Hercules, request, Page);
|
|
@@ -536,9 +550,10 @@ export class Hercules {
|
|
|
536
550
|
controller: AbortController,
|
|
537
551
|
): Promise<Response> {
|
|
538
552
|
const { signal, method, ...options } = init || {};
|
|
539
|
-
|
|
553
|
+
const abort = this._makeAbort(controller);
|
|
554
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
540
555
|
|
|
541
|
-
const timeout = setTimeout(
|
|
556
|
+
const timeout = setTimeout(abort, ms);
|
|
542
557
|
|
|
543
558
|
const isReadableBody =
|
|
544
559
|
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
@@ -706,6 +721,12 @@ export class Hercules {
|
|
|
706
721
|
return headers.values;
|
|
707
722
|
}
|
|
708
723
|
|
|
724
|
+
private _makeAbort(controller: AbortController) {
|
|
725
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
726
|
+
// would capture all request options, and cause a memory leak.
|
|
727
|
+
return () => controller.abort();
|
|
728
|
+
}
|
|
729
|
+
|
|
709
730
|
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
|
|
710
731
|
bodyHeaders: HeadersLike;
|
|
711
732
|
body: BodyInit | undefined;
|
|
@@ -775,10 +796,16 @@ export class Hercules {
|
|
|
775
796
|
* and SSL status.
|
|
776
797
|
*/
|
|
777
798
|
domains: API.Domains = new API.Domains(this);
|
|
799
|
+
/**
|
|
800
|
+
* Send transactional emails, send batch emails, and retrieve sent email
|
|
801
|
+
* history with delivery status tracking.
|
|
802
|
+
*/
|
|
803
|
+
email: API.EmailResource = new API.EmailResource(this);
|
|
778
804
|
/**
|
|
779
805
|
* Upload, retrieve, and list files and media associated with a website.
|
|
780
|
-
* Upload is a two-step process: first create
|
|
781
|
-
* then
|
|
806
|
+
* Upload is a two-step process: first call create to get an upload URL,
|
|
807
|
+
* then PUT the file content to that URL. The PUT response returns the
|
|
808
|
+
* completed MediaFile object. No separate complete call is needed.
|
|
782
809
|
*/
|
|
783
810
|
files: API.Files = new API.Files(this);
|
|
784
811
|
pushNotifications: API.PushNotifications = new API.PushNotifications(this);
|
|
@@ -787,6 +814,7 @@ export class Hercules {
|
|
|
787
814
|
Hercules.Commerce = Commerce;
|
|
788
815
|
Hercules.Content = Content;
|
|
789
816
|
Hercules.Domains = Domains;
|
|
817
|
+
Hercules.EmailResource = EmailResource;
|
|
790
818
|
Hercules.Files = Files;
|
|
791
819
|
Hercules.PushNotifications = PushNotifications;
|
|
792
820
|
|
|
@@ -816,6 +844,16 @@ export declare namespace Hercules {
|
|
|
816
844
|
type DomainListParams as DomainListParams,
|
|
817
845
|
};
|
|
818
846
|
|
|
847
|
+
export {
|
|
848
|
+
EmailResource as EmailResource,
|
|
849
|
+
type Attachment as Attachment,
|
|
850
|
+
type Email as Email,
|
|
851
|
+
type EmailSendResponse as EmailSendResponse,
|
|
852
|
+
type EmailsCursorIDPage as EmailsCursorIDPage,
|
|
853
|
+
type EmailListParams as EmailListParams,
|
|
854
|
+
type EmailSendParams as EmailSendParams,
|
|
855
|
+
};
|
|
856
|
+
|
|
819
857
|
export {
|
|
820
858
|
Files as Files,
|
|
821
859
|
type File as File,
|
package/src/internal/parse.ts
CHANGED
|
@@ -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
|
}
|