@ductape/sdk 0.0.4-v85 → 0.0.4-v86
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/products/services/products.service.d.ts +39 -1
- package/dist/products/services/products.service.js +157 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +81 -0
- package/dist/types/productsBuilder.types.js +40 -1
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/vector/actions/action-manager.d.ts +139 -0
- package/dist/vector/actions/action-manager.js +355 -0
- package/dist/vector/actions/action-manager.js.map +1 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.js +13 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/types/action.interface.d.ts +195 -0
- package/dist/vector/types/action.interface.js +100 -0
- package/dist/vector/types/action.interface.js.map +1 -0
- package/dist/vector/types/index.d.ts +2 -0
- package/dist/vector/types/index.js +8 -1
- package/dist/vector/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IBootstrapActionParams, IBootstrapActionResponse, IBootstrapNotificationParams, IBootstrapNotificationResponse, IBootstrapStorageParams, IBootstrapStorageResponse } from '../../api/services/productsApi.service';
|
|
2
2
|
import { IApp, IAppAccess, IAppAction, IAppWebhook, ISample, IVersion } from '../../types/appBuilder.types';
|
|
3
3
|
import { IBuilderInit } from '../../types/index.types';
|
|
4
|
-
import { IActionDataParserInput, IActionRequest, ICreateProductsBuilder, IFeatureEvent, IFeatureInput, IFeatureSequence, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductFunction, IProductJobs, IParseActionEventInput, IParseInputStringInput, IParseInputStringMetaData, IProductStorage, IDbActionRequest, INotificationRequest, IProductQuota, IProductFallback, IProductDatabaseMigration, IQuotaOptions, IFallbackOptions, IProductSession, IFetchFilesPayload, IFetchUsersPayload, IProductAppHealth, IProductGraph, IProductWorkflow, IProductVector, IProductAgent, IProductLLMModel, IProductDatabaseTrigger } from '../../types/productsBuilder.types';
|
|
4
|
+
import { IActionDataParserInput, IActionRequest, ICreateProductsBuilder, IFeatureEvent, IFeatureInput, IFeatureSequence, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductFunction, IProductJobs, IParseActionEventInput, IParseInputStringInput, IParseInputStringMetaData, IProductStorage, IDbActionRequest, INotificationRequest, IProductQuota, IProductFallback, IProductDatabaseMigration, IQuotaOptions, IFallbackOptions, IProductSession, IFetchFilesPayload, IFetchUsersPayload, IProductAppHealth, IProductGraph, IProductWorkflow, IProductVector, IProductAgent, IProductLLMModel, IProductDatabaseTrigger, IProductVectorAction } from '../../types/productsBuilder.types';
|
|
5
5
|
import { KeyValuePair } from '../../imports/imports.types';
|
|
6
6
|
import { IProductNotification, INotificationEnv, IProductNotificationTemplate, IProductMessageBroker, IProductMessageBrokerTopic, IMessageBrokerProducer, IMessageBrokerConsumer, IFileURLPayload } from '../../types/processor.types';
|
|
7
7
|
import { IParsedSample } from '../../types/inputs.types';
|
|
@@ -105,6 +105,11 @@ export interface IProductsBuilderService {
|
|
|
105
105
|
fetchGraphAction(graphTag: string, actionTag: string): Promise<any | null>;
|
|
106
106
|
fetchGraphActions(graphTag: string): Promise<Array<any>>;
|
|
107
107
|
deleteGraphAction(graphTag: string, actionTag: string): Promise<void>;
|
|
108
|
+
createVectorAction(vectorTag: string, data: Partial<IProductVectorAction>): Promise<IProductVectorAction>;
|
|
109
|
+
updateVectorAction(vectorTag: string, data: Partial<IProductVectorAction>): Promise<IProductVectorAction>;
|
|
110
|
+
fetchVectorAction(vectorTag: string, actionTag: string): Promise<IProductVectorAction | null>;
|
|
111
|
+
fetchVectorActions(vectorTag: string): Promise<Array<IProductVectorAction>>;
|
|
112
|
+
deleteVectorAction(vectorTag: string, actionTag: string): Promise<void>;
|
|
108
113
|
createJob(data: Partial<IProductJobs>, throwErrorIfExists?: boolean): Promise<void>;
|
|
109
114
|
updateJob(tag: string, data: Partial<IProductJobs>): Promise<void>;
|
|
110
115
|
fetchJob(tag: string): Promise<IProductJobs | null>;
|
|
@@ -260,6 +265,39 @@ export default class ProductsBuilderService implements IProductsBuilderService {
|
|
|
260
265
|
* @param tag Vector config tag
|
|
261
266
|
*/
|
|
262
267
|
deleteVector(tag: string): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Create a new vector action
|
|
270
|
+
* @param vectorTag Vector database tag
|
|
271
|
+
* @param data Vector action data
|
|
272
|
+
* @returns Created vector action
|
|
273
|
+
*/
|
|
274
|
+
createVectorAction(vectorTag: string, data: Partial<IProductVectorAction>): Promise<IProductVectorAction>;
|
|
275
|
+
/**
|
|
276
|
+
* Update an existing vector action
|
|
277
|
+
* @param vectorTag Vector database tag
|
|
278
|
+
* @param data Vector action update data (must include tag)
|
|
279
|
+
* @returns Updated vector action
|
|
280
|
+
*/
|
|
281
|
+
updateVectorAction(vectorTag: string, data: Partial<IProductVectorAction>): Promise<IProductVectorAction>;
|
|
282
|
+
/**
|
|
283
|
+
* Fetch a specific vector action
|
|
284
|
+
* @param vectorTag Vector database tag
|
|
285
|
+
* @param actionTag Action tag
|
|
286
|
+
* @returns Vector action or null
|
|
287
|
+
*/
|
|
288
|
+
fetchVectorAction(vectorTag: string, actionTag: string): Promise<IProductVectorAction | null>;
|
|
289
|
+
/**
|
|
290
|
+
* Fetch all vector actions for a vector database
|
|
291
|
+
* @param vectorTag Vector database tag
|
|
292
|
+
* @returns Array of vector actions
|
|
293
|
+
*/
|
|
294
|
+
fetchVectorActions(vectorTag: string): Promise<Array<IProductVectorAction>>;
|
|
295
|
+
/**
|
|
296
|
+
* Delete a vector action
|
|
297
|
+
* @param vectorTag Vector database tag
|
|
298
|
+
* @param actionTag Action tag to delete
|
|
299
|
+
*/
|
|
300
|
+
deleteVectorAction(vectorTag: string, actionTag: string): Promise<void>;
|
|
263
301
|
/**
|
|
264
302
|
* Create a new agent configuration
|
|
265
303
|
* @param data Agent configuration data
|
|
@@ -1797,6 +1797,163 @@ class ProductsBuilderService {
|
|
|
1797
1797
|
throw e;
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
|
+
// ==================== VECTOR ACTION METHODS ====================
|
|
1801
|
+
/**
|
|
1802
|
+
* Create a new vector action
|
|
1803
|
+
* @param vectorTag Vector database tag
|
|
1804
|
+
* @param data Vector action data
|
|
1805
|
+
* @returns Created vector action
|
|
1806
|
+
*/
|
|
1807
|
+
async createVectorAction(vectorTag, data) {
|
|
1808
|
+
try {
|
|
1809
|
+
const vector = await this.fetchVector(vectorTag);
|
|
1810
|
+
if (!vector) {
|
|
1811
|
+
throw new Error(`Vector with tag: ${vectorTag} not found`);
|
|
1812
|
+
}
|
|
1813
|
+
if (!data.tag) {
|
|
1814
|
+
throw new Error('Action tag is required');
|
|
1815
|
+
}
|
|
1816
|
+
if (!data.name) {
|
|
1817
|
+
throw new Error('Action name is required');
|
|
1818
|
+
}
|
|
1819
|
+
// Parse the tag to get action-only part (format: vector_tag:action_tag)
|
|
1820
|
+
const tagParts = data.tag.split(':');
|
|
1821
|
+
const actionTag = tagParts.length > 1 ? tagParts[tagParts.length - 1] : data.tag;
|
|
1822
|
+
// Check if action already exists
|
|
1823
|
+
const existingActions = vector.actions || [];
|
|
1824
|
+
const exists = existingActions.find(a => a.tag === data.tag || a.tag === `${vectorTag}:${actionTag}`);
|
|
1825
|
+
if (exists) {
|
|
1826
|
+
throw new Error(`Vector action with tag: ${data.tag} already exists`);
|
|
1827
|
+
}
|
|
1828
|
+
// Build the full action tag
|
|
1829
|
+
const fullTag = data.tag.includes(':') ? data.tag : `${vectorTag}:${actionTag}`;
|
|
1830
|
+
const newAction = {
|
|
1831
|
+
name: data.name,
|
|
1832
|
+
tag: fullTag,
|
|
1833
|
+
description: data.description,
|
|
1834
|
+
type: data.type,
|
|
1835
|
+
template: data.template || { options: {} },
|
|
1836
|
+
parameters: data.parameters || [],
|
|
1837
|
+
created_at: new Date(),
|
|
1838
|
+
updated_at: new Date(),
|
|
1839
|
+
};
|
|
1840
|
+
// Add to vector's actions array
|
|
1841
|
+
const updatedActions = [...existingActions, newAction];
|
|
1842
|
+
await this.productApi.updateProduct(this.product_id, {
|
|
1843
|
+
tag: vectorTag,
|
|
1844
|
+
actions: updatedActions,
|
|
1845
|
+
component: enums_1.ProductComponents.VECTOR,
|
|
1846
|
+
action: enums_1.RequestAction.UPDATE,
|
|
1847
|
+
}, this.getUserAccess());
|
|
1848
|
+
return newAction;
|
|
1849
|
+
}
|
|
1850
|
+
catch (e) {
|
|
1851
|
+
throw e;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Update an existing vector action
|
|
1856
|
+
* @param vectorTag Vector database tag
|
|
1857
|
+
* @param data Vector action update data (must include tag)
|
|
1858
|
+
* @returns Updated vector action
|
|
1859
|
+
*/
|
|
1860
|
+
async updateVectorAction(vectorTag, data) {
|
|
1861
|
+
try {
|
|
1862
|
+
const vector = await this.fetchVector(vectorTag);
|
|
1863
|
+
if (!vector) {
|
|
1864
|
+
throw new Error(`Vector with tag: ${vectorTag} not found`);
|
|
1865
|
+
}
|
|
1866
|
+
if (!data.tag) {
|
|
1867
|
+
throw new Error('Action tag is required');
|
|
1868
|
+
}
|
|
1869
|
+
const existingActions = vector.actions || [];
|
|
1870
|
+
const actionIndex = existingActions.findIndex(a => a.tag === data.tag);
|
|
1871
|
+
if (actionIndex === -1) {
|
|
1872
|
+
throw new Error(`Vector action with tag: ${data.tag} not found`);
|
|
1873
|
+
}
|
|
1874
|
+
// Merge with existing action
|
|
1875
|
+
const updatedAction = Object.assign(Object.assign(Object.assign({}, existingActions[actionIndex]), data), { updated_at: new Date() });
|
|
1876
|
+
// Update in the array
|
|
1877
|
+
const updatedActions = [...existingActions];
|
|
1878
|
+
updatedActions[actionIndex] = updatedAction;
|
|
1879
|
+
await this.productApi.updateProduct(this.product_id, {
|
|
1880
|
+
tag: vectorTag,
|
|
1881
|
+
actions: updatedActions,
|
|
1882
|
+
component: enums_1.ProductComponents.VECTOR,
|
|
1883
|
+
action: enums_1.RequestAction.UPDATE,
|
|
1884
|
+
}, this.getUserAccess());
|
|
1885
|
+
return updatedAction;
|
|
1886
|
+
}
|
|
1887
|
+
catch (e) {
|
|
1888
|
+
throw e;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Fetch a specific vector action
|
|
1893
|
+
* @param vectorTag Vector database tag
|
|
1894
|
+
* @param actionTag Action tag
|
|
1895
|
+
* @returns Vector action or null
|
|
1896
|
+
*/
|
|
1897
|
+
async fetchVectorAction(vectorTag, actionTag) {
|
|
1898
|
+
try {
|
|
1899
|
+
const vector = await this.fetchVector(vectorTag);
|
|
1900
|
+
if (!vector) {
|
|
1901
|
+
return null;
|
|
1902
|
+
}
|
|
1903
|
+
const actions = vector.actions || [];
|
|
1904
|
+
const action = actions.find(a => a.tag === actionTag || a.tag === `${vectorTag}:${actionTag}`);
|
|
1905
|
+
return action || null;
|
|
1906
|
+
}
|
|
1907
|
+
catch (e) {
|
|
1908
|
+
throw e;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Fetch all vector actions for a vector database
|
|
1913
|
+
* @param vectorTag Vector database tag
|
|
1914
|
+
* @returns Array of vector actions
|
|
1915
|
+
*/
|
|
1916
|
+
async fetchVectorActions(vectorTag) {
|
|
1917
|
+
try {
|
|
1918
|
+
const vector = await this.fetchVector(vectorTag);
|
|
1919
|
+
if (!vector) {
|
|
1920
|
+
return [];
|
|
1921
|
+
}
|
|
1922
|
+
return vector.actions || [];
|
|
1923
|
+
}
|
|
1924
|
+
catch (e) {
|
|
1925
|
+
throw e;
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Delete a vector action
|
|
1930
|
+
* @param vectorTag Vector database tag
|
|
1931
|
+
* @param actionTag Action tag to delete
|
|
1932
|
+
*/
|
|
1933
|
+
async deleteVectorAction(vectorTag, actionTag) {
|
|
1934
|
+
try {
|
|
1935
|
+
const vector = await this.fetchVector(vectorTag);
|
|
1936
|
+
if (!vector) {
|
|
1937
|
+
throw new Error(`Vector with tag: ${vectorTag} not found`);
|
|
1938
|
+
}
|
|
1939
|
+
const existingActions = vector.actions || [];
|
|
1940
|
+
const actionIndex = existingActions.findIndex(a => a.tag === actionTag || a.tag === `${vectorTag}:${actionTag}`);
|
|
1941
|
+
if (actionIndex === -1) {
|
|
1942
|
+
throw new Error(`Vector action with tag: ${actionTag} not found`);
|
|
1943
|
+
}
|
|
1944
|
+
// Remove from array
|
|
1945
|
+
const updatedActions = existingActions.filter((_, idx) => idx !== actionIndex);
|
|
1946
|
+
await this.productApi.updateProduct(this.product_id, {
|
|
1947
|
+
tag: vectorTag,
|
|
1948
|
+
actions: updatedActions,
|
|
1949
|
+
component: enums_1.ProductComponents.VECTOR,
|
|
1950
|
+
action: enums_1.RequestAction.UPDATE,
|
|
1951
|
+
}, this.getUserAccess());
|
|
1952
|
+
}
|
|
1953
|
+
catch (e) {
|
|
1954
|
+
throw e;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1800
1957
|
// ==================== AGENT METHODS ====================
|
|
1801
1958
|
/**
|
|
1802
1959
|
* Create a new agent configuration
|