@vertesia/client 0.53.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +3 -3
  2. package/lib/cjs/ApiKeysApi.js +1 -1
  3. package/lib/cjs/EnvironmentsApi.js +2 -2
  4. package/lib/cjs/InteractionBase.js +1 -1
  5. package/lib/cjs/InteractionsApi.js +5 -5
  6. package/lib/cjs/PluginsApi.js +25 -0
  7. package/lib/cjs/PluginsApi.js.map +1 -0
  8. package/lib/cjs/ProjectsApi.js +6 -0
  9. package/lib/cjs/ProjectsApi.js.map +1 -1
  10. package/lib/cjs/PromptsApi.js +1 -1
  11. package/lib/cjs/client.js +2 -0
  12. package/lib/cjs/client.js.map +1 -1
  13. package/lib/cjs/execute.js +5 -5
  14. package/lib/cjs/execute.js.map +1 -1
  15. package/lib/cjs/store/ObjectsApi.js +101 -37
  16. package/lib/cjs/store/ObjectsApi.js.map +1 -1
  17. package/lib/esm/ApiKeysApi.js +1 -1
  18. package/lib/esm/EnvironmentsApi.js +2 -2
  19. package/lib/esm/InteractionBase.js +1 -1
  20. package/lib/esm/InteractionsApi.js +5 -5
  21. package/lib/esm/PluginsApi.js +22 -0
  22. package/lib/esm/PluginsApi.js.map +1 -0
  23. package/lib/esm/ProjectsApi.js +6 -0
  24. package/lib/esm/ProjectsApi.js.map +1 -1
  25. package/lib/esm/PromptsApi.js +1 -1
  26. package/lib/esm/client.js +2 -0
  27. package/lib/esm/client.js.map +1 -1
  28. package/lib/esm/execute.js +5 -5
  29. package/lib/esm/execute.js.map +1 -1
  30. package/lib/esm/store/ObjectsApi.js +104 -40
  31. package/lib/esm/store/ObjectsApi.js.map +1 -1
  32. package/lib/tsconfig.tsbuildinfo +1 -1
  33. package/lib/types/ApiKeysApi.d.ts +1 -1
  34. package/lib/types/EnvironmentsApi.d.ts +2 -2
  35. package/lib/types/InteractionBase.d.ts +1 -1
  36. package/lib/types/InteractionsApi.d.ts +5 -5
  37. package/lib/types/PluginsApi.d.ts +14 -0
  38. package/lib/types/PluginsApi.d.ts.map +1 -0
  39. package/lib/types/ProjectsApi.d.ts +6 -2
  40. package/lib/types/ProjectsApi.d.ts.map +1 -1
  41. package/lib/types/PromptsApi.d.ts +1 -1
  42. package/lib/types/client.d.ts +2 -0
  43. package/lib/types/client.d.ts.map +1 -1
  44. package/lib/types/execute.d.ts +2 -2
  45. package/lib/types/execute.d.ts.map +1 -1
  46. package/lib/types/store/ObjectsApi.d.ts +40 -7
  47. package/lib/types/store/ObjectsApi.d.ts.map +1 -1
  48. package/package.json +5 -5
  49. package/src/ApiKeysApi.ts +1 -1
  50. package/src/EnvironmentsApi.ts +2 -2
  51. package/src/InteractionBase.ts +1 -1
  52. package/src/InteractionsApi.ts +5 -5
  53. package/src/PluginsApi.ts +28 -0
  54. package/src/ProjectsApi.ts +10 -2
  55. package/src/PromptsApi.ts +1 -1
  56. package/src/client.ts +2 -0
  57. package/src/execute.ts +5 -5
  58. package/src/store/ObjectsApi.ts +179 -86
@@ -1,8 +1,8 @@
1
- import { ApiTopic, ClientBase } from '@vertesia/api-fetch-client';
2
- import { ComplexSearchPayload, ComputeObjectFacetPayload, ContentObject, ContentObjectItem, ContentSource, CreateContentObjectPayload, Embedding, ExportPropertiesPayload, ExportPropertiesResponse, FindPayload, GetFileUrlResponse, GetRenditionResponse, GetUploadUrlPayload, ListWorkflowRunsResponse, ObjectSearchPayload, SupportedEmbeddingTypes } from '@vertesia/common';
3
- import { StreamSource } from '../StreamSource.js';
4
- import { AnalyzeDocApi } from './AnalyzeDocApi.js';
5
- export interface UploadContentObjectPayload extends Omit<CreateContentObjectPayload, 'content'> {
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import { ComplexSearchPayload, ComputeObjectFacetPayload, ContentObject, ContentObjectItem, ContentSource, CreateContentObjectPayload, Embedding, ExportPropertiesPayload, ExportPropertiesResponse, FindPayload, GetFileUrlResponse, GetRenditionResponse, GetUploadUrlPayload, ListWorkflowRunsResponse, ObjectSearchPayload, SupportedEmbeddingTypes } from "@vertesia/common";
3
+ import { StreamSource } from "../StreamSource.js";
4
+ import { AnalyzeDocApi } from "./AnalyzeDocApi.js";
5
+ export interface UploadContentObjectPayload extends Omit<CreateContentObjectPayload, "content"> {
6
6
  content?: StreamSource | File | {
7
7
  source: string;
8
8
  name?: string;
@@ -35,10 +35,22 @@ export declare class ObjectsApi extends ApiTopic {
35
35
  url: string;
36
36
  }>;
37
37
  getContentSource(objectId: string): Promise<ContentSource>;
38
- list(payload?: ObjectSearchPayload): Promise<ContentObjectItem[]>;
38
+ /**
39
+ * List objects with revision filtering options
40
+ *
41
+ * @param payload Search/filter parameters
42
+ * @returns Matching content objects
43
+ */
44
+ list<T = any>(payload?: ObjectSearchPayload): Promise<ContentObjectItem<T>[]>;
39
45
  computeFacets(query: ComputeObjectFacetPayload): Promise<ComputeFacetsResponse>;
40
46
  listFolders(path?: string): void;
47
+ /** Find object based on query */
41
48
  find(payload: FindPayload): Promise<ContentObject[]>;
49
+ /** Count number of objects matching this query */
50
+ count(payload: FindPayload): Promise<{
51
+ count: number;
52
+ }>;
53
+ /** Search object — different from find because allow full text search */
42
54
  search(payload: ComplexSearchPayload): Promise<ContentObjectItem[]>;
43
55
  retrieve(id: string, select?: string): Promise<ContentObject>;
44
56
  getObjectText(id: string): Promise<{
@@ -60,7 +72,28 @@ export declare class ObjectsApi extends ApiTopic {
60
72
  * @returns
61
73
  */
62
74
  createFromExternalSource(uri: string, payload?: CreateContentObjectPayload): Promise<ContentObject>;
63
- update(id: string, payload: Partial<CreateContentObjectPayload>): Promise<ContentObject>;
75
+ /**
76
+ * Updates an existing object or creates a new revision
77
+ * Handles file uploads similar to the create method
78
+ *
79
+ * @param id The ID of the object to update
80
+ * @param payload The changes to apply
81
+ * @param options Additional options
82
+ * @param options.createRevision Whether to create a new revision instead of updating in place
83
+ * @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
84
+ * @returns The updated object or newly created revision
85
+ */
86
+ update(id: string, payload: Partial<CreateContentObjectPayload>, options?: {
87
+ createRevision?: boolean;
88
+ revisionLabel?: string;
89
+ }): Promise<ContentObject>;
90
+ /**
91
+ * Retrieves all revisions of a content object
92
+ *
93
+ * @param id The ID of any revision in the object's history
94
+ * @returns Array of all revisions sharing the same root
95
+ */
96
+ getRevisions(id: string): Promise<ContentObjectItem[]>;
64
97
  delete(id: string): Promise<{
65
98
  id: string;
66
99
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectsApi.d.ts","sourceRoot":"","sources":["../../../src/store/ObjectsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,0BAA0B,EAAE,SAAS,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,WAAW,EAAqB,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAqB,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAExZ,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC;IAC3F,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG;QAG5B,MAAM,EAAE,MAAM,CAAC;QAEf,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd,IAAI,CAAC,EAAE,MAAM,CAAA;QAGb,EAAE,CAAC,EAAE,MAAM,CAAA;KAEd,CAAA;CACJ;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAA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AM,CAAC;KAC1B,GACF,OAAO,CAAC,aAAa,CAAC;IAyBzB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3C,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAIvE,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIhE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAS5F,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAMrF,YAAY,CACR,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,SAAS,GACnB,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;CAKzD;AAED,UAAU,kBAAkB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC"}
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@vertesia/client",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "type": "module",
5
5
  "types": "./lib/types/index.d.ts",
6
6
  "files": [
7
7
  "lib",
8
8
  "src"
9
9
  ],
10
+ "license": "Apache-2.0",
10
11
  "devDependencies": {
11
- "@types/eventsource": "^1.1.14",
12
12
  "@types/node": "^22.13.5",
13
13
  "ts-dual-module": "^0.6.3",
14
14
  "typescript": "^5.0.2",
15
15
  "vitest": "^3.0.9"
16
16
  },
17
17
  "dependencies": {
18
- "eventsource": "^2.0.2",
19
- "@vertesia/api-fetch-client": "0.52.0",
18
+ "eventsource": "^3.0.6",
20
19
  "@llumiverse/core": "0.17.0",
21
- "@vertesia/common": "0.52.0"
20
+ "@vertesia/common": "0.55.0",
21
+ "@vertesia/api-fetch-client": "0.55.0"
22
22
  },
23
23
  "ts_dual_module": {
24
24
  "outDir": "lib"
package/src/ApiKeysApi.ts CHANGED
@@ -50,7 +50,7 @@ export class ApiKeysApi extends ApiTopic {
50
50
  }
51
51
 
52
52
  /**
53
- * get or create a temporary public key which can be used from browser to browse and execute itneractions.
53
+ * get or create a temporary public key which can be used from browser to browse and execute interactions.
54
54
  * If a public key already exists for the given project (or for the current organization) then it is returned, otherwise a new one is created.
55
55
  * The payload object can contain the following properties:
56
56
  * - name: the name of the public key. If not specified a random name is generated.
@@ -34,8 +34,8 @@ export default class EnvironmentsApi extends ApiTopic {
34
34
  }
35
35
 
36
36
  /**
37
- * udpate enabled models and / or config. If enabled_models is not provided, the existing enabled models will not change.
38
- * Same, if config is not provioded the exiting config is not changed.
37
+ * Update enabled models and / or config. If enabled_models is not provided, the existing enabled models will not change.
38
+ * Same, if config is not provided the exiting config is not changed.
39
39
  * If the config is provided then it will be updated without removing fields that are not provided.
40
40
  *
41
41
  * @param id
@@ -31,7 +31,7 @@ export class InteractionBase<P = any, R = any> {
31
31
  * the run completes or fails.
32
32
  * If the onChunk callback is passed then the streaming of the result is enabled.
33
33
  * The onChunk callback with be called with the next chunk of the result as soon as it is available.
34
- * When all chunks are received the fucntion will return the resolved promise
34
+ * When all chunks are received the function will return the resolved promise
35
35
  * @param id of the interaction to execute
36
36
  * @param payload InteractionExecutionPayload
37
37
  * @param onChunk callback to be called when the next chunk of the response is available
@@ -32,7 +32,7 @@ export default class InteractionsApi extends ApiTopic {
32
32
  });
33
33
  }
34
34
  /**
35
- * Find interractions given a mongo match query.
35
+ * Find interactions given a mongo match query.
36
36
  * You can also specify if prompts schemas are included in the result
37
37
  */
38
38
  listEndpoints(payload: InteractionEndpointQuery): Promise<InteractionRef[]> {
@@ -92,7 +92,7 @@ export default class InteractionsApi extends ApiTopic {
92
92
  }
93
93
 
94
94
  /**
95
- * Retrieve an existing interaction definiton
95
+ * Retrieve an existing interaction definition
96
96
  * @param id of the interaction to retrieve
97
97
  * @returns Interaction
98
98
  **/
@@ -101,7 +101,7 @@ export default class InteractionsApi extends ApiTopic {
101
101
  }
102
102
 
103
103
  /**
104
- * Update an existing interaction definiton
104
+ * Update an existing interaction definition
105
105
  * @param id of the interaction to update
106
106
  * @param payload InteractionUpdatePayload
107
107
  * @returns Interaction
@@ -121,7 +121,7 @@ export default class InteractionsApi extends ApiTopic {
121
121
  * the run completes or fails.
122
122
  * If the onChunk callback is passed then the streaming of the result is enabled.
123
123
  * The onChunk callback with be called with the next chunk of the result as soon as it is available.
124
- * When all chunks are received the fucntion will return the resolved promise
124
+ * When all chunks are received the function will return the resolved promise
125
125
  * @param id of the interaction to execute
126
126
  * @param payload InteractionExecutionPayload
127
127
  * @param onChunk callback to be called when the next chunk of the response is available
@@ -146,7 +146,7 @@ export default class InteractionsApi extends ApiTopic {
146
146
  /**
147
147
  * Same as execute but uses the interaction name selector instead of the id.
148
148
  *
149
- * A name selector is the interaction endpoint name suffuxed with an optional tag or version wich is starting with a `@` character.
149
+ * A name selector is the interaction endpoint name suffixed with an optional tag or version which is starting with a `@` character.
150
150
  * The special `draft` tag is used to select the draft version of the interaction. If no tag or version is specified then the latest version is selected.
151
151
  * Examples of selectors:
152
152
  * - `ReviewContract` - select the latest version of the ReviewContract interaction
@@ -0,0 +1,28 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import type { PluginManifest } from "@vertesia/common";
3
+
4
+ export default class PluginsApi extends ApiTopic {
5
+
6
+ constructor(parent: ClientBase) {
7
+ super(parent, "/api/v1/plugins")
8
+ }
9
+
10
+ create(manifest: Omit<PluginManifest, 'id'>): Promise<PluginManifest> {
11
+ return this.post('/', { payload: manifest });
12
+ }
13
+
14
+ update(manifest: PluginManifest) {
15
+ return this.put(`/${manifest.id}`, { payload: manifest });
16
+ }
17
+
18
+ /**
19
+ * If a project ID is specified through the project query param
20
+ * then only the plugins that are enabled on the project are returned.
21
+ * @param query
22
+ * @returns
23
+ */
24
+ list(): Promise<PluginManifest[]> {
25
+ return this.get('/');
26
+ }
27
+
28
+ }
@@ -1,5 +1,5 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
- import { AwsConfiguration, GithubConfiguration, GladiaConfiguration, ICreateProjectPayload, MacgicPdfConfiguration, Project, ProjectIntegrationListEntry, ProjectRef, SupportedIntegrations } from "@vertesia/common";
2
+ import { AwsConfiguration, GithubConfiguration, GladiaConfiguration, ICreateProjectPayload, MagicPdfConfiguration, PluginManifest, Project, ProjectIntegrationListEntry, ProjectRef, SupportedIntegrations } from "@vertesia/common";
3
3
 
4
4
  export default class ProjectsApi extends ApiTopic {
5
5
  constructor(parent: ClientBase) {
@@ -26,6 +26,14 @@ export default class ProjectsApi extends ApiTopic {
26
26
  });
27
27
  }
28
28
 
29
+ listPlugins(projectId: string): Promise<PluginManifest[]> {
30
+ return this.get(`/${projectId}/plugins`);
31
+ }
32
+
33
+ setPlugins(projectId: string, pluginIds: string[]): Promise<{ count: number }> {
34
+ return this.post(`/${projectId}/plugins`, { payload: { plugins: pluginIds } });
35
+ }
36
+
29
37
  integrations: IntegrationsConfigurationApi = new IntegrationsConfigurationApi(this);
30
38
 
31
39
  }
@@ -40,7 +48,7 @@ class IntegrationsConfigurationApi extends ApiTopic {
40
48
  return this.get(`/${projectId}/integrations`).then(res => res.integrations);
41
49
  }
42
50
 
43
- retrieve(projectId: string, integrationId: SupportedIntegrations): Promise<GladiaConfiguration | GithubConfiguration | AwsConfiguration | MacgicPdfConfiguration | undefined> {
51
+ retrieve(projectId: string, integrationId: SupportedIntegrations): Promise<GladiaConfiguration | GithubConfiguration | AwsConfiguration | MagicPdfConfiguration | undefined> {
44
52
  return this.get(`/${projectId}/integrations/${integrationId}`).catch(err => {
45
53
  if (err.status === 404) {
46
54
  return undefined;
package/src/PromptsApi.ts CHANGED
@@ -123,7 +123,7 @@ export default class PromptsApi extends ApiTopic {
123
123
  }
124
124
 
125
125
  /**
126
- * List the versions of the prompt template. Returens an empty array if no versions are found
126
+ * List the versions of the prompt template. Returns an empty array if no versions are found
127
127
  * @param id
128
128
  * @returns the versions list or an empty array if no versions are found
129
129
  */
package/src/client.ts CHANGED
@@ -15,6 +15,7 @@ import { RunsApi } from "./RunsApi.js";
15
15
  import { ZenoClient } from "./store/client.js";
16
16
  import TrainingApi from "./TrainingApi.js";
17
17
  import UsersApi from "./UsersApi.js";
18
+ import PluginsApi from "./PluginsApi.js";
18
19
 
19
20
  /**
20
21
  * 1 min threshold constant in ms
@@ -218,6 +219,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
218
219
  iam = new IamApi(this);
219
220
  refs = new RefsApi(this);
220
221
  commands = new CommandsApi(this);
222
+ plugins = new PluginsApi(this);
221
223
  }
222
224
 
223
225
  function isApiKey(apiKey: string) {
package/src/execute.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { AsyncExecutionPayload, ExecutionRunStatus, InteractionExecutionPayload, InteractionExecutionResult, NamedInteractionExecutionPayload } from '@vertesia/common';
2
2
  import { VertesiaClient } from './client.js';
3
3
 
4
- export function EventSourceProvider(): Promise<typeof EventSource> {
4
+ export async function EventSourceProvider(): Promise<typeof EventSource> {
5
5
  if (typeof globalThis.EventSource === 'function') {
6
- return Promise.resolve(globalThis.EventSource)
6
+ return globalThis.EventSource;
7
7
  } else {
8
- return import('eventsource').then(module => module.default as unknown as typeof EventSource);
8
+ return (await import('eventsource')).EventSource;
9
9
  }
10
10
  }
11
11
  /**
@@ -14,7 +14,7 @@ export function EventSourceProvider(): Promise<typeof EventSource> {
14
14
  * the run completes or fails.
15
15
  * If the onChunk callback is passed then the streaming of the result is enabled.
16
16
  * The onChunk callback with be called with the next chunk of the result as soon as it is available.
17
- * When all chunks are received the fucntion will return the resolved promise
17
+ * When all chunks are received the function will return the resolved promise
18
18
  * @param id of the interaction to execute
19
19
  * @param payload InteractionExecutionPayload
20
20
  * @param onChunk callback to be called when the next chunk of the response is available
@@ -38,7 +38,7 @@ export async function executeInteraction<P = any, R = any>(client: VertesiaClien
38
38
 
39
39
  /**
40
40
  * Same as executeInteraction but uses the interaction name selector instead of the id.
41
- * A name selector is the interaction endpoint name suffuxed with an optional tag or version wich is starting with a `@` character.
41
+ * A name selector is the interaction endpoint name suffixed with an optional tag or version which is starting with a `@` character.
42
42
  * The special `draft` tag is used to select the draft version of the interaction. If no tag or version is specified then the latest version is selected.
43
43
  * Examples of selectors:
44
44
  * - `ReviewContract` - select the latest version of the ReviewContract interaction