lemma-sdk 0.2.44 → 0.2.45
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/README.md +1 -1
- package/dist/assistant-events.d.ts +1 -0
- package/dist/assistant-events.js +25 -0
- package/dist/browser/lemma-client.js +264 -152
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/hey_client/client/client.gen.d.ts +2 -0
- package/dist/hey_client/client/client.gen.js +216 -0
- package/dist/hey_client/client/index.d.ts +10 -0
- package/dist/hey_client/client/index.js +6 -0
- package/dist/hey_client/client/types.gen.d.ts +120 -0
- package/dist/hey_client/client/types.gen.js +2 -0
- package/dist/hey_client/client/utils.gen.d.ts +37 -0
- package/dist/hey_client/client/utils.gen.js +228 -0
- package/dist/hey_client/client.gen.d.ts +12 -0
- package/dist/hey_client/client.gen.js +3 -0
- package/dist/hey_client/core/auth.gen.d.ts +25 -0
- package/dist/hey_client/core/auth.gen.js +14 -0
- package/dist/hey_client/core/bodySerializer.gen.d.ts +25 -0
- package/dist/hey_client/core/bodySerializer.gen.js +57 -0
- package/dist/hey_client/core/params.gen.d.ts +43 -0
- package/dist/hey_client/core/params.gen.js +100 -0
- package/dist/hey_client/core/pathSerializer.gen.d.ts +33 -0
- package/dist/hey_client/core/pathSerializer.gen.js +106 -0
- package/dist/hey_client/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/hey_client/core/queryKeySerializer.gen.js +92 -0
- package/dist/hey_client/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/hey_client/core/serverSentEvents.gen.js +132 -0
- package/dist/hey_client/core/types.gen.d.ts +83 -0
- package/dist/hey_client/core/types.gen.js +2 -0
- package/dist/hey_client/core/utils.gen.d.ts +19 -0
- package/dist/hey_client/core/utils.gen.js +87 -0
- package/dist/hey_client/index.d.ts +2 -0
- package/dist/hey_client/index.js +2 -0
- package/dist/hey_client/sdk.gen.d.ts +1005 -0
- package/dist/hey_client/sdk.gen.js +1438 -0
- package/dist/hey_client/types.gen.d.ts +13004 -0
- package/dist/hey_client/types.gen.js +2 -0
- package/dist/namespaces/files.d.ts +6 -24
- package/dist/namespaces/files.js +6 -16
- package/dist/namespaces/integrations.js +4 -4
- package/dist/namespaces/pod-surfaces.d.ts +8 -3
- package/dist/namespaces/pod-surfaces.js +15 -6
- package/dist/namespaces/pods.d.ts +2 -3
- package/dist/namespaces/pods.js +1 -6
- package/dist/namespaces/records.d.ts +7 -7
- package/dist/namespaces/resource-access.d.ts +3 -3
- package/dist/namespaces/resource-access.js +6 -6
- package/dist/namespaces/schedules.d.ts +1 -0
- package/dist/namespaces/schedules.js +1 -1
- package/dist/namespaces/tables.d.ts +2 -2
- package/dist/namespaces/workflows.d.ts +12 -8
- package/dist/namespaces/workflows.js +9 -18
- package/dist/openapi_client/index.d.ts +20 -37
- package/dist/openapi_client/index.js +3 -11
- package/dist/openapi_client/models/AgentHarnessInfo.d.ts +2 -0
- package/dist/openapi_client/models/AgentNode.d.ts +1 -1
- package/dist/openapi_client/models/AgentNodeConfig.d.ts +1 -1
- package/dist/openapi_client/models/AgentResourcePermissionRequest.d.ts +1 -1
- package/dist/openapi_client/models/AgentResourcePermissionResponse.d.ts +1 -1
- package/dist/openapi_client/models/AgentRuntimeProfileResponse.d.ts +6 -0
- package/dist/openapi_client/models/AgentSurfaceResponse.d.ts +6 -17
- package/dist/openapi_client/models/AgentSurfaceStatus.d.ts +3 -1
- package/dist/openapi_client/models/AgentSurfaceStatus.js +2 -0
- package/dist/openapi_client/models/ApplicationSkillResponse.d.ts +6 -0
- package/dist/openapi_client/models/ConnectedAccountSummary.d.ts +7 -0
- package/dist/openapi_client/models/CreateFunctionRequest.d.ts +0 -1
- package/dist/openapi_client/models/CreateScheduleRequest.d.ts +4 -0
- package/dist/openapi_client/models/CreateSurfaceRequest.d.ts +3 -10
- package/dist/openapi_client/models/CreateUserDaemonRuntimeProfileRequest.d.ts +2 -0
- package/dist/openapi_client/models/DataStoreFlowStartInput.d.ts +1 -1
- package/dist/openapi_client/models/DataStoreFlowStartOutput.d.ts +1 -1
- package/dist/openapi_client/models/DatastoreCountResponse.d.ts +6 -0
- package/dist/openapi_client/models/DecisionNode.d.ts +2 -1
- package/dist/openapi_client/models/DecisionRule.d.ts +3 -0
- package/dist/openapi_client/models/EndNode.d.ts +1 -1
- package/dist/openapi_client/models/ExpressionInputBinding.d.ts +6 -2
- package/dist/openapi_client/models/FileListResponse.d.ts +1 -0
- package/dist/openapi_client/models/FileSearchResponse.d.ts +2 -2
- package/dist/openapi_client/models/FlowRunStatus.d.ts +4 -1
- package/dist/openapi_client/models/FlowRunStatus.js +4 -1
- package/dist/openapi_client/models/FormNode.d.ts +2 -1
- package/dist/openapi_client/models/FormNodeConfig.d.ts +1 -1
- package/dist/openapi_client/models/FunctionNode.d.ts +2 -1
- package/dist/openapi_client/models/FunctionResourcePermissionRequest.d.ts +1 -1
- package/dist/openapi_client/models/FunctionResourcePermissionResponse.d.ts +1 -1
- package/dist/openapi_client/models/InstalledAppSummary.d.ts +7 -0
- package/dist/openapi_client/models/IntegrationStatusResponse.d.ts +6 -0
- package/dist/openapi_client/models/LoopNode.d.ts +2 -1
- package/dist/openapi_client/models/LoopNodeConfig.d.ts +3 -3
- package/dist/openapi_client/models/PodMemberAddRequest.d.ts +1 -3
- package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +0 -2
- package/dist/openapi_client/models/PodMemberResponse.d.ts +0 -2
- package/dist/openapi_client/models/PodMemberUpdateRoleRequest.d.ts +1 -3
- package/dist/openapi_client/models/PodRoleResourcePermissionRequest.d.ts +1 -1
- package/dist/openapi_client/models/PodRoleResourcePermissionResponse.d.ts +1 -1
- package/dist/openapi_client/models/ResourceAccessGrantResponse.d.ts +1 -1
- package/dist/openapi_client/models/ResourceAccessResponse.d.ts +1 -1
- package/dist/openapi_client/models/RuntimeProfileScope.d.ts +2 -1
- package/dist/openapi_client/models/RuntimeProfileScope.js +1 -0
- package/dist/openapi_client/models/ScheduleDetailResponse.d.ts +6 -0
- package/dist/openapi_client/models/ScheduleFireStatus.d.ts +8 -0
- package/dist/openapi_client/models/ScheduleFireStatus.js +13 -0
- package/dist/openapi_client/models/StepRecordResponse.d.ts +10 -0
- package/dist/openapi_client/models/StepStatus.d.ts +7 -0
- package/dist/openapi_client/models/StepStatus.js +12 -0
- package/dist/openapi_client/models/SurfaceBehaviorConfigInput.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceChannelRouteInput.d.ts +6 -0
- package/dist/openapi_client/models/SurfaceChannelRouteResponse.d.ts +6 -0
- package/dist/openapi_client/models/SurfaceConfigResponse.d.ts +10 -0
- package/dist/openapi_client/models/SurfaceCredentialMode.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceCredentialMode.js +9 -0
- package/dist/openapi_client/models/SurfaceIdentityConfigInput.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceIdentityConfigResponse.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceSetupStatusResponse.d.ts +10 -0
- package/dist/openapi_client/models/TableListResponse.d.ts +2 -0
- package/dist/openapi_client/models/ToggleSurfaceRequest.d.ts +1 -1
- package/dist/openapi_client/models/UpdateScheduleRequest.d.ts +1 -0
- package/dist/openapi_client/models/UpdateSurfaceChannelsRequest.d.ts +4 -0
- package/dist/openapi_client/models/UpdateSurfaceRequest.d.ts +4 -11
- package/dist/openapi_client/models/UpsertSurfaceRequest.d.ts +9 -0
- package/dist/openapi_client/models/UserProfileRequest.d.ts +1 -0
- package/dist/openapi_client/models/UserResponse.d.ts +1 -0
- package/dist/openapi_client/models/WaitUntilNode.d.ts +1 -1
- package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +16 -0
- package/dist/openapi_client/models/WorkflowRunFormSubmitRequest.d.ts +13 -0
- package/dist/openapi_client/models/WorkflowRunResponse.d.ts +28 -0
- package/dist/openapi_client/models/WorkflowRunSummaryResponse.d.ts +2 -3
- package/dist/openapi_client/models/WorkflowRunWaitAssignment.d.ts +4 -4
- package/dist/openapi_client/models/{WorkflowRunWaitEntity.d.ts → WorkflowRunWaitResponse.d.ts} +4 -8
- package/dist/openapi_client/models/WorkflowRunWaitType.d.ts +1 -2
- package/dist/openapi_client/models/WorkflowRunWaitType.js +0 -1
- package/dist/openapi_client/models/WorkspaceAppAccessRequest.d.ts +0 -3
- package/dist/openapi_client/models/WorkspaceMeSandbox.d.ts +1 -4
- package/dist/openapi_client/services/AgentSurfacesService.d.ts +39 -10
- package/dist/openapi_client/services/AgentSurfacesService.js +86 -20
- package/dist/openapi_client/services/ApplicationsService.d.ts +10 -0
- package/dist/openapi_client/services/ApplicationsService.js +23 -0
- package/dist/openapi_client/services/FilesService.d.ts +2 -3
- package/dist/openapi_client/services/FilesService.js +1 -1
- package/dist/openapi_client/services/FunctionsService.d.ts +1 -1
- package/dist/openapi_client/services/FunctionsService.js +1 -1
- package/dist/openapi_client/services/IntegrationsService.d.ts +12 -4
- package/dist/openapi_client/services/IntegrationsService.js +22 -4
- package/dist/openapi_client/services/PodResourceAccessService.d.ts +6 -6
- package/dist/openapi_client/services/PodResourceAccessService.js +12 -12
- package/dist/openapi_client/services/RecordsService.d.ts +21 -22
- package/dist/openapi_client/services/RecordsService.js +13 -13
- package/dist/openapi_client/services/SchedulesService.d.ts +2 -1
- package/dist/openapi_client/services/SchedulesService.js +3 -1
- package/dist/openapi_client/services/TablesService.d.ts +4 -5
- package/dist/openapi_client/services/TablesService.js +2 -2
- package/dist/openapi_client/services/WorkflowsService.d.ts +35 -26
- package/dist/openapi_client/services/WorkflowsService.js +57 -39
- package/dist/react/useAddPodMember.js +1 -1
- package/dist/react/useAssistantController.d.ts +1 -0
- package/dist/react/useAssistantController.js +5 -1
- package/dist/react/useAssistantSession.d.ts +1 -0
- package/dist/react/useAssistantSession.js +41 -0
- package/dist/react/useBulkRecords.d.ts +5 -5
- package/dist/react/useBulkRecords.js +5 -5
- package/dist/react/useCreateFolder.d.ts +2 -4
- package/dist/react/useCreateFolder.js +2 -3
- package/dist/react/useCreateRecord.d.ts +2 -2
- package/dist/react/useCreateRecord.js +1 -1
- package/dist/react/useDeleteFile.d.ts +1 -4
- package/dist/react/useDeleteFile.js +3 -3
- package/dist/react/useDeleteRecord.d.ts +1 -2
- package/dist/react/useDeleteRecord.js +3 -3
- package/dist/react/useFile.d.ts +2 -4
- package/dist/react/useFile.js +3 -3
- package/dist/react/useFilePreview.d.ts +1 -4
- package/dist/react/useFilePreview.js +4 -5
- package/dist/react/useFileSearch.d.ts +5 -1
- package/dist/react/useFileSearch.js +6 -4
- package/dist/react/useFileTree.d.ts +2 -4
- package/dist/react/useFileTree.js +2 -3
- package/dist/react/useFiles.d.ts +2 -4
- package/dist/react/useFiles.js +3 -5
- package/dist/react/useFlowSession.d.ts +3 -1
- package/dist/react/useFlowSession.js +24 -17
- package/dist/react/useGlobalSearch.js +1 -1
- package/dist/react/useRecord.d.ts +2 -2
- package/dist/react/useRecord.js +1 -1
- package/dist/react/useRecordForm.d.ts +2 -2
- package/dist/react/useRecordForm.js +2 -2
- package/dist/react/useReverseRelatedRecords.js +1 -1
- package/dist/react/useUpdateFile.d.ts +2 -4
- package/dist/react/useUpdateFile.js +2 -3
- package/dist/react/useUpdateRecord.d.ts +2 -2
- package/dist/react/useUpdateRecord.js +1 -1
- package/dist/react/useUploadFile.d.ts +2 -4
- package/dist/react/useUploadFile.js +2 -3
- package/dist/react/useWorkflowResume.d.ts +1 -0
- package/dist/react/useWorkflowResume.js +10 -1
- package/dist/react/useWorkflowRun.js +1 -3
- package/dist/react/useWorkflowStart.js +11 -26
- package/dist/react/utils.js +2 -0
- package/dist/types.d.ts +3 -3
- package/package.json +7 -2
- package/dist/openapi_client/models/BillingHistoryResponse.d.ts +0 -8
- package/dist/openapi_client/models/BillingInterval.d.ts +0 -7
- package/dist/openapi_client/models/BillingInterval.js +0 -12
- package/dist/openapi_client/models/BillingInvoiceResponse.d.ts +0 -27
- package/dist/openapi_client/models/BillingInvoiceStatus.d.ts +0 -10
- package/dist/openapi_client/models/BillingInvoiceStatus.js +0 -15
- package/dist/openapi_client/models/CancelSubscriptionResponse.d.ts +0 -10
- package/dist/openapi_client/models/CreateInvoicePaymentUrlRequest.d.ts +0 -7
- package/dist/openapi_client/models/CreateInvoicePaymentUrlResponse.d.ts +0 -8
- package/dist/openapi_client/models/DatastoreMessageResponse.d.ts +0 -6
- package/dist/openapi_client/models/DeskServingConfigResponse.d.ts +0 -11
- package/dist/openapi_client/models/DeskServingConfigResponse.js +0 -8
- package/dist/openapi_client/models/FlowRunEntity.d.ts +0 -36
- package/dist/openapi_client/models/GmailSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/OutlookSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/PlanListResponse.d.ts +0 -8
- package/dist/openapi_client/models/PlanResponse.d.ts +0 -18
- package/dist/openapi_client/models/PlanType.d.ts +0 -7
- package/dist/openapi_client/models/PlanType.js +0 -12
- package/dist/openapi_client/models/RecordResponse.d.ts +0 -9
- package/dist/openapi_client/models/SeatInfoResponse.d.ts +0 -10
- package/dist/openapi_client/models/SlackSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/StackFrame.d.ts +0 -11
- package/dist/openapi_client/models/StartSubscriptionRequest.d.ts +0 -14
- package/dist/openapi_client/models/StartSubscriptionResponse.d.ts +0 -9
- package/dist/openapi_client/models/StartTeamBillingRequest.d.ts +0 -6
- package/dist/openapi_client/models/StartTeamBillingRequest.js +0 -1
- package/dist/openapi_client/models/StepExecution.d.ts +0 -13
- package/dist/openapi_client/models/StepExecution.js +0 -1
- package/dist/openapi_client/models/SubscriptionResponse.d.ts +0 -22
- package/dist/openapi_client/models/SubscriptionResponse.js +0 -1
- package/dist/openapi_client/models/SubscriptionStatus.d.ts +0 -10
- package/dist/openapi_client/models/SubscriptionStatus.js +0 -15
- package/dist/openapi_client/models/SubscriptionStatusResponse.d.ts +0 -10
- package/dist/openapi_client/models/SubscriptionStatusResponse.js +0 -1
- package/dist/openapi_client/models/SubscriptionWithPlanResponse.d.ts +0 -22
- package/dist/openapi_client/models/SubscriptionWithPlanResponse.js +0 -1
- package/dist/openapi_client/models/SurfaceEventMode.d.ts +0 -6
- package/dist/openapi_client/models/SurfaceEventMode.js +0 -11
- package/dist/openapi_client/models/SurfaceMode.d.ts +0 -5
- package/dist/openapi_client/models/SurfaceMode.js +0 -10
- package/dist/openapi_client/models/SurfaceRoutingScope.d.ts +0 -4
- package/dist/openapi_client/models/SurfaceRoutingScope.js +0 -9
- package/dist/openapi_client/models/TeamsSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/TeamsSurfaceConfig.js +0 -1
- package/dist/openapi_client/models/TelegramSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/TelegramSurfaceConfig.js +0 -1
- package/dist/openapi_client/models/WhatsAppSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/WhatsAppSurfaceConfig.js +0 -1
- package/dist/openapi_client/models/WorkflowRunWaitEntity.js +0 -1
- package/dist/openapi_client/services/BillingSubscriptionsService.d.ts +0 -117
- package/dist/openapi_client/services/BillingSubscriptionsService.js +0 -230
- package/dist/openapi_client/services/BillingWebhooksService.d.ts +0 -12
- package/dist/openapi_client/services/BillingWebhooksService.js +0 -25
- package/dist/openapi_client/services/PublicDesksService.d.ts +0 -10
- package/dist/openapi_client/services/PublicDesksService.js +0 -15
- /package/dist/openapi_client/models/{BillingHistoryResponse.js → ApplicationSkillResponse.js} +0 -0
- /package/dist/openapi_client/models/{BillingInvoiceResponse.js → ConnectedAccountSummary.js} +0 -0
- /package/dist/openapi_client/models/{CancelSubscriptionResponse.js → DatastoreCountResponse.js} +0 -0
- /package/dist/openapi_client/models/{CreateInvoicePaymentUrlRequest.js → InstalledAppSummary.js} +0 -0
- /package/dist/openapi_client/models/{CreateInvoicePaymentUrlResponse.js → IntegrationStatusResponse.js} +0 -0
- /package/dist/openapi_client/models/{DatastoreMessageResponse.js → StepRecordResponse.js} +0 -0
- /package/dist/openapi_client/models/{FlowRunEntity.js → SurfaceChannelRouteInput.js} +0 -0
- /package/dist/openapi_client/models/{GmailSurfaceConfig.js → SurfaceChannelRouteResponse.js} +0 -0
- /package/dist/openapi_client/models/{OutlookSurfaceConfig.js → SurfaceConfigResponse.js} +0 -0
- /package/dist/openapi_client/models/{PlanListResponse.js → SurfaceIdentityConfigInput.js} +0 -0
- /package/dist/openapi_client/models/{PlanResponse.js → SurfaceIdentityConfigResponse.js} +0 -0
- /package/dist/openapi_client/models/{RecordResponse.js → SurfaceSetupStatusResponse.js} +0 -0
- /package/dist/openapi_client/models/{SeatInfoResponse.js → UpdateSurfaceChannelsRequest.js} +0 -0
- /package/dist/openapi_client/models/{SlackSurfaceConfig.js → UpsertSurfaceRequest.js} +0 -0
- /package/dist/openapi_client/models/{StackFrame.js → WorkflowRunFormSubmitRequest.js} +0 -0
- /package/dist/openapi_client/models/{StartSubscriptionRequest.js → WorkflowRunResponse.js} +0 -0
- /package/dist/openapi_client/models/{StartSubscriptionResponse.js → WorkflowRunWaitResponse.js} +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { FlowDetailResponse } from '../models/FlowDetailResponse.js';
|
|
2
|
-
import type { FlowRunEntity } from '../models/FlowRunEntity.js';
|
|
3
2
|
import type { WorkflowCreateRequest } from '../models/WorkflowCreateRequest.js';
|
|
4
3
|
import type { WorkflowGraphUpdateRequest } from '../models/WorkflowGraphUpdateRequest.js';
|
|
5
4
|
import type { WorkflowListResponse } from '../models/WorkflowListResponse.js';
|
|
5
|
+
import type { WorkflowRunFormSubmitRequest } from '../models/WorkflowRunFormSubmitRequest.js';
|
|
6
6
|
import type { WorkflowRunListResponse } from '../models/WorkflowRunListResponse.js';
|
|
7
|
+
import type { WorkflowRunResponse } from '../models/WorkflowRunResponse.js';
|
|
7
8
|
import type { WorkflowRunWaitAssignmentListResponse } from '../models/WorkflowRunWaitAssignmentListResponse.js';
|
|
8
9
|
import type { WorkflowUpdateRequest } from '../models/WorkflowUpdateRequest.js';
|
|
9
10
|
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
10
11
|
export declare class WorkflowsService {
|
|
11
12
|
/**
|
|
12
13
|
* List Workflow Runs Waiting For Current User
|
|
13
|
-
*
|
|
14
|
+
* The current user's approval queue: active form waits assigned to them, with the owning run.
|
|
14
15
|
* @param podId
|
|
15
16
|
* @param limit
|
|
16
17
|
* @param pageToken
|
|
@@ -20,23 +21,32 @@ export declare class WorkflowsService {
|
|
|
20
21
|
static workflowRunWaitingAssignedToMe(podId: string, limit?: number, pageToken?: (string | null)): CancelablePromise<WorkflowRunWaitAssignmentListResponse>;
|
|
21
22
|
/**
|
|
22
23
|
* Get Workflow Run
|
|
23
|
-
* Get current state, context,
|
|
24
|
+
* Get current state, context, step history, and the active wait (when WAITING) of a workflow run.
|
|
24
25
|
* @param podId
|
|
25
26
|
* @param runId
|
|
26
|
-
* @returns
|
|
27
|
+
* @returns WorkflowRunResponse Successful Response
|
|
27
28
|
* @throws ApiError
|
|
28
29
|
*/
|
|
29
|
-
static workflowRunGet(podId: string, runId: string): CancelablePromise<
|
|
30
|
+
static workflowRunGet(podId: string, runId: string): CancelablePromise<WorkflowRunResponse>;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
* Cancel Workflow Run
|
|
33
|
+
* Cancel a non-terminal run. The active wait (if any) is cancelled in the same transaction; late completion events for cancelled waits are dropped. Cancelling a terminal run returns 409.
|
|
34
|
+
* @param podId
|
|
35
|
+
* @param runId
|
|
36
|
+
* @returns WorkflowRunResponse Successful Response
|
|
37
|
+
* @throws ApiError
|
|
38
|
+
*/
|
|
39
|
+
static workflowRunCancel(podId: string, runId: string): CancelablePromise<WorkflowRunResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Submit Workflow Run Form
|
|
42
|
+
* Submit the form the run is waiting on. `node_id` must match the run's active HUMAN wait (409 when the run is not waiting on a form, 422 on node mismatch, 403 when the wait is assigned to someone else). The submitted `inputs` become the form node's output, available to later nodes as `<node_id>.<field>`.
|
|
33
43
|
* @param podId
|
|
34
44
|
* @param runId
|
|
35
45
|
* @param requestBody
|
|
36
|
-
* @returns
|
|
46
|
+
* @returns WorkflowRunResponse Successful Response
|
|
37
47
|
* @throws ApiError
|
|
38
48
|
*/
|
|
39
|
-
static
|
|
49
|
+
static workflowRunFormSubmit(podId: string, runId: string, requestBody: WorkflowRunFormSubmitRequest): CancelablePromise<WorkflowRunResponse>;
|
|
40
50
|
/**
|
|
41
51
|
* Visualize Workflow Run
|
|
42
52
|
* Render an HTML view of a run overlaid on its workflow graph.
|
|
@@ -46,17 +56,6 @@ export declare class WorkflowsService {
|
|
|
46
56
|
* @throws ApiError
|
|
47
57
|
*/
|
|
48
58
|
static workflowRunVisualize(podId: string, runId: string): CancelablePromise<string>;
|
|
49
|
-
/**
|
|
50
|
-
* List Workflow Runs
|
|
51
|
-
* List recent runs for a given workflow.
|
|
52
|
-
* @param podId
|
|
53
|
-
* @param workflowName
|
|
54
|
-
* @param limit
|
|
55
|
-
* @param pageToken
|
|
56
|
-
* @returns WorkflowRunListResponse Successful Response
|
|
57
|
-
* @throws ApiError
|
|
58
|
-
*/
|
|
59
|
-
static workflowRunList(podId: string, workflowName: string, limit?: number, pageToken?: (string | null)): CancelablePromise<WorkflowRunListResponse>;
|
|
60
59
|
/**
|
|
61
60
|
* List Workflows
|
|
62
61
|
* List all workflows in a pod.
|
|
@@ -69,7 +68,7 @@ export declare class WorkflowsService {
|
|
|
69
68
|
static workflowList(podId: string, limit?: number, pageToken?: (string | null)): CancelablePromise<WorkflowListResponse>;
|
|
70
69
|
/**
|
|
71
70
|
* Create Workflow
|
|
72
|
-
* Create a workflow definition.
|
|
71
|
+
* Create a workflow definition. The graph (`nodes`/`edges`) can be included in this call to create a ready-to-run workflow in one step, or omitted to create a shell and upload the graph later with `workflow.graph.update`.
|
|
73
72
|
* @param podId
|
|
74
73
|
* @param requestBody
|
|
75
74
|
* @returns FlowDetailResponse Successful Response
|
|
@@ -115,15 +114,25 @@ export declare class WorkflowsService {
|
|
|
115
114
|
*/
|
|
116
115
|
static workflowGraphUpdate(podId: string, workflowName: string, requestBody: WorkflowGraphUpdateRequest): CancelablePromise<FlowDetailResponse>;
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
117
|
+
* List Workflow Runs
|
|
118
|
+
* List recent runs for a given workflow.
|
|
120
119
|
* @param podId
|
|
121
120
|
* @param workflowName
|
|
122
|
-
* @param
|
|
123
|
-
* @
|
|
121
|
+
* @param limit
|
|
122
|
+
* @param pageToken
|
|
123
|
+
* @returns WorkflowRunListResponse Successful Response
|
|
124
|
+
* @throws ApiError
|
|
125
|
+
*/
|
|
126
|
+
static workflowRunList(podId: string, workflowName: string, limit?: number, pageToken?: (string | null)): CancelablePromise<WorkflowRunListResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Create Workflow Run
|
|
129
|
+
* Create a new run for this workflow. Takes no request body: if the workflow's entry node is a FORM node the run is created WAITING on it (see `active_wait` in the response) and input is submitted via `workflow.run.form.submit`; otherwise the run executes immediately. Trigger payloads for scheduled/event/datastore starts are supplied by the platform, not through this endpoint.
|
|
130
|
+
* @param podId
|
|
131
|
+
* @param workflowName
|
|
132
|
+
* @returns WorkflowRunResponse Successful Response
|
|
124
133
|
* @throws ApiError
|
|
125
134
|
*/
|
|
126
|
-
static
|
|
135
|
+
static workflowRunCreate(podId: string, workflowName: string): CancelablePromise<WorkflowRunResponse>;
|
|
127
136
|
/**
|
|
128
137
|
* Visualize Workflow
|
|
129
138
|
* Render an HTML visualization for debugging workflow graph structure.
|
|
@@ -3,7 +3,7 @@ import { request as __request } from '../core/request.js';
|
|
|
3
3
|
export class WorkflowsService {
|
|
4
4
|
/**
|
|
5
5
|
* List Workflow Runs Waiting For Current User
|
|
6
|
-
*
|
|
6
|
+
* The current user's approval queue: active form waits assigned to them, with the owning run.
|
|
7
7
|
* @param podId
|
|
8
8
|
* @param limit
|
|
9
9
|
* @param pageToken
|
|
@@ -28,10 +28,10 @@ export class WorkflowsService {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Get Workflow Run
|
|
31
|
-
* Get current state, context,
|
|
31
|
+
* Get current state, context, step history, and the active wait (when WAITING) of a workflow run.
|
|
32
32
|
* @param podId
|
|
33
33
|
* @param runId
|
|
34
|
-
* @returns
|
|
34
|
+
* @returns WorkflowRunResponse Successful Response
|
|
35
35
|
* @throws ApiError
|
|
36
36
|
*/
|
|
37
37
|
static workflowRunGet(podId, runId) {
|
|
@@ -48,71 +48,65 @@ export class WorkflowsService {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* Cancel Workflow Run
|
|
52
|
+
* Cancel a non-terminal run. The active wait (if any) is cancelled in the same transaction; late completion events for cancelled waits are dropped. Cancelling a terminal run returns 409.
|
|
53
53
|
* @param podId
|
|
54
54
|
* @param runId
|
|
55
|
-
* @
|
|
56
|
-
* @returns FlowRunEntity Successful Response
|
|
55
|
+
* @returns WorkflowRunResponse Successful Response
|
|
57
56
|
* @throws ApiError
|
|
58
57
|
*/
|
|
59
|
-
static
|
|
58
|
+
static workflowRunCancel(podId, runId) {
|
|
60
59
|
return __request(OpenAPI, {
|
|
61
60
|
method: 'POST',
|
|
62
|
-
url: '/pods/{pod_id}/workflow-runs/{run_id}/
|
|
61
|
+
url: '/pods/{pod_id}/workflow-runs/{run_id}/cancel',
|
|
63
62
|
path: {
|
|
64
63
|
'pod_id': podId,
|
|
65
64
|
'run_id': runId,
|
|
66
65
|
},
|
|
67
|
-
body: requestBody,
|
|
68
|
-
mediaType: 'application/json',
|
|
69
66
|
errors: {
|
|
70
67
|
422: `Validation Error`,
|
|
71
68
|
},
|
|
72
69
|
});
|
|
73
70
|
}
|
|
74
71
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* Submit Workflow Run Form
|
|
73
|
+
* Submit the form the run is waiting on. `node_id` must match the run's active HUMAN wait (409 when the run is not waiting on a form, 422 on node mismatch, 403 when the wait is assigned to someone else). The submitted `inputs` become the form node's output, available to later nodes as `<node_id>.<field>`.
|
|
77
74
|
* @param podId
|
|
78
75
|
* @param runId
|
|
79
|
-
* @
|
|
76
|
+
* @param requestBody
|
|
77
|
+
* @returns WorkflowRunResponse Successful Response
|
|
80
78
|
* @throws ApiError
|
|
81
79
|
*/
|
|
82
|
-
static
|
|
80
|
+
static workflowRunFormSubmit(podId, runId, requestBody) {
|
|
83
81
|
return __request(OpenAPI, {
|
|
84
|
-
method: '
|
|
85
|
-
url: '/pods/{pod_id}/workflow-runs/{run_id}/
|
|
82
|
+
method: 'POST',
|
|
83
|
+
url: '/pods/{pod_id}/workflow-runs/{run_id}/form',
|
|
86
84
|
path: {
|
|
87
85
|
'pod_id': podId,
|
|
88
86
|
'run_id': runId,
|
|
89
87
|
},
|
|
88
|
+
body: requestBody,
|
|
89
|
+
mediaType: 'application/json',
|
|
90
90
|
errors: {
|
|
91
91
|
422: `Validation Error`,
|
|
92
92
|
},
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
96
|
+
* Visualize Workflow Run
|
|
97
|
+
* Render an HTML view of a run overlaid on its workflow graph.
|
|
98
98
|
* @param podId
|
|
99
|
-
* @param
|
|
100
|
-
* @
|
|
101
|
-
* @param pageToken
|
|
102
|
-
* @returns WorkflowRunListResponse Successful Response
|
|
99
|
+
* @param runId
|
|
100
|
+
* @returns string Successful Response
|
|
103
101
|
* @throws ApiError
|
|
104
102
|
*/
|
|
105
|
-
static
|
|
103
|
+
static workflowRunVisualize(podId, runId) {
|
|
106
104
|
return __request(OpenAPI, {
|
|
107
105
|
method: 'GET',
|
|
108
|
-
url: '/pods/{pod_id}/workflow-runs/{
|
|
106
|
+
url: '/pods/{pod_id}/workflow-runs/{run_id}/visualize',
|
|
109
107
|
path: {
|
|
110
108
|
'pod_id': podId,
|
|
111
|
-
'
|
|
112
|
-
},
|
|
113
|
-
query: {
|
|
114
|
-
'limit': limit,
|
|
115
|
-
'page_token': pageToken,
|
|
109
|
+
'run_id': runId,
|
|
116
110
|
},
|
|
117
111
|
errors: {
|
|
118
112
|
422: `Validation Error`,
|
|
@@ -146,7 +140,7 @@ export class WorkflowsService {
|
|
|
146
140
|
}
|
|
147
141
|
/**
|
|
148
142
|
* Create Workflow
|
|
149
|
-
* Create a workflow definition.
|
|
143
|
+
* Create a workflow definition. The graph (`nodes`/`edges`) can be included in this call to create a ready-to-run workflow in one step, or omitted to create a shell and upload the graph later with `workflow.graph.update`.
|
|
150
144
|
* @param podId
|
|
151
145
|
* @param requestBody
|
|
152
146
|
* @returns FlowDetailResponse Successful Response
|
|
@@ -257,24 +251,48 @@ export class WorkflowsService {
|
|
|
257
251
|
});
|
|
258
252
|
}
|
|
259
253
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
254
|
+
* List Workflow Runs
|
|
255
|
+
* List recent runs for a given workflow.
|
|
262
256
|
* @param podId
|
|
263
257
|
* @param workflowName
|
|
264
|
-
* @param
|
|
265
|
-
* @
|
|
258
|
+
* @param limit
|
|
259
|
+
* @param pageToken
|
|
260
|
+
* @returns WorkflowRunListResponse Successful Response
|
|
261
|
+
* @throws ApiError
|
|
262
|
+
*/
|
|
263
|
+
static workflowRunList(podId, workflowName, limit = 100, pageToken) {
|
|
264
|
+
return __request(OpenAPI, {
|
|
265
|
+
method: 'GET',
|
|
266
|
+
url: '/pods/{pod_id}/workflows/{workflow_name}/runs',
|
|
267
|
+
path: {
|
|
268
|
+
'pod_id': podId,
|
|
269
|
+
'workflow_name': workflowName,
|
|
270
|
+
},
|
|
271
|
+
query: {
|
|
272
|
+
'limit': limit,
|
|
273
|
+
'page_token': pageToken,
|
|
274
|
+
},
|
|
275
|
+
errors: {
|
|
276
|
+
422: `Validation Error`,
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Create Workflow Run
|
|
282
|
+
* Create a new run for this workflow. Takes no request body: if the workflow's entry node is a FORM node the run is created WAITING on it (see `active_wait` in the response) and input is submitted via `workflow.run.form.submit`; otherwise the run executes immediately. Trigger payloads for scheduled/event/datastore starts are supplied by the platform, not through this endpoint.
|
|
283
|
+
* @param podId
|
|
284
|
+
* @param workflowName
|
|
285
|
+
* @returns WorkflowRunResponse Successful Response
|
|
266
286
|
* @throws ApiError
|
|
267
287
|
*/
|
|
268
|
-
static
|
|
288
|
+
static workflowRunCreate(podId, workflowName) {
|
|
269
289
|
return __request(OpenAPI, {
|
|
270
290
|
method: 'POST',
|
|
271
|
-
url: '/pods/{pod_id}/workflows/{workflow_name}/
|
|
291
|
+
url: '/pods/{pod_id}/workflows/{workflow_name}/runs',
|
|
272
292
|
path: {
|
|
273
293
|
'pod_id': podId,
|
|
274
294
|
'workflow_name': workflowName,
|
|
275
295
|
},
|
|
276
|
-
body: requestBody,
|
|
277
|
-
mediaType: 'application/json',
|
|
278
296
|
errors: {
|
|
279
297
|
422: `Validation Error`,
|
|
280
298
|
},
|
|
@@ -20,7 +20,7 @@ export function useAddPodMember({ client, podId, enabled = true, defaultRole = P
|
|
|
20
20
|
const resolvedPodId = resolvePodId(client, podId);
|
|
21
21
|
const nextMember = await client.podMembers.add(resolvedPodId, {
|
|
22
22
|
organization_member_id: organizationMemberId,
|
|
23
|
-
|
|
23
|
+
roles: [input.role ?? defaultRole],
|
|
24
24
|
});
|
|
25
25
|
setAddedMember(nextMember);
|
|
26
26
|
onSuccessRef.current?.(nextMember);
|
|
@@ -80,6 +80,7 @@ export interface UseAssistantControllerOptions extends AssistantConversationScop
|
|
|
80
80
|
export interface SendAssistantControllerMessageOptions {
|
|
81
81
|
forceNewConversation?: boolean;
|
|
82
82
|
metadata?: Record<string, unknown> | null;
|
|
83
|
+
conversationMetadata?: Record<string, unknown> | null;
|
|
83
84
|
instructions?: string | null;
|
|
84
85
|
}
|
|
85
86
|
export type AssistantUserApprovalDecision = "APPROVE_ONCE" | "APPROVE_FOR_SESSION" | "DENY";
|
|
@@ -1075,6 +1075,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1075
1075
|
const createdConversation = await sessionCreateConversation({
|
|
1076
1076
|
title: titleSeed.slice(0, 120),
|
|
1077
1077
|
instructions: typeof options.instructions === "undefined" ? instructions : options.instructions,
|
|
1078
|
+
metadata: options.metadata ?? undefined,
|
|
1078
1079
|
model: conversationModel,
|
|
1079
1080
|
agentRuntime: conversationRuntime,
|
|
1080
1081
|
...scope,
|
|
@@ -1136,7 +1137,10 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1136
1137
|
let conversationId = forceNewConversation ? null : activeConversationId;
|
|
1137
1138
|
try {
|
|
1138
1139
|
if (!conversationId) {
|
|
1139
|
-
conversationId = await ensureConversation(trimmed, {
|
|
1140
|
+
conversationId = await ensureConversation(trimmed, {
|
|
1141
|
+
instructions: options.instructions,
|
|
1142
|
+
metadata: options.conversationMetadata,
|
|
1143
|
+
});
|
|
1140
1144
|
}
|
|
1141
1145
|
if (!conversationId) {
|
|
1142
1146
|
throw new Error("Conversation could not be initialized");
|
|
@@ -40,6 +40,7 @@ export interface UseAssistantSessionOptions {
|
|
|
40
40
|
export interface CreateConversationInput {
|
|
41
41
|
title?: string | null;
|
|
42
42
|
instructions?: string | null;
|
|
43
|
+
metadata?: Record<string, unknown> | null;
|
|
43
44
|
model?: ConversationModel | null;
|
|
44
45
|
agentRuntime?: AgentRuntimeConfig | null;
|
|
45
46
|
podId?: string | null;
|
|
@@ -143,6 +143,9 @@ export function useAssistantSession(options) {
|
|
|
143
143
|
const onStatusRef = useRef(onStatus);
|
|
144
144
|
const onMessageRef = useRef(onMessage);
|
|
145
145
|
const onErrorRef = useRef(onError);
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
|
+
const consumeRef = useRef(null);
|
|
148
|
+
const streamReconnectCountRef = useRef(0);
|
|
146
149
|
const setConversationId = useCallback((nextConversationId) => {
|
|
147
150
|
abortRef.current?.abort();
|
|
148
151
|
abortRef.current = null;
|
|
@@ -274,6 +277,7 @@ export function useAssistantSession(options) {
|
|
|
274
277
|
instructions: typeof input.instructions === "undefined"
|
|
275
278
|
? defaultInstructions ?? undefined
|
|
276
279
|
: input.instructions,
|
|
280
|
+
metadata: input.metadata ?? undefined,
|
|
277
281
|
pod_id: input.podId ?? defaultPodId ?? scopedClient.podId ?? undefined,
|
|
278
282
|
agent_name: input.agentName
|
|
279
283
|
?? input.assistantName
|
|
@@ -391,6 +395,16 @@ export function useAssistantSession(options) {
|
|
|
391
395
|
const payload = parseSSEJson(event);
|
|
392
396
|
onEventRef.current?.(event, payload);
|
|
393
397
|
const parsed = parseAssistantStreamEvent(payload);
|
|
398
|
+
if (parsed.error) {
|
|
399
|
+
const streamError = new Error(parsed.error);
|
|
400
|
+
setError(streamError);
|
|
401
|
+
onErrorRef.current?.(streamError);
|
|
402
|
+
setConversationStatus(parsed.status ?? "FAILED");
|
|
403
|
+
sawTerminalStatus = true;
|
|
404
|
+
clearStreamingText();
|
|
405
|
+
clearStreamingTool();
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
394
408
|
if (parsed.token) {
|
|
395
409
|
if (parsed.tokenKind === "tool") {
|
|
396
410
|
streamingToolTokenRef.current += parsed.token;
|
|
@@ -435,6 +449,28 @@ export function useAssistantSession(options) {
|
|
|
435
449
|
}
|
|
436
450
|
if (!controller.signal.aborted) {
|
|
437
451
|
if (!sawTerminalStatus && isConversationRunningStatus(statusRef.current)) {
|
|
452
|
+
const reconId = streamConversationId ?? conversationId;
|
|
453
|
+
if (reconId && streamReconnectCountRef.current < 3) {
|
|
454
|
+
streamReconnectCountRef.current += 1;
|
|
455
|
+
const delay = Math.pow(2, streamReconnectCountRef.current - 1) * 1000;
|
|
456
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
457
|
+
if (!controller.signal.aborted && isConversationRunningStatus(statusRef.current)) {
|
|
458
|
+
try {
|
|
459
|
+
const scope = normalizeScope(client, defaultScope);
|
|
460
|
+
const scopedClient = applyPodScope(client, scope.podId);
|
|
461
|
+
const newStream = await scopedClient.conversations.resumeStream(reconId, {
|
|
462
|
+
pod_id: scope.podId ?? undefined,
|
|
463
|
+
signal: controller.signal,
|
|
464
|
+
});
|
|
465
|
+
// Sync any messages delivered while the stream was dropped
|
|
466
|
+
await loadMessages({ conversationId: reconId, limit: 100 });
|
|
467
|
+
streamReconnectCountRef.current = 0;
|
|
468
|
+
return consumeRef.current({ stream: newStream, controller, streamConversationId: reconId, syncAfterStream });
|
|
469
|
+
}
|
|
470
|
+
catch { /* fall through to WAITING */ }
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
streamReconnectCountRef.current = 0;
|
|
438
474
|
setConversationStatus("WAITING");
|
|
439
475
|
}
|
|
440
476
|
clearStreamingText();
|
|
@@ -464,12 +500,17 @@ export function useAssistantSession(options) {
|
|
|
464
500
|
appendStreamingToken,
|
|
465
501
|
clearStreamingTool,
|
|
466
502
|
clearStreamingText,
|
|
503
|
+
client,
|
|
467
504
|
conversationId,
|
|
505
|
+
defaultScope,
|
|
468
506
|
loadMessages,
|
|
469
507
|
refreshConversation,
|
|
470
508
|
setConversationStatus,
|
|
471
509
|
syncOnTurnEnd,
|
|
472
510
|
]);
|
|
511
|
+
useEffect(() => {
|
|
512
|
+
consumeRef.current = consume;
|
|
513
|
+
}, [consume]);
|
|
473
514
|
const ensureConversation = useCallback(async (overrideConversationId) => {
|
|
474
515
|
const existingId = overrideConversationId ?? conversationId;
|
|
475
516
|
if (existingId) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DatastoreCountResponse } from "../types.js";
|
|
3
3
|
export interface UseBulkRecordsOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
6
6
|
tableName: string;
|
|
7
7
|
enabled?: boolean;
|
|
8
|
-
onSuccess?: (response:
|
|
8
|
+
onSuccess?: (response: DatastoreCountResponse) => void;
|
|
9
9
|
onError?: (error: unknown) => void;
|
|
10
10
|
}
|
|
11
11
|
export interface UseBulkRecordsResult {
|
|
12
12
|
isSubmitting: boolean;
|
|
13
13
|
error: Error | null;
|
|
14
14
|
lastMessage: string | null;
|
|
15
|
-
createMany: (records: Record<string, unknown>[]) => Promise<
|
|
16
|
-
updateMany: (records: Record<string, unknown>[]) => Promise<
|
|
17
|
-
deleteMany: (recordIds: Array<string | number>) => Promise<
|
|
15
|
+
createMany: (records: Record<string, unknown>[]) => Promise<DatastoreCountResponse | null>;
|
|
16
|
+
updateMany: (records: Record<string, unknown>[]) => Promise<DatastoreCountResponse | null>;
|
|
17
|
+
deleteMany: (recordIds: Array<string | number>) => Promise<DatastoreCountResponse | null>;
|
|
18
18
|
reset: () => void;
|
|
19
19
|
}
|
|
20
20
|
export declare function useBulkRecords({ client, podId, tableName, enabled, onSuccess, onError, }: UseBulkRecordsOptions): UseBulkRecordsResult;
|
|
@@ -10,7 +10,7 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
10
10
|
useEffect(() => { onErrorRef.current = onError; }, [onError]);
|
|
11
11
|
const trimmedTableName = tableName.trim();
|
|
12
12
|
const isEnabled = enabled && trimmedTableName.length > 0;
|
|
13
|
-
const runBulkOperation = useCallback(async (action, fallbackError) => {
|
|
13
|
+
const runBulkOperation = useCallback(async (action, fallbackError, describe) => {
|
|
14
14
|
if (!isEnabled) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
19
19
|
try {
|
|
20
20
|
const scopedClient = resolvePodClient(client, podId);
|
|
21
21
|
const response = await action(scopedClient);
|
|
22
|
-
setLastMessage(response.
|
|
22
|
+
setLastMessage(describe(response.count));
|
|
23
23
|
onSuccessRef.current?.(response);
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
@@ -36,17 +36,17 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
36
36
|
const createMany = useCallback(async (records) => {
|
|
37
37
|
if (records.length === 0)
|
|
38
38
|
return null;
|
|
39
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.create(trimmedTableName, records), "Failed to bulk create records.");
|
|
39
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.create(trimmedTableName, records), "Failed to bulk create records.", (count) => `${count} record${count === 1 ? "" : "s"} created.`);
|
|
40
40
|
}, [runBulkOperation, trimmedTableName]);
|
|
41
41
|
const updateMany = useCallback(async (records) => {
|
|
42
42
|
if (records.length === 0)
|
|
43
43
|
return null;
|
|
44
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.update(trimmedTableName, records), "Failed to bulk update records.");
|
|
44
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.update(trimmedTableName, records), "Failed to bulk update records.", (count) => `${count} record${count === 1 ? "" : "s"} updated.`);
|
|
45
45
|
}, [runBulkOperation, trimmedTableName]);
|
|
46
46
|
const deleteMany = useCallback(async (recordIds) => {
|
|
47
47
|
if (recordIds.length === 0)
|
|
48
48
|
return null;
|
|
49
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.delete(trimmedTableName, recordIds), "Failed to bulk delete records.");
|
|
49
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.delete(trimmedTableName, recordIds), "Failed to bulk delete records.", (count) => `${count} record${count === 1 ? "" : "s"} deleted.`);
|
|
50
50
|
}, [runBulkOperation, trimmedTableName]);
|
|
51
51
|
const reset = useCallback(() => {
|
|
52
52
|
setError(null);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FileResponse } from "../types.js";
|
|
3
3
|
export interface CreateFolderInput {
|
|
4
4
|
directoryPath?: string;
|
|
5
5
|
parentId?: string;
|
|
6
6
|
description?: string;
|
|
7
|
-
namespace?: DatastoreFileNamespace | null;
|
|
8
7
|
}
|
|
9
8
|
export interface UseCreateFolderOptions {
|
|
10
9
|
client: LemmaClient;
|
|
11
10
|
podId?: string;
|
|
12
|
-
namespace?: DatastoreFileNamespace | null;
|
|
13
11
|
enabled?: boolean;
|
|
14
12
|
onSuccess?: (folder: FileResponse) => void;
|
|
15
13
|
onError?: (error: unknown) => void;
|
|
@@ -21,4 +19,4 @@ export interface UseCreateFolderResult<TFile extends FileResponse = FileResponse
|
|
|
21
19
|
createFolder: (name: string, options?: CreateFolderInput) => Promise<TFile | null>;
|
|
22
20
|
reset: () => void;
|
|
23
21
|
}
|
|
24
|
-
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId,
|
|
22
|
+
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId, enabled, onSuccess, onError, }: UseCreateFolderOptions): UseCreateFolderResult<TFile>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useCreateFolder({ client, podId,
|
|
3
|
+
export function useCreateFolder({ client, podId, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [createdFolder, setCreatedFolder] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -19,7 +19,6 @@ export function useCreateFolder({ client, podId, namespace, enabled = true, onSu
|
|
|
19
19
|
const scopedClient = resolvePodClient(client, podId);
|
|
20
20
|
const nextFolder = await scopedClient.files.folder.create(trimmedName, {
|
|
21
21
|
...options,
|
|
22
|
-
namespace: options.namespace ?? namespace,
|
|
23
22
|
});
|
|
24
23
|
setCreatedFolder(nextFolder);
|
|
25
24
|
onSuccessRef.current?.(nextFolder);
|
|
@@ -34,7 +33,7 @@ export function useCreateFolder({ client, podId, namespace, enabled = true, onSu
|
|
|
34
33
|
finally {
|
|
35
34
|
setIsSubmitting(false);
|
|
36
35
|
}
|
|
37
|
-
}, [client, enabled,
|
|
36
|
+
}, [client, enabled, podId]);
|
|
38
37
|
const reset = useCallback(() => {
|
|
39
38
|
setCreatedFolder(null);
|
|
40
39
|
setError(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FunctionRun
|
|
2
|
+
import type { FunctionRun } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* React hook for creating a single record. Manages loading/error state and
|
|
5
5
|
* exposes a `create` function you can call from event handlers.
|
|
@@ -35,7 +35,7 @@ export interface UseCreateRecordOptions {
|
|
|
35
35
|
createVia?: "direct" | "function";
|
|
36
36
|
/** Function name to run when `createVia` is `"function"`. Falls back to `tableName` if omitted. */
|
|
37
37
|
createFunctionName?: string;
|
|
38
|
-
onSuccess?: (record: Record<string, unknown>, response:
|
|
38
|
+
onSuccess?: (record: Record<string, unknown>, response: Record<string, unknown> | FunctionRun) => void;
|
|
39
39
|
onError?: (error: unknown) => void;
|
|
40
40
|
}
|
|
41
41
|
export interface UseCreateRecordResult<TRecord extends Record<string, unknown> = Record<string, unknown>> {
|
|
@@ -29,7 +29,7 @@ export function useCreateRecord({ client, podId, tableName, enabled = true, crea
|
|
|
29
29
|
return nextRecord;
|
|
30
30
|
}
|
|
31
31
|
const response = await scopedClient.records.create(trimmedTableName, data);
|
|
32
|
-
const nextRecord = (response
|
|
32
|
+
const nextRecord = (response ?? null);
|
|
33
33
|
setCreatedRecord(nextRecord);
|
|
34
34
|
if (nextRecord) {
|
|
35
35
|
onSuccessRef.current?.(nextRecord, response);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DatastoreFileNamespace } from "../types.js";
|
|
3
2
|
export interface UseDeleteFileOptions {
|
|
4
3
|
client: LemmaClient;
|
|
5
4
|
podId?: string;
|
|
6
5
|
path?: string | null;
|
|
7
|
-
namespace?: DatastoreFileNamespace | null;
|
|
8
6
|
enabled?: boolean;
|
|
9
7
|
onSuccess?: (path: string) => void;
|
|
10
8
|
onError?: (error: unknown) => void;
|
|
@@ -15,8 +13,7 @@ export interface UseDeleteFileResult {
|
|
|
15
13
|
error: Error | null;
|
|
16
14
|
remove: (overrides?: {
|
|
17
15
|
path?: string | null;
|
|
18
|
-
namespace?: DatastoreFileNamespace | null;
|
|
19
16
|
}) => Promise<boolean>;
|
|
20
17
|
reset: () => void;
|
|
21
18
|
}
|
|
22
|
-
export declare function useDeleteFile({ client, podId, path,
|
|
19
|
+
export declare function useDeleteFile({ client, podId, path, enabled, onSuccess, onError, }: UseDeleteFileOptions): UseDeleteFileResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useDeleteFile({ client, podId, path = null,
|
|
3
|
+
export function useDeleteFile({ client, podId, path = null, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [deletedPath, setDeletedPath] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -21,7 +21,7 @@ export function useDeleteFile({ client, podId, path = null, namespace, enabled =
|
|
|
21
21
|
setError(null);
|
|
22
22
|
try {
|
|
23
23
|
const scopedClient = resolvePodClient(client, podId);
|
|
24
|
-
await scopedClient.files.delete(nextPath
|
|
24
|
+
await scopedClient.files.delete(nextPath);
|
|
25
25
|
setDeletedPath(nextPath);
|
|
26
26
|
onSuccessRef.current?.(nextPath);
|
|
27
27
|
return true;
|
|
@@ -35,7 +35,7 @@ export function useDeleteFile({ client, podId, path = null, namespace, enabled =
|
|
|
35
35
|
finally {
|
|
36
36
|
setIsSubmitting(false);
|
|
37
37
|
}
|
|
38
|
-
}, [client, isEnabled,
|
|
38
|
+
}, [client, isEnabled, podId, trimmedPath]);
|
|
39
39
|
const reset = useCallback(() => {
|
|
40
40
|
setDeletedPath(null);
|
|
41
41
|
setError(null);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DatastoreMessageResponse } from "../types.js";
|
|
3
2
|
export interface UseDeleteRecordOptions {
|
|
4
3
|
client: LemmaClient;
|
|
5
4
|
podId?: string;
|
|
6
5
|
tableName: string;
|
|
7
6
|
recordId?: string | null;
|
|
8
7
|
enabled?: boolean;
|
|
9
|
-
onSuccess?: (
|
|
8
|
+
onSuccess?: () => void;
|
|
10
9
|
onError?: (error: unknown) => void;
|
|
11
10
|
}
|
|
12
11
|
export interface UseDeleteRecordResult {
|
|
@@ -22,9 +22,9 @@ export function useDeleteRecord({ client, podId, tableName, recordId = null, ena
|
|
|
22
22
|
setError(null);
|
|
23
23
|
try {
|
|
24
24
|
const scopedClient = resolvePodClient(client, podId);
|
|
25
|
-
|
|
26
|
-
setLastMessage(
|
|
27
|
-
onSuccessRef.current?.(
|
|
25
|
+
await scopedClient.records.delete(trimmedTableName, nextRecordId);
|
|
26
|
+
setLastMessage("Record deleted.");
|
|
27
|
+
onSuccessRef.current?.();
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
catch (mutationError) {
|