@caido/sdk-frontend 0.46.1-beta.6 → 0.46.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.46.1-beta.6",
3
+ "version": "0.46.1-beta.8",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
package/src/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { API as Caido } from "./types";
1
+ export type { API as Caido } from "./types";
2
+ export type * from "./types";
@@ -20170,6 +20170,19 @@ export type WorkflowFullFragment = {
20170
20170
  global: boolean;
20171
20171
  readOnly: boolean;
20172
20172
  };
20173
+ export type WorkflowEdgeFullFragment = {
20174
+ cursor: string;
20175
+ node: {
20176
+ __typename: "Workflow";
20177
+ definition: Record<string, unknown>;
20178
+ id: string;
20179
+ kind: WorkflowKind;
20180
+ name: string;
20181
+ enabled: boolean;
20182
+ global: boolean;
20183
+ readOnly: boolean;
20184
+ };
20185
+ };
20173
20186
  export type WorkflowNodeDefinitionFullFragment = {
20174
20187
  __typename: "WorkflowNodeDefinition";
20175
20188
  raw: Record<string, unknown>;
@@ -20700,6 +20713,7 @@ export declare const UpstreamProxySocksFullFragmentDoc = "\n fragment upstrea
20700
20713
  export declare const UserProfileFullFragmentDoc = "\n fragment userProfileFull on UserProfile {\n __typename\n identity {\n __typename\n name\n email\n }\n subscription {\n __typename\n entitlements {\n __typename\n name\n }\n plan {\n __typename\n name\n }\n }\n}\n ";
20701
20714
  export declare const UserSettingsFullFragmentDoc = "\n fragment userSettingsFull on UserSettings {\n __typename\n data\n migrations\n}\n ";
20702
20715
  export declare const WorkflowFullFragmentDoc = "\n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n ";
20716
+ export declare const WorkflowEdgeFullFragmentDoc = "\n fragment workflowEdgeFull on WorkflowEdge {\n cursor\n node {\n ...workflowFull\n }\n}\n ";
20703
20717
  export declare const WorkflowNodeDefinitionFullFragmentDoc = "\n fragment workflowNodeDefinitionFull on WorkflowNodeDefinition {\n __typename\n raw\n}\n ";
20704
20718
  export declare const WorkflowTaskMetaFragmentDoc = "\n fragment workflowTaskMeta on WorkflowTask {\n ...taskMeta\n workflow {\n ...workflowMeta\n }\n}\n ";
20705
20719
  export declare const AssistantSessionsDocument = "\n query assistantSessions {\n assistantSessions {\n ...assistantSessionMeta\n }\n}\n \n fragment assistantSessionMeta on AssistantSession {\n __typename\n id\n modelId\n name\n updatedAt\n createdAt\n}\n ";
@@ -20974,9 +20988,9 @@ export declare const UserProfileDocument = "\n query userProfile {\n viewer
20974
20988
  export declare const UserSettingsDocument = "\n query userSettings {\n viewer {\n id\n settings {\n ...userSettingsFull\n }\n }\n}\n \n fragment userSettingsFull on UserSettings {\n __typename\n data\n migrations\n}\n ";
20975
20989
  export declare const WorkflowDocument = "\n query workflow($id: ID!) {\n workflow(id: $id) {\n ...workflowFull\n }\n}\n \n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20976
20990
  export declare const WorkflowsStateDocument = "\n query workflowsState {\n workflows {\n ...workflowFull\n }\n workflowNodeDefinitions {\n ...workflowNodeDefinitionFull\n }\n}\n \n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n \n\n fragment workflowNodeDefinitionFull on WorkflowNodeDefinition {\n __typename\n raw\n}\n ";
20977
- export declare const CreatedWorkflowDocument = "\n subscription createdWorkflow {\n createdWorkflow {\n workflowEdge {\n cursor\n node {\n ...workflowFull\n }\n }\n }\n}\n \n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20991
+ export declare const CreatedWorkflowDocument = "\n subscription createdWorkflow {\n createdWorkflow {\n workflowEdge {\n ...workflowEdgeFull\n }\n }\n}\n \n fragment workflowEdgeFull on WorkflowEdge {\n cursor\n node {\n ...workflowFull\n }\n}\n \n\n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20978
20992
  export declare const DeletedWorkflowDocument = "\n subscription deletedWorkflow {\n deletedWorkflow {\n deletedWorkflowId\n }\n}\n ";
20979
- export declare const UpdatedWorkflowDocument = "\n subscription updatedWorkflow {\n updatedWorkflow {\n workflowEdge {\n cursor\n node {\n ...workflowFull\n }\n }\n }\n}\n \n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20993
+ export declare const UpdatedWorkflowDocument = "\n subscription updatedWorkflow {\n updatedWorkflow {\n workflowEdge {\n ...workflowEdgeFull\n }\n }\n}\n \n fragment workflowEdgeFull on WorkflowEdge {\n cursor\n node {\n ...workflowFull\n }\n}\n \n\n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20980
20994
  export declare const CreateWorkflowDocument = "\n mutation createWorkflow($input: CreateWorkflowInput!) {\n createWorkflow(input: $input) {\n error {\n ... on WorkflowUserError {\n ...workflowUserErrorFull\n }\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n }\n workflow {\n ...workflowFull\n }\n }\n}\n \n fragment workflowUserErrorFull on WorkflowUserError {\n ...userErrorFull\n node\n message\n reason\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n \n\n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
20981
20995
  export declare const DeleteWorkflowDocument = "\n mutation deleteWorkflow($id: ID!) {\n deleteWorkflow(id: $id) {\n deletedId\n error {\n ... on UnknownIdUserError {\n ...unknownIdUserErrorFull\n }\n ... on ReadOnlyUserError {\n ...readOnlyUserErrorFull\n }\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n }\n }\n}\n \n fragment unknownIdUserErrorFull on UnknownIdUserError {\n ...userErrorFull\n id\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment readOnlyUserErrorFull on ReadOnlyUserError {\n ...userErrorFull\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n ";
20982
20996
  export declare const ToggleWorkflowDocument = "\n mutation toggleWorkflow($id: ID!, $enabled: Boolean!) {\n toggleWorkflow(id: $id, enabled: $enabled) {\n error {\n ... on UnknownIdUserError {\n ...unknownIdUserErrorFull\n }\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n }\n workflow {\n ...workflowFull\n }\n }\n}\n \n fragment unknownIdUserErrorFull on UnknownIdUserError {\n ...userErrorFull\n id\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n \n\n fragment workflowFull on Workflow {\n ...workflowMeta\n definition\n}\n \n\n fragment workflowMeta on Workflow {\n __typename\n id\n kind\n name\n enabled\n global\n readOnly\n}\n ";
@@ -32,7 +32,8 @@ export type { HTTPQL, ID } from "./utils";
32
32
  export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, } from "./matchReplace";
33
33
  export type { Scope } from "./scopes";
34
34
  export type { EnvironmentVariable } from "./environment";
35
- export type { Workflow, WorkflowKind } from "./workflows";
35
+ export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./workflows";
36
+ export type { ListenerHandle } from "./utils";
36
37
  /**
37
38
  * Utilities for frontend plugins.
38
39
  * @category SDK
@@ -34,4 +34,13 @@ export type JSONCompatible<T> = unknown extends T ? never : {
34
34
  [P in keyof T]: T[P] extends JSONValue ? T[P] : T[P] extends NotAssignableToJson ? never : JSONCompatible<T[P]>;
35
35
  };
36
36
  export type PromisifiedReturnType<T extends (...args: unknown[]) => unknown> = ReturnType<T> extends Promise<infer U> ? Promise<U> : Promise<ReturnType<T>>;
37
+ /**
38
+ * A handle for a listener.
39
+ */
40
+ export type ListenerHandle = {
41
+ /**
42
+ * Stop the listener.
43
+ */
44
+ stop: () => void;
45
+ };
37
46
  export {};
@@ -1,3 +1,4 @@
1
+ import { type ID, type ListenerHandle } from "./utils";
1
2
  /**
2
3
  * Utilities to interact with workflows.
3
4
  * @category Workflows
@@ -8,6 +9,21 @@ export type WorkflowSDK = {
8
9
  * @returns All workflows.
9
10
  */
10
11
  getWorkflows: () => Workflow[];
12
+ /**
13
+ * Register a callback to be called when a workflow is created.
14
+ * @param callback The callback to be called.
15
+ */
16
+ onCreatedWorkflow: (callback: OnCreatedWorkflowCallback) => ListenerHandle;
17
+ /**
18
+ * Register a callback to be called when a workflow is updated.
19
+ * @param callback The callback to be called.
20
+ */
21
+ onUpdatedWorkflow: (callback: OnUpdatedWorkflowCallback) => ListenerHandle;
22
+ /**
23
+ * Register a callback to be called when a workflow is deleted.
24
+ * @param callback The callback to be called.
25
+ */
26
+ onDeletedWorkflow: (callback: OnDeletedWorkflowCallback) => ListenerHandle;
11
27
  };
12
28
  /**
13
29
  * A workflow
@@ -24,3 +40,12 @@ export type Workflow = {
24
40
  * @category Workflows
25
41
  */
26
42
  export type WorkflowKind = "Convert" | "Active" | "Passive";
43
+ export type OnCreatedWorkflowCallback = (event: {
44
+ workflow: Workflow;
45
+ }) => void;
46
+ export type OnUpdatedWorkflowCallback = (event: {
47
+ workflow: Workflow;
48
+ }) => void;
49
+ export type OnDeletedWorkflowCallback = (event: {
50
+ id: ID;
51
+ }) => void;