@boboddy/sdk 0.1.0-alpha → 0.1.2-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.
@@ -1 +1,2 @@
1
1
  export * from "./define-pipeline";
2
+ export * from "./pipeline-definitions-client";
@@ -132,10 +132,52 @@ function definePipeline(config) {
132
132
  }))
133
133
  };
134
134
  }
135
+ // src/definitions/pipelines/pipeline-definitions-client.ts
136
+ function createPipelineDefinitionsClient(baseUrl) {
137
+ const base = baseUrl.replace(/\/$/, "");
138
+ async function doFetch(path, method, headers, body) {
139
+ const requestHeaders = { ...headers };
140
+ if (body !== undefined) {
141
+ requestHeaders["Content-Type"] = "application/json";
142
+ }
143
+ const response = await fetch(`${base}${path}`, {
144
+ method,
145
+ headers: requestHeaders,
146
+ ...body !== undefined ? { body: JSON.stringify(body) } : {}
147
+ });
148
+ if (!response.ok) {
149
+ const err = await response.json().catch(() => null);
150
+ throw new Error(err?.title ?? `HTTP ${String(response.status)} ${method} ${path}`);
151
+ }
152
+ return response.json().catch(() => null);
153
+ }
154
+ return buildPipelineDefinitionsClient(base, doFetch);
155
+ }
156
+ var buildPipelineDefinitionsClient = (_base, doFetch) => ({
157
+ listByProjectId: async (projectId, options) => {
158
+ const path = `/api/linear-pipeline-definitions?projectId=${encodeURIComponent(projectId)}`;
159
+ const result = await doFetch(path, "GET", options?.headers ?? {});
160
+ return result ?? [];
161
+ },
162
+ create: async (body, options) => {
163
+ const result = await doFetch("/api/linear-pipeline-definitions", "POST", options?.headers ?? {}, body);
164
+ return result;
165
+ },
166
+ update: async (pipelineId, body, options) => {
167
+ await doFetch(`/api/linear-pipeline-definitions/${pipelineId}`, "PUT", options?.headers ?? {}, body);
168
+ },
169
+ addStep: async (pipelineId, body, options) => {
170
+ await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps`, "POST", options?.headers ?? {}, body);
171
+ },
172
+ removeStep: async (pipelineId, stepId, options) => {
173
+ await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps/${stepId}`, "DELETE", options?.headers ?? {});
174
+ }
175
+ });
135
176
  export {
136
177
  stepOutput,
137
178
  fromSignal,
138
179
  fromPipelineInput,
139
180
  definePipeline,
181
+ createPipelineDefinitionsClient,
140
182
  Rule
141
183
  };
@@ -0,0 +1,56 @@
1
+ import type { SerializedAdvancementPolicy } from "../advancement-policies/define-advancement-policy";
2
+ type RequestOptions = {
3
+ headers?: Record<string, unknown>;
4
+ };
5
+ export type PipelineStepCreateInput = {
6
+ stepDefinitionId: string;
7
+ stepDefinitionVersion: number;
8
+ key: string;
9
+ name: string;
10
+ description: string | null;
11
+ position: number;
12
+ inputBindingsJson: Record<string, unknown>;
13
+ timeoutSeconds: number | null;
14
+ retryPolicyJson: null;
15
+ advancementPolicyDefinition: SerializedAdvancementPolicy;
16
+ };
17
+ export type CreatePipelineInput = {
18
+ projectId: string;
19
+ key: string;
20
+ name: string;
21
+ description: string | null;
22
+ version: number;
23
+ status: "draft" | "active" | "archived";
24
+ stepDefinitions: PipelineStepCreateInput[];
25
+ };
26
+ export type UpdatePipelineInput = {
27
+ projectId: string;
28
+ key: string;
29
+ name: string;
30
+ description: string | null;
31
+ version: number;
32
+ status: "draft" | "active" | "archived";
33
+ };
34
+ export type ExistingPipelineStep = {
35
+ id: string;
36
+ key: string;
37
+ };
38
+ export type ExistingPipeline = {
39
+ id: string;
40
+ key: string;
41
+ version: number;
42
+ status: string;
43
+ steps: ExistingPipelineStep[];
44
+ };
45
+ export declare function createPipelineDefinitionsClient(baseUrl: string): ReturnType<typeof buildPipelineDefinitionsClient>;
46
+ declare const buildPipelineDefinitionsClient: (_base: string, doFetch: (path: string, method: string, headers: Record<string, string>, body?: unknown) => Promise<unknown>) => {
47
+ listByProjectId: (projectId: string, options?: RequestOptions) => Promise<ExistingPipeline[]>;
48
+ create: (body: CreatePipelineInput, options?: RequestOptions) => Promise<{
49
+ id: string;
50
+ key: string;
51
+ }>;
52
+ update: (pipelineId: string, body: UpdatePipelineInput, options?: RequestOptions) => Promise<void>;
53
+ addStep: (pipelineId: string, body: PipelineStepCreateInput, options?: RequestOptions) => Promise<void>;
54
+ removeStep: (pipelineId: string, stepId: string, options?: RequestOptions) => Promise<void>;
55
+ };
56
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { ZodType } from "zod";
2
+ import type { AnyStepFeature, FeatureResultExtensions, FeatureSignalKeys } from "./step-features";
2
3
  type OpenCodeMcpServers = Record<string, {
3
4
  type: "local";
4
5
  command: string[];
@@ -59,6 +60,7 @@ export type DefineStepInput<TInput extends ZodType = ZodType, TResult extends Zo
59
60
  result?: TResult;
60
61
  signals?: SignalSpecInput<TResult["_output"]>[];
61
62
  computedSignals?: StepComputedSignalSpec[];
63
+ features?: AnyStepFeature[];
62
64
  mcpServers?: OpenCodeMcpServers | null;
63
65
  status?: "draft" | "active";
64
66
  };
@@ -99,7 +101,8 @@ type ExtractSignalKey<T> = T extends {
99
101
  sourcePath: infer S extends string;
100
102
  } ? S : string;
101
103
  export type SignalKeysOf<TSignals extends readonly unknown[]> = TSignals extends readonly (infer S)[] ? ExtractSignalKey<S> : string;
102
- export declare function defineStep<TInput extends ZodType = ZodType, TResult extends ZodType = ZodType, const TSignals extends ReadonlyArray<SignalSpecInput<TResult["_output"]>> = never[]>(config: Omit<DefineStepInput<TInput, TResult>, "signals"> & {
104
+ export declare function defineStep<TInput extends ZodType = ZodType, TResult extends ZodType = ZodType, const TSignals extends ReadonlyArray<SignalSpecInput<TResult["_output"]>> = never[], const TFeatures extends ReadonlyArray<AnyStepFeature> = never[]>(config: Omit<DefineStepInput<TInput, TResult>, "signals" | "features"> & {
103
105
  signals?: TSignals;
104
- }): TypedStepDefinitionSpec<TInput["_output"], TResult["_output"], SignalKeysOf<TSignals>>;
106
+ features?: TFeatures;
107
+ }): TypedStepDefinitionSpec<TInput["_output"], TResult["_output"] & FeatureResultExtensions<TFeatures>, SignalKeysOf<TSignals> | FeatureSignalKeys<TFeatures>>;
105
108
  export {};
@@ -1,2 +1,3 @@
1
1
  export * from "./define-step";
2
2
  export * from "./step-definitions-client";
3
+ export * from "./step-features";