@agent-os-sdk/client 0.9.26 → 0.9.28
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/client/AgentOsClient.d.ts +141 -0
- package/dist/client/AgentOsClient.d.ts.map +1 -0
- package/{src/client/AgentOsClient.ts → dist/client/AgentOsClient.js} +61 -105
- package/dist/client/HttpRequestBuilder.d.ts +50 -0
- package/dist/client/HttpRequestBuilder.d.ts.map +1 -0
- package/{src/client/HttpRequestBuilder.ts → dist/client/HttpRequestBuilder.js} +9 -41
- package/{src/client/OperationContext.ts → dist/client/OperationContext.d.ts} +6 -9
- package/dist/client/OperationContext.d.ts.map +1 -0
- package/dist/client/OperationContext.js +13 -0
- package/dist/client/OperationContextProvider.d.ts +54 -0
- package/dist/client/OperationContextProvider.d.ts.map +1 -0
- package/{src/client/OperationContextProvider.ts → dist/client/OperationContextProvider.js} +17 -35
- package/{src/client/auth.ts → dist/client/auth.d.ts} +29 -65
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/auth.js +38 -0
- package/dist/client/config.d.ts +49 -0
- package/dist/client/config.d.ts.map +1 -0
- package/{src/client/config.ts → dist/client/config.js} +5 -43
- package/dist/client/helpers.d.ts +63 -0
- package/dist/client/helpers.d.ts.map +1 -0
- package/{src/client/helpers.ts → dist/client/helpers.js} +9 -52
- package/dist/client/pagination.d.ts +105 -0
- package/dist/client/pagination.d.ts.map +1 -0
- package/{src/client/pagination.ts → dist/client/pagination.js} +15 -116
- package/dist/client/raw.d.ts +277 -0
- package/dist/client/raw.d.ts.map +1 -0
- package/dist/client/raw.js +337 -0
- package/dist/client/retry.d.ts +37 -0
- package/dist/client/retry.d.ts.map +1 -0
- package/{src/client/retry.ts → dist/client/retry.js} +13 -55
- package/dist/client/sanitize.d.ts +19 -0
- package/dist/client/sanitize.d.ts.map +1 -0
- package/{src/client/sanitize.ts → dist/client/sanitize.js} +4 -7
- package/dist/client/timeout.d.ts +26 -0
- package/dist/client/timeout.d.ts.map +1 -0
- package/{src/client/timeout.ts → dist/client/timeout.js} +10 -18
- package/dist/errors/factory.d.ts +22 -0
- package/dist/errors/factory.d.ts.map +1 -0
- package/{src/errors/factory.ts → dist/errors/factory.js} +18 -57
- package/dist/errors/index.d.ts +210 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/{src/errors/index.ts → dist/errors/index.js} +74 -156
- package/{src/generated/client.ts → dist/generated/client.d.ts} +5 -17
- package/dist/generated/client.d.ts.map +1 -0
- package/dist/generated/client.js +15 -0
- package/{src/generated/index.ts → dist/generated/index.d.ts} +1 -1
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +1 -0
- package/{src/generated/openapi.ts → dist/generated/openapi.d.ts} +1 -1
- package/dist/generated/openapi.d.ts.map +1 -0
- package/dist/generated/openapi.js +5 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +13 -63
- package/dist/modules/a2a.d.ts +48 -0
- package/dist/modules/a2a.d.ts.map +1 -0
- package/dist/modules/a2a.js +37 -0
- package/dist/modules/agents.d.ts +346 -0
- package/dist/modules/agents.d.ts.map +1 -0
- package/dist/modules/agents.js +296 -0
- package/dist/modules/apiTokens.d.ts +62 -0
- package/dist/modules/apiTokens.d.ts.map +1 -0
- package/dist/modules/apiTokens.js +56 -0
- package/dist/modules/approvals.d.ts +77 -0
- package/dist/modules/approvals.d.ts.map +1 -0
- package/dist/modules/approvals.js +91 -0
- package/dist/modules/audit.d.ts +78 -0
- package/dist/modules/audit.d.ts.map +1 -0
- package/{src/modules/audit.ts → dist/modules/audit.js} +23 -74
- package/{src/modules/auth.ts → dist/modules/auth.d.ts} +6 -11
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +22 -0
- package/dist/modules/builder.d.ts +242 -0
- package/dist/modules/builder.d.ts.map +1 -0
- package/dist/modules/builder.js +248 -0
- package/dist/modules/catalog.d.ts +142 -0
- package/dist/modules/catalog.d.ts.map +1 -0
- package/dist/modules/catalog.js +136 -0
- package/dist/modules/chatwoot.d.ts +59 -0
- package/dist/modules/chatwoot.d.ts.map +1 -0
- package/dist/modules/chatwoot.js +200 -0
- package/dist/modules/checkpoints.d.ts +62 -0
- package/dist/modules/checkpoints.d.ts.map +1 -0
- package/dist/modules/checkpoints.js +48 -0
- package/dist/modules/contracts.d.ts +48 -0
- package/dist/modules/contracts.d.ts.map +1 -0
- package/dist/modules/contracts.js +25 -0
- package/dist/modules/credentials.d.ts +105 -0
- package/dist/modules/credentials.d.ts.map +1 -0
- package/dist/modules/credentials.js +135 -0
- package/dist/modules/crons.d.ts +73 -0
- package/dist/modules/crons.d.ts.map +1 -0
- package/dist/modules/crons.js +67 -0
- package/dist/modules/datasets.d.ts +80 -0
- package/dist/modules/datasets.d.ts.map +1 -0
- package/dist/modules/datasets.js +91 -0
- package/{src/modules/evaluation.ts → dist/modules/evaluation.d.ts} +23 -109
- package/dist/modules/evaluation.d.ts.map +1 -0
- package/dist/modules/evaluation.js +108 -0
- package/dist/modules/files.d.ts +89 -0
- package/dist/modules/files.d.ts.map +1 -0
- package/dist/modules/files.js +133 -0
- package/dist/modules/graphs.d.ts +120 -0
- package/dist/modules/graphs.d.ts.map +1 -0
- package/dist/modules/graphs.js +69 -0
- package/{src/modules/improvements.ts → dist/modules/improvements.d.ts} +8 -27
- package/dist/modules/improvements.d.ts.map +1 -0
- package/dist/modules/improvements.js +27 -0
- package/dist/modules/info.d.ts +76 -0
- package/dist/modules/info.d.ts.map +1 -0
- package/{src/modules/info.ts → dist/modules/info.js} +16 -66
- package/dist/modules/knowledge.d.ts +91 -0
- package/dist/modules/knowledge.d.ts.map +1 -0
- package/dist/modules/knowledge.js +80 -0
- package/{src/modules/me.ts → dist/modules/me.d.ts} +7 -23
- package/dist/modules/me.d.ts.map +1 -0
- package/dist/modules/me.js +28 -0
- package/dist/modules/members.d.ts +124 -0
- package/dist/modules/members.d.ts.map +1 -0
- package/dist/modules/members.js +142 -0
- package/dist/modules/memberships.d.ts +25 -0
- package/dist/modules/memberships.d.ts.map +1 -0
- package/dist/modules/memberships.js +20 -0
- package/{src/modules/metaAgent.ts → dist/modules/metaAgent.d.ts} +8 -44
- package/dist/modules/metaAgent.d.ts.map +1 -0
- package/dist/modules/metaAgent.js +32 -0
- package/dist/modules/metrics.d.ts +20 -0
- package/dist/modules/metrics.d.ts.map +1 -0
- package/{src/modules/metrics.ts → dist/modules/metrics.js} +7 -14
- package/dist/modules/observability.d.ts +19 -0
- package/dist/modules/observability.d.ts.map +1 -0
- package/dist/modules/observability.js +14 -0
- package/dist/modules/playground.d.ts +42 -0
- package/dist/modules/playground.d.ts.map +1 -0
- package/dist/modules/playground.js +48 -0
- package/dist/modules/presets.d.ts +32 -0
- package/dist/modules/presets.d.ts.map +1 -0
- package/dist/modules/presets.js +199 -0
- package/dist/modules/prompts.d.ts +87 -0
- package/dist/modules/prompts.d.ts.map +1 -0
- package/dist/modules/prompts.js +87 -0
- package/dist/modules/roles.d.ts +64 -0
- package/dist/modules/roles.d.ts.map +1 -0
- package/dist/modules/roles.js +79 -0
- package/dist/modules/runs.d.ts +451 -0
- package/dist/modules/runs.d.ts.map +1 -0
- package/{src/modules/runs.ts → dist/modules/runs.js} +96 -438
- package/dist/modules/store.d.ts +37 -0
- package/dist/modules/store.d.ts.map +1 -0
- package/dist/modules/store.js +48 -0
- package/{src/modules/templates.ts → dist/modules/templates.d.ts} +8 -32
- package/dist/modules/templates.d.ts.map +1 -0
- package/dist/modules/templates.js +26 -0
- package/dist/modules/tenants.d.ts +49 -0
- package/dist/modules/tenants.d.ts.map +1 -0
- package/dist/modules/tenants.js +56 -0
- package/dist/modules/threads.d.ts +205 -0
- package/dist/modules/threads.d.ts.map +1 -0
- package/dist/modules/threads.js +225 -0
- package/dist/modules/tools.d.ts +62 -0
- package/dist/modules/tools.d.ts.map +1 -0
- package/dist/modules/tools.js +45 -0
- package/dist/modules/traces.d.ts +89 -0
- package/dist/modules/traces.d.ts.map +1 -0
- package/dist/modules/traces.js +65 -0
- package/{src/modules/triggers.ts → dist/modules/triggers.d.ts} +24 -153
- package/dist/modules/triggers.d.ts.map +1 -0
- package/dist/modules/triggers.js +176 -0
- package/{src/modules/usage.ts → dist/modules/usage.d.ts} +14 -46
- package/dist/modules/usage.d.ts.map +1 -0
- package/dist/modules/usage.js +43 -0
- package/dist/modules/vectorStores.d.ts +100 -0
- package/dist/modules/vectorStores.d.ts.map +1 -0
- package/dist/modules/vectorStores.js +159 -0
- package/dist/modules/workspaces.d.ts +138 -0
- package/dist/modules/workspaces.d.ts.map +1 -0
- package/dist/modules/workspaces.js +121 -0
- package/dist/sse/client.d.ts +140 -0
- package/dist/sse/client.d.ts.map +1 -0
- package/{src/sse/client.ts → dist/sse/client.js} +24 -100
- package/package.json +8 -15
- package/src/client/raw.ts +0 -609
- package/src/generated/swagger.json +0 -17014
- package/src/modules/a2a.ts +0 -64
- package/src/modules/agents.ts +0 -604
- package/src/modules/apiTokens.ts +0 -101
- package/src/modules/approvals.ts +0 -151
- package/src/modules/catalog.ts +0 -241
- package/src/modules/chatwoot.ts +0 -242
- package/src/modules/checkpoints.ts +0 -87
- package/src/modules/contracts.ts +0 -80
- package/src/modules/credentials.ts +0 -216
- package/src/modules/crons.ts +0 -115
- package/src/modules/datasets.ts +0 -142
- package/src/modules/files.ts +0 -208
- package/src/modules/members.ts +0 -199
- package/src/modules/memberships.ts +0 -42
- package/src/modules/observability.ts +0 -28
- package/src/modules/playground.ts +0 -68
- package/src/modules/presets.ts +0 -246
- package/src/modules/prompts.ts +0 -147
- package/src/modules/roles.ts +0 -112
- package/src/modules/store.ts +0 -65
- package/src/modules/tenants.ts +0 -79
- package/src/modules/threads.ts +0 -343
- package/src/modules/tools.ts +0 -91
- package/src/modules/traces.ts +0 -133
- package/src/modules/vectorStores.ts +0 -257
- package/src/modules/workspaces.ts +0 -216
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chatwoot Module
|
|
3
|
+
*/
|
|
4
|
+
export class ChatwootModule {
|
|
5
|
+
client;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(client, headers) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Internal helper to resolve Chatwoot configuration from AgentOS credentials
|
|
13
|
+
*/
|
|
14
|
+
async _getChatwootConfig(credentialId) {
|
|
15
|
+
const { data: credential, error } = await this.client.GET("/v1/api/credentials/{id}", {
|
|
16
|
+
params: {
|
|
17
|
+
path: { id: credentialId },
|
|
18
|
+
query: { includeValues: true }
|
|
19
|
+
},
|
|
20
|
+
headers: this.headers(),
|
|
21
|
+
});
|
|
22
|
+
if (error || !credential) {
|
|
23
|
+
return { error: error || { message: "Credential not found", code: "CREDENTIAL_NOT_FOUND" }, data: undefined };
|
|
24
|
+
}
|
|
25
|
+
// Backend now returns 'values' when includeValues=true
|
|
26
|
+
const values = credential.values || credential.Values || {};
|
|
27
|
+
const publicConfig = credential.publicConfig || credential.PublicConfig || {};
|
|
28
|
+
const data = credential.data || {};
|
|
29
|
+
const url = publicConfig.url || data.url || values.url || publicConfig.endpoint || data.endpoint || values.endpoint || values.base_url;
|
|
30
|
+
let accountId = publicConfig.account_id || data.account_id || values.account_id || publicConfig.accountId || data.accountId || values.accountId;
|
|
31
|
+
const apiAccessToken = values.api_access_token || data.api_access_token || values.api_key || data.api_key || values.apiKey || data.apiKey || values.api_token;
|
|
32
|
+
if (!url || !apiAccessToken) {
|
|
33
|
+
return { error: { message: "Invalid Chatwoot credential: missing URL/Endpoint or API Access Token/Key", code: "INVALID_CREDENTIAL" }, data: undefined };
|
|
34
|
+
}
|
|
35
|
+
const baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
36
|
+
// Auto-discover accountId if missing
|
|
37
|
+
if (!accountId) {
|
|
38
|
+
try {
|
|
39
|
+
const profileRes = await fetch(`${baseUrl}/api/v1/profile`, {
|
|
40
|
+
headers: { "api_access_token": apiAccessToken }
|
|
41
|
+
});
|
|
42
|
+
if (profileRes.ok) {
|
|
43
|
+
const profile = await profileRes.json();
|
|
44
|
+
// Use the first available account
|
|
45
|
+
if (profile.accounts && profile.accounts.length > 0) {
|
|
46
|
+
accountId = profile.accounts[0].id;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.warn("Failed to auto-discover Chatwoot account ID:", err);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!accountId) {
|
|
55
|
+
return { error: { message: "Invalid Chatwoot credential: missing Account ID and auto-discovery failed.", code: "ACCOUNT_ID_MISSING" }, data: undefined };
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
data: {
|
|
59
|
+
baseUrl,
|
|
60
|
+
accountId: String(accountId),
|
|
61
|
+
apiAccessToken
|
|
62
|
+
},
|
|
63
|
+
error: null
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Direct call to Chatwoot API
|
|
68
|
+
*/
|
|
69
|
+
async _chatwootRequest(config, method, path, body) {
|
|
70
|
+
const url = `${config.baseUrl}${path}`;
|
|
71
|
+
const headers = {
|
|
72
|
+
"api_access_token": config.apiAccessToken,
|
|
73
|
+
"Content-Type": "application/json",
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(url, {
|
|
77
|
+
method,
|
|
78
|
+
headers,
|
|
79
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
80
|
+
});
|
|
81
|
+
let data = null;
|
|
82
|
+
const contentType = response.headers.get("content-type");
|
|
83
|
+
if (contentType && contentType.includes("application/json")) {
|
|
84
|
+
try {
|
|
85
|
+
const text = await response.text();
|
|
86
|
+
if (text)
|
|
87
|
+
data = JSON.parse(text);
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
// Ignore JSON parse errors for empty bodies
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
return { error: data || { message: `Chatwoot API error: ${response.statusText}`, code: "API_ERROR" }, data: undefined, response };
|
|
95
|
+
}
|
|
96
|
+
return { data, error: undefined, response };
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return { error: { message: err.message, code: "UNKNOWN_ERROR" }, data: undefined, response: new Response() };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the inbox URL for a specific credential.
|
|
104
|
+
* Use this to open the Chatwoot inbox directly.
|
|
105
|
+
*/
|
|
106
|
+
async getInboxUrl(credentialId) {
|
|
107
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
108
|
+
if (error || !config) {
|
|
109
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
110
|
+
}
|
|
111
|
+
const inboxUrl = `${config.baseUrl}/app/accounts/${config.accountId}/inbox`;
|
|
112
|
+
return {
|
|
113
|
+
data: { url: inboxUrl },
|
|
114
|
+
error: undefined,
|
|
115
|
+
response: new Response(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* List all inboxes
|
|
120
|
+
*/
|
|
121
|
+
async listInboxes(credentialId) {
|
|
122
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
123
|
+
if (error || !config)
|
|
124
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
125
|
+
const res = await this._chatwootRequest(config, "GET", `/api/v1/accounts/${config.accountId}/inboxes`);
|
|
126
|
+
// Chatwoot API returns { payload: [...] }
|
|
127
|
+
if (res.data && Array.isArray(res.data.payload)) {
|
|
128
|
+
return { data: res.data.payload, error: undefined, response: res.response };
|
|
129
|
+
}
|
|
130
|
+
return res;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Create a new inbox
|
|
134
|
+
*/
|
|
135
|
+
async createInbox(credentialId, data) {
|
|
136
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
137
|
+
if (error || !config)
|
|
138
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
139
|
+
return this._chatwootRequest(config, "POST", `/api/v1/accounts/${config.accountId}/inboxes`, data);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get a specific inbox
|
|
143
|
+
*/
|
|
144
|
+
async getInbox(credentialId, inboxId) {
|
|
145
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
146
|
+
if (error || !config)
|
|
147
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
148
|
+
return this._chatwootRequest(config, "GET", `/api/v1/accounts/${config.accountId}/inboxes/${inboxId}`);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Update an inbox
|
|
152
|
+
*/
|
|
153
|
+
async updateInbox(credentialId, inboxId, data) {
|
|
154
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
155
|
+
if (error || !config)
|
|
156
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
157
|
+
return this._chatwootRequest(config, "PATCH", `/api/v1/accounts/${config.accountId}/inboxes/${inboxId}`, data);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Delete an inbox
|
|
161
|
+
*/
|
|
162
|
+
async deleteInbox(credentialId, inboxId) {
|
|
163
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
164
|
+
if (error || !config)
|
|
165
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
166
|
+
return this._chatwootRequest(config, "DELETE", `/api/v1/accounts/${config.accountId}/inboxes/${inboxId}`);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get inbox metrics
|
|
170
|
+
*/
|
|
171
|
+
async getInboxMetrics(credentialId, inboxId) {
|
|
172
|
+
const { data: config, error } = await this._getChatwootConfig(credentialId);
|
|
173
|
+
if (error || !config)
|
|
174
|
+
return { error: error || { message: "Config not found", code: "CONFIG_MISSING" }, data: undefined, response: new Response() };
|
|
175
|
+
return this._chatwootRequest(config, "GET", `/api/v1/accounts/${config.accountId}/inboxes/${inboxId}/metrics`);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get the inbox URL for a specific agent.
|
|
179
|
+
*/
|
|
180
|
+
async getAgentInboxUrl(agentId) {
|
|
181
|
+
const { data: triggers, error: triggerError } = await this.client.GET("/v1/api/triggers", {
|
|
182
|
+
params: { query: { agent_id: agentId } },
|
|
183
|
+
headers: this.headers(),
|
|
184
|
+
});
|
|
185
|
+
if (triggerError || !triggers) {
|
|
186
|
+
return { error: triggerError || { message: "Failed to fetch triggers", code: "TRIGGER_FETCH_FAILED" }, data: undefined, response: new Response() };
|
|
187
|
+
}
|
|
188
|
+
const chatwootTrigger = triggers.items?.find((t) => t.type === "chatwoot" ||
|
|
189
|
+
(t.type === "evolution_whatsapp" && t.config?.chat_platform === "chatwoot") ||
|
|
190
|
+
(t.config?.credential_id && (t.type === "chatwoot" || t.type.includes("whatsapp"))));
|
|
191
|
+
if (!chatwootTrigger) {
|
|
192
|
+
return { error: { message: "No compatible trigger found for this agent", code: "NO_TRIGGER" }, data: undefined, response: new Response() };
|
|
193
|
+
}
|
|
194
|
+
const credentialId = chatwootTrigger.config?.credential_id;
|
|
195
|
+
if (!credentialId) {
|
|
196
|
+
return { error: { message: "Trigger configuration missing credential_id", code: "MISSING_CREDENTIAL_ID" }, data: undefined, response: new Response() };
|
|
197
|
+
}
|
|
198
|
+
return this.getInboxUrl(credentialId);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoints Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
5
|
+
export interface Checkpoint {
|
|
6
|
+
id: string;
|
|
7
|
+
run_id: string;
|
|
8
|
+
thread_id: string;
|
|
9
|
+
step_name: string;
|
|
10
|
+
checkpoint_id: string;
|
|
11
|
+
parent_checkpoint_id?: string;
|
|
12
|
+
has_state_snapshot: boolean;
|
|
13
|
+
created_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CheckpointNode {
|
|
16
|
+
id: string;
|
|
17
|
+
step_name: string;
|
|
18
|
+
checkpoint_id: string;
|
|
19
|
+
parent_checkpoint_id?: string;
|
|
20
|
+
created_at: string;
|
|
21
|
+
children?: CheckpointNode[];
|
|
22
|
+
}
|
|
23
|
+
export interface CheckpointsResponse {
|
|
24
|
+
run_id: string;
|
|
25
|
+
total_checkpoints: number;
|
|
26
|
+
checkpoints: CheckpointNode[];
|
|
27
|
+
}
|
|
28
|
+
export interface ReplayResponse {
|
|
29
|
+
run_id: string;
|
|
30
|
+
status: string;
|
|
31
|
+
replayed_from_checkpoint_id: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class CheckpointsModule {
|
|
34
|
+
private client;
|
|
35
|
+
private headers;
|
|
36
|
+
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
37
|
+
/**
|
|
38
|
+
* List checkpoints for a run.
|
|
39
|
+
* @param workspaceId - Workspace ID
|
|
40
|
+
* @param runId - Run ID
|
|
41
|
+
*/
|
|
42
|
+
list(workspaceId: string, runId: string): Promise<APIResponse<CheckpointsResponse>>;
|
|
43
|
+
/**
|
|
44
|
+
* Get a specific checkpoint.
|
|
45
|
+
* @param workspaceId - Workspace ID
|
|
46
|
+
* @param runId - Run ID
|
|
47
|
+
* @param checkpointId - Checkpoint ID
|
|
48
|
+
*/
|
|
49
|
+
get(workspaceId: string, runId: string, checkpointId: string): Promise<APIResponse<Checkpoint>>;
|
|
50
|
+
/**
|
|
51
|
+
* Replay from a checkpoint.
|
|
52
|
+
* @param workspaceId - Workspace ID
|
|
53
|
+
* @param runId - Run ID
|
|
54
|
+
* @param checkpointId - Checkpoint ID
|
|
55
|
+
* @param options - Replay options
|
|
56
|
+
*/
|
|
57
|
+
replay(workspaceId: string, runId: string, checkpointId: string, options?: {
|
|
58
|
+
create_new_thread?: boolean;
|
|
59
|
+
modified_input?: string;
|
|
60
|
+
}): Promise<APIResponse<ReplayResponse>>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=checkpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../../src/modules/checkpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAK3E,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B,EAAE,MAAM,CAAC;CACvC;AAED,qBAAa,iBAAiB;IACd,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;;;OAIG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAOzF;;;;;OAKG;IACG,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAOrG;;;;;;OAMG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC7E,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;CAO3C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoints Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
export class CheckpointsModule {
|
|
5
|
+
client;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(client, headers) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List checkpoints for a run.
|
|
13
|
+
* @param workspaceId - Workspace ID
|
|
14
|
+
* @param runId - Run ID
|
|
15
|
+
*/
|
|
16
|
+
async list(workspaceId, runId) {
|
|
17
|
+
return this.client.GET("/v1/api/workspaces/{workspaceId}/runs/{runId}/checkpoints", {
|
|
18
|
+
params: { path: { workspaceId, runId } },
|
|
19
|
+
headers: this.headers(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a specific checkpoint.
|
|
24
|
+
* @param workspaceId - Workspace ID
|
|
25
|
+
* @param runId - Run ID
|
|
26
|
+
* @param checkpointId - Checkpoint ID
|
|
27
|
+
*/
|
|
28
|
+
async get(workspaceId, runId, checkpointId) {
|
|
29
|
+
return this.client.GET("/v1/api/workspaces/{workspaceId}/runs/{runId}/checkpoints/{checkpointId}", {
|
|
30
|
+
params: { path: { workspaceId, runId, checkpointId } },
|
|
31
|
+
headers: this.headers(),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Replay from a checkpoint.
|
|
36
|
+
* @param workspaceId - Workspace ID
|
|
37
|
+
* @param runId - Run ID
|
|
38
|
+
* @param checkpointId - Checkpoint ID
|
|
39
|
+
* @param options - Replay options
|
|
40
|
+
*/
|
|
41
|
+
async replay(workspaceId, runId, checkpointId, options) {
|
|
42
|
+
return this.client.POST("/v1/api/workspaces/{workspaceId}/runs/{runId}/checkpoints/{checkpointId}/replay", {
|
|
43
|
+
params: { path: { workspaceId, runId, checkpointId } },
|
|
44
|
+
body: options ?? {},
|
|
45
|
+
headers: this.headers(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { APIResponse, RawClient } from "../client/raw.js";
|
|
2
|
+
export interface ContractsValidationIssue {
|
|
3
|
+
code: string;
|
|
4
|
+
message: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
severity?: string;
|
|
7
|
+
}
|
|
8
|
+
export type ContractsErrorCode = "CONTRACT_ID_INVALID" | "RUNTIME_PACKAGE_COMPILE_INVALID" | "INTERNAL_UNAUTHORIZED" | "KERNEL_UNAVAILABLE" | "KERNEL_ERROR" | "INTERNAL_ERROR" | "VALIDATION_ERROR";
|
|
9
|
+
export interface ContractsErrorResponse {
|
|
10
|
+
code: ContractsErrorCode;
|
|
11
|
+
message: string;
|
|
12
|
+
errors?: ContractsValidationIssue[];
|
|
13
|
+
supported_contract_ids?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface ContractsSupportedResponse {
|
|
16
|
+
contract_ids: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface ContractsValidateRequest {
|
|
19
|
+
contract_id: string;
|
|
20
|
+
spec: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface ContractsValidateResponse {
|
|
23
|
+
contract_id: string;
|
|
24
|
+
valid: boolean;
|
|
25
|
+
errors: ContractsValidationIssue[];
|
|
26
|
+
warnings: ContractsValidationIssue[];
|
|
27
|
+
}
|
|
28
|
+
export interface ContractsCompileRuntimePackageRequest {
|
|
29
|
+
ir_spec: unknown;
|
|
30
|
+
capability_registry_spec: unknown;
|
|
31
|
+
policy_refs?: Record<string, unknown>;
|
|
32
|
+
runtime_config_refs?: Record<string, unknown>;
|
|
33
|
+
package_id?: string;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
compiled_at?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ContractsCompileRuntimePackageResponse {
|
|
38
|
+
package_spec: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare class ContractsModule {
|
|
41
|
+
private client;
|
|
42
|
+
private headers;
|
|
43
|
+
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
44
|
+
supported(): Promise<APIResponse<ContractsSupportedResponse>>;
|
|
45
|
+
validate(body: ContractsValidateRequest): Promise<APIResponse<ContractsValidateResponse>>;
|
|
46
|
+
compileRuntimePackage(body: ContractsCompileRuntimePackageRequest): Promise<APIResponse<ContractsCompileRuntimePackageResponse>>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/modules/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE/D,M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AE,OAAO,CAAC,CAAC;CACzC;AAED,qBAAa,eAAe;IACZ,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAE9E,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAM7D,QAAQ,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAOzF,qBAAqB,CACvB,IAAI,EAAE,qCAAqC,GAC5C,OAAO,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC;CAMlE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class ContractsModule {
|
|
2
|
+
client;
|
|
3
|
+
headers;
|
|
4
|
+
constructor(client, headers) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.headers = headers;
|
|
7
|
+
}
|
|
8
|
+
async supported() {
|
|
9
|
+
return this.client.GET("/v1/api/contracts/supported", {
|
|
10
|
+
headers: this.headers(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async validate(body) {
|
|
14
|
+
return this.client.POST("/v1/api/contracts/validate", {
|
|
15
|
+
body,
|
|
16
|
+
headers: this.headers(),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async compileRuntimePackage(body) {
|
|
20
|
+
return this.client.POST("/v1/api/contracts/compile/runtime-package", {
|
|
21
|
+
body,
|
|
22
|
+
headers: this.headers(),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
import type { APIResponse, RawClient } from "../client/raw.js";
|
|
5
|
+
export interface Credential {
|
|
6
|
+
id: string;
|
|
7
|
+
credential_instance_ref?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
scope: "workspace" | "tenant";
|
|
10
|
+
type_id?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
credential_type_ref?: string;
|
|
13
|
+
workspace_id?: string;
|
|
14
|
+
tenant_id: string;
|
|
15
|
+
sharing_mode: "private" | "shared";
|
|
16
|
+
status: "active" | "disabled" | "expired";
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CredentialListResponse {
|
|
21
|
+
items: Credential[];
|
|
22
|
+
total: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CredentialType {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
credential_type_ref?: string;
|
|
28
|
+
display_name?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
provider_family?: string;
|
|
31
|
+
version?: string;
|
|
32
|
+
status?: string;
|
|
33
|
+
masking_policy?: string;
|
|
34
|
+
materialization_policy?: string;
|
|
35
|
+
schema_public_json?: Record<string, unknown> | null;
|
|
36
|
+
schema_secret_json?: Record<string, unknown> | null;
|
|
37
|
+
}
|
|
38
|
+
export interface CredentialTypesResponse {
|
|
39
|
+
items: CredentialType[];
|
|
40
|
+
count?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ValidateCredentialResponse {
|
|
43
|
+
valid: boolean;
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare class CredentialsModule {
|
|
47
|
+
private client;
|
|
48
|
+
private getWorkspaceId;
|
|
49
|
+
private headers;
|
|
50
|
+
constructor(client: RawClient, getWorkspaceId: () => string, headers: () => Record<string, string>);
|
|
51
|
+
/**
|
|
52
|
+
* List all credentials.
|
|
53
|
+
*/
|
|
54
|
+
list(params?: {
|
|
55
|
+
workspace_id?: string;
|
|
56
|
+
scope?: string;
|
|
57
|
+
type?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
offset?: number;
|
|
60
|
+
}): Promise<APIResponse<CredentialListResponse>>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a credential by ID.
|
|
63
|
+
*/
|
|
64
|
+
get(credentialId: string, includeValues?: boolean): Promise<APIResponse<Credential>>;
|
|
65
|
+
/**
|
|
66
|
+
* Create a new credential.
|
|
67
|
+
*/
|
|
68
|
+
create(body: {
|
|
69
|
+
name: string;
|
|
70
|
+
scope?: "workspace" | "tenant";
|
|
71
|
+
type_id?: string;
|
|
72
|
+
type?: string;
|
|
73
|
+
workspace_id?: string;
|
|
74
|
+
values?: Record<string, unknown>;
|
|
75
|
+
data?: Record<string, unknown>;
|
|
76
|
+
sharing_mode?: "private" | "shared";
|
|
77
|
+
}): Promise<APIResponse<Credential>>;
|
|
78
|
+
/**
|
|
79
|
+
* Update a credential.
|
|
80
|
+
* Uses PATCH per backend CredentialsController.
|
|
81
|
+
*/
|
|
82
|
+
update(credentialId: string, body: {
|
|
83
|
+
name?: string;
|
|
84
|
+
values?: Record<string, unknown>;
|
|
85
|
+
status?: string;
|
|
86
|
+
sharing_mode?: string;
|
|
87
|
+
}): Promise<APIResponse<Credential>>;
|
|
88
|
+
/**
|
|
89
|
+
* Delete a credential.
|
|
90
|
+
*/
|
|
91
|
+
delete(credentialId: string): Promise<APIResponse<void>>;
|
|
92
|
+
/**
|
|
93
|
+
* List available credential types.
|
|
94
|
+
*/
|
|
95
|
+
listTypes(): Promise<APIResponse<CredentialTypesResponse>>;
|
|
96
|
+
/**
|
|
97
|
+
* Validate a credential.
|
|
98
|
+
*/
|
|
99
|
+
validate(credentialId: string): Promise<APIResponse<ValidateCredentialResponse>>;
|
|
100
|
+
/**
|
|
101
|
+
* List available models for a credential provider.
|
|
102
|
+
*/
|
|
103
|
+
listModels(credentialId: string): Promise<APIResponse<string[]>>;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/modules/credentials.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO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AAC,UAAU,CAAC,CAAC;IAUpC;;;OAGG;IACG,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE;QACrC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAQpC;;OAEG;IACG,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO9D;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAqDhE;;OAEG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAOtF;;OAEG;IACG,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;CAMzE"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
export class CredentialsModule {
|
|
5
|
+
client;
|
|
6
|
+
getWorkspaceId;
|
|
7
|
+
headers;
|
|
8
|
+
constructor(client, getWorkspaceId, headers) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
11
|
+
this.headers = headers;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* List all credentials.
|
|
15
|
+
*/
|
|
16
|
+
async list(params) {
|
|
17
|
+
return this.client.GET("/v1/api/credentials", {
|
|
18
|
+
params: { query: params },
|
|
19
|
+
headers: this.headers(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a credential by ID.
|
|
24
|
+
*/
|
|
25
|
+
async get(credentialId, includeValues = false) {
|
|
26
|
+
return this.client.GET("/v1/api/credentials/{id}", {
|
|
27
|
+
params: {
|
|
28
|
+
path: { id: credentialId },
|
|
29
|
+
query: { includeValues }
|
|
30
|
+
},
|
|
31
|
+
headers: this.headers(),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a new credential.
|
|
36
|
+
*/
|
|
37
|
+
async create(body) {
|
|
38
|
+
return this.client.POST("/v1/api/credentials", {
|
|
39
|
+
body: {
|
|
40
|
+
...body,
|
|
41
|
+
workspace_id: body.workspace_id || (this.getWorkspaceId() ? this.getWorkspaceId() : undefined),
|
|
42
|
+
},
|
|
43
|
+
headers: this.headers(),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update a credential.
|
|
48
|
+
* Uses PATCH per backend CredentialsController.
|
|
49
|
+
*/
|
|
50
|
+
async update(credentialId, body) {
|
|
51
|
+
return this.client.PATCH("/v1/api/credentials/{id}", {
|
|
52
|
+
params: { path: { id: credentialId } },
|
|
53
|
+
body,
|
|
54
|
+
headers: this.headers(),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete a credential.
|
|
59
|
+
*/
|
|
60
|
+
async delete(credentialId) {
|
|
61
|
+
return this.client.DELETE("/v1/api/credentials/{id}", {
|
|
62
|
+
params: { path: { id: credentialId } },
|
|
63
|
+
headers: this.headers(),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* List available credential types.
|
|
68
|
+
*/
|
|
69
|
+
async listTypes() {
|
|
70
|
+
const response = await this.client.GET("/v1/api/credential-types", {
|
|
71
|
+
headers: this.headers(),
|
|
72
|
+
});
|
|
73
|
+
if (!response.data || response.error) {
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
const raw = response.data;
|
|
77
|
+
const rawItems = Array.isArray(raw)
|
|
78
|
+
? raw
|
|
79
|
+
: Array.isArray(raw.items)
|
|
80
|
+
? raw.items
|
|
81
|
+
: [];
|
|
82
|
+
const items = rawItems
|
|
83
|
+
.filter((item) => Boolean(item) && typeof item === "object")
|
|
84
|
+
.map((item) => ({
|
|
85
|
+
id: String(item.id ?? ""),
|
|
86
|
+
name: String(item.name ?? item.key ?? ""),
|
|
87
|
+
credential_type_ref: typeof item.credential_type_ref === "string"
|
|
88
|
+
? item.credential_type_ref
|
|
89
|
+
: undefined,
|
|
90
|
+
display_name: typeof item.display_name === "string"
|
|
91
|
+
? item.display_name
|
|
92
|
+
: typeof item.displayName === "string"
|
|
93
|
+
? item.displayName
|
|
94
|
+
: undefined,
|
|
95
|
+
description: typeof item.description === "string" ? item.description : undefined,
|
|
96
|
+
provider_family: typeof item.provider_family === "string" ? item.provider_family : undefined,
|
|
97
|
+
version: typeof item.version === "string" ? item.version : undefined,
|
|
98
|
+
status: typeof item.status === "string" ? item.status : undefined,
|
|
99
|
+
masking_policy: typeof item.masking_policy === "string" ? item.masking_policy : undefined,
|
|
100
|
+
materialization_policy: typeof item.materialization_policy === "string" ? item.materialization_policy : undefined,
|
|
101
|
+
schema_public_json: item.schema_public_json && typeof item.schema_public_json === "object"
|
|
102
|
+
? item.schema_public_json
|
|
103
|
+
: null,
|
|
104
|
+
schema_secret_json: item.schema_secret_json && typeof item.schema_secret_json === "object"
|
|
105
|
+
? item.schema_secret_json
|
|
106
|
+
: null,
|
|
107
|
+
}))
|
|
108
|
+
.filter((item) => item.id && item.name);
|
|
109
|
+
return {
|
|
110
|
+
...response,
|
|
111
|
+
data: {
|
|
112
|
+
items,
|
|
113
|
+
count: typeof raw.count === "number" ? raw.count : items.length,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Validate a credential.
|
|
119
|
+
*/
|
|
120
|
+
async validate(credentialId) {
|
|
121
|
+
return this.client.POST("/v1/api/credentials/{id}/validate", {
|
|
122
|
+
params: { path: { id: credentialId } },
|
|
123
|
+
headers: this.headers(),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* List available models for a credential provider.
|
|
128
|
+
*/
|
|
129
|
+
async listModels(credentialId) {
|
|
130
|
+
return this.client.GET("/v1/api/credentials/{id}/models", {
|
|
131
|
+
params: { path: { id: credentialId } },
|
|
132
|
+
headers: this.headers(),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|