@collective-intelligence/external-apps-client-sdk-react 0.0.0-stage → 0.1.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/README.md +140 -2
- package/dist/index-6memxjn1.js +49 -0
- package/dist/index.d.ts +958 -0
- package/dist/index.js +2 -0
- package/dist/resources.d.ts +662 -0
- package/dist/resources.js +2 -0
- package/package.json +70 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,958 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import { CSSProperties, ElementType, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export type FederatedAuthErrorCode = "configuration_error" | "invalid_return_target" | "invalid_callback" | "invalid_state" | "transaction_expired" | "authorization_failed" | "token_exchange_failed" | "reauthorization_required";
|
|
6
|
+
declare class FederatedAuthError extends Error {
|
|
7
|
+
readonly code: FederatedAuthErrorCode;
|
|
8
|
+
constructor(code: FederatedAuthErrorCode, message: string);
|
|
9
|
+
}
|
|
10
|
+
export type FederatedSessionIdentity = Readonly<{
|
|
11
|
+
email: string | null;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string | null;
|
|
14
|
+
organizationId: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type FederatedAuthState = Readonly<{
|
|
17
|
+
status: "anonymous";
|
|
18
|
+
}> | Readonly<{
|
|
19
|
+
status: "redirecting";
|
|
20
|
+
}> | Readonly<{
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
identity?: FederatedSessionIdentity;
|
|
23
|
+
status: "authenticated";
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
status: "expired";
|
|
26
|
+
}> | Readonly<{
|
|
27
|
+
error: FederatedAuthError;
|
|
28
|
+
status: "error";
|
|
29
|
+
}>;
|
|
30
|
+
export type FederatedAuth = Readonly<{
|
|
31
|
+
beginLogin: (options: Readonly<{
|
|
32
|
+
returnTo: string;
|
|
33
|
+
}>) => Promise<string>;
|
|
34
|
+
completeLogin: (callbackUrl: string) => Promise<Readonly<{
|
|
35
|
+
returnTo: string;
|
|
36
|
+
}>>;
|
|
37
|
+
getAccessToken: () => Promise<string>;
|
|
38
|
+
getState: () => FederatedAuthState;
|
|
39
|
+
logout: () => Promise<void>;
|
|
40
|
+
reauthorize: (options?: Readonly<{
|
|
41
|
+
returnTo?: string;
|
|
42
|
+
}>) => Promise<string>;
|
|
43
|
+
subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
|
|
44
|
+
}>;
|
|
45
|
+
export type ClientFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
46
|
+
export type JsonValue$1 = boolean | null | number | readonly JsonValue$1[] | Readonly<{
|
|
47
|
+
readonly [key: string]: JsonValue$1;
|
|
48
|
+
}> | string;
|
|
49
|
+
export type JsonObject = Readonly<Record<string, JsonValue$1>>;
|
|
50
|
+
export type WorkflowInvokeTarget = {
|
|
51
|
+
workflowId: string;
|
|
52
|
+
workflowFqn?: never;
|
|
53
|
+
} | {
|
|
54
|
+
workflowFqn: string;
|
|
55
|
+
workflowId?: never;
|
|
56
|
+
};
|
|
57
|
+
/** Addresses an Agent by its UUID or its in-organization FQN. */
|
|
58
|
+
export type AgentInvokeTarget = {
|
|
59
|
+
agentId: string;
|
|
60
|
+
agentFqn?: never;
|
|
61
|
+
} | {
|
|
62
|
+
agentFqn: string;
|
|
63
|
+
agentId?: never;
|
|
64
|
+
};
|
|
65
|
+
/** Starts a conversation with an Agent, or continues an existing one. */
|
|
66
|
+
export type ConversationContinueTarget = (AgentInvokeTarget & {
|
|
67
|
+
conversationId?: never;
|
|
68
|
+
}) | {
|
|
69
|
+
agentFqn?: never;
|
|
70
|
+
agentId?: never;
|
|
71
|
+
conversationId: string;
|
|
72
|
+
};
|
|
73
|
+
export type ConversationTurnStatus = "accepted" | "cancelled" | "failed" | "running" | "succeeded";
|
|
74
|
+
/**
|
|
75
|
+
* One conversation turn: the application's input, the Agent's final message
|
|
76
|
+
* once its run succeeded, and the Agent Output the run saved, if any.
|
|
77
|
+
* `runId` identifies the turn and its producing run.
|
|
78
|
+
*/
|
|
79
|
+
export interface ConversationTurn {
|
|
80
|
+
completedAt: string | null;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
input: unknown;
|
|
83
|
+
message: string | null;
|
|
84
|
+
output?: unknown;
|
|
85
|
+
runId: string;
|
|
86
|
+
status: ConversationTurnStatus;
|
|
87
|
+
}
|
|
88
|
+
export interface ConversationHistory {
|
|
89
|
+
agentId: string;
|
|
90
|
+
conversationId: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
turns: ConversationTurn[];
|
|
93
|
+
}
|
|
94
|
+
export interface QueryFilter {
|
|
95
|
+
caseSensitive?: boolean;
|
|
96
|
+
field: string;
|
|
97
|
+
op: "eq" | "neq" | "in" | "contains" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
98
|
+
value?: unknown;
|
|
99
|
+
}
|
|
100
|
+
export interface SearchQuery {
|
|
101
|
+
cursor?: string;
|
|
102
|
+
entitySchemaId: string;
|
|
103
|
+
fields?: string[];
|
|
104
|
+
filters?: QueryFilter[];
|
|
105
|
+
limit?: number;
|
|
106
|
+
text?: string;
|
|
107
|
+
}
|
|
108
|
+
export type KnowledgeQuery = {
|
|
109
|
+
entityId: string;
|
|
110
|
+
op: "get";
|
|
111
|
+
} | {
|
|
112
|
+
anchorEntityId: string;
|
|
113
|
+
filters?: QueryFilter[];
|
|
114
|
+
limit?: number;
|
|
115
|
+
op: "related";
|
|
116
|
+
relationSchemaId: string;
|
|
117
|
+
text?: string;
|
|
118
|
+
} | (SearchQuery & {
|
|
119
|
+
op: "search";
|
|
120
|
+
}) | {
|
|
121
|
+
entitySchemaId: string;
|
|
122
|
+
fields: string[];
|
|
123
|
+
filters?: QueryFilter[];
|
|
124
|
+
op: "facets";
|
|
125
|
+
text?: string;
|
|
126
|
+
} | (SearchQuery & {
|
|
127
|
+
op: "autocomplete";
|
|
128
|
+
});
|
|
129
|
+
export type ExternalApplicationOperationRequest = {
|
|
130
|
+
input: JsonObject | unknown[];
|
|
131
|
+
operationId: "context_get";
|
|
132
|
+
} | {
|
|
133
|
+
input: {
|
|
134
|
+
query: KnowledgeQuery;
|
|
135
|
+
};
|
|
136
|
+
operationId: "knowledge_query";
|
|
137
|
+
} | {
|
|
138
|
+
input: {
|
|
139
|
+
schemaId: string;
|
|
140
|
+
};
|
|
141
|
+
operationId: "knowledge_get_entity_schema_snapshot";
|
|
142
|
+
} | {
|
|
143
|
+
input: SearchQuery;
|
|
144
|
+
operationId: "knowledge_search_entities";
|
|
145
|
+
} | {
|
|
146
|
+
input: {
|
|
147
|
+
entitySchemaId: string;
|
|
148
|
+
fields: string[];
|
|
149
|
+
filters?: QueryFilter[];
|
|
150
|
+
text?: string;
|
|
151
|
+
};
|
|
152
|
+
operationId: "knowledge_facets";
|
|
153
|
+
} | {
|
|
154
|
+
input: {
|
|
155
|
+
entitySchemaId: string;
|
|
156
|
+
};
|
|
157
|
+
operationId: "knowledge_get_schema_query_context";
|
|
158
|
+
} | {
|
|
159
|
+
input: SearchQuery;
|
|
160
|
+
operationId: "knowledge_autocomplete";
|
|
161
|
+
} | {
|
|
162
|
+
input: {
|
|
163
|
+
entityId: string;
|
|
164
|
+
};
|
|
165
|
+
operationId: "knowledge_get_entity";
|
|
166
|
+
} | {
|
|
167
|
+
input: {
|
|
168
|
+
entity: {
|
|
169
|
+
data: JsonObject;
|
|
170
|
+
description?: string;
|
|
171
|
+
entitySchemaId: string;
|
|
172
|
+
name: string;
|
|
173
|
+
};
|
|
174
|
+
idempotencyKey: string;
|
|
175
|
+
};
|
|
176
|
+
operationId: "knowledge_create_entity";
|
|
177
|
+
} | {
|
|
178
|
+
input: {
|
|
179
|
+
entity: {
|
|
180
|
+
data?: JsonObject;
|
|
181
|
+
description?: string;
|
|
182
|
+
name?: string;
|
|
183
|
+
};
|
|
184
|
+
entityId: string;
|
|
185
|
+
expectedVersion: number;
|
|
186
|
+
idempotencyKey: string;
|
|
187
|
+
};
|
|
188
|
+
operationId: "knowledge_update_entity";
|
|
189
|
+
} | {
|
|
190
|
+
input: {
|
|
191
|
+
entity: {
|
|
192
|
+
data: JsonObject;
|
|
193
|
+
description?: string;
|
|
194
|
+
entitySchemaId: string;
|
|
195
|
+
name: string;
|
|
196
|
+
};
|
|
197
|
+
entitySchemaId: string;
|
|
198
|
+
externalIdentity: {
|
|
199
|
+
source: string;
|
|
200
|
+
value: string;
|
|
201
|
+
};
|
|
202
|
+
idempotencyKey: string;
|
|
203
|
+
};
|
|
204
|
+
operationId: "knowledge_upsert_entity";
|
|
205
|
+
} | {
|
|
206
|
+
input: {
|
|
207
|
+
entityId: string;
|
|
208
|
+
expectedVersion: number;
|
|
209
|
+
idempotencyKey: string;
|
|
210
|
+
};
|
|
211
|
+
operationId: "knowledge_delete_entity";
|
|
212
|
+
} | {
|
|
213
|
+
input: {
|
|
214
|
+
anchorEntityId: string;
|
|
215
|
+
direction?: "incoming" | "outgoing" | "both";
|
|
216
|
+
limit?: number;
|
|
217
|
+
maxDepth?: number;
|
|
218
|
+
relationSchemaId?: string;
|
|
219
|
+
};
|
|
220
|
+
operationId: "knowledge_traverse";
|
|
221
|
+
} | {
|
|
222
|
+
input: {
|
|
223
|
+
idempotencyKey: string;
|
|
224
|
+
relation: {
|
|
225
|
+
data?: JsonObject;
|
|
226
|
+
relationSchemaId: string;
|
|
227
|
+
sourceId: string;
|
|
228
|
+
targetId: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
operationId: "knowledge_create_relation";
|
|
232
|
+
} | {
|
|
233
|
+
input: {
|
|
234
|
+
expectedVersion: number;
|
|
235
|
+
idempotencyKey: string;
|
|
236
|
+
relation: {
|
|
237
|
+
data?: JsonObject;
|
|
238
|
+
};
|
|
239
|
+
relationId: string;
|
|
240
|
+
};
|
|
241
|
+
operationId: "knowledge_update_relation";
|
|
242
|
+
} | {
|
|
243
|
+
input: {
|
|
244
|
+
expectedVersion: number;
|
|
245
|
+
idempotencyKey: string;
|
|
246
|
+
relationId: string;
|
|
247
|
+
};
|
|
248
|
+
operationId: "knowledge_delete_relation";
|
|
249
|
+
} | {
|
|
250
|
+
input: {
|
|
251
|
+
filter?: JsonObject;
|
|
252
|
+
};
|
|
253
|
+
operationId: "agents_list";
|
|
254
|
+
} | {
|
|
255
|
+
input: {
|
|
256
|
+
idempotencyKey: string;
|
|
257
|
+
input: unknown;
|
|
258
|
+
} & AgentInvokeTarget;
|
|
259
|
+
operationId: "agents_invoke";
|
|
260
|
+
} | {
|
|
261
|
+
input: {
|
|
262
|
+
filter?: JsonObject;
|
|
263
|
+
};
|
|
264
|
+
operationId: "skills_list";
|
|
265
|
+
} | {
|
|
266
|
+
input: {
|
|
267
|
+
idempotencyKey: string;
|
|
268
|
+
input: unknown;
|
|
269
|
+
skillId: string;
|
|
270
|
+
};
|
|
271
|
+
operationId: "skills_invoke";
|
|
272
|
+
} | {
|
|
273
|
+
input: {
|
|
274
|
+
filter?: JsonObject;
|
|
275
|
+
};
|
|
276
|
+
operationId: "workflows_list";
|
|
277
|
+
} | {
|
|
278
|
+
input: {
|
|
279
|
+
idempotencyKey: string;
|
|
280
|
+
input: unknown;
|
|
281
|
+
} & WorkflowInvokeTarget;
|
|
282
|
+
operationId: "workflows_invoke";
|
|
283
|
+
} | {
|
|
284
|
+
input: {
|
|
285
|
+
runId: string;
|
|
286
|
+
};
|
|
287
|
+
operationId: "runs_get";
|
|
288
|
+
} | {
|
|
289
|
+
input: {
|
|
290
|
+
afterCursor?: string;
|
|
291
|
+
runId: string;
|
|
292
|
+
};
|
|
293
|
+
operationId: "runs_stream";
|
|
294
|
+
} | {
|
|
295
|
+
input: {
|
|
296
|
+
runId: string;
|
|
297
|
+
};
|
|
298
|
+
operationId: "runs_cancel";
|
|
299
|
+
} | {
|
|
300
|
+
input: {
|
|
301
|
+
contentBase64: string;
|
|
302
|
+
contentType: string;
|
|
303
|
+
fileName: string;
|
|
304
|
+
runId: string;
|
|
305
|
+
sizeBytes: number;
|
|
306
|
+
};
|
|
307
|
+
operationId: "attachments_upload";
|
|
308
|
+
} | {
|
|
309
|
+
input: {
|
|
310
|
+
attachmentId: string;
|
|
311
|
+
runId: string;
|
|
312
|
+
};
|
|
313
|
+
operationId: "attachments_download_url";
|
|
314
|
+
} | {
|
|
315
|
+
input: {
|
|
316
|
+
idempotencyKey: string;
|
|
317
|
+
input: unknown;
|
|
318
|
+
} & ConversationContinueTarget;
|
|
319
|
+
operationId: "conversations_continue";
|
|
320
|
+
} | {
|
|
321
|
+
input: {
|
|
322
|
+
conversationId: string;
|
|
323
|
+
};
|
|
324
|
+
operationId: "conversations_history";
|
|
325
|
+
};
|
|
326
|
+
export interface EnvelopeSuccess<Id extends string, Result> {
|
|
327
|
+
correlationId: string;
|
|
328
|
+
operationId: Id;
|
|
329
|
+
result: Result;
|
|
330
|
+
}
|
|
331
|
+
export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"context_get", JsonObject> | EnvelopeSuccess<"knowledge_query", JsonObject> | EnvelopeSuccess<"knowledge_get_entity_schema_snapshot", JsonObject> | EnvelopeSuccess<"knowledge_search_entities", JsonObject> | EnvelopeSuccess<"knowledge_facets", JsonObject> | EnvelopeSuccess<"knowledge_get_schema_query_context", JsonObject> | EnvelopeSuccess<"knowledge_autocomplete", JsonObject> | EnvelopeSuccess<"knowledge_get_entity", JsonObject> | EnvelopeSuccess<"knowledge_create_entity", JsonObject> | EnvelopeSuccess<"knowledge_update_entity", JsonObject> | EnvelopeSuccess<"knowledge_upsert_entity", JsonObject> | EnvelopeSuccess<"knowledge_delete_entity", JsonObject> | EnvelopeSuccess<"knowledge_traverse", JsonObject> | EnvelopeSuccess<"knowledge_create_relation", JsonObject> | EnvelopeSuccess<"knowledge_update_relation", JsonObject> | EnvelopeSuccess<"knowledge_delete_relation", JsonObject> | EnvelopeSuccess<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
|
|
332
|
+
runId: string;
|
|
333
|
+
}> | EnvelopeSuccess<"skills_list", JsonObject> | EnvelopeSuccess<"skills_invoke", {
|
|
334
|
+
runId: string;
|
|
335
|
+
}> | EnvelopeSuccess<"workflows_list", JsonObject> | EnvelopeSuccess<"workflows_invoke", {
|
|
336
|
+
runId: string;
|
|
337
|
+
}> | EnvelopeSuccess<"runs_get", JsonObject> | EnvelopeSuccess<"runs_stream", {
|
|
338
|
+
events: JsonObject[];
|
|
339
|
+
nextCursor: string | null;
|
|
340
|
+
}> | EnvelopeSuccess<"runs_cancel", JsonObject> | EnvelopeSuccess<"attachments_upload", {
|
|
341
|
+
attachmentId: string;
|
|
342
|
+
}> | EnvelopeSuccess<"attachments_download_url", {
|
|
343
|
+
expiresAt: string;
|
|
344
|
+
url: string;
|
|
345
|
+
}> | EnvelopeSuccess<"conversations_continue", {
|
|
346
|
+
conversationId: string;
|
|
347
|
+
runId: string;
|
|
348
|
+
}> | EnvelopeSuccess<"conversations_history", ConversationHistory>;
|
|
349
|
+
export type ExternalApplicationOperationId = ExternalApplicationOperationRequest["operationId"];
|
|
350
|
+
export type ExternalApplicationOperationRequestFor<Id extends ExternalApplicationOperationId> = Extract<ExternalApplicationOperationRequest, {
|
|
351
|
+
operationId: Id;
|
|
352
|
+
}>;
|
|
353
|
+
export type ExternalApplicationOperationSuccessFor<Id extends ExternalApplicationOperationId> = Extract<ExternalApplicationOperationSuccess, {
|
|
354
|
+
operationId: Id;
|
|
355
|
+
}>;
|
|
356
|
+
export type ClientOperationId = ExternalApplicationOperationId;
|
|
357
|
+
export interface ClientOperationDefinition<Input, Output> {
|
|
358
|
+
readonly input: Input;
|
|
359
|
+
readonly output: Output;
|
|
360
|
+
}
|
|
361
|
+
export type ClientOperationMap = Readonly<{
|
|
362
|
+
[Id in ClientOperationId]: ClientOperationDefinition<ExternalApplicationOperationRequestFor<Id>["input"], ExternalApplicationOperationSuccessFor<Id>["result"]>;
|
|
363
|
+
}>;
|
|
364
|
+
export type ClientOperationInput<Operations extends ClientOperationMap, Id extends ClientOperationId> = Operations[Id]["input"];
|
|
365
|
+
export type ClientOperationOutput<Operations extends ClientOperationMap, Id extends ClientOperationId> = Operations[Id]["output"];
|
|
366
|
+
export type OperationExecutionOptions = Readonly<{
|
|
367
|
+
organizationId: string;
|
|
368
|
+
signal?: AbortSignal;
|
|
369
|
+
}>;
|
|
370
|
+
export interface TypedOperationExecutor<Operations extends ClientOperationMap> {
|
|
371
|
+
readonly execute: <Id extends ClientOperationId>(operationId: Id, input: ClientOperationInput<Operations, Id>, options?: OperationExecutionOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
|
|
372
|
+
}
|
|
373
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | Readonly<{
|
|
374
|
+
[key: string]: JsonValue;
|
|
375
|
+
}>;
|
|
376
|
+
export type CiErrorCode = "unauthenticated" | "forbidden" | "not_found" | "conflict" | "invalid_request" | "rate_limited" | "unavailable" | "internal";
|
|
377
|
+
export type CiError = Readonly<{
|
|
378
|
+
code: CiErrorCode;
|
|
379
|
+
message: string;
|
|
380
|
+
retryable: boolean;
|
|
381
|
+
details?: Readonly<Record<string, JsonValue>>;
|
|
382
|
+
}>;
|
|
383
|
+
export type CiResult<Value> = Readonly<{
|
|
384
|
+
correlationId: string;
|
|
385
|
+
ok: true;
|
|
386
|
+
value: Value;
|
|
387
|
+
}> | Readonly<{
|
|
388
|
+
correlationId: string;
|
|
389
|
+
error: CiError;
|
|
390
|
+
ok: false;
|
|
391
|
+
}>;
|
|
392
|
+
export type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
393
|
+
[key: string]: ResourceJsonValue;
|
|
394
|
+
}>;
|
|
395
|
+
/** Opaque wire identity. Callers must not infer or concatenate its internals. */
|
|
396
|
+
export type ResourceId = string;
|
|
397
|
+
export type ResourceRecordId = ResourceId;
|
|
398
|
+
/** Opaque concurrency token independent from source timestamps. */
|
|
399
|
+
export type ResourceRevision = string;
|
|
400
|
+
/** Opaque pagination position issued and consumed only by a resource adapter. */
|
|
401
|
+
export type ResourceCursor = string;
|
|
402
|
+
export type IdempotencyKey = string;
|
|
403
|
+
export type ResourceIdentityField = Readonly<{
|
|
404
|
+
name: string;
|
|
405
|
+
type: "number" | "string";
|
|
406
|
+
}>;
|
|
407
|
+
export type ResourceCapabilities = Readonly<{
|
|
408
|
+
create?: boolean;
|
|
409
|
+
/** Common entity deletion is always soft deletion. */
|
|
410
|
+
delete?: boolean;
|
|
411
|
+
get?: boolean;
|
|
412
|
+
hardDelete?: boolean;
|
|
413
|
+
includeDeleted?: boolean;
|
|
414
|
+
restore?: boolean;
|
|
415
|
+
search: true;
|
|
416
|
+
softDelete?: boolean;
|
|
417
|
+
update?: boolean;
|
|
418
|
+
}>;
|
|
419
|
+
export type ResourcePaginationMode = "cursor" | "page";
|
|
420
|
+
export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
|
|
421
|
+
export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
422
|
+
capabilities: ResourceCapabilities;
|
|
423
|
+
concurrency: "revision";
|
|
424
|
+
id: string;
|
|
425
|
+
identity: Readonly<{
|
|
426
|
+
fields: readonly [
|
|
427
|
+
ResourceIdentityField,
|
|
428
|
+
...ResourceIdentityField[]
|
|
429
|
+
];
|
|
430
|
+
}>;
|
|
431
|
+
query: Readonly<{
|
|
432
|
+
filterableFields: readonly string[];
|
|
433
|
+
pagination: Readonly<{
|
|
434
|
+
modes: readonly ResourcePaginationMode[];
|
|
435
|
+
}>;
|
|
436
|
+
sortableFields: readonly string[];
|
|
437
|
+
textSearchFields?: readonly string[];
|
|
438
|
+
}>;
|
|
439
|
+
schemas: Readonly<{
|
|
440
|
+
create?: PortableResourceSchema;
|
|
441
|
+
entity: PortableResourceSchema;
|
|
442
|
+
update?: PortableResourceSchema;
|
|
443
|
+
}>;
|
|
444
|
+
version: string;
|
|
445
|
+
/** Portable UI metadata; required/enum/nullability remain in schemas. */
|
|
446
|
+
metadata?: Readonly<Record<string, ResourceJsonValue>>;
|
|
447
|
+
/** Type-only slots keep definition values portable and serializable. */
|
|
448
|
+
readonly __types?: Readonly<{
|
|
449
|
+
create: Create;
|
|
450
|
+
entity: Entity;
|
|
451
|
+
update: Update;
|
|
452
|
+
}>;
|
|
453
|
+
}>;
|
|
454
|
+
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
455
|
+
export type ResourceFilter = Readonly<{
|
|
456
|
+
field: string;
|
|
457
|
+
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
458
|
+
value: FilterValue;
|
|
459
|
+
}> | Readonly<{
|
|
460
|
+
field: string;
|
|
461
|
+
operator: "is_not_null" | "is_null";
|
|
462
|
+
}> | Readonly<{
|
|
463
|
+
filters: readonly ResourceFilter[];
|
|
464
|
+
operator: "and" | "or";
|
|
465
|
+
}> | Readonly<{
|
|
466
|
+
filter: ResourceFilter;
|
|
467
|
+
operator: "not";
|
|
468
|
+
}>;
|
|
469
|
+
export type ResourceSort = Readonly<{
|
|
470
|
+
direction: "asc" | "desc";
|
|
471
|
+
field: string;
|
|
472
|
+
}>;
|
|
473
|
+
export type ResourcePagination = Readonly<{
|
|
474
|
+
mode: "cursor";
|
|
475
|
+
cursor?: ResourceCursor;
|
|
476
|
+
limit: number;
|
|
477
|
+
}> | Readonly<{
|
|
478
|
+
mode: "page";
|
|
479
|
+
page: number;
|
|
480
|
+
pageSize: number;
|
|
481
|
+
}>;
|
|
482
|
+
export type ResourceListQuery = Readonly<{
|
|
483
|
+
filter?: ResourceFilter;
|
|
484
|
+
includeDeleted?: boolean;
|
|
485
|
+
pagination: ResourcePagination;
|
|
486
|
+
sort?: readonly ResourceSort[];
|
|
487
|
+
textSearch?: string;
|
|
488
|
+
}>;
|
|
489
|
+
export type ResourceRecord<Entity> = Readonly<{
|
|
490
|
+
deletedAt?: string;
|
|
491
|
+
id: ResourceRecordId;
|
|
492
|
+
revision: ResourceRevision;
|
|
493
|
+
value: Entity;
|
|
494
|
+
}>;
|
|
495
|
+
export type ResourceListResult<Entity> = Readonly<{
|
|
496
|
+
items: readonly ResourceRecord<Entity>[];
|
|
497
|
+
nextCursor?: ResourceCursor;
|
|
498
|
+
pagination: "cursor";
|
|
499
|
+
}> | Readonly<{
|
|
500
|
+
items: readonly ResourceRecord<Entity>[];
|
|
501
|
+
page: number;
|
|
502
|
+
pageSize: number;
|
|
503
|
+
pagination: "page";
|
|
504
|
+
totalItems: number;
|
|
505
|
+
totalPages: number;
|
|
506
|
+
}>;
|
|
507
|
+
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
|
|
508
|
+
export type ResourceError = Readonly<{
|
|
509
|
+
code: ResourceErrorCode;
|
|
510
|
+
/** Client-observed dispatch outcome; uncertainty never proves rollback. */
|
|
511
|
+
outcome?: "not_dispatched" | "rejected" | "uncertain";
|
|
512
|
+
details?: Readonly<Record<string, ResourceJsonValue>>;
|
|
513
|
+
message: string;
|
|
514
|
+
retryable: boolean;
|
|
515
|
+
}>;
|
|
516
|
+
export type ResourceResult<Value> = Readonly<{
|
|
517
|
+
correlationId: string;
|
|
518
|
+
ok: true;
|
|
519
|
+
value: Value;
|
|
520
|
+
}> | Readonly<{
|
|
521
|
+
correlationId: string;
|
|
522
|
+
error: ResourceError;
|
|
523
|
+
ok: false;
|
|
524
|
+
}>;
|
|
525
|
+
export type ResourceRequestOptions = Readonly<{
|
|
526
|
+
signal?: AbortSignal;
|
|
527
|
+
}>;
|
|
528
|
+
export type ResourceMutationInput<Value> = Readonly<{
|
|
529
|
+
expectedRevision: ResourceRevision;
|
|
530
|
+
id: ResourceRecordId;
|
|
531
|
+
idempotencyKey?: IdempotencyKey;
|
|
532
|
+
value: Value;
|
|
533
|
+
}>;
|
|
534
|
+
export type ResourceLifecycleInput = Readonly<{
|
|
535
|
+
expectedRevision: ResourceRevision;
|
|
536
|
+
id: ResourceRecordId;
|
|
537
|
+
idempotencyKey?: IdempotencyKey;
|
|
538
|
+
}>;
|
|
539
|
+
export type ResourceCreateInput<Value> = Readonly<{
|
|
540
|
+
idempotencyKey: IdempotencyKey;
|
|
541
|
+
value: Value;
|
|
542
|
+
}>;
|
|
543
|
+
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
544
|
+
pagination: Extract<ResourcePagination, {
|
|
545
|
+
mode: "page";
|
|
546
|
+
}>;
|
|
547
|
+
}>;
|
|
548
|
+
export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
|
|
549
|
+
pagination: "page";
|
|
550
|
+
}>;
|
|
551
|
+
export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
|
|
552
|
+
export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
553
|
+
idempotencyKey: IdempotencyKey;
|
|
554
|
+
}>;
|
|
555
|
+
export type EntityDeleteInput = ResourceLifecycleInput & Readonly<{
|
|
556
|
+
idempotencyKey: IdempotencyKey;
|
|
557
|
+
}>;
|
|
558
|
+
/** A logical write retains its key, payload and edited revision on explicit resubmission. */
|
|
559
|
+
export interface EntityClient<Value, Create = Value, Patch = Partial<Value>> {
|
|
560
|
+
readonly definition: ResourceDefinition<Value, Create, Patch>;
|
|
561
|
+
readonly list: (query: EntityListQuery, options?: ResourceRequestOptions) => Promise<ResourceResult<EntityPage<Value>>>;
|
|
562
|
+
readonly get: (input: Readonly<{
|
|
563
|
+
id: ResourceRecordId;
|
|
564
|
+
}>, options?: ResourceRequestOptions) => Promise<ResourceResult<ResourceRecord<Value>>>;
|
|
565
|
+
readonly create: (input: EntityCreateInput<Create>) => Promise<ResourceResult<ResourceRecord<Value>>>;
|
|
566
|
+
readonly update: (input: EntityUpdateInput<Patch>) => Promise<ResourceResult<ResourceRecord<Value>>>;
|
|
567
|
+
readonly delete: (input: EntityDeleteInput) => Promise<ResourceResult<ResourceRecord<Value>>>;
|
|
568
|
+
}
|
|
569
|
+
export type CiStreamPage = ClientOperationOutput<ClientOperationMap, "runs_stream">;
|
|
570
|
+
export type FollowRunOptions = Readonly<{
|
|
571
|
+
/**
|
|
572
|
+
* Total wait before `followRun` throws "Run did not finish". Defaults to
|
|
573
|
+
* {@link DEFAULT_FOLLOW_RUN_DEADLINE_MS}.
|
|
574
|
+
*/
|
|
575
|
+
deadlineMs?: number;
|
|
576
|
+
/**
|
|
577
|
+
* First wait between polls in milliseconds (default 50). It doubles while
|
|
578
|
+
* no new event arrives, up to one second or `idleMs` if larger.
|
|
579
|
+
*/
|
|
580
|
+
idleMs?: number;
|
|
581
|
+
now?: () => number;
|
|
582
|
+
runId: string;
|
|
583
|
+
/** Stops following and cancels in-flight requests made by `runs.follow`. */
|
|
584
|
+
signal?: AbortSignal;
|
|
585
|
+
sleep?: (ms: number) => Promise<void>;
|
|
586
|
+
}>;
|
|
587
|
+
declare const clientSdkProtocolVersion: "v1";
|
|
588
|
+
export type SignalOptions = Readonly<{
|
|
589
|
+
signal?: AbortSignal;
|
|
590
|
+
}>;
|
|
591
|
+
export type FollowRunCall<Scoped extends boolean> = Scoped extends true ? (options: FollowRunOptions) => Promise<CiStreamPage> : (options: FollowRunOptions & Readonly<{
|
|
592
|
+
organizationId: string;
|
|
593
|
+
}>) => Promise<CiStreamPage>;
|
|
594
|
+
export type ScopedOperation<Operations extends ClientOperationMap, Id extends ClientOperationId> = (input: ClientOperationInput<Operations, Id>, options?: SignalOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
|
|
595
|
+
export type RootOperation<Operations extends ClientOperationMap, Id extends ClientOperationId> = (input: ClientOperationInput<Operations, Id> & Readonly<{
|
|
596
|
+
organizationId: string;
|
|
597
|
+
}>, options?: SignalOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
|
|
598
|
+
export type DomainOperation<Operations extends ClientOperationMap, Id extends ClientOperationId, Scoped extends boolean> = Scoped extends true ? ScopedOperation<Operations, Id> : RootOperation<Operations, Id>;
|
|
599
|
+
export type ClientDomains<Operations extends ClientOperationMap, Scoped extends boolean> = Readonly<{
|
|
600
|
+
agents: Readonly<{
|
|
601
|
+
invoke: DomainOperation<Operations, "agents_invoke", Scoped>;
|
|
602
|
+
list: DomainOperation<Operations, "agents_list", Scoped>;
|
|
603
|
+
}>;
|
|
604
|
+
attachments: Readonly<{
|
|
605
|
+
downloadUrl: DomainOperation<Operations, "attachments_download_url", Scoped>;
|
|
606
|
+
upload: DomainOperation<Operations, "attachments_upload", Scoped>;
|
|
607
|
+
}>;
|
|
608
|
+
context: Readonly<{
|
|
609
|
+
get: DomainOperation<Operations, "context_get", Scoped>;
|
|
610
|
+
}>;
|
|
611
|
+
knowledge: Readonly<{
|
|
612
|
+
autocomplete: DomainOperation<Operations, "knowledge_autocomplete", Scoped>;
|
|
613
|
+
createEntity: DomainOperation<Operations, "knowledge_create_entity", Scoped>;
|
|
614
|
+
createRelation: DomainOperation<Operations, "knowledge_create_relation", Scoped>;
|
|
615
|
+
deleteEntity: DomainOperation<Operations, "knowledge_delete_entity", Scoped>;
|
|
616
|
+
deleteRelation: DomainOperation<Operations, "knowledge_delete_relation", Scoped>;
|
|
617
|
+
facets: DomainOperation<Operations, "knowledge_facets", Scoped>;
|
|
618
|
+
getEntity: DomainOperation<Operations, "knowledge_get_entity", Scoped>;
|
|
619
|
+
getEntitySchemaSnapshot: DomainOperation<Operations, "knowledge_get_entity_schema_snapshot", Scoped>;
|
|
620
|
+
getSchemaQueryContext: DomainOperation<Operations, "knowledge_get_schema_query_context", Scoped>;
|
|
621
|
+
query: DomainOperation<Operations, "knowledge_query", Scoped>;
|
|
622
|
+
searchEntities: DomainOperation<Operations, "knowledge_search_entities", Scoped>;
|
|
623
|
+
traverse: DomainOperation<Operations, "knowledge_traverse", Scoped>;
|
|
624
|
+
updateEntity: DomainOperation<Operations, "knowledge_update_entity", Scoped>;
|
|
625
|
+
updateRelation: DomainOperation<Operations, "knowledge_update_relation", Scoped>;
|
|
626
|
+
upsertEntity: DomainOperation<Operations, "knowledge_upsert_entity", Scoped>;
|
|
627
|
+
}>;
|
|
628
|
+
runs: Readonly<{
|
|
629
|
+
cancel: DomainOperation<Operations, "runs_cancel", Scoped>;
|
|
630
|
+
follow: FollowRunCall<Scoped>;
|
|
631
|
+
get: DomainOperation<Operations, "runs_get", Scoped>;
|
|
632
|
+
stream: DomainOperation<Operations, "runs_stream", Scoped>;
|
|
633
|
+
}>;
|
|
634
|
+
skills: Readonly<{
|
|
635
|
+
invoke: DomainOperation<Operations, "skills_invoke", Scoped>;
|
|
636
|
+
list: DomainOperation<Operations, "skills_list", Scoped>;
|
|
637
|
+
}>;
|
|
638
|
+
workflows: Readonly<{
|
|
639
|
+
invoke: DomainOperation<Operations, "workflows_invoke", Scoped>;
|
|
640
|
+
list: DomainOperation<Operations, "workflows_list", Scoped>;
|
|
641
|
+
}>;
|
|
642
|
+
}>;
|
|
643
|
+
export type OrganizationClient<Operations extends ClientOperationMap> = ClientDomains<Operations, true> & Readonly<{
|
|
644
|
+
organizationId: string;
|
|
645
|
+
}>;
|
|
646
|
+
export type ClientSdkClient<Operations extends ClientOperationMap> = Omit<ClientDomains<Operations, false>, "context"> & TypedOperationExecutor<Operations> & Readonly<{
|
|
647
|
+
context: ClientDomains<Operations, false>["context"] & Readonly<{
|
|
648
|
+
forOrganization: (organizationId: string) => OrganizationClient<Operations>;
|
|
649
|
+
}>;
|
|
650
|
+
forOrganization: (organizationId: string) => OrganizationClient<Operations>;
|
|
651
|
+
protocolVersion: typeof clientSdkProtocolVersion;
|
|
652
|
+
}>;
|
|
653
|
+
export type PromptKeyEvent = Readonly<{
|
|
654
|
+
isComposing: boolean;
|
|
655
|
+
key: string;
|
|
656
|
+
preventDefault: () => void;
|
|
657
|
+
shiftKey: boolean;
|
|
658
|
+
}>;
|
|
659
|
+
export declare const createPromptKeyHandler: (onSubmit: () => void) => (event: PromptKeyEvent) => void;
|
|
660
|
+
export type AgentPromptComponents = Readonly<{
|
|
661
|
+
Button?: ElementType;
|
|
662
|
+
Form?: ElementType;
|
|
663
|
+
Label?: ElementType;
|
|
664
|
+
Status?: ElementType;
|
|
665
|
+
Textarea?: ElementType;
|
|
666
|
+
}>;
|
|
667
|
+
export type AgentPromptPrimitiveProps = Readonly<{
|
|
668
|
+
autoFocus?: boolean;
|
|
669
|
+
className?: string;
|
|
670
|
+
components?: AgentPromptComponents;
|
|
671
|
+
id: string;
|
|
672
|
+
label: ReactNode;
|
|
673
|
+
onChange: (value: string) => void;
|
|
674
|
+
onSubmit: () => void;
|
|
675
|
+
pending: boolean;
|
|
676
|
+
status?: ReactNode;
|
|
677
|
+
style?: CSSProperties;
|
|
678
|
+
submitLabel?: ReactNode;
|
|
679
|
+
value: string;
|
|
680
|
+
}>;
|
|
681
|
+
export declare const AgentPromptPrimitive: ({ autoFocus, className, components, id, label, onChange, onSubmit, pending, status, style, submitLabel, value }: AgentPromptPrimitiveProps) => import("react").JSX.Element;
|
|
682
|
+
export type AgentInvokeInput = ClientOperationInput<ClientOperationMap, "agents_invoke">;
|
|
683
|
+
export type AgentInvokeResult = Awaited<ReturnType<OrganizationClient<ClientOperationMap>["agents"]["invoke"]>>;
|
|
684
|
+
export type AgentInvocationState = Readonly<{
|
|
685
|
+
status: "idle";
|
|
686
|
+
}> | Readonly<{
|
|
687
|
+
status: "submitting";
|
|
688
|
+
}> | Readonly<{
|
|
689
|
+
result: Extract<AgentInvokeResult, {
|
|
690
|
+
ok: true;
|
|
691
|
+
}>;
|
|
692
|
+
status: "success";
|
|
693
|
+
}> | Readonly<{
|
|
694
|
+
result: Extract<AgentInvokeResult, {
|
|
695
|
+
ok: false;
|
|
696
|
+
}>;
|
|
697
|
+
status: "failure";
|
|
698
|
+
}> | Readonly<{
|
|
699
|
+
error: unknown;
|
|
700
|
+
status: "error";
|
|
701
|
+
}>;
|
|
702
|
+
export declare const useAgentInvocation: (organizationId: string) => {
|
|
703
|
+
readonly invoke: (input: AgentInvokeInput) => Promise<AgentInvokeResult>;
|
|
704
|
+
readonly reset: () => void;
|
|
705
|
+
readonly state: AgentInvocationState;
|
|
706
|
+
};
|
|
707
|
+
export type AgentPromptProps = Readonly<{
|
|
708
|
+
agentId: string;
|
|
709
|
+
autoFocus?: boolean;
|
|
710
|
+
className?: string;
|
|
711
|
+
components?: AgentPromptComponents;
|
|
712
|
+
createIdempotencyKey?: () => string;
|
|
713
|
+
label?: ReactNode;
|
|
714
|
+
onResult?: (result: AgentInvokeResult) => void;
|
|
715
|
+
organizationId: string;
|
|
716
|
+
style?: CSSProperties;
|
|
717
|
+
submitLabel?: ReactNode;
|
|
718
|
+
}>;
|
|
719
|
+
export declare const AgentPrompt: ({ agentId, autoFocus, className, components, createIdempotencyKey, label, onResult, organizationId, style, submitLabel }: AgentPromptProps) => import("react").JSX.Element;
|
|
720
|
+
export type EntityIdentity = Readonly<{
|
|
721
|
+
sourceId: string;
|
|
722
|
+
applicationId: string;
|
|
723
|
+
userId: string;
|
|
724
|
+
organizationId: string;
|
|
725
|
+
}>;
|
|
726
|
+
export type EntitySourceState = Readonly<{
|
|
727
|
+
status: "authenticated";
|
|
728
|
+
identity: EntityIdentity;
|
|
729
|
+
}> | Readonly<{
|
|
730
|
+
status: "unauthenticated" | "expired" | "forbidden";
|
|
731
|
+
}>;
|
|
732
|
+
/** Configured authenticated client boundary. Snapshots are stable until identity changes. */
|
|
733
|
+
export interface EntitySource {
|
|
734
|
+
readonly getSnapshot: () => EntitySourceState;
|
|
735
|
+
readonly subscribe: (notify: () => void) => () => void;
|
|
736
|
+
readonly bind: <Value, Create, Patch>(contract: ResourceDefinition<Value, Create, Patch>) => EntityClient<Value, Create, Patch>;
|
|
737
|
+
}
|
|
738
|
+
export type DelegatedIdentity = Readonly<{
|
|
739
|
+
organizationId: string;
|
|
740
|
+
userId: string;
|
|
741
|
+
}>;
|
|
742
|
+
export type DelegatedEntitySourceOptions = Readonly<{
|
|
743
|
+
applicationId: string;
|
|
744
|
+
fetch?: ClientFetch;
|
|
745
|
+
getIdentity: () => DelegatedIdentity | null;
|
|
746
|
+
getStatus: () => string;
|
|
747
|
+
origin: string;
|
|
748
|
+
pathFor?: (contract: Readonly<{
|
|
749
|
+
id: string;
|
|
750
|
+
}>) => string;
|
|
751
|
+
sourceId?: string;
|
|
752
|
+
subscribe: (notify: () => void) => () => void;
|
|
753
|
+
}>;
|
|
754
|
+
/** Binds entity contracts to same-origin Resource proxy routes from the current session. */
|
|
755
|
+
export declare const createDelegatedEntitySource: (options: DelegatedEntitySourceOptions) => EntitySource;
|
|
756
|
+
export type Client = ClientSdkClient<ClientOperationMap>;
|
|
757
|
+
export type Organization = OrganizationClient<ClientOperationMap>;
|
|
758
|
+
export type CollectiveIntelligenceProviderProps = Readonly<{
|
|
759
|
+
entitySource?: EntitySource | undefined;
|
|
760
|
+
} & ({
|
|
761
|
+
children: ReactNode;
|
|
762
|
+
client: Client;
|
|
763
|
+
clientFactory?: never;
|
|
764
|
+
} | {
|
|
765
|
+
children: ReactNode;
|
|
766
|
+
client?: never;
|
|
767
|
+
clientFactory: () => Client;
|
|
768
|
+
})>;
|
|
769
|
+
export declare const CollectiveIntelligenceProvider: (props: CollectiveIntelligenceProviderProps) => import("react").JSX.Element;
|
|
770
|
+
export declare const useCollectiveIntelligenceClient: () => Client;
|
|
771
|
+
export declare const useOrganizationClient: (organizationId: string) => OrganizationClient<ClientOperationMap>;
|
|
772
|
+
export declare const useKnowledge: (organizationId: string) => Organization["knowledge"];
|
|
773
|
+
export declare const useAgents: (organizationId: string) => Organization["agents"];
|
|
774
|
+
export declare const useSkills: (organizationId: string) => Organization["skills"];
|
|
775
|
+
export declare const useWorkflows: (organizationId: string) => Organization["workflows"];
|
|
776
|
+
export declare const useRuns: (organizationId: string) => Organization["runs"];
|
|
777
|
+
export declare const useAttachments: (organizationId: string) => Organization["attachments"];
|
|
778
|
+
export declare const useClientContext: (organizationId: string) => Organization["context"];
|
|
779
|
+
export type AuthContextValue = Readonly<{
|
|
780
|
+
auth: FederatedAuth;
|
|
781
|
+
state: FederatedAuthState;
|
|
782
|
+
}>;
|
|
783
|
+
export type CollectiveIntelligenceLoginProviderProps = Readonly<{
|
|
784
|
+
auth: FederatedAuth;
|
|
785
|
+
} & CollectiveIntelligenceProviderProps>;
|
|
786
|
+
export declare const CollectiveIntelligenceLoginProvider: (props: CollectiveIntelligenceLoginProviderProps) => import("react").JSX.Element;
|
|
787
|
+
export type CollectiveIntelligenceAuthBinding = AuthContextValue & Readonly<{
|
|
788
|
+
beginLogin: FederatedAuth["beginLogin"];
|
|
789
|
+
completeLogin: FederatedAuth["completeLogin"];
|
|
790
|
+
logout: FederatedAuth["logout"];
|
|
791
|
+
reauthorize: FederatedAuth["reauthorize"];
|
|
792
|
+
}>;
|
|
793
|
+
export declare const useCollectiveIntelligenceAuth: () => CollectiveIntelligenceAuthBinding;
|
|
794
|
+
export type LoginButtonComponents = Readonly<{
|
|
795
|
+
Button?: ElementType;
|
|
796
|
+
}>;
|
|
797
|
+
export type LoginButtonProps = Readonly<{
|
|
798
|
+
children?: ReactNode;
|
|
799
|
+
className?: string;
|
|
800
|
+
components?: LoginButtonComponents;
|
|
801
|
+
disabled?: boolean;
|
|
802
|
+
onError?: (error: FederatedAuthError) => void;
|
|
803
|
+
returnTo?: string;
|
|
804
|
+
style?: CSSProperties;
|
|
805
|
+
}>;
|
|
806
|
+
export declare const LoginButton: ({ children, className, components, disabled, onError, returnTo, style }: LoginButtonProps) => import("react").JSX.Element;
|
|
807
|
+
export type LoginCallbackComponents = Readonly<{
|
|
808
|
+
Status?: ElementType;
|
|
809
|
+
}>;
|
|
810
|
+
export type LoginCallbackPrimitiveProps = Readonly<{
|
|
811
|
+
className?: string;
|
|
812
|
+
components?: LoginCallbackComponents;
|
|
813
|
+
state: FederatedAuthState;
|
|
814
|
+
style?: CSSProperties;
|
|
815
|
+
}>;
|
|
816
|
+
export declare const LoginCallbackPrimitive: ({ className, components, state, style }: LoginCallbackPrimitiveProps) => import("react").JSX.Element;
|
|
817
|
+
export type LoginCallbackProps = Omit<LoginCallbackPrimitiveProps, "state"> & Readonly<{
|
|
818
|
+
callbackUrl?: string;
|
|
819
|
+
onComplete?: (returnTo: string) => void;
|
|
820
|
+
onError?: (error: FederatedAuthError) => void;
|
|
821
|
+
}>;
|
|
822
|
+
export declare const LoginCallback: ({ callbackUrl, onComplete, onError, ...primitiveProps }: LoginCallbackProps) => import("react").JSX.Element;
|
|
823
|
+
export type SessionGateProps = Readonly<{
|
|
824
|
+
children: ReactNode;
|
|
825
|
+
fallback?: ReactNode;
|
|
826
|
+
}>;
|
|
827
|
+
/** Current federated session state from the nearest login provider. */
|
|
828
|
+
export declare const useSession: () => FederatedAuthState;
|
|
829
|
+
/** Renders children only when the BFF sealed-cookie session is authenticated. */
|
|
830
|
+
export declare const SessionGate: ({ children, fallback }: SessionGateProps) => ReactNode;
|
|
831
|
+
export type ResourceValue = string | number | boolean | null | readonly ResourceValue[] | ResourceObject;
|
|
832
|
+
export interface ResourceObject {
|
|
833
|
+
readonly [key: string]: ResourceValue;
|
|
834
|
+
}
|
|
835
|
+
/** Display-ready controls. Schema inference and registry selection belong to the consumer. */
|
|
836
|
+
export type ResourceField = Readonly<{
|
|
837
|
+
name: string;
|
|
838
|
+
label: string;
|
|
839
|
+
control: "text" | "email" | "number" | "checkbox" | "date" | "datetime-local" | "select" | "custom";
|
|
840
|
+
required?: boolean;
|
|
841
|
+
readOnly?: boolean;
|
|
842
|
+
nullable?: boolean;
|
|
843
|
+
options?: readonly Readonly<{
|
|
844
|
+
label: string;
|
|
845
|
+
value: string | number | boolean;
|
|
846
|
+
}>[];
|
|
847
|
+
}>;
|
|
848
|
+
export type ResourceFieldControlProps = Readonly<{
|
|
849
|
+
field: ResourceField;
|
|
850
|
+
id: string;
|
|
851
|
+
value: ResourceValue | undefined;
|
|
852
|
+
disabled: boolean;
|
|
853
|
+
errorId?: string | undefined;
|
|
854
|
+
onChange: (value: ResourceValue) => void;
|
|
855
|
+
}>;
|
|
856
|
+
export type EntityFieldKey<Value> = Extract<keyof Value, string>;
|
|
857
|
+
export type EntityFieldConfig = Readonly<{
|
|
858
|
+
control?: ResourceField["control"] | string;
|
|
859
|
+
label: string;
|
|
860
|
+
readOnly?: boolean;
|
|
861
|
+
renderer?: string;
|
|
862
|
+
}>;
|
|
863
|
+
export type EntityViewVariant<Value> = Readonly<{
|
|
864
|
+
columns: readonly EntityFieldKey<Value>[];
|
|
865
|
+
}>;
|
|
866
|
+
export type EntityConfiguration<Value> = Readonly<{
|
|
867
|
+
fields: Readonly<Partial<Record<EntityFieldKey<Value>, EntityFieldConfig>>>;
|
|
868
|
+
forms: Readonly<{
|
|
869
|
+
create: Readonly<{
|
|
870
|
+
fields: readonly EntityFieldKey<Value>[];
|
|
871
|
+
}>;
|
|
872
|
+
update: Readonly<{
|
|
873
|
+
fields: readonly EntityFieldKey<Value>[];
|
|
874
|
+
}>;
|
|
875
|
+
}>;
|
|
876
|
+
list: Readonly<{
|
|
877
|
+
description?: EntityFieldKey<Value>;
|
|
878
|
+
title: EntityFieldKey<Value>;
|
|
879
|
+
}>;
|
|
880
|
+
table: Readonly<{
|
|
881
|
+
columns: readonly EntityFieldKey<Value>[];
|
|
882
|
+
variants?: Readonly<Record<string, EntityViewVariant<Value>>>;
|
|
883
|
+
}>;
|
|
884
|
+
}>;
|
|
885
|
+
export type EntityDeclaration<Value, Create, Patch> = Readonly<{
|
|
886
|
+
config: EntityConfiguration<Value>;
|
|
887
|
+
contract: ResourceDefinition<Value, Create, Patch>;
|
|
888
|
+
}>;
|
|
889
|
+
export type EntityControlRegistry = Readonly<Record<string, (props: ResourceFieldControlProps) => ReactNode>>;
|
|
890
|
+
export type EntityRendererRegistry<Value> = Readonly<Record<string, (input: Readonly<{
|
|
891
|
+
field: string;
|
|
892
|
+
record: ResourceRecord<Value>;
|
|
893
|
+
}>) => ReactNode>>;
|
|
894
|
+
export declare const defineEntity: <Value extends {
|
|
895
|
+
readonly [Key in keyof Value]: ResourceJsonValue;
|
|
896
|
+
}, Create, Patch>(declaration: EntityDeclaration<Value, Create, Patch>) => EntityDeclaration<Value, Create, Patch>;
|
|
897
|
+
type JsonObject$1<Value = Readonly<Record<string, ResourceJsonValue>>> = {
|
|
898
|
+
readonly [Key in keyof Value]: ResourceJsonValue;
|
|
899
|
+
};
|
|
900
|
+
export type ViewStateProps = Readonly<{
|
|
901
|
+
namespace: string;
|
|
902
|
+
viewState?: "url";
|
|
903
|
+
}> | Readonly<{
|
|
904
|
+
namespace?: never;
|
|
905
|
+
viewState: "memory";
|
|
906
|
+
}>;
|
|
907
|
+
export type SharedViewProps<Value, Create, Patch> = Readonly<{
|
|
908
|
+
entity: EntityDeclaration<Value, Create, Patch>;
|
|
909
|
+
empty?: ReactNode;
|
|
910
|
+
pageSize?: number;
|
|
911
|
+
renderers?: EntityRendererRegistry<Value>;
|
|
912
|
+
variant?: string;
|
|
913
|
+
}>;
|
|
914
|
+
export type EntityTableProps<Value extends JsonObject$1<Value>, Create, Patch> = SharedViewProps<Value, Create, Patch> & ViewStateProps;
|
|
915
|
+
export type EntityListProps<Value extends JsonObject$1<Value>, Create, Patch> = SharedViewProps<Value, Create, Patch> & ViewStateProps;
|
|
916
|
+
export declare const EntityTable: <Value extends JsonObject$1<Value>, Create, Patch>(props: EntityTableProps<Value, Create, Patch>) => import("react").JSX.Element;
|
|
917
|
+
export declare const EntityList: <Value extends JsonObject$1<Value>, Create, Patch>(props: EntityListProps<Value, Create, Patch>) => import("react").JSX.Element;
|
|
918
|
+
export type SharedEntityFormProps<Value extends JsonObject$1<Value>, Create, Patch> = Readonly<{
|
|
919
|
+
controls?: EntityControlRegistry;
|
|
920
|
+
entity: EntityDeclaration<Value, Create, Patch>;
|
|
921
|
+
initialValues?: Readonly<Record<string, ResourceValue>>;
|
|
922
|
+
onCancel?: () => void;
|
|
923
|
+
onSuccess?: (record: ResourceRecord<Value>) => void;
|
|
924
|
+
}>;
|
|
925
|
+
export type EntityFormProps<Value extends JsonObject$1<Value>, Create, Patch> = (SharedEntityFormProps<Value, Create, Patch> & Readonly<{
|
|
926
|
+
mode: "create";
|
|
927
|
+
}>) | (SharedEntityFormProps<Value, Create, Patch> & Readonly<{
|
|
928
|
+
mode: "update";
|
|
929
|
+
record: ResourceRecord<Value>;
|
|
930
|
+
}>);
|
|
931
|
+
export declare const EntityForm: <Value extends JsonObject$1<Value>, Create, Patch>(props: EntityFormProps<Value, Create, Patch>) => import("react").JSX.Element;
|
|
932
|
+
export type EntityViewOptions = Readonly<{
|
|
933
|
+
contract?: ResourceDefinition<unknown, unknown, unknown>;
|
|
934
|
+
pageSize?: number;
|
|
935
|
+
}>;
|
|
936
|
+
export type EntityViewState = Readonly<{
|
|
937
|
+
filter: ResourceFilter | null;
|
|
938
|
+
page: number;
|
|
939
|
+
pageSize: number;
|
|
940
|
+
sort: readonly ResourceSort[];
|
|
941
|
+
textSearch: string;
|
|
942
|
+
}>;
|
|
943
|
+
export type EntityViewStateController = Readonly<{
|
|
944
|
+
query: EntityListQuery;
|
|
945
|
+
state: EntityViewState;
|
|
946
|
+
setFilter: (filter: ResourceFilter | null) => void;
|
|
947
|
+
setPage: (page: number) => void;
|
|
948
|
+
setPageSize: (pageSize: number) => void;
|
|
949
|
+
setSort: (sort: readonly ResourceSort[]) => void;
|
|
950
|
+
setTextSearch: (textSearch: string) => void;
|
|
951
|
+
}>;
|
|
952
|
+
export declare const useEntityViewState: (namespace: string, input?: EntityViewOptions) => EntityViewStateController;
|
|
953
|
+
export declare const useMemoryEntityViewState: (input?: Readonly<{
|
|
954
|
+
pageSize?: number;
|
|
955
|
+
}>) => EntityViewStateController;
|
|
956
|
+
export declare const clientSdkReactEntrypoint: "react";
|
|
957
|
+
|
|
958
|
+
export {};
|