@myapihq/sdk 2.5.0 → 2.6.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 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);
@@ -60,7 +60,8 @@ export interface LogEntry {
60
60
  severity: string;
61
61
  text: string;
62
62
  }
63
- export declare function getContainerLogs(apiKey: string, orgId: string, containerId: string, tail?: number): Promise<LogEntry[]>;
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;
@@ -69,6 +70,4 @@ export interface DomainBinding {
69
70
  }
70
71
  export declare function bindDomain(apiKey: string, orgId: string, containerId: string, domain: string): Promise<DomainBinding>;
71
72
  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
- }>;
73
+ export declare function buildLogs(apiKey: string, orgId: string, id: string, tail?: number): Promise<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
- // getContainerLogs returns recent runtime log entries, newest first.
71
- // `tail` caps the count (default 100, max 1000 server-side). An
72
- // undeployed container returns an empty array.
73
- async function getContainerLogs(apiKey, orgId, containerId, tail) {
74
- const query = tail ? `?tail=${encodeURIComponent(String(tail))}` : '';
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
@@ -96,5 +98,16 @@ async function unbindDomain(apiKey, orgId, containerId) {
96
98
  // why, without the noise.
97
99
  async function buildLogs(apiKey, orgId, id, tail) {
98
100
  const q = tail !== undefined ? `?tail=${encodeURIComponent(String(tail))}` : '';
99
- return (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(id)}/build-logs${q}`, apiKey);
101
+ // The envelope's `data` is a bare array of log lines. This was typed as
102
+ // `{ logs: string[] }` when first written — a guess, because the OpenAPI
103
+ // document does not describe the response body. The guess read as correct
104
+ // against a container with no logs (both shapes look empty) and would have
105
+ // reported "no build logs" for every container that HAD them. Verified
106
+ // against production before relying on it this time.
107
+ const res = await (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(id)}/build-logs${q}`, apiKey);
108
+ if (Array.isArray(res))
109
+ return res;
110
+ // Tolerate a future `{ logs: [...] }` shape rather than silently showing none.
111
+ const wrapped = res?.logs;
112
+ return Array.isArray(wrapped) ? wrapped : [];
100
113
  }
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/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,21 +57,22 @@ 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
- }>;
59
- export declare function getIdentity(apiKey: string, orgId: string, pixelId: string, website: string): Promise<{
60
- uuid: string;
61
- is_resolved: boolean;
62
- nodes: Record<string, {
60
+ }): Promise<EventsPage>;
61
+ export interface IdentityGraph {
62
+ pixel_id: string;
63
+ emails: string[];
64
+ external_ids: string[];
65
+ ips: string[];
66
+ locations: string[];
67
+ networks: string[];
68
+ raw_nodes: Array<{
69
+ value: string;
63
70
  type: string;
64
71
  probability: number;
65
72
  }>;
66
- latency_ms: number;
67
- }>;
73
+ [k: string]: unknown;
74
+ }
75
+ export declare function getIdentity(apiKey: string, orgId: string, pixelId: string, website: string): Promise<IdentityGraph>;
68
76
  export declare function getGeoSample(apiKey: string, orgId: string): Promise<Record<string, unknown>>;
69
77
  export declare function identify(apiKey: string, orgId: string, pixelId: string, who: {
70
78
  email?: string;
package/dist/pixel.js CHANGED
@@ -50,10 +50,14 @@ 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
- return (0, client_1.request)('GET', `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}?website=${encodeURIComponent(website)}`, apiKey);
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.
59
+ const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}?website=${encodeURIComponent(website)}`;
60
+ return (0, client_1.request)('GET', url, apiKey);
57
61
  }
58
62
  // Sample of geographic distribution of the org's pixel audience. Backend
59
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.5.0";
1
+ export declare const SDK_VERSION = "2.6.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.5.0';
11
+ exports.SDK_VERSION = '2.6.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.5.0",
4
+ "version": "2.6.0",
5
5
  "description": "TypeScript SDK for the MyAPI ecosystem",
6
6
  "repository": {
7
7
  "type": "git",