@joai/sdk 2.3.0 → 4.0.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 +84 -61
- package/dist/index.mjs +10 -6
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -37,7 +37,8 @@ interface IRequestOptions {
|
|
|
37
37
|
type SocialAuthProvider = 'github' | 'apple' | 'google' | 'x' | 'telegram' | 'slack'; //#endregion
|
|
38
38
|
//#region src/config/types.d.ts
|
|
39
39
|
type AppEnv = 'mainnet' | 'testnet' | 'devnet' | 'local'; //#endregion
|
|
40
|
-
//#region src/
|
|
40
|
+
//#region src/auth/token.d.ts
|
|
41
|
+
/** One-time native/deep-link handoff param (exchanged for a Bearer via API). */
|
|
41
42
|
//#endregion
|
|
42
43
|
//#region src/ingestion/types.d.ts
|
|
43
44
|
type IngestionSourceType = 'note' | 'meeting' | 'article' | 'email' | 'chat' | 'post' | 'webhook';
|
|
@@ -724,7 +725,7 @@ type OrderItem = {
|
|
|
724
725
|
name: string;
|
|
725
726
|
quantity: number;
|
|
726
727
|
unitPrice: number;
|
|
727
|
-
type: 'product-variation' | 'service';
|
|
728
|
+
type: 'product-variation' | 'service' | 'coupon';
|
|
728
729
|
digital?: boolean | null;
|
|
729
730
|
sellerTeamId?: string | null;
|
|
730
731
|
};
|
|
@@ -758,6 +759,7 @@ type Order = {
|
|
|
758
759
|
notes: string | null;
|
|
759
760
|
configuration?: OrderConfigurationItem[];
|
|
760
761
|
items: OrderItem[];
|
|
762
|
+
coupon?: Coupon | null;
|
|
761
763
|
plan: Plan | null;
|
|
762
764
|
user: UserPrivate | null;
|
|
763
765
|
team: TeamPrivate | null;
|
|
@@ -799,6 +801,7 @@ type Coupon = {
|
|
|
799
801
|
amount: number | null;
|
|
800
802
|
percent: number | null;
|
|
801
803
|
price: number | null;
|
|
804
|
+
discount?: number;
|
|
802
805
|
condition: CouponCondition;
|
|
803
806
|
restrictedItems: CouponRestrictedItem[];
|
|
804
807
|
usesLeft: number | null;
|
|
@@ -837,7 +840,7 @@ type Skill = {
|
|
|
837
840
|
screenshots: string[];
|
|
838
841
|
}; //#endregion
|
|
839
842
|
//#region src/integration/types.d.ts
|
|
840
|
-
type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
|
|
843
|
+
type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'whatsapp-personal' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'xchat' | 'instagram' | 'grok' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
|
|
841
844
|
type IntegrationDetails = {
|
|
842
845
|
type: IntegrationType;
|
|
843
846
|
name: string;
|
|
@@ -851,8 +854,16 @@ type IntegrationDetails = {
|
|
|
851
854
|
type IntegrationMeta = {
|
|
852
855
|
handle?: string;
|
|
853
856
|
provider?: EmailProvider | null;
|
|
857
|
+
hookSource?: string;
|
|
854
858
|
[key: string]: unknown;
|
|
855
859
|
};
|
|
860
|
+
type IntegrationConnectionDetails = IntegrationDetails & {
|
|
861
|
+
phoneNumberId?: string;
|
|
862
|
+
phoneNumber?: string;
|
|
863
|
+
webhookUrl?: string;
|
|
864
|
+
webhookSecret?: string;
|
|
865
|
+
webhookSecretKey?: string;
|
|
866
|
+
};
|
|
856
867
|
type Integration = {
|
|
857
868
|
id: string;
|
|
858
869
|
type: IntegrationType;
|
|
@@ -861,9 +872,9 @@ type Integration = {
|
|
|
861
872
|
configured: boolean;
|
|
862
873
|
createdAt: string;
|
|
863
874
|
meta?: IntegrationMeta;
|
|
864
|
-
details?:
|
|
875
|
+
details?: IntegrationConnectionDetails;
|
|
865
876
|
};
|
|
866
|
-
type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'sms' | 'discord' | 'github';
|
|
877
|
+
type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'sms' | 'discord' | 'github' | 'xchat' | 'instagram';
|
|
867
878
|
type SocialBot = {
|
|
868
879
|
name: string;
|
|
869
880
|
createdAt: string;
|
|
@@ -1167,51 +1178,6 @@ type BrandBackend = {
|
|
|
1167
1178
|
integrations?: Partial<Record<BrandIntegrationProvider, BrandIntegration>>;
|
|
1168
1179
|
};
|
|
1169
1180
|
};
|
|
1170
|
-
//#endregion
|
|
1171
|
-
//#region src/store/types.d.ts
|
|
1172
|
-
type StoreVisibility = 'private' | 'team' | 'public';
|
|
1173
|
-
type StoreEntry = {
|
|
1174
|
-
value: number | string | boolean;
|
|
1175
|
-
label?: string;
|
|
1176
|
-
at: string;
|
|
1177
|
-
};
|
|
1178
|
-
type Store = {
|
|
1179
|
-
name: string;
|
|
1180
|
-
description: string;
|
|
1181
|
-
valueType: 'scalar' | 'series';
|
|
1182
|
-
unit?: string;
|
|
1183
|
-
visibility: StoreVisibility;
|
|
1184
|
-
entryCount: number;
|
|
1185
|
-
lastValue?: number | string | boolean;
|
|
1186
|
-
lastAt?: string;
|
|
1187
|
-
};
|
|
1188
|
-
type StoreWithEntries = {
|
|
1189
|
-
name: string;
|
|
1190
|
-
description: string;
|
|
1191
|
-
unit?: string;
|
|
1192
|
-
entries: StoreEntry[];
|
|
1193
|
-
};
|
|
1194
|
-
type StoreCreatePayload = {
|
|
1195
|
-
name: string;
|
|
1196
|
-
description?: string;
|
|
1197
|
-
valueType?: 'scalar' | 'series';
|
|
1198
|
-
unit?: string;
|
|
1199
|
-
visibility?: StoreVisibility;
|
|
1200
|
-
};
|
|
1201
|
-
type StoreEntryPayload = {
|
|
1202
|
-
storeName?: string;
|
|
1203
|
-
value: number | string | boolean;
|
|
1204
|
-
label?: string;
|
|
1205
|
-
};
|
|
1206
|
-
type StoreEntryResult = {
|
|
1207
|
-
name: string;
|
|
1208
|
-
entryCount: number;
|
|
1209
|
-
};
|
|
1210
|
-
type StoreToggleResult = {
|
|
1211
|
-
name: string;
|
|
1212
|
-
value: number | string | boolean;
|
|
1213
|
-
previous: number | string | boolean;
|
|
1214
|
-
};
|
|
1215
1181
|
type StorePricing = {
|
|
1216
1182
|
model: PricingModel;
|
|
1217
1183
|
amount: string;
|
|
@@ -1518,6 +1484,7 @@ type AppointmentPolicy = {
|
|
|
1518
1484
|
serviceSelectionEnabled?: boolean | null;
|
|
1519
1485
|
paymentEnabled?: boolean | null;
|
|
1520
1486
|
bookingCapacity?: number | null;
|
|
1487
|
+
bookingCapacityUnit?: 'booking' | 'person' | null;
|
|
1521
1488
|
requireApproval?: boolean | null;
|
|
1522
1489
|
sync?: AppointmentPolicySync | null;
|
|
1523
1490
|
agent?: Agent | null;
|
|
@@ -1793,6 +1760,7 @@ type Item = {
|
|
|
1793
1760
|
};
|
|
1794
1761
|
type ItemCreatePayload = {
|
|
1795
1762
|
title: string;
|
|
1763
|
+
source?: 'user' | 'api';
|
|
1796
1764
|
description?: string;
|
|
1797
1765
|
priority?: ItemPriority;
|
|
1798
1766
|
tags?: string[];
|
|
@@ -1815,6 +1783,48 @@ type ItemUpdatePayload = {
|
|
|
1815
1783
|
contactIds?: string[];
|
|
1816
1784
|
assignedToIds?: string[];
|
|
1817
1785
|
}; //#endregion
|
|
1786
|
+
//#region src/kv/types.d.ts
|
|
1787
|
+
type KvValue = number | string | boolean;
|
|
1788
|
+
type KvEntry = {
|
|
1789
|
+
value: KvValue;
|
|
1790
|
+
label?: string | null;
|
|
1791
|
+
at: string;
|
|
1792
|
+
};
|
|
1793
|
+
type KvField = {
|
|
1794
|
+
name: string;
|
|
1795
|
+
description: string | null;
|
|
1796
|
+
valueType: 'scalar' | 'series';
|
|
1797
|
+
unit: string | null;
|
|
1798
|
+
entryCount: number;
|
|
1799
|
+
lastValue?: KvValue | null;
|
|
1800
|
+
lastAt?: string | null;
|
|
1801
|
+
};
|
|
1802
|
+
type KvFieldWithEntries = Pick<KvField, 'name' | 'description' | 'unit'> & {
|
|
1803
|
+
entries: KvEntry[];
|
|
1804
|
+
};
|
|
1805
|
+
type CreateKvFieldPayload = {
|
|
1806
|
+
name: string;
|
|
1807
|
+
description?: string;
|
|
1808
|
+
valueType?: 'scalar' | 'series';
|
|
1809
|
+
unit?: string;
|
|
1810
|
+
};
|
|
1811
|
+
type KvEntryPayload = {
|
|
1812
|
+
field?: string;
|
|
1813
|
+
value: KvValue;
|
|
1814
|
+
label?: string;
|
|
1815
|
+
};
|
|
1816
|
+
type SetKvEntryResult = KvEntry & {
|
|
1817
|
+
name: string;
|
|
1818
|
+
};
|
|
1819
|
+
type AppendKvEntryResult = {
|
|
1820
|
+
name: string;
|
|
1821
|
+
entryCount: number;
|
|
1822
|
+
};
|
|
1823
|
+
type ToggleKvFieldResult = {
|
|
1824
|
+
name: string;
|
|
1825
|
+
value: KvValue;
|
|
1826
|
+
previous: KvValue | null;
|
|
1827
|
+
}; //#endregion
|
|
1818
1828
|
//#region src/marketing/types.d.ts
|
|
1819
1829
|
//#endregion
|
|
1820
1830
|
//#region src/mcp/types.d.ts
|
|
@@ -2781,7 +2791,17 @@ type CreateWebHookPayload = {
|
|
|
2781
2791
|
type CreateWarpLinkedHookPayload = {
|
|
2782
2792
|
warpIdentifier: string;
|
|
2783
2793
|
};
|
|
2784
|
-
type
|
|
2794
|
+
type CreateInboundHookPayload = {
|
|
2795
|
+
source: string;
|
|
2796
|
+
warpIdentifier: string;
|
|
2797
|
+
trigger?: HookTrigger;
|
|
2798
|
+
};
|
|
2799
|
+
type CreateHookPayload = CreateInternalHookPayload | CreateWebHookPayload | CreateWarpLinkedHookPayload | CreateInboundHookPayload;
|
|
2800
|
+
type HookSample = {
|
|
2801
|
+
source: string;
|
|
2802
|
+
payload: Record<string, unknown> | null;
|
|
2803
|
+
recordedAt: string | null;
|
|
2804
|
+
}; //#endregion
|
|
2785
2805
|
//#region src/workspace/types.d.ts
|
|
2786
2806
|
type WorkspaceInfo = {
|
|
2787
2807
|
id?: string;
|
|
@@ -3064,6 +3084,7 @@ type AuthSendCodeRequest = {
|
|
|
3064
3084
|
table?: string;
|
|
3065
3085
|
};
|
|
3066
3086
|
type AuthVerifyResponse = {
|
|
3087
|
+
token: string;
|
|
3067
3088
|
user: AuthUser;
|
|
3068
3089
|
team: {
|
|
3069
3090
|
slug: string;
|
|
@@ -4021,18 +4042,19 @@ declare class StatsResource {
|
|
|
4021
4042
|
declare class KvResource {
|
|
4022
4043
|
private readonly http;
|
|
4023
4044
|
constructor(http: IHttpService);
|
|
4024
|
-
list(): Promise<IAppResponse<
|
|
4025
|
-
create(payload:
|
|
4045
|
+
list(): Promise<IAppResponse<KvField[]>>;
|
|
4046
|
+
create(payload: CreateKvFieldPayload): Promise<IAppResponse<KvField>>;
|
|
4026
4047
|
entries(params?: {
|
|
4027
|
-
|
|
4048
|
+
field?: string;
|
|
4028
4049
|
since?: string;
|
|
4029
4050
|
until?: string;
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4051
|
+
page?: number;
|
|
4052
|
+
perPage?: number;
|
|
4053
|
+
}): Promise<IAppResponse<KvFieldWithEntries>>;
|
|
4054
|
+
setEntry(payload: KvEntryPayload): Promise<IAppResponse<SetKvEntryResult>>;
|
|
4055
|
+
appendEntry(payload: KvEntryPayload): Promise<IAppResponse<AppendKvEntryResult>>;
|
|
4056
|
+
toggle(field?: string): Promise<IAppResponse<ToggleKvFieldResult>>;
|
|
4057
|
+
delete(field: string): Promise<IAppResponse<void>>;
|
|
4036
4058
|
}
|
|
4037
4059
|
//#endregion
|
|
4038
4060
|
//#region src/resources/subscriptions.d.ts
|
|
@@ -4402,6 +4424,7 @@ declare class HooksResource {
|
|
|
4402
4424
|
constructor(http: IHttpService);
|
|
4403
4425
|
list(agentId: string): Promise<IAppResponse<Hook[]>>;
|
|
4404
4426
|
create(agentId: string, payload: CreateHookPayload): Promise<IAppResponse<Hook>>;
|
|
4427
|
+
sample(agentId: string, source: string): Promise<IAppResponse<HookSample>>;
|
|
4405
4428
|
toggle(agentId: string, hookId: string): Promise<IAppResponse<Hook>>;
|
|
4406
4429
|
removeByHook(agentId: string, hookId: string): Promise<IAppResponse<void>>;
|
|
4407
4430
|
removeByWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
|
|
@@ -4532,4 +4555,4 @@ declare class DistributionResource {
|
|
|
4532
4555
|
private fetchDistribution;
|
|
4533
4556
|
}
|
|
4534
4557
|
//#endregion
|
|
4535
|
-
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 };
|
|
4558
|
+
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 CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, type Hook, type HookSample, 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
|
@@ -1874,10 +1874,11 @@ var KvResource = class {
|
|
|
1874
1874
|
}
|
|
1875
1875
|
entries(params) {
|
|
1876
1876
|
const query = new URLSearchParams();
|
|
1877
|
-
if (params?.
|
|
1877
|
+
if (params?.field) query.set("field", params.field);
|
|
1878
1878
|
if (params?.since) query.set("since", params.since);
|
|
1879
1879
|
if (params?.until) query.set("until", params.until);
|
|
1880
|
-
if (params?.
|
|
1880
|
+
if (params?.page != null) query.set("page", String(params.page));
|
|
1881
|
+
if (params?.perPage != null) query.set("perPage", String(params.perPage));
|
|
1881
1882
|
const qs = query.toString();
|
|
1882
1883
|
return this.http.get(`kv/entries${qs ? "?" + qs : ""}`);
|
|
1883
1884
|
}
|
|
@@ -1887,11 +1888,11 @@ var KvResource = class {
|
|
|
1887
1888
|
appendEntry(payload) {
|
|
1888
1889
|
return this.http.post("kv/entries/append", payload);
|
|
1889
1890
|
}
|
|
1890
|
-
toggle(
|
|
1891
|
-
return this.http.post("kv/toggle", {
|
|
1891
|
+
toggle(field) {
|
|
1892
|
+
return this.http.post("kv/toggle", { field });
|
|
1892
1893
|
}
|
|
1893
|
-
delete(
|
|
1894
|
-
return this.http.delete(`kv/${
|
|
1894
|
+
delete(field) {
|
|
1895
|
+
return this.http.delete(`kv/${encodeURIComponent(field)}`);
|
|
1895
1896
|
}
|
|
1896
1897
|
};
|
|
1897
1898
|
//#endregion
|
|
@@ -2472,6 +2473,9 @@ var HooksResource = class {
|
|
|
2472
2473
|
create(agentId, payload) {
|
|
2473
2474
|
return this.http.post(`hooks?agent=${agentId}`, payload);
|
|
2474
2475
|
}
|
|
2476
|
+
sample(agentId, source) {
|
|
2477
|
+
return this.http.get(`hooks/sample?agent=${agentId}&source=${encodeURIComponent(source)}`);
|
|
2478
|
+
}
|
|
2475
2479
|
toggle(agentId, hookId) {
|
|
2476
2480
|
return this.http.post(`hooks/${hookId}/toggle?agent=${agentId}`);
|
|
2477
2481
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joai/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "JoAi public API SDK — build with your AI agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsdown",
|
|
34
|
-
"dev": "tsdown --watch"
|
|
34
|
+
"dev": "tsdown --watch",
|
|
35
|
+
"test": "jest --config jest.config.js"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@joai/warps": "*"
|