@myapihq/sdk 2.5.1 → 2.6.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/dist/client.js +13 -0
- package/dist/container.d.ts +2 -1
- package/dist/container.js +7 -5
- package/dist/crm.d.ts +0 -2
- package/dist/funnel.d.ts +2 -0
- package/dist/pixel.d.ts +14 -12
- package/dist/pixel.js +6 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -248,6 +248,19 @@ async function parseResponse(method, url, response) {
|
|
|
248
248
|
if (!response.ok) {
|
|
249
249
|
throw toError(result?.error, response.status);
|
|
250
250
|
}
|
|
251
|
+
// A few routes answer 2xx with a BARE object — no {success, data, error,
|
|
252
|
+
// meta} envelope. `pixel identity` and `pixel events` are the two we have
|
|
253
|
+
// found, both by hitting them with real parameters; there is no way to
|
|
254
|
+
// enumerate the rest short of calling every endpoint, because the schema
|
|
255
|
+
// does not describe response bodies.
|
|
256
|
+
//
|
|
257
|
+
// Treating an absent `success` as a failure is what made both of them
|
|
258
|
+
// surface as a bare `unknown_error` while the data sat in the response. The
|
|
259
|
+
// HTTP status is the authority on whether the call succeeded — if the body
|
|
260
|
+
// does not carry the envelope, the body IS the data.
|
|
261
|
+
if (result === null || typeof result !== 'object' || !('success' in result)) {
|
|
262
|
+
return { success: true, data: result, error: null, meta: {} };
|
|
263
|
+
}
|
|
251
264
|
const apiResponse = result;
|
|
252
265
|
if (!apiResponse.success) {
|
|
253
266
|
throw toError(apiResponse.error, response.status);
|
package/dist/container.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ export interface LogEntry {
|
|
|
60
60
|
severity: string;
|
|
61
61
|
text: string;
|
|
62
62
|
}
|
|
63
|
-
export
|
|
63
|
+
export type LogScope = 'container' | 'all';
|
|
64
|
+
export declare function getContainerLogs(apiKey: string, orgId: string, containerId: string, tail?: number, scope?: LogScope): Promise<LogEntry[]>;
|
|
64
65
|
export interface DomainBinding {
|
|
65
66
|
container_id: string;
|
|
66
67
|
custom_domain: string;
|
package/dist/container.js
CHANGED
|
@@ -67,11 +67,13 @@ async function deployContainerSource(apiKey, orgId, containerId, tarball, filena
|
|
|
67
67
|
}
|
|
68
68
|
return result.data;
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
async function getContainerLogs(apiKey, orgId, containerId, tail, scope) {
|
|
71
|
+
const params = new URLSearchParams();
|
|
72
|
+
if (tail)
|
|
73
|
+
params.set('tail', String(tail));
|
|
74
|
+
if (scope === 'all')
|
|
75
|
+
params.set('scope', 'all');
|
|
76
|
+
const query = params.toString() ? `?${params.toString()}` : '';
|
|
75
77
|
return (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/logs${query}`, apiKey);
|
|
76
78
|
}
|
|
77
79
|
// bindDomain points a custom domain at a deployed container. The parent
|
package/dist/crm.d.ts
CHANGED
|
@@ -67,7 +67,6 @@ export interface ContactSearchFilter {
|
|
|
67
67
|
max_last_engagement_days?: number;
|
|
68
68
|
include_deleted?: boolean;
|
|
69
69
|
limit?: number;
|
|
70
|
-
offset?: number;
|
|
71
70
|
}
|
|
72
71
|
export interface ContactSearchResult {
|
|
73
72
|
contacts: Contact[];
|
|
@@ -92,7 +91,6 @@ export interface CompanySearchFilter {
|
|
|
92
91
|
domain?: string;
|
|
93
92
|
include_deleted?: boolean;
|
|
94
93
|
limit?: number;
|
|
95
|
-
offset?: number;
|
|
96
94
|
}
|
|
97
95
|
export interface CompanySearchResult {
|
|
98
96
|
companies: Company[];
|
package/dist/funnel.d.ts
CHANGED
package/dist/pixel.d.ts
CHANGED
|
@@ -6,6 +6,18 @@ export interface InteractionsResponse {
|
|
|
6
6
|
total_events: number;
|
|
7
7
|
limit: number;
|
|
8
8
|
offset: number;
|
|
9
|
+
include_bots?: boolean;
|
|
10
|
+
bots_filtered?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface VisitsResponse {
|
|
13
|
+
visits: Visit[];
|
|
14
|
+
total: number;
|
|
15
|
+
}
|
|
16
|
+
export interface EventsPage {
|
|
17
|
+
events: PixelEvent[];
|
|
18
|
+
total: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
offset: number;
|
|
9
21
|
}
|
|
10
22
|
export interface Visit {
|
|
11
23
|
type: 'visit';
|
|
@@ -37,12 +49,7 @@ export declare function getVisits(apiKey: string, orgId: string, params: {
|
|
|
37
49
|
to?: string;
|
|
38
50
|
limit?: number;
|
|
39
51
|
offset?: number;
|
|
40
|
-
}): Promise<
|
|
41
|
-
visits: Visit[];
|
|
42
|
-
total: number;
|
|
43
|
-
limit: number;
|
|
44
|
-
offset: number;
|
|
45
|
-
}>;
|
|
52
|
+
}): Promise<VisitsResponse>;
|
|
46
53
|
export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
47
54
|
campaign_id?: string;
|
|
48
55
|
domain?: string;
|
|
@@ -50,12 +57,7 @@ export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
|
50
57
|
to?: string;
|
|
51
58
|
limit?: number;
|
|
52
59
|
offset?: number;
|
|
53
|
-
}): Promise<
|
|
54
|
-
events: PixelEvent[];
|
|
55
|
-
total: number;
|
|
56
|
-
limit: number;
|
|
57
|
-
offset: number;
|
|
58
|
-
}>;
|
|
60
|
+
}): Promise<EventsPage>;
|
|
59
61
|
export interface IdentityGraph {
|
|
60
62
|
pixel_id: string;
|
|
61
63
|
emails: string[];
|
package/dist/pixel.js
CHANGED
|
@@ -51,26 +51,13 @@ async function getEvents(apiKey, orgId, params) {
|
|
|
51
51
|
return (0, client_1.request)('GET', url, apiKey);
|
|
52
52
|
}
|
|
53
53
|
async function getIdentity(apiKey, orgId, pixelId, website) {
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
// field, took it for a failure, and surfaced a bare `unknown_error`, so
|
|
60
|
-
// `pixel identity` looked broken while the data was there all along.
|
|
61
|
-
// 2. The old return type (`uuid` / `is_resolved` / `nodes` / `latency_ms`)
|
|
62
|
-
// described a shape the endpoint does not return.
|
|
63
|
-
//
|
|
64
|
-
// Accepting both envelope shapes is a workaround, not an endorsement — when
|
|
65
|
-
// this route starts enveloping like the rest, the first branch takes over.
|
|
54
|
+
// This route answers with a BARE object — no {success, data, error, meta}
|
|
55
|
+
// envelope, unlike most of the platform. That used to need a hand-rolled
|
|
56
|
+
// fetch here, which also meant no retry, no timeout and no idempotency key.
|
|
57
|
+
// parseResponse() now treats an un-enveloped 2xx body as the data, so this
|
|
58
|
+
// is an ordinary request() again and picks all of that back up.
|
|
66
59
|
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}?website=${encodeURIComponent(website)}`;
|
|
67
|
-
|
|
68
|
-
const body = await res.json().catch(() => null);
|
|
69
|
-
if (!res.ok) {
|
|
70
|
-
const err = body?.error;
|
|
71
|
-
throw new client_1.MyApiError((typeof err === 'object' ? err?.code : err) || 'unknown_error', res.status, typeof err === 'object' ? err?.message : undefined);
|
|
72
|
-
}
|
|
73
|
-
return (body && typeof body === 'object' && 'data' in body ? body.data : body) ?? {};
|
|
60
|
+
return (0, client_1.request)('GET', url, apiKey);
|
|
74
61
|
}
|
|
75
62
|
// Sample of geographic distribution of the org's pixel audience. Backend
|
|
76
63
|
// returns whatever shape it wants; we type as record-of-unknowns and let
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.6.1";
|
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.6.1';
|