@myapihq/sdk 1.3.13 → 2.0.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.
package/src/payments.ts CHANGED
@@ -19,6 +19,7 @@ export const EXPOSES: Exposes = [
19
19
  // Connection status — the org's Stripe link. T0 takes no platform fee, so
20
20
  // `application_fee_bps` is 0.
21
21
  export interface ConnectStatus {
22
+ connected?: boolean;
22
23
  tier: string;
23
24
  stripe_account_id: string;
24
25
  onboarding_status: string;
@@ -71,7 +72,7 @@ export async function connect(apiKey: string, orgId: string, stripeSecretKey: st
71
72
  });
72
73
  }
73
74
 
74
- // getConnect reads the org's connection status. Throws NOT_CONNECTED (404)
75
+ // getConnect reads the org's connection status. Returns { connected: false } when no Stripe is linked (no longer a 404).
75
76
  // when the org has not connected Stripe.
76
77
  export async function getConnect(apiKey: string, orgId: string): Promise<ConnectStatus> {
77
78
  return request('GET', `${BASE_URL}/payments/orgs/${encodeURIComponent(orgId)}/connect`, apiKey);
package/src/queue.ts CHANGED
@@ -10,6 +10,7 @@ export const EXPOSES: Exposes = [
10
10
  'POST /queue/orgs/{org_id}/queues',
11
11
  'GET /queue/orgs/{org_id}/queues',
12
12
  'GET /queue/orgs/{org_id}/queues/{name}',
13
+ 'DELETE /queue/orgs/{org_id}/queues/{name}',
13
14
  'POST /queue/orgs/{org_id}/queues/{name}/jobs',
14
15
  'GET /queue/orgs/{org_id}/queues/{name}/jobs',
15
16
  'GET /queue/orgs/{org_id}/jobs/{id}',
@@ -84,6 +85,10 @@ export async function getQueue(apiKey: string, orgId: string, name: string): Pro
84
85
  return request('GET', `${queuesBase(orgId)}/${encodeURIComponent(name)}`, apiKey);
85
86
  }
86
87
 
88
+ export async function deleteQueue(apiKey: string, orgId: string, name: string): Promise<void> {
89
+ return request('DELETE', `${queuesBase(orgId)}/${encodeURIComponent(name)}`, apiKey);
90
+ }
91
+
87
92
  // enqueueJob is idempotent on (queue, dedup_key). A job with unsucceeded
88
93
  // depends_on starts blocked.
89
94
  export async function enqueueJob(apiKey: string, orgId: string, name: string, opts: EnqueueOptions = {}): Promise<Job> {
package/src/services.ts CHANGED
@@ -54,6 +54,15 @@ export const SERVICES: readonly ServiceMeta[] = [
54
54
  status: 'ga',
55
55
  keywords: k('auth', 'identity', 'billing', 'organization'),
56
56
  },
57
+ {
58
+ module: 'auth',
59
+ skill: 'my-auth-api',
60
+ domain: 'myauthapi.com',
61
+ description: 'Managed OIDC identity provider for the end users of apps built on MyAPI. Per-org auth tenant + OIDC clients, RS256/JWKS, hosted login, managed Google sign-in. A Kinde alternative.',
62
+ category: 'identity',
63
+ status: 'ga',
64
+ keywords: k('auth', 'oidc', 'oauth', 'login', 'identity', 'sso'),
65
+ },
57
66
  {
58
67
  module: 'domain',
59
68
  skill: 'my-domain-api',
@@ -73,16 +82,16 @@ export const SERVICES: readonly ServiceMeta[] = [
73
82
  module: 'email',
74
83
  skill: 'my-email-api',
75
84
  domain: 'myemailapi.com',
76
- description: 'Send transactional and bulk email from your own domain. Mailboxes, AI templates, drip campaigns, and warmup.',
85
+ description: 'Send transactional and bulk email from your own domain. Mailboxes, AI templates, and warmup.',
77
86
  category: 'send',
78
87
  status: 'ga',
79
- keywords: k('email', 'transactional', 'campaign', 'smtp'),
88
+ keywords: k('email', 'transactional', 'smtp', 'mailbox'),
80
89
  },
81
90
  {
82
91
  module: 'email',
83
92
  skill: 'my-email-verify-api',
84
93
  domain: 'myemailapi.com',
85
- description: 'Sync single-address email verification — syntax + DNS + Microsoft probe. Pre-send quality gate for campaigns.',
94
+ description: 'Sync single-address email verification — syntax + DNS + Microsoft probe. Pre-send quality gate for outbound.',
86
95
  category: 'send',
87
96
  status: 'ga',
88
97
  keywords: k('email', 'verification', 'deliverability', 'syntax', 'dns'),
@@ -206,10 +215,10 @@ export const SERVICES: readonly ServiceMeta[] = [
206
215
  module: 'llm',
207
216
  skill: 'my-llm-api',
208
217
  domain: 'myllmapi.com',
209
- description: 'Provider-agnostic LLM completions + embeddings via MyAPI. Routes to managed models (Gemini today, more soon) at upstream cost. Use in workflow steps, not for your own reasoning.',
218
+ description: 'Self-hosted open-source LLM: raw chat completions (you pick the model) + objective verbs (classify/extract/summarize/draft). Billed in cents per 1M tokens from your balance. Use in workflow steps, not for your own reasoning.',
210
219
  category: 'compute',
211
220
  status: 'ga',
212
- keywords: k('llm', 'completion', 'embedding', 'gemini'),
221
+ keywords: k('llm', 'completion', 'qwen', 'classify'),
213
222
  },
214
223
  {
215
224
  // CLI top-level command is `fn`; SDK namespace is `fn`; skill directory is
@@ -267,7 +276,7 @@ export const SERVICES: readonly ServiceMeta[] = [
267
276
  domain: 'mygitapi.com',
268
277
  description: 'Hosted git repositories over HTTP — create repos, commit files, manage branches and tags, read trees, blobs, history, and diffs. No local clone required.',
269
278
  category: 'store',
270
- status: 'preview',
279
+ status: 'ga',
271
280
  keywords: k('git', 'repository', 'version-control', 'commit', 'scm'),
272
281
  },
273
282
 
package/src/storage.ts CHANGED
@@ -27,6 +27,8 @@ export type UploadContentType =
27
27
  | 'image/png'
28
28
  | 'image/gif'
29
29
  | 'image/webp'
30
+ | 'image/svg+xml'
31
+ | 'application/pdf'
30
32
  | 'video/mp4'
31
33
  | 'video/webm';
32
34
 
package/src/types.ts CHANGED
@@ -2,7 +2,9 @@ export interface ApiResponse<T> {
2
2
  success: boolean;
3
3
  data: T | null;
4
4
  error: string | null;
5
- meta: { request_id: string; latency_ms: number; service: string; version: string };
5
+ // Pagination fields (next_cursor / has_more / limit) appear on keyset-paginated
6
+ // list endpoints (backend `envelope.WrapPage`) — read via `requestPage`.
7
+ meta: { request_id: string; latency_ms: number; service: string; version: string; next_cursor?: string; has_more?: boolean; limit?: number };
6
8
  }
7
9
 
8
10
  export interface PaginatedResponse<T> {
package/src/webhook.ts CHANGED
@@ -21,6 +21,9 @@ export interface WebhookEndpoint {
21
21
  // into CRM as a contact + webhook_received event on each delivery.
22
22
  // Default 'email' (top-level). Empty string disables CRM ingest.
23
23
  crm_email_path?: string;
24
+ // URL every inbound delivery is forwarded to (POST, async, best-effort).
25
+ // Empty/absent when forwarding is disabled. Backend webhook/endpoints.go.
26
+ forward_url?: string;
24
27
  created_at: string;
25
28
  }
26
29
 
@@ -29,6 +32,13 @@ export interface Delivery {
29
32
  endpoint_id: string;
30
33
  payload: unknown;
31
34
  received_at: string;
35
+ // Forwarding outcome for this delivery, present only when the endpoint has
36
+ // a forward_url configured (backend webhook/endpoints.go). forward_status
37
+ // is the HTTP status of the forward POST; last_forward_error carries the
38
+ // failure message when the forward attempt errored.
39
+ forward_status?: number;
40
+ last_forward_at?: string;
41
+ last_forward_error?: string;
32
42
  }
33
43
 
34
44
  export interface CreateEndpointOptions {
package/src/workflow.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { request } from './client';
1
+ import { request, requestPage } from './client';
2
2
  import { WORKFLOW_BASE as BASE_URL } from './config';
3
3
  import type { Exposes } from './exposes';
4
4
 
@@ -62,6 +62,20 @@ export interface WorkflowRun {
62
62
  started_at?: string;
63
63
  finished_at?: string;
64
64
  created_at: string;
65
+ // Per-step output records, populated by GetRun only (backend crud.go:639
66
+ // returns step_outputs; ListRuns omits them). Empty array when none.
67
+ step_outputs?: unknown[];
68
+ }
69
+
70
+ export interface ListRunsOptions {
71
+ limit?: number; // 1-500, default 100 server-side
72
+ cursor?: string; // last run id from the prior page (keyset)
73
+ }
74
+
75
+ export interface WorkflowRunsPage {
76
+ runs: WorkflowRun[];
77
+ next_cursor?: string;
78
+ has_more?: boolean;
65
79
  }
66
80
 
67
81
  // Local URL-shape check on http_request steps. Same shape as the SSRF
@@ -122,8 +136,25 @@ export async function deleteWorkflow(apiKey: string, orgId: string, workflowId:
122
136
  return request('DELETE', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
123
137
  }
124
138
 
125
- export async function listWorkflowRuns(apiKey: string, orgId: string, workflowId: string): Promise<WorkflowRun[]> {
126
- return request('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
139
+ // listWorkflowRuns returns recent runs newest-first. The backend wraps this
140
+ // in a keyset-pagination envelope (limit 1-500 + cursor), so we use
141
+ // requestPage to preserve next_cursor — a plain `request` would drop it.
142
+ export async function listWorkflowRuns(
143
+ apiKey: string,
144
+ orgId: string,
145
+ workflowId: string,
146
+ opts: ListRunsOptions = {},
147
+ ): Promise<WorkflowRunsPage> {
148
+ const qs = new URLSearchParams();
149
+ if (opts.limit !== undefined) qs.set('limit', String(opts.limit));
150
+ if (opts.cursor) qs.set('cursor', opts.cursor);
151
+ const query = qs.toString() ? `?${qs.toString()}` : '';
152
+ const page = await requestPage<WorkflowRun>(
153
+ 'GET',
154
+ `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/runs${query}`,
155
+ apiKey,
156
+ );
157
+ return { runs: page.data, next_cursor: page.next_cursor, has_more: page.has_more };
127
158
  }
128
159
 
129
160
  export async function getWorkflowRun(apiKey: string, orgId: string, runId: string): Promise<WorkflowRun> {