@devpad/mcp 2.2.7 → 2.2.9
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 +1407 -1273
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10576,343 +10576,29 @@ var coerce = {
|
|
|
10576
10576
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
10577
10577
|
};
|
|
10578
10578
|
var NEVER = INVALID;
|
|
10579
|
-
//
|
|
10580
|
-
var
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
});
|
|
10598
|
-
var upsert_todo = exports_external.object({
|
|
10599
|
-
id: exports_external.string().optional().nullable(),
|
|
10600
|
-
title: exports_external.string().optional(),
|
|
10601
|
-
summary: exports_external.string().optional().nullable(),
|
|
10602
|
-
description: exports_external.string().optional().nullable(),
|
|
10603
|
-
progress: exports_external.union([exports_external.literal("UNSTARTED"), exports_external.literal("IN_PROGRESS"), exports_external.literal("COMPLETED")]).optional(),
|
|
10604
|
-
visibility: exports_external.union([exports_external.literal("PUBLIC"), exports_external.literal("PRIVATE"), exports_external.literal("HIDDEN"), exports_external.literal("ARCHIVED"), exports_external.literal("DRAFT"), exports_external.literal("DELETED")]).optional(),
|
|
10605
|
-
start_time: exports_external.string().optional().nullable(),
|
|
10606
|
-
end_time: exports_external.string().optional().nullable(),
|
|
10607
|
-
priority: exports_external.union([exports_external.literal("LOW"), exports_external.literal("MEDIUM"), exports_external.literal("HIGH")]).optional(),
|
|
10608
|
-
owner_id: exports_external.string(),
|
|
10609
|
-
project_id: exports_external.string().optional().nullable(),
|
|
10610
|
-
goal_id: exports_external.string().optional().nullable(),
|
|
10611
|
-
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
10612
|
-
});
|
|
10613
|
-
var update_action = exports_external.union([exports_external.literal("CONFIRM"), exports_external.literal("UNLINK"), exports_external.literal("CREATE"), exports_external.literal("IGNORE"), exports_external.literal("DELETE"), exports_external.literal("COMPLETE")]);
|
|
10614
|
-
var upsert_tag = exports_external.object({
|
|
10615
|
-
id: exports_external.string().optional(),
|
|
10616
|
-
title: exports_external.string(),
|
|
10617
|
-
color: exports_external.union([exports_external.literal("red"), exports_external.literal("green"), exports_external.literal("blue"), exports_external.literal("yellow"), exports_external.literal("purple"), exports_external.literal("orange"), exports_external.literal("teal"), exports_external.literal("pink"), exports_external.literal("gray"), exports_external.literal("cyan"), exports_external.literal("lime")]).nullable().optional(),
|
|
10618
|
-
deleted: exports_external.boolean().optional().default(false),
|
|
10619
|
-
render: exports_external.boolean().optional().default(true),
|
|
10620
|
-
owner_id: exports_external.string()
|
|
10621
|
-
});
|
|
10622
|
-
var project_config = exports_external.object({
|
|
10623
|
-
tags: exports_external.array(exports_external.object({
|
|
10624
|
-
name: exports_external.string(),
|
|
10625
|
-
match: exports_external.array(exports_external.string())
|
|
10626
|
-
})),
|
|
10627
|
-
ignore: exports_external.array(exports_external.string())
|
|
10628
|
-
});
|
|
10629
|
-
var save_config_request = exports_external.object({
|
|
10630
|
-
id: exports_external.string(),
|
|
10631
|
-
config: project_config,
|
|
10632
|
-
scan_branch: exports_external.string().optional()
|
|
10633
|
-
});
|
|
10634
|
-
var save_tags_request = exports_external.array(upsert_tag);
|
|
10635
|
-
var update_user = exports_external.object({
|
|
10636
|
-
id: exports_external.string(),
|
|
10637
|
-
name: exports_external.string().optional(),
|
|
10638
|
-
image_url: exports_external.string().optional(),
|
|
10639
|
-
task_view: exports_external.union([exports_external.literal("list"), exports_external.literal("grid")]).optional(),
|
|
10640
|
-
email_verified: exports_external.boolean().optional()
|
|
10641
|
-
});
|
|
10642
|
-
var config_schema = exports_external.object({
|
|
10643
|
-
tags: exports_external.array(exports_external.object({
|
|
10644
|
-
name: exports_external.string(),
|
|
10645
|
-
match: exports_external.array(exports_external.string())
|
|
10646
|
-
})),
|
|
10647
|
-
ignore: exports_external.array(exports_external.string().regex(/^[\s\S]*$/, "Invalid path"))
|
|
10648
|
-
});
|
|
10649
|
-
var upsert_milestone = exports_external.object({
|
|
10650
|
-
id: exports_external.string().optional().nullable(),
|
|
10651
|
-
project_id: exports_external.string(),
|
|
10652
|
-
name: exports_external.string().min(1).max(200),
|
|
10653
|
-
description: exports_external.string().nullable().optional(),
|
|
10654
|
-
target_time: exports_external.string().nullable().optional(),
|
|
10655
|
-
target_version: exports_external.string().nullable().optional(),
|
|
10656
|
-
finished_at: exports_external.string().nullable().optional(),
|
|
10657
|
-
after_id: exports_external.string().nullable().optional(),
|
|
10658
|
-
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
10659
|
-
});
|
|
10660
|
-
var upsert_goal = exports_external.object({
|
|
10661
|
-
id: exports_external.string().optional().nullable(),
|
|
10662
|
-
milestone_id: exports_external.string(),
|
|
10663
|
-
name: exports_external.string().min(1).max(200),
|
|
10664
|
-
description: exports_external.string().nullable().optional(),
|
|
10665
|
-
target_time: exports_external.string().nullable().optional(),
|
|
10666
|
-
finished_at: exports_external.string().nullable().optional(),
|
|
10667
|
-
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
10668
|
-
});
|
|
10669
|
-
var rollout_shape = exports_external.union([exports_external.literal("gradual"), exports_external.literal("atomic")]);
|
|
10670
|
-
var run_kind = exports_external.union([exports_external.literal("deploy"), exports_external.literal("rollback")]);
|
|
10671
|
-
var run_status = exports_external.union([
|
|
10672
|
-
exports_external.literal("queued"),
|
|
10673
|
-
exports_external.literal("deploying"),
|
|
10674
|
-
exports_external.literal("baking"),
|
|
10675
|
-
exports_external.literal("awaiting_approval"),
|
|
10676
|
-
exports_external.literal("rolling_back"),
|
|
10677
|
-
exports_external.literal("completed"),
|
|
10678
|
-
exports_external.literal("rolled_back"),
|
|
10679
|
-
exports_external.literal("failed"),
|
|
10680
|
-
exports_external.literal("cancelled")
|
|
10681
|
-
]);
|
|
10682
|
-
var forced_atomic_reason = exports_external.union([exports_external.literal("do_migrations"), exports_external.literal("asset_affinity_none")]);
|
|
10683
|
-
var stage_event_kind = exports_external.union([
|
|
10684
|
-
exports_external.literal("deploy_started"),
|
|
10685
|
-
exports_external.literal("deploy_completed"),
|
|
10686
|
-
exports_external.literal("bake_started"),
|
|
10687
|
-
exports_external.literal("bake_completed"),
|
|
10688
|
-
exports_external.literal("gate_verdict"),
|
|
10689
|
-
exports_external.literal("approval_requested"),
|
|
10690
|
-
exports_external.literal("rollback_started"),
|
|
10691
|
-
exports_external.literal("rollback_completed"),
|
|
10692
|
-
exports_external.literal("warning"),
|
|
10693
|
-
exports_external.literal("error")
|
|
10694
|
-
]);
|
|
10695
|
-
var approval_decision = exports_external.union([exports_external.literal("approved"), exports_external.literal("denied")]);
|
|
10696
|
-
var grant_scope = exports_external.string().regex(/^[a-z0-9_-]+:[a-z0-9_-]+(:[^\s]+)?$/, "Invalid scope format");
|
|
10697
|
-
var rollout_stage = exports_external.object({
|
|
10698
|
-
name: exports_external.string(),
|
|
10699
|
-
traffic: exports_external.number().int().min(0).max(100),
|
|
10700
|
-
bake: exports_external.string().nullable()
|
|
10701
|
-
});
|
|
10702
|
-
var resolved_rollout = exports_external.discriminatedUnion("type", [
|
|
10703
|
-
exports_external.object({
|
|
10704
|
-
type: exports_external.literal("gradual"),
|
|
10705
|
-
stages: exports_external.array(rollout_stage)
|
|
10706
|
-
}),
|
|
10707
|
-
exports_external.object({
|
|
10708
|
-
type: exports_external.literal("atomic")
|
|
10709
|
-
})
|
|
10710
|
-
]);
|
|
10711
|
-
var gate_descriptor = exports_external.discriminatedUnion("type", [
|
|
10712
|
-
exports_external.object({ type: exports_external.literal("manual") }),
|
|
10713
|
-
exports_external.object({ type: exports_external.literal("auto"), afterBake: exports_external.boolean().optional() }),
|
|
10714
|
-
exports_external.object({ type: exports_external.literal("analysis"), template: exports_external.string() })
|
|
10715
|
-
]);
|
|
10716
|
-
var resolved_gates = exports_external.record(exports_external.string(), gate_descriptor);
|
|
10717
|
-
var upsert_pipeline_package = exports_external.object({
|
|
10718
|
-
id: exports_external.string().optional().nullable(),
|
|
10719
|
-
owner_id: exports_external.string(),
|
|
10720
|
-
name: exports_external.string().min(1).max(200),
|
|
10721
|
-
repo_url: exports_external.string().nullable().optional(),
|
|
10722
|
-
default_template_ref: exports_external.string().nullable().optional(),
|
|
10723
|
-
script_name_overrides: exports_external.record(exports_external.string(), exports_external.string()).nullable().optional(),
|
|
10724
|
-
project_id: exports_external.string().nullable().optional()
|
|
10725
|
-
});
|
|
10726
|
-
var upsert_pipeline_run = exports_external.object({
|
|
10727
|
-
id: exports_external.string().optional().nullable(),
|
|
10728
|
-
package_id: exports_external.string(),
|
|
10729
|
-
version_set_id: exports_external.string(),
|
|
10730
|
-
shape: rollout_shape,
|
|
10731
|
-
kind: run_kind.optional(),
|
|
10732
|
-
status: run_status.optional(),
|
|
10733
|
-
current_stage: exports_external.string().nullable().optional(),
|
|
10734
|
-
resolved_rollout,
|
|
10735
|
-
resolved_gates,
|
|
10736
|
-
forced_atomic_reason: forced_atomic_reason.nullable().optional(),
|
|
10737
|
-
started_at: exports_external.string().nullable().optional(),
|
|
10738
|
-
finished_at: exports_external.string().nullable().optional()
|
|
10739
|
-
});
|
|
10740
|
-
var insert_pipeline_stage_event = exports_external.object({
|
|
10741
|
-
run_id: exports_external.string(),
|
|
10742
|
-
stage_name: exports_external.string(),
|
|
10743
|
-
kind: stage_event_kind,
|
|
10744
|
-
payload: exports_external.unknown().optional()
|
|
10745
|
-
});
|
|
10746
|
-
var upsert_pipeline_grant = exports_external.object({
|
|
10747
|
-
id: exports_external.string().optional().nullable(),
|
|
10748
|
-
package_id: exports_external.string(),
|
|
10749
|
-
stage_name: exports_external.string(),
|
|
10750
|
-
scope: grant_scope,
|
|
10751
|
-
granted_by: exports_external.string().nullable().optional(),
|
|
10752
|
-
granted_at: exports_external.string().nullable().optional()
|
|
10753
|
-
});
|
|
10754
|
-
var upsert_pipeline_approval = exports_external.object({
|
|
10755
|
-
run_id: exports_external.string(),
|
|
10756
|
-
stage_name: exports_external.string(),
|
|
10757
|
-
decision: approval_decision.nullable().optional(),
|
|
10758
|
-
reason: exports_external.string().nullable().optional(),
|
|
10759
|
-
decided_by: exports_external.string().nullable().optional(),
|
|
10760
|
-
decided_at: exports_external.string().nullable().optional()
|
|
10761
|
-
});
|
|
10762
|
-
var upsert_pipeline_analysis_template = exports_external.object({
|
|
10763
|
-
id: exports_external.string().optional().nullable(),
|
|
10764
|
-
owner_id: exports_external.string(),
|
|
10765
|
-
name: exports_external.string().min(1).max(200),
|
|
10766
|
-
query_dsl: exports_external.unknown(),
|
|
10767
|
-
threshold_dsl: exports_external.unknown()
|
|
10768
|
-
});
|
|
10769
|
-
var pipeline_oidc_provider = exports_external.literal("github");
|
|
10770
|
-
var upsert_pipeline_oidc_trust = exports_external.object({
|
|
10771
|
-
id: exports_external.string().optional().nullable(),
|
|
10772
|
-
owner_id: exports_external.string(),
|
|
10773
|
-
provider: pipeline_oidc_provider.optional(),
|
|
10774
|
-
github_owner: exports_external.string().min(1).max(200),
|
|
10775
|
-
repo_pattern: exports_external.string().min(1).max(200).optional(),
|
|
10776
|
-
allowed_refs: exports_external.array(exports_external.string()).optional(),
|
|
10777
|
-
allowed_environments: exports_external.array(exports_external.string()).optional(),
|
|
10778
|
-
expected_audience: exports_external.string().min(1),
|
|
10779
|
-
allowed_actions: exports_external.array(exports_external.string()).optional(),
|
|
10780
|
-
session_ttl_seconds: exports_external.number().int().positive().optional(),
|
|
10781
|
-
last_used_at: exports_external.string().nullable().optional()
|
|
10782
|
-
});
|
|
10783
|
-
|
|
10784
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/types.js
|
|
10785
|
-
var ok = (value) => ({ ok: true, value });
|
|
10786
|
-
var err = (error) => ({ ok: false, error });
|
|
10787
|
-
|
|
10788
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/utils.js
|
|
10789
|
-
function create_filter_pipeline(config) {
|
|
10790
|
-
return (items, opts) => {
|
|
10791
|
-
let filtered = items;
|
|
10792
|
-
for (const { key, predicate } of config.filters) {
|
|
10793
|
-
const optValue = opts[key];
|
|
10794
|
-
if (optValue !== undefined && optValue !== null) {
|
|
10795
|
-
filtered = filtered.filter((item) => predicate(item, optValue));
|
|
10579
|
+
// ../../node_modules/.bun/drizzle-orm@0.44.7+02e1b8e76bf21939/node_modules/drizzle-orm/entity.js
|
|
10580
|
+
var entityKind = Symbol.for("drizzle:entityKind");
|
|
10581
|
+
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
10582
|
+
function is(value, type) {
|
|
10583
|
+
if (!value || typeof value !== "object") {
|
|
10584
|
+
return false;
|
|
10585
|
+
}
|
|
10586
|
+
if (value instanceof type) {
|
|
10587
|
+
return true;
|
|
10588
|
+
}
|
|
10589
|
+
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
10590
|
+
throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
|
|
10591
|
+
}
|
|
10592
|
+
let cls = Object.getPrototypeOf(value).constructor;
|
|
10593
|
+
if (cls) {
|
|
10594
|
+
while (cls) {
|
|
10595
|
+
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
10596
|
+
return true;
|
|
10796
10597
|
}
|
|
10598
|
+
cls = Object.getPrototypeOf(cls);
|
|
10797
10599
|
}
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
filtered = filtered.slice(0, opts.limit);
|
|
10801
|
-
}
|
|
10802
|
-
return filtered;
|
|
10803
|
-
};
|
|
10804
|
-
}
|
|
10805
|
-
var snapshot_filter_pipeline = create_filter_pipeline({
|
|
10806
|
-
filters: [
|
|
10807
|
-
{ key: "before", predicate: (m, before) => m.created_at < before },
|
|
10808
|
-
{ key: "after", predicate: (m, after) => m.created_at > after },
|
|
10809
|
-
{ key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag) => m.tags?.includes(tag)) }
|
|
10810
|
-
],
|
|
10811
|
-
sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
|
|
10812
|
-
});
|
|
10813
|
-
|
|
10814
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/result.js
|
|
10815
|
-
var try_catch_async = async (fn, on_error) => {
|
|
10816
|
-
try {
|
|
10817
|
-
return ok(await fn());
|
|
10818
|
-
} catch (e) {
|
|
10819
|
-
return err(on_error(e));
|
|
10820
|
-
}
|
|
10821
|
-
};
|
|
10822
|
-
var fetch_result = async (input, init, on_error, parse_body = (r) => r.json()) => {
|
|
10823
|
-
try {
|
|
10824
|
-
const response = await fetch(input, init);
|
|
10825
|
-
if (!response.ok) {
|
|
10826
|
-
return err(on_error({ type: "http", status: response.status, status_text: response.statusText }));
|
|
10827
|
-
}
|
|
10828
|
-
return ok(await parse_body(response));
|
|
10829
|
-
} catch (e) {
|
|
10830
|
-
return err(on_error({ type: "network", cause: e }));
|
|
10831
|
-
}
|
|
10832
|
-
};
|
|
10833
|
-
var create_pipe = (promised) => ({
|
|
10834
|
-
map: (fn) => create_pipe(promised.then((r) => {
|
|
10835
|
-
if (r.ok)
|
|
10836
|
-
return ok(fn(r.value));
|
|
10837
|
-
return err(r.error);
|
|
10838
|
-
})),
|
|
10839
|
-
map_async: (fn) => create_pipe(promised.then(async (r) => {
|
|
10840
|
-
if (r.ok)
|
|
10841
|
-
return ok(await fn(r.value));
|
|
10842
|
-
return err(r.error);
|
|
10843
|
-
})),
|
|
10844
|
-
flat_map: (fn) => create_pipe(promised.then((r) => {
|
|
10845
|
-
if (r.ok)
|
|
10846
|
-
return fn(r.value);
|
|
10847
|
-
return err(r.error);
|
|
10848
|
-
})),
|
|
10849
|
-
map_err: (fn) => create_pipe(promised.then((r) => {
|
|
10850
|
-
if (r.ok)
|
|
10851
|
-
return ok(r.value);
|
|
10852
|
-
return err(fn(r.error));
|
|
10853
|
-
})),
|
|
10854
|
-
tap: (fn) => create_pipe(promised.then(async (r) => {
|
|
10855
|
-
if (r.ok)
|
|
10856
|
-
await fn(r.value);
|
|
10857
|
-
return r;
|
|
10858
|
-
})),
|
|
10859
|
-
tap_err: (fn) => create_pipe(promised.then(async (r) => {
|
|
10860
|
-
if (!r.ok)
|
|
10861
|
-
await fn(r.error);
|
|
10862
|
-
return r;
|
|
10863
|
-
})),
|
|
10864
|
-
unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
|
|
10865
|
-
result: () => promised
|
|
10866
|
-
});
|
|
10867
|
-
var pipe = (initial) => create_pipe(Promise.resolve(initial));
|
|
10868
|
-
pipe.ok = (value) => pipe(ok(value));
|
|
10869
|
-
pipe.err = (error) => pipe(err(error));
|
|
10870
|
-
pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
|
|
10871
|
-
pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
|
|
10872
|
-
|
|
10873
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/observations/storage.js
|
|
10874
|
-
var observation_filter_pipeline = create_filter_pipeline({
|
|
10875
|
-
filters: [
|
|
10876
|
-
{
|
|
10877
|
-
key: "type",
|
|
10878
|
-
predicate: (r, type) => {
|
|
10879
|
-
const types2 = Array.isArray(type) ? type : [type];
|
|
10880
|
-
return types2.includes(r.type);
|
|
10881
|
-
}
|
|
10882
|
-
},
|
|
10883
|
-
{ key: "source_store_id", predicate: (r, id) => r.source_store_id === id },
|
|
10884
|
-
{ key: "source_version", predicate: (r, version) => r.source_version === version },
|
|
10885
|
-
{ key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
|
|
10886
|
-
{ key: "created_after", predicate: (r, after) => r.created_at > after },
|
|
10887
|
-
{ key: "created_before", predicate: (r, before) => r.created_at < before },
|
|
10888
|
-
{ key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
|
|
10889
|
-
{ key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
|
|
10890
|
-
],
|
|
10891
|
-
sort: (a, b) => b.created_at.localeCompare(a.created_at)
|
|
10892
|
-
});
|
|
10893
|
-
// ../../node_modules/.bun/drizzle-orm@0.44.7+02e1b8e76bf21939/node_modules/drizzle-orm/entity.js
|
|
10894
|
-
var entityKind = Symbol.for("drizzle:entityKind");
|
|
10895
|
-
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
10896
|
-
function is(value, type) {
|
|
10897
|
-
if (!value || typeof value !== "object") {
|
|
10898
|
-
return false;
|
|
10899
|
-
}
|
|
10900
|
-
if (value instanceof type) {
|
|
10901
|
-
return true;
|
|
10902
|
-
}
|
|
10903
|
-
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
10904
|
-
throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
|
|
10905
|
-
}
|
|
10906
|
-
let cls = Object.getPrototypeOf(value).constructor;
|
|
10907
|
-
if (cls) {
|
|
10908
|
-
while (cls) {
|
|
10909
|
-
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
10910
|
-
return true;
|
|
10911
|
-
}
|
|
10912
|
-
cls = Object.getPrototypeOf(cls);
|
|
10913
|
-
}
|
|
10914
|
-
}
|
|
10915
|
-
return false;
|
|
10600
|
+
}
|
|
10601
|
+
return false;
|
|
10916
10602
|
}
|
|
10917
10603
|
|
|
10918
10604
|
// ../../node_modules/.bun/drizzle-orm@0.44.7+02e1b8e76bf21939/node_modules/drizzle-orm/column.js
|
|
@@ -11568,6 +11254,21 @@ function getColumnNameAndConfig(a, b) {
|
|
|
11568
11254
|
}
|
|
11569
11255
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
11570
11256
|
|
|
11257
|
+
// ../../node_modules/.bun/drizzle-orm@0.44.7+02e1b8e76bf21939/node_modules/drizzle-orm/relations.js
|
|
11258
|
+
class Relations {
|
|
11259
|
+
constructor(table, config) {
|
|
11260
|
+
this.table = table;
|
|
11261
|
+
this.config = config;
|
|
11262
|
+
}
|
|
11263
|
+
static [entityKind] = "Relations";
|
|
11264
|
+
}
|
|
11265
|
+
function relations(table, relations2) {
|
|
11266
|
+
return new Relations(table, (helpers) => Object.fromEntries(Object.entries(relations2(helpers)).map(([key, value]) => [
|
|
11267
|
+
key,
|
|
11268
|
+
value.withFieldName(key)
|
|
11269
|
+
])));
|
|
11270
|
+
}
|
|
11271
|
+
|
|
11571
11272
|
// ../../node_modules/.bun/drizzle-orm@0.44.7+02e1b8e76bf21939/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
11572
11273
|
class ForeignKeyBuilder {
|
|
11573
11274
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
@@ -12220,941 +11921,10 @@ class PrimaryKey {
|
|
|
12220
11921
|
}
|
|
12221
11922
|
}
|
|
12222
11923
|
|
|
12223
|
-
//
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
this.config = config;
|
|
12228
|
-
}
|
|
12229
|
-
static [entityKind] = "Relations";
|
|
12230
|
-
}
|
|
12231
|
-
function relations(table, relations2) {
|
|
12232
|
-
return new Relations(table, (helpers) => Object.fromEntries(Object.entries(relations2(helpers)).map(([key, value]) => [
|
|
12233
|
-
key,
|
|
12234
|
-
value.withFieldName(key)
|
|
12235
|
-
])));
|
|
12236
|
-
}
|
|
12237
|
-
|
|
12238
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/observations/schema.js
|
|
12239
|
-
var corpus_observations = sqliteTable("corpus_observations", {
|
|
12240
|
-
id: text("id").primaryKey(),
|
|
12241
|
-
type: text("type").notNull(),
|
|
12242
|
-
source_store_id: text("source_store_id").notNull(),
|
|
12243
|
-
source_version: text("source_version").notNull(),
|
|
12244
|
-
source_path: text("source_path"),
|
|
12245
|
-
source_span_start: text("source_span_start"),
|
|
12246
|
-
source_span_end: text("source_span_end"),
|
|
12247
|
-
content: text("content").notNull(),
|
|
12248
|
-
confidence: real("confidence"),
|
|
12249
|
-
observed_at: text("observed_at"),
|
|
12250
|
-
created_at: text("created_at").notNull(),
|
|
12251
|
-
derived_from: text("derived_from")
|
|
12252
|
-
}, (table) => ({
|
|
12253
|
-
type_idx: index("idx_obs_type").on(table.type),
|
|
12254
|
-
source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
|
|
12255
|
-
type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
|
|
12256
|
-
type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
|
|
12257
|
-
}));
|
|
12258
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/backend/memory.js
|
|
12259
|
-
var CORPUS_DEV = (() => {
|
|
12260
|
-
try {
|
|
12261
|
-
return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
|
|
12262
|
-
} catch {
|
|
12263
|
-
return false;
|
|
12264
|
-
}
|
|
12265
|
-
})();
|
|
12266
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/schema.js
|
|
12267
|
-
var corpus_snapshots = sqliteTable("corpus_snapshots", {
|
|
12268
|
-
store_id: text("store_id").notNull(),
|
|
12269
|
-
version: text("version").notNull(),
|
|
12270
|
-
parents: text("parents").notNull(),
|
|
12271
|
-
created_at: text("created_at").notNull(),
|
|
12272
|
-
invoked_at: text("invoked_at"),
|
|
12273
|
-
content_hash: text("content_hash").notNull(),
|
|
12274
|
-
content_type: text("content_type").notNull(),
|
|
12275
|
-
size_bytes: integer("size_bytes").notNull(),
|
|
12276
|
-
data_key: text("data_key").notNull(),
|
|
12277
|
-
tags: text("tags")
|
|
12278
|
-
}, (table) => ({
|
|
12279
|
-
pk: primaryKey({ columns: [table.store_id, table.version] }),
|
|
12280
|
-
created_idx: index("idx_store_created").on(table.store_id, table.created_at),
|
|
12281
|
-
hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
|
|
12282
|
-
data_key_idx: index("idx_data_key").on(table.data_key)
|
|
12283
|
-
}));
|
|
12284
|
-
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/version-set.js
|
|
12285
|
-
var VersionSetManifestSchema = exports_external.object({
|
|
12286
|
-
package: exports_external.string(),
|
|
12287
|
-
git_sha: exports_external.string().length(40),
|
|
12288
|
-
created_at: exports_external.string().datetime(),
|
|
12289
|
-
builds: exports_external.object({
|
|
12290
|
-
worker: exports_external.object({
|
|
12291
|
-
artifact_ref: exports_external.string(),
|
|
12292
|
-
size_bytes: exports_external.number().int(),
|
|
12293
|
-
compatibility_date: exports_external.string()
|
|
12294
|
-
}),
|
|
12295
|
-
assets: exports_external.object({
|
|
12296
|
-
artifact_ref: exports_external.string().optional(),
|
|
12297
|
-
version_affinity: exports_external.enum(["pinned", "none"]).default("pinned")
|
|
12298
|
-
}).optional()
|
|
12299
|
-
}),
|
|
12300
|
-
migrations: exports_external.object({
|
|
12301
|
-
d1_plan_ref: exports_external.string().optional(),
|
|
12302
|
-
do_migrations: exports_external.array(exports_external.object({
|
|
12303
|
-
class_name: exports_external.string(),
|
|
12304
|
-
tag: exports_external.string(),
|
|
12305
|
-
kind: exports_external.enum([
|
|
12306
|
-
"new_sqlite_classes",
|
|
12307
|
-
"new_classes",
|
|
12308
|
-
"renamed_classes",
|
|
12309
|
-
"deleted_classes",
|
|
12310
|
-
"transferred_classes"
|
|
12311
|
-
])
|
|
12312
|
-
})).default([])
|
|
12313
|
-
}),
|
|
12314
|
-
env_manifest_ref: exports_external.string(),
|
|
12315
|
-
infra_plan_ref: exports_external.string(),
|
|
12316
|
-
grants_ref: exports_external.string().optional(),
|
|
12317
|
-
template_ref: exports_external.string().optional()
|
|
12318
|
-
});
|
|
12319
|
-
// ../api/dist/index.js
|
|
12320
|
-
var ApiError = class _ApiError extends Error {
|
|
12321
|
-
constructor(message, options = {}) {
|
|
12322
|
-
super(message);
|
|
12323
|
-
this.name = "ApiError";
|
|
12324
|
-
this.code = options.code ?? undefined;
|
|
12325
|
-
this.statusCode = options.statusCode ?? undefined;
|
|
12326
|
-
}
|
|
12327
|
-
static fromResponse(response) {
|
|
12328
|
-
return new _ApiError(`API request failed: ${response.statusText}`, {
|
|
12329
|
-
statusCode: response.status
|
|
12330
|
-
});
|
|
12331
|
-
}
|
|
12332
|
-
};
|
|
12333
|
-
var AuthenticationError = class extends ApiError {
|
|
12334
|
-
constructor(message = "Authentication failed") {
|
|
12335
|
-
super(message, { code: "AUTHENTICATION_ERROR" });
|
|
12336
|
-
}
|
|
12337
|
-
};
|
|
12338
|
-
var NetworkError = class extends ApiError {
|
|
12339
|
-
constructor(message = "Network request failed") {
|
|
12340
|
-
super(message, { code: "NETWORK_ERROR" });
|
|
12341
|
-
}
|
|
12342
|
-
};
|
|
12343
|
-
var ValidationError = class extends ApiError {
|
|
12344
|
-
constructor(message = "Validation failed") {
|
|
12345
|
-
super(message, { code: "VALIDATION_ERROR" });
|
|
12346
|
-
}
|
|
12347
|
-
};
|
|
12348
|
-
var HTTP_STATUS = {
|
|
12349
|
-
OK: 200,
|
|
12350
|
-
CREATED: 201,
|
|
12351
|
-
NO_CONTENT: 204,
|
|
12352
|
-
BAD_REQUEST: 400,
|
|
12353
|
-
UNAUTHORIZED: 401,
|
|
12354
|
-
FORBIDDEN: 403,
|
|
12355
|
-
NOT_FOUND: 404,
|
|
12356
|
-
INTERNAL_SERVER_ERROR: 500
|
|
12357
|
-
};
|
|
12358
|
-
function handleHttpResponse(response) {
|
|
12359
|
-
switch (response.status) {
|
|
12360
|
-
case HTTP_STATUS.UNAUTHORIZED:
|
|
12361
|
-
throw new AuthenticationError("Invalid or expired API key");
|
|
12362
|
-
case HTTP_STATUS.NOT_FOUND:
|
|
12363
|
-
throw new ApiError("Resource not found", { statusCode: HTTP_STATUS.NOT_FOUND });
|
|
12364
|
-
case HTTP_STATUS.BAD_REQUEST:
|
|
12365
|
-
break;
|
|
12366
|
-
default:
|
|
12367
|
-
if (!response.ok) {
|
|
12368
|
-
throw new ApiError(`Request failed: ${response.statusText}`, { statusCode: response.status });
|
|
12369
|
-
}
|
|
12370
|
-
}
|
|
12371
|
-
}
|
|
12372
|
-
async function handleResponseError(response) {
|
|
12373
|
-
const errorText = await response.text();
|
|
12374
|
-
const errorMessage = errorText || "Request failed";
|
|
12375
|
-
let parsedError = null;
|
|
12376
|
-
try {
|
|
12377
|
-
parsedError = JSON.parse(errorText);
|
|
12378
|
-
} catch {}
|
|
12379
|
-
if (response.status === HTTP_STATUS.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
|
|
12380
|
-
const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
|
|
12381
|
-
throw new ValidationError(zodErrorDetails);
|
|
12382
|
-
}
|
|
12383
|
-
throw new ApiError(errorMessage, { statusCode: response.status });
|
|
12384
|
-
}
|
|
12385
|
-
function handleNetworkError(error) {
|
|
12386
|
-
const message = error instanceof Error ? error.message : "Unknown network error";
|
|
12387
|
-
throw new NetworkError(message);
|
|
12388
|
-
}
|
|
12389
|
-
var ArrayBufferedQueue = class {
|
|
12390
|
-
constructor(_capacity) {
|
|
12391
|
-
this._capacity = _capacity;
|
|
12392
|
-
this._entries = [];
|
|
12393
|
-
this._head = 0;
|
|
12394
|
-
this._tail = 0;
|
|
12395
|
-
this._size = 0;
|
|
12396
|
-
}
|
|
12397
|
-
latest() {
|
|
12398
|
-
if (this._size === 0)
|
|
12399
|
-
return null;
|
|
12400
|
-
return this._entries[this._tail - 1] ?? null;
|
|
12401
|
-
}
|
|
12402
|
-
list() {
|
|
12403
|
-
if (this._size === 0)
|
|
12404
|
-
return [];
|
|
12405
|
-
if (this._head < this._tail) {
|
|
12406
|
-
return this._entries.slice(this._head, this._tail);
|
|
12407
|
-
}
|
|
12408
|
-
return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
|
|
12409
|
-
}
|
|
12410
|
-
add(item) {
|
|
12411
|
-
if (this._size === this._capacity) {
|
|
12412
|
-
this._head = (this._head + 1) % this._capacity;
|
|
12413
|
-
} else {
|
|
12414
|
-
this._size++;
|
|
12415
|
-
}
|
|
12416
|
-
this._entries[this._tail] = item;
|
|
12417
|
-
this._tail = (this._tail + 1) % this._capacity;
|
|
12418
|
-
}
|
|
12419
|
-
size() {
|
|
12420
|
-
return this._size;
|
|
12421
|
-
}
|
|
12422
|
-
clear() {
|
|
12423
|
-
this._entries = [];
|
|
12424
|
-
this._head = 0;
|
|
12425
|
-
this._tail = 0;
|
|
12426
|
-
this._size = 0;
|
|
12427
|
-
}
|
|
12428
|
-
};
|
|
12429
|
-
var ApiClient = class {
|
|
12430
|
-
constructor(options) {
|
|
12431
|
-
this.category = "api";
|
|
12432
|
-
this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
|
|
12433
|
-
if (this.auth_mode !== "cookie") {
|
|
12434
|
-
if (!options.api_key)
|
|
12435
|
-
throw new Error("API key is required");
|
|
12436
|
-
if (options.api_key.length < 10)
|
|
12437
|
-
throw new Error("API key is too short");
|
|
12438
|
-
}
|
|
12439
|
-
this.base_url = options.base_url;
|
|
12440
|
-
this.api_key = options.api_key ?? "";
|
|
12441
|
-
this.category = options.category || "api";
|
|
12442
|
-
this.credentials = options.credentials;
|
|
12443
|
-
this.default_headers = options.default_headers ?? {};
|
|
12444
|
-
this.custom_fetch = options.custom_fetch;
|
|
12445
|
-
this.request_history = new ArrayBufferedQueue(options.max_history_size ?? 5);
|
|
12446
|
-
this.debug = options.debug ?? false;
|
|
12447
|
-
}
|
|
12448
|
-
buildUrl(path, query) {
|
|
12449
|
-
const url = new URL(`${this.base_url}${path}`);
|
|
12450
|
-
if (query) {
|
|
12451
|
-
Object.entries(query).forEach(([key, value]) => {
|
|
12452
|
-
if (value)
|
|
12453
|
-
url.searchParams.append(key, value);
|
|
12454
|
-
});
|
|
12455
|
-
}
|
|
12456
|
-
return url.toString();
|
|
12457
|
-
}
|
|
12458
|
-
generateRequestId() {
|
|
12459
|
-
return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
12460
|
-
}
|
|
12461
|
-
async request(path, options = {}) {
|
|
12462
|
-
const { method = "GET", headers = {}, body, query } = options;
|
|
12463
|
-
const url = this.buildUrl(path, query);
|
|
12464
|
-
const requestId = this.generateRequestId();
|
|
12465
|
-
const startTime = Date.now();
|
|
12466
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
12467
|
-
if (this.debug) {
|
|
12468
|
-
console.log(`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`, { body, query });
|
|
12469
|
-
}
|
|
12470
|
-
const request_headers = {
|
|
12471
|
-
"Content-Type": "application/json",
|
|
12472
|
-
"X-Request-ID": requestId,
|
|
12473
|
-
...this.default_headers,
|
|
12474
|
-
...headers
|
|
12475
|
-
};
|
|
12476
|
-
if (this.auth_mode === "session") {
|
|
12477
|
-
request_headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
12478
|
-
} else if (this.auth_mode === "key") {
|
|
12479
|
-
request_headers.Authorization = `Bearer ${this.api_key}`;
|
|
12480
|
-
}
|
|
12481
|
-
const historyEntry = {
|
|
12482
|
-
timestamp,
|
|
12483
|
-
method,
|
|
12484
|
-
path,
|
|
12485
|
-
options: { ...options, method },
|
|
12486
|
-
url
|
|
12487
|
-
};
|
|
12488
|
-
try {
|
|
12489
|
-
const fetchOptions = {
|
|
12490
|
-
method,
|
|
12491
|
-
headers: request_headers
|
|
12492
|
-
};
|
|
12493
|
-
if (body) {
|
|
12494
|
-
fetchOptions.body = JSON.stringify(body);
|
|
12495
|
-
}
|
|
12496
|
-
if (this.credentials) {
|
|
12497
|
-
fetchOptions.credentials = this.credentials;
|
|
12498
|
-
} else if (this.auth_mode === "cookie") {
|
|
12499
|
-
fetchOptions.credentials = "include";
|
|
12500
|
-
}
|
|
12501
|
-
const fetcher = this.custom_fetch ?? fetch;
|
|
12502
|
-
const response = await fetcher(url, fetchOptions);
|
|
12503
|
-
const duration = Date.now() - startTime;
|
|
12504
|
-
historyEntry.status = response.status;
|
|
12505
|
-
historyEntry.duration = duration;
|
|
12506
|
-
if (!response.ok) {
|
|
12507
|
-
if (this.debug) {
|
|
12508
|
-
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
12509
|
-
status: response.status,
|
|
12510
|
-
duration: `${duration}ms`,
|
|
12511
|
-
body,
|
|
12512
|
-
query
|
|
12513
|
-
});
|
|
12514
|
-
}
|
|
12515
|
-
try {
|
|
12516
|
-
handleHttpResponse(response);
|
|
12517
|
-
await handleResponseError(response);
|
|
12518
|
-
} catch (error) {
|
|
12519
|
-
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
12520
|
-
historyEntry.error = errorMessage;
|
|
12521
|
-
this.request_history.add(historyEntry);
|
|
12522
|
-
throw error;
|
|
12523
|
-
}
|
|
12524
|
-
}
|
|
12525
|
-
this.request_history.add(historyEntry);
|
|
12526
|
-
let result;
|
|
12527
|
-
if (response.status === HTTP_STATUS.NO_CONTENT) {
|
|
12528
|
-
result = undefined;
|
|
12529
|
-
} else {
|
|
12530
|
-
const text2 = await response.text();
|
|
12531
|
-
if (!text2 || text2.trim() === "" || text2.trim() === "null") {
|
|
12532
|
-
result = undefined;
|
|
12533
|
-
} else {
|
|
12534
|
-
try {
|
|
12535
|
-
result = JSON.parse(text2);
|
|
12536
|
-
} catch (parseError) {
|
|
12537
|
-
result = text2;
|
|
12538
|
-
}
|
|
12539
|
-
}
|
|
12540
|
-
}
|
|
12541
|
-
if (this.debug) {
|
|
12542
|
-
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
12543
|
-
status: response.status,
|
|
12544
|
-
duration: `${duration}ms`
|
|
12545
|
-
});
|
|
12546
|
-
}
|
|
12547
|
-
return result;
|
|
12548
|
-
} catch (error) {
|
|
12549
|
-
const duration = Date.now() - startTime;
|
|
12550
|
-
if (this.debug) {
|
|
12551
|
-
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
12552
|
-
url,
|
|
12553
|
-
duration: `${duration}ms`,
|
|
12554
|
-
error: error instanceof Error ? error.message : String(error),
|
|
12555
|
-
body,
|
|
12556
|
-
query
|
|
12557
|
-
});
|
|
12558
|
-
}
|
|
12559
|
-
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
12560
|
-
throw error;
|
|
12561
|
-
}
|
|
12562
|
-
historyEntry.duration = duration;
|
|
12563
|
-
try {
|
|
12564
|
-
handleNetworkError(error);
|
|
12565
|
-
} catch (networkError) {
|
|
12566
|
-
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
12567
|
-
historyEntry.error = errorMessage;
|
|
12568
|
-
this.request_history.add(historyEntry);
|
|
12569
|
-
throw networkError;
|
|
12570
|
-
}
|
|
12571
|
-
}
|
|
12572
|
-
}
|
|
12573
|
-
get(path, options = {}) {
|
|
12574
|
-
return this.request(path, { ...options, method: "GET" });
|
|
12575
|
-
}
|
|
12576
|
-
post(path, options = {}) {
|
|
12577
|
-
return this.request(path, { ...options, method: "POST" });
|
|
12578
|
-
}
|
|
12579
|
-
patch(path, options = {}) {
|
|
12580
|
-
return this.request(path, { ...options, method: "PATCH" });
|
|
12581
|
-
}
|
|
12582
|
-
put(path, options = {}) {
|
|
12583
|
-
return this.request(path, { ...options, method: "PUT" });
|
|
12584
|
-
}
|
|
12585
|
-
delete(path, options = {}) {
|
|
12586
|
-
return this.request(path, { ...options, method: "DELETE" });
|
|
12587
|
-
}
|
|
12588
|
-
history() {
|
|
12589
|
-
return this.request_history;
|
|
12590
|
-
}
|
|
12591
|
-
url() {
|
|
12592
|
-
return this.base_url;
|
|
12593
|
-
}
|
|
12594
|
-
headers() {
|
|
12595
|
-
const headers = {
|
|
12596
|
-
"Content-Type": "application/json"
|
|
12597
|
-
};
|
|
12598
|
-
if (this.auth_mode === "session") {
|
|
12599
|
-
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
12600
|
-
} else if (this.auth_mode === "key") {
|
|
12601
|
-
headers["X-API-KEY"] = this.api_key;
|
|
12602
|
-
}
|
|
12603
|
-
return headers;
|
|
12604
|
-
}
|
|
12605
|
-
};
|
|
12606
|
-
function wrap(fn) {
|
|
12607
|
-
return fn().then((data) => ok(data)).catch((error) => err({
|
|
12608
|
-
message: error.message || "Unknown error",
|
|
12609
|
-
code: error.code,
|
|
12610
|
-
status_code: error.statusCode || error.status_code
|
|
12611
|
-
}));
|
|
12612
|
-
}
|
|
12613
|
-
var ApiClient2 = class {
|
|
12614
|
-
constructor(options) {
|
|
12615
|
-
this.auth = {
|
|
12616
|
-
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
12617
|
-
keys: {
|
|
12618
|
-
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
12619
|
-
create: (input) => {
|
|
12620
|
-
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
12621
|
-
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
12622
|
-
},
|
|
12623
|
-
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
12624
|
-
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
12625
|
-
}
|
|
12626
|
-
};
|
|
12627
|
-
this.projects = {
|
|
12628
|
-
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
12629
|
-
map: async (filters) => wrap(async () => {
|
|
12630
|
-
const result = await this.projects.list(filters);
|
|
12631
|
-
if (!result.ok)
|
|
12632
|
-
throw new Error(result.error.message);
|
|
12633
|
-
return result.value.reduce((acc, project2) => {
|
|
12634
|
-
acc[project2.id] = project2;
|
|
12635
|
-
return acc;
|
|
12636
|
-
}, {});
|
|
12637
|
-
}),
|
|
12638
|
-
find: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
|
|
12639
|
-
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
12640
|
-
getById: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
|
|
12641
|
-
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
12642
|
-
update: async (idOrData, changes) => wrap(async () => {
|
|
12643
|
-
if (typeof idOrData === "object" && idOrData.id) {
|
|
12644
|
-
return this.clients.projects.patch("/projects", {
|
|
12645
|
-
body: idOrData
|
|
12646
|
-
});
|
|
12647
|
-
}
|
|
12648
|
-
const id2 = idOrData;
|
|
12649
|
-
if (!changes) {
|
|
12650
|
-
throw new Error("Changes parameter required for update");
|
|
12651
|
-
}
|
|
12652
|
-
const result = await this.projects.find(id2);
|
|
12653
|
-
if (!result.ok)
|
|
12654
|
-
throw new Error(result.error.message);
|
|
12655
|
-
if (!result.value)
|
|
12656
|
-
throw new Error(`Project with id ${id2} not found`);
|
|
12657
|
-
const project2 = result.value;
|
|
12658
|
-
const updateData = {
|
|
12659
|
-
id: project2.id,
|
|
12660
|
-
project_id: project2.project_id,
|
|
12661
|
-
owner_id: project2.owner_id,
|
|
12662
|
-
name: project2.name,
|
|
12663
|
-
description: project2.description,
|
|
12664
|
-
specification: project2.specification,
|
|
12665
|
-
repo_url: project2.repo_url,
|
|
12666
|
-
repo_id: project2.repo_id,
|
|
12667
|
-
icon_url: project2.icon_url,
|
|
12668
|
-
status: project2.status,
|
|
12669
|
-
deleted: project2.deleted,
|
|
12670
|
-
link_url: project2.link_url,
|
|
12671
|
-
link_text: project2.link_text,
|
|
12672
|
-
visibility: project2.visibility,
|
|
12673
|
-
current_version: project2.current_version,
|
|
12674
|
-
...changes
|
|
12675
|
-
};
|
|
12676
|
-
return this.clients.projects.patch("/projects", {
|
|
12677
|
-
body: updateData
|
|
12678
|
-
});
|
|
12679
|
-
}),
|
|
12680
|
-
config: {
|
|
12681
|
-
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
12682
|
-
query: { project_id }
|
|
12683
|
-
})),
|
|
12684
|
-
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
12685
|
-
body: request
|
|
12686
|
-
}))
|
|
12687
|
-
},
|
|
12688
|
-
scan: {
|
|
12689
|
-
initiate: async (project_id) => {
|
|
12690
|
-
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
12691
|
-
method: "POST",
|
|
12692
|
-
headers: this.clients.projects.headers()
|
|
12693
|
-
});
|
|
12694
|
-
if (!response.body) {
|
|
12695
|
-
throw new Error("No response body");
|
|
12696
|
-
}
|
|
12697
|
-
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
12698
|
-
return stream;
|
|
12699
|
-
},
|
|
12700
|
-
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
12701
|
-
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
12702
|
-
query: { project_id },
|
|
12703
|
-
body: data
|
|
12704
|
-
}))
|
|
12705
|
-
},
|
|
12706
|
-
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
12707
|
-
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
12708
|
-
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
12709
|
-
query: { project_id }
|
|
12710
|
-
})),
|
|
12711
|
-
deleteProject: (project2) => wrap(() => this.clients.projects.patch("/projects", {
|
|
12712
|
-
body: { ...project2, deleted: true }
|
|
12713
|
-
}))
|
|
12714
|
-
};
|
|
12715
|
-
this.milestones = {
|
|
12716
|
-
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
12717
|
-
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
12718
|
-
find: (id2) => wrap(async () => {
|
|
12719
|
-
try {
|
|
12720
|
-
return await this.clients.milestones.get(`/milestones/${id2}`);
|
|
12721
|
-
} catch (error) {
|
|
12722
|
-
return null;
|
|
12723
|
-
}
|
|
12724
|
-
}),
|
|
12725
|
-
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
12726
|
-
update: async (id2, data) => wrap(async () => {
|
|
12727
|
-
const result = await this.milestones.find(id2);
|
|
12728
|
-
if (!result.ok)
|
|
12729
|
-
throw new Error(result.error.message);
|
|
12730
|
-
if (!result.value)
|
|
12731
|
-
throw new Error(`Milestone with id ${id2} not found`);
|
|
12732
|
-
const milestone2 = result.value;
|
|
12733
|
-
const updateData = {
|
|
12734
|
-
id: milestone2.id,
|
|
12735
|
-
project_id: milestone2.project_id,
|
|
12736
|
-
name: data.name ?? milestone2.name,
|
|
12737
|
-
description: data.description ?? milestone2.description,
|
|
12738
|
-
target_time: data.target_time ?? milestone2.target_time,
|
|
12739
|
-
target_version: data.target_version ?? milestone2.target_version,
|
|
12740
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : milestone2.finished_at
|
|
12741
|
-
};
|
|
12742
|
-
return this.clients.milestones.patch(`/milestones/${id2}`, {
|
|
12743
|
-
body: updateData
|
|
12744
|
-
});
|
|
12745
|
-
}),
|
|
12746
|
-
delete: (id2) => wrap(() => this.clients.milestones.delete(`/milestones/${id2}`)),
|
|
12747
|
-
goals: (id2) => wrap(() => this.clients.milestones.get(`/milestones/${id2}/goals`))
|
|
12748
|
-
};
|
|
12749
|
-
this.goals = {
|
|
12750
|
-
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
12751
|
-
find: (id2) => wrap(() => this.clients.goals.get(`/goals/${id2}`)),
|
|
12752
|
-
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
12753
|
-
update: async (id2, data) => wrap(async () => {
|
|
12754
|
-
const result = await this.goals.find(id2);
|
|
12755
|
-
if (!result.ok)
|
|
12756
|
-
throw new Error(result.error.message);
|
|
12757
|
-
if (!result.value)
|
|
12758
|
-
throw new Error(`Goal with id ${id2} not found`);
|
|
12759
|
-
const goal2 = result.value;
|
|
12760
|
-
const updateData = {
|
|
12761
|
-
id: goal2.id,
|
|
12762
|
-
milestone_id: goal2.milestone_id,
|
|
12763
|
-
name: data.name ?? goal2.name,
|
|
12764
|
-
description: data.description ?? goal2.description,
|
|
12765
|
-
target_time: data.target_time ?? goal2.target_time,
|
|
12766
|
-
finished_at: data.finished_at !== undefined ? data.finished_at : goal2.finished_at
|
|
12767
|
-
};
|
|
12768
|
-
return this.clients.goals.patch(`/goals/${id2}`, {
|
|
12769
|
-
body: updateData
|
|
12770
|
-
});
|
|
12771
|
-
}),
|
|
12772
|
-
delete: (id2) => wrap(() => this.clients.goals.delete(`/goals/${id2}`))
|
|
12773
|
-
};
|
|
12774
|
-
this.tasks = {
|
|
12775
|
-
list: (filters) => wrap(() => {
|
|
12776
|
-
const query = {};
|
|
12777
|
-
if (filters?.project_id)
|
|
12778
|
-
query.project = filters.project_id;
|
|
12779
|
-
if (filters?.tag_id)
|
|
12780
|
-
query.tag = filters.tag_id;
|
|
12781
|
-
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
12782
|
-
}),
|
|
12783
|
-
find: (id2) => wrap(() => this.clients.tasks.get("/tasks", { query: { id: id2 } })),
|
|
12784
|
-
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
12785
|
-
query: { project: project_id }
|
|
12786
|
-
})),
|
|
12787
|
-
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
12788
|
-
update: async (id2, changes) => wrap(async () => {
|
|
12789
|
-
const result = await this.tasks.find(id2);
|
|
12790
|
-
if (!result.ok)
|
|
12791
|
-
throw new Error(result.error.message);
|
|
12792
|
-
if (!result.value)
|
|
12793
|
-
throw new Error(`Task with id ${id2} not found`);
|
|
12794
|
-
const task2 = result.value;
|
|
12795
|
-
const updateData = {
|
|
12796
|
-
id: id2,
|
|
12797
|
-
title: task2.task.title,
|
|
12798
|
-
summary: task2.task.summary,
|
|
12799
|
-
description: task2.task.description,
|
|
12800
|
-
progress: task2.task.progress,
|
|
12801
|
-
visibility: task2.task.visibility,
|
|
12802
|
-
start_time: task2.task.start_time,
|
|
12803
|
-
end_time: task2.task.end_time,
|
|
12804
|
-
priority: task2.task.priority,
|
|
12805
|
-
owner_id: task2.task.owner_id,
|
|
12806
|
-
project_id: task2.task.project_id,
|
|
12807
|
-
...changes
|
|
12808
|
-
};
|
|
12809
|
-
return this.clients.tasks.patch("/tasks", {
|
|
12810
|
-
body: updateData
|
|
12811
|
-
});
|
|
12812
|
-
}),
|
|
12813
|
-
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
12814
|
-
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
12815
|
-
deleteTask: (task2) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
12816
|
-
body: { ...task2.task, deleted: true }
|
|
12817
|
-
})),
|
|
12818
|
-
history: {
|
|
12819
|
-
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
12820
|
-
}
|
|
12821
|
-
};
|
|
12822
|
-
this.tags = {
|
|
12823
|
-
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
12824
|
-
};
|
|
12825
|
-
this.github = {
|
|
12826
|
-
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
12827
|
-
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
12828
|
-
};
|
|
12829
|
-
this.blog = {
|
|
12830
|
-
posts: {
|
|
12831
|
-
list: (params) => wrap(() => {
|
|
12832
|
-
const query = {};
|
|
12833
|
-
if (params?.category)
|
|
12834
|
-
query.category = params.category;
|
|
12835
|
-
if (params?.tag)
|
|
12836
|
-
query.tag = params.tag;
|
|
12837
|
-
if (params?.project)
|
|
12838
|
-
query.project = params.project;
|
|
12839
|
-
if (params?.status)
|
|
12840
|
-
query.status = params.status;
|
|
12841
|
-
if (params?.archived !== undefined)
|
|
12842
|
-
query.archived = String(params.archived);
|
|
12843
|
-
if (params?.limit)
|
|
12844
|
-
query.limit = String(params.limit);
|
|
12845
|
-
if (params?.offset !== undefined)
|
|
12846
|
-
query.offset = String(params.offset);
|
|
12847
|
-
if (params?.sort)
|
|
12848
|
-
query.sort = params.sort;
|
|
12849
|
-
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
12850
|
-
}),
|
|
12851
|
-
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
12852
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
12853
|
-
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
12854
|
-
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
12855
|
-
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
12856
|
-
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
12857
|
-
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
12858
|
-
},
|
|
12859
|
-
tags: {
|
|
12860
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
12861
|
-
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
12862
|
-
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
12863
|
-
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
12864
|
-
removeFromPost: (uuid, tag2) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag2}`))
|
|
12865
|
-
},
|
|
12866
|
-
categories: {
|
|
12867
|
-
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
12868
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
12869
|
-
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
12870
|
-
body: data
|
|
12871
|
-
})),
|
|
12872
|
-
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
12873
|
-
},
|
|
12874
|
-
tokens: {
|
|
12875
|
-
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
12876
|
-
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
12877
|
-
update: (id2, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id2}`, {
|
|
12878
|
-
body: data
|
|
12879
|
-
})),
|
|
12880
|
-
delete: (id2) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id2}`))
|
|
12881
|
-
}
|
|
12882
|
-
};
|
|
12883
|
-
this.media = {
|
|
12884
|
-
profiles: {
|
|
12885
|
-
list: () => wrap(async () => {
|
|
12886
|
-
const res = await this.clients.media.get("/profiles");
|
|
12887
|
-
return res.profiles;
|
|
12888
|
-
}),
|
|
12889
|
-
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
12890
|
-
get: (id2) => wrap(() => this.clients.media.get(`/profiles/${id2}`)),
|
|
12891
|
-
update: (id2, data) => wrap(() => this.clients.media.patch(`/profiles/${id2}`, { body: data })),
|
|
12892
|
-
delete: (id2) => wrap(() => this.clients.media.delete(`/profiles/${id2}`)),
|
|
12893
|
-
filters: {
|
|
12894
|
-
list: (profile_id) => wrap(async () => {
|
|
12895
|
-
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
12896
|
-
return res.filters;
|
|
12897
|
-
}),
|
|
12898
|
-
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
12899
|
-
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
12900
|
-
},
|
|
12901
|
-
timeline: (slug, params) => wrap(() => {
|
|
12902
|
-
const query = {};
|
|
12903
|
-
if (params?.limit)
|
|
12904
|
-
query.limit = String(params.limit);
|
|
12905
|
-
if (params?.before)
|
|
12906
|
-
query.before = params.before;
|
|
12907
|
-
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
12908
|
-
})
|
|
12909
|
-
},
|
|
12910
|
-
connections: {
|
|
12911
|
-
list: (profile_id, options2) => wrap(async () => {
|
|
12912
|
-
const query = { profile_id };
|
|
12913
|
-
if (options2?.include_settings)
|
|
12914
|
-
query.include_settings = "true";
|
|
12915
|
-
const res = await this.clients.media.get("/connections", { query });
|
|
12916
|
-
return res.accounts;
|
|
12917
|
-
}),
|
|
12918
|
-
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
12919
|
-
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
12920
|
-
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
12921
|
-
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
12922
|
-
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
12923
|
-
body: { is_active }
|
|
12924
|
-
})),
|
|
12925
|
-
settings: {
|
|
12926
|
-
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
12927
|
-
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
12928
|
-
body: { settings }
|
|
12929
|
-
}))
|
|
12930
|
-
},
|
|
12931
|
-
repos: (account_id) => wrap(async () => {
|
|
12932
|
-
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
12933
|
-
return res.repos;
|
|
12934
|
-
}),
|
|
12935
|
-
subreddits: (account_id) => wrap(async () => {
|
|
12936
|
-
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
12937
|
-
return res.subreddits;
|
|
12938
|
-
})
|
|
12939
|
-
},
|
|
12940
|
-
credentials: {
|
|
12941
|
-
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
12942
|
-
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
12943
|
-
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
12944
|
-
},
|
|
12945
|
-
timeline: {
|
|
12946
|
-
get: (user_id, params) => wrap(() => {
|
|
12947
|
-
const query = {};
|
|
12948
|
-
if (params?.from)
|
|
12949
|
-
query.from = params.from;
|
|
12950
|
-
if (params?.to)
|
|
12951
|
-
query.to = params.to;
|
|
12952
|
-
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
12953
|
-
}),
|
|
12954
|
-
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
12955
|
-
query: { account_id }
|
|
12956
|
-
}))
|
|
12957
|
-
}
|
|
12958
|
-
};
|
|
12959
|
-
this.activity = {
|
|
12960
|
-
ai: (options2) => wrap(() => {
|
|
12961
|
-
const query = {};
|
|
12962
|
-
if (options2?.limit)
|
|
12963
|
-
query.limit = String(options2.limit);
|
|
12964
|
-
if (options2?.since)
|
|
12965
|
-
query.since = options2.since;
|
|
12966
|
-
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
12967
|
-
})
|
|
12968
|
-
};
|
|
12969
|
-
this.user = {
|
|
12970
|
-
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
12971
|
-
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
|
|
12972
|
-
};
|
|
12973
|
-
this.pulse = {
|
|
12974
|
-
summary: (input) => wrap(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
12975
|
-
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
12976
|
-
})),
|
|
12977
|
-
events: (input) => wrap(() => {
|
|
12978
|
-
const query = {};
|
|
12979
|
-
if (input.name)
|
|
12980
|
-
query.name = input.name;
|
|
12981
|
-
if (input.level)
|
|
12982
|
-
query.level = input.level;
|
|
12983
|
-
if (typeof input.ts_from === "number")
|
|
12984
|
-
query.ts_from = String(input.ts_from);
|
|
12985
|
-
if (typeof input.ts_to === "number")
|
|
12986
|
-
query.ts_to = String(input.ts_to);
|
|
12987
|
-
if (input.search)
|
|
12988
|
-
query.search = input.search;
|
|
12989
|
-
if (input.limit)
|
|
12990
|
-
query.limit = String(input.limit);
|
|
12991
|
-
if (input.cursor)
|
|
12992
|
-
query.cursor = input.cursor;
|
|
12993
|
-
return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
|
|
12994
|
-
}),
|
|
12995
|
-
errors: (input) => wrap(() => {
|
|
12996
|
-
const query = {};
|
|
12997
|
-
if (typeof input.range === "string") {
|
|
12998
|
-
query.range = input.range;
|
|
12999
|
-
} else {
|
|
13000
|
-
query.from = String(input.range.from);
|
|
13001
|
-
query.to = String(input.range.to);
|
|
13002
|
-
}
|
|
13003
|
-
if (input.group_by_fingerprint)
|
|
13004
|
-
query.group_by_fingerprint = "true";
|
|
13005
|
-
return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
|
|
13006
|
-
}),
|
|
13007
|
-
logs: (input) => wrap(() => {
|
|
13008
|
-
const query = {};
|
|
13009
|
-
if (typeof input.range === "string") {
|
|
13010
|
-
query.range = input.range;
|
|
13011
|
-
} else {
|
|
13012
|
-
query.from = String(input.range.from);
|
|
13013
|
-
query.to = String(input.range.to);
|
|
13014
|
-
}
|
|
13015
|
-
if (input.level)
|
|
13016
|
-
query.level = input.level;
|
|
13017
|
-
if (input.search)
|
|
13018
|
-
query.search = input.search;
|
|
13019
|
-
return this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
13020
|
-
}),
|
|
13021
|
-
latency: (input) => wrap(() => {
|
|
13022
|
-
const query = {};
|
|
13023
|
-
if (typeof input.range === "string") {
|
|
13024
|
-
query.range = input.range;
|
|
13025
|
-
} else {
|
|
13026
|
-
query.from = String(input.range.from);
|
|
13027
|
-
query.to = String(input.range.to);
|
|
13028
|
-
}
|
|
13029
|
-
if (input.route)
|
|
13030
|
-
query.route = input.route;
|
|
13031
|
-
if (input.percentiles && input.percentiles.length > 0)
|
|
13032
|
-
query.percentiles = input.percentiles.join(",");
|
|
13033
|
-
return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
|
|
13034
|
-
}),
|
|
13035
|
-
subs: {
|
|
13036
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
13037
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
13038
|
-
body: {
|
|
13039
|
-
project_id: input.project_id,
|
|
13040
|
-
name: input.name,
|
|
13041
|
-
filter: input.filter,
|
|
13042
|
-
channel: input.channel,
|
|
13043
|
-
cooldown_seconds: input.cooldown_seconds
|
|
13044
|
-
}
|
|
13045
|
-
})),
|
|
13046
|
-
get: (id2) => wrap(() => this.clients.pulse.get(`/admin/subs/${id2}`)),
|
|
13047
|
-
update: (id2, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id2}`, { body: patch })),
|
|
13048
|
-
delete: (id2) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id2}`))
|
|
13049
|
-
},
|
|
13050
|
-
keys: {
|
|
13051
|
-
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
13052
|
-
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
13053
|
-
body: {
|
|
13054
|
-
project_id: input.project_id,
|
|
13055
|
-
name: input.name,
|
|
13056
|
-
rate_limit_per_min: input.rate_limit_per_min
|
|
13057
|
-
}
|
|
13058
|
-
})),
|
|
13059
|
-
delete: (id2, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id2}`, { query: { project_id: input.project_id } }))
|
|
13060
|
-
}
|
|
13061
|
-
};
|
|
13062
|
-
this.pipelines = {
|
|
13063
|
-
list: (filter) => {
|
|
13064
|
-
const query = {};
|
|
13065
|
-
if (filter?.package_id !== undefined)
|
|
13066
|
-
query.package_id = filter.package_id;
|
|
13067
|
-
if (filter?.status !== undefined)
|
|
13068
|
-
query.status = filter.status;
|
|
13069
|
-
if (filter?.limit !== undefined)
|
|
13070
|
-
query.limit = String(filter.limit);
|
|
13071
|
-
return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
13072
|
-
},
|
|
13073
|
-
get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
13074
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
|
|
13075
|
-
body: input
|
|
13076
|
-
})),
|
|
13077
|
-
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
13078
|
-
body: input
|
|
13079
|
-
})),
|
|
13080
|
-
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
13081
|
-
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
13082
|
-
grants: {
|
|
13083
|
-
list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
|
|
13084
|
-
query: package_id ? { package_id } : {}
|
|
13085
|
-
})),
|
|
13086
|
-
approve: (grant_id, user_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
13087
|
-
body: { user_id }
|
|
13088
|
-
})),
|
|
13089
|
-
deny: (grant_id, user_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
13090
|
-
body: { user_id, reason }
|
|
13091
|
-
}))
|
|
13092
|
-
},
|
|
13093
|
-
packages: {
|
|
13094
|
-
list: (filter) => {
|
|
13095
|
-
const query = {};
|
|
13096
|
-
if (filter?.project_id !== undefined)
|
|
13097
|
-
query.project_id = filter.project_id;
|
|
13098
|
-
return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
13099
|
-
},
|
|
13100
|
-
get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
13101
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
13102
|
-
update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
13103
|
-
delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
13104
|
-
},
|
|
13105
|
-
oidc_trust: {
|
|
13106
|
-
list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
13107
|
-
get: (id2, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } })),
|
|
13108
|
-
create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
13109
|
-
update: (id2, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id2}`, { body: input })),
|
|
13110
|
-
delete: (id2, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } }))
|
|
13111
|
-
}
|
|
13112
|
-
};
|
|
13113
|
-
const base_url = options.base_url || "http://localhost:4321/api/v1";
|
|
13114
|
-
this._api_key = options.api_key ?? "";
|
|
13115
|
-
this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
|
|
13116
|
-
const clientOptions = {
|
|
13117
|
-
base_url,
|
|
13118
|
-
api_key: options.api_key,
|
|
13119
|
-
max_history_size: options.max_history_size,
|
|
13120
|
-
auth_mode: this._auth_mode,
|
|
13121
|
-
credentials: options.credentials,
|
|
13122
|
-
default_headers: options.default_headers,
|
|
13123
|
-
custom_fetch: options.custom_fetch
|
|
13124
|
-
};
|
|
13125
|
-
const auth_base_url = base_url.replace(/\/v1\/?$/, "");
|
|
13126
|
-
this.clients = {
|
|
13127
|
-
auth: new ApiClient({ ...clientOptions, category: "auth" }),
|
|
13128
|
-
auth_root: new ApiClient({
|
|
13129
|
-
...clientOptions,
|
|
13130
|
-
base_url: auth_base_url,
|
|
13131
|
-
category: "auth"
|
|
13132
|
-
}),
|
|
13133
|
-
projects: new ApiClient({ ...clientOptions, category: "projects" }),
|
|
13134
|
-
tasks: new ApiClient({ ...clientOptions, category: "tasks" }),
|
|
13135
|
-
milestones: new ApiClient({ ...clientOptions, category: "milestones" }),
|
|
13136
|
-
goals: new ApiClient({ ...clientOptions, category: "goals" }),
|
|
13137
|
-
github: new ApiClient({ ...clientOptions, category: "github" }),
|
|
13138
|
-
tags: new ApiClient({ ...clientOptions, category: "tags" }),
|
|
13139
|
-
blog: new ApiClient({ ...clientOptions, category: "blog" }),
|
|
13140
|
-
media: new ApiClient({ ...clientOptions, category: "media" }),
|
|
13141
|
-
pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" }),
|
|
13142
|
-
pipelines: new ApiClient({ ...clientOptions, category: "pipelines" })
|
|
13143
|
-
};
|
|
13144
|
-
}
|
|
13145
|
-
history() {
|
|
13146
|
-
return this.clients.projects.history();
|
|
13147
|
-
}
|
|
13148
|
-
getApiKey() {
|
|
13149
|
-
return this._api_key;
|
|
13150
|
-
}
|
|
13151
|
-
getAuthMode() {
|
|
13152
|
-
return this._auth_mode;
|
|
13153
|
-
}
|
|
13154
|
-
};
|
|
13155
|
-
var timestamps = () => ({
|
|
13156
|
-
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
13157
|
-
updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
11924
|
+
// ../api/dist/chunk-TEOIDOOX.js
|
|
11925
|
+
var timestamps = () => ({
|
|
11926
|
+
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
11927
|
+
updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
13158
11928
|
});
|
|
13159
11929
|
var deleted = () => ({
|
|
13160
11930
|
deleted: int("deleted", { mode: "boolean" }).notNull().default(false)
|
|
@@ -13404,7 +12174,8 @@ var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
|
|
|
13404
12174
|
stage_name: text("stage_name").notNull(),
|
|
13405
12175
|
kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
|
|
13406
12176
|
payload: text("payload", { mode: "json" }),
|
|
13407
|
-
ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
12177
|
+
ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
12178
|
+
idempotency_hash: text("idempotency_hash")
|
|
13408
12179
|
});
|
|
13409
12180
|
var pipeline_grant = sqliteTable("pipeline_grant", {
|
|
13410
12181
|
...entity("pipeline-grant"),
|
|
@@ -13527,9 +12298,1293 @@ var pipeline_approval_relations = relations(pipeline_approval, ({ one }) => ({
|
|
|
13527
12298
|
var pipeline_analysis_template_relations = relations(pipeline_analysis_template, ({ one }) => ({
|
|
13528
12299
|
owner: one(user, { fields: [pipeline_analysis_template.owner_id], references: [user.id] })
|
|
13529
12300
|
}));
|
|
13530
|
-
var pipeline_oidc_trust_relations = relations(pipeline_oidc_trust, ({ one }) => ({
|
|
13531
|
-
owner: one(user, { fields: [pipeline_oidc_trust.owner_id], references: [user.id] })
|
|
12301
|
+
var pipeline_oidc_trust_relations = relations(pipeline_oidc_trust, ({ one }) => ({
|
|
12302
|
+
owner: one(user, { fields: [pipeline_oidc_trust.owner_id], references: [user.id] })
|
|
12303
|
+
}));
|
|
12304
|
+
var upsert_project = exports_external.object({
|
|
12305
|
+
id: exports_external.string().optional().nullable(),
|
|
12306
|
+
project_id: exports_external.string(),
|
|
12307
|
+
owner_id: exports_external.string().optional(),
|
|
12308
|
+
name: exports_external.string(),
|
|
12309
|
+
description: exports_external.string().nullable(),
|
|
12310
|
+
specification: exports_external.string().nullable(),
|
|
12311
|
+
repo_url: exports_external.string().nullable(),
|
|
12312
|
+
repo_id: exports_external.number().nullable(),
|
|
12313
|
+
icon_url: exports_external.string().nullable(),
|
|
12314
|
+
status: exports_external.union([exports_external.literal("DEVELOPMENT"), exports_external.literal("PAUSED"), exports_external.literal("RELEASED"), exports_external.literal("LIVE"), exports_external.literal("FINISHED"), exports_external.literal("ABANDONED"), exports_external.literal("STOPPED")]).optional(),
|
|
12315
|
+
deleted: exports_external.boolean().optional().default(false),
|
|
12316
|
+
link_url: exports_external.string().nullable(),
|
|
12317
|
+
link_text: exports_external.string().nullable(),
|
|
12318
|
+
visibility: exports_external.union([exports_external.literal("PUBLIC"), exports_external.literal("PRIVATE"), exports_external.literal("HIDDEN"), exports_external.literal("ARCHIVED"), exports_external.literal("DRAFT"), exports_external.literal("DELETED")]).optional(),
|
|
12319
|
+
current_version: exports_external.string().nullable(),
|
|
12320
|
+
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
12321
|
+
});
|
|
12322
|
+
var upsert_todo = exports_external.object({
|
|
12323
|
+
id: exports_external.string().optional().nullable(),
|
|
12324
|
+
title: exports_external.string().optional(),
|
|
12325
|
+
summary: exports_external.string().optional().nullable(),
|
|
12326
|
+
description: exports_external.string().optional().nullable(),
|
|
12327
|
+
progress: exports_external.union([exports_external.literal("UNSTARTED"), exports_external.literal("IN_PROGRESS"), exports_external.literal("COMPLETED")]).optional(),
|
|
12328
|
+
visibility: exports_external.union([exports_external.literal("PUBLIC"), exports_external.literal("PRIVATE"), exports_external.literal("HIDDEN"), exports_external.literal("ARCHIVED"), exports_external.literal("DRAFT"), exports_external.literal("DELETED")]).optional(),
|
|
12329
|
+
start_time: exports_external.string().optional().nullable(),
|
|
12330
|
+
end_time: exports_external.string().optional().nullable(),
|
|
12331
|
+
priority: exports_external.union([exports_external.literal("LOW"), exports_external.literal("MEDIUM"), exports_external.literal("HIGH")]).optional(),
|
|
12332
|
+
owner_id: exports_external.string(),
|
|
12333
|
+
project_id: exports_external.string().optional().nullable(),
|
|
12334
|
+
goal_id: exports_external.string().optional().nullable(),
|
|
12335
|
+
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
12336
|
+
});
|
|
12337
|
+
var update_action = exports_external.union([exports_external.literal("CONFIRM"), exports_external.literal("UNLINK"), exports_external.literal("CREATE"), exports_external.literal("IGNORE"), exports_external.literal("DELETE"), exports_external.literal("COMPLETE")]);
|
|
12338
|
+
var upsert_tag = exports_external.object({
|
|
12339
|
+
id: exports_external.string().optional(),
|
|
12340
|
+
title: exports_external.string(),
|
|
12341
|
+
color: exports_external.union([exports_external.literal("red"), exports_external.literal("green"), exports_external.literal("blue"), exports_external.literal("yellow"), exports_external.literal("purple"), exports_external.literal("orange"), exports_external.literal("teal"), exports_external.literal("pink"), exports_external.literal("gray"), exports_external.literal("cyan"), exports_external.literal("lime")]).nullable().optional(),
|
|
12342
|
+
deleted: exports_external.boolean().optional().default(false),
|
|
12343
|
+
render: exports_external.boolean().optional().default(true),
|
|
12344
|
+
owner_id: exports_external.string()
|
|
12345
|
+
});
|
|
12346
|
+
var project_config = exports_external.object({
|
|
12347
|
+
tags: exports_external.array(exports_external.object({
|
|
12348
|
+
name: exports_external.string(),
|
|
12349
|
+
match: exports_external.array(exports_external.string())
|
|
12350
|
+
})),
|
|
12351
|
+
ignore: exports_external.array(exports_external.string())
|
|
12352
|
+
});
|
|
12353
|
+
var save_config_request = exports_external.object({
|
|
12354
|
+
id: exports_external.string(),
|
|
12355
|
+
config: project_config,
|
|
12356
|
+
scan_branch: exports_external.string().optional()
|
|
12357
|
+
});
|
|
12358
|
+
var save_tags_request = exports_external.array(upsert_tag);
|
|
12359
|
+
var update_user = exports_external.object({
|
|
12360
|
+
id: exports_external.string(),
|
|
12361
|
+
name: exports_external.string().optional(),
|
|
12362
|
+
image_url: exports_external.string().optional(),
|
|
12363
|
+
task_view: exports_external.union([exports_external.literal("list"), exports_external.literal("grid")]).optional(),
|
|
12364
|
+
email_verified: exports_external.boolean().optional()
|
|
12365
|
+
});
|
|
12366
|
+
var config_schema = exports_external.object({
|
|
12367
|
+
tags: exports_external.array(exports_external.object({
|
|
12368
|
+
name: exports_external.string(),
|
|
12369
|
+
match: exports_external.array(exports_external.string())
|
|
12370
|
+
})),
|
|
12371
|
+
ignore: exports_external.array(exports_external.string().regex(/^[\s\S]*$/, "Invalid path"))
|
|
12372
|
+
});
|
|
12373
|
+
var upsert_milestone = exports_external.object({
|
|
12374
|
+
id: exports_external.string().optional().nullable(),
|
|
12375
|
+
project_id: exports_external.string(),
|
|
12376
|
+
name: exports_external.string().min(1).max(200),
|
|
12377
|
+
description: exports_external.string().nullable().optional(),
|
|
12378
|
+
target_time: exports_external.string().nullable().optional(),
|
|
12379
|
+
target_version: exports_external.string().nullable().optional(),
|
|
12380
|
+
finished_at: exports_external.string().nullable().optional(),
|
|
12381
|
+
after_id: exports_external.string().nullable().optional(),
|
|
12382
|
+
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
12383
|
+
});
|
|
12384
|
+
var upsert_goal = exports_external.object({
|
|
12385
|
+
id: exports_external.string().optional().nullable(),
|
|
12386
|
+
milestone_id: exports_external.string(),
|
|
12387
|
+
name: exports_external.string().min(1).max(200),
|
|
12388
|
+
description: exports_external.string().nullable().optional(),
|
|
12389
|
+
target_time: exports_external.string().nullable().optional(),
|
|
12390
|
+
finished_at: exports_external.string().nullable().optional(),
|
|
12391
|
+
force: exports_external.boolean().optional().describe("Override protection on user-modified entities")
|
|
12392
|
+
});
|
|
12393
|
+
var rollout_shape = exports_external.union([exports_external.literal("gradual"), exports_external.literal("atomic")]);
|
|
12394
|
+
var run_kind = exports_external.union([exports_external.literal("deploy"), exports_external.literal("rollback")]);
|
|
12395
|
+
var run_status = exports_external.union([
|
|
12396
|
+
exports_external.literal("queued"),
|
|
12397
|
+
exports_external.literal("deploying"),
|
|
12398
|
+
exports_external.literal("baking"),
|
|
12399
|
+
exports_external.literal("awaiting_approval"),
|
|
12400
|
+
exports_external.literal("rolling_back"),
|
|
12401
|
+
exports_external.literal("completed"),
|
|
12402
|
+
exports_external.literal("rolled_back"),
|
|
12403
|
+
exports_external.literal("failed"),
|
|
12404
|
+
exports_external.literal("cancelled")
|
|
12405
|
+
]);
|
|
12406
|
+
var forced_atomic_reason = exports_external.union([exports_external.literal("do_migrations"), exports_external.literal("asset_affinity_none")]);
|
|
12407
|
+
var stage_event_kind = exports_external.union([
|
|
12408
|
+
exports_external.literal("deploy_started"),
|
|
12409
|
+
exports_external.literal("deploy_completed"),
|
|
12410
|
+
exports_external.literal("bake_started"),
|
|
12411
|
+
exports_external.literal("bake_completed"),
|
|
12412
|
+
exports_external.literal("gate_verdict"),
|
|
12413
|
+
exports_external.literal("approval_requested"),
|
|
12414
|
+
exports_external.literal("rollback_started"),
|
|
12415
|
+
exports_external.literal("rollback_completed"),
|
|
12416
|
+
exports_external.literal("warning"),
|
|
12417
|
+
exports_external.literal("error")
|
|
12418
|
+
]);
|
|
12419
|
+
var approval_decision = exports_external.union([exports_external.literal("approved"), exports_external.literal("denied")]);
|
|
12420
|
+
var grant_scope = exports_external.string().regex(/^[a-z0-9_-]+:[a-z0-9_-]+(:[^\s]+)?$/, "Invalid scope format");
|
|
12421
|
+
var rollout_stage = exports_external.object({
|
|
12422
|
+
name: exports_external.string(),
|
|
12423
|
+
traffic: exports_external.number().int().min(0).max(100),
|
|
12424
|
+
bake: exports_external.string().nullable()
|
|
12425
|
+
});
|
|
12426
|
+
var resolved_rollout = exports_external.discriminatedUnion("type", [
|
|
12427
|
+
exports_external.object({
|
|
12428
|
+
type: exports_external.literal("gradual"),
|
|
12429
|
+
stages: exports_external.array(rollout_stage)
|
|
12430
|
+
}),
|
|
12431
|
+
exports_external.object({
|
|
12432
|
+
type: exports_external.literal("atomic")
|
|
12433
|
+
})
|
|
12434
|
+
]);
|
|
12435
|
+
var gate_descriptor = exports_external.discriminatedUnion("type", [
|
|
12436
|
+
exports_external.object({ type: exports_external.literal("manual") }),
|
|
12437
|
+
exports_external.object({ type: exports_external.literal("auto"), afterBake: exports_external.boolean().optional() }),
|
|
12438
|
+
exports_external.object({ type: exports_external.literal("analysis"), template: exports_external.string() })
|
|
12439
|
+
]);
|
|
12440
|
+
var resolved_gates = exports_external.record(exports_external.string(), gate_descriptor);
|
|
12441
|
+
var upsert_pipeline_package = exports_external.object({
|
|
12442
|
+
id: exports_external.string().optional().nullable(),
|
|
12443
|
+
owner_id: exports_external.string(),
|
|
12444
|
+
name: exports_external.string().min(1).max(200),
|
|
12445
|
+
repo_url: exports_external.string().nullable().optional(),
|
|
12446
|
+
default_template_ref: exports_external.string().nullable().optional(),
|
|
12447
|
+
script_name_overrides: exports_external.record(exports_external.string(), exports_external.string()).nullable().optional(),
|
|
12448
|
+
project_id: exports_external.string().nullable().optional()
|
|
12449
|
+
});
|
|
12450
|
+
var upsert_pipeline_run = exports_external.object({
|
|
12451
|
+
id: exports_external.string().optional().nullable(),
|
|
12452
|
+
package_id: exports_external.string(),
|
|
12453
|
+
version_set_id: exports_external.string(),
|
|
12454
|
+
shape: rollout_shape,
|
|
12455
|
+
kind: run_kind.optional(),
|
|
12456
|
+
status: run_status.optional(),
|
|
12457
|
+
current_stage: exports_external.string().nullable().optional(),
|
|
12458
|
+
resolved_rollout,
|
|
12459
|
+
resolved_gates,
|
|
12460
|
+
forced_atomic_reason: forced_atomic_reason.nullable().optional(),
|
|
12461
|
+
started_at: exports_external.string().nullable().optional(),
|
|
12462
|
+
finished_at: exports_external.string().nullable().optional()
|
|
12463
|
+
});
|
|
12464
|
+
var insert_pipeline_stage_event = exports_external.object({
|
|
12465
|
+
run_id: exports_external.string(),
|
|
12466
|
+
stage_name: exports_external.string(),
|
|
12467
|
+
kind: stage_event_kind,
|
|
12468
|
+
payload: exports_external.unknown().optional()
|
|
12469
|
+
});
|
|
12470
|
+
var upsert_pipeline_grant = exports_external.object({
|
|
12471
|
+
id: exports_external.string().optional().nullable(),
|
|
12472
|
+
package_id: exports_external.string(),
|
|
12473
|
+
stage_name: exports_external.string(),
|
|
12474
|
+
scope: grant_scope,
|
|
12475
|
+
granted_by: exports_external.string().nullable().optional(),
|
|
12476
|
+
granted_at: exports_external.string().nullable().optional()
|
|
12477
|
+
});
|
|
12478
|
+
var upsert_pipeline_approval = exports_external.object({
|
|
12479
|
+
run_id: exports_external.string(),
|
|
12480
|
+
stage_name: exports_external.string(),
|
|
12481
|
+
decision: approval_decision.nullable().optional(),
|
|
12482
|
+
reason: exports_external.string().nullable().optional(),
|
|
12483
|
+
decided_by: exports_external.string().nullable().optional(),
|
|
12484
|
+
decided_at: exports_external.string().nullable().optional()
|
|
12485
|
+
});
|
|
12486
|
+
var upsert_pipeline_analysis_template = exports_external.object({
|
|
12487
|
+
id: exports_external.string().optional(),
|
|
12488
|
+
owner_id: exports_external.string().min(1),
|
|
12489
|
+
name: exports_external.string().min(1).max(200),
|
|
12490
|
+
query_dsl: exports_external.unknown(),
|
|
12491
|
+
threshold_dsl: exports_external.string().min(1),
|
|
12492
|
+
window_ms: exports_external.number().int().positive()
|
|
12493
|
+
});
|
|
12494
|
+
var pipeline_oidc_provider = exports_external.literal("github");
|
|
12495
|
+
var upsert_pipeline_oidc_trust = exports_external.object({
|
|
12496
|
+
id: exports_external.string().optional().nullable(),
|
|
12497
|
+
owner_id: exports_external.string(),
|
|
12498
|
+
provider: pipeline_oidc_provider.optional(),
|
|
12499
|
+
github_owner: exports_external.string().min(1).max(200),
|
|
12500
|
+
repo_pattern: exports_external.string().min(1).max(200).optional(),
|
|
12501
|
+
allowed_refs: exports_external.array(exports_external.string()).optional(),
|
|
12502
|
+
allowed_environments: exports_external.array(exports_external.string()).optional(),
|
|
12503
|
+
expected_audience: exports_external.string().min(1),
|
|
12504
|
+
allowed_actions: exports_external.array(exports_external.string()).optional(),
|
|
12505
|
+
session_ttl_seconds: exports_external.number().int().positive().optional(),
|
|
12506
|
+
last_used_at: exports_external.string().nullable().optional()
|
|
12507
|
+
});
|
|
12508
|
+
var webhook_event_body = exports_external.object({
|
|
12509
|
+
stage_name: exports_external.string().min(1),
|
|
12510
|
+
kind: exports_external.enum(STAGE_EVENT_KINDS),
|
|
12511
|
+
payload: exports_external.unknown().optional(),
|
|
12512
|
+
idempotency_key: exports_external.string().uuid()
|
|
12513
|
+
});
|
|
12514
|
+
var dashboard_window_query = exports_external.object({
|
|
12515
|
+
package_id: exports_external.string().min(1),
|
|
12516
|
+
window_ms: exports_external.number().int().positive().default(24 * 60 * 60 * 1000)
|
|
12517
|
+
});
|
|
12518
|
+
var verdict_breakdown = exports_external.object({
|
|
12519
|
+
pass: exports_external.number().int().nonnegative(),
|
|
12520
|
+
fail: exports_external.number().int().nonnegative(),
|
|
12521
|
+
pending: exports_external.number().int().nonnegative()
|
|
12522
|
+
});
|
|
12523
|
+
var dashboard_response = exports_external.object({
|
|
12524
|
+
run_counts: exports_external.object({
|
|
12525
|
+
total: exports_external.number().int().nonnegative(),
|
|
12526
|
+
completed: exports_external.number().int().nonnegative(),
|
|
12527
|
+
failed: exports_external.number().int().nonnegative(),
|
|
12528
|
+
cancelled: exports_external.number().int().nonnegative(),
|
|
12529
|
+
rolled_back: exports_external.number().int().nonnegative(),
|
|
12530
|
+
in_flight: exports_external.number().int().nonnegative()
|
|
12531
|
+
}),
|
|
12532
|
+
verdict_counts: exports_external.object({
|
|
12533
|
+
manual: verdict_breakdown,
|
|
12534
|
+
auto: verdict_breakdown,
|
|
12535
|
+
analysis: verdict_breakdown
|
|
12536
|
+
}),
|
|
12537
|
+
latency_p50_ms: exports_external.number().nonnegative().nullable(),
|
|
12538
|
+
latency_p95_ms: exports_external.number().nonnegative().nullable(),
|
|
12539
|
+
approval_turnaround_p50_ms: exports_external.number().nonnegative().nullable(),
|
|
12540
|
+
rollback_rate: exports_external.number().min(0).max(1).nullable()
|
|
12541
|
+
});
|
|
12542
|
+
|
|
12543
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/types.js
|
|
12544
|
+
var ok = (value) => ({ ok: true, value });
|
|
12545
|
+
var err = (error) => ({ ok: false, error });
|
|
12546
|
+
|
|
12547
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/utils.js
|
|
12548
|
+
function create_filter_pipeline(config) {
|
|
12549
|
+
return (items, opts) => {
|
|
12550
|
+
let filtered = items;
|
|
12551
|
+
for (const { key, predicate } of config.filters) {
|
|
12552
|
+
const optValue = opts[key];
|
|
12553
|
+
if (optValue !== undefined && optValue !== null) {
|
|
12554
|
+
filtered = filtered.filter((item) => predicate(item, optValue));
|
|
12555
|
+
}
|
|
12556
|
+
}
|
|
12557
|
+
filtered.sort(config.sort);
|
|
12558
|
+
if (opts.limit) {
|
|
12559
|
+
filtered = filtered.slice(0, opts.limit);
|
|
12560
|
+
}
|
|
12561
|
+
return filtered;
|
|
12562
|
+
};
|
|
12563
|
+
}
|
|
12564
|
+
var snapshot_filter_pipeline = create_filter_pipeline({
|
|
12565
|
+
filters: [
|
|
12566
|
+
{ key: "before", predicate: (m, before) => m.created_at < before },
|
|
12567
|
+
{ key: "after", predicate: (m, after) => m.created_at > after },
|
|
12568
|
+
{ key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag2) => m.tags?.includes(tag2)) }
|
|
12569
|
+
],
|
|
12570
|
+
sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
|
|
12571
|
+
});
|
|
12572
|
+
|
|
12573
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/result.js
|
|
12574
|
+
var try_catch_async = async (fn, on_error) => {
|
|
12575
|
+
try {
|
|
12576
|
+
return ok(await fn());
|
|
12577
|
+
} catch (e) {
|
|
12578
|
+
return err(on_error(e));
|
|
12579
|
+
}
|
|
12580
|
+
};
|
|
12581
|
+
var fetch_result = async (input, init, on_error, parse_body = (r) => r.json()) => {
|
|
12582
|
+
try {
|
|
12583
|
+
const response = await fetch(input, init);
|
|
12584
|
+
if (!response.ok) {
|
|
12585
|
+
return err(on_error({ type: "http", status: response.status, status_text: response.statusText }));
|
|
12586
|
+
}
|
|
12587
|
+
return ok(await parse_body(response));
|
|
12588
|
+
} catch (e) {
|
|
12589
|
+
return err(on_error({ type: "network", cause: e }));
|
|
12590
|
+
}
|
|
12591
|
+
};
|
|
12592
|
+
var create_pipe = (promised) => ({
|
|
12593
|
+
map: (fn) => create_pipe(promised.then((r) => {
|
|
12594
|
+
if (r.ok)
|
|
12595
|
+
return ok(fn(r.value));
|
|
12596
|
+
return err(r.error);
|
|
12597
|
+
})),
|
|
12598
|
+
map_async: (fn) => create_pipe(promised.then(async (r) => {
|
|
12599
|
+
if (r.ok)
|
|
12600
|
+
return ok(await fn(r.value));
|
|
12601
|
+
return err(r.error);
|
|
12602
|
+
})),
|
|
12603
|
+
flat_map: (fn) => create_pipe(promised.then((r) => {
|
|
12604
|
+
if (r.ok)
|
|
12605
|
+
return fn(r.value);
|
|
12606
|
+
return err(r.error);
|
|
12607
|
+
})),
|
|
12608
|
+
map_err: (fn) => create_pipe(promised.then((r) => {
|
|
12609
|
+
if (r.ok)
|
|
12610
|
+
return ok(r.value);
|
|
12611
|
+
return err(fn(r.error));
|
|
12612
|
+
})),
|
|
12613
|
+
tap: (fn) => create_pipe(promised.then(async (r) => {
|
|
12614
|
+
if (r.ok)
|
|
12615
|
+
await fn(r.value);
|
|
12616
|
+
return r;
|
|
12617
|
+
})),
|
|
12618
|
+
tap_err: (fn) => create_pipe(promised.then(async (r) => {
|
|
12619
|
+
if (!r.ok)
|
|
12620
|
+
await fn(r.error);
|
|
12621
|
+
return r;
|
|
12622
|
+
})),
|
|
12623
|
+
unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
|
|
12624
|
+
result: () => promised
|
|
12625
|
+
});
|
|
12626
|
+
var pipe = (initial) => create_pipe(Promise.resolve(initial));
|
|
12627
|
+
pipe.ok = (value) => pipe(ok(value));
|
|
12628
|
+
pipe.err = (error) => pipe(err(error));
|
|
12629
|
+
pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
|
|
12630
|
+
pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
|
|
12631
|
+
|
|
12632
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/observations/storage.js
|
|
12633
|
+
var observation_filter_pipeline = create_filter_pipeline({
|
|
12634
|
+
filters: [
|
|
12635
|
+
{
|
|
12636
|
+
key: "type",
|
|
12637
|
+
predicate: (r, type) => {
|
|
12638
|
+
const types2 = Array.isArray(type) ? type : [type];
|
|
12639
|
+
return types2.includes(r.type);
|
|
12640
|
+
}
|
|
12641
|
+
},
|
|
12642
|
+
{ key: "source_store_id", predicate: (r, id2) => r.source_store_id === id2 },
|
|
12643
|
+
{ key: "source_version", predicate: (r, version2) => r.source_version === version2 },
|
|
12644
|
+
{ key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
|
|
12645
|
+
{ key: "created_after", predicate: (r, after) => r.created_at > after },
|
|
12646
|
+
{ key: "created_before", predicate: (r, before) => r.created_at < before },
|
|
12647
|
+
{ key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
|
|
12648
|
+
{ key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
|
|
12649
|
+
],
|
|
12650
|
+
sort: (a, b) => b.created_at.localeCompare(a.created_at)
|
|
12651
|
+
});
|
|
12652
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/observations/schema.js
|
|
12653
|
+
var corpus_observations = sqliteTable("corpus_observations", {
|
|
12654
|
+
id: text("id").primaryKey(),
|
|
12655
|
+
type: text("type").notNull(),
|
|
12656
|
+
source_store_id: text("source_store_id").notNull(),
|
|
12657
|
+
source_version: text("source_version").notNull(),
|
|
12658
|
+
source_path: text("source_path"),
|
|
12659
|
+
source_span_start: text("source_span_start"),
|
|
12660
|
+
source_span_end: text("source_span_end"),
|
|
12661
|
+
content: text("content").notNull(),
|
|
12662
|
+
confidence: real("confidence"),
|
|
12663
|
+
observed_at: text("observed_at"),
|
|
12664
|
+
created_at: text("created_at").notNull(),
|
|
12665
|
+
derived_from: text("derived_from")
|
|
12666
|
+
}, (table) => ({
|
|
12667
|
+
type_idx: index("idx_obs_type").on(table.type),
|
|
12668
|
+
source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
|
|
12669
|
+
type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
|
|
12670
|
+
type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
|
|
12671
|
+
}));
|
|
12672
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/backend/memory.js
|
|
12673
|
+
var CORPUS_DEV = (() => {
|
|
12674
|
+
try {
|
|
12675
|
+
return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
|
|
12676
|
+
} catch {
|
|
12677
|
+
return false;
|
|
12678
|
+
}
|
|
12679
|
+
})();
|
|
12680
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/schema.js
|
|
12681
|
+
var corpus_snapshots = sqliteTable("corpus_snapshots", {
|
|
12682
|
+
store_id: text("store_id").notNull(),
|
|
12683
|
+
version: text("version").notNull(),
|
|
12684
|
+
parents: text("parents").notNull(),
|
|
12685
|
+
created_at: text("created_at").notNull(),
|
|
12686
|
+
invoked_at: text("invoked_at"),
|
|
12687
|
+
content_hash: text("content_hash").notNull(),
|
|
12688
|
+
content_type: text("content_type").notNull(),
|
|
12689
|
+
size_bytes: integer("size_bytes").notNull(),
|
|
12690
|
+
data_key: text("data_key").notNull(),
|
|
12691
|
+
tags: text("tags")
|
|
12692
|
+
}, (table) => ({
|
|
12693
|
+
pk: primaryKey({ columns: [table.store_id, table.version] }),
|
|
12694
|
+
created_idx: index("idx_store_created").on(table.store_id, table.created_at),
|
|
12695
|
+
hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
|
|
12696
|
+
data_key_idx: index("idx_data_key").on(table.data_key)
|
|
13532
12697
|
}));
|
|
12698
|
+
// ../../node_modules/.bun/@f0rbit+corpus@0.6.0+cdb71084ede92ac1/node_modules/@f0rbit/corpus/dist/version-set.js
|
|
12699
|
+
var VersionSetManifestSchema = exports_external.object({
|
|
12700
|
+
package: exports_external.string(),
|
|
12701
|
+
git_sha: exports_external.string().length(40),
|
|
12702
|
+
created_at: exports_external.string().datetime(),
|
|
12703
|
+
builds: exports_external.object({
|
|
12704
|
+
worker: exports_external.object({
|
|
12705
|
+
artifact_ref: exports_external.string(),
|
|
12706
|
+
size_bytes: exports_external.number().int(),
|
|
12707
|
+
compatibility_date: exports_external.string()
|
|
12708
|
+
}),
|
|
12709
|
+
assets: exports_external.object({
|
|
12710
|
+
artifact_ref: exports_external.string().optional(),
|
|
12711
|
+
version_affinity: exports_external.enum(["pinned", "none"]).default("pinned")
|
|
12712
|
+
}).optional()
|
|
12713
|
+
}),
|
|
12714
|
+
migrations: exports_external.object({
|
|
12715
|
+
d1_plan_ref: exports_external.string().optional(),
|
|
12716
|
+
do_migrations: exports_external.array(exports_external.object({
|
|
12717
|
+
class_name: exports_external.string(),
|
|
12718
|
+
tag: exports_external.string(),
|
|
12719
|
+
kind: exports_external.enum([
|
|
12720
|
+
"new_sqlite_classes",
|
|
12721
|
+
"new_classes",
|
|
12722
|
+
"renamed_classes",
|
|
12723
|
+
"deleted_classes",
|
|
12724
|
+
"transferred_classes"
|
|
12725
|
+
])
|
|
12726
|
+
})).default([])
|
|
12727
|
+
}),
|
|
12728
|
+
env_manifest_ref: exports_external.string(),
|
|
12729
|
+
infra_plan_ref: exports_external.string(),
|
|
12730
|
+
grants_ref: exports_external.string().optional(),
|
|
12731
|
+
template_ref: exports_external.string().optional()
|
|
12732
|
+
});
|
|
12733
|
+
// ../api/dist/index.js
|
|
12734
|
+
var ApiError = class _ApiError extends Error {
|
|
12735
|
+
constructor(message, options = {}) {
|
|
12736
|
+
super(message);
|
|
12737
|
+
this.name = "ApiError";
|
|
12738
|
+
this.code = options.code ?? undefined;
|
|
12739
|
+
this.statusCode = options.statusCode ?? undefined;
|
|
12740
|
+
}
|
|
12741
|
+
static fromResponse(response) {
|
|
12742
|
+
return new _ApiError(`API request failed: ${response.statusText}`, {
|
|
12743
|
+
statusCode: response.status
|
|
12744
|
+
});
|
|
12745
|
+
}
|
|
12746
|
+
};
|
|
12747
|
+
var AuthenticationError = class extends ApiError {
|
|
12748
|
+
constructor(message = "Authentication failed") {
|
|
12749
|
+
super(message, { code: "AUTHENTICATION_ERROR" });
|
|
12750
|
+
}
|
|
12751
|
+
};
|
|
12752
|
+
var NetworkError = class extends ApiError {
|
|
12753
|
+
constructor(message = "Network request failed") {
|
|
12754
|
+
super(message, { code: "NETWORK_ERROR" });
|
|
12755
|
+
}
|
|
12756
|
+
};
|
|
12757
|
+
var ValidationError = class extends ApiError {
|
|
12758
|
+
constructor(message = "Validation failed") {
|
|
12759
|
+
super(message, { code: "VALIDATION_ERROR" });
|
|
12760
|
+
}
|
|
12761
|
+
};
|
|
12762
|
+
var HTTP_STATUS = {
|
|
12763
|
+
OK: 200,
|
|
12764
|
+
CREATED: 201,
|
|
12765
|
+
NO_CONTENT: 204,
|
|
12766
|
+
BAD_REQUEST: 400,
|
|
12767
|
+
UNAUTHORIZED: 401,
|
|
12768
|
+
FORBIDDEN: 403,
|
|
12769
|
+
NOT_FOUND: 404,
|
|
12770
|
+
INTERNAL_SERVER_ERROR: 500
|
|
12771
|
+
};
|
|
12772
|
+
function handleHttpResponse(response) {
|
|
12773
|
+
switch (response.status) {
|
|
12774
|
+
case HTTP_STATUS.UNAUTHORIZED:
|
|
12775
|
+
throw new AuthenticationError("Invalid or expired API key");
|
|
12776
|
+
case HTTP_STATUS.NOT_FOUND:
|
|
12777
|
+
throw new ApiError("Resource not found", { statusCode: HTTP_STATUS.NOT_FOUND });
|
|
12778
|
+
case HTTP_STATUS.BAD_REQUEST:
|
|
12779
|
+
break;
|
|
12780
|
+
default:
|
|
12781
|
+
if (!response.ok) {
|
|
12782
|
+
throw new ApiError(`Request failed: ${response.statusText}`, { statusCode: response.status });
|
|
12783
|
+
}
|
|
12784
|
+
}
|
|
12785
|
+
}
|
|
12786
|
+
async function handleResponseError(response) {
|
|
12787
|
+
const errorText = await response.text();
|
|
12788
|
+
const errorMessage = errorText || "Request failed";
|
|
12789
|
+
let parsedError = null;
|
|
12790
|
+
try {
|
|
12791
|
+
parsedError = JSON.parse(errorText);
|
|
12792
|
+
} catch {}
|
|
12793
|
+
if (response.status === HTTP_STATUS.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
|
|
12794
|
+
const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
|
|
12795
|
+
throw new ValidationError(zodErrorDetails);
|
|
12796
|
+
}
|
|
12797
|
+
throw new ApiError(errorMessage, { statusCode: response.status });
|
|
12798
|
+
}
|
|
12799
|
+
function handleNetworkError(error) {
|
|
12800
|
+
const message = error instanceof Error ? error.message : "Unknown network error";
|
|
12801
|
+
throw new NetworkError(message);
|
|
12802
|
+
}
|
|
12803
|
+
var ArrayBufferedQueue = class {
|
|
12804
|
+
constructor(_capacity) {
|
|
12805
|
+
this._capacity = _capacity;
|
|
12806
|
+
this._entries = [];
|
|
12807
|
+
this._head = 0;
|
|
12808
|
+
this._tail = 0;
|
|
12809
|
+
this._size = 0;
|
|
12810
|
+
}
|
|
12811
|
+
latest() {
|
|
12812
|
+
if (this._size === 0)
|
|
12813
|
+
return null;
|
|
12814
|
+
return this._entries[this._tail - 1] ?? null;
|
|
12815
|
+
}
|
|
12816
|
+
list() {
|
|
12817
|
+
if (this._size === 0)
|
|
12818
|
+
return [];
|
|
12819
|
+
if (this._head < this._tail) {
|
|
12820
|
+
return this._entries.slice(this._head, this._tail);
|
|
12821
|
+
}
|
|
12822
|
+
return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
|
|
12823
|
+
}
|
|
12824
|
+
add(item) {
|
|
12825
|
+
if (this._size === this._capacity) {
|
|
12826
|
+
this._head = (this._head + 1) % this._capacity;
|
|
12827
|
+
} else {
|
|
12828
|
+
this._size++;
|
|
12829
|
+
}
|
|
12830
|
+
this._entries[this._tail] = item;
|
|
12831
|
+
this._tail = (this._tail + 1) % this._capacity;
|
|
12832
|
+
}
|
|
12833
|
+
size() {
|
|
12834
|
+
return this._size;
|
|
12835
|
+
}
|
|
12836
|
+
clear() {
|
|
12837
|
+
this._entries = [];
|
|
12838
|
+
this._head = 0;
|
|
12839
|
+
this._tail = 0;
|
|
12840
|
+
this._size = 0;
|
|
12841
|
+
}
|
|
12842
|
+
};
|
|
12843
|
+
var ApiClient = class {
|
|
12844
|
+
constructor(options) {
|
|
12845
|
+
this.category = "api";
|
|
12846
|
+
this.auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : "key");
|
|
12847
|
+
if (this.auth_mode !== "cookie") {
|
|
12848
|
+
if (!options.api_key)
|
|
12849
|
+
throw new Error("API key is required");
|
|
12850
|
+
if (options.api_key.length < 10)
|
|
12851
|
+
throw new Error("API key is too short");
|
|
12852
|
+
}
|
|
12853
|
+
this.base_url = options.base_url;
|
|
12854
|
+
this.api_key = options.api_key ?? "";
|
|
12855
|
+
this.category = options.category || "api";
|
|
12856
|
+
this.credentials = options.credentials;
|
|
12857
|
+
this.default_headers = options.default_headers ?? {};
|
|
12858
|
+
this.custom_fetch = options.custom_fetch;
|
|
12859
|
+
this.request_history = new ArrayBufferedQueue(options.max_history_size ?? 5);
|
|
12860
|
+
this.debug = options.debug ?? false;
|
|
12861
|
+
}
|
|
12862
|
+
buildUrl(path, query) {
|
|
12863
|
+
const url = new URL(`${this.base_url}${path}`);
|
|
12864
|
+
if (query) {
|
|
12865
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
12866
|
+
if (value)
|
|
12867
|
+
url.searchParams.append(key, value);
|
|
12868
|
+
});
|
|
12869
|
+
}
|
|
12870
|
+
return url.toString();
|
|
12871
|
+
}
|
|
12872
|
+
generateRequestId() {
|
|
12873
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
12874
|
+
}
|
|
12875
|
+
async request(path, options = {}) {
|
|
12876
|
+
const { method = "GET", headers = {}, body, query } = options;
|
|
12877
|
+
const url = this.buildUrl(path, query);
|
|
12878
|
+
const requestId = this.generateRequestId();
|
|
12879
|
+
const startTime = Date.now();
|
|
12880
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
12881
|
+
if (this.debug) {
|
|
12882
|
+
console.log(`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`, { body, query });
|
|
12883
|
+
}
|
|
12884
|
+
const request_headers = {
|
|
12885
|
+
"Content-Type": "application/json",
|
|
12886
|
+
"X-Request-ID": requestId,
|
|
12887
|
+
...this.default_headers,
|
|
12888
|
+
...headers
|
|
12889
|
+
};
|
|
12890
|
+
if (this.auth_mode === "session") {
|
|
12891
|
+
request_headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
12892
|
+
} else if (this.auth_mode === "key") {
|
|
12893
|
+
request_headers.Authorization = `Bearer ${this.api_key}`;
|
|
12894
|
+
}
|
|
12895
|
+
const historyEntry = {
|
|
12896
|
+
timestamp,
|
|
12897
|
+
method,
|
|
12898
|
+
path,
|
|
12899
|
+
options: { ...options, method },
|
|
12900
|
+
url
|
|
12901
|
+
};
|
|
12902
|
+
try {
|
|
12903
|
+
const fetchOptions = {
|
|
12904
|
+
method,
|
|
12905
|
+
headers: request_headers
|
|
12906
|
+
};
|
|
12907
|
+
if (body) {
|
|
12908
|
+
fetchOptions.body = JSON.stringify(body);
|
|
12909
|
+
}
|
|
12910
|
+
if (this.credentials) {
|
|
12911
|
+
fetchOptions.credentials = this.credentials;
|
|
12912
|
+
} else if (this.auth_mode === "cookie") {
|
|
12913
|
+
fetchOptions.credentials = "include";
|
|
12914
|
+
}
|
|
12915
|
+
const fetcher = this.custom_fetch ?? fetch;
|
|
12916
|
+
const response = await fetcher(url, fetchOptions);
|
|
12917
|
+
const duration = Date.now() - startTime;
|
|
12918
|
+
historyEntry.status = response.status;
|
|
12919
|
+
historyEntry.duration = duration;
|
|
12920
|
+
if (!response.ok) {
|
|
12921
|
+
if (this.debug) {
|
|
12922
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
12923
|
+
status: response.status,
|
|
12924
|
+
duration: `${duration}ms`,
|
|
12925
|
+
body,
|
|
12926
|
+
query
|
|
12927
|
+
});
|
|
12928
|
+
}
|
|
12929
|
+
try {
|
|
12930
|
+
handleHttpResponse(response);
|
|
12931
|
+
await handleResponseError(response);
|
|
12932
|
+
} catch (error) {
|
|
12933
|
+
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
12934
|
+
historyEntry.error = errorMessage;
|
|
12935
|
+
this.request_history.add(historyEntry);
|
|
12936
|
+
throw error;
|
|
12937
|
+
}
|
|
12938
|
+
}
|
|
12939
|
+
this.request_history.add(historyEntry);
|
|
12940
|
+
let result;
|
|
12941
|
+
if (response.status === HTTP_STATUS.NO_CONTENT) {
|
|
12942
|
+
result = undefined;
|
|
12943
|
+
} else {
|
|
12944
|
+
const text2 = await response.text();
|
|
12945
|
+
if (!text2 || text2.trim() === "" || text2.trim() === "null") {
|
|
12946
|
+
result = undefined;
|
|
12947
|
+
} else {
|
|
12948
|
+
try {
|
|
12949
|
+
result = JSON.parse(text2);
|
|
12950
|
+
} catch (parseError) {
|
|
12951
|
+
result = text2;
|
|
12952
|
+
}
|
|
12953
|
+
}
|
|
12954
|
+
}
|
|
12955
|
+
if (this.debug) {
|
|
12956
|
+
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
12957
|
+
status: response.status,
|
|
12958
|
+
duration: `${duration}ms`
|
|
12959
|
+
});
|
|
12960
|
+
}
|
|
12961
|
+
return result;
|
|
12962
|
+
} catch (error) {
|
|
12963
|
+
const duration = Date.now() - startTime;
|
|
12964
|
+
if (this.debug) {
|
|
12965
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
12966
|
+
url,
|
|
12967
|
+
duration: `${duration}ms`,
|
|
12968
|
+
error: error instanceof Error ? error.message : String(error),
|
|
12969
|
+
body,
|
|
12970
|
+
query
|
|
12971
|
+
});
|
|
12972
|
+
}
|
|
12973
|
+
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
12974
|
+
throw error;
|
|
12975
|
+
}
|
|
12976
|
+
historyEntry.duration = duration;
|
|
12977
|
+
try {
|
|
12978
|
+
handleNetworkError(error);
|
|
12979
|
+
} catch (networkError) {
|
|
12980
|
+
const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
|
|
12981
|
+
historyEntry.error = errorMessage;
|
|
12982
|
+
this.request_history.add(historyEntry);
|
|
12983
|
+
throw networkError;
|
|
12984
|
+
}
|
|
12985
|
+
}
|
|
12986
|
+
}
|
|
12987
|
+
get(path, options = {}) {
|
|
12988
|
+
return this.request(path, { ...options, method: "GET" });
|
|
12989
|
+
}
|
|
12990
|
+
post(path, options = {}) {
|
|
12991
|
+
return this.request(path, { ...options, method: "POST" });
|
|
12992
|
+
}
|
|
12993
|
+
patch(path, options = {}) {
|
|
12994
|
+
return this.request(path, { ...options, method: "PATCH" });
|
|
12995
|
+
}
|
|
12996
|
+
put(path, options = {}) {
|
|
12997
|
+
return this.request(path, { ...options, method: "PUT" });
|
|
12998
|
+
}
|
|
12999
|
+
delete(path, options = {}) {
|
|
13000
|
+
return this.request(path, { ...options, method: "DELETE" });
|
|
13001
|
+
}
|
|
13002
|
+
history() {
|
|
13003
|
+
return this.request_history;
|
|
13004
|
+
}
|
|
13005
|
+
url() {
|
|
13006
|
+
return this.base_url;
|
|
13007
|
+
}
|
|
13008
|
+
headers() {
|
|
13009
|
+
const headers = {
|
|
13010
|
+
"Content-Type": "application/json"
|
|
13011
|
+
};
|
|
13012
|
+
if (this.auth_mode === "session") {
|
|
13013
|
+
headers.Authorization = `Bearer jwt:${this.api_key.replace(/^jwt:/, "")}`;
|
|
13014
|
+
} else if (this.auth_mode === "key") {
|
|
13015
|
+
headers["X-API-KEY"] = this.api_key;
|
|
13016
|
+
}
|
|
13017
|
+
return headers;
|
|
13018
|
+
}
|
|
13019
|
+
};
|
|
13020
|
+
function wrap(fn) {
|
|
13021
|
+
return fn().then((data) => ok(data)).catch((error) => err({
|
|
13022
|
+
message: error.message || "Unknown error",
|
|
13023
|
+
code: error.code,
|
|
13024
|
+
status_code: error.statusCode || error.status_code
|
|
13025
|
+
}));
|
|
13026
|
+
}
|
|
13027
|
+
var ApiClient2 = class {
|
|
13028
|
+
constructor(options) {
|
|
13029
|
+
this.auth = {
|
|
13030
|
+
session: () => wrap(() => this.clients.auth_root.get("/auth/session")),
|
|
13031
|
+
keys: {
|
|
13032
|
+
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
13033
|
+
create: (input) => {
|
|
13034
|
+
const body = typeof input === "string" ? { name: input } : input ?? {};
|
|
13035
|
+
return wrap(() => this.clients.auth.post("/keys", { body }));
|
|
13036
|
+
},
|
|
13037
|
+
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
13038
|
+
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
13039
|
+
}
|
|
13040
|
+
};
|
|
13041
|
+
this.projects = {
|
|
13042
|
+
list: (filters) => wrap(() => this.clients.projects.get(filters?.private === false ? "/projects/public" : "/projects")),
|
|
13043
|
+
map: async (filters) => wrap(async () => {
|
|
13044
|
+
const result = await this.projects.list(filters);
|
|
13045
|
+
if (!result.ok)
|
|
13046
|
+
throw new Error(result.error.message);
|
|
13047
|
+
return result.value.reduce((acc, project2) => {
|
|
13048
|
+
acc[project2.id] = project2;
|
|
13049
|
+
return acc;
|
|
13050
|
+
}, {});
|
|
13051
|
+
}),
|
|
13052
|
+
find: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
|
|
13053
|
+
getByName: (name) => wrap(() => this.clients.projects.get("/projects", { query: { name } })),
|
|
13054
|
+
getById: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
|
|
13055
|
+
create: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13056
|
+
update: async (idOrData, changes) => wrap(async () => {
|
|
13057
|
+
if (typeof idOrData === "object" && idOrData.id) {
|
|
13058
|
+
return this.clients.projects.patch("/projects", {
|
|
13059
|
+
body: idOrData
|
|
13060
|
+
});
|
|
13061
|
+
}
|
|
13062
|
+
const id2 = idOrData;
|
|
13063
|
+
if (!changes) {
|
|
13064
|
+
throw new Error("Changes parameter required for update");
|
|
13065
|
+
}
|
|
13066
|
+
const result = await this.projects.find(id2);
|
|
13067
|
+
if (!result.ok)
|
|
13068
|
+
throw new Error(result.error.message);
|
|
13069
|
+
if (!result.value)
|
|
13070
|
+
throw new Error(`Project with id ${id2} not found`);
|
|
13071
|
+
const project2 = result.value;
|
|
13072
|
+
const updateData = {
|
|
13073
|
+
id: project2.id,
|
|
13074
|
+
project_id: project2.project_id,
|
|
13075
|
+
owner_id: project2.owner_id,
|
|
13076
|
+
name: project2.name,
|
|
13077
|
+
description: project2.description,
|
|
13078
|
+
specification: project2.specification,
|
|
13079
|
+
repo_url: project2.repo_url,
|
|
13080
|
+
repo_id: project2.repo_id,
|
|
13081
|
+
icon_url: project2.icon_url,
|
|
13082
|
+
status: project2.status,
|
|
13083
|
+
deleted: project2.deleted,
|
|
13084
|
+
link_url: project2.link_url,
|
|
13085
|
+
link_text: project2.link_text,
|
|
13086
|
+
visibility: project2.visibility,
|
|
13087
|
+
current_version: project2.current_version,
|
|
13088
|
+
...changes
|
|
13089
|
+
};
|
|
13090
|
+
return this.clients.projects.patch("/projects", {
|
|
13091
|
+
body: updateData
|
|
13092
|
+
});
|
|
13093
|
+
}),
|
|
13094
|
+
config: {
|
|
13095
|
+
load: (project_id) => wrap(() => this.clients.projects.get("/projects/config", {
|
|
13096
|
+
query: { project_id }
|
|
13097
|
+
})),
|
|
13098
|
+
save: (request) => wrap(() => this.clients.projects.patch("/projects/save_config", {
|
|
13099
|
+
body: request
|
|
13100
|
+
}))
|
|
13101
|
+
},
|
|
13102
|
+
scan: {
|
|
13103
|
+
initiate: async (project_id) => {
|
|
13104
|
+
const response = await fetch(`${this.clients.projects.url()}/projects/scan?project_id=${project_id}`, {
|
|
13105
|
+
method: "POST",
|
|
13106
|
+
headers: this.clients.projects.headers()
|
|
13107
|
+
});
|
|
13108
|
+
if (!response.body) {
|
|
13109
|
+
throw new Error("No response body");
|
|
13110
|
+
}
|
|
13111
|
+
const stream = response.body.pipeThrough(new TextDecoderStream);
|
|
13112
|
+
return stream;
|
|
13113
|
+
},
|
|
13114
|
+
updates: (project_id) => wrap(() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)),
|
|
13115
|
+
update: (project_id, data) => wrap(() => this.clients.projects.post("/projects/scan_status", {
|
|
13116
|
+
query: { project_id },
|
|
13117
|
+
body: data
|
|
13118
|
+
}))
|
|
13119
|
+
},
|
|
13120
|
+
history: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/history`)),
|
|
13121
|
+
upsert: (data) => wrap(() => this.clients.projects.patch("/projects", { body: data })),
|
|
13122
|
+
specification: (project_id) => wrap(() => this.clients.projects.get("/projects/fetch_spec", {
|
|
13123
|
+
query: { project_id }
|
|
13124
|
+
})),
|
|
13125
|
+
deleteProject: (project2) => wrap(() => this.clients.projects.patch("/projects", {
|
|
13126
|
+
body: { ...project2, deleted: true }
|
|
13127
|
+
}))
|
|
13128
|
+
};
|
|
13129
|
+
this.milestones = {
|
|
13130
|
+
list: () => wrap(() => this.clients.milestones.get("/milestones")),
|
|
13131
|
+
getByProject: (project_id) => wrap(() => this.clients.milestones.get(`/projects/${project_id}/milestones`)),
|
|
13132
|
+
find: (id2) => wrap(async () => {
|
|
13133
|
+
try {
|
|
13134
|
+
return await this.clients.milestones.get(`/milestones/${id2}`);
|
|
13135
|
+
} catch (error) {
|
|
13136
|
+
return null;
|
|
13137
|
+
}
|
|
13138
|
+
}),
|
|
13139
|
+
create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
|
|
13140
|
+
update: async (id2, data) => wrap(async () => {
|
|
13141
|
+
const result = await this.milestones.find(id2);
|
|
13142
|
+
if (!result.ok)
|
|
13143
|
+
throw new Error(result.error.message);
|
|
13144
|
+
if (!result.value)
|
|
13145
|
+
throw new Error(`Milestone with id ${id2} not found`);
|
|
13146
|
+
const milestone2 = result.value;
|
|
13147
|
+
const updateData = {
|
|
13148
|
+
id: milestone2.id,
|
|
13149
|
+
project_id: milestone2.project_id,
|
|
13150
|
+
name: data.name ?? milestone2.name,
|
|
13151
|
+
description: data.description ?? milestone2.description,
|
|
13152
|
+
target_time: data.target_time ?? milestone2.target_time,
|
|
13153
|
+
target_version: data.target_version ?? milestone2.target_version,
|
|
13154
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : milestone2.finished_at
|
|
13155
|
+
};
|
|
13156
|
+
return this.clients.milestones.patch(`/milestones/${id2}`, {
|
|
13157
|
+
body: updateData
|
|
13158
|
+
});
|
|
13159
|
+
}),
|
|
13160
|
+
delete: (id2) => wrap(() => this.clients.milestones.delete(`/milestones/${id2}`)),
|
|
13161
|
+
goals: (id2) => wrap(() => this.clients.milestones.get(`/milestones/${id2}/goals`))
|
|
13162
|
+
};
|
|
13163
|
+
this.goals = {
|
|
13164
|
+
list: () => wrap(() => this.clients.goals.get("/goals")),
|
|
13165
|
+
find: (id2) => wrap(() => this.clients.goals.get(`/goals/${id2}`)),
|
|
13166
|
+
create: (data) => wrap(() => this.clients.goals.post("/goals", { body: data })),
|
|
13167
|
+
update: async (id2, data) => wrap(async () => {
|
|
13168
|
+
const result = await this.goals.find(id2);
|
|
13169
|
+
if (!result.ok)
|
|
13170
|
+
throw new Error(result.error.message);
|
|
13171
|
+
if (!result.value)
|
|
13172
|
+
throw new Error(`Goal with id ${id2} not found`);
|
|
13173
|
+
const goal2 = result.value;
|
|
13174
|
+
const updateData = {
|
|
13175
|
+
id: goal2.id,
|
|
13176
|
+
milestone_id: goal2.milestone_id,
|
|
13177
|
+
name: data.name ?? goal2.name,
|
|
13178
|
+
description: data.description ?? goal2.description,
|
|
13179
|
+
target_time: data.target_time ?? goal2.target_time,
|
|
13180
|
+
finished_at: data.finished_at !== undefined ? data.finished_at : goal2.finished_at
|
|
13181
|
+
};
|
|
13182
|
+
return this.clients.goals.patch(`/goals/${id2}`, {
|
|
13183
|
+
body: updateData
|
|
13184
|
+
});
|
|
13185
|
+
}),
|
|
13186
|
+
delete: (id2) => wrap(() => this.clients.goals.delete(`/goals/${id2}`))
|
|
13187
|
+
};
|
|
13188
|
+
this.tasks = {
|
|
13189
|
+
list: (filters) => wrap(() => {
|
|
13190
|
+
const query = {};
|
|
13191
|
+
if (filters?.project_id)
|
|
13192
|
+
query.project = filters.project_id;
|
|
13193
|
+
if (filters?.tag_id)
|
|
13194
|
+
query.tag = filters.tag_id;
|
|
13195
|
+
return this.clients.tasks.get("/tasks", Object.keys(query).length > 0 ? { query } : {});
|
|
13196
|
+
}),
|
|
13197
|
+
find: (id2) => wrap(() => this.clients.tasks.get("/tasks", { query: { id: id2 } })),
|
|
13198
|
+
getByProject: (project_id) => wrap(() => this.clients.tasks.get(`/tasks`, {
|
|
13199
|
+
query: { project: project_id }
|
|
13200
|
+
})),
|
|
13201
|
+
create: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13202
|
+
update: async (id2, changes) => wrap(async () => {
|
|
13203
|
+
const result = await this.tasks.find(id2);
|
|
13204
|
+
if (!result.ok)
|
|
13205
|
+
throw new Error(result.error.message);
|
|
13206
|
+
if (!result.value)
|
|
13207
|
+
throw new Error(`Task with id ${id2} not found`);
|
|
13208
|
+
const task2 = result.value;
|
|
13209
|
+
const updateData = {
|
|
13210
|
+
id: id2,
|
|
13211
|
+
title: task2.task.title,
|
|
13212
|
+
summary: task2.task.summary,
|
|
13213
|
+
description: task2.task.description,
|
|
13214
|
+
progress: task2.task.progress,
|
|
13215
|
+
visibility: task2.task.visibility,
|
|
13216
|
+
start_time: task2.task.start_time,
|
|
13217
|
+
end_time: task2.task.end_time,
|
|
13218
|
+
priority: task2.task.priority,
|
|
13219
|
+
owner_id: task2.task.owner_id,
|
|
13220
|
+
project_id: task2.task.project_id,
|
|
13221
|
+
...changes
|
|
13222
|
+
};
|
|
13223
|
+
return this.clients.tasks.patch("/tasks", {
|
|
13224
|
+
body: updateData
|
|
13225
|
+
});
|
|
13226
|
+
}),
|
|
13227
|
+
upsert: (data) => wrap(() => this.clients.tasks.patch("/tasks", { body: data })),
|
|
13228
|
+
saveTags: (data) => wrap(() => this.clients.tasks.patch("/tasks/save_tags", { body: data })),
|
|
13229
|
+
deleteTask: (task2) => wrap(() => this.clients.tasks.patch("/tasks", {
|
|
13230
|
+
body: { ...task2.task, deleted: true }
|
|
13231
|
+
})),
|
|
13232
|
+
history: {
|
|
13233
|
+
get: (task_id) => wrap(() => this.clients.tasks.get(`/tasks/history/${task_id}`))
|
|
13234
|
+
}
|
|
13235
|
+
};
|
|
13236
|
+
this.tags = {
|
|
13237
|
+
list: () => wrap(() => this.clients.tags.get("/tags"))
|
|
13238
|
+
};
|
|
13239
|
+
this.github = {
|
|
13240
|
+
repos: () => wrap(() => this.clients.github.get("/repos")),
|
|
13241
|
+
branches: (owner, repo) => wrap(() => this.clients.github.get(`/repos/${owner}/${repo}/branches`))
|
|
13242
|
+
};
|
|
13243
|
+
this.blog = {
|
|
13244
|
+
posts: {
|
|
13245
|
+
list: (params) => wrap(() => {
|
|
13246
|
+
const query = {};
|
|
13247
|
+
if (params?.category)
|
|
13248
|
+
query.category = params.category;
|
|
13249
|
+
if (params?.tag)
|
|
13250
|
+
query.tag = params.tag;
|
|
13251
|
+
if (params?.project)
|
|
13252
|
+
query.project = params.project;
|
|
13253
|
+
if (params?.status)
|
|
13254
|
+
query.status = params.status;
|
|
13255
|
+
if (params?.archived !== undefined)
|
|
13256
|
+
query.archived = String(params.archived);
|
|
13257
|
+
if (params?.limit)
|
|
13258
|
+
query.limit = String(params.limit);
|
|
13259
|
+
if (params?.offset !== undefined)
|
|
13260
|
+
query.offset = String(params.offset);
|
|
13261
|
+
if (params?.sort)
|
|
13262
|
+
query.sort = params.sort;
|
|
13263
|
+
return this.clients.blog.get("/blog/posts", Object.keys(query).length ? { query } : {});
|
|
13264
|
+
}),
|
|
13265
|
+
getBySlug: (slug) => wrap(() => this.clients.blog.get(`/blog/posts/${slug}`)),
|
|
13266
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/posts", { body: data })),
|
|
13267
|
+
update: (uuid, data) => wrap(() => this.clients.blog.put(`/blog/posts/${uuid}`, { body: data })),
|
|
13268
|
+
delete: (uuid) => wrap(() => this.clients.blog.delete(`/blog/posts/${uuid}`)),
|
|
13269
|
+
versions: (uuid) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/versions`)),
|
|
13270
|
+
version: (uuid, hash) => wrap(() => this.clients.blog.get(`/blog/posts/${uuid}/version/${hash}`)),
|
|
13271
|
+
restore: (uuid, hash) => wrap(() => this.clients.blog.post(`/blog/posts/${uuid}/restore/${hash}`))
|
|
13272
|
+
},
|
|
13273
|
+
tags: {
|
|
13274
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tags")),
|
|
13275
|
+
getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
|
|
13276
|
+
setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
13277
|
+
addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
|
|
13278
|
+
removeFromPost: (uuid, tag2) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag2}`))
|
|
13279
|
+
},
|
|
13280
|
+
categories: {
|
|
13281
|
+
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
13282
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
13283
|
+
update: (name, data) => wrap(() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
13284
|
+
body: data
|
|
13285
|
+
})),
|
|
13286
|
+
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
13287
|
+
},
|
|
13288
|
+
tokens: {
|
|
13289
|
+
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
13290
|
+
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
13291
|
+
update: (id2, data) => wrap(() => this.clients.blog.put(`/blog/tokens/${id2}`, {
|
|
13292
|
+
body: data
|
|
13293
|
+
})),
|
|
13294
|
+
delete: (id2) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id2}`))
|
|
13295
|
+
}
|
|
13296
|
+
};
|
|
13297
|
+
this.media = {
|
|
13298
|
+
profiles: {
|
|
13299
|
+
list: () => wrap(async () => {
|
|
13300
|
+
const res = await this.clients.media.get("/profiles");
|
|
13301
|
+
return res.profiles;
|
|
13302
|
+
}),
|
|
13303
|
+
create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
|
|
13304
|
+
get: (id2) => wrap(() => this.clients.media.get(`/profiles/${id2}`)),
|
|
13305
|
+
update: (id2, data) => wrap(() => this.clients.media.patch(`/profiles/${id2}`, { body: data })),
|
|
13306
|
+
delete: (id2) => wrap(() => this.clients.media.delete(`/profiles/${id2}`)),
|
|
13307
|
+
filters: {
|
|
13308
|
+
list: (profile_id) => wrap(async () => {
|
|
13309
|
+
const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
|
|
13310
|
+
return res.filters;
|
|
13311
|
+
}),
|
|
13312
|
+
add: (profile_id, data) => wrap(() => this.clients.media.post(`/profiles/${profile_id}/filters`, { body: data })),
|
|
13313
|
+
remove: (profile_id, filter_id) => wrap(() => this.clients.media.delete(`/profiles/${profile_id}/filters/${filter_id}`))
|
|
13314
|
+
},
|
|
13315
|
+
timeline: (slug, params) => wrap(() => {
|
|
13316
|
+
const query = {};
|
|
13317
|
+
if (params?.limit)
|
|
13318
|
+
query.limit = String(params.limit);
|
|
13319
|
+
if (params?.before)
|
|
13320
|
+
query.before = params.before;
|
|
13321
|
+
return this.clients.media.get(`/profiles/${slug}/timeline`, Object.keys(query).length ? { query } : {});
|
|
13322
|
+
})
|
|
13323
|
+
},
|
|
13324
|
+
connections: {
|
|
13325
|
+
list: (profile_id, options2) => wrap(async () => {
|
|
13326
|
+
const query = { profile_id };
|
|
13327
|
+
if (options2?.include_settings)
|
|
13328
|
+
query.include_settings = "true";
|
|
13329
|
+
const res = await this.clients.media.get("/connections", { query });
|
|
13330
|
+
return res.accounts;
|
|
13331
|
+
}),
|
|
13332
|
+
create: (data) => wrap(() => this.clients.media.post("/connections", { body: data })),
|
|
13333
|
+
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
13334
|
+
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
13335
|
+
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
13336
|
+
updateStatus: (account_id, is_active) => wrap(() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
13337
|
+
body: { is_active }
|
|
13338
|
+
})),
|
|
13339
|
+
settings: {
|
|
13340
|
+
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
13341
|
+
update: (account_id, settings) => wrap(() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
13342
|
+
body: { settings }
|
|
13343
|
+
}))
|
|
13344
|
+
},
|
|
13345
|
+
repos: (account_id) => wrap(async () => {
|
|
13346
|
+
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
13347
|
+
return res.repos;
|
|
13348
|
+
}),
|
|
13349
|
+
subreddits: (account_id) => wrap(async () => {
|
|
13350
|
+
const res = await this.clients.media.get(`/connections/${account_id}/subreddits`);
|
|
13351
|
+
return res.subreddits;
|
|
13352
|
+
})
|
|
13353
|
+
},
|
|
13354
|
+
credentials: {
|
|
13355
|
+
check: (platform, profile_id) => wrap(() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })),
|
|
13356
|
+
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
13357
|
+
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
13358
|
+
},
|
|
13359
|
+
timeline: {
|
|
13360
|
+
get: (user_id, params) => wrap(() => {
|
|
13361
|
+
const query = {};
|
|
13362
|
+
if (params?.from)
|
|
13363
|
+
query.from = params.from;
|
|
13364
|
+
if (params?.to)
|
|
13365
|
+
query.to = params.to;
|
|
13366
|
+
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
13367
|
+
}),
|
|
13368
|
+
getRaw: (user_id, platform, account_id) => wrap(() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
13369
|
+
query: { account_id }
|
|
13370
|
+
}))
|
|
13371
|
+
}
|
|
13372
|
+
};
|
|
13373
|
+
this.activity = {
|
|
13374
|
+
ai: (options2) => wrap(() => {
|
|
13375
|
+
const query = {};
|
|
13376
|
+
if (options2?.limit)
|
|
13377
|
+
query.limit = String(options2.limit);
|
|
13378
|
+
if (options2?.since)
|
|
13379
|
+
query.since = options2.since;
|
|
13380
|
+
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
13381
|
+
})
|
|
13382
|
+
};
|
|
13383
|
+
this.user = {
|
|
13384
|
+
history: () => wrap(() => this.clients.auth.get("/user/history")),
|
|
13385
|
+
preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
|
|
13386
|
+
};
|
|
13387
|
+
this.pulse = {
|
|
13388
|
+
summary: (input) => wrap(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
|
|
13389
|
+
query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
|
|
13390
|
+
})),
|
|
13391
|
+
events: (input) => wrap(() => {
|
|
13392
|
+
const query = {};
|
|
13393
|
+
if (input.name)
|
|
13394
|
+
query.name = input.name;
|
|
13395
|
+
if (input.level)
|
|
13396
|
+
query.level = input.level;
|
|
13397
|
+
if (typeof input.ts_from === "number")
|
|
13398
|
+
query.ts_from = String(input.ts_from);
|
|
13399
|
+
if (typeof input.ts_to === "number")
|
|
13400
|
+
query.ts_to = String(input.ts_to);
|
|
13401
|
+
if (input.search)
|
|
13402
|
+
query.search = input.search;
|
|
13403
|
+
if (input.limit)
|
|
13404
|
+
query.limit = String(input.limit);
|
|
13405
|
+
if (input.cursor)
|
|
13406
|
+
query.cursor = input.cursor;
|
|
13407
|
+
return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
|
|
13408
|
+
}),
|
|
13409
|
+
errors: (input) => wrap(() => {
|
|
13410
|
+
const query = {};
|
|
13411
|
+
if (typeof input.range === "string") {
|
|
13412
|
+
query.range = input.range;
|
|
13413
|
+
} else {
|
|
13414
|
+
query.from = String(input.range.from);
|
|
13415
|
+
query.to = String(input.range.to);
|
|
13416
|
+
}
|
|
13417
|
+
if (input.group_by_fingerprint)
|
|
13418
|
+
query.group_by_fingerprint = "true";
|
|
13419
|
+
return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
|
|
13420
|
+
}),
|
|
13421
|
+
logs: (input) => wrap(() => {
|
|
13422
|
+
const query = {};
|
|
13423
|
+
if (typeof input.range === "string") {
|
|
13424
|
+
query.range = input.range;
|
|
13425
|
+
} else {
|
|
13426
|
+
query.from = String(input.range.from);
|
|
13427
|
+
query.to = String(input.range.to);
|
|
13428
|
+
}
|
|
13429
|
+
if (input.level)
|
|
13430
|
+
query.level = input.level;
|
|
13431
|
+
if (input.search)
|
|
13432
|
+
query.search = input.search;
|
|
13433
|
+
return this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
|
|
13434
|
+
}),
|
|
13435
|
+
latency: (input) => wrap(() => {
|
|
13436
|
+
const query = {};
|
|
13437
|
+
if (typeof input.range === "string") {
|
|
13438
|
+
query.range = input.range;
|
|
13439
|
+
} else {
|
|
13440
|
+
query.from = String(input.range.from);
|
|
13441
|
+
query.to = String(input.range.to);
|
|
13442
|
+
}
|
|
13443
|
+
if (input.route)
|
|
13444
|
+
query.route = input.route;
|
|
13445
|
+
if (input.percentiles && input.percentiles.length > 0)
|
|
13446
|
+
query.percentiles = input.percentiles.join(",");
|
|
13447
|
+
return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
|
|
13448
|
+
}),
|
|
13449
|
+
subs: {
|
|
13450
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
|
|
13451
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
|
|
13452
|
+
body: {
|
|
13453
|
+
project_id: input.project_id,
|
|
13454
|
+
name: input.name,
|
|
13455
|
+
filter: input.filter,
|
|
13456
|
+
channel: input.channel,
|
|
13457
|
+
cooldown_seconds: input.cooldown_seconds
|
|
13458
|
+
}
|
|
13459
|
+
})),
|
|
13460
|
+
get: (id2) => wrap(() => this.clients.pulse.get(`/admin/subs/${id2}`)),
|
|
13461
|
+
update: (id2, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id2}`, { body: patch })),
|
|
13462
|
+
delete: (id2) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id2}`))
|
|
13463
|
+
},
|
|
13464
|
+
keys: {
|
|
13465
|
+
list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
|
|
13466
|
+
create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
|
|
13467
|
+
body: {
|
|
13468
|
+
project_id: input.project_id,
|
|
13469
|
+
name: input.name,
|
|
13470
|
+
rate_limit_per_min: input.rate_limit_per_min
|
|
13471
|
+
}
|
|
13472
|
+
})),
|
|
13473
|
+
delete: (id2, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id2}`, { query: { project_id: input.project_id } }))
|
|
13474
|
+
}
|
|
13475
|
+
};
|
|
13476
|
+
this.pipelines = {
|
|
13477
|
+
dashboard: {
|
|
13478
|
+
get: (input) => {
|
|
13479
|
+
const query = { project_id: input.project_id };
|
|
13480
|
+
if (input.window_ms !== undefined)
|
|
13481
|
+
query.window_ms = String(input.window_ms);
|
|
13482
|
+
return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
|
|
13483
|
+
}
|
|
13484
|
+
},
|
|
13485
|
+
list: (filter) => {
|
|
13486
|
+
const query = {};
|
|
13487
|
+
if (filter?.package_id !== undefined)
|
|
13488
|
+
query.package_id = filter.package_id;
|
|
13489
|
+
if (filter?.status !== undefined)
|
|
13490
|
+
query.status = filter.status;
|
|
13491
|
+
if (filter?.limit !== undefined)
|
|
13492
|
+
query.limit = String(filter.limit);
|
|
13493
|
+
return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
|
|
13494
|
+
},
|
|
13495
|
+
get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
|
|
13496
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
|
|
13497
|
+
body: input
|
|
13498
|
+
})),
|
|
13499
|
+
approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
|
|
13500
|
+
body: input
|
|
13501
|
+
})),
|
|
13502
|
+
cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
|
|
13503
|
+
rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
|
|
13504
|
+
events: {
|
|
13505
|
+
ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, { body: input })),
|
|
13506
|
+
list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
|
|
13507
|
+
},
|
|
13508
|
+
grants: {
|
|
13509
|
+
list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
|
|
13510
|
+
query: package_id ? { package_id } : {}
|
|
13511
|
+
})),
|
|
13512
|
+
approve: (grant_id, user_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
|
|
13513
|
+
body: { user_id }
|
|
13514
|
+
})),
|
|
13515
|
+
deny: (grant_id, user_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
|
|
13516
|
+
body: { user_id, reason }
|
|
13517
|
+
}))
|
|
13518
|
+
},
|
|
13519
|
+
packages: {
|
|
13520
|
+
list: (filter) => {
|
|
13521
|
+
const query = {};
|
|
13522
|
+
if (filter?.project_id !== undefined)
|
|
13523
|
+
query.project_id = filter.project_id;
|
|
13524
|
+
return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
|
|
13525
|
+
},
|
|
13526
|
+
get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
|
|
13527
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
|
|
13528
|
+
update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
|
|
13529
|
+
delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
|
|
13530
|
+
},
|
|
13531
|
+
analysis_templates: {
|
|
13532
|
+
list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", { query: { owner_id: input.owner_id } })),
|
|
13533
|
+
get: (id2, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id2}`, { query: { owner_id: input.owner_id } })),
|
|
13534
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
|
|
13535
|
+
update: (id2, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id2}`, { body: input })),
|
|
13536
|
+
delete: (id2, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id2}`, { query: { owner_id: input.owner_id } }))
|
|
13537
|
+
},
|
|
13538
|
+
oidc_trust: {
|
|
13539
|
+
list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
|
|
13540
|
+
get: (id2, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } })),
|
|
13541
|
+
create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
|
|
13542
|
+
update: (id2, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id2}`, { body: input })),
|
|
13543
|
+
delete: (id2, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } }))
|
|
13544
|
+
}
|
|
13545
|
+
};
|
|
13546
|
+
const base_url = options.base_url || "http://localhost:4321/api/v1";
|
|
13547
|
+
this._api_key = options.api_key ?? "";
|
|
13548
|
+
this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
|
|
13549
|
+
const clientOptions = {
|
|
13550
|
+
base_url,
|
|
13551
|
+
api_key: options.api_key,
|
|
13552
|
+
max_history_size: options.max_history_size,
|
|
13553
|
+
auth_mode: this._auth_mode,
|
|
13554
|
+
credentials: options.credentials,
|
|
13555
|
+
default_headers: options.default_headers,
|
|
13556
|
+
custom_fetch: options.custom_fetch
|
|
13557
|
+
};
|
|
13558
|
+
const auth_base_url = base_url.replace(/\/v1\/?$/, "");
|
|
13559
|
+
this.clients = {
|
|
13560
|
+
auth: new ApiClient({ ...clientOptions, category: "auth" }),
|
|
13561
|
+
auth_root: new ApiClient({
|
|
13562
|
+
...clientOptions,
|
|
13563
|
+
base_url: auth_base_url,
|
|
13564
|
+
category: "auth"
|
|
13565
|
+
}),
|
|
13566
|
+
projects: new ApiClient({ ...clientOptions, category: "projects" }),
|
|
13567
|
+
tasks: new ApiClient({ ...clientOptions, category: "tasks" }),
|
|
13568
|
+
milestones: new ApiClient({ ...clientOptions, category: "milestones" }),
|
|
13569
|
+
goals: new ApiClient({ ...clientOptions, category: "goals" }),
|
|
13570
|
+
github: new ApiClient({ ...clientOptions, category: "github" }),
|
|
13571
|
+
tags: new ApiClient({ ...clientOptions, category: "tags" }),
|
|
13572
|
+
blog: new ApiClient({ ...clientOptions, category: "blog" }),
|
|
13573
|
+
media: new ApiClient({ ...clientOptions, category: "media" }),
|
|
13574
|
+
pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" }),
|
|
13575
|
+
pipelines: new ApiClient({ ...clientOptions, category: "pipelines" })
|
|
13576
|
+
};
|
|
13577
|
+
}
|
|
13578
|
+
history() {
|
|
13579
|
+
return this.clients.projects.history();
|
|
13580
|
+
}
|
|
13581
|
+
getApiKey() {
|
|
13582
|
+
return this._api_key;
|
|
13583
|
+
}
|
|
13584
|
+
getAuthMode() {
|
|
13585
|
+
return this._auth_mode;
|
|
13586
|
+
}
|
|
13587
|
+
};
|
|
13533
13588
|
function unwrap2(result) {
|
|
13534
13589
|
if (!result.ok)
|
|
13535
13590
|
throw new Error(result.error?.message ?? "Unknown error");
|
|
@@ -14141,6 +14196,31 @@ var tools = {
|
|
|
14141
14196
|
return { success: true };
|
|
14142
14197
|
}
|
|
14143
14198
|
},
|
|
14199
|
+
devpad_pipelines_runs_events_ingest: {
|
|
14200
|
+
name: "devpad_pipelines_runs_events_ingest",
|
|
14201
|
+
description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
|
|
14202
|
+
inputSchema: exports_external.object({
|
|
14203
|
+
run_id: exports_external.string().describe("Pipeline run ID"),
|
|
14204
|
+
stage_name: exports_external.string().min(1).describe("Stage the event is associated with"),
|
|
14205
|
+
kind: exports_external.enum(STAGE_EVENT_KINDS).describe("Event kind from STAGE_EVENT_KINDS"),
|
|
14206
|
+
payload: exports_external.unknown().optional().describe("Arbitrary JSON payload — server-side stamps source = external"),
|
|
14207
|
+
idempotency_key: exports_external.string().uuid().describe("UUID idempotency key; reuse with the same payload returns duplicated:true")
|
|
14208
|
+
}),
|
|
14209
|
+
execute: async (client, input) => unwrap2(await client.pipelines.events.ingest(input.run_id, {
|
|
14210
|
+
stage_name: input.stage_name,
|
|
14211
|
+
kind: input.kind,
|
|
14212
|
+
payload: input.payload,
|
|
14213
|
+
idempotency_key: input.idempotency_key
|
|
14214
|
+
}))
|
|
14215
|
+
},
|
|
14216
|
+
devpad_pipelines_runs_events_list: {
|
|
14217
|
+
name: "devpad_pipelines_runs_events_list",
|
|
14218
|
+
description: "List stored stage events for a pipeline run, newest-first",
|
|
14219
|
+
inputSchema: exports_external.object({
|
|
14220
|
+
run_id: exports_external.string().describe("Pipeline run ID")
|
|
14221
|
+
}),
|
|
14222
|
+
execute: async (client, input) => unwrap2(await client.pipelines.events.list(input.run_id))
|
|
14223
|
+
},
|
|
14144
14224
|
devpad_pipelines_grants_list: {
|
|
14145
14225
|
name: "devpad_pipelines_grants_list",
|
|
14146
14226
|
description: "List vault grants for a pipeline package",
|
|
@@ -14220,6 +14300,60 @@ var tools = {
|
|
|
14220
14300
|
}),
|
|
14221
14301
|
execute: async (client, input) => unwrap2(await client.pipelines.packages.delete(input.id))
|
|
14222
14302
|
},
|
|
14303
|
+
devpad_pipelines_analysis_templates_list: {
|
|
14304
|
+
name: "devpad_pipelines_analysis_templates_list",
|
|
14305
|
+
description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
|
|
14306
|
+
inputSchema: exports_external.object({
|
|
14307
|
+
owner_id: exports_external.string().describe("Devpad user ID whose templates to list")
|
|
14308
|
+
}),
|
|
14309
|
+
execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.list(input))
|
|
14310
|
+
},
|
|
14311
|
+
devpad_pipelines_analysis_templates_get: {
|
|
14312
|
+
name: "devpad_pipelines_analysis_templates_get",
|
|
14313
|
+
description: "Get a single pipeline analysis template by id, scoped to its owner.",
|
|
14314
|
+
inputSchema: exports_external.object({
|
|
14315
|
+
id: exports_external.string().describe("Pipeline analysis template ID"),
|
|
14316
|
+
owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
|
|
14317
|
+
}),
|
|
14318
|
+
execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.get(input.id, { owner_id: input.owner_id }))
|
|
14319
|
+
},
|
|
14320
|
+
devpad_pipelines_analysis_templates_create: {
|
|
14321
|
+
name: "devpad_pipelines_analysis_templates_create",
|
|
14322
|
+
description: 'Create a new pipeline analysis template. `threshold_dsl` is a multi-line DSL: `metric_name OP value [: pending]` (OPs: > < >= <= =). Trailing ": pending" marks a breach as Pending rather than Fail. Server-side parse failure surfaces as `validation_error` with field=threshold_dsl. `window_ms` defaults to 600000 (10 min).',
|
|
14323
|
+
inputSchema: exports_external.object({
|
|
14324
|
+
owner_id: exports_external.string().describe("Devpad user ID who owns this template"),
|
|
14325
|
+
name: exports_external.string().describe('Human-readable name (e.g. "default-analysis")'),
|
|
14326
|
+
threshold_dsl: exports_external.string().describe("Multi-line threshold DSL"),
|
|
14327
|
+
query_dsl: exports_external.unknown().optional().describe("Optional structured query DSL stored alongside thresholds"),
|
|
14328
|
+
window_ms: exports_external.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
|
|
14329
|
+
}),
|
|
14330
|
+
execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.create(input))
|
|
14331
|
+
},
|
|
14332
|
+
devpad_pipelines_analysis_templates_update: {
|
|
14333
|
+
name: "devpad_pipelines_analysis_templates_update",
|
|
14334
|
+
description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
|
|
14335
|
+
inputSchema: exports_external.object({
|
|
14336
|
+
id: exports_external.string().describe("Pipeline analysis template ID"),
|
|
14337
|
+
owner_id: exports_external.string().describe("Owner ID (must match the template's owner)"),
|
|
14338
|
+
name: exports_external.string().optional(),
|
|
14339
|
+
threshold_dsl: exports_external.string().optional(),
|
|
14340
|
+
query_dsl: exports_external.unknown().optional(),
|
|
14341
|
+
window_ms: exports_external.number().int().positive().optional()
|
|
14342
|
+
}),
|
|
14343
|
+
execute: async (client, input) => {
|
|
14344
|
+
const { id: id2, ...patch } = input;
|
|
14345
|
+
return unwrap2(await client.pipelines.analysis_templates.update(id2, patch));
|
|
14346
|
+
}
|
|
14347
|
+
},
|
|
14348
|
+
devpad_pipelines_analysis_templates_delete: {
|
|
14349
|
+
name: "devpad_pipelines_analysis_templates_delete",
|
|
14350
|
+
description: "Hard-delete a pipeline analysis template. Does NOT consult pipeline_run.resolved_gates — runs snapshot their gate template at resolve-time, so deletion never orphans in-flight runs.",
|
|
14351
|
+
inputSchema: exports_external.object({
|
|
14352
|
+
id: exports_external.string().describe("Pipeline analysis template ID"),
|
|
14353
|
+
owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
|
|
14354
|
+
}),
|
|
14355
|
+
execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.delete(input.id, { owner_id: input.owner_id }))
|
|
14356
|
+
},
|
|
14223
14357
|
devpad_pipelines_oidc_trust_list: {
|
|
14224
14358
|
name: "devpad_pipelines_oidc_trust_list",
|
|
14225
14359
|
description: "List GitHub Actions OIDC trust policies for an owner. Returned ordered by created_at DESC, id ASC to match the orchestrator's trust-matcher resolution order.",
|