@bakers-build/addon-remote-drupal 0.8.0 → 0.8.1-next.2

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.
@@ -39,6 +39,8 @@ export declare class DrupalBbRemote implements BbRemote {
39
39
  siteTools?: SiteToolClient;
40
40
  constructor(api: JsonApiClient, selection?: BbProjectSelection | undefined, resolvedProjectId?: string | undefined, fetchRunLog?: RunLogFetcher);
41
41
  fetchActiveRuns(id: string): Promise<ActiveRun[]>;
42
+ /** Through the site's `bakers_comment_publish`, which throws on a tool error. */
43
+ publishTicketComment(ticketUuid: string, body: string): Promise<void>;
42
44
  activeRunCount(id: string): Promise<number>;
43
45
  machineCapacity(hostKey: string): Promise<{
44
46
  maxParallel: number;
@@ -67,6 +69,7 @@ export declare class DrupalBbRemote implements BbRemote {
67
69
  listConductors(owner?: 'me'): Promise<ConductorStatus[]>;
68
70
  markRunning(uuid: string, attrs?: RunWriteAttributes): Promise<void>;
69
71
  markFailed(uuid: string, errorLog: string): Promise<void>;
72
+ cancelRun(uuid: string): Promise<void>;
70
73
  fetchFinalizableRuns(id: string): Promise<FinalizableRun[]>;
71
74
  private finalizableRunsInState;
72
75
  finalizeRun(uuid: string, log: string, metrics?: RunMetrics): Promise<void>;
package/dist/src/index.js CHANGED
@@ -76,19 +76,37 @@ export class DrupalBbRemote {
76
76
  .collection('bb_run')
77
77
  .where('conductor_id.conductor_id', '=', id)
78
78
  .whereIn('state', ACTIVE)
79
- .fields(['state', 'state_at_start', 'worktree_path'])
79
+ .fields([
80
+ 'state',
81
+ 'state_at_start',
82
+ 'worktree_path',
83
+ 'drupal_internal__id',
84
+ 'agent',
85
+ ])
80
86
  .page(100)
81
87
  .list();
82
88
  return Promise.all(rows.map(async (r) => ({
83
89
  runUuid: r.id,
90
+ runId: Number(r.attr('drupal_internal__id')),
84
91
  ticketUuid: r.rel('ticket_id') ?? '',
85
92
  ticketIdentifier: await this.getRunTicketIdentifier(r.id),
86
93
  branchName: await this.getRunTicketBranchName(r.id),
87
94
  state: r.attr('state') ?? '',
88
95
  stateAtStart: r.attr('state_at_start') ?? '',
89
96
  worktreePath: r.attr('worktree_path') ?? '',
97
+ agent: r.attr('agent') ?? '',
90
98
  })));
91
99
  }
100
+ /** Through the site's `bakers_comment_publish`, which throws on a tool error. */
101
+ async publishTicketComment(ticketUuid, body) {
102
+ if (!this.siteTools)
103
+ throw new Error('no site tools to publish a comment');
104
+ await this.siteTools.call('bakers_comment_publish', {
105
+ ticket: ticketUuid,
106
+ type: 'comment',
107
+ body,
108
+ });
109
+ }
92
110
  async activeRunCount(id) {
93
111
  // Filter on the related conductor's registration string field.
94
112
  return this.api
@@ -496,6 +514,11 @@ export class DrupalBbRemote {
496
514
  },
497
515
  });
498
516
  }
517
+ async cancelRun(uuid) {
518
+ await this.api.update('bb_run', uuid, {
519
+ attributes: { state: 'cancelled' },
520
+ });
521
+ }
499
522
  async fetchFinalizableRuns(id) {
500
523
  // `done` and `cancelled` finalise identically: stop the agent, capture its
501
524
  // transcript, then close the run's terminal tab. Two queries are used
@@ -833,7 +856,7 @@ export class DrupalBbRemote {
833
856
  }
834
857
  export function drupalRemote() {
835
858
  return {
836
- kind: 'remote',
859
+ kind: 'server',
837
860
  id: 'drupal',
838
861
  requiredModules: [],
839
862
  async createRemote(config) {
@@ -1,3 +1,3 @@
1
1
  import type { Preset } from '@bakers-build/conductor/contract';
2
- export declare const remotes: Preset['remotes'];
2
+ export declare const servers: Preset['servers'];
3
3
  export declare const scopes: Preset['scopes'];
@@ -1,4 +1,4 @@
1
1
  import { drupalRemote } from './index.js';
2
- export const remotes = (acc) => [...acc, drupalRemote()];
3
- // Conductor wiring of one project: list this addon in .bakers/conductor.config.js addons[].
2
+ export const servers = (acc) => [...acc, drupalRemote()];
3
+ // Conductor wiring of one project: list this addon in .bakers/project.config.js addons[].
4
4
  export const scopes = ['project'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-remote-drupal",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-next.2",
4
4
  "description": "bakers.build conductor remote addon: the Drupal/JSON:API control-plane remote.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,12 +24,12 @@
24
24
  "dropsh": "^0.8.2"
25
25
  },
26
26
  "peerDependencies": {
27
- "@bakers-build/conductor": "^0.8.0",
28
- "@bakers-build/core": "^0.8.0",
29
- "@bakers-build/message": "^0.8.0"
27
+ "@bakers-build/conductor": "^0.8.1-next.2",
28
+ "@bakers-build/core": "^0.8.1-next.2",
29
+ "@bakers-build/message": "^0.8.1-next.2"
30
30
  },
31
31
  "bakersBuild": {
32
- "commit": "082d8c57436f78e751f5a9a26a4446cec42209ce",
33
- "channel": "latest"
32
+ "commit": "0177880667693d1c36c65ffced82d2f3a17cbf2a",
33
+ "channel": "next"
34
34
  }
35
35
  }