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

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/steps.d.ts CHANGED
@@ -17,8 +17,10 @@ export declare function choiceValues(connector: {
17
17
  export declare const isChosen: (option: ChosenOption | undefined, chosen: Record<string, string>) => boolean;
18
18
  /** The choice fields shown: one that `requires` an earlier choice only while it is made. */
19
19
  export declare const askedFields: (fields: Field[], values: Record<string, string>) => Field[];
20
- /** The steps that apply under the chosen options (a step with `option` only while chosen). */
21
- export declare function chosenSteps(connector: Connector, steps: Step[], values: Record<string, string>): Step[];
20
+ /** The steps that apply under the chosen options (a step with `option` only while chosen)
21
+ * and, given `ticked`, the ticked capabilities (a step with `capabilities` only while one of
22
+ * them is). */
23
+ export declare function chosenSteps(connector: Connector, steps: Step[], values: Record<string, string>, ticked?: readonly string[]): Step[];
22
24
  /** Choices that change the permissions the setup steps ask for: made in step 1, with what
23
25
  * agents may do, so the steps after it already show those permissions. */
24
26
  export declare function permissionChoices(connector: Connector): Field[];
@@ -39,6 +41,12 @@ export declare function keyApps(agent: Agent, connectors: Connector[]): Connecto
39
41
  export declare function keysUsing(agents: Agent[], connectorId: string): number;
40
42
  /** The values a connected app reported for its discover probe, e.g. Jira project keys. */
41
43
  export declare function discovered(connector: Connector, checks: Check[] | null): string[];
44
+ /** The same, each with the label to show for it (the value itself when the app gave none),
45
+ * e.g. a NetSuite subsidiary's name for its id. */
46
+ export declare function discoveredChoices(connector: Connector, checks: Check[] | null): {
47
+ value: string;
48
+ label: string;
49
+ }[];
42
50
  /** Parses free-typed list input ("KAN, SAM1") into values. */
43
51
  export declare function splitList(raw: string): string[];
44
52
  /** Shown under Click through for a step the vendor offers only as commands. */
@@ -211,6 +219,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
211
219
  field: string;
212
220
  value: string;
213
221
  };
222
+ capabilities?: string[];
214
223
  }[];
215
224
  afterConnect: {
216
225
  title: string;
@@ -240,6 +249,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
240
249
  field: string;
241
250
  value: string;
242
251
  };
252
+ capabilities?: string[];
243
253
  }[];
244
254
  fields: {
245
255
  id: string;
@@ -257,6 +267,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
257
267
  field: string;
258
268
  value: string;
259
269
  };
270
+ optional: boolean;
260
271
  }[];
261
272
  capabilities: {
262
273
  id: string;
@@ -340,6 +351,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
340
351
  path: string;
341
352
  label: string;
342
353
  show: string;
354
+ name?: string;
343
355
  match?: {
344
356
  [key: string]: string | number | boolean;
345
357
  };
@@ -357,6 +369,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
357
369
  path: string;
358
370
  label: string;
359
371
  show: string;
372
+ name?: string;
360
373
  match?: {
361
374
  [key: string]: string | number | boolean;
362
375
  };
@@ -372,6 +385,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
372
385
  revoke: string;
373
386
  http?: {
374
387
  baseUrl: string;
388
+ allowedHosts?: string[];
375
389
  auth: {
376
390
  type: "header";
377
391
  header: string;
@@ -390,6 +404,8 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
390
404
  clientId: string;
391
405
  clientSecret: string;
392
406
  scope?: string;
407
+ clientAuth?: "body" | "basic";
408
+ audience?: string;
393
409
  } | {
394
410
  type: "query";
395
411
  param: string;
@@ -398,6 +414,9 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
398
414
  headers: {
399
415
  [key: string]: string;
400
416
  };
417
+ fieldHeaders: {
418
+ [key: string]: string;
419
+ };
401
420
  tools: {
402
421
  name: string;
403
422
  description: string;
@@ -497,6 +516,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
497
516
  };
498
517
  odata?: {
499
518
  serviceRoot: string;
519
+ allowedHosts?: string[];
500
520
  version: "2" | "4";
501
521
  auth: {
502
522
  type: "header";
@@ -516,6 +536,8 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
516
536
  clientId: string;
517
537
  clientSecret: string;
518
538
  scope?: string;
539
+ clientAuth?: "body" | "basic";
540
+ audience?: string;
519
541
  } | {
520
542
  type: "query";
521
543
  param: string;
@@ -712,7 +734,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
712
734
  deliveryId: string[];
713
735
  types: {
714
736
  type: string;
715
- same?: [string, string];
737
+ since?: string;
716
738
  }[];
717
739
  };
718
740
  };
@@ -790,6 +812,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
790
812
  field: string;
791
813
  value: string;
792
814
  };
815
+ capabilities?: string[];
793
816
  }[];
794
817
  afterConnect: {
795
818
  title: string;
@@ -819,6 +842,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
819
842
  field: string;
820
843
  value: string;
821
844
  };
845
+ capabilities?: string[];
822
846
  }[];
823
847
  fields: {
824
848
  id: string;
@@ -836,6 +860,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
836
860
  field: string;
837
861
  value: string;
838
862
  };
863
+ optional: boolean;
839
864
  }[];
840
865
  capabilities: {
841
866
  id: string;
@@ -919,6 +944,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
919
944
  path: string;
920
945
  label: string;
921
946
  show: string;
947
+ name?: string;
922
948
  match?: {
923
949
  [key: string]: string | number | boolean;
924
950
  };
@@ -936,6 +962,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
936
962
  path: string;
937
963
  label: string;
938
964
  show: string;
965
+ name?: string;
939
966
  match?: {
940
967
  [key: string]: string | number | boolean;
941
968
  };
@@ -951,6 +978,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
951
978
  revoke: string;
952
979
  http?: {
953
980
  baseUrl: string;
981
+ allowedHosts?: string[];
954
982
  auth: {
955
983
  type: "header";
956
984
  header: string;
@@ -969,6 +997,8 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
969
997
  clientId: string;
970
998
  clientSecret: string;
971
999
  scope?: string;
1000
+ clientAuth?: "body" | "basic";
1001
+ audience?: string;
972
1002
  } | {
973
1003
  type: "query";
974
1004
  param: string;
@@ -977,6 +1007,9 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
977
1007
  headers: {
978
1008
  [key: string]: string;
979
1009
  };
1010
+ fieldHeaders: {
1011
+ [key: string]: string;
1012
+ };
980
1013
  tools: {
981
1014
  name: string;
982
1015
  description: string;
@@ -1076,6 +1109,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
1076
1109
  };
1077
1110
  odata?: {
1078
1111
  serviceRoot: string;
1112
+ allowedHosts?: string[];
1079
1113
  version: "2" | "4";
1080
1114
  auth: {
1081
1115
  type: "header";
@@ -1095,6 +1129,8 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
1095
1129
  clientId: string;
1096
1130
  clientSecret: string;
1097
1131
  scope?: string;
1132
+ clientAuth?: "body" | "basic";
1133
+ audience?: string;
1098
1134
  } | {
1099
1135
  type: "query";
1100
1136
  param: string;
@@ -1291,7 +1327,7 @@ export declare function newKeySetup(ticked: Connector[], providers: Provider[]):
1291
1327
  deliveryId: string[];
1292
1328
  types: {
1293
1329
  type: string;
1294
- same?: [string, string];
1330
+ since?: string;
1295
1331
  }[];
1296
1332
  };
1297
1333
  };
package/lib/steps.js CHANGED
@@ -37,10 +37,13 @@ export const askedFields = (fields, values) => {
37
37
  const chosen = choiceValues({ fields }, values);
38
38
  return fields.filter((f) => isChosen(f.requires, chosen));
39
39
  };
40
- /** The steps that apply under the chosen options (a step with `option` only while chosen). */
41
- export function chosenSteps(connector, steps, values) {
40
+ /** The steps that apply under the chosen options (a step with `option` only while chosen)
41
+ * and, given `ticked`, the ticked capabilities (a step with `capabilities` only while one of
42
+ * them is). */
43
+ export function chosenSteps(connector, steps, values, ticked) {
42
44
  const chosen = choiceValues(connector, values);
43
- return steps.filter((s) => isChosen(s.option, chosen));
45
+ return steps.filter((s) => isChosen(s.option, chosen) &&
46
+ (!ticked || !s.capabilities || s.capabilities.some((c) => ticked.includes(c))));
44
47
  }
45
48
  /** Choices that change the permissions the setup steps ask for: made in step 1, with what
46
49
  * agents may do, so the steps after it already show those permissions. */
@@ -83,9 +86,15 @@ export function keysUsing(agents, connectorId) {
83
86
  }
84
87
  /** The values a connected app reported for its discover probe, e.g. Jira project keys. */
85
88
  export function discovered(connector, checks) {
89
+ return discoveredChoices(connector, checks).map((c) => c.value);
90
+ }
91
+ /** The same, each with the label to show for it (the value itself when the app gave none),
92
+ * e.g. a NetSuite subsidiary's name for its id. */
93
+ export function discoveredChoices(connector, checks) {
86
94
  if (!connector.discover || !checks)
87
95
  return [];
88
- return checks.find((c) => c.label === connector.discover.label)?.values ?? [];
96
+ const check = checks.find((c) => c.label === connector.discover.label);
97
+ return (check?.values ?? []).map((value) => ({ value, label: check?.labels?.[value] ?? value }));
89
98
  }
90
99
  /** Parses free-typed list input ("KAN, SAM1") into values. */
91
100
  export function splitList(raw) {
@@ -505,8 +514,8 @@ const numbered = (ns) => ns.length === 1
505
514
  : `steps ${ns.slice(0, -1).join(", ")} and ${ns[ns.length - 1]}`;
506
515
  export function appSteps(input) {
507
516
  const { connector, connection, health, ceiling, marks } = input;
508
- const setup = chosenSteps(connector, connector.setup, input.choices ?? {});
509
- const afterConnect = chosenSteps(connector, connector.afterConnect, input.choices ?? {});
517
+ const setup = chosenSteps(connector, connector.setup, input.choices ?? {}, ceiling);
518
+ const afterConnect = chosenSteps(connector, connector.afterConnect, input.choices ?? {}, ceiling);
510
519
  const on = connection !== null;
511
520
  const changed = on && connection.capabilities.join(",") !== ceiling.join(",");
512
521
  const before = input.providerReady ? {} : { locked: true };
package/lib/types.d.ts CHANGED
@@ -47,11 +47,14 @@ export type EventTriggerInput = Body<"setEventTrigger">;
47
47
  export type EventRun = S["EventRun"];
48
48
  export type ClaudeKey = S["ClaudeKey"];
49
49
  export type ClaudeAgent = S["ClaudeAgent"];
50
+ export type InternalApp = S["InternalApp"];
51
+ export type InternalAppSaved = S["InternalAppSaved"];
52
+ export type InternalAppDraft = S["InternalAppDraft"];
50
53
  export type Step = Connector["setup"][number];
51
54
  export type AgentStep = Provider["addAgent"][number];
52
55
  export type Setting = NonNullable<Step["settings"]>[number];
53
56
  export type ChosenOption = NonNullable<Step["option"]>;
54
- /** A connect form field; a provider's may be left empty (`optional`). */
57
+ /** A connect form field; an `optional` one may be left empty. */
55
58
  export type Field = Connector["fields"][number] & {
56
59
  optional?: boolean;
57
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbium/enterprise-agent-connect-client",
3
- "version": "0.1.2-dev.d2aa5ca",
3
+ "version": "0.2.1-dev.7b4e802",
4
4
  "description": "Typed client for the Agent Connect admin API (v1), and the pure logic admin pages share",
5
5
  "type": "module",
6
6
  "exports": {