lua-cli 2.2.8-alpha.1 → 2.3.0-alpha.1
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/API_REFERENCE.md +1408 -0
- package/CLI_REFERENCE.md +818 -0
- package/GETTING_STARTED.md +1040 -0
- package/README.md +738 -424
- package/TEMPLATE_GUIDE.md +1398 -0
- package/dist/api/agent.api.service.d.ts +45 -0
- package/dist/api/agent.api.service.js +57 -0
- package/dist/api/auth.api.service.d.ts +48 -0
- package/dist/api/auth.api.service.js +54 -0
- package/dist/api/basket.api.service.d.ts +85 -0
- package/dist/api/basket.api.service.js +164 -0
- package/dist/api/chat.api.service.d.ts +21 -0
- package/dist/api/chat.api.service.js +24 -0
- package/dist/api/credentials.d.ts +24 -0
- package/dist/api/credentials.js +46 -0
- package/dist/api/custom.data.api.service.d.ts +69 -0
- package/dist/api/custom.data.api.service.js +125 -0
- package/dist/api/lazy-instances.d.ts +49 -0
- package/dist/api/lazy-instances.js +95 -0
- package/dist/api/order.api.service.d.ts +53 -0
- package/dist/api/order.api.service.js +95 -0
- package/dist/api/products.api.service.d.ts +66 -0
- package/dist/api/products.api.service.js +112 -0
- package/dist/api/skills.api.service.d.ts +77 -0
- package/dist/api/skills.api.service.js +88 -0
- package/dist/api/tool.api.service.d.ts +52 -0
- package/dist/api/tool.api.service.js +73 -0
- package/dist/api/user.data.api.service.d.ts +33 -0
- package/dist/api/user.data.api.service.js +59 -0
- package/dist/api-exports.d.ts +271 -0
- package/dist/api-exports.js +372 -0
- package/dist/cli/command-definitions.d.ts +30 -0
- package/dist/cli/command-definitions.js +71 -0
- package/dist/commands/agents.d.ts +20 -0
- package/dist/commands/agents.js +24 -2
- package/dist/commands/apiKey.d.ts +23 -0
- package/dist/commands/apiKey.js +23 -0
- package/dist/commands/compile.d.ts +24 -0
- package/dist/commands/compile.js +67 -759
- package/dist/commands/configure.d.ts +24 -0
- package/dist/commands/configure.js +31 -96
- package/dist/commands/deploy.d.ts +31 -19
- package/dist/commands/deploy.js +45 -74
- package/dist/commands/destroy.d.ts +27 -0
- package/dist/commands/destroy.js +27 -1
- package/dist/commands/dev.d.ts +25 -62
- package/dist/commands/dev.js +58 -873
- package/dist/commands/init.d.ts +27 -0
- package/dist/commands/init.js +98 -260
- package/dist/commands/push.d.ts +24 -21
- package/dist/commands/push.js +39 -92
- package/dist/commands/test.d.ts +26 -0
- package/dist/commands/test.js +41 -188
- package/dist/common/basket.instance.d.ts +78 -0
- package/dist/common/basket.instance.js +132 -0
- package/dist/common/data.entry.instance.d.ts +39 -0
- package/dist/common/data.entry.instance.js +76 -0
- package/dist/common/http.client.d.ts +64 -0
- package/dist/common/http.client.js +133 -0
- package/dist/common/order.instance.d.ts +40 -0
- package/dist/common/order.instance.js +79 -0
- package/dist/common/product.instance.d.ts +33 -0
- package/dist/common/product.instance.js +63 -0
- package/dist/common/product.pagination.instance.d.ts +43 -0
- package/dist/common/product.pagination.instance.js +74 -0
- package/dist/common/product.search.instance.d.ts +22 -0
- package/dist/common/product.search.instance.js +40 -0
- package/dist/common/user.instance.d.ts +41 -0
- package/dist/common/user.instance.js +84 -0
- package/dist/config/auth.constants.d.ts +11 -0
- package/dist/config/auth.constants.js +11 -0
- package/dist/config/compile.constants.d.ts +67 -0
- package/dist/config/compile.constants.js +99 -0
- package/dist/config/constants.d.ts +5 -0
- package/dist/config/constants.js +5 -0
- package/dist/config/dev.constants.d.ts +65 -0
- package/dist/config/dev.constants.js +79 -0
- package/dist/config/init.constants.d.ts +23 -0
- package/dist/config/init.constants.js +41 -0
- package/dist/index.d.ts +19 -3
- package/dist/index.js +28 -44
- package/dist/interfaces/admin.d.ts +101 -0
- package/dist/interfaces/admin.js +5 -0
- package/dist/interfaces/agent.d.ts +107 -0
- package/dist/interfaces/agent.js +5 -0
- package/dist/interfaces/baskets.d.ts +135 -0
- package/dist/interfaces/baskets.js +19 -0
- package/dist/interfaces/chat.d.ts +61 -0
- package/dist/interfaces/chat.js +5 -0
- package/dist/interfaces/common.d.ts +62 -0
- package/dist/interfaces/common.js +8 -0
- package/dist/interfaces/compile.d.ts +11 -0
- package/dist/interfaces/compile.js +4 -0
- package/dist/interfaces/custom.data.d.ts +82 -0
- package/dist/interfaces/custom.data.js +5 -0
- package/dist/interfaces/deploy.d.ts +29 -0
- package/dist/interfaces/deploy.js +4 -0
- package/dist/interfaces/dev.d.ts +53 -0
- package/dist/interfaces/dev.js +5 -0
- package/dist/interfaces/init.d.ts +60 -0
- package/dist/interfaces/init.js +4 -0
- package/dist/interfaces/orders.d.ts +91 -0
- package/dist/interfaces/orders.js +19 -0
- package/dist/interfaces/product.d.ts +65 -0
- package/dist/interfaces/product.js +5 -0
- package/dist/interfaces/push.d.ts +26 -0
- package/dist/interfaces/push.js +4 -0
- package/dist/interfaces/test.d.ts +36 -0
- package/dist/interfaces/test.js +4 -0
- package/dist/services/auth.d.ts +54 -99
- package/dist/services/auth.js +76 -12
- package/dist/types/api-contracts.d.ts +211 -0
- package/dist/types/api-contracts.js +8 -0
- package/dist/types/compile.types.d.ts +76 -0
- package/dist/types/compile.types.js +4 -0
- package/dist/types/index.d.ts +23 -85
- package/dist/types/index.js +25 -14
- package/dist/types/skill.d.ts +142 -0
- package/dist/{skill.js → types/skill.js} +66 -19
- package/dist/types/tool-validation.d.ts +34 -0
- package/dist/types/tool-validation.js +42 -0
- package/dist/utils/auth-flows.d.ts +26 -0
- package/dist/utils/auth-flows.js +141 -0
- package/dist/utils/bundling.d.ts +36 -0
- package/dist/utils/bundling.js +137 -0
- package/dist/utils/compile.d.ts +37 -0
- package/dist/utils/compile.js +242 -0
- package/dist/utils/deploy-api.d.ts +26 -0
- package/dist/utils/deploy-api.js +53 -0
- package/dist/utils/deploy-helpers.d.ts +46 -0
- package/dist/utils/deploy-helpers.js +86 -0
- package/dist/utils/deployment.d.ts +25 -0
- package/dist/utils/deployment.js +161 -0
- package/dist/utils/dev-api.d.ts +61 -0
- package/dist/utils/dev-api.js +262 -0
- package/dist/utils/dev-helpers.d.ts +46 -0
- package/dist/utils/dev-helpers.js +83 -0
- package/dist/utils/dev-server.d.ts +24 -0
- package/dist/utils/dev-server.js +555 -0
- package/dist/utils/dev-watcher.d.ts +31 -0
- package/dist/utils/dev-watcher.js +110 -0
- package/dist/utils/files.js +0 -5
- package/dist/utils/init-agent.d.ts +34 -0
- package/dist/utils/init-agent.js +129 -0
- package/dist/utils/init-helpers.d.ts +41 -0
- package/dist/utils/init-helpers.js +73 -0
- package/dist/utils/init-prompts.d.ts +47 -0
- package/dist/utils/init-prompts.js +168 -0
- package/dist/utils/push-api.d.ts +15 -0
- package/dist/utils/push-api.js +48 -0
- package/dist/utils/push-helpers.d.ts +38 -0
- package/dist/utils/push-helpers.js +84 -0
- package/dist/utils/sandbox-storage.d.ts +27 -0
- package/dist/utils/sandbox-storage.js +71 -0
- package/dist/utils/sandbox.js +78 -118
- package/dist/utils/skill-management.d.ts +14 -0
- package/dist/utils/skill-management.js +148 -0
- package/dist/utils/test-helpers.d.ts +40 -0
- package/dist/utils/test-helpers.js +92 -0
- package/dist/utils/test-prompts.d.ts +23 -0
- package/dist/utils/test-prompts.js +186 -0
- package/dist/utils/tool-detection.d.ts +18 -0
- package/dist/utils/tool-detection.js +110 -0
- package/dist/web/app.css +14 -9
- package/package.json +11 -12
- package/template/QUICKSTART.md +299 -144
- package/template/README.md +928 -349
- package/template/TOOL_EXAMPLES.md +655 -0
- package/template/package-lock.json +3781 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +81 -40
- package/template/src/tools/BasketTool.ts +128 -0
- package/template/src/tools/CustomDataTool.ts +7 -13
- package/template/src/tools/OrderTool.ts +54 -0
- package/template/src/tools/PaymentTool.ts +1 -1
- package/template/src/tools/ProductsTool.ts +56 -118
- package/template/src/tools/UserDataTool.ts +4 -27
- package/dist/custom-data-api.d.ts +0 -72
- package/dist/custom-data-api.js +0 -174
- package/dist/product-api.d.ts +0 -197
- package/dist/product-api.js +0 -152
- package/dist/services/api.d.ts +0 -569
- package/dist/services/api.js +0 -625
- package/dist/skill.d.ts +0 -50
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/dist/user-data-api.d.ts +0 -39
- package/dist/user-data-api.js +0 -50
- package/template/API.md +0 -604
- package/template/DEVELOPER.md +0 -771
- package/template/lua.skill.yaml +0 -16
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { HttpClient } from "../common/http.client.js";
|
|
2
|
+
import DataEntryInstance from "../common/data.entry.instance.js";
|
|
3
|
+
// Custom Data API calls
|
|
4
|
+
export default class CustomDataApi extends HttpClient {
|
|
5
|
+
/**
|
|
6
|
+
* Creates an instance of CustomDataApi
|
|
7
|
+
* @param baseUrl - The base URL for the API
|
|
8
|
+
* @param apiKey - The API key for authentication
|
|
9
|
+
* @param agentId - The unique identifier of the agent
|
|
10
|
+
*/
|
|
11
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
12
|
+
super(baseUrl);
|
|
13
|
+
this.apiKey = apiKey;
|
|
14
|
+
this.agentId = agentId;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new custom data entry in a specified collection
|
|
18
|
+
* @param collectionName - The name of the collection to create the entry in
|
|
19
|
+
* @param data - The data object to store in the entry
|
|
20
|
+
* @param searchText - Optional text to be used for semantic search indexing
|
|
21
|
+
* @returns Promise resolving to a DataEntryInstance representing the created entry
|
|
22
|
+
* @throws Error if the entry creation fails or the API request is unsuccessful
|
|
23
|
+
*/
|
|
24
|
+
async create(collectionName, data, searchText) {
|
|
25
|
+
const response = await this.httpPost(`/developer/agents/${this.agentId}/custom-data/${collectionName}`, { data, searchText }, {
|
|
26
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
27
|
+
});
|
|
28
|
+
if (response.success) {
|
|
29
|
+
return new DataEntryInstance(this, response.data, collectionName);
|
|
30
|
+
}
|
|
31
|
+
throw new Error(response.error?.message || 'Failed to create custom data entry');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves custom data entries from a collection with optional filtering and pagination
|
|
35
|
+
* @param collectionName - The name of the collection to query
|
|
36
|
+
* @param filter - Optional filter object to apply to the query (JSON-serializable)
|
|
37
|
+
* @param page - The page number for pagination (default: 1)
|
|
38
|
+
* @param limit - The number of entries per page (default: 10)
|
|
39
|
+
* @returns Promise resolving to a GetCustomDataResponse containing the entries and pagination info
|
|
40
|
+
* @throws Error if the query fails or the API request is unsuccessful
|
|
41
|
+
*/
|
|
42
|
+
async get(collectionName, filter, page = 1, limit = 10) {
|
|
43
|
+
let url = `/developer/agents/${this.agentId}/custom-data/${collectionName}?page=${page}&limit=${limit}`;
|
|
44
|
+
if (filter) {
|
|
45
|
+
const encodedFilter = encodeURIComponent(JSON.stringify(filter));
|
|
46
|
+
url += `&filter=${encodedFilter}`;
|
|
47
|
+
}
|
|
48
|
+
const response = await this.httpGet(url, {
|
|
49
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
50
|
+
});
|
|
51
|
+
if (response.success) {
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
throw new Error(response.error?.message || 'Failed to get custom data entries');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves a single custom data entry by its ID
|
|
58
|
+
* @param collectionName - The name of the collection containing the entry
|
|
59
|
+
* @param entryId - The unique identifier of the entry to retrieve
|
|
60
|
+
* @returns Promise resolving to a DataEntryInstance representing the entry
|
|
61
|
+
* @throws Error if the entry is not found or the API request is unsuccessful
|
|
62
|
+
*/
|
|
63
|
+
async getEntry(collectionName, entryId) {
|
|
64
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, {
|
|
65
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
66
|
+
});
|
|
67
|
+
if (response.success) {
|
|
68
|
+
return new DataEntryInstance(this, response.data, collectionName);
|
|
69
|
+
}
|
|
70
|
+
throw new Error(response.error?.message || 'Failed to get custom data entry');
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Updates an existing custom data entry
|
|
74
|
+
* @param collectionName - The name of the collection containing the entry
|
|
75
|
+
* @param entryId - The unique identifier of the entry to update
|
|
76
|
+
* @param data - The update data containing fields to modify (data and/or searchText)
|
|
77
|
+
* @returns Promise resolving to an UpdateCustomDataResponse with the updated entry details
|
|
78
|
+
* @throws Error if the entry is not found or the update fails
|
|
79
|
+
*/
|
|
80
|
+
async update(collectionName, entryId, data) {
|
|
81
|
+
const response = await this.httpPut(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, data, {
|
|
82
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
83
|
+
});
|
|
84
|
+
if (response.success) {
|
|
85
|
+
return response.data;
|
|
86
|
+
}
|
|
87
|
+
throw new Error(response.error?.message || 'Failed to update custom data entry');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Performs semantic search on custom data entries using text similarity
|
|
91
|
+
* @param collectionName - The name of the collection to search within
|
|
92
|
+
* @param searchText - The text query to search for
|
|
93
|
+
* @param limit - Maximum number of results to return (default: 10)
|
|
94
|
+
* @param scoreThreshold - Minimum similarity score threshold 0-1 (default: 0.6)
|
|
95
|
+
* @returns Promise resolving to an array of DataEntryInstance objects matching the search
|
|
96
|
+
* @throws Error if the search fails or the API request is unsuccessful
|
|
97
|
+
*/
|
|
98
|
+
async search(collectionName, searchText, limit = 10, scoreThreshold = 0.6) {
|
|
99
|
+
const url = `/developer/agents/${this.agentId}/custom-data/${collectionName}/search?searchText=${encodeURIComponent(searchText)}&limit=${limit}&scoreThreshold=${scoreThreshold}`;
|
|
100
|
+
const response = await this.httpGet(url, {
|
|
101
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
102
|
+
});
|
|
103
|
+
if (response.success) {
|
|
104
|
+
const entries = response.data?.data || [];
|
|
105
|
+
return entries.map((entry) => new DataEntryInstance(this, entry, collectionName)) || [];
|
|
106
|
+
}
|
|
107
|
+
throw new Error(response.error?.message || 'Failed to search custom data entries');
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Deletes a custom data entry from a collection
|
|
111
|
+
* @param collectionName - The name of the collection containing the entry
|
|
112
|
+
* @param entryId - The unique identifier of the entry to delete
|
|
113
|
+
* @returns Promise resolving to a DeleteCustomDataResponse confirming deletion
|
|
114
|
+
* @throws Error if the entry is not found or the deletion fails
|
|
115
|
+
*/
|
|
116
|
+
async delete(collectionName, entryId) {
|
|
117
|
+
const response = await this.httpDelete(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, {
|
|
118
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
119
|
+
});
|
|
120
|
+
if (response.success) {
|
|
121
|
+
return response.data;
|
|
122
|
+
}
|
|
123
|
+
throw new Error(response.error?.message || 'Failed to delete custom data entry');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy-Loaded API Instances
|
|
3
|
+
* Provides singleton instances of API services with lazy initialization
|
|
4
|
+
*/
|
|
5
|
+
import ProductApiService from "./products.api.service.js";
|
|
6
|
+
import BasketApiService from "./basket.api.service.js";
|
|
7
|
+
import OrderApiService from "./order.api.service.js";
|
|
8
|
+
import UserDataApiService from "./user.data.api.service.js";
|
|
9
|
+
import CustomDataApiService from "./custom.data.api.service.js";
|
|
10
|
+
/**
|
|
11
|
+
* Gets or creates User Data API instance.
|
|
12
|
+
* Instance is created once and reused for subsequent calls.
|
|
13
|
+
*
|
|
14
|
+
* @returns UserDataApiService instance
|
|
15
|
+
*/
|
|
16
|
+
export declare function getUserInstance(): Promise<UserDataApiService>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets or creates Custom Data API instance.
|
|
19
|
+
* Instance is created once and reused for subsequent calls.
|
|
20
|
+
*
|
|
21
|
+
* @returns CustomDataApiService instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDataInstance(): Promise<CustomDataApiService>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets or creates Products API instance.
|
|
26
|
+
* Instance is created once and reused for subsequent calls.
|
|
27
|
+
*
|
|
28
|
+
* @returns ProductApiService instance
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProductsInstance(): Promise<ProductApiService>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets or creates Baskets API instance.
|
|
33
|
+
* Instance is created once and reused for subsequent calls.
|
|
34
|
+
*
|
|
35
|
+
* @returns BasketApiService instance
|
|
36
|
+
*/
|
|
37
|
+
export declare function getBasketsInstance(): Promise<BasketApiService>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets or creates Orders API instance.
|
|
40
|
+
* Instance is created once and reused for subsequent calls.
|
|
41
|
+
*
|
|
42
|
+
* @returns OrderApiService instance
|
|
43
|
+
*/
|
|
44
|
+
export declare function getOrderInstance(): Promise<OrderApiService>;
|
|
45
|
+
/**
|
|
46
|
+
* Clears all cached API instances.
|
|
47
|
+
* Useful for testing or when credentials change.
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearAllInstances(): void;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy-Loaded API Instances
|
|
3
|
+
* Provides singleton instances of API services with lazy initialization
|
|
4
|
+
*/
|
|
5
|
+
import { BASE_URLS } from "../config/constants.js";
|
|
6
|
+
import { getCredentials } from "./credentials.js";
|
|
7
|
+
import ProductApiService from "./products.api.service.js";
|
|
8
|
+
import BasketApiService from "./basket.api.service.js";
|
|
9
|
+
import OrderApiService from "./order.api.service.js";
|
|
10
|
+
import UserDataApiService from "./user.data.api.service.js";
|
|
11
|
+
import CustomDataApiService from "./custom.data.api.service.js";
|
|
12
|
+
/**
|
|
13
|
+
* Singleton instances (lazy-loaded)
|
|
14
|
+
*/
|
|
15
|
+
let _userInstance = null;
|
|
16
|
+
let _dataInstance = null;
|
|
17
|
+
let _productsInstance = null;
|
|
18
|
+
let _basketsInstance = null;
|
|
19
|
+
let _orderInstance = null;
|
|
20
|
+
/**
|
|
21
|
+
* Gets or creates User Data API instance.
|
|
22
|
+
* Instance is created once and reused for subsequent calls.
|
|
23
|
+
*
|
|
24
|
+
* @returns UserDataApiService instance
|
|
25
|
+
*/
|
|
26
|
+
export async function getUserInstance() {
|
|
27
|
+
if (!_userInstance) {
|
|
28
|
+
const creds = await getCredentials();
|
|
29
|
+
_userInstance = new UserDataApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
30
|
+
}
|
|
31
|
+
return _userInstance;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets or creates Custom Data API instance.
|
|
35
|
+
* Instance is created once and reused for subsequent calls.
|
|
36
|
+
*
|
|
37
|
+
* @returns CustomDataApiService instance
|
|
38
|
+
*/
|
|
39
|
+
export async function getDataInstance() {
|
|
40
|
+
if (!_dataInstance) {
|
|
41
|
+
const creds = await getCredentials();
|
|
42
|
+
_dataInstance = new CustomDataApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
43
|
+
}
|
|
44
|
+
return _dataInstance;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets or creates Products API instance.
|
|
48
|
+
* Instance is created once and reused for subsequent calls.
|
|
49
|
+
*
|
|
50
|
+
* @returns ProductApiService instance
|
|
51
|
+
*/
|
|
52
|
+
export async function getProductsInstance() {
|
|
53
|
+
if (!_productsInstance) {
|
|
54
|
+
const creds = await getCredentials();
|
|
55
|
+
_productsInstance = new ProductApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
56
|
+
}
|
|
57
|
+
return _productsInstance;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets or creates Baskets API instance.
|
|
61
|
+
* Instance is created once and reused for subsequent calls.
|
|
62
|
+
*
|
|
63
|
+
* @returns BasketApiService instance
|
|
64
|
+
*/
|
|
65
|
+
export async function getBasketsInstance() {
|
|
66
|
+
if (!_basketsInstance) {
|
|
67
|
+
const creds = await getCredentials();
|
|
68
|
+
_basketsInstance = new BasketApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
69
|
+
}
|
|
70
|
+
return _basketsInstance;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets or creates Orders API instance.
|
|
74
|
+
* Instance is created once and reused for subsequent calls.
|
|
75
|
+
*
|
|
76
|
+
* @returns OrderApiService instance
|
|
77
|
+
*/
|
|
78
|
+
export async function getOrderInstance() {
|
|
79
|
+
if (!_orderInstance) {
|
|
80
|
+
const creds = await getCredentials();
|
|
81
|
+
_orderInstance = new OrderApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
82
|
+
}
|
|
83
|
+
return _orderInstance;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Clears all cached API instances.
|
|
87
|
+
* Useful for testing or when credentials change.
|
|
88
|
+
*/
|
|
89
|
+
export function clearAllInstances() {
|
|
90
|
+
_userInstance = null;
|
|
91
|
+
_dataInstance = null;
|
|
92
|
+
_productsInstance = null;
|
|
93
|
+
_basketsInstance = null;
|
|
94
|
+
_orderInstance = null;
|
|
95
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { OrderAPI } from "../types/index.js";
|
|
2
|
+
import { HttpClient } from "../common/http.client.js";
|
|
3
|
+
import { CreateOrderRequest, OrderResponse } from "../interfaces/orders.js";
|
|
4
|
+
import { OrderStatus } from "../interfaces/orders.js";
|
|
5
|
+
import OrderInstance from "../common/order.instance.js";
|
|
6
|
+
export default class OrderApi extends HttpClient implements OrderAPI {
|
|
7
|
+
private apiKey;
|
|
8
|
+
private agentId;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of OrderApi
|
|
11
|
+
* @param baseUrl - The base URL for the API
|
|
12
|
+
* @param apiKey - The API key for authentication
|
|
13
|
+
* @param agentId - The unique identifier of the agent
|
|
14
|
+
*/
|
|
15
|
+
constructor(baseUrl: string, apiKey: string, agentId: string);
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new order from a basket
|
|
18
|
+
* @param orderData - The order creation request data containing basketId and additional order information
|
|
19
|
+
* @returns Promise resolving to an OrderInstance representing the created order
|
|
20
|
+
* @throws Error if the basket is not found or the order creation fails
|
|
21
|
+
*/
|
|
22
|
+
create(orderData: CreateOrderRequest): Promise<OrderInstance>;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the status of an existing order
|
|
25
|
+
* @param status - The new order status (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
|
|
26
|
+
* @param orderId - The unique identifier of the order to update
|
|
27
|
+
* @returns Promise resolving to the updated OrderResponse
|
|
28
|
+
* @throws Error if the order is not found or the status update fails
|
|
29
|
+
*/
|
|
30
|
+
updateStatus(status: OrderStatus, orderId: string): Promise<OrderResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Updates the data associated with an order
|
|
33
|
+
* @param data - The data object containing fields to update (e.g., shipping info, notes, metadata)
|
|
34
|
+
* @param orderId - The unique identifier of the order to update
|
|
35
|
+
* @returns Promise resolving to the updated OrderResponse
|
|
36
|
+
* @throws Error if the order is not found or the data update fails
|
|
37
|
+
*/
|
|
38
|
+
updateData(data: Record<string, any>, orderId: string): Promise<OrderResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves all user orders with optional status filtering
|
|
41
|
+
* @param status - Optional order status to filter by (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
|
|
42
|
+
* @returns Promise resolving to an array of OrderInstance objects
|
|
43
|
+
* @throws Error if the request fails or orders cannot be retrieved
|
|
44
|
+
*/
|
|
45
|
+
get(status?: OrderStatus): Promise<OrderInstance[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves a single order by its unique identifier
|
|
48
|
+
* @param orderId - The unique identifier of the order to retrieve
|
|
49
|
+
* @returns Promise resolving to an OrderInstance representing the order
|
|
50
|
+
* @throws Error if the order is not found or the request fails
|
|
51
|
+
*/
|
|
52
|
+
getById(orderId: string): Promise<OrderInstance>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { HttpClient } from "../common/http.client.js";
|
|
2
|
+
import OrderInstance from "../common/order.instance.js";
|
|
3
|
+
export default class OrderApi extends HttpClient {
|
|
4
|
+
/**
|
|
5
|
+
* Creates an instance of OrderApi
|
|
6
|
+
* @param baseUrl - The base URL for the API
|
|
7
|
+
* @param apiKey - The API key for authentication
|
|
8
|
+
* @param agentId - The unique identifier of the agent
|
|
9
|
+
*/
|
|
10
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
11
|
+
super(baseUrl);
|
|
12
|
+
this.apiKey = apiKey;
|
|
13
|
+
this.agentId = agentId;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new order from a basket
|
|
17
|
+
* @param orderData - The order creation request data containing basketId and additional order information
|
|
18
|
+
* @returns Promise resolving to an OrderInstance representing the created order
|
|
19
|
+
* @throws Error if the basket is not found or the order creation fails
|
|
20
|
+
*/
|
|
21
|
+
async create(orderData) {
|
|
22
|
+
const response = await this.httpPost(`/developer/agents/${this.agentId}/order`, orderData, {
|
|
23
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
24
|
+
});
|
|
25
|
+
if (response.success && response.data) {
|
|
26
|
+
const orderInstance = new OrderInstance(this, response.data);
|
|
27
|
+
return orderInstance;
|
|
28
|
+
}
|
|
29
|
+
throw new Error(response.error?.message || 'Failed to create order');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Updates the status of an existing order
|
|
33
|
+
* @param status - The new order status (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
|
|
34
|
+
* @param orderId - The unique identifier of the order to update
|
|
35
|
+
* @returns Promise resolving to the updated OrderResponse
|
|
36
|
+
* @throws Error if the order is not found or the status update fails
|
|
37
|
+
*/
|
|
38
|
+
async updateStatus(status, orderId) {
|
|
39
|
+
const response = await this.httpPut(`/developer/agents/${this.agentId}/order/${orderId}/${status}`, {}, {
|
|
40
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
41
|
+
});
|
|
42
|
+
if (response.success) {
|
|
43
|
+
return response.data;
|
|
44
|
+
}
|
|
45
|
+
throw new Error(response.error?.message || 'Failed to update order status');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Updates the data associated with an order
|
|
49
|
+
* @param data - The data object containing fields to update (e.g., shipping info, notes, metadata)
|
|
50
|
+
* @param orderId - The unique identifier of the order to update
|
|
51
|
+
* @returns Promise resolving to the updated OrderResponse
|
|
52
|
+
* @throws Error if the order is not found or the data update fails
|
|
53
|
+
*/
|
|
54
|
+
async updateData(data, orderId) {
|
|
55
|
+
const response = await this.httpPut(`/developer/agents/${this.agentId}/order/${orderId}`, data, {
|
|
56
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
57
|
+
});
|
|
58
|
+
if (response.success) {
|
|
59
|
+
return response.data;
|
|
60
|
+
}
|
|
61
|
+
throw new Error(response.error?.message || 'Failed to update order status');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves all user orders with optional status filtering
|
|
65
|
+
* @param status - Optional order status to filter by (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
|
|
66
|
+
* @returns Promise resolving to an array of OrderInstance objects
|
|
67
|
+
* @throws Error if the request fails or orders cannot be retrieved
|
|
68
|
+
*/
|
|
69
|
+
async get(status) {
|
|
70
|
+
const statusParam = status ? `?status=${status}` : '';
|
|
71
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/order/user${statusParam}`, {
|
|
72
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
73
|
+
});
|
|
74
|
+
if (response.success) {
|
|
75
|
+
const orders = response.data;
|
|
76
|
+
return orders.map((order) => new OrderInstance(this, order)) || [];
|
|
77
|
+
}
|
|
78
|
+
throw new Error(response.error?.message || 'Failed to get user orders');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves a single order by its unique identifier
|
|
82
|
+
* @param orderId - The unique identifier of the order to retrieve
|
|
83
|
+
* @returns Promise resolving to an OrderInstance representing the order
|
|
84
|
+
* @throws Error if the order is not found or the request fails
|
|
85
|
+
*/
|
|
86
|
+
async getById(orderId) {
|
|
87
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/order/${orderId}`, {
|
|
88
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
89
|
+
});
|
|
90
|
+
if (response.success && response.data) {
|
|
91
|
+
return new OrderInstance(this, response.data);
|
|
92
|
+
}
|
|
93
|
+
throw new Error(response.error?.message || 'Failed to get order');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { HttpClient } from "../common/http.client.js";
|
|
2
|
+
import { ProductAPI } from "../types/index.js";
|
|
3
|
+
import { Product } from "../interfaces/product.js";
|
|
4
|
+
import { UpdateProductResponse } from "../interfaces/product.js";
|
|
5
|
+
import { DeleteProductResponse } from "../interfaces/product.js";
|
|
6
|
+
import ProductInstance from "../common/product.instance.js";
|
|
7
|
+
import ProductPaginationInstance from "../common/product.pagination.instance.js";
|
|
8
|
+
import ProductSearchInstance from "../common/product.search.instance.js";
|
|
9
|
+
/**
|
|
10
|
+
* Product API calls
|
|
11
|
+
*/
|
|
12
|
+
export default class ProductApi extends HttpClient implements ProductAPI {
|
|
13
|
+
private apiKey;
|
|
14
|
+
private agentId;
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of ProductApi
|
|
17
|
+
* @param baseUrl - The base URL for the API
|
|
18
|
+
* @param apiKey - The API key for authentication
|
|
19
|
+
* @param agentId - The unique identifier of the agent
|
|
20
|
+
*/
|
|
21
|
+
constructor(baseUrl: string, apiKey: string, agentId: string);
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves all products for an agent with pagination support
|
|
24
|
+
* @param page - The page number for pagination (default: 1)
|
|
25
|
+
* @param limit - The number of products per page (default: 10)
|
|
26
|
+
* @returns Promise resolving to a ProductPaginationInstance containing products and pagination info
|
|
27
|
+
* @throws Error if the request fails or products cannot be retrieved
|
|
28
|
+
*/
|
|
29
|
+
get(page?: number, limit?: number): Promise<ProductPaginationInstance>;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves a single product by its unique identifier
|
|
32
|
+
* @param productId - The unique identifier of the product to retrieve
|
|
33
|
+
* @returns Promise resolving to a ProductInstance representing the product
|
|
34
|
+
* @throws Error if the product is not found or the request fails
|
|
35
|
+
*/
|
|
36
|
+
getById(productId: string): Promise<ProductInstance>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new product in the agent's catalog
|
|
39
|
+
* @param productData - The product data including name, description, price, images, and metadata
|
|
40
|
+
* @returns Promise resolving to a ProductInstance representing the created product
|
|
41
|
+
* @throws Error if the product creation fails or validation errors occur
|
|
42
|
+
*/
|
|
43
|
+
create(productData: Product): Promise<ProductInstance>;
|
|
44
|
+
/**
|
|
45
|
+
* Updates an existing product's information
|
|
46
|
+
* @param productData - The product data fields to update (partial update supported)
|
|
47
|
+
* @param productId - The unique identifier of the product to update
|
|
48
|
+
* @returns Promise resolving to an UpdateProductResponse with the updated product details
|
|
49
|
+
* @throws Error if the product is not found or the update fails
|
|
50
|
+
*/
|
|
51
|
+
update(productData: Record<string, any>, productId: string): Promise<UpdateProductResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Deletes a product from the agent's catalog
|
|
54
|
+
* @param productId - The unique identifier of the product to delete
|
|
55
|
+
* @returns Promise resolving to a DeleteProductResponse confirming deletion
|
|
56
|
+
* @throws Error if the product is not found or the deletion fails
|
|
57
|
+
*/
|
|
58
|
+
delete(productId: string): Promise<DeleteProductResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Performs semantic search on products using a text query
|
|
61
|
+
* @param searchQuery - The search text to find matching products
|
|
62
|
+
* @returns Promise resolving to a ProductSearchInstance containing search results
|
|
63
|
+
* @throws Error if the search fails or the API request is unsuccessful
|
|
64
|
+
*/
|
|
65
|
+
search(searchQuery: string): Promise<ProductSearchInstance>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { HttpClient } from "../common/http.client.js";
|
|
2
|
+
import ProductInstance from "../common/product.instance.js";
|
|
3
|
+
import ProductPaginationInstance from "../common/product.pagination.instance.js";
|
|
4
|
+
import ProductSearchInstance from "../common/product.search.instance.js";
|
|
5
|
+
/**
|
|
6
|
+
* Product API calls
|
|
7
|
+
*/
|
|
8
|
+
export default class ProductApi extends HttpClient {
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of ProductApi
|
|
11
|
+
* @param baseUrl - The base URL for the API
|
|
12
|
+
* @param apiKey - The API key for authentication
|
|
13
|
+
* @param agentId - The unique identifier of the agent
|
|
14
|
+
*/
|
|
15
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
16
|
+
super(baseUrl);
|
|
17
|
+
this.apiKey = apiKey;
|
|
18
|
+
this.agentId = agentId;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves all products for an agent with pagination support
|
|
22
|
+
* @param page - The page number for pagination (default: 1)
|
|
23
|
+
* @param limit - The number of products per page (default: 10)
|
|
24
|
+
* @returns Promise resolving to a ProductPaginationInstance containing products and pagination info
|
|
25
|
+
* @throws Error if the request fails or products cannot be retrieved
|
|
26
|
+
*/
|
|
27
|
+
async get(page = 1, limit = 10) {
|
|
28
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/products?page=${page}&limit=${limit}`, {
|
|
29
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
30
|
+
});
|
|
31
|
+
if (response.success) {
|
|
32
|
+
return new ProductPaginationInstance(this, response);
|
|
33
|
+
}
|
|
34
|
+
throw new Error(response.error?.message || 'Failed to get products');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a single product by its unique identifier
|
|
38
|
+
* @param productId - The unique identifier of the product to retrieve
|
|
39
|
+
* @returns Promise resolving to a ProductInstance representing the product
|
|
40
|
+
* @throws Error if the product is not found or the request fails
|
|
41
|
+
*/
|
|
42
|
+
async getById(productId) {
|
|
43
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/products/${productId}`, {
|
|
44
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
45
|
+
});
|
|
46
|
+
if (response.success && response.data) {
|
|
47
|
+
return new ProductInstance(this, response.data);
|
|
48
|
+
}
|
|
49
|
+
throw new Error(response.error?.message || 'Failed to get product');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new product in the agent's catalog
|
|
53
|
+
* @param productData - The product data including name, description, price, images, and metadata
|
|
54
|
+
* @returns Promise resolving to a ProductInstance representing the created product
|
|
55
|
+
* @throws Error if the product creation fails or validation errors occur
|
|
56
|
+
*/
|
|
57
|
+
async create(productData) {
|
|
58
|
+
const response = await this.httpPost(`/developer/agents/${this.agentId}/products`, productData, {
|
|
59
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
60
|
+
});
|
|
61
|
+
if (response.success && response.data) {
|
|
62
|
+
return new ProductInstance(this, response.data.product);
|
|
63
|
+
}
|
|
64
|
+
throw new Error(response.error?.message || 'Failed to create product');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Updates an existing product's information
|
|
68
|
+
* @param productData - The product data fields to update (partial update supported)
|
|
69
|
+
* @param productId - The unique identifier of the product to update
|
|
70
|
+
* @returns Promise resolving to an UpdateProductResponse with the updated product details
|
|
71
|
+
* @throws Error if the product is not found or the update fails
|
|
72
|
+
*/
|
|
73
|
+
async update(productData, productId) {
|
|
74
|
+
const response = await this.httpPut(`/developer/agents/${this.agentId}/products`, { ...productData, id: productId }, {
|
|
75
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
76
|
+
});
|
|
77
|
+
if (response.success) {
|
|
78
|
+
return response.data;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(response.error?.message || 'Failed to update product');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Deletes a product from the agent's catalog
|
|
84
|
+
* @param productId - The unique identifier of the product to delete
|
|
85
|
+
* @returns Promise resolving to a DeleteProductResponse confirming deletion
|
|
86
|
+
* @throws Error if the product is not found or the deletion fails
|
|
87
|
+
*/
|
|
88
|
+
async delete(productId) {
|
|
89
|
+
const response = await this.httpDelete(`/developer/agents/${this.agentId}/products/${productId}`, {
|
|
90
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
91
|
+
});
|
|
92
|
+
if (response.success) {
|
|
93
|
+
return response.data;
|
|
94
|
+
}
|
|
95
|
+
throw new Error(response.error?.message || 'Failed to delete product');
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Performs semantic search on products using a text query
|
|
99
|
+
* @param searchQuery - The search text to find matching products
|
|
100
|
+
* @returns Promise resolving to a ProductSearchInstance containing search results
|
|
101
|
+
* @throws Error if the search fails or the API request is unsuccessful
|
|
102
|
+
*/
|
|
103
|
+
async search(searchQuery) {
|
|
104
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/products/search?searchQuery=${encodeURIComponent(searchQuery)}`, {
|
|
105
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
106
|
+
});
|
|
107
|
+
if (response.success) {
|
|
108
|
+
return new ProductSearchInstance(this, response);
|
|
109
|
+
}
|
|
110
|
+
throw new Error(response.error?.message || 'Failed to search products');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { DevVersionResponse, UpdateDevVersionResponse } from "../interfaces/dev.js";
|
|
2
|
+
import { HttpClient } from "../common/http.client.js";
|
|
3
|
+
import { ApiResponse } from "../interfaces/common.js";
|
|
4
|
+
/**
|
|
5
|
+
* Skill API calls
|
|
6
|
+
*/
|
|
7
|
+
export default class SkillApi extends HttpClient {
|
|
8
|
+
private apiKey;
|
|
9
|
+
private agentId;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of SkillApi
|
|
12
|
+
* @param baseUrl - The base URL for the API
|
|
13
|
+
* @param apiKey - The API key for authentication
|
|
14
|
+
* @param agentId - The unique identifier of the agent
|
|
15
|
+
*/
|
|
16
|
+
constructor(baseUrl: string, apiKey: string, agentId: string);
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new skill for the agent
|
|
19
|
+
* @param skillData - The skill data including name, description, and optional context
|
|
20
|
+
* @returns Promise resolving to an ApiResponse containing the created skill details
|
|
21
|
+
* @throws Error if the skill creation fails or validation errors occur
|
|
22
|
+
*/
|
|
23
|
+
createSkill(skillData: any): Promise<ApiResponse<{
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
agentId: string;
|
|
28
|
+
context?: string;
|
|
29
|
+
}>>;
|
|
30
|
+
/**
|
|
31
|
+
* Pushes a new version of a skill to production
|
|
32
|
+
* @param skillId - The unique identifier of the skill
|
|
33
|
+
* @param versionData - The version data including code, configuration, and metadata
|
|
34
|
+
* @returns Promise resolving to an ApiResponse containing the created version details
|
|
35
|
+
* @throws Error if the skill is not found or the push operation fails
|
|
36
|
+
*/
|
|
37
|
+
pushSkill(skillId: string, versionData: any): Promise<ApiResponse<DevVersionResponse>>;
|
|
38
|
+
/**
|
|
39
|
+
* Pushes a new development/sandbox version of a skill for testing
|
|
40
|
+
* @param skillId - The unique identifier of the skill
|
|
41
|
+
* @param versionData - The version data including code, configuration, and metadata
|
|
42
|
+
* @returns Promise resolving to an ApiResponse containing the development version details
|
|
43
|
+
* @throws Error if the skill is not found or the push operation fails
|
|
44
|
+
*/
|
|
45
|
+
pushDevSkill(skillId: string, versionData: any): Promise<ApiResponse<DevVersionResponse>>;
|
|
46
|
+
/**
|
|
47
|
+
* Updates an existing development/sandbox version of a skill
|
|
48
|
+
* @param skillId - The unique identifier of the skill
|
|
49
|
+
* @param sandboxVersionId - The unique identifier of the sandbox version to update
|
|
50
|
+
* @param versionData - The updated version data including code, configuration, and metadata
|
|
51
|
+
* @returns Promise resolving to an ApiResponse containing the updated version details
|
|
52
|
+
* @throws Error if the skill or version is not found or the update fails
|
|
53
|
+
*/
|
|
54
|
+
updateDevSkill(skillId: string, sandboxVersionId: string, versionData: any): Promise<ApiResponse<UpdateDevVersionResponse>>;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves all versions of a specific skill
|
|
57
|
+
* @param skillId - The unique identifier of the skill
|
|
58
|
+
* @returns Promise resolving to an ApiResponse containing an array of skill versions
|
|
59
|
+
* @throws Error if the skill is not found or the request fails
|
|
60
|
+
*/
|
|
61
|
+
getSkillVersions(skillId: string): Promise<ApiResponse<{
|
|
62
|
+
versions: any[];
|
|
63
|
+
}>>;
|
|
64
|
+
/**
|
|
65
|
+
* Publishes a specific version of a skill to production
|
|
66
|
+
* @param skillId - The unique identifier of the skill
|
|
67
|
+
* @param version - The version identifier to publish
|
|
68
|
+
* @returns Promise resolving to an ApiResponse containing publication confirmation details
|
|
69
|
+
* @throws Error if the skill or version is not found or the publish operation fails
|
|
70
|
+
*/
|
|
71
|
+
publishSkillVersion(skillId: string, version: string): Promise<ApiResponse<{
|
|
72
|
+
message: string;
|
|
73
|
+
skillId: string;
|
|
74
|
+
activeVersionId: string;
|
|
75
|
+
publishedAt: string;
|
|
76
|
+
}>>;
|
|
77
|
+
}
|