Skip to content

Commit

Permalink
Add project change event + bump quickjs types
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytten committed Oct 29, 2024
1 parent 10eba78 commit 07e8c21
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/sdk-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caido/sdk-backend",
"version": "0.42.1-beta.3",
"version": "0.42.1-beta.4",
"description": "Typing for the Caido Backend SDK",
"author": "Caido Labs Inc. <[email protected]>",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
"documentation": "typedoc"
},
"dependencies": {
"@caido/quickjs-types": "^0.11.0",
"@caido/quickjs-types": "^0.12.0",
"@caido/sdk-shared": "^0.1.0"
}
}
24 changes: 24 additions & 0 deletions packages/sdk-backend/src/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare module "caido:plugin" {
Response,
ReplaySDK,
ProjectsSDK,
Project,
} from "caido:utils";

/**
Expand Down Expand Up @@ -81,6 +82,29 @@ declare module "caido:plugin" {
response: Response,
) => MaybePromise<void>,
): void;

/**
* Registers an callback on project change.
*
* This callback is called asynchronously and cannot modify the project.
*
* It can happen that the project is null if the user deleted the currently selected one.
*
* @example
* ```ts
* sdk.events.onProjectChange((sdk, project) => {
* if (project !== null) {
* // Do something with the project
* }
* });
* ```
*/
onProjectChange(
callback: (
sdk: SDK<API, Events>,
project: Project | null,
) => MaybePromise<void>,
): void;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-workflow/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caido/sdk-workflow",
"version": "0.42.1-beta.3",
"version": "0.42.1-beta.4",
"description": "Typing for the Caido Workflow SDK",
"author": "Caido Labs Inc. <[email protected]>",
"license": "MIT",
Expand All @@ -12,6 +12,6 @@
"documentation": "typedoc"
},
"dependencies": {
"@caido/quickjs-types": "^0.11.0"
"@caido/quickjs-types": "^0.12.0"
}
}
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07e8c21

Please sign in to comment.