@arcadeai/design-system 1.1.0 → 1.3.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/README.md +1 -1
- package/dist/arcade-49z5mR1G.js +1541 -0
- package/dist/assets/icons/arcade.d.ts +3 -0
- package/dist/assets/icons/arcade.js +33 -0
- package/dist/assets/icons/google-docs.js +110 -120
- package/dist/assets/icons/index.d.ts +1 -0
- package/dist/assets/icons/index.js +124 -122
- package/dist/assets/icons/utils.d.ts +26 -0
- package/dist/assets/icons/utils.js +155 -138
- package/dist/components/index.js +188 -172
- package/dist/components/ui/atoms/accordion.js +1 -1
- package/dist/components/ui/atoms/alert.js +2 -2
- package/dist/components/ui/atoms/avatar.js +1 -1
- package/dist/components/ui/atoms/badge.js +2 -2
- package/dist/components/ui/atoms/breadcrumb.js +13 -15
- package/dist/components/ui/atoms/button.js +2 -2
- package/dist/components/ui/atoms/byoc-badge.js +2 -2
- package/dist/components/ui/atoms/card.js +1 -1
- package/dist/components/ui/atoms/chart.js +1 -1
- package/dist/components/ui/atoms/checkbox.d.ts +4 -0
- package/dist/components/ui/atoms/checkbox.js +268 -0
- package/dist/components/ui/atoms/command.js +2 -2
- package/dist/components/ui/atoms/dialog.js +8 -8
- package/dist/components/ui/atoms/dropdown-menu.js +2 -2
- package/dist/components/ui/atoms/form.d.ts +1 -1
- package/dist/components/ui/atoms/form.js +8 -7
- package/dist/components/ui/atoms/hover-card.js +2 -2
- package/dist/components/ui/atoms/index.d.ts +1 -0
- package/dist/components/ui/atoms/index.js +168 -165
- package/dist/components/ui/atoms/input.js +1 -1
- package/dist/components/ui/atoms/label.js +1 -1
- package/dist/components/ui/atoms/popover.js +2 -2
- package/dist/components/ui/atoms/pro-badge.js +2 -2
- package/dist/components/ui/atoms/progress.js +1 -1
- package/dist/components/ui/atoms/radio-group.js +1 -1
- package/dist/components/ui/atoms/resizable.js +24 -1527
- package/dist/components/ui/atoms/scroll-area.js +1 -1
- package/dist/components/ui/atoms/select.js +2 -2
- package/dist/components/ui/atoms/separator.js +1 -1
- package/dist/components/ui/atoms/sheet.js +2 -2
- package/dist/components/ui/atoms/sidebar.js +3 -3
- package/dist/components/ui/atoms/skeleton.js +1 -1
- package/dist/components/ui/atoms/slider.js +1 -1
- package/dist/components/ui/atoms/switch.js +1 -1
- package/dist/components/ui/atoms/table.js +1 -1
- package/dist/components/ui/atoms/tabs.js +1 -1
- package/dist/components/ui/atoms/textarea.js +1 -1
- package/dist/components/ui/atoms/toggle.js +2 -2
- package/dist/components/ui/atoms/tooltip.js +60 -60
- package/dist/components/ui/atoms/view-tools-control.d.ts +12 -0
- package/dist/components/ui/atoms/view-tools-control.js +53 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +188 -172
- package/dist/components/ui/molecules/empty-state.d.ts +5 -0
- package/dist/components/ui/molecules/empty-state.js +25 -0
- package/dist/components/ui/molecules/index.d.ts +6 -0
- package/dist/components/ui/molecules/index.js +13 -0
- package/dist/components/ui/molecules/requirement-badges.d.ts +29 -0
- package/dist/components/ui/molecules/requirement-badges.js +24 -0
- package/dist/components/ui/molecules/tool-card.d.ts +17 -0
- package/dist/components/ui/molecules/tool-card.js +127 -0
- package/dist/components/ui/molecules/toolkit-card.d.ts +24 -0
- package/dist/components/ui/molecules/toolkit-card.js +13 -0
- package/dist/components/ui/molecules/toolkit-picker-trigger.d.ts +8 -0
- package/dist/components/ui/molecules/toolkit-picker-trigger.js +96 -0
- package/dist/components/ui/molecules/toolkit-selection-summary.d.ts +10 -0
- package/dist/components/ui/molecules/toolkit-selection-summary.js +117 -0
- package/dist/components/ui/organisms/index.d.ts +1 -0
- package/dist/components/ui/organisms/index.js +4 -0
- package/dist/components/ui/organisms/toolkit-picker/components/footer-summary.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/components/footer-summary.js +36 -0
- package/dist/components/ui/organisms/toolkit-picker/components/mobile-filter-badges.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/components/mobile-filter-badges.js +96 -0
- package/dist/components/ui/organisms/toolkit-picker/components/search-input.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/components/search-input.js +36 -0
- package/dist/components/ui/organisms/toolkit-picker/components/select-button.d.ts +9 -0
- package/dist/components/ui/organisms/toolkit-picker/components/select-button.js +35 -0
- package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.d.ts +9 -0
- package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.js +36 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-filter.test.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-filter.test.js +44 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-search.test.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-search.test.js +46 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-selection.test.d.ts +1 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-selection.test.js +28 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.d.ts +40 -0
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.js +267 -0
- package/dist/components/ui/organisms/toolkit-picker/index.d.ts +14 -0
- package/dist/components/ui/organisms/toolkit-picker/index.js +16 -0
- package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.d.ts +7 -0
- package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.js +432 -0
- package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.d.ts +2 -0
- package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.js +395 -0
- package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.test.d.ts +0 -0
- package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.test.js +12832 -0
- package/dist/components/ui/utils/memo.d.ts +2 -0
- package/dist/components/ui/utils/memo.js +25 -0
- package/dist/{index-CQhYMnjT.js → index-BDE30rcJ.js} +1 -1
- package/dist/{index-PlrlSrPo.js → index-DEJd-dpa.js} +1 -1
- package/dist/{index-BSWzylXR.js → index-Ez2mlmzx.js} +2 -2
- package/dist/lib/arcade/arcade.d.ts +100 -0
- package/dist/lib/arcade/arcade.js +5 -0
- package/dist/lib/arcade/arcade.test.d.ts +1 -0
- package/dist/lib/arcade/arcade.test.js +299 -0
- package/dist/lib/arcade/mocks.d.ts +2 -0
- package/dist/lib/arcade/mocks.js +547 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.js +3 -2
- package/dist/magic-string.es-BQ9KnLz-.js +659 -0
- package/dist/main.js +188 -172
- package/dist/react-resizable-panels.browser-ZHjTH32c.js +1509 -0
- package/dist/react.esm-369wBsAv.js +35565 -0
- package/dist/toolkit-card-GhM_oj4G.js +304 -0
- package/dist/{utils-CRiPKpXj.js → utils-Db4QWi-E.js} +204 -189
- package/dist/vi.bdSIJ99Y-CZgZQPWH.js +11996 -0
- package/package.json +39 -30
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function f(n) {
|
|
2
|
+
return function(e, t) {
|
|
3
|
+
for (const r of n) {
|
|
4
|
+
const o = e[r], u = t[r];
|
|
5
|
+
if (!Object.is(o, u))
|
|
6
|
+
return !1;
|
|
7
|
+
}
|
|
8
|
+
return !0;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function i(n, a) {
|
|
12
|
+
const e = n ?? [], t = a ?? [];
|
|
13
|
+
if (e === t)
|
|
14
|
+
return !0;
|
|
15
|
+
if (e.length !== t.length)
|
|
16
|
+
return !1;
|
|
17
|
+
for (let r = 0; r < e.length; r++)
|
|
18
|
+
if (e[r] !== t[r])
|
|
19
|
+
return !1;
|
|
20
|
+
return !0;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
i as areStringArraysEqual,
|
|
24
|
+
f as createPropsComparator
|
|
25
|
+
};
|
|
@@ -345,7 +345,7 @@ const We = (t) => ({
|
|
|
345
345
|
const C = ((($ = r.flip) == null ? void 0 : $.index) || 0) + 1, F = P[C];
|
|
346
346
|
if (F && (!(u === "alignment" ? x !== z(F) : !1) || // We leave the current main axis only if every placement on that axis
|
|
347
347
|
// overflows the main axis.
|
|
348
|
-
L.every((b) => b.overflows[0] > 0
|
|
348
|
+
L.every((b) => z(b.placement) === x ? b.overflows[0] > 0 : !0)))
|
|
349
349
|
return {
|
|
350
350
|
data: {
|
|
351
351
|
index: C,
|
|
@@ -232,12 +232,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
232
232
|
}, [a, e, t]), null;
|
|
233
233
|
}, he = x, Pe = T, Ee = M, ye = w, Ne = F, Oe = W, Ie = G, xe = $;
|
|
234
234
|
export {
|
|
235
|
-
|
|
235
|
+
Ne as C,
|
|
236
236
|
Ie as D,
|
|
237
237
|
ye as O,
|
|
238
238
|
Ee as P,
|
|
239
239
|
he as R,
|
|
240
240
|
Pe as T,
|
|
241
|
-
|
|
241
|
+
xe as a,
|
|
242
242
|
Oe as b
|
|
243
243
|
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Arcade } from '@arcadeai/arcadejs';
|
|
2
|
+
import { ToolDefinition } from '@arcadeai/arcadejs/resources/index.mjs';
|
|
3
|
+
export type Toolkit = ToolDefinition.Toolkit & {
|
|
4
|
+
tools: ToolDefinition[];
|
|
5
|
+
isByoc?: boolean;
|
|
6
|
+
isPro?: boolean;
|
|
7
|
+
requirements: {
|
|
8
|
+
met: boolean;
|
|
9
|
+
secrets?: Arcade.Tools.ToolDefinition.Requirements.Secret[];
|
|
10
|
+
authorization?: Arcade.Tools.ToolDefinition.Requirements.Authorization[];
|
|
11
|
+
scopes?: Record<string, string[]>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type ProcessedToolkit = Toolkit & {
|
|
15
|
+
searchableText: string;
|
|
16
|
+
requirementsSummary: {
|
|
17
|
+
secrets?: {
|
|
18
|
+
configured: string[];
|
|
19
|
+
pending: string[];
|
|
20
|
+
};
|
|
21
|
+
oauth?: {
|
|
22
|
+
providers: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
status: 'active' | 'inactive';
|
|
25
|
+
scopes: string[];
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type ProcessedTool = ToolDefinition & {
|
|
31
|
+
searchableText: string;
|
|
32
|
+
};
|
|
33
|
+
export type ToolkitCollection = {
|
|
34
|
+
toolkits: ProcessedToolkit[];
|
|
35
|
+
tools: ProcessedTool[];
|
|
36
|
+
toolkitMap: Map<string, ProcessedToolkit>;
|
|
37
|
+
toolToToolkitMap: Map<string, string>;
|
|
38
|
+
searchIndex: {
|
|
39
|
+
toolkitsByName: Map<string, ProcessedToolkit>;
|
|
40
|
+
toolsByName: Map<string, ProcessedTool>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
type ArcadeConfig = {
|
|
44
|
+
/**
|
|
45
|
+
* A unique identifier for your app or organization, used to authenticate and track requests.
|
|
46
|
+
*/
|
|
47
|
+
arcadeClientId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The base URL for the Arcade API.
|
|
50
|
+
*/
|
|
51
|
+
baseURL?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The API key for the Arcade API.
|
|
54
|
+
*/
|
|
55
|
+
apiKey?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The access token for the Arcade API.
|
|
58
|
+
*/
|
|
59
|
+
accessToken?: string;
|
|
60
|
+
};
|
|
61
|
+
export type GetToolsProps = {
|
|
62
|
+
limit?: number;
|
|
63
|
+
offset?: number;
|
|
64
|
+
toolkit?: string;
|
|
65
|
+
};
|
|
66
|
+
export declare class ArcadeClient {
|
|
67
|
+
#private;
|
|
68
|
+
constructor(config: ArcadeConfig);
|
|
69
|
+
static create(config: ArcadeConfig): Arcade;
|
|
70
|
+
getAllTools(props?: GetToolsProps): Promise<ToolDefinition[]>;
|
|
71
|
+
groupToolsBy(groupKey: keyof ToolDefinition): Promise<Map<string, ToolDefinition>>;
|
|
72
|
+
getToolkits(): Promise<Map<string, Toolkit>>;
|
|
73
|
+
getToolsForToolkit(toolkit: string): Promise<ToolDefinition[]>;
|
|
74
|
+
private applyToolRequirements;
|
|
75
|
+
private mergeSecrets;
|
|
76
|
+
private mergeAuthorizations;
|
|
77
|
+
private mergeScopes;
|
|
78
|
+
/**
|
|
79
|
+
* Pre-compute requirements summary for optimal UI performance.
|
|
80
|
+
* This eliminates the need for runtime transformation in UI components.
|
|
81
|
+
*/
|
|
82
|
+
private computeRequirementsSummary;
|
|
83
|
+
/**
|
|
84
|
+
* Process raw toolkit data into an optimized collection with pre-computed search indices.
|
|
85
|
+
*
|
|
86
|
+
* @returns ToolkitCollection with:
|
|
87
|
+
* - Pre-computed searchable text for fast filtering
|
|
88
|
+
* - Pre-computed requirement badges (no runtime processing needed)
|
|
89
|
+
* - Search indices for O(1) lookups
|
|
90
|
+
* - Toolkit/tool mapping for quick relationships
|
|
91
|
+
*/
|
|
92
|
+
getProcessedToolkitCollection(): Promise<ToolkitCollection>;
|
|
93
|
+
/**
|
|
94
|
+
* Helper function to create normalized searchable text from multiple strings.
|
|
95
|
+
* Separates compound terms (like Gmail.List_emails) into individual searchable components.
|
|
96
|
+
* Handles camelCase, snake_case, kebab-case, and dot.notation.
|
|
97
|
+
*/
|
|
98
|
+
private normalizeText;
|
|
99
|
+
}
|
|
100
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { A as i, a as c } from "../../arcade-49z5mR1G.js";
|
|
2
|
+
import { allTools as m } from "./mocks.js";
|
|
3
|
+
import { v as l, d as u, b as p, i as s, g as e } from "../../vi.bdSIJ99Y-CZgZQPWH.js";
|
|
4
|
+
const d = {
|
|
5
|
+
tools: {
|
|
6
|
+
list: l.fn().mockImplementation((o) => {
|
|
7
|
+
let t = m;
|
|
8
|
+
return o?.toolkit && (t = m.filter(
|
|
9
|
+
(a) => a.toolkit.name.toLowerCase() === o.toolkit.toLowerCase()
|
|
10
|
+
)), Promise.resolve({
|
|
11
|
+
items: t
|
|
12
|
+
});
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
l.mock("@arcadeai/arcadejs", () => ({
|
|
17
|
+
Arcade: l.fn().mockImplementation(() => d)
|
|
18
|
+
}));
|
|
19
|
+
l.mock("../utils", () => ({
|
|
20
|
+
// biome-ignore lint/suspicious/noEmptyBlockStatements: This is a mock
|
|
21
|
+
resolveEnv: l.fn(() => {
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
u("Arcade Tests", () => {
|
|
25
|
+
p(() => {
|
|
26
|
+
l.clearAllMocks();
|
|
27
|
+
}), s("should create an arcade instance", () => {
|
|
28
|
+
const o = new i({
|
|
29
|
+
arcadeClientId: "test-client-id",
|
|
30
|
+
apiKey: "test-api-key"
|
|
31
|
+
});
|
|
32
|
+
e(o).toBeDefined();
|
|
33
|
+
}), s("should create an arcade instance with access token", () => {
|
|
34
|
+
const o = new i({
|
|
35
|
+
arcadeClientId: "test-client-id",
|
|
36
|
+
accessToken: "test-token"
|
|
37
|
+
});
|
|
38
|
+
e(o).toBeDefined(), e(c).toHaveBeenCalledWith(
|
|
39
|
+
e.objectContaining({
|
|
40
|
+
defaultHeaders: e.objectContaining({
|
|
41
|
+
"Arcade-Client-Id": "test-client-id",
|
|
42
|
+
Authorization: "Bearer test-token"
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}), s("should create an arcade instance with API key", () => {
|
|
47
|
+
const o = new i({
|
|
48
|
+
arcadeClientId: "test-client-id",
|
|
49
|
+
apiKey: "test-api-key"
|
|
50
|
+
});
|
|
51
|
+
e(o).toBeDefined(), e(c).toHaveBeenCalledWith(
|
|
52
|
+
e.objectContaining({
|
|
53
|
+
apiKey: "test-api-key",
|
|
54
|
+
defaultHeaders: e.not.objectContaining({
|
|
55
|
+
Authorization: e.any(String)
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}), s("should create an arcade instance with all config options", () => {
|
|
60
|
+
const o = new i({
|
|
61
|
+
arcadeClientId: "test-client-id",
|
|
62
|
+
accessToken: "test-token",
|
|
63
|
+
apiKey: "test-api-key"
|
|
64
|
+
});
|
|
65
|
+
e(o).toBeDefined(), e(c).toHaveBeenCalledWith(
|
|
66
|
+
e.objectContaining({
|
|
67
|
+
apiKey: "test-api-key",
|
|
68
|
+
defaultHeaders: e.not.objectContaining({
|
|
69
|
+
Authorization: e.any(String)
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
}), s("should use static create method", () => {
|
|
74
|
+
const o = i.create({
|
|
75
|
+
arcadeClientId: "test-client-id",
|
|
76
|
+
apiKey: "test-api-key"
|
|
77
|
+
});
|
|
78
|
+
e(o).toBeDefined();
|
|
79
|
+
}), s("should return all tools", async () => {
|
|
80
|
+
const t = await new i({
|
|
81
|
+
arcadeClientId: "test-client-id",
|
|
82
|
+
apiKey: "test-api-key"
|
|
83
|
+
}).getAllTools();
|
|
84
|
+
e(t).toBeDefined(), e(t).toHaveLength(16);
|
|
85
|
+
}), s("should pass default limit/offset to list call", async () => {
|
|
86
|
+
await new i({
|
|
87
|
+
arcadeClientId: "test-client-id",
|
|
88
|
+
apiKey: "test-api-key"
|
|
89
|
+
}).getAllTools(), e(d.tools.list).toHaveBeenCalledWith(
|
|
90
|
+
e.objectContaining({ limit: 1e3, offset: 0 })
|
|
91
|
+
);
|
|
92
|
+
}), s("should filter tools by toolkit", async () => {
|
|
93
|
+
const t = await new i({
|
|
94
|
+
arcadeClientId: "test-client-id",
|
|
95
|
+
apiKey: "test-api-key"
|
|
96
|
+
}).getAllTools({ toolkit: "E2b" });
|
|
97
|
+
e(t).toBeDefined(), e(t).toHaveLength(1), e(t[0].name).toBe("CreateStaticMatplotlibChart"), e(t[0].toolkit.name).toBe("E2b");
|
|
98
|
+
}), s("should pass provided limit/offset/toolkit to list call", async () => {
|
|
99
|
+
await new i({
|
|
100
|
+
arcadeClientId: "test-client-id",
|
|
101
|
+
apiKey: "test-api-key"
|
|
102
|
+
}).getAllTools({ toolkit: "Gmail", limit: 5, offset: 10 }), e(d.tools.list).toHaveBeenCalledWith(
|
|
103
|
+
e.objectContaining({ toolkit: "Gmail", limit: 5, offset: 10 })
|
|
104
|
+
);
|
|
105
|
+
}), s("should filter tools by toolkit case insensitive", async () => {
|
|
106
|
+
const o = new i({
|
|
107
|
+
arcadeClientId: "test-client-id",
|
|
108
|
+
apiKey: "test-api-key"
|
|
109
|
+
}), t = await o.getAllTools({ toolkit: "e2b" });
|
|
110
|
+
e(t).toBeDefined(), e(t).toHaveLength(1), e(t[0].name).toBe("CreateStaticMatplotlibChart"), e(t[0].toolkit.name).toBe("E2b");
|
|
111
|
+
const a = await o.getAllTools({ toolkit: "E2B" });
|
|
112
|
+
e(a).toBeDefined(), e(a).toHaveLength(1), e(a[0].name).toBe("CreateStaticMatplotlibChart"), e(a[0].toolkit.name).toBe("E2b");
|
|
113
|
+
const n = await o.getAllTools({ toolkit: "E2B" });
|
|
114
|
+
e(n).toBeDefined(), e(n).toHaveLength(1), e(n[0].name).toBe("CreateStaticMatplotlibChart"), e(n[0].toolkit.name).toBe("E2b");
|
|
115
|
+
}), s("should process basic toolkit with no requirements", async () => {
|
|
116
|
+
const t = await new i({
|
|
117
|
+
arcadeClientId: "test-client-id",
|
|
118
|
+
apiKey: "test-api-key"
|
|
119
|
+
}).getToolkits();
|
|
120
|
+
e(t.get("basic")).toBeDefined(), e(t.get("basic")?.tools).toHaveLength(1), e(t.get("basic")?.requirements.met).toBe(!0), e(t.get("basic")?.requirements.secrets).toHaveLength(0), e(t.get("basic")?.requirements.authorization).toHaveLength(0), e(t.get("basic")?.requirements.scopes).toEqual({});
|
|
121
|
+
}), s("should process API toolkit with secret requirements", async () => {
|
|
122
|
+
const t = await new i({
|
|
123
|
+
arcadeClientId: "test-client-id",
|
|
124
|
+
apiKey: "test-api-key"
|
|
125
|
+
}).getToolkits();
|
|
126
|
+
e(t.get("api_toolkit")).toBeDefined(), e(t.get("api_toolkit")?.requirements.met).toBe(!1), e(t.get("api_toolkit")?.requirements.secrets).toHaveLength(3), e(
|
|
127
|
+
t.get("api_toolkit")?.requirements.secrets?.find((a) => a.key === "GROQ_API_KEY")
|
|
128
|
+
).toBeDefined(), e(
|
|
129
|
+
t.get("api_toolkit")?.requirements.secrets?.find((a) => a.key === "OPENAI_API_KEY")
|
|
130
|
+
).toBeDefined(), e(
|
|
131
|
+
t.get("api_toolkit")?.requirements.secrets?.find((a) => a.key === "ARCADE_API_KEY")
|
|
132
|
+
).not.toBeDefined();
|
|
133
|
+
}), s("should process OAuth toolkit with authorization requirements", async () => {
|
|
134
|
+
const t = await new i({
|
|
135
|
+
arcadeClientId: "test-client-id",
|
|
136
|
+
apiKey: "test-api-key"
|
|
137
|
+
}).getToolkits();
|
|
138
|
+
e(t.get("oauth_toolkit")).toBeDefined(), e(t.get("oauth_toolkit")?.requirements.met).toBe(!1), e(
|
|
139
|
+
t.get("oauth_toolkit")?.requirements.authorization
|
|
140
|
+
).toHaveLength(1), e(t.get("oauth_toolkit")?.requirements.scopes).toEqual({
|
|
141
|
+
google: [
|
|
142
|
+
"https://www.googleapis.com/auth/calendar.readonly",
|
|
143
|
+
"https://www.googleapis.com/auth/drive",
|
|
144
|
+
"https://www.googleapis.com/auth/gmail.readonly"
|
|
145
|
+
]
|
|
146
|
+
}), e(t.get("oauth_toolkit")?.requirements.secrets).toHaveLength(0);
|
|
147
|
+
}), s("should process GitHub toolkit with specific scopes", async () => {
|
|
148
|
+
const t = await new i({
|
|
149
|
+
arcadeClientId: "test-client-id",
|
|
150
|
+
apiKey: "test-api-key"
|
|
151
|
+
}).getToolkits();
|
|
152
|
+
e(t.get("github_toolkit")).toBeDefined(), e(t.get("github_toolkit")?.requirements.met).toBe(!1), e(
|
|
153
|
+
t.get("github_toolkit")?.requirements.authorization?.find((a) => a.provider_id === "github")
|
|
154
|
+
).toBeDefined(), e(t.get("github_toolkit")?.requirements.scopes).toEqual({
|
|
155
|
+
github: ["repo", "user", "issues"]
|
|
156
|
+
});
|
|
157
|
+
}), s("should process Google toolkit with met requirements", async () => {
|
|
158
|
+
const t = await new i({
|
|
159
|
+
arcadeClientId: "test-client-id",
|
|
160
|
+
apiKey: "test-api-key"
|
|
161
|
+
}).getToolkits();
|
|
162
|
+
e(t.get("Google")).toBeDefined(), e(t.get("Google")?.requirements.met).toBe(!0), e(t.get("Google")?.requirements.authorization).toHaveLength(1), e(t.get("Google")?.requirements.scopes).toEqual({
|
|
163
|
+
google: ["https://www.googleapis.com/auth/drive.file"]
|
|
164
|
+
});
|
|
165
|
+
}), s("should process E2b toolkit with unmet secret requirements", async () => {
|
|
166
|
+
const t = await new i({
|
|
167
|
+
arcadeClientId: "test-client-id",
|
|
168
|
+
apiKey: "test-api-key"
|
|
169
|
+
}).getToolkits();
|
|
170
|
+
e(t.get("E2b")).toBeDefined(), e(t.get("E2b")?.requirements.met).toBe(!1), e(t.get("E2b")?.requirements.secrets).toHaveLength(1), e(t.get("E2b")?.requirements.secrets?.[0]).toEqual({
|
|
171
|
+
key: "e2b_api_key",
|
|
172
|
+
met: !1,
|
|
173
|
+
status_reason: "Secret e2b_api_key not found"
|
|
174
|
+
});
|
|
175
|
+
}), s("should process Gmail toolkit with met authorization requirements", async () => {
|
|
176
|
+
const t = await new i({
|
|
177
|
+
arcadeClientId: "test-client-id",
|
|
178
|
+
apiKey: "test-api-key"
|
|
179
|
+
}).getToolkits();
|
|
180
|
+
e(t.get("Gmail")).toBeDefined(), e(t.get("Gmail")?.requirements.met).toBe(!0), e(t.get("Gmail")?.requirements.authorization).toHaveLength(1), e(t.get("Gmail")?.requirements.scopes).toEqual({
|
|
181
|
+
google: [
|
|
182
|
+
"https://www.googleapis.com/auth/gmail.modify",
|
|
183
|
+
"https://www.googleapis.com/auth/gmail.labels"
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}), s("should merge OAuth scopes correctly", async () => {
|
|
187
|
+
const a = (await new i({
|
|
188
|
+
arcadeClientId: "test-client-id",
|
|
189
|
+
apiKey: "test-api-key"
|
|
190
|
+
}).getToolkits()).get("oauth_toolkit");
|
|
191
|
+
e(a?.requirements.scopes?.google).toContain(
|
|
192
|
+
"https://www.googleapis.com/auth/calendar.readonly"
|
|
193
|
+
), e(a?.requirements.scopes?.google).toContain(
|
|
194
|
+
"https://www.googleapis.com/auth/drive"
|
|
195
|
+
), e(a?.requirements.scopes?.google).toContain(
|
|
196
|
+
"https://www.googleapis.com/auth/gmail.readonly"
|
|
197
|
+
);
|
|
198
|
+
const n = new Set(a?.requirements.scopes?.google);
|
|
199
|
+
e(n.size).toBe(
|
|
200
|
+
a?.requirements.scopes?.google?.length
|
|
201
|
+
);
|
|
202
|
+
}), s("should handle tools with no requirements", async () => {
|
|
203
|
+
const a = (await new i({
|
|
204
|
+
arcadeClientId: "test-client-id",
|
|
205
|
+
apiKey: "test-api-key"
|
|
206
|
+
}).getToolkits()).get("basic");
|
|
207
|
+
e(a?.requirements.met).toBe(!0), e(a?.requirements.secrets).toHaveLength(0), e(a?.requirements.authorization).toHaveLength(0), e(a?.requirements.scopes).toEqual({});
|
|
208
|
+
}), s("should merge secrets correctly", async () => {
|
|
209
|
+
const a = (await new i({
|
|
210
|
+
arcadeClientId: "test-client-id",
|
|
211
|
+
apiKey: "test-api-key"
|
|
212
|
+
}).getToolkits()).get("api_toolkit");
|
|
213
|
+
e(a?.requirements.secrets).toHaveLength(3);
|
|
214
|
+
const n = a?.requirements.secrets?.filter(
|
|
215
|
+
(g) => g.key === "OPENAI_API_KEY"
|
|
216
|
+
) || [], r = a?.requirements.secrets?.filter(
|
|
217
|
+
(g) => g.key === "GROQ_API_KEY"
|
|
218
|
+
) || [];
|
|
219
|
+
e(n).toHaveLength(1), e(n[0].met).toBe(!0), e(r[0].met).toBe(!1), e(a?.requirements.met).toBe(!1), e(n[0].status_reason).toBe("API key configured"), e(r[0].status_reason).toBe("API key not configured");
|
|
220
|
+
}), s("should merge OAuth scopes from multiple Google services", async () => {
|
|
221
|
+
const t = await new i({
|
|
222
|
+
arcadeClientId: "test-client-id",
|
|
223
|
+
apiKey: "test-api-key"
|
|
224
|
+
}).getToolkits();
|
|
225
|
+
e(t.get("Google")?.requirements.scopes?.google).toContain(
|
|
226
|
+
"https://www.googleapis.com/auth/drive.file"
|
|
227
|
+
), e(t.get("Gmail")?.requirements.scopes?.google).toContain(
|
|
228
|
+
"https://www.googleapis.com/auth/gmail.modify"
|
|
229
|
+
), e(t.get("Gmail")?.requirements.scopes?.google).toContain(
|
|
230
|
+
"https://www.googleapis.com/auth/gmail.labels"
|
|
231
|
+
), e(
|
|
232
|
+
t.get("oauth_toolkit")?.requirements.scopes?.google
|
|
233
|
+
).toContain("https://www.googleapis.com/auth/calendar.readonly"), e(
|
|
234
|
+
t.get("oauth_toolkit")?.requirements.scopes?.google
|
|
235
|
+
).toContain("https://www.googleapis.com/auth/drive"), e(
|
|
236
|
+
t.get("oauth_toolkit")?.requirements.scopes?.google
|
|
237
|
+
).toContain("https://www.googleapis.com/auth/gmail.readonly");
|
|
238
|
+
const a = t.get("Google")?.requirements.scopes?.google || [], n = t.get("Gmail")?.requirements.scopes?.google || [], r = t.get("oauth_toolkit")?.requirements.scopes?.google || [];
|
|
239
|
+
e(new Set(a).size).toBe(a.length), e(new Set(n).size).toBe(n.length), e(new Set(r).size).toBe(r.length);
|
|
240
|
+
}), s("should get tools for specific toolkit", async () => {
|
|
241
|
+
const t = await new i({
|
|
242
|
+
arcadeClientId: "test-client-id",
|
|
243
|
+
apiKey: "test-api-key"
|
|
244
|
+
}).getToolsForToolkit("E2b");
|
|
245
|
+
e(t).toBeDefined(), e(t).toHaveLength(1), e(t[0].name).toBe("CreateStaticMatplotlibChart"), e(t[0].toolkit.name).toBe("E2b");
|
|
246
|
+
}), s("should call list with toolkit and default limit when getting tools for a toolkit", async () => {
|
|
247
|
+
await new i({
|
|
248
|
+
arcadeClientId: "test-client-id",
|
|
249
|
+
apiKey: "test-api-key"
|
|
250
|
+
}).getToolsForToolkit("Gmail"), e(d.tools.list).toHaveBeenCalledWith(
|
|
251
|
+
e.objectContaining({ toolkit: "Gmail", limit: 1e3 })
|
|
252
|
+
);
|
|
253
|
+
}), s("should group tools by a string key", async () => {
|
|
254
|
+
const t = await new i({
|
|
255
|
+
arcadeClientId: "test-client-id",
|
|
256
|
+
apiKey: "test-api-key"
|
|
257
|
+
}).groupToolsBy("fully_qualified_name");
|
|
258
|
+
e(t.get("gmail.gmail_get_inbox")?.name).toBe(
|
|
259
|
+
"gmail_get_inbox"
|
|
260
|
+
), e(t.get("Gmail.CreateLabel@2.0.0")?.name).toBe(
|
|
261
|
+
"CreateLabel"
|
|
262
|
+
), e(t.get("Google.CreateBlankDocument@1.2.4")?.name).toBe(
|
|
263
|
+
"CreateBlankDocument"
|
|
264
|
+
);
|
|
265
|
+
}), s("should ignore non-string grouping keys", async () => {
|
|
266
|
+
const t = await new i({
|
|
267
|
+
arcadeClientId: "test-client-id",
|
|
268
|
+
apiKey: "test-api-key"
|
|
269
|
+
}).groupToolsBy("input");
|
|
270
|
+
e(t.size).toBe(0);
|
|
271
|
+
}), s("should honor baseURL when provided", () => {
|
|
272
|
+
const o = new i({
|
|
273
|
+
arcadeClientId: "test-client-id",
|
|
274
|
+
apiKey: "test-api-key",
|
|
275
|
+
baseURL: "https://example.test"
|
|
276
|
+
});
|
|
277
|
+
e(o).toBeDefined(), e(c).toHaveBeenCalledWith(
|
|
278
|
+
e.objectContaining({ baseURL: "https://example.test" })
|
|
279
|
+
);
|
|
280
|
+
}), s("should build a processed toolkit collection with search indices", async () => {
|
|
281
|
+
const t = await new i({
|
|
282
|
+
arcadeClientId: "test-client-id",
|
|
283
|
+
apiKey: "test-api-key"
|
|
284
|
+
}).getProcessedToolkitCollection();
|
|
285
|
+
e(t.toolkits.length).toBeGreaterThan(0), e(t.tools.length).toBeGreaterThan(0), e(t.toolToToolkitMap.get("gmail.gmail_get_inbox")).toBe(
|
|
286
|
+
"Gmail"
|
|
287
|
+
), e(t.searchIndex.toolkitsByName.get("gmail")?.name).toBe(
|
|
288
|
+
"Gmail"
|
|
289
|
+
), e(
|
|
290
|
+
t.searchIndex.toolsByName.get("gmail.gmail_get_inbox")?.name
|
|
291
|
+
).toBe("gmail_get_inbox");
|
|
292
|
+
const a = t.searchIndex.toolsByName.get(
|
|
293
|
+
"gmail.gmail_get_inbox"
|
|
294
|
+
);
|
|
295
|
+
e(a?.searchableText).toContain("gmail"), e(a?.searchableText).toContain("get"), e(a?.searchableText).toContain("inbox");
|
|
296
|
+
const n = t.searchIndex.toolkitsByName.get("google");
|
|
297
|
+
e(n?.searchableText).toContain("google"), e(n?.searchableText).toContain("arcade"), e(n?.searchableText).toContain("dev"), e(n?.searchableText).toContain("llm"), e(n?.searchableText).toContain("tools"), e(n?.searchableText).toContain("workspace");
|
|
298
|
+
});
|
|
299
|
+
});
|