@collective-intelligence/external-apps-server-sdk 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import { CiError, CiTransportError, FederatedAuthError, FederatedAuthErrorCode } from '@collective-intelligence/external-apps-client-sdk/effect';
4
- import { EntityUploadInput, EntityUploadSlot, ResourceJsonValue } from '@collective-intelligence/external-apps-client-sdk/resources';
4
+ import { EntityListQuery, EntityPage, EntityUploadInput, EntityUploadSlot, ResourceJsonValue } from '@collective-intelligence/external-apps-client-sdk/resources';
5
5
  import * as Brand from 'effect/Brand';
6
6
  import * as Context from 'effect/Context';
7
7
  import * as Effect from 'effect/Effect';
@@ -10,6 +10,764 @@ import * as Option$1 from 'effect/Option';
10
10
  import * as Redacted from 'effect/Redacted';
11
11
  import * as Schema from 'effect/Schema';
12
12
 
13
+ export type AuthToken = string | undefined;
14
+ export interface Auth {
15
+ /**
16
+ * Which part of the request do we use to send the auth?
17
+ *
18
+ * @default 'header'
19
+ */
20
+ in?: "header" | "query" | "cookie";
21
+ /**
22
+ * Header or query parameter name.
23
+ *
24
+ * @default 'Authorization'
25
+ */
26
+ name?: string;
27
+ scheme?: "basic" | "bearer";
28
+ type: "apiKey" | "http";
29
+ }
30
+ export interface SerializerOptions<T> {
31
+ /**
32
+ * @default true
33
+ */
34
+ explode: boolean;
35
+ style: T;
36
+ }
37
+ export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
38
+ export type ObjectStyle = "form" | "deepObject";
39
+ export type QuerySerializer = (query: Record<string, unknown>) => string;
40
+ export type BodySerializer = (body: unknown) => unknown;
41
+ export type QuerySerializerOptionsObject = {
42
+ allowReserved?: boolean;
43
+ array?: Partial<SerializerOptions<ArrayStyle>>;
44
+ object?: Partial<SerializerOptions<ObjectStyle>>;
45
+ };
46
+ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
47
+ /**
48
+ * Per-parameter serialization overrides. When provided, these settings
49
+ * override the global array/object settings for specific parameter names.
50
+ */
51
+ parameters?: Record<string, QuerySerializerOptionsObject>;
52
+ };
53
+ export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
54
+ export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
55
+ /**
56
+ * Returns the final request URL.
57
+ */
58
+ buildUrl: BuildUrlFn;
59
+ getConfig: () => Config;
60
+ request: RequestFn;
61
+ setConfig: (config: Config) => Config;
62
+ } & {
63
+ [K in HttpMethod]: MethodFn;
64
+ } & ([
65
+ SseFn
66
+ ] extends [
67
+ never
68
+ ] ? {
69
+ sse?: never;
70
+ } : {
71
+ sse: {
72
+ [K in HttpMethod]: SseFn;
73
+ };
74
+ });
75
+ export interface Config {
76
+ /**
77
+ * Auth token or a function returning auth token. The resolved value will be
78
+ * added to the request payload as defined by its `security` array.
79
+ */
80
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
81
+ /**
82
+ * A function for serializing request body parameter. By default,
83
+ * {@link JSON.stringify()} will be used.
84
+ */
85
+ bodySerializer?: BodySerializer | null;
86
+ /**
87
+ * An object containing any HTTP headers that you want to pre-populate your
88
+ * `Headers` object with.
89
+ *
90
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
91
+ */
92
+ headers?: RequestInit["headers"] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
93
+ /**
94
+ * The request method.
95
+ *
96
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
97
+ */
98
+ method?: Uppercase<HttpMethod>;
99
+ /**
100
+ * A function for serializing request query parameters. By default, arrays
101
+ * will be exploded in form style, objects will be exploded in deepObject
102
+ * style, and reserved characters are percent-encoded.
103
+ *
104
+ * This method will have no effect if the native `paramsSerializer()` Axios
105
+ * API function is used.
106
+ *
107
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
108
+ */
109
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
110
+ /**
111
+ * A function validating request data. This is useful if you want to ensure
112
+ * the request conforms to the desired shape, so it can be safely sent to
113
+ * the server.
114
+ */
115
+ requestValidator?: (data: unknown) => Promise<unknown>;
116
+ /**
117
+ * A function transforming response data before it's returned. This is useful
118
+ * for post-processing data, e.g., converting ISO strings into Date objects.
119
+ */
120
+ responseTransformer?: (data: unknown) => Promise<unknown>;
121
+ /**
122
+ * A function validating response data. This is useful if you want to ensure
123
+ * the response conforms to the desired shape, so it can be safely passed to
124
+ * the transformers and returned to the user.
125
+ */
126
+ responseValidator?: (data: unknown) => Promise<unknown>;
127
+ }
128
+ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "body" | "method"> & Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
129
+ /**
130
+ * Fetch API implementation. You can use this option to provide a custom
131
+ * fetch instance.
132
+ *
133
+ * @default globalThis.fetch
134
+ */
135
+ body?: RequestInit["body"] | undefined;
136
+ fetch?: typeof fetch;
137
+ /**
138
+ * Implementing clients can call request interceptors inside this hook.
139
+ */
140
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
141
+ /**
142
+ * Callback invoked when a network or parsing error occurs during streaming.
143
+ *
144
+ * This option applies only if the endpoint returns a stream of events.
145
+ *
146
+ * @param error The error that occurred.
147
+ */
148
+ onSseError?: (error: unknown) => void;
149
+ /**
150
+ * Callback invoked when an event is streamed from the server.
151
+ *
152
+ * This option applies only if the endpoint returns a stream of events.
153
+ *
154
+ * @param event Event streamed from the server.
155
+ * @returns Nothing (void).
156
+ */
157
+ onSseEvent?: (event: StreamEvent<TData>) => void;
158
+ serializedBody?: RequestInit["body"] | undefined;
159
+ /**
160
+ * Default retry delay in milliseconds.
161
+ *
162
+ * This option applies only if the endpoint returns a stream of events.
163
+ *
164
+ * @default 3000
165
+ */
166
+ sseDefaultRetryDelay?: number;
167
+ /**
168
+ * Maximum number of retry attempts before giving up.
169
+ */
170
+ sseMaxRetryAttempts?: number;
171
+ /**
172
+ * Maximum retry delay in milliseconds.
173
+ *
174
+ * Applies only when exponential backoff is used.
175
+ *
176
+ * This option applies only if the endpoint returns a stream of events.
177
+ *
178
+ * @default 30000
179
+ */
180
+ sseMaxRetryDelay?: number;
181
+ /**
182
+ * Optional sleep function for retry backoff.
183
+ *
184
+ * Defaults to using `setTimeout`.
185
+ */
186
+ sseSleepFn?: (ms: number) => Promise<void>;
187
+ url: string;
188
+ };
189
+ export interface StreamEvent<TData = unknown> {
190
+ data: TData;
191
+ event?: string | undefined;
192
+ id?: string | undefined;
193
+ retry?: number;
194
+ }
195
+ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
196
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
197
+ };
198
+ export type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
199
+ export type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
200
+ export type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
201
+ declare class Interceptors<Interceptor> {
202
+ fns: Array<Interceptor | null>;
203
+ clear(): void;
204
+ eject(id: number | Interceptor): void;
205
+ exists(id: number | Interceptor): boolean;
206
+ getInterceptorIndex(id: number | Interceptor): number;
207
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
208
+ use(fn: Interceptor): number;
209
+ }
210
+ export interface Middleware<Req, Res, Err, Options> {
211
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
212
+ request: Interceptors<ReqInterceptor<Req, Options>>;
213
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
214
+ }
215
+ export type ResponseStyle = "data" | "fields";
216
+ interface Config$1<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, Config {
217
+ /**
218
+ * Base URL for all requests made by this client.
219
+ */
220
+ baseUrl?: T["baseUrl"];
221
+ /**
222
+ * Fetch API implementation. You can use this option to provide a custom
223
+ * fetch instance.
224
+ *
225
+ * @default globalThis.fetch
226
+ */
227
+ fetch?: typeof fetch;
228
+ /**
229
+ * Please don't use the Fetch client for Next.js applications. The `next`
230
+ * options won't have any effect.
231
+ *
232
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
233
+ */
234
+ next?: never;
235
+ /**
236
+ * Return the response data parsed in a specified format. By default, `auto`
237
+ * will infer the appropriate method from the `Content-Type` response header.
238
+ * You can override this behavior with any of the {@link Body} methods.
239
+ * Select `stream` if you don't want to parse response data at all.
240
+ *
241
+ * @default 'auto'
242
+ */
243
+ parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text";
244
+ /**
245
+ * Should we return only data or multiple fields (data, error, response, etc.)?
246
+ *
247
+ * @default 'fields'
248
+ */
249
+ responseStyle?: ResponseStyle;
250
+ /**
251
+ * Throw an error instead of returning it in the response?
252
+ *
253
+ * @default false
254
+ */
255
+ throwOnError?: T["throwOnError"];
256
+ }
257
+ export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$1<{
258
+ responseStyle: TResponseStyle;
259
+ throwOnError: ThrowOnError;
260
+ }>, Pick<ServerSentEventsOptions<TData>, "onRequest" | "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
261
+ /**
262
+ * Any body that you want to add to your request.
263
+ *
264
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
265
+ */
266
+ body?: unknown;
267
+ path?: Record<string, unknown>;
268
+ query?: Record<string, unknown>;
269
+ /**
270
+ * Security mechanism(s) to use for the request.
271
+ */
272
+ security?: ReadonlyArray<Auth>;
273
+ url: Url;
274
+ }
275
+ export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
276
+ headers: Headers;
277
+ serializedBody?: string | undefined;
278
+ }
279
+ export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = ThrowOnError extends true ? Promise<TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
280
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
281
+ request: Request;
282
+ response: Response;
283
+ }> : Promise<TResponseStyle extends "data" ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
284
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
285
+ error: undefined;
286
+ } | {
287
+ data: undefined;
288
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
289
+ }) & {
290
+ request: Request;
291
+ response: Response;
292
+ }>;
293
+ export interface ClientOptions {
294
+ baseUrl?: string;
295
+ responseStyle?: ResponseStyle;
296
+ throwOnError?: boolean;
297
+ }
298
+ export type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
299
+ export type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData, TError>>;
300
+ export type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
301
+ export type BuildUrlFn = <TData extends {
302
+ body?: unknown;
303
+ path?: Record<string, unknown>;
304
+ query?: Record<string, unknown>;
305
+ url: string;
306
+ }>(options: TData & Options<TData>) => string;
307
+ type Client$1 = Client<RequestFn, Config$1, MethodFn, BuildUrlFn, SseFn> & {
308
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
309
+ };
310
+ export interface TEndpointData {
311
+ body?: unknown;
312
+ headers?: unknown;
313
+ path?: unknown;
314
+ query?: unknown;
315
+ url: string;
316
+ }
317
+ export type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
318
+ export type Options<TData extends TEndpointData = TEndpointData, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = "fields"> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> & ([
319
+ TData
320
+ ] extends [
321
+ never
322
+ ] ? unknown : Omit<TData, "url">);
323
+ export type AccessExplanation = {
324
+ cut: {
325
+ credential: {
326
+ apiKeyId: string;
327
+ kind: "api_key";
328
+ } | {
329
+ applicationId: string;
330
+ kind: "application_token";
331
+ };
332
+ maxPrivileges: Array<{
333
+ code: string;
334
+ mode: "manage" | "on" | "read";
335
+ }>;
336
+ tuples: Array<{
337
+ capabilities: Array<{
338
+ code: string;
339
+ held: "manage" | "on" | "read";
340
+ kept: "manage" | "on" | "read" | null;
341
+ }>;
342
+ holder: {
343
+ grantId: string;
344
+ kind: "grant";
345
+ };
346
+ }>;
347
+ } | null;
348
+ grants: Array<{
349
+ grantId: string;
350
+ label: string;
351
+ profile: {
352
+ id: string;
353
+ label: string;
354
+ };
355
+ values: Array<{
356
+ axis: {
357
+ id: string;
358
+ label: string;
359
+ };
360
+ value: {
361
+ id: string;
362
+ label: string | null;
363
+ };
364
+ }>;
365
+ origin: "declared" | "manual" | "import" | "api" | "app_server" | "invitation" | "tenant" | null;
366
+ via: {
367
+ kind: "direct";
368
+ } | {
369
+ group: {
370
+ id: string;
371
+ label: string | null;
372
+ };
373
+ kind: "group";
374
+ } | {
375
+ group: {
376
+ id: string;
377
+ label: string | null;
378
+ };
379
+ kind: "inherited_group";
380
+ };
381
+ }>;
382
+ principal: {
383
+ kind: "service_principal" | "user";
384
+ tenantRole: "tenant_admin" | "tenant_operator" | null;
385
+ userId: string;
386
+ } | {
387
+ applicationId: string;
388
+ kind: "application_server" | "application_visitors";
389
+ };
390
+ target: {
391
+ allowed: boolean;
392
+ code: string;
393
+ holders: Array<{
394
+ grantId: string;
395
+ kind: "grant";
396
+ }>;
397
+ kind: "capability";
398
+ known: boolean;
399
+ mode: "manage" | "on" | "read";
400
+ } | {
401
+ admitted: boolean;
402
+ fields: {
403
+ hidden: Array<string>;
404
+ otherFields: "hidden" | "shown";
405
+ shown: Array<string>;
406
+ } | null;
407
+ kind: "record";
408
+ operation: "read" | "write";
409
+ policies: Array<{
410
+ capability: {
411
+ code: string;
412
+ mode: "manage" | "on" | "read";
413
+ };
414
+ fields: Array<string> | {
415
+ except: Array<string>;
416
+ } | null;
417
+ id: string;
418
+ kind: "package" | "core_tenant" | "core_admin" | "core_default";
419
+ purpose: "access" | "administration";
420
+ result: {
421
+ admitted: true;
422
+ grantIds: Array<string>;
423
+ } | {
424
+ admitted: false;
425
+ reason: "axes_not_bound" | "capability_not_held" | "record_not_matched";
426
+ };
427
+ }>;
428
+ recordId: string;
429
+ schemaId: string;
430
+ };
431
+ };
432
+ export type AccessExplainRequest = {
433
+ credential?: {
434
+ apiKeyId: string;
435
+ kind: "api_key";
436
+ } | {
437
+ applicationId: string;
438
+ kind: "application_token";
439
+ };
440
+ principal: {
441
+ kind: "user";
442
+ userId: string;
443
+ } | {
444
+ applicationId: string;
445
+ kind: "application_server" | "application_visitors";
446
+ };
447
+ target: {
448
+ code: string;
449
+ kind: "capability";
450
+ mode: "manage" | "on" | "read";
451
+ } | {
452
+ kind: "record";
453
+ operation: "read" | "write";
454
+ recordId: string;
455
+ };
456
+ };
457
+ export type AccessGrantAxis = {
458
+ entitySchemaId: string;
459
+ hierarchyFieldId: string | null;
460
+ id: string;
461
+ label: string;
462
+ packageInstallationId: string | null;
463
+ slug: string;
464
+ };
465
+ export type AccessCapabilityNode = {
466
+ area: "dashboard" | "studio" | "mcp" | "admin" | "platform" | "data" | "tenant" | "app" | "package";
467
+ code: string;
468
+ grantableBy: "admins" | "holders";
469
+ id: string;
470
+ key: string;
471
+ kind: "switch" | "read_manage";
472
+ parentId: string | null;
473
+ source: "core" | "application" | "package";
474
+ status: "active" | "retired";
475
+ };
476
+ export type AccessProfile = {
477
+ audience: "user" | "server" | "anonymous" | "max_privileges";
478
+ axisIds: Array<string>;
479
+ canGrant: "all" | Array<string>;
480
+ capabilities: Array<AccessProfileCapability>;
481
+ description: string | null;
482
+ displayName: string;
483
+ fqn: string | null;
484
+ id: string;
485
+ readonly: boolean;
486
+ source: "builtin" | "package" | "custom";
487
+ version: number;
488
+ };
489
+ export type AccessProfileCapability = {
490
+ code: string;
491
+ mode: "manage" | "on" | "read";
492
+ };
493
+ export type AccessMemberCreated = {
494
+ accountCreated: boolean;
495
+ grants: Array<AccessGrant>;
496
+ mode: "direct";
497
+ userId: string;
498
+ } | {
499
+ email: string;
500
+ invitationId: string;
501
+ mode: "invitation";
502
+ };
503
+ export type AccessGrant = {
504
+ active: boolean;
505
+ axes: Array<{
506
+ axisId: string;
507
+ entityId: string;
508
+ }>;
509
+ fqn: string | null;
510
+ id: string;
511
+ origin: "declared" | "manual" | "import" | "api" | "app_server" | "invitation" | "tenant";
512
+ profileId: string;
513
+ recipient: AccessGrantRecipient;
514
+ };
515
+ export type AccessGrantRecipient = {
516
+ kind: "user";
517
+ userId: string;
518
+ } | {
519
+ coverage: "direct" | "inherited";
520
+ groupId: string;
521
+ kind: "group";
522
+ } | {
523
+ applicationId: string;
524
+ kind: "application_server" | "application_visitors";
525
+ };
526
+ export type AccessMemberCreateRequest = {
527
+ email: string;
528
+ grants: Array<{
529
+ axes?: {
530
+ [key: string]: {
531
+ knowledgeEntity: {
532
+ field: string;
533
+ value: string;
534
+ };
535
+ } | string;
536
+ };
537
+ profile: string | {
538
+ id: string;
539
+ };
540
+ }>;
541
+ kind: "member" | "guest";
542
+ mode: "direct" | "invitation";
543
+ name?: string;
544
+ };
545
+ export type AccessGrantSyncResult = {
546
+ created: Array<string>;
547
+ deleted: Array<string>;
548
+ unchanged: Array<string>;
549
+ updated: Array<string>;
550
+ };
551
+ export type AccessSnapshot = {
552
+ accessVersion: number;
553
+ capabilities: Array<{
554
+ area: "admin" | "app" | "dashboard" | "data" | "mcp" | "package" | "platform" | "studio" | "tenant";
555
+ code: string;
556
+ mode: "manage" | "on" | "read";
557
+ path: Array<string>;
558
+ }>;
559
+ grants: Array<{
560
+ grantId: string;
561
+ label: string;
562
+ profile: {
563
+ id: string;
564
+ label: string;
565
+ };
566
+ values: Array<{
567
+ axis: {
568
+ id: string;
569
+ label: string;
570
+ };
571
+ value: {
572
+ id: string;
573
+ label: string | null;
574
+ };
575
+ }>;
576
+ }>;
577
+ schemas: Array<{
578
+ read: "all" | "none" | "some";
579
+ schemaId: string;
580
+ write: "all" | "none" | "some";
581
+ }>;
582
+ versionToken: string;
583
+ };
584
+ export type AccessGroup = {
585
+ description: string | null;
586
+ fqn: string | null;
587
+ id: string;
588
+ name: string;
589
+ package: {
590
+ fqn: string;
591
+ managed: boolean;
592
+ readonly: boolean;
593
+ } | null;
594
+ parentGroupId: string | null;
595
+ slug: string | null;
596
+ };
597
+ export type AccessGroupUpdateRequest = {
598
+ description?: string | null;
599
+ name?: string;
600
+ parentGroupId?: string | null;
601
+ slug?: string | null;
602
+ };
603
+ export type AccessGroupPage = {
604
+ items: Array<AccessGroup>;
605
+ next: number | null;
606
+ };
607
+ export type AccessGroupCreateRequest = {
608
+ description?: string | null;
609
+ name: string;
610
+ parentGroupId?: string | null;
611
+ slug?: string | null;
612
+ };
613
+ export type AccessSchemaKnowledgePolicies = {
614
+ read: Array<AccessKnowledgeDataPolicy>;
615
+ schemaId: string;
616
+ write: Array<AccessKnowledgeDataPolicy>;
617
+ };
618
+ export type AccessKnowledgeDataPolicy = {
619
+ axes: Array<{
620
+ axis: string;
621
+ byCondition: true;
622
+ } | {
623
+ axis: string;
624
+ map: {
625
+ field: string;
626
+ } | {
627
+ relation: {
628
+ field: string;
629
+ key: string;
630
+ };
631
+ } | {
632
+ self: true;
633
+ };
634
+ } | {
635
+ axis: string;
636
+ unscoped: true;
637
+ }>;
638
+ capability: AccessProfileCapability;
639
+ fqn: string | null;
640
+ id: string;
641
+ includesHostOwned: boolean;
642
+ kind: "package" | "core_tenant" | "core_admin" | "core_default";
643
+ operation: "read" | "write";
644
+ otherAxesUnscoped: boolean;
645
+ purpose: "access" | "administration";
646
+ readableFields: Array<string> | {
647
+ except: Array<string>;
648
+ } | null;
649
+ schemaId: string | null;
650
+ where: unknown | null;
651
+ writableFields: Array<string> | {
652
+ except: Array<string>;
653
+ } | null;
654
+ };
655
+ export type AccessGrantUpdateRequest = {
656
+ axes?: {
657
+ [key: string]: {
658
+ knowledgeEntity: {
659
+ field: string;
660
+ value: string;
661
+ };
662
+ } | string;
663
+ };
664
+ grantee: {
665
+ user: {
666
+ email: string;
667
+ };
668
+ } | {
669
+ coverage: "direct" | "inherited";
670
+ group: {
671
+ fqn: string;
672
+ };
673
+ } | {
674
+ servicePrincipal: string;
675
+ } | {
676
+ applicationServer: string;
677
+ } | {
678
+ applicationVisitors: string;
679
+ };
680
+ profile: string | {
681
+ id: string;
682
+ };
683
+ };
684
+ export type AccessGrantList = Array<AccessGrant>;
685
+ export type AccessGrantSyncRequest = {
686
+ grants: Array<{
687
+ axes?: {
688
+ [key: string]: {
689
+ knowledgeEntity: {
690
+ field: string;
691
+ value: string;
692
+ };
693
+ } | string;
694
+ };
695
+ grantee: {
696
+ user: {
697
+ email: string;
698
+ };
699
+ } | {
700
+ coverage: "direct" | "inherited";
701
+ group: {
702
+ fqn: string;
703
+ };
704
+ } | {
705
+ servicePrincipal: string;
706
+ } | {
707
+ applicationServer: string;
708
+ } | {
709
+ applicationVisitors: string;
710
+ };
711
+ profile: string | {
712
+ id: string;
713
+ };
714
+ fqn: string;
715
+ }>;
716
+ namespace: string;
717
+ };
718
+ export type AccessGrantCreateRequest = {
719
+ axes?: {
720
+ [key: string]: {
721
+ knowledgeEntity: {
722
+ field: string;
723
+ value: string;
724
+ };
725
+ } | string;
726
+ };
727
+ grantee: {
728
+ user: {
729
+ email: string;
730
+ };
731
+ } | {
732
+ coverage: "direct" | "inherited";
733
+ group: {
734
+ fqn: string;
735
+ };
736
+ } | {
737
+ servicePrincipal: string;
738
+ } | {
739
+ applicationServer: string;
740
+ } | {
741
+ applicationVisitors: string;
742
+ };
743
+ profile: string | {
744
+ id: string;
745
+ };
746
+ fqn: string;
747
+ };
748
+ export type AccessInvitationPage = {
749
+ items: Array<AccessInvitation>;
750
+ next: number | null;
751
+ };
752
+ export type AccessInvitation = {
753
+ createdAt: string | null;
754
+ email: string;
755
+ id: string;
756
+ invitedByUserId: string | null;
757
+ status: "pending" | "accepted" | "revoked";
758
+ };
759
+ export type AccessMember = {
760
+ email: string | null;
761
+ kind: "member" | "guest";
762
+ name: string | null;
763
+ originApplicationId: string | null;
764
+ suspended: boolean;
765
+ userId: string;
766
+ };
767
+ export type AccessMemberPage = {
768
+ items: Array<AccessMember>;
769
+ next: string | null;
770
+ };
13
771
  export type ExternalApplicationsGetContextErrors = {
14
772
  /**
15
773
  * Error
@@ -35,190 +793,553 @@ export type ExternalApplicationsGetContextErrors = {
35
793
  retryable: false;
36
794
  };
37
795
  };
38
- /**
39
- * Error
40
- */
41
- 403: {
42
- correlationId: string;
43
- error: {
44
- code: "authorization_denied";
45
- message: string;
46
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
47
- retryable: false;
48
- };
796
+ /**
797
+ * Error
798
+ */
799
+ 403: {
800
+ correlationId: string;
801
+ error: {
802
+ code: "authorization_denied";
803
+ message: string;
804
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
805
+ retryable: false;
806
+ };
807
+ };
808
+ /**
809
+ * Error
810
+ */
811
+ 404: {
812
+ correlationId: string;
813
+ error: {
814
+ code: "operation_not_allowed";
815
+ message: string;
816
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
817
+ retryable: false;
818
+ };
819
+ } | {
820
+ correlationId: string;
821
+ error: {
822
+ code: "not_found";
823
+ message: string;
824
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
825
+ retryable: false;
826
+ };
827
+ };
828
+ /**
829
+ * Error
830
+ */
831
+ 409: {
832
+ correlationId: string;
833
+ error: {
834
+ code: "conflict";
835
+ message: string;
836
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
837
+ retryable: false;
838
+ };
839
+ };
840
+ /**
841
+ * Error
842
+ */
843
+ 500: {
844
+ correlationId: string;
845
+ error: {
846
+ code: "internal_error";
847
+ message: string;
848
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
849
+ retryable: false;
850
+ };
851
+ };
852
+ /**
853
+ * Error
854
+ */
855
+ 503: {
856
+ correlationId: string;
857
+ error: {
858
+ code: "temporarily_unavailable";
859
+ message: string;
860
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
861
+ retryable: true;
862
+ };
863
+ };
864
+ };
865
+ export type ExternalApplicationsGetContextError = ExternalApplicationsGetContextErrors[keyof ExternalApplicationsGetContextErrors];
866
+ export type ApplicationAccessMembersListData = {
867
+ body?: never;
868
+ headers: {
869
+ authorization?: string;
870
+ "x-organization-id": string;
871
+ };
872
+ path?: never;
873
+ query?: {
874
+ after?: string;
875
+ email?: string;
876
+ limit?: string;
877
+ };
878
+ url: "/application/v1/access/members";
879
+ };
880
+ export type ApplicationAccessMembersCreateData = {
881
+ body: AccessMemberCreateRequest;
882
+ headers: {
883
+ authorization?: string;
884
+ "x-organization-id": string;
885
+ };
886
+ path?: never;
887
+ query?: never;
888
+ url: "/application/v1/access/members";
889
+ };
890
+ export type ApplicationAccessMembersDeleteData = {
891
+ body?: never;
892
+ headers: {
893
+ authorization?: string;
894
+ "x-organization-id": string;
895
+ };
896
+ path: {
897
+ userId: string;
898
+ };
899
+ query?: never;
900
+ url: "/application/v1/access/members/{userId}";
901
+ };
902
+ export type ApplicationAccessMembersGetData = {
903
+ body?: never;
904
+ headers: {
905
+ authorization?: string;
906
+ "x-organization-id": string;
907
+ };
908
+ path: {
909
+ userId: string;
910
+ };
911
+ query?: never;
912
+ url: "/application/v1/access/members/{userId}";
913
+ };
914
+ export type ApplicationAccessMembersSuspendData = {
915
+ body?: never;
916
+ headers: {
917
+ authorization?: string;
918
+ "x-organization-id": string;
919
+ };
920
+ path: {
921
+ userId: string;
922
+ };
923
+ query?: never;
924
+ url: "/application/v1/access/members/{userId}/suspend";
925
+ };
926
+ export type ApplicationAccessMembersResumeData = {
927
+ body?: never;
928
+ headers: {
929
+ authorization?: string;
930
+ "x-organization-id": string;
931
+ };
932
+ path: {
933
+ userId: string;
934
+ };
935
+ query?: never;
936
+ url: "/application/v1/access/members/{userId}/resume";
937
+ };
938
+ export type ApplicationAccessMembersListInvitationsData = {
939
+ body?: never;
940
+ headers: {
941
+ authorization?: string;
942
+ "x-organization-id": string;
943
+ };
944
+ path?: never;
945
+ query?: {
946
+ limit?: string;
947
+ page?: string;
948
+ status?: "pending" | "accepted" | "revoked";
949
+ };
950
+ url: "/application/v1/access/invitations";
951
+ };
952
+ export type ApplicationAccessMembersRevokeInvitationData = {
953
+ body?: never;
954
+ headers: {
955
+ authorization?: string;
956
+ "x-organization-id": string;
957
+ };
958
+ path: {
959
+ invitationId: string;
960
+ };
961
+ query?: never;
962
+ url: "/application/v1/access/invitations/{invitationId}";
963
+ };
964
+ export type ApplicationAccessGrantsListData = {
965
+ body?: never;
966
+ headers: {
967
+ authorization?: string;
968
+ "x-organization-id": string;
969
+ };
970
+ path?: never;
971
+ query?: {
972
+ groupId?: string;
973
+ namespace?: string;
974
+ userId?: string;
975
+ };
976
+ url: "/application/v1/access/grants";
977
+ };
978
+ export type ApplicationAccessGrantsCreateData = {
979
+ body: AccessGrantCreateRequest;
980
+ headers: {
981
+ authorization?: string;
982
+ "x-organization-id": string;
983
+ };
984
+ path?: never;
985
+ query?: never;
986
+ url: "/application/v1/access/grants";
987
+ };
988
+ export type ApplicationAccessGrantsSyncData = {
989
+ body: AccessGrantSyncRequest;
990
+ headers: {
991
+ authorization?: string;
992
+ "x-organization-id": string;
993
+ };
994
+ path?: never;
995
+ query?: never;
996
+ url: "/application/v1/access/grants/sync";
997
+ };
998
+ export type ApplicationAccessGrantsDeleteData = {
999
+ body?: never;
1000
+ headers: {
1001
+ authorization?: string;
1002
+ "x-organization-id": string;
1003
+ };
1004
+ path: {
1005
+ grantId: string;
1006
+ };
1007
+ query?: never;
1008
+ url: "/application/v1/access/grants/{grantId}";
1009
+ };
1010
+ export type ApplicationAccessGrantsGetData = {
1011
+ body?: never;
1012
+ headers: {
1013
+ authorization?: string;
1014
+ "x-organization-id": string;
1015
+ };
1016
+ path: {
1017
+ grantId: string;
1018
+ };
1019
+ query?: never;
1020
+ url: "/application/v1/access/grants/{grantId}";
1021
+ };
1022
+ export type ApplicationAccessGrantsUpdateData = {
1023
+ body: AccessGrantUpdateRequest;
1024
+ headers: {
1025
+ authorization?: string;
1026
+ "x-organization-id": string;
1027
+ };
1028
+ path: {
1029
+ grantId: string;
1030
+ };
1031
+ query?: never;
1032
+ url: "/application/v1/access/grants/{grantId}";
1033
+ };
1034
+ export type ApplicationAccessGrantsDeleteByFqnData = {
1035
+ body?: never;
1036
+ headers: {
1037
+ authorization?: string;
1038
+ "x-organization-id": string;
1039
+ };
1040
+ path: {
1041
+ fqn: string;
1042
+ };
1043
+ query?: never;
1044
+ url: "/application/v1/access/grants/fqn/{fqn}";
1045
+ };
1046
+ export type ApplicationAccessGrantsGetByFqnData = {
1047
+ body?: never;
1048
+ headers: {
1049
+ authorization?: string;
1050
+ "x-organization-id": string;
1051
+ };
1052
+ path: {
1053
+ fqn: string;
1054
+ };
1055
+ query?: never;
1056
+ url: "/application/v1/access/grants/fqn/{fqn}";
1057
+ };
1058
+ export type ApplicationAccessGrantsUpdateByFqnData = {
1059
+ body: AccessGrantUpdateRequest;
1060
+ headers: {
1061
+ authorization?: string;
1062
+ "x-organization-id": string;
1063
+ };
1064
+ path: {
1065
+ fqn: string;
1066
+ };
1067
+ query?: never;
1068
+ url: "/application/v1/access/grants/fqn/{fqn}";
1069
+ };
1070
+ export type ApplicationAccessDefinitionsListProfilesData = {
1071
+ body?: never;
1072
+ headers: {
1073
+ authorization?: string;
1074
+ "x-organization-id": string;
1075
+ };
1076
+ path?: never;
1077
+ query?: never;
1078
+ url: "/application/v1/access/profiles";
1079
+ };
1080
+ export type ApplicationAccessDefinitionsGetProfileData = {
1081
+ body?: never;
1082
+ headers: {
1083
+ authorization?: string;
1084
+ "x-organization-id": string;
1085
+ };
1086
+ path: {
1087
+ profileId: string;
1088
+ };
1089
+ query?: never;
1090
+ url: "/application/v1/access/profiles/{profileId}";
1091
+ };
1092
+ export type ApplicationAccessDefinitionsListCapabilitiesData = {
1093
+ body?: never;
1094
+ headers: {
1095
+ authorization?: string;
1096
+ "x-organization-id": string;
1097
+ };
1098
+ path?: never;
1099
+ query?: never;
1100
+ url: "/application/v1/access/catalog";
1101
+ };
1102
+ export type ApplicationAccessDefinitionsListAxesData = {
1103
+ body?: never;
1104
+ headers: {
1105
+ authorization?: string;
1106
+ "x-organization-id": string;
49
1107
  };
50
- /**
51
- * Error
52
- */
53
- 404: {
54
- correlationId: string;
55
- error: {
56
- code: "operation_not_allowed";
57
- message: string;
58
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
59
- retryable: false;
60
- };
61
- } | {
62
- correlationId: string;
63
- error: {
64
- code: "not_found";
65
- message: string;
66
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
67
- retryable: false;
68
- };
1108
+ path?: never;
1109
+ query?: never;
1110
+ url: "/application/v1/access/axes";
1111
+ };
1112
+ export type ApplicationAccessDefinitionsListMaxPrivilegesData = {
1113
+ body?: never;
1114
+ headers: {
1115
+ authorization?: string;
1116
+ "x-organization-id": string;
69
1117
  };
70
- /**
71
- * Error
72
- */
73
- 409: {
74
- correlationId: string;
75
- error: {
76
- code: "conflict";
77
- message: string;
78
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
79
- retryable: false;
80
- };
1118
+ path?: never;
1119
+ query?: never;
1120
+ url: "/application/v1/access/max-privileges";
1121
+ };
1122
+ export type ApplicationAccessDefinitionsGetMaxPrivilegesData = {
1123
+ body?: never;
1124
+ headers: {
1125
+ authorization?: string;
1126
+ "x-organization-id": string;
81
1127
  };
82
- /**
83
- * Error
84
- */
85
- 500: {
86
- correlationId: string;
87
- error: {
88
- code: "internal_error";
89
- message: string;
90
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
91
- retryable: false;
92
- };
1128
+ path: {
1129
+ profileId: string;
93
1130
  };
94
- /**
95
- * Error
96
- */
97
- 503: {
98
- correlationId: string;
99
- error: {
100
- code: "temporarily_unavailable";
101
- message: string;
102
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
103
- retryable: true;
104
- };
1131
+ query?: never;
1132
+ url: "/application/v1/access/max-privileges/{profileId}";
1133
+ };
1134
+ export type ApplicationAccessDefinitionsListKnowledgePoliciesData = {
1135
+ body?: never;
1136
+ headers: {
1137
+ authorization?: string;
1138
+ "x-organization-id": string;
105
1139
  };
1140
+ path?: never;
1141
+ query?: never;
1142
+ url: "/application/v1/access/knowledge-policies";
106
1143
  };
107
- export type ExternalApplicationsGetContextError = ExternalApplicationsGetContextErrors[keyof ExternalApplicationsGetContextErrors];
108
- export type ExternalApplicationsListAppUsersResponses = {
109
- /**
110
- * Success
111
- */
112
- 200: {
113
- correlationId: string;
114
- result: {
115
- items: Array<{
116
- email: string | null;
117
- name: string | null;
118
- userId: string;
119
- }>;
120
- };
1144
+ export type ApplicationAccessDefinitionsGetSchemaKnowledgePoliciesData = {
1145
+ body?: never;
1146
+ headers: {
1147
+ authorization?: string;
1148
+ "x-organization-id": string;
1149
+ };
1150
+ path: {
1151
+ schemaFqn: string;
121
1152
  };
1153
+ query?: never;
1154
+ url: "/application/v1/access/knowledge-policies/schemas/{schemaFqn}";
122
1155
  };
123
- export type ExternalApplicationsListAppUsersResponse = ExternalApplicationsListAppUsersResponses[keyof ExternalApplicationsListAppUsersResponses];
124
- export type ExternalApplicationsCreateOrGetAppUserData = {
125
- body: {
126
- email: string;
127
- name: string;
128
- roles: Array<string>;
1156
+ export type ApplicationAccessGroupsListData = {
1157
+ body?: never;
1158
+ headers: {
1159
+ authorization?: string;
1160
+ "x-organization-id": string;
1161
+ };
1162
+ path?: never;
1163
+ query?: {
1164
+ limit?: string;
1165
+ page?: string;
129
1166
  };
1167
+ url: "/application/v1/access/groups";
1168
+ };
1169
+ export type ApplicationAccessGroupsCreateData = {
1170
+ body: AccessGroupCreateRequest;
130
1171
  headers: {
131
1172
  authorization?: string;
132
1173
  "x-organization-id": string;
133
- "x-correlation-id"?: string;
134
- "x-external-audit-issuer"?: string;
135
- "x-external-audit-subject"?: string;
136
- "x-external-caller-kind"?: "anonymous_visitor";
137
- "x-external-ci-user-id"?: string;
138
- "x-external-server-role"?: string;
139
1174
  };
140
1175
  path?: never;
141
1176
  query?: never;
142
- url: "/application/v1/users";
1177
+ url: "/application/v1/access/groups";
143
1178
  };
144
- export type ExternalApplicationsCreateOrGetAppUserResponses = {
145
- /**
146
- * Success
147
- */
148
- 200: {
149
- correlationId: string;
150
- result: {
151
- email: string | null;
152
- name: string | null;
153
- userId: string;
154
- created: boolean;
155
- kind: "member" | "external_app_user";
156
- };
1179
+ export type ApplicationAccessGroupsDeleteData = {
1180
+ body?: never;
1181
+ headers: {
1182
+ authorization?: string;
1183
+ "x-organization-id": string;
1184
+ };
1185
+ path: {
1186
+ groupId: string;
1187
+ };
1188
+ query?: never;
1189
+ url: "/application/v1/access/groups/{groupId}";
1190
+ };
1191
+ export type ApplicationAccessGroupsGetData = {
1192
+ body?: never;
1193
+ headers: {
1194
+ authorization?: string;
1195
+ "x-organization-id": string;
1196
+ };
1197
+ path: {
1198
+ groupId: string;
1199
+ };
1200
+ query?: never;
1201
+ url: "/application/v1/access/groups/{groupId}";
1202
+ };
1203
+ export type ApplicationAccessGroupsUpdateData = {
1204
+ body: AccessGroupUpdateRequest;
1205
+ headers: {
1206
+ authorization?: string;
1207
+ "x-organization-id": string;
1208
+ };
1209
+ path: {
1210
+ groupId: string;
157
1211
  };
1212
+ query?: never;
1213
+ url: "/application/v1/access/groups/{groupId}";
158
1214
  };
159
- export type ExternalApplicationsCreateOrGetAppUserResponse = ExternalApplicationsCreateOrGetAppUserResponses[keyof ExternalApplicationsCreateOrGetAppUserResponses];
160
- export type ExternalApplicationsCheckAppUserEmailData = {
1215
+ export type ApplicationAccessGroupsAddMemberData = {
161
1216
  body: {
162
- email: string;
1217
+ userId: string;
163
1218
  };
164
1219
  headers: {
165
1220
  authorization?: string;
166
1221
  "x-organization-id": string;
167
- "x-correlation-id"?: string;
168
- "x-external-audit-issuer"?: string;
169
- "x-external-audit-subject"?: string;
170
- "x-external-caller-kind"?: "anonymous_visitor";
171
- "x-external-ci-user-id"?: string;
172
- "x-external-server-role"?: string;
173
1222
  };
174
- path?: never;
1223
+ path: {
1224
+ groupId: string;
1225
+ };
175
1226
  query?: never;
176
- url: "/application/v1/users/check-email";
1227
+ url: "/application/v1/access/groups/{groupId}/members";
177
1228
  };
178
- export type ExternalApplicationsCheckAppUserEmailResponses = {
179
- /**
180
- * Success
181
- */
182
- 200: {
183
- correlationId: string;
184
- result: {
185
- usable: true;
186
- } | {
187
- reason: "user_unavailable" | "target_inactive";
188
- usable: false;
189
- };
1229
+ export type ApplicationAccessGroupsRemoveMemberData = {
1230
+ body?: never;
1231
+ headers: {
1232
+ authorization?: string;
1233
+ "x-organization-id": string;
190
1234
  };
1235
+ path: {
1236
+ groupId: string;
1237
+ userId: string;
1238
+ };
1239
+ query?: never;
1240
+ url: "/application/v1/access/groups/{groupId}/members/{userId}";
191
1241
  };
192
- export type ExternalApplicationsCheckAppUserEmailResponse = ExternalApplicationsCheckAppUserEmailResponses[keyof ExternalApplicationsCheckAppUserEmailResponses];
193
- export type ExternalApplicationsGetAppUserResponses = {
194
- /**
195
- * Success
196
- */
197
- 200: {
198
- correlationId: string;
199
- result: {
200
- email: string | null;
201
- name: string | null;
202
- userId: string;
203
- };
1242
+ export type ApplicationAccessPrincipalsSnapshotData = {
1243
+ body?: never;
1244
+ headers: {
1245
+ authorization?: string;
1246
+ "x-organization-id": string;
1247
+ };
1248
+ path: {
1249
+ userId: string;
204
1250
  };
1251
+ query?: never;
1252
+ url: "/application/v1/access/users/{userId}/snapshot";
1253
+ };
1254
+ export type ApplicationAccessPrincipalsExplainData = {
1255
+ body: AccessExplainRequest;
1256
+ headers: {
1257
+ authorization?: string;
1258
+ "x-organization-id": string;
1259
+ };
1260
+ path?: never;
1261
+ query?: never;
1262
+ url: "/application/v1/access/explain";
205
1263
  };
206
- export type ExternalApplicationsGetAppUserResponse = ExternalApplicationsGetAppUserResponses[keyof ExternalApplicationsGetAppUserResponses];
207
- export type ExternalApplicationsListAppRolesResponses = {
1264
+ type Options$1<TData extends TEndpointData = TEndpointData, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options<TData, ThrowOnError, TResponse> & {
208
1265
  /**
209
- * Success
1266
+ * You can provide a client instance returned by `createClient()` instead of
1267
+ * individual options. This might be also useful if you want to implement a
1268
+ * custom client.
210
1269
  */
211
- 200: {
212
- correlationId: string;
213
- result: {
214
- items: Array<{
215
- id: string;
216
- key: string;
217
- }>;
218
- };
1270
+ client?: Client$1;
1271
+ /**
1272
+ * You can pass arbitrary values through the `meta` object. This can be
1273
+ * used to access values that aren't defined as part of the SDK function.
1274
+ */
1275
+ meta?: Record<string, unknown>;
1276
+ };
1277
+ /** Every generated error body of the access API names its error by `_tag`. */
1278
+ export type AccessApiErrorBody = Readonly<{
1279
+ _tag: string;
1280
+ }>;
1281
+ declare class AccessApiError extends Error {
1282
+ readonly name = "AccessApiError";
1283
+ readonly body: AccessApiErrorBody;
1284
+ readonly status: number;
1285
+ constructor(status: number, body: AccessApiErrorBody);
1286
+ }
1287
+ export type EndpointOptions<OptionsType> = Pick<OptionsType, Extract<keyof OptionsType, "body" | "headers" | "path" | "query">>;
1288
+ declare const createApplicationAccessApi: (client: Client$1) => {
1289
+ axes: {
1290
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListAxesData, false, unknown>>) => Promise<AccessGrantAxis[]>;
1291
+ };
1292
+ catalog: {
1293
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListCapabilitiesData, false, unknown>>) => Promise<AccessCapabilityNode[]>;
1294
+ };
1295
+ explain: (options: EndpointOptions<Options$1<ApplicationAccessPrincipalsExplainData, false, unknown>>) => Promise<AccessExplanation>;
1296
+ grants: {
1297
+ create: (options: EndpointOptions<Options$1<ApplicationAccessGrantsCreateData, false, unknown>>) => Promise<AccessGrant>;
1298
+ delete: (options: EndpointOptions<Options$1<ApplicationAccessGrantsDeleteData, false, unknown>>) => Promise<void>;
1299
+ deleteByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsDeleteByFqnData, false, unknown>>) => Promise<void>;
1300
+ get: (options: EndpointOptions<Options$1<ApplicationAccessGrantsGetData, false, unknown>>) => Promise<AccessGrant>;
1301
+ getByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsGetByFqnData, false, unknown>>) => Promise<AccessGrant>;
1302
+ list: (options: EndpointOptions<Options$1<ApplicationAccessGrantsListData, false, unknown>>) => Promise<AccessGrantList>;
1303
+ sync: (options: EndpointOptions<Options$1<ApplicationAccessGrantsSyncData, false, unknown>>) => Promise<AccessGrantSyncResult>;
1304
+ update: (options: EndpointOptions<Options$1<ApplicationAccessGrantsUpdateData, false, unknown>>) => Promise<AccessGrant>;
1305
+ updateByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsUpdateByFqnData, false, unknown>>) => Promise<AccessGrant>;
1306
+ };
1307
+ groups: {
1308
+ addMember: (options: EndpointOptions<Options$1<ApplicationAccessGroupsAddMemberData, false, unknown>>) => Promise<void>;
1309
+ create: (options: EndpointOptions<Options$1<ApplicationAccessGroupsCreateData, false, unknown>>) => Promise<AccessGroup>;
1310
+ delete: (options: EndpointOptions<Options$1<ApplicationAccessGroupsDeleteData, false, unknown>>) => Promise<void>;
1311
+ get: (options: EndpointOptions<Options$1<ApplicationAccessGroupsGetData, false, unknown>>) => Promise<AccessGroup>;
1312
+ list: (options: EndpointOptions<Options$1<ApplicationAccessGroupsListData, false, unknown>>) => Promise<AccessGroupPage>;
1313
+ removeMember: (options: EndpointOptions<Options$1<ApplicationAccessGroupsRemoveMemberData, false, unknown>>) => Promise<void>;
1314
+ update: (options: EndpointOptions<Options$1<ApplicationAccessGroupsUpdateData, false, unknown>>) => Promise<AccessGroup>;
1315
+ };
1316
+ invitations: {
1317
+ list: (options: EndpointOptions<Options$1<ApplicationAccessMembersListInvitationsData, false, unknown>>) => Promise<AccessInvitationPage>;
1318
+ revoke: (options: EndpointOptions<Options$1<ApplicationAccessMembersRevokeInvitationData, false, unknown>>) => Promise<void>;
1319
+ };
1320
+ knowledgePolicies: {
1321
+ forSchema: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetSchemaKnowledgePoliciesData, false, unknown>>) => Promise<AccessSchemaKnowledgePolicies>;
1322
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListKnowledgePoliciesData, false, unknown>>) => Promise<AccessKnowledgeDataPolicy[]>;
1323
+ };
1324
+ maxPrivileges: {
1325
+ get: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetMaxPrivilegesData, false, unknown>>) => Promise<AccessProfile>;
1326
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListMaxPrivilegesData, false, unknown>>) => Promise<AccessProfile[]>;
219
1327
  };
1328
+ members: {
1329
+ create: (options: EndpointOptions<Options$1<ApplicationAccessMembersCreateData, false, unknown>>) => Promise<AccessMemberCreated>;
1330
+ get: (options: EndpointOptions<Options$1<ApplicationAccessMembersGetData, false, unknown>>) => Promise<AccessMember>;
1331
+ list: (options: EndpointOptions<Options$1<ApplicationAccessMembersListData, false, unknown>>) => Promise<AccessMemberPage>;
1332
+ remove: (options: EndpointOptions<Options$1<ApplicationAccessMembersDeleteData, false, unknown>>) => Promise<void>;
1333
+ resume: (options: EndpointOptions<Options$1<ApplicationAccessMembersResumeData, false, unknown>>) => Promise<void>;
1334
+ suspend: (options: EndpointOptions<Options$1<ApplicationAccessMembersSuspendData, false, unknown>>) => Promise<void>;
1335
+ };
1336
+ profiles: {
1337
+ get: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetProfileData, false, unknown>>) => Promise<AccessProfile>;
1338
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListProfilesData, false, unknown>>) => Promise<AccessProfile[]>;
1339
+ };
1340
+ snapshot: (options: EndpointOptions<Options$1<ApplicationAccessPrincipalsSnapshotData, false, unknown>>) => Promise<AccessSnapshot>;
220
1341
  };
221
- export type ExternalApplicationsListAppRolesResponse = ExternalApplicationsListAppRolesResponses[keyof ExternalApplicationsListAppRolesResponses];
1342
+ export type ApplicationAccessApi = ReturnType<typeof createApplicationAccessApi>;
222
1343
  export type JsonValue = boolean | null | number | readonly JsonValue[] | Readonly<{
223
1344
  readonly [key: string]: JsonValue;
224
1345
  }> | string;
@@ -296,40 +1417,6 @@ export type KnowledgeQuery = {
296
1417
  op: "autocomplete";
297
1418
  });
298
1419
  export type ExternalApplicationOperationRequest = {
299
- input: {
300
- userId: string;
301
- };
302
- operationId: "users_get";
303
- } | {
304
- input: {
305
- page?: number;
306
- pageSize?: number;
307
- };
308
- operationId: "users_list";
309
- } | {
310
- input: {
311
- userId: string;
312
- };
313
- operationId: "users_deactivate";
314
- } | {
315
- input: Record<string, never>;
316
- operationId: "roles_list";
317
- } | {
318
- input: {
319
- userId: string;
320
- roles: string[];
321
- };
322
- operationId: "roles_assign";
323
- } | {
324
- input: {
325
- userId: string;
326
- roles: string[];
327
- };
328
- operationId: "roles_revoke";
329
- } | {
330
- input: ExternalApplicationsCreateOrGetAppUserData["body"];
331
- operationId: "users_create_or_get";
332
- } | {
333
1420
  input: JsonObject | unknown[];
334
1421
  operationId: "context_get";
335
1422
  } | {
@@ -494,15 +1581,7 @@ export interface EnvelopeSuccess<Id extends string, Result> {
494
1581
  operationId: Id;
495
1582
  result: Result;
496
1583
  }
497
- export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"users_get", ApplicationUser> | EnvelopeSuccess<"users_list", ApplicationUserPage> | EnvelopeSuccess<"users_deactivate", {
498
- userId: string;
499
- }> | EnvelopeSuccess<"roles_list", {
500
- items: ApplicationRole[];
501
- }> | EnvelopeSuccess<"roles_assign", {
502
- userId: string;
503
- }> | EnvelopeSuccess<"roles_revoke", {
504
- userId: string;
505
- }> | EnvelopeSuccess<"users_create_or_get", ApplicationUserResolution> | 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<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
1584
+ 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<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
506
1585
  runId: string;
507
1586
  }> | EnvelopeSuccess<"skills_list", JsonObject> | EnvelopeSuccess<"skills_invoke", {
508
1587
  runId: string;
@@ -520,11 +1599,6 @@ export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"users_get", A
520
1599
  conversationId: string;
521
1600
  runId: string;
522
1601
  }> | EnvelopeSuccess<"conversations_history", ConversationHistory>;
523
- /** User details returned by the application's user-management gateway. */
524
- type ApplicationUser = ExternalApplicationsGetAppUserResponse["result"];
525
- type ApplicationUserResolution = ExternalApplicationsCreateOrGetAppUserResponse["result"];
526
- type ApplicationUserPage = ExternalApplicationsListAppUsersResponse["result"];
527
- type ApplicationRole = ExternalApplicationsListAppRolesResponse["result"]["items"][number];
528
1602
  declare const storageFileIdBrand: unique symbol;
529
1603
  /** A durable private file of the application's Organization. */
530
1604
  type StorageFileId = string & Readonly<{
@@ -540,19 +1614,11 @@ interface DurableFileUpload {
540
1614
  fileName: string;
541
1615
  sizeBytes: number;
542
1616
  }
543
- export type ExternalApplicationServiceOperationRequest = {
544
- input: ExternalApplicationsCheckAppUserEmailData["body"];
545
- operationId: "users_check_email";
546
- } | {
1617
+ export interface ExternalApplicationServiceOperationRequest {
547
1618
  input: DurableFileUpload;
548
1619
  operationId: "files_upload";
549
- };
550
- /**
551
- * Whether `users_create_or_get` would accept an email, checked without
552
- * creating anything; an unknown email is usable.
553
- */
554
- export type ApplicationUserEmailCheck = ExternalApplicationsCheckAppUserEmailResponse["result"];
555
- export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"users_check_email", ApplicationUserEmailCheck> | EnvelopeSuccess<"files_upload", {
1620
+ }
1621
+ export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_upload", {
556
1622
  storageFileId: StorageFileId;
557
1623
  }>;
558
1624
  /** Every operation a confidential server client may invoke. */
@@ -693,7 +1759,6 @@ declare const oauthErrorCodes: readonly [
693
1759
  "invalid_client",
694
1760
  "invalid_grant",
695
1761
  "invalid_request",
696
- "invalid_scope",
697
1762
  "invalid_target",
698
1763
  "temporarily_unavailable",
699
1764
  "unauthorized_client",
@@ -712,7 +1777,6 @@ declare const MemberSessionExchangeError_base: Schema.Class<MemberSessionExchang
712
1777
  "invalid_client",
713
1778
  "invalid_grant",
714
1779
  "invalid_request",
715
- "invalid_scope",
716
1780
  "invalid_target",
717
1781
  "temporarily_unavailable",
718
1782
  "unauthorized_client",
@@ -781,8 +1845,6 @@ export interface ServerInvocationContext {
781
1845
  readonly callerKind?: "anonymous_visitor";
782
1846
  readonly correlationId?: string;
783
1847
  readonly organizationId: string;
784
- /** Selects a Server Role for this call; omission uses the credential default. */
785
- readonly serverRole?: string;
786
1848
  readonly signal?: AbortSignal;
787
1849
  readonly traceparent?: string;
788
1850
  }
@@ -838,14 +1900,39 @@ export type ServerResourceUploadResult = Readonly<{
838
1900
  }>;
839
1901
  /** The field values of a record: a JSON object. */
840
1902
  export type ServerRecordValue = Readonly<Record<string, ResourceJsonValue>>;
841
- /** One record of an entity schema, as CI answers a write. */
1903
+ /** One record of an entity schema, as CI answers a read or a write. */
842
1904
  export type ServerResourceRecord = Readonly<{
843
1905
  deletedAt?: string;
844
1906
  id: string;
1907
+ /**
1908
+ * The records of the read's Include Paths by relation field key: one
1909
+ * record, or the records of a `many` field in reference order. Untyped:
1910
+ * the target schemas are CI's.
1911
+ */
1912
+ included?: Readonly<Record<string, ResourceJsonValue>>;
845
1913
  /** The revision that the next update or delete of the record names. */
846
1914
  revision: string;
1915
+ /** The keys of `included` whose records CI cut to the first 100. */
1916
+ truncated?: readonly string[];
847
1917
  value: ServerRecordValue;
848
1918
  }>;
1919
+ /** One page of a record search. */
1920
+ export type ServerRecordPage = EntityPage<ServerRecordValue>;
1921
+ /**
1922
+ * Reads the record `id`. `include` names Include Paths, such as
1923
+ * `["company", "contacts.company"]`; their records are in `included`.
1924
+ */
1925
+ export type ServerRecordGetRequest = Readonly<{
1926
+ id: string;
1927
+ include?: readonly string[];
1928
+ schemaId: string;
1929
+ timeoutMs?: number;
1930
+ }> & ServerInvocationContext;
1931
+ /** Searches the records of a schema, one page at a time. */
1932
+ export type ServerRecordSearchRequest = Readonly<{
1933
+ schemaId: string;
1934
+ timeoutMs?: number;
1935
+ }> & EntityListQuery & ServerInvocationContext;
849
1936
  /** Creates a record with `value`; CI names its id. */
850
1937
  export type ServerRecordCreateRequest = Readonly<{
851
1938
  idempotencyKey?: string;
@@ -881,6 +1968,19 @@ export type ServerRecordWriteResult = Readonly<{
881
1968
  result: ServerResourceRecord;
882
1969
  }>;
883
1970
  }>;
1971
+ /** The record that CI read, or the refusal of CI. */
1972
+ export type ServerRecordGetResult = ServerRecordWriteResult;
1973
+ /** The page that CI found, or the refusal of CI. */
1974
+ export type ServerRecordSearchResult = Readonly<{
1975
+ error: ServerResourceFailure;
1976
+ ok: false;
1977
+ }> | Readonly<{
1978
+ ok: true;
1979
+ value: Readonly<{
1980
+ correlationId: string;
1981
+ result: ServerRecordPage;
1982
+ }>;
1983
+ }>;
884
1984
  export type ServerOperationMethod<Id extends ExternalApplicationServerOperationId> = (request: ServerOperationRequest<Id>) => Promise<ExternalApplicationOperationResult<Id>>;
885
1985
  export type ServerMessageSendMethod = (request: ServerMessageSendRequest) => Promise<MessageSendResult>;
886
1986
  export type ServerResourceUploadMethod = (request: ServerResourceUploadRequest) => Promise<ServerResourceUploadResult>;
@@ -967,6 +2067,13 @@ export type ServerClientMode<Mode extends ServerAuthenticationMode> = Readonly<{
967
2067
  }>;
968
2068
  /** `Mode` is the authentication mode of the client; by default it is not known. */
969
2069
  export interface ServerClient<Mode extends ServerAuthenticationMode = ServerAuthenticationMode> extends ServerClientMode<Mode> {
2070
+ /**
2071
+ * Members and guests, Access Grants and the read-only access model of an
2072
+ * Organization (ARC-010). App server credentials act with the app's server
2073
+ * grants; a delegated token must be a service principal's API key. CI
2074
+ * authorizes each call with the caller's Tuples.
2075
+ */
2076
+ readonly access: ServerAccess;
970
2077
  readonly agents: Readonly<{
971
2078
  /** Starts an Agent run addressed by `agentId` or by its Organization `agentFqn`. */
972
2079
  invoke: ServerOperationMethod<"agents_invoke">;
@@ -992,8 +2099,8 @@ export interface ServerClient<Mode extends ServerAuthenticationMode = ServerAuth
992
2099
  * Durable private files of the application's Organization. `upload` stores
993
2100
  * one PDF, JPEG or PNG of up to 10 MiB with no expiry and returns its
994
2101
  * `storageFileId`; a `workflows.invoke` input can name it, and the nodes of
995
- * the run read the file. Needs the `ai:attachments` scope and confidential
996
- * credentials. Unlike `attachments.upload`, the file belongs to no run and
2102
+ * the run read the file. Needs `core.platform.attachments` in the app
2103
+ * server's grants and confidential credentials. Unlike `attachments.upload`, the file belongs to no run and
997
2104
  * does not expire after 24 hours.
998
2105
  */
999
2106
  readonly files: Readonly<{
@@ -1014,7 +2121,8 @@ export interface ServerClient<Mode extends ServerAuthenticationMode = ServerAuth
1014
2121
  }>;
1015
2122
  /**
1016
2123
  * Sends one message through a messaging connection that an administrator
1017
- * granted to the application. Needs the `messaging:send` scope. A repeat
2124
+ * granted to the application. Needs `core.platform.messaging` in the
2125
+ * caller's grants. A repeat
1018
2126
  * with the same `idempotencyKey` and content returns the first receipt and
1019
2127
  * sends nothing.
1020
2128
  */
@@ -1029,25 +2137,24 @@ export interface ServerClient<Mode extends ServerAuthenticationMode = ServerAuth
1029
2137
  * the Organization default service principal, only on schemas its own
1030
2138
  * package declares.
1031
2139
  *
1032
- * `records` writes records of an entity schema, named by `schemaId` (the
1033
- * schema id or FQN), with the same credentials. A refusal of CI resolves
1034
- * `{ ok: false, error }`. After CI confirms a write, the `invalidate`
1035
- * option of the client gets the Entity Tag and the Schema Tag of the
1036
- * record.
2140
+ * `records` reads and writes records of an entity schema, named by
2141
+ * `schemaId` (the schema id or FQN), with the same credentials. A refusal
2142
+ * of CI resolves `{ ok: false, error }`. After CI confirms a write, the
2143
+ * `invalidate` option of the client gets the Entity Tag and the Schema
2144
+ * Tag of the record. A read invalidates nothing.
1037
2145
  */
1038
2146
  readonly resources: Readonly<{
1039
2147
  createUpload: ServerResourceUploadMethod;
1040
2148
  records: Readonly<{
1041
2149
  create: ServerRecordWriteMethod<ServerRecordCreateRequest>;
1042
2150
  delete: ServerRecordWriteMethod<ServerRecordDeleteRequest>;
2151
+ /** Reads one record; `include` names its Include Paths. */
2152
+ get: (request: ServerRecordGetRequest) => Promise<ServerRecordGetResult>;
2153
+ /** Searches the records of the schema, one page at a time. */
2154
+ search: (request: ServerRecordSearchRequest) => Promise<ServerRecordSearchResult>;
1043
2155
  update: ServerRecordWriteMethod<ServerRecordUpdateRequest>;
1044
2156
  }>;
1045
2157
  }>;
1046
- readonly roles: Readonly<{
1047
- assign: ServerOperationMethod<"roles_assign">;
1048
- list: ServerOperationMethod<"roles_list">;
1049
- revoke: ServerOperationMethod<"roles_revoke">;
1050
- }>;
1051
2158
  readonly runs: Readonly<{
1052
2159
  cancel: ServerRunOperationMethod<"runs_cancel", ServerRun>;
1053
2160
  get: ServerRunOperationMethod<"runs_get", ServerRun>;
@@ -1057,23 +2164,6 @@ export interface ServerClient<Mode extends ServerAuthenticationMode = ServerAuth
1057
2164
  invoke: ServerOperationMethod<"skills_invoke">;
1058
2165
  list: ServerOperationMethod<"skills_list">;
1059
2166
  }>;
1060
- /**
1061
- * Application users and their role-bounded lifecycle. User tokens and service
1062
- * credentials are authorized by CI on each call.
1063
- */
1064
- readonly users: Readonly<{
1065
- /**
1066
- * Whether `createOrGet` would accept `email`, without creating anything:
1067
- * `{ usable: true }`, or `{ usable: false, reason }` with
1068
- * `user_unavailable` or `target_inactive`. An unknown email is usable.
1069
- * Service credentials only, under the users-create permission.
1070
- */
1071
- checkEmail: ServerOperationMethod<"users_check_email">;
1072
- createOrGet: ServerOperationMethod<"users_create_or_get">;
1073
- deactivate: ServerOperationMethod<"users_deactivate">;
1074
- get: ServerOperationMethod<"users_get">;
1075
- list: ServerOperationMethod<"users_list">;
1076
- }>;
1077
2167
  readonly workflows: Readonly<{
1078
2168
  invoke: ServerOperationMethod<"workflows_invoke">;
1079
2169
  list: ServerOperationMethod<"workflows_list">;
@@ -1087,13 +2177,132 @@ declare function createServerClient(config: ServerClientConfig & ServerClientInv
1087
2177
  declare function createServerClient(config: ServerClientConfig & ServerClientInvalidation): ServerClient & Readonly<{
1088
2178
  close: () => Promise<void>;
1089
2179
  }>;
2180
+ /** The Organization a `ci.access` call acts in. */
2181
+ export type ServerAccessContext = Readonly<{
2182
+ organizationId: string;
2183
+ }>;
2184
+ export type OptionsOf<F> = F extends (options: infer Options) => PromiseLike<infer _> ? Options : never;
2185
+ export type BodyOf<F> = OptionsOf<F> extends {
2186
+ body: infer B;
2187
+ } ? B : never;
2188
+ export type PathOf<F> = OptionsOf<F> extends {
2189
+ path: infer P;
2190
+ } ? P : never;
2191
+ export type QueryOf<F> = OptionsOf<F> extends {
2192
+ query?: infer Q;
2193
+ } ? NonNullable<Q> : never;
2194
+ export type ResultOf<F> = F extends (options: never) => PromiseLike<infer Result> ? Result : never;
2195
+ export type Api = ApplicationAccessApi;
2196
+ export type WithBody<F> = ServerAccessContext & BodyOf<F>;
2197
+ export type WithPath<F> = ServerAccessContext & PathOf<F>;
2198
+ export type Method<Request, F> = (request: Request) => Promise<ResultOf<F>>;
2199
+ /** A grant named by its id or by its Access Grant FQN. */
2200
+ export type GrantReference = PathOf<Api["grants"]["get"]> | PathOf<Api["grants"]["getByFqn"]>;
2201
+ export type ServerAccessMember = ResultOf<Api["members"]["get"]>;
2202
+ export type ServerAccessGrant = ResultOf<Api["grants"]["get"]>;
2203
+ export interface ServerAccess {
2204
+ /** The Grant Axes and the slugs that key Axis Values. Needs `admin.profiles` at read. */
2205
+ readonly axes: Readonly<{
2206
+ list: Method<ServerAccessContext, Api["axes"]["list"]>;
2207
+ }>;
2208
+ /** The Capability Catalog of the Organization. Needs `admin.profiles` at read. */
2209
+ readonly catalog: Readonly<{
2210
+ list: Method<ServerAccessContext, Api["catalog"]["list"]>;
2211
+ }>;
2212
+ /**
2213
+ * Why a principal may use a capability or act on a Knowledge record: its
2214
+ * grants with their path and the matching policies. Needs `admin.grants`
2215
+ * at read.
2216
+ */
2217
+ readonly explain: Method<WithBody<Api["explain"]>, Api["explain"]>;
2218
+ /**
2219
+ * Access Grants by id or Access Grant FQN. Writes need `admin.grants` at
2220
+ * manage and pass Grant Authority; `sync` makes the runtime grants below
2221
+ * a namespace exactly the list. Reads need `admin.grants` at read.
2222
+ */
2223
+ readonly grants: Readonly<{
2224
+ create: Method<WithBody<Api["grants"]["create"]>, Api["grants"]["create"]>;
2225
+ delete: (request: ServerAccessContext & GrantReference) => Promise<void>;
2226
+ get: (request: ServerAccessContext & GrantReference) => Promise<ServerAccessGrant>;
2227
+ /** The grants of a user or Group, or below a namespace; at least one of them. */
2228
+ list: Method<ServerAccessContext & QueryOf<Api["grants"]["list"]>, Api["grants"]["list"]>;
2229
+ sync: Method<WithBody<Api["grants"]["sync"]>, Api["grants"]["sync"]>;
2230
+ update: (request: ServerAccessContext & GrantReference & BodyOf<Api["grants"]["update"]>) => Promise<ServerAccessGrant>;
2231
+ }>;
2232
+ /**
2233
+ * Groups. Reads need `admin.groups` at read, writes at manage; adding or
2234
+ * removing a member of a Group that a holders-only grant reaches also
2235
+ * needs Grant Authority over that grant. An app server reads Groups but
2236
+ * writes none.
2237
+ */
2238
+ readonly groups: Readonly<{
2239
+ addMember: (request: WithPath<Api["groups"]["addMember"]> & BodyOf<Api["groups"]["addMember"]>) => Promise<void>;
2240
+ create: Method<WithBody<Api["groups"]["create"]>, Api["groups"]["create"]>;
2241
+ delete: (request: WithPath<Api["groups"]["delete"]>) => Promise<void>;
2242
+ get: Method<WithPath<Api["groups"]["get"]>, Api["groups"]["get"]>;
2243
+ /** A page of Groups; pass `next` as `page` to read the page after it. */
2244
+ list: Method<ServerAccessContext & QueryOf<Api["groups"]["list"]>, Api["groups"]["list"]>;
2245
+ removeMember: (request: WithPath<Api["groups"]["removeMember"]>) => Promise<void>;
2246
+ update: Method<WithPath<Api["groups"]["update"]> & BodyOf<Api["groups"]["update"]>, Api["groups"]["update"]>;
2247
+ }>;
2248
+ /**
2249
+ * Invitations that `members.create` sent with mode `invitation`, newest
2250
+ * first. Reads need `admin.users` at read, a revoke at manage. Only a
2251
+ * service principal invites, so an app server is refused.
2252
+ */
2253
+ readonly invitations: Readonly<{
2254
+ /** A page of invitations, optionally by `status`; pass `next` as `page` to read the page after it. */
2255
+ list: Method<ServerAccessContext & QueryOf<Api["invitations"]["list"]>, Api["invitations"]["list"]>;
2256
+ revoke: (request: WithPath<Api["invitations"]["revoke"]>) => Promise<void>;
2257
+ }>;
2258
+ /**
2259
+ * The Knowledge Data Policies, read only: the core and packages declare
2260
+ * them. `forSchema` answers the policies that decide the reads and the
2261
+ * writes of one schema, by its FQN. Needs `admin.profiles` at read.
2262
+ */
2263
+ readonly knowledgePolicies: Readonly<{
2264
+ forSchema: Method<WithPath<Api["knowledgePolicies"]["forSchema"]>, Api["knowledgePolicies"]["forSchema"]>;
2265
+ list: Method<ServerAccessContext, Api["knowledgePolicies"]["list"]>;
2266
+ }>;
2267
+ /**
2268
+ * The Max Privileges templates, read only: the most an app's user tokens
2269
+ * or an API key may do. Needs `admin.profiles` at read.
2270
+ */
2271
+ readonly maxPrivileges: Readonly<{
2272
+ get: Method<WithPath<Api["maxPrivileges"]["get"]>, Api["maxPrivileges"]["get"]>;
2273
+ list: Method<ServerAccessContext, Api["maxPrivileges"]["list"]>;
2274
+ }>;
2275
+ /**
2276
+ * Members and guests. `create` needs `admin.grants` at manage and Grant
2277
+ * Authority over each grant; reads need `admin.users` at read for
2278
+ * members and `admin.guests` at read for guests; changes need the same at
2279
+ * manage. An app server sees and changes only the guests it created.
2280
+ */
2281
+ readonly members: Readonly<{
2282
+ create: Method<WithBody<Api["members"]["create"]>, Api["members"]["create"]>;
2283
+ /** The member with this address, or `null` when the caller sees none. */
2284
+ findByEmail: (request: ServerAccessContext & Readonly<{
2285
+ email: string;
2286
+ }>) => Promise<ServerAccessMember | null>;
2287
+ get: Method<WithPath<Api["members"]["get"]>, Api["members"]["get"]>;
2288
+ list: Method<ServerAccessContext & QueryOf<Api["members"]["list"]>, Api["members"]["list"]>;
2289
+ remove: Method<WithPath<Api["members"]["remove"]>, Api["members"]["remove"]>;
2290
+ resume: Method<WithPath<Api["members"]["resume"]>, Api["members"]["resume"]>;
2291
+ suspend: Method<WithPath<Api["members"]["suspend"]>, Api["members"]["suspend"]>;
2292
+ }>;
2293
+ /** Access Profiles, read only. Needs `admin.profiles` at read. */
2294
+ readonly profiles: Readonly<{
2295
+ get: Method<WithPath<Api["profiles"]["get"]>, Api["profiles"]["get"]>;
2296
+ list: Method<ServerAccessContext, Api["profiles"]["list"]>;
2297
+ }>;
2298
+ /** A user's Access Snapshot in the Organization. Needs `admin.grants` at read. */
2299
+ readonly snapshot: Method<WithPath<Api["snapshot"]>, Api["snapshot"]>;
2300
+ }
1090
2301
  export interface MemberSessionExchangeRequest {
1091
2302
  readonly credentials: ConfidentialCredentialProvider;
1092
2303
  readonly fetch?: typeof globalThis.fetch;
1093
2304
  /** The Organization the member acts in; the application must be allowed in it. */
1094
2305
  readonly organizationId: string;
1095
- /** A subset of the application's scopes. */
1096
- readonly scopes: readonly string[];
1097
2306
  /** The member's CI session token, for example from `POST /auth/otp/verify`. */
1098
2307
  readonly sessionToken: string;
1099
2308
  /** Cancels the exchange; a cancelled exchange rejects with the signal's reason. */
@@ -1126,6 +2335,7 @@ declare const FederatedAuthError$1: typeof FederatedAuthError;
1126
2335
  type FederatedAuthError$1 = FederatedAuthError;
1127
2336
  declare const createServerClient$1: typeof createServerClient;
1128
2337
  export declare const serverSdkRuntime: "node";
2338
+ export declare const ServerAccessError: typeof AccessApiError;
1129
2339
  export declare const runAsApplication: (config: RunAsApplicationConfig & ServerClientInvalidation) => ServerClient & Readonly<{
1130
2340
  close: () => Promise<void>;
1131
2341
  }>;
@@ -1133,10 +2343,6 @@ export declare const exchangeMemberSession: (request: MemberSessionExchangeReque
1133
2343
  export declare const uuidV7: () => string;
1134
2344
 
1135
2345
  export {
1136
- ApplicationRole as ServerApplicationRole,
1137
- ApplicationUser as ServerApplicationUser,
1138
- ApplicationUserPage as ServerApplicationUserPage,
1139
- ApplicationUserResolution as ServerApplicationUserResolution,
1140
2346
  CiError$1 as CiError,
1141
2347
  CiTransportError$1 as CiTransportError,
1142
2348
  DurableFileUpload as ServerDurableFileUpload,