@myapihq/sdk 1.1.0-wip.4 → 1.2.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.
Files changed (67) hide show
  1. package/dist/audience.d.ts +71 -0
  2. package/dist/audience.js +54 -0
  3. package/dist/client.d.ts +1 -1
  4. package/dist/client.js +8 -1
  5. package/dist/company.d.ts +20 -0
  6. package/dist/company.js +25 -0
  7. package/dist/config.d.ts +6 -0
  8. package/dist/config.js +20 -2
  9. package/dist/crm.d.ts +122 -0
  10. package/dist/crm.js +84 -0
  11. package/dist/database.d.ts +36 -0
  12. package/dist/database.js +65 -0
  13. package/dist/domain.d.ts +19 -1
  14. package/dist/domain.js +22 -2
  15. package/dist/email-verify.d.ts +30 -0
  16. package/dist/email-verify.js +17 -0
  17. package/dist/email.d.ts +33 -0
  18. package/dist/email.js +53 -0
  19. package/dist/exposes.d.ts +2 -0
  20. package/dist/exposes.js +14 -0
  21. package/dist/funnel.d.ts +10 -0
  22. package/dist/funnel.js +20 -0
  23. package/dist/hq.d.ts +10 -0
  24. package/dist/hq.js +28 -0
  25. package/dist/image.d.ts +14 -0
  26. package/dist/image.js +12 -0
  27. package/dist/index.d.ts +6 -1
  28. package/dist/index.js +13 -2
  29. package/dist/llm.d.ts +50 -0
  30. package/dist/llm.js +27 -0
  31. package/dist/people.d.ts +54 -0
  32. package/dist/people.js +22 -0
  33. package/dist/pixel.d.ts +3 -0
  34. package/dist/pixel.js +15 -0
  35. package/dist/services.d.ts +17 -0
  36. package/dist/services.js +190 -0
  37. package/dist/storage.d.ts +3 -1
  38. package/dist/storage.js +7 -0
  39. package/dist/url.d.ts +2 -0
  40. package/dist/url.js +4 -0
  41. package/dist/webhook.d.ts +8 -1
  42. package/dist/webhook.js +14 -2
  43. package/dist/workflow.d.ts +2 -0
  44. package/dist/workflow.js +12 -0
  45. package/package.json +2 -1
  46. package/scripts/scaffold-sdk.js +501 -0
  47. package/src/audience.ts +162 -0
  48. package/src/client.ts +9 -1
  49. package/src/company.ts +48 -0
  50. package/src/config.ts +21 -1
  51. package/src/crm.ts +235 -0
  52. package/src/database.ts +103 -0
  53. package/src/domain.ts +44 -2
  54. package/src/email.ts +84 -0
  55. package/src/exposes.ts +16 -0
  56. package/src/funnel.ts +34 -0
  57. package/src/hq.ts +41 -0
  58. package/src/image.ts +31 -0
  59. package/src/index.ts +12 -1
  60. package/src/llm.ts +86 -0
  61. package/src/people.ts +84 -0
  62. package/src/pixel.ts +16 -0
  63. package/src/services.ts +220 -0
  64. package/src/storage.ts +15 -6
  65. package/src/url.ts +5 -0
  66. package/src/webhook.ts +25 -2
  67. package/src/workflow.ts +13 -0
@@ -0,0 +1,30 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
3
+ export type VerifyVerdict = 'deliverable' | 'undeliverable' | 'unknown';
4
+ export interface VerifyChecks {
5
+ syntax: {
6
+ valid: boolean;
7
+ detail?: string;
8
+ };
9
+ dns?: {
10
+ valid: boolean;
11
+ mx_records?: string[];
12
+ };
13
+ microsoft?: {
14
+ verdict: string;
15
+ if_exists_result: number;
16
+ domain_type: number;
17
+ federated: boolean;
18
+ };
19
+ }
20
+ export interface VerifyResult {
21
+ email: string;
22
+ verdict: VerifyVerdict;
23
+ confidence: number;
24
+ smtp_recommended: boolean;
25
+ checks: VerifyChecks;
26
+ elapsed_ms: number;
27
+ }
28
+ export declare function verifyEmail(apiKey: string, orgId: string, { email }: {
29
+ email: string;
30
+ }): Promise<VerifyResult>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // Scaffolded from schema by scripts/scaffold-sdk.js — DO NOT remove the
3
+ // EXPOSES array (the coverage tool verifies it against the live schema).
4
+ // Types and function names ARE editable; re-running the scaffolder against
5
+ // a service whose config has been changed will diff vs. existing file
6
+ // (use --dry-run to inspect).
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EXPOSES = void 0;
9
+ exports.verifyEmail = verifyEmail;
10
+ const client_1 = require("./client");
11
+ const config_1 = require("./config");
12
+ exports.EXPOSES = [
13
+ 'POST /email-verify/orgs/{org_id}/verify',
14
+ ];
15
+ async function verifyEmail(apiKey, orgId, { email }) {
16
+ return (0, client_1.request)('POST', `${config_1.EMAIL_VERIFY_BASE}/email-verify/orgs/${encodeURIComponent(orgId)}/verify`, apiKey, { email });
17
+ }
package/dist/email.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
1
3
  export interface EmailMessage {
2
4
  message_id: string;
3
5
  from: string;
@@ -52,6 +54,32 @@ export interface CampaignStats {
52
54
  page_visits: number;
53
55
  };
54
56
  }
57
+ export type VerifyVerdict = 'deliverable' | 'undeliverable' | 'unknown';
58
+ export interface VerifyChecks {
59
+ syntax: {
60
+ valid: boolean;
61
+ detail?: string;
62
+ };
63
+ dns?: {
64
+ valid: boolean;
65
+ mx_records?: string[];
66
+ };
67
+ microsoft?: {
68
+ verdict: string;
69
+ if_exists_result: number;
70
+ domain_type: number;
71
+ federated: boolean;
72
+ };
73
+ }
74
+ export interface VerifyResult {
75
+ email: string;
76
+ verdict: VerifyVerdict;
77
+ confidence: number;
78
+ smtp_recommended: boolean;
79
+ checks: VerifyChecks;
80
+ elapsed_ms: number;
81
+ }
82
+ export declare function verifyEmail(apiKey: string, orgId: string, email: string): Promise<VerifyResult>;
55
83
  export declare function createMailbox(apiKey: string, domain: string, username: string, displayName?: string): Promise<{
56
84
  address: string;
57
85
  created_at: string;
@@ -117,6 +145,11 @@ export declare function getTemplateJobStatus(apiKey: string, orgId: string, jobI
117
145
  };
118
146
  }>;
119
147
  export declare function getTemplate(apiKey: string, orgId: string, templateId: string): Promise<EmailTemplate>;
148
+ export declare function getTemplatePreview(templateId: string): Promise<{
149
+ html?: string;
150
+ subject?: string;
151
+ preview_url?: string;
152
+ } & Record<string, unknown>>;
120
153
  export declare function editTemplate(apiKey: string, orgId: string, templateId: string, prompt: string): Promise<{
121
154
  template_id: string;
122
155
  preview_url: string;
package/dist/email.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPOSES = void 0;
4
+ exports.verifyEmail = verifyEmail;
3
5
  exports.createMailbox = createMailbox;
4
6
  exports.listMailboxes = listMailboxes;
5
7
  exports.activateSending = activateSending;
@@ -17,6 +19,7 @@ exports.getWarmupStats = getWarmupStats;
17
19
  exports.generateTemplate = generateTemplate;
18
20
  exports.getTemplateJobStatus = getTemplateJobStatus;
19
21
  exports.getTemplate = getTemplate;
22
+ exports.getTemplatePreview = getTemplatePreview;
20
23
  exports.editTemplate = editTemplate;
21
24
  exports.sendTestEmail = sendTestEmail;
22
25
  exports.listTemplates = listTemplates;
@@ -34,6 +37,51 @@ exports.getCampaign = getCampaign;
34
37
  exports.updateCampaign = updateCampaign;
35
38
  const client_1 = require("./client");
36
39
  const config_1 = require("./config");
40
+ exports.EXPOSES = [
41
+ // Mailbox / sending activation
42
+ 'POST /email/mailboxes/create',
43
+ 'GET /email/mailboxes',
44
+ 'POST /email/sending/activate',
45
+ // Send + read
46
+ 'POST /email/send',
47
+ 'GET /email/status/{message_id}',
48
+ 'GET /email/sent',
49
+ 'GET /email/inbox/{address}',
50
+ 'GET /email/outbox/{address}',
51
+ 'GET /email/message/{message_id}',
52
+ // Warmup
53
+ 'POST /email/warmup/start',
54
+ 'POST /email/warmup/pause',
55
+ 'POST /email/warmup/resume',
56
+ 'POST /email/warmup/stop',
57
+ 'GET /email/warmup/stats/{address}',
58
+ // Templates
59
+ 'POST /email/orgs/{org_id}/templates/generate',
60
+ 'GET /email/orgs/{org_id}/template-jobs/{job_id}',
61
+ 'GET /email/orgs/{org_id}/templates',
62
+ 'GET /email/orgs/{org_id}/templates/{template_id}',
63
+ 'POST /email/orgs/{org_id}/templates/{template_id}/edit',
64
+ 'POST /email/orgs/{org_id}/templates/{template_id}/send-test',
65
+ 'DELETE /email/orgs/{org_id}/templates/{template_id}',
66
+ 'GET /email/templates/{template_id}/preview',
67
+ // Campaigns
68
+ 'POST /email/orgs/{org_id}/campaigns',
69
+ 'GET /email/orgs/{org_id}/campaigns',
70
+ 'GET /email/orgs/{org_id}/campaigns/{campaign_id}',
71
+ 'PATCH /email/orgs/{org_id}/campaigns/{campaign_id}',
72
+ 'POST /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/upload-list',
73
+ 'POST /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/upload-file',
74
+ 'GET /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/status',
75
+ 'POST /email/orgs/{org_id}/campaigns/{campaign_id}/start',
76
+ 'POST /email/orgs/{org_id}/campaigns/{campaign_id}/pause',
77
+ 'POST /email/orgs/{org_id}/campaigns/{campaign_id}/resume',
78
+ 'GET /email/orgs/{org_id}/campaigns/{campaign_id}/stats',
79
+ // Verify
80
+ 'POST /email/orgs/{org_id}/verify',
81
+ ];
82
+ async function verifyEmail(apiKey, orgId, email) {
83
+ return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/verify`, apiKey, { email });
84
+ }
37
85
  // ── Mailbox ops (account-scoped) ─────────────────────────────────────────────
38
86
  async function createMailbox(apiKey, domain, username, displayName) {
39
87
  return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/mailboxes/create`, apiKey, { domain, username, display_name: displayName });
@@ -95,6 +143,11 @@ async function getTemplateJobStatus(apiKey, orgId, jobId) {
95
143
  async function getTemplate(apiKey, orgId, templateId) {
96
144
  return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
97
145
  }
146
+ // Public preview — no auth required. The endpoint is unauthenticated per
147
+ // the OpenAPI schema; access is gated by the unguessable template_id.
148
+ async function getTemplatePreview(templateId) {
149
+ return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/templates/${encodeURIComponent(templateId)}/preview`, undefined);
150
+ }
98
151
  async function editTemplate(apiKey, orgId, templateId, prompt) {
99
152
  return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
100
153
  }
@@ -0,0 +1,2 @@
1
+ export type Endpoint = `${'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'} /${string}`;
2
+ export type Exposes = readonly Endpoint[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // OpenAPI-templated endpoint declaration for SDK service modules.
3
+ //
4
+ // Each service module (hq, domain, funnel, ...) exports an `EXPOSES: Exposes`
5
+ // array listing the backend endpoints reachable through that module's
6
+ // functions. The integrations coverage tool walks these to verify CLI ↔ SDK
7
+ // parity (S-108).
8
+ //
9
+ // Form: `<METHOD> <PATH>` where path uses `{name}` for variable segments
10
+ // matching OpenAPI 3.x style.
11
+ //
12
+ // Mirrors packages/cli/src/exposes.ts — kept duplicated to avoid runtime
13
+ // dependencies between the packages (the SDK has zero runtime deps per NFR-005).
14
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/funnel.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
1
3
  export interface Funnel {
2
4
  id: string;
3
5
  org_id: string;
@@ -32,6 +34,14 @@ export declare function pushFunnelPage(apiKey: string, orgId: string, funnelId:
32
34
  }): Promise<{
33
35
  url: string;
34
36
  }>;
37
+ export interface FunnelPage {
38
+ slug: string;
39
+ url?: string;
40
+ published_at?: string;
41
+ updated_at?: string;
42
+ [key: string]: unknown;
43
+ }
44
+ export declare function listFunnelPages(apiKey: string, orgId: string, funnelId: string): Promise<FunnelPage[]>;
35
45
  export declare function verifyFunnel(apiKey: string, orgId: string, funnelId: string, opts?: {
36
46
  html?: string;
37
47
  slug?: string;
package/dist/funnel.js CHANGED
@@ -1,13 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPOSES = void 0;
3
4
  exports.createFunnel = createFunnel;
4
5
  exports.getFunnel = getFunnel;
5
6
  exports.listFunnels = listFunnels;
6
7
  exports.deleteFunnel = deleteFunnel;
7
8
  exports.pushFunnelPage = pushFunnelPage;
9
+ exports.listFunnelPages = listFunnelPages;
8
10
  exports.verifyFunnel = verifyFunnel;
9
11
  const client_1 = require("./client");
10
12
  const config_1 = require("./config");
13
+ exports.EXPOSES = [
14
+ 'POST /funnel/orgs/{org_id}/funnels',
15
+ 'GET /funnel/orgs/{org_id}/funnels',
16
+ 'GET /funnel/orgs/{org_id}/funnels/{funnel_id}',
17
+ 'DELETE /funnel/orgs/{org_id}/funnels/{funnel_id}',
18
+ 'POST /funnel/orgs/{org_id}/funnels/{funnel_id}/push-page',
19
+ 'POST /funnel/orgs/{org_id}/funnels/{funnel_id}/verify',
20
+ 'GET /funnel/orgs/{org_id}/funnels/{funnel_id}/pages',
21
+ ];
11
22
  async function createFunnel(apiKey, orgId) {
12
23
  return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels`, apiKey, {});
13
24
  }
@@ -23,6 +34,15 @@ async function deleteFunnel(apiKey, orgId, funnelId) {
23
34
  async function pushFunnelPage(apiKey, orgId, funnelId, payload) {
24
35
  return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, payload);
25
36
  }
37
+ async function listFunnelPages(apiKey, orgId, funnelId) {
38
+ // Backend returns `{ pages: [...] }` for this endpoint (every other list
39
+ // endpoint returns a flat array). Unwrap so the SDK's contract matches the
40
+ // rest — callers expect an array.
41
+ const res = await (0, client_1.request)('GET', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/pages`, apiKey);
42
+ if (Array.isArray(res))
43
+ return res;
44
+ return res?.pages ?? [];
45
+ }
26
46
  async function verifyFunnel(apiKey, orgId, funnelId, opts) {
27
47
  return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
28
48
  }
package/dist/hq.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
1
3
  export interface Org {
2
4
  id: string;
3
5
  name: string;
@@ -44,6 +46,14 @@ export declare function createAnonymousAccount(): Promise<AuthResult & {
44
46
  export declare function sendCode(email: string): Promise<void>;
45
47
  export declare function verifyCode(email: string, code: string): Promise<AuthResult>;
46
48
  export declare function upgradeAccount(apiKey: string, email: string): Promise<AuthResult>;
49
+ export type FreeTierEntry = {
50
+ service: string;
51
+ used: number;
52
+ allowance: number;
53
+ remaining?: number;
54
+ reset_at?: string;
55
+ };
56
+ export declare function getFreeTier(apiKey: string): Promise<FreeTierEntry[] | null>;
47
57
  export declare function getAccount(apiKey: string): Promise<AccountInfo>;
48
58
  export declare function createApiKey(apiKey: string, name: string): Promise<{
49
59
  api_key: string;
package/dist/hq.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPOSES = void 0;
3
4
  exports.createAnonymousAccount = createAnonymousAccount;
4
5
  exports.sendCode = sendCode;
5
6
  exports.verifyCode = verifyCode;
6
7
  exports.upgradeAccount = upgradeAccount;
8
+ exports.getFreeTier = getFreeTier;
7
9
  exports.getAccount = getAccount;
8
10
  exports.createApiKey = createApiKey;
9
11
  exports.listApiKeys = listApiKeys;
@@ -22,6 +24,29 @@ exports.setupPayment = setupPayment;
22
24
  exports.topUp = topUp;
23
25
  const client_1 = require("./client");
24
26
  const config_1 = require("./config");
27
+ exports.EXPOSES = [
28
+ 'POST /hq/account/anonymous',
29
+ 'POST /hq/account/send-code',
30
+ 'POST /hq/account/verify-code',
31
+ 'PATCH /hq/account/upgrade',
32
+ 'GET /hq/account/me',
33
+ 'GET /hq/account/free-tier',
34
+ 'POST /hq/account/create/key',
35
+ 'GET /hq/account/keys',
36
+ 'DELETE /hq/account/delete/key/{key_id}',
37
+ 'POST /hq/orgs',
38
+ 'GET /hq/orgs',
39
+ 'GET /hq/orgs/{org_id}',
40
+ 'PATCH /hq/orgs/{org_id}',
41
+ 'DELETE /hq/orgs/{org_id}',
42
+ 'POST /hq/org-imports',
43
+ 'GET /hq/org-imports/{import_id}',
44
+ 'POST /hq/org-imports/{import_id}/confirm',
45
+ 'GET /hq/billing/balance',
46
+ 'GET /hq/billing/history',
47
+ 'POST /hq/billing/setup-payment',
48
+ 'POST /hq/billing/topup',
49
+ ];
25
50
  async function createAnonymousAccount() {
26
51
  return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/account/anonymous`, undefined, {});
27
52
  }
@@ -34,6 +59,9 @@ async function verifyCode(email, code) {
34
59
  async function upgradeAccount(apiKey, email) {
35
60
  return (0, client_1.request)('PATCH', `${config_1.HQ_BASE}/hq/account/upgrade`, apiKey, { email });
36
61
  }
62
+ async function getFreeTier(apiKey) {
63
+ return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/account/free-tier`, apiKey);
64
+ }
37
65
  async function getAccount(apiKey) {
38
66
  return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/account/me`, apiKey);
39
67
  }
package/dist/image.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
3
+ export interface ImageModel {
4
+ id: string;
5
+ kind: 'image';
6
+ aspect_ratios: string[];
7
+ default_size: string;
8
+ cost_per_image_usd: number;
9
+ }
10
+ export interface ImageModelsResponse {
11
+ models: ImageModel[];
12
+ }
1
13
  export interface ImageJob {
2
14
  job_id: string;
3
15
  status: 'pending' | 'processing' | 'completed' | 'failed';
@@ -9,6 +21,7 @@ export interface ImageJob {
9
21
  }
10
22
  export declare function generateImage(apiKey: string, orgId: string, payload: {
11
23
  prompt: string;
24
+ model?: string;
12
25
  aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
13
26
  style?: string;
14
27
  colors?: string;
@@ -20,3 +33,4 @@ export declare function generateImage(apiKey: string, orgId: string, payload: {
20
33
  export declare function getImageJob(apiKey: string, orgId: string, jobId: string): Promise<ImageJob>;
21
34
  export declare function listImages(apiKey: string, orgId: string): Promise<ImageJob[]>;
22
35
  export declare function deleteImage(apiKey: string, orgId: string, jobId: string): Promise<void>;
36
+ export declare function listModels(apiKey: string, orgId: string): Promise<ImageModelsResponse>;
package/dist/image.js CHANGED
@@ -1,11 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPOSES = void 0;
3
4
  exports.generateImage = generateImage;
4
5
  exports.getImageJob = getImageJob;
5
6
  exports.listImages = listImages;
6
7
  exports.deleteImage = deleteImage;
8
+ exports.listModels = listModels;
7
9
  const client_1 = require("./client");
8
10
  const config_1 = require("./config");
11
+ exports.EXPOSES = [
12
+ 'POST /image/orgs/{org_id}/generate',
13
+ 'GET /image/orgs/{org_id}/jobs/{job_id}',
14
+ 'GET /image/orgs/{org_id}/list',
15
+ 'GET /image/orgs/{org_id}/models',
16
+ 'DELETE /image/orgs/{org_id}/images/{image_id}',
17
+ ];
9
18
  async function generateImage(apiKey, orgId, payload) {
10
19
  return (0, client_1.request)('POST', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
11
20
  }
@@ -18,3 +27,6 @@ async function listImages(apiKey, orgId) {
18
27
  async function deleteImage(apiKey, orgId, jobId) {
19
28
  return (0, client_1.request)('DELETE', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
20
29
  }
30
+ async function listModels(apiKey, orgId) {
31
+ return (0, client_1.request)('GET', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/models`, apiKey);
32
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './types';
2
2
  export * from './client';
3
- export * from './config';
4
3
  export * as hq from './hq';
5
4
  export * as domain from './domain';
6
5
  export * as email from './email';
@@ -11,3 +10,9 @@ export * as storage from './storage';
11
10
  export * as webhook from './webhook';
12
11
  export * as workflow from './workflow';
13
12
  export * as url from './url';
13
+ export * as people from './people';
14
+ export * as company from './company';
15
+ export * as audience from './audience';
16
+ export * as llm from './llm';
17
+ export * as database from './database';
18
+ export * as crm from './crm';
package/dist/index.js CHANGED
@@ -36,10 +36,15 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
39
+ 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
- __exportStar(require("./config"), exports);
42
+ // Note: config constants (STORAGE_BASE etc.) are NOT re-exported from the
43
+ // barrel. TypeScript compiles `export * from './config'` to a runtime
44
+ // `__exportStar` call that Node's cjs-module-lexer can't see through, so
45
+ // downstream ESM consumers fail with "Named export not found" against the
46
+ // CJS-compiled SDK. If you need a base URL in a downstream package, mirror
47
+ // the constant locally — it's one line and the comment makes it obvious.
43
48
  exports.hq = __importStar(require("./hq"));
44
49
  exports.domain = __importStar(require("./domain"));
45
50
  exports.email = __importStar(require("./email"));
@@ -50,3 +55,9 @@ exports.storage = __importStar(require("./storage"));
50
55
  exports.webhook = __importStar(require("./webhook"));
51
56
  exports.workflow = __importStar(require("./workflow"));
52
57
  exports.url = __importStar(require("./url"));
58
+ exports.people = __importStar(require("./people"));
59
+ exports.company = __importStar(require("./company"));
60
+ exports.audience = __importStar(require("./audience"));
61
+ exports.llm = __importStar(require("./llm"));
62
+ exports.database = __importStar(require("./database"));
63
+ exports.crm = __importStar(require("./crm"));
package/dist/llm.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
3
+ export type Role = 'system' | 'user' | 'assistant';
4
+ export interface Message {
5
+ role: Role;
6
+ content: string;
7
+ }
8
+ export interface CompleteRequest {
9
+ model: string;
10
+ messages: Message[];
11
+ max_tokens?: number;
12
+ temperature?: number;
13
+ stop?: string[];
14
+ }
15
+ export interface CompleteResponse {
16
+ model: string;
17
+ content: string;
18
+ finish_reason: string;
19
+ usage: {
20
+ input_tokens: number;
21
+ output_tokens: number;
22
+ cost_usd: number;
23
+ };
24
+ }
25
+ export interface EmbedRequest {
26
+ model: string;
27
+ input: string | string[];
28
+ }
29
+ export interface EmbedResponse {
30
+ model: string;
31
+ embeddings: number[][];
32
+ usage: {
33
+ input_tokens: number;
34
+ cost_usd: number;
35
+ };
36
+ }
37
+ export interface Model {
38
+ id: string;
39
+ kind: 'chat' | 'embed';
40
+ context?: number;
41
+ dimensions?: number;
42
+ input_per_1m: number;
43
+ output_per_1m?: number;
44
+ }
45
+ export interface ModelsResponse {
46
+ models: Model[];
47
+ }
48
+ export declare function complete(apiKey: string, orgId: string, req: CompleteRequest): Promise<CompleteResponse>;
49
+ export declare function embed(apiKey: string, orgId: string, req: EmbedRequest): Promise<EmbedResponse>;
50
+ export declare function listModels(apiKey: string, orgId: string): Promise<ModelsResponse>;
package/dist/llm.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Scaffolded from schema by scripts/scaffold-sdk.js — DO NOT remove the
3
+ // EXPOSES array (the coverage tool verifies it against the live schema).
4
+ // Types and function names ARE editable; re-running the scaffolder against
5
+ // a service whose config has been changed will diff vs. existing file
6
+ // (use --dry-run to inspect).
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EXPOSES = void 0;
9
+ exports.complete = complete;
10
+ exports.embed = embed;
11
+ exports.listModels = listModels;
12
+ const client_1 = require("./client");
13
+ const config_1 = require("./config");
14
+ exports.EXPOSES = [
15
+ 'POST /llm/orgs/{org_id}/complete',
16
+ 'POST /llm/orgs/{org_id}/embed',
17
+ 'GET /llm/orgs/{org_id}/models',
18
+ ];
19
+ async function complete(apiKey, orgId, req) {
20
+ return (0, client_1.request)('POST', `${config_1.LLM_BASE}/llm/orgs/${encodeURIComponent(orgId)}/complete`, apiKey, req);
21
+ }
22
+ async function embed(apiKey, orgId, req) {
23
+ return (0, client_1.request)('POST', `${config_1.LLM_BASE}/llm/orgs/${encodeURIComponent(orgId)}/embed`, apiKey, req);
24
+ }
25
+ async function listModels(apiKey, orgId) {
26
+ return (0, client_1.request)('GET', `${config_1.LLM_BASE}/llm/orgs/${encodeURIComponent(orgId)}/models`, apiKey);
27
+ }
@@ -0,0 +1,54 @@
1
+ import type { Exposes } from './exposes';
2
+ import type { SearchFilter } from './audience';
3
+ export declare const EXPOSES: Exposes;
4
+ export interface Location {
5
+ city?: string;
6
+ region?: string;
7
+ country?: string;
8
+ }
9
+ export interface Person {
10
+ id: string;
11
+ full_name: string;
12
+ first_name?: string;
13
+ last_name?: string;
14
+ email?: string;
15
+ email_type?: string;
16
+ link_confidence?: number;
17
+ location: Location;
18
+ company_id: string;
19
+ company: PersonCompany;
20
+ }
21
+ export interface PersonCompany {
22
+ id: string;
23
+ domain?: string;
24
+ name: string;
25
+ general_phone?: string;
26
+ address?: string;
27
+ is_registered_entity: boolean;
28
+ confidence: 'high' | 'low' | 'very_low';
29
+ country?: string;
30
+ country_consistent: boolean;
31
+ tld_class?: string;
32
+ has_careers_page: boolean;
33
+ has_investors_page: boolean;
34
+ has_shop_page: boolean;
35
+ has_blog: boolean;
36
+ has_c_level: boolean;
37
+ has_decision_maker: boolean;
38
+ headcount_lower_bound: number;
39
+ org_breadth: number;
40
+ source_count: number;
41
+ subdomain_variety: number;
42
+ multilingual: boolean;
43
+ language_count: number;
44
+ location?: Location;
45
+ }
46
+ export interface PeopleSearchResult {
47
+ people: Person[];
48
+ total: number;
49
+ limit: number;
50
+ offset: number;
51
+ has_more: boolean;
52
+ }
53
+ export declare function searchPeople(apiKey: string, orgId: string, filter: SearchFilter): Promise<PeopleSearchResult>;
54
+ export declare function getPerson(apiKey: string, orgId: string, personId: string): Promise<Person>;
package/dist/people.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // Scaffolded from schema by scripts/scaffold-sdk.js — DO NOT remove the
3
+ // EXPOSES array (the coverage tool verifies it against the live schema).
4
+ // Types and function names ARE editable; re-running the scaffolder against
5
+ // a service whose config has been changed will diff vs. existing file
6
+ // (use --dry-run to inspect).
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EXPOSES = void 0;
9
+ exports.searchPeople = searchPeople;
10
+ exports.getPerson = getPerson;
11
+ const client_1 = require("./client");
12
+ const config_1 = require("./config");
13
+ exports.EXPOSES = [
14
+ 'POST /people/orgs/{org_id}/search',
15
+ 'GET /people/orgs/{org_id}/{person_id}',
16
+ ];
17
+ async function searchPeople(apiKey, orgId, filter) {
18
+ return (0, client_1.request)('POST', `${config_1.PEOPLE_BASE}/people/orgs/${encodeURIComponent(orgId)}/search`, apiKey, filter);
19
+ }
20
+ async function getPerson(apiKey, orgId, personId) {
21
+ return (0, client_1.request)('GET', `${config_1.PEOPLE_BASE}/people/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(personId)}`, apiKey);
22
+ }
package/dist/pixel.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Exposes } from './exposes';
2
+ export declare const EXPOSES: Exposes;
1
3
  export interface InteractionsResponse {
2
4
  interactions: (Visit | PixelEvent)[];
3
5
  total_visits: number;
@@ -63,3 +65,4 @@ export declare function getIdentity(apiKey: string, orgId: string, pixelId: stri
63
65
  }>;
64
66
  latency_ms: number;
65
67
  }>;
68
+ export declare function getGeoSample(apiKey: string, orgId: string): Promise<Record<string, unknown>>;
package/dist/pixel.js CHANGED
@@ -1,11 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPOSES = void 0;
3
4
  exports.getInteractions = getInteractions;
4
5
  exports.getVisits = getVisits;
5
6
  exports.getEvents = getEvents;
6
7
  exports.getIdentity = getIdentity;
8
+ exports.getGeoSample = getGeoSample;
7
9
  const client_1 = require("./client");
8
10
  const config_1 = require("./config");
11
+ exports.EXPOSES = [
12
+ 'GET /pixel/orgs/{org_id}/interactions',
13
+ 'GET /pixel/orgs/{org_id}/visits',
14
+ 'GET /pixel/orgs/{org_id}/events',
15
+ 'GET /pixel/orgs/{org_id}/identity/{pixel_id}',
16
+ 'GET /pixel/orgs/{org_id}/audience/get_geo_sample',
17
+ ];
9
18
  async function getInteractions(apiKey, orgId, params) {
10
19
  const qs = new URLSearchParams();
11
20
  for (const [key, val] of Object.entries(params)) {
@@ -42,3 +51,9 @@ async function getEvents(apiKey, orgId, params) {
42
51
  async function getIdentity(apiKey, orgId, pixelId) {
43
52
  return (0, client_1.request)('GET', `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
44
53
  }
54
+ // Sample of geographic distribution of the org's pixel audience. Backend
55
+ // returns whatever shape it wants; we type as record-of-unknowns and let
56
+ // callers print or destructure as needed.
57
+ async function getGeoSample(apiKey, orgId) {
58
+ return (0, client_1.request)('GET', `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/audience/get_geo_sample`, apiKey);
59
+ }
@@ -0,0 +1,17 @@
1
+ export type ServiceStatus = 'ga' | 'preview' | 'planned';
2
+ export type ServiceCategory = 'send' | 'capture' | 'data' | 'store' | 'compute' | 'identity' | 'infra';
3
+ export interface ServiceMeta {
4
+ /** SDK namespace (also OpenAPI tag and CLI top-level command). */
5
+ module: string;
6
+ /** Skill name — used for: GitHub repo name, npm package name, plugin.json `name`, README headings. */
7
+ skill: string;
8
+ /** Brand domain we own (or want to own). Used for canonical links + npm/GitHub homepage. */
9
+ domain: string;
10
+ /** One-line description — used verbatim in npm description, GitHub repo description, plugin.json. */
11
+ description: string;
12
+ category: ServiceCategory;
13
+ status: ServiceStatus;
14
+ /** npm keywords + GitHub topics + PyPI classifiers. The first five are shared boilerplate. */
15
+ keywords: string[];
16
+ }
17
+ export declare const SERVICES: readonly ServiceMeta[];