@boboddy/sdk 0.1.44-alpha → 0.2.1-alpha

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/client.js CHANGED
@@ -864,15 +864,6 @@ class Api extends HeyApiClient {
864
864
  "allApiAuth*8"(options) {
865
865
  return (options?.client ?? this.client).trace({ url: "/api/auth/*", ...options });
866
866
  }
867
- getApiIntegrationsGithubInstall(options) {
868
- return (options?.client ?? this.client).get({ url: "/api/integrations/github/install", ...options });
869
- }
870
- getApiIntegrationsGithubCallback(options) {
871
- return (options?.client ?? this.client).get({ url: "/api/integrations/github/callback", ...options });
872
- }
873
- postApiIntegrationsGithubWebhook(options) {
874
- return (options?.client ?? this.client).post({ url: "/api/integrations/github/webhook", ...options });
875
- }
876
867
  }
877
868
 
878
869
  class Projects extends HeyApiClient {
@@ -1018,6 +1009,22 @@ class StepExecutions extends HeyApiClient {
1018
1009
  getStepExecution(options) {
1019
1010
  return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1020
1011
  }
1012
+ readStepExecutionLogs(options) {
1013
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
1014
+ }
1015
+ appendStepExecutionLogs(options) {
1016
+ return (options.client ?? this.client).post({
1017
+ url: "/api/step-executions/{stepExecutionId}/logs",
1018
+ ...options,
1019
+ headers: {
1020
+ "Content-Type": "application/json",
1021
+ ...options.headers
1022
+ }
1023
+ });
1024
+ }
1025
+ getStepExecutionLogArchive(options) {
1026
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
1027
+ }
1021
1028
  }
1022
1029
 
1023
1030
  class PipelineDefinitions extends HeyApiClient {
@@ -1233,12 +1240,41 @@ class ProjectContext extends HeyApiClient {
1233
1240
  }
1234
1241
  }
1235
1242
 
1236
- class FeedbackRequests extends HeyApiClient {
1237
- listFeedbackRequests(options) {
1238
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/step-signals/{stepSignalId}/feedback-requests", ...options });
1243
+ class UserNotifications extends HeyApiClient {
1244
+ listUserNotifications(options) {
1245
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notifications", ...options });
1246
+ }
1247
+ getUserNotification(options) {
1248
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notifications/{notificationId}", ...options });
1249
+ }
1250
+ dismissUserNotification(options) {
1251
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/notifications/{notificationId}/dismiss", ...options });
1252
+ }
1253
+ respondToFeedbackRequest(options) {
1254
+ return (options.client ?? this.client).post({
1255
+ url: "/api/projects/{projectId}/notifications/{notificationId}/respond",
1256
+ ...options,
1257
+ headers: {
1258
+ "Content-Type": "application/json",
1259
+ ...options.headers
1260
+ }
1261
+ });
1262
+ }
1263
+ }
1264
+
1265
+ class NotificationRules extends HeyApiClient {
1266
+ listNotificationRules(options) {
1267
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notification-rules", ...options });
1239
1268
  }
1240
- declineFeedbackRequest(options) {
1241
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/feedback-requests/{feedbackRequestId}/decline", ...options });
1269
+ upsertNotificationRule(options) {
1270
+ return (options.client ?? this.client).put({
1271
+ url: "/api/projects/{projectId}/notification-rules",
1272
+ ...options,
1273
+ headers: {
1274
+ "Content-Type": "application/json",
1275
+ ...options.headers
1276
+ }
1277
+ });
1242
1278
  }
1243
1279
  }
1244
1280
 
@@ -1290,6 +1326,18 @@ class ProjectIntegrations extends HeyApiClient {
1290
1326
  }
1291
1327
  }
1292
1328
 
1329
+ class GitHubIntegrations extends HeyApiClient {
1330
+ beginGitHubAppInstall(options) {
1331
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/install", ...options });
1332
+ }
1333
+ completeGitHubAppInstall(options) {
1334
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/callback", ...options });
1335
+ }
1336
+ handleGitHubWebhook(options) {
1337
+ return (options?.client ?? this.client).post({ url: "/api/integrations/github/webhook", ...options });
1338
+ }
1339
+ }
1340
+
1293
1341
  class ProjectInvites extends HeyApiClient {
1294
1342
  getProjectInviteByToken(options) {
1295
1343
  return (options.client ?? this.client).get({ url: "/api/project-invites/{token}", ...options });
@@ -1315,6 +1363,12 @@ class ProjectInvites extends HeyApiClient {
1315
1363
  }
1316
1364
  }
1317
1365
 
1366
+ class Billing extends HeyApiClient {
1367
+ getOrgUsage(options) {
1368
+ return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
1369
+ }
1370
+ }
1371
+
1318
1372
  class BoboddyClient extends HeyApiClient {
1319
1373
  static __registry = new HeyApiRegistry;
1320
1374
  constructor(args) {
@@ -1353,9 +1407,13 @@ class BoboddyClient extends HeyApiClient {
1353
1407
  get projectContext() {
1354
1408
  return this._projectContext ??= new ProjectContext({ client: this.client });
1355
1409
  }
1356
- _feedbackRequests;
1357
- get feedbackRequests() {
1358
- return this._feedbackRequests ??= new FeedbackRequests({ client: this.client });
1410
+ _userNotifications;
1411
+ get userNotifications() {
1412
+ return this._userNotifications ??= new UserNotifications({ client: this.client });
1413
+ }
1414
+ _notificationRules;
1415
+ get notificationRules() {
1416
+ return this._notificationRules ??= new NotificationRules({ client: this.client });
1359
1417
  }
1360
1418
  _stepDefinitionTemplates;
1361
1419
  get stepDefinitionTemplates() {
@@ -1365,10 +1423,18 @@ class BoboddyClient extends HeyApiClient {
1365
1423
  get projectIntegrations() {
1366
1424
  return this._projectIntegrations ??= new ProjectIntegrations({ client: this.client });
1367
1425
  }
1426
+ _gitHubIntegrations;
1427
+ get gitHubIntegrations() {
1428
+ return this._gitHubIntegrations ??= new GitHubIntegrations({ client: this.client });
1429
+ }
1368
1430
  _projectInvites;
1369
1431
  get projectInvites() {
1370
1432
  return this._projectInvites ??= new ProjectInvites({ client: this.client });
1371
1433
  }
1434
+ _billing;
1435
+ get billing() {
1436
+ return this._billing ??= new Billing({ client: this.client });
1437
+ }
1372
1438
  }
1373
1439
  // src/step-execution-plane-client.ts
1374
1440
  function createStepExecutionPlaneClient(baseUrl) {
@@ -1431,6 +1497,16 @@ var buildStepExecutionPlaneClient = (stepExecutions) => {
1431
1497
  });
1432
1498
  if (result.error)
1433
1499
  throw new Error(JSON.stringify(result.error));
1500
+ },
1501
+ appendStepExecutionLogs: async (stepExecutionId, body, options) => {
1502
+ const result = await stepExecutions.appendStepExecutionLogs({
1503
+ path: { stepExecutionId },
1504
+ body,
1505
+ headers: options?.headers
1506
+ });
1507
+ if (result.error)
1508
+ throw new Error(JSON.stringify(result.error));
1509
+ return result.data;
1434
1510
  }
1435
1511
  };
1436
1512
  };
@@ -1444,6 +1520,7 @@ export {
1444
1520
  createStepExecutionPlaneClient,
1445
1521
  createBoboddyClient,
1446
1522
  WorkItems,
1523
+ UserNotifications,
1447
1524
  StepExecutions,
1448
1525
  StepDefinitions,
1449
1526
  StepDefinitionTemplates,
@@ -1453,7 +1530,9 @@ export {
1453
1530
  ProjectContext,
1454
1531
  PipelineExecutions,
1455
1532
  PipelineDefinitions,
1456
- FeedbackRequests,
1533
+ NotificationRules,
1534
+ GitHubIntegrations,
1457
1535
  BoboddyClient,
1536
+ Billing,
1458
1537
  Api
1459
1538
  };
@@ -281,7 +281,7 @@ async function loadProjectConfig(rootDir = process.cwd()) {
281
281
  import path2 from "path";
282
282
  async function findProjectConfigUpwards(startDir) {
283
283
  let current = path2.resolve(startDir);
284
- while (true) {
284
+ for (;; ) {
285
285
  const found = await loadProjectConfig(current);
286
286
  if (found)
287
287
  return found;
@@ -294,9 +294,9 @@ async function findProjectConfigUpwards(startDir) {
294
294
  async function loadPushDefaults(opts) {
295
295
  const baseUrl = resolveBoboddyBaseUrl();
296
296
  const envProjectId = process.env["BOBODDY_PROJECT_ID"]?.trim();
297
- const projectId = envProjectId && envProjectId.length > 0 ? envProjectId : (await findProjectConfigUpwards(opts.dir))?.projectId;
297
+ const projectId = envProjectId ? envProjectId : (await findProjectConfigUpwards(opts.dir))?.projectId;
298
298
  const envAccessToken = process.env["BOBODDY_ACCESS_TOKEN"]?.trim();
299
- const accessToken = envAccessToken && envAccessToken.length > 0 ? envAccessToken : loadAuthProfile(baseUrl)?.accessToken;
299
+ const accessToken = envAccessToken ? envAccessToken : loadAuthProfile(baseUrl)?.accessToken;
300
300
  return { baseUrl, projectId, accessToken };
301
301
  }
302
302
  export {
@@ -0,0 +1,69 @@
1
+ import { z, type ZodType } from "zod";
2
+ import { type AdditionalStepInputBinding, type TypedStepDefinitionSpec } from "../steps/define-step";
3
+ import { type AnyBinding, type LiteralBinding, type StepOutputBinding, type StepSignalBinding, type WorkItemBinding } from "./define-pipeline";
4
+ import { type InputAccessor } from "./input-accessor";
5
+ export type AnyTypedStep = TypedStepDefinitionSpec<any, any, any, any>;
6
+ export type StepConfig = {
7
+ timeout?: number | null;
8
+ };
9
+ type ElementOf<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer U> ? U : never;
10
+ export type WorkItemAccessor = {
11
+ readonly title: WorkItemBinding;
12
+ readonly description: WorkItemBinding;
13
+ readonly field: (fieldName: string) => WorkItemBinding;
14
+ };
15
+ export type WithWorkItemFields<T> = {
16
+ workItemTitle: string;
17
+ workItemDescription: string | null;
18
+ } & T;
19
+ type RequiredInputKeys<T extends object> = {
20
+ [K in keyof T & string]-?: undefined extends T[K] ? never : K;
21
+ }[keyof T & string];
22
+ type OptionalInputKeys<T extends object> = {
23
+ [K in keyof T & string]-?: undefined extends T[K] ? K : never;
24
+ }[keyof T & string];
25
+ type Prettify<T> = {
26
+ [K in keyof T]: T[K];
27
+ } & {};
28
+ export type StepInputCtx<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> = {
29
+ input: InputAccessor<Prettify<WithWorkItemFields<TInput["_output"]>>>;
30
+ signal: <S extends ElementOf<TSteps>>(step: S, key: S["__signalKeys"]) => StepSignalBinding;
31
+ output: (step: ElementOf<TSteps>) => StepOutputBinding;
32
+ literal: (value: unknown) => LiteralBinding;
33
+ };
34
+ type ReservedPipelineInputKeys = "workItemTitle" | "workItemDescription";
35
+ export type NoReservedKeys<T extends ZodType> = T extends {
36
+ shape: infer Shape;
37
+ } ? [keyof Shape & ReservedPipelineInputKeys] extends [never] ? T : never : T;
38
+ export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
39
+ key: string;
40
+ name: string;
41
+ description?: string;
42
+ version?: number;
43
+ status?: "draft" | "active";
44
+ additionalPipelineInput?: {
45
+ schema: NoReservedKeys<TInput>;
46
+ bindings: (ctx: {
47
+ workItem: WorkItemAccessor;
48
+ literal: (value: unknown) => LiteralBinding;
49
+ }) => TInput["_output"] extends object ? {
50
+ [K in RequiredInputKeys<TInput["_output"]>]: AnyBinding;
51
+ } & {
52
+ [K in OptionalInputKeys<TInput["_output"]>]?: AnyBinding;
53
+ } : Partial<Record<string, AnyBinding>>;
54
+ };
55
+ additionalStepInput?: {
56
+ schema: ZodType;
57
+ bindings: (ctx: {
58
+ workItemField: (fieldName: string) => WorkItemBinding;
59
+ literal: (value: unknown) => LiteralBinding;
60
+ }) => Partial<Record<string, AdditionalStepInputBinding>>;
61
+ };
62
+ };
63
+ export declare const WORK_ITEM_ACCESSOR: WorkItemAccessor;
64
+ export declare function makeStepInputCtx<TInput extends ZodType>(inputSchema: TInput): StepInputCtx<TInput, ReadonlyArray<AnyTypedStep>>;
65
+ export declare function literal(value: unknown): LiteralBinding;
66
+ export declare function normalizeInputMapping(mapping: Record<string, AnyBinding | undefined> | undefined): Record<string, AnyBinding> | undefined;
67
+ export declare function resolveAdditionalStepInputBindings(label: "additionalStepInput", definition: PipelineMeta["additionalStepInput"] | undefined): Record<string, AnyBinding>;
68
+ export declare function mergeStepBindings(pipelineBindings: Record<string, AnyBinding>, explicitBindings: Record<string, AnyBinding> | undefined): Record<string, AnyBinding> | undefined;
69
+ export {};
@@ -1,13 +1,8 @@
1
1
  import { z, type ZodType } from "zod";
2
- import { type AdditionalStepInputBinding, type TypedStepDefinitionSpec } from "../steps/define-step";
3
2
  import { type AdvanceCtx, type AdvanceResult } from "../advancement-policies/fluent-rules";
4
- import { type AnyBinding, type LiteralBinding, type PipelineDefinitionSpec, type PipelineStepConfig, type StepOutputBinding, type StepSignalBinding, type WorkItemBinding } from "./define-pipeline";
5
- import { type InputAccessor } from "./input-accessor";
6
- type AnyTypedStep = TypedStepDefinitionSpec<any, any, any, any>;
7
- export type StepConfig = {
8
- timeout?: number | null;
9
- };
10
- type ElementOf<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer U> ? U : never;
3
+ import { type AnyBinding, type PipelineDefinitionSpec, type PipelineStepConfig } from "./define-pipeline";
4
+ import { type AnyTypedStep, type PipelineMeta, type StepConfig, type StepInputCtx } from "./builder-helpers";
5
+ export type { AnyTypedStep, PipelineMeta, StepConfig, StepInputCtx, WorkItemAccessor, } from "./builder-helpers";
11
6
  type LastStep<T extends ReadonlyArray<AnyTypedStep>> = T extends readonly [
12
7
  ...AnyTypedStep[],
13
8
  infer L
@@ -15,9 +10,6 @@ type LastStep<T extends ReadonlyArray<AnyTypedStep>> = T extends readonly [
15
10
  type LastSignalKeys<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalKeys"] : never;
16
11
  type LastSignalTypeMap<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalTypeMap"] : Record<string, unknown>;
17
12
  type IsAny<T> = 0 extends 1 & T ? true : false;
18
- type Prettify<T> = {
19
- [K in keyof T]: T[K];
20
- } & {};
21
13
  type RequiredInputKeys<T extends object> = {
22
14
  [K in keyof T & string]-?: undefined extends T[K] ? never : K;
23
15
  }[keyof T & string];
@@ -29,50 +21,6 @@ type StepInputMapping<S extends AnyTypedStep> = IsAny<S["__inputType"]> extends
29
21
  } & {
30
22
  [K in OptionalInputKeys<S["__inputType"]>]?: AnyBinding;
31
23
  } : Partial<Record<string, AnyBinding>>;
32
- export type WorkItemAccessor = {
33
- readonly title: WorkItemBinding;
34
- readonly description: WorkItemBinding;
35
- readonly field: (fieldName: string) => WorkItemBinding;
36
- };
37
- type WithWorkItemFields<T> = {
38
- workItemTitle: string;
39
- workItemDescription: string | null;
40
- } & T;
41
- export type StepInputCtx<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> = {
42
- input: InputAccessor<Prettify<WithWorkItemFields<TInput["_output"]>>>;
43
- signal: <S extends ElementOf<TSteps>>(step: S, key: S["__signalKeys"]) => StepSignalBinding;
44
- output: <S extends ElementOf<TSteps>>(step: S) => StepOutputBinding;
45
- literal: (value: unknown) => LiteralBinding;
46
- };
47
- type ReservedPipelineInputKeys = "workItemTitle" | "workItemDescription";
48
- type NoReservedKeys<T extends ZodType> = T extends {
49
- shape: infer Shape;
50
- } ? [string & keyof Shape & ReservedPipelineInputKeys] extends [never] ? T : never : T;
51
- export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
52
- key: string;
53
- name: string;
54
- description?: string;
55
- version?: number;
56
- status?: "draft" | "active";
57
- additionalPipelineInput?: {
58
- schema: NoReservedKeys<TInput>;
59
- bindings: (ctx: {
60
- workItem: WorkItemAccessor;
61
- literal: (value: unknown) => LiteralBinding;
62
- }) => TInput["_output"] extends object ? {
63
- [K in RequiredInputKeys<TInput["_output"]>]: AnyBinding;
64
- } & {
65
- [K in OptionalInputKeys<TInput["_output"]>]?: AnyBinding;
66
- } : Partial<Record<string, AnyBinding>>;
67
- };
68
- additionalStepInput?: {
69
- schema: ZodType;
70
- bindings: (ctx: {
71
- workItemField: (fieldName: string) => WorkItemBinding;
72
- literal: (value: unknown) => LiteralBinding;
73
- }) => Partial<Record<string, AdditionalStepInputBinding>>;
74
- };
75
- };
76
24
  /**
77
25
  * Returned by `.step()`. Requires `.advance()` before the pipeline can
78
26
  * continue. Also accepts `.timeout()` before `.advance()`.
@@ -122,6 +70,5 @@ export declare class PipelineBuilder<TInput extends ZodType> {
122
70
  }>(step: S, mapper?: (ctx: StepInputCtx<TInput, []>) => Partial<Record<string, AnyBinding>>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [S]>;
123
71
  step<S extends AnyTypedStep>(step: S, mapper: (ctx: StepInputCtx<TInput, []>) => StepInputMapping<S>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [S]>;
124
72
  }
125
- export declare function literal(value: unknown): LiteralBinding;
73
+ export { literal } from "./builder-helpers";
126
74
  export declare function pipeline<TInput extends ZodType = z.ZodUnknown>(meta: PipelineMeta<TInput>): PipelineBuilder<TInput>;
127
- export {};