@myapihq/cli 1.0.84 → 1.1.0-wip.1

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 (77) hide show
  1. package/dist/commands/auth.d.ts +8 -3
  2. package/dist/commands/auth.js +84 -60
  3. package/dist/commands/billing.d.ts +8 -4
  4. package/dist/commands/billing.js +46 -27
  5. package/dist/commands/config.d.ts +8 -5
  6. package/dist/commands/config.js +52 -27
  7. package/dist/commands/domain.d.ts +12 -9
  8. package/dist/commands/domain.js +124 -86
  9. package/dist/commands/email/campaign.d.ts +2 -0
  10. package/dist/commands/email/campaign.js +152 -0
  11. package/dist/commands/email/index.d.ts +4 -0
  12. package/dist/commands/email/index.js +98 -0
  13. package/dist/commands/email/mailbox.d.ts +2 -0
  14. package/dist/commands/email/mailbox.js +88 -0
  15. package/dist/commands/email/message.d.ts +2 -0
  16. package/dist/commands/email/message.js +115 -0
  17. package/dist/commands/email/template.d.ts +2 -0
  18. package/dist/commands/email/template.js +106 -0
  19. package/dist/commands/email/warmup.d.ts +2 -0
  20. package/dist/commands/email/warmup.js +43 -0
  21. package/dist/commands/email.d.ts +4 -12
  22. package/dist/commands/email.js +528 -146
  23. package/dist/commands/funnel.d.ts +10 -7
  24. package/dist/commands/funnel.js +79 -55
  25. package/dist/commands/image.js +25 -15
  26. package/dist/commands/keys.d.ts +8 -3
  27. package/dist/commands/keys.js +71 -35
  28. package/dist/commands/org.d.ts +9 -5
  29. package/dist/commands/org.js +100 -64
  30. package/dist/commands/pixel.js +23 -11
  31. package/dist/commands/setup.d.ts +3 -2
  32. package/dist/commands/setup.js +160 -165
  33. package/dist/commands/storage.js +25 -15
  34. package/dist/commands/update.d.ts +2 -1
  35. package/dist/commands/update.js +5 -0
  36. package/dist/commands/url.js +19 -7
  37. package/dist/commands/webhook.d.ts +8 -5
  38. package/dist/commands/webhook.js +70 -38
  39. package/dist/commands/workflow.d.ts +13 -7
  40. package/dist/commands/workflow.js +179 -58
  41. package/dist/config.js +10 -5
  42. package/dist/flags.d.ts +8 -0
  43. package/dist/flags.js +88 -0
  44. package/dist/flags.test.d.ts +1 -0
  45. package/dist/flags.test.js +73 -0
  46. package/dist/helpers.d.ts +6 -0
  47. package/dist/helpers.js +31 -0
  48. package/dist/index.js +98 -109
  49. package/dist/output.d.ts +12 -1
  50. package/dist/output.js +16 -6
  51. package/dist/prompt.d.ts +24 -0
  52. package/dist/prompt.js +41 -0
  53. package/dist/skills/my-email-api/README.md +45 -0
  54. package/dist/skills/my-email-api/SKILL.md +104 -0
  55. package/dist/skills/my-email-api/claude/.claude-plugin/plugin.json +6 -0
  56. package/dist/skills/my-email-api/make/.gitkeep +0 -0
  57. package/dist/skills/my-email-api/n8n/.gitkeep +0 -0
  58. package/dist/skills/my-email-api/openapi/.gitkeep +0 -0
  59. package/dist/skills/my-webhook-api/README.md +40 -0
  60. package/dist/skills/my-webhook-api/SKILL.md +138 -0
  61. package/dist/skills/my-webhook-api/claude/.claude-plugin/plugin.json +6 -0
  62. package/dist/skills/my-webhook-api/make/.gitkeep +0 -0
  63. package/dist/skills/my-webhook-api/n8n/.gitkeep +0 -0
  64. package/dist/skills/my-webhook-api/openapi/.gitkeep +0 -0
  65. package/dist/skills/my-workflow-api/README.md +36 -0
  66. package/dist/skills/my-workflow-api/SKILL.md +156 -0
  67. package/dist/skills/my-workflow-api/claude/.claude-plugin/plugin.json +6 -0
  68. package/dist/skills/my-workflow-api/make/.gitkeep +0 -0
  69. package/dist/skills/my-workflow-api/n8n/.gitkeep +0 -0
  70. package/dist/skills/my-workflow-api/openapi/.gitkeep +0 -0
  71. package/dist/utils.d.ts +26 -4
  72. package/dist/utils.js +32 -33
  73. package/dist/utils.test.d.ts +1 -0
  74. package/dist/utils.test.js +48 -0
  75. package/package.json +9 -4
  76. package/dist/commands/account.d.ts +0 -4
  77. package/dist/commands/account.js +0 -80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.84",
3
+ "version": "1.1.0-wip.1",
4
4
  "description": "MyAPI command-line interface",
5
5
  "type": "module",
6
6
  "files": [
@@ -13,10 +13,14 @@
13
13
  "scripts": {
14
14
  "prebuild": "node scripts/copy-skills.js",
15
15
  "build": "tsc && rm -rf dist/skills && cp -r src/skills dist/skills",
16
- "dev": "tsc --watch"
16
+ "dev": "tsc --watch",
17
+ "test": "vitest run src",
18
+ "test:smoke": "npm run build && vitest run src test/smoke",
19
+ "test:online": "npm run build && MYAPI_RUN_RESET=1 vitest run test/online",
20
+ "test:all": "npm run build && MYAPI_RUN_RESET=1 vitest run src test/smoke test/online"
17
21
  },
18
22
  "dependencies": {
19
- "@myapihq/sdk": "*",
23
+ "@myapihq/sdk": "1.1.0-wip.0",
20
24
  "omelette": "^0.4.17",
21
25
  "update-notifier": "^7.3.1"
22
26
  },
@@ -24,6 +28,7 @@
24
28
  "@types/node": "^25.6.0",
25
29
  "@types/omelette": "^0.4.5",
26
30
  "@types/update-notifier": "^6.0.8",
27
- "typescript": "^5.4.0"
31
+ "typescript": "^5.4.0",
32
+ "vitest": "^4.1.5"
28
33
  }
29
34
  }
@@ -1,4 +0,0 @@
1
- export declare function create(): Promise<void>;
2
- export declare function token(flags: Record<string, string | boolean>): Promise<void>;
3
- export declare function listKeys(flags: Record<string, string | boolean>): Promise<void>;
4
- export declare function revokeKey(id: string, flags: Record<string, string | boolean>): Promise<void>;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.create = create;
37
- exports.token = token;
38
- exports.listKeys = listKeys;
39
- exports.revokeKey = revokeKey;
40
- const sdk_1 = require("@myapihq/sdk");
41
- const config_js_1 = require("../config.js");
42
- const output_js_1 = require("../output.js");
43
- const readline = __importStar(require("readline"));
44
- async function create() {
45
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
46
- const key = await new Promise(resolve => rl.question('Paste your API key (get it from https://myapihq.com): ', resolve));
47
- rl.close();
48
- if (!key.trim()) {
49
- (0, output_js_1.error)('API key cannot be empty.');
50
- return;
51
- }
52
- (0, config_js_1.saveConfig)({ api_key: key.trim(), account_id: '', pin: '' });
53
- (0, output_js_1.success)(`API key saved to ~/.myapi/config.json`);
54
- }
55
- async function token(flags) {
56
- let pin = flags.pin;
57
- if (!pin) {
58
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
59
- pin = await new Promise(resolve => rl.question('Enter PIN: ', resolve));
60
- rl.close();
61
- }
62
- const result = await sdk_1.hq.recoverAgentToken(pin);
63
- const keyInfo = await sdk_1.hq.createApiKey(result.token, 'recovered');
64
- const config = (0, config_js_1.requireConfig)();
65
- config.api_key = keyInfo.api_key;
66
- (0, config_js_1.saveConfig)(config);
67
- (0, output_js_1.success)(`Token recovered! New API Key: ${keyInfo.api_key}`);
68
- }
69
- async function listKeys(flags) {
70
- const config = (0, config_js_1.requireConfig)();
71
- const keys = await sdk_1.hq.listApiKeys(config.api_key);
72
- (0, output_js_1.printTable)(keys);
73
- }
74
- async function revokeKey(id, flags) {
75
- if (!id)
76
- (0, output_js_1.error)("Missing key id");
77
- const config = (0, config_js_1.requireConfig)();
78
- await sdk_1.hq.revokeApiKey(config.api_key, id);
79
- (0, output_js_1.success)(`Key ${id} revoked`);
80
- }