@vertesia/client 1.4.0-dev.20260629.130134Z → 1.5.0-dev.20260713.113008Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/EnvironmentsApi.d.ts +3 -1
- package/lib/EnvironmentsApi.d.ts.map +1 -1
- package/lib/EnvironmentsApi.js +8 -0
- package/lib/EnvironmentsApi.js.map +1 -1
- package/lib/InternalSecretsApi.d.ts +18 -0
- package/lib/InternalSecretsApi.d.ts.map +1 -0
- package/lib/InternalSecretsApi.js +29 -0
- package/lib/InternalSecretsApi.js.map +1 -0
- package/lib/QuotaApi.d.ts +16 -0
- package/lib/QuotaApi.d.ts.map +1 -0
- package/lib/QuotaApi.js +21 -0
- package/lib/QuotaApi.js.map +1 -0
- package/lib/client.d.ts +5 -0
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +8 -0
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/store/DataApi.d.ts +2 -2
- package/lib/store/DataApi.d.ts.map +1 -1
- package/lib/store/DataApi.js +2 -2
- package/lib/store/DataApi.js.map +1 -1
- package/lib/store/EventIngestChannelsApi.d.ts +11 -0
- package/lib/store/EventIngestChannelsApi.d.ts.map +1 -0
- package/lib/store/EventIngestChannelsApi.js +40 -0
- package/lib/store/EventIngestChannelsApi.js.map +1 -0
- package/lib/store/EventSubscriptionsApi.d.ts +11 -0
- package/lib/store/EventSubscriptionsApi.d.ts.map +1 -0
- package/lib/store/EventSubscriptionsApi.js +40 -0
- package/lib/store/EventSubscriptionsApi.js.map +1 -0
- package/lib/store/EventsApi.d.ts +12 -0
- package/lib/store/EventsApi.d.ts.map +1 -0
- package/lib/store/EventsApi.js +19 -0
- package/lib/store/EventsApi.js.map +1 -0
- package/lib/store/ObjectsApi.d.ts +22 -2
- package/lib/store/ObjectsApi.d.ts.map +1 -1
- package/lib/store/ObjectsApi.js +64 -1
- package/lib/store/ObjectsApi.js.map +1 -1
- package/lib/store/client.d.ts +4 -0
- package/lib/store/client.d.ts.map +1 -1
- package/lib/store/client.js +4 -0
- package/lib/store/client.js.map +1 -1
- package/lib/store/index.d.ts +4 -0
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +4 -0
- package/lib/store/index.js.map +1 -1
- package/lib/vertesia-client.js +14 -2
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +6 -9
- package/src/EnvironmentsApi.test.ts +39 -0
- package/src/EnvironmentsApi.ts +11 -0
- package/src/InternalSecretsApi.ts +63 -0
- package/src/QuotaApi.ts +24 -0
- package/src/client.ts +9 -0
- package/src/index.ts +2 -1
- package/src/store/DataApi.ts +2 -2
- package/src/store/EventIngestChannelsApi.ts +50 -0
- package/src/store/EventSubscriptionsApi.ts +50 -0
- package/src/store/EventsApi.ts +28 -0
- package/src/store/ObjectsApi.ts +113 -1
- package/src/store/client.ts +4 -0
- package/src/store/index.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-dev.20260713.113008Z",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -11,20 +11,17 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@rollup/plugin-commonjs": "^29.0.3",
|
|
15
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
16
|
-
"@rollup/plugin-terser": "^1.0.0",
|
|
17
14
|
"@types/node": "^24.13.2",
|
|
18
|
-
"
|
|
15
|
+
"rolldown": "1.1.3",
|
|
19
16
|
"typescript": "^6.0.3",
|
|
20
17
|
"vitest": "^4.1.9",
|
|
21
18
|
"@vertesia/tsconfig": "0.1.0"
|
|
22
19
|
},
|
|
23
20
|
"dependencies": {
|
|
24
21
|
"eventsource": "^4.1.0",
|
|
25
|
-
"@
|
|
26
|
-
"@vertesia/common": "1.
|
|
27
|
-
"@
|
|
22
|
+
"@vertesia/api-fetch-client": "1.5.0-dev.20260713.113008Z",
|
|
23
|
+
"@vertesia/common": "1.5.0-dev.20260713.113008Z",
|
|
24
|
+
"@llumiverse/common": "1.5.0-dev"
|
|
28
25
|
},
|
|
29
26
|
"exports": {
|
|
30
27
|
".": {
|
|
@@ -54,7 +51,7 @@
|
|
|
54
51
|
"scripts": {
|
|
55
52
|
"lint": "biome lint src",
|
|
56
53
|
"clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
|
|
57
|
-
"build": "pnpm run clean:lib && tsc -p tsconfig.json && pnpm exec
|
|
54
|
+
"build": "pnpm run clean:lib && tsc -p tsconfig.json && pnpm exec rolldown -c rolldown.config.js",
|
|
58
55
|
"clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo",
|
|
59
56
|
"test": "vitest run",
|
|
60
57
|
"typecheck:test": "tsc -p tsconfig.test.json --noEmit"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { VertesiaClient } from './client.js';
|
|
3
|
+
|
|
4
|
+
describe('EnvironmentsApi', () => {
|
|
5
|
+
it('encodes model IDs in disableModel paths', async () => {
|
|
6
|
+
const requests: Request[] = [];
|
|
7
|
+
const fetchMock = vi.fn(async () => {
|
|
8
|
+
return new Response(
|
|
9
|
+
JSON.stringify({
|
|
10
|
+
id: 'env-id',
|
|
11
|
+
name: 'Test Environment',
|
|
12
|
+
provider: 'test',
|
|
13
|
+
account: 'account-id',
|
|
14
|
+
created_by: 'user:test',
|
|
15
|
+
updated_by: 'user:test',
|
|
16
|
+
created_at: new Date(0).toISOString(),
|
|
17
|
+
updated_at: new Date(0).toISOString(),
|
|
18
|
+
}),
|
|
19
|
+
{
|
|
20
|
+
status: 200,
|
|
21
|
+
headers: { 'content-type': 'application/json' },
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const client = new VertesiaClient({
|
|
27
|
+
serverUrl: 'https://api.example.com',
|
|
28
|
+
storeUrl: 'https://api.example.com',
|
|
29
|
+
fetch: fetchMock,
|
|
30
|
+
onRequest: (request) => requests.push(request),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await client.environments.disableModel('env-id', 'provider/model#v?1');
|
|
34
|
+
|
|
35
|
+
expect(requests[0]?.url).toBe(
|
|
36
|
+
'https://api.example.com/api/v1/environments/env-id/models/enabled/provider%2Fmodel%23v%3F1',
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
});
|
package/src/EnvironmentsApi.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
|
3
3
|
import type {
|
|
4
4
|
EmbeddingsApiRequest,
|
|
5
5
|
EmbeddingsApiResult,
|
|
6
|
+
EnableEnvironmentModelPayload,
|
|
6
7
|
ExecutionEnvironment,
|
|
7
8
|
ExecutionEnvironmentCreatePayload,
|
|
8
9
|
ExecutionEnvironmentRef,
|
|
@@ -71,6 +72,16 @@ export default class EnvironmentsApi extends ApiTopic {
|
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
enableModel(id: string, payload: EnableEnvironmentModelPayload): Promise<ExecutionEnvironment> {
|
|
76
|
+
return this.post(`/${id}/models/enabled`, {
|
|
77
|
+
payload,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
disableModel(id: string, modelId: string): Promise<ExecutionEnvironment> {
|
|
82
|
+
return this.del(`/${id}/models/enabled/${encodeURIComponent(modelId)}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
74
85
|
listTrainableModels(id: string): Promise<AIModel[]> {
|
|
75
86
|
return this.get(`/${id}/trainable-models`);
|
|
76
87
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
EventIngestSigningSecretRequest,
|
|
4
|
+
EventIngestSigningSecretResponse,
|
|
5
|
+
EventWebhookSigningSecretRequest,
|
|
6
|
+
EventWebhookSigningSecretResponse,
|
|
7
|
+
GithubInstallationTokenRequest,
|
|
8
|
+
GithubInstallationTokenResponse,
|
|
9
|
+
SignEventWebhookRequest,
|
|
10
|
+
SignEventWebhookResponse,
|
|
11
|
+
VerifyEventIngestSignatureRequest,
|
|
12
|
+
VerifyEventIngestSignatureResponse,
|
|
13
|
+
} from '@vertesia/common';
|
|
14
|
+
|
|
15
|
+
export default class InternalSecretsApi extends ApiTopic {
|
|
16
|
+
constructor(parent: ClientBase) {
|
|
17
|
+
super(parent, '/internal/secrets');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
rotateEventWebhookSigningSecret(
|
|
21
|
+
subscriptionId: string,
|
|
22
|
+
payload: EventWebhookSigningSecretRequest,
|
|
23
|
+
): Promise<EventWebhookSigningSecretResponse> {
|
|
24
|
+
return this.post(`/event-webhooks/${subscriptionId}/rotate`, { payload });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
deleteEventWebhookSigningSecret(
|
|
28
|
+
subscriptionId: string,
|
|
29
|
+
payload: EventWebhookSigningSecretRequest,
|
|
30
|
+
): Promise<{ deleted: true }> {
|
|
31
|
+
return this.post(`/event-webhooks/${subscriptionId}/delete`, { payload });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
signEventWebhook(subscriptionId: string, payload: SignEventWebhookRequest): Promise<SignEventWebhookResponse> {
|
|
35
|
+
return this.post(`/event-webhooks/${subscriptionId}/sign`, { payload });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
rotateEventIngestChannelSigningSecret(
|
|
39
|
+
channelId: string,
|
|
40
|
+
payload: EventIngestSigningSecretRequest,
|
|
41
|
+
): Promise<EventIngestSigningSecretResponse> {
|
|
42
|
+
return this.post(`/event-ingest-channels/${channelId}/rotate`, { payload });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
deleteEventIngestChannelSigningSecret(
|
|
46
|
+
channelId: string,
|
|
47
|
+
payload: EventIngestSigningSecretRequest,
|
|
48
|
+
): Promise<{ deleted: true }> {
|
|
49
|
+
return this.post(`/event-ingest-channels/${channelId}/delete`, { payload });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
verifyEventIngestSignature(
|
|
53
|
+
channelId: string,
|
|
54
|
+
payload: VerifyEventIngestSignatureRequest,
|
|
55
|
+
): Promise<VerifyEventIngestSignatureResponse> {
|
|
56
|
+
return this.post(`/event-ingest-channels/${channelId}/verify`, { payload });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Mint a short-lived, repository-scoped GitHub App installation token for the project. */
|
|
60
|
+
mintGithubInstallationToken(payload: GithubInstallationTokenRequest): Promise<GithubInstallationTokenResponse> {
|
|
61
|
+
return this.post('/github/installation-token', { payload });
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/QuotaApi.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { QuotaStandingResponse, QuotaTierResponse } from '@vertesia/common';
|
|
3
|
+
|
|
4
|
+
export default class QuotaApi extends ApiTopic {
|
|
5
|
+
constructor(parent: ClientBase) {
|
|
6
|
+
super(parent, '/api/v1/quota');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The calling tenant's own quota standing: effective API rate limits + current usage, plus
|
|
11
|
+
* workflow-admission occupancy and an LLM-limiter posture note.
|
|
12
|
+
*/
|
|
13
|
+
standing(): Promise<QuotaStandingResponse> {
|
|
14
|
+
return this.get('/standing');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The calling account's effective quota tier. A cheap, cacheable lookup used to resolve a
|
|
19
|
+
* tenant's tier without a direct account-store dependency.
|
|
20
|
+
*/
|
|
21
|
+
tier(): Promise<QuotaTierResponse> {
|
|
22
|
+
return this.get('/tier');
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -10,12 +10,14 @@ import CommandsApi from './CommandsApi.js';
|
|
|
10
10
|
import EnvironmentsApi from './EnvironmentsApi.js';
|
|
11
11
|
import { IamApi } from './IamApi.js';
|
|
12
12
|
import InteractionsApi from './InteractionsApi.js';
|
|
13
|
+
import InternalSecretsApi from './InternalSecretsApi.js';
|
|
13
14
|
import OAuthClientsApi from './OAuthClientsApi.js';
|
|
14
15
|
import OAuthGrantsApi from './OAuthGrantsApi.js';
|
|
15
16
|
import OAuthProvidersApi from './OAuthProvidersApi.js';
|
|
16
17
|
import OAuthServerApi from './OAuthServerApi.js';
|
|
17
18
|
import ProjectsApi from './ProjectsApi.js';
|
|
18
19
|
import PromptsApi from './PromptsApi.js';
|
|
20
|
+
import QuotaApi from './QuotaApi.js';
|
|
19
21
|
import { RefsApi } from './RefsApi.js';
|
|
20
22
|
import RemoteMcpConnectionsApi from './RemoteMcpConnectionsApi.js';
|
|
21
23
|
import { RunsApi } from './RunsApi.js';
|
|
@@ -101,6 +103,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
101
103
|
oauthProviders: OAuthProvidersApi;
|
|
102
104
|
remoteMcpConnections: RemoteMcpConnectionsApi;
|
|
103
105
|
secrets: SecretsApi;
|
|
106
|
+
internalSecrets: InternalSecretsApi;
|
|
104
107
|
|
|
105
108
|
/**
|
|
106
109
|
* Create a client from the given token.
|
|
@@ -225,6 +228,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
225
228
|
this.oauthProviders = new OAuthProvidersApi(this);
|
|
226
229
|
this.remoteMcpConnections = new RemoteMcpConnectionsApi(this);
|
|
227
230
|
this.secrets = new SecretsApi(this);
|
|
231
|
+
this.internalSecrets = new InternalSecretsApi(this);
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
withApiVersion(version: string | number | null) {
|
|
@@ -347,6 +351,10 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
347
351
|
return this.store.data;
|
|
348
352
|
}
|
|
349
353
|
|
|
354
|
+
get events() {
|
|
355
|
+
return this.store.events;
|
|
356
|
+
}
|
|
357
|
+
|
|
350
358
|
get storeUrl() {
|
|
351
359
|
return this.store.baseUrl;
|
|
352
360
|
}
|
|
@@ -402,6 +410,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
402
410
|
commands = new CommandsApi(this);
|
|
403
411
|
apps = new AppsApi(this);
|
|
404
412
|
tools = new ToolsApi(this);
|
|
413
|
+
quota = new QuotaApi(this);
|
|
405
414
|
}
|
|
406
415
|
|
|
407
416
|
function isApiKey(apiKey: string) {
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { AsyncExecutionResult } from '@vertesia/common';
|
|
2
2
|
|
|
3
|
-
export type { OrphanedAppInstallation } from '@vertesia/common';
|
|
3
|
+
export type { EnableEnvironmentModelPayload, OrphanedAppInstallation } from '@vertesia/common';
|
|
4
4
|
export { getOAuthPermissionScopes, Permission } from '@vertesia/common';
|
|
5
5
|
export * from './client.js';
|
|
6
6
|
export type { GroupsQueryOptions } from './GroupsApi.js';
|
|
7
7
|
export * from './InteractionBase.js';
|
|
8
8
|
export * from './InteractionOutput.js';
|
|
9
|
+
export { default as InternalSecretsApi } from './InternalSecretsApi.js';
|
|
9
10
|
export { default as OAuthClientsApi } from './OAuthClientsApi.js';
|
|
10
11
|
export { default as OAuthGrantsApi } from './OAuthGrantsApi.js';
|
|
11
12
|
export { default as OAuthProvidersApi } from './OAuthProvidersApi.js';
|
package/src/store/DataApi.ts
CHANGED
|
@@ -255,7 +255,7 @@ export class DataApi extends ApiTopic {
|
|
|
255
255
|
*
|
|
256
256
|
* @example
|
|
257
257
|
* ```typescript
|
|
258
|
-
* const job = await client.data.
|
|
258
|
+
* const job = await client.data.importData(storeId, {
|
|
259
259
|
* mode: 'append',
|
|
260
260
|
* message: 'Monthly data import',
|
|
261
261
|
* tables: {
|
|
@@ -272,7 +272,7 @@ export class DataApi extends ApiTopic {
|
|
|
272
272
|
* });
|
|
273
273
|
* ```
|
|
274
274
|
*/
|
|
275
|
-
|
|
275
|
+
importData(id: string, payload: ImportDataPayload): Promise<ImportJob> {
|
|
276
276
|
return this.post(`/${id}/import`, { payload, headers: this.storeHeaders(id) });
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
CreateEventIngestChannelPayload,
|
|
4
|
+
DeleteCountResult,
|
|
5
|
+
EventIngestChannel,
|
|
6
|
+
EventIngestChannelMutationResponse,
|
|
7
|
+
ListEventIngestChannelsQuery,
|
|
8
|
+
UpdateEventIngestChannelPayload,
|
|
9
|
+
} from '@vertesia/common';
|
|
10
|
+
|
|
11
|
+
function toQueryRecord(query?: ListEventIngestChannelsQuery): Record<string, string> | undefined {
|
|
12
|
+
if (!query) return undefined;
|
|
13
|
+
const out: Record<string, string> = {};
|
|
14
|
+
for (const [key, value] of Object.entries(query)) {
|
|
15
|
+
if (value === undefined || value === null) continue;
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
if (value.length === 0) continue;
|
|
18
|
+
out[key] = value.join(',');
|
|
19
|
+
} else {
|
|
20
|
+
out[key] = String(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(out).length ? out : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class EventIngestChannelsApi extends ApiTopic {
|
|
27
|
+
constructor(parent: ClientBase) {
|
|
28
|
+
super(parent, '/api/v1/events/channels');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
list(query?: ListEventIngestChannelsQuery): Promise<EventIngestChannel[]> {
|
|
32
|
+
return this.get('/', { query: toQueryRecord(query) });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
retrieve(id: string): Promise<EventIngestChannel> {
|
|
36
|
+
return this.get(`/${id}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
create(payload: CreateEventIngestChannelPayload): Promise<EventIngestChannelMutationResponse> {
|
|
40
|
+
return this.post('/', { payload });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
update(id: string, payload: UpdateEventIngestChannelPayload): Promise<EventIngestChannelMutationResponse> {
|
|
44
|
+
return this.put(`/${id}`, { payload });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
delete(id: string): Promise<DeleteCountResult> {
|
|
48
|
+
return this.del(`/${id}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
CreateEventSubscriptionPayload,
|
|
4
|
+
DeleteCountResult,
|
|
5
|
+
EventSubscription,
|
|
6
|
+
EventSubscriptionMutationResponse,
|
|
7
|
+
ListEventSubscriptionsQuery,
|
|
8
|
+
UpdateEventSubscriptionPayload,
|
|
9
|
+
} from '@vertesia/common';
|
|
10
|
+
|
|
11
|
+
function toQueryRecord(query?: ListEventSubscriptionsQuery): Record<string, string> | undefined {
|
|
12
|
+
if (!query) return undefined;
|
|
13
|
+
const out: Record<string, string> = {};
|
|
14
|
+
for (const [key, value] of Object.entries(query)) {
|
|
15
|
+
if (value === undefined || value === null) continue;
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
if (value.length === 0) continue;
|
|
18
|
+
out[key] = value.join(',');
|
|
19
|
+
} else {
|
|
20
|
+
out[key] = String(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(out).length ? out : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class EventSubscriptionsApi extends ApiTopic {
|
|
27
|
+
constructor(parent: ClientBase) {
|
|
28
|
+
super(parent, '/api/v1/events/subscriptions');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
list(query?: ListEventSubscriptionsQuery): Promise<EventSubscription[]> {
|
|
32
|
+
return this.get('/', { query: toQueryRecord(query) });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
retrieve(id: string): Promise<EventSubscription> {
|
|
36
|
+
return this.get(`/${id}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
create(payload: CreateEventSubscriptionPayload): Promise<EventSubscriptionMutationResponse> {
|
|
40
|
+
return this.post('/', { payload });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
update(id: string, payload: UpdateEventSubscriptionPayload): Promise<EventSubscriptionMutationResponse> {
|
|
44
|
+
return this.put(`/${id}`, { payload });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
delete(id: string): Promise<DeleteCountResult> {
|
|
48
|
+
return this.del(`/${id}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
EventDeliveryQueueSummaryPayload,
|
|
4
|
+
EventDeliveryQueueSummaryResponse,
|
|
5
|
+
ListEventDeliveriesPayload,
|
|
6
|
+
ListEventDeliveriesResponse,
|
|
7
|
+
} from '@vertesia/common';
|
|
8
|
+
import { EventIngestChannelsApi } from './EventIngestChannelsApi.js';
|
|
9
|
+
import { EventSubscriptionsApi } from './EventSubscriptionsApi.js';
|
|
10
|
+
|
|
11
|
+
export class EventsApi extends ApiTopic {
|
|
12
|
+
readonly subscriptions: EventSubscriptionsApi;
|
|
13
|
+
readonly channels: EventIngestChannelsApi;
|
|
14
|
+
|
|
15
|
+
constructor(parent: ClientBase) {
|
|
16
|
+
super(parent, '/api/v1/events');
|
|
17
|
+
this.subscriptions = new EventSubscriptionsApi(parent);
|
|
18
|
+
this.channels = new EventIngestChannelsApi(parent);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
searchDeliveries(payload: ListEventDeliveriesPayload = {}): Promise<ListEventDeliveriesResponse> {
|
|
22
|
+
return this.post('/deliveries/search', { payload });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
queueSummary(payload: EventDeliveryQueueSummaryPayload = {}): Promise<EventDeliveryQueueSummaryResponse> {
|
|
26
|
+
return this.post('/deliveries/queue-summary', { payload });
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/store/ObjectsApi.ts
CHANGED
|
@@ -9,12 +9,16 @@ import {
|
|
|
9
9
|
type ComputeObjectFacetPayload,
|
|
10
10
|
type ContentObject,
|
|
11
11
|
ContentObjectApiHeaders,
|
|
12
|
+
type ContentObjectExportArtifactFile,
|
|
13
|
+
type ContentObjectExportResult,
|
|
14
|
+
type ContentObjectExportStatusResponse,
|
|
12
15
|
type ContentObjectItem,
|
|
13
16
|
type ContentObjectProcessingPriority,
|
|
14
17
|
type ContentObjectTextResponse,
|
|
15
18
|
type ContentSource,
|
|
16
19
|
type CreateContentObjectPayload,
|
|
17
20
|
canGenerateRendition,
|
|
21
|
+
type DeleteContentObjectExportResponse,
|
|
18
22
|
type DeleteContentObjectResult,
|
|
19
23
|
type Embedding,
|
|
20
24
|
type ExportPropertiesPayload,
|
|
@@ -25,12 +29,23 @@ import {
|
|
|
25
29
|
type GetRenditionParams,
|
|
26
30
|
type GetRenditionResponse,
|
|
27
31
|
type GetUploadUrlPayload,
|
|
32
|
+
type ListContentObjectExportsResponse,
|
|
28
33
|
type ListWorkflowRunsResponse,
|
|
29
34
|
type ObjectSearchPayload,
|
|
30
35
|
type ObjectSearchQuery,
|
|
31
36
|
type ObjectSearchResponse,
|
|
32
37
|
type SetObjectEmbeddingsResponse,
|
|
38
|
+
type StartContentObjectExportRequest,
|
|
39
|
+
type StartContentObjectExportResponse,
|
|
33
40
|
type SupportedEmbeddingTypes,
|
|
41
|
+
type ZenoBulkContentObjectExportComposeRequest,
|
|
42
|
+
type ZenoBulkContentObjectExportPlanRequest,
|
|
43
|
+
type ZenoBulkContentObjectExportPlanResponse,
|
|
44
|
+
type ZenoBulkContentObjectExportRequest,
|
|
45
|
+
type ZenoBulkContentObjectExportShardRequest,
|
|
46
|
+
type ZenoBulkContentObjectExportShardResult,
|
|
47
|
+
type ZenoBulkContentObjectExportSplitShardRequest,
|
|
48
|
+
type ZenoBulkContentObjectExportSplitShardResponse,
|
|
34
49
|
} from '@vertesia/common';
|
|
35
50
|
|
|
36
51
|
export { getSupportedRenditionFormats, supportsVisualRendition } from '@vertesia/common';
|
|
@@ -106,6 +121,101 @@ export class ObjectsApi extends ApiTopic {
|
|
|
106
121
|
});
|
|
107
122
|
}
|
|
108
123
|
|
|
124
|
+
startExport(payload: StartContentObjectExportRequest = {}): Promise<StartContentObjectExportResponse> {
|
|
125
|
+
return this.post('/export/bulk', { payload });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
listExports(): Promise<ListContentObjectExportsResponse> {
|
|
129
|
+
return this.get('/export/bulk/artifacts');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
deleteExport(exportId: string): Promise<DeleteContentObjectExportResponse> {
|
|
133
|
+
return this.del(`/export/bulk/artifacts/${encodeURIComponent(exportId)}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getExportStatus(workflowId: string, runId: string): Promise<ContentObjectExportStatusResponse> {
|
|
137
|
+
return this.get(`/export/bulk/${encodeURIComponent(workflowId)}/${encodeURIComponent(runId)}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
getExportDownloadUrl(exportId: string, role: ContentObjectExportArtifactFile['role']): Promise<GetFileUrlResponse> {
|
|
141
|
+
return this.get(`/export/bulk/artifacts/${encodeURIComponent(exportId)}/${role}/download-url`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async downloadExportFile(
|
|
145
|
+
exportId: string,
|
|
146
|
+
role: ContentObjectExportArtifactFile['role'],
|
|
147
|
+
): Promise<ReadableStream<Uint8Array<ArrayBuffer>>> {
|
|
148
|
+
const { url } = await this.getExportDownloadUrl(exportId, role);
|
|
149
|
+
const res = await fetchSignedUrl(url, {
|
|
150
|
+
method: 'GET',
|
|
151
|
+
}).then((res: Response) => {
|
|
152
|
+
if (!res.ok) {
|
|
153
|
+
throw new Error(`Failed to download export file: ${res.status} ${res.statusText}`);
|
|
154
|
+
}
|
|
155
|
+
return res;
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
if (!res.body) {
|
|
159
|
+
throw new Error('No response body received when downloading export file');
|
|
160
|
+
}
|
|
161
|
+
return res.body as ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
exportToBucketViaBulk(
|
|
165
|
+
payload: ZenoBulkContentObjectExportRequest,
|
|
166
|
+
timeoutMs: number | false | null = false,
|
|
167
|
+
): Promise<ContentObjectExportResult> {
|
|
168
|
+
return this.zenoBulkPost('/export', payload, timeoutMs);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
planContentObjectExportViaBulk(
|
|
172
|
+
payload: ZenoBulkContentObjectExportPlanRequest,
|
|
173
|
+
timeoutMs: number | false | null = false,
|
|
174
|
+
): Promise<ZenoBulkContentObjectExportPlanResponse> {
|
|
175
|
+
return this.zenoBulkPost('/export/plan', payload, timeoutMs);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
exportContentObjectShardViaBulk(
|
|
179
|
+
payload: ZenoBulkContentObjectExportShardRequest,
|
|
180
|
+
timeoutMs: number | false | null = false,
|
|
181
|
+
): Promise<ZenoBulkContentObjectExportShardResult> {
|
|
182
|
+
return this.zenoBulkPost('/export/shard', payload, timeoutMs);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
splitContentObjectExportShardViaBulk(
|
|
186
|
+
payload: ZenoBulkContentObjectExportSplitShardRequest,
|
|
187
|
+
timeoutMs: number | false | null = false,
|
|
188
|
+
): Promise<ZenoBulkContentObjectExportSplitShardResponse> {
|
|
189
|
+
return this.zenoBulkPost('/export/shard/split', payload, timeoutMs);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
composeContentObjectExportViaBulk(
|
|
193
|
+
payload: ZenoBulkContentObjectExportComposeRequest,
|
|
194
|
+
timeoutMs: number | false | null = false,
|
|
195
|
+
): Promise<ContentObjectExportResult> {
|
|
196
|
+
return this.zenoBulkPost('/export/compose', payload, timeoutMs);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get the zeno-bulk base URL.
|
|
201
|
+
* Dev branches: store URL contains "zeno-server" -> replace with "zeno-bulk".
|
|
202
|
+
* Production/preview: same domain, LB routes /export to zeno-bulk.
|
|
203
|
+
*/
|
|
204
|
+
private get zenoBulkBaseUrl(): string {
|
|
205
|
+
const storeBaseUrl = this.client.baseUrl;
|
|
206
|
+
if (storeBaseUrl.includes('localhost:') || storeBaseUrl.includes('127.0.0.1:')) {
|
|
207
|
+
return 'https://zeno-bulk-dev-main.api.dev1.vertesia.io';
|
|
208
|
+
}
|
|
209
|
+
if (storeBaseUrl.includes('zeno-server')) {
|
|
210
|
+
return storeBaseUrl.replace(/zeno-server/, 'zeno-bulk');
|
|
211
|
+
}
|
|
212
|
+
return storeBaseUrl;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private zenoBulkPost<T>(path: string, body: object, timeoutMs?: number | false | null): Promise<T> {
|
|
216
|
+
return this.client.post(this.zenoBulkBaseUrl + path, { payload: body, timeoutMs });
|
|
217
|
+
}
|
|
218
|
+
|
|
109
219
|
listFolders(_path: string = '/') {
|
|
110
220
|
throw new Error('Not implemented yet');
|
|
111
221
|
}
|
|
@@ -263,7 +373,7 @@ export class ObjectsApi extends ApiTopic {
|
|
|
263
373
|
* @param options Additional options
|
|
264
374
|
* @param options.createRevision Whether to create a new revision instead of updating in place
|
|
265
375
|
* @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
|
|
266
|
-
* @param options.suppressWorkflows
|
|
376
|
+
* @param options.suppressWorkflows Deprecated. Events are always emitted; this suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire.
|
|
267
377
|
* @returns The updated object or newly created revision
|
|
268
378
|
*/
|
|
269
379
|
async update(
|
|
@@ -273,6 +383,7 @@ export class ObjectsApi extends ApiTopic {
|
|
|
273
383
|
createRevision?: boolean;
|
|
274
384
|
revisionLabel?: string;
|
|
275
385
|
processing_priority?: ContentObjectProcessingPriority;
|
|
386
|
+
/** @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire. */
|
|
276
387
|
suppressWorkflows?: boolean;
|
|
277
388
|
/** If provided, the server will reject the update with 412 if the document's content etag no longer matches. */
|
|
278
389
|
ifMatch?: string;
|
|
@@ -359,6 +470,7 @@ export class ObjectsApi extends ApiTopic {
|
|
|
359
470
|
objects: CreateContentObjectPayload[],
|
|
360
471
|
options?: {
|
|
361
472
|
collection_id?: string;
|
|
473
|
+
/** @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire. */
|
|
362
474
|
skip_workflows?: boolean;
|
|
363
475
|
processing_priority?: ContentObjectProcessingPriority;
|
|
364
476
|
},
|
package/src/store/client.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { CostApi } from './CostApi.js';
|
|
|
11
11
|
import { DataApi } from './DataApi.js';
|
|
12
12
|
import { EmailApi } from './EmailApi.js';
|
|
13
13
|
import { EmbeddingsApi } from './EmbeddingsApi.js';
|
|
14
|
+
import { EventsApi } from './EventsApi.js';
|
|
14
15
|
import { ZenoClientNotFoundError } from './errors.js';
|
|
15
16
|
import { FilesApi } from './FilesApi.js';
|
|
16
17
|
import { HiveMemoryApi } from './HiveMemoryApi.js';
|
|
@@ -105,6 +106,9 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
|
|
|
105
106
|
collections = new CollectionsApi(this);
|
|
106
107
|
embeddings = new EmbeddingsApi(this);
|
|
107
108
|
email = new EmailApi(this);
|
|
109
|
+
events = new EventsApi(this);
|
|
110
|
+
/** @deprecated Use events.subscriptions. */
|
|
111
|
+
eventSubscriptions = this.events.subscriptions;
|
|
108
112
|
pendingAsks = new PendingAsksApi(this);
|
|
109
113
|
data = new DataApi(this);
|
|
110
114
|
indexing = new IndexingApi(this);
|
package/src/store/index.ts
CHANGED
|
@@ -2,6 +2,10 @@ export * from './AgentsApi.js';
|
|
|
2
2
|
export * from './client.js';
|
|
3
3
|
export * from './DataApi.js';
|
|
4
4
|
export * from './EmailApi.js';
|
|
5
|
+
export * from './EmbeddingsApi.js';
|
|
6
|
+
export * from './EventIngestChannelsApi.js';
|
|
7
|
+
export * from './EventSubscriptionsApi.js';
|
|
8
|
+
export * from './EventsApi.js';
|
|
5
9
|
export * from './errors.js';
|
|
6
10
|
export * from './FilesApi.js';
|
|
7
11
|
export * from './HiveMemoryApi.js';
|