@devpad/api 2.2.7 → 2.2.8

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.
@@ -69,7 +69,11 @@ type ScanError = BaseError & {
69
69
  type GithubError = BaseError & {
70
70
  kind: "github_error";
71
71
  };
72
- type ServiceError = NotFoundError | ForbiddenError | ValidationError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | ProtectedError | BadRequestError | UnauthorizedError | ScanError | GithubError;
72
+ type ValidationFieldError = BaseError & {
73
+ kind: "validation_error";
74
+ field: string;
75
+ };
76
+ type ServiceError = NotFoundError | ForbiddenError | ValidationError | ValidationFieldError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | ProtectedError | BadRequestError | UnauthorizedError | ScanError | GithubError;
73
77
  type ProviderError = RateLimitedError | AuthExpiredError | NetworkError | ApiError | ParseError;
74
78
  type CronError = StoreError | NetworkError | AuthExpiredError | EncryptionError;
75
79
  type ErrorContext = {
@@ -106,6 +110,7 @@ declare const isBadRequestError: (e: unknown) => e is BadRequestError;
106
110
  declare const isUnauthorizedError: (e: unknown) => e is UnauthorizedError;
107
111
  declare const isScanError: (e: unknown) => e is ScanError;
108
112
  declare const isGithubError: (e: unknown) => e is GithubError;
113
+ declare const isValidationFieldError: (e: unknown) => e is ValidationFieldError;
109
114
  declare const isServiceError: (e: unknown) => e is ServiceError;
110
115
  declare const isRetryableError: (e: unknown) => boolean;
111
116
  declare const notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
@@ -125,6 +130,7 @@ declare const badRequest: (message?: string, details?: unknown, ctx?: Record<str
125
130
  declare const unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
126
131
  declare const scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
127
132
  declare const githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
133
+ declare const validationFieldError: (field: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ValidationFieldError>;
128
134
  declare const errors: {
129
135
  readonly notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
130
136
  readonly forbidden: (reason?: string, ctx?: Record<string, unknown>) => Result<never, ForbiddenError>;
@@ -143,10 +149,12 @@ declare const errors: {
143
149
  readonly unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
144
150
  readonly scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
145
151
  readonly githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
152
+ readonly validationFieldError: (field: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ValidationFieldError>;
146
153
  readonly is: {
147
154
  readonly notFound: (e: unknown) => e is NotFoundError;
148
155
  readonly forbidden: (e: unknown) => e is ForbiddenError;
149
156
  readonly validation: (e: unknown) => e is ValidationError;
157
+ readonly validationField: (e: unknown) => e is ValidationFieldError;
150
158
  readonly rateLimited: (e: unknown) => e is RateLimitedError;
151
159
  readonly storeError: (e: unknown) => e is StoreError;
152
160
  readonly networkError: (e: unknown) => e is NetworkError;
@@ -166,4 +174,4 @@ declare const errors: {
166
174
  };
167
175
  };
168
176
 
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 };
177
+ export { isValidationFieldError 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, isEncryptionError as H, isForbiddenError as I, isGithubError as J, isNetworkError as K, isNotFoundError as L, isParseError as M, type NetworkError as N, isProtectedError as O, type ParseError as P, isRateLimitedError as Q, type RateLimitedError as R, type ScanError as S, isRetryableError as T, type UnauthorizedError as U, type ValidationError as V, isScanError as W, isServiceError as X, isStoreError as Y, isUnauthorizedError as Z, isValidationError as _, type AuthExpiredError as a, networkError as a0, notFound as a1, parseError as a2, protectedEntity as a3, rateLimited as a4, scanError as a5, storeError as a6, unauthorized as a7, validation as a8, validationFieldError as a9, 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, type ValidationFieldError as k, apiError as l, authExpired as m, badRequest as n, configureErrorLogging as o, conflict as p, dbError as q, encryptionError as r, errors as s, forbidden as t, githubError as u, isApiError as v, isAuthExpiredError as w, isBadRequestError as x, isConflictError as y, isDatabaseError as z };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
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';
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-BcKx3ryl.js';
3
+ import { a as ApiKey, l as Project, Z as UpsertProject, G as GetConfigResult, S as SaveConfigRequest, M as Milestone, d as Goal, z as TaskWithDetails, $ as UpsertTodo, _ as UpsertTag, H as HistoryAction, v as TagWithTypedColor, D as DashboardResponse, j as PipelineRun, k as PipelineStageEvent, g as PipelineGrant, i as PipelinePackage, P as PipelineAnalysisTemplate, h as PipelineOidcTrust } from './types.d-BvfRohlZ.js';
4
+ export { m as ProjectConfig, w as Task } from './types.d-BvfRohlZ.js';
5
5
  import { Result } from '@f0rbit/corpus';
6
6
  export { Result, err, ok } from '@f0rbit/corpus';
7
+ import { S as StageEventKind } from './schema.d-BeVFWenc.js';
7
8
  import { z } from 'zod';
8
9
  import 'drizzle-orm';
9
10
  import './media.d-R87HGuRp.js';
10
11
  import 'drizzle-orm/sqlite-core';
11
- import './schema.d-DFyjWZV1.js';
12
12
 
13
13
  interface BufferedQueue<T> {
14
14
  latest(): T | null;
@@ -656,6 +656,25 @@ declare class ApiClient {
656
656
  * Pipelines namespace with Result-wrapped operations
657
657
  */
658
658
  readonly pipelines: {
659
+ /**
660
+ * Dashboard namespace — Phase 2.D observability slice. Aggregates
661
+ * `pipeline_run`, `pipeline_stage_event`, and `pipeline_approval`
662
+ * for the project's pipeline_package(s) over `window_ms` and
663
+ * enriches the response with pulse `/summary` when configured.
664
+ *
665
+ * Lives at `GET /v1/pipelines/dashboard?project_id=...&window_ms=...`
666
+ * on the main worker (unified D1 binding — no orchestrator hop).
667
+ * Auth: session cookie + ownership check on the project_id.
668
+ * Cache: `public, max-age=30`.
669
+ */
670
+ dashboard: {
671
+ get: (input: {
672
+ project_id: string;
673
+ window_ms?: number;
674
+ }) => Promise<ApiResult<DashboardResponse & {
675
+ pulse: Record<string, unknown> | null;
676
+ }>>;
677
+ };
659
678
  /**
660
679
  * List pipeline runs ordered by `created_at` DESC. Optional filters
661
680
  * narrow by package and/or status; `limit` defaults to 50 server-side
@@ -697,6 +716,30 @@ declare class ApiClient {
697
716
  * Rollback a pipeline run
698
717
  */
699
718
  rollback: (run_id: string) => Promise<ApiResult<void>>;
719
+ /**
720
+ * Stage-event namespace — Phase 2.C webhook ingestion + read-back.
721
+ *
722
+ * `ingest` posts a webhook event against an in-flight run; auth
723
+ * mode is the standard bearer/session header (admin bypass; session
724
+ * must carry `runs:events` and matching `package_id`). Server-side
725
+ * stamps `payload.source = "external"`. Idempotency: same
726
+ * `idempotency_key` + same payload returns `{ duplicated: true }`;
727
+ * same key + different payload returns a 400 validation_error.
728
+ *
729
+ * `list` is read-only and returns the run's events newest-first.
730
+ */
731
+ events: {
732
+ ingest: (run_id: string, input: {
733
+ stage_name: string;
734
+ kind: StageEventKind;
735
+ payload?: unknown;
736
+ idempotency_key: string;
737
+ }) => Promise<ApiResult<{
738
+ event_id: string;
739
+ duplicated: boolean;
740
+ }>>;
741
+ list: (run_id: string) => Promise<ApiResult<PipelineStageEvent[]>>;
742
+ };
700
743
  /**
701
744
  * Grants namespace
702
745
  */
@@ -764,6 +807,65 @@ declare class ApiClient {
764
807
  deleted: true;
765
808
  }>>;
766
809
  };
810
+ /**
811
+ * Analysis-template namespace — admin-gated CRUD for the
812
+ * `pipeline_analysis_template` table. Phase 2.A surface; each
813
+ * call requires the orchestrator's bearer token (literal
814
+ * `PIPELINES_TOKEN`). `owner_id` is required on every operation
815
+ * — single-tenant today, but the column is in place so multi-user
816
+ * ACLs slot in later.
817
+ */
818
+ analysis_templates: {
819
+ /**
820
+ * List templates for an owner.
821
+ */
822
+ list: (input: {
823
+ owner_id: string;
824
+ }) => Promise<ApiResult<PipelineAnalysisTemplate[]>>;
825
+ /**
826
+ * Get a single template by id, scoped to its owner. 404 when
827
+ * unknown or owned by a different user.
828
+ */
829
+ get: (id: string, input: {
830
+ owner_id: string;
831
+ }) => Promise<ApiResult<PipelineAnalysisTemplate>>;
832
+ /**
833
+ * Create a new analysis template. `threshold_dsl` is parsed
834
+ * server-side; parse failure returns 400 `validation_error`
835
+ * with `field: "threshold_dsl"` and a descriptive message.
836
+ * `window_ms` defaults to 600_000 (10 min) when omitted.
837
+ */
838
+ create: (input: {
839
+ owner_id: string;
840
+ name: string;
841
+ threshold_dsl: string;
842
+ query_dsl?: unknown;
843
+ window_ms?: number;
844
+ }) => Promise<ApiResult<PipelineAnalysisTemplate>>;
845
+ /**
846
+ * Partial patch — only the supplied fields are touched.
847
+ * Re-validates `threshold_dsl` when supplied; same
848
+ * `validation_error` shape as create on parse failure.
849
+ */
850
+ update: (id: string, input: {
851
+ owner_id: string;
852
+ name?: string;
853
+ threshold_dsl?: string;
854
+ query_dsl?: unknown;
855
+ window_ms?: number;
856
+ }) => Promise<ApiResult<PipelineAnalysisTemplate>>;
857
+ /**
858
+ * Hard-delete the template. Does NOT consult
859
+ * `pipeline_run.resolved_gates` — runs snapshot their gate
860
+ * template at resolve-time, so deletion never orphans
861
+ * in-flight runs.
862
+ */
863
+ delete: (id: string, input: {
864
+ owner_id: string;
865
+ }) => Promise<ApiResult<{
866
+ deleted: true;
867
+ }>>;
868
+ };
767
869
  /**
768
870
  * OIDC trust-policy namespace — admin-gated CRUD for the
769
871
  * `pipeline_oidc_trust` table. Phase 15.D surface; each call requires