@objectstack/client 7.4.1 → 7.6.0

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.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { FilterCondition, QueryAST, SortNode, AggregationNode } from '@objectstack/spec/data';
2
- import { MetadataEvent, DataEvent, ApiRoutes, GetDiscoveryResponse, WellKnownCapabilities, GetMetaTypesResponse, GetMetaItemsResponse, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, BatchOptions, LoginRequest, SessionResponse, RegisterRequest, FileUploadResponse, GetPresignedUrlRequest, PresignedUrlResponse, InitiateChunkedUploadRequest, InitiateChunkedUploadResponse, UploadChunkResponse, CompleteChunkedUploadRequest, CompleteChunkedUploadResponse, CheckPermissionRequest, CheckPermissionResponse, GetObjectPermissionsResponse, GetEffectivePermissionsResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, SetPresenceRequest, GetPresenceResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, WorkflowTransitionRequest, WorkflowTransitionResponse, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, ListViewsResponse, GetViewResponse, CreateViewRequest, CreateViewResponse, UpdateViewRequest, UpdateViewResponse, DeleteViewResponse, RegisterDeviceRequest, RegisterDeviceResponse, UnregisterDeviceResponse, GetNotificationPreferencesResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, ListNotificationsResponse, MarkNotificationsReadResponse, MarkAllNotificationsReadResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AiInsightsRequest, AiInsightsResponse, GetLocalesResponse, GetTranslationsResponse, GetFieldLabelsResponse, GetFeedResponse, CreateFeedItemResponse, UpdateFeedItemResponse, DeleteFeedItemResponse, AddReactionResponse, RemoveReactionResponse, PinFeedItemResponse, UnpinFeedItemResponse, StarFeedItemResponse, UnstarFeedItemResponse, SearchFeedResponse, GetChangelogResponse, SubscribeResponse, UnsubscribeResponse, StandardErrorCode, ErrorCategory } from '@objectstack/spec/api';
3
- export { AddReactionResponse, AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AuthFeaturesConfig, AuthProviderInfo, BatchOperationResult, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, CheckPermissionRequest, CheckPermissionResponse, CreateFeedItemResponse, CreateViewResponse, DeleteFeedItemResponse, DeleteManyRequest, DeleteViewResponse, EmailPasswordConfigPublic, ErrorCategory, GetAuthConfigResponse, GetChangelogResponse, GetDiscoveryResponse, GetEffectivePermissionsResponse, GetFeedResponse, GetFieldLabelsResponse, GetLocalesResponse, GetMetaItemsResponse, GetMetaTypesResponse, GetObjectPermissionsResponse, GetPresenceResponse, GetTranslationsResponse, GetViewResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, ListNotificationsResponse, ListViewsResponse, MetadataCacheRequest, MetadataCacheResponse, PinFeedItemResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RefreshTokenRequest, RegisterDeviceRequest, RegisterDeviceResponse, RegisterRequest, RemoveReactionResponse, SearchFeedResponse, StandardErrorCode, StarFeedItemResponse, SubscribeResponse, UnpinFeedItemResponse, UnstarFeedItemResponse, UnsubscribeResponse, UpdateFeedItemResponse, UpdateManyRequest, UpdateViewResponse, WellKnownCapabilities, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';
2
+ import { MetadataEvent, DataEvent, ApiRoutes, GetDiscoveryResponse, WellKnownCapabilities, GetMetaTypesResponse, GetMetaItemsResponse, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, BatchOptions, LoginRequest, SessionResponse, RegisterRequest, FileUploadResponse, GetPresignedUrlRequest, PresignedUrlResponse, InitiateChunkedUploadRequest, InitiateChunkedUploadResponse, UploadChunkResponse, CompleteChunkedUploadRequest, CompleteChunkedUploadResponse, CheckPermissionRequest, CheckPermissionResponse, GetObjectPermissionsResponse, GetEffectivePermissionsResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, SetPresenceRequest, GetPresenceResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, WorkflowTransitionRequest, WorkflowTransitionResponse, ListViewsResponse, GetViewResponse, CreateViewRequest, CreateViewResponse, UpdateViewRequest, UpdateViewResponse, DeleteViewResponse, RegisterDeviceRequest, RegisterDeviceResponse, UnregisterDeviceResponse, GetNotificationPreferencesResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, ListNotificationsResponse, MarkNotificationsReadResponse, MarkAllNotificationsReadResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AiInsightsRequest, AiInsightsResponse, GetLocalesResponse, GetTranslationsResponse, GetFieldLabelsResponse, GetFeedResponse, CreateFeedItemResponse, UpdateFeedItemResponse, DeleteFeedItemResponse, AddReactionResponse, RemoveReactionResponse, PinFeedItemResponse, UnpinFeedItemResponse, StarFeedItemResponse, UnstarFeedItemResponse, SearchFeedResponse, GetChangelogResponse, SubscribeResponse, UnsubscribeResponse, StandardErrorCode, ErrorCategory } from '@objectstack/spec/api';
3
+ export { AddReactionResponse, AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AuthFeaturesConfig, AuthProviderInfo, BatchOperationResult, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, CheckPermissionRequest, CheckPermissionResponse, CreateFeedItemResponse, CreateViewResponse, DeleteFeedItemResponse, DeleteManyRequest, DeleteViewResponse, EmailPasswordConfigPublic, ErrorCategory, GetAuthConfigResponse, GetChangelogResponse, GetDiscoveryResponse, GetEffectivePermissionsResponse, GetFeedResponse, GetFieldLabelsResponse, GetLocalesResponse, GetMetaItemsResponse, GetMetaTypesResponse, GetObjectPermissionsResponse, GetPresenceResponse, GetTranslationsResponse, GetViewResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, ListNotificationsResponse, ListViewsResponse, MetadataCacheRequest, MetadataCacheResponse, PinFeedItemResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RefreshTokenRequest, RegisterDeviceRequest, RegisterDeviceResponse, RegisterRequest, RemoveReactionResponse, SearchFeedResponse, StandardErrorCode, StarFeedItemResponse, SubscribeResponse, UnpinFeedItemResponse, UnstarFeedItemResponse, UnsubscribeResponse, UpdateFeedItemResponse, UpdateManyRequest, UpdateViewResponse, WellKnownCapabilities, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';
4
+ import { RealtimeEventPayload, ApprovalStatus, ApprovalRequestRow, ApprovalDecisionResult, ApprovalActionRow } from '@objectstack/spec/contracts';
5
+ export { ApprovalActionRow, ApprovalDecisionInput, ApprovalDecisionResult, ApprovalRequestRow, ApprovalStatus } from '@objectstack/spec/contracts';
4
6
  import { Logger } from '@objectstack/core/logger';
5
- import { RealtimeEventPayload } from '@objectstack/spec/contracts';
6
7
 
7
8
  /**
8
9
  * Realtime API Module for ObjectStackClient
@@ -411,6 +412,7 @@ declare class ObjectStackClient {
411
412
  graphql?: string | undefined;
412
413
  packages?: string | undefined;
413
414
  workflow?: string | undefined;
415
+ approvals?: string | undefined;
414
416
  realtime?: string | undefined;
415
417
  notifications?: string | undefined;
416
418
  ai?: string | undefined;
@@ -1679,14 +1681,52 @@ declare class ObjectStackClient {
1679
1681
  * Execute a workflow state transition
1680
1682
  */
1681
1683
  transition: (request: WorkflowTransitionRequest) => Promise<WorkflowTransitionResponse>;
1684
+ };
1685
+ /**
1686
+ * Approval Services (ADR-0019)
1687
+ *
1688
+ * Approval is a first-class flow node, not a workflow step: a flow's
1689
+ * Approval node opens a request and suspends the run; recording a decision
1690
+ * here finalises the request and resumes the owning flow down the matching
1691
+ * `approve` / `reject` edge. This namespace drives the "my approvals" inbox
1692
+ * and the decision API exposed under `/api/v1/approvals`.
1693
+ */
1694
+ approvals: {
1695
+ /**
1696
+ * List approval requests ("my approvals" inbox). Filter by status, target
1697
+ * object / record, the user expected to act next, or the submitter.
1698
+ */
1699
+ listRequests: (filter?: {
1700
+ object?: string;
1701
+ recordId?: string;
1702
+ status?: ApprovalStatus | ApprovalStatus[];
1703
+ approverId?: string;
1704
+ submitterId?: string;
1705
+ }) => Promise<ApprovalRequestRow[]>;
1682
1706
  /**
1683
- * Approve a workflow step
1707
+ * Get a single approval request by id.
1684
1708
  */
1685
- approve: (request: WorkflowApproveRequest) => Promise<WorkflowApproveResponse>;
1709
+ getRequest: (requestId: string) => Promise<ApprovalRequestRow>;
1710
+ /**
1711
+ * Record an approve decision on a request. Finalises the request when the
1712
+ * node's behaviour is satisfied and resumes the owning flow run.
1713
+ */
1714
+ approve: (requestId: string, decision?: {
1715
+ actorId?: string;
1716
+ comment?: string;
1717
+ }) => Promise<ApprovalDecisionResult>;
1718
+ /**
1719
+ * Record a reject decision on a request. Resumes the owning flow run down
1720
+ * the `reject` edge.
1721
+ */
1722
+ reject: (requestId: string, decision?: {
1723
+ actorId?: string;
1724
+ comment?: string;
1725
+ }) => Promise<ApprovalDecisionResult>;
1686
1726
  /**
1687
- * Reject a workflow step
1727
+ * Audit trail (the immutable action log) for an approval request.
1688
1728
  */
1689
- reject: (request: WorkflowRejectRequest) => Promise<WorkflowRejectResponse>;
1729
+ listActions: (requestId: string) => Promise<ApprovalActionRow[]>;
1690
1730
  };
1691
1731
  /**
1692
1732
  * Views CRUD Services
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { FilterCondition, QueryAST, SortNode, AggregationNode } from '@objectstack/spec/data';
2
- import { MetadataEvent, DataEvent, ApiRoutes, GetDiscoveryResponse, WellKnownCapabilities, GetMetaTypesResponse, GetMetaItemsResponse, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, BatchOptions, LoginRequest, SessionResponse, RegisterRequest, FileUploadResponse, GetPresignedUrlRequest, PresignedUrlResponse, InitiateChunkedUploadRequest, InitiateChunkedUploadResponse, UploadChunkResponse, CompleteChunkedUploadRequest, CompleteChunkedUploadResponse, CheckPermissionRequest, CheckPermissionResponse, GetObjectPermissionsResponse, GetEffectivePermissionsResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, SetPresenceRequest, GetPresenceResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, WorkflowTransitionRequest, WorkflowTransitionResponse, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, ListViewsResponse, GetViewResponse, CreateViewRequest, CreateViewResponse, UpdateViewRequest, UpdateViewResponse, DeleteViewResponse, RegisterDeviceRequest, RegisterDeviceResponse, UnregisterDeviceResponse, GetNotificationPreferencesResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, ListNotificationsResponse, MarkNotificationsReadResponse, MarkAllNotificationsReadResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AiInsightsRequest, AiInsightsResponse, GetLocalesResponse, GetTranslationsResponse, GetFieldLabelsResponse, GetFeedResponse, CreateFeedItemResponse, UpdateFeedItemResponse, DeleteFeedItemResponse, AddReactionResponse, RemoveReactionResponse, PinFeedItemResponse, UnpinFeedItemResponse, StarFeedItemResponse, UnstarFeedItemResponse, SearchFeedResponse, GetChangelogResponse, SubscribeResponse, UnsubscribeResponse, StandardErrorCode, ErrorCategory } from '@objectstack/spec/api';
3
- export { AddReactionResponse, AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AuthFeaturesConfig, AuthProviderInfo, BatchOperationResult, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, CheckPermissionRequest, CheckPermissionResponse, CreateFeedItemResponse, CreateViewResponse, DeleteFeedItemResponse, DeleteManyRequest, DeleteViewResponse, EmailPasswordConfigPublic, ErrorCategory, GetAuthConfigResponse, GetChangelogResponse, GetDiscoveryResponse, GetEffectivePermissionsResponse, GetFeedResponse, GetFieldLabelsResponse, GetLocalesResponse, GetMetaItemsResponse, GetMetaTypesResponse, GetObjectPermissionsResponse, GetPresenceResponse, GetTranslationsResponse, GetViewResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, ListNotificationsResponse, ListViewsResponse, MetadataCacheRequest, MetadataCacheResponse, PinFeedItemResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RefreshTokenRequest, RegisterDeviceRequest, RegisterDeviceResponse, RegisterRequest, RemoveReactionResponse, SearchFeedResponse, StandardErrorCode, StarFeedItemResponse, SubscribeResponse, UnpinFeedItemResponse, UnstarFeedItemResponse, UnsubscribeResponse, UpdateFeedItemResponse, UpdateManyRequest, UpdateViewResponse, WellKnownCapabilities, WorkflowApproveRequest, WorkflowApproveResponse, WorkflowRejectRequest, WorkflowRejectResponse, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';
2
+ import { MetadataEvent, DataEvent, ApiRoutes, GetDiscoveryResponse, WellKnownCapabilities, GetMetaTypesResponse, GetMetaItemsResponse, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, BatchOptions, LoginRequest, SessionResponse, RegisterRequest, FileUploadResponse, GetPresignedUrlRequest, PresignedUrlResponse, InitiateChunkedUploadRequest, InitiateChunkedUploadResponse, UploadChunkResponse, CompleteChunkedUploadRequest, CompleteChunkedUploadResponse, CheckPermissionRequest, CheckPermissionResponse, GetObjectPermissionsResponse, GetEffectivePermissionsResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, SetPresenceRequest, GetPresenceResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, WorkflowTransitionRequest, WorkflowTransitionResponse, ListViewsResponse, GetViewResponse, CreateViewRequest, CreateViewResponse, UpdateViewRequest, UpdateViewResponse, DeleteViewResponse, RegisterDeviceRequest, RegisterDeviceResponse, UnregisterDeviceResponse, GetNotificationPreferencesResponse, UpdateNotificationPreferencesRequest, UpdateNotificationPreferencesResponse, ListNotificationsResponse, MarkNotificationsReadResponse, MarkAllNotificationsReadResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AiInsightsRequest, AiInsightsResponse, GetLocalesResponse, GetTranslationsResponse, GetFieldLabelsResponse, GetFeedResponse, CreateFeedItemResponse, UpdateFeedItemResponse, DeleteFeedItemResponse, AddReactionResponse, RemoveReactionResponse, PinFeedItemResponse, UnpinFeedItemResponse, StarFeedItemResponse, UnstarFeedItemResponse, SearchFeedResponse, GetChangelogResponse, SubscribeResponse, UnsubscribeResponse, StandardErrorCode, ErrorCategory } from '@objectstack/spec/api';
3
+ export { AddReactionResponse, AiInsightsRequest, AiInsightsResponse, AiNlqRequest, AiNlqResponse, AiSuggestRequest, AiSuggestResponse, AuthFeaturesConfig, AuthProviderInfo, BatchOperationResult, BatchOptions, BatchRecord, BatchUpdateRequest, BatchUpdateResponse, CheckPermissionRequest, CheckPermissionResponse, CreateFeedItemResponse, CreateViewResponse, DeleteFeedItemResponse, DeleteManyRequest, DeleteViewResponse, EmailPasswordConfigPublic, ErrorCategory, GetAuthConfigResponse, GetChangelogResponse, GetDiscoveryResponse, GetEffectivePermissionsResponse, GetFeedResponse, GetFieldLabelsResponse, GetLocalesResponse, GetMetaItemsResponse, GetMetaTypesResponse, GetObjectPermissionsResponse, GetPresenceResponse, GetTranslationsResponse, GetViewResponse, GetWorkflowConfigResponse, GetWorkflowStateResponse, ListNotificationsResponse, ListViewsResponse, MetadataCacheRequest, MetadataCacheResponse, PinFeedItemResponse, RealtimeConnectRequest, RealtimeConnectResponse, RealtimeSubscribeRequest, RealtimeSubscribeResponse, RefreshTokenRequest, RegisterDeviceRequest, RegisterDeviceResponse, RegisterRequest, RemoveReactionResponse, SearchFeedResponse, StandardErrorCode, StarFeedItemResponse, SubscribeResponse, UnpinFeedItemResponse, UnstarFeedItemResponse, UnsubscribeResponse, UpdateFeedItemResponse, UpdateManyRequest, UpdateViewResponse, WellKnownCapabilities, WorkflowTransitionRequest, WorkflowTransitionResponse } from '@objectstack/spec/api';
4
+ import { RealtimeEventPayload, ApprovalStatus, ApprovalRequestRow, ApprovalDecisionResult, ApprovalActionRow } from '@objectstack/spec/contracts';
5
+ export { ApprovalActionRow, ApprovalDecisionInput, ApprovalDecisionResult, ApprovalRequestRow, ApprovalStatus } from '@objectstack/spec/contracts';
4
6
  import { Logger } from '@objectstack/core/logger';
5
- import { RealtimeEventPayload } from '@objectstack/spec/contracts';
6
7
 
7
8
  /**
8
9
  * Realtime API Module for ObjectStackClient
@@ -411,6 +412,7 @@ declare class ObjectStackClient {
411
412
  graphql?: string | undefined;
412
413
  packages?: string | undefined;
413
414
  workflow?: string | undefined;
415
+ approvals?: string | undefined;
414
416
  realtime?: string | undefined;
415
417
  notifications?: string | undefined;
416
418
  ai?: string | undefined;
@@ -1679,14 +1681,52 @@ declare class ObjectStackClient {
1679
1681
  * Execute a workflow state transition
1680
1682
  */
1681
1683
  transition: (request: WorkflowTransitionRequest) => Promise<WorkflowTransitionResponse>;
1684
+ };
1685
+ /**
1686
+ * Approval Services (ADR-0019)
1687
+ *
1688
+ * Approval is a first-class flow node, not a workflow step: a flow's
1689
+ * Approval node opens a request and suspends the run; recording a decision
1690
+ * here finalises the request and resumes the owning flow down the matching
1691
+ * `approve` / `reject` edge. This namespace drives the "my approvals" inbox
1692
+ * and the decision API exposed under `/api/v1/approvals`.
1693
+ */
1694
+ approvals: {
1695
+ /**
1696
+ * List approval requests ("my approvals" inbox). Filter by status, target
1697
+ * object / record, the user expected to act next, or the submitter.
1698
+ */
1699
+ listRequests: (filter?: {
1700
+ object?: string;
1701
+ recordId?: string;
1702
+ status?: ApprovalStatus | ApprovalStatus[];
1703
+ approverId?: string;
1704
+ submitterId?: string;
1705
+ }) => Promise<ApprovalRequestRow[]>;
1682
1706
  /**
1683
- * Approve a workflow step
1707
+ * Get a single approval request by id.
1684
1708
  */
1685
- approve: (request: WorkflowApproveRequest) => Promise<WorkflowApproveResponse>;
1709
+ getRequest: (requestId: string) => Promise<ApprovalRequestRow>;
1710
+ /**
1711
+ * Record an approve decision on a request. Finalises the request when the
1712
+ * node's behaviour is satisfied and resumes the owning flow run.
1713
+ */
1714
+ approve: (requestId: string, decision?: {
1715
+ actorId?: string;
1716
+ comment?: string;
1717
+ }) => Promise<ApprovalDecisionResult>;
1718
+ /**
1719
+ * Record a reject decision on a request. Resumes the owning flow run down
1720
+ * the `reject` edge.
1721
+ */
1722
+ reject: (requestId: string, decision?: {
1723
+ actorId?: string;
1724
+ comment?: string;
1725
+ }) => Promise<ApprovalDecisionResult>;
1686
1726
  /**
1687
- * Reject a workflow step
1727
+ * Audit trail (the immutable action log) for an approval request.
1688
1728
  */
1689
- reject: (request: WorkflowRejectRequest) => Promise<WorkflowRejectResponse>;
1729
+ listActions: (requestId: string) => Promise<ApprovalActionRow[]>;
1690
1730
  };
1691
1731
  /**
1692
1732
  * Views CRUD Services
package/dist/index.js CHANGED
@@ -2179,34 +2179,79 @@ var ObjectStackClient = class {
2179
2179
  })
2180
2180
  });
2181
2181
  return this.unwrapResponse(res);
2182
+ }
2183
+ // ADR-0019: approve/reject are no longer workflow operations. Approval is a
2184
+ // flow node — see the `approvals` namespace below for recording decisions.
2185
+ };
2186
+ /**
2187
+ * Approval Services (ADR-0019)
2188
+ *
2189
+ * Approval is a first-class flow node, not a workflow step: a flow's
2190
+ * Approval node opens a request and suspends the run; recording a decision
2191
+ * here finalises the request and resumes the owning flow down the matching
2192
+ * `approve` / `reject` edge. This namespace drives the "my approvals" inbox
2193
+ * and the decision API exposed under `/api/v1/approvals`.
2194
+ */
2195
+ this.approvals = {
2196
+ /**
2197
+ * List approval requests ("my approvals" inbox). Filter by status, target
2198
+ * object / record, the user expected to act next, or the submitter.
2199
+ */
2200
+ listRequests: async (filter) => {
2201
+ const route = this.getRoute("approvals");
2202
+ const params = new URLSearchParams();
2203
+ if (filter?.object) params.set("object", filter.object);
2204
+ if (filter?.recordId) params.set("recordId", filter.recordId);
2205
+ if (filter?.status) {
2206
+ params.set("status", Array.isArray(filter.status) ? filter.status.join(",") : filter.status);
2207
+ }
2208
+ if (filter?.approverId) params.set("approverId", filter.approverId);
2209
+ if (filter?.submitterId) params.set("submitterId", filter.submitterId);
2210
+ const qs = params.toString();
2211
+ const res = await this.fetch(`${this.baseUrl}${route}/requests${qs ? `?${qs}` : ""}`);
2212
+ const body = await this.unwrapResponse(res);
2213
+ return Array.isArray(body) ? body : body?.data ?? [];
2182
2214
  },
2183
2215
  /**
2184
- * Approve a workflow step
2216
+ * Get a single approval request by id.
2185
2217
  */
2186
- approve: async (request) => {
2187
- const route = this.getRoute("workflow");
2188
- const res = await this.fetch(`${this.baseUrl}${route}/${encodeURIComponent(request.object)}/${encodeURIComponent(request.recordId)}/approve`, {
2218
+ getRequest: async (requestId) => {
2219
+ const route = this.getRoute("approvals");
2220
+ const res = await this.fetch(`${this.baseUrl}${route}/requests/${encodeURIComponent(requestId)}`);
2221
+ return this.unwrapResponse(res);
2222
+ },
2223
+ /**
2224
+ * Record an approve decision on a request. Finalises the request when the
2225
+ * node's behaviour is satisfied and resumes the owning flow run.
2226
+ */
2227
+ approve: async (requestId, decision) => {
2228
+ const route = this.getRoute("approvals");
2229
+ const res = await this.fetch(`${this.baseUrl}${route}/requests/${encodeURIComponent(requestId)}/approve`, {
2189
2230
  method: "POST",
2190
- body: JSON.stringify({
2191
- comment: request.comment,
2192
- data: request.data
2193
- })
2231
+ body: JSON.stringify({ actorId: decision?.actorId, comment: decision?.comment })
2194
2232
  });
2195
2233
  return this.unwrapResponse(res);
2196
2234
  },
2197
2235
  /**
2198
- * Reject a workflow step
2236
+ * Record a reject decision on a request. Resumes the owning flow run down
2237
+ * the `reject` edge.
2199
2238
  */
2200
- reject: async (request) => {
2201
- const route = this.getRoute("workflow");
2202
- const res = await this.fetch(`${this.baseUrl}${route}/${encodeURIComponent(request.object)}/${encodeURIComponent(request.recordId)}/reject`, {
2239
+ reject: async (requestId, decision) => {
2240
+ const route = this.getRoute("approvals");
2241
+ const res = await this.fetch(`${this.baseUrl}${route}/requests/${encodeURIComponent(requestId)}/reject`, {
2203
2242
  method: "POST",
2204
- body: JSON.stringify({
2205
- reason: request.reason,
2206
- comment: request.comment
2207
- })
2243
+ body: JSON.stringify({ actorId: decision?.actorId, comment: decision?.comment })
2208
2244
  });
2209
2245
  return this.unwrapResponse(res);
2246
+ },
2247
+ /**
2248
+ * Audit trail (the immutable action log) for an approval request.
2249
+ */
2250
+ listActions: async (requestId) => {
2251
+ const route = this.getRoute("approvals");
2252
+ const res = await this.fetch(`${this.baseUrl}${route}/requests/${encodeURIComponent(requestId)}/actions`);
2253
+ const body = await this.unwrapResponse(res);
2254
+ return Array.isArray(body) ? body : body?.data ?? [];
2210
2255
  }
2211
2256
  };
2212
2257
  /**
@@ -2998,6 +3043,7 @@ var ObjectStackClient = class {
2998
3043
  permissions: "/api/v1/permissions",
2999
3044
  realtime: "/api/v1/realtime",
3000
3045
  workflow: "/api/v1/workflow",
3046
+ approvals: "/api/v1/approvals",
3001
3047
  views: "/api/v1/ui/views",
3002
3048
  notifications: "/api/v1/notifications",
3003
3049
  ai: "/api/v1/ai",