@devpad/mcp 2.6.10 → 2.6.12

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.
Files changed (2) hide show
  1. package/dist/index.js +650 -637
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -12111,7 +12111,7 @@ var createSelectSchema = (entity, refine) => {
12111
12111
  return handleColumns(columns, refine ?? {}, selectConditions);
12112
12112
  };
12113
12113
 
12114
- // ../api/dist/chunk-AXQWQXZR.js
12114
+ // ../api/dist/chunk-DHYAC4LG.js
12115
12115
  var timestamps = () => ({
12116
12116
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12117
12117
  updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
@@ -12798,8 +12798,7 @@ var update_user = objectType({
12798
12798
  id: stringType(),
12799
12799
  name: stringType().optional(),
12800
12800
  image_url: stringType().optional(),
12801
- task_view: unionType([literalType("list"), literalType("grid")]).optional(),
12802
- email_verified: booleanType().optional()
12801
+ task_view: unionType([literalType("list"), literalType("grid")]).optional()
12803
12802
  });
12804
12803
  var config_schema = objectType({
12805
12804
  tags: arrayType(objectType({
@@ -12930,7 +12929,7 @@ var upsert_pipeline_grant = objectType({
12930
12929
  scope: grant_scope,
12931
12930
  granted_by: stringType().nullable().optional(),
12932
12931
  granted_at: stringType().nullable().optional(),
12933
- auto_approved: booleanType().nullable().optional()
12932
+ auto_approved: booleanType().optional()
12934
12933
  });
12935
12934
  var upsert_pipeline_approval = objectType({
12936
12935
  run_id: stringType(),
@@ -13426,7 +13425,7 @@ var VersionSetManifestSchema = objectType({
13426
13425
  grants_ref: stringType().optional(),
13427
13426
  template_ref: stringType().optional()
13428
13427
  });
13429
- // ../api/dist/chunk-5L3AUVMM.js
13428
+ // ../api/dist/chunk-V6CM3V4I.js
13430
13429
  var PostContentSchema = objectType({
13431
13430
  title: stringType().min(1),
13432
13431
  content: stringType(),
@@ -13673,6 +13672,8 @@ var PulseLatencyResultSchema = objectType({
13673
13672
  by_minute: arrayType(PulseLatencyByMinuteSchema)
13674
13673
  });
13675
13674
  var ApiError = class _ApiError extends Error {
13675
+ code;
13676
+ statusCode;
13676
13677
  constructor(message, options = {}) {
13677
13678
  super(message);
13678
13679
  this.name = "ApiError";
@@ -13743,11 +13744,12 @@ function handleNetworkError(error) {
13743
13744
  var ArrayBufferedQueue = class {
13744
13745
  constructor(capacity) {
13745
13746
  this.capacity = capacity;
13746
- this.entries = [];
13747
- this.head = 0;
13748
- this.tail = 0;
13749
- this.count = 0;
13750
13747
  }
13748
+ capacity;
13749
+ entries = [];
13750
+ head = 0;
13751
+ tail = 0;
13752
+ count = 0;
13751
13753
  latest() {
13752
13754
  if (this.count === 0)
13753
13755
  return null;
@@ -13781,8 +13783,16 @@ var ArrayBufferedQueue = class {
13781
13783
  }
13782
13784
  };
13783
13785
  var ApiClient = class {
13786
+ base_url;
13787
+ api_key;
13788
+ request_history;
13789
+ category = "api";
13790
+ default_headers;
13791
+ custom_fetch;
13792
+ credentials;
13793
+ auth_mode;
13794
+ debug;
13784
13795
  constructor(options) {
13785
- this.category = "api";
13786
13796
  this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
13787
13797
  if (this.auth_mode !== "cookie") {
13788
13798
  if (!options.api_key)
@@ -13978,634 +13988,10 @@ function wrap(fn) {
13978
13988
  }));
13979
13989
  }
13980
13990
  var ApiClient2 = class {
13991
+ clients;
13992
+ api_key_field;
13993
+ auth_mode_field;
13981
13994
  constructor(options) {
13982
- this.auth = {
13983
- session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
13984
- keys: {
13985
- list: () => wrap(() => this.clients.auth.get("/keys")),
13986
- create: (input) => {
13987
- const body = typeof input === "string" ? { name: input } : input ?? {};
13988
- return wrap(() => this.clients.auth.post("/keys", { body }));
13989
- },
13990
- revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
13991
- remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
13992
- }
13993
- };
13994
- this.projects = {
13995
- list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
13996
- map: async (filters) => wrap(async () => {
13997
- const result = await this.projects.list(filters);
13998
- if (!result.ok)
13999
- throw new Error(result.error.message);
14000
- return result.value.reduce((acc, project) => {
14001
- acc[project.id] = project;
14002
- return acc;
14003
- }, {});
14004
- }),
14005
- find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
14006
- getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
14007
- getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
14008
- create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
14009
- update: async (idOrData, changes) => wrap(async () => {
14010
- if (typeof idOrData === "object" && idOrData.id) {
14011
- return this.clients.projects.patch("/projects", {
14012
- body: idOrData
14013
- });
14014
- }
14015
- const id = idOrData;
14016
- if (!changes) {
14017
- throw new Error("Changes parameter required for update");
14018
- }
14019
- const result = await this.projects.find(id);
14020
- if (!result.ok)
14021
- throw new Error(result.error.message);
14022
- if (!result.value)
14023
- throw new Error(`Project with id ${id} not found`);
14024
- const project = result.value;
14025
- const updateData = {
14026
- id: project.id,
14027
- project_id: project.project_id,
14028
- owner_id: project.owner_id,
14029
- name: project.name,
14030
- description: project.description,
14031
- specification: project.specification,
14032
- repo_url: project.repo_url,
14033
- repo_id: project.repo_id,
14034
- icon_url: project.icon_url,
14035
- status: project.status,
14036
- deleted: project.deleted,
14037
- link_url: project.link_url,
14038
- link_text: project.link_text,
14039
- visibility: project.visibility,
14040
- current_version: project.current_version,
14041
- ...changes
14042
- };
14043
- return this.clients.projects.patch("/projects", {
14044
- body: updateData
14045
- });
14046
- }),
14047
- config: {
14048
- load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
14049
- query: { project_id }
14050
- })),
14051
- save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
14052
- body: request
14053
- }))
14054
- },
14055
- scan: {
14056
- initiate: async (project_id) => {
14057
- const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
14058
- method: "POST",
14059
- headers: this.clients.projects.headers()
14060
- });
14061
- if (!response.body) {
14062
- throw new Error("No response body");
14063
- }
14064
- const stream = response.body.pipeThrough(new TextDecoderStream);
14065
- return stream;
14066
- },
14067
- updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
14068
- update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
14069
- query: { project_id },
14070
- body: data
14071
- }))
14072
- },
14073
- history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
14074
- upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
14075
- specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
14076
- query: { project_id }
14077
- })),
14078
- deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
14079
- body: { ...project, deleted: true }
14080
- })),
14081
- graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
14082
- getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
14083
- putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
14084
- };
14085
- this.milestones = {
14086
- list: () => wrap(() => this.clients.milestones.get("/milestones")),
14087
- getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
14088
- lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
14089
- query: depth ? { depth: String(depth) } : {}
14090
- })),
14091
- find: (id) => wrap(async () => {
14092
- try {
14093
- return await this.clients.milestones.get(`/milestones/${id}`);
14094
- } catch {
14095
- return null;
14096
- }
14097
- }),
14098
- create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
14099
- update: async (id, data) => wrap(async () => {
14100
- const result = await this.milestones.find(id);
14101
- if (!result.ok)
14102
- throw new Error(result.error.message);
14103
- if (!result.value)
14104
- throw new Error(`Milestone with id ${id} not found`);
14105
- const milestone = result.value;
14106
- const updateData = {
14107
- id: milestone.id,
14108
- project_id: milestone.project_id,
14109
- name: data.name ?? milestone.name,
14110
- description: data.description ?? milestone.description,
14111
- target_time: data.target_time ?? milestone.target_time,
14112
- target_version: data.target_version ?? milestone.target_version,
14113
- finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
14114
- };
14115
- return this.clients.milestones.patch(`/milestones/${id}`, {
14116
- body: updateData
14117
- });
14118
- }),
14119
- delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
14120
- goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
14121
- };
14122
- this.hooks = {
14123
- list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
14124
- upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
14125
- delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
14126
- setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
14127
- deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
14128
- };
14129
- this.goals = {
14130
- list: () => wrap(() => this.clients.goals.get("/goals")),
14131
- find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
14132
- create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
14133
- update: async (id, data) => wrap(async () => {
14134
- const result = await this.goals.find(id);
14135
- if (!result.ok)
14136
- throw new Error(result.error.message);
14137
- if (!result.value)
14138
- throw new Error(`Goal with id ${id} not found`);
14139
- const goal = result.value;
14140
- const updateData = {
14141
- id: goal.id,
14142
- milestone_id: goal.milestone_id,
14143
- name: data.name ?? goal.name,
14144
- description: data.description ?? goal.description,
14145
- target_time: data.target_time ?? goal.target_time,
14146
- finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
14147
- };
14148
- return this.clients.goals.patch(`/goals/${id}`, {
14149
- body: updateData
14150
- });
14151
- }),
14152
- delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
14153
- };
14154
- this.tasks = {
14155
- list: (filters) => wrap(() => {
14156
- const query = {};
14157
- if (filters?.project_id)
14158
- query.project = filters.project_id;
14159
- if (filters?.tag_id)
14160
- query.tag = filters.tag_id;
14161
- return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
14162
- }),
14163
- find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
14164
- getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
14165
- query: { project: project_id }
14166
- })),
14167
- create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
14168
- update: async (id, changes) => wrap(async () => {
14169
- const result = await this.tasks.find(id);
14170
- if (!result.ok)
14171
- throw new Error(result.error.message);
14172
- if (!result.value)
14173
- throw new Error(`Task with id ${id} not found`);
14174
- const task = result.value;
14175
- const updateData = {
14176
- id,
14177
- title: task.task.title,
14178
- summary: task.task.summary,
14179
- description: task.task.description,
14180
- progress: task.task.progress,
14181
- visibility: task.task.visibility,
14182
- start_time: task.task.start_time,
14183
- end_time: task.task.end_time,
14184
- priority: task.task.priority,
14185
- owner_id: task.task.owner_id,
14186
- project_id: task.task.project_id,
14187
- ...changes
14188
- };
14189
- return this.clients.tasks.patch("/tasks", {
14190
- body: updateData
14191
- });
14192
- }),
14193
- upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
14194
- saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
14195
- deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
14196
- body: { ...task.task, deleted: true }
14197
- })),
14198
- history: {
14199
- get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
14200
- },
14201
- ready: (filters) => wrap(() => {
14202
- const query = {};
14203
- if (filters?.project_id)
14204
- query.project = filters.project_id;
14205
- if (filters?.limit)
14206
- query.limit = String(filters.limit);
14207
- if (filters?.cursor)
14208
- query.cursor = filters.cursor;
14209
- return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
14210
- }),
14211
- tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
14212
- near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
14213
- ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
14214
- claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
14215
- done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
14216
- reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
14217
- advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
14218
- link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
14219
- unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
14220
- apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
14221
- };
14222
- this.tags = {
14223
- list: () => wrap(() => this.clients.tags.get("/tags"))
14224
- };
14225
- this.docs = {
14226
- list: (filters) => wrap(() => {
14227
- const query = { project_id: filters.project_id };
14228
- if (filters.task_id)
14229
- query.task_id = filters.task_id;
14230
- return this.clients.docs.get("/docs", { query });
14231
- }),
14232
- push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
14233
- pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
14234
- versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
14235
- renderUrl: (id, version) => {
14236
- const query = version ? `?version=${encodeURIComponent(version)}` : "";
14237
- return `${this.clients.docs.url()}/docs/${id}/render${query}`;
14238
- },
14239
- createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
14240
- replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
14241
- resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
14242
- toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
14243
- unresolved: (filters) => wrap(() => {
14244
- const query = {};
14245
- if (filters.project_id)
14246
- query.project_id = filters.project_id;
14247
- if (filters.document_id)
14248
- query.document_id = filters.document_id;
14249
- return this.clients.docs.get("/docs/annotations/unresolved", { query });
14250
- }),
14251
- pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
14252
- interfaceStatus: (filters) => wrap(() => {
14253
- const query = { project_id: filters.project_id, title: filters.title };
14254
- if (filters.task_id)
14255
- query.task_id = filters.task_id;
14256
- return this.clients.docs.get("/docs/interface/status", { query });
14257
- })
14258
- };
14259
- this.signoffs = {
14260
- request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
14261
- find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
14262
- findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
14263
- decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
14264
- };
14265
- this.reviews = {
14266
- pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
14267
- };
14268
- this.github = {
14269
- repos: () => wrap(() => this.clients.github.get("/repos")),
14270
- branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
14271
- };
14272
- this.blog = {
14273
- posts: {
14274
- list: (params) => wrap(() => {
14275
- const query = {};
14276
- if (params?.category)
14277
- query.category = params.category;
14278
- if (params?.tag)
14279
- query.tag = params.tag;
14280
- if (params?.project)
14281
- query.project = params.project;
14282
- if (params?.status)
14283
- query.status = params.status;
14284
- if (params?.archived !== undefined)
14285
- query.archived = String(params.archived);
14286
- if (params?.limit)
14287
- query.limit = String(params.limit);
14288
- if (params?.offset !== undefined)
14289
- query.offset = String(params.offset);
14290
- if (params?.sort)
14291
- query.sort = params.sort;
14292
- return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
14293
- }),
14294
- getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
14295
- create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
14296
- update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
14297
- delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
14298
- versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
14299
- version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
14300
- restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
14301
- },
14302
- tags: {
14303
- list: () => wrap(() => this.clients.blog.get("/blog/tags")),
14304
- getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
14305
- setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
14306
- addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
14307
- removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
14308
- },
14309
- categories: {
14310
- tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
14311
- create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
14312
- update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
14313
- body: data
14314
- })),
14315
- delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
14316
- },
14317
- tokens: {
14318
- list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
14319
- create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
14320
- update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
14321
- body: data
14322
- })),
14323
- delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
14324
- }
14325
- };
14326
- this.media = {
14327
- profiles: {
14328
- list: () => wrap(async () => {
14329
- const res = await this.clients.media.get("/profiles");
14330
- return res.profiles;
14331
- }),
14332
- create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
14333
- get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
14334
- update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
14335
- delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
14336
- filters: {
14337
- list: (profile_id) => wrap(async () => {
14338
- const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
14339
- return res.filters;
14340
- }),
14341
- add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
14342
- remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
14343
- },
14344
- timeline: (slug, params) => wrap(() => {
14345
- const query = {};
14346
- if (params?.limit)
14347
- query.limit = String(params.limit);
14348
- if (params?.before)
14349
- query.before = params.before;
14350
- return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
14351
- })
14352
- },
14353
- connections: {
14354
- list: (profile_id, options) => wrap(async () => {
14355
- const query = { profile_id };
14356
- if (options?.include_settings)
14357
- query.include_settings = "true";
14358
- const res = await this.clients.media.get("/connections", { query });
14359
- return res.accounts;
14360
- }),
14361
- create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
14362
- delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
14363
- refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
14364
- refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
14365
- updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
14366
- body: { is_active }
14367
- })),
14368
- settings: {
14369
- get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
14370
- update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
14371
- body: { settings }
14372
- }))
14373
- },
14374
- repos: (account_id) => wrap(async () => {
14375
- const res = await this.clients.media.get(`/connections/${account_id}/repos`);
14376
- return res.repos;
14377
- }),
14378
- subreddits: (account_id) => wrap(async () => {
14379
- const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
14380
- return res.subreddits;
14381
- })
14382
- },
14383
- credentials: {
14384
- check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
14385
- save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
14386
- delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
14387
- },
14388
- timeline: {
14389
- get: (user_id, params) => wrap(() => {
14390
- const query = {};
14391
- if (params?.from)
14392
- query.from = params.from;
14393
- if (params?.to)
14394
- query.to = params.to;
14395
- return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
14396
- }),
14397
- getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
14398
- query: { account_id }
14399
- }))
14400
- }
14401
- };
14402
- this.activity = {
14403
- ai: (options) => wrap(() => {
14404
- const query = {};
14405
- if (options?.limit)
14406
- query.limit = String(options.limit);
14407
- if (options?.since)
14408
- query.since = options.since;
14409
- return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
14410
- })
14411
- };
14412
- this.admin = {
14413
- verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
14414
- reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
14415
- };
14416
- this.user = {
14417
- me: () => wrap(() => this.clients.auth.get("/user/me")),
14418
- history: () => wrap(() => this.clients.auth.get("/user/history")),
14419
- preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
14420
- body: data
14421
- }))
14422
- };
14423
- this.pulse = {
14424
- summary: (input) => wrap(async () => {
14425
- const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
14426
- query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
14427
- });
14428
- return PulseSummarySchema.parse(raw);
14429
- }),
14430
- events: (input) => wrap(async () => {
14431
- const query = {};
14432
- if (input.name)
14433
- query.name = input.name;
14434
- if (input.level)
14435
- query.level = input.level;
14436
- if (typeof input.ts_from === "number")
14437
- query.ts_from = String(input.ts_from);
14438
- if (typeof input.ts_to === "number")
14439
- query.ts_to = String(input.ts_to);
14440
- if (input.search)
14441
- query.search = input.search;
14442
- if (input.limit)
14443
- query.limit = String(input.limit);
14444
- if (input.cursor)
14445
- query.cursor = input.cursor;
14446
- const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
14447
- query
14448
- });
14449
- return PulseEventsPageSchema.parse(raw);
14450
- }),
14451
- errors: (input) => wrap(async () => {
14452
- const query = {};
14453
- if (typeof input.range === "string") {
14454
- query.range = input.range;
14455
- } else {
14456
- query.from = String(input.range.from);
14457
- query.to = String(input.range.to);
14458
- }
14459
- if (input.group_by_fingerprint)
14460
- query.group_by_fingerprint = "true";
14461
- const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
14462
- query
14463
- });
14464
- return PulseErrorsResultSchema.parse(raw);
14465
- }),
14466
- logs: (input) => wrap(async () => {
14467
- const query = {};
14468
- if (typeof input.range === "string") {
14469
- query.range = input.range;
14470
- } else {
14471
- query.from = String(input.range.from);
14472
- query.to = String(input.range.to);
14473
- }
14474
- if (input.level)
14475
- query.level = input.level;
14476
- if (input.search)
14477
- query.search = input.search;
14478
- const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
14479
- return PulseLogsResultSchema.parse(raw);
14480
- }),
14481
- latency: (input) => wrap(async () => {
14482
- const query = {};
14483
- if (typeof input.range === "string") {
14484
- query.range = input.range;
14485
- } else {
14486
- query.from = String(input.range.from);
14487
- query.to = String(input.range.to);
14488
- }
14489
- if (input.route)
14490
- query.route = input.route;
14491
- if (input.percentiles && input.percentiles.length > 0)
14492
- query.percentiles = input.percentiles.join(",");
14493
- const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
14494
- query
14495
- });
14496
- return PulseLatencyResultSchema.parse(raw);
14497
- }),
14498
- subs: {
14499
- list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
14500
- create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
14501
- body: {
14502
- project_id: input.project_id,
14503
- name: input.name,
14504
- filter: input.filter,
14505
- channel: input.channel,
14506
- cooldown_seconds: input.cooldown_seconds
14507
- }
14508
- })),
14509
- get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
14510
- update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
14511
- delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
14512
- },
14513
- keys: {
14514
- list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
14515
- create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
14516
- body: {
14517
- project_id: input.project_id,
14518
- name: input.name,
14519
- rate_limit_per_min: input.rate_limit_per_min
14520
- }
14521
- })),
14522
- delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
14523
- query: { project_id: input.project_id }
14524
- }))
14525
- }
14526
- };
14527
- this.pipelines = {
14528
- dashboard: {
14529
- get: (input) => {
14530
- const query = { project_id: input.project_id };
14531
- if (input.window_ms !== undefined)
14532
- query.window_ms = String(input.window_ms);
14533
- return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
14534
- }
14535
- },
14536
- list: (filter) => {
14537
- const query = {};
14538
- if (filter?.package_id !== undefined)
14539
- query.package_id = filter.package_id;
14540
- if (filter?.status !== undefined)
14541
- query.status = filter.status;
14542
- if (filter?.limit !== undefined)
14543
- query.limit = String(filter.limit);
14544
- return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
14545
- },
14546
- get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
14547
- create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
14548
- body: input
14549
- })),
14550
- approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
14551
- body: input
14552
- })),
14553
- cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
14554
- rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
14555
- redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
14556
- dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
14557
- events: {
14558
- ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
14559
- body: input
14560
- })),
14561
- list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
14562
- },
14563
- grants: {
14564
- list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
14565
- query: package_id ? { package_id } : {}
14566
- })),
14567
- approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
14568
- body: {}
14569
- })),
14570
- deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
14571
- body: reason !== undefined ? { reason } : {}
14572
- }))
14573
- },
14574
- packages: {
14575
- list: (filter) => {
14576
- const query = {};
14577
- if (filter?.project_id !== undefined)
14578
- query.project_id = filter.project_id;
14579
- return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
14580
- },
14581
- get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
14582
- create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
14583
- update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
14584
- delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
14585
- },
14586
- analysis_templates: {
14587
- list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
14588
- query: { owner_id: input.owner_id }
14589
- })),
14590
- get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
14591
- query: { owner_id: input.owner_id }
14592
- })),
14593
- create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
14594
- update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
14595
- delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
14596
- query: { owner_id: input.owner_id }
14597
- }))
14598
- },
14599
- oidc_trust: {
14600
- list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
14601
- get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
14602
- create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
14603
- update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
14604
- delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
14605
- query: { owner_id: input.owner_id }
14606
- }))
14607
- }
14608
- };
14609
13995
  const base_url = options.base_url || "http://localhost:4321/api/v1";
14610
13996
  this.api_key_field = options.api_key ?? "";
14611
13997
  this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
@@ -14643,9 +14029,636 @@ var ApiClient2 = class {
14643
14029
  admin: new ApiClient({ ...clientOptions, category: "admin" })
14644
14030
  };
14645
14031
  }
14032
+ auth = {
14033
+ session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
14034
+ keys: {
14035
+ list: () => wrap(() => this.clients.auth.get("/keys")),
14036
+ create: (input) => {
14037
+ const body = typeof input === "string" ? { name: input } : input ?? {};
14038
+ return wrap(() => this.clients.auth.post("/keys", { body }));
14039
+ },
14040
+ revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
14041
+ remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
14042
+ }
14043
+ };
14044
+ projects = {
14045
+ list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
14046
+ map: async (filters) => wrap(async () => {
14047
+ const result = await this.projects.list(filters);
14048
+ if (!result.ok)
14049
+ throw new Error(result.error.message);
14050
+ return result.value.reduce((acc, project) => {
14051
+ acc[project.id] = project;
14052
+ return acc;
14053
+ }, {});
14054
+ }),
14055
+ find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
14056
+ getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
14057
+ getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
14058
+ create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
14059
+ update: async (idOrData, changes) => wrap(async () => {
14060
+ if (typeof idOrData === "object" && idOrData.id) {
14061
+ return this.clients.projects.patch("/projects", {
14062
+ body: idOrData
14063
+ });
14064
+ }
14065
+ const id = idOrData;
14066
+ if (!changes) {
14067
+ throw new Error("Changes parameter required for update");
14068
+ }
14069
+ const result = await this.projects.find(id);
14070
+ if (!result.ok)
14071
+ throw new Error(result.error.message);
14072
+ if (!result.value)
14073
+ throw new Error(`Project with id ${id} not found`);
14074
+ const project = result.value;
14075
+ const updateData = {
14076
+ id: project.id,
14077
+ project_id: project.project_id,
14078
+ owner_id: project.owner_id,
14079
+ name: project.name,
14080
+ description: project.description,
14081
+ specification: project.specification,
14082
+ repo_url: project.repo_url,
14083
+ repo_id: project.repo_id,
14084
+ icon_url: project.icon_url,
14085
+ status: project.status,
14086
+ deleted: project.deleted,
14087
+ link_url: project.link_url,
14088
+ link_text: project.link_text,
14089
+ visibility: project.visibility,
14090
+ current_version: project.current_version,
14091
+ ...changes
14092
+ };
14093
+ return this.clients.projects.patch("/projects", {
14094
+ body: updateData
14095
+ });
14096
+ }),
14097
+ config: {
14098
+ load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
14099
+ query: { project_id }
14100
+ })),
14101
+ save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
14102
+ body: request
14103
+ }))
14104
+ },
14105
+ scan: {
14106
+ initiate: async (project_id) => {
14107
+ const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
14108
+ method: "POST",
14109
+ headers: this.clients.projects.headers()
14110
+ });
14111
+ if (!response.body) {
14112
+ throw new Error("No response body");
14113
+ }
14114
+ const stream = response.body.pipeThrough(new TextDecoderStream);
14115
+ return stream;
14116
+ },
14117
+ updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
14118
+ update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
14119
+ query: { project_id },
14120
+ body: data
14121
+ }))
14122
+ },
14123
+ history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
14124
+ upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
14125
+ specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
14126
+ query: { project_id }
14127
+ })),
14128
+ deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
14129
+ body: { ...project, deleted: true }
14130
+ })),
14131
+ graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
14132
+ getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
14133
+ putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
14134
+ };
14135
+ milestones = {
14136
+ list: () => wrap(() => this.clients.milestones.get("/milestones")),
14137
+ getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
14138
+ lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
14139
+ query: depth ? { depth: String(depth) } : {}
14140
+ })),
14141
+ find: (id) => wrap(async () => {
14142
+ try {
14143
+ return await this.clients.milestones.get(`/milestones/${id}`);
14144
+ } catch {
14145
+ return null;
14146
+ }
14147
+ }),
14148
+ create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
14149
+ update: async (id, data) => wrap(async () => {
14150
+ const result = await this.milestones.find(id);
14151
+ if (!result.ok)
14152
+ throw new Error(result.error.message);
14153
+ if (!result.value)
14154
+ throw new Error(`Milestone with id ${id} not found`);
14155
+ const milestone = result.value;
14156
+ const updateData = {
14157
+ id: milestone.id,
14158
+ project_id: milestone.project_id,
14159
+ name: data.name ?? milestone.name,
14160
+ description: data.description ?? milestone.description,
14161
+ target_time: data.target_time ?? milestone.target_time,
14162
+ target_version: data.target_version ?? milestone.target_version,
14163
+ finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
14164
+ };
14165
+ return this.clients.milestones.patch(`/milestones/${id}`, {
14166
+ body: updateData
14167
+ });
14168
+ }),
14169
+ delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
14170
+ goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
14171
+ };
14172
+ hooks = {
14173
+ list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
14174
+ upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
14175
+ delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
14176
+ setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
14177
+ deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
14178
+ };
14179
+ goals = {
14180
+ list: () => wrap(() => this.clients.goals.get("/goals")),
14181
+ find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
14182
+ create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
14183
+ update: async (id, data) => wrap(async () => {
14184
+ const result = await this.goals.find(id);
14185
+ if (!result.ok)
14186
+ throw new Error(result.error.message);
14187
+ if (!result.value)
14188
+ throw new Error(`Goal with id ${id} not found`);
14189
+ const goal = result.value;
14190
+ const updateData = {
14191
+ id: goal.id,
14192
+ milestone_id: goal.milestone_id,
14193
+ name: data.name ?? goal.name,
14194
+ description: data.description ?? goal.description,
14195
+ target_time: data.target_time ?? goal.target_time,
14196
+ finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
14197
+ };
14198
+ return this.clients.goals.patch(`/goals/${id}`, {
14199
+ body: updateData
14200
+ });
14201
+ }),
14202
+ delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
14203
+ };
14204
+ tasks = {
14205
+ list: (filters) => wrap(() => {
14206
+ const query = {};
14207
+ if (filters?.project_id)
14208
+ query.project = filters.project_id;
14209
+ if (filters?.tag_id)
14210
+ query.tag = filters.tag_id;
14211
+ return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
14212
+ }),
14213
+ find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
14214
+ getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
14215
+ query: { project: project_id }
14216
+ })),
14217
+ create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
14218
+ update: async (id, changes) => wrap(async () => {
14219
+ const result = await this.tasks.find(id);
14220
+ if (!result.ok)
14221
+ throw new Error(result.error.message);
14222
+ if (!result.value)
14223
+ throw new Error(`Task with id ${id} not found`);
14224
+ const task = result.value;
14225
+ const updateData = {
14226
+ id,
14227
+ title: task.task.title,
14228
+ summary: task.task.summary,
14229
+ description: task.task.description,
14230
+ progress: task.task.progress,
14231
+ visibility: task.task.visibility,
14232
+ start_time: task.task.start_time,
14233
+ end_time: task.task.end_time,
14234
+ priority: task.task.priority,
14235
+ owner_id: task.task.owner_id,
14236
+ project_id: task.task.project_id,
14237
+ ...changes
14238
+ };
14239
+ return this.clients.tasks.patch("/tasks", {
14240
+ body: updateData
14241
+ });
14242
+ }),
14243
+ upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
14244
+ saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
14245
+ deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
14246
+ body: { ...task.task, deleted: true }
14247
+ })),
14248
+ history: {
14249
+ get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
14250
+ },
14251
+ ready: (filters) => wrap(() => {
14252
+ const query = {};
14253
+ if (filters?.project_id)
14254
+ query.project = filters.project_id;
14255
+ if (filters?.limit)
14256
+ query.limit = String(filters.limit);
14257
+ if (filters?.cursor)
14258
+ query.cursor = filters.cursor;
14259
+ return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
14260
+ }),
14261
+ tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
14262
+ near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
14263
+ ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
14264
+ claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
14265
+ done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
14266
+ reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
14267
+ advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
14268
+ link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
14269
+ unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
14270
+ apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
14271
+ };
14272
+ tags = {
14273
+ list: () => wrap(() => this.clients.tags.get("/tags"))
14274
+ };
14275
+ docs = {
14276
+ list: (filters) => wrap(() => {
14277
+ const query = { project_id: filters.project_id };
14278
+ if (filters.task_id)
14279
+ query.task_id = filters.task_id;
14280
+ return this.clients.docs.get("/docs", { query });
14281
+ }),
14282
+ push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
14283
+ pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
14284
+ versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
14285
+ renderUrl: (id, version) => {
14286
+ const query = version ? `?version=${encodeURIComponent(version)}` : "";
14287
+ return `${this.clients.docs.url()}/docs/${id}/render${query}`;
14288
+ },
14289
+ createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
14290
+ replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
14291
+ resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
14292
+ toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
14293
+ unresolved: (filters) => wrap(() => {
14294
+ const query = {};
14295
+ if (filters.project_id)
14296
+ query.project_id = filters.project_id;
14297
+ if (filters.document_id)
14298
+ query.document_id = filters.document_id;
14299
+ return this.clients.docs.get("/docs/annotations/unresolved", { query });
14300
+ }),
14301
+ pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
14302
+ interfaceStatus: (filters) => wrap(() => {
14303
+ const query = { project_id: filters.project_id, title: filters.title };
14304
+ if (filters.task_id)
14305
+ query.task_id = filters.task_id;
14306
+ return this.clients.docs.get("/docs/interface/status", { query });
14307
+ })
14308
+ };
14309
+ signoffs = {
14310
+ request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
14311
+ find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
14312
+ findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
14313
+ decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
14314
+ };
14315
+ reviews = {
14316
+ pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
14317
+ };
14318
+ github = {
14319
+ repos: () => wrap(() => this.clients.github.get("/repos")),
14320
+ branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
14321
+ };
14322
+ blog = {
14323
+ posts: {
14324
+ list: (params) => wrap(() => {
14325
+ const query = {};
14326
+ if (params?.category)
14327
+ query.category = params.category;
14328
+ if (params?.tag)
14329
+ query.tag = params.tag;
14330
+ if (params?.project)
14331
+ query.project = params.project;
14332
+ if (params?.status)
14333
+ query.status = params.status;
14334
+ if (params?.archived !== undefined)
14335
+ query.archived = String(params.archived);
14336
+ if (params?.limit)
14337
+ query.limit = String(params.limit);
14338
+ if (params?.offset !== undefined)
14339
+ query.offset = String(params.offset);
14340
+ if (params?.sort)
14341
+ query.sort = params.sort;
14342
+ return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
14343
+ }),
14344
+ getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
14345
+ create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
14346
+ update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
14347
+ delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
14348
+ versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
14349
+ version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
14350
+ restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
14351
+ },
14352
+ tags: {
14353
+ list: () => wrap(() => this.clients.blog.get("/blog/tags")),
14354
+ getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
14355
+ setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
14356
+ addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
14357
+ removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
14358
+ },
14359
+ categories: {
14360
+ tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
14361
+ create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
14362
+ update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
14363
+ body: data
14364
+ })),
14365
+ delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
14366
+ },
14367
+ tokens: {
14368
+ list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
14369
+ create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
14370
+ update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
14371
+ body: data
14372
+ })),
14373
+ delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
14374
+ }
14375
+ };
14376
+ media = {
14377
+ profiles: {
14378
+ list: () => wrap(async () => {
14379
+ const res = await this.clients.media.get("/profiles");
14380
+ return res.profiles;
14381
+ }),
14382
+ create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
14383
+ get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
14384
+ update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
14385
+ delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
14386
+ filters: {
14387
+ list: (profile_id) => wrap(async () => {
14388
+ const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
14389
+ return res.filters;
14390
+ }),
14391
+ add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
14392
+ remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
14393
+ },
14394
+ timeline: (slug, params) => wrap(() => {
14395
+ const query = {};
14396
+ if (params?.limit)
14397
+ query.limit = String(params.limit);
14398
+ if (params?.before)
14399
+ query.before = params.before;
14400
+ return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
14401
+ })
14402
+ },
14403
+ connections: {
14404
+ list: (profile_id, options) => wrap(async () => {
14405
+ const query = { profile_id };
14406
+ if (options?.include_settings)
14407
+ query.include_settings = "true";
14408
+ const res = await this.clients.media.get("/connections", { query });
14409
+ return res.accounts;
14410
+ }),
14411
+ create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
14412
+ delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
14413
+ refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
14414
+ refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
14415
+ updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
14416
+ body: { is_active }
14417
+ })),
14418
+ settings: {
14419
+ get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
14420
+ update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
14421
+ body: { settings }
14422
+ }))
14423
+ },
14424
+ repos: (account_id) => wrap(async () => {
14425
+ const res = await this.clients.media.get(`/connections/${account_id}/repos`);
14426
+ return res.repos;
14427
+ }),
14428
+ subreddits: (account_id) => wrap(async () => {
14429
+ const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
14430
+ return res.subreddits;
14431
+ })
14432
+ },
14433
+ credentials: {
14434
+ check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
14435
+ save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
14436
+ delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
14437
+ },
14438
+ timeline: {
14439
+ get: (user_id, params) => wrap(() => {
14440
+ const query = {};
14441
+ if (params?.from)
14442
+ query.from = params.from;
14443
+ if (params?.to)
14444
+ query.to = params.to;
14445
+ return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
14446
+ }),
14447
+ getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
14448
+ query: { account_id }
14449
+ }))
14450
+ }
14451
+ };
14452
+ activity = {
14453
+ ai: (options) => wrap(() => {
14454
+ const query = {};
14455
+ if (options?.limit)
14456
+ query.limit = String(options.limit);
14457
+ if (options?.since)
14458
+ query.since = options.since;
14459
+ return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
14460
+ })
14461
+ };
14462
+ admin = {
14463
+ verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
14464
+ reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
14465
+ };
14466
+ user = {
14467
+ me: () => wrap(() => this.clients.auth.get("/user/me")),
14468
+ history: () => wrap(() => this.clients.auth.get("/user/history")),
14469
+ preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
14470
+ body: data
14471
+ }))
14472
+ };
14646
14473
  history() {
14647
14474
  return this.clients.projects.history();
14648
14475
  }
14476
+ pulse = {
14477
+ summary: (input) => wrap(async () => {
14478
+ const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
14479
+ query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
14480
+ });
14481
+ return PulseSummarySchema.parse(raw);
14482
+ }),
14483
+ events: (input) => wrap(async () => {
14484
+ const query = {};
14485
+ if (input.name)
14486
+ query.name = input.name;
14487
+ if (input.level)
14488
+ query.level = input.level;
14489
+ if (typeof input.ts_from === "number")
14490
+ query.ts_from = String(input.ts_from);
14491
+ if (typeof input.ts_to === "number")
14492
+ query.ts_to = String(input.ts_to);
14493
+ if (input.search)
14494
+ query.search = input.search;
14495
+ if (input.limit)
14496
+ query.limit = String(input.limit);
14497
+ if (input.cursor)
14498
+ query.cursor = input.cursor;
14499
+ const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
14500
+ query
14501
+ });
14502
+ return PulseEventsPageSchema.parse(raw);
14503
+ }),
14504
+ errors: (input) => wrap(async () => {
14505
+ const query = {};
14506
+ if (typeof input.range === "string") {
14507
+ query.range = input.range;
14508
+ } else {
14509
+ query.from = String(input.range.from);
14510
+ query.to = String(input.range.to);
14511
+ }
14512
+ if (input.group_by_fingerprint)
14513
+ query.group_by_fingerprint = "true";
14514
+ const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
14515
+ query
14516
+ });
14517
+ return PulseErrorsResultSchema.parse(raw);
14518
+ }),
14519
+ logs: (input) => wrap(async () => {
14520
+ const query = {};
14521
+ if (typeof input.range === "string") {
14522
+ query.range = input.range;
14523
+ } else {
14524
+ query.from = String(input.range.from);
14525
+ query.to = String(input.range.to);
14526
+ }
14527
+ if (input.level)
14528
+ query.level = input.level;
14529
+ if (input.search)
14530
+ query.search = input.search;
14531
+ const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
14532
+ return PulseLogsResultSchema.parse(raw);
14533
+ }),
14534
+ latency: (input) => wrap(async () => {
14535
+ const query = {};
14536
+ if (typeof input.range === "string") {
14537
+ query.range = input.range;
14538
+ } else {
14539
+ query.from = String(input.range.from);
14540
+ query.to = String(input.range.to);
14541
+ }
14542
+ if (input.route)
14543
+ query.route = input.route;
14544
+ if (input.percentiles && input.percentiles.length > 0)
14545
+ query.percentiles = input.percentiles.join(",");
14546
+ const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
14547
+ query
14548
+ });
14549
+ return PulseLatencyResultSchema.parse(raw);
14550
+ }),
14551
+ subs: {
14552
+ list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
14553
+ create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
14554
+ body: {
14555
+ project_id: input.project_id,
14556
+ name: input.name,
14557
+ filter: input.filter,
14558
+ channel: input.channel,
14559
+ cooldown_seconds: input.cooldown_seconds
14560
+ }
14561
+ })),
14562
+ get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
14563
+ update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
14564
+ delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
14565
+ },
14566
+ keys: {
14567
+ list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
14568
+ create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
14569
+ body: {
14570
+ project_id: input.project_id,
14571
+ name: input.name,
14572
+ rate_limit_per_min: input.rate_limit_per_min
14573
+ }
14574
+ })),
14575
+ delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
14576
+ query: { project_id: input.project_id }
14577
+ }))
14578
+ }
14579
+ };
14580
+ pipelines = {
14581
+ dashboard: {
14582
+ get: (input) => {
14583
+ const query = { project_id: input.project_id };
14584
+ if (input.window_ms !== undefined)
14585
+ query.window_ms = String(input.window_ms);
14586
+ return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
14587
+ }
14588
+ },
14589
+ list: (filter) => {
14590
+ const query = {};
14591
+ if (filter?.package_id !== undefined)
14592
+ query.package_id = filter.package_id;
14593
+ if (filter?.status !== undefined)
14594
+ query.status = filter.status;
14595
+ if (filter?.limit !== undefined)
14596
+ query.limit = String(filter.limit);
14597
+ return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
14598
+ },
14599
+ get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
14600
+ create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
14601
+ body: input
14602
+ })),
14603
+ approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
14604
+ body: input
14605
+ })),
14606
+ cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
14607
+ rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
14608
+ redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
14609
+ dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
14610
+ events: {
14611
+ ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
14612
+ body: input
14613
+ })),
14614
+ list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
14615
+ },
14616
+ grants: {
14617
+ list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
14618
+ query: package_id ? { package_id } : {}
14619
+ })),
14620
+ approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
14621
+ body: {}
14622
+ })),
14623
+ deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
14624
+ body: reason !== undefined ? { reason } : {}
14625
+ }))
14626
+ },
14627
+ packages: {
14628
+ list: (filter) => {
14629
+ const query = {};
14630
+ if (filter?.project_id !== undefined)
14631
+ query.project_id = filter.project_id;
14632
+ return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
14633
+ },
14634
+ get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
14635
+ create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
14636
+ update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
14637
+ delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
14638
+ },
14639
+ analysis_templates: {
14640
+ list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
14641
+ query: { owner_id: input.owner_id }
14642
+ })),
14643
+ get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
14644
+ query: { owner_id: input.owner_id }
14645
+ })),
14646
+ create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
14647
+ update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
14648
+ delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
14649
+ query: { owner_id: input.owner_id }
14650
+ }))
14651
+ },
14652
+ oidc_trust: {
14653
+ list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
14654
+ get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
14655
+ create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
14656
+ update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
14657
+ delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
14658
+ query: { owner_id: input.owner_id }
14659
+ }))
14660
+ }
14661
+ };
14649
14662
  getApiKey() {
14650
14663
  return this.api_key_field;
14651
14664
  }