@myapihq/sdk 2.5.0 → 2.5.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/container.d.ts +1 -3
- package/dist/container.js +12 -1
- package/dist/pixel.d.ts +12 -6
- package/dist/pixel.js +20 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/container.d.ts
CHANGED
|
@@ -69,6 +69,4 @@ export interface DomainBinding {
|
|
|
69
69
|
}
|
|
70
70
|
export declare function bindDomain(apiKey: string, orgId: string, containerId: string, domain: string): Promise<DomainBinding>;
|
|
71
71
|
export declare function unbindDomain(apiKey: string, orgId: string, containerId: string): Promise<void>;
|
|
72
|
-
export declare function buildLogs(apiKey: string, orgId: string, id: string, tail?: number): Promise<
|
|
73
|
-
logs: string[];
|
|
74
|
-
}>;
|
|
72
|
+
export declare function buildLogs(apiKey: string, orgId: string, id: string, tail?: number): Promise<string[]>;
|
package/dist/container.js
CHANGED
|
@@ -96,5 +96,16 @@ async function unbindDomain(apiKey, orgId, containerId) {
|
|
|
96
96
|
// why, without the noise.
|
|
97
97
|
async function buildLogs(apiKey, orgId, id, tail) {
|
|
98
98
|
const q = tail !== undefined ? `?tail=${encodeURIComponent(String(tail))}` : '';
|
|
99
|
-
|
|
99
|
+
// The envelope's `data` is a bare array of log lines. This was typed as
|
|
100
|
+
// `{ logs: string[] }` when first written — a guess, because the OpenAPI
|
|
101
|
+
// document does not describe the response body. The guess read as correct
|
|
102
|
+
// against a container with no logs (both shapes look empty) and would have
|
|
103
|
+
// reported "no build logs" for every container that HAD them. Verified
|
|
104
|
+
// against production before relying on it this time.
|
|
105
|
+
const res = await (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(id)}/build-logs${q}`, apiKey);
|
|
106
|
+
if (Array.isArray(res))
|
|
107
|
+
return res;
|
|
108
|
+
// Tolerate a future `{ logs: [...] }` shape rather than silently showing none.
|
|
109
|
+
const wrapped = res?.logs;
|
|
110
|
+
return Array.isArray(wrapped) ? wrapped : [];
|
|
100
111
|
}
|
package/dist/pixel.d.ts
CHANGED
|
@@ -56,15 +56,21 @@ export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
|
56
56
|
limit: number;
|
|
57
57
|
offset: number;
|
|
58
58
|
}>;
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
export interface IdentityGraph {
|
|
60
|
+
pixel_id: string;
|
|
61
|
+
emails: string[];
|
|
62
|
+
external_ids: string[];
|
|
63
|
+
ips: string[];
|
|
64
|
+
locations: string[];
|
|
65
|
+
networks: string[];
|
|
66
|
+
raw_nodes: Array<{
|
|
67
|
+
value: string;
|
|
63
68
|
type: string;
|
|
64
69
|
probability: number;
|
|
65
70
|
}>;
|
|
66
|
-
|
|
67
|
-
}
|
|
71
|
+
[k: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
export declare function getIdentity(apiKey: string, orgId: string, pixelId: string, website: string): Promise<IdentityGraph>;
|
|
68
74
|
export declare function getGeoSample(apiKey: string, orgId: string): Promise<Record<string, unknown>>;
|
|
69
75
|
export declare function identify(apiKey: string, orgId: string, pixelId: string, who: {
|
|
70
76
|
email?: string;
|
package/dist/pixel.js
CHANGED
|
@@ -50,10 +50,27 @@ async function getEvents(apiKey, orgId, params) {
|
|
|
50
50
|
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
51
51
|
return (0, client_1.request)('GET', url, apiKey);
|
|
52
52
|
}
|
|
53
|
-
// getIdentity resolves a pixel's identity graph. `website` is required —
|
|
54
|
-
// the backend scopes the lookup to a domain the org owns.
|
|
55
53
|
async function getIdentity(apiKey, orgId, pixelId, website) {
|
|
56
|
-
|
|
54
|
+
// Two things verified against production 2026-07-27, both of which had been
|
|
55
|
+
// guessed wrong here:
|
|
56
|
+
//
|
|
57
|
+
// 1. This endpoint answers with a BARE object — no {success, data, error,
|
|
58
|
+
// meta} envelope, unlike every other route. `request()` saw no `success`
|
|
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.
|
|
66
|
+
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}?website=${encodeURIComponent(website)}`;
|
|
67
|
+
const res = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
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) ?? {};
|
|
57
74
|
}
|
|
58
75
|
// Sample of geographic distribution of the org's pixel audience. Backend
|
|
59
76
|
// 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.5.
|
|
1
|
+
export declare const SDK_VERSION = "2.5.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.5.
|
|
11
|
+
exports.SDK_VERSION = '2.5.1';
|