@myapihq/sdk 1.2.8 → 1.3.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.
- package/dist/client.js +4 -4
- package/dist/config.d.ts +3 -0
- package/dist/config.js +4 -1
- package/dist/email.d.ts +27 -0
- package/dist/email.js +31 -0
- package/dist/git.d.ts +96 -0
- package/dist/git.js +121 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/pixel.d.ts +1 -1
- package/dist/pixel.js +4 -2
- package/dist/queue.d.ts +49 -0
- package/dist/queue.js +71 -0
- package/dist/services.d.ts +1 -1
- package/dist/services.js +54 -14
- package/dist/task.d.ts +78 -0
- package/dist/task.js +131 -0
- package/dist/workflow.d.ts +6 -0
- package/package.json +1 -1
- package/src/client.ts +4 -4
- package/src/config.ts +3 -0
- package/src/email.ts +53 -0
- package/src/git.ts +171 -0
- package/src/index.ts +3 -0
- package/src/pixel.ts +4 -2
- package/src/queue.ts +110 -0
- package/src/services.ts +57 -15
- package/src/task.ts +198 -0
- package/src/workflow.ts +7 -1
package/dist/client.js
CHANGED
|
@@ -64,16 +64,16 @@ async function request(method, url, apiKey, body, extraHeaders) {
|
|
|
64
64
|
const err = result?.error;
|
|
65
65
|
const code = typeof err === 'object' ? (err?.code || 'unknown_error') : (err || 'unknown_error');
|
|
66
66
|
const detail = typeof err === 'object' ? (err?.message || undefined) : undefined;
|
|
67
|
-
const
|
|
68
|
-
throw new MyApiError(code, response.status, detail,
|
|
67
|
+
const errBody = typeof err === 'object' ? err : undefined;
|
|
68
|
+
throw new MyApiError(code, response.status, detail, errBody);
|
|
69
69
|
}
|
|
70
70
|
const apiResponse = result;
|
|
71
71
|
if (!apiResponse.success) {
|
|
72
72
|
const err = apiResponse.error;
|
|
73
73
|
const code = typeof err === 'object' ? (err?.code || 'unknown_error') : (err || 'unknown_error');
|
|
74
74
|
const detail = typeof err === 'object' ? (err?.message || undefined) : undefined;
|
|
75
|
-
const
|
|
76
|
-
throw new MyApiError(code, response.status, detail,
|
|
75
|
+
const errBody = typeof err === 'object' ? err : undefined;
|
|
76
|
+
throw new MyApiError(code, response.status, detail, errBody);
|
|
77
77
|
}
|
|
78
78
|
return apiResponse.data;
|
|
79
79
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const FUNNEL_BASE: string;
|
|
|
4
4
|
export declare const FUNCTION_BASE: string;
|
|
5
5
|
export declare const PAYMENTS_BASE: string;
|
|
6
6
|
export declare const CONTAINER_BASE: string;
|
|
7
|
+
export declare const GIT_BASE: string;
|
|
8
|
+
export declare const QUEUE_BASE: string;
|
|
9
|
+
export declare const TASK_BASE: string;
|
|
7
10
|
export declare const IMAGE_BASE: string;
|
|
8
11
|
export declare const WEBHOOK_BASE: string;
|
|
9
12
|
export declare const WORKFLOW_BASE: string;
|
package/dist/config.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// local dev — `source scripts/local-env.sh` still points everything at
|
|
9
9
|
// localhost:8080 regardless of the prod default.
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.CRM_BASE = exports.DATABASE_BASE = exports.LLM_BASE = exports.AUDIENCE_BASE = exports.COMPANY_BASE = exports.PEOPLE_BASE = exports.PIXEL_BASE = exports.URL_BASE = exports.STORAGE_BASE = exports.EMAIL_BASE = exports.WORKFLOW_BASE = exports.WEBHOOK_BASE = exports.IMAGE_BASE = exports.CONTAINER_BASE = exports.PAYMENTS_BASE = exports.FUNCTION_BASE = exports.FUNNEL_BASE = exports.DOMAIN_BASE = exports.HQ_BASE = void 0;
|
|
11
|
+
exports.CRM_BASE = exports.DATABASE_BASE = exports.LLM_BASE = exports.AUDIENCE_BASE = exports.COMPANY_BASE = exports.PEOPLE_BASE = exports.PIXEL_BASE = exports.URL_BASE = exports.STORAGE_BASE = exports.EMAIL_BASE = exports.WORKFLOW_BASE = exports.WEBHOOK_BASE = exports.IMAGE_BASE = exports.TASK_BASE = exports.QUEUE_BASE = exports.GIT_BASE = exports.CONTAINER_BASE = exports.PAYMENTS_BASE = exports.FUNCTION_BASE = exports.FUNNEL_BASE = exports.DOMAIN_BASE = exports.HQ_BASE = void 0;
|
|
12
12
|
const GATEWAY = 'https://api.myapihq.com';
|
|
13
13
|
exports.HQ_BASE = process.env.MYAPI_HQ_URL ?? process.env.MYAPI_API_BASE ?? GATEWAY;
|
|
14
14
|
exports.DOMAIN_BASE = process.env.MYAPI_DOMAIN_URL ?? 'https://api.mydomainapi.com';
|
|
@@ -18,6 +18,9 @@ exports.FUNNEL_BASE = process.env.MYAPI_FUNNEL_URL ?? 'https://api.myfunnelapi.c
|
|
|
18
18
|
exports.FUNCTION_BASE = process.env.MYAPI_FUNCTION_URL ?? GATEWAY;
|
|
19
19
|
exports.PAYMENTS_BASE = process.env.MYAPI_PAYMENTS_URL ?? GATEWAY;
|
|
20
20
|
exports.CONTAINER_BASE = process.env.MYAPI_CONTAINER_URL ?? GATEWAY;
|
|
21
|
+
exports.GIT_BASE = process.env.MYAPI_GIT_URL ?? GATEWAY;
|
|
22
|
+
exports.QUEUE_BASE = process.env.MYAPI_QUEUE_URL ?? GATEWAY;
|
|
23
|
+
exports.TASK_BASE = process.env.MYAPI_TASK_URL ?? GATEWAY;
|
|
21
24
|
exports.IMAGE_BASE = process.env.MYAPI_IMAGE_URL ?? 'https://api.myimageapi.com';
|
|
22
25
|
exports.WEBHOOK_BASE = process.env.MYAPI_WEBHOOK_URL ?? 'https://api.mywebhookapi.com';
|
|
23
26
|
exports.WORKFLOW_BASE = process.env.MYAPI_WORKFLOW_URL ?? 'https://api.myworkflowapi.com';
|
package/dist/email.d.ts
CHANGED
|
@@ -80,6 +80,28 @@ export interface VerifyResult {
|
|
|
80
80
|
elapsed_ms: number;
|
|
81
81
|
}
|
|
82
82
|
export declare function verifyEmail(apiKey: string, orgId: string, email: string): Promise<VerifyResult>;
|
|
83
|
+
export interface BulkVerifyResult {
|
|
84
|
+
email: string;
|
|
85
|
+
verdict: string;
|
|
86
|
+
confidence: number;
|
|
87
|
+
source: string;
|
|
88
|
+
classification?: string;
|
|
89
|
+
mx?: string;
|
|
90
|
+
rcpt_code?: number;
|
|
91
|
+
catch_all?: boolean;
|
|
92
|
+
detail?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface VerifyJob {
|
|
95
|
+
job_id: string;
|
|
96
|
+
status: string;
|
|
97
|
+
total: number;
|
|
98
|
+
completed?: number;
|
|
99
|
+
catch_all?: boolean;
|
|
100
|
+
results?: BulkVerifyResult[];
|
|
101
|
+
error?: string;
|
|
102
|
+
}
|
|
103
|
+
export declare function verifyBulk(apiKey: string, orgId: string, emails: string[], catchAll?: boolean): Promise<VerifyJob>;
|
|
104
|
+
export declare function getVerifyJob(apiKey: string, orgId: string, jobId: string): Promise<VerifyJob>;
|
|
83
105
|
export declare function createMailbox(apiKey: string, domain: string, username: string, displayName?: string): Promise<{
|
|
84
106
|
address: string;
|
|
85
107
|
created_at: string;
|
|
@@ -96,6 +118,11 @@ export declare function activateSending(apiKey: string, address: string): Promis
|
|
|
96
118
|
sending_enabled: boolean;
|
|
97
119
|
emails_quota_remaining: number;
|
|
98
120
|
}>;
|
|
121
|
+
export declare function setForwarding(apiKey: string, address: string, forwardTo: string): Promise<{
|
|
122
|
+
address: string;
|
|
123
|
+
forward_to: string;
|
|
124
|
+
}>;
|
|
125
|
+
export declare function deleteForwarding(apiKey: string, address: string): Promise<void>;
|
|
99
126
|
export declare function sendEmail(apiKey: string, payload: {
|
|
100
127
|
from: string;
|
|
101
128
|
to: string[];
|
package/dist/email.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EXPOSES = void 0;
|
|
4
4
|
exports.verifyEmail = verifyEmail;
|
|
5
|
+
exports.verifyBulk = verifyBulk;
|
|
6
|
+
exports.getVerifyJob = getVerifyJob;
|
|
5
7
|
exports.createMailbox = createMailbox;
|
|
6
8
|
exports.listMailboxes = listMailboxes;
|
|
7
9
|
exports.activateSending = activateSending;
|
|
10
|
+
exports.setForwarding = setForwarding;
|
|
11
|
+
exports.deleteForwarding = deleteForwarding;
|
|
8
12
|
exports.sendEmail = sendEmail;
|
|
9
13
|
exports.getEmailStatus = getEmailStatus;
|
|
10
14
|
exports.getSentEmails = getSentEmails;
|
|
@@ -41,6 +45,8 @@ exports.EXPOSES = [
|
|
|
41
45
|
// Mailbox / sending activation
|
|
42
46
|
'POST /email/mailboxes/create',
|
|
43
47
|
'GET /email/mailboxes',
|
|
48
|
+
'PUT /email/mailboxes/{address}/forwarding',
|
|
49
|
+
'DELETE /email/mailboxes/{address}/forwarding',
|
|
44
50
|
'POST /email/sending/activate',
|
|
45
51
|
// Send + read
|
|
46
52
|
'POST /email/send',
|
|
@@ -78,10 +84,25 @@ exports.EXPOSES = [
|
|
|
78
84
|
'GET /email/orgs/{org_id}/campaigns/{campaign_id}/stats',
|
|
79
85
|
// Verify
|
|
80
86
|
'POST /email/orgs/{org_id}/verify',
|
|
87
|
+
'POST /email/orgs/{org_id}/verify-bulk',
|
|
88
|
+
'GET /email/orgs/{org_id}/verify-jobs/{id}',
|
|
81
89
|
];
|
|
82
90
|
async function verifyEmail(apiKey, orgId, email) {
|
|
83
91
|
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/verify`, apiKey, { email });
|
|
84
92
|
}
|
|
93
|
+
// verifyBulk kicks off an asynchronous bulk verification (1-500 addresses)
|
|
94
|
+
// and returns immediately with a job_id. `catchAll` toggles the catch-all
|
|
95
|
+
// check on SMTP-probed addresses (default true). Poll getVerifyJob for
|
|
96
|
+
// status + results.
|
|
97
|
+
async function verifyBulk(apiKey, orgId, emails, catchAll) {
|
|
98
|
+
const body = { emails };
|
|
99
|
+
if (catchAll !== undefined)
|
|
100
|
+
body.catch_all = catchAll;
|
|
101
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/verify-bulk`, apiKey, body);
|
|
102
|
+
}
|
|
103
|
+
async function getVerifyJob(apiKey, orgId, jobId) {
|
|
104
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/verify-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
105
|
+
}
|
|
85
106
|
// ── Mailbox ops (account-scoped) ─────────────────────────────────────────────
|
|
86
107
|
async function createMailbox(apiKey, domain, username, displayName) {
|
|
87
108
|
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/mailboxes/create`, apiKey, { domain, username, display_name: displayName });
|
|
@@ -98,6 +119,16 @@ async function listMailboxes(apiKey, options) {
|
|
|
98
119
|
async function activateSending(apiKey, address) {
|
|
99
120
|
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/sending/activate`, apiKey, { address });
|
|
100
121
|
}
|
|
122
|
+
// setForwarding redirects a copy of every incoming message to an external
|
|
123
|
+
// address (server-side; the original is kept in the mailbox). `forwardTo`
|
|
124
|
+
// must be a valid address and cannot equal the mailbox itself.
|
|
125
|
+
async function setForwarding(apiKey, address, forwardTo) {
|
|
126
|
+
return (0, client_1.request)('PUT', `${config_1.EMAIL_BASE}/email/mailboxes/${encodeURIComponent(address)}/forwarding`, apiKey, { forward_to: forwardTo });
|
|
127
|
+
}
|
|
128
|
+
// deleteForwarding stops forwarding for a mailbox.
|
|
129
|
+
async function deleteForwarding(apiKey, address) {
|
|
130
|
+
return (0, client_1.request)('DELETE', `${config_1.EMAIL_BASE}/email/mailboxes/${encodeURIComponent(address)}/forwarding`, apiKey);
|
|
131
|
+
}
|
|
101
132
|
// ── Sending and reading (account-scoped) ─────────────────────────────────────
|
|
102
133
|
async function sendEmail(apiKey, payload) {
|
|
103
134
|
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/send`, apiKey, payload);
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Exposes } from './exposes';
|
|
2
|
+
export declare const EXPOSES: Exposes;
|
|
3
|
+
export interface RepoSummary {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Repo {
|
|
7
|
+
name: string;
|
|
8
|
+
default_branch: string;
|
|
9
|
+
branches: number;
|
|
10
|
+
tags: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RefInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
sha: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Refs {
|
|
17
|
+
head: string;
|
|
18
|
+
branches: RefInfo[];
|
|
19
|
+
tags: RefInfo[];
|
|
20
|
+
}
|
|
21
|
+
export interface TreeEntry {
|
|
22
|
+
name: string;
|
|
23
|
+
path: string;
|
|
24
|
+
type: 'file' | 'dir';
|
|
25
|
+
mode: string;
|
|
26
|
+
sha: string;
|
|
27
|
+
size: number;
|
|
28
|
+
}
|
|
29
|
+
export interface CommitInfo {
|
|
30
|
+
sha: string;
|
|
31
|
+
message: string;
|
|
32
|
+
author: string;
|
|
33
|
+
email: string;
|
|
34
|
+
when: string;
|
|
35
|
+
parents: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface CommitResult {
|
|
38
|
+
sha: string;
|
|
39
|
+
tree: string;
|
|
40
|
+
branch: string;
|
|
41
|
+
}
|
|
42
|
+
export interface RepackResult {
|
|
43
|
+
packs_before: number;
|
|
44
|
+
packs_after: number;
|
|
45
|
+
objects: number;
|
|
46
|
+
}
|
|
47
|
+
export interface Blob {
|
|
48
|
+
path: string;
|
|
49
|
+
size: number;
|
|
50
|
+
content_base64: string;
|
|
51
|
+
}
|
|
52
|
+
export interface FileChange {
|
|
53
|
+
path: string;
|
|
54
|
+
content?: string;
|
|
55
|
+
content_base64?: string;
|
|
56
|
+
delete?: boolean;
|
|
57
|
+
mode?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CommitPayload {
|
|
60
|
+
branch: string;
|
|
61
|
+
base?: string;
|
|
62
|
+
message: string;
|
|
63
|
+
author?: {
|
|
64
|
+
name: string;
|
|
65
|
+
email: string;
|
|
66
|
+
};
|
|
67
|
+
changes: FileChange[];
|
|
68
|
+
}
|
|
69
|
+
export declare function createRepo(apiKey: string, orgId: string, name: string, defaultBranch?: string): Promise<{
|
|
70
|
+
name: string;
|
|
71
|
+
default_branch: string;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function listRepos(apiKey: string, orgId: string): Promise<RepoSummary[]>;
|
|
74
|
+
export declare function getRepo(apiKey: string, orgId: string, repo: string): Promise<Repo>;
|
|
75
|
+
export declare function deleteRepo(apiKey: string, orgId: string, repo: string): Promise<void>;
|
|
76
|
+
export declare function listRefs(apiKey: string, orgId: string, repo: string): Promise<Refs>;
|
|
77
|
+
export declare function listCommits(apiKey: string, orgId: string, repo: string, opts?: {
|
|
78
|
+
ref?: string;
|
|
79
|
+
limit?: number;
|
|
80
|
+
}): Promise<CommitInfo[]>;
|
|
81
|
+
export declare function getCommit(apiKey: string, orgId: string, repo: string, sha: string): Promise<CommitInfo>;
|
|
82
|
+
export declare function getDiff(apiKey: string, orgId: string, repo: string, base: string, head: string): Promise<string>;
|
|
83
|
+
export declare function listTree(apiKey: string, orgId: string, repo: string, ref: string, path?: string): Promise<TreeEntry[]>;
|
|
84
|
+
export declare function readBlob(apiKey: string, orgId: string, repo: string, ref: string, path: string): Promise<Blob>;
|
|
85
|
+
export declare function commit(apiKey: string, orgId: string, repo: string, payload: CommitPayload): Promise<CommitResult>;
|
|
86
|
+
export declare function createBranch(apiKey: string, orgId: string, repo: string, name: string, from: string): Promise<{
|
|
87
|
+
name: string;
|
|
88
|
+
}>;
|
|
89
|
+
export declare function deleteBranch(apiKey: string, orgId: string, repo: string, branch: string): Promise<void>;
|
|
90
|
+
export declare function createTag(apiKey: string, orgId: string, repo: string, name: string, ref: string): Promise<{
|
|
91
|
+
name: string;
|
|
92
|
+
}>;
|
|
93
|
+
export declare function merge(apiKey: string, orgId: string, repo: string, target: string, source: string): Promise<{
|
|
94
|
+
sha: string;
|
|
95
|
+
}>;
|
|
96
|
+
export declare function repack(apiKey: string, orgId: string, repo: string): Promise<RepackResult>;
|
package/dist/git.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPOSES = void 0;
|
|
4
|
+
exports.createRepo = createRepo;
|
|
5
|
+
exports.listRepos = listRepos;
|
|
6
|
+
exports.getRepo = getRepo;
|
|
7
|
+
exports.deleteRepo = deleteRepo;
|
|
8
|
+
exports.listRefs = listRefs;
|
|
9
|
+
exports.listCommits = listCommits;
|
|
10
|
+
exports.getCommit = getCommit;
|
|
11
|
+
exports.getDiff = getDiff;
|
|
12
|
+
exports.listTree = listTree;
|
|
13
|
+
exports.readBlob = readBlob;
|
|
14
|
+
exports.commit = commit;
|
|
15
|
+
exports.createBranch = createBranch;
|
|
16
|
+
exports.deleteBranch = deleteBranch;
|
|
17
|
+
exports.createTag = createTag;
|
|
18
|
+
exports.merge = merge;
|
|
19
|
+
exports.repack = repack;
|
|
20
|
+
const client_1 = require("./client");
|
|
21
|
+
const config_1 = require("./config");
|
|
22
|
+
// Backend: my-git-api per myapi-hq/internal/routes/git/. A stateless
|
|
23
|
+
// git-over-HTTP surface — repositories, refs, commits, and history served
|
|
24
|
+
// by a go-git engine (objects in GCS packfiles, refs in Postgres).
|
|
25
|
+
exports.EXPOSES = [
|
|
26
|
+
'POST /git/orgs/{org_id}/repos',
|
|
27
|
+
'GET /git/orgs/{org_id}/repos',
|
|
28
|
+
'GET /git/orgs/{org_id}/repos/{repo}',
|
|
29
|
+
'DELETE /git/orgs/{org_id}/repos/{repo}',
|
|
30
|
+
'GET /git/orgs/{org_id}/repos/{repo}/refs',
|
|
31
|
+
'GET /git/orgs/{org_id}/repos/{repo}/tree/{ref}',
|
|
32
|
+
'GET /git/orgs/{org_id}/repos/{repo}/blob/{ref}/{path}',
|
|
33
|
+
'GET /git/orgs/{org_id}/repos/{repo}/commits',
|
|
34
|
+
'GET /git/orgs/{org_id}/repos/{repo}/commits/{sha}',
|
|
35
|
+
'GET /git/orgs/{org_id}/repos/{repo}/diff',
|
|
36
|
+
'POST /git/orgs/{org_id}/repos/{repo}/commits',
|
|
37
|
+
'POST /git/orgs/{org_id}/repos/{repo}/branches',
|
|
38
|
+
'DELETE /git/orgs/{org_id}/repos/{repo}/branches/{branch}',
|
|
39
|
+
'POST /git/orgs/{org_id}/repos/{repo}/tags',
|
|
40
|
+
'POST /git/orgs/{org_id}/repos/{repo}/merges',
|
|
41
|
+
'POST /git/orgs/{org_id}/repos/{repo}/repack',
|
|
42
|
+
];
|
|
43
|
+
function repoBase(orgId, repo) {
|
|
44
|
+
return `${config_1.GIT_BASE}/git/orgs/${encodeURIComponent(orgId)}/repos/${encodeURIComponent(repo)}`;
|
|
45
|
+
}
|
|
46
|
+
// ── Repos ────────────────────────────────────────────────────────────────────
|
|
47
|
+
async function createRepo(apiKey, orgId, name, defaultBranch) {
|
|
48
|
+
const body = { name };
|
|
49
|
+
if (defaultBranch)
|
|
50
|
+
body.default_branch = defaultBranch;
|
|
51
|
+
return (0, client_1.request)('POST', `${config_1.GIT_BASE}/git/orgs/${encodeURIComponent(orgId)}/repos`, apiKey, body);
|
|
52
|
+
}
|
|
53
|
+
async function listRepos(apiKey, orgId) {
|
|
54
|
+
const res = await (0, client_1.request)('GET', `${config_1.GIT_BASE}/git/orgs/${encodeURIComponent(orgId)}/repos`, apiKey);
|
|
55
|
+
return res?.repos ?? [];
|
|
56
|
+
}
|
|
57
|
+
async function getRepo(apiKey, orgId, repo) {
|
|
58
|
+
return (0, client_1.request)('GET', repoBase(orgId, repo), apiKey);
|
|
59
|
+
}
|
|
60
|
+
async function deleteRepo(apiKey, orgId, repo) {
|
|
61
|
+
return (0, client_1.request)('DELETE', repoBase(orgId, repo), apiKey);
|
|
62
|
+
}
|
|
63
|
+
// ── Refs / history ───────────────────────────────────────────────────────────
|
|
64
|
+
async function listRefs(apiKey, orgId, repo) {
|
|
65
|
+
return (0, client_1.request)('GET', `${repoBase(orgId, repo)}/refs`, apiKey);
|
|
66
|
+
}
|
|
67
|
+
// listCommits walks history from `ref` (default HEAD); `limit` is 1-500.
|
|
68
|
+
async function listCommits(apiKey, orgId, repo, opts = {}) {
|
|
69
|
+
const q = new URLSearchParams();
|
|
70
|
+
if (opts.ref)
|
|
71
|
+
q.set('ref', opts.ref);
|
|
72
|
+
if (opts.limit !== undefined)
|
|
73
|
+
q.set('limit', String(opts.limit));
|
|
74
|
+
const qs = q.toString();
|
|
75
|
+
const res = await (0, client_1.request)('GET', `${repoBase(orgId, repo)}/commits${qs ? `?${qs}` : ''}`, apiKey);
|
|
76
|
+
return res?.commits ?? [];
|
|
77
|
+
}
|
|
78
|
+
async function getCommit(apiKey, orgId, repo, sha) {
|
|
79
|
+
return (0, client_1.request)('GET', `${repoBase(orgId, repo)}/commits/${encodeURIComponent(sha)}`, apiKey);
|
|
80
|
+
}
|
|
81
|
+
// getDiff returns the unified diff text between two refs.
|
|
82
|
+
async function getDiff(apiKey, orgId, repo, base, head) {
|
|
83
|
+
const q = new URLSearchParams({ base, head });
|
|
84
|
+
const res = await (0, client_1.request)('GET', `${repoBase(orgId, repo)}/diff?${q}`, apiKey);
|
|
85
|
+
return res?.diff ?? '';
|
|
86
|
+
}
|
|
87
|
+
// listTree lists a ref's tree; `path` scopes it to a subdirectory.
|
|
88
|
+
async function listTree(apiKey, orgId, repo, ref, path) {
|
|
89
|
+
const qs = path ? `?path=${encodeURIComponent(path)}` : '';
|
|
90
|
+
const res = await (0, client_1.request)('GET', `${repoBase(orgId, repo)}/tree/${encodeURIComponent(ref)}${qs}`, apiKey);
|
|
91
|
+
return res?.entries ?? [];
|
|
92
|
+
}
|
|
93
|
+
// readBlob returns a file's content (base64-encoded — safe for binary).
|
|
94
|
+
async function readBlob(apiKey, orgId, repo, ref, path) {
|
|
95
|
+
// The backend route is /blob/{ref}/{path...} — a catch-all — so slashes
|
|
96
|
+
// in the path must survive; encode each segment, not the separators.
|
|
97
|
+
const encPath = path.split('/').map(encodeURIComponent).join('/');
|
|
98
|
+
return (0, client_1.request)('GET', `${repoBase(orgId, repo)}/blob/${encodeURIComponent(ref)}/${encPath}`, apiKey);
|
|
99
|
+
}
|
|
100
|
+
// ── Writes ───────────────────────────────────────────────────────────────────
|
|
101
|
+
// commit applies all `changes` atomically onto `branch`.
|
|
102
|
+
async function commit(apiKey, orgId, repo, payload) {
|
|
103
|
+
return (0, client_1.request)('POST', `${repoBase(orgId, repo)}/commits`, apiKey, payload);
|
|
104
|
+
}
|
|
105
|
+
async function createBranch(apiKey, orgId, repo, name, from) {
|
|
106
|
+
return (0, client_1.request)('POST', `${repoBase(orgId, repo)}/branches`, apiKey, { name, from });
|
|
107
|
+
}
|
|
108
|
+
async function deleteBranch(apiKey, orgId, repo, branch) {
|
|
109
|
+
return (0, client_1.request)('DELETE', `${repoBase(orgId, repo)}/branches/${encodeURIComponent(branch)}`, apiKey);
|
|
110
|
+
}
|
|
111
|
+
async function createTag(apiKey, orgId, repo, name, ref) {
|
|
112
|
+
return (0, client_1.request)('POST', `${repoBase(orgId, repo)}/tags`, apiKey, { name, ref });
|
|
113
|
+
}
|
|
114
|
+
// merge fast-forwards `target` to `source` (fast-forward only).
|
|
115
|
+
async function merge(apiKey, orgId, repo, target, source) {
|
|
116
|
+
return (0, client_1.request)('POST', `${repoBase(orgId, repo)}/merges`, apiKey, { target, source });
|
|
117
|
+
}
|
|
118
|
+
// repack compacts the repository's incremental packfiles into one.
|
|
119
|
+
async function repack(apiKey, orgId, repo) {
|
|
120
|
+
return (0, client_1.request)('POST', `${repoBase(orgId, repo)}/repack`, apiKey);
|
|
121
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.container = exports.payments = exports.fn = exports.crm = exports.database = exports.llm = exports.audience = exports.company = exports.people = exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
39
|
+
exports.task = exports.queue = exports.git = exports.container = exports.payments = exports.fn = exports.crm = exports.database = exports.llm = exports.audience = exports.company = exports.people = exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
40
40
|
__exportStar(require("./types"), exports);
|
|
41
41
|
__exportStar(require("./client"), exports);
|
|
42
42
|
// Note: config constants (STORAGE_BASE etc.) are NOT re-exported from the
|
|
@@ -64,3 +64,6 @@ exports.crm = __importStar(require("./crm"));
|
|
|
64
64
|
exports.fn = __importStar(require("./function"));
|
|
65
65
|
exports.payments = __importStar(require("./payments"));
|
|
66
66
|
exports.container = __importStar(require("./container"));
|
|
67
|
+
exports.git = __importStar(require("./git"));
|
|
68
|
+
exports.queue = __importStar(require("./queue"));
|
|
69
|
+
exports.task = __importStar(require("./task"));
|
package/dist/pixel.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
|
56
56
|
limit: number;
|
|
57
57
|
offset: number;
|
|
58
58
|
}>;
|
|
59
|
-
export declare function getIdentity(apiKey: string, orgId: string, pixelId: string): Promise<{
|
|
59
|
+
export declare function getIdentity(apiKey: string, orgId: string, pixelId: string, website: string): Promise<{
|
|
60
60
|
uuid: string;
|
|
61
61
|
is_resolved: boolean;
|
|
62
62
|
nodes: Record<string, {
|
package/dist/pixel.js
CHANGED
|
@@ -48,8 +48,10 @@ async function getEvents(apiKey, orgId, params) {
|
|
|
48
48
|
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
49
49
|
return (0, client_1.request)('GET', url, apiKey);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
// getIdentity resolves a pixel's identity graph. `website` is required —
|
|
52
|
+
// the backend scopes the lookup to a domain the org owns.
|
|
53
|
+
async function getIdentity(apiKey, orgId, pixelId, website) {
|
|
54
|
+
return (0, client_1.request)('GET', `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}?website=${encodeURIComponent(website)}`, apiKey);
|
|
53
55
|
}
|
|
54
56
|
// Sample of geographic distribution of the org's pixel audience. Backend
|
|
55
57
|
// returns whatever shape it wants; we type as record-of-unknowns and let
|
package/dist/queue.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Exposes } from './exposes';
|
|
2
|
+
export declare const EXPOSES: Exposes;
|
|
3
|
+
export interface Queue {
|
|
4
|
+
id: string;
|
|
5
|
+
org_id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
consumer_url: string;
|
|
8
|
+
max_attempts: number;
|
|
9
|
+
max_concurrency: number;
|
|
10
|
+
created_at: string;
|
|
11
|
+
}
|
|
12
|
+
export type JobStatus = 'pending' | 'blocked' | 'running' | 'succeeded' | 'dead';
|
|
13
|
+
export interface Job {
|
|
14
|
+
id: string;
|
|
15
|
+
queue_id: string;
|
|
16
|
+
org_id: string;
|
|
17
|
+
payload: unknown;
|
|
18
|
+
status: JobStatus;
|
|
19
|
+
attempt: number;
|
|
20
|
+
max_attempts: number;
|
|
21
|
+
not_before: string;
|
|
22
|
+
depends_on: string[];
|
|
23
|
+
dedup_key?: string;
|
|
24
|
+
last_error?: string;
|
|
25
|
+
started_at?: string;
|
|
26
|
+
created_at: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateQueueOptions {
|
|
30
|
+
name: string;
|
|
31
|
+
consumerUrl: string;
|
|
32
|
+
maxAttempts?: number;
|
|
33
|
+
maxConcurrency?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface EnqueueOptions {
|
|
36
|
+
payload?: unknown;
|
|
37
|
+
dedupKey?: string;
|
|
38
|
+
delaySeconds?: number;
|
|
39
|
+
dependsOn?: string[];
|
|
40
|
+
}
|
|
41
|
+
export declare function createQueue(apiKey: string, orgId: string, opts: CreateQueueOptions): Promise<Queue>;
|
|
42
|
+
export declare function listQueues(apiKey: string, orgId: string): Promise<Queue[]>;
|
|
43
|
+
export declare function getQueue(apiKey: string, orgId: string, name: string): Promise<Queue>;
|
|
44
|
+
export declare function enqueueJob(apiKey: string, orgId: string, name: string, opts?: EnqueueOptions): Promise<Job>;
|
|
45
|
+
export declare function listJobs(apiKey: string, orgId: string, name: string, opts?: {
|
|
46
|
+
status?: string;
|
|
47
|
+
limit?: number;
|
|
48
|
+
}): Promise<Job[]>;
|
|
49
|
+
export declare function getJob(apiKey: string, orgId: string, jobId: string): Promise<Job>;
|
package/dist/queue.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPOSES = void 0;
|
|
4
|
+
exports.createQueue = createQueue;
|
|
5
|
+
exports.listQueues = listQueues;
|
|
6
|
+
exports.getQueue = getQueue;
|
|
7
|
+
exports.enqueueJob = enqueueJob;
|
|
8
|
+
exports.listJobs = listJobs;
|
|
9
|
+
exports.getJob = getJob;
|
|
10
|
+
const client_1 = require("./client");
|
|
11
|
+
const config_1 = require("./config");
|
|
12
|
+
// Backend: my-queue-api per myapi-hq/internal/routes/queue/. A durable
|
|
13
|
+
// HTTP-consumer job queue — each named queue POSTs its jobs to a configured
|
|
14
|
+
// consumer_url, with retry/backoff to max_attempts, a concurrency cap, and a
|
|
15
|
+
// dependency DAG (a job with unsucceeded depends_on starts blocked).
|
|
16
|
+
exports.EXPOSES = [
|
|
17
|
+
'POST /queue/orgs/{org_id}/queues',
|
|
18
|
+
'GET /queue/orgs/{org_id}/queues',
|
|
19
|
+
'GET /queue/orgs/{org_id}/queues/{name}',
|
|
20
|
+
'POST /queue/orgs/{org_id}/queues/{name}/jobs',
|
|
21
|
+
'GET /queue/orgs/{org_id}/queues/{name}/jobs',
|
|
22
|
+
'GET /queue/orgs/{org_id}/jobs/{id}',
|
|
23
|
+
];
|
|
24
|
+
function queuesBase(orgId) {
|
|
25
|
+
return `${config_1.QUEUE_BASE}/queue/orgs/${encodeURIComponent(orgId)}/queues`;
|
|
26
|
+
}
|
|
27
|
+
// createQueue registers a named queue with its retry + concurrency policy
|
|
28
|
+
// and the HTTP consumer that runs its jobs.
|
|
29
|
+
async function createQueue(apiKey, orgId, opts) {
|
|
30
|
+
const body = { name: opts.name, consumer_url: opts.consumerUrl };
|
|
31
|
+
if (opts.maxAttempts !== undefined)
|
|
32
|
+
body.max_attempts = opts.maxAttempts;
|
|
33
|
+
if (opts.maxConcurrency !== undefined)
|
|
34
|
+
body.max_concurrency = opts.maxConcurrency;
|
|
35
|
+
return (0, client_1.request)('POST', queuesBase(orgId), apiKey, body);
|
|
36
|
+
}
|
|
37
|
+
async function listQueues(apiKey, orgId) {
|
|
38
|
+
const res = await (0, client_1.request)('GET', queuesBase(orgId), apiKey);
|
|
39
|
+
return res?.queues ?? [];
|
|
40
|
+
}
|
|
41
|
+
async function getQueue(apiKey, orgId, name) {
|
|
42
|
+
return (0, client_1.request)('GET', `${queuesBase(orgId)}/${encodeURIComponent(name)}`, apiKey);
|
|
43
|
+
}
|
|
44
|
+
// enqueueJob is idempotent on (queue, dedup_key). A job with unsucceeded
|
|
45
|
+
// depends_on starts blocked.
|
|
46
|
+
async function enqueueJob(apiKey, orgId, name, opts = {}) {
|
|
47
|
+
const body = {};
|
|
48
|
+
if (opts.payload !== undefined)
|
|
49
|
+
body.payload = opts.payload;
|
|
50
|
+
if (opts.dedupKey !== undefined)
|
|
51
|
+
body.dedup_key = opts.dedupKey;
|
|
52
|
+
if (opts.delaySeconds !== undefined)
|
|
53
|
+
body.delay_seconds = opts.delaySeconds;
|
|
54
|
+
if (opts.dependsOn !== undefined)
|
|
55
|
+
body.depends_on = opts.dependsOn;
|
|
56
|
+
return (0, client_1.request)('POST', `${queuesBase(orgId)}/${encodeURIComponent(name)}/jobs`, apiKey, body);
|
|
57
|
+
}
|
|
58
|
+
// listJobs lists a queue's jobs, newest first. `limit` is 1-200.
|
|
59
|
+
async function listJobs(apiKey, orgId, name, opts = {}) {
|
|
60
|
+
const q = new URLSearchParams();
|
|
61
|
+
if (opts.status)
|
|
62
|
+
q.set('status', opts.status);
|
|
63
|
+
if (opts.limit !== undefined)
|
|
64
|
+
q.set('limit', String(opts.limit));
|
|
65
|
+
const qs = q.toString();
|
|
66
|
+
const res = await (0, client_1.request)('GET', `${queuesBase(orgId)}/${encodeURIComponent(name)}/jobs${qs ? `?${qs}` : ''}`, apiKey);
|
|
67
|
+
return res?.jobs ?? [];
|
|
68
|
+
}
|
|
69
|
+
async function getJob(apiKey, orgId, jobId) {
|
|
70
|
+
return (0, client_1.request)('GET', `${config_1.QUEUE_BASE}/queue/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
71
|
+
}
|
package/dist/services.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ServiceStatus = 'ga' | 'preview' | 'planned';
|
|
2
|
-
export type ServiceCategory = 'send' | 'capture' | 'data' | 'store' | 'compute' | 'identity' | 'infra';
|
|
2
|
+
export type ServiceCategory = 'send' | 'capture' | 'data' | 'store' | 'compute' | 'orchestrate' | 'identity' | 'infra';
|
|
3
3
|
export interface ServiceMeta {
|
|
4
4
|
/** SDK namespace (also OpenAPI tag and CLI top-level command). */
|
|
5
5
|
module: string;
|
package/dist/services.js
CHANGED
|
@@ -39,16 +39,16 @@ exports.SERVICES = [
|
|
|
39
39
|
},
|
|
40
40
|
// ── send ────────────────────────────────────────────────────────────
|
|
41
41
|
{
|
|
42
|
-
// Customer-facing email surface
|
|
43
|
-
// warmup
|
|
44
|
-
//
|
|
45
|
-
//
|
|
42
|
+
// Customer-facing email surface — mailboxes, campaigns, templates,
|
|
43
|
+
// warmup. Launched 2026-05-17: the backend lifted the pre-launch gate
|
|
44
|
+
// (the [disabled, pre-launch] / 503 SERVICE_NOT_LAUNCHED state is gone).
|
|
45
|
+
// Sibling `my-email-verify-api` is the sync single-address verifier.
|
|
46
46
|
module: 'email',
|
|
47
47
|
skill: 'my-email-api',
|
|
48
48
|
domain: 'myemailapi.com',
|
|
49
49
|
description: 'Send transactional and bulk email from your own domain. Mailboxes, AI templates, drip campaigns, and warmup.',
|
|
50
50
|
category: 'send',
|
|
51
|
-
status: '
|
|
51
|
+
status: 'ga',
|
|
52
52
|
keywords: k('email', 'transactional', 'campaign', 'smtp'),
|
|
53
53
|
},
|
|
54
54
|
{
|
|
@@ -171,15 +171,6 @@ exports.SERVICES = [
|
|
|
171
171
|
keywords: k('kv-store', 'database', 'state'),
|
|
172
172
|
},
|
|
173
173
|
// ── compute ─────────────────────────────────────────────────────────
|
|
174
|
-
{
|
|
175
|
-
module: 'workflow',
|
|
176
|
-
skill: 'my-workflow-api',
|
|
177
|
-
domain: 'myworkflowapi.com',
|
|
178
|
-
description: 'React to inbound webhooks with step chains: send email, post to Slack, call HTTP URLs.',
|
|
179
|
-
category: 'compute',
|
|
180
|
-
status: 'ga',
|
|
181
|
-
keywords: k('workflow', 'automation', 'orchestration'),
|
|
182
|
-
},
|
|
183
174
|
{
|
|
184
175
|
module: 'llm',
|
|
185
176
|
skill: 'my-llm-api',
|
|
@@ -236,4 +227,53 @@ exports.SERVICES = [
|
|
|
236
227
|
status: 'preview',
|
|
237
228
|
keywords: k('container', 'cloud-run', 'service', 'worker', 'job'),
|
|
238
229
|
},
|
|
230
|
+
{
|
|
231
|
+
// CLI top-level command + SDK namespace are both `git`; skill directory
|
|
232
|
+
// is `my-git-api`. A stateless git-over-HTTP surface (go-git engine;
|
|
233
|
+
// objects in GCS, refs in Postgres) — repos, commits, branches, history.
|
|
234
|
+
module: 'git',
|
|
235
|
+
skill: 'my-git-api',
|
|
236
|
+
domain: 'mygitapi.com',
|
|
237
|
+
description: 'Hosted git repositories over HTTP — create repos, commit files, manage branches and tags, read trees, blobs, history, and diffs. No local clone required.',
|
|
238
|
+
category: 'store',
|
|
239
|
+
status: 'preview',
|
|
240
|
+
keywords: k('git', 'repository', 'version-control', 'commit', 'scm'),
|
|
241
|
+
},
|
|
242
|
+
// ── orchestrate ─────────────────────────────────────────────────────
|
|
243
|
+
// Control flow, not actions. workflow = event→action, queue = durable
|
|
244
|
+
// async machine work, task = work that needs an agent/human decision.
|
|
245
|
+
// See docs/orchestration-decision-guide.md.
|
|
246
|
+
{
|
|
247
|
+
module: 'workflow',
|
|
248
|
+
skill: 'my-workflow-api',
|
|
249
|
+
domain: 'myworkflowapi.com',
|
|
250
|
+
description: 'React to inbound webhooks with step chains: send email, post to Slack, call HTTP URLs.',
|
|
251
|
+
category: 'orchestrate',
|
|
252
|
+
status: 'ga',
|
|
253
|
+
keywords: k('workflow', 'automation', 'orchestration'),
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
// CLI top-level command + SDK namespace are both `queue`; skill
|
|
257
|
+
// directory is `my-queue-api`. A durable HTTP-consumer job queue —
|
|
258
|
+
// retry/backoff, concurrency caps, dependency DAG.
|
|
259
|
+
module: 'queue',
|
|
260
|
+
skill: 'my-queue-api',
|
|
261
|
+
domain: 'myqueueapi.com',
|
|
262
|
+
description: 'Durable job queue — enqueue work and have it retried against your HTTP consumer, with concurrency caps and a dependency DAG.',
|
|
263
|
+
category: 'orchestrate',
|
|
264
|
+
status: 'preview',
|
|
265
|
+
keywords: k('queue', 'job-queue', 'background-jobs', 'retry', 'async'),
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
// CLI top-level command + SDK namespace are both `task`; skill
|
|
269
|
+
// directory is `my-task-api`. The agent-task queue — the agent-loop
|
|
270
|
+
// hot path: file, claim under a lease, resolve.
|
|
271
|
+
module: 'task',
|
|
272
|
+
skill: 'my-task-api',
|
|
273
|
+
domain: 'mytaskapi.com',
|
|
274
|
+
description: 'Agent-task queue — file units of work, rank them, claim under a lease, then resolve, fail, or cancel. The agent-loop hot path.',
|
|
275
|
+
category: 'orchestrate',
|
|
276
|
+
status: 'preview',
|
|
277
|
+
keywords: k('task', 'task-queue', 'agent-loop', 'work-queue', 'lease'),
|
|
278
|
+
},
|
|
239
279
|
];
|