@talex-touch/utils 1.0.40 → 1.0.44
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/.eslintcache +1 -0
- package/__tests__/cloud-sync-sdk.test.ts +442 -0
- package/__tests__/icons/icons.test.ts +84 -0
- package/__tests__/plugin-sdk-lifecycle.test.ts +130 -0
- package/__tests__/power-sdk.test.ts +143 -0
- package/__tests__/preset-export-types.test.ts +108 -0
- package/__tests__/search/fuzzy-match.test.ts +137 -0
- package/__tests__/transport/port-policy.test.ts +44 -0
- package/__tests__/transport-domain-sdks.test.ts +152 -0
- package/__tests__/types/update.test.ts +67 -0
- package/account/account-sdk.ts +915 -0
- package/account/index.ts +2 -0
- package/account/types.ts +321 -0
- package/analytics/client.ts +136 -0
- package/analytics/index.ts +2 -0
- package/analytics/types.ts +156 -0
- package/animation/auto-resize.ts +322 -0
- package/animation/window-node.ts +26 -19
- package/auth/clerk-types.ts +12 -30
- package/auth/index.ts +0 -2
- package/auth/useAuthState.ts +6 -14
- package/base/index.ts +2 -0
- package/base/log-level.ts +105 -0
- package/channel/index.ts +170 -69
- package/cloud-sync/cloud-sync-sdk.ts +450 -0
- package/cloud-sync/index.ts +1 -0
- package/common/file-scan-utils.ts +17 -9
- package/common/index.ts +4 -0
- package/common/logger/index.ts +46 -0
- package/common/logger/logger-manager.ts +303 -0
- package/common/logger/module-logger.ts +270 -0
- package/common/logger/transport-logger.ts +234 -0
- package/common/logger/types.ts +93 -0
- package/common/search/gather.ts +48 -6
- package/common/search/index.ts +8 -0
- package/common/storage/constants.ts +13 -0
- package/common/storage/entity/app-settings.ts +245 -0
- package/common/storage/entity/index.ts +3 -0
- package/common/storage/entity/layout-atom-types.ts +147 -0
- package/common/storage/entity/openers.ts +1 -0
- package/common/storage/entity/preset-cloud-api.ts +132 -0
- package/common/storage/entity/preset-export-types.ts +256 -0
- package/common/storage/entity/shortcut-settings.ts +1 -0
- package/common/storage/shortcut-storage.ts +11 -0
- package/common/utils/clone-diagnostics.ts +105 -0
- package/common/utils/file.ts +16 -8
- package/common/utils/index.ts +6 -2
- package/common/utils/payload-preview.ts +173 -0
- package/common/utils/polling.ts +167 -13
- package/common/utils/safe-path.ts +103 -0
- package/common/utils/safe-shell.ts +115 -0
- package/common/utils/task-queue.ts +4 -1
- package/core-box/builder/tuff-builder.ts +0 -1
- package/core-box/index.ts +1 -1
- package/core-box/recommendation.ts +38 -1
- package/core-box/tuff/tuff-dsl.ts +97 -0
- package/electron/download-manager.ts +10 -7
- package/electron/env-tool.ts +42 -40
- package/electron/index.ts +0 -1
- package/env/index.ts +156 -0
- package/eslint.config.js +55 -0
- package/i18n/index.ts +62 -0
- package/i18n/locales/en.json +226 -0
- package/i18n/locales/zh.json +226 -0
- package/i18n/message-keys.ts +236 -0
- package/i18n/resolver.ts +181 -0
- package/icons/index.ts +257 -0
- package/icons/svg.ts +69 -0
- package/index.ts +9 -1
- package/intelligence/client.ts +72 -42
- package/market/constants.ts +21 -3
- package/market/index.ts +1 -1
- package/market/types.ts +20 -5
- package/package.json +15 -5
- package/permission/index.ts +143 -46
- package/permission/legacy.ts +26 -0
- package/permission/registry.ts +304 -0
- package/permission/types.ts +164 -0
- package/plugin/channel.ts +68 -39
- package/plugin/index.ts +82 -8
- package/plugin/install.ts +3 -0
- package/plugin/log/types.ts +22 -5
- package/plugin/node/logger-manager.ts +11 -3
- package/plugin/node/logger.ts +24 -17
- package/plugin/preload.ts +25 -2
- package/plugin/providers/index.ts +4 -0
- package/plugin/providers/market-client.ts +218 -0
- package/plugin/providers/npm-provider.ts +228 -0
- package/plugin/providers/tpex-provider.ts +297 -0
- package/plugin/providers/tpex-types.ts +34 -0
- package/plugin/sdk/box-items.ts +14 -0
- package/plugin/sdk/box-sdk.ts +64 -0
- package/plugin/sdk/channel.ts +119 -4
- package/plugin/sdk/clipboard.ts +26 -12
- package/plugin/sdk/cloud-sync.ts +113 -0
- package/plugin/sdk/common.ts +19 -11
- package/plugin/sdk/core-box.ts +6 -15
- package/plugin/sdk/division-box.ts +160 -65
- package/plugin/sdk/examples/storage-onDidChange-example.js +5 -2
- package/plugin/sdk/feature-sdk.ts +111 -76
- package/plugin/sdk/flow.ts +146 -45
- package/plugin/sdk/hooks/bridge.ts +113 -49
- package/plugin/sdk/hooks/life-cycle.ts +35 -16
- package/plugin/sdk/index.ts +14 -3
- package/plugin/sdk/intelligence.ts +87 -0
- package/plugin/sdk/meta/README.md +179 -0
- package/plugin/sdk/meta-sdk.ts +244 -0
- package/plugin/sdk/notification.ts +9 -0
- package/plugin/sdk/performance.ts +1 -16
- package/plugin/sdk/plugin-info.ts +64 -0
- package/plugin/sdk/power.ts +155 -0
- package/plugin/sdk/recommend.ts +21 -0
- package/plugin/sdk/service/index.ts +12 -8
- package/plugin/sdk/sqlite.ts +141 -0
- package/plugin/sdk/storage.ts +2 -6
- package/plugin/sdk/system.ts +2 -9
- package/plugin/sdk/temp-files.ts +41 -0
- package/plugin/sdk/touch-sdk.ts +18 -0
- package/plugin/sdk/types.ts +44 -4
- package/plugin/sdk/window/index.ts +12 -9
- package/plugin/sdk-version.ts +231 -0
- package/preload/renderer.ts +3 -2
- package/renderer/hooks/arg-mapper.ts +34 -6
- package/renderer/hooks/index.ts +13 -0
- package/renderer/hooks/initialize.ts +2 -1
- package/renderer/hooks/use-agent-market-sdk.ts +7 -0
- package/renderer/hooks/use-agent-market.ts +106 -0
- package/renderer/hooks/use-agents-sdk.ts +7 -0
- package/renderer/hooks/use-app-sdk.ts +7 -0
- package/renderer/hooks/use-channel.ts +33 -4
- package/renderer/hooks/use-download-sdk.ts +21 -0
- package/renderer/hooks/use-intelligence-sdk.ts +7 -0
- package/renderer/hooks/use-intelligence-stats.ts +290 -0
- package/renderer/hooks/use-intelligence.ts +202 -104
- package/renderer/hooks/use-market-sdk.ts +16 -0
- package/renderer/hooks/use-notification-sdk.ts +7 -0
- package/renderer/hooks/use-permission-sdk.ts +7 -0
- package/renderer/hooks/use-permission.ts +325 -0
- package/renderer/hooks/use-platform-sdk.ts +7 -0
- package/renderer/hooks/use-plugin-sdk.ts +16 -0
- package/renderer/hooks/use-settings-sdk.ts +7 -0
- package/renderer/hooks/use-update-sdk.ts +21 -0
- package/renderer/index.ts +1 -0
- package/renderer/ref.ts +19 -10
- package/renderer/shared/components/SharedPluginDetailContent.vue +84 -0
- package/renderer/shared/components/SharedPluginDetailHeader.vue +116 -0
- package/renderer/shared/components/SharedPluginDetailMetaList.vue +39 -0
- package/renderer/shared/components/SharedPluginDetailReadme.vue +45 -0
- package/renderer/shared/components/SharedPluginDetailVersions.vue +98 -0
- package/renderer/shared/components/index.ts +5 -0
- package/renderer/shared/components/shims-vue.d.ts +5 -0
- package/renderer/shared/index.ts +2 -0
- package/renderer/shared/plugin-detail.ts +62 -0
- package/renderer/storage/app-settings.ts +3 -1
- package/renderer/storage/base-storage.ts +508 -82
- package/renderer/storage/intelligence-storage.ts +37 -46
- package/renderer/storage/openers.ts +3 -1
- package/renderer/storage/storage-subscription.ts +126 -42
- package/renderer/touch-sdk/env.ts +10 -10
- package/renderer/touch-sdk/index.ts +114 -18
- package/renderer/touch-sdk/terminal.ts +24 -13
- package/search/feature-matcher.ts +279 -0
- package/search/fuzzy-match.ts +64 -34
- package/search/index.ts +10 -0
- package/search/levenshtein-utils.ts +17 -11
- package/transport/errors.ts +310 -0
- package/transport/event/builder.ts +378 -0
- package/transport/event/index.ts +7 -0
- package/transport/event/types.ts +292 -0
- package/transport/events/index.ts +2670 -0
- package/transport/events/meta-overlay.ts +79 -0
- package/transport/events/types/agents.ts +177 -0
- package/transport/events/types/app-index.ts +9 -0
- package/transport/events/types/app.ts +475 -0
- package/transport/events/types/box-item.ts +222 -0
- package/transport/events/types/clipboard.ts +80 -0
- package/transport/events/types/core-box.ts +534 -0
- package/transport/events/types/device-idle.ts +7 -0
- package/transport/events/types/division-box.ts +99 -0
- package/transport/events/types/download.ts +115 -0
- package/transport/events/types/file-index.ts +73 -0
- package/transport/events/types/flow.ts +149 -0
- package/transport/events/types/index.ts +70 -0
- package/transport/events/types/market.ts +39 -0
- package/transport/events/types/meta-overlay.ts +184 -0
- package/transport/events/types/notification.ts +140 -0
- package/transport/events/types/permission.ts +90 -0
- package/transport/events/types/platform.ts +8 -0
- package/transport/events/types/plugin.ts +620 -0
- package/transport/events/types/sentry.ts +20 -0
- package/transport/events/types/storage.ts +208 -0
- package/transport/events/types/transport.ts +60 -0
- package/transport/events/types/tray.ts +16 -0
- package/transport/events/types/update.ts +78 -0
- package/transport/index.ts +139 -0
- package/transport/main.ts +2 -0
- package/transport/sdk/constants.ts +29 -0
- package/transport/sdk/domains/agents-market.ts +47 -0
- package/transport/sdk/domains/agents.ts +62 -0
- package/transport/sdk/domains/app.ts +48 -0
- package/transport/sdk/domains/disposable.ts +35 -0
- package/transport/sdk/domains/download.ts +139 -0
- package/transport/sdk/domains/index.ts +13 -0
- package/transport/sdk/domains/intelligence.ts +616 -0
- package/transport/sdk/domains/market.ts +35 -0
- package/transport/sdk/domains/notification.ts +62 -0
- package/transport/sdk/domains/permission.ts +85 -0
- package/transport/sdk/domains/platform.ts +19 -0
- package/transport/sdk/domains/plugin.ts +144 -0
- package/transport/sdk/domains/settings.ts +92 -0
- package/transport/sdk/domains/update.ts +64 -0
- package/transport/sdk/index.ts +60 -0
- package/transport/sdk/main-transport.ts +710 -0
- package/transport/sdk/main.ts +9 -0
- package/transport/sdk/plugin-transport.ts +654 -0
- package/transport/sdk/port-policy.ts +38 -0
- package/transport/sdk/renderer-transport.ts +1165 -0
- package/transport/types.ts +605 -0
- package/types/agent.ts +399 -0
- package/types/cloud-sync.ts +157 -0
- package/types/division-box.ts +47 -27
- package/types/download.ts +1 -0
- package/types/flow.ts +63 -12
- package/types/icon.ts +2 -1
- package/types/index.ts +5 -0
- package/types/intelligence.ts +1492 -81
- package/types/modules/base.ts +2 -0
- package/types/path-browserify.d.ts +5 -0
- package/types/platform.ts +12 -0
- package/types/startup-info.ts +32 -0
- package/types/touch-app-core.ts +8 -8
- package/types/update.ts +94 -1
- package/vitest.config.ts +25 -0
- package/auth/useClerkConfig.ts +0 -40
- package/auth/useClerkProvider.ts +0 -52
package/channel/index.ts
CHANGED
|
@@ -1,183 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel type for IPC communication.
|
|
3
|
+
* @deprecated Use TuffTransport from `@talex-touch/utils/transport` instead. Will be removed in v3.0.0.
|
|
4
|
+
*/
|
|
1
5
|
export enum ChannelType {
|
|
2
6
|
MAIN = 'main',
|
|
3
7
|
PLUGIN = 'plugin',
|
|
4
8
|
}
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Response status codes for channel communication.
|
|
12
|
+
* @deprecated Use TuffTransportErrorCode from `@talex-touch/utils/transport` instead. Will be removed in v3.0.0.
|
|
13
|
+
*/
|
|
6
14
|
export enum DataCode {
|
|
7
15
|
SUCCESS = 200,
|
|
8
16
|
NETWORK_ERROR = 500,
|
|
9
17
|
ERROR = 100,
|
|
10
18
|
}
|
|
11
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Callback type for channel event handlers.
|
|
22
|
+
* @deprecated Use TuffTransport event handlers instead. Will be removed in v3.0.0.
|
|
23
|
+
*/
|
|
12
24
|
export type ChannelCallback = (data: StandardChannelData) => any
|
|
13
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Main process channel interface for IPC communication.
|
|
28
|
+
* @deprecated Use ITuffTransportMain from `@talex-touch/utils/transport` instead. Will be removed in v3.0.0.
|
|
29
|
+
* @see {@link https://github.com/talex-touch/tuff/blob/main/packages/utils/transport/types.ts | TuffTransport Types}
|
|
30
|
+
*/
|
|
14
31
|
export interface ITouchChannel {
|
|
15
32
|
|
|
16
33
|
/**
|
|
17
|
-
* Register a channel
|
|
18
|
-
* @
|
|
19
|
-
* @param type
|
|
20
|
-
* @param eventName
|
|
21
|
-
* @param callback
|
|
34
|
+
* Register a channel event handler.
|
|
35
|
+
* @deprecated Use `transport.on(TuffEvent, handler)` from TuffTransport instead.
|
|
36
|
+
* @param type - The channel type (MAIN or PLUGIN)
|
|
37
|
+
* @param eventName - The event name (string-based, not type-safe)
|
|
38
|
+
* @param callback - The callback function
|
|
39
|
+
* @returns Unsubscribe function
|
|
22
40
|
*/
|
|
23
41
|
regChannel: (type: ChannelType, eventName: string, callback: ChannelCallback) => () => void
|
|
24
42
|
|
|
25
43
|
/**
|
|
26
|
-
* Unregister a channel
|
|
27
|
-
* @
|
|
28
|
-
* @param type
|
|
29
|
-
* @param eventName
|
|
30
|
-
* @param callback
|
|
31
|
-
* @returns
|
|
44
|
+
* Unregister a channel event handler.
|
|
45
|
+
* @deprecated Use the cleanup function returned by `transport.on()` instead.
|
|
46
|
+
* @param type - The channel type
|
|
47
|
+
* @param eventName - The event name
|
|
48
|
+
* @param callback - The callback to unregister
|
|
49
|
+
* @returns `true` if successfully unregistered
|
|
32
50
|
*/
|
|
33
51
|
unregChannel: (type: ChannelType, eventName: string, callback: ChannelCallback) => boolean
|
|
34
52
|
|
|
35
53
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param type
|
|
39
|
-
* @param eventName
|
|
40
|
-
* @param arg
|
|
54
|
+
* Send a message to a channel.
|
|
55
|
+
* @deprecated Use `transport.send(TuffEvent, payload)` from TuffTransport instead.
|
|
56
|
+
* @param type - The channel type
|
|
57
|
+
* @param eventName - The event name
|
|
58
|
+
* @param arg - The message payload
|
|
59
|
+
* @returns Promise resolving to the response
|
|
41
60
|
*/
|
|
42
61
|
send: (type: ChannelType, eventName: string, arg?: any) => Promise<any>
|
|
43
62
|
|
|
44
63
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param win
|
|
48
|
-
* @param type
|
|
49
|
-
* @param eventName
|
|
50
|
-
* @param arg
|
|
64
|
+
* Send a message to a specific window.
|
|
65
|
+
* @deprecated Use `transport.sendTo(webContents, TuffEvent, payload)` from TuffTransport instead.
|
|
66
|
+
* @param win - The target BrowserWindow
|
|
67
|
+
* @param type - The channel type
|
|
68
|
+
* @param eventName - The event name
|
|
69
|
+
* @param arg - The message payload
|
|
70
|
+
* @returns Promise resolving to the response
|
|
51
71
|
*/
|
|
52
72
|
sendTo: (win: Electron.BrowserWindow, type: ChannelType, eventName: string, arg: any) => Promise<any>
|
|
53
73
|
|
|
54
74
|
/**
|
|
55
|
-
* Send a message to main process
|
|
56
|
-
* @
|
|
57
|
-
* @param
|
|
75
|
+
* Send a message to the main renderer process.
|
|
76
|
+
* @deprecated Use `transport.send(TuffEvent, payload)` from TuffTransport instead.
|
|
77
|
+
* @param eventName - The event name
|
|
78
|
+
* @param arg - The message payload
|
|
79
|
+
* @returns Promise resolving to the response
|
|
58
80
|
*/
|
|
59
81
|
sendMain: (eventName: string, arg?: any) => Promise<any>
|
|
60
82
|
|
|
61
83
|
/**
|
|
62
|
-
* Send a message to
|
|
63
|
-
* @
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
84
|
+
* Send a message to a specific window's main renderer.
|
|
85
|
+
* @deprecated Use `transport.sendTo(webContents, TuffEvent, payload)` from TuffTransport instead.
|
|
86
|
+
* @param win - The target BrowserWindow
|
|
87
|
+
* @param eventName - The event name
|
|
88
|
+
* @param arg - The message payload
|
|
89
|
+
* @returns Promise resolving to the response
|
|
66
90
|
*/
|
|
67
91
|
sendToMain: (win: Electron.BrowserWindow, eventName: string, arg?: any) => Promise<any>
|
|
68
92
|
|
|
69
93
|
/**
|
|
70
|
-
* Send a message to
|
|
71
|
-
* @
|
|
72
|
-
* @param
|
|
94
|
+
* Send a message to a plugin's renderer.
|
|
95
|
+
* @deprecated Use `transport.sendToPlugin(pluginName, TuffEvent, payload)` from TuffTransport instead.
|
|
96
|
+
* @param pluginName - The target plugin name
|
|
97
|
+
* @param eventName - The event name
|
|
98
|
+
* @param arg - The message payload
|
|
99
|
+
* @returns Promise resolving to the response
|
|
73
100
|
*/
|
|
74
101
|
sendPlugin: (pluginName: string, eventName: string, arg?: any) => Promise<any>
|
|
75
102
|
|
|
76
103
|
/**
|
|
77
|
-
* Send a message to plugin
|
|
78
|
-
* @
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
104
|
+
* Send a message to a plugin's renderer (alias).
|
|
105
|
+
* @deprecated Use `transport.sendToPlugin(pluginName, TuffEvent, payload)` from TuffTransport instead.
|
|
106
|
+
* @param pluginName - The target plugin name
|
|
107
|
+
* @param eventName - The event name
|
|
108
|
+
* @param arg - The message payload
|
|
109
|
+
* @returns Promise resolving to the response
|
|
81
110
|
*/
|
|
82
111
|
sendToPlugin: (pluginName: string, eventName: string, arg?: any) => Promise<any>
|
|
83
112
|
|
|
84
113
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
88
|
-
* @param
|
|
114
|
+
* Broadcast a message without waiting for a response.
|
|
115
|
+
* Use for notification-style messages that don't need acknowledgment.
|
|
116
|
+
* @param type - The channel type
|
|
117
|
+
* @param eventName - The event name
|
|
118
|
+
* @param arg - The message payload
|
|
119
|
+
*/
|
|
120
|
+
broadcast: (type: ChannelType, eventName: string, arg?: any) => void
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Broadcast a message to a specific window without waiting for a response.
|
|
124
|
+
* @deprecated Use `transport.broadcastToWindow(windowId, event, payload)` from TuffTransport instead.
|
|
125
|
+
* @param win - The target BrowserWindow
|
|
126
|
+
* @param type - The channel type
|
|
127
|
+
* @param eventName - The event name
|
|
128
|
+
* @param arg - The message payload
|
|
129
|
+
*/
|
|
130
|
+
broadcastTo: (win: Electron.BrowserWindow, type: ChannelType, eventName: string, arg?: any) => void
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Broadcast a message to a plugin without waiting for a response.
|
|
134
|
+
* @param pluginName - The target plugin name
|
|
135
|
+
* @param eventName - The event name
|
|
136
|
+
* @param arg - The message payload
|
|
137
|
+
*/
|
|
138
|
+
broadcastPlugin: (pluginName: string, eventName: string, arg?: any) => void
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Request an encrypted key for plugin identification.
|
|
142
|
+
* @remarks This mechanism is preserved in TuffTransport via PluginKeyManager.
|
|
143
|
+
* @param name - The plugin name
|
|
144
|
+
* @returns The encrypted key
|
|
89
145
|
*/
|
|
90
146
|
requestKey: (name: string) => string
|
|
91
147
|
|
|
92
148
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @
|
|
95
|
-
* @param key
|
|
149
|
+
* Revoke a previously issued plugin key.
|
|
150
|
+
* @remarks This mechanism is preserved in TuffTransport via PluginKeyManager.
|
|
151
|
+
* @param key - The key to revoke
|
|
152
|
+
* @returns `true` if successfully revoked
|
|
96
153
|
*/
|
|
97
154
|
revokeKey: (key: string) => boolean
|
|
98
155
|
}
|
|
99
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Renderer-side channel interface for IPC communication.
|
|
159
|
+
* @deprecated Use ITuffTransport from `@talex-touch/utils/transport` instead. Will be removed in v3.0.0.
|
|
160
|
+
*/
|
|
100
161
|
export interface ITouchClientChannel {
|
|
101
162
|
|
|
102
163
|
/**
|
|
103
|
-
* Register a channel
|
|
104
|
-
* @
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @
|
|
164
|
+
* Register a channel event handler.
|
|
165
|
+
* @deprecated Use `transport.on(TuffEvent, handler)` from TuffTransport instead.
|
|
166
|
+
* @param eventName - The event name (string-based, not type-safe)
|
|
167
|
+
* @param callback - The callback function
|
|
168
|
+
* @returns Unsubscribe function
|
|
108
169
|
*/
|
|
109
170
|
regChannel: (eventName: string, callback: (data: StandardChannelData) => any) => () => void
|
|
110
171
|
|
|
111
172
|
/**
|
|
112
|
-
* Unregister a channel
|
|
113
|
-
* @
|
|
114
|
-
* @param eventName
|
|
115
|
-
* @param callback
|
|
116
|
-
* @returns
|
|
173
|
+
* Unregister a channel event handler.
|
|
174
|
+
* @deprecated Use the cleanup function returned by `transport.on()` instead.
|
|
175
|
+
* @param eventName - The event name
|
|
176
|
+
* @param callback - The callback function to unregister
|
|
177
|
+
* @returns `true` if successfully unregistered
|
|
117
178
|
*/
|
|
118
179
|
unRegChannel: (eventName: string, callback: (data: StandardChannelData) => any) => boolean
|
|
119
180
|
|
|
120
181
|
/**
|
|
121
|
-
* Send a message to
|
|
122
|
-
* @
|
|
123
|
-
* @param
|
|
182
|
+
* Send a message to the main process.
|
|
183
|
+
* @deprecated Use `transport.send(TuffEvent, payload)` from TuffTransport instead.
|
|
184
|
+
* @param eventName - The event name
|
|
185
|
+
* @param arg - The message payload
|
|
186
|
+
* @returns Promise resolving to the response
|
|
124
187
|
*/
|
|
125
188
|
send: (eventName: string, arg?: any) => Promise<any>
|
|
126
189
|
|
|
127
190
|
/**
|
|
128
|
-
* Send a message
|
|
129
|
-
* @
|
|
130
|
-
* @param
|
|
191
|
+
* Send a synchronous message and get the response.
|
|
192
|
+
* @deprecated Synchronous IPC is discouraged. Use async `transport.send()` from TuffTransport instead.
|
|
193
|
+
* @param eventName - The event name
|
|
194
|
+
* @param arg - The message payload
|
|
195
|
+
* @returns Response payload
|
|
131
196
|
*/
|
|
132
197
|
sendSync: (eventName: string, arg?: any) => any
|
|
133
198
|
}
|
|
134
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Internal sync data structure.
|
|
202
|
+
* @deprecated Internal type, will be removed in v3.0.0.
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
135
205
|
export interface RawChannelSyncData {
|
|
136
206
|
timeStamp: number
|
|
137
207
|
/**
|
|
138
|
-
*
|
|
139
|
-
* @
|
|
140
|
-
* @default 10000
|
|
208
|
+
* Timeout in milliseconds.
|
|
209
|
+
* @defaultValue 10000
|
|
141
210
|
*/
|
|
142
|
-
timeout:
|
|
211
|
+
timeout: number
|
|
143
212
|
|
|
144
213
|
/**
|
|
145
|
-
*
|
|
146
|
-
* @description To identify each sync-request.
|
|
214
|
+
* Unique request ID for correlation.
|
|
147
215
|
*/
|
|
148
216
|
id: string
|
|
149
217
|
}
|
|
150
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Internal channel header data.
|
|
221
|
+
* @deprecated Internal type, will be removed in v3.0.0.
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
151
224
|
export interface RawChannelHeaderData {
|
|
152
225
|
status: 'reply' | 'request'
|
|
153
226
|
type: ChannelType
|
|
154
227
|
_originData?: any
|
|
228
|
+
/**
|
|
229
|
+
* Plugin security key for authentication.
|
|
230
|
+
* @remarks This is preserved in TuffTransport via PluginSecurityContext.
|
|
231
|
+
*/
|
|
155
232
|
uniqueKey?: string
|
|
156
233
|
event?: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent | Electron.IpcRendererEvent
|
|
157
234
|
plugin?: string
|
|
158
235
|
}
|
|
159
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Base channel data structure.
|
|
239
|
+
* @deprecated Internal type, will be removed in v3.0.0.
|
|
240
|
+
* @internal
|
|
241
|
+
*/
|
|
160
242
|
export interface RawChannelData {
|
|
161
243
|
name: string
|
|
162
244
|
header: RawChannelHeaderData
|
|
163
245
|
sync?: RawChannelSyncData
|
|
164
246
|
}
|
|
165
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Standard channel data with code and payload.
|
|
250
|
+
* @deprecated Internal type, will be removed in v3.0.0.
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
166
253
|
export interface RawStandardChannelData extends RawChannelData {
|
|
167
254
|
code: DataCode
|
|
168
255
|
data?: IChannelData
|
|
169
256
|
plugin?: string
|
|
170
257
|
}
|
|
171
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Channel data with reply callback.
|
|
261
|
+
* @deprecated Use TuffTransport handler context instead. Will be removed in v3.0.0.
|
|
262
|
+
*/
|
|
172
263
|
export interface StandardChannelData extends RawStandardChannelData {
|
|
264
|
+
/**
|
|
265
|
+
* Reply to the request.
|
|
266
|
+
* @param code - Response status code
|
|
267
|
+
* @param data - Response payload
|
|
268
|
+
*/
|
|
173
269
|
reply: (code: DataCode, data: IChannelData) => void
|
|
174
270
|
}
|
|
175
271
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Generic channel data type.
|
|
274
|
+
* @deprecated Will be removed in v3.0.0.
|
|
275
|
+
*/
|
|
276
|
+
export type IChannelData = any
|
|
179
277
|
|
|
180
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Default export for Vite compatibility.
|
|
280
|
+
* @deprecated Import named exports instead.
|
|
281
|
+
*/
|
|
181
282
|
export default {
|
|
182
283
|
ChannelType,
|
|
183
284
|
DataCode,
|