@joai/sdk 2.1.0 → 2.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.
package/dist/index.d.mts CHANGED
@@ -2715,64 +2715,67 @@ type RampProviderInfo = {
2715
2715
  active: boolean;
2716
2716
  }; //#endregion
2717
2717
  //#region src/warp-webhooks/types.d.ts
2718
- type AgentWebhookTriggerCondition = {
2718
+ type HookTriggerCondition = {
2719
2719
  path: string;
2720
2720
  operator: 'exists' | 'equals' | 'contains' | 'not_contains';
2721
2721
  value?: unknown;
2722
2722
  };
2723
- type AgentWebhookTriggerInput = string | {
2723
+ type HookTriggerInput = string | {
2724
2724
  source: 'payload';
2725
2725
  path: string;
2726
2726
  } | {
2727
2727
  source: 'literal';
2728
2728
  value: unknown;
2729
2729
  };
2730
- type AgentWebhookTrigger = {
2730
+ type HookTrigger = {
2731
2731
  event?: string;
2732
2732
  contract?: string;
2733
- when?: AgentWebhookTriggerCondition[];
2734
- inputs?: Record<string, AgentWebhookTriggerInput>;
2733
+ when?: HookTriggerCondition[];
2734
+ inputs?: Record<string, HookTriggerInput>;
2735
2735
  };
2736
- type AgentWebhookWarp = {
2737
- id: number;
2736
+ type WebHookTriggerEvent = 'agent.action' | 'agent.message' | 'agent.activity' | 'user.message' | 'external.message';
2737
+ type Hook = {
2738
+ id: string;
2738
2739
  source: string;
2739
2740
  event?: string | null;
2740
2741
  contract?: string | null;
2741
- next: string;
2742
+ trigger?: HookTrigger | null;
2743
+ triggerEvent?: string | null;
2744
+ next: string | null;
2745
+ name?: string | null;
2746
+ url?: string | null;
2747
+ headers?: Record<string, string> | null;
2748
+ verifySsl?: boolean;
2749
+ timeout?: number;
2750
+ maxRetries?: number;
2751
+ lastTriggeredAt?: string | null;
2752
+ description?: string | null;
2742
2753
  active: boolean;
2743
2754
  managed: boolean;
2744
- trigger?: AgentWebhookTrigger | null;
2745
2755
  warpIdentifier: string | null;
2746
2756
  createdAt: string;
2747
2757
  };
2748
- type ActivateAgentWebhookWarpPayload = {
2758
+ type CreateInternalHookPayload = {
2759
+ source: 'internal';
2749
2760
  warpIdentifier: string;
2750
- source?: 'internal';
2751
- trigger?: AgentWebhookTrigger;
2752
- }; //#endregion
2753
- //#region src/webhook/types.d.ts
2754
- type WebhookTriggerEvent = 'agent.action' | 'agent.message' | 'user.message';
2755
- type Webhook = {
2756
- id: string;
2761
+ trigger?: HookTrigger;
2762
+ };
2763
+ type CreateWebHookPayload = {
2764
+ source: 'web';
2757
2765
  name: string;
2758
2766
  url: string;
2759
- trigger: WebhookTriggerEvent;
2760
- headers: Record<string, string>;
2761
- description: string | null;
2762
- active: boolean;
2763
- verifySsl: boolean;
2764
- timeout: number;
2765
- maxRetries: number;
2766
- lastTriggeredAt: string | null;
2767
- createdAt: string;
2768
- updatedAt: string;
2769
- webhookableType: string;
2770
- webhookable?: {
2771
- type: string;
2772
- uuid: string;
2773
- name: string;
2774
- };
2775
- }; //#endregion
2767
+ trigger: WebHookTriggerEvent;
2768
+ headers?: Record<string, string>;
2769
+ description?: string;
2770
+ active?: boolean;
2771
+ verifySsl?: boolean;
2772
+ timeout?: number;
2773
+ maxRetries?: number;
2774
+ };
2775
+ type CreateWarpLinkedHookPayload = {
2776
+ warpIdentifier: string;
2777
+ };
2778
+ type CreateHookPayload = CreateInternalHookPayload | CreateWebHookPayload | CreateWarpLinkedHookPayload; //#endregion
2776
2779
  //#region src/workspace/types.d.ts
2777
2780
  type WorkspaceInfo = {
2778
2781
  id?: string;
@@ -4383,35 +4386,15 @@ declare class WarpsResource {
4383
4386
  fetchSourceSchemaFromUrl(url: string): Promise<IAppResponse<any>>;
4384
4387
  }
4385
4388
  //#endregion
4386
- //#region src/resources/webhooks.d.ts
4387
- declare class WebhooksResource {
4389
+ //#region src/resources/hooks.d.ts
4390
+ declare class HooksResource {
4388
4391
  private readonly http;
4389
4392
  constructor(http: IHttpService);
4390
- list(agentId: string): Promise<IAppResponse<Webhook[]>>;
4391
- create(agentId: string, name: string, url: string, trigger: WebhookTriggerEvent, options?: {
4392
- headers?: Record<string, string>;
4393
- description?: string;
4394
- active?: boolean;
4395
- verifySsl?: boolean;
4396
- timeout?: number;
4397
- maxRetries?: number;
4398
- }): Promise<IAppResponse<Webhook>>;
4399
- update(agentId: string, webhookId: string, updates: {
4400
- name?: string;
4401
- url?: string;
4402
- trigger?: WebhookTriggerEvent;
4403
- headers?: Record<string, string>;
4404
- description?: string;
4405
- active?: boolean;
4406
- verifySsl?: boolean;
4407
- timeout?: number;
4408
- maxRetries?: number;
4409
- }): Promise<IAppResponse<Webhook>>;
4410
- delete(agentId: string, webhookId: string): Promise<IAppResponse<void>>;
4411
- listWarps(agentId: string): Promise<IAppResponse<AgentWebhookWarp[]>>;
4412
- activateWarp(agentId: string, payload: ActivateAgentWebhookWarpPayload): Promise<IAppResponse<AgentWebhookWarp>>;
4413
- deactivateWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
4414
- deleteWarpHook(agentId: string, webhookId: number): Promise<IAppResponse<void>>;
4393
+ list(agentId: string): Promise<IAppResponse<Hook[]>>;
4394
+ create(agentId: string, payload: CreateHookPayload): Promise<IAppResponse<Hook>>;
4395
+ toggle(agentId: string, hookId: string): Promise<IAppResponse<Hook>>;
4396
+ removeByHook(agentId: string, hookId: string): Promise<IAppResponse<void>>;
4397
+ removeByWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
4415
4398
  }
4416
4399
  //#endregion
4417
4400
  //#region src/cache/types.d.ts
@@ -4499,7 +4482,7 @@ declare class JoAiClient {
4499
4482
  readonly users: UsersResource;
4500
4483
  readonly voice: VoiceResource;
4501
4484
  readonly wallets: WalletsResource;
4502
- readonly webhooks: WebhooksResource;
4485
+ readonly hooks: HooksResource;
4503
4486
  readonly workspace: WorkspaceResource;
4504
4487
  constructor(config: JoAiClientConfig);
4505
4488
  clearCache(): void;
@@ -4539,4 +4522,4 @@ declare class DistributionResource {
4539
4522
  private fetchDistribution;
4540
4523
  }
4541
4524
  //#endregion
4542
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
4525
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, type CreateHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, type Hook, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, createClient, formatOpeningHours };
package/dist/index.mjs CHANGED
@@ -2455,39 +2455,25 @@ var WarpsResource = class {
2455
2455
  }
2456
2456
  };
2457
2457
  //#endregion
2458
- //#region src/resources/webhooks.ts
2459
- var WebhooksResource = class {
2458
+ //#region src/resources/hooks.ts
2459
+ var HooksResource = class {
2460
2460
  constructor(http) {
2461
2461
  this.http = http;
2462
2462
  }
2463
2463
  list(agentId) {
2464
- return this.http.get(`agents/${agentId}/webhooks`);
2464
+ return this.http.get(`hooks?agent=${agentId}`);
2465
2465
  }
2466
- create(agentId, name, url, trigger, options) {
2467
- return this.http.post(`agents/${agentId}/webhooks`, {
2468
- name,
2469
- url,
2470
- trigger,
2471
- ...options
2472
- });
2473
- }
2474
- update(agentId, webhookId, updates) {
2475
- return this.http.patch(`agents/${agentId}/webhooks/${webhookId}`, updates);
2476
- }
2477
- delete(agentId, webhookId) {
2478
- return this.http.delete(`agents/${agentId}/webhooks/${webhookId}`);
2479
- }
2480
- listWarps(agentId) {
2481
- return this.http.get(`agents/${agentId}/webhook-warps`);
2466
+ create(agentId, payload) {
2467
+ return this.http.post(`hooks?agent=${agentId}`, payload);
2482
2468
  }
2483
- activateWarp(agentId, payload) {
2484
- return this.http.post(`agents/${agentId}/webhook-warps`, payload);
2469
+ toggle(agentId, hookId) {
2470
+ return this.http.post(`hooks/${hookId}/toggle?agent=${agentId}`);
2485
2471
  }
2486
- deactivateWarp(agentId, warpIdentifier) {
2487
- return this.http.delete(`agents/${agentId}/webhook-warps?warpIdentifier=${encodeURIComponent(warpIdentifier)}`);
2472
+ removeByHook(agentId, hookId) {
2473
+ return this.http.delete(`hooks?agent=${agentId}&hookId=${encodeURIComponent(hookId)}`);
2488
2474
  }
2489
- deleteWarpHook(agentId, webhookId) {
2490
- return this.http.delete(`agents/${agentId}/webhook-warps?webhookId=${encodeURIComponent(webhookId)}`);
2475
+ removeByWarp(agentId, warpIdentifier) {
2476
+ return this.http.delete(`hooks?agent=${agentId}&warpIdentifier=${encodeURIComponent(warpIdentifier)}`);
2491
2477
  }
2492
2478
  };
2493
2479
  //#endregion
@@ -2690,7 +2676,7 @@ var JoAiClient = class {
2690
2676
  this.users = new UsersResource(this.http);
2691
2677
  this.voice = new VoiceResource(this.http);
2692
2678
  this.wallets = new WalletsResource(this.http);
2693
- this.webhooks = new WebhooksResource(this.http);
2679
+ this.hooks = new HooksResource(this.http);
2694
2680
  this.workspace = new WorkspaceResource(this.http);
2695
2681
  }
2696
2682
  clearCache() {
@@ -2736,4 +2722,4 @@ var DistributionResource = class {
2736
2722
  }
2737
2723
  };
2738
2724
  //#endregion
2739
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
2725
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, createClient, formatOpeningHours };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",