@boboddy/sdk 0.1.13-alpha → 0.1.14-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.
@@ -919,19 +919,62 @@ export type PostApiStepDefinitionsResponses = {
919
919
  };
920
920
  };
921
921
  export type PostApiStepDefinitionsResponse = PostApiStepDefinitionsResponses[keyof PostApiStepDefinitionsResponses];
922
- export type GetApiStepDefinitionsByStepDefinitionIdData = {
923
- body?: never;
924
- path: {
925
- stepDefinitionId: string;
922
+ export type PutApiStepDefinitionsData = {
923
+ body: {
924
+ projectId: string;
925
+ key: string;
926
+ name: string;
927
+ description: string | unknown;
928
+ prompt: string | unknown;
929
+ version: number;
930
+ kind: 'built_in' | 'user_defined';
931
+ inputSchemaJson: unknown;
932
+ resultSchemaJson: unknown;
933
+ opencodeMcpJson?: {
934
+ [key: string]: {
935
+ type: string;
936
+ command: Array<string>;
937
+ environment?: {
938
+ [key: string]: string;
939
+ };
940
+ enabled?: boolean;
941
+ timeout?: number;
942
+ } | {
943
+ type: string;
944
+ url: string;
945
+ enabled?: boolean;
946
+ headers?: {
947
+ [key: string]: string;
948
+ };
949
+ oauth?: {
950
+ clientId?: string;
951
+ clientSecret?: string;
952
+ scope?: string;
953
+ redirectUri?: string;
954
+ } | boolean;
955
+ timeout?: number;
956
+ } | {
957
+ enabled: boolean;
958
+ };
959
+ } | unknown;
960
+ status: 'draft' | 'active' | 'archived';
961
+ signalExtractorDefinitions: Array<{
962
+ key: string;
963
+ sourcePath: string;
964
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
965
+ required: boolean;
966
+ availableWhenResultStatusIn: Array<string> | unknown;
967
+ }>;
926
968
  };
969
+ path?: never;
927
970
  query?: never;
928
- url: '/api/step-definitions/{stepDefinitionId}';
971
+ url: '/api/step-definitions';
929
972
  };
930
- export type GetApiStepDefinitionsByStepDefinitionIdErrors = {
973
+ export type PutApiStepDefinitionsErrors = {
931
974
  /**
932
- * Response for status 401
975
+ * Response for status 400
933
976
  */
934
- 401: {
977
+ 400: {
935
978
  type: string;
936
979
  title: string;
937
980
  status: number;
@@ -945,9 +988,9 @@ export type GetApiStepDefinitionsByStepDefinitionIdErrors = {
945
988
  }>;
946
989
  };
947
990
  /**
948
- * Response for status 403
991
+ * Response for status 401
949
992
  */
950
- 403: {
993
+ 401: {
951
994
  type: string;
952
995
  title: string;
953
996
  status: number;
@@ -961,9 +1004,9 @@ export type GetApiStepDefinitionsByStepDefinitionIdErrors = {
961
1004
  }>;
962
1005
  };
963
1006
  /**
964
- * Response for status 404
1007
+ * Response for status 403
965
1008
  */
966
- 404: {
1009
+ 403: {
967
1010
  type: string;
968
1011
  title: string;
969
1012
  status: number;
@@ -1009,8 +1052,8 @@ export type GetApiStepDefinitionsByStepDefinitionIdErrors = {
1009
1052
  }>;
1010
1053
  };
1011
1054
  };
1012
- export type GetApiStepDefinitionsByStepDefinitionIdError = GetApiStepDefinitionsByStepDefinitionIdErrors[keyof GetApiStepDefinitionsByStepDefinitionIdErrors];
1013
- export type GetApiStepDefinitionsByStepDefinitionIdResponses = {
1055
+ export type PutApiStepDefinitionsError = PutApiStepDefinitionsErrors[keyof PutApiStepDefinitionsErrors];
1056
+ export type PutApiStepDefinitionsResponses = {
1014
1057
  /**
1015
1058
  * Response for status 200
1016
1059
  */
@@ -1067,61 +1110,16 @@ export type GetApiStepDefinitionsByStepDefinitionIdResponses = {
1067
1110
  updatedAt: string;
1068
1111
  };
1069
1112
  };
1070
- export type GetApiStepDefinitionsByStepDefinitionIdResponse = GetApiStepDefinitionsByStepDefinitionIdResponses[keyof GetApiStepDefinitionsByStepDefinitionIdResponses];
1071
- export type PutApiStepDefinitionsByStepDefinitionIdData = {
1072
- body: {
1073
- projectId: string;
1074
- key: string;
1075
- name: string;
1076
- description: string | unknown;
1077
- prompt: string | unknown;
1078
- version: number;
1079
- kind: 'built_in' | 'user_defined';
1080
- inputSchemaJson: unknown;
1081
- resultSchemaJson: unknown;
1082
- opencodeMcpJson?: {
1083
- [key: string]: {
1084
- type: string;
1085
- command: Array<string>;
1086
- environment?: {
1087
- [key: string]: string;
1088
- };
1089
- enabled?: boolean;
1090
- timeout?: number;
1091
- } | {
1092
- type: string;
1093
- url: string;
1094
- enabled?: boolean;
1095
- headers?: {
1096
- [key: string]: string;
1097
- };
1098
- oauth?: {
1099
- clientId?: string;
1100
- clientSecret?: string;
1101
- scope?: string;
1102
- redirectUri?: string;
1103
- } | boolean;
1104
- timeout?: number;
1105
- } | {
1106
- enabled: boolean;
1107
- };
1108
- } | unknown;
1109
- status: 'draft' | 'active' | 'archived';
1110
- signalExtractorDefinitions: Array<{
1111
- key: string;
1112
- sourcePath: string;
1113
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
1114
- required: boolean;
1115
- availableWhenResultStatusIn: Array<string> | unknown;
1116
- }>;
1117
- };
1113
+ export type PutApiStepDefinitionsResponse = PutApiStepDefinitionsResponses[keyof PutApiStepDefinitionsResponses];
1114
+ export type GetApiStepDefinitionsByStepDefinitionIdData = {
1115
+ body?: never;
1118
1116
  path: {
1119
1117
  stepDefinitionId: string;
1120
1118
  };
1121
1119
  query?: never;
1122
1120
  url: '/api/step-definitions/{stepDefinitionId}';
1123
1121
  };
1124
- export type PutApiStepDefinitionsByStepDefinitionIdErrors = {
1122
+ export type GetApiStepDefinitionsByStepDefinitionIdErrors = {
1125
1123
  /**
1126
1124
  * Response for status 401
1127
1125
  */
@@ -1203,8 +1201,8 @@ export type PutApiStepDefinitionsByStepDefinitionIdErrors = {
1203
1201
  }>;
1204
1202
  };
1205
1203
  };
1206
- export type PutApiStepDefinitionsByStepDefinitionIdError = PutApiStepDefinitionsByStepDefinitionIdErrors[keyof PutApiStepDefinitionsByStepDefinitionIdErrors];
1207
- export type PutApiStepDefinitionsByStepDefinitionIdResponses = {
1204
+ export type GetApiStepDefinitionsByStepDefinitionIdError = GetApiStepDefinitionsByStepDefinitionIdErrors[keyof GetApiStepDefinitionsByStepDefinitionIdErrors];
1205
+ export type GetApiStepDefinitionsByStepDefinitionIdResponses = {
1208
1206
  /**
1209
1207
  * Response for status 200
1210
1208
  */
@@ -1261,7 +1259,7 @@ export type PutApiStepDefinitionsByStepDefinitionIdResponses = {
1261
1259
  updatedAt: string;
1262
1260
  };
1263
1261
  };
1264
- export type PutApiStepDefinitionsByStepDefinitionIdResponse = PutApiStepDefinitionsByStepDefinitionIdResponses[keyof PutApiStepDefinitionsByStepDefinitionIdResponses];
1262
+ export type GetApiStepDefinitionsByStepDefinitionIdResponse = GetApiStepDefinitionsByStepDefinitionIdResponses[keyof GetApiStepDefinitionsByStepDefinitionIdResponses];
1265
1263
  export type PutApiStepDefinitionsByStepDefinitionIdArchiveData = {
1266
1264
  body?: never;
1267
1265
  path: {
package/dist/index.js CHANGED
@@ -913,12 +913,9 @@ class StepDefinitions extends HeyApiClient {
913
913
  }
914
914
  });
915
915
  }
916
- getStepDefinition(options) {
917
- return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
918
- }
919
- updateStepDefinition(options) {
916
+ upsertStepDefinition(options) {
920
917
  return (options.client ?? this.client).put({
921
- url: "/api/step-definitions/{stepDefinitionId}",
918
+ url: "/api/step-definitions",
922
919
  ...options,
923
920
  headers: {
924
921
  "Content-Type": "application/json",
@@ -926,6 +923,9 @@ class StepDefinitions extends HeyApiClient {
926
923
  }
927
924
  });
928
925
  }
926
+ getStepDefinition(options) {
927
+ return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
928
+ }
929
929
  archiveStepDefinition(options) {
930
930
  return (options.client ?? this.client).put({ url: "/api/step-definitions/{stepDefinitionId}/archive", ...options });
931
931
  }
@@ -13433,9 +13433,12 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
13433
13433
  throw new Error(JSON.stringify(result.error));
13434
13434
  return result.data;
13435
13435
  },
13436
- update: async (stepDefinitionId, body, options) => {
13437
- const result = await stepDefinitions.updateStepDefinition({
13438
- path: { stepDefinitionId },
13436
+ upsertFromSpec: async (projectId, spec, options) => {
13437
+ const body = {
13438
+ ...spec,
13439
+ projectId
13440
+ };
13441
+ const result = await stepDefinitions.upsertStepDefinition({
13439
13442
  body,
13440
13443
  headers: options?.headers
13441
13444
  });
@@ -16043,45 +16046,65 @@ function definePipeline(config2) {
16043
16046
  }
16044
16047
  // src/definitions/pipelines/pipeline-definitions-client.ts
16045
16048
  function createPipelineDefinitionsClient(baseUrl) {
16046
- const base = baseUrl.replace(/\/$/, "");
16047
- async function doFetch(path, method, headers, body) {
16048
- const requestHeaders = { ...headers };
16049
- if (body !== undefined) {
16050
- requestHeaders["Content-Type"] = "application/json";
16051
- }
16052
- const response = await fetch(`${base}${path}`, {
16053
- method,
16054
- headers: requestHeaders,
16055
- ...body !== undefined ? { body: JSON.stringify(body) } : {}
16056
- });
16057
- if (!response.ok) {
16058
- const err = await response.json().catch(() => null);
16059
- throw new Error(err?.title ?? `HTTP ${String(response.status)} ${method} ${path}`);
16060
- }
16061
- return response.json().catch(() => null);
16062
- }
16063
- return buildPipelineDefinitionsClient(base, doFetch);
16049
+ const client2 = createClient({ baseUrl });
16050
+ return buildPipelineDefinitionsClient(new PipelineDefinitions({ client: client2 }));
16064
16051
  }
16065
- var buildPipelineDefinitionsClient = (_base, doFetch) => ({
16066
- listByProjectId: async (projectId, options) => {
16067
- const path = `/api/linear-pipeline-definitions?projectId=${encodeURIComponent(projectId)}`;
16068
- const result = await doFetch(path, "GET", options?.headers ?? {});
16069
- return result ?? [];
16070
- },
16071
- create: async (body, options) => {
16072
- const result = await doFetch("/api/linear-pipeline-definitions", "POST", options?.headers ?? {}, body);
16073
- return result;
16074
- },
16075
- update: async (pipelineId, body, options) => {
16076
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}`, "PUT", options?.headers ?? {}, body);
16077
- },
16078
- addStep: async (pipelineId, body, options) => {
16079
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps`, "POST", options?.headers ?? {}, body);
16080
- },
16081
- removeStep: async (pipelineId, stepId, options) => {
16082
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps/${stepId}`, "DELETE", options?.headers ?? {});
16083
- }
16084
- });
16052
+ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
16053
+ return {
16054
+ listByProjectId: async (projectId, options) => {
16055
+ const result = await pipelineDefinitions.listPipelineDefinitions({
16056
+ query: { projectId },
16057
+ headers: options?.headers
16058
+ });
16059
+ if (result.error)
16060
+ throw new Error(JSON.stringify(result.error));
16061
+ return result.data ?? [];
16062
+ },
16063
+ upsertFromSpec: async (projectId, spec, stepDefs, options) => {
16064
+ const stepDefMap = new Map;
16065
+ for (const s of stepDefs) {
16066
+ const existing = stepDefMap.get(s.key);
16067
+ if (!existing || s.version > existing.version) {
16068
+ stepDefMap.set(s.key, s);
16069
+ }
16070
+ }
16071
+ const stepDefinitions = spec.steps.map((step) => {
16072
+ const stepDef = stepDefMap.get(step.stepKey);
16073
+ if (!stepDef) {
16074
+ throw new Error(`Step "${step.stepKey}" referenced in pipeline "${spec.key}" was not found on the server. ` + `Run \`boboddy steps push\` first to push your step definitions.`);
16075
+ }
16076
+ return {
16077
+ stepDefinitionId: stepDef.id,
16078
+ stepDefinitionVersion: stepDef.version,
16079
+ key: step.stepKey,
16080
+ name: step.stepName,
16081
+ description: step.stepDescription,
16082
+ position: step.position,
16083
+ inputBindingsJson: step.inputBindingsJson,
16084
+ timeoutSeconds: step.timeoutSeconds,
16085
+ retryPolicyJson: null,
16086
+ advancementPolicyDefinition: step.advancementPolicyDefinition,
16087
+ computedSignalDefinitions: step.computedSignalDefinitions
16088
+ };
16089
+ });
16090
+ const body = {
16091
+ projectId,
16092
+ key: spec.key,
16093
+ name: spec.name,
16094
+ description: spec.description,
16095
+ status: spec.status,
16096
+ stepDefinitions
16097
+ };
16098
+ const result = await pipelineDefinitions.upsertPipelineDefinition({
16099
+ body,
16100
+ headers: options?.headers
16101
+ });
16102
+ if (result.error)
16103
+ throw new Error(JSON.stringify(result.error));
16104
+ return result.data;
16105
+ }
16106
+ };
16107
+ };
16085
16108
  // src/opencode-mcp.ts
16086
16109
  var nonEmptyStringSchema = exports_external.string().trim().min(1);
16087
16110
  var mcpStringMapSchema = exports_external.record(exports_external.string(), exports_external.string());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@boboddy/sdk",
4
- "version": "0.1.13-alpha",
4
+ "version": "0.1.14-alpha",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {