@ban-dal/os-bridge 1.0.0 → 1.1.0
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 +122 -20
- package/index.d.ts +37 -0
- package/index.js +59 -52
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -31,16 +31,20 @@ Platform packages are optional dependencies. Always import from `@ban-dal/os-bri
|
|
|
31
31
|
|
|
32
32
|
## Feature Index
|
|
33
33
|
|
|
34
|
-
| Feature
|
|
35
|
-
|
|
|
36
|
-
| Notification permission status
|
|
34
|
+
| Feature | API | macOS | Windows | Linux |
|
|
35
|
+
| ------------------------------- | ------------------------------------ | --------- | ------------- | ------------- |
|
|
36
|
+
| Notification permission status | `getNotificationPermissionStatus` | Supported | Supported | `unsupported` |
|
|
37
|
+
| macOS notification permission | `requestMacNotificationPermission` | Supported | Status only | `unsupported` |
|
|
38
|
+
| Notification interruption level | `getNotificationInterruptionLevel` | Supported | Supported | `unsupported` |
|
|
39
|
+
| macOS Focus Status access | `requestMacFocusStatusAuthorization` | Supported | `unsupported` | `unsupported` |
|
|
40
|
+
| Notification capability summary | `getNotificationCapability` | Supported | Supported | `unsupported` |
|
|
37
41
|
|
|
38
42
|
## Usage
|
|
39
43
|
|
|
40
44
|
```ts
|
|
41
|
-
import {
|
|
45
|
+
import { getNotificationCapability, type NotificationCapability } from '@ban-dal/os-bridge'
|
|
42
46
|
|
|
43
|
-
const
|
|
47
|
+
const capability: NotificationCapability = getNotificationCapability()
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
## Features
|
|
@@ -48,33 +52,110 @@ const status: NotificationPermissionStatus = getPermissionStatus()
|
|
|
48
52
|
### Notification Permission Status
|
|
49
53
|
|
|
50
54
|
```ts
|
|
51
|
-
function
|
|
55
|
+
function getNotificationPermissionStatus(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
52
56
|
```
|
|
53
57
|
|
|
54
58
|
```ts
|
|
55
59
|
type NotificationPermissionStatus = 'granted' | 'denied' | 'not-determined' | 'limited' | 'unsupported' | 'unknown'
|
|
56
60
|
```
|
|
57
61
|
|
|
58
|
-
| Platform | Behavior
|
|
59
|
-
| -------- |
|
|
60
|
-
| macOS | Returns `unknown` when called outside an app bundle.
|
|
61
|
-
| Windows | Looks up notification permission by app user model id. Returns `unknown` if the app id is missing or empty. |
|
|
62
|
-
| Linux | Returns `unsupported`.
|
|
62
|
+
| Platform | Behavior |
|
|
63
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| macOS | Returns `unknown` when called outside an app bundle. |
|
|
65
|
+
| Windows | Looks up notification permission by app user model id. Windows defaults to allowed when no app-specific deny state exists. Returns `unknown` if the app id is missing or empty. |
|
|
66
|
+
| Linux | Returns `unsupported`. |
|
|
63
67
|
|
|
64
68
|
```ts
|
|
65
|
-
import {
|
|
69
|
+
import { getNotificationPermissionStatus } from '@ban-dal/os-bridge'
|
|
66
70
|
|
|
67
|
-
const status =
|
|
71
|
+
const status = getNotificationPermissionStatus({ appUserModelId: 'com.example.my-app' })
|
|
68
72
|
```
|
|
69
73
|
|
|
70
74
|
For Windows Electron apps, pass the same app user model id used with `app.setAppUserModelId(...)`.
|
|
71
75
|
|
|
76
|
+
`getPermissionStatus(appUserModelId?)` remains available as the low-level compatibility alias.
|
|
77
|
+
|
|
78
|
+
### macOS Notification Permission Request
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
function requestMacNotificationPermission(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This API requests notification authorization on macOS and returns the resulting permission status. Windows does not provide an OS API for requesting app notification permission, and its default notification state is allowed, so use `getNotificationPermissionStatus` or `getNotificationCapability` for Windows diagnostics.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { requestMacNotificationPermission } from '@ban-dal/os-bridge'
|
|
88
|
+
|
|
89
|
+
const status = requestMacNotificationPermission()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Notification Interruption Level
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
function getNotificationInterruptionLevel(): NotificationInterruptionLevel
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
type NotificationInterruptionLevel = 'normal' | 'limited' | 'unsupported' | 'unknown'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
type NotificationDiagnosticsOptions = {
|
|
104
|
+
appUserModelId?: string
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This API exposes whether the OS is currently in a normal or limited notification-delivery context. `limited` is diagnostic context only. It does not prove that this app's notifications will be suppressed.
|
|
109
|
+
|
|
110
|
+
#### macOS
|
|
111
|
+
|
|
112
|
+
On macOS, this API reads `INFocusStatusCenter`. To read this value, the app must be able to access Focus Status and the user must enable the app in System Settings > Privacy & Security > Focus. Use `requestMacFocusStatusAuthorization()` from an app bundle to request that Focus Status access.
|
|
113
|
+
|
|
114
|
+
macOS reports Focus from this app's effective perspective: if the current Focus allows this app, the value can be `normal` even while Focus is enabled. If Focus Status access is unavailable or not enabled for the app, this API returns `unknown`.
|
|
115
|
+
|
|
116
|
+
#### Windows
|
|
117
|
+
|
|
118
|
+
On Windows, this API reads `ToastNotificationManager.GetDefault().NotificationMode()`. `Unrestricted` maps to `normal`, while `PriorityOnly` and `AlarmsOnly` map to `limited`. Windows does not expose whether this app is included in the user's priority app list, so `limited` means the system is limiting notifications, not that this app is definitely blocked.
|
|
119
|
+
|
|
120
|
+
### macOS Focus Status Access Request
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
function requestMacFocusStatusAuthorization(): NotificationInterruptionLevel
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This API requests permission for macOS to share Focus Status with this app, then returns the current interruption level. If the request has already been handled by the OS, macOS may not show another alert.
|
|
127
|
+
|
|
128
|
+
### Notification Capability
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
function getNotificationCapability(options?: NotificationDiagnosticsOptions): NotificationCapability
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
type NotificationCapability = {
|
|
136
|
+
canNotify: boolean
|
|
137
|
+
permission: NotificationPermissionStatus
|
|
138
|
+
interruptionLevel: NotificationInterruptionLevel
|
|
139
|
+
reasons: NotificationUnavailableReason[]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
type NotificationUnavailableReason =
|
|
143
|
+
| 'permission-denied'
|
|
144
|
+
| 'permission-not-determined'
|
|
145
|
+
| 'missing-app-user-model-id'
|
|
146
|
+
| 'invalid-app-user-model-id'
|
|
147
|
+
| 'unsupported-platform'
|
|
148
|
+
| 'unknown'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`canNotify` is based on platform support, notification permission, and platform-specific requirements such as the Windows app user model id. The interruption level is returned as diagnostic context, but it is not treated as a definitive notification-blocking reason.
|
|
152
|
+
|
|
72
153
|
#### Electron
|
|
73
154
|
|
|
74
155
|
```ts
|
|
75
156
|
// main.ts
|
|
76
157
|
import { app, ipcMain } from 'electron'
|
|
77
|
-
import {
|
|
158
|
+
import { getNotificationCapability } from '@ban-dal/os-bridge'
|
|
78
159
|
|
|
79
160
|
const appUserModelId = 'com.example.my-app'
|
|
80
161
|
|
|
@@ -82,26 +163,26 @@ if (process.platform === 'win32') {
|
|
|
82
163
|
app.setAppUserModelId(appUserModelId)
|
|
83
164
|
}
|
|
84
165
|
|
|
85
|
-
ipcMain.handle('notification:
|
|
86
|
-
return
|
|
166
|
+
ipcMain.handle('notification:getCapability', () => {
|
|
167
|
+
return getNotificationCapability({ appUserModelId })
|
|
87
168
|
})
|
|
88
169
|
```
|
|
89
170
|
|
|
90
171
|
```ts
|
|
91
172
|
// preload.ts
|
|
92
173
|
import { contextBridge, ipcRenderer } from 'electron'
|
|
93
|
-
import type {
|
|
174
|
+
import type { NotificationCapability } from '@ban-dal/os-bridge'
|
|
94
175
|
|
|
95
176
|
contextBridge.exposeInMainWorld('osBridge', {
|
|
96
|
-
|
|
97
|
-
return ipcRenderer.invoke('notification:
|
|
177
|
+
getNotificationCapability: (): Promise<NotificationCapability> => {
|
|
178
|
+
return ipcRenderer.invoke('notification:getCapability')
|
|
98
179
|
},
|
|
99
180
|
})
|
|
100
181
|
```
|
|
101
182
|
|
|
102
183
|
```ts
|
|
103
184
|
// renderer.ts
|
|
104
|
-
const
|
|
185
|
+
const capability = await window.osBridge.getNotificationCapability()
|
|
105
186
|
```
|
|
106
187
|
|
|
107
188
|
## Adding Feature Documentation
|
|
@@ -117,3 +198,24 @@ pnpm install
|
|
|
117
198
|
pnpm build
|
|
118
199
|
pnpm test
|
|
119
200
|
```
|
|
201
|
+
|
|
202
|
+
### Manual Electron Probe
|
|
203
|
+
|
|
204
|
+
Use `electron-probe/` when you need to physically compare this package's diagnostics with the current OS notification and Focus state.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
pnpm build
|
|
208
|
+
cd electron-probe
|
|
209
|
+
cp .env.example .env
|
|
210
|
+
pnpm install
|
|
211
|
+
pnpm dev
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
For macOS app-bundle testing:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
cd electron-probe
|
|
218
|
+
pnpm pack:mac
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The probe can request macOS Focus Status access and includes `NSFocusStatusUsageDescription` in the packaged app. The macOS probe package is ad-hoc signed locally for manual testing.
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export declare function getNotificationCapability(
|
|
4
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
5
|
+
): NotificationCapability
|
|
6
|
+
|
|
7
|
+
export declare function getNotificationInterruptionLevel(): NotificationInterruptionLevel
|
|
8
|
+
|
|
9
|
+
export declare function getNotificationPermissionStatus(
|
|
10
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
11
|
+
): NotificationPermissionStatus
|
|
12
|
+
|
|
3
13
|
export declare function getPermissionStatus(appUserModelId?: string | undefined | null): NotificationPermissionStatus
|
|
4
14
|
|
|
15
|
+
export interface NotificationCapability {
|
|
16
|
+
canNotify: boolean
|
|
17
|
+
permission: NotificationPermissionStatus
|
|
18
|
+
interruptionLevel: NotificationInterruptionLevel
|
|
19
|
+
reasons: Array<NotificationUnavailableReason>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface NotificationDiagnosticsOptions {
|
|
23
|
+
appUserModelId?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type NotificationInterruptionLevel = 'normal' | 'limited' | 'unsupported' | 'unknown'
|
|
27
|
+
|
|
5
28
|
export type NotificationPermissionStatus =
|
|
6
29
|
| 'granted'
|
|
7
30
|
| 'denied'
|
|
@@ -9,3 +32,17 @@ export type NotificationPermissionStatus =
|
|
|
9
32
|
| 'limited'
|
|
10
33
|
| 'unsupported'
|
|
11
34
|
| 'unknown'
|
|
35
|
+
|
|
36
|
+
export type NotificationUnavailableReason =
|
|
37
|
+
| 'permission-denied'
|
|
38
|
+
| 'permission-not-determined'
|
|
39
|
+
| 'missing-app-user-model-id'
|
|
40
|
+
| 'invalid-app-user-model-id'
|
|
41
|
+
| 'unsupported-platform'
|
|
42
|
+
| 'unknown'
|
|
43
|
+
|
|
44
|
+
export declare function requestMacFocusStatusAuthorization(): NotificationInterruptionLevel
|
|
45
|
+
|
|
46
|
+
export declare function requestMacNotificationPermission(
|
|
47
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
48
|
+
): NotificationPermissionStatus
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@ban-dal/os-bridge-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@ban-dal/os-bridge-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
80
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@ban-dal/os-bridge-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@ban-dal/os-bridge-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
96
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@ban-dal/os-bridge-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
117
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@ban-dal/os-bridge-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
133
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@ban-dal/os-bridge-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
150
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@ban-dal/os-bridge-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
166
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@ban-dal/os-bridge-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
185
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@ban-dal/os-bridge-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
201
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@ban-dal/os-bridge-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
217
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@ban-dal/os-bridge-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@ban-dal/os-bridge-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
237
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@ban-dal/os-bridge-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@ban-dal/os-bridge-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
253
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@ban-dal/os-bridge-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
274
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@ban-dal/os-bridge-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
290
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@ban-dal/os-bridge-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
308
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@ban-dal/os-bridge-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
324
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@ban-dal/os-bridge-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
342
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@ban-dal/os-bridge-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
358
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@ban-dal/os-bridge-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
376
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@ban-dal/os-bridge-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
392
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@ban-dal/os-bridge-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
410
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@ban-dal/os-bridge-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
426
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@ban-dal/os-bridge-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
443
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@ban-dal/os-bridge-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
459
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@ban-dal/os-bridge-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
479
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@ban-dal/os-bridge-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
495
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@ban-dal/os-bridge-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
511
|
+
if (bindingPackageVersion !== '1.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -576,5 +576,12 @@ if (!nativeBinding) {
|
|
|
576
576
|
}
|
|
577
577
|
|
|
578
578
|
module.exports = nativeBinding
|
|
579
|
+
module.exports.getNotificationCapability = nativeBinding.getNotificationCapability
|
|
580
|
+
module.exports.getNotificationInterruptionLevel = nativeBinding.getNotificationInterruptionLevel
|
|
581
|
+
module.exports.getNotificationPermissionStatus = nativeBinding.getNotificationPermissionStatus
|
|
579
582
|
module.exports.getPermissionStatus = nativeBinding.getPermissionStatus
|
|
583
|
+
module.exports.NotificationInterruptionLevel = nativeBinding.NotificationInterruptionLevel
|
|
580
584
|
module.exports.NotificationPermissionStatus = nativeBinding.NotificationPermissionStatus
|
|
585
|
+
module.exports.NotificationUnavailableReason = nativeBinding.NotificationUnavailableReason
|
|
586
|
+
module.exports.requestMacFocusStatusAuthorization = nativeBinding.requestMacFocusStatusAuthorization
|
|
587
|
+
module.exports.requestMacNotificationPermission = nativeBinding.requestMacNotificationPermission
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ban-dal/os-bridge",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Native OS capability bridge for Node.js and Electron.
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Native OS capability bridge for Node.js and Electron. Diagnose notification capability on macOS and Windows.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"index.js"
|
|
48
48
|
],
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@ban-dal/os-bridge-darwin-arm64": "1.
|
|
51
|
-
"@ban-dal/os-bridge-darwin-x64": "1.
|
|
52
|
-
"@ban-dal/os-bridge-linux-x64-gnu": "1.
|
|
53
|
-
"@ban-dal/os-bridge-win32-x64-msvc": "1.
|
|
50
|
+
"@ban-dal/os-bridge-darwin-arm64": "1.1.0",
|
|
51
|
+
"@ban-dal/os-bridge-darwin-x64": "1.1.0",
|
|
52
|
+
"@ban-dal/os-bridge-linux-x64-gnu": "1.1.0",
|
|
53
|
+
"@ban-dal/os-bridge-win32-x64-msvc": "1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"napi": {
|
|
56
56
|
"binaryName": "os-bridge",
|