@arbium/enterprise-agent-connect-client 0.1.2-dev.d2aa5ca → 0.2.1-dev.fd7a648

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/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type AppLive } from "./steps.js";
2
- import type { Agent, CheckOutcome, Connection, Connector, EventSubscriptionInput, EventTriggerInput, Limits, SiteAccess, TeamsTriggerInput } from "./types.js";
2
+ import type { Agent, Body, CheckOutcome, Connection, Connector, EventSubscriptionInput, EventTriggerInput, Limits, SiteAccess, TeamsTriggerInput } from "./types.js";
3
3
  export * from "./steps.js";
4
4
  export type * from "./types.js";
5
5
  /** A refusal the admin should read (4xx with an `error`): bad input, a failed connection
@@ -115,6 +115,7 @@ export declare function createClient(options: ClientOptions): {
115
115
  field: string;
116
116
  value: string;
117
117
  };
118
+ capabilities?: string[];
118
119
  }[];
119
120
  afterConnect: {
120
121
  title: string;
@@ -144,6 +145,7 @@ export declare function createClient(options: ClientOptions): {
144
145
  field: string;
145
146
  value: string;
146
147
  };
148
+ capabilities?: string[];
147
149
  }[];
148
150
  fields: {
149
151
  id: string;
@@ -161,6 +163,559 @@ export declare function createClient(options: ClientOptions): {
161
163
  field: string;
162
164
  value: string;
163
165
  };
166
+ optional: boolean;
167
+ }[];
168
+ capabilities: {
169
+ id: string;
170
+ label: string;
171
+ description: string;
172
+ required: boolean;
173
+ destructive: boolean;
174
+ costs?: boolean;
175
+ scopes: string[];
176
+ roles?: string[];
177
+ permissions: string[];
178
+ fill?: {
179
+ [key: string]: string;
180
+ };
181
+ note?: string;
182
+ forbidden?: string;
183
+ claudeKey?: boolean;
184
+ tools: string[];
185
+ }[];
186
+ limits: {
187
+ id: string;
188
+ label: string;
189
+ help: string;
190
+ kind: "list" | "text" | "map";
191
+ required: boolean;
192
+ pattern?: string;
193
+ keys?: string;
194
+ }[];
195
+ siteAccess?: {
196
+ grant: {
197
+ title: string;
198
+ body: string;
199
+ link?: {
200
+ label: string;
201
+ href: string;
202
+ };
203
+ copy?: string[];
204
+ shell?: "bash" | "powershell";
205
+ permissions?: boolean;
206
+ certificate?: boolean;
207
+ click?: string[];
208
+ clickUnavailable?: true;
209
+ siteRole?: "read" | "write";
210
+ agentCheck?: boolean;
211
+ confirm?: string;
212
+ live?: string;
213
+ settings?: {
214
+ id: string;
215
+ label: string;
216
+ help?: string;
217
+ placeholder?: string;
218
+ pattern: string;
219
+ }[];
220
+ option?: {
221
+ field: string;
222
+ value: string;
223
+ };
224
+ }[];
225
+ request: string;
226
+ write: string[];
227
+ };
228
+ agentAccess?: {
229
+ limit: string;
230
+ label: string;
231
+ path: string & (unknown & unknown);
232
+ granted: string;
233
+ notGranted: string;
234
+ notFound: string;
235
+ probes: {
236
+ [key: string]: {
237
+ method: "GET" | "POST" | "PATCH";
238
+ path: string & (unknown & unknown);
239
+ body?: unknown;
240
+ allowed: number[];
241
+ };
242
+ };
243
+ missing?: string;
244
+ };
245
+ verify: {
246
+ method: "GET" | "POST";
247
+ path: string;
248
+ label: string;
249
+ show: string;
250
+ name?: string;
251
+ match?: {
252
+ [key: string]: string | number | boolean;
253
+ };
254
+ body?: {
255
+ [key: string]: unknown;
256
+ };
257
+ ifEmpty?: string;
258
+ } | {
259
+ label: string;
260
+ check: string;
261
+ ifEmpty?: string;
262
+ };
263
+ discover?: {
264
+ method: "GET" | "POST";
265
+ path: string;
266
+ label: string;
267
+ show: string;
268
+ name?: string;
269
+ match?: {
270
+ [key: string]: string | number | boolean;
271
+ };
272
+ body?: {
273
+ [key: string]: unknown;
274
+ };
275
+ ifEmpty?: string;
276
+ } | {
277
+ label: string;
278
+ check: string;
279
+ ifEmpty?: string;
280
+ };
281
+ revoke: string;
282
+ http?: {
283
+ baseUrl: string;
284
+ auth: {
285
+ type: "header";
286
+ header: string;
287
+ value: string;
288
+ prefix?: string;
289
+ } | {
290
+ type: "bearer";
291
+ token: string;
292
+ } | {
293
+ type: "basic";
294
+ username: string;
295
+ password: string;
296
+ } | {
297
+ type: "oauth2";
298
+ tokenUrl: string;
299
+ clientId: string;
300
+ clientSecret: string;
301
+ scope?: string;
302
+ } | {
303
+ type: "query";
304
+ param: string;
305
+ value: string;
306
+ };
307
+ headers: {
308
+ [key: string]: string;
309
+ };
310
+ tools: {
311
+ name: string;
312
+ description: string;
313
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
314
+ path: string;
315
+ params: {
316
+ [key: string]: {
317
+ type: "string" | "number" | "integer" | "boolean" | "array";
318
+ description: string;
319
+ in: "path" | "query" | "body";
320
+ name?: string;
321
+ required: boolean;
322
+ default?: (string | number | boolean) | (string | number | boolean)[];
323
+ enum?: (string | number | boolean)[];
324
+ items?: "string" | "number" | "integer" | "boolean";
325
+ join?: string;
326
+ limit?: string;
327
+ };
328
+ };
329
+ destructive: boolean;
330
+ answerLimits: {
331
+ field: string;
332
+ limit: string;
333
+ }[];
334
+ result?: {
335
+ items?: string;
336
+ fields?: string[];
337
+ };
338
+ paging?: {
339
+ param: string;
340
+ body: string;
341
+ } | {
342
+ param: string;
343
+ header: string;
344
+ } | {
345
+ param: string;
346
+ link: true;
347
+ };
348
+ }[];
349
+ allowInsecureHttp: boolean;
350
+ };
351
+ soap?: {
352
+ endpoint: string;
353
+ version: "1.1" | "1.2";
354
+ namespaces: {
355
+ [key: string]: string;
356
+ };
357
+ auth?: {
358
+ type: "header";
359
+ header: string;
360
+ value: string;
361
+ prefix?: string;
362
+ } | {
363
+ type: "bearer";
364
+ token: string;
365
+ } | {
366
+ type: "basic";
367
+ username: string;
368
+ password: string;
369
+ };
370
+ wsSecurity?: {
371
+ username: string;
372
+ password: string;
373
+ digest: boolean;
374
+ };
375
+ verify?: {
376
+ tool: string;
377
+ args: {
378
+ [key: string]: string | number | boolean;
379
+ };
380
+ show: string;
381
+ };
382
+ tools: {
383
+ name: string;
384
+ description: string;
385
+ operation: string;
386
+ soapAction?: string;
387
+ body: string;
388
+ params: {
389
+ [key: string]: {
390
+ type: "string" | "number" | "integer" | "boolean";
391
+ description: string;
392
+ required: boolean;
393
+ limit?: string;
394
+ };
395
+ };
396
+ result?: string;
397
+ fields?: string[];
398
+ readOnly: boolean;
399
+ destructive: boolean;
400
+ answerLimits: {
401
+ field: string;
402
+ limit: string;
403
+ }[];
404
+ }[];
405
+ allowInsecureHttp: boolean;
406
+ };
407
+ odata?: {
408
+ serviceRoot: string;
409
+ version: "2" | "4";
410
+ auth: {
411
+ type: "header";
412
+ header: string;
413
+ value: string;
414
+ prefix?: string;
415
+ } | {
416
+ type: "bearer";
417
+ token: string;
418
+ } | {
419
+ type: "basic";
420
+ username: string;
421
+ password: string;
422
+ } | {
423
+ type: "oauth2";
424
+ tokenUrl: string;
425
+ clientId: string;
426
+ clientSecret: string;
427
+ scope?: string;
428
+ } | {
429
+ type: "query";
430
+ param: string;
431
+ value: string;
432
+ };
433
+ headers: {
434
+ [key: string]: string;
435
+ };
436
+ csrf: boolean;
437
+ paging: "skip" | "server";
438
+ tools: {
439
+ name: string;
440
+ description: string;
441
+ kind: "list" | "get" | "create" | "update" | "function" | "action";
442
+ entitySet?: string;
443
+ function?: string;
444
+ key: {
445
+ [key: string]: {
446
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
447
+ description: string;
448
+ property?: string;
449
+ required?: boolean;
450
+ limit?: string;
451
+ };
452
+ };
453
+ filters: {
454
+ [key: string]: {
455
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
456
+ description: string;
457
+ property?: string;
458
+ required?: boolean;
459
+ limit?: string;
460
+ op: "eq" | "ne" | "gt" | "ge" | "lt" | "le" | "contains" | "startswith";
461
+ };
462
+ };
463
+ fields: {
464
+ [key: string]: {
465
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
466
+ description: string;
467
+ property?: string;
468
+ required?: boolean;
469
+ limit?: string;
470
+ };
471
+ };
472
+ params: {
473
+ [key: string]: {
474
+ type: "string" | "integer" | "number" | "decimal" | "boolean" | "guid" | "datetime" | "datetimeoffset";
475
+ description: string;
476
+ property?: string;
477
+ required?: boolean;
478
+ limit?: string;
479
+ };
480
+ };
481
+ select: string[];
482
+ orderBy?: string;
483
+ top: number;
484
+ destructive: boolean;
485
+ answerLimits: {
486
+ field: string;
487
+ limit: string;
488
+ }[];
489
+ }[];
490
+ allowInsecureHttp: boolean;
491
+ };
492
+ sql?: {
493
+ engine: "postgres" | "sqlserver" | "mysql" | "oracle";
494
+ host: string;
495
+ port?: number;
496
+ database: string;
497
+ auth: {
498
+ user: string;
499
+ password: string;
500
+ };
501
+ tls: "verify" | "insecure" | "off";
502
+ timeoutSeconds: number;
503
+ maxRows: number;
504
+ tools: {
505
+ name: string;
506
+ description: string;
507
+ sql: string;
508
+ params: {
509
+ [key: string]: {
510
+ type: "string" | "number" | "integer" | "boolean";
511
+ description: string;
512
+ required: boolean;
513
+ limit?: string;
514
+ };
515
+ };
516
+ write: boolean;
517
+ destructive: boolean;
518
+ answerLimits: {
519
+ column: string;
520
+ limit: string;
521
+ }[];
522
+ }[];
523
+ };
524
+ events?: {
525
+ types: {
526
+ id: string;
527
+ label: string;
528
+ }[];
529
+ fields: {
530
+ [key: string]: string;
531
+ };
532
+ limits: {
533
+ [key: string]: string;
534
+ };
535
+ webhook?: {
536
+ verify: {
537
+ type: "hmac-sha256";
538
+ header: string;
539
+ prefix: string;
540
+ } | {
541
+ type: "token";
542
+ header: string;
543
+ } | {
544
+ type: "none";
545
+ };
546
+ allowInsecure: boolean;
547
+ type: {
548
+ field: string;
549
+ } | {
550
+ header: string;
551
+ };
552
+ deliveryId?: {
553
+ field: string;
554
+ } | {
555
+ header: string;
556
+ };
557
+ timestamp?: {
558
+ at: {
559
+ field: string;
560
+ } | {
561
+ header: string;
562
+ };
563
+ unit: "s" | "ms" | "iso";
564
+ toleranceSeconds: number;
565
+ };
566
+ setup: {
567
+ title: string;
568
+ body: string;
569
+ link?: {
570
+ label: string;
571
+ href: string;
572
+ };
573
+ copy?: string[];
574
+ shell?: "bash" | "powershell";
575
+ permissions?: boolean;
576
+ certificate?: boolean;
577
+ click?: string[];
578
+ clickUnavailable?: true;
579
+ siteRole?: "read" | "write";
580
+ agentCheck?: boolean;
581
+ confirm?: string;
582
+ live?: string;
583
+ settings?: {
584
+ id: string;
585
+ label: string;
586
+ help?: string;
587
+ placeholder?: string;
588
+ pattern: string;
589
+ }[];
590
+ option?: {
591
+ field: string;
592
+ value: string;
593
+ };
594
+ }[];
595
+ register?: {
596
+ method: "GET" | "POST" | "PUT";
597
+ path: string;
598
+ body?: unknown;
599
+ location: string;
600
+ };
601
+ };
602
+ self?: {
603
+ request: {
604
+ method: "GET" | "POST" | "PUT";
605
+ path: string;
606
+ body?: unknown;
607
+ };
608
+ id: string;
609
+ fields: string[];
610
+ };
611
+ poll?: {
612
+ request: {
613
+ method: "GET" | "POST" | "PUT";
614
+ path: string;
615
+ body?: unknown;
616
+ };
617
+ filter?: string;
618
+ items: string;
619
+ wrap?: string;
620
+ cursor: string;
621
+ deliveryId: string[];
622
+ types: {
623
+ type: string;
624
+ since?: string;
625
+ }[];
626
+ };
627
+ };
628
+ }[]>;
629
+ /** The deployment's apps and the organization's own internal apps. */
630
+ orgConnectors: (o: string) => Promise<{
631
+ id: string;
632
+ name: string;
633
+ description: string;
634
+ logo: string;
635
+ identity: string;
636
+ signsInAs?: "agentBot";
637
+ provider?: string;
638
+ order?: number;
639
+ connectionKind: "guided";
640
+ accountKey: string;
641
+ scopes?: string[];
642
+ setup: {
643
+ title: string;
644
+ body: string;
645
+ link?: {
646
+ label: string;
647
+ href: string;
648
+ };
649
+ copy?: string[];
650
+ shell?: "bash" | "powershell";
651
+ permissions?: boolean;
652
+ certificate?: boolean;
653
+ click?: string[];
654
+ clickUnavailable?: true;
655
+ siteRole?: "read" | "write";
656
+ agentCheck?: boolean;
657
+ confirm?: string;
658
+ live?: string;
659
+ settings?: {
660
+ id: string;
661
+ label: string;
662
+ help?: string;
663
+ placeholder?: string;
664
+ pattern: string;
665
+ }[];
666
+ option?: {
667
+ field: string;
668
+ value: string;
669
+ };
670
+ capabilities?: string[];
671
+ }[];
672
+ afterConnect: {
673
+ title: string;
674
+ body: string;
675
+ link?: {
676
+ label: string;
677
+ href: string;
678
+ };
679
+ copy?: string[];
680
+ shell?: "bash" | "powershell";
681
+ permissions?: boolean;
682
+ certificate?: boolean;
683
+ click?: string[];
684
+ clickUnavailable?: true;
685
+ siteRole?: "read" | "write";
686
+ agentCheck?: boolean;
687
+ confirm?: string;
688
+ live?: string;
689
+ settings?: {
690
+ id: string;
691
+ label: string;
692
+ help?: string;
693
+ placeholder?: string;
694
+ pattern: string;
695
+ }[];
696
+ option?: {
697
+ field: string;
698
+ value: string;
699
+ };
700
+ capabilities?: string[];
701
+ }[];
702
+ fields: {
703
+ id: string;
704
+ label: string;
705
+ help?: string;
706
+ placeholder?: string;
707
+ secret: boolean;
708
+ options?: {
709
+ value: string;
710
+ label: string;
711
+ description: string;
712
+ scopes?: string[];
713
+ }[];
714
+ requires?: {
715
+ field: string;
716
+ value: string;
717
+ };
718
+ optional: boolean;
164
719
  }[];
165
720
  capabilities: {
166
721
  id: string;
@@ -244,6 +799,7 @@ export declare function createClient(options: ClientOptions): {
244
799
  path: string;
245
800
  label: string;
246
801
  show: string;
802
+ name?: string;
247
803
  match?: {
248
804
  [key: string]: string | number | boolean;
249
805
  };
@@ -261,6 +817,7 @@ export declare function createClient(options: ClientOptions): {
261
817
  path: string;
262
818
  label: string;
263
819
  show: string;
820
+ name?: string;
264
821
  match?: {
265
822
  [key: string]: string | number | boolean;
266
823
  };
@@ -616,11 +1173,50 @@ export declare function createClient(options: ClientOptions): {
616
1173
  deliveryId: string[];
617
1174
  types: {
618
1175
  type: string;
619
- same?: [string, string];
1176
+ since?: string;
620
1177
  }[];
621
1178
  };
622
1179
  };
623
1180
  }[]>;
1181
+ internalApps: (o: string) => Promise<{
1182
+ id: string;
1183
+ organizationId: string;
1184
+ definition: {
1185
+ [key: string]: unknown;
1186
+ };
1187
+ problem: string | null;
1188
+ createdBy: string;
1189
+ createdAt: string;
1190
+ updatedBy: string;
1191
+ updatedAt: string;
1192
+ }[]>;
1193
+ internalApp: (o: string, a: string) => Promise<{
1194
+ id: string;
1195
+ organizationId: string;
1196
+ definition: {
1197
+ [key: string]: unknown;
1198
+ };
1199
+ problem: string | null;
1200
+ createdBy: string;
1201
+ createdAt: string;
1202
+ updatedBy: string;
1203
+ updatedAt: string;
1204
+ } | null>;
1205
+ saveInternalApp: (o: string, a: string, definition: Record<string, unknown>, by: string) => Promise<{
1206
+ app: import("./schema.js").components["schemas"]["InternalApp"];
1207
+ connector: import("./schema.js").components["schemas"]["Connector"];
1208
+ created: boolean;
1209
+ disconnected: boolean;
1210
+ grantsRemoved: string[];
1211
+ }>;
1212
+ deleteInternalApp: (o: string, a: string, by: string) => Promise<void>;
1213
+ draftInternalApp: (body: Body<"draftInternalApp">) => Promise<{
1214
+ definition: {
1215
+ [key: string]: unknown;
1216
+ };
1217
+ notes: string[];
1218
+ problem: string | null;
1219
+ }>;
624
1220
  providers: () => Promise<{
625
1221
  id: string;
626
1222
  name: string;
package/lib/index.js CHANGED
@@ -64,6 +64,16 @@ export function createClient(options) {
64
64
  },
65
65
  branding: () => call("GET", "/branding"),
66
66
  connectors: () => call("GET", "/connectors"),
67
+ /** The deployment's apps and the organization's own internal apps. */
68
+ orgConnectors: (o) => call("GET", `${org(o)}/connectors`),
69
+ internalApps: (o) => call("GET", `${org(o)}/internal-apps`),
70
+ internalApp: (o, a) => maybe(`${org(o)}/internal-apps/${seg(a)}`),
71
+ saveInternalApp: (o, a, definition, by) => call("PUT", `${org(o)}/internal-apps/${seg(a)}`, {
72
+ definition,
73
+ by,
74
+ }),
75
+ deleteInternalApp: (o, a, by) => call("DELETE", `${org(o)}/internal-apps/${seg(a)}`, { by }),
76
+ draftInternalApp: (body) => call("POST", "/internal-apps/draft", body),
67
77
  providers: () => call("GET", "/providers"),
68
78
  providerConnections: (o) => call("GET", `${org(o)}/providers`),
69
79
  connectProvider: (o, p, body) => call("PUT", provider(o, p), body),
@@ -197,7 +207,7 @@ export function createClient(options) {
197
207
  async appStates(o, connectors, connections) {
198
208
  const apps = connectors.map((connector) => {
199
209
  const connection = connections.find((c) => c.connectorId === connector.id) ?? null;
200
- const liveSteps = chosenSteps(connector, [...connector.setup, ...connector.afterConnect], connection?.config ?? {}).filter((s) => s.live);
210
+ const liveSteps = chosenSteps(connector, [...connector.setup, ...connector.afterConnect], connection?.config ?? {}, connection?.capabilities ?? []).filter((s) => s.live);
201
211
  return { connector, connection, liveSteps };
202
212
  });
203
213
  const liveSteps = apps.flatMap((a) => a.liveSteps);