@devpad/cli 2.6.11 → 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.
- package/dist/index.js +1412 -1377
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -11714,7 +11714,7 @@ __exportCjs(exports_commander, {
|
|
|
11714
11714
|
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
11715
11715
|
});
|
|
11716
11716
|
|
|
11717
|
-
// ../api/dist/chunk-
|
|
11717
|
+
// ../api/dist/chunk-DHYAC4LG.js
|
|
11718
11718
|
init_drizzle_orm();
|
|
11719
11719
|
init_sqlite_core();
|
|
11720
11720
|
|
|
@@ -11971,7 +11971,7 @@ var createSelectSchema = (entity, refine) => {
|
|
|
11971
11971
|
return handleColumns(columns, refine ?? {}, selectConditions);
|
|
11972
11972
|
};
|
|
11973
11973
|
|
|
11974
|
-
// ../api/dist/chunk-
|
|
11974
|
+
// ../api/dist/chunk-DHYAC4LG.js
|
|
11975
11975
|
init_zod();
|
|
11976
11976
|
var timestamps = () => ({
|
|
11977
11977
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
@@ -12659,8 +12659,7 @@ var update_user = objectType({
|
|
|
12659
12659
|
id: stringType(),
|
|
12660
12660
|
name: stringType().optional(),
|
|
12661
12661
|
image_url: stringType().optional(),
|
|
12662
|
-
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
12663
|
-
email_verified: booleanType().optional()
|
|
12662
|
+
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
12664
12663
|
});
|
|
12665
12664
|
var config_schema = objectType({
|
|
12666
12665
|
tags: arrayType(objectType({
|
|
@@ -12791,7 +12790,7 @@ var upsert_pipeline_grant = objectType({
|
|
|
12791
12790
|
scope: grant_scope,
|
|
12792
12791
|
granted_by: stringType().nullable().optional(),
|
|
12793
12792
|
granted_at: stringType().nullable().optional(),
|
|
12794
|
-
auto_approved: booleanType().
|
|
12793
|
+
auto_approved: booleanType().optional()
|
|
12795
12794
|
});
|
|
12796
12795
|
var upsert_pipeline_approval = objectType({
|
|
12797
12796
|
run_id: stringType(),
|
|
@@ -13084,7 +13083,7 @@ var project_graph_response = objectType({
|
|
|
13084
13083
|
var project_view_pin = objectType({ x: numberType(), y: numberType() });
|
|
13085
13084
|
var project_view_layout = objectType({ pins: recordType(stringType(), project_view_pin) });
|
|
13086
13085
|
|
|
13087
|
-
// ../api/dist/chunk-
|
|
13086
|
+
// ../api/dist/chunk-V6CM3V4I.js
|
|
13088
13087
|
init_dist();
|
|
13089
13088
|
init_zod();
|
|
13090
13089
|
init_dist();
|
|
@@ -13342,6 +13341,8 @@ var PulseLatencyResultSchema = objectType({
|
|
|
13342
13341
|
by_minute: arrayType(PulseLatencyByMinuteSchema)
|
|
13343
13342
|
});
|
|
13344
13343
|
var ApiError = class _ApiError extends Error {
|
|
13344
|
+
code;
|
|
13345
|
+
statusCode;
|
|
13345
13346
|
constructor(message, options = {}) {
|
|
13346
13347
|
super(message);
|
|
13347
13348
|
this.name = "ApiError";
|
|
@@ -13412,11 +13413,12 @@ function handleNetworkError(error) {
|
|
|
13412
13413
|
var ArrayBufferedQueue = class {
|
|
13413
13414
|
constructor(capacity) {
|
|
13414
13415
|
this.capacity = capacity;
|
|
13415
|
-
this.entries = [];
|
|
13416
|
-
this.head = 0;
|
|
13417
|
-
this.tail = 0;
|
|
13418
|
-
this.count = 0;
|
|
13419
13416
|
}
|
|
13417
|
+
capacity;
|
|
13418
|
+
entries = [];
|
|
13419
|
+
head = 0;
|
|
13420
|
+
tail = 0;
|
|
13421
|
+
count = 0;
|
|
13420
13422
|
latest() {
|
|
13421
13423
|
if (this.count === 0)
|
|
13422
13424
|
return null;
|
|
@@ -13450,8 +13452,16 @@ var ArrayBufferedQueue = class {
|
|
|
13450
13452
|
}
|
|
13451
13453
|
};
|
|
13452
13454
|
var ApiClient = class {
|
|
13455
|
+
base_url;
|
|
13456
|
+
api_key;
|
|
13457
|
+
request_history;
|
|
13458
|
+
category = "api";
|
|
13459
|
+
default_headers;
|
|
13460
|
+
custom_fetch;
|
|
13461
|
+
credentials;
|
|
13462
|
+
auth_mode;
|
|
13463
|
+
debug;
|
|
13453
13464
|
constructor(options) {
|
|
13454
|
-
this.category = "api";
|
|
13455
13465
|
this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
|
|
13456
13466
|
if (this.auth_mode !== "cookie") {
|
|
13457
13467
|
if (!options.api_key)
|
|
@@ -13647,634 +13657,10 @@ function wrap(fn) {
|
|
|
13647
13657
|
}));
|
|
13648
13658
|
}
|
|
13649
13659
|
var ApiClient2 = class {
|
|
13660
|
+
clients;
|
|
13661
|
+
api_key_field;
|
|
13662
|
+
auth_mode_field;
|
|
13650
13663
|
constructor(options) {
|
|
13651
|
-
this.auth = {
|
|
13652
|
-
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
13653
|
-
keys: {
|
|
13654
|
-
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
13655
|
-
create: (input) => {
|
|
13656
|
-
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
13657
|
-
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
13658
|
-
},
|
|
13659
|
-
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
13660
|
-
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
13661
|
-
}
|
|
13662
|
-
};
|
|
13663
|
-
this.projects = {
|
|
13664
|
-
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
13665
|
-
map: async (filters) => wrap(async () => {
|
|
13666
|
-
const result = await this.projects.list(filters);
|
|
13667
|
-
if (!result.ok)
|
|
13668
|
-
throw new Error(result.error.message);
|
|
13669
|
-
return result.value.reduce((acc, project) => {
|
|
13670
|
-
acc[project.id] = project;
|
|
13671
|
-
return acc;
|
|
13672
|
-
}, {});
|
|
13673
|
-
}),
|
|
13674
|
-
find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
13675
|
-
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
13676
|
-
getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
13677
|
-
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13678
|
-
update: async (idOrData, changes) => wrap(async () => {
|
|
13679
|
-
if (typeof idOrData === "object" && idOrData.id) {
|
|
13680
|
-
return this.clients.projects.patch("/projects", {
|
|
13681
|
-
body: idOrData
|
|
13682
|
-
});
|
|
13683
|
-
}
|
|
13684
|
-
const id = idOrData;
|
|
13685
|
-
if (!changes) {
|
|
13686
|
-
throw new Error("Changes parameter required for update");
|
|
13687
|
-
}
|
|
13688
|
-
const result = await this.projects.find(id);
|
|
13689
|
-
if (!result.ok)
|
|
13690
|
-
throw new Error(result.error.message);
|
|
13691
|
-
if (!result.value)
|
|
13692
|
-
throw new Error(`Project with id ${id} not found`);
|
|
13693
|
-
const project = result.value;
|
|
13694
|
-
const updateData = {
|
|
13695
|
-
id: project.id,
|
|
13696
|
-
project_id: project.project_id,
|
|
13697
|
-
owner_id: project.owner_id,
|
|
13698
|
-
name: project.name,
|
|
13699
|
-
description: project.description,
|
|
13700
|
-
specification: project.specification,
|
|
13701
|
-
repo_url: project.repo_url,
|
|
13702
|
-
repo_id: project.repo_id,
|
|
13703
|
-
icon_url: project.icon_url,
|
|
13704
|
-
status: project.status,
|
|
13705
|
-
deleted: project.deleted,
|
|
13706
|
-
link_url: project.link_url,
|
|
13707
|
-
link_text: project.link_text,
|
|
13708
|
-
visibility: project.visibility,
|
|
13709
|
-
current_version: project.current_version,
|
|
13710
|
-
...changes
|
|
13711
|
-
};
|
|
13712
|
-
return this.clients.projects.patch("/projects", {
|
|
13713
|
-
body: updateData
|
|
13714
|
-
});
|
|
13715
|
-
}),
|
|
13716
|
-
config: {
|
|
13717
|
-
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
13718
|
-
query: { project_id }
|
|
13719
|
-
})),
|
|
13720
|
-
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
13721
|
-
body: request
|
|
13722
|
-
}))
|
|
13723
|
-
},
|
|
13724
|
-
scan: {
|
|
13725
|
-
initiate: async (project_id) => {
|
|
13726
|
-
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
13727
|
-
method: "POST",
|
|
13728
|
-
headers: this.clients.projects.headers()
|
|
13729
|
-
});
|
|
13730
|
-
if (!response.body) {
|
|
13731
|
-
throw new Error("No response body");
|
|
13732
|
-
}
|
|
13733
|
-
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
13734
|
-
return stream;
|
|
13735
|
-
},
|
|
13736
|
-
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
13737
|
-
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
13738
|
-
query: { project_id },
|
|
13739
|
-
body: data
|
|
13740
|
-
}))
|
|
13741
|
-
},
|
|
13742
|
-
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
13743
|
-
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13744
|
-
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
13745
|
-
query: { project_id }
|
|
13746
|
-
})),
|
|
13747
|
-
deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
|
|
13748
|
-
body: { ...project, deleted: true }
|
|
13749
|
-
})),
|
|
13750
|
-
graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
13751
|
-
getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
13752
|
-
putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
13753
|
-
};
|
|
13754
|
-
this.milestones = {
|
|
13755
|
-
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
13756
|
-
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
13757
|
-
lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
13758
|
-
query: depth ? { depth: String(depth) } : {}
|
|
13759
|
-
})),
|
|
13760
|
-
find: (id) => wrap(async () => {
|
|
13761
|
-
try {
|
|
13762
|
-
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
13763
|
-
} catch {
|
|
13764
|
-
return null;
|
|
13765
|
-
}
|
|
13766
|
-
}),
|
|
13767
|
-
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
13768
|
-
update: async (id, data) => wrap(async () => {
|
|
13769
|
-
const result = await this.milestones.find(id);
|
|
13770
|
-
if (!result.ok)
|
|
13771
|
-
throw new Error(result.error.message);
|
|
13772
|
-
if (!result.value)
|
|
13773
|
-
throw new Error(`Milestone with id ${id} not found`);
|
|
13774
|
-
const milestone = result.value;
|
|
13775
|
-
const updateData = {
|
|
13776
|
-
id: milestone.id,
|
|
13777
|
-
project_id: milestone.project_id,
|
|
13778
|
-
name: data.name ?? milestone.name,
|
|
13779
|
-
description: data.description ?? milestone.description,
|
|
13780
|
-
target_time: data.target_time ?? milestone.target_time,
|
|
13781
|
-
target_version: data.target_version ?? milestone.target_version,
|
|
13782
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
13783
|
-
};
|
|
13784
|
-
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
13785
|
-
body: updateData
|
|
13786
|
-
});
|
|
13787
|
-
}),
|
|
13788
|
-
delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
13789
|
-
goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
13790
|
-
};
|
|
13791
|
-
this.hooks = {
|
|
13792
|
-
list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
13793
|
-
upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
13794
|
-
delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
13795
|
-
setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
13796
|
-
deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
13797
|
-
};
|
|
13798
|
-
this.goals = {
|
|
13799
|
-
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
13800
|
-
find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
|
|
13801
|
-
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
13802
|
-
update: async (id, data) => wrap(async () => {
|
|
13803
|
-
const result = await this.goals.find(id);
|
|
13804
|
-
if (!result.ok)
|
|
13805
|
-
throw new Error(result.error.message);
|
|
13806
|
-
if (!result.value)
|
|
13807
|
-
throw new Error(`Goal with id ${id} not found`);
|
|
13808
|
-
const goal = result.value;
|
|
13809
|
-
const updateData = {
|
|
13810
|
-
id: goal.id,
|
|
13811
|
-
milestone_id: goal.milestone_id,
|
|
13812
|
-
name: data.name ?? goal.name,
|
|
13813
|
-
description: data.description ?? goal.description,
|
|
13814
|
-
target_time: data.target_time ?? goal.target_time,
|
|
13815
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
13816
|
-
};
|
|
13817
|
-
return this.clients.goals.patch(`/goals/${id}`, {
|
|
13818
|
-
body: updateData
|
|
13819
|
-
});
|
|
13820
|
-
}),
|
|
13821
|
-
delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
|
|
13822
|
-
};
|
|
13823
|
-
this.tasks = {
|
|
13824
|
-
list: (filters) => wrap(() => {
|
|
13825
|
-
const query = {};
|
|
13826
|
-
if (filters?.project_id)
|
|
13827
|
-
query.project = filters.project_id;
|
|
13828
|
-
if (filters?.tag_id)
|
|
13829
|
-
query.tag = filters.tag_id;
|
|
13830
|
-
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
13831
|
-
}),
|
|
13832
|
-
find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
13833
|
-
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
13834
|
-
query: { project: project_id }
|
|
13835
|
-
})),
|
|
13836
|
-
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13837
|
-
update: async (id, changes) => wrap(async () => {
|
|
13838
|
-
const result = await this.tasks.find(id);
|
|
13839
|
-
if (!result.ok)
|
|
13840
|
-
throw new Error(result.error.message);
|
|
13841
|
-
if (!result.value)
|
|
13842
|
-
throw new Error(`Task with id ${id} not found`);
|
|
13843
|
-
const task = result.value;
|
|
13844
|
-
const updateData = {
|
|
13845
|
-
id,
|
|
13846
|
-
title: task.task.title,
|
|
13847
|
-
summary: task.task.summary,
|
|
13848
|
-
description: task.task.description,
|
|
13849
|
-
progress: task.task.progress,
|
|
13850
|
-
visibility: task.task.visibility,
|
|
13851
|
-
start_time: task.task.start_time,
|
|
13852
|
-
end_time: task.task.end_time,
|
|
13853
|
-
priority: task.task.priority,
|
|
13854
|
-
owner_id: task.task.owner_id,
|
|
13855
|
-
project_id: task.task.project_id,
|
|
13856
|
-
...changes
|
|
13857
|
-
};
|
|
13858
|
-
return this.clients.tasks.patch("/tasks", {
|
|
13859
|
-
body: updateData
|
|
13860
|
-
});
|
|
13861
|
-
}),
|
|
13862
|
-
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13863
|
-
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
13864
|
-
deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
13865
|
-
body: { ...task.task, deleted: true }
|
|
13866
|
-
})),
|
|
13867
|
-
history: {
|
|
13868
|
-
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
13869
|
-
},
|
|
13870
|
-
ready: (filters) => wrap(() => {
|
|
13871
|
-
const query = {};
|
|
13872
|
-
if (filters?.project_id)
|
|
13873
|
-
query.project = filters.project_id;
|
|
13874
|
-
if (filters?.limit)
|
|
13875
|
-
query.limit = String(filters.limit);
|
|
13876
|
-
if (filters?.cursor)
|
|
13877
|
-
query.cursor = filters.cursor;
|
|
13878
|
-
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
13879
|
-
}),
|
|
13880
|
-
tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
13881
|
-
near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
13882
|
-
ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
13883
|
-
claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
13884
|
-
done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
13885
|
-
reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
13886
|
-
advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
13887
|
-
link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
13888
|
-
unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
13889
|
-
apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
13890
|
-
};
|
|
13891
|
-
this.tags = {
|
|
13892
|
-
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
13893
|
-
};
|
|
13894
|
-
this.docs = {
|
|
13895
|
-
list: (filters) => wrap(() => {
|
|
13896
|
-
const query = { project_id: filters.project_id };
|
|
13897
|
-
if (filters.task_id)
|
|
13898
|
-
query.task_id = filters.task_id;
|
|
13899
|
-
return this.clients.docs.get("/docs", { query });
|
|
13900
|
-
}),
|
|
13901
|
-
push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
|
|
13902
|
-
pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
13903
|
-
versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
13904
|
-
renderUrl: (id, version) => {
|
|
13905
|
-
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
13906
|
-
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
13907
|
-
},
|
|
13908
|
-
createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
13909
|
-
replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
13910
|
-
resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
13911
|
-
toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
13912
|
-
unresolved: (filters) => wrap(() => {
|
|
13913
|
-
const query = {};
|
|
13914
|
-
if (filters.project_id)
|
|
13915
|
-
query.project_id = filters.project_id;
|
|
13916
|
-
if (filters.document_id)
|
|
13917
|
-
query.document_id = filters.document_id;
|
|
13918
|
-
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
13919
|
-
}),
|
|
13920
|
-
pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
13921
|
-
interfaceStatus: (filters) => wrap(() => {
|
|
13922
|
-
const query = { project_id: filters.project_id, title: filters.title };
|
|
13923
|
-
if (filters.task_id)
|
|
13924
|
-
query.task_id = filters.task_id;
|
|
13925
|
-
return this.clients.docs.get("/docs/interface/status", { query });
|
|
13926
|
-
})
|
|
13927
|
-
};
|
|
13928
|
-
this.signoffs = {
|
|
13929
|
-
request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
13930
|
-
find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
13931
|
-
findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
13932
|
-
decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
13933
|
-
};
|
|
13934
|
-
this.reviews = {
|
|
13935
|
-
pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
|
|
13936
|
-
};
|
|
13937
|
-
this.github = {
|
|
13938
|
-
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
13939
|
-
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
13940
|
-
};
|
|
13941
|
-
this.blog = {
|
|
13942
|
-
posts: {
|
|
13943
|
-
list: (params) => wrap(() => {
|
|
13944
|
-
const query = {};
|
|
13945
|
-
if (params?.category)
|
|
13946
|
-
query.category = params.category;
|
|
13947
|
-
if (params?.tag)
|
|
13948
|
-
query.tag = params.tag;
|
|
13949
|
-
if (params?.project)
|
|
13950
|
-
query.project = params.project;
|
|
13951
|
-
if (params?.status)
|
|
13952
|
-
query.status = params.status;
|
|
13953
|
-
if (params?.archived !== undefined)
|
|
13954
|
-
query.archived = String(params.archived);
|
|
13955
|
-
if (params?.limit)
|
|
13956
|
-
query.limit = String(params.limit);
|
|
13957
|
-
if (params?.offset !== undefined)
|
|
13958
|
-
query.offset = String(params.offset);
|
|
13959
|
-
if (params?.sort)
|
|
13960
|
-
query.sort = params.sort;
|
|
13961
|
-
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
13962
|
-
}),
|
|
13963
|
-
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
13964
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
13965
|
-
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
13966
|
-
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
13967
|
-
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
13968
|
-
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
13969
|
-
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
13970
|
-
},
|
|
13971
|
-
tags: {
|
|
13972
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
13973
|
-
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
13974
|
-
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
13975
|
-
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
13976
|
-
removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
13977
|
-
},
|
|
13978
|
-
categories: {
|
|
13979
|
-
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
13980
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
13981
|
-
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
13982
|
-
body: data
|
|
13983
|
-
})),
|
|
13984
|
-
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
13985
|
-
},
|
|
13986
|
-
tokens: {
|
|
13987
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
13988
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
13989
|
-
update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
13990
|
-
body: data
|
|
13991
|
-
})),
|
|
13992
|
-
delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
13993
|
-
}
|
|
13994
|
-
};
|
|
13995
|
-
this.media = {
|
|
13996
|
-
profiles: {
|
|
13997
|
-
list: () => wrap(async () => {
|
|
13998
|
-
const res = await this.clients.media.get("/profiles");
|
|
13999
|
-
return res.profiles;
|
|
14000
|
-
}),
|
|
14001
|
-
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
14002
|
-
get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
|
|
14003
|
-
update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
14004
|
-
delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
14005
|
-
filters: {
|
|
14006
|
-
list: (profile_id) => wrap(async () => {
|
|
14007
|
-
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
14008
|
-
return res.filters;
|
|
14009
|
-
}),
|
|
14010
|
-
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
14011
|
-
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
14012
|
-
},
|
|
14013
|
-
timeline: (slug, params) => wrap(() => {
|
|
14014
|
-
const query = {};
|
|
14015
|
-
if (params?.limit)
|
|
14016
|
-
query.limit = String(params.limit);
|
|
14017
|
-
if (params?.before)
|
|
14018
|
-
query.before = params.before;
|
|
14019
|
-
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
14020
|
-
})
|
|
14021
|
-
},
|
|
14022
|
-
connections: {
|
|
14023
|
-
list: (profile_id, options) => wrap(async () => {
|
|
14024
|
-
const query = { profile_id };
|
|
14025
|
-
if (options?.include_settings)
|
|
14026
|
-
query.include_settings = "true";
|
|
14027
|
-
const res = await this.clients.media.get("/connections", { query });
|
|
14028
|
-
return res.accounts;
|
|
14029
|
-
}),
|
|
14030
|
-
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
14031
|
-
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
14032
|
-
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
14033
|
-
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
14034
|
-
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
14035
|
-
body: { is_active }
|
|
14036
|
-
})),
|
|
14037
|
-
settings: {
|
|
14038
|
-
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
14039
|
-
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
14040
|
-
body: { settings }
|
|
14041
|
-
}))
|
|
14042
|
-
},
|
|
14043
|
-
repos: (account_id) => wrap(async () => {
|
|
14044
|
-
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
14045
|
-
return res.repos;
|
|
14046
|
-
}),
|
|
14047
|
-
subreddits: (account_id) => wrap(async () => {
|
|
14048
|
-
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
14049
|
-
return res.subreddits;
|
|
14050
|
-
})
|
|
14051
|
-
},
|
|
14052
|
-
credentials: {
|
|
14053
|
-
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
14054
|
-
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
14055
|
-
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
14056
|
-
},
|
|
14057
|
-
timeline: {
|
|
14058
|
-
get: (user_id, params) => wrap(() => {
|
|
14059
|
-
const query = {};
|
|
14060
|
-
if (params?.from)
|
|
14061
|
-
query.from = params.from;
|
|
14062
|
-
if (params?.to)
|
|
14063
|
-
query.to = params.to;
|
|
14064
|
-
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
14065
|
-
}),
|
|
14066
|
-
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
14067
|
-
query: { account_id }
|
|
14068
|
-
}))
|
|
14069
|
-
}
|
|
14070
|
-
};
|
|
14071
|
-
this.activity = {
|
|
14072
|
-
ai: (options) => wrap(() => {
|
|
14073
|
-
const query = {};
|
|
14074
|
-
if (options?.limit)
|
|
14075
|
-
query.limit = String(options.limit);
|
|
14076
|
-
if (options?.since)
|
|
14077
|
-
query.since = options.since;
|
|
14078
|
-
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
14079
|
-
})
|
|
14080
|
-
};
|
|
14081
|
-
this.admin = {
|
|
14082
|
-
verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
|
|
14083
|
-
reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
14084
|
-
};
|
|
14085
|
-
this.user = {
|
|
14086
|
-
me: () => wrap(() => this.clients.auth.get("/user/me")),
|
|
14087
|
-
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
14088
|
-
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
|
|
14089
|
-
body: data
|
|
14090
|
-
}))
|
|
14091
|
-
};
|
|
14092
|
-
this.pulse = {
|
|
14093
|
-
summary: (input) => wrap(async () => {
|
|
14094
|
-
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
14095
|
-
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
14096
|
-
});
|
|
14097
|
-
return PulseSummarySchema.parse(raw);
|
|
14098
|
-
}),
|
|
14099
|
-
events: (input) => wrap(async () => {
|
|
14100
|
-
const query = {};
|
|
14101
|
-
if (input.name)
|
|
14102
|
-
query.name = input.name;
|
|
14103
|
-
if (input.level)
|
|
14104
|
-
query.level = input.level;
|
|
14105
|
-
if (typeof input.ts_from === "number")
|
|
14106
|
-
query.ts_from = String(input.ts_from);
|
|
14107
|
-
if (typeof input.ts_to === "number")
|
|
14108
|
-
query.ts_to = String(input.ts_to);
|
|
14109
|
-
if (input.search)
|
|
14110
|
-
query.search = input.search;
|
|
14111
|
-
if (input.limit)
|
|
14112
|
-
query.limit = String(input.limit);
|
|
14113
|
-
if (input.cursor)
|
|
14114
|
-
query.cursor = input.cursor;
|
|
14115
|
-
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
14116
|
-
query
|
|
14117
|
-
});
|
|
14118
|
-
return PulseEventsPageSchema.parse(raw);
|
|
14119
|
-
}),
|
|
14120
|
-
errors: (input) => wrap(async () => {
|
|
14121
|
-
const query = {};
|
|
14122
|
-
if (typeof input.range === "string") {
|
|
14123
|
-
query.range = input.range;
|
|
14124
|
-
} else {
|
|
14125
|
-
query.from = String(input.range.from);
|
|
14126
|
-
query.to = String(input.range.to);
|
|
14127
|
-
}
|
|
14128
|
-
if (input.group_by_fingerprint)
|
|
14129
|
-
query.group_by_fingerprint = "true";
|
|
14130
|
-
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
14131
|
-
query
|
|
14132
|
-
});
|
|
14133
|
-
return PulseErrorsResultSchema.parse(raw);
|
|
14134
|
-
}),
|
|
14135
|
-
logs: (input) => wrap(async () => {
|
|
14136
|
-
const query = {};
|
|
14137
|
-
if (typeof input.range === "string") {
|
|
14138
|
-
query.range = input.range;
|
|
14139
|
-
} else {
|
|
14140
|
-
query.from = String(input.range.from);
|
|
14141
|
-
query.to = String(input.range.to);
|
|
14142
|
-
}
|
|
14143
|
-
if (input.level)
|
|
14144
|
-
query.level = input.level;
|
|
14145
|
-
if (input.search)
|
|
14146
|
-
query.search = input.search;
|
|
14147
|
-
const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
14148
|
-
return PulseLogsResultSchema.parse(raw);
|
|
14149
|
-
}),
|
|
14150
|
-
latency: (input) => wrap(async () => {
|
|
14151
|
-
const query = {};
|
|
14152
|
-
if (typeof input.range === "string") {
|
|
14153
|
-
query.range = input.range;
|
|
14154
|
-
} else {
|
|
14155
|
-
query.from = String(input.range.from);
|
|
14156
|
-
query.to = String(input.range.to);
|
|
14157
|
-
}
|
|
14158
|
-
if (input.route)
|
|
14159
|
-
query.route = input.route;
|
|
14160
|
-
if (input.percentiles && input.percentiles.length > 0)
|
|
14161
|
-
query.percentiles = input.percentiles.join(",");
|
|
14162
|
-
const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
|
|
14163
|
-
query
|
|
14164
|
-
});
|
|
14165
|
-
return PulseLatencyResultSchema.parse(raw);
|
|
14166
|
-
}),
|
|
14167
|
-
subs: {
|
|
14168
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
14169
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
14170
|
-
body: {
|
|
14171
|
-
project_id: input.project_id,
|
|
14172
|
-
name: input.name,
|
|
14173
|
-
filter: input.filter,
|
|
14174
|
-
channel: input.channel,
|
|
14175
|
-
cooldown_seconds: input.cooldown_seconds
|
|
14176
|
-
}
|
|
14177
|
-
})),
|
|
14178
|
-
get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
14179
|
-
update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
14180
|
-
delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
14181
|
-
},
|
|
14182
|
-
keys: {
|
|
14183
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
14184
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
14185
|
-
body: {
|
|
14186
|
-
project_id: input.project_id,
|
|
14187
|
-
name: input.name,
|
|
14188
|
-
rate_limit_per_min: input.rate_limit_per_min
|
|
14189
|
-
}
|
|
14190
|
-
})),
|
|
14191
|
-
delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
14192
|
-
query: { project_id: input.project_id }
|
|
14193
|
-
}))
|
|
14194
|
-
}
|
|
14195
|
-
};
|
|
14196
|
-
this.pipelines = {
|
|
14197
|
-
dashboard: {
|
|
14198
|
-
get: (input) => {
|
|
14199
|
-
const query = { project_id: input.project_id };
|
|
14200
|
-
if (input.window_ms !== undefined)
|
|
14201
|
-
query.window_ms = String(input.window_ms);
|
|
14202
|
-
return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
|
|
14203
|
-
}
|
|
14204
|
-
},
|
|
14205
|
-
list: (filter) => {
|
|
14206
|
-
const query = {};
|
|
14207
|
-
if (filter?.package_id !== undefined)
|
|
14208
|
-
query.package_id = filter.package_id;
|
|
14209
|
-
if (filter?.status !== undefined)
|
|
14210
|
-
query.status = filter.status;
|
|
14211
|
-
if (filter?.limit !== undefined)
|
|
14212
|
-
query.limit = String(filter.limit);
|
|
14213
|
-
return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14214
|
-
},
|
|
14215
|
-
get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
14216
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
|
|
14217
|
-
body: input
|
|
14218
|
-
})),
|
|
14219
|
-
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
14220
|
-
body: input
|
|
14221
|
-
})),
|
|
14222
|
-
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
14223
|
-
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
14224
|
-
redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
14225
|
-
dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
|
|
14226
|
-
events: {
|
|
14227
|
-
ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
14228
|
-
body: input
|
|
14229
|
-
})),
|
|
14230
|
-
list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
14231
|
-
},
|
|
14232
|
-
grants: {
|
|
14233
|
-
list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
|
|
14234
|
-
query: package_id ? { package_id } : {}
|
|
14235
|
-
})),
|
|
14236
|
-
approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
14237
|
-
body: {}
|
|
14238
|
-
})),
|
|
14239
|
-
deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
14240
|
-
body: reason !== undefined ? { reason } : {}
|
|
14241
|
-
}))
|
|
14242
|
-
},
|
|
14243
|
-
packages: {
|
|
14244
|
-
list: (filter) => {
|
|
14245
|
-
const query = {};
|
|
14246
|
-
if (filter?.project_id !== undefined)
|
|
14247
|
-
query.project_id = filter.project_id;
|
|
14248
|
-
return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14249
|
-
},
|
|
14250
|
-
get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
14251
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
14252
|
-
update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
14253
|
-
delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
14254
|
-
},
|
|
14255
|
-
analysis_templates: {
|
|
14256
|
-
list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
|
|
14257
|
-
query: { owner_id: input.owner_id }
|
|
14258
|
-
})),
|
|
14259
|
-
get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
14260
|
-
query: { owner_id: input.owner_id }
|
|
14261
|
-
})),
|
|
14262
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
14263
|
-
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
|
|
14264
|
-
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
14265
|
-
query: { owner_id: input.owner_id }
|
|
14266
|
-
}))
|
|
14267
|
-
},
|
|
14268
|
-
oidc_trust: {
|
|
14269
|
-
list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
14270
|
-
get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
|
|
14271
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
14272
|
-
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
|
|
14273
|
-
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
14274
|
-
query: { owner_id: input.owner_id }
|
|
14275
|
-
}))
|
|
14276
|
-
}
|
|
14277
|
-
};
|
|
14278
13664
|
const base_url = options.base_url || "http://localhost:4321/api/v1";
|
|
14279
13665
|
this.api_key_field = options.api_key ?? "";
|
|
14280
13666
|
this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
|
|
@@ -14312,9 +13698,636 @@ var ApiClient2 = class {
|
|
|
14312
13698
|
admin: new ApiClient({ ...clientOptions, category: "admin" })
|
|
14313
13699
|
};
|
|
14314
13700
|
}
|
|
13701
|
+
auth = {
|
|
13702
|
+
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
13703
|
+
keys: {
|
|
13704
|
+
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
13705
|
+
create: (input) => {
|
|
13706
|
+
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
13707
|
+
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
13708
|
+
},
|
|
13709
|
+
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
13710
|
+
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
13711
|
+
}
|
|
13712
|
+
};
|
|
13713
|
+
projects = {
|
|
13714
|
+
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
13715
|
+
map: async (filters) => wrap(async () => {
|
|
13716
|
+
const result = await this.projects.list(filters);
|
|
13717
|
+
if (!result.ok)
|
|
13718
|
+
throw new Error(result.error.message);
|
|
13719
|
+
return result.value.reduce((acc, project) => {
|
|
13720
|
+
acc[project.id] = project;
|
|
13721
|
+
return acc;
|
|
13722
|
+
}, {});
|
|
13723
|
+
}),
|
|
13724
|
+
find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
13725
|
+
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
13726
|
+
getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
13727
|
+
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13728
|
+
update: async (idOrData, changes) => wrap(async () => {
|
|
13729
|
+
if (typeof idOrData === "object" && idOrData.id) {
|
|
13730
|
+
return this.clients.projects.patch("/projects", {
|
|
13731
|
+
body: idOrData
|
|
13732
|
+
});
|
|
13733
|
+
}
|
|
13734
|
+
const id = idOrData;
|
|
13735
|
+
if (!changes) {
|
|
13736
|
+
throw new Error("Changes parameter required for update");
|
|
13737
|
+
}
|
|
13738
|
+
const result = await this.projects.find(id);
|
|
13739
|
+
if (!result.ok)
|
|
13740
|
+
throw new Error(result.error.message);
|
|
13741
|
+
if (!result.value)
|
|
13742
|
+
throw new Error(`Project with id ${id} not found`);
|
|
13743
|
+
const project = result.value;
|
|
13744
|
+
const updateData = {
|
|
13745
|
+
id: project.id,
|
|
13746
|
+
project_id: project.project_id,
|
|
13747
|
+
owner_id: project.owner_id,
|
|
13748
|
+
name: project.name,
|
|
13749
|
+
description: project.description,
|
|
13750
|
+
specification: project.specification,
|
|
13751
|
+
repo_url: project.repo_url,
|
|
13752
|
+
repo_id: project.repo_id,
|
|
13753
|
+
icon_url: project.icon_url,
|
|
13754
|
+
status: project.status,
|
|
13755
|
+
deleted: project.deleted,
|
|
13756
|
+
link_url: project.link_url,
|
|
13757
|
+
link_text: project.link_text,
|
|
13758
|
+
visibility: project.visibility,
|
|
13759
|
+
current_version: project.current_version,
|
|
13760
|
+
...changes
|
|
13761
|
+
};
|
|
13762
|
+
return this.clients.projects.patch("/projects", {
|
|
13763
|
+
body: updateData
|
|
13764
|
+
});
|
|
13765
|
+
}),
|
|
13766
|
+
config: {
|
|
13767
|
+
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
13768
|
+
query: { project_id }
|
|
13769
|
+
})),
|
|
13770
|
+
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
13771
|
+
body: request
|
|
13772
|
+
}))
|
|
13773
|
+
},
|
|
13774
|
+
scan: {
|
|
13775
|
+
initiate: async (project_id) => {
|
|
13776
|
+
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
13777
|
+
method: "POST",
|
|
13778
|
+
headers: this.clients.projects.headers()
|
|
13779
|
+
});
|
|
13780
|
+
if (!response.body) {
|
|
13781
|
+
throw new Error("No response body");
|
|
13782
|
+
}
|
|
13783
|
+
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
13784
|
+
return stream;
|
|
13785
|
+
},
|
|
13786
|
+
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
13787
|
+
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
13788
|
+
query: { project_id },
|
|
13789
|
+
body: data
|
|
13790
|
+
}))
|
|
13791
|
+
},
|
|
13792
|
+
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
13793
|
+
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13794
|
+
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
13795
|
+
query: { project_id }
|
|
13796
|
+
})),
|
|
13797
|
+
deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
|
|
13798
|
+
body: { ...project, deleted: true }
|
|
13799
|
+
})),
|
|
13800
|
+
graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
13801
|
+
getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
13802
|
+
putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
13803
|
+
};
|
|
13804
|
+
milestones = {
|
|
13805
|
+
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
13806
|
+
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
13807
|
+
lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
13808
|
+
query: depth ? { depth: String(depth) } : {}
|
|
13809
|
+
})),
|
|
13810
|
+
find: (id) => wrap(async () => {
|
|
13811
|
+
try {
|
|
13812
|
+
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
13813
|
+
} catch {
|
|
13814
|
+
return null;
|
|
13815
|
+
}
|
|
13816
|
+
}),
|
|
13817
|
+
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
13818
|
+
update: async (id, data) => wrap(async () => {
|
|
13819
|
+
const result = await this.milestones.find(id);
|
|
13820
|
+
if (!result.ok)
|
|
13821
|
+
throw new Error(result.error.message);
|
|
13822
|
+
if (!result.value)
|
|
13823
|
+
throw new Error(`Milestone with id ${id} not found`);
|
|
13824
|
+
const milestone = result.value;
|
|
13825
|
+
const updateData = {
|
|
13826
|
+
id: milestone.id,
|
|
13827
|
+
project_id: milestone.project_id,
|
|
13828
|
+
name: data.name ?? milestone.name,
|
|
13829
|
+
description: data.description ?? milestone.description,
|
|
13830
|
+
target_time: data.target_time ?? milestone.target_time,
|
|
13831
|
+
target_version: data.target_version ?? milestone.target_version,
|
|
13832
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
13833
|
+
};
|
|
13834
|
+
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
13835
|
+
body: updateData
|
|
13836
|
+
});
|
|
13837
|
+
}),
|
|
13838
|
+
delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
13839
|
+
goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
13840
|
+
};
|
|
13841
|
+
hooks = {
|
|
13842
|
+
list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
13843
|
+
upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
13844
|
+
delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
13845
|
+
setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
13846
|
+
deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
13847
|
+
};
|
|
13848
|
+
goals = {
|
|
13849
|
+
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
13850
|
+
find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
|
|
13851
|
+
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
13852
|
+
update: async (id, data) => wrap(async () => {
|
|
13853
|
+
const result = await this.goals.find(id);
|
|
13854
|
+
if (!result.ok)
|
|
13855
|
+
throw new Error(result.error.message);
|
|
13856
|
+
if (!result.value)
|
|
13857
|
+
throw new Error(`Goal with id ${id} not found`);
|
|
13858
|
+
const goal = result.value;
|
|
13859
|
+
const updateData = {
|
|
13860
|
+
id: goal.id,
|
|
13861
|
+
milestone_id: goal.milestone_id,
|
|
13862
|
+
name: data.name ?? goal.name,
|
|
13863
|
+
description: data.description ?? goal.description,
|
|
13864
|
+
target_time: data.target_time ?? goal.target_time,
|
|
13865
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
13866
|
+
};
|
|
13867
|
+
return this.clients.goals.patch(`/goals/${id}`, {
|
|
13868
|
+
body: updateData
|
|
13869
|
+
});
|
|
13870
|
+
}),
|
|
13871
|
+
delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
|
|
13872
|
+
};
|
|
13873
|
+
tasks = {
|
|
13874
|
+
list: (filters) => wrap(() => {
|
|
13875
|
+
const query = {};
|
|
13876
|
+
if (filters?.project_id)
|
|
13877
|
+
query.project = filters.project_id;
|
|
13878
|
+
if (filters?.tag_id)
|
|
13879
|
+
query.tag = filters.tag_id;
|
|
13880
|
+
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
13881
|
+
}),
|
|
13882
|
+
find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
13883
|
+
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
13884
|
+
query: { project: project_id }
|
|
13885
|
+
})),
|
|
13886
|
+
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13887
|
+
update: async (id, changes) => wrap(async () => {
|
|
13888
|
+
const result = await this.tasks.find(id);
|
|
13889
|
+
if (!result.ok)
|
|
13890
|
+
throw new Error(result.error.message);
|
|
13891
|
+
if (!result.value)
|
|
13892
|
+
throw new Error(`Task with id ${id} not found`);
|
|
13893
|
+
const task = result.value;
|
|
13894
|
+
const updateData = {
|
|
13895
|
+
id,
|
|
13896
|
+
title: task.task.title,
|
|
13897
|
+
summary: task.task.summary,
|
|
13898
|
+
description: task.task.description,
|
|
13899
|
+
progress: task.task.progress,
|
|
13900
|
+
visibility: task.task.visibility,
|
|
13901
|
+
start_time: task.task.start_time,
|
|
13902
|
+
end_time: task.task.end_time,
|
|
13903
|
+
priority: task.task.priority,
|
|
13904
|
+
owner_id: task.task.owner_id,
|
|
13905
|
+
project_id: task.task.project_id,
|
|
13906
|
+
...changes
|
|
13907
|
+
};
|
|
13908
|
+
return this.clients.tasks.patch("/tasks", {
|
|
13909
|
+
body: updateData
|
|
13910
|
+
});
|
|
13911
|
+
}),
|
|
13912
|
+
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13913
|
+
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
13914
|
+
deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
13915
|
+
body: { ...task.task, deleted: true }
|
|
13916
|
+
})),
|
|
13917
|
+
history: {
|
|
13918
|
+
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
13919
|
+
},
|
|
13920
|
+
ready: (filters) => wrap(() => {
|
|
13921
|
+
const query = {};
|
|
13922
|
+
if (filters?.project_id)
|
|
13923
|
+
query.project = filters.project_id;
|
|
13924
|
+
if (filters?.limit)
|
|
13925
|
+
query.limit = String(filters.limit);
|
|
13926
|
+
if (filters?.cursor)
|
|
13927
|
+
query.cursor = filters.cursor;
|
|
13928
|
+
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
13929
|
+
}),
|
|
13930
|
+
tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
13931
|
+
near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
13932
|
+
ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
13933
|
+
claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
13934
|
+
done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
13935
|
+
reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
13936
|
+
advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
13937
|
+
link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
13938
|
+
unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
13939
|
+
apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
13940
|
+
};
|
|
13941
|
+
tags = {
|
|
13942
|
+
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
13943
|
+
};
|
|
13944
|
+
docs = {
|
|
13945
|
+
list: (filters) => wrap(() => {
|
|
13946
|
+
const query = { project_id: filters.project_id };
|
|
13947
|
+
if (filters.task_id)
|
|
13948
|
+
query.task_id = filters.task_id;
|
|
13949
|
+
return this.clients.docs.get("/docs", { query });
|
|
13950
|
+
}),
|
|
13951
|
+
push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
|
|
13952
|
+
pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
13953
|
+
versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
13954
|
+
renderUrl: (id, version) => {
|
|
13955
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
13956
|
+
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
13957
|
+
},
|
|
13958
|
+
createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
13959
|
+
replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
13960
|
+
resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
13961
|
+
toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
13962
|
+
unresolved: (filters) => wrap(() => {
|
|
13963
|
+
const query = {};
|
|
13964
|
+
if (filters.project_id)
|
|
13965
|
+
query.project_id = filters.project_id;
|
|
13966
|
+
if (filters.document_id)
|
|
13967
|
+
query.document_id = filters.document_id;
|
|
13968
|
+
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
13969
|
+
}),
|
|
13970
|
+
pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
13971
|
+
interfaceStatus: (filters) => wrap(() => {
|
|
13972
|
+
const query = { project_id: filters.project_id, title: filters.title };
|
|
13973
|
+
if (filters.task_id)
|
|
13974
|
+
query.task_id = filters.task_id;
|
|
13975
|
+
return this.clients.docs.get("/docs/interface/status", { query });
|
|
13976
|
+
})
|
|
13977
|
+
};
|
|
13978
|
+
signoffs = {
|
|
13979
|
+
request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
13980
|
+
find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
13981
|
+
findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
13982
|
+
decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
13983
|
+
};
|
|
13984
|
+
reviews = {
|
|
13985
|
+
pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
|
|
13986
|
+
};
|
|
13987
|
+
github = {
|
|
13988
|
+
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
13989
|
+
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
13990
|
+
};
|
|
13991
|
+
blog = {
|
|
13992
|
+
posts: {
|
|
13993
|
+
list: (params) => wrap(() => {
|
|
13994
|
+
const query = {};
|
|
13995
|
+
if (params?.category)
|
|
13996
|
+
query.category = params.category;
|
|
13997
|
+
if (params?.tag)
|
|
13998
|
+
query.tag = params.tag;
|
|
13999
|
+
if (params?.project)
|
|
14000
|
+
query.project = params.project;
|
|
14001
|
+
if (params?.status)
|
|
14002
|
+
query.status = params.status;
|
|
14003
|
+
if (params?.archived !== undefined)
|
|
14004
|
+
query.archived = String(params.archived);
|
|
14005
|
+
if (params?.limit)
|
|
14006
|
+
query.limit = String(params.limit);
|
|
14007
|
+
if (params?.offset !== undefined)
|
|
14008
|
+
query.offset = String(params.offset);
|
|
14009
|
+
if (params?.sort)
|
|
14010
|
+
query.sort = params.sort;
|
|
14011
|
+
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
14012
|
+
}),
|
|
14013
|
+
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
14014
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
14015
|
+
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
14016
|
+
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
14017
|
+
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
14018
|
+
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
14019
|
+
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
14020
|
+
},
|
|
14021
|
+
tags: {
|
|
14022
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
14023
|
+
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
14024
|
+
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14025
|
+
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14026
|
+
removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
14027
|
+
},
|
|
14028
|
+
categories: {
|
|
14029
|
+
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
14030
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
14031
|
+
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
14032
|
+
body: data
|
|
14033
|
+
})),
|
|
14034
|
+
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
14035
|
+
},
|
|
14036
|
+
tokens: {
|
|
14037
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
14038
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
14039
|
+
update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
14040
|
+
body: data
|
|
14041
|
+
})),
|
|
14042
|
+
delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
14043
|
+
}
|
|
14044
|
+
};
|
|
14045
|
+
media = {
|
|
14046
|
+
profiles: {
|
|
14047
|
+
list: () => wrap(async () => {
|
|
14048
|
+
const res = await this.clients.media.get("/profiles");
|
|
14049
|
+
return res.profiles;
|
|
14050
|
+
}),
|
|
14051
|
+
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
14052
|
+
get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
|
|
14053
|
+
update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
14054
|
+
delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
14055
|
+
filters: {
|
|
14056
|
+
list: (profile_id) => wrap(async () => {
|
|
14057
|
+
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
14058
|
+
return res.filters;
|
|
14059
|
+
}),
|
|
14060
|
+
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
14061
|
+
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
14062
|
+
},
|
|
14063
|
+
timeline: (slug, params) => wrap(() => {
|
|
14064
|
+
const query = {};
|
|
14065
|
+
if (params?.limit)
|
|
14066
|
+
query.limit = String(params.limit);
|
|
14067
|
+
if (params?.before)
|
|
14068
|
+
query.before = params.before;
|
|
14069
|
+
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
14070
|
+
})
|
|
14071
|
+
},
|
|
14072
|
+
connections: {
|
|
14073
|
+
list: (profile_id, options) => wrap(async () => {
|
|
14074
|
+
const query = { profile_id };
|
|
14075
|
+
if (options?.include_settings)
|
|
14076
|
+
query.include_settings = "true";
|
|
14077
|
+
const res = await this.clients.media.get("/connections", { query });
|
|
14078
|
+
return res.accounts;
|
|
14079
|
+
}),
|
|
14080
|
+
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
14081
|
+
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
14082
|
+
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
14083
|
+
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
14084
|
+
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
14085
|
+
body: { is_active }
|
|
14086
|
+
})),
|
|
14087
|
+
settings: {
|
|
14088
|
+
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
14089
|
+
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
14090
|
+
body: { settings }
|
|
14091
|
+
}))
|
|
14092
|
+
},
|
|
14093
|
+
repos: (account_id) => wrap(async () => {
|
|
14094
|
+
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
14095
|
+
return res.repos;
|
|
14096
|
+
}),
|
|
14097
|
+
subreddits: (account_id) => wrap(async () => {
|
|
14098
|
+
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
14099
|
+
return res.subreddits;
|
|
14100
|
+
})
|
|
14101
|
+
},
|
|
14102
|
+
credentials: {
|
|
14103
|
+
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
14104
|
+
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
14105
|
+
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
14106
|
+
},
|
|
14107
|
+
timeline: {
|
|
14108
|
+
get: (user_id, params) => wrap(() => {
|
|
14109
|
+
const query = {};
|
|
14110
|
+
if (params?.from)
|
|
14111
|
+
query.from = params.from;
|
|
14112
|
+
if (params?.to)
|
|
14113
|
+
query.to = params.to;
|
|
14114
|
+
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
14115
|
+
}),
|
|
14116
|
+
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
14117
|
+
query: { account_id }
|
|
14118
|
+
}))
|
|
14119
|
+
}
|
|
14120
|
+
};
|
|
14121
|
+
activity = {
|
|
14122
|
+
ai: (options) => wrap(() => {
|
|
14123
|
+
const query = {};
|
|
14124
|
+
if (options?.limit)
|
|
14125
|
+
query.limit = String(options.limit);
|
|
14126
|
+
if (options?.since)
|
|
14127
|
+
query.since = options.since;
|
|
14128
|
+
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
14129
|
+
})
|
|
14130
|
+
};
|
|
14131
|
+
admin = {
|
|
14132
|
+
verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
|
|
14133
|
+
reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
14134
|
+
};
|
|
14135
|
+
user = {
|
|
14136
|
+
me: () => wrap(() => this.clients.auth.get("/user/me")),
|
|
14137
|
+
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
14138
|
+
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
|
|
14139
|
+
body: data
|
|
14140
|
+
}))
|
|
14141
|
+
};
|
|
14315
14142
|
history() {
|
|
14316
14143
|
return this.clients.projects.history();
|
|
14317
14144
|
}
|
|
14145
|
+
pulse = {
|
|
14146
|
+
summary: (input) => wrap(async () => {
|
|
14147
|
+
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
14148
|
+
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
14149
|
+
});
|
|
14150
|
+
return PulseSummarySchema.parse(raw);
|
|
14151
|
+
}),
|
|
14152
|
+
events: (input) => wrap(async () => {
|
|
14153
|
+
const query = {};
|
|
14154
|
+
if (input.name)
|
|
14155
|
+
query.name = input.name;
|
|
14156
|
+
if (input.level)
|
|
14157
|
+
query.level = input.level;
|
|
14158
|
+
if (typeof input.ts_from === "number")
|
|
14159
|
+
query.ts_from = String(input.ts_from);
|
|
14160
|
+
if (typeof input.ts_to === "number")
|
|
14161
|
+
query.ts_to = String(input.ts_to);
|
|
14162
|
+
if (input.search)
|
|
14163
|
+
query.search = input.search;
|
|
14164
|
+
if (input.limit)
|
|
14165
|
+
query.limit = String(input.limit);
|
|
14166
|
+
if (input.cursor)
|
|
14167
|
+
query.cursor = input.cursor;
|
|
14168
|
+
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
14169
|
+
query
|
|
14170
|
+
});
|
|
14171
|
+
return PulseEventsPageSchema.parse(raw);
|
|
14172
|
+
}),
|
|
14173
|
+
errors: (input) => wrap(async () => {
|
|
14174
|
+
const query = {};
|
|
14175
|
+
if (typeof input.range === "string") {
|
|
14176
|
+
query.range = input.range;
|
|
14177
|
+
} else {
|
|
14178
|
+
query.from = String(input.range.from);
|
|
14179
|
+
query.to = String(input.range.to);
|
|
14180
|
+
}
|
|
14181
|
+
if (input.group_by_fingerprint)
|
|
14182
|
+
query.group_by_fingerprint = "true";
|
|
14183
|
+
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
14184
|
+
query
|
|
14185
|
+
});
|
|
14186
|
+
return PulseErrorsResultSchema.parse(raw);
|
|
14187
|
+
}),
|
|
14188
|
+
logs: (input) => wrap(async () => {
|
|
14189
|
+
const query = {};
|
|
14190
|
+
if (typeof input.range === "string") {
|
|
14191
|
+
query.range = input.range;
|
|
14192
|
+
} else {
|
|
14193
|
+
query.from = String(input.range.from);
|
|
14194
|
+
query.to = String(input.range.to);
|
|
14195
|
+
}
|
|
14196
|
+
if (input.level)
|
|
14197
|
+
query.level = input.level;
|
|
14198
|
+
if (input.search)
|
|
14199
|
+
query.search = input.search;
|
|
14200
|
+
const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
14201
|
+
return PulseLogsResultSchema.parse(raw);
|
|
14202
|
+
}),
|
|
14203
|
+
latency: (input) => wrap(async () => {
|
|
14204
|
+
const query = {};
|
|
14205
|
+
if (typeof input.range === "string") {
|
|
14206
|
+
query.range = input.range;
|
|
14207
|
+
} else {
|
|
14208
|
+
query.from = String(input.range.from);
|
|
14209
|
+
query.to = String(input.range.to);
|
|
14210
|
+
}
|
|
14211
|
+
if (input.route)
|
|
14212
|
+
query.route = input.route;
|
|
14213
|
+
if (input.percentiles && input.percentiles.length > 0)
|
|
14214
|
+
query.percentiles = input.percentiles.join(",");
|
|
14215
|
+
const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
|
|
14216
|
+
query
|
|
14217
|
+
});
|
|
14218
|
+
return PulseLatencyResultSchema.parse(raw);
|
|
14219
|
+
}),
|
|
14220
|
+
subs: {
|
|
14221
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
14222
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
14223
|
+
body: {
|
|
14224
|
+
project_id: input.project_id,
|
|
14225
|
+
name: input.name,
|
|
14226
|
+
filter: input.filter,
|
|
14227
|
+
channel: input.channel,
|
|
14228
|
+
cooldown_seconds: input.cooldown_seconds
|
|
14229
|
+
}
|
|
14230
|
+
})),
|
|
14231
|
+
get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
14232
|
+
update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
14233
|
+
delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
14234
|
+
},
|
|
14235
|
+
keys: {
|
|
14236
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
14237
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
14238
|
+
body: {
|
|
14239
|
+
project_id: input.project_id,
|
|
14240
|
+
name: input.name,
|
|
14241
|
+
rate_limit_per_min: input.rate_limit_per_min
|
|
14242
|
+
}
|
|
14243
|
+
})),
|
|
14244
|
+
delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
14245
|
+
query: { project_id: input.project_id }
|
|
14246
|
+
}))
|
|
14247
|
+
}
|
|
14248
|
+
};
|
|
14249
|
+
pipelines = {
|
|
14250
|
+
dashboard: {
|
|
14251
|
+
get: (input) => {
|
|
14252
|
+
const query = { project_id: input.project_id };
|
|
14253
|
+
if (input.window_ms !== undefined)
|
|
14254
|
+
query.window_ms = String(input.window_ms);
|
|
14255
|
+
return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
|
|
14256
|
+
}
|
|
14257
|
+
},
|
|
14258
|
+
list: (filter) => {
|
|
14259
|
+
const query = {};
|
|
14260
|
+
if (filter?.package_id !== undefined)
|
|
14261
|
+
query.package_id = filter.package_id;
|
|
14262
|
+
if (filter?.status !== undefined)
|
|
14263
|
+
query.status = filter.status;
|
|
14264
|
+
if (filter?.limit !== undefined)
|
|
14265
|
+
query.limit = String(filter.limit);
|
|
14266
|
+
return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14267
|
+
},
|
|
14268
|
+
get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
14269
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
|
|
14270
|
+
body: input
|
|
14271
|
+
})),
|
|
14272
|
+
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
14273
|
+
body: input
|
|
14274
|
+
})),
|
|
14275
|
+
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
14276
|
+
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
14277
|
+
redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
14278
|
+
dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
|
|
14279
|
+
events: {
|
|
14280
|
+
ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
14281
|
+
body: input
|
|
14282
|
+
})),
|
|
14283
|
+
list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
14284
|
+
},
|
|
14285
|
+
grants: {
|
|
14286
|
+
list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
|
|
14287
|
+
query: package_id ? { package_id } : {}
|
|
14288
|
+
})),
|
|
14289
|
+
approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
14290
|
+
body: {}
|
|
14291
|
+
})),
|
|
14292
|
+
deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
14293
|
+
body: reason !== undefined ? { reason } : {}
|
|
14294
|
+
}))
|
|
14295
|
+
},
|
|
14296
|
+
packages: {
|
|
14297
|
+
list: (filter) => {
|
|
14298
|
+
const query = {};
|
|
14299
|
+
if (filter?.project_id !== undefined)
|
|
14300
|
+
query.project_id = filter.project_id;
|
|
14301
|
+
return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14302
|
+
},
|
|
14303
|
+
get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
14304
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
14305
|
+
update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
14306
|
+
delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
14307
|
+
},
|
|
14308
|
+
analysis_templates: {
|
|
14309
|
+
list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
|
|
14310
|
+
query: { owner_id: input.owner_id }
|
|
14311
|
+
})),
|
|
14312
|
+
get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
14313
|
+
query: { owner_id: input.owner_id }
|
|
14314
|
+
})),
|
|
14315
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
14316
|
+
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
|
|
14317
|
+
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
14318
|
+
query: { owner_id: input.owner_id }
|
|
14319
|
+
}))
|
|
14320
|
+
},
|
|
14321
|
+
oidc_trust: {
|
|
14322
|
+
list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
14323
|
+
get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
|
|
14324
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
14325
|
+
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
|
|
14326
|
+
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
14327
|
+
query: { owner_id: input.owner_id }
|
|
14328
|
+
}))
|
|
14329
|
+
}
|
|
14330
|
+
};
|
|
14318
14331
|
getApiKey() {
|
|
14319
14332
|
return this.api_key_field;
|
|
14320
14333
|
}
|
|
@@ -16016,6 +16029,8 @@ var PulseLatencyResultSchema2 = objectType({
|
|
|
16016
16029
|
by_minute: arrayType(PulseLatencyByMinuteSchema2)
|
|
16017
16030
|
});
|
|
16018
16031
|
var ApiError2 = class _ApiError extends Error {
|
|
16032
|
+
code;
|
|
16033
|
+
statusCode;
|
|
16019
16034
|
constructor(message, options = {}) {
|
|
16020
16035
|
super(message);
|
|
16021
16036
|
this.name = "ApiError";
|
|
@@ -16086,11 +16101,12 @@ function handleNetworkError2(error) {
|
|
|
16086
16101
|
var ArrayBufferedQueue2 = class {
|
|
16087
16102
|
constructor(capacity) {
|
|
16088
16103
|
this.capacity = capacity;
|
|
16089
|
-
this.entries = [];
|
|
16090
|
-
this.head = 0;
|
|
16091
|
-
this.tail = 0;
|
|
16092
|
-
this.count = 0;
|
|
16093
16104
|
}
|
|
16105
|
+
capacity;
|
|
16106
|
+
entries = [];
|
|
16107
|
+
head = 0;
|
|
16108
|
+
tail = 0;
|
|
16109
|
+
count = 0;
|
|
16094
16110
|
latest() {
|
|
16095
16111
|
if (this.count === 0)
|
|
16096
16112
|
return null;
|
|
@@ -16124,8 +16140,16 @@ var ArrayBufferedQueue2 = class {
|
|
|
16124
16140
|
}
|
|
16125
16141
|
};
|
|
16126
16142
|
var ApiClient3 = class {
|
|
16143
|
+
base_url;
|
|
16144
|
+
api_key;
|
|
16145
|
+
request_history;
|
|
16146
|
+
category = "api";
|
|
16147
|
+
default_headers;
|
|
16148
|
+
custom_fetch;
|
|
16149
|
+
credentials;
|
|
16150
|
+
auth_mode;
|
|
16151
|
+
debug;
|
|
16127
16152
|
constructor(options) {
|
|
16128
|
-
this.category = "api";
|
|
16129
16153
|
this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
|
|
16130
16154
|
if (this.auth_mode !== "cookie") {
|
|
16131
16155
|
if (!options.api_key)
|
|
@@ -16218,737 +16242,113 @@ var ApiClient3 = class {
|
|
|
16218
16242
|
this.request_history.add(historyEntry);
|
|
16219
16243
|
throw error;
|
|
16220
16244
|
}
|
|
16221
|
-
}
|
|
16222
|
-
this.request_history.add(historyEntry);
|
|
16223
|
-
let result;
|
|
16224
|
-
if (response.status === HTTP_STATUS2.NO_CONTENT) {
|
|
16225
|
-
result = undefined;
|
|
16226
|
-
} else {
|
|
16227
|
-
const text2 = await response.text();
|
|
16228
|
-
if (!text2 || text2.trim() === "" || text2.trim() === "null") {
|
|
16229
|
-
result = undefined;
|
|
16230
|
-
} else {
|
|
16231
|
-
try {
|
|
16232
|
-
const raw = JSON.parse(text2);
|
|
16233
|
-
result = raw;
|
|
16234
|
-
} catch {
|
|
16235
|
-
result = text2;
|
|
16236
|
-
}
|
|
16237
|
-
}
|
|
16238
|
-
}
|
|
16239
|
-
if (this.debug) {
|
|
16240
|
-
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
16241
|
-
status: response.status,
|
|
16242
|
-
duration: `${String(duration)}ms`
|
|
16243
|
-
});
|
|
16244
|
-
}
|
|
16245
|
-
return result;
|
|
16246
|
-
} catch (error) {
|
|
16247
|
-
const duration = Date.now() - startTime;
|
|
16248
|
-
if (this.debug) {
|
|
16249
|
-
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
16250
|
-
url,
|
|
16251
|
-
duration: `${String(duration)}ms`,
|
|
16252
|
-
error: error instanceof Error ? error.message : String(error),
|
|
16253
|
-
body,
|
|
16254
|
-
query
|
|
16255
|
-
});
|
|
16256
|
-
}
|
|
16257
|
-
if (error instanceof ApiError2 || error instanceof AuthenticationError2) {
|
|
16258
|
-
throw error;
|
|
16259
|
-
}
|
|
16260
|
-
historyEntry.duration = duration;
|
|
16261
|
-
try {
|
|
16262
|
-
handleNetworkError2(error);
|
|
16263
|
-
} catch (networkError) {
|
|
16264
|
-
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
16265
|
-
historyEntry.error = errorMessage;
|
|
16266
|
-
this.request_history.add(historyEntry);
|
|
16267
|
-
throw networkError;
|
|
16268
|
-
}
|
|
16269
|
-
}
|
|
16270
|
-
}
|
|
16271
|
-
get(path, options = {}) {
|
|
16272
|
-
return this.request(path, { ...options, method: "GET" });
|
|
16273
|
-
}
|
|
16274
|
-
post(path, options = {}) {
|
|
16275
|
-
return this.request(path, { ...options, method: "POST" });
|
|
16276
|
-
}
|
|
16277
|
-
patch(path, options = {}) {
|
|
16278
|
-
return this.request(path, { ...options, method: "PATCH" });
|
|
16279
|
-
}
|
|
16280
|
-
put(path, options = {}) {
|
|
16281
|
-
return this.request(path, { ...options, method: "PUT" });
|
|
16282
|
-
}
|
|
16283
|
-
delete(path, options = {}) {
|
|
16284
|
-
return this.request(path, { ...options, method: "DELETE" });
|
|
16285
|
-
}
|
|
16286
|
-
history() {
|
|
16287
|
-
return this.request_history;
|
|
16288
|
-
}
|
|
16289
|
-
url() {
|
|
16290
|
-
return this.base_url;
|
|
16291
|
-
}
|
|
16292
|
-
headers() {
|
|
16293
|
-
const headers = {
|
|
16294
|
-
"Content-Type": "application/json"
|
|
16295
|
-
};
|
|
16296
|
-
if (this.auth_mode === "session") {
|
|
16297
|
-
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
16298
|
-
} else if (this.auth_mode === "key") {
|
|
16299
|
-
headers["X-API-KEY"] = this.api_key;
|
|
16300
|
-
}
|
|
16301
|
-
return headers;
|
|
16302
|
-
}
|
|
16303
|
-
};
|
|
16304
|
-
var string_field2 = (value, key) => {
|
|
16305
|
-
if (typeof value !== "object" || value === null || !(key in value))
|
|
16306
|
-
return;
|
|
16307
|
-
const field = value[key];
|
|
16308
|
-
return typeof field === "string" ? field : undefined;
|
|
16309
|
-
};
|
|
16310
|
-
var number_field2 = (value, key) => {
|
|
16311
|
-
if (typeof value !== "object" || value === null || !(key in value))
|
|
16312
|
-
return;
|
|
16313
|
-
const field = value[key];
|
|
16314
|
-
return typeof field === "number" ? field : undefined;
|
|
16315
|
-
};
|
|
16316
|
-
function wrap2(fn) {
|
|
16317
|
-
return fn().then((data) => ok(data)).catch((error) => err({
|
|
16318
|
-
message: error instanceof Error ? error.message : "Unknown error",
|
|
16319
|
-
code: string_field2(error, "code"),
|
|
16320
|
-
status_code: number_field2(error, "statusCode") ?? number_field2(error, "status_code")
|
|
16321
|
-
}));
|
|
16322
|
-
}
|
|
16323
|
-
var ApiClient22 = class {
|
|
16324
|
-
constructor(options) {
|
|
16325
|
-
this.auth = {
|
|
16326
|
-
session: () => wrap2(() => this.clients.auth_root.get("/auth/session")),
|
|
16327
|
-
keys: {
|
|
16328
|
-
list: () => wrap2(() => this.clients.auth.get("/keys")),
|
|
16329
|
-
create: (input) => {
|
|
16330
|
-
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
16331
|
-
return wrap2(() => this.clients.auth.post("/keys", { body }));
|
|
16332
|
-
},
|
|
16333
|
-
revoke: (key_id) => wrap2(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
16334
|
-
remove: (key_id) => wrap2(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
16335
|
-
}
|
|
16336
|
-
};
|
|
16337
|
-
this.projects = {
|
|
16338
|
-
list: (filters) => wrap2(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
16339
|
-
map: async (filters) => wrap2(async () => {
|
|
16340
|
-
const result = await this.projects.list(filters);
|
|
16341
|
-
if (!result.ok)
|
|
16342
|
-
throw new Error(result.error.message);
|
|
16343
|
-
return result.value.reduce((acc, project) => {
|
|
16344
|
-
acc[project.id] = project;
|
|
16345
|
-
return acc;
|
|
16346
|
-
}, {});
|
|
16347
|
-
}),
|
|
16348
|
-
find: (id) => wrap2(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
16349
|
-
getByName: (name) => wrap2(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
16350
|
-
getById: (id) => wrap2(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
16351
|
-
create: (data) => wrap2(() => this.clients.projects.patch("/projects", { body: data })),
|
|
16352
|
-
update: async (idOrData, changes) => wrap2(async () => {
|
|
16353
|
-
if (typeof idOrData === "object" && idOrData.id) {
|
|
16354
|
-
return this.clients.projects.patch("/projects", {
|
|
16355
|
-
body: idOrData
|
|
16356
|
-
});
|
|
16357
|
-
}
|
|
16358
|
-
const id = idOrData;
|
|
16359
|
-
if (!changes) {
|
|
16360
|
-
throw new Error("Changes parameter required for update");
|
|
16361
|
-
}
|
|
16362
|
-
const result = await this.projects.find(id);
|
|
16363
|
-
if (!result.ok)
|
|
16364
|
-
throw new Error(result.error.message);
|
|
16365
|
-
if (!result.value)
|
|
16366
|
-
throw new Error(`Project with id ${id} not found`);
|
|
16367
|
-
const project = result.value;
|
|
16368
|
-
const updateData = {
|
|
16369
|
-
id: project.id,
|
|
16370
|
-
project_id: project.project_id,
|
|
16371
|
-
owner_id: project.owner_id,
|
|
16372
|
-
name: project.name,
|
|
16373
|
-
description: project.description,
|
|
16374
|
-
specification: project.specification,
|
|
16375
|
-
repo_url: project.repo_url,
|
|
16376
|
-
repo_id: project.repo_id,
|
|
16377
|
-
icon_url: project.icon_url,
|
|
16378
|
-
status: project.status,
|
|
16379
|
-
deleted: project.deleted,
|
|
16380
|
-
link_url: project.link_url,
|
|
16381
|
-
link_text: project.link_text,
|
|
16382
|
-
visibility: project.visibility,
|
|
16383
|
-
current_version: project.current_version,
|
|
16384
|
-
...changes
|
|
16385
|
-
};
|
|
16386
|
-
return this.clients.projects.patch("/projects", {
|
|
16387
|
-
body: updateData
|
|
16388
|
-
});
|
|
16389
|
-
}),
|
|
16390
|
-
config: {
|
|
16391
|
-
load: (project_id) => wrap2(() => this.clients.projects.get("/projects/config", {
|
|
16392
|
-
query: { project_id }
|
|
16393
|
-
})),
|
|
16394
|
-
save: (request) => wrap2(() => this.clients.projects.patch("/projects/save_config", {
|
|
16395
|
-
body: request
|
|
16396
|
-
}))
|
|
16397
|
-
},
|
|
16398
|
-
scan: {
|
|
16399
|
-
initiate: async (project_id) => {
|
|
16400
|
-
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
16401
|
-
method: "POST",
|
|
16402
|
-
headers: this.clients.projects.headers()
|
|
16403
|
-
});
|
|
16404
|
-
if (!response.body) {
|
|
16405
|
-
throw new Error("No response body");
|
|
16406
|
-
}
|
|
16407
|
-
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
16408
|
-
return stream;
|
|
16409
|
-
},
|
|
16410
|
-
updates: (project_id) => wrap2(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
16411
|
-
update: (project_id, data) => wrap2(() => this.clients.projects.post("/projects/scan_status", {
|
|
16412
|
-
query: { project_id },
|
|
16413
|
-
body: data
|
|
16414
|
-
}))
|
|
16415
|
-
},
|
|
16416
|
-
history: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
16417
|
-
upsert: (data) => wrap2(() => this.clients.projects.patch("/projects", { body: data })),
|
|
16418
|
-
specification: (project_id) => wrap2(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
16419
|
-
query: { project_id }
|
|
16420
|
-
})),
|
|
16421
|
-
deleteProject: (project) => wrap2(() => this.clients.projects.patch("/projects", {
|
|
16422
|
-
body: { ...project, deleted: true }
|
|
16423
|
-
})),
|
|
16424
|
-
graph: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
16425
|
-
getViewState: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
16426
|
-
putViewState: (project_id, layout) => wrap2(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
16427
|
-
};
|
|
16428
|
-
this.milestones = {
|
|
16429
|
-
list: () => wrap2(() => this.clients.milestones.get("/milestones")),
|
|
16430
|
-
getByProject: (project_id) => wrap2(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
16431
|
-
lens: (project_id, depth) => wrap2(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
16432
|
-
query: depth ? { depth: String(depth) } : {}
|
|
16433
|
-
})),
|
|
16434
|
-
find: (id) => wrap2(async () => {
|
|
16435
|
-
try {
|
|
16436
|
-
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
16437
|
-
} catch {
|
|
16438
|
-
return null;
|
|
16439
|
-
}
|
|
16440
|
-
}),
|
|
16441
|
-
create: (data) => wrap2(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
16442
|
-
update: async (id, data) => wrap2(async () => {
|
|
16443
|
-
const result = await this.milestones.find(id);
|
|
16444
|
-
if (!result.ok)
|
|
16445
|
-
throw new Error(result.error.message);
|
|
16446
|
-
if (!result.value)
|
|
16447
|
-
throw new Error(`Milestone with id ${id} not found`);
|
|
16448
|
-
const milestone = result.value;
|
|
16449
|
-
const updateData = {
|
|
16450
|
-
id: milestone.id,
|
|
16451
|
-
project_id: milestone.project_id,
|
|
16452
|
-
name: data.name ?? milestone.name,
|
|
16453
|
-
description: data.description ?? milestone.description,
|
|
16454
|
-
target_time: data.target_time ?? milestone.target_time,
|
|
16455
|
-
target_version: data.target_version ?? milestone.target_version,
|
|
16456
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
16457
|
-
};
|
|
16458
|
-
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
16459
|
-
body: updateData
|
|
16460
|
-
});
|
|
16461
|
-
}),
|
|
16462
|
-
delete: (id) => wrap2(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
16463
|
-
goals: (id) => wrap2(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
16464
|
-
};
|
|
16465
|
-
this.hooks = {
|
|
16466
|
-
list: (project_id) => wrap2(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
16467
|
-
upsert: (data) => wrap2(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
16468
|
-
delete: (id) => wrap2(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
16469
|
-
setEnabled: (id, enabled) => wrap2(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
16470
|
-
deliveries: (id, status) => wrap2(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
16471
|
-
};
|
|
16472
|
-
this.goals = {
|
|
16473
|
-
list: () => wrap2(() => this.clients.goals.get("/goals")),
|
|
16474
|
-
find: (id) => wrap2(() => this.clients.goals.get(`/goals/${id}`)),
|
|
16475
|
-
create: (data) => wrap2(() => this.clients.goals.post("/goals", { body: data })),
|
|
16476
|
-
update: async (id, data) => wrap2(async () => {
|
|
16477
|
-
const result = await this.goals.find(id);
|
|
16478
|
-
if (!result.ok)
|
|
16479
|
-
throw new Error(result.error.message);
|
|
16480
|
-
if (!result.value)
|
|
16481
|
-
throw new Error(`Goal with id ${id} not found`);
|
|
16482
|
-
const goal = result.value;
|
|
16483
|
-
const updateData = {
|
|
16484
|
-
id: goal.id,
|
|
16485
|
-
milestone_id: goal.milestone_id,
|
|
16486
|
-
name: data.name ?? goal.name,
|
|
16487
|
-
description: data.description ?? goal.description,
|
|
16488
|
-
target_time: data.target_time ?? goal.target_time,
|
|
16489
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
16490
|
-
};
|
|
16491
|
-
return this.clients.goals.patch(`/goals/${id}`, {
|
|
16492
|
-
body: updateData
|
|
16493
|
-
});
|
|
16494
|
-
}),
|
|
16495
|
-
delete: (id) => wrap2(() => this.clients.goals.delete(`/goals/${id}`))
|
|
16496
|
-
};
|
|
16497
|
-
this.tasks = {
|
|
16498
|
-
list: (filters) => wrap2(() => {
|
|
16499
|
-
const query = {};
|
|
16500
|
-
if (filters?.project_id)
|
|
16501
|
-
query.project = filters.project_id;
|
|
16502
|
-
if (filters?.tag_id)
|
|
16503
|
-
query.tag = filters.tag_id;
|
|
16504
|
-
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
16505
|
-
}),
|
|
16506
|
-
find: (id) => wrap2(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
16507
|
-
getByProject: (project_id) => wrap2(() => this.clients.tasks.get(`/tasks`, {
|
|
16508
|
-
query: { project: project_id }
|
|
16509
|
-
})),
|
|
16510
|
-
create: (data) => wrap2(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
16511
|
-
update: async (id, changes) => wrap2(async () => {
|
|
16512
|
-
const result = await this.tasks.find(id);
|
|
16513
|
-
if (!result.ok)
|
|
16514
|
-
throw new Error(result.error.message);
|
|
16515
|
-
if (!result.value)
|
|
16516
|
-
throw new Error(`Task with id ${id} not found`);
|
|
16517
|
-
const task = result.value;
|
|
16518
|
-
const updateData = {
|
|
16519
|
-
id,
|
|
16520
|
-
title: task.task.title,
|
|
16521
|
-
summary: task.task.summary,
|
|
16522
|
-
description: task.task.description,
|
|
16523
|
-
progress: task.task.progress,
|
|
16524
|
-
visibility: task.task.visibility,
|
|
16525
|
-
start_time: task.task.start_time,
|
|
16526
|
-
end_time: task.task.end_time,
|
|
16527
|
-
priority: task.task.priority,
|
|
16528
|
-
owner_id: task.task.owner_id,
|
|
16529
|
-
project_id: task.task.project_id,
|
|
16530
|
-
...changes
|
|
16531
|
-
};
|
|
16532
|
-
return this.clients.tasks.patch("/tasks", {
|
|
16533
|
-
body: updateData
|
|
16534
|
-
});
|
|
16535
|
-
}),
|
|
16536
|
-
upsert: (data) => wrap2(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
16537
|
-
saveTags: (data) => wrap2(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
16538
|
-
deleteTask: (task) => wrap2(() => this.clients.tasks.patch("/tasks", {
|
|
16539
|
-
body: { ...task.task, deleted: true }
|
|
16540
|
-
})),
|
|
16541
|
-
history: {
|
|
16542
|
-
get: (task_id) => wrap2(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
16543
|
-
},
|
|
16544
|
-
ready: (filters) => wrap2(() => {
|
|
16545
|
-
const query = {};
|
|
16546
|
-
if (filters?.project_id)
|
|
16547
|
-
query.project = filters.project_id;
|
|
16548
|
-
if (filters?.limit)
|
|
16549
|
-
query.limit = String(filters.limit);
|
|
16550
|
-
if (filters?.cursor)
|
|
16551
|
-
query.cursor = filters.cursor;
|
|
16552
|
-
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
16553
|
-
}),
|
|
16554
|
-
tree: (id, depth) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
16555
|
-
near: (id, depth) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
16556
|
-
ancestors: (id) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
16557
|
-
claim: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
16558
|
-
done: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
16559
|
-
reopen: (id) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
16560
|
-
advanceStage: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
16561
|
-
link: (data) => wrap2(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
16562
|
-
unlink: (link_id) => wrap2(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
16563
|
-
apply: (data) => wrap2(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
16564
|
-
};
|
|
16565
|
-
this.tags = {
|
|
16566
|
-
list: () => wrap2(() => this.clients.tags.get("/tags"))
|
|
16567
|
-
};
|
|
16568
|
-
this.docs = {
|
|
16569
|
-
list: (filters) => wrap2(() => {
|
|
16570
|
-
const query = { project_id: filters.project_id };
|
|
16571
|
-
if (filters.task_id)
|
|
16572
|
-
query.task_id = filters.task_id;
|
|
16573
|
-
return this.clients.docs.get("/docs", { query });
|
|
16574
|
-
}),
|
|
16575
|
-
push: (data) => wrap2(() => this.clients.docs.post("/docs", { body: data })),
|
|
16576
|
-
pull: (id, version) => wrap2(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
16577
|
-
versions: (id) => wrap2(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
16578
|
-
renderUrl: (id, version) => {
|
|
16579
|
-
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
16580
|
-
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
16581
|
-
},
|
|
16582
|
-
createThread: (document_id, data) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
16583
|
-
replyThread: (document_id, thread_id, body) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
16584
|
-
resolveThread: (document_id, thread_id) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
16585
|
-
toggleBlocking: (document_id, thread_id, blocking) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
16586
|
-
unresolved: (filters) => wrap2(() => {
|
|
16587
|
-
const query = {};
|
|
16588
|
-
if (filters.project_id)
|
|
16589
|
-
query.project_id = filters.project_id;
|
|
16590
|
-
if (filters.document_id)
|
|
16591
|
-
query.document_id = filters.document_id;
|
|
16592
|
-
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
16593
|
-
}),
|
|
16594
|
-
pushInterfaceReport: (data) => wrap2(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
16595
|
-
interfaceStatus: (filters) => wrap2(() => {
|
|
16596
|
-
const query = { project_id: filters.project_id, title: filters.title };
|
|
16597
|
-
if (filters.task_id)
|
|
16598
|
-
query.task_id = filters.task_id;
|
|
16599
|
-
return this.clients.docs.get("/docs/interface/status", { query });
|
|
16600
|
-
})
|
|
16601
|
-
};
|
|
16602
|
-
this.signoffs = {
|
|
16603
|
-
request: (data) => wrap2(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
16604
|
-
find: (id) => wrap2(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
16605
|
-
findPending: (filters) => wrap2(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
16606
|
-
decide: (id, data) => wrap2(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
16607
|
-
};
|
|
16608
|
-
this.reviews = {
|
|
16609
|
-
pending: () => wrap2(() => this.clients.reviews.get("/reviews/pending"))
|
|
16610
|
-
};
|
|
16611
|
-
this.github = {
|
|
16612
|
-
repos: () => wrap2(() => this.clients.github.get("/repos")),
|
|
16613
|
-
branches: (owner, repo) => wrap2(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
16614
|
-
};
|
|
16615
|
-
this.blog = {
|
|
16616
|
-
posts: {
|
|
16617
|
-
list: (params) => wrap2(() => {
|
|
16618
|
-
const query = {};
|
|
16619
|
-
if (params?.category)
|
|
16620
|
-
query.category = params.category;
|
|
16621
|
-
if (params?.tag)
|
|
16622
|
-
query.tag = params.tag;
|
|
16623
|
-
if (params?.project)
|
|
16624
|
-
query.project = params.project;
|
|
16625
|
-
if (params?.status)
|
|
16626
|
-
query.status = params.status;
|
|
16627
|
-
if (params?.archived !== undefined)
|
|
16628
|
-
query.archived = String(params.archived);
|
|
16629
|
-
if (params?.limit)
|
|
16630
|
-
query.limit = String(params.limit);
|
|
16631
|
-
if (params?.offset !== undefined)
|
|
16632
|
-
query.offset = String(params.offset);
|
|
16633
|
-
if (params?.sort)
|
|
16634
|
-
query.sort = params.sort;
|
|
16635
|
-
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
16636
|
-
}),
|
|
16637
|
-
getBySlug: (slug) => wrap2(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
16638
|
-
create: (data) => wrap2(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
16639
|
-
update: (uuid, data) => wrap2(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
16640
|
-
delete: (uuid) => wrap2(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
16641
|
-
versions: (uuid) => wrap2(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
16642
|
-
version: (uuid, hash) => wrap2(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
16643
|
-
restore: (uuid, hash) => wrap2(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
16644
|
-
},
|
|
16645
|
-
tags: {
|
|
16646
|
-
list: () => wrap2(() => this.clients.blog.get("/blog/tags")),
|
|
16647
|
-
getForPost: (uuid) => wrap2(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
16648
|
-
setForPost: (uuid, tags) => wrap2(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
16649
|
-
addToPost: (uuid, tags) => wrap2(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
16650
|
-
removeFromPost: (uuid, tag) => wrap2(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
16651
|
-
},
|
|
16652
|
-
categories: {
|
|
16653
|
-
tree: () => wrap2(() => this.clients.blog.get("/blog/categories")),
|
|
16654
|
-
create: (data) => wrap2(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
16655
|
-
update: (name, data) => wrap2(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
16656
|
-
body: data
|
|
16657
|
-
})),
|
|
16658
|
-
delete: (name) => wrap2(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
16659
|
-
},
|
|
16660
|
-
tokens: {
|
|
16661
|
-
list: () => wrap2(() => this.clients.blog.get("/blog/tokens")),
|
|
16662
|
-
create: (data) => wrap2(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
16663
|
-
update: (id, data) => wrap2(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
16664
|
-
body: data
|
|
16665
|
-
})),
|
|
16666
|
-
delete: (id) => wrap2(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
16667
|
-
}
|
|
16668
|
-
};
|
|
16669
|
-
this.media = {
|
|
16670
|
-
profiles: {
|
|
16671
|
-
list: () => wrap2(async () => {
|
|
16672
|
-
const res = await this.clients.media.get("/profiles");
|
|
16673
|
-
return res.profiles;
|
|
16674
|
-
}),
|
|
16675
|
-
create: (data) => wrap2(() => this.clients.media.post("/profiles", { body: data })),
|
|
16676
|
-
get: (id) => wrap2(() => this.clients.media.get(`/profiles/${id}`)),
|
|
16677
|
-
update: (id, data) => wrap2(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
16678
|
-
delete: (id) => wrap2(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
16679
|
-
filters: {
|
|
16680
|
-
list: (profile_id) => wrap2(async () => {
|
|
16681
|
-
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
16682
|
-
return res.filters;
|
|
16683
|
-
}),
|
|
16684
|
-
add: (profile_id, data) => wrap2(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
16685
|
-
remove: (profile_id, filter_id) => wrap2(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
16686
|
-
},
|
|
16687
|
-
timeline: (slug, params) => wrap2(() => {
|
|
16688
|
-
const query = {};
|
|
16689
|
-
if (params?.limit)
|
|
16690
|
-
query.limit = String(params.limit);
|
|
16691
|
-
if (params?.before)
|
|
16692
|
-
query.before = params.before;
|
|
16693
|
-
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
16694
|
-
})
|
|
16695
|
-
},
|
|
16696
|
-
connections: {
|
|
16697
|
-
list: (profile_id, options) => wrap2(async () => {
|
|
16698
|
-
const query = { profile_id };
|
|
16699
|
-
if (options?.include_settings)
|
|
16700
|
-
query.include_settings = "true";
|
|
16701
|
-
const res = await this.clients.media.get("/connections", { query });
|
|
16702
|
-
return res.accounts;
|
|
16703
|
-
}),
|
|
16704
|
-
create: (data) => wrap2(() => this.clients.media.post("/connections", { body: data })),
|
|
16705
|
-
delete: (account_id) => wrap2(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
16706
|
-
refresh: (account_id) => wrap2(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
16707
|
-
refreshAll: () => wrap2(() => this.clients.media.post("/connections/refresh-all")),
|
|
16708
|
-
updateStatus: (account_id, is_active) => wrap2(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
16709
|
-
body: { is_active }
|
|
16710
|
-
})),
|
|
16711
|
-
settings: {
|
|
16712
|
-
get: (account_id) => wrap2(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
16713
|
-
update: (account_id, settings) => wrap2(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
16714
|
-
body: { settings }
|
|
16715
|
-
}))
|
|
16716
|
-
},
|
|
16717
|
-
repos: (account_id) => wrap2(async () => {
|
|
16718
|
-
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
16719
|
-
return res.repos;
|
|
16720
|
-
}),
|
|
16721
|
-
subreddits: (account_id) => wrap2(async () => {
|
|
16722
|
-
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
16723
|
-
return res.subreddits;
|
|
16724
|
-
})
|
|
16725
|
-
},
|
|
16726
|
-
credentials: {
|
|
16727
|
-
check: (platform, profile_id) => wrap2(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
16728
|
-
save: (platform, data) => wrap2(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
16729
|
-
delete: (platform, profile_id) => wrap2(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
16730
|
-
},
|
|
16731
|
-
timeline: {
|
|
16732
|
-
get: (user_id, params) => wrap2(() => {
|
|
16733
|
-
const query = {};
|
|
16734
|
-
if (params?.from)
|
|
16735
|
-
query.from = params.from;
|
|
16736
|
-
if (params?.to)
|
|
16737
|
-
query.to = params.to;
|
|
16738
|
-
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
16739
|
-
}),
|
|
16740
|
-
getRaw: (user_id, platform, account_id) => wrap2(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
16741
|
-
query: { account_id }
|
|
16742
|
-
}))
|
|
16743
|
-
}
|
|
16744
|
-
};
|
|
16745
|
-
this.activity = {
|
|
16746
|
-
ai: (options) => wrap2(() => {
|
|
16747
|
-
const query = {};
|
|
16748
|
-
if (options?.limit)
|
|
16749
|
-
query.limit = String(options.limit);
|
|
16750
|
-
if (options?.since)
|
|
16751
|
-
query.since = options.since;
|
|
16752
|
-
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
16753
|
-
})
|
|
16754
|
-
};
|
|
16755
|
-
this.admin = {
|
|
16756
|
-
verifyFold: () => wrap2(() => this.clients.admin.get("/admin/verify-fold")),
|
|
16757
|
-
reconcileDocsCss: () => wrap2(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
16758
|
-
};
|
|
16759
|
-
this.user = {
|
|
16760
|
-
me: () => wrap2(() => this.clients.auth.get("/user/me")),
|
|
16761
|
-
history: () => wrap2(() => this.clients.auth.get("/user/history")),
|
|
16762
|
-
preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", {
|
|
16763
|
-
body: data
|
|
16764
|
-
}))
|
|
16765
|
-
};
|
|
16766
|
-
this.pulse = {
|
|
16767
|
-
summary: (input) => wrap2(async () => {
|
|
16768
|
-
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
16769
|
-
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
16770
|
-
});
|
|
16771
|
-
return PulseSummarySchema2.parse(raw);
|
|
16772
|
-
}),
|
|
16773
|
-
events: (input) => wrap2(async () => {
|
|
16774
|
-
const query = {};
|
|
16775
|
-
if (input.name)
|
|
16776
|
-
query.name = input.name;
|
|
16777
|
-
if (input.level)
|
|
16778
|
-
query.level = input.level;
|
|
16779
|
-
if (typeof input.ts_from === "number")
|
|
16780
|
-
query.ts_from = String(input.ts_from);
|
|
16781
|
-
if (typeof input.ts_to === "number")
|
|
16782
|
-
query.ts_to = String(input.ts_to);
|
|
16783
|
-
if (input.search)
|
|
16784
|
-
query.search = input.search;
|
|
16785
|
-
if (input.limit)
|
|
16786
|
-
query.limit = String(input.limit);
|
|
16787
|
-
if (input.cursor)
|
|
16788
|
-
query.cursor = input.cursor;
|
|
16789
|
-
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
16790
|
-
query
|
|
16791
|
-
});
|
|
16792
|
-
return PulseEventsPageSchema2.parse(raw);
|
|
16793
|
-
}),
|
|
16794
|
-
errors: (input) => wrap2(async () => {
|
|
16795
|
-
const query = {};
|
|
16796
|
-
if (typeof input.range === "string") {
|
|
16797
|
-
query.range = input.range;
|
|
16798
|
-
} else {
|
|
16799
|
-
query.from = String(input.range.from);
|
|
16800
|
-
query.to = String(input.range.to);
|
|
16801
|
-
}
|
|
16802
|
-
if (input.group_by_fingerprint)
|
|
16803
|
-
query.group_by_fingerprint = "true";
|
|
16804
|
-
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
16805
|
-
query
|
|
16806
|
-
});
|
|
16807
|
-
return PulseErrorsResultSchema2.parse(raw);
|
|
16808
|
-
}),
|
|
16809
|
-
logs: (input) => wrap2(async () => {
|
|
16810
|
-
const query = {};
|
|
16811
|
-
if (typeof input.range === "string") {
|
|
16812
|
-
query.range = input.range;
|
|
16813
|
-
} else {
|
|
16814
|
-
query.from = String(input.range.from);
|
|
16815
|
-
query.to = String(input.range.to);
|
|
16816
|
-
}
|
|
16817
|
-
if (input.level)
|
|
16818
|
-
query.level = input.level;
|
|
16819
|
-
if (input.search)
|
|
16820
|
-
query.search = input.search;
|
|
16821
|
-
const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
16822
|
-
return PulseLogsResultSchema2.parse(raw);
|
|
16823
|
-
}),
|
|
16824
|
-
latency: (input) => wrap2(async () => {
|
|
16825
|
-
const query = {};
|
|
16826
|
-
if (typeof input.range === "string") {
|
|
16827
|
-
query.range = input.range;
|
|
16245
|
+
}
|
|
16246
|
+
this.request_history.add(historyEntry);
|
|
16247
|
+
let result;
|
|
16248
|
+
if (response.status === HTTP_STATUS2.NO_CONTENT) {
|
|
16249
|
+
result = undefined;
|
|
16250
|
+
} else {
|
|
16251
|
+
const text2 = await response.text();
|
|
16252
|
+
if (!text2 || text2.trim() === "" || text2.trim() === "null") {
|
|
16253
|
+
result = undefined;
|
|
16828
16254
|
} else {
|
|
16829
|
-
|
|
16830
|
-
|
|
16255
|
+
try {
|
|
16256
|
+
const raw = JSON.parse(text2);
|
|
16257
|
+
result = raw;
|
|
16258
|
+
} catch {
|
|
16259
|
+
result = text2;
|
|
16260
|
+
}
|
|
16831
16261
|
}
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
|
|
16836
|
-
|
|
16262
|
+
}
|
|
16263
|
+
if (this.debug) {
|
|
16264
|
+
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
16265
|
+
status: response.status,
|
|
16266
|
+
duration: `${String(duration)}ms`
|
|
16267
|
+
});
|
|
16268
|
+
}
|
|
16269
|
+
return result;
|
|
16270
|
+
} catch (error) {
|
|
16271
|
+
const duration = Date.now() - startTime;
|
|
16272
|
+
if (this.debug) {
|
|
16273
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
16274
|
+
url,
|
|
16275
|
+
duration: `${String(duration)}ms`,
|
|
16276
|
+
error: error instanceof Error ? error.message : String(error),
|
|
16277
|
+
body,
|
|
16837
16278
|
query
|
|
16838
16279
|
});
|
|
16839
|
-
return PulseLatencyResultSchema2.parse(raw);
|
|
16840
|
-
}),
|
|
16841
|
-
subs: {
|
|
16842
|
-
list: (input) => wrap2(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
16843
|
-
create: (input) => wrap2(() => this.clients.pulse.post("/admin/subs", {
|
|
16844
|
-
body: {
|
|
16845
|
-
project_id: input.project_id,
|
|
16846
|
-
name: input.name,
|
|
16847
|
-
filter: input.filter,
|
|
16848
|
-
channel: input.channel,
|
|
16849
|
-
cooldown_seconds: input.cooldown_seconds
|
|
16850
|
-
}
|
|
16851
|
-
})),
|
|
16852
|
-
get: (id) => wrap2(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
16853
|
-
update: (id, patch) => wrap2(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
16854
|
-
delete: (id) => wrap2(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
16855
|
-
},
|
|
16856
|
-
keys: {
|
|
16857
|
-
list: (input) => wrap2(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
16858
|
-
create: (input) => wrap2(() => this.clients.pulse.post("/admin/keys", {
|
|
16859
|
-
body: {
|
|
16860
|
-
project_id: input.project_id,
|
|
16861
|
-
name: input.name,
|
|
16862
|
-
rate_limit_per_min: input.rate_limit_per_min
|
|
16863
|
-
}
|
|
16864
|
-
})),
|
|
16865
|
-
delete: (id, input) => wrap2(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
16866
|
-
query: { project_id: input.project_id }
|
|
16867
|
-
}))
|
|
16868
16280
|
}
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
const query = {};
|
|
16881
|
-
if (filter?.package_id !== undefined)
|
|
16882
|
-
query.package_id = filter.package_id;
|
|
16883
|
-
if (filter?.status !== undefined)
|
|
16884
|
-
query.status = filter.status;
|
|
16885
|
-
if (filter?.limit !== undefined)
|
|
16886
|
-
query.limit = String(filter.limit);
|
|
16887
|
-
return wrap2(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
16888
|
-
},
|
|
16889
|
-
get: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
16890
|
-
create: (input) => wrap2(() => this.clients.pipelines.post("/runs", {
|
|
16891
|
-
body: input
|
|
16892
|
-
})),
|
|
16893
|
-
approve: (run_id, input) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
16894
|
-
body: input
|
|
16895
|
-
})),
|
|
16896
|
-
cancel: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
16897
|
-
rollback: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
16898
|
-
redispatch: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
16899
|
-
dispatches: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
|
|
16900
|
-
events: {
|
|
16901
|
-
ingest: (run_id, input) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
16902
|
-
body: input
|
|
16903
|
-
})),
|
|
16904
|
-
list: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
16905
|
-
},
|
|
16906
|
-
grants: {
|
|
16907
|
-
list: (package_id) => wrap2(() => this.clients.pipelines.get("/grants", {
|
|
16908
|
-
query: package_id ? { package_id } : {}
|
|
16909
|
-
})),
|
|
16910
|
-
approve: (grant_id) => wrap2(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
16911
|
-
body: {}
|
|
16912
|
-
})),
|
|
16913
|
-
deny: (grant_id, reason) => wrap2(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
16914
|
-
body: reason !== undefined ? { reason } : {}
|
|
16915
|
-
}))
|
|
16916
|
-
},
|
|
16917
|
-
packages: {
|
|
16918
|
-
list: (filter) => {
|
|
16919
|
-
const query = {};
|
|
16920
|
-
if (filter?.project_id !== undefined)
|
|
16921
|
-
query.project_id = filter.project_id;
|
|
16922
|
-
return wrap2(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
16923
|
-
},
|
|
16924
|
-
get: (package_id) => wrap2(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
16925
|
-
create: (input) => wrap2(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
16926
|
-
update: (package_id, input) => wrap2(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
16927
|
-
delete: (package_id) => wrap2(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
16928
|
-
},
|
|
16929
|
-
analysis_templates: {
|
|
16930
|
-
list: (input) => wrap2(() => this.clients.pipelines.get("/analysis-templates", {
|
|
16931
|
-
query: { owner_id: input.owner_id }
|
|
16932
|
-
})),
|
|
16933
|
-
get: (id, input) => wrap2(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
16934
|
-
query: { owner_id: input.owner_id }
|
|
16935
|
-
})),
|
|
16936
|
-
create: (input) => wrap2(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
16937
|
-
update: (id, input) => wrap2(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
|
|
16938
|
-
delete: (id, input) => wrap2(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
16939
|
-
query: { owner_id: input.owner_id }
|
|
16940
|
-
}))
|
|
16941
|
-
},
|
|
16942
|
-
oidc_trust: {
|
|
16943
|
-
list: (input) => wrap2(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
16944
|
-
get: (id, input) => wrap2(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
|
|
16945
|
-
create: (input) => wrap2(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
16946
|
-
update: (id, input) => wrap2(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
|
|
16947
|
-
delete: (id, input) => wrap2(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
16948
|
-
query: { owner_id: input.owner_id }
|
|
16949
|
-
}))
|
|
16281
|
+
if (error instanceof ApiError2 || error instanceof AuthenticationError2) {
|
|
16282
|
+
throw error;
|
|
16283
|
+
}
|
|
16284
|
+
historyEntry.duration = duration;
|
|
16285
|
+
try {
|
|
16286
|
+
handleNetworkError2(error);
|
|
16287
|
+
} catch (networkError) {
|
|
16288
|
+
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
16289
|
+
historyEntry.error = errorMessage;
|
|
16290
|
+
this.request_history.add(historyEntry);
|
|
16291
|
+
throw networkError;
|
|
16950
16292
|
}
|
|
16293
|
+
}
|
|
16294
|
+
}
|
|
16295
|
+
get(path, options = {}) {
|
|
16296
|
+
return this.request(path, { ...options, method: "GET" });
|
|
16297
|
+
}
|
|
16298
|
+
post(path, options = {}) {
|
|
16299
|
+
return this.request(path, { ...options, method: "POST" });
|
|
16300
|
+
}
|
|
16301
|
+
patch(path, options = {}) {
|
|
16302
|
+
return this.request(path, { ...options, method: "PATCH" });
|
|
16303
|
+
}
|
|
16304
|
+
put(path, options = {}) {
|
|
16305
|
+
return this.request(path, { ...options, method: "PUT" });
|
|
16306
|
+
}
|
|
16307
|
+
delete(path, options = {}) {
|
|
16308
|
+
return this.request(path, { ...options, method: "DELETE" });
|
|
16309
|
+
}
|
|
16310
|
+
history() {
|
|
16311
|
+
return this.request_history;
|
|
16312
|
+
}
|
|
16313
|
+
url() {
|
|
16314
|
+
return this.base_url;
|
|
16315
|
+
}
|
|
16316
|
+
headers() {
|
|
16317
|
+
const headers = {
|
|
16318
|
+
"Content-Type": "application/json"
|
|
16951
16319
|
};
|
|
16320
|
+
if (this.auth_mode === "session") {
|
|
16321
|
+
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
16322
|
+
} else if (this.auth_mode === "key") {
|
|
16323
|
+
headers["X-API-KEY"] = this.api_key;
|
|
16324
|
+
}
|
|
16325
|
+
return headers;
|
|
16326
|
+
}
|
|
16327
|
+
};
|
|
16328
|
+
var string_field2 = (value, key) => {
|
|
16329
|
+
if (typeof value !== "object" || value === null || !(key in value))
|
|
16330
|
+
return;
|
|
16331
|
+
const field = value[key];
|
|
16332
|
+
return typeof field === "string" ? field : undefined;
|
|
16333
|
+
};
|
|
16334
|
+
var number_field2 = (value, key) => {
|
|
16335
|
+
if (typeof value !== "object" || value === null || !(key in value))
|
|
16336
|
+
return;
|
|
16337
|
+
const field = value[key];
|
|
16338
|
+
return typeof field === "number" ? field : undefined;
|
|
16339
|
+
};
|
|
16340
|
+
function wrap2(fn) {
|
|
16341
|
+
return fn().then((data) => ok(data)).catch((error) => err({
|
|
16342
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
16343
|
+
code: string_field2(error, "code"),
|
|
16344
|
+
status_code: number_field2(error, "statusCode") ?? number_field2(error, "status_code")
|
|
16345
|
+
}));
|
|
16346
|
+
}
|
|
16347
|
+
var ApiClient22 = class {
|
|
16348
|
+
clients;
|
|
16349
|
+
api_key_field;
|
|
16350
|
+
auth_mode_field;
|
|
16351
|
+
constructor(options) {
|
|
16952
16352
|
const base_url = options.base_url || "http://localhost:4321/api/v1";
|
|
16953
16353
|
this.api_key_field = options.api_key ?? "";
|
|
16954
16354
|
this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
|
|
@@ -16986,9 +16386,636 @@ var ApiClient22 = class {
|
|
|
16986
16386
|
admin: new ApiClient3({ ...clientOptions, category: "admin" })
|
|
16987
16387
|
};
|
|
16988
16388
|
}
|
|
16389
|
+
auth = {
|
|
16390
|
+
session: () => wrap2(() => this.clients.auth_root.get("/auth/session")),
|
|
16391
|
+
keys: {
|
|
16392
|
+
list: () => wrap2(() => this.clients.auth.get("/keys")),
|
|
16393
|
+
create: (input) => {
|
|
16394
|
+
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
16395
|
+
return wrap2(() => this.clients.auth.post("/keys", { body }));
|
|
16396
|
+
},
|
|
16397
|
+
revoke: (key_id) => wrap2(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
16398
|
+
remove: (key_id) => wrap2(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
16399
|
+
}
|
|
16400
|
+
};
|
|
16401
|
+
projects = {
|
|
16402
|
+
list: (filters) => wrap2(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
16403
|
+
map: async (filters) => wrap2(async () => {
|
|
16404
|
+
const result = await this.projects.list(filters);
|
|
16405
|
+
if (!result.ok)
|
|
16406
|
+
throw new Error(result.error.message);
|
|
16407
|
+
return result.value.reduce((acc, project) => {
|
|
16408
|
+
acc[project.id] = project;
|
|
16409
|
+
return acc;
|
|
16410
|
+
}, {});
|
|
16411
|
+
}),
|
|
16412
|
+
find: (id) => wrap2(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
16413
|
+
getByName: (name) => wrap2(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
16414
|
+
getById: (id) => wrap2(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
16415
|
+
create: (data) => wrap2(() => this.clients.projects.patch("/projects", { body: data })),
|
|
16416
|
+
update: async (idOrData, changes) => wrap2(async () => {
|
|
16417
|
+
if (typeof idOrData === "object" && idOrData.id) {
|
|
16418
|
+
return this.clients.projects.patch("/projects", {
|
|
16419
|
+
body: idOrData
|
|
16420
|
+
});
|
|
16421
|
+
}
|
|
16422
|
+
const id = idOrData;
|
|
16423
|
+
if (!changes) {
|
|
16424
|
+
throw new Error("Changes parameter required for update");
|
|
16425
|
+
}
|
|
16426
|
+
const result = await this.projects.find(id);
|
|
16427
|
+
if (!result.ok)
|
|
16428
|
+
throw new Error(result.error.message);
|
|
16429
|
+
if (!result.value)
|
|
16430
|
+
throw new Error(`Project with id ${id} not found`);
|
|
16431
|
+
const project = result.value;
|
|
16432
|
+
const updateData = {
|
|
16433
|
+
id: project.id,
|
|
16434
|
+
project_id: project.project_id,
|
|
16435
|
+
owner_id: project.owner_id,
|
|
16436
|
+
name: project.name,
|
|
16437
|
+
description: project.description,
|
|
16438
|
+
specification: project.specification,
|
|
16439
|
+
repo_url: project.repo_url,
|
|
16440
|
+
repo_id: project.repo_id,
|
|
16441
|
+
icon_url: project.icon_url,
|
|
16442
|
+
status: project.status,
|
|
16443
|
+
deleted: project.deleted,
|
|
16444
|
+
link_url: project.link_url,
|
|
16445
|
+
link_text: project.link_text,
|
|
16446
|
+
visibility: project.visibility,
|
|
16447
|
+
current_version: project.current_version,
|
|
16448
|
+
...changes
|
|
16449
|
+
};
|
|
16450
|
+
return this.clients.projects.patch("/projects", {
|
|
16451
|
+
body: updateData
|
|
16452
|
+
});
|
|
16453
|
+
}),
|
|
16454
|
+
config: {
|
|
16455
|
+
load: (project_id) => wrap2(() => this.clients.projects.get("/projects/config", {
|
|
16456
|
+
query: { project_id }
|
|
16457
|
+
})),
|
|
16458
|
+
save: (request) => wrap2(() => this.clients.projects.patch("/projects/save_config", {
|
|
16459
|
+
body: request
|
|
16460
|
+
}))
|
|
16461
|
+
},
|
|
16462
|
+
scan: {
|
|
16463
|
+
initiate: async (project_id) => {
|
|
16464
|
+
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
16465
|
+
method: "POST",
|
|
16466
|
+
headers: this.clients.projects.headers()
|
|
16467
|
+
});
|
|
16468
|
+
if (!response.body) {
|
|
16469
|
+
throw new Error("No response body");
|
|
16470
|
+
}
|
|
16471
|
+
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
16472
|
+
return stream;
|
|
16473
|
+
},
|
|
16474
|
+
updates: (project_id) => wrap2(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
16475
|
+
update: (project_id, data) => wrap2(() => this.clients.projects.post("/projects/scan_status", {
|
|
16476
|
+
query: { project_id },
|
|
16477
|
+
body: data
|
|
16478
|
+
}))
|
|
16479
|
+
},
|
|
16480
|
+
history: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
16481
|
+
upsert: (data) => wrap2(() => this.clients.projects.patch("/projects", { body: data })),
|
|
16482
|
+
specification: (project_id) => wrap2(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
16483
|
+
query: { project_id }
|
|
16484
|
+
})),
|
|
16485
|
+
deleteProject: (project) => wrap2(() => this.clients.projects.patch("/projects", {
|
|
16486
|
+
body: { ...project, deleted: true }
|
|
16487
|
+
})),
|
|
16488
|
+
graph: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
16489
|
+
getViewState: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
16490
|
+
putViewState: (project_id, layout) => wrap2(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
16491
|
+
};
|
|
16492
|
+
milestones = {
|
|
16493
|
+
list: () => wrap2(() => this.clients.milestones.get("/milestones")),
|
|
16494
|
+
getByProject: (project_id) => wrap2(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
16495
|
+
lens: (project_id, depth) => wrap2(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
16496
|
+
query: depth ? { depth: String(depth) } : {}
|
|
16497
|
+
})),
|
|
16498
|
+
find: (id) => wrap2(async () => {
|
|
16499
|
+
try {
|
|
16500
|
+
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
16501
|
+
} catch {
|
|
16502
|
+
return null;
|
|
16503
|
+
}
|
|
16504
|
+
}),
|
|
16505
|
+
create: (data) => wrap2(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
16506
|
+
update: async (id, data) => wrap2(async () => {
|
|
16507
|
+
const result = await this.milestones.find(id);
|
|
16508
|
+
if (!result.ok)
|
|
16509
|
+
throw new Error(result.error.message);
|
|
16510
|
+
if (!result.value)
|
|
16511
|
+
throw new Error(`Milestone with id ${id} not found`);
|
|
16512
|
+
const milestone = result.value;
|
|
16513
|
+
const updateData = {
|
|
16514
|
+
id: milestone.id,
|
|
16515
|
+
project_id: milestone.project_id,
|
|
16516
|
+
name: data.name ?? milestone.name,
|
|
16517
|
+
description: data.description ?? milestone.description,
|
|
16518
|
+
target_time: data.target_time ?? milestone.target_time,
|
|
16519
|
+
target_version: data.target_version ?? milestone.target_version,
|
|
16520
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
16521
|
+
};
|
|
16522
|
+
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
16523
|
+
body: updateData
|
|
16524
|
+
});
|
|
16525
|
+
}),
|
|
16526
|
+
delete: (id) => wrap2(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
16527
|
+
goals: (id) => wrap2(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
16528
|
+
};
|
|
16529
|
+
hooks = {
|
|
16530
|
+
list: (project_id) => wrap2(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
16531
|
+
upsert: (data) => wrap2(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
16532
|
+
delete: (id) => wrap2(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
16533
|
+
setEnabled: (id, enabled) => wrap2(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
16534
|
+
deliveries: (id, status) => wrap2(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
16535
|
+
};
|
|
16536
|
+
goals = {
|
|
16537
|
+
list: () => wrap2(() => this.clients.goals.get("/goals")),
|
|
16538
|
+
find: (id) => wrap2(() => this.clients.goals.get(`/goals/${id}`)),
|
|
16539
|
+
create: (data) => wrap2(() => this.clients.goals.post("/goals", { body: data })),
|
|
16540
|
+
update: async (id, data) => wrap2(async () => {
|
|
16541
|
+
const result = await this.goals.find(id);
|
|
16542
|
+
if (!result.ok)
|
|
16543
|
+
throw new Error(result.error.message);
|
|
16544
|
+
if (!result.value)
|
|
16545
|
+
throw new Error(`Goal with id ${id} not found`);
|
|
16546
|
+
const goal = result.value;
|
|
16547
|
+
const updateData = {
|
|
16548
|
+
id: goal.id,
|
|
16549
|
+
milestone_id: goal.milestone_id,
|
|
16550
|
+
name: data.name ?? goal.name,
|
|
16551
|
+
description: data.description ?? goal.description,
|
|
16552
|
+
target_time: data.target_time ?? goal.target_time,
|
|
16553
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
16554
|
+
};
|
|
16555
|
+
return this.clients.goals.patch(`/goals/${id}`, {
|
|
16556
|
+
body: updateData
|
|
16557
|
+
});
|
|
16558
|
+
}),
|
|
16559
|
+
delete: (id) => wrap2(() => this.clients.goals.delete(`/goals/${id}`))
|
|
16560
|
+
};
|
|
16561
|
+
tasks = {
|
|
16562
|
+
list: (filters) => wrap2(() => {
|
|
16563
|
+
const query = {};
|
|
16564
|
+
if (filters?.project_id)
|
|
16565
|
+
query.project = filters.project_id;
|
|
16566
|
+
if (filters?.tag_id)
|
|
16567
|
+
query.tag = filters.tag_id;
|
|
16568
|
+
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
16569
|
+
}),
|
|
16570
|
+
find: (id) => wrap2(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
16571
|
+
getByProject: (project_id) => wrap2(() => this.clients.tasks.get(`/tasks`, {
|
|
16572
|
+
query: { project: project_id }
|
|
16573
|
+
})),
|
|
16574
|
+
create: (data) => wrap2(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
16575
|
+
update: async (id, changes) => wrap2(async () => {
|
|
16576
|
+
const result = await this.tasks.find(id);
|
|
16577
|
+
if (!result.ok)
|
|
16578
|
+
throw new Error(result.error.message);
|
|
16579
|
+
if (!result.value)
|
|
16580
|
+
throw new Error(`Task with id ${id} not found`);
|
|
16581
|
+
const task = result.value;
|
|
16582
|
+
const updateData = {
|
|
16583
|
+
id,
|
|
16584
|
+
title: task.task.title,
|
|
16585
|
+
summary: task.task.summary,
|
|
16586
|
+
description: task.task.description,
|
|
16587
|
+
progress: task.task.progress,
|
|
16588
|
+
visibility: task.task.visibility,
|
|
16589
|
+
start_time: task.task.start_time,
|
|
16590
|
+
end_time: task.task.end_time,
|
|
16591
|
+
priority: task.task.priority,
|
|
16592
|
+
owner_id: task.task.owner_id,
|
|
16593
|
+
project_id: task.task.project_id,
|
|
16594
|
+
...changes
|
|
16595
|
+
};
|
|
16596
|
+
return this.clients.tasks.patch("/tasks", {
|
|
16597
|
+
body: updateData
|
|
16598
|
+
});
|
|
16599
|
+
}),
|
|
16600
|
+
upsert: (data) => wrap2(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
16601
|
+
saveTags: (data) => wrap2(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
16602
|
+
deleteTask: (task) => wrap2(() => this.clients.tasks.patch("/tasks", {
|
|
16603
|
+
body: { ...task.task, deleted: true }
|
|
16604
|
+
})),
|
|
16605
|
+
history: {
|
|
16606
|
+
get: (task_id) => wrap2(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
16607
|
+
},
|
|
16608
|
+
ready: (filters) => wrap2(() => {
|
|
16609
|
+
const query = {};
|
|
16610
|
+
if (filters?.project_id)
|
|
16611
|
+
query.project = filters.project_id;
|
|
16612
|
+
if (filters?.limit)
|
|
16613
|
+
query.limit = String(filters.limit);
|
|
16614
|
+
if (filters?.cursor)
|
|
16615
|
+
query.cursor = filters.cursor;
|
|
16616
|
+
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
16617
|
+
}),
|
|
16618
|
+
tree: (id, depth) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
16619
|
+
near: (id, depth) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
16620
|
+
ancestors: (id) => wrap2(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
16621
|
+
claim: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
16622
|
+
done: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
16623
|
+
reopen: (id) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
16624
|
+
advanceStage: (id, data) => wrap2(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
16625
|
+
link: (data) => wrap2(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
16626
|
+
unlink: (link_id) => wrap2(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
16627
|
+
apply: (data) => wrap2(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
16628
|
+
};
|
|
16629
|
+
tags = {
|
|
16630
|
+
list: () => wrap2(() => this.clients.tags.get("/tags"))
|
|
16631
|
+
};
|
|
16632
|
+
docs = {
|
|
16633
|
+
list: (filters) => wrap2(() => {
|
|
16634
|
+
const query = { project_id: filters.project_id };
|
|
16635
|
+
if (filters.task_id)
|
|
16636
|
+
query.task_id = filters.task_id;
|
|
16637
|
+
return this.clients.docs.get("/docs", { query });
|
|
16638
|
+
}),
|
|
16639
|
+
push: (data) => wrap2(() => this.clients.docs.post("/docs", { body: data })),
|
|
16640
|
+
pull: (id, version) => wrap2(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
16641
|
+
versions: (id) => wrap2(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
16642
|
+
renderUrl: (id, version) => {
|
|
16643
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
16644
|
+
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
16645
|
+
},
|
|
16646
|
+
createThread: (document_id, data) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
16647
|
+
replyThread: (document_id, thread_id, body) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
16648
|
+
resolveThread: (document_id, thread_id) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
16649
|
+
toggleBlocking: (document_id, thread_id, blocking) => wrap2(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
16650
|
+
unresolved: (filters) => wrap2(() => {
|
|
16651
|
+
const query = {};
|
|
16652
|
+
if (filters.project_id)
|
|
16653
|
+
query.project_id = filters.project_id;
|
|
16654
|
+
if (filters.document_id)
|
|
16655
|
+
query.document_id = filters.document_id;
|
|
16656
|
+
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
16657
|
+
}),
|
|
16658
|
+
pushInterfaceReport: (data) => wrap2(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
16659
|
+
interfaceStatus: (filters) => wrap2(() => {
|
|
16660
|
+
const query = { project_id: filters.project_id, title: filters.title };
|
|
16661
|
+
if (filters.task_id)
|
|
16662
|
+
query.task_id = filters.task_id;
|
|
16663
|
+
return this.clients.docs.get("/docs/interface/status", { query });
|
|
16664
|
+
})
|
|
16665
|
+
};
|
|
16666
|
+
signoffs = {
|
|
16667
|
+
request: (data) => wrap2(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
16668
|
+
find: (id) => wrap2(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
16669
|
+
findPending: (filters) => wrap2(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
16670
|
+
decide: (id, data) => wrap2(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
16671
|
+
};
|
|
16672
|
+
reviews = {
|
|
16673
|
+
pending: () => wrap2(() => this.clients.reviews.get("/reviews/pending"))
|
|
16674
|
+
};
|
|
16675
|
+
github = {
|
|
16676
|
+
repos: () => wrap2(() => this.clients.github.get("/repos")),
|
|
16677
|
+
branches: (owner, repo) => wrap2(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
16678
|
+
};
|
|
16679
|
+
blog = {
|
|
16680
|
+
posts: {
|
|
16681
|
+
list: (params) => wrap2(() => {
|
|
16682
|
+
const query = {};
|
|
16683
|
+
if (params?.category)
|
|
16684
|
+
query.category = params.category;
|
|
16685
|
+
if (params?.tag)
|
|
16686
|
+
query.tag = params.tag;
|
|
16687
|
+
if (params?.project)
|
|
16688
|
+
query.project = params.project;
|
|
16689
|
+
if (params?.status)
|
|
16690
|
+
query.status = params.status;
|
|
16691
|
+
if (params?.archived !== undefined)
|
|
16692
|
+
query.archived = String(params.archived);
|
|
16693
|
+
if (params?.limit)
|
|
16694
|
+
query.limit = String(params.limit);
|
|
16695
|
+
if (params?.offset !== undefined)
|
|
16696
|
+
query.offset = String(params.offset);
|
|
16697
|
+
if (params?.sort)
|
|
16698
|
+
query.sort = params.sort;
|
|
16699
|
+
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
16700
|
+
}),
|
|
16701
|
+
getBySlug: (slug) => wrap2(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
16702
|
+
create: (data) => wrap2(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
16703
|
+
update: (uuid, data) => wrap2(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
16704
|
+
delete: (uuid) => wrap2(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
16705
|
+
versions: (uuid) => wrap2(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
16706
|
+
version: (uuid, hash) => wrap2(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
16707
|
+
restore: (uuid, hash) => wrap2(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
16708
|
+
},
|
|
16709
|
+
tags: {
|
|
16710
|
+
list: () => wrap2(() => this.clients.blog.get("/blog/tags")),
|
|
16711
|
+
getForPost: (uuid) => wrap2(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
16712
|
+
setForPost: (uuid, tags) => wrap2(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
16713
|
+
addToPost: (uuid, tags) => wrap2(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
16714
|
+
removeFromPost: (uuid, tag) => wrap2(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
16715
|
+
},
|
|
16716
|
+
categories: {
|
|
16717
|
+
tree: () => wrap2(() => this.clients.blog.get("/blog/categories")),
|
|
16718
|
+
create: (data) => wrap2(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
16719
|
+
update: (name, data) => wrap2(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
16720
|
+
body: data
|
|
16721
|
+
})),
|
|
16722
|
+
delete: (name) => wrap2(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
16723
|
+
},
|
|
16724
|
+
tokens: {
|
|
16725
|
+
list: () => wrap2(() => this.clients.blog.get("/blog/tokens")),
|
|
16726
|
+
create: (data) => wrap2(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
16727
|
+
update: (id, data) => wrap2(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
16728
|
+
body: data
|
|
16729
|
+
})),
|
|
16730
|
+
delete: (id) => wrap2(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
16731
|
+
}
|
|
16732
|
+
};
|
|
16733
|
+
media = {
|
|
16734
|
+
profiles: {
|
|
16735
|
+
list: () => wrap2(async () => {
|
|
16736
|
+
const res = await this.clients.media.get("/profiles");
|
|
16737
|
+
return res.profiles;
|
|
16738
|
+
}),
|
|
16739
|
+
create: (data) => wrap2(() => this.clients.media.post("/profiles", { body: data })),
|
|
16740
|
+
get: (id) => wrap2(() => this.clients.media.get(`/profiles/${id}`)),
|
|
16741
|
+
update: (id, data) => wrap2(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
16742
|
+
delete: (id) => wrap2(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
16743
|
+
filters: {
|
|
16744
|
+
list: (profile_id) => wrap2(async () => {
|
|
16745
|
+
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
16746
|
+
return res.filters;
|
|
16747
|
+
}),
|
|
16748
|
+
add: (profile_id, data) => wrap2(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
16749
|
+
remove: (profile_id, filter_id) => wrap2(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
16750
|
+
},
|
|
16751
|
+
timeline: (slug, params) => wrap2(() => {
|
|
16752
|
+
const query = {};
|
|
16753
|
+
if (params?.limit)
|
|
16754
|
+
query.limit = String(params.limit);
|
|
16755
|
+
if (params?.before)
|
|
16756
|
+
query.before = params.before;
|
|
16757
|
+
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
16758
|
+
})
|
|
16759
|
+
},
|
|
16760
|
+
connections: {
|
|
16761
|
+
list: (profile_id, options) => wrap2(async () => {
|
|
16762
|
+
const query = { profile_id };
|
|
16763
|
+
if (options?.include_settings)
|
|
16764
|
+
query.include_settings = "true";
|
|
16765
|
+
const res = await this.clients.media.get("/connections", { query });
|
|
16766
|
+
return res.accounts;
|
|
16767
|
+
}),
|
|
16768
|
+
create: (data) => wrap2(() => this.clients.media.post("/connections", { body: data })),
|
|
16769
|
+
delete: (account_id) => wrap2(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
16770
|
+
refresh: (account_id) => wrap2(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
16771
|
+
refreshAll: () => wrap2(() => this.clients.media.post("/connections/refresh-all")),
|
|
16772
|
+
updateStatus: (account_id, is_active) => wrap2(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
16773
|
+
body: { is_active }
|
|
16774
|
+
})),
|
|
16775
|
+
settings: {
|
|
16776
|
+
get: (account_id) => wrap2(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
16777
|
+
update: (account_id, settings) => wrap2(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
16778
|
+
body: { settings }
|
|
16779
|
+
}))
|
|
16780
|
+
},
|
|
16781
|
+
repos: (account_id) => wrap2(async () => {
|
|
16782
|
+
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
16783
|
+
return res.repos;
|
|
16784
|
+
}),
|
|
16785
|
+
subreddits: (account_id) => wrap2(async () => {
|
|
16786
|
+
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
16787
|
+
return res.subreddits;
|
|
16788
|
+
})
|
|
16789
|
+
},
|
|
16790
|
+
credentials: {
|
|
16791
|
+
check: (platform, profile_id) => wrap2(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
16792
|
+
save: (platform, data) => wrap2(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
16793
|
+
delete: (platform, profile_id) => wrap2(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
16794
|
+
},
|
|
16795
|
+
timeline: {
|
|
16796
|
+
get: (user_id, params) => wrap2(() => {
|
|
16797
|
+
const query = {};
|
|
16798
|
+
if (params?.from)
|
|
16799
|
+
query.from = params.from;
|
|
16800
|
+
if (params?.to)
|
|
16801
|
+
query.to = params.to;
|
|
16802
|
+
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
16803
|
+
}),
|
|
16804
|
+
getRaw: (user_id, platform, account_id) => wrap2(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
16805
|
+
query: { account_id }
|
|
16806
|
+
}))
|
|
16807
|
+
}
|
|
16808
|
+
};
|
|
16809
|
+
activity = {
|
|
16810
|
+
ai: (options) => wrap2(() => {
|
|
16811
|
+
const query = {};
|
|
16812
|
+
if (options?.limit)
|
|
16813
|
+
query.limit = String(options.limit);
|
|
16814
|
+
if (options?.since)
|
|
16815
|
+
query.since = options.since;
|
|
16816
|
+
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
16817
|
+
})
|
|
16818
|
+
};
|
|
16819
|
+
admin = {
|
|
16820
|
+
verifyFold: () => wrap2(() => this.clients.admin.get("/admin/verify-fold")),
|
|
16821
|
+
reconcileDocsCss: () => wrap2(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
16822
|
+
};
|
|
16823
|
+
user = {
|
|
16824
|
+
me: () => wrap2(() => this.clients.auth.get("/user/me")),
|
|
16825
|
+
history: () => wrap2(() => this.clients.auth.get("/user/history")),
|
|
16826
|
+
preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", {
|
|
16827
|
+
body: data
|
|
16828
|
+
}))
|
|
16829
|
+
};
|
|
16989
16830
|
history() {
|
|
16990
16831
|
return this.clients.projects.history();
|
|
16991
16832
|
}
|
|
16833
|
+
pulse = {
|
|
16834
|
+
summary: (input) => wrap2(async () => {
|
|
16835
|
+
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
16836
|
+
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
16837
|
+
});
|
|
16838
|
+
return PulseSummarySchema2.parse(raw);
|
|
16839
|
+
}),
|
|
16840
|
+
events: (input) => wrap2(async () => {
|
|
16841
|
+
const query = {};
|
|
16842
|
+
if (input.name)
|
|
16843
|
+
query.name = input.name;
|
|
16844
|
+
if (input.level)
|
|
16845
|
+
query.level = input.level;
|
|
16846
|
+
if (typeof input.ts_from === "number")
|
|
16847
|
+
query.ts_from = String(input.ts_from);
|
|
16848
|
+
if (typeof input.ts_to === "number")
|
|
16849
|
+
query.ts_to = String(input.ts_to);
|
|
16850
|
+
if (input.search)
|
|
16851
|
+
query.search = input.search;
|
|
16852
|
+
if (input.limit)
|
|
16853
|
+
query.limit = String(input.limit);
|
|
16854
|
+
if (input.cursor)
|
|
16855
|
+
query.cursor = input.cursor;
|
|
16856
|
+
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
16857
|
+
query
|
|
16858
|
+
});
|
|
16859
|
+
return PulseEventsPageSchema2.parse(raw);
|
|
16860
|
+
}),
|
|
16861
|
+
errors: (input) => wrap2(async () => {
|
|
16862
|
+
const query = {};
|
|
16863
|
+
if (typeof input.range === "string") {
|
|
16864
|
+
query.range = input.range;
|
|
16865
|
+
} else {
|
|
16866
|
+
query.from = String(input.range.from);
|
|
16867
|
+
query.to = String(input.range.to);
|
|
16868
|
+
}
|
|
16869
|
+
if (input.group_by_fingerprint)
|
|
16870
|
+
query.group_by_fingerprint = "true";
|
|
16871
|
+
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
16872
|
+
query
|
|
16873
|
+
});
|
|
16874
|
+
return PulseErrorsResultSchema2.parse(raw);
|
|
16875
|
+
}),
|
|
16876
|
+
logs: (input) => wrap2(async () => {
|
|
16877
|
+
const query = {};
|
|
16878
|
+
if (typeof input.range === "string") {
|
|
16879
|
+
query.range = input.range;
|
|
16880
|
+
} else {
|
|
16881
|
+
query.from = String(input.range.from);
|
|
16882
|
+
query.to = String(input.range.to);
|
|
16883
|
+
}
|
|
16884
|
+
if (input.level)
|
|
16885
|
+
query.level = input.level;
|
|
16886
|
+
if (input.search)
|
|
16887
|
+
query.search = input.search;
|
|
16888
|
+
const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
16889
|
+
return PulseLogsResultSchema2.parse(raw);
|
|
16890
|
+
}),
|
|
16891
|
+
latency: (input) => wrap2(async () => {
|
|
16892
|
+
const query = {};
|
|
16893
|
+
if (typeof input.range === "string") {
|
|
16894
|
+
query.range = input.range;
|
|
16895
|
+
} else {
|
|
16896
|
+
query.from = String(input.range.from);
|
|
16897
|
+
query.to = String(input.range.to);
|
|
16898
|
+
}
|
|
16899
|
+
if (input.route)
|
|
16900
|
+
query.route = input.route;
|
|
16901
|
+
if (input.percentiles && input.percentiles.length > 0)
|
|
16902
|
+
query.percentiles = input.percentiles.join(",");
|
|
16903
|
+
const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
|
|
16904
|
+
query
|
|
16905
|
+
});
|
|
16906
|
+
return PulseLatencyResultSchema2.parse(raw);
|
|
16907
|
+
}),
|
|
16908
|
+
subs: {
|
|
16909
|
+
list: (input) => wrap2(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
16910
|
+
create: (input) => wrap2(() => this.clients.pulse.post("/admin/subs", {
|
|
16911
|
+
body: {
|
|
16912
|
+
project_id: input.project_id,
|
|
16913
|
+
name: input.name,
|
|
16914
|
+
filter: input.filter,
|
|
16915
|
+
channel: input.channel,
|
|
16916
|
+
cooldown_seconds: input.cooldown_seconds
|
|
16917
|
+
}
|
|
16918
|
+
})),
|
|
16919
|
+
get: (id) => wrap2(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
16920
|
+
update: (id, patch) => wrap2(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
16921
|
+
delete: (id) => wrap2(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
16922
|
+
},
|
|
16923
|
+
keys: {
|
|
16924
|
+
list: (input) => wrap2(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
16925
|
+
create: (input) => wrap2(() => this.clients.pulse.post("/admin/keys", {
|
|
16926
|
+
body: {
|
|
16927
|
+
project_id: input.project_id,
|
|
16928
|
+
name: input.name,
|
|
16929
|
+
rate_limit_per_min: input.rate_limit_per_min
|
|
16930
|
+
}
|
|
16931
|
+
})),
|
|
16932
|
+
delete: (id, input) => wrap2(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
16933
|
+
query: { project_id: input.project_id }
|
|
16934
|
+
}))
|
|
16935
|
+
}
|
|
16936
|
+
};
|
|
16937
|
+
pipelines = {
|
|
16938
|
+
dashboard: {
|
|
16939
|
+
get: (input) => {
|
|
16940
|
+
const query = { project_id: input.project_id };
|
|
16941
|
+
if (input.window_ms !== undefined)
|
|
16942
|
+
query.window_ms = String(input.window_ms);
|
|
16943
|
+
return wrap2(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
|
|
16944
|
+
}
|
|
16945
|
+
},
|
|
16946
|
+
list: (filter) => {
|
|
16947
|
+
const query = {};
|
|
16948
|
+
if (filter?.package_id !== undefined)
|
|
16949
|
+
query.package_id = filter.package_id;
|
|
16950
|
+
if (filter?.status !== undefined)
|
|
16951
|
+
query.status = filter.status;
|
|
16952
|
+
if (filter?.limit !== undefined)
|
|
16953
|
+
query.limit = String(filter.limit);
|
|
16954
|
+
return wrap2(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
16955
|
+
},
|
|
16956
|
+
get: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
16957
|
+
create: (input) => wrap2(() => this.clients.pipelines.post("/runs", {
|
|
16958
|
+
body: input
|
|
16959
|
+
})),
|
|
16960
|
+
approve: (run_id, input) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
16961
|
+
body: input
|
|
16962
|
+
})),
|
|
16963
|
+
cancel: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
16964
|
+
rollback: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
16965
|
+
redispatch: (run_id) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
16966
|
+
dispatches: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
|
|
16967
|
+
events: {
|
|
16968
|
+
ingest: (run_id, input) => wrap2(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
16969
|
+
body: input
|
|
16970
|
+
})),
|
|
16971
|
+
list: (run_id) => wrap2(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
16972
|
+
},
|
|
16973
|
+
grants: {
|
|
16974
|
+
list: (package_id) => wrap2(() => this.clients.pipelines.get("/grants", {
|
|
16975
|
+
query: package_id ? { package_id } : {}
|
|
16976
|
+
})),
|
|
16977
|
+
approve: (grant_id) => wrap2(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
16978
|
+
body: {}
|
|
16979
|
+
})),
|
|
16980
|
+
deny: (grant_id, reason) => wrap2(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
16981
|
+
body: reason !== undefined ? { reason } : {}
|
|
16982
|
+
}))
|
|
16983
|
+
},
|
|
16984
|
+
packages: {
|
|
16985
|
+
list: (filter) => {
|
|
16986
|
+
const query = {};
|
|
16987
|
+
if (filter?.project_id !== undefined)
|
|
16988
|
+
query.project_id = filter.project_id;
|
|
16989
|
+
return wrap2(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
16990
|
+
},
|
|
16991
|
+
get: (package_id) => wrap2(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
16992
|
+
create: (input) => wrap2(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
16993
|
+
update: (package_id, input) => wrap2(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
16994
|
+
delete: (package_id) => wrap2(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
16995
|
+
},
|
|
16996
|
+
analysis_templates: {
|
|
16997
|
+
list: (input) => wrap2(() => this.clients.pipelines.get("/analysis-templates", {
|
|
16998
|
+
query: { owner_id: input.owner_id }
|
|
16999
|
+
})),
|
|
17000
|
+
get: (id, input) => wrap2(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
17001
|
+
query: { owner_id: input.owner_id }
|
|
17002
|
+
})),
|
|
17003
|
+
create: (input) => wrap2(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
17004
|
+
update: (id, input) => wrap2(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
|
|
17005
|
+
delete: (id, input) => wrap2(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
17006
|
+
query: { owner_id: input.owner_id }
|
|
17007
|
+
}))
|
|
17008
|
+
},
|
|
17009
|
+
oidc_trust: {
|
|
17010
|
+
list: (input) => wrap2(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
17011
|
+
get: (id, input) => wrap2(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
|
|
17012
|
+
create: (input) => wrap2(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
17013
|
+
update: (id, input) => wrap2(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
|
|
17014
|
+
delete: (id, input) => wrap2(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
17015
|
+
query: { owner_id: input.owner_id }
|
|
17016
|
+
}))
|
|
17017
|
+
}
|
|
17018
|
+
};
|
|
16992
17019
|
getApiKey() {
|
|
16993
17020
|
return this.api_key_field;
|
|
16994
17021
|
}
|
|
@@ -21326,7 +21353,7 @@ External CI should call POST /runs/:id/events directly with an OIDC session JWT,
|
|
|
21326
21353
|
grants.command("list").description("List vault grants for a package").requiredOption("--package <id>", "Package ID to list grants for").action(action_grants_list(client_factory));
|
|
21327
21354
|
grants.command("approve <grant-id>").description("Approve a pending vault grant. HUMAN ONLY — signed-in session in the devpad web UI; the CLI/API-key channel gets 403 human_approval_required.").action(action_grants_approve(client_factory));
|
|
21328
21355
|
grants.command("deny <grant-id>").description("Deny a pending vault grant. HUMAN ONLY — signed-in session in the devpad web UI; the CLI/API-key channel gets 403 human_approval_required.").option("--reason <text>", "Optional denial reason").action(action_grants_deny(client_factory));
|
|
21329
|
-
grants.command("request").description("Request a new vault grant (admin-only, direct orchestrator via $DEVPAD_PIPELINES_URL/$DEVPAD_PIPELINES_TOKEN). Creates a PENDING grant a human approves in the devpad web UI; re-requesting the same (package, stage, scope) returns the existing grant.").requiredOption("--package <id>", "Package ID to request the grant for").requiredOption("--stage <name>", 'Stage the grant applies to ("staging" | "production")').requiredOption("--scope <scope>", 'Grant scope, e.g. "github:dispatch:owner/repo/deploy.yml"').option("--json", "Machine-readable JSON output instead of the human line").option("--orchestrator-url <url>", "Orchestrator base URL (default: $DEVPAD_PIPELINES_URL)").option("--token <token>", "Bearer token (default: $DEVPAD_PIPELINES_TOKEN)").action(action_grants_request);
|
|
21356
|
+
grants.command("request").description("Request a new vault grant (admin-only, direct orchestrator via $DEVPAD_PIPELINES_URL/$DEVPAD_PIPELINES_TOKEN). Creates a PENDING grant a human approves in the devpad web UI; re-requesting the same (package, stage, scope) returns the existing grant.").requiredOption("--package <id>", "Package ID to request the grant for").requiredOption("--stage <name>", 'Stage the grant applies to ("staging" | "production")').requiredOption("--scope <scope>", 'Grant scope, e.g. "github:dispatch:owner/repo/deploy.yml"').option("--json", "Machine-readable JSON output instead of the human line").option("--orchestrator-url <url>", "Orchestrator base URL (default: $DEVPAD_PIPELINES_URL)").option("--token <token>", "Bearer token (default: $DEVPAD_PIPELINES_TOKEN)").action(action_grants_request());
|
|
21330
21357
|
const packages = pipelines.command("packages").description("Manage pipeline packages.\nTypical flow: `packages create` to register a pipeline-managed package, then in your repo add\ninfra.ts, pipeline.ts, grants.ts, and a CI workflow that calls `pipelines artifacts upload`.");
|
|
21331
21358
|
packages.command("list").description("List pipeline packages").option("--project <id-or-slug>", "Filter by linked devpad project (accepts project_id or internal id)").action(action_packages_list(client_factory));
|
|
21332
21359
|
packages.command("get <id>").description("Get a pipeline package by id").action(action_packages_get(client_factory));
|
|
@@ -22043,8 +22070,7 @@ var update_user2 = objectType({
|
|
|
22043
22070
|
id: stringType(),
|
|
22044
22071
|
name: stringType().optional(),
|
|
22045
22072
|
image_url: stringType().optional(),
|
|
22046
|
-
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
22047
|
-
email_verified: booleanType().optional()
|
|
22073
|
+
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
22048
22074
|
});
|
|
22049
22075
|
var config_schema2 = objectType({
|
|
22050
22076
|
tags: arrayType(objectType({
|
|
@@ -22175,7 +22201,7 @@ var upsert_pipeline_grant2 = objectType({
|
|
|
22175
22201
|
scope: grant_scope2,
|
|
22176
22202
|
granted_by: stringType().nullable().optional(),
|
|
22177
22203
|
granted_at: stringType().nullable().optional(),
|
|
22178
|
-
auto_approved: booleanType().
|
|
22204
|
+
auto_approved: booleanType().optional()
|
|
22179
22205
|
});
|
|
22180
22206
|
var upsert_pipeline_approval2 = objectType({
|
|
22181
22207
|
run_id: stringType(),
|
|
@@ -23233,6 +23259,9 @@ function handleError(error) {
|
|
|
23233
23259
|
console.error(source_default.red(`Error: ${message}`));
|
|
23234
23260
|
process.exit(1);
|
|
23235
23261
|
}
|
|
23262
|
+
function is_named_entity(value) {
|
|
23263
|
+
return typeof value === "object" && value !== null && "name" in value && "id" in value;
|
|
23264
|
+
}
|
|
23236
23265
|
async function formatOutput(data, format = "json") {
|
|
23237
23266
|
if (format === "json") {
|
|
23238
23267
|
const output = JSON.stringify(data, null, 2) + `
|
|
@@ -23295,8 +23324,10 @@ projects.command("create").description("Create a new project").requiredOption("-
|
|
|
23295
23324
|
description: options.description,
|
|
23296
23325
|
private: options.private
|
|
23297
23326
|
});
|
|
23298
|
-
|
|
23299
|
-
|
|
23327
|
+
if (!is_named_entity(result))
|
|
23328
|
+
throw new Error("Unexpected response from tool");
|
|
23329
|
+
spinner.succeed(`Project "${result.name}" created`);
|
|
23330
|
+
console.log(source_default.green(`ID: ${result.id}`));
|
|
23300
23331
|
} catch (error) {
|
|
23301
23332
|
spinner.fail("Failed to create project");
|
|
23302
23333
|
handleError(error);
|
|
@@ -23524,8 +23555,10 @@ milestones.command("create").description("Create a new milestone").requiredOptio
|
|
|
23524
23555
|
target_time: options.targetTime,
|
|
23525
23556
|
target_version: options.targetVersion
|
|
23526
23557
|
});
|
|
23527
|
-
|
|
23528
|
-
|
|
23558
|
+
if (!is_named_entity(result))
|
|
23559
|
+
throw new Error("Unexpected response from tool");
|
|
23560
|
+
spinner.succeed(`Milestone "${result.name}" created`);
|
|
23561
|
+
console.log(source_default.green(`ID: ${result.id}`));
|
|
23529
23562
|
} catch (error) {
|
|
23530
23563
|
spinner.fail("Failed to create milestone");
|
|
23531
23564
|
handleError(error);
|
|
@@ -23560,8 +23593,10 @@ goals.command("create").description("Create a new goal").requiredOption("-n, --n
|
|
|
23560
23593
|
description: options.description,
|
|
23561
23594
|
target_time: options.targetTime
|
|
23562
23595
|
});
|
|
23563
|
-
|
|
23564
|
-
|
|
23596
|
+
if (!is_named_entity(result))
|
|
23597
|
+
throw new Error("Unexpected response from tool");
|
|
23598
|
+
spinner.succeed(`Goal "${result.name}" created`);
|
|
23599
|
+
console.log(source_default.green(`ID: ${result.id}`));
|
|
23565
23600
|
} catch (error) {
|
|
23566
23601
|
spinner.fail("Failed to create goal");
|
|
23567
23602
|
handleError(error);
|