@devpad/mcp 2.6.11 → 2.6.13
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 +1229 -983
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -7999,6 +7999,181 @@ class PrimaryKey {
|
|
|
7999
7999
|
}
|
|
8000
8000
|
}
|
|
8001
8001
|
|
|
8002
|
+
// ../../node_modules/@f0rbit/corpus/dist/types.js
|
|
8003
|
+
var ok = (value) => ({ ok: true, value });
|
|
8004
|
+
var err = (error) => ({ ok: false, error });
|
|
8005
|
+
function define_store(id, codec, opts) {
|
|
8006
|
+
if (typeof opts === "string") {
|
|
8007
|
+
return { id, codec, description: opts };
|
|
8008
|
+
}
|
|
8009
|
+
return { id, codec, description: opts?.description, data_key_fn: opts?.data_key_fn };
|
|
8010
|
+
}
|
|
8011
|
+
|
|
8012
|
+
// ../../node_modules/@f0rbit/corpus/dist/utils.js
|
|
8013
|
+
function json_codec(schema) {
|
|
8014
|
+
return {
|
|
8015
|
+
content_type: "application/json",
|
|
8016
|
+
encode: async (value) => new TextEncoder().encode(JSON.stringify(value)),
|
|
8017
|
+
decode: async (bytes) => schema.parse(JSON.parse(new TextDecoder().decode(bytes)))
|
|
8018
|
+
};
|
|
8019
|
+
}
|
|
8020
|
+
function create_filter_pipeline(config) {
|
|
8021
|
+
return (items, opts) => {
|
|
8022
|
+
let filtered = items;
|
|
8023
|
+
for (const { key, predicate } of config.filters) {
|
|
8024
|
+
const optValue = opts[key];
|
|
8025
|
+
if (optValue !== undefined && optValue !== null) {
|
|
8026
|
+
filtered = filtered.filter((item) => predicate(item, optValue));
|
|
8027
|
+
}
|
|
8028
|
+
}
|
|
8029
|
+
filtered.sort(config.sort);
|
|
8030
|
+
if (opts.limit) {
|
|
8031
|
+
filtered = filtered.slice(0, opts.limit);
|
|
8032
|
+
}
|
|
8033
|
+
return filtered;
|
|
8034
|
+
};
|
|
8035
|
+
}
|
|
8036
|
+
var snapshot_filter_pipeline = create_filter_pipeline({
|
|
8037
|
+
filters: [
|
|
8038
|
+
{ key: "before", predicate: (m, before) => m.created_at < before },
|
|
8039
|
+
{ key: "after", predicate: (m, after) => m.created_at > after },
|
|
8040
|
+
{ key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag) => m.tags?.includes(tag)) }
|
|
8041
|
+
],
|
|
8042
|
+
sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
|
|
8043
|
+
});
|
|
8044
|
+
|
|
8045
|
+
// ../../node_modules/@f0rbit/corpus/dist/result.js
|
|
8046
|
+
var try_catch = (fn, on_error) => {
|
|
8047
|
+
try {
|
|
8048
|
+
return ok(fn());
|
|
8049
|
+
} catch (e) {
|
|
8050
|
+
return err(on_error(e));
|
|
8051
|
+
}
|
|
8052
|
+
};
|
|
8053
|
+
var try_catch_async = async (fn, on_error) => {
|
|
8054
|
+
try {
|
|
8055
|
+
return ok(await fn());
|
|
8056
|
+
} catch (e) {
|
|
8057
|
+
return err(on_error(e));
|
|
8058
|
+
}
|
|
8059
|
+
};
|
|
8060
|
+
var fetch_result = async (input, init, on_error, parse_body = (r) => r.json()) => {
|
|
8061
|
+
try {
|
|
8062
|
+
const response = await fetch(input, init);
|
|
8063
|
+
if (!response.ok) {
|
|
8064
|
+
return err(on_error({ type: "http", status: response.status, status_text: response.statusText }));
|
|
8065
|
+
}
|
|
8066
|
+
return ok(await parse_body(response));
|
|
8067
|
+
} catch (e) {
|
|
8068
|
+
return err(on_error({ type: "network", cause: e }));
|
|
8069
|
+
}
|
|
8070
|
+
};
|
|
8071
|
+
var create_pipe = (promised) => ({
|
|
8072
|
+
map: (fn) => create_pipe(promised.then((r) => {
|
|
8073
|
+
if (r.ok)
|
|
8074
|
+
return ok(fn(r.value));
|
|
8075
|
+
return err(r.error);
|
|
8076
|
+
})),
|
|
8077
|
+
map_async: (fn) => create_pipe(promised.then(async (r) => {
|
|
8078
|
+
if (r.ok)
|
|
8079
|
+
return ok(await fn(r.value));
|
|
8080
|
+
return err(r.error);
|
|
8081
|
+
})),
|
|
8082
|
+
flat_map: (fn) => create_pipe(promised.then((r) => {
|
|
8083
|
+
if (r.ok)
|
|
8084
|
+
return fn(r.value);
|
|
8085
|
+
return err(r.error);
|
|
8086
|
+
})),
|
|
8087
|
+
map_err: (fn) => create_pipe(promised.then((r) => {
|
|
8088
|
+
if (r.ok)
|
|
8089
|
+
return ok(r.value);
|
|
8090
|
+
return err(fn(r.error));
|
|
8091
|
+
})),
|
|
8092
|
+
tap: (fn) => create_pipe(promised.then(async (r) => {
|
|
8093
|
+
if (r.ok)
|
|
8094
|
+
await fn(r.value);
|
|
8095
|
+
return r;
|
|
8096
|
+
})),
|
|
8097
|
+
tap_err: (fn) => create_pipe(promised.then(async (r) => {
|
|
8098
|
+
if (!r.ok)
|
|
8099
|
+
await fn(r.error);
|
|
8100
|
+
return r;
|
|
8101
|
+
})),
|
|
8102
|
+
unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
|
|
8103
|
+
result: () => promised
|
|
8104
|
+
});
|
|
8105
|
+
var pipe = (initial) => create_pipe(Promise.resolve(initial));
|
|
8106
|
+
pipe.ok = (value) => pipe(ok(value));
|
|
8107
|
+
pipe.err = (error) => pipe(err(error));
|
|
8108
|
+
pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
|
|
8109
|
+
pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
|
|
8110
|
+
|
|
8111
|
+
// ../../node_modules/@f0rbit/corpus/dist/observations/storage.js
|
|
8112
|
+
var observation_filter_pipeline = create_filter_pipeline({
|
|
8113
|
+
filters: [
|
|
8114
|
+
{
|
|
8115
|
+
key: "type",
|
|
8116
|
+
predicate: (r, type) => {
|
|
8117
|
+
const types = Array.isArray(type) ? type : [type];
|
|
8118
|
+
return types.includes(r.type);
|
|
8119
|
+
}
|
|
8120
|
+
},
|
|
8121
|
+
{ key: "source_store_id", predicate: (r, id) => r.source_store_id === id },
|
|
8122
|
+
{ key: "source_version", predicate: (r, version) => r.source_version === version },
|
|
8123
|
+
{ key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
|
|
8124
|
+
{ key: "created_after", predicate: (r, after) => r.created_at > after },
|
|
8125
|
+
{ key: "created_before", predicate: (r, before) => r.created_at < before },
|
|
8126
|
+
{ key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
|
|
8127
|
+
{ key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
|
|
8128
|
+
],
|
|
8129
|
+
sort: (a, b) => b.created_at.localeCompare(a.created_at)
|
|
8130
|
+
});
|
|
8131
|
+
// ../../node_modules/@f0rbit/corpus/dist/observations/schema.js
|
|
8132
|
+
var corpus_observations = sqliteTable("corpus_observations", {
|
|
8133
|
+
id: text("id").primaryKey(),
|
|
8134
|
+
type: text("type").notNull(),
|
|
8135
|
+
source_store_id: text("source_store_id").notNull(),
|
|
8136
|
+
source_version: text("source_version").notNull(),
|
|
8137
|
+
source_path: text("source_path"),
|
|
8138
|
+
source_span_start: text("source_span_start"),
|
|
8139
|
+
source_span_end: text("source_span_end"),
|
|
8140
|
+
content: text("content").notNull(),
|
|
8141
|
+
confidence: real("confidence"),
|
|
8142
|
+
observed_at: text("observed_at"),
|
|
8143
|
+
created_at: text("created_at").notNull(),
|
|
8144
|
+
derived_from: text("derived_from")
|
|
8145
|
+
}, (table) => ({
|
|
8146
|
+
type_idx: index("idx_obs_type").on(table.type),
|
|
8147
|
+
source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
|
|
8148
|
+
type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
|
|
8149
|
+
type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
|
|
8150
|
+
}));
|
|
8151
|
+
// ../../node_modules/@f0rbit/corpus/dist/backend/memory.js
|
|
8152
|
+
var CORPUS_DEV = (() => {
|
|
8153
|
+
try {
|
|
8154
|
+
return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
|
|
8155
|
+
} catch {
|
|
8156
|
+
return false;
|
|
8157
|
+
}
|
|
8158
|
+
})();
|
|
8159
|
+
// ../../node_modules/@f0rbit/corpus/dist/schema.js
|
|
8160
|
+
var corpus_snapshots = sqliteTable("corpus_snapshots", {
|
|
8161
|
+
store_id: text("store_id").notNull(),
|
|
8162
|
+
version: text("version").notNull(),
|
|
8163
|
+
parents: text("parents").notNull(),
|
|
8164
|
+
created_at: text("created_at").notNull(),
|
|
8165
|
+
invoked_at: text("invoked_at"),
|
|
8166
|
+
content_hash: text("content_hash").notNull(),
|
|
8167
|
+
content_type: text("content_type").notNull(),
|
|
8168
|
+
size_bytes: integer("size_bytes").notNull(),
|
|
8169
|
+
data_key: text("data_key").notNull(),
|
|
8170
|
+
tags: text("tags")
|
|
8171
|
+
}, (table) => ({
|
|
8172
|
+
pk: primaryKey({ columns: [table.store_id, table.version] }),
|
|
8173
|
+
created_idx: index("idx_store_created").on(table.store_id, table.created_at),
|
|
8174
|
+
hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
|
|
8175
|
+
data_key_idx: index("idx_data_key").on(table.data_key)
|
|
8176
|
+
}));
|
|
8002
8177
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
8003
8178
|
var util;
|
|
8004
8179
|
(function(util) {
|
|
@@ -11860,6 +12035,41 @@ var coerce = {
|
|
|
11860
12035
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
11861
12036
|
};
|
|
11862
12037
|
var NEVER = INVALID;
|
|
12038
|
+
// ../../node_modules/@f0rbit/corpus/dist/version-set.js
|
|
12039
|
+
var VersionSetManifestSchema = objectType({
|
|
12040
|
+
package: stringType(),
|
|
12041
|
+
git_sha: stringType().length(40),
|
|
12042
|
+
created_at: stringType().datetime(),
|
|
12043
|
+
builds: objectType({
|
|
12044
|
+
worker: objectType({
|
|
12045
|
+
artifact_ref: stringType(),
|
|
12046
|
+
size_bytes: numberType().int(),
|
|
12047
|
+
compatibility_date: stringType()
|
|
12048
|
+
}),
|
|
12049
|
+
assets: objectType({
|
|
12050
|
+
artifact_ref: stringType().optional(),
|
|
12051
|
+
version_affinity: enumType(["pinned", "none"]).default("pinned")
|
|
12052
|
+
}).optional()
|
|
12053
|
+
}),
|
|
12054
|
+
migrations: objectType({
|
|
12055
|
+
d1_plan_ref: stringType().optional(),
|
|
12056
|
+
do_migrations: arrayType(objectType({
|
|
12057
|
+
class_name: stringType(),
|
|
12058
|
+
tag: stringType(),
|
|
12059
|
+
kind: enumType([
|
|
12060
|
+
"new_sqlite_classes",
|
|
12061
|
+
"new_classes",
|
|
12062
|
+
"renamed_classes",
|
|
12063
|
+
"deleted_classes",
|
|
12064
|
+
"transferred_classes"
|
|
12065
|
+
])
|
|
12066
|
+
})).default([])
|
|
12067
|
+
}),
|
|
12068
|
+
env_manifest_ref: stringType(),
|
|
12069
|
+
infra_plan_ref: stringType(),
|
|
12070
|
+
grants_ref: stringType().optional(),
|
|
12071
|
+
template_ref: stringType().optional()
|
|
12072
|
+
});
|
|
11863
12073
|
// ../../node_modules/drizzle-zod/index.mjs
|
|
11864
12074
|
var CONSTANTS = {
|
|
11865
12075
|
INT8_MIN: -128,
|
|
@@ -12111,7 +12321,7 @@ var createSelectSchema = (entity, refine) => {
|
|
|
12111
12321
|
return handleColumns(columns, refine ?? {}, selectConditions);
|
|
12112
12322
|
};
|
|
12113
12323
|
|
|
12114
|
-
// ../api/dist/chunk-
|
|
12324
|
+
// ../api/dist/chunk-3HPT255B.js
|
|
12115
12325
|
var timestamps = () => ({
|
|
12116
12326
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12117
12327
|
updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
@@ -12215,14 +12425,14 @@ var action = sqliteTable("action", {
|
|
|
12215
12425
|
...owned_entity("action"),
|
|
12216
12426
|
type: text("type", { enum: ACTIONS }).notNull(),
|
|
12217
12427
|
description: text("description").notNull(),
|
|
12218
|
-
data: text("data", { mode: "json" }),
|
|
12428
|
+
data: text("data", { mode: "json" }).$type(),
|
|
12219
12429
|
channel: text("channel", { enum: ["user", "api"] }).notNull().default("user")
|
|
12220
12430
|
});
|
|
12221
12431
|
var tracker_result = sqliteTable("tracker_result", {
|
|
12222
12432
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
12223
12433
|
project_id: text("project_id").notNull().references(() => project.id),
|
|
12224
12434
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12225
|
-
data: text("data", { mode: "json" }).notNull(),
|
|
12435
|
+
data: text("data", { mode: "json" }).$type().notNull(),
|
|
12226
12436
|
accepted: integer("accepted", { mode: "boolean" }).notNull().default(false)
|
|
12227
12437
|
});
|
|
12228
12438
|
var todo_updates = sqliteTable("todo_updates", {
|
|
@@ -12231,7 +12441,7 @@ var todo_updates = sqliteTable("todo_updates", {
|
|
|
12231
12441
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12232
12442
|
old_id: integer("old_id").references(() => tracker_result.id),
|
|
12233
12443
|
new_id: integer("new_id").notNull().references(() => tracker_result.id),
|
|
12234
|
-
data: text("data", { mode: "json" }).notNull(),
|
|
12444
|
+
data: text("data", { mode: "json" }).$type().notNull(),
|
|
12235
12445
|
status: text("status", { enum: ["PENDING", "ACCEPTED", "REJECTED", "IGNORED"] }).notNull().default("PENDING"),
|
|
12236
12446
|
branch: text("branch"),
|
|
12237
12447
|
commit_sha: text("commit_sha"),
|
|
@@ -12293,7 +12503,7 @@ var task_link = sqliteTable("task_link", {
|
|
|
12293
12503
|
src_id: text("src_id").notNull().references(() => task.id),
|
|
12294
12504
|
dst_id: text("dst_id").references(() => task.id),
|
|
12295
12505
|
kind: text("kind", { enum: TASK_LINK_KINDS }).notNull(),
|
|
12296
|
-
ref: text("ref", { mode: "json" }),
|
|
12506
|
+
ref: text("ref", { mode: "json" }).$type(),
|
|
12297
12507
|
note: text("note")
|
|
12298
12508
|
}, (table) => [
|
|
12299
12509
|
unique("task_link_unique").on(table.src_id, table.dst_id, table.kind),
|
|
@@ -12310,7 +12520,7 @@ var task_rollup = sqliteTable("task_rollup", {
|
|
|
12310
12520
|
var apply_log = sqliteTable("apply_log", {
|
|
12311
12521
|
idempotency_key: text("idempotency_key").primaryKey(),
|
|
12312
12522
|
owner_id: text("owner_id").notNull().references(() => user.id),
|
|
12313
|
-
response: text("response", { mode: "json" }).notNull(),
|
|
12523
|
+
response: text("response", { mode: "json" }).$type().notNull(),
|
|
12314
12524
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
12315
12525
|
});
|
|
12316
12526
|
var TASK_EVENT_KINDS = [
|
|
@@ -12340,7 +12550,7 @@ var task_event = sqliteTable("task_event", {
|
|
|
12340
12550
|
subject_id: text("subject_id").notNull(),
|
|
12341
12551
|
project_id: text("project_id"),
|
|
12342
12552
|
actor: text("actor", { enum: TASK_EVENT_ACTORS }).notNull(),
|
|
12343
|
-
payload: text("payload", { mode: "json" }).notNull(),
|
|
12553
|
+
payload: text("payload", { mode: "json" }).$type().notNull(),
|
|
12344
12554
|
occurred_at: text("occurred_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12345
12555
|
dispatch_status: text("dispatch_status", { enum: TASK_EVENT_DISPATCH_STATUSES }).notNull().default("pending"),
|
|
12346
12556
|
dispatched_at: text("dispatched_at")
|
|
@@ -12352,8 +12562,8 @@ var hook = sqliteTable("hook", {
|
|
|
12352
12562
|
...entity("hook"),
|
|
12353
12563
|
project_id: text("project_id").notNull().references(() => project.id),
|
|
12354
12564
|
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
12355
|
-
trigger: text("trigger", { mode: "json" }).notNull(),
|
|
12356
|
-
action: text("action", { mode: "json" }).notNull()
|
|
12565
|
+
trigger: text("trigger", { mode: "json" }).$type().notNull(),
|
|
12566
|
+
action: text("action", { mode: "json" }).$type().notNull()
|
|
12357
12567
|
}, (table) => [index("hook_project_id_idx").on(table.project_id)]);
|
|
12358
12568
|
var HOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed_transient", "failed_permanent"];
|
|
12359
12569
|
var hook_delivery = sqliteTable("hook_delivery", {
|
|
@@ -12438,7 +12648,7 @@ var codebase_tasks = sqliteTable("codebase_tasks", {
|
|
|
12438
12648
|
text: text("text"),
|
|
12439
12649
|
file: text("file"),
|
|
12440
12650
|
line: integer("line"),
|
|
12441
|
-
context: text("context", { mode: "json" }),
|
|
12651
|
+
context: text("context", { mode: "json" }).$type(),
|
|
12442
12652
|
recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
|
|
12443
12653
|
});
|
|
12444
12654
|
var tag = sqliteTable("tag", {
|
|
@@ -12489,10 +12699,10 @@ var pipeline_package = sqliteTable("pipeline_package", {
|
|
|
12489
12699
|
name: text("name").notNull(),
|
|
12490
12700
|
repo_url: text("repo_url"),
|
|
12491
12701
|
default_template_ref: text("default_template_ref"),
|
|
12492
|
-
script_name_overrides: text("script_name_overrides", { mode: "json" }),
|
|
12702
|
+
script_name_overrides: text("script_name_overrides", { mode: "json" }).$type(),
|
|
12493
12703
|
project_id: text("project_id").references(() => project.id),
|
|
12494
12704
|
deploy_mode: text("deploy_mode", { enum: DEPLOY_MODES }).notNull().default("orchestrated"),
|
|
12495
|
-
external_target: text("external_target", { mode: "json" })
|
|
12705
|
+
external_target: text("external_target", { mode: "json" }).$type()
|
|
12496
12706
|
});
|
|
12497
12707
|
var pipeline_run = sqliteTable("pipeline_run", {
|
|
12498
12708
|
...entity("pipeline-run"),
|
|
@@ -12503,8 +12713,8 @@ var pipeline_run = sqliteTable("pipeline_run", {
|
|
|
12503
12713
|
kind: text("kind", { enum: RUN_KINDS }).notNull().default("deploy"),
|
|
12504
12714
|
status: text("status", { enum: RUN_STATUSES }).notNull().default("queued"),
|
|
12505
12715
|
current_stage: text("current_stage"),
|
|
12506
|
-
resolved_rollout: text("resolved_rollout", { mode: "json" }).notNull(),
|
|
12507
|
-
resolved_gates: text("resolved_gates", { mode: "json" }).notNull(),
|
|
12716
|
+
resolved_rollout: text("resolved_rollout", { mode: "json" }).$type().notNull(),
|
|
12717
|
+
resolved_gates: text("resolved_gates", { mode: "json" }).$type().notNull(),
|
|
12508
12718
|
forced_atomic_reason: text("forced_atomic_reason", { enum: FORCED_ATOMIC_REASONS }),
|
|
12509
12719
|
started_at: text("started_at"),
|
|
12510
12720
|
finished_at: text("finished_at"),
|
|
@@ -12515,7 +12725,7 @@ var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
|
|
|
12515
12725
|
run_id: text("run_id").notNull().references(() => pipeline_run.id),
|
|
12516
12726
|
stage_name: text("stage_name").notNull(),
|
|
12517
12727
|
kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
|
|
12518
|
-
payload: text("payload", { mode: "json" }),
|
|
12728
|
+
payload: text("payload", { mode: "json" }).$type(),
|
|
12519
12729
|
ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12520
12730
|
idempotency_hash: text("idempotency_hash")
|
|
12521
12731
|
}, (table) => [
|
|
@@ -12554,8 +12764,8 @@ var pipeline_analysis_template = sqliteTable("pipeline_analysis_template", {
|
|
|
12554
12764
|
...entity("pipeline-analysis-template"),
|
|
12555
12765
|
owner_id: text("owner_id").notNull().references(() => user.id),
|
|
12556
12766
|
name: text("name").notNull(),
|
|
12557
|
-
query_dsl: text("query_dsl", { mode: "json" }).notNull(),
|
|
12558
|
-
threshold_dsl: text("threshold_dsl", { mode: "json" }).notNull(),
|
|
12767
|
+
query_dsl: text("query_dsl", { mode: "json" }).$type().notNull(),
|
|
12768
|
+
threshold_dsl: text("threshold_dsl", { mode: "json" }).$type().notNull(),
|
|
12559
12769
|
window_ms: integer("window_ms").notNull().default(600000)
|
|
12560
12770
|
});
|
|
12561
12771
|
var PIPELINE_OIDC_PROVIDERS = ["github"];
|
|
@@ -12798,8 +13008,7 @@ var update_user = objectType({
|
|
|
12798
13008
|
id: stringType(),
|
|
12799
13009
|
name: stringType().optional(),
|
|
12800
13010
|
image_url: stringType().optional(),
|
|
12801
|
-
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
12802
|
-
email_verified: booleanType().optional()
|
|
13011
|
+
task_view: unionType([literalType("list"), literalType("grid")]).optional()
|
|
12803
13012
|
});
|
|
12804
13013
|
var config_schema = objectType({
|
|
12805
13014
|
tags: arrayType(objectType({
|
|
@@ -12930,7 +13139,7 @@ var upsert_pipeline_grant = objectType({
|
|
|
12930
13139
|
scope: grant_scope,
|
|
12931
13140
|
granted_by: stringType().nullable().optional(),
|
|
12932
13141
|
granted_at: stringType().nullable().optional(),
|
|
12933
|
-
auto_approved: booleanType().
|
|
13142
|
+
auto_approved: booleanType().optional()
|
|
12934
13143
|
});
|
|
12935
13144
|
var upsert_pipeline_approval = objectType({
|
|
12936
13145
|
run_id: stringType(),
|
|
@@ -13222,211 +13431,65 @@ var project_graph_response = objectType({
|
|
|
13222
13431
|
});
|
|
13223
13432
|
var project_view_pin = objectType({ x: numberType(), y: numberType() });
|
|
13224
13433
|
var project_view_layout = objectType({ pins: recordType(stringType(), project_view_pin) });
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
}
|
|
13253
|
-
filtered.sort(config.sort);
|
|
13254
|
-
if (opts.limit) {
|
|
13255
|
-
filtered = filtered.slice(0, opts.limit);
|
|
13256
|
-
}
|
|
13257
|
-
return filtered;
|
|
13258
|
-
};
|
|
13259
|
-
}
|
|
13260
|
-
var snapshot_filter_pipeline = create_filter_pipeline({
|
|
13261
|
-
filters: [
|
|
13262
|
-
{ key: "before", predicate: (m, before) => m.created_at < before },
|
|
13263
|
-
{ key: "after", predicate: (m, after) => m.created_at > after },
|
|
13264
|
-
{ key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag) => m.tags?.includes(tag)) }
|
|
13265
|
-
],
|
|
13266
|
-
sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
|
|
13434
|
+
var action_data = objectType({
|
|
13435
|
+
task_id: stringType().optional(),
|
|
13436
|
+
project_id: stringType().optional(),
|
|
13437
|
+
milestone_id: stringType().optional(),
|
|
13438
|
+
goal_id: stringType().optional(),
|
|
13439
|
+
title: stringType().optional(),
|
|
13440
|
+
name: stringType().nullish(),
|
|
13441
|
+
href: stringType().nullish(),
|
|
13442
|
+
message: stringType().nullish(),
|
|
13443
|
+
status: stringType().nullish(),
|
|
13444
|
+
from: stringType().nullish(),
|
|
13445
|
+
to: stringType().nullish(),
|
|
13446
|
+
override: booleanType().optional(),
|
|
13447
|
+
reason: stringType().nullish()
|
|
13448
|
+
});
|
|
13449
|
+
var scan_diff_info = objectType({
|
|
13450
|
+
text: stringType(),
|
|
13451
|
+
line: numberType(),
|
|
13452
|
+
file: stringType(),
|
|
13453
|
+
context: arrayType(stringType()).optional()
|
|
13454
|
+
});
|
|
13455
|
+
var scan_diff_result = objectType({
|
|
13456
|
+
id: stringType(),
|
|
13457
|
+
tag: stringType(),
|
|
13458
|
+
type: enumType(["SAME", "MOVE", "UPDATE", "NEW", "DELETE"]),
|
|
13459
|
+
data: objectType({ old: scan_diff_info.nullable(), new: scan_diff_info.nullable() }),
|
|
13460
|
+
proposal: scan_diff_proposal.nullable().optional()
|
|
13267
13461
|
});
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
};
|
|
13277
|
-
var
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
return ok(await parse_body(response));
|
|
13284
|
-
} catch (e) {
|
|
13285
|
-
return err(on_error({ type: "network", cause: e }));
|
|
13286
|
-
}
|
|
13462
|
+
var scan_diff_results = arrayType(scan_diff_result);
|
|
13463
|
+
var scan_parsed_task = objectType({
|
|
13464
|
+
id: stringType(),
|
|
13465
|
+
file: stringType(),
|
|
13466
|
+
line: numberType(),
|
|
13467
|
+
tag: stringType(),
|
|
13468
|
+
text: stringType(),
|
|
13469
|
+
context: arrayType(stringType())
|
|
13470
|
+
});
|
|
13471
|
+
var scan_parsed_tasks = arrayType(scan_parsed_task);
|
|
13472
|
+
var decode_legacy_json_string = (value) => {
|
|
13473
|
+
if (typeof value !== "string")
|
|
13474
|
+
return value;
|
|
13475
|
+
const decoded = try_catch(() => JSON.parse(value), (e) => e);
|
|
13476
|
+
return decoded.ok ? decoded.value : value;
|
|
13287
13477
|
};
|
|
13288
|
-
var
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
})),
|
|
13304
|
-
map_err: (fn) => create_pipe(promised.then((r) => {
|
|
13305
|
-
if (r.ok)
|
|
13306
|
-
return ok(r.value);
|
|
13307
|
-
return err(fn(r.error));
|
|
13308
|
-
})),
|
|
13309
|
-
tap: (fn) => create_pipe(promised.then(async (r) => {
|
|
13310
|
-
if (r.ok)
|
|
13311
|
-
await fn(r.value);
|
|
13312
|
-
return r;
|
|
13313
|
-
})),
|
|
13314
|
-
tap_err: (fn) => create_pipe(promised.then(async (r) => {
|
|
13315
|
-
if (!r.ok)
|
|
13316
|
-
await fn(r.error);
|
|
13317
|
-
return r;
|
|
13318
|
-
})),
|
|
13319
|
-
unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
|
|
13320
|
-
result: () => promised
|
|
13321
|
-
});
|
|
13322
|
-
var pipe = (initial) => create_pipe(Promise.resolve(initial));
|
|
13323
|
-
pipe.ok = (value) => pipe(ok(value));
|
|
13324
|
-
pipe.err = (error) => pipe(err(error));
|
|
13325
|
-
pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
|
|
13326
|
-
pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
|
|
13327
|
-
|
|
13328
|
-
// ../../node_modules/@f0rbit/corpus/dist/observations/storage.js
|
|
13329
|
-
var observation_filter_pipeline = create_filter_pipeline({
|
|
13330
|
-
filters: [
|
|
13331
|
-
{
|
|
13332
|
-
key: "type",
|
|
13333
|
-
predicate: (r, type) => {
|
|
13334
|
-
const types = Array.isArray(type) ? type : [type];
|
|
13335
|
-
return types.includes(r.type);
|
|
13336
|
-
}
|
|
13337
|
-
},
|
|
13338
|
-
{ key: "source_store_id", predicate: (r, id) => r.source_store_id === id },
|
|
13339
|
-
{ key: "source_version", predicate: (r, version) => r.source_version === version },
|
|
13340
|
-
{ key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
|
|
13341
|
-
{ key: "created_after", predicate: (r, after) => r.created_at > after },
|
|
13342
|
-
{ key: "created_before", predicate: (r, before) => r.created_at < before },
|
|
13343
|
-
{ key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
|
|
13344
|
-
{ key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
|
|
13345
|
-
],
|
|
13346
|
-
sort: (a, b) => b.created_at.localeCompare(a.created_at)
|
|
13347
|
-
});
|
|
13348
|
-
// ../../node_modules/@f0rbit/corpus/dist/observations/schema.js
|
|
13349
|
-
var corpus_observations = sqliteTable("corpus_observations", {
|
|
13350
|
-
id: text("id").primaryKey(),
|
|
13351
|
-
type: text("type").notNull(),
|
|
13352
|
-
source_store_id: text("source_store_id").notNull(),
|
|
13353
|
-
source_version: text("source_version").notNull(),
|
|
13354
|
-
source_path: text("source_path"),
|
|
13355
|
-
source_span_start: text("source_span_start"),
|
|
13356
|
-
source_span_end: text("source_span_end"),
|
|
13357
|
-
content: text("content").notNull(),
|
|
13358
|
-
confidence: real("confidence"),
|
|
13359
|
-
observed_at: text("observed_at"),
|
|
13360
|
-
created_at: text("created_at").notNull(),
|
|
13361
|
-
derived_from: text("derived_from")
|
|
13362
|
-
}, (table) => ({
|
|
13363
|
-
type_idx: index("idx_obs_type").on(table.type),
|
|
13364
|
-
source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
|
|
13365
|
-
type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
|
|
13366
|
-
type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
|
|
13367
|
-
}));
|
|
13368
|
-
// ../../node_modules/@f0rbit/corpus/dist/backend/memory.js
|
|
13369
|
-
var CORPUS_DEV = (() => {
|
|
13370
|
-
try {
|
|
13371
|
-
return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
|
|
13372
|
-
} catch {
|
|
13373
|
-
return false;
|
|
13374
|
-
}
|
|
13375
|
-
})();
|
|
13376
|
-
// ../../node_modules/@f0rbit/corpus/dist/schema.js
|
|
13377
|
-
var corpus_snapshots = sqliteTable("corpus_snapshots", {
|
|
13378
|
-
store_id: text("store_id").notNull(),
|
|
13379
|
-
version: text("version").notNull(),
|
|
13380
|
-
parents: text("parents").notNull(),
|
|
13381
|
-
created_at: text("created_at").notNull(),
|
|
13382
|
-
invoked_at: text("invoked_at"),
|
|
13383
|
-
content_hash: text("content_hash").notNull(),
|
|
13384
|
-
content_type: text("content_type").notNull(),
|
|
13385
|
-
size_bytes: integer("size_bytes").notNull(),
|
|
13386
|
-
data_key: text("data_key").notNull(),
|
|
13387
|
-
tags: text("tags")
|
|
13388
|
-
}, (table) => ({
|
|
13389
|
-
pk: primaryKey({ columns: [table.store_id, table.version] }),
|
|
13390
|
-
created_idx: index("idx_store_created").on(table.store_id, table.created_at),
|
|
13391
|
-
hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
|
|
13392
|
-
data_key_idx: index("idx_data_key").on(table.data_key)
|
|
13393
|
-
}));
|
|
13394
|
-
// ../../node_modules/@f0rbit/corpus/dist/version-set.js
|
|
13395
|
-
var VersionSetManifestSchema = objectType({
|
|
13396
|
-
package: stringType(),
|
|
13397
|
-
git_sha: stringType().length(40),
|
|
13398
|
-
created_at: stringType().datetime(),
|
|
13399
|
-
builds: objectType({
|
|
13400
|
-
worker: objectType({
|
|
13401
|
-
artifact_ref: stringType(),
|
|
13402
|
-
size_bytes: numberType().int(),
|
|
13403
|
-
compatibility_date: stringType()
|
|
13404
|
-
}),
|
|
13405
|
-
assets: objectType({
|
|
13406
|
-
artifact_ref: stringType().optional(),
|
|
13407
|
-
version_affinity: enumType(["pinned", "none"]).default("pinned")
|
|
13408
|
-
}).optional()
|
|
13409
|
-
}),
|
|
13410
|
-
migrations: objectType({
|
|
13411
|
-
d1_plan_ref: stringType().optional(),
|
|
13412
|
-
do_migrations: arrayType(objectType({
|
|
13413
|
-
class_name: stringType(),
|
|
13414
|
-
tag: stringType(),
|
|
13415
|
-
kind: enumType([
|
|
13416
|
-
"new_sqlite_classes",
|
|
13417
|
-
"new_classes",
|
|
13418
|
-
"renamed_classes",
|
|
13419
|
-
"deleted_classes",
|
|
13420
|
-
"transferred_classes"
|
|
13421
|
-
])
|
|
13422
|
-
})).default([])
|
|
13423
|
-
}),
|
|
13424
|
-
env_manifest_ref: stringType(),
|
|
13425
|
-
infra_plan_ref: stringType(),
|
|
13426
|
-
grants_ref: stringType().optional(),
|
|
13427
|
-
template_ref: stringType().optional()
|
|
13428
|
-
});
|
|
13429
|
-
// ../api/dist/chunk-5L3AUVMM.js
|
|
13478
|
+
var scan_diff_results_stored = preprocessType(decode_legacy_json_string, scan_diff_results);
|
|
13479
|
+
var scan_parsed_tasks_stored = preprocessType(decode_legacy_json_string, scan_parsed_tasks);
|
|
13480
|
+
var scan_context = arrayType(stringType());
|
|
13481
|
+
var scan_context_stored = preprocessType(decode_legacy_json_string, scan_context.nullable());
|
|
13482
|
+
var apply_op_result = objectType({
|
|
13483
|
+
op: enumType(["create", "update", "reparent", "link", "unlink", "claim", "complete"]),
|
|
13484
|
+
id: stringType()
|
|
13485
|
+
});
|
|
13486
|
+
var apply_log_response = objectType({ idempotency_key: stringType(), results: arrayType(apply_op_result) });
|
|
13487
|
+
var stage_event_payload = recordType(stringType(), unknownType());
|
|
13488
|
+
var analysis_query_dsl = unknownType();
|
|
13489
|
+
var analysis_threshold_dsl = stringType();
|
|
13490
|
+
var script_name_overrides = recordType(stringType(), stringType());
|
|
13491
|
+
|
|
13492
|
+
// ../api/dist/chunk-V6CM3V4I.js
|
|
13430
13493
|
var PostContentSchema = objectType({
|
|
13431
13494
|
title: stringType().min(1),
|
|
13432
13495
|
content: stringType(),
|
|
@@ -13614,6 +13677,149 @@ var IntegrationUpsertSchema = objectType({
|
|
|
13614
13677
|
});
|
|
13615
13678
|
|
|
13616
13679
|
// ../api/dist/index.js
|
|
13680
|
+
var wire_error = objectType({
|
|
13681
|
+
ok: literalType(false),
|
|
13682
|
+
error: objectType({
|
|
13683
|
+
code: stringType().min(1),
|
|
13684
|
+
message: stringType().optional()
|
|
13685
|
+
}).passthrough()
|
|
13686
|
+
});
|
|
13687
|
+
var external_event_payload = objectType({ sha: stringType().min(1) }).passthrough();
|
|
13688
|
+
var external_event_request = objectType({
|
|
13689
|
+
...webhook_event_body.shape,
|
|
13690
|
+
payload: external_event_payload
|
|
13691
|
+
});
|
|
13692
|
+
var noop_tick = stringType().regex(/^noop:[a-z_]+$/);
|
|
13693
|
+
var failed_tick = stringType().regex(/^failed:.+/);
|
|
13694
|
+
var ingest_tick = unionType([
|
|
13695
|
+
literalType("applied"),
|
|
13696
|
+
noop_tick,
|
|
13697
|
+
failed_tick,
|
|
13698
|
+
literalType("skipped:informational"),
|
|
13699
|
+
literalType("skipped:duplicated")
|
|
13700
|
+
]);
|
|
13701
|
+
var external_event_response = objectType({
|
|
13702
|
+
ok: literalType(true),
|
|
13703
|
+
value: objectType({
|
|
13704
|
+
event_id: stringType().min(1),
|
|
13705
|
+
duplicated: booleanType(),
|
|
13706
|
+
tick: ingest_tick
|
|
13707
|
+
})
|
|
13708
|
+
});
|
|
13709
|
+
var auth_channel_wire = unionType([literalType("user"), literalType("api")]);
|
|
13710
|
+
var wire_entity = {
|
|
13711
|
+
id: stringType().min(1),
|
|
13712
|
+
created_at: stringType(),
|
|
13713
|
+
updated_at: stringType(),
|
|
13714
|
+
deleted: booleanType(),
|
|
13715
|
+
created_by: auth_channel_wire,
|
|
13716
|
+
modified_by: auth_channel_wire,
|
|
13717
|
+
protected: booleanType()
|
|
13718
|
+
};
|
|
13719
|
+
var pipeline_run_wire = objectType({
|
|
13720
|
+
...wire_entity,
|
|
13721
|
+
package_id: stringType().min(1),
|
|
13722
|
+
version_set_id: stringType().nullable(),
|
|
13723
|
+
commit_sha: stringType().nullable(),
|
|
13724
|
+
shape: rollout_shape,
|
|
13725
|
+
kind: run_kind,
|
|
13726
|
+
status: run_status,
|
|
13727
|
+
current_stage: stringType().nullable(),
|
|
13728
|
+
resolved_rollout,
|
|
13729
|
+
resolved_gates,
|
|
13730
|
+
forced_atomic_reason: forced_atomic_reason.nullable(),
|
|
13731
|
+
started_at: stringType().nullable(),
|
|
13732
|
+
finished_at: stringType().nullable(),
|
|
13733
|
+
error: stringType().nullable()
|
|
13734
|
+
});
|
|
13735
|
+
var pipeline_stage_event_wire = objectType({
|
|
13736
|
+
id: stringType().min(1),
|
|
13737
|
+
run_id: stringType().min(1),
|
|
13738
|
+
stage_name: stringType(),
|
|
13739
|
+
kind: stage_event_kind,
|
|
13740
|
+
payload: stage_event_payload.nullable(),
|
|
13741
|
+
ts: stringType(),
|
|
13742
|
+
idempotency_hash: stringType().nullable()
|
|
13743
|
+
});
|
|
13744
|
+
var pipeline_grant_wire = objectType({
|
|
13745
|
+
...wire_entity,
|
|
13746
|
+
package_id: stringType().min(1),
|
|
13747
|
+
stage_name: stringType(),
|
|
13748
|
+
scope: stringType(),
|
|
13749
|
+
granted_by: stringType().nullable(),
|
|
13750
|
+
granted_at: stringType().nullable(),
|
|
13751
|
+
auto_approved: booleanType()
|
|
13752
|
+
});
|
|
13753
|
+
var pipeline_package_wire = objectType({
|
|
13754
|
+
...wire_entity,
|
|
13755
|
+
owner_id: stringType().min(1),
|
|
13756
|
+
name: stringType(),
|
|
13757
|
+
repo_url: stringType().nullable(),
|
|
13758
|
+
default_template_ref: stringType().nullable(),
|
|
13759
|
+
script_name_overrides: script_name_overrides.nullable(),
|
|
13760
|
+
project_id: stringType().nullable(),
|
|
13761
|
+
deploy_mode,
|
|
13762
|
+
external_target: external_target.nullable()
|
|
13763
|
+
});
|
|
13764
|
+
var pipeline_run_list_wire = arrayType(pipeline_run_wire);
|
|
13765
|
+
var pipeline_stage_event_list_wire = arrayType(pipeline_stage_event_wire);
|
|
13766
|
+
var pipeline_grant_list_wire = arrayType(pipeline_grant_wire);
|
|
13767
|
+
var pipeline_package_list_wire = arrayType(pipeline_package_wire);
|
|
13768
|
+
var pipeline_dispatch_entry_wire = objectType({
|
|
13769
|
+
stage_name: stringType(),
|
|
13770
|
+
commit_sha: stringType(),
|
|
13771
|
+
status: dispatch_status,
|
|
13772
|
+
error: stringType().nullable(),
|
|
13773
|
+
requested_by: stringType().nullable(),
|
|
13774
|
+
created_at: stringType(),
|
|
13775
|
+
updated_at: stringType()
|
|
13776
|
+
});
|
|
13777
|
+
var pipeline_dispatch_ledger_wire = objectType({
|
|
13778
|
+
run_id: stringType().min(1),
|
|
13779
|
+
run_status,
|
|
13780
|
+
commit_sha: stringType().nullable(),
|
|
13781
|
+
dispatches: arrayType(pipeline_dispatch_entry_wire)
|
|
13782
|
+
});
|
|
13783
|
+
var pipeline_ingest_response_wire = objectType({
|
|
13784
|
+
event_id: stringType().min(1),
|
|
13785
|
+
duplicated: booleanType(),
|
|
13786
|
+
tick: ingest_tick
|
|
13787
|
+
});
|
|
13788
|
+
var pipeline_run_start_wire = objectType({
|
|
13789
|
+
run_id: stringType().min(1),
|
|
13790
|
+
status: run_status
|
|
13791
|
+
});
|
|
13792
|
+
var pipelines_deleted_wire = objectType({ deleted: literalType(true) });
|
|
13793
|
+
var pipelines_deny_wire = objectType({ success: literalType(true) });
|
|
13794
|
+
var pipeline_analysis_template_wire = objectType({
|
|
13795
|
+
...wire_entity,
|
|
13796
|
+
owner_id: stringType().min(1),
|
|
13797
|
+
name: stringType(),
|
|
13798
|
+
query_dsl: unknownType(),
|
|
13799
|
+
threshold_dsl: stringType(),
|
|
13800
|
+
window_ms: numberType().int().positive()
|
|
13801
|
+
}).transform((template) => ({ ...template, query_dsl: template.query_dsl }));
|
|
13802
|
+
var pipeline_oidc_trust_wire = objectType({
|
|
13803
|
+
...wire_entity,
|
|
13804
|
+
owner_id: stringType().min(1),
|
|
13805
|
+
provider: literalType("github"),
|
|
13806
|
+
github_owner: stringType(),
|
|
13807
|
+
repo_pattern: stringType(),
|
|
13808
|
+
allowed_refs: arrayType(stringType()),
|
|
13809
|
+
allowed_environments: arrayType(stringType()),
|
|
13810
|
+
expected_audience: stringType(),
|
|
13811
|
+
allowed_actions: arrayType(stringType()),
|
|
13812
|
+
session_ttl_seconds: numberType().int().positive(),
|
|
13813
|
+
last_used_at: stringType().nullable(),
|
|
13814
|
+
repository_id: stringType().nullable(),
|
|
13815
|
+
repository_owner_id: stringType().nullable()
|
|
13816
|
+
});
|
|
13817
|
+
var pipelines_dashboard_wire = objectType({
|
|
13818
|
+
...dashboard_response.shape,
|
|
13819
|
+
pulse: recordType(unknownType()).nullable().catch(null)
|
|
13820
|
+
});
|
|
13821
|
+
var pipeline_analysis_template_list_wire = arrayType(pipeline_analysis_template_wire);
|
|
13822
|
+
var pipeline_oidc_trust_list_wire = arrayType(pipeline_oidc_trust_wire);
|
|
13617
13823
|
var PulseEventRowSchema = objectType({
|
|
13618
13824
|
id: numberType(),
|
|
13619
13825
|
project_id: stringType(),
|
|
@@ -13673,6 +13879,8 @@ var PulseLatencyResultSchema = objectType({
|
|
|
13673
13879
|
by_minute: arrayType(PulseLatencyByMinuteSchema)
|
|
13674
13880
|
});
|
|
13675
13881
|
var ApiError = class _ApiError extends Error {
|
|
13882
|
+
code;
|
|
13883
|
+
statusCode;
|
|
13676
13884
|
constructor(message, options = {}) {
|
|
13677
13885
|
super(message);
|
|
13678
13886
|
this.name = "ApiError";
|
|
@@ -13700,6 +13908,19 @@ var ValidationError = class extends ApiError {
|
|
|
13700
13908
|
super(message, { code: "VALIDATION_ERROR" });
|
|
13701
13909
|
}
|
|
13702
13910
|
};
|
|
13911
|
+
var zod_issue = custom((value) => typeof value === "object" && value !== null && ("path" in value) && Array.isArray(value.path));
|
|
13912
|
+
var parsed_error_body = objectType({
|
|
13913
|
+
error: unionType([stringType(), objectType({ name: stringType().optional(), issues: arrayType(zod_issue).optional() })]).optional(),
|
|
13914
|
+
issues: arrayType(zod_issue).optional()
|
|
13915
|
+
});
|
|
13916
|
+
var parse_error_body = (raw) => {
|
|
13917
|
+
const parsed = parsed_error_body.safeParse(raw);
|
|
13918
|
+
return parsed.success ? parsed.data : null;
|
|
13919
|
+
};
|
|
13920
|
+
var parse_json_error_body = (text2) => {
|
|
13921
|
+
const raw = try_catch(() => JSON.parse(text2), (e) => e);
|
|
13922
|
+
return raw.ok ? parse_error_body(raw.value) : null;
|
|
13923
|
+
};
|
|
13703
13924
|
var HTTP_STATUS = {
|
|
13704
13925
|
OK: 200,
|
|
13705
13926
|
CREATED: 201,
|
|
@@ -13723,11 +13944,7 @@ function handleHttpResponse(response) {
|
|
|
13723
13944
|
async function handleResponseError(response) {
|
|
13724
13945
|
const errorText = await response.text();
|
|
13725
13946
|
const errorMessage = errorText || "Request failed";
|
|
13726
|
-
|
|
13727
|
-
try {
|
|
13728
|
-
const raw = JSON.parse(errorText);
|
|
13729
|
-
parsedError = raw;
|
|
13730
|
-
} catch {}
|
|
13947
|
+
const parsedError = parse_json_error_body(errorText);
|
|
13731
13948
|
const structuredError = typeof parsedError?.error === "object" ? parsedError.error : undefined;
|
|
13732
13949
|
if (response.status === HTTP_STATUS.BAD_REQUEST && structuredError?.name === "ZodError") {
|
|
13733
13950
|
const zodErrorDetails = structuredError.issues ? JSON.stringify(structuredError) : errorMessage;
|
|
@@ -13743,11 +13960,12 @@ function handleNetworkError(error) {
|
|
|
13743
13960
|
var ArrayBufferedQueue = class {
|
|
13744
13961
|
constructor(capacity) {
|
|
13745
13962
|
this.capacity = capacity;
|
|
13746
|
-
this.entries = [];
|
|
13747
|
-
this.head = 0;
|
|
13748
|
-
this.tail = 0;
|
|
13749
|
-
this.count = 0;
|
|
13750
13963
|
}
|
|
13964
|
+
capacity;
|
|
13965
|
+
entries = [];
|
|
13966
|
+
head = 0;
|
|
13967
|
+
tail = 0;
|
|
13968
|
+
count = 0;
|
|
13751
13969
|
latest() {
|
|
13752
13970
|
if (this.count === 0)
|
|
13753
13971
|
return null;
|
|
@@ -13781,8 +13999,16 @@ var ArrayBufferedQueue = class {
|
|
|
13781
13999
|
}
|
|
13782
14000
|
};
|
|
13783
14001
|
var ApiClient = class {
|
|
14002
|
+
base_url;
|
|
14003
|
+
api_key;
|
|
14004
|
+
request_history;
|
|
14005
|
+
category = "api";
|
|
14006
|
+
default_headers;
|
|
14007
|
+
custom_fetch;
|
|
14008
|
+
credentials;
|
|
14009
|
+
auth_mode;
|
|
14010
|
+
debug;
|
|
13784
14011
|
constructor(options) {
|
|
13785
|
-
this.category = "api";
|
|
13786
14012
|
this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
|
|
13787
14013
|
if (this.auth_mode !== "cookie") {
|
|
13788
14014
|
if (!options.api_key)
|
|
@@ -13812,6 +14038,22 @@ var ApiClient = class {
|
|
|
13812
14038
|
generateRequestId() {
|
|
13813
14039
|
return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
|
|
13814
14040
|
}
|
|
14041
|
+
async read_body(response) {
|
|
14042
|
+
if (response.status === HTTP_STATUS.NO_CONTENT)
|
|
14043
|
+
return;
|
|
14044
|
+
const text2 = await response.text();
|
|
14045
|
+
if (!text2 || text2.trim() === "" || text2.trim() === "null")
|
|
14046
|
+
return;
|
|
14047
|
+
const parsed = try_catch(() => JSON.parse(text2), (error) => error);
|
|
14048
|
+
if (parsed.ok)
|
|
14049
|
+
return parsed.value;
|
|
14050
|
+
if (this.debug) {
|
|
14051
|
+
console.log(`[DEBUG][${this.category}] response body is not JSON, returning raw text`, {
|
|
14052
|
+
error: parsed.error instanceof Error ? parsed.error.message : String(parsed.error)
|
|
14053
|
+
});
|
|
14054
|
+
}
|
|
14055
|
+
return text2;
|
|
14056
|
+
}
|
|
13815
14057
|
async request(path, options = {}) {
|
|
13816
14058
|
const { method = "GET", headers = {}, body, query } = options;
|
|
13817
14059
|
const url = this.buildUrl(path, query);
|
|
@@ -13852,760 +14094,123 @@ var ApiClient = class {
|
|
|
13852
14094
|
} else if (this.auth_mode === "cookie") {
|
|
13853
14095
|
fetchOptions.credentials = "include";
|
|
13854
14096
|
}
|
|
13855
|
-
const fetcher = this.custom_fetch ?? fetch;
|
|
13856
|
-
const response = await fetcher(url, fetchOptions);
|
|
13857
|
-
const duration = Date.now() - startTime;
|
|
13858
|
-
historyEntry.status = response.status;
|
|
13859
|
-
historyEntry.duration = duration;
|
|
13860
|
-
if (!response.ok) {
|
|
13861
|
-
if (this.debug) {
|
|
13862
|
-
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
13863
|
-
status: response.status,
|
|
13864
|
-
duration: `${String(duration)}ms`,
|
|
13865
|
-
body,
|
|
13866
|
-
query
|
|
13867
|
-
});
|
|
13868
|
-
}
|
|
13869
|
-
try {
|
|
13870
|
-
handleHttpResponse(response);
|
|
13871
|
-
await handleResponseError(response);
|
|
13872
|
-
} catch (error) {
|
|
13873
|
-
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
13874
|
-
historyEntry.error = errorMessage;
|
|
13875
|
-
this.request_history.add(historyEntry);
|
|
13876
|
-
throw error;
|
|
13877
|
-
}
|
|
13878
|
-
}
|
|
13879
|
-
this.request_history.add(historyEntry);
|
|
13880
|
-
let result;
|
|
13881
|
-
if (response.status === HTTP_STATUS.NO_CONTENT) {
|
|
13882
|
-
result = undefined;
|
|
13883
|
-
} else {
|
|
13884
|
-
const text2 = await response.text();
|
|
13885
|
-
if (!text2 || text2.trim() === "" || text2.trim() === "null") {
|
|
13886
|
-
result = undefined;
|
|
13887
|
-
} else {
|
|
13888
|
-
try {
|
|
13889
|
-
const raw = JSON.parse(text2);
|
|
13890
|
-
result = raw;
|
|
13891
|
-
} catch {
|
|
13892
|
-
result = text2;
|
|
13893
|
-
}
|
|
13894
|
-
}
|
|
13895
|
-
}
|
|
13896
|
-
if (this.debug) {
|
|
13897
|
-
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
13898
|
-
status: response.status,
|
|
13899
|
-
duration: `${String(duration)}ms`
|
|
13900
|
-
});
|
|
13901
|
-
}
|
|
13902
|
-
return result;
|
|
13903
|
-
} catch (error) {
|
|
13904
|
-
const duration = Date.now() - startTime;
|
|
13905
|
-
if (this.debug) {
|
|
13906
|
-
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
13907
|
-
url,
|
|
13908
|
-
duration: `${String(duration)}ms`,
|
|
13909
|
-
error: error instanceof Error ? error.message : String(error),
|
|
13910
|
-
body,
|
|
13911
|
-
query
|
|
13912
|
-
});
|
|
13913
|
-
}
|
|
13914
|
-
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
13915
|
-
throw error;
|
|
13916
|
-
}
|
|
13917
|
-
historyEntry.duration = duration;
|
|
13918
|
-
try {
|
|
13919
|
-
handleNetworkError(error);
|
|
13920
|
-
} catch (networkError) {
|
|
13921
|
-
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
13922
|
-
historyEntry.error = errorMessage;
|
|
13923
|
-
this.request_history.add(historyEntry);
|
|
13924
|
-
throw networkError;
|
|
13925
|
-
}
|
|
13926
|
-
}
|
|
13927
|
-
}
|
|
13928
|
-
get(path, options = {}) {
|
|
13929
|
-
return this.request(path, { ...options, method: "GET" });
|
|
13930
|
-
}
|
|
13931
|
-
post(path, options = {}) {
|
|
13932
|
-
return this.request(path, { ...options, method: "POST" });
|
|
13933
|
-
}
|
|
13934
|
-
patch(path, options = {}) {
|
|
13935
|
-
return this.request(path, { ...options, method: "PATCH" });
|
|
13936
|
-
}
|
|
13937
|
-
put(path, options = {}) {
|
|
13938
|
-
return this.request(path, { ...options, method: "PUT" });
|
|
13939
|
-
}
|
|
13940
|
-
delete(path, options = {}) {
|
|
13941
|
-
return this.request(path, { ...options, method: "DELETE" });
|
|
13942
|
-
}
|
|
13943
|
-
history() {
|
|
13944
|
-
return this.request_history;
|
|
13945
|
-
}
|
|
13946
|
-
url() {
|
|
13947
|
-
return this.base_url;
|
|
13948
|
-
}
|
|
13949
|
-
headers() {
|
|
13950
|
-
const headers = {
|
|
13951
|
-
"Content-Type": "application/json"
|
|
13952
|
-
};
|
|
13953
|
-
if (this.auth_mode === "session") {
|
|
13954
|
-
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
13955
|
-
} else if (this.auth_mode === "key") {
|
|
13956
|
-
headers["X-API-KEY"] = this.api_key;
|
|
13957
|
-
}
|
|
13958
|
-
return headers;
|
|
13959
|
-
}
|
|
13960
|
-
};
|
|
13961
|
-
var string_field = (value, key) => {
|
|
13962
|
-
if (typeof value !== "object" || value === null || !(key in value))
|
|
13963
|
-
return;
|
|
13964
|
-
const field = value[key];
|
|
13965
|
-
return typeof field === "string" ? field : undefined;
|
|
13966
|
-
};
|
|
13967
|
-
var number_field = (value, key) => {
|
|
13968
|
-
if (typeof value !== "object" || value === null || !(key in value))
|
|
13969
|
-
return;
|
|
13970
|
-
const field = value[key];
|
|
13971
|
-
return typeof field === "number" ? field : undefined;
|
|
13972
|
-
};
|
|
13973
|
-
function wrap(fn) {
|
|
13974
|
-
return fn().then((data) => ok(data)).catch((error) => err({
|
|
13975
|
-
message: error instanceof Error ? error.message : "Unknown error",
|
|
13976
|
-
code: string_field(error, "code"),
|
|
13977
|
-
status_code: number_field(error, "statusCode") ?? number_field(error, "status_code")
|
|
13978
|
-
}));
|
|
13979
|
-
}
|
|
13980
|
-
var ApiClient2 = class {
|
|
13981
|
-
constructor(options) {
|
|
13982
|
-
this.auth = {
|
|
13983
|
-
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
13984
|
-
keys: {
|
|
13985
|
-
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
13986
|
-
create: (input) => {
|
|
13987
|
-
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
13988
|
-
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
13989
|
-
},
|
|
13990
|
-
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
13991
|
-
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
13992
|
-
}
|
|
13993
|
-
};
|
|
13994
|
-
this.projects = {
|
|
13995
|
-
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
13996
|
-
map: async (filters) => wrap(async () => {
|
|
13997
|
-
const result = await this.projects.list(filters);
|
|
13998
|
-
if (!result.ok)
|
|
13999
|
-
throw new Error(result.error.message);
|
|
14000
|
-
return result.value.reduce((acc, project) => {
|
|
14001
|
-
acc[project.id] = project;
|
|
14002
|
-
return acc;
|
|
14003
|
-
}, {});
|
|
14004
|
-
}),
|
|
14005
|
-
find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
14006
|
-
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
14007
|
-
getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
14008
|
-
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
14009
|
-
update: async (idOrData, changes) => wrap(async () => {
|
|
14010
|
-
if (typeof idOrData === "object" && idOrData.id) {
|
|
14011
|
-
return this.clients.projects.patch("/projects", {
|
|
14012
|
-
body: idOrData
|
|
14013
|
-
});
|
|
14014
|
-
}
|
|
14015
|
-
const id = idOrData;
|
|
14016
|
-
if (!changes) {
|
|
14017
|
-
throw new Error("Changes parameter required for update");
|
|
14018
|
-
}
|
|
14019
|
-
const result = await this.projects.find(id);
|
|
14020
|
-
if (!result.ok)
|
|
14021
|
-
throw new Error(result.error.message);
|
|
14022
|
-
if (!result.value)
|
|
14023
|
-
throw new Error(`Project with id ${id} not found`);
|
|
14024
|
-
const project = result.value;
|
|
14025
|
-
const updateData = {
|
|
14026
|
-
id: project.id,
|
|
14027
|
-
project_id: project.project_id,
|
|
14028
|
-
owner_id: project.owner_id,
|
|
14029
|
-
name: project.name,
|
|
14030
|
-
description: project.description,
|
|
14031
|
-
specification: project.specification,
|
|
14032
|
-
repo_url: project.repo_url,
|
|
14033
|
-
repo_id: project.repo_id,
|
|
14034
|
-
icon_url: project.icon_url,
|
|
14035
|
-
status: project.status,
|
|
14036
|
-
deleted: project.deleted,
|
|
14037
|
-
link_url: project.link_url,
|
|
14038
|
-
link_text: project.link_text,
|
|
14039
|
-
visibility: project.visibility,
|
|
14040
|
-
current_version: project.current_version,
|
|
14041
|
-
...changes
|
|
14042
|
-
};
|
|
14043
|
-
return this.clients.projects.patch("/projects", {
|
|
14044
|
-
body: updateData
|
|
14045
|
-
});
|
|
14046
|
-
}),
|
|
14047
|
-
config: {
|
|
14048
|
-
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
14049
|
-
query: { project_id }
|
|
14050
|
-
})),
|
|
14051
|
-
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
14052
|
-
body: request
|
|
14053
|
-
}))
|
|
14054
|
-
},
|
|
14055
|
-
scan: {
|
|
14056
|
-
initiate: async (project_id) => {
|
|
14057
|
-
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
14058
|
-
method: "POST",
|
|
14059
|
-
headers: this.clients.projects.headers()
|
|
14060
|
-
});
|
|
14061
|
-
if (!response.body) {
|
|
14062
|
-
throw new Error("No response body");
|
|
14063
|
-
}
|
|
14064
|
-
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
14065
|
-
return stream;
|
|
14066
|
-
},
|
|
14067
|
-
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
14068
|
-
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
14069
|
-
query: { project_id },
|
|
14070
|
-
body: data
|
|
14071
|
-
}))
|
|
14072
|
-
},
|
|
14073
|
-
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
14074
|
-
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
14075
|
-
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
14076
|
-
query: { project_id }
|
|
14077
|
-
})),
|
|
14078
|
-
deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
|
|
14079
|
-
body: { ...project, deleted: true }
|
|
14080
|
-
})),
|
|
14081
|
-
graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
14082
|
-
getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
14083
|
-
putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
14084
|
-
};
|
|
14085
|
-
this.milestones = {
|
|
14086
|
-
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
14087
|
-
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
14088
|
-
lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
14089
|
-
query: depth ? { depth: String(depth) } : {}
|
|
14090
|
-
})),
|
|
14091
|
-
find: (id) => wrap(async () => {
|
|
14092
|
-
try {
|
|
14093
|
-
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
14094
|
-
} catch {
|
|
14095
|
-
return null;
|
|
14096
|
-
}
|
|
14097
|
-
}),
|
|
14098
|
-
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
14099
|
-
update: async (id, data) => wrap(async () => {
|
|
14100
|
-
const result = await this.milestones.find(id);
|
|
14101
|
-
if (!result.ok)
|
|
14102
|
-
throw new Error(result.error.message);
|
|
14103
|
-
if (!result.value)
|
|
14104
|
-
throw new Error(`Milestone with id ${id} not found`);
|
|
14105
|
-
const milestone = result.value;
|
|
14106
|
-
const updateData = {
|
|
14107
|
-
id: milestone.id,
|
|
14108
|
-
project_id: milestone.project_id,
|
|
14109
|
-
name: data.name ?? milestone.name,
|
|
14110
|
-
description: data.description ?? milestone.description,
|
|
14111
|
-
target_time: data.target_time ?? milestone.target_time,
|
|
14112
|
-
target_version: data.target_version ?? milestone.target_version,
|
|
14113
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
14114
|
-
};
|
|
14115
|
-
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
14116
|
-
body: updateData
|
|
14117
|
-
});
|
|
14118
|
-
}),
|
|
14119
|
-
delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
14120
|
-
goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
14121
|
-
};
|
|
14122
|
-
this.hooks = {
|
|
14123
|
-
list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
14124
|
-
upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
14125
|
-
delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
14126
|
-
setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
14127
|
-
deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
14128
|
-
};
|
|
14129
|
-
this.goals = {
|
|
14130
|
-
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
14131
|
-
find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
|
|
14132
|
-
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
14133
|
-
update: async (id, data) => wrap(async () => {
|
|
14134
|
-
const result = await this.goals.find(id);
|
|
14135
|
-
if (!result.ok)
|
|
14136
|
-
throw new Error(result.error.message);
|
|
14137
|
-
if (!result.value)
|
|
14138
|
-
throw new Error(`Goal with id ${id} not found`);
|
|
14139
|
-
const goal = result.value;
|
|
14140
|
-
const updateData = {
|
|
14141
|
-
id: goal.id,
|
|
14142
|
-
milestone_id: goal.milestone_id,
|
|
14143
|
-
name: data.name ?? goal.name,
|
|
14144
|
-
description: data.description ?? goal.description,
|
|
14145
|
-
target_time: data.target_time ?? goal.target_time,
|
|
14146
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
14147
|
-
};
|
|
14148
|
-
return this.clients.goals.patch(`/goals/${id}`, {
|
|
14149
|
-
body: updateData
|
|
14150
|
-
});
|
|
14151
|
-
}),
|
|
14152
|
-
delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
|
|
14153
|
-
};
|
|
14154
|
-
this.tasks = {
|
|
14155
|
-
list: (filters) => wrap(() => {
|
|
14156
|
-
const query = {};
|
|
14157
|
-
if (filters?.project_id)
|
|
14158
|
-
query.project = filters.project_id;
|
|
14159
|
-
if (filters?.tag_id)
|
|
14160
|
-
query.tag = filters.tag_id;
|
|
14161
|
-
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
14162
|
-
}),
|
|
14163
|
-
find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
14164
|
-
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
14165
|
-
query: { project: project_id }
|
|
14166
|
-
})),
|
|
14167
|
-
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
14168
|
-
update: async (id, changes) => wrap(async () => {
|
|
14169
|
-
const result = await this.tasks.find(id);
|
|
14170
|
-
if (!result.ok)
|
|
14171
|
-
throw new Error(result.error.message);
|
|
14172
|
-
if (!result.value)
|
|
14173
|
-
throw new Error(`Task with id ${id} not found`);
|
|
14174
|
-
const task = result.value;
|
|
14175
|
-
const updateData = {
|
|
14176
|
-
id,
|
|
14177
|
-
title: task.task.title,
|
|
14178
|
-
summary: task.task.summary,
|
|
14179
|
-
description: task.task.description,
|
|
14180
|
-
progress: task.task.progress,
|
|
14181
|
-
visibility: task.task.visibility,
|
|
14182
|
-
start_time: task.task.start_time,
|
|
14183
|
-
end_time: task.task.end_time,
|
|
14184
|
-
priority: task.task.priority,
|
|
14185
|
-
owner_id: task.task.owner_id,
|
|
14186
|
-
project_id: task.task.project_id,
|
|
14187
|
-
...changes
|
|
14188
|
-
};
|
|
14189
|
-
return this.clients.tasks.patch("/tasks", {
|
|
14190
|
-
body: updateData
|
|
14191
|
-
});
|
|
14192
|
-
}),
|
|
14193
|
-
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
14194
|
-
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
14195
|
-
deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
14196
|
-
body: { ...task.task, deleted: true }
|
|
14197
|
-
})),
|
|
14198
|
-
history: {
|
|
14199
|
-
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
14200
|
-
},
|
|
14201
|
-
ready: (filters) => wrap(() => {
|
|
14202
|
-
const query = {};
|
|
14203
|
-
if (filters?.project_id)
|
|
14204
|
-
query.project = filters.project_id;
|
|
14205
|
-
if (filters?.limit)
|
|
14206
|
-
query.limit = String(filters.limit);
|
|
14207
|
-
if (filters?.cursor)
|
|
14208
|
-
query.cursor = filters.cursor;
|
|
14209
|
-
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
14210
|
-
}),
|
|
14211
|
-
tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
14212
|
-
near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
14213
|
-
ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
14214
|
-
claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
14215
|
-
done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
14216
|
-
reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
14217
|
-
advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
14218
|
-
link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
14219
|
-
unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
14220
|
-
apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
14221
|
-
};
|
|
14222
|
-
this.tags = {
|
|
14223
|
-
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
14224
|
-
};
|
|
14225
|
-
this.docs = {
|
|
14226
|
-
list: (filters) => wrap(() => {
|
|
14227
|
-
const query = { project_id: filters.project_id };
|
|
14228
|
-
if (filters.task_id)
|
|
14229
|
-
query.task_id = filters.task_id;
|
|
14230
|
-
return this.clients.docs.get("/docs", { query });
|
|
14231
|
-
}),
|
|
14232
|
-
push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
|
|
14233
|
-
pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
14234
|
-
versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
14235
|
-
renderUrl: (id, version) => {
|
|
14236
|
-
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
14237
|
-
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
14238
|
-
},
|
|
14239
|
-
createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
14240
|
-
replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
14241
|
-
resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
14242
|
-
toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
14243
|
-
unresolved: (filters) => wrap(() => {
|
|
14244
|
-
const query = {};
|
|
14245
|
-
if (filters.project_id)
|
|
14246
|
-
query.project_id = filters.project_id;
|
|
14247
|
-
if (filters.document_id)
|
|
14248
|
-
query.document_id = filters.document_id;
|
|
14249
|
-
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
14250
|
-
}),
|
|
14251
|
-
pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
14252
|
-
interfaceStatus: (filters) => wrap(() => {
|
|
14253
|
-
const query = { project_id: filters.project_id, title: filters.title };
|
|
14254
|
-
if (filters.task_id)
|
|
14255
|
-
query.task_id = filters.task_id;
|
|
14256
|
-
return this.clients.docs.get("/docs/interface/status", { query });
|
|
14257
|
-
})
|
|
14258
|
-
};
|
|
14259
|
-
this.signoffs = {
|
|
14260
|
-
request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
14261
|
-
find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
14262
|
-
findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
14263
|
-
decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
14264
|
-
};
|
|
14265
|
-
this.reviews = {
|
|
14266
|
-
pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
|
|
14267
|
-
};
|
|
14268
|
-
this.github = {
|
|
14269
|
-
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
14270
|
-
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
14271
|
-
};
|
|
14272
|
-
this.blog = {
|
|
14273
|
-
posts: {
|
|
14274
|
-
list: (params) => wrap(() => {
|
|
14275
|
-
const query = {};
|
|
14276
|
-
if (params?.category)
|
|
14277
|
-
query.category = params.category;
|
|
14278
|
-
if (params?.tag)
|
|
14279
|
-
query.tag = params.tag;
|
|
14280
|
-
if (params?.project)
|
|
14281
|
-
query.project = params.project;
|
|
14282
|
-
if (params?.status)
|
|
14283
|
-
query.status = params.status;
|
|
14284
|
-
if (params?.archived !== undefined)
|
|
14285
|
-
query.archived = String(params.archived);
|
|
14286
|
-
if (params?.limit)
|
|
14287
|
-
query.limit = String(params.limit);
|
|
14288
|
-
if (params?.offset !== undefined)
|
|
14289
|
-
query.offset = String(params.offset);
|
|
14290
|
-
if (params?.sort)
|
|
14291
|
-
query.sort = params.sort;
|
|
14292
|
-
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
14293
|
-
}),
|
|
14294
|
-
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
14295
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
14296
|
-
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
14297
|
-
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
14298
|
-
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
14299
|
-
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
14300
|
-
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
14301
|
-
},
|
|
14302
|
-
tags: {
|
|
14303
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
14304
|
-
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
14305
|
-
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14306
|
-
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14307
|
-
removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
14308
|
-
},
|
|
14309
|
-
categories: {
|
|
14310
|
-
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
14311
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
14312
|
-
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
14313
|
-
body: data
|
|
14314
|
-
})),
|
|
14315
|
-
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
14316
|
-
},
|
|
14317
|
-
tokens: {
|
|
14318
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
14319
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
14320
|
-
update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
14321
|
-
body: data
|
|
14322
|
-
})),
|
|
14323
|
-
delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
14324
|
-
}
|
|
14325
|
-
};
|
|
14326
|
-
this.media = {
|
|
14327
|
-
profiles: {
|
|
14328
|
-
list: () => wrap(async () => {
|
|
14329
|
-
const res = await this.clients.media.get("/profiles");
|
|
14330
|
-
return res.profiles;
|
|
14331
|
-
}),
|
|
14332
|
-
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
14333
|
-
get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
|
|
14334
|
-
update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
14335
|
-
delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
14336
|
-
filters: {
|
|
14337
|
-
list: (profile_id) => wrap(async () => {
|
|
14338
|
-
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
14339
|
-
return res.filters;
|
|
14340
|
-
}),
|
|
14341
|
-
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
14342
|
-
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
14343
|
-
},
|
|
14344
|
-
timeline: (slug, params) => wrap(() => {
|
|
14345
|
-
const query = {};
|
|
14346
|
-
if (params?.limit)
|
|
14347
|
-
query.limit = String(params.limit);
|
|
14348
|
-
if (params?.before)
|
|
14349
|
-
query.before = params.before;
|
|
14350
|
-
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
14351
|
-
})
|
|
14352
|
-
},
|
|
14353
|
-
connections: {
|
|
14354
|
-
list: (profile_id, options) => wrap(async () => {
|
|
14355
|
-
const query = { profile_id };
|
|
14356
|
-
if (options?.include_settings)
|
|
14357
|
-
query.include_settings = "true";
|
|
14358
|
-
const res = await this.clients.media.get("/connections", { query });
|
|
14359
|
-
return res.accounts;
|
|
14360
|
-
}),
|
|
14361
|
-
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
14362
|
-
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
14363
|
-
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
14364
|
-
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
14365
|
-
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
14366
|
-
body: { is_active }
|
|
14367
|
-
})),
|
|
14368
|
-
settings: {
|
|
14369
|
-
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
14370
|
-
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
14371
|
-
body: { settings }
|
|
14372
|
-
}))
|
|
14373
|
-
},
|
|
14374
|
-
repos: (account_id) => wrap(async () => {
|
|
14375
|
-
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
14376
|
-
return res.repos;
|
|
14377
|
-
}),
|
|
14378
|
-
subreddits: (account_id) => wrap(async () => {
|
|
14379
|
-
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
14380
|
-
return res.subreddits;
|
|
14381
|
-
})
|
|
14382
|
-
},
|
|
14383
|
-
credentials: {
|
|
14384
|
-
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
14385
|
-
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
14386
|
-
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
14387
|
-
},
|
|
14388
|
-
timeline: {
|
|
14389
|
-
get: (user_id, params) => wrap(() => {
|
|
14390
|
-
const query = {};
|
|
14391
|
-
if (params?.from)
|
|
14392
|
-
query.from = params.from;
|
|
14393
|
-
if (params?.to)
|
|
14394
|
-
query.to = params.to;
|
|
14395
|
-
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
14396
|
-
}),
|
|
14397
|
-
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
14398
|
-
query: { account_id }
|
|
14399
|
-
}))
|
|
14400
|
-
}
|
|
14401
|
-
};
|
|
14402
|
-
this.activity = {
|
|
14403
|
-
ai: (options) => wrap(() => {
|
|
14404
|
-
const query = {};
|
|
14405
|
-
if (options?.limit)
|
|
14406
|
-
query.limit = String(options.limit);
|
|
14407
|
-
if (options?.since)
|
|
14408
|
-
query.since = options.since;
|
|
14409
|
-
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
14410
|
-
})
|
|
14411
|
-
};
|
|
14412
|
-
this.admin = {
|
|
14413
|
-
verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
|
|
14414
|
-
reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
14415
|
-
};
|
|
14416
|
-
this.user = {
|
|
14417
|
-
me: () => wrap(() => this.clients.auth.get("/user/me")),
|
|
14418
|
-
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
14419
|
-
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
|
|
14420
|
-
body: data
|
|
14421
|
-
}))
|
|
14422
|
-
};
|
|
14423
|
-
this.pulse = {
|
|
14424
|
-
summary: (input) => wrap(async () => {
|
|
14425
|
-
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
14426
|
-
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
14427
|
-
});
|
|
14428
|
-
return PulseSummarySchema.parse(raw);
|
|
14429
|
-
}),
|
|
14430
|
-
events: (input) => wrap(async () => {
|
|
14431
|
-
const query = {};
|
|
14432
|
-
if (input.name)
|
|
14433
|
-
query.name = input.name;
|
|
14434
|
-
if (input.level)
|
|
14435
|
-
query.level = input.level;
|
|
14436
|
-
if (typeof input.ts_from === "number")
|
|
14437
|
-
query.ts_from = String(input.ts_from);
|
|
14438
|
-
if (typeof input.ts_to === "number")
|
|
14439
|
-
query.ts_to = String(input.ts_to);
|
|
14440
|
-
if (input.search)
|
|
14441
|
-
query.search = input.search;
|
|
14442
|
-
if (input.limit)
|
|
14443
|
-
query.limit = String(input.limit);
|
|
14444
|
-
if (input.cursor)
|
|
14445
|
-
query.cursor = input.cursor;
|
|
14446
|
-
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
14447
|
-
query
|
|
14448
|
-
});
|
|
14449
|
-
return PulseEventsPageSchema.parse(raw);
|
|
14450
|
-
}),
|
|
14451
|
-
errors: (input) => wrap(async () => {
|
|
14452
|
-
const query = {};
|
|
14453
|
-
if (typeof input.range === "string") {
|
|
14454
|
-
query.range = input.range;
|
|
14455
|
-
} else {
|
|
14456
|
-
query.from = String(input.range.from);
|
|
14457
|
-
query.to = String(input.range.to);
|
|
14458
|
-
}
|
|
14459
|
-
if (input.group_by_fingerprint)
|
|
14460
|
-
query.group_by_fingerprint = "true";
|
|
14461
|
-
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
14462
|
-
query
|
|
14463
|
-
});
|
|
14464
|
-
return PulseErrorsResultSchema.parse(raw);
|
|
14465
|
-
}),
|
|
14466
|
-
logs: (input) => wrap(async () => {
|
|
14467
|
-
const query = {};
|
|
14468
|
-
if (typeof input.range === "string") {
|
|
14469
|
-
query.range = input.range;
|
|
14470
|
-
} else {
|
|
14471
|
-
query.from = String(input.range.from);
|
|
14472
|
-
query.to = String(input.range.to);
|
|
14097
|
+
const fetcher = this.custom_fetch ?? fetch;
|
|
14098
|
+
const response = await fetcher(url, fetchOptions);
|
|
14099
|
+
const duration = Date.now() - startTime;
|
|
14100
|
+
historyEntry.status = response.status;
|
|
14101
|
+
historyEntry.duration = duration;
|
|
14102
|
+
if (!response.ok) {
|
|
14103
|
+
if (this.debug) {
|
|
14104
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
14105
|
+
status: response.status,
|
|
14106
|
+
duration: `${String(duration)}ms`,
|
|
14107
|
+
body,
|
|
14108
|
+
query
|
|
14109
|
+
});
|
|
14473
14110
|
}
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
const query = {};
|
|
14483
|
-
if (typeof input.range === "string") {
|
|
14484
|
-
query.range = input.range;
|
|
14485
|
-
} else {
|
|
14486
|
-
query.from = String(input.range.from);
|
|
14487
|
-
query.to = String(input.range.to);
|
|
14111
|
+
try {
|
|
14112
|
+
handleHttpResponse(response);
|
|
14113
|
+
await handleResponseError(response);
|
|
14114
|
+
} catch (error) {
|
|
14115
|
+
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
14116
|
+
historyEntry.error = errorMessage;
|
|
14117
|
+
this.request_history.add(historyEntry);
|
|
14118
|
+
throw error;
|
|
14488
14119
|
}
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14120
|
+
}
|
|
14121
|
+
this.request_history.add(historyEntry);
|
|
14122
|
+
const result = await this.read_body(response);
|
|
14123
|
+
if (this.debug) {
|
|
14124
|
+
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
14125
|
+
status: response.status,
|
|
14126
|
+
duration: `${String(duration)}ms`
|
|
14127
|
+
});
|
|
14128
|
+
}
|
|
14129
|
+
return result;
|
|
14130
|
+
} catch (error) {
|
|
14131
|
+
const duration = Date.now() - startTime;
|
|
14132
|
+
if (this.debug) {
|
|
14133
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
14134
|
+
url,
|
|
14135
|
+
duration: `${String(duration)}ms`,
|
|
14136
|
+
error: error instanceof Error ? error.message : String(error),
|
|
14137
|
+
body,
|
|
14494
14138
|
query
|
|
14495
14139
|
});
|
|
14496
|
-
return PulseLatencyResultSchema.parse(raw);
|
|
14497
|
-
}),
|
|
14498
|
-
subs: {
|
|
14499
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
14500
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
14501
|
-
body: {
|
|
14502
|
-
project_id: input.project_id,
|
|
14503
|
-
name: input.name,
|
|
14504
|
-
filter: input.filter,
|
|
14505
|
-
channel: input.channel,
|
|
14506
|
-
cooldown_seconds: input.cooldown_seconds
|
|
14507
|
-
}
|
|
14508
|
-
})),
|
|
14509
|
-
get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
14510
|
-
update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
14511
|
-
delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
14512
|
-
},
|
|
14513
|
-
keys: {
|
|
14514
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
14515
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
14516
|
-
body: {
|
|
14517
|
-
project_id: input.project_id,
|
|
14518
|
-
name: input.name,
|
|
14519
|
-
rate_limit_per_min: input.rate_limit_per_min
|
|
14520
|
-
}
|
|
14521
|
-
})),
|
|
14522
|
-
delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
14523
|
-
query: { project_id: input.project_id }
|
|
14524
|
-
}))
|
|
14525
14140
|
}
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
const query = {};
|
|
14538
|
-
if (filter?.package_id !== undefined)
|
|
14539
|
-
query.package_id = filter.package_id;
|
|
14540
|
-
if (filter?.status !== undefined)
|
|
14541
|
-
query.status = filter.status;
|
|
14542
|
-
if (filter?.limit !== undefined)
|
|
14543
|
-
query.limit = String(filter.limit);
|
|
14544
|
-
return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14545
|
-
},
|
|
14546
|
-
get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
14547
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
|
|
14548
|
-
body: input
|
|
14549
|
-
})),
|
|
14550
|
-
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
14551
|
-
body: input
|
|
14552
|
-
})),
|
|
14553
|
-
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
14554
|
-
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
14555
|
-
redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
14556
|
-
dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
|
|
14557
|
-
events: {
|
|
14558
|
-
ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
14559
|
-
body: input
|
|
14560
|
-
})),
|
|
14561
|
-
list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
14562
|
-
},
|
|
14563
|
-
grants: {
|
|
14564
|
-
list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
|
|
14565
|
-
query: package_id ? { package_id } : {}
|
|
14566
|
-
})),
|
|
14567
|
-
approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
14568
|
-
body: {}
|
|
14569
|
-
})),
|
|
14570
|
-
deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
14571
|
-
body: reason !== undefined ? { reason } : {}
|
|
14572
|
-
}))
|
|
14573
|
-
},
|
|
14574
|
-
packages: {
|
|
14575
|
-
list: (filter) => {
|
|
14576
|
-
const query = {};
|
|
14577
|
-
if (filter?.project_id !== undefined)
|
|
14578
|
-
query.project_id = filter.project_id;
|
|
14579
|
-
return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
14580
|
-
},
|
|
14581
|
-
get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
14582
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
14583
|
-
update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
14584
|
-
delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
14585
|
-
},
|
|
14586
|
-
analysis_templates: {
|
|
14587
|
-
list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
|
|
14588
|
-
query: { owner_id: input.owner_id }
|
|
14589
|
-
})),
|
|
14590
|
-
get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
14591
|
-
query: { owner_id: input.owner_id }
|
|
14592
|
-
})),
|
|
14593
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
14594
|
-
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
|
|
14595
|
-
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
14596
|
-
query: { owner_id: input.owner_id }
|
|
14597
|
-
}))
|
|
14598
|
-
},
|
|
14599
|
-
oidc_trust: {
|
|
14600
|
-
list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
14601
|
-
get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
|
|
14602
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
14603
|
-
update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
|
|
14604
|
-
delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
14605
|
-
query: { owner_id: input.owner_id }
|
|
14606
|
-
}))
|
|
14141
|
+
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
14142
|
+
throw error;
|
|
14143
|
+
}
|
|
14144
|
+
historyEntry.duration = duration;
|
|
14145
|
+
try {
|
|
14146
|
+
handleNetworkError(error);
|
|
14147
|
+
} catch (networkError) {
|
|
14148
|
+
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
14149
|
+
historyEntry.error = errorMessage;
|
|
14150
|
+
this.request_history.add(historyEntry);
|
|
14151
|
+
throw networkError;
|
|
14607
14152
|
}
|
|
14153
|
+
}
|
|
14154
|
+
}
|
|
14155
|
+
get(path, options = {}) {
|
|
14156
|
+
return this.request(path, { ...options, method: "GET" });
|
|
14157
|
+
}
|
|
14158
|
+
post(path, options = {}) {
|
|
14159
|
+
return this.request(path, { ...options, method: "POST" });
|
|
14160
|
+
}
|
|
14161
|
+
patch(path, options = {}) {
|
|
14162
|
+
return this.request(path, { ...options, method: "PATCH" });
|
|
14163
|
+
}
|
|
14164
|
+
put(path, options = {}) {
|
|
14165
|
+
return this.request(path, { ...options, method: "PUT" });
|
|
14166
|
+
}
|
|
14167
|
+
delete(path, options = {}) {
|
|
14168
|
+
return this.request(path, { ...options, method: "DELETE" });
|
|
14169
|
+
}
|
|
14170
|
+
history() {
|
|
14171
|
+
return this.request_history;
|
|
14172
|
+
}
|
|
14173
|
+
url() {
|
|
14174
|
+
return this.base_url;
|
|
14175
|
+
}
|
|
14176
|
+
headers() {
|
|
14177
|
+
const headers = {
|
|
14178
|
+
"Content-Type": "application/json"
|
|
14608
14179
|
};
|
|
14180
|
+
if (this.auth_mode === "session") {
|
|
14181
|
+
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
14182
|
+
} else if (this.auth_mode === "key") {
|
|
14183
|
+
headers["X-API-KEY"] = this.api_key;
|
|
14184
|
+
}
|
|
14185
|
+
return headers;
|
|
14186
|
+
}
|
|
14187
|
+
};
|
|
14188
|
+
var field_of = (value, key) => {
|
|
14189
|
+
if (typeof value !== "object" || value === null)
|
|
14190
|
+
return;
|
|
14191
|
+
const field = Reflect.get(value, key);
|
|
14192
|
+
return field;
|
|
14193
|
+
};
|
|
14194
|
+
var string_field = (value, key) => {
|
|
14195
|
+
const field = field_of(value, key);
|
|
14196
|
+
return typeof field === "string" ? field : undefined;
|
|
14197
|
+
};
|
|
14198
|
+
var number_field = (value, key) => {
|
|
14199
|
+
const field = field_of(value, key);
|
|
14200
|
+
return typeof field === "number" ? field : undefined;
|
|
14201
|
+
};
|
|
14202
|
+
function wrap(fn) {
|
|
14203
|
+
return fn().then((data) => ok(data)).catch((error) => err({
|
|
14204
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
14205
|
+
code: string_field(error, "code"),
|
|
14206
|
+
status_code: number_field(error, "statusCode") ?? number_field(error, "status_code")
|
|
14207
|
+
}));
|
|
14208
|
+
}
|
|
14209
|
+
var ApiClient2 = class {
|
|
14210
|
+
clients;
|
|
14211
|
+
api_key_field;
|
|
14212
|
+
auth_mode_field;
|
|
14213
|
+
constructor(options) {
|
|
14609
14214
|
const base_url = options.base_url || "http://localhost:4321/api/v1";
|
|
14610
14215
|
this.api_key_field = options.api_key ?? "";
|
|
14611
14216
|
this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
|
|
@@ -14643,9 +14248,645 @@ var ApiClient2 = class {
|
|
|
14643
14248
|
admin: new ApiClient({ ...clientOptions, category: "admin" })
|
|
14644
14249
|
};
|
|
14645
14250
|
}
|
|
14251
|
+
auth = {
|
|
14252
|
+
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
14253
|
+
keys: {
|
|
14254
|
+
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
14255
|
+
create: (input) => {
|
|
14256
|
+
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
14257
|
+
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
14258
|
+
},
|
|
14259
|
+
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
14260
|
+
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
14261
|
+
}
|
|
14262
|
+
};
|
|
14263
|
+
projects = {
|
|
14264
|
+
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
14265
|
+
map: async (filters) => wrap(async () => {
|
|
14266
|
+
const result = await this.projects.list(filters);
|
|
14267
|
+
if (!result.ok)
|
|
14268
|
+
throw new Error(result.error.message);
|
|
14269
|
+
return result.value.reduce((acc, project) => {
|
|
14270
|
+
acc[project.id] = project;
|
|
14271
|
+
return acc;
|
|
14272
|
+
}, {});
|
|
14273
|
+
}),
|
|
14274
|
+
find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
14275
|
+
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
14276
|
+
getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
|
|
14277
|
+
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
14278
|
+
update: async (idOrData, changes) => wrap(async () => {
|
|
14279
|
+
if (typeof idOrData === "object" && idOrData.id) {
|
|
14280
|
+
return this.clients.projects.patch("/projects", {
|
|
14281
|
+
body: idOrData
|
|
14282
|
+
});
|
|
14283
|
+
}
|
|
14284
|
+
const id = typeof idOrData === "string" ? idOrData : idOrData.id ?? "";
|
|
14285
|
+
if (!changes) {
|
|
14286
|
+
throw new Error("Changes parameter required for update");
|
|
14287
|
+
}
|
|
14288
|
+
const result = await this.projects.find(id);
|
|
14289
|
+
if (!result.ok)
|
|
14290
|
+
throw new Error(result.error.message);
|
|
14291
|
+
if (!result.value)
|
|
14292
|
+
throw new Error(`Project with id ${id} not found`);
|
|
14293
|
+
const project = result.value;
|
|
14294
|
+
const updateData = {
|
|
14295
|
+
id: project.id,
|
|
14296
|
+
project_id: project.project_id,
|
|
14297
|
+
owner_id: project.owner_id,
|
|
14298
|
+
name: project.name,
|
|
14299
|
+
description: project.description,
|
|
14300
|
+
specification: project.specification,
|
|
14301
|
+
repo_url: project.repo_url,
|
|
14302
|
+
repo_id: project.repo_id,
|
|
14303
|
+
icon_url: project.icon_url,
|
|
14304
|
+
status: project.status,
|
|
14305
|
+
deleted: project.deleted,
|
|
14306
|
+
link_url: project.link_url,
|
|
14307
|
+
link_text: project.link_text,
|
|
14308
|
+
visibility: project.visibility,
|
|
14309
|
+
current_version: project.current_version,
|
|
14310
|
+
...changes
|
|
14311
|
+
};
|
|
14312
|
+
return this.clients.projects.patch("/projects", {
|
|
14313
|
+
body: updateData
|
|
14314
|
+
});
|
|
14315
|
+
}),
|
|
14316
|
+
config: {
|
|
14317
|
+
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
14318
|
+
query: { project_id }
|
|
14319
|
+
})),
|
|
14320
|
+
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
14321
|
+
body: request
|
|
14322
|
+
}))
|
|
14323
|
+
},
|
|
14324
|
+
scan: {
|
|
14325
|
+
initiate: async (project_id) => {
|
|
14326
|
+
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
14327
|
+
method: "POST",
|
|
14328
|
+
headers: this.clients.projects.headers()
|
|
14329
|
+
});
|
|
14330
|
+
if (!response.body) {
|
|
14331
|
+
throw new Error("No response body");
|
|
14332
|
+
}
|
|
14333
|
+
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
14334
|
+
return stream;
|
|
14335
|
+
},
|
|
14336
|
+
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
14337
|
+
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
14338
|
+
query: { project_id },
|
|
14339
|
+
body: data
|
|
14340
|
+
}))
|
|
14341
|
+
},
|
|
14342
|
+
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
14343
|
+
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
14344
|
+
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
14345
|
+
query: { project_id }
|
|
14346
|
+
})),
|
|
14347
|
+
deleteProject: (project) => wrap(() => this.clients.projects.patch("/projects", {
|
|
14348
|
+
body: { ...project, deleted: true }
|
|
14349
|
+
})),
|
|
14350
|
+
graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
|
|
14351
|
+
getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
|
|
14352
|
+
putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
|
|
14353
|
+
};
|
|
14354
|
+
milestones = {
|
|
14355
|
+
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
14356
|
+
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
14357
|
+
lens: (project_id, depth) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones/lens`, {
|
|
14358
|
+
query: depth ? { depth: String(depth) } : {}
|
|
14359
|
+
})),
|
|
14360
|
+
find: (id) => wrap(async () => {
|
|
14361
|
+
try {
|
|
14362
|
+
return await this.clients.milestones.get(`/milestones/${id}`);
|
|
14363
|
+
} catch (error) {
|
|
14364
|
+
if (error instanceof ApiError && error.statusCode === HTTP_STATUS.NOT_FOUND)
|
|
14365
|
+
return null;
|
|
14366
|
+
throw error;
|
|
14367
|
+
}
|
|
14368
|
+
}),
|
|
14369
|
+
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
14370
|
+
update: async (id, data) => wrap(async () => {
|
|
14371
|
+
const result = await this.milestones.find(id);
|
|
14372
|
+
if (!result.ok)
|
|
14373
|
+
throw new Error(result.error.message);
|
|
14374
|
+
if (!result.value)
|
|
14375
|
+
throw new Error(`Milestone with id ${id} not found`);
|
|
14376
|
+
const milestone = result.value;
|
|
14377
|
+
const updateData = {
|
|
14378
|
+
id: milestone.id,
|
|
14379
|
+
project_id: milestone.project_id,
|
|
14380
|
+
name: data.name ?? milestone.name,
|
|
14381
|
+
description: data.description ?? milestone.description,
|
|
14382
|
+
target_time: data.target_time ?? milestone.target_time,
|
|
14383
|
+
target_version: data.target_version ?? milestone.target_version,
|
|
14384
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : milestone.finished_at
|
|
14385
|
+
};
|
|
14386
|
+
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
14387
|
+
body: updateData
|
|
14388
|
+
});
|
|
14389
|
+
}),
|
|
14390
|
+
delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
|
|
14391
|
+
goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
14392
|
+
};
|
|
14393
|
+
hooks = {
|
|
14394
|
+
list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
14395
|
+
upsert: (data) => wrap(() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })),
|
|
14396
|
+
delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
14397
|
+
setEnabled: (id, enabled) => wrap(() => this.clients.hooks.patch(`/hooks/${id}/enabled`, { body: { enabled } })),
|
|
14398
|
+
deliveries: (id, status) => wrap(() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {}))
|
|
14399
|
+
};
|
|
14400
|
+
goals = {
|
|
14401
|
+
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
14402
|
+
find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
|
|
14403
|
+
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
14404
|
+
update: async (id, data) => wrap(async () => {
|
|
14405
|
+
const result = await this.goals.find(id);
|
|
14406
|
+
if (!result.ok)
|
|
14407
|
+
throw new Error(result.error.message);
|
|
14408
|
+
if (!result.value)
|
|
14409
|
+
throw new Error(`Goal with id ${id} not found`);
|
|
14410
|
+
const goal = result.value;
|
|
14411
|
+
const updateData = {
|
|
14412
|
+
id: goal.id,
|
|
14413
|
+
milestone_id: goal.milestone_id,
|
|
14414
|
+
name: data.name ?? goal.name,
|
|
14415
|
+
description: data.description ?? goal.description,
|
|
14416
|
+
target_time: data.target_time ?? goal.target_time,
|
|
14417
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : goal.finished_at
|
|
14418
|
+
};
|
|
14419
|
+
return this.clients.goals.patch(`/goals/${id}`, {
|
|
14420
|
+
body: updateData
|
|
14421
|
+
});
|
|
14422
|
+
}),
|
|
14423
|
+
delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
|
|
14424
|
+
};
|
|
14425
|
+
tasks = {
|
|
14426
|
+
list: (filters) => wrap(() => {
|
|
14427
|
+
const query = {};
|
|
14428
|
+
if (filters?.project_id)
|
|
14429
|
+
query.project = filters.project_id;
|
|
14430
|
+
if (filters?.tag_id)
|
|
14431
|
+
query.tag = filters.tag_id;
|
|
14432
|
+
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
14433
|
+
}),
|
|
14434
|
+
find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
|
|
14435
|
+
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
14436
|
+
query: { project: project_id }
|
|
14437
|
+
})),
|
|
14438
|
+
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
14439
|
+
update: async (id, changes) => wrap(async () => {
|
|
14440
|
+
const result = await this.tasks.find(id);
|
|
14441
|
+
if (!result.ok)
|
|
14442
|
+
throw new Error(result.error.message);
|
|
14443
|
+
if (!result.value)
|
|
14444
|
+
throw new Error(`Task with id ${id} not found`);
|
|
14445
|
+
const task = result.value;
|
|
14446
|
+
const updateData = {
|
|
14447
|
+
id,
|
|
14448
|
+
title: task.task.title,
|
|
14449
|
+
summary: task.task.summary,
|
|
14450
|
+
description: task.task.description,
|
|
14451
|
+
progress: task.task.progress,
|
|
14452
|
+
visibility: task.task.visibility,
|
|
14453
|
+
start_time: task.task.start_time,
|
|
14454
|
+
end_time: task.task.end_time,
|
|
14455
|
+
priority: task.task.priority,
|
|
14456
|
+
owner_id: task.task.owner_id,
|
|
14457
|
+
project_id: task.task.project_id,
|
|
14458
|
+
...changes
|
|
14459
|
+
};
|
|
14460
|
+
return this.clients.tasks.patch("/tasks", {
|
|
14461
|
+
body: updateData
|
|
14462
|
+
});
|
|
14463
|
+
}),
|
|
14464
|
+
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
14465
|
+
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
14466
|
+
deleteTask: (task) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
14467
|
+
body: { ...task.task, deleted: true }
|
|
14468
|
+
})),
|
|
14469
|
+
history: {
|
|
14470
|
+
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
14471
|
+
},
|
|
14472
|
+
ready: (filters) => wrap(() => {
|
|
14473
|
+
const query = {};
|
|
14474
|
+
if (filters?.project_id)
|
|
14475
|
+
query.project = filters.project_id;
|
|
14476
|
+
if (filters?.limit)
|
|
14477
|
+
query.limit = String(filters.limit);
|
|
14478
|
+
if (filters?.cursor)
|
|
14479
|
+
query.cursor = filters.cursor;
|
|
14480
|
+
return this.clients.tasks.get("/tasks/ready", Object.keys(query).length > 0 ? { query } : {});
|
|
14481
|
+
}),
|
|
14482
|
+
tree: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/tree`, depth ? { query: { depth: String(depth) } } : {})),
|
|
14483
|
+
near: (id, depth) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`, depth ? { query: { depth: String(depth) } } : {})),
|
|
14484
|
+
ancestors: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/ancestors`)),
|
|
14485
|
+
claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
14486
|
+
done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
14487
|
+
reopen: (id) => wrap(() => this.clients.tasks.post(`/tasks/${id}/reopen`)),
|
|
14488
|
+
advanceStage: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/stage`, { body: data })),
|
|
14489
|
+
link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
14490
|
+
unlink: (link_id) => wrap(() => this.clients.tasks.delete(`/tasks/link/${link_id}`)),
|
|
14491
|
+
apply: (data) => wrap(() => this.clients.tasks.post("/tasks/apply", { body: data }))
|
|
14492
|
+
};
|
|
14493
|
+
tags = {
|
|
14494
|
+
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
14495
|
+
};
|
|
14496
|
+
docs = {
|
|
14497
|
+
list: (filters) => wrap(() => {
|
|
14498
|
+
const query = { project_id: filters.project_id };
|
|
14499
|
+
if (filters.task_id)
|
|
14500
|
+
query.task_id = filters.task_id;
|
|
14501
|
+
return this.clients.docs.get("/docs", { query });
|
|
14502
|
+
}),
|
|
14503
|
+
push: (data) => wrap(() => this.clients.docs.post("/docs", { body: data })),
|
|
14504
|
+
pull: (id, version) => wrap(() => this.clients.docs.get(`/docs/${id}`, version ? { query: { version } } : {})),
|
|
14505
|
+
versions: (id) => wrap(() => this.clients.docs.get(`/docs/${id}/versions`)),
|
|
14506
|
+
renderUrl: (id, version) => {
|
|
14507
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
14508
|
+
return `${this.clients.docs.url()}/docs/${id}/render${query}`;
|
|
14509
|
+
},
|
|
14510
|
+
createThread: (document_id, data) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads`, { body: data })),
|
|
14511
|
+
replyThread: (document_id, thread_id, body) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/reply`, { body: { body } })),
|
|
14512
|
+
resolveThread: (document_id, thread_id) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/resolve`, {})),
|
|
14513
|
+
toggleBlocking: (document_id, thread_id, blocking) => wrap(() => this.clients.docs.post(`/docs/${document_id}/threads/${thread_id}/blocking`, { body: { blocking } })),
|
|
14514
|
+
unresolved: (filters) => wrap(() => {
|
|
14515
|
+
const query = {};
|
|
14516
|
+
if (filters.project_id)
|
|
14517
|
+
query.project_id = filters.project_id;
|
|
14518
|
+
if (filters.document_id)
|
|
14519
|
+
query.document_id = filters.document_id;
|
|
14520
|
+
return this.clients.docs.get("/docs/annotations/unresolved", { query });
|
|
14521
|
+
}),
|
|
14522
|
+
pushInterfaceReport: (data) => wrap(() => this.clients.docs.post("/docs/interface", { body: data })),
|
|
14523
|
+
interfaceStatus: (filters) => wrap(() => {
|
|
14524
|
+
const query = { project_id: filters.project_id, title: filters.title };
|
|
14525
|
+
if (filters.task_id)
|
|
14526
|
+
query.task_id = filters.task_id;
|
|
14527
|
+
return this.clients.docs.get("/docs/interface/status", { query });
|
|
14528
|
+
})
|
|
14529
|
+
};
|
|
14530
|
+
signoffs = {
|
|
14531
|
+
request: (data) => wrap(() => this.clients.signoffs.post("/signoffs", { body: data })),
|
|
14532
|
+
find: (id) => wrap(() => this.clients.signoffs.get(`/signoffs/${id}`)),
|
|
14533
|
+
findPending: (filters) => wrap(() => this.clients.signoffs.get("/signoffs", { query: filters })),
|
|
14534
|
+
decide: (id, data) => wrap(() => this.clients.signoffs.post(`/signoffs/${id}/decide`, { body: data }))
|
|
14535
|
+
};
|
|
14536
|
+
reviews = {
|
|
14537
|
+
pending: () => wrap(() => this.clients.reviews.get("/reviews/pending"))
|
|
14538
|
+
};
|
|
14539
|
+
github = {
|
|
14540
|
+
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
14541
|
+
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
14542
|
+
};
|
|
14543
|
+
blog = {
|
|
14544
|
+
posts: {
|
|
14545
|
+
list: (params) => wrap(() => {
|
|
14546
|
+
const query = {};
|
|
14547
|
+
if (params?.category)
|
|
14548
|
+
query.category = params.category;
|
|
14549
|
+
if (params?.tag)
|
|
14550
|
+
query.tag = params.tag;
|
|
14551
|
+
if (params?.project)
|
|
14552
|
+
query.project = params.project;
|
|
14553
|
+
if (params?.status)
|
|
14554
|
+
query.status = params.status;
|
|
14555
|
+
if (params?.archived !== undefined)
|
|
14556
|
+
query.archived = String(params.archived);
|
|
14557
|
+
if (params?.limit)
|
|
14558
|
+
query.limit = String(params.limit);
|
|
14559
|
+
if (params?.offset !== undefined)
|
|
14560
|
+
query.offset = String(params.offset);
|
|
14561
|
+
if (params?.sort)
|
|
14562
|
+
query.sort = params.sort;
|
|
14563
|
+
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
14564
|
+
}),
|
|
14565
|
+
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
14566
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
14567
|
+
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
14568
|
+
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
14569
|
+
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
14570
|
+
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
14571
|
+
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
14572
|
+
},
|
|
14573
|
+
tags: {
|
|
14574
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
14575
|
+
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
14576
|
+
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14577
|
+
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
14578
|
+
removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
|
|
14579
|
+
},
|
|
14580
|
+
categories: {
|
|
14581
|
+
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
14582
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
14583
|
+
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
14584
|
+
body: data
|
|
14585
|
+
})),
|
|
14586
|
+
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
14587
|
+
},
|
|
14588
|
+
tokens: {
|
|
14589
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
14590
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
14591
|
+
update: (id, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
14592
|
+
body: data
|
|
14593
|
+
})),
|
|
14594
|
+
delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
14595
|
+
}
|
|
14596
|
+
};
|
|
14597
|
+
media = {
|
|
14598
|
+
profiles: {
|
|
14599
|
+
list: () => wrap(async () => {
|
|
14600
|
+
const res = await this.clients.media.get("/profiles");
|
|
14601
|
+
return res.profiles;
|
|
14602
|
+
}),
|
|
14603
|
+
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
14604
|
+
get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
|
|
14605
|
+
update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
|
|
14606
|
+
delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
|
|
14607
|
+
filters: {
|
|
14608
|
+
list: (profile_id) => wrap(async () => {
|
|
14609
|
+
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
14610
|
+
return res.filters;
|
|
14611
|
+
}),
|
|
14612
|
+
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
14613
|
+
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
14614
|
+
},
|
|
14615
|
+
timeline: (slug, params) => wrap(() => {
|
|
14616
|
+
const query = {};
|
|
14617
|
+
if (params?.limit)
|
|
14618
|
+
query.limit = String(params.limit);
|
|
14619
|
+
if (params?.before)
|
|
14620
|
+
query.before = params.before;
|
|
14621
|
+
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
14622
|
+
})
|
|
14623
|
+
},
|
|
14624
|
+
connections: {
|
|
14625
|
+
list: (profile_id, options) => wrap(async () => {
|
|
14626
|
+
const query = { profile_id };
|
|
14627
|
+
if (options?.include_settings)
|
|
14628
|
+
query.include_settings = "true";
|
|
14629
|
+
const res = await this.clients.media.get("/connections", { query });
|
|
14630
|
+
return res.accounts;
|
|
14631
|
+
}),
|
|
14632
|
+
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
14633
|
+
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
14634
|
+
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
14635
|
+
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
14636
|
+
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
14637
|
+
body: { is_active }
|
|
14638
|
+
})),
|
|
14639
|
+
settings: {
|
|
14640
|
+
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
14641
|
+
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
14642
|
+
body: { settings }
|
|
14643
|
+
}))
|
|
14644
|
+
},
|
|
14645
|
+
repos: (account_id) => wrap(async () => {
|
|
14646
|
+
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
14647
|
+
return res.repos;
|
|
14648
|
+
}),
|
|
14649
|
+
subreddits: (account_id) => wrap(async () => {
|
|
14650
|
+
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
14651
|
+
return res.subreddits;
|
|
14652
|
+
})
|
|
14653
|
+
},
|
|
14654
|
+
credentials: {
|
|
14655
|
+
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
14656
|
+
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
14657
|
+
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
14658
|
+
},
|
|
14659
|
+
timeline: {
|
|
14660
|
+
get: (user_id, params) => wrap(() => {
|
|
14661
|
+
const query = {};
|
|
14662
|
+
if (params?.from)
|
|
14663
|
+
query.from = params.from;
|
|
14664
|
+
if (params?.to)
|
|
14665
|
+
query.to = params.to;
|
|
14666
|
+
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
14667
|
+
}),
|
|
14668
|
+
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
14669
|
+
query: { account_id }
|
|
14670
|
+
}))
|
|
14671
|
+
}
|
|
14672
|
+
};
|
|
14673
|
+
activity = {
|
|
14674
|
+
ai: (options) => wrap(() => {
|
|
14675
|
+
const query = {};
|
|
14676
|
+
if (options?.limit)
|
|
14677
|
+
query.limit = String(options.limit);
|
|
14678
|
+
if (options?.since)
|
|
14679
|
+
query.since = options.since;
|
|
14680
|
+
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
14681
|
+
})
|
|
14682
|
+
};
|
|
14683
|
+
admin = {
|
|
14684
|
+
verifyFold: () => wrap(() => this.clients.admin.get("/admin/verify-fold")),
|
|
14685
|
+
reconcileDocsCss: () => wrap(() => this.clients.admin.post("/admin/reconcile-docs-css"))
|
|
14686
|
+
};
|
|
14687
|
+
user = {
|
|
14688
|
+
me: () => wrap(() => this.clients.auth.get("/user/me")),
|
|
14689
|
+
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
14690
|
+
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
|
|
14691
|
+
body: data
|
|
14692
|
+
}))
|
|
14693
|
+
};
|
|
14646
14694
|
history() {
|
|
14647
14695
|
return this.clients.projects.history();
|
|
14648
14696
|
}
|
|
14697
|
+
pulse = {
|
|
14698
|
+
summary: (input) => wrap(async () => {
|
|
14699
|
+
const raw = await this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
14700
|
+
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
14701
|
+
});
|
|
14702
|
+
return PulseSummarySchema.parse(raw);
|
|
14703
|
+
}),
|
|
14704
|
+
events: (input) => wrap(async () => {
|
|
14705
|
+
const query = {};
|
|
14706
|
+
if (input.name)
|
|
14707
|
+
query.name = input.name;
|
|
14708
|
+
if (input.level)
|
|
14709
|
+
query.level = input.level;
|
|
14710
|
+
if (typeof input.ts_from === "number")
|
|
14711
|
+
query.ts_from = String(input.ts_from);
|
|
14712
|
+
if (typeof input.ts_to === "number")
|
|
14713
|
+
query.ts_to = String(input.ts_to);
|
|
14714
|
+
if (input.search)
|
|
14715
|
+
query.search = input.search;
|
|
14716
|
+
if (input.limit)
|
|
14717
|
+
query.limit = String(input.limit);
|
|
14718
|
+
if (input.cursor)
|
|
14719
|
+
query.cursor = input.cursor;
|
|
14720
|
+
const raw = await this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
|
|
14721
|
+
query
|
|
14722
|
+
});
|
|
14723
|
+
return PulseEventsPageSchema.parse(raw);
|
|
14724
|
+
}),
|
|
14725
|
+
errors: (input) => wrap(async () => {
|
|
14726
|
+
const query = {};
|
|
14727
|
+
if (typeof input.range === "string") {
|
|
14728
|
+
query.range = input.range;
|
|
14729
|
+
} else {
|
|
14730
|
+
query.from = String(input.range.from);
|
|
14731
|
+
query.to = String(input.range.to);
|
|
14732
|
+
}
|
|
14733
|
+
if (input.group_by_fingerprint)
|
|
14734
|
+
query.group_by_fingerprint = "true";
|
|
14735
|
+
const raw = await this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
|
|
14736
|
+
query
|
|
14737
|
+
});
|
|
14738
|
+
return PulseErrorsResultSchema.parse(raw);
|
|
14739
|
+
}),
|
|
14740
|
+
logs: (input) => wrap(async () => {
|
|
14741
|
+
const query = {};
|
|
14742
|
+
if (typeof input.range === "string") {
|
|
14743
|
+
query.range = input.range;
|
|
14744
|
+
} else {
|
|
14745
|
+
query.from = String(input.range.from);
|
|
14746
|
+
query.to = String(input.range.to);
|
|
14747
|
+
}
|
|
14748
|
+
if (input.level)
|
|
14749
|
+
query.level = input.level;
|
|
14750
|
+
if (input.search)
|
|
14751
|
+
query.search = input.search;
|
|
14752
|
+
const raw = await this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
14753
|
+
return PulseLogsResultSchema.parse(raw);
|
|
14754
|
+
}),
|
|
14755
|
+
latency: (input) => wrap(async () => {
|
|
14756
|
+
const query = {};
|
|
14757
|
+
if (typeof input.range === "string") {
|
|
14758
|
+
query.range = input.range;
|
|
14759
|
+
} else {
|
|
14760
|
+
query.from = String(input.range.from);
|
|
14761
|
+
query.to = String(input.range.to);
|
|
14762
|
+
}
|
|
14763
|
+
if (input.route)
|
|
14764
|
+
query.route = input.route;
|
|
14765
|
+
if (input.percentiles && input.percentiles.length > 0)
|
|
14766
|
+
query.percentiles = input.percentiles.join(",");
|
|
14767
|
+
const raw = await this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
|
|
14768
|
+
query
|
|
14769
|
+
});
|
|
14770
|
+
return PulseLatencyResultSchema.parse(raw);
|
|
14771
|
+
}),
|
|
14772
|
+
subs: {
|
|
14773
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
14774
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
14775
|
+
body: {
|
|
14776
|
+
project_id: input.project_id,
|
|
14777
|
+
name: input.name,
|
|
14778
|
+
filter: input.filter,
|
|
14779
|
+
channel: input.channel,
|
|
14780
|
+
cooldown_seconds: input.cooldown_seconds
|
|
14781
|
+
}
|
|
14782
|
+
})),
|
|
14783
|
+
get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
|
|
14784
|
+
update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
|
|
14785
|
+
delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
|
|
14786
|
+
},
|
|
14787
|
+
keys: {
|
|
14788
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
14789
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
14790
|
+
body: {
|
|
14791
|
+
project_id: input.project_id,
|
|
14792
|
+
name: input.name,
|
|
14793
|
+
rate_limit_per_min: input.rate_limit_per_min
|
|
14794
|
+
}
|
|
14795
|
+
})),
|
|
14796
|
+
delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, {
|
|
14797
|
+
query: { project_id: input.project_id }
|
|
14798
|
+
}))
|
|
14799
|
+
}
|
|
14800
|
+
};
|
|
14801
|
+
pipelines = {
|
|
14802
|
+
dashboard: {
|
|
14803
|
+
get: (input) => {
|
|
14804
|
+
const query = { project_id: input.project_id };
|
|
14805
|
+
if (input.window_ms !== undefined)
|
|
14806
|
+
query.window_ms = String(input.window_ms);
|
|
14807
|
+
return wrap(async () => pipelines_dashboard_wire.parse(await this.clients.pipelines.get("/pipelines/dashboard", { query })));
|
|
14808
|
+
}
|
|
14809
|
+
},
|
|
14810
|
+
list: (filter) => {
|
|
14811
|
+
const query = {};
|
|
14812
|
+
if (filter?.package_id !== undefined)
|
|
14813
|
+
query.package_id = filter.package_id;
|
|
14814
|
+
if (filter?.status !== undefined)
|
|
14815
|
+
query.status = filter.status;
|
|
14816
|
+
if (filter?.limit !== undefined)
|
|
14817
|
+
query.limit = String(filter.limit);
|
|
14818
|
+
return wrap(async () => {
|
|
14819
|
+
const raw = await this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined);
|
|
14820
|
+
return pipeline_run_list_wire.parse(raw);
|
|
14821
|
+
});
|
|
14822
|
+
},
|
|
14823
|
+
get: (run_id) => wrap(async () => pipeline_run_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}`))),
|
|
14824
|
+
create: (input) => wrap(async () => pipeline_run_start_wire.parse(await this.clients.pipelines.post("/runs", { body: input }))),
|
|
14825
|
+
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
14826
|
+
body: input
|
|
14827
|
+
})),
|
|
14828
|
+
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
14829
|
+
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
14830
|
+
redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
|
|
14831
|
+
dispatches: (run_id) => wrap(async () => pipeline_dispatch_ledger_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}/dispatches`))),
|
|
14832
|
+
events: {
|
|
14833
|
+
ingest: (run_id, input) => wrap(async () => pipeline_ingest_response_wire.parse(await this.clients.pipelines.post(`/runs/${run_id}/events`, {
|
|
14834
|
+
body: input
|
|
14835
|
+
}))),
|
|
14836
|
+
list: (run_id) => wrap(async () => pipeline_stage_event_list_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}/events`)))
|
|
14837
|
+
},
|
|
14838
|
+
grants: {
|
|
14839
|
+
list: (package_id) => wrap(async () => {
|
|
14840
|
+
const raw = await this.clients.pipelines.get("/grants", {
|
|
14841
|
+
query: package_id ? { package_id } : {}
|
|
14842
|
+
});
|
|
14843
|
+
return pipeline_grant_list_wire.parse(raw);
|
|
14844
|
+
}),
|
|
14845
|
+
approve: (grant_id) => wrap(async () => pipeline_grant_wire.parse(await this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
14846
|
+
body: {}
|
|
14847
|
+
}))),
|
|
14848
|
+
deny: (grant_id, reason) => wrap(async () => pipelines_deny_wire.parse(await this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
14849
|
+
body: reason !== undefined ? { reason } : {}
|
|
14850
|
+
})))
|
|
14851
|
+
},
|
|
14852
|
+
packages: {
|
|
14853
|
+
list: (filter) => {
|
|
14854
|
+
const query = {};
|
|
14855
|
+
if (filter?.project_id !== undefined)
|
|
14856
|
+
query.project_id = filter.project_id;
|
|
14857
|
+
return wrap(async () => {
|
|
14858
|
+
const raw = await this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined);
|
|
14859
|
+
return pipeline_package_list_wire.parse(raw);
|
|
14860
|
+
});
|
|
14861
|
+
},
|
|
14862
|
+
get: (package_id) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.get(`/packages/${package_id}`))),
|
|
14863
|
+
create: (input) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.post("/packages", { body: input }))),
|
|
14864
|
+
update: (package_id, input) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.patch(`/packages/${package_id}`, { body: input }))),
|
|
14865
|
+
delete: (package_id) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/packages/${package_id}`)))
|
|
14866
|
+
},
|
|
14867
|
+
analysis_templates: {
|
|
14868
|
+
list: (input) => wrap(async () => pipeline_analysis_template_list_wire.parse(await this.clients.pipelines.get("/analysis-templates", {
|
|
14869
|
+
query: { owner_id: input.owner_id }
|
|
14870
|
+
}))),
|
|
14871
|
+
get: (id, input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.get(`/analysis-templates/${id}`, {
|
|
14872
|
+
query: { owner_id: input.owner_id }
|
|
14873
|
+
}))),
|
|
14874
|
+
create: (input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.post("/analysis-templates", { body: input }))),
|
|
14875
|
+
update: (id, input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input }))),
|
|
14876
|
+
delete: (id, input) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/analysis-templates/${id}`, {
|
|
14877
|
+
query: { owner_id: input.owner_id }
|
|
14878
|
+
})))
|
|
14879
|
+
},
|
|
14880
|
+
oidc_trust: {
|
|
14881
|
+
list: (input) => wrap(async () => pipeline_oidc_trust_list_wire.parse(await this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } }))),
|
|
14882
|
+
get: (id, input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } }))),
|
|
14883
|
+
create: (input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.post("/oidc-trust", { body: input }))),
|
|
14884
|
+
update: (id, input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input }))),
|
|
14885
|
+
delete: (id, input) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/oidc-trust/${id}`, {
|
|
14886
|
+
query: { owner_id: input.owner_id }
|
|
14887
|
+
})))
|
|
14888
|
+
}
|
|
14889
|
+
};
|
|
14649
14890
|
getApiKey() {
|
|
14650
14891
|
return this.api_key_field;
|
|
14651
14892
|
}
|
|
@@ -14698,7 +14939,7 @@ var blog_post_projects = sqliteTable("blog_post_projects", {
|
|
|
14698
14939
|
}, (table) => [primaryKey({ columns: [table.post_id, table.project_id] })]);
|
|
14699
14940
|
function unwrap2(result) {
|
|
14700
14941
|
if (!result.ok)
|
|
14701
|
-
throw new Error(result.error
|
|
14942
|
+
throw new Error(result.error.message);
|
|
14702
14943
|
return result.value;
|
|
14703
14944
|
}
|
|
14704
14945
|
var project_filters = objectType({
|
|
@@ -22829,12 +23070,16 @@ class StdioServerTransport {
|
|
|
22829
23070
|
}
|
|
22830
23071
|
|
|
22831
23072
|
// src/index.ts
|
|
23073
|
+
var is_json_schema_object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22832
23074
|
function zodToMCPSchema(schema) {
|
|
22833
23075
|
try {
|
|
22834
|
-
const
|
|
23076
|
+
const converted = zodToJsonSchema(schema, {
|
|
22835
23077
|
target: "openApi3",
|
|
22836
23078
|
$refStrategy: "none"
|
|
22837
23079
|
});
|
|
23080
|
+
if (!is_json_schema_object(converted))
|
|
23081
|
+
throw new Error("zod-to-json-schema returned a non-object schema");
|
|
23082
|
+
const jsonSchema = converted;
|
|
22838
23083
|
const { $schema: _, ...cleanSchema } = jsonSchema;
|
|
22839
23084
|
if (jsonSchema.type === "object")
|
|
22840
23085
|
return jsonSchema;
|
|
@@ -22845,7 +23090,8 @@ function zodToMCPSchema(schema) {
|
|
|
22845
23090
|
},
|
|
22846
23091
|
required: []
|
|
22847
23092
|
};
|
|
22848
|
-
} catch {
|
|
23093
|
+
} catch (error) {
|
|
23094
|
+
console.error("[mcp] tool json-schema conversion failed, using open schema:", error);
|
|
22849
23095
|
return {
|
|
22850
23096
|
type: "object",
|
|
22851
23097
|
properties: {},
|