@myapihq/sdk 2.7.2 → 2.9.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/config.d.ts +1 -0
- package/dist/config.js +2 -1
- package/dist/container.d.ts +1 -1
- package/dist/container.js +6 -1
- package/dist/feedback.d.ts +51 -0
- package/dist/feedback.js +56 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/llm.d.ts +20 -2
- package/dist/llm.js +8 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const PAYMENTS_BASE: string;
|
|
|
6
6
|
export declare const CONTAINER_BASE: string;
|
|
7
7
|
export declare const GIT_BASE: string;
|
|
8
8
|
export declare const QUEUE_BASE: string;
|
|
9
|
+
export declare const FEEDBACK_BASE: string;
|
|
9
10
|
export declare const TASK_BASE: string;
|
|
10
11
|
export declare const IMAGE_BASE: string;
|
|
11
12
|
export declare const WEBHOOK_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.AUTH_BASE = 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;
|
|
11
|
+
exports.AUTH_BASE = 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.FEEDBACK_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';
|
|
@@ -20,6 +20,7 @@ exports.PAYMENTS_BASE = process.env.MYAPI_PAYMENTS_URL ?? GATEWAY;
|
|
|
20
20
|
exports.CONTAINER_BASE = process.env.MYAPI_CONTAINER_URL ?? GATEWAY;
|
|
21
21
|
exports.GIT_BASE = process.env.MYAPI_GIT_URL ?? GATEWAY;
|
|
22
22
|
exports.QUEUE_BASE = process.env.MYAPI_QUEUE_URL ?? GATEWAY;
|
|
23
|
+
exports.FEEDBACK_BASE = process.env.MYAPI_FEEDBACK_URL ?? GATEWAY;
|
|
23
24
|
exports.TASK_BASE = process.env.MYAPI_TASK_URL ?? GATEWAY;
|
|
24
25
|
exports.IMAGE_BASE = process.env.MYAPI_IMAGE_URL ?? 'https://api.myimageapi.com';
|
|
25
26
|
exports.WEBHOOK_BASE = process.env.MYAPI_WEBHOOK_URL ?? 'https://api.mywebhookapi.com';
|
package/dist/container.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface BuildDeployResponse {
|
|
|
81
81
|
status: string;
|
|
82
82
|
message?: string;
|
|
83
83
|
}
|
|
84
|
-
export declare function deployContainerSource(apiKey: string, orgId: string, containerId: string, tarball: Blob | Buffer, filename?: string): Promise<BuildDeployResponse>;
|
|
84
|
+
export declare function deployContainerSource(apiKey: string, orgId: string, containerId: string, tarball: Blob | Buffer, filename?: string, opts?: DeployOptions): Promise<BuildDeployResponse>;
|
|
85
85
|
export interface LogEntry {
|
|
86
86
|
timestamp: string;
|
|
87
87
|
severity: string;
|
package/dist/container.js
CHANGED
|
@@ -70,9 +70,14 @@ async function promoteRevision(apiKey, orgId, containerId, revision) {
|
|
|
70
70
|
// (backend deploy.go builds it via Cloud Build → Artifact Registry, then
|
|
71
71
|
// deploys). Asynchronous: returns status='building' to poll. The tarball is
|
|
72
72
|
// capped at 100MB server-side. Mirrors the multipart upload in storage.ts.
|
|
73
|
-
async function deployContainerSource(apiKey, orgId, containerId, tarball, filename = 'source.tar.gz') {
|
|
73
|
+
async function deployContainerSource(apiKey, orgId, containerId, tarball, filename = 'source.tar.gz', opts = {}) {
|
|
74
74
|
const formData = new FormData();
|
|
75
75
|
formData.append('source', new Blob([tarball], { type: 'application/gzip' }), filename);
|
|
76
|
+
// The multipart path takes `promote` too as of 2026-07-28. It did not when
|
|
77
|
+
// --no-promote first shipped, which is exactly why the flag was silently
|
|
78
|
+
// dropped here: the options never reached this function at all.
|
|
79
|
+
if (opts.promote === false)
|
|
80
|
+
formData.append('promote', 'false');
|
|
76
81
|
const response = await fetch(`${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/deploy`, { method: 'POST', headers: { Authorization: `Bearer ${apiKey}` }, body: formData });
|
|
77
82
|
let result;
|
|
78
83
|
try {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Exposes } from './exposes';
|
|
2
|
+
export declare const EXPOSES: Exposes;
|
|
3
|
+
export type FeedbackKind = 'bug' | 'issue' | 'suggestion';
|
|
4
|
+
export type FeedbackStatus = 'open' | 'resolved';
|
|
5
|
+
export interface FeedbackItem {
|
|
6
|
+
id: string;
|
|
7
|
+
org_id: string;
|
|
8
|
+
kind: FeedbackKind;
|
|
9
|
+
body: string;
|
|
10
|
+
status: FeedbackStatus;
|
|
11
|
+
page_url?: string;
|
|
12
|
+
route?: string;
|
|
13
|
+
target_selector?: string;
|
|
14
|
+
target_region?: string;
|
|
15
|
+
viewport?: string;
|
|
16
|
+
created_at: string;
|
|
17
|
+
resolved_at?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FeedbackPage {
|
|
20
|
+
items: FeedbackItem[];
|
|
21
|
+
total: number;
|
|
22
|
+
has_more?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ListFeedbackOptions {
|
|
25
|
+
kind?: FeedbackKind;
|
|
26
|
+
status?: FeedbackStatus;
|
|
27
|
+
limit?: number;
|
|
28
|
+
offset?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface Widget {
|
|
31
|
+
id: string;
|
|
32
|
+
org_id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
key: string;
|
|
35
|
+
allowed_origins?: string[];
|
|
36
|
+
created_at: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function listFeedback(apiKey: string, orgId: string, opts?: ListFeedbackOptions): Promise<FeedbackPage>;
|
|
39
|
+
export interface CreateFeedbackInput {
|
|
40
|
+
kind: FeedbackKind;
|
|
41
|
+
body: string;
|
|
42
|
+
page_url?: string;
|
|
43
|
+
route?: string;
|
|
44
|
+
target_selector?: string;
|
|
45
|
+
target_region?: string;
|
|
46
|
+
viewport?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function createFeedback(apiKey: string, orgId: string, input: CreateFeedbackInput): Promise<FeedbackItem>;
|
|
49
|
+
export declare function resolveFeedback(apiKey: string, orgId: string, id: string): Promise<void>;
|
|
50
|
+
export declare function createWidget(apiKey: string, orgId: string, name: string, allowedOrigins?: string[]): Promise<Widget>;
|
|
51
|
+
export declare function revokeWidget(apiKey: string, orgId: string, id: string): Promise<void>;
|
package/dist/feedback.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPOSES = void 0;
|
|
4
|
+
exports.listFeedback = listFeedback;
|
|
5
|
+
exports.createFeedback = createFeedback;
|
|
6
|
+
exports.resolveFeedback = resolveFeedback;
|
|
7
|
+
exports.createWidget = createWidget;
|
|
8
|
+
exports.revokeWidget = revokeWidget;
|
|
9
|
+
const client_1 = require("./client");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
// End-user feedback collected from a page, and the widget keys that let a
|
|
12
|
+
// page submit it without a credential.
|
|
13
|
+
exports.EXPOSES = [
|
|
14
|
+
'POST /feedback/orgs/{org_id}/widgets',
|
|
15
|
+
'DELETE /feedback/orgs/{org_id}/widgets/{id}',
|
|
16
|
+
'GET /feedback/orgs/{org_id}/items',
|
|
17
|
+
'POST /feedback/orgs/{org_id}/items',
|
|
18
|
+
'POST /feedback/orgs/{org_id}/items/{id}/resolve',
|
|
19
|
+
];
|
|
20
|
+
function orgBase(orgId) {
|
|
21
|
+
return `${config_1.FEEDBACK_BASE}/feedback/orgs/${encodeURIComponent(orgId)}`;
|
|
22
|
+
}
|
|
23
|
+
async function listFeedback(apiKey, orgId, opts = {}) {
|
|
24
|
+
const q = new URLSearchParams();
|
|
25
|
+
if (opts.kind)
|
|
26
|
+
q.set('kind', opts.kind);
|
|
27
|
+
if (opts.status)
|
|
28
|
+
q.set('status', opts.status);
|
|
29
|
+
if (opts.limit !== undefined)
|
|
30
|
+
q.set('limit', String(opts.limit));
|
|
31
|
+
if (opts.offset !== undefined)
|
|
32
|
+
q.set('offset', String(opts.offset));
|
|
33
|
+
const qs = q.toString();
|
|
34
|
+
return (0, client_1.request)('GET', `${orgBase(orgId)}/items${qs ? `?${qs}` : ''}`, apiKey);
|
|
35
|
+
}
|
|
36
|
+
async function createFeedback(apiKey, orgId, input) {
|
|
37
|
+
return (0, client_1.request)('POST', `${orgBase(orgId)}/items`, apiKey, input);
|
|
38
|
+
}
|
|
39
|
+
// Already-resolved and not-found answer identically, so an id cannot be probed
|
|
40
|
+
// across orgs. That means a 'resolved' response is not proof the id was yours.
|
|
41
|
+
async function resolveFeedback(apiKey, orgId, id) {
|
|
42
|
+
return (0, client_1.request)('POST', `${orgBase(orgId)}/items/${encodeURIComponent(id)}/resolve`, apiKey, {});
|
|
43
|
+
}
|
|
44
|
+
// Mints a PUBLIC widget key. It ships in your page source and authenticates
|
|
45
|
+
// nobody — it names an org so a page can submit without a credential. Set
|
|
46
|
+
// `allowed_origins` so another site cannot post through it, and revoke it if
|
|
47
|
+
// it is abused; the feedback already collected is kept.
|
|
48
|
+
async function createWidget(apiKey, orgId, name, allowedOrigins) {
|
|
49
|
+
const body = { name };
|
|
50
|
+
if (allowedOrigins?.length)
|
|
51
|
+
body.allowed_origins = allowedOrigins;
|
|
52
|
+
return (0, client_1.request)('POST', `${orgBase(orgId)}/widgets`, apiKey, body);
|
|
53
|
+
}
|
|
54
|
+
async function revokeWidget(apiKey, orgId, id) {
|
|
55
|
+
return (0, client_1.request)('DELETE', `${orgBase(orgId)}/widgets/${encodeURIComponent(id)}`, apiKey);
|
|
56
|
+
}
|
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.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.auth = exports.hq = void 0;
|
|
39
|
+
exports.task = exports.feedback = 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.auth = exports.hq = void 0;
|
|
40
40
|
__exportStar(require("./types"), exports);
|
|
41
41
|
__exportStar(require("./client"), exports);
|
|
42
42
|
__exportStar(require("./funds"), exports);
|
|
@@ -69,4 +69,5 @@ exports.payments = __importStar(require("./payments"));
|
|
|
69
69
|
exports.container = __importStar(require("./container"));
|
|
70
70
|
exports.git = __importStar(require("./git"));
|
|
71
71
|
exports.queue = __importStar(require("./queue"));
|
|
72
|
+
exports.feedback = __importStar(require("./feedback"));
|
|
72
73
|
exports.task = __importStar(require("./task"));
|
package/dist/llm.d.ts
CHANGED
|
@@ -99,12 +99,30 @@ export interface SummarizeResponse {
|
|
|
99
99
|
usage: VerbUsage;
|
|
100
100
|
}
|
|
101
101
|
export interface DraftRequest extends VerbBase {
|
|
102
|
-
/** Optional source content — may be empty when `
|
|
102
|
+
/** Optional source content — may be empty when `facts`/`prompt` carry
|
|
103
103
|
* the brief. */
|
|
104
104
|
input?: string;
|
|
105
105
|
/** What to write — `email`, `message`, `reply`, etc. */
|
|
106
106
|
kind: string;
|
|
107
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Referent data quoted into the prompt as reference, never as instructions
|
|
109
|
+
* — recipient details, dates, amounts.
|
|
110
|
+
*
|
|
111
|
+
* Replaces `context`, which the platform kept as an alias with a removal
|
|
112
|
+
* clock and no security properties. Verified 2026-07-28: both spellings
|
|
113
|
+
* behave identically today, and neither is declared in the schema.
|
|
114
|
+
*/
|
|
115
|
+
facts?: Record<string, unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Writer controls: tone, max_words, format, language, style. A closed set,
|
|
118
|
+
* denied-listed against dangerous key names — which is the property `facts`
|
|
119
|
+
* does not have and `context` never distinguished.
|
|
120
|
+
*/
|
|
121
|
+
directives?: Record<string, unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Use `facts`. Sent as-is when `facts` is absent, so existing
|
|
124
|
+
* callers keep working; remove no earlier than the next minor.
|
|
125
|
+
*/
|
|
108
126
|
context?: Record<string, unknown>;
|
|
109
127
|
/** Free-text instructions to the writer. */
|
|
110
128
|
prompt?: string;
|
package/dist/llm.js
CHANGED
|
@@ -43,5 +43,12 @@ async function summarize(apiKey, orgId, req) {
|
|
|
43
43
|
return (0, client_1.request)('POST', verbUrl(orgId, 'summarize'), apiKey, req);
|
|
44
44
|
}
|
|
45
45
|
async function draft(apiKey, orgId, req) {
|
|
46
|
-
|
|
46
|
+
// Send `facts`, not `context`. The platform treats `context` as an alias on
|
|
47
|
+
// a removal clock, so a caller still passing it gets migrated here rather
|
|
48
|
+
// than finding out when it is dropped.
|
|
49
|
+
const { context, ...rest } = req;
|
|
50
|
+
const body = context !== undefined && rest.facts === undefined
|
|
51
|
+
? { ...rest, facts: context }
|
|
52
|
+
: rest;
|
|
53
|
+
return (0, client_1.request)('POST', verbUrl(orgId, 'draft'), apiKey, body);
|
|
47
54
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.9.0";
|
package/dist/version.js
CHANGED
|
@@ -8,4 +8,4 @@ exports.SDK_VERSION = void 0;
|
|
|
8
8
|
// Why a constant and not a package.json read: the SDK runs inside edge
|
|
9
9
|
// functions (Cloudflare Workers), so it must not import node:fs. A literal
|
|
10
10
|
// is the only version source that works in every runtime we ship to.
|
|
11
|
-
exports.SDK_VERSION = '2.
|
|
11
|
+
exports.SDK_VERSION = '2.9.0';
|