@devpad/api 2.2.6 → 2.2.7

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.
@@ -0,0 +1,238 @@
1
+ // ../schema/dist/validation.js
2
+ import { z } from "zod";
3
+ var upsert_project = z.object({
4
+ id: z.string().optional().nullable(),
5
+ project_id: z.string(),
6
+ owner_id: z.string().optional(),
7
+ name: z.string(),
8
+ description: z.string().nullable(),
9
+ specification: z.string().nullable(),
10
+ repo_url: z.string().nullable(),
11
+ repo_id: z.number().nullable(),
12
+ icon_url: z.string().nullable(),
13
+ status: z.union([z.literal("DEVELOPMENT"), z.literal("PAUSED"), z.literal("RELEASED"), z.literal("LIVE"), z.literal("FINISHED"), z.literal("ABANDONED"), z.literal("STOPPED")]).optional(),
14
+ deleted: z.boolean().optional().default(false),
15
+ link_url: z.string().nullable(),
16
+ link_text: z.string().nullable(),
17
+ visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
18
+ current_version: z.string().nullable(),
19
+ force: z.boolean().optional().describe("Override protection on user-modified entities")
20
+ });
21
+ var upsert_todo = z.object({
22
+ id: z.string().optional().nullable(),
23
+ title: z.string().optional(),
24
+ summary: z.string().optional().nullable(),
25
+ description: z.string().optional().nullable(),
26
+ progress: z.union([z.literal("UNSTARTED"), z.literal("IN_PROGRESS"), z.literal("COMPLETED")]).optional(),
27
+ visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
28
+ start_time: z.string().optional().nullable(),
29
+ end_time: z.string().optional().nullable(),
30
+ priority: z.union([z.literal("LOW"), z.literal("MEDIUM"), z.literal("HIGH")]).optional(),
31
+ owner_id: z.string(),
32
+ project_id: z.string().optional().nullable(),
33
+ goal_id: z.string().optional().nullable(),
34
+ force: z.boolean().optional().describe("Override protection on user-modified entities")
35
+ });
36
+ var update_action = z.union([z.literal("CONFIRM"), z.literal("UNLINK"), z.literal("CREATE"), z.literal("IGNORE"), z.literal("DELETE"), z.literal("COMPLETE")]);
37
+ var upsert_tag = z.object({
38
+ id: z.string().optional(),
39
+ title: z.string(),
40
+ color: z.union([z.literal("red"), z.literal("green"), z.literal("blue"), z.literal("yellow"), z.literal("purple"), z.literal("orange"), z.literal("teal"), z.literal("pink"), z.literal("gray"), z.literal("cyan"), z.literal("lime")]).nullable().optional(),
41
+ deleted: z.boolean().optional().default(false),
42
+ render: z.boolean().optional().default(true),
43
+ owner_id: z.string()
44
+ });
45
+ var project_config = z.object({
46
+ tags: z.array(z.object({
47
+ name: z.string(),
48
+ match: z.array(z.string())
49
+ })),
50
+ ignore: z.array(z.string())
51
+ });
52
+ var save_config_request = z.object({
53
+ id: z.string(),
54
+ config: project_config,
55
+ scan_branch: z.string().optional()
56
+ });
57
+ var save_tags_request = z.array(upsert_tag);
58
+ var update_user = z.object({
59
+ id: z.string(),
60
+ name: z.string().optional(),
61
+ image_url: z.string().optional(),
62
+ task_view: z.union([z.literal("list"), z.literal("grid")]).optional(),
63
+ email_verified: z.boolean().optional()
64
+ });
65
+ var config_schema = z.object({
66
+ tags: z.array(z.object({
67
+ name: z.string(),
68
+ match: z.array(z.string())
69
+ })),
70
+ ignore: z.array(z.string().regex(/^[\s\S]*$/, "Invalid path"))
71
+ });
72
+ var upsert_milestone = z.object({
73
+ id: z.string().optional().nullable(),
74
+ project_id: z.string(),
75
+ name: z.string().min(1).max(200),
76
+ description: z.string().nullable().optional(),
77
+ target_time: z.string().nullable().optional(),
78
+ target_version: z.string().nullable().optional(),
79
+ finished_at: z.string().nullable().optional(),
80
+ after_id: z.string().nullable().optional(),
81
+ force: z.boolean().optional().describe("Override protection on user-modified entities")
82
+ });
83
+ var upsert_goal = z.object({
84
+ id: z.string().optional().nullable(),
85
+ milestone_id: z.string(),
86
+ name: z.string().min(1).max(200),
87
+ description: z.string().nullable().optional(),
88
+ target_time: z.string().nullable().optional(),
89
+ finished_at: z.string().nullable().optional(),
90
+ force: z.boolean().optional().describe("Override protection on user-modified entities")
91
+ });
92
+ var rollout_shape = z.union([z.literal("gradual"), z.literal("atomic")]);
93
+ var run_kind = z.union([z.literal("deploy"), z.literal("rollback")]);
94
+ var run_status = z.union([
95
+ z.literal("queued"),
96
+ z.literal("deploying"),
97
+ z.literal("baking"),
98
+ z.literal("awaiting_approval"),
99
+ z.literal("rolling_back"),
100
+ z.literal("completed"),
101
+ z.literal("rolled_back"),
102
+ z.literal("failed"),
103
+ z.literal("cancelled")
104
+ ]);
105
+ var forced_atomic_reason = z.union([z.literal("do_migrations"), z.literal("asset_affinity_none")]);
106
+ var stage_event_kind = z.union([
107
+ z.literal("deploy_started"),
108
+ z.literal("deploy_completed"),
109
+ z.literal("bake_started"),
110
+ z.literal("bake_completed"),
111
+ z.literal("gate_verdict"),
112
+ z.literal("approval_requested"),
113
+ z.literal("rollback_started"),
114
+ z.literal("rollback_completed"),
115
+ z.literal("warning"),
116
+ z.literal("error")
117
+ ]);
118
+ var approval_decision = z.union([z.literal("approved"), z.literal("denied")]);
119
+ var grant_scope = z.string().regex(/^[a-z0-9_-]+:[a-z0-9_-]+(:[^\s]+)?$/, "Invalid scope format");
120
+ var rollout_stage = z.object({
121
+ name: z.string(),
122
+ traffic: z.number().int().min(0).max(100),
123
+ bake: z.string().nullable()
124
+ });
125
+ var resolved_rollout = z.discriminatedUnion("type", [
126
+ z.object({
127
+ type: z.literal("gradual"),
128
+ stages: z.array(rollout_stage)
129
+ }),
130
+ z.object({
131
+ type: z.literal("atomic")
132
+ })
133
+ ]);
134
+ var gate_descriptor = z.discriminatedUnion("type", [
135
+ z.object({ type: z.literal("manual") }),
136
+ z.object({ type: z.literal("auto"), afterBake: z.boolean().optional() }),
137
+ z.object({ type: z.literal("analysis"), template: z.string() })
138
+ ]);
139
+ var resolved_gates = z.record(z.string(), gate_descriptor);
140
+ var upsert_pipeline_package = z.object({
141
+ id: z.string().optional().nullable(),
142
+ owner_id: z.string(),
143
+ name: z.string().min(1).max(200),
144
+ repo_url: z.string().nullable().optional(),
145
+ default_template_ref: z.string().nullable().optional(),
146
+ script_name_overrides: z.record(z.string(), z.string()).nullable().optional(),
147
+ project_id: z.string().nullable().optional()
148
+ });
149
+ var upsert_pipeline_run = z.object({
150
+ id: z.string().optional().nullable(),
151
+ package_id: z.string(),
152
+ version_set_id: z.string(),
153
+ shape: rollout_shape,
154
+ kind: run_kind.optional(),
155
+ status: run_status.optional(),
156
+ current_stage: z.string().nullable().optional(),
157
+ resolved_rollout,
158
+ resolved_gates,
159
+ forced_atomic_reason: forced_atomic_reason.nullable().optional(),
160
+ started_at: z.string().nullable().optional(),
161
+ finished_at: z.string().nullable().optional()
162
+ });
163
+ var insert_pipeline_stage_event = z.object({
164
+ run_id: z.string(),
165
+ stage_name: z.string(),
166
+ kind: stage_event_kind,
167
+ payload: z.unknown().optional()
168
+ });
169
+ var upsert_pipeline_grant = z.object({
170
+ id: z.string().optional().nullable(),
171
+ package_id: z.string(),
172
+ stage_name: z.string(),
173
+ scope: grant_scope,
174
+ granted_by: z.string().nullable().optional(),
175
+ granted_at: z.string().nullable().optional()
176
+ });
177
+ var upsert_pipeline_approval = z.object({
178
+ run_id: z.string(),
179
+ stage_name: z.string(),
180
+ decision: approval_decision.nullable().optional(),
181
+ reason: z.string().nullable().optional(),
182
+ decided_by: z.string().nullable().optional(),
183
+ decided_at: z.string().nullable().optional()
184
+ });
185
+ var upsert_pipeline_analysis_template = z.object({
186
+ id: z.string().optional().nullable(),
187
+ owner_id: z.string(),
188
+ name: z.string().min(1).max(200),
189
+ query_dsl: z.unknown(),
190
+ threshold_dsl: z.unknown()
191
+ });
192
+ var pipeline_oidc_provider = z.literal("github");
193
+ var upsert_pipeline_oidc_trust = z.object({
194
+ id: z.string().optional().nullable(),
195
+ owner_id: z.string(),
196
+ provider: pipeline_oidc_provider.optional(),
197
+ github_owner: z.string().min(1).max(200),
198
+ repo_pattern: z.string().min(1).max(200).optional(),
199
+ allowed_refs: z.array(z.string()).optional(),
200
+ allowed_environments: z.array(z.string()).optional(),
201
+ expected_audience: z.string().min(1),
202
+ allowed_actions: z.array(z.string()).optional(),
203
+ session_ttl_seconds: z.number().int().positive().optional(),
204
+ last_used_at: z.string().nullable().optional()
205
+ });
206
+
207
+ export {
208
+ upsert_project,
209
+ upsert_todo,
210
+ update_action,
211
+ upsert_tag,
212
+ project_config,
213
+ save_config_request,
214
+ save_tags_request,
215
+ update_user,
216
+ config_schema,
217
+ upsert_milestone,
218
+ upsert_goal,
219
+ rollout_shape,
220
+ run_kind,
221
+ run_status,
222
+ forced_atomic_reason,
223
+ stage_event_kind,
224
+ approval_decision,
225
+ grant_scope,
226
+ rollout_stage,
227
+ resolved_rollout,
228
+ gate_descriptor,
229
+ resolved_gates,
230
+ upsert_pipeline_package,
231
+ upsert_pipeline_run,
232
+ insert_pipeline_stage_event,
233
+ upsert_pipeline_grant,
234
+ upsert_pipeline_approval,
235
+ upsert_pipeline_analysis_template,
236
+ pipeline_oidc_provider,
237
+ upsert_pipeline_oidc_trust
238
+ };
@@ -166,4 +166,4 @@ declare const errors: {
166
166
  };
167
167
  };
168
168
 
169
- export { dbError as $, type AuthExpiredError as A, type BaseError as B, type ConflictError as C, type DatabaseError as D, type EncryptionError as E, type ForbiddenError as F, type GithubError as G, isScanError as H, isGithubError as I, isServiceError as J, isRetryableError as K, notFound as L, forbidden as M, type NotFoundError as N, validation as O, type ParseError as P, rateLimited as Q, type RateLimitedError as R, type StoreError as S, storeError as T, type UnauthorizedError as U, type ValidationError as V, networkError as W, authExpired as X, apiError as Y, parseError as Z, encryptionError as _, type NetworkError as a, conflict as a0, protectedEntity as a1, badRequest as a2, unauthorized as a3, scanError as a4, githubError as a5, errors as a6, type ApiError as b, type ProtectedError as c, type BadRequestError as d, type ScanError as e, type ServiceError as f, type ProviderError as g, type CronError as h, type ErrorContext as i, type ErrorLogEntry as j, configureErrorLogging as k, isNotFoundError as l, isForbiddenError as m, isValidationError as n, isRateLimitedError as o, isStoreError as p, isNetworkError as q, isAuthExpiredError as r, isApiError as s, isParseError as t, isEncryptionError as u, isDatabaseError as v, isConflictError as w, isProtectedError as x, isBadRequestError as y, isUnauthorizedError as z };
169
+ export { notFound as $, type ApiError as A, type BadRequestError as B, type ConflictError as C, type DatabaseError as D, type EncryptionError as E, type ForbiddenError as F, type GithubError as G, isForbiddenError as H, isGithubError as I, isNetworkError as J, isNotFoundError as K, isParseError as L, isProtectedError as M, type NetworkError as N, isRateLimitedError as O, type ParseError as P, isRetryableError as Q, type RateLimitedError as R, type ScanError as S, isScanError as T, type UnauthorizedError as U, type ValidationError as V, isServiceError as W, isStoreError as X, isUnauthorizedError as Y, isValidationError as Z, networkError as _, type AuthExpiredError as a, parseError as a0, protectedEntity as a1, rateLimited as a2, scanError as a3, storeError as a4, unauthorized as a5, validation as a6, type BaseError as b, type CronError as c, type ErrorContext as d, type ErrorLogEntry as e, type NotFoundError as f, type ProtectedError as g, type ProviderError as h, type ServiceError as i, type StoreError as j, apiError as k, authExpired as l, badRequest as m, configureErrorLogging as n, conflict as o, dbError as p, encryptionError as q, errors as r, forbidden as s, githubError as t, isApiError as u, isAuthExpiredError as v, isBadRequestError as w, isConflictError as x, isDatabaseError as y, isEncryptionError as z };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { Q as PostListParams, S as PostsResponse, J as Post, L as PostCreate, N as PostUpdate, d as VersionInfo, a as PostContent, k as Category, $ as CategoryCreate, v as AccessKey } from './types.d-DLE9TSql.js';
2
- import { T as Profile, a4 as CreateProfileInput, a5 as UpdateProfileInput, U as ProfileFilter, a6 as AddFilterInput, aI as Timeline, A as Account, ai as PlatformSettings } from './types.d-VdW3W-u7.js';
3
- import { A as ApiKey, P as Project, g as UpsertProject, r as GetConfigResult, n as SaveConfigRequest, M as Milestone, G as Goal, o as TaskWithDetails, h as UpsertTodo, i as UpsertTag, H as HistoryAction, u as TagWithTypedColor } from './types.d-CW-e2BrO.js';
4
- export { m as ProjectConfig, T as Task } from './types.d-CW-e2BrO.js';
1
+ import { G as PostListParams, T as PostsResponse, x as Post, D as PostCreate, Q as PostUpdate, Z as VersionInfo, y as PostContent, C as Category, k as CategoryCreate, A as AccessKey } from './types.d-B3vp62jJ.js';
2
+ import { ai as Profile, u as CreateProfileInput, aw as UpdateProfileInput, aj as ProfileFilter, c as AddFilterInput, aq as Timeline, A as Account, ae as PlatformSettings } from './types.d-YhCFiUtt.js';
3
+ import { a as ApiKey, k as Project, X as UpsertProject, G as GetConfigResult, S as SaveConfigRequest, M as Milestone, c as Goal, y as TaskWithDetails, Z as UpsertTodo, Y as UpsertTag, H as HistoryAction, u as TagWithTypedColor, i as PipelineRun, f as PipelineGrant, h as PipelinePackage, g as PipelineOidcTrust } from './types.d-i9gbGlha.js';
4
+ export { l as ProjectConfig, v as Task } from './types.d-i9gbGlha.js';
5
5
  import { Result } from '@f0rbit/corpus';
6
6
  export { Result, err, ok } from '@f0rbit/corpus';
7
7
  import { z } from 'zod';
8
8
  import 'drizzle-orm';
9
- import './media.d-CQ56ckoR.js';
9
+ import './media.d-R87HGuRp.js';
10
10
  import 'drizzle-orm/sqlite-core';
11
- import './schema.d-Bka8880l.js';
11
+ import './schema.d-DFyjWZV1.js';
12
12
 
13
13
  interface BufferedQueue<T> {
14
14
  latest(): T | null;
@@ -652,6 +652,183 @@ declare class ApiClient {
652
652
  }>>;
653
653
  };
654
654
  };
655
+ /**
656
+ * Pipelines namespace with Result-wrapped operations
657
+ */
658
+ readonly pipelines: {
659
+ /**
660
+ * List pipeline runs ordered by `created_at` DESC. Optional filters
661
+ * narrow by package and/or status; `limit` defaults to 50 server-side
662
+ * and is capped at 200.
663
+ */
664
+ list: (filter?: {
665
+ package_id?: string;
666
+ status?: string;
667
+ limit?: number;
668
+ }) => Promise<ApiResult<PipelineRun[]>>;
669
+ /**
670
+ * Get a pipeline run by ID
671
+ */
672
+ get: (run_id: string) => Promise<ApiResult<PipelineRun>>;
673
+ /**
674
+ * Create a new pipeline run
675
+ */
676
+ create: (input: {
677
+ package_id: string;
678
+ version_set_id: string;
679
+ }) => Promise<ApiResult<{
680
+ run_id: string;
681
+ status: string;
682
+ }>>;
683
+ /**
684
+ * Approve a stage in a pipeline run
685
+ */
686
+ approve: (run_id: string, input: {
687
+ stage_name: string;
688
+ decision: "approved" | "denied";
689
+ user_id: string;
690
+ reason?: string;
691
+ }) => Promise<ApiResult<void>>;
692
+ /**
693
+ * Cancel a pipeline run
694
+ */
695
+ cancel: (run_id: string) => Promise<ApiResult<void>>;
696
+ /**
697
+ * Rollback a pipeline run
698
+ */
699
+ rollback: (run_id: string) => Promise<ApiResult<void>>;
700
+ /**
701
+ * Grants namespace
702
+ */
703
+ grants: {
704
+ /**
705
+ * List grants for a package
706
+ */
707
+ list: (package_id?: string) => Promise<ApiResult<PipelineGrant[]>>;
708
+ /**
709
+ * Approve a grant
710
+ */
711
+ approve: (grant_id: string, user_id: string) => Promise<ApiResult<PipelineGrant>>;
712
+ /**
713
+ * Deny a grant
714
+ */
715
+ deny: (grant_id: string, user_id: string, reason?: string) => Promise<ApiResult<{
716
+ success: boolean;
717
+ }>>;
718
+ };
719
+ /**
720
+ * Packages namespace — full CRUD over pipeline_package rows. Writes
721
+ * (create/update/delete) require the orchestrator bearer token; the
722
+ * HttpClient picks it up via the standard auth header injection.
723
+ */
724
+ packages: {
725
+ /**
726
+ * List packages, optionally filtered by linked devpad project.
727
+ * Packages with `project_id = null` are not yet linked.
728
+ */
729
+ list: (filter?: {
730
+ project_id?: string;
731
+ }) => Promise<ApiResult<PipelinePackage[]>>;
732
+ /**
733
+ * Get a single package by id
734
+ */
735
+ get: (package_id: string) => Promise<ApiResult<PipelinePackage>>;
736
+ /**
737
+ * Register a new pipeline package. `id` is canonically the same as
738
+ * `name` per existing convention but is supplied explicitly so the
739
+ * orchestrator can disambiguate renames without conflicts.
740
+ */
741
+ create: (input: {
742
+ id: string;
743
+ name: string;
744
+ owner_id: string;
745
+ repo_url?: string | null;
746
+ project_id?: string | null;
747
+ default_template_ref?: string | null;
748
+ }) => Promise<ApiResult<PipelinePackage>>;
749
+ /**
750
+ * Partially update a package row. Missing keys preserve existing
751
+ * values; explicit `null` clears the field.
752
+ */
753
+ update: (package_id: string, input: {
754
+ repo_url?: string | null;
755
+ project_id?: string | null;
756
+ default_template_ref?: string | null;
757
+ script_name_overrides?: Record<string, string> | null;
758
+ }) => Promise<ApiResult<PipelinePackage>>;
759
+ /**
760
+ * Remove a package. Refuses (409) if pipeline_run rows still
761
+ * reference the package — clean up runs first.
762
+ */
763
+ delete: (package_id: string) => Promise<ApiResult<{
764
+ deleted: true;
765
+ }>>;
766
+ };
767
+ /**
768
+ * OIDC trust-policy namespace — admin-gated CRUD for the
769
+ * `pipeline_oidc_trust` table. Phase 15.D surface; each call requires
770
+ * the orchestrator's bearer token (literal `PIPELINES_TOKEN`).
771
+ * `owner_id` is required on every operation — single-tenant today,
772
+ * but the column is in place so multi-user ACLs slot in later.
773
+ */
774
+ oidc_trust: {
775
+ /**
776
+ * List policies for an owner, ordered created_at DESC, id ASC —
777
+ * matches the trust-matcher resolution order so the management UI
778
+ * shows the policy that would be picked first.
779
+ */
780
+ list: (input: {
781
+ owner_id: string;
782
+ }) => Promise<ApiResult<PipelineOidcTrust[]>>;
783
+ /**
784
+ * Get a single policy by id, scoped to its owner. 404 when
785
+ * unknown, soft-deleted, or owned by a different user.
786
+ */
787
+ get: (id: string, input: {
788
+ owner_id: string;
789
+ }) => Promise<ApiResult<PipelineOidcTrust>>;
790
+ /**
791
+ * Create a new policy. Defaults per plan §I.5: `repo_pattern: "*"`,
792
+ * `allowed_actions: ["artifacts:upload","runs:start"]`,
793
+ * `session_ttl_seconds: 900`.
794
+ */
795
+ create: (input: {
796
+ owner_id: string;
797
+ github_owner: string;
798
+ expected_audience: string;
799
+ provider?: "github";
800
+ repo_pattern?: string;
801
+ allowed_refs?: string[];
802
+ allowed_environments?: string[];
803
+ allowed_actions?: string[];
804
+ session_ttl_seconds?: number;
805
+ }) => Promise<ApiResult<PipelineOidcTrust>>;
806
+ /**
807
+ * Partial patch — only the supplied fields are touched. Validation
808
+ * runs against the merged record server-side.
809
+ */
810
+ update: (id: string, input: {
811
+ owner_id: string;
812
+ github_owner?: string;
813
+ expected_audience?: string;
814
+ repo_pattern?: string;
815
+ allowed_refs?: string[];
816
+ allowed_environments?: string[];
817
+ allowed_actions?: string[];
818
+ session_ttl_seconds?: number;
819
+ }) => Promise<ApiResult<PipelineOidcTrust>>;
820
+ /**
821
+ * Soft-delete a policy (sets `deleted = true`; row preserved for
822
+ * audit). The matcher and management list both skip soft-deleted
823
+ * rows.
824
+ */
825
+ delete: (id: string, input: {
826
+ owner_id: string;
827
+ }) => Promise<ApiResult<{
828
+ deleted: true;
829
+ }>>;
830
+ };
831
+ };
655
832
  /**
656
833
  * Get the API key
657
834
  */