@hyperdrive.bot/fleet-client 0.3.211 → 0.3.212

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.
@@ -491,6 +491,15 @@ export type SourceAccountsPayload = Extract<SessionOutboundMessage, {
491
491
  export type SourceAssignPayload = Extract<SessionOutboundMessage, {
492
492
  type: "source/assign/response";
493
493
  }>["payload"];
494
+ export type SourceAddCustomPayload = Extract<SessionOutboundMessage, {
495
+ type: "source/add-custom/response";
496
+ }>["payload"];
497
+ export type SourceTestCustomPayload = Extract<SessionOutboundMessage, {
498
+ type: "source/test-custom/response";
499
+ }>["payload"];
500
+ export type SourceSetSecretPayload = Extract<SessionOutboundMessage, {
501
+ type: "source/set-secret/response";
502
+ }>["payload"];
494
503
  export type SourceItemsPayload = Extract<SessionOutboundMessage, {
495
504
  type: "source/items/response";
496
505
  }>["payload"];
@@ -753,6 +762,26 @@ export interface SourceAssignOptions {
753
762
  accountId: string;
754
763
  requestId?: string;
755
764
  }
765
+ /** An HTTPS API to add or test as a custom source. */
766
+ export interface SourceCustomApiOptions {
767
+ appSlug: "gitlab" | "github" | "jira" | "generic";
768
+ baseUrl: string;
769
+ auth: {
770
+ scheme: "none";
771
+ } | {
772
+ scheme: "bearer";
773
+ } | {
774
+ scheme: "basic";
775
+ } | {
776
+ scheme: "header";
777
+ name: string;
778
+ };
779
+ /** A generic API's probe path, relative to `baseUrl`. */
780
+ probePath?: string;
781
+ /** Write-only: the daemon keeps it and no response ever carries it back. */
782
+ secret?: string | null;
783
+ requestId?: string;
784
+ }
756
785
  export interface SourceItemsOptions {
757
786
  sourceId: string;
758
787
  /** Epoch ms, inclusive. Nothing older comes back. */
@@ -1646,6 +1675,21 @@ export declare class DaemonClient {
1646
1675
  sourceAccounts(options: SourceAccountsOptions): Promise<SourceAccountsPayload>;
1647
1676
  /** Point a source at one of those accounts. A refusal comes back as `reason`. */
1648
1677
  sourceAssign(options: SourceAssignOptions): Promise<SourceAssignPayload>;
1678
+ /**
1679
+ * Add an HTTPS API as a custom source. Gated on the daemon's
1680
+ * `sourceCustomApi` feature by the caller. A refusal comes back as `reason`.
1681
+ */
1682
+ sourceAddCustom(options: SourceCustomApiOptions & {
1683
+ nickname?: string | null;
1684
+ }): Promise<SourceAddCustomPayload>;
1685
+ /** Probe a custom API without saving anything. */
1686
+ sourceTestCustom(options: SourceCustomApiOptions): Promise<SourceTestCustomPayload>;
1687
+ /** Replace a custom source's saved credential. Write-only, like every credential here. */
1688
+ sourceSetSecret(options: {
1689
+ sourceId: string;
1690
+ secret: string;
1691
+ requestId?: string;
1692
+ }): Promise<SourceSetSecretPayload>;
1649
1693
  /**
1650
1694
  * The recent items of one source, payloads included. Read-only: the daemon
1651
1695
  * side creates, writes, arms and spawns nothing.
@@ -253,6 +253,16 @@ function toReasonCode(reason) {
253
253
  }
254
254
  return "unknown";
255
255
  }
256
+ /** The wire fields of a custom API description, without the client-only `requestId`. */
257
+ function customApiMessageFields(options) {
258
+ return {
259
+ appSlug: options.appSlug,
260
+ baseUrl: options.baseUrl,
261
+ auth: options.auth,
262
+ ...(options.probePath === undefined ? {} : { probePath: options.probePath }),
263
+ ...(options.secret === undefined ? {} : { secret: options.secret }),
264
+ };
265
+ }
256
266
  export class DaemonClient {
257
267
  constructor(config) {
258
268
  this.config = config;
@@ -4519,6 +4529,37 @@ export class DaemonClient {
4519
4529
  responseType: "source/assign/response",
4520
4530
  });
4521
4531
  }
4532
+ /**
4533
+ * Add an HTTPS API as a custom source. Gated on the daemon's
4534
+ * `sourceCustomApi` feature by the caller. A refusal comes back as `reason`.
4535
+ */
4536
+ async sourceAddCustom(options) {
4537
+ return this.sendCorrelatedSessionRequest({
4538
+ requestId: options.requestId,
4539
+ message: {
4540
+ type: "source/add-custom",
4541
+ ...customApiMessageFields(options),
4542
+ ...(options.nickname === undefined ? {} : { nickname: options.nickname }),
4543
+ },
4544
+ responseType: "source/add-custom/response",
4545
+ });
4546
+ }
4547
+ /** Probe a custom API without saving anything. */
4548
+ async sourceTestCustom(options) {
4549
+ return this.sendCorrelatedSessionRequest({
4550
+ requestId: options.requestId,
4551
+ message: { type: "source/test-custom", ...customApiMessageFields(options) },
4552
+ responseType: "source/test-custom/response",
4553
+ });
4554
+ }
4555
+ /** Replace a custom source's saved credential. Write-only, like every credential here. */
4556
+ async sourceSetSecret(options) {
4557
+ return this.sendCorrelatedSessionRequest({
4558
+ requestId: options.requestId,
4559
+ message: { type: "source/set-secret", sourceId: options.sourceId, secret: options.secret },
4560
+ responseType: "source/set-secret/response",
4561
+ });
4562
+ }
4522
4563
  /**
4523
4564
  * The recent items of one source, payloads included. Read-only: the daemon
4524
4565
  * side creates, writes, arms and spawns nothing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperdrive.bot/fleet-client",
3
- "version": "0.3.211",
3
+ "version": "0.3.212",
4
4
  "description": "Paseo client SDK package",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -34,8 +34,8 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@hyperdrive.bot/fleet-protocol": "0.3.211",
38
- "@hyperdrive.bot/fleet-relay": "0.3.211",
37
+ "@hyperdrive.bot/fleet-protocol": "0.3.212",
38
+ "@hyperdrive.bot/fleet-relay": "0.3.212",
39
39
  "zod": "^4.4.3"
40
40
  },
41
41
  "devDependencies": {