@nebulateam/jarvis-sdk 0.0.0-stage → 5.57.9
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 +197 -2
- package/dist/app/automation-client.d.ts +33 -0
- package/dist/app/automation-client.models.d.ts +77 -0
- package/dist/app/jarvis-client.d.ts +201 -0
- package/dist/app/jarvis-public-api-v2.client.d.ts +8268 -0
- package/dist/app/jarvis-public-api.client.d.ts +4678 -0
- package/dist/app/jarvis-shell.d.ts +79 -0
- package/dist/app/jarvis-shell.models.d.ts +204 -0
- package/dist/app/public-api.client.extension.d.ts +22 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/package.json +34 -4
package/README.md
CHANGED
|
@@ -1,3 +1,198 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nebulateam/jarvis-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JavaScript/TypeScript SDK for the **Jarvis public API**, distributed as an ES module with full type definitions,
|
|
4
|
+
so editors such as VS Code offer IntelliSense on every client, request and response.
|
|
5
|
+
|
|
6
|
+
This build targets **Jarvis 5.57.9** (SDK version 5.57.9).
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @nebulateam/jarvis-sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The package is ESM only (`import`), it has no runtime dependencies and uses the standard `fetch` API:
|
|
15
|
+
it runs in browsers and in Node.js 18 or later.
|
|
16
|
+
|
|
17
|
+
## Versions
|
|
18
|
+
|
|
19
|
+
The SDK version follows the Jarvis release it was generated from: SDK `5.57.10` is built from the public API of Jarvis `5.57.10`.
|
|
20
|
+
|
|
21
|
+
When the SDK needs a fix without a new Jarvis release, a version such as `5.57.10-fix.1` is published.
|
|
22
|
+
For npm these are pre-release versions, so ranges like `^5.57.10` or `~5.57.10` do **not** pick them up. To get them:
|
|
23
|
+
|
|
24
|
+
| What you need | Install |
|
|
25
|
+
|---|---|
|
|
26
|
+
| The latest SDK | `npm install @nebulateam/jarvis-sdk` (dist-tag `latest`) |
|
|
27
|
+
| The latest SDK build for a given Jarvis version, fixes included | `npm install @nebulateam/jarvis-sdk@jarvis-5.57.10` |
|
|
28
|
+
| An exact build | `npm install @nebulateam/jarvis-sdk@5.57.10-fix.1` |
|
|
29
|
+
|
|
30
|
+
Use the SDK built for the Jarvis version you are calling: newer SDKs may contain endpoints your Jarvis does not have yet.
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { Jarvis } from '@nebulateam/jarvis-sdk';
|
|
36
|
+
|
|
37
|
+
const API_VERSION = '2';
|
|
38
|
+
const jarvis = Jarvis.CreateClient('https://my-jarvis.example.com', process.env.JARVIS_TOKEN, { callInfoHeader: 'my-app' });
|
|
39
|
+
|
|
40
|
+
const result = await jarvis.createWorkTaskClient().searchV2(API_VERSION, 'Workspace_12', {
|
|
41
|
+
text: 'pump',
|
|
42
|
+
startIndex: 0,
|
|
43
|
+
pageSize: 20
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (result.success) {
|
|
47
|
+
for (const task of result.data ?? []) {
|
|
48
|
+
console.log(task.id, task.title, task.statusId);
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
console.error(result.error?.message);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Creating the client
|
|
56
|
+
|
|
57
|
+
| Method | When to use it |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `Jarvis.CreateClient(url, token?, { callInfoHeader? })` | Scripts, back-ends and applications that call a known Jarvis. |
|
|
60
|
+
| `Jarvis.Autodiscover(devLocation?)` | Components served by Jarvis itself: they call the Jarvis that serves the page. On `localhost` they use `devLocation` (`{ url, token }`). |
|
|
61
|
+
| `Jarvis.ConnectTo(location, token?)` | Like `Autodiscover`, with an explicit `Location`. |
|
|
62
|
+
|
|
63
|
+
- **Authentication**: the token is sent in the `jarvis-auth-token` header. Omit it when the calls run in a browser page already authenticated on Jarvis.
|
|
64
|
+
- **Call info**: `callInfoHeader` (or the `jarvisInfoHeader` argument of every `create...Client` method) is sent as `X-Jarvis-Call-Info`, to tag the calls made by your application.
|
|
65
|
+
|
|
66
|
+
### API clients
|
|
67
|
+
|
|
68
|
+
`JarvisClient` creates one client per area of the public API, for example:
|
|
69
|
+
|
|
70
|
+
| Method | Area |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `createWorkspaceClient()`, `createWorkspacePlanningClient()`, `createWorkTaskClient()`, `createTaskTypeV2Client()` | Workspaces, planning and work tasks |
|
|
73
|
+
| `createDatasetClient()`, `createFieldsClient()`, `createPropertiesClient()` | Datasets, fields and properties |
|
|
74
|
+
| `createDocumentClient()`, `createDocumentTypeClient()`, `createContainerClient()`, `createDmsSearchClient()`, `createFileUploadClient()` | Documents (DMS) |
|
|
75
|
+
| `createTicketClient()` | Tickets |
|
|
76
|
+
| `createAccountV2Client()`, `createContactV2Client()`, `createUsersClient()`, `createAvatarClient()` | Accounts, contacts and users |
|
|
77
|
+
| `createIdTranslationV1Client()`, `createLongRunningJobClient()`, `createIntegrationClient()` | Utilities |
|
|
78
|
+
|
|
79
|
+
Every client, method, request and response is documented in the type definitions: hover on a method in your editor to read it.
|
|
80
|
+
All the generated clients and DTOs are also exported, so you can import types such as `OmniSearchPublicSearchRequest` directly.
|
|
81
|
+
|
|
82
|
+
Each method takes the API version as first argument: use `'2'` for the V2 clients and `'1'` for the V1 ones
|
|
83
|
+
(`ContactV1Client`, `PropertiesV1Client`, `IdTranslationV1Client`).
|
|
84
|
+
|
|
85
|
+
### Responses and errors
|
|
86
|
+
|
|
87
|
+
Most methods resolve to a response with:
|
|
88
|
+
|
|
89
|
+
- `success`: `false` when the request failed validation or a constraint;
|
|
90
|
+
- `data`: the result of the operation;
|
|
91
|
+
- `logs` and `error`: what happened on the server.
|
|
92
|
+
|
|
93
|
+
When Jarvis answers with an unexpected HTTP status the promise is rejected with an `ApiException`
|
|
94
|
+
(`status`, `response`, `headers`):
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { ApiException } from '@nebulateam/jarvis-sdk';
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
const ticket = await jarvis.createTicketClient().detail('2', { ticketId: 'Ticket_1' });
|
|
101
|
+
if (!ticket.success) console.warn(ticket.error?.message, ticket.logs);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
if (e instanceof ApiException) console.error(e.status, e.response);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Filter work tasks by field values
|
|
110
|
+
|
|
111
|
+
`filteringExpression` combines conditions on fields with `PublicFilteringLogic.And` / `Or`; operands can be nested expressions.
|
|
112
|
+
Field values of a work task are returned in `fields`, one entry per field with its `values`.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { PublicFilteringLogic, WorkTaskSearchResult } from '@nebulateam/jarvis-sdk';
|
|
116
|
+
|
|
117
|
+
const workTasks = jarvis.createWorkTaskClient();
|
|
118
|
+
|
|
119
|
+
const response = await workTasks.searchV2('2', 'Workspace_12', {
|
|
120
|
+
startIndex: 0,
|
|
121
|
+
pageSize: 100,
|
|
122
|
+
showArchived: false,
|
|
123
|
+
sortField: 'version',
|
|
124
|
+
sortDescending: true,
|
|
125
|
+
filteringExpression: {
|
|
126
|
+
logic: PublicFilteringLogic.And,
|
|
127
|
+
operands: [
|
|
128
|
+
{ field: 'modelname', value: 'PUMP-200' },
|
|
129
|
+
{ field: 'taskstatusid', filterType: 'notEqual', value: 'TaskStatus_9' }
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const fieldValue = (task: WorkTaskSearchResult, fieldId: string) =>
|
|
135
|
+
task.fields?.find((f) => f.id?.toLowerCase() === fieldId)?.values?.[0];
|
|
136
|
+
|
|
137
|
+
for (const task of response.data ?? []) {
|
|
138
|
+
console.log(task.title, fieldValue(task, 'modelname'), fieldValue(task, 'assettype'));
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Page through all the results
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
const pageSize = 200;
|
|
146
|
+
const all: WorkTaskSearchResult[] = [];
|
|
147
|
+
for (let startIndex = 0; ; startIndex += pageSize) {
|
|
148
|
+
const page = await workTasks.searchV2('2', 'Workspace_12', { startIndex, pageSize, showArchived: false });
|
|
149
|
+
if (!page.success) throw new Error(page.error?.message);
|
|
150
|
+
all.push(...(page.data ?? []));
|
|
151
|
+
if (!page.data?.length || all.length >= (page.total ?? 0)) break;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Search the selectable values of a field
|
|
156
|
+
|
|
157
|
+
Useful to build pickers for selection fields (users, datasets, other work tasks...):
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const fields = jarvis.createFieldsClient();
|
|
161
|
+
|
|
162
|
+
const selection = await fields.searchSelection('2', {
|
|
163
|
+
field: 'customer',
|
|
164
|
+
term: 'acme',
|
|
165
|
+
startIndex: 0,
|
|
166
|
+
numOfRecords: 20
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const options = (selection.data?.items ?? []).map((item) => ({ id: item.id, label: item.title }));
|
|
170
|
+
console.log(`${options.length} of ${selection.data?.total ?? 0}`);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Components embedded in Jarvis
|
|
174
|
+
|
|
175
|
+
`JarvisShell` lets a page shown inside Jarvis (iframe or web component) interact with the host:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import { Jarvis, JarvisShell } from '@nebulateam/jarvis-sdk';
|
|
179
|
+
|
|
180
|
+
// served by Jarvis: calls go to the same Jarvis with the user session; on localhost to the given dev instance
|
|
181
|
+
const jarvis = Jarvis.Autodiscover({ url: 'https://my-dev-jarvis.example.com/', token: '<dev token>' }, undefined, { callInfoHeader: 'my-component' });
|
|
182
|
+
|
|
183
|
+
const shell = new JarvisShell();
|
|
184
|
+
shell.init((host, configuration) => {
|
|
185
|
+
host.showToast('Ready', `Hello ${configuration?.user.fullName}`, 'success');
|
|
186
|
+
host.on('WorkTask.Updated', (notification) => console.log('updated', notification.modelId));
|
|
187
|
+
host.on('WorkTask.Created', (notification) => console.log('created', notification.modelId));
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// open a work task in Jarvis, in a new tab
|
|
191
|
+
shell.navigateById('WorkTask_42', 'Workspace_12', true);
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Available actions: `navigate`, `navigateById`, `openDetail`, `showToast`, `showDialog`, `showContextMenu` and subscriptions to Jarvis events (`on`).
|
|
195
|
+
The actions supported by the host are listed in `configuration.capabilities`.
|
|
196
|
+
|
|
197
|
+
`AutomationClient` calls the Jarvis Automation workflows (`getWorkflowInstance`, `getWorkflowInstances`, `dispatchSignal`, `triggerWorkflow`)
|
|
198
|
+
from components served by Jarvis.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DispatchSignalResponse, GetWorkflowInstancesRequest, WorkflowInstance, WorkflowResponse } from "./automation-client.models";
|
|
2
|
+
/** Result of {@link AutomationClient.triggerWorkflow}. */
|
|
3
|
+
export declare class ResponseDto {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
json: {
|
|
6
|
+
body?: any;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
static create(ok: boolean, body?: string, errorMessage?: string): ResponseDto;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Client of Jarvis Automation (workflows), for components served by the same Jarvis:
|
|
13
|
+
* calls are relative to the page origin and use the browser session.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AutomationClient {
|
|
16
|
+
private baseUrl;
|
|
17
|
+
private workflowActivationBaseUrl;
|
|
18
|
+
/** Gets a workflow instance by id. @throws AutomationApiException when the call fails */
|
|
19
|
+
getWorkflowInstance(id: string): Promise<WorkflowInstance>;
|
|
20
|
+
/** Searches the instances of a workflow. @throws AutomationApiException when the call fails */
|
|
21
|
+
getWorkflowInstances(request: GetWorkflowInstancesRequest): Promise<WorkflowResponse>;
|
|
22
|
+
/** Dispatches a signal to the workflows waiting for it. @throws AutomationApiException when the call fails */
|
|
23
|
+
dispatchSignal(signalName: string, input: any): Promise<DispatchSignalResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Triggers a workflow exposed through an HTTP endpoint.
|
|
26
|
+
* @param endpointVerb the verb of the workflow endpoint
|
|
27
|
+
* @param url the endpoint path, relative to /automation/workflows
|
|
28
|
+
* @param inputs query parameters (GET) or body (POST, required)
|
|
29
|
+
*/
|
|
30
|
+
triggerWorkflow(endpointVerb: 'GET' | 'POST', url: string, inputs?: string[][] | Record<string, string | string[]>): Promise<ResponseDto>;
|
|
31
|
+
private fetchGet;
|
|
32
|
+
private fetchPost;
|
|
33
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Error raised by {@link AutomationClient} when Jarvis Automation answers with an error status. */
|
|
2
|
+
export declare class AutomationApiException extends Error {
|
|
3
|
+
message: string;
|
|
4
|
+
status: number;
|
|
5
|
+
constructor(message: string, status: number);
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowResponse {
|
|
8
|
+
$id: string;
|
|
9
|
+
items: WorkflowInstance[];
|
|
10
|
+
page: number;
|
|
11
|
+
pageSize: number;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowInstanceFault {
|
|
15
|
+
$id: string;
|
|
16
|
+
message: string;
|
|
17
|
+
exception: {
|
|
18
|
+
$id: string;
|
|
19
|
+
type: string;
|
|
20
|
+
message: string;
|
|
21
|
+
stackTrace: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface WorkflowInstance {
|
|
25
|
+
$id: string;
|
|
26
|
+
id: string;
|
|
27
|
+
definitionId: string;
|
|
28
|
+
definitionVersionId: string;
|
|
29
|
+
version: number;
|
|
30
|
+
workflowStatus: string;
|
|
31
|
+
correlationId: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
lastExecutedAt: string;
|
|
34
|
+
finishedAt: string;
|
|
35
|
+
metadata: {
|
|
36
|
+
$id: string;
|
|
37
|
+
};
|
|
38
|
+
variables: {
|
|
39
|
+
$id: string;
|
|
40
|
+
data: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
faults: WorkflowInstanceFault[];
|
|
45
|
+
}
|
|
46
|
+
export interface GetWorkflowInstancesRequest {
|
|
47
|
+
status?: string;
|
|
48
|
+
orderBy: string;
|
|
49
|
+
pageSize: number;
|
|
50
|
+
workflow: string;
|
|
51
|
+
}
|
|
52
|
+
export interface DispatchSignalResponse {
|
|
53
|
+
startedWorkflows: StartedWorkflow[];
|
|
54
|
+
}
|
|
55
|
+
export interface StartedWorkflow {
|
|
56
|
+
workflowInstanceId: string;
|
|
57
|
+
workflowInstance: StartedWorkflowInstance;
|
|
58
|
+
activityId: string;
|
|
59
|
+
}
|
|
60
|
+
export interface StartedWorkflowInstance {
|
|
61
|
+
definitionId: string;
|
|
62
|
+
definitionVersionId: string;
|
|
63
|
+
version: number;
|
|
64
|
+
workflowStatus: string;
|
|
65
|
+
correlationId: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
variables: {
|
|
68
|
+
data: any;
|
|
69
|
+
};
|
|
70
|
+
activityData: any;
|
|
71
|
+
metadata: any;
|
|
72
|
+
blockingActivities: any[];
|
|
73
|
+
faults: any[];
|
|
74
|
+
scheduledActivities: any[];
|
|
75
|
+
scopes: any[];
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { AccountV2Client, ContactV2Client, ContainerV2Client, DatasetV2Client, DmsSearchV2Client, DocumentTypeV2Client, DocumentV2Client, FileUploadV2Client, JarvisApiBaseClient, JarvisApiConfig, JarvisFieldsV2Client, LongRunningJobPublicV2Client, PropertiesV2Client, TaskTypeV2Client, TicketV2Client, UsersV2Client, WorkTaskV2Client, WorkspaceV2Client, AvatarV2Client, IntegrationV2Client, WorkspacePlanningV2Client } from "./jarvis-public-api-v2.client";
|
|
2
|
+
import { ContactV1Client, IdTranslationV1Client, PropertiesV1Client } from "./jarvis-public-api.client";
|
|
3
|
+
/** Locale aware helpers to format dates for display and for the Jarvis API. */
|
|
4
|
+
export declare class Formatters {
|
|
5
|
+
private _locale;
|
|
6
|
+
/**
|
|
7
|
+
*Creates an instance of Formatters.
|
|
8
|
+
* @param {string} [_locale="it-IT"]
|
|
9
|
+
* @memberof Formatters
|
|
10
|
+
*/
|
|
11
|
+
constructor(_locale?: string);
|
|
12
|
+
static longDate: Intl.DateTimeFormatOptions;
|
|
13
|
+
static shortDate: Intl.DateTimeFormatOptions;
|
|
14
|
+
/** Formats a date with the client locale (short date by default). */
|
|
15
|
+
dateTime: (date: Date, options?: Intl.DateTimeFormatOptions) => string;
|
|
16
|
+
/** Formats a date as yyyyMMdd, the date-only format expected by the Jarvis API. */
|
|
17
|
+
toAPIDateOnly: (date: Date) => string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Factory of the clients of the Jarvis public API, all sharing the same Jarvis address and credentials.
|
|
21
|
+
* Create it with {@link Jarvis.CreateClient} or {@link Jarvis.Autodiscover}.
|
|
22
|
+
* @example
|
|
23
|
+
* const jarvis = Jarvis.CreateClient('https://my-jarvis.example.com', '<api token>');
|
|
24
|
+
* const result = await jarvis.createWorkspaceClient().searchAllWorkspaces('2', { pageSize: 10 });
|
|
25
|
+
*/
|
|
26
|
+
export declare class JarvisClient {
|
|
27
|
+
private root;
|
|
28
|
+
private token?;
|
|
29
|
+
private callInfo?;
|
|
30
|
+
/** Date formatting helpers. */
|
|
31
|
+
readonly format: Formatters;
|
|
32
|
+
/**
|
|
33
|
+
* @param root the Jarvis address, e.g. https://my-jarvis.example.com
|
|
34
|
+
* @param token the API token, sent in the jarvis-auth-token header; omit it when the browser session is already authenticated
|
|
35
|
+
* @param callInfo default value of the X-Jarvis-Call-Info header, which tags the calls made by this client
|
|
36
|
+
*/
|
|
37
|
+
constructor(root: string, token?: string | undefined, callInfo?: string | undefined);
|
|
38
|
+
/** True when the client points to a local Jarvis (localhost or 127.0.0.1). */
|
|
39
|
+
isLocalHost(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a TicketV2Client.
|
|
42
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
43
|
+
*/
|
|
44
|
+
createTicketClient: (jarvisInfoHeader?: string) => TicketV2Client;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a WorkspaceV2Client.
|
|
47
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
48
|
+
*/
|
|
49
|
+
createWorkspaceClient: (jarvisInfoHeader?: string) => WorkspaceV2Client;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a WorkspacePlanningV2Client.
|
|
52
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
53
|
+
*/
|
|
54
|
+
createWorkspacePlanningClient: (jarvisInfoHeader?: string) => WorkspacePlanningV2Client;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a WorkTaskV2Client.
|
|
57
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
58
|
+
*/
|
|
59
|
+
createWorkTaskClient: (jarvisInfoHeader?: string) => WorkTaskV2Client;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a DatasetV2Client.
|
|
62
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
63
|
+
*/
|
|
64
|
+
createDatasetClient: (jarvisInfoHeader?: string) => DatasetV2Client;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a DocumentV2Client.
|
|
67
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
68
|
+
*/
|
|
69
|
+
createDocumentClient: (jarvisInfoHeader?: string) => DocumentV2Client;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a ContainerV2Client.
|
|
72
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
73
|
+
*/
|
|
74
|
+
createContainerClient: (jarvisInfoHeader?: string) => ContainerV2Client;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a DocumentTypeV2Client.
|
|
77
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
78
|
+
*/
|
|
79
|
+
createDocumentTypeClient: (jarvisInfoHeader?: string) => DocumentTypeV2Client;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a DmsSearchV2Client.
|
|
82
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
83
|
+
*/
|
|
84
|
+
createDmsSearchClient: (jarvisInfoHeader?: string) => DmsSearchV2Client;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a UsersV2Client.
|
|
87
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
88
|
+
*/
|
|
89
|
+
createUsersClient: (jarvisInfoHeader?: string) => UsersV2Client;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a FileUploadV2Client.
|
|
92
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
93
|
+
*/
|
|
94
|
+
createFileUploadClient: (jarvisInfoHeader?: string) => FileUploadV2Client;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a ContactV1Client.
|
|
97
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
98
|
+
*/
|
|
99
|
+
createContactV1Client: (jarvisInfoHeader?: string) => ContactV1Client;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a ContactV2Client.
|
|
102
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
103
|
+
*/
|
|
104
|
+
createContactV2Client: (jarvisInfoHeader?: string) => ContactV2Client;
|
|
105
|
+
/**
|
|
106
|
+
* Creates a AccountV2Client.
|
|
107
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
108
|
+
*/
|
|
109
|
+
createAccountV2Client: (jarvisInfoHeader?: string) => AccountV2Client;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a PropertiesV2Client.
|
|
112
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
113
|
+
*/
|
|
114
|
+
createPropertiesClient: (jarvisInfoHeader?: string) => PropertiesV2Client;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a JarvisFieldsV2Client.
|
|
117
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
118
|
+
*/
|
|
119
|
+
createFieldsClient: (jarvisInfoHeader?: string) => JarvisFieldsV2Client;
|
|
120
|
+
/**
|
|
121
|
+
* Creates a PropertiesV1Client.
|
|
122
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
123
|
+
*/
|
|
124
|
+
createPropertiesV1Client: (jarvisInfoHeader?: string) => PropertiesV1Client;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a IdTranslationV1Client.
|
|
127
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
128
|
+
*/
|
|
129
|
+
createIdTranslationV1Client: (jarvisInfoHeader?: string) => IdTranslationV1Client;
|
|
130
|
+
/**
|
|
131
|
+
* Creates a LongRunningJobPublicV2Client.
|
|
132
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
133
|
+
*/
|
|
134
|
+
createLongRunningJobClient: (jarvisInfoHeader?: string) => LongRunningJobPublicV2Client;
|
|
135
|
+
/**
|
|
136
|
+
* Creates a TaskTypeV2Client.
|
|
137
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
138
|
+
*/
|
|
139
|
+
createTaskTypeV2Client: (jarvisInfoHeader?: string) => TaskTypeV2Client;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a AvatarV2Client.
|
|
142
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
143
|
+
*/
|
|
144
|
+
createAvatarClient: (jarvisInfoHeader?: string) => AvatarV2Client;
|
|
145
|
+
/**
|
|
146
|
+
* Creates a IntegrationV2Client.
|
|
147
|
+
* @param jarvisInfoHeader overrides the X-Jarvis-Call-Info header for the calls of this client
|
|
148
|
+
*/
|
|
149
|
+
createIntegrationClient: (jarvisInfoHeader?: string) => IntegrationV2Client;
|
|
150
|
+
}
|
|
151
|
+
/** Creates a generated API client with the configuration of a {@link JarvisClient}. */
|
|
152
|
+
export declare class JarvisTsClient<T extends JarvisApiBaseClient> {
|
|
153
|
+
private clientType;
|
|
154
|
+
private baseUrl?;
|
|
155
|
+
private token?;
|
|
156
|
+
private jarvisCallInfoHeader?;
|
|
157
|
+
constructor(clientType: new (config: JarvisApiConfig, baseUrl?: string, http?: {
|
|
158
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
159
|
+
}) => T, baseUrl?: string | undefined, token?: string | undefined, jarvisCallInfoHeader?: string | undefined);
|
|
160
|
+
createClient(http?: {
|
|
161
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
162
|
+
}): T;
|
|
163
|
+
}
|
|
164
|
+
/** Entry point of the SDK: creates a {@link JarvisClient}. */
|
|
165
|
+
export declare class Jarvis {
|
|
166
|
+
/**
|
|
167
|
+
* Creates a client for the given Jarvis address.
|
|
168
|
+
* @param root the Jarvis address, e.g. https://my-jarvis.example.com
|
|
169
|
+
* @param token the API token; omit it when the browser session is already authenticated
|
|
170
|
+
* @param contextInfo optional X-Jarvis-Call-Info header sent with every call
|
|
171
|
+
*/
|
|
172
|
+
static CreateClient: (root: string, token?: string, contextInfo?: {
|
|
173
|
+
callInfoHeader?: string;
|
|
174
|
+
}) => JarvisClient;
|
|
175
|
+
/**
|
|
176
|
+
* For components hosted inside Jarvis: connects to the Jarvis that serves the page.
|
|
177
|
+
* On localhost it uses {@link Jarvis.CreateDevClient} instead.
|
|
178
|
+
* @param jarvisLocation Jarvis address and token to use during local development
|
|
179
|
+
* @param location the page location, window.location by default
|
|
180
|
+
*/
|
|
181
|
+
static Autodiscover: (jarvisLocation?: {
|
|
182
|
+
url: string;
|
|
183
|
+
token: string;
|
|
184
|
+
}, location?: Location, contextInfo?: {
|
|
185
|
+
callInfoHeader?: string;
|
|
186
|
+
}) => JarvisClient;
|
|
187
|
+
/**
|
|
188
|
+
* Client for local development: uses jarvisLocation or, when missing, the JARVIS_URI and token
|
|
189
|
+
* globals defined by the development proxy.
|
|
190
|
+
*/
|
|
191
|
+
static CreateDevClient: (jarvisLocation?: {
|
|
192
|
+
url: string;
|
|
193
|
+
token: string;
|
|
194
|
+
}, contextInfo?: {
|
|
195
|
+
callInfoHeader?: string;
|
|
196
|
+
}) => JarvisClient;
|
|
197
|
+
/** Creates a client for the Jarvis at the given page location (protocol, host and port). */
|
|
198
|
+
static ConnectTo: (location: Location, token?: string, contextInfo?: {
|
|
199
|
+
callInfoHeader?: string;
|
|
200
|
+
}) => JarvisClient;
|
|
201
|
+
}
|