@jetcrab/pi-desk-sdk 1.1.0-dev.1 → 1.1.2

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/entry.d.ts CHANGED
@@ -41,6 +41,8 @@ export interface PluginNotificationEventInput {
41
41
  data: PluginJsonObject;
42
42
  }
43
43
  export interface PluginNotificationPublishInput {
44
+ /** 同一插件内的业务去重标识,去除首尾空白后为 1~256 字符。 */
45
+ key?: string;
44
46
  level: PluginNotificationLevel;
45
47
  title: string;
46
48
  description?: string;
package/dist/session.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare const SESSION_PLUGIN_STATE_EVENT = "pi-desk:session-plugins";
7
7
  export declare const SESSION_PLUGIN_METHOD_EVENT = "pi-desk:session-plugin-methods:v1";
8
8
  export declare const SESSION_PLUGIN_PUSH_EVENT = "pi-desk:session-plugin-push:v1";
9
9
  export declare const SESSION_PLUGIN_CAPABILITIES_EVENT = "pi-desk:session-capabilities";
10
+ export declare const SESSION_PREVIEW_DIRECTORY_EVENT = "pi-desk:session-preview-directory";
10
11
  export type SessionCapabilityHandler = (rules: SessionCapabilityRules, context: ExtensionContext) => void | Promise<void>;
11
12
  /** Registration is shared only inside the Session EventBus, never serialized. */
12
13
  export interface SessionCapabilityRegistration {
@@ -44,6 +45,9 @@ export type SessionPluginMethodEvent = {
44
45
  export interface SessionPluginFacade {
45
46
  readonly name: string;
46
47
  setState(state: PluginJsonObject | null): void;
48
+ addPreviewDirectory(directory: string, options?: {
49
+ default?: boolean;
50
+ }): void;
47
51
  push(event: string, data: PluginJsonObject): void;
48
52
  registerMethod(method: string, execute: SessionPluginMethodHandler): () => void;
49
53
  onCapabilitiesChange(handler: SessionCapabilityHandler): () => void;
package/dist/session.js CHANGED
@@ -5,6 +5,7 @@ export const SESSION_PLUGIN_STATE_EVENT = 'pi-desk:session-plugins';
5
5
  export const SESSION_PLUGIN_METHOD_EVENT = 'pi-desk:session-plugin-methods:v1';
6
6
  export const SESSION_PLUGIN_PUSH_EVENT = 'pi-desk:session-plugin-push:v1';
7
7
  export const SESSION_PLUGIN_CAPABILITIES_EVENT = 'pi-desk:session-capabilities';
8
+ export const SESSION_PREVIEW_DIRECTORY_EVENT = 'pi-desk:session-preview-directory';
8
9
  export function bindSessionPlugin(pi, pluginName) {
9
10
  const name = normalizePluginIdentifier(pluginName, 'pluginName');
10
11
  return {
@@ -12,6 +13,12 @@ export function bindSessionPlugin(pi, pluginName) {
12
13
  setState(state) {
13
14
  pi.events.emit(SESSION_PLUGIN_STATE_EVENT, { [name]: state });
14
15
  },
16
+ addPreviewDirectory(directory, options) {
17
+ pi.events.emit(SESSION_PREVIEW_DIRECTORY_EVENT, {
18
+ directory,
19
+ ...(options?.default === undefined ? {} : { default: options.default })
20
+ });
21
+ },
15
22
  push(eventInput, data) {
16
23
  const event = normalizePluginIdentifier(eventInput, 'event');
17
24
  pi.events.emit(SESSION_PLUGIN_PUSH_EVENT, {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/JetCrab/pi-desk.git",
6
6
  "directory": "plugins/pi-desk-sdk"
7
7
  },
8
- "version": "1.1.0-dev.1",
8
+ "version": "1.1.2",
9
9
  "license": "Apache-2.0",
10
10
  "publishConfig": {
11
11
  "registry": "https://registry.npmjs.org",