@trycourier/courier 6.0.8 → 6.1.0

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 (85) hide show
  1. package/Client.js +1 -1
  2. package/api/resources/audiences/client/Client.js +5 -5
  3. package/api/resources/auditEvents/client/Client.js +2 -2
  4. package/api/resources/authTokens/client/Client.js +1 -1
  5. package/api/resources/automations/client/Client.js +2 -2
  6. package/api/resources/brands/client/Client.js +5 -5
  7. package/api/resources/bulk/client/Client.js +5 -5
  8. package/api/resources/lists/client/Client.d.ts +1 -1
  9. package/api/resources/lists/client/Client.js +11 -20
  10. package/api/resources/lists/client/requests/index.d.ts +0 -1
  11. package/api/resources/lists/types/index.d.ts +0 -5
  12. package/api/resources/lists/types/index.js +0 -5
  13. package/api/resources/messages/client/Client.js +6 -6
  14. package/api/resources/notifications/client/Client.js +8 -8
  15. package/api/resources/profiles/client/Client.js +7 -7
  16. package/api/resources/templates/client/Client.js +1 -1
  17. package/api/resources/tenants/client/Client.d.ts +2 -2
  18. package/api/resources/tenants/client/Client.js +25 -7
  19. package/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
  20. package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
  21. package/api/resources/tenants/client/requests/index.d.ts +2 -0
  22. package/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
  23. package/api/resources/translations/client/Client.js +2 -2
  24. package/api/resources/users/resources/preferences/client/Client.js +3 -3
  25. package/api/resources/users/resources/tenants/client/Client.js +8 -8
  26. package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
  27. package/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  28. package/api/resources/users/resources/tokens/client/Client.js +5 -5
  29. package/core/fetcher/Fetcher.js +3 -5
  30. package/dist/Client.js +1 -1
  31. package/dist/api/resources/audiences/client/Client.js +5 -5
  32. package/dist/api/resources/auditEvents/client/Client.js +2 -2
  33. package/dist/api/resources/authTokens/client/Client.js +1 -1
  34. package/dist/api/resources/automations/client/Client.js +2 -2
  35. package/dist/api/resources/brands/client/Client.js +5 -5
  36. package/dist/api/resources/bulk/client/Client.js +5 -5
  37. package/dist/api/resources/lists/client/Client.d.ts +1 -1
  38. package/dist/api/resources/lists/client/Client.js +11 -20
  39. package/dist/api/resources/lists/client/requests/index.d.ts +0 -1
  40. package/dist/api/resources/lists/types/index.d.ts +0 -5
  41. package/dist/api/resources/lists/types/index.js +0 -5
  42. package/dist/api/resources/messages/client/Client.js +6 -6
  43. package/dist/api/resources/notifications/client/Client.js +8 -8
  44. package/dist/api/resources/profiles/client/Client.js +7 -7
  45. package/dist/api/resources/templates/client/Client.js +1 -1
  46. package/dist/api/resources/tenants/client/Client.d.ts +2 -2
  47. package/dist/api/resources/tenants/client/Client.js +25 -7
  48. package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
  49. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
  50. package/dist/api/resources/tenants/client/requests/index.d.ts +2 -0
  51. package/dist/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
  52. package/dist/api/resources/translations/client/Client.js +2 -2
  53. package/dist/api/resources/users/resources/preferences/client/Client.js +3 -3
  54. package/dist/api/resources/users/resources/tenants/client/Client.js +8 -8
  55. package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
  56. package/dist/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  57. package/dist/api/resources/users/resources/tokens/client/Client.js +5 -5
  58. package/dist/core/fetcher/Fetcher.js +3 -5
  59. package/jest.config.js +5 -0
  60. package/package.json +6 -2
  61. package/tests/client.test.ts +11 -0
  62. package/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
  63. package/api/resources/lists/types/ListFindByRecipientIdParams.d.ts +0 -6
  64. package/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
  65. package/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
  66. package/api/resources/lists/types/ListGetSubscriptionsParams.d.ts +0 -6
  67. package/api/resources/lists/types/ListGetSubscriptionsParams.js +0 -5
  68. package/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
  69. package/api/resources/lists/types/RecipientSubscriptionsResponse.js +0 -5
  70. package/dist/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
  71. package/dist/api/resources/lists/client/requests/GetListRequest.js +0 -5
  72. package/dist/api/resources/lists/types/ListFindByRecipientIdParams.d.ts +0 -6
  73. package/dist/api/resources/lists/types/ListFindByRecipientIdParams.js +0 -5
  74. package/dist/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
  75. package/dist/api/resources/lists/types/ListFindByRecipientIdResponse.js +0 -5
  76. package/dist/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
  77. package/dist/api/resources/lists/types/ListGetAllParams.js +0 -5
  78. package/dist/api/resources/lists/types/ListGetSubscriptionsParams.d.ts +0 -6
  79. package/dist/api/resources/lists/types/ListGetSubscriptionsParams.js +0 -5
  80. package/dist/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
  81. package/dist/api/resources/lists/types/RecipientSubscriptionsResponse.js +0 -5
  82. /package/api/resources/{lists/client/requests/GetListRequest.js → tenants/client/requests/ListTenantParams.js} +0 -0
  83. /package/api/resources/{lists/types/ListFindByRecipientIdParams.js → tenants/client/requests/ListUsersForTenantParams.js} +0 -0
  84. /package/{api/resources/lists/types/ListFindByRecipientIdResponse.js → dist/api/resources/tenants/client/requests/ListTenantParams.js} +0 -0
  85. /package/{api/resources/lists/types/ListGetAllParams.js → dist/api/resources/tenants/client/requests/ListUsersForTenantParams.js} +0 -0
@@ -62,7 +62,7 @@ class Tokens {
62
62
  Authorization: yield this._getAuthorizationHeader(),
63
63
  "X-Fern-Language": "JavaScript",
64
64
  "X-Fern-SDK-Name": "@trycourier/courier",
65
- "X-Fern-SDK-Version": "v6.0.8",
65
+ "X-Fern-SDK-Version": "v6.1.0",
66
66
  },
67
67
  contentType: "application/json",
68
68
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -111,7 +111,7 @@ class Tokens {
111
111
  Authorization: yield this._getAuthorizationHeader(),
112
112
  "X-Fern-Language": "JavaScript",
113
113
  "X-Fern-SDK-Name": "@trycourier/courier",
114
- "X-Fern-SDK-Version": "v6.0.8",
114
+ "X-Fern-SDK-Version": "v6.1.0",
115
115
  },
116
116
  contentType: "application/json",
117
117
  body: request,
@@ -161,7 +161,7 @@ class Tokens {
161
161
  Authorization: yield this._getAuthorizationHeader(),
162
162
  "X-Fern-Language": "JavaScript",
163
163
  "X-Fern-SDK-Name": "@trycourier/courier",
164
- "X-Fern-SDK-Version": "v6.0.8",
164
+ "X-Fern-SDK-Version": "v6.1.0",
165
165
  },
166
166
  contentType: "application/json",
167
167
  body: request,
@@ -211,7 +211,7 @@ class Tokens {
211
211
  Authorization: yield this._getAuthorizationHeader(),
212
212
  "X-Fern-Language": "JavaScript",
213
213
  "X-Fern-SDK-Name": "@trycourier/courier",
214
- "X-Fern-SDK-Version": "v6.0.8",
214
+ "X-Fern-SDK-Version": "v6.1.0",
215
215
  },
216
216
  contentType: "application/json",
217
217
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -260,7 +260,7 @@ class Tokens {
260
260
  Authorization: yield this._getAuthorizationHeader(),
261
261
  "X-Fern-Language": "JavaScript",
262
262
  "X-Fern-SDK-Name": "@trycourier/courier",
263
- "X-Fern-SDK-Version": "v6.0.8",
263
+ "X-Fern-SDK-Version": "v6.1.0",
264
264
  },
265
265
  contentType: "application/json",
266
266
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.fetcher = void 0;
16
16
  const form_data_1 = __importDefault(require("form-data"));
17
17
  const qs_1 = __importDefault(require("qs"));
18
- if (typeof window === "undefined") {
19
- global.fetch = require("node-fetch");
20
- }
21
18
  const INITIAL_RETRY_DELAY = 1;
22
19
  const MAX_RETRY_DELAY = 60;
23
20
  const DEFAULT_MAX_RETRIES = 2;
@@ -46,18 +43,19 @@ function fetcherImpl(args) {
46
43
  else {
47
44
  body = JSON.stringify(args.body);
48
45
  }
46
+ const fetchFn = typeof fetch == "function" ? fetch : require("node-fetch");
49
47
  const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
50
48
  const controller = new AbortController();
51
49
  let abortId = undefined;
52
50
  if (args.timeoutMs != null) {
53
51
  abortId = setTimeout(() => controller.abort(), args.timeoutMs);
54
52
  }
55
- const response = yield fetch(url, {
53
+ const response = yield fetchFn(url, {
56
54
  method: args.method,
57
55
  headers,
58
56
  body,
59
57
  signal: controller.signal,
60
- credentials: args.withCredentials ? "same-origin" : undefined,
58
+ credentials: args.withCredentials ? "include" : undefined,
61
59
  });
62
60
  if (abortId != null) {
63
61
  clearTimeout(abortId);
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: "ts-jest",
4
+ testEnvironment: "node",
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier",
3
- "version": "v6.0.8",
3
+ "version": "v6.1.0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/trycourier/courier-node",
6
6
  "main": "./index.js",
@@ -8,7 +8,8 @@
8
8
  "scripts": {
9
9
  "format": "prettier --write 'src/**/*.ts'",
10
10
  "build": "tsc",
11
- "prepack": "cp -rv dist/. ."
11
+ "prepack": "cp -rv dist/. .",
12
+ "test": "jest"
12
13
  },
13
14
  "dependencies": {
14
15
  "url-join": "4.0.1",
@@ -21,6 +22,9 @@
21
22
  "@types/url-join": "4.0.1",
22
23
  "@types/qs": "6.9.8",
23
24
  "@types/node-fetch": "2.6.9",
25
+ "jest": "^29.7.0",
26
+ "@types/jest": "^29.5.5",
27
+ "ts-jest": "^29.1.1",
24
28
  "@types/node": "17.0.33",
25
29
  "prettier": "2.7.1",
26
30
  "typescript": "4.6.4"
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a test file for the SDK.
3
+ *
4
+ * Add any tests here and make sure to mark this file
5
+ * in `.fernignore`.
6
+ */
7
+ describe("test", () => {
8
+ it("default", () => {
9
+ expect(true).toBe(true);
10
+ });
11
+ });
@@ -1,13 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface GetListRequest {
5
- /**
6
- * A unique identifier that allows for fetching the next page of lists.
7
- */
8
- cursor?: string;
9
- /**
10
- * "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match."
11
- */
12
- pattern?: string;
13
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListFindByRecipientIdParams {
5
- cursor?: string;
6
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface ListFindByRecipientIdResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetAllParams {
5
- cursor?: string;
6
- pattern?: string;
7
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetSubscriptionsParams {
5
- cursor?: string;
6
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface RecipientSubscriptionsResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface GetListRequest {
5
- /**
6
- * A unique identifier that allows for fetching the next page of lists.
7
- */
8
- cursor?: string;
9
- /**
10
- * "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match."
11
- */
12
- pattern?: string;
13
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListFindByRecipientIdParams {
5
- cursor?: string;
6
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface ListFindByRecipientIdResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetAllParams {
5
- cursor?: string;
6
- pattern?: string;
7
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetSubscriptionsParams {
5
- cursor?: string;
6
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface RecipientSubscriptionsResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });