@customyai/customy-sdk 0.1.0 → 0.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.
@@ -1,3 +1,5 @@
1
+ export { C as CUSTOMY_PLATFORM_SERVICE_KEYS, a as CUSTOMY_PRODUCT_KEYS, b as CustomyHttpMethod, c as CustomyPlatformServiceKey, d as CustomyPortfolioSdk, e as CustomyProductClient, f as CustomyProductClients, g as CustomyProductKey, h as CustomyQuery, i as CustomySdkConfig, j as CustomySdkError, k as CustomySdkKey, l as CustomySdkRequestOptions, m as createCustomySdk } from './portfolio-Bk9cn8h4.cjs';
2
+
1
3
  interface CustomyClientConfig {
2
4
  /** API key (sk-...) */
3
5
  apiKey: string;
@@ -411,77 +413,4 @@ declare class CustomyClient {
411
413
  };
412
414
  }
413
415
 
414
- /**
415
- * Product/service SDK boundary for the Customy portfolio.
416
- *
417
- * This layer deliberately owns transport, auth and tenant-safe URL handling
418
- * only. Domain methods belong in the SDK for the corresponding bounded
419
- * context once that service publishes its OpenAPI contract.
420
- */
421
- declare const CUSTOMY_PRODUCT_KEYS: readonly ["agent", "ads", "analytics", "atlas", "bookings", "campaigns", "commerce", "content", "crm", "data", "design", "domains", "engagement", "flows", "forms", "links", "mission-control", "pages", "payments", "send", "sitesight", "support", "tables", "tasks", "voice", "whatsapp", "work"];
422
- declare const CUSTOMY_PLATFORM_SERVICE_KEYS: readonly ["access", "audit", "billing", "events", "integrations", "realtime", "scheduler", "storage"];
423
- type CustomyProductKey = (typeof CUSTOMY_PRODUCT_KEYS)[number];
424
- type CustomyPlatformServiceKey = (typeof CUSTOMY_PLATFORM_SERVICE_KEYS)[number];
425
- type CustomySdkKey = CustomyProductKey | CustomyPlatformServiceKey;
426
- type CustomyHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
427
- type CustomyQuery = Record<string, string | number | boolean | null | undefined | Array<string | number | boolean>>;
428
- type CustomySdkRequestOptions = {
429
- query?: CustomyQuery;
430
- body?: unknown;
431
- headers?: Record<string, string>;
432
- signal?: AbortSignal;
433
- timeoutMs?: number;
434
- maxBytes?: number;
435
- };
436
- type CustomySdkConfig = {
437
- /** Shared fallback URL. Prefer `baseUrls` for multi-service applications. */
438
- baseUrl?: string;
439
- baseUrls?: Partial<Record<CustomySdkKey, string>>;
440
- apiKey?: string;
441
- bearerToken?: string;
442
- internalKey?: string;
443
- headers?: Record<string, string>;
444
- timeoutMs?: number;
445
- fetch?: typeof fetch;
446
- };
447
- declare class CustomySdkError extends Error {
448
- readonly product: CustomySdkKey;
449
- readonly status: number;
450
- readonly code: string;
451
- readonly body?: unknown | undefined;
452
- constructor(product: CustomySdkKey, status: number, code: string, body?: unknown | undefined);
453
- }
454
- /** One isolated client for one Customy bounded context. */
455
- declare class CustomyProductClient {
456
- readonly product: CustomySdkKey;
457
- private readonly configuredBaseUrl?;
458
- private readonly config;
459
- private readonly fetchImpl;
460
- constructor(product: CustomySdkKey, config: CustomySdkConfig);
461
- get baseUrl(): string;
462
- request<TResponse = unknown>(method: CustomyHttpMethod, path: string, options?: CustomySdkRequestOptions): Promise<TResponse>;
463
- get<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
464
- post<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
465
- put<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
466
- patch<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
467
- delete<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
468
- }
469
- type CustomyProductClients = {
470
- [K in CustomySdkKey]: CustomyProductClient;
471
- };
472
- /** One install with isolated clients for every Customy product and platform service. */
473
- declare class CustomyPortfolioSdk {
474
- readonly clients: CustomyProductClients;
475
- readonly products: {
476
- [K in CustomyProductKey]: CustomyProductClient;
477
- };
478
- readonly platform: {
479
- [K in CustomyPlatformServiceKey]: CustomyProductClient;
480
- };
481
- constructor(config: CustomySdkConfig);
482
- product<K extends CustomyProductKey>(key: K): CustomyProductClient;
483
- service<K extends CustomyPlatformServiceKey>(key: K): CustomyProductClient;
484
- }
485
- declare const createCustomySdk: (config: CustomySdkConfig) => CustomyPortfolioSdk;
486
-
487
- export { type AITriggerEvalResult, type AgentBrowserTask, type BrowserSession, type BrowserSessionAccount, type CRMContactCreateOptions, type CRMContactResult, CUSTOMY_PLATFORM_SERVICE_KEYS, CUSTOMY_PRODUCT_KEYS, CustomyClient, type CustomyClientConfig, type CustomyHttpMethod, type CustomyPlatformServiceKey, CustomyPortfolioSdk, CustomyProductClient, type CustomyProductClients, type CustomyProductKey, type CustomyQuery, type CustomySdkConfig, CustomySdkError, type CustomySdkKey, type CustomySdkRequestOptions, type EventPublishOptions, type EventPublishResult, type MarketplaceInstall, type MarketplaceListing, type PaginatedResponse, type PaymentIntentCreateOptions, type PaymentIntentResult, type TaskCreateOptions, type VoiceCallInitiateOptions, type VoiceCallResult, createCustomySdk };
416
+ export { type AITriggerEvalResult, type AgentBrowserTask, type BrowserSession, type BrowserSessionAccount, type CRMContactCreateOptions, type CRMContactResult, CustomyClient, type CustomyClientConfig, type EventPublishOptions, type EventPublishResult, type MarketplaceInstall, type MarketplaceListing, type PaginatedResponse, type PaymentIntentCreateOptions, type PaymentIntentResult, type TaskCreateOptions, type VoiceCallInitiateOptions, type VoiceCallResult };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { C as CUSTOMY_PLATFORM_SERVICE_KEYS, a as CUSTOMY_PRODUCT_KEYS, b as CustomyHttpMethod, c as CustomyPlatformServiceKey, d as CustomyPortfolioSdk, e as CustomyProductClient, f as CustomyProductClients, g as CustomyProductKey, h as CustomyQuery, i as CustomySdkConfig, j as CustomySdkError, k as CustomySdkKey, l as CustomySdkRequestOptions, m as createCustomySdk } from './portfolio-Bk9cn8h4.js';
2
+
1
3
  interface CustomyClientConfig {
2
4
  /** API key (sk-...) */
3
5
  apiKey: string;
@@ -411,77 +413,4 @@ declare class CustomyClient {
411
413
  };
412
414
  }
413
415
 
414
- /**
415
- * Product/service SDK boundary for the Customy portfolio.
416
- *
417
- * This layer deliberately owns transport, auth and tenant-safe URL handling
418
- * only. Domain methods belong in the SDK for the corresponding bounded
419
- * context once that service publishes its OpenAPI contract.
420
- */
421
- declare const CUSTOMY_PRODUCT_KEYS: readonly ["agent", "ads", "analytics", "atlas", "bookings", "campaigns", "commerce", "content", "crm", "data", "design", "domains", "engagement", "flows", "forms", "links", "mission-control", "pages", "payments", "send", "sitesight", "support", "tables", "tasks", "voice", "whatsapp", "work"];
422
- declare const CUSTOMY_PLATFORM_SERVICE_KEYS: readonly ["access", "audit", "billing", "events", "integrations", "realtime", "scheduler", "storage"];
423
- type CustomyProductKey = (typeof CUSTOMY_PRODUCT_KEYS)[number];
424
- type CustomyPlatformServiceKey = (typeof CUSTOMY_PLATFORM_SERVICE_KEYS)[number];
425
- type CustomySdkKey = CustomyProductKey | CustomyPlatformServiceKey;
426
- type CustomyHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
427
- type CustomyQuery = Record<string, string | number | boolean | null | undefined | Array<string | number | boolean>>;
428
- type CustomySdkRequestOptions = {
429
- query?: CustomyQuery;
430
- body?: unknown;
431
- headers?: Record<string, string>;
432
- signal?: AbortSignal;
433
- timeoutMs?: number;
434
- maxBytes?: number;
435
- };
436
- type CustomySdkConfig = {
437
- /** Shared fallback URL. Prefer `baseUrls` for multi-service applications. */
438
- baseUrl?: string;
439
- baseUrls?: Partial<Record<CustomySdkKey, string>>;
440
- apiKey?: string;
441
- bearerToken?: string;
442
- internalKey?: string;
443
- headers?: Record<string, string>;
444
- timeoutMs?: number;
445
- fetch?: typeof fetch;
446
- };
447
- declare class CustomySdkError extends Error {
448
- readonly product: CustomySdkKey;
449
- readonly status: number;
450
- readonly code: string;
451
- readonly body?: unknown | undefined;
452
- constructor(product: CustomySdkKey, status: number, code: string, body?: unknown | undefined);
453
- }
454
- /** One isolated client for one Customy bounded context. */
455
- declare class CustomyProductClient {
456
- readonly product: CustomySdkKey;
457
- private readonly configuredBaseUrl?;
458
- private readonly config;
459
- private readonly fetchImpl;
460
- constructor(product: CustomySdkKey, config: CustomySdkConfig);
461
- get baseUrl(): string;
462
- request<TResponse = unknown>(method: CustomyHttpMethod, path: string, options?: CustomySdkRequestOptions): Promise<TResponse>;
463
- get<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
464
- post<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
465
- put<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
466
- patch<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
467
- delete<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
468
- }
469
- type CustomyProductClients = {
470
- [K in CustomySdkKey]: CustomyProductClient;
471
- };
472
- /** One install with isolated clients for every Customy product and platform service. */
473
- declare class CustomyPortfolioSdk {
474
- readonly clients: CustomyProductClients;
475
- readonly products: {
476
- [K in CustomyProductKey]: CustomyProductClient;
477
- };
478
- readonly platform: {
479
- [K in CustomyPlatformServiceKey]: CustomyProductClient;
480
- };
481
- constructor(config: CustomySdkConfig);
482
- product<K extends CustomyProductKey>(key: K): CustomyProductClient;
483
- service<K extends CustomyPlatformServiceKey>(key: K): CustomyProductClient;
484
- }
485
- declare const createCustomySdk: (config: CustomySdkConfig) => CustomyPortfolioSdk;
486
-
487
- export { type AITriggerEvalResult, type AgentBrowserTask, type BrowserSession, type BrowserSessionAccount, type CRMContactCreateOptions, type CRMContactResult, CUSTOMY_PLATFORM_SERVICE_KEYS, CUSTOMY_PRODUCT_KEYS, CustomyClient, type CustomyClientConfig, type CustomyHttpMethod, type CustomyPlatformServiceKey, CustomyPortfolioSdk, CustomyProductClient, type CustomyProductClients, type CustomyProductKey, type CustomyQuery, type CustomySdkConfig, CustomySdkError, type CustomySdkKey, type CustomySdkRequestOptions, type EventPublishOptions, type EventPublishResult, type MarketplaceInstall, type MarketplaceListing, type PaginatedResponse, type PaymentIntentCreateOptions, type PaymentIntentResult, type TaskCreateOptions, type VoiceCallInitiateOptions, type VoiceCallResult, createCustomySdk };
416
+ export { type AITriggerEvalResult, type AgentBrowserTask, type BrowserSession, type BrowserSessionAccount, type CRMContactCreateOptions, type CRMContactResult, CustomyClient, type CustomyClientConfig, type EventPublishOptions, type EventPublishResult, type MarketplaceInstall, type MarketplaceListing, type PaginatedResponse, type PaymentIntentCreateOptions, type PaymentIntentResult, type TaskCreateOptions, type VoiceCallInitiateOptions, type VoiceCallResult };
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ export { CUSTOMY_PLATFORM_SERVICE_KEYS, CUSTOMY_PRODUCT_KEYS, CustomyPortfolioSdk, CustomyProductClient, CustomySdkError, createCustomySdk } from './chunk-2TLSPDBG.mjs';
2
+
1
3
  // src/client.ts
2
4
  var CustomyClient = class {
3
5
  baseUrl;
@@ -230,179 +232,4 @@ var CustomyAPIError = class extends Error {
230
232
  body;
231
233
  };
232
234
 
233
- // src/portfolio.ts
234
- var CUSTOMY_PRODUCT_KEYS = [
235
- "agent",
236
- "ads",
237
- "analytics",
238
- "atlas",
239
- "bookings",
240
- "campaigns",
241
- "commerce",
242
- "content",
243
- "crm",
244
- "data",
245
- "design",
246
- "domains",
247
- "engagement",
248
- "flows",
249
- "forms",
250
- "links",
251
- "mission-control",
252
- "pages",
253
- "payments",
254
- "send",
255
- "sitesight",
256
- "support",
257
- "tables",
258
- "tasks",
259
- "voice",
260
- "whatsapp",
261
- "work"
262
- ];
263
- var CUSTOMY_PLATFORM_SERVICE_KEYS = [
264
- "access",
265
- "audit",
266
- "billing",
267
- "events",
268
- "integrations",
269
- "realtime",
270
- "scheduler",
271
- "storage"
272
- ];
273
- var CustomySdkError = class extends Error {
274
- constructor(product, status, code, body) {
275
- super(`Customy ${product} SDK request failed (${status}): ${code}`);
276
- this.product = product;
277
- this.status = status;
278
- this.code = code;
279
- this.body = body;
280
- this.name = "CustomySdkError";
281
- }
282
- product;
283
- status;
284
- code;
285
- body;
286
- };
287
- function normalizeBaseUrl(value, product) {
288
- if (!value) throw new CustomySdkError(product, 0, "SDK_BASE_URL_REQUIRED");
289
- let url;
290
- try {
291
- url = new URL(value);
292
- } catch {
293
- throw new CustomySdkError(product, 0, "SDK_BASE_URL_INVALID");
294
- }
295
- if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash)
296
- throw new CustomySdkError(product, 0, "SDK_BASE_URL_INVALID");
297
- return url.toString().replace(/\/$/, "");
298
- }
299
- function buildUrl(baseUrl, path, query, product) {
300
- if (!path.startsWith("/") || path.startsWith("//") || path.includes("..")) throw new CustomySdkError(product, 0, "SDK_PATH_INVALID");
301
- const url = new URL(path, `${baseUrl}/`);
302
- for (const [key, value] of Object.entries(query ?? {})) {
303
- if (value === void 0 || value === null) continue;
304
- if (Array.isArray(value)) for (const item of value) url.searchParams.append(key, String(item));
305
- else url.searchParams.set(key, String(value));
306
- }
307
- return url;
308
- }
309
- async function readBody(response, maxBytes) {
310
- if (response.status === 204) return null;
311
- const text = await response.text();
312
- if (new TextEncoder().encode(text).byteLength > maxBytes) throw new Error("SDK_RESPONSE_TOO_LARGE");
313
- if (!text) return null;
314
- try {
315
- return JSON.parse(text);
316
- } catch {
317
- return text;
318
- }
319
- }
320
- var CustomyProductClient = class {
321
- product;
322
- configuredBaseUrl;
323
- config;
324
- fetchImpl;
325
- constructor(product, config) {
326
- this.product = product;
327
- this.config = config;
328
- this.configuredBaseUrl = config.baseUrls?.[product] ?? config.baseUrl;
329
- this.fetchImpl = config.fetch ?? globalThis.fetch;
330
- if (!this.fetchImpl) throw new CustomySdkError(product, 0, "SDK_FETCH_REQUIRED");
331
- }
332
- get baseUrl() {
333
- return normalizeBaseUrl(this.configuredBaseUrl, this.product);
334
- }
335
- async request(method, path, options = {}) {
336
- const url = buildUrl(this.baseUrl, path, options.query, this.product);
337
- const controller = new AbortController();
338
- const signal = options.signal ? AbortSignal.any([options.signal, controller.signal]) : controller.signal;
339
- const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? this.config.timeoutMs ?? 3e4);
340
- const headers = { accept: "application/json", ...this.config.headers, ...options.headers };
341
- if (options.body !== void 0) headers["content-type"] ??= "application/json";
342
- if (this.config.apiKey || this.config.bearerToken) headers.authorization ??= `Bearer ${this.config.bearerToken ?? this.config.apiKey}`;
343
- if (this.config.internalKey) headers["x-internal-key"] ??= this.config.internalKey;
344
- try {
345
- const response = await this.fetchImpl(url, { method, headers, body: options.body === void 0 ? void 0 : JSON.stringify(options.body), cache: "no-store", credentials: "omit", redirect: "error", signal });
346
- let body;
347
- try {
348
- body = await readBody(response, options.maxBytes ?? 4 * 1024 * 1024);
349
- } catch (error) {
350
- if (error instanceof Error && error.message === "SDK_RESPONSE_TOO_LARGE") throw new CustomySdkError(this.product, 413, "SDK_RESPONSE_TOO_LARGE");
351
- throw new CustomySdkError(this.product, 502, "SDK_RESPONSE_INVALID");
352
- }
353
- if (!response.ok) {
354
- const code = body && typeof body === "object" && "code" in body && typeof body.code === "string" ? body.code : `HTTP_${response.status}`;
355
- throw new CustomySdkError(this.product, response.status, code, body);
356
- }
357
- return body;
358
- } catch (error) {
359
- if (error instanceof CustomySdkError) throw error;
360
- if (error instanceof DOMException && error.name === "AbortError") throw new CustomySdkError(this.product, 408, "SDK_TIMEOUT");
361
- throw new CustomySdkError(this.product, 503, "SDK_UNAVAILABLE");
362
- } finally {
363
- clearTimeout(timeout);
364
- }
365
- }
366
- get(path, options) {
367
- return this.request("GET", path, options);
368
- }
369
- post(path, body, options) {
370
- return this.request("POST", path, { ...options, body });
371
- }
372
- put(path, body, options) {
373
- return this.request("PUT", path, { ...options, body });
374
- }
375
- patch(path, body, options) {
376
- return this.request("PATCH", path, { ...options, body });
377
- }
378
- delete(path, options) {
379
- return this.request("DELETE", path, options);
380
- }
381
- };
382
- var CustomyPortfolioSdk = class {
383
- clients;
384
- products;
385
- platform;
386
- constructor(config) {
387
- const keys = [...CUSTOMY_PRODUCT_KEYS, ...CUSTOMY_PLATFORM_SERVICE_KEYS];
388
- this.clients = Object.fromEntries(keys.map((key) => [key, new CustomyProductClient(key, config)]));
389
- this.products = Object.fromEntries(CUSTOMY_PRODUCT_KEYS.map((key) => [key, this.clients[key]]));
390
- this.platform = Object.fromEntries(CUSTOMY_PLATFORM_SERVICE_KEYS.map((key) => [key, this.clients[key]]));
391
- }
392
- product(key) {
393
- return this.products[key];
394
- }
395
- service(key) {
396
- return this.platform[key];
397
- }
398
- };
399
- var createCustomySdk = (config) => new CustomyPortfolioSdk(config);
400
- export {
401
- CUSTOMY_PLATFORM_SERVICE_KEYS,
402
- CUSTOMY_PRODUCT_KEYS,
403
- CustomyClient,
404
- CustomyPortfolioSdk,
405
- CustomyProductClient,
406
- CustomySdkError,
407
- createCustomySdk
408
- };
235
+ export { CustomyClient };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Product/service SDK boundary for the Customy portfolio.
3
+ *
4
+ * This layer deliberately owns transport, auth and tenant-safe URL handling
5
+ * only. Domain methods belong in the SDK for the corresponding bounded
6
+ * context once that service publishes its OpenAPI contract.
7
+ */
8
+ declare const CUSTOMY_PRODUCT_KEYS: readonly ["agent", "ads", "analytics", "atlas", "bookings", "campaigns", "commerce", "content", "crm", "data", "design", "domains", "engagement", "flows", "forms", "links", "mission-control", "pages", "payments", "send", "sitesight", "support", "tables", "tasks", "voice", "whatsapp", "work"];
9
+ declare const CUSTOMY_PLATFORM_SERVICE_KEYS: readonly ["access", "audit", "billing", "events", "integrations", "realtime", "scheduler", "storage"];
10
+ type CustomyProductKey = (typeof CUSTOMY_PRODUCT_KEYS)[number];
11
+ type CustomyPlatformServiceKey = (typeof CUSTOMY_PLATFORM_SERVICE_KEYS)[number];
12
+ type CustomySdkKey = CustomyProductKey | CustomyPlatformServiceKey;
13
+ type CustomyHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
14
+ type CustomyQuery = Record<string, string | number | boolean | null | undefined | Array<string | number | boolean>>;
15
+ type CustomySdkRequestOptions = {
16
+ query?: CustomyQuery;
17
+ body?: unknown;
18
+ headers?: Record<string, string>;
19
+ signal?: AbortSignal;
20
+ timeoutMs?: number;
21
+ maxBytes?: number;
22
+ };
23
+ type CustomySdkConfig = {
24
+ /** Shared fallback URL. Prefer `baseUrls` for multi-service applications. */
25
+ baseUrl?: string;
26
+ baseUrls?: Partial<Record<CustomySdkKey, string>>;
27
+ apiKey?: string;
28
+ bearerToken?: string;
29
+ /**
30
+ * Proveedor de tokens de Customy Access (p. ej. `createMachineTokenProvider`
31
+ * de `@customyai/customy-access/server`); se pide un token vigente por request.
32
+ */
33
+ accessToken?: () => Promise<string>;
34
+ internalKey?: string;
35
+ headers?: Record<string, string>;
36
+ timeoutMs?: number;
37
+ fetch?: typeof fetch;
38
+ };
39
+ declare class CustomySdkError extends Error {
40
+ readonly product: CustomySdkKey;
41
+ readonly status: number;
42
+ readonly code: string;
43
+ readonly body?: unknown | undefined;
44
+ constructor(product: CustomySdkKey, status: number, code: string, body?: unknown | undefined);
45
+ }
46
+ /** One isolated client for one Customy bounded context. */
47
+ declare class CustomyProductClient {
48
+ readonly product: CustomySdkKey;
49
+ private readonly configuredBaseUrl?;
50
+ private readonly config;
51
+ private readonly fetchImpl;
52
+ constructor(product: CustomySdkKey, config: CustomySdkConfig);
53
+ get baseUrl(): string;
54
+ request<TResponse = unknown>(method: CustomyHttpMethod, path: string, options?: CustomySdkRequestOptions): Promise<TResponse>;
55
+ get<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
56
+ post<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
57
+ put<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
58
+ patch<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
59
+ delete<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
60
+ }
61
+ type CustomyProductClients = {
62
+ [K in CustomySdkKey]: CustomyProductClient;
63
+ };
64
+ /** One install with isolated clients for every Customy product and platform service. */
65
+ declare class CustomyPortfolioSdk {
66
+ readonly clients: CustomyProductClients;
67
+ readonly products: {
68
+ [K in CustomyProductKey]: CustomyProductClient;
69
+ };
70
+ readonly platform: {
71
+ [K in CustomyPlatformServiceKey]: CustomyProductClient;
72
+ };
73
+ constructor(config: CustomySdkConfig);
74
+ product<K extends CustomyProductKey>(key: K): CustomyProductClient;
75
+ service<K extends CustomyPlatformServiceKey>(key: K): CustomyProductClient;
76
+ }
77
+ declare const createCustomySdk: (config: CustomySdkConfig) => CustomyPortfolioSdk;
78
+
79
+ export { CUSTOMY_PLATFORM_SERVICE_KEYS as C, CUSTOMY_PRODUCT_KEYS as a, type CustomyHttpMethod as b, type CustomyPlatformServiceKey as c, CustomyPortfolioSdk as d, CustomyProductClient as e, type CustomyProductClients as f, type CustomyProductKey as g, type CustomyQuery as h, type CustomySdkConfig as i, CustomySdkError as j, type CustomySdkKey as k, type CustomySdkRequestOptions as l, createCustomySdk as m };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Product/service SDK boundary for the Customy portfolio.
3
+ *
4
+ * This layer deliberately owns transport, auth and tenant-safe URL handling
5
+ * only. Domain methods belong in the SDK for the corresponding bounded
6
+ * context once that service publishes its OpenAPI contract.
7
+ */
8
+ declare const CUSTOMY_PRODUCT_KEYS: readonly ["agent", "ads", "analytics", "atlas", "bookings", "campaigns", "commerce", "content", "crm", "data", "design", "domains", "engagement", "flows", "forms", "links", "mission-control", "pages", "payments", "send", "sitesight", "support", "tables", "tasks", "voice", "whatsapp", "work"];
9
+ declare const CUSTOMY_PLATFORM_SERVICE_KEYS: readonly ["access", "audit", "billing", "events", "integrations", "realtime", "scheduler", "storage"];
10
+ type CustomyProductKey = (typeof CUSTOMY_PRODUCT_KEYS)[number];
11
+ type CustomyPlatformServiceKey = (typeof CUSTOMY_PLATFORM_SERVICE_KEYS)[number];
12
+ type CustomySdkKey = CustomyProductKey | CustomyPlatformServiceKey;
13
+ type CustomyHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
14
+ type CustomyQuery = Record<string, string | number | boolean | null | undefined | Array<string | number | boolean>>;
15
+ type CustomySdkRequestOptions = {
16
+ query?: CustomyQuery;
17
+ body?: unknown;
18
+ headers?: Record<string, string>;
19
+ signal?: AbortSignal;
20
+ timeoutMs?: number;
21
+ maxBytes?: number;
22
+ };
23
+ type CustomySdkConfig = {
24
+ /** Shared fallback URL. Prefer `baseUrls` for multi-service applications. */
25
+ baseUrl?: string;
26
+ baseUrls?: Partial<Record<CustomySdkKey, string>>;
27
+ apiKey?: string;
28
+ bearerToken?: string;
29
+ /**
30
+ * Proveedor de tokens de Customy Access (p. ej. `createMachineTokenProvider`
31
+ * de `@customyai/customy-access/server`); se pide un token vigente por request.
32
+ */
33
+ accessToken?: () => Promise<string>;
34
+ internalKey?: string;
35
+ headers?: Record<string, string>;
36
+ timeoutMs?: number;
37
+ fetch?: typeof fetch;
38
+ };
39
+ declare class CustomySdkError extends Error {
40
+ readonly product: CustomySdkKey;
41
+ readonly status: number;
42
+ readonly code: string;
43
+ readonly body?: unknown | undefined;
44
+ constructor(product: CustomySdkKey, status: number, code: string, body?: unknown | undefined);
45
+ }
46
+ /** One isolated client for one Customy bounded context. */
47
+ declare class CustomyProductClient {
48
+ readonly product: CustomySdkKey;
49
+ private readonly configuredBaseUrl?;
50
+ private readonly config;
51
+ private readonly fetchImpl;
52
+ constructor(product: CustomySdkKey, config: CustomySdkConfig);
53
+ get baseUrl(): string;
54
+ request<TResponse = unknown>(method: CustomyHttpMethod, path: string, options?: CustomySdkRequestOptions): Promise<TResponse>;
55
+ get<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
56
+ post<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
57
+ put<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
58
+ patch<TResponse = unknown>(path: string, body?: unknown, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
59
+ delete<TResponse = unknown>(path: string, options?: Omit<CustomySdkRequestOptions, "body">): Promise<TResponse>;
60
+ }
61
+ type CustomyProductClients = {
62
+ [K in CustomySdkKey]: CustomyProductClient;
63
+ };
64
+ /** One install with isolated clients for every Customy product and platform service. */
65
+ declare class CustomyPortfolioSdk {
66
+ readonly clients: CustomyProductClients;
67
+ readonly products: {
68
+ [K in CustomyProductKey]: CustomyProductClient;
69
+ };
70
+ readonly platform: {
71
+ [K in CustomyPlatformServiceKey]: CustomyProductClient;
72
+ };
73
+ constructor(config: CustomySdkConfig);
74
+ product<K extends CustomyProductKey>(key: K): CustomyProductClient;
75
+ service<K extends CustomyPlatformServiceKey>(key: K): CustomyProductClient;
76
+ }
77
+ declare const createCustomySdk: (config: CustomySdkConfig) => CustomyPortfolioSdk;
78
+
79
+ export { CUSTOMY_PLATFORM_SERVICE_KEYS as C, CUSTOMY_PRODUCT_KEYS as a, type CustomyHttpMethod as b, type CustomyPlatformServiceKey as c, CustomyPortfolioSdk as d, CustomyProductClient as e, type CustomyProductClients as f, type CustomyProductKey as g, type CustomyQuery as h, type CustomySdkConfig as i, CustomySdkError as j, type CustomySdkKey as k, type CustomySdkRequestOptions as l, createCustomySdk as m };