@trycourier/cli 2.7.1 → 3.1.4

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 (103) hide show
  1. package/bin/.gitkeep +0 -0
  2. package/install.js +115 -0
  3. package/package.json +22 -87
  4. package/LICENSE +0 -21
  5. package/README.md +0 -105
  6. package/dist/bulk.d.ts +0 -15
  7. package/dist/bulk.js +0 -53
  8. package/dist/cli.d.ts +0 -2
  9. package/dist/cli.js +0 -24
  10. package/dist/commands/AudienceSearch.d.ts +0 -3
  11. package/dist/commands/AudienceSearch.js +0 -113
  12. package/dist/commands/AutomationInvokeBulk.d.ts +0 -3
  13. package/dist/commands/AutomationInvokeBulk.js +0 -139
  14. package/dist/commands/Config.d.ts +0 -4
  15. package/dist/commands/Config.js +0 -45
  16. package/dist/commands/DigestFlush.d.ts +0 -5
  17. package/dist/commands/DigestFlush.js +0 -28
  18. package/dist/commands/Help.d.ts +0 -16
  19. package/dist/commands/Help.js +0 -38
  20. package/dist/commands/Inbox/ArchiveAll.d.ts +0 -8
  21. package/dist/commands/Inbox/ArchiveAll.js +0 -180
  22. package/dist/commands/Inbox/ArchiveAllBulk.d.ts +0 -5
  23. package/dist/commands/Inbox/ArchiveAllBulk.js +0 -99
  24. package/dist/commands/Inbox/MarkAllRead.d.ts +0 -5
  25. package/dist/commands/Inbox/MarkAllRead.js +0 -110
  26. package/dist/commands/MessagesSearch.d.ts +0 -3
  27. package/dist/commands/MessagesSearch.js +0 -120
  28. package/dist/commands/NotYetImplemented.d.ts +0 -3
  29. package/dist/commands/NotYetImplemented.js +0 -5
  30. package/dist/commands/Send.d.ts +0 -5
  31. package/dist/commands/Send.js +0 -144
  32. package/dist/commands/Templates/List.d.ts +0 -3
  33. package/dist/commands/Templates/List.js +0 -114
  34. package/dist/commands/TenantsBulk.d.ts +0 -3
  35. package/dist/commands/TenantsBulk.js +0 -171
  36. package/dist/commands/TenantsGetMembership.d.ts +0 -3
  37. package/dist/commands/TenantsGetMembership.js +0 -127
  38. package/dist/commands/TenantsMembershipBulk.d.ts +0 -3
  39. package/dist/commands/TenantsMembershipBulk.js +0 -203
  40. package/dist/commands/Track.d.ts +0 -5
  41. package/dist/commands/Track.js +0 -40
  42. package/dist/commands/TrackBulk.d.ts +0 -3
  43. package/dist/commands/TrackBulk.js +0 -89
  44. package/dist/commands/TranslationsDownload.d.ts +0 -10
  45. package/dist/commands/TranslationsDownload.js +0 -30
  46. package/dist/commands/TranslationsUpload.d.ts +0 -9
  47. package/dist/commands/TranslationsUpload.js +0 -37
  48. package/dist/commands/Upgrade.d.ts +0 -3
  49. package/dist/commands/Upgrade.js +0 -38
  50. package/dist/commands/UserToken.d.ts +0 -3
  51. package/dist/commands/UserToken.js +0 -78
  52. package/dist/commands/UsersBulk.d.ts +0 -3
  53. package/dist/commands/UsersBulk.js +0 -205
  54. package/dist/commands/UsersGet.d.ts +0 -5
  55. package/dist/commands/UsersGet.js +0 -37
  56. package/dist/commands/UsersPreferences.d.ts +0 -3
  57. package/dist/commands/UsersPreferences.js +0 -73
  58. package/dist/commands/UsersSet.d.ts +0 -5
  59. package/dist/commands/UsersSet.js +0 -34
  60. package/dist/commands/UsersTokensBulk.d.ts +0 -3
  61. package/dist/commands/UsersTokensBulk.js +0 -215
  62. package/dist/commands/WhoAmI.d.ts +0 -3
  63. package/dist/commands/WhoAmI.js +0 -27
  64. package/dist/components/Context.d.ts +0 -55
  65. package/dist/components/Context.js +0 -94
  66. package/dist/components/Elemental.d.ts +0 -13
  67. package/dist/components/Elemental.js +0 -23
  68. package/dist/components/KVP.d.ts +0 -11
  69. package/dist/components/KVP.js +0 -12
  70. package/dist/components/Request.d.ts +0 -23
  71. package/dist/components/Request.js +0 -17
  72. package/dist/components/Response.d.ts +0 -16
  73. package/dist/components/Response.js +0 -29
  74. package/dist/components/Router.d.ts +0 -4
  75. package/dist/components/Router.js +0 -60
  76. package/dist/components/SdkResponse.d.ts +0 -9
  77. package/dist/components/SdkResponse.js +0 -21
  78. package/dist/components/Spinner.d.ts +0 -6
  79. package/dist/components/Spinner.js +0 -41
  80. package/dist/components/Table.d.ts +0 -19
  81. package/dist/components/Table.js +0 -62
  82. package/dist/components/UhOh.d.ts +0 -5
  83. package/dist/components/UhOh.js +0 -10
  84. package/dist/components/Version.d.ts +0 -3
  85. package/dist/components/Version.js +0 -53
  86. package/dist/constants.d.ts +0 -8
  87. package/dist/constants.js +0 -8
  88. package/dist/lib/api.d.ts +0 -17
  89. package/dist/lib/api.js +0 -39
  90. package/dist/lib/args.d.ts +0 -2
  91. package/dist/lib/args.js +0 -13
  92. package/dist/lib/courier.d.ts +0 -3
  93. package/dist/lib/courier.js +0 -7
  94. package/dist/lib/delay.d.ts +0 -2
  95. package/dist/lib/delay.js +0 -7
  96. package/dist/lib/load-env.d.ts +0 -2
  97. package/dist/lib/load-env.js +0 -16
  98. package/dist/lib/uuid.d.ts +0 -2
  99. package/dist/lib/uuid.js +0 -4
  100. package/dist/mappings.d.ts +0 -6
  101. package/dist/mappings.js +0 -559
  102. package/dist/version.d.ts +0 -2
  103. package/dist/version.js +0 -2
package/dist/lib/api.d.ts DELETED
@@ -1,17 +0,0 @@
1
- interface IRequest {
2
- url: string;
3
- method: string;
4
- body?: object | string;
5
- headers?: {
6
- [key: string]: string;
7
- };
8
- options?: RequestInit;
9
- }
10
- interface IResponse {
11
- res: Response;
12
- json?: any;
13
- text?: string;
14
- err?: Error;
15
- }
16
- declare const _default: (request: IRequest, baseUrl: string, apikey: string) => Promise<IResponse>;
17
- export default _default;
package/dist/lib/api.js DELETED
@@ -1,39 +0,0 @@
1
- import VERSION from "../version.js";
2
- const isString = (s) => {
3
- return typeof s === 'string' || s instanceof String;
4
- };
5
- export default async (request, baseUrl, apikey) => {
6
- const req = {
7
- method: request.method,
8
- headers: {
9
- Authorization: `Bearer ${apikey}`,
10
- 'Content-Type': 'application/json',
11
- 'User-Agent': `courier-cli/${VERSION}`,
12
- 'X-Courier-CLI-Version': VERSION,
13
- ...request.headers,
14
- },
15
- body: request.body && !isString(request.body)
16
- ? JSON.stringify(request.body)
17
- : request.body?.toString(),
18
- ...request.options,
19
- };
20
- return fetch(`${baseUrl}${request.url}`, req).then(res => {
21
- if (res.status > 400) {
22
- return {
23
- res,
24
- err: new Error(`${res.status}: ${res.statusText}`),
25
- };
26
- }
27
- else if (res.status === 204) {
28
- return { res };
29
- }
30
- else {
31
- if (res.headers.get('Content-Type')?.includes('application/json')) {
32
- return res.json().then(json => ({ res, json }));
33
- }
34
- else {
35
- return res.text().then(text => ({ res, text }));
36
- }
37
- }
38
- });
39
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (argv: string[]) => string[];
2
- export default _default;
package/dist/lib/args.js DELETED
@@ -1,13 +0,0 @@
1
- export default (argv) => {
2
- if (!argv || !argv.length || !argv[0]) {
3
- return [];
4
- }
5
- else if (argv[0].endsWith('node')) {
6
- const [, , ...args] = argv;
7
- return args;
8
- }
9
- else {
10
- const [, ...args] = argv;
11
- return args;
12
- }
13
- };
@@ -1,3 +0,0 @@
1
- import { CourierClient } from "@trycourier/courier";
2
- declare const getClient: (environment?: 'test' | 'production') => CourierClient;
3
- export default getClient;
@@ -1,7 +0,0 @@
1
- import { CourierClient } from "@trycourier/courier";
2
- const getClient = (environment = 'production') => {
3
- return new CourierClient({
4
- authorizationToken: environment ? process.env['COURIER_AUTH_TOKEN'] : process.env['COURIER_AUTH_TOKEN_TEST'],
5
- });
6
- };
7
- export default getClient;
@@ -1,2 +0,0 @@
1
- declare function delay(ms: number): Promise<unknown>;
2
- export default delay;
package/dist/lib/delay.js DELETED
@@ -1,7 +0,0 @@
1
- function delay(ms) {
2
- if (ms === 0) {
3
- return Promise.resolve();
4
- }
5
- return new Promise(resolve => setTimeout(resolve, ms));
6
- }
7
- export default delay;
@@ -1,2 +0,0 @@
1
- declare const _default: () => Promise<boolean>;
2
- export default _default;
@@ -1,16 +0,0 @@
1
- import os from 'os';
2
- import fs from 'fs';
3
- import dotenv from 'dotenv';
4
- export default async () => {
5
- const paths = [
6
- `${process.cwd()}/.courier`, // current working directory
7
- `${os.homedir()}/.courier`, // user home directory
8
- ];
9
- for (const path of paths) {
10
- if (fs.existsSync(path)) {
11
- dotenv.config({ path });
12
- return true;
13
- }
14
- }
15
- return false;
16
- };
@@ -1,2 +0,0 @@
1
- declare const uuid: () => string;
2
- export default uuid;
package/dist/lib/uuid.js DELETED
@@ -1,4 +0,0 @@
1
- const uuid = () => {
2
- return Math.random().toString(36).substring(2) + Math.random().toString(36).substring(2);
3
- };
4
- export default uuid;
@@ -1,6 +0,0 @@
1
- declare const mappings: Map<string, IMapping>;
2
- export declare const COMMON_OPTIONS: {
3
- option: string;
4
- value: string;
5
- }[];
6
- export default mappings;