@nonstrict/recordkit 0.2.1 → 0.3.0-alpha.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.
Files changed (40) hide show
  1. package/bin/.gitkeep +0 -0
  2. package/bin/recordkit-rpc +0 -0
  3. package/build.sh +32 -0
  4. package/jest.config.js +16 -0
  5. package/{dist → out}/IpcRecordKit.d.ts +0 -1
  6. package/{dist → out}/IpcRecordKit.js +2 -8
  7. package/out/IpcRecordKit.js.map +1 -0
  8. package/{dist → out}/NonstrictRPC.d.ts +1 -0
  9. package/{dist → out}/NonstrictRPC.js +20 -3
  10. package/out/NonstrictRPC.js.map +1 -0
  11. package/out/RecordKit.d.ts +50 -0
  12. package/out/RecordKit.js +48 -0
  13. package/out/RecordKit.js.map +1 -0
  14. package/out/Recorder.d.ts +59 -0
  15. package/{dist/RecordingSession.js → out/Recorder.js} +21 -5
  16. package/out/Recorder.js.map +1 -0
  17. package/{dist → out}/finalizationRegistry.js +1 -0
  18. package/out/finalizationRegistry.js.map +1 -0
  19. package/{dist → out}/index.cjs +74 -24
  20. package/out/index.cjs.map +1 -0
  21. package/out/index.d.ts +3 -0
  22. package/{dist → out}/index.js +1 -0
  23. package/out/index.js.map +1 -0
  24. package/package.json +8 -10
  25. package/rollup.config.js +11 -0
  26. package/src/IpcRecordKit.ts +36 -0
  27. package/src/NonstrictRPC.test.ts +98 -0
  28. package/src/NonstrictRPC.ts +324 -0
  29. package/src/RecordKit.ts +99 -0
  30. package/src/Recorder.ts +113 -0
  31. package/src/__snapshots__/NonstrictRPC.test.ts.snap +24 -0
  32. package/src/finalizationRegistry.ts +2 -0
  33. package/src/index.ts +3 -0
  34. package/tsconfig.json +109 -0
  35. package/typedoc.json +6 -0
  36. package/dist/RecordKit.d.ts +0 -34
  37. package/dist/RecordKit.js +0 -22
  38. package/dist/RecordingSession.d.ts +0 -70
  39. package/dist/index.d.ts +0 -1
  40. /package/{dist → out}/finalizationRegistry.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@nonstrict/recordkit",
3
- "version": "0.2.1",
3
+ "version": "0.3.0-alpha.2",
4
4
  "description": "RecordKit gives you hassle-free recording in Electron apps on macOS.",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "main": "out/index.js",
7
+ "types": "out/index.d.ts",
8
8
  "exports": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
9
+ "import": "./out/index.js",
10
+ "require": "./out/index.cjs"
11
11
  },
12
- "files": [
13
- "dist"
14
- ],
15
12
  "engines": {
16
13
  "node": ">=18.16"
17
14
  },
18
15
  "scripts": {
19
16
  "test": "jest",
20
- "build": "rm -rf dist && tsc && rollup -c",
17
+ "build": "rm -rf out && tsc && rollup -c",
21
18
  "prepublish": "npm run build"
22
19
  },
23
20
  "keywords": [
@@ -34,7 +31,7 @@
34
31
  "author": {
35
32
  "name": "Nonstrict B.V.",
36
33
  "email": "team+recordkit@nonstrict.com",
37
- "url": "https://nonstrict.eu"
34
+ "url": "https://nonstrict.eu/recordkit"
38
35
  },
39
36
  "license": "SEE LICENSE IN License.md",
40
37
  "devDependencies": {
@@ -43,6 +40,7 @@
43
40
  "jest": "^29.7.0",
44
41
  "rollup": "^4.12.0",
45
42
  "ts-jest": "^29.1.2",
43
+ "typedoc": "^0.25.11",
46
44
  "typescript": "^5.3.3"
47
45
  },
48
46
  "volta": {
@@ -0,0 +1,11 @@
1
+ export default {
2
+ input: 'out/index.js',
3
+ output: [
4
+ {
5
+ file: 'out/index.cjs',
6
+ format: 'cjs',
7
+ sourcemap: true,
8
+ }
9
+ ],
10
+ external: ['node:child_process', 'node:fs', 'readline', 'crypto', 'stream']
11
+ };
@@ -0,0 +1,36 @@
1
+ import { ChildProcess, spawn } from 'node:child_process';
2
+ import * as readline from 'readline';
3
+ import { NSRPC } from "./NonstrictRPC.js";
4
+
5
+ export class IpcRecordKit {
6
+ private childProcess?: ChildProcess;
7
+ readonly nsrpc: NSRPC;
8
+
9
+ constructor() {
10
+ this.nsrpc = new NSRPC((message) => this.write(message));
11
+ }
12
+
13
+ async initialize(recordKitRpcPath: string, logMessages: boolean = false): Promise<void> {
14
+ if (this.childProcess !== undefined) { throw new Error('RecordKit RPC: Already initialized.') }
15
+
16
+ this.nsrpc.logMessages = logMessages;
17
+ this.childProcess = await new Promise<ChildProcess>((resolve, reject) => {
18
+ const childProcess = spawn(recordKitRpcPath)
19
+ childProcess.on('spawn', () => { resolve(childProcess) })
20
+ childProcess.on('error', (error) => { reject(error) })
21
+ })
22
+
23
+ const { stdout } = this.childProcess
24
+ if (!stdout) { throw new Error('RecordKit RPC: No stdout stream on child process.') }
25
+
26
+ readline.createInterface({ input: stdout }).on('line', (line) => {
27
+ this.nsrpc.receive(line);
28
+ });
29
+ }
30
+
31
+ private write(message: String) {
32
+ const stdin = this.childProcess?.stdin;
33
+ if (!stdin) { throw new Error('RecordKit RPC: Missing stdin stream.') }
34
+ stdin.write(message + "\n")
35
+ }
36
+ }
@@ -0,0 +1,98 @@
1
+ import { NSRPC, NSRPCPerformClosureRequest } from './NonstrictRPC.js';
2
+ import v8 from 'v8';
3
+
4
+ // const finalizationRegistry = new FinalizationRegistry(async (destructor) => { console.log('==> ', destructor) })
5
+
6
+ // finalizationRegistry.register({}, 'CHECK');
7
+ // eval('%CollectGarbage(true)');
8
+
9
+ describe('NonstrictRPC', () => {
10
+ it('needs tests', () => { });
11
+
12
+ // beforeAll(() => {
13
+ // v8.setFlagsFromString('--allow-natives-syntax');
14
+ // });
15
+
16
+ // describe('initialize', () => {
17
+ // it('sends init request w/parameters', (done) => {
18
+ // const rpc = new NSRPC((data) => {
19
+ // const message = JSON.parse(data)
20
+ // expect(message).toMatchSnapshot({ id: expect.any(String) });
21
+ // done()
22
+ // });
23
+
24
+ // rpc.initialize({
25
+ // target: 'TheTarget',
26
+ // type: 'TheType',
27
+ // params: { aParameter: 'TheValue' },
28
+ // lifecycle: {}
29
+ // });
30
+ // });
31
+
32
+ // it('sends init request w/o parameters', (done) => {
33
+ // const rpc = new NSRPC((data) => {
34
+ // const message = JSON.parse(data)
35
+ // expect(message).toMatchSnapshot({ id: expect.any(String) });
36
+ // done()
37
+ // });
38
+
39
+ // rpc.initialize({
40
+ // target: 'TheTarget',
41
+ // type: 'TheType',
42
+ // lifecycle: {}
43
+ // });
44
+ // });
45
+
46
+ // it('sends release request', async () => {
47
+ // const rpc = new NSRPC((data) => {
48
+ // const message = JSON.parse(data)
49
+ // console.log(message)
50
+ // // if (message.procedure === 'release') {
51
+ // // expect(message).toMatchSnapshot({ id: expect.any(String) });
52
+ // // done()
53
+ // // }
54
+ // });
55
+
56
+ // async function scope() {
57
+ // const foo = {}
58
+ // await rpc.initialize({
59
+ // target: 'TheTarget',
60
+ // type: 'TheType',
61
+ // lifecycle: foo
62
+ // }); 
63
+ // finalizationRegistry.register(foo, 'CHECK');
64
+ // }
65
+
66
+ // await scope();
67
+ // eval("%CollectGarbage(true)");
68
+ // });
69
+ // });
70
+
71
+ // describe('registerClosure', () => {
72
+ // it('should do something', (done) => {
73
+ // const rpc = new NSRPC((data) => {
74
+ // expect(JSON.parse(data)).toStrictEqual({status:200,result:{test:"test"},nsrpc:1,id:"req_id"})
75
+ // done()
76
+ // });
77
+
78
+ // const target = rpc.registerClosure({
79
+ // handler: (params) => { params },
80
+ // prefix: 'test',
81
+ // lifecycle: {}
82
+ // });
83
+
84
+ // const rpcMessage: NSRPCPerformClosureRequest = {
85
+ // nsrpc: 1,
86
+ // id: 'req_id',
87
+ // procedure: 'perform',
88
+ // target,
89
+ // params: { test: 'test' }
90
+ // }
91
+ // rpc.receive(JSON.stringify(rpcMessage));
92
+ // });x
93
+ // });
94
+
95
+ // function timeout(ms: number) {
96
+ // return new Promise<void>(resolve => setTimeout(resolve, ms));
97
+ // }
98
+ });
@@ -0,0 +1,324 @@
1
+ import { randomUUID } from "crypto";
2
+ import { finalizationRegistry } from "./finalizationRegistry.js";
3
+
4
+ type NSRPCMessage = NSRPCRequest | NSRPCResponse;
5
+
6
+ /* Request types */
7
+
8
+ type NSRPCRequest =
9
+ | NSRPCInitializationRequest
10
+ | NSRPCPerformStaticMethodRequest
11
+ | NSRPCPerformMethodRequest
12
+ | NSRPCPerformClosureRequest
13
+ | NSRPCReleaseRequest;
14
+
15
+ interface NSRPCInitializationRequest {
16
+ nsrpc: number;
17
+ id: string;
18
+ procedure: "init";
19
+ target: string;
20
+ type: string;
21
+ params?: Record<string, unknown>;
22
+ }
23
+
24
+ interface NSRPCPerformStaticMethodRequest {
25
+ nsrpc: number;
26
+ id?: string;
27
+ procedure: "perform";
28
+ type: string;
29
+ action: string;
30
+ params?: Record<string, unknown>;
31
+ }
32
+
33
+ interface NSRPCPerformMethodRequest {
34
+ nsrpc: number;
35
+ id?: string;
36
+ procedure: "perform";
37
+ target: string;
38
+ action: string;
39
+ params?: Record<string, unknown>;
40
+ }
41
+
42
+ export interface NSRPCPerformClosureRequest {
43
+ nsrpc: number;
44
+ id?: string;
45
+ procedure: "perform";
46
+ target: string;
47
+ params?: Record<string, unknown>;
48
+ }
49
+
50
+ interface NSRPCReleaseRequest {
51
+ nsrpc: number;
52
+ id: string;
53
+ procedure: "release";
54
+ target: string;
55
+ }
56
+
57
+ type NSRPCRequestBody =
58
+ | NSRPCInitializationRequestBody
59
+ | NSRPCPerformStaticMethodRequestBody
60
+ | NSRPCPerformMethodRequestBody
61
+ | NSRPCPerformClosureRequestBody
62
+ | NSRPCReleaseRequestBody;
63
+ type NSRPCInitializationRequestBody = Omit<
64
+ NSRPCInitializationRequest,
65
+ "nsrpc" | "id"
66
+ >;
67
+ type NSRPCPerformMethodRequestBody = Omit<
68
+ NSRPCPerformMethodRequest,
69
+ "nsrpc" | "id"
70
+ >;
71
+ type NSRPCPerformStaticMethodRequestBody = Omit<
72
+ NSRPCPerformStaticMethodRequest,
73
+ "nsrpc" | "id"
74
+ >;
75
+ type NSRPCPerformClosureRequestBody = Omit<
76
+ NSRPCPerformClosureRequest,
77
+ "nsrpc" | "id"
78
+ >;
79
+ type NSRPCReleaseRequestBody = Omit<NSRPCReleaseRequest, "nsrpc" | "id">;
80
+
81
+ /* Response types */
82
+
83
+ type NSRPCResponse = NSRPCSuccesfulResponse | NSRPCErrorResponse;
84
+
85
+ interface NSRPCSuccesfulResponse {
86
+ nsrpc: number;
87
+ id: string;
88
+ status: 200;
89
+ result?: unknown;
90
+ }
91
+
92
+ interface NSRPCErrorResponse {
93
+ nsrpc: number;
94
+ id: string;
95
+ status: Exclude<number, 200>;
96
+ error: Record<string, unknown>;
97
+ }
98
+
99
+ type NSRPCResponseBody = NSRPCSuccesfulResponseBody | NSRPCErrorResponseBody;
100
+ type NSRPCSuccesfulResponseBody = Omit<NSRPCSuccesfulResponse, "nsrpc" | "id">;
101
+ type NSRPCErrorResponseBody = Omit<NSRPCErrorResponse, "nsrpc" | "id">;
102
+
103
+ interface PromiseSource {
104
+ resolve: (
105
+ value: unknown
106
+ ) => void;
107
+ reject: (reason?: any) => void;
108
+ }
109
+ type ClosureTarget = (
110
+ params: Record<string, unknown>
111
+ ) => Record<string, unknown> | void;
112
+
113
+ export class NSRPC {
114
+ logMessages = false;
115
+ private readonly send: (data: string) => void;
116
+
117
+ private responseHandlers: Map<string, PromiseSource> = new Map();
118
+ private closureTargets: Map<string, ClosureTarget> = new Map();
119
+
120
+ constructor(send: (data: string) => void) {
121
+ this.send = send;
122
+ }
123
+
124
+ receive(data: string) {
125
+ // TODO: For now we just assume the message is a valid NSRPC message, but we should:
126
+ // - Check if the nsrpc property is set to a number in the range of 1..<2
127
+ // - Validate the message against the defined interfaces above
128
+ let message: NSRPCMessage
129
+ try {
130
+ if (this.logMessages) {
131
+ console.log("< ", data.trimEnd());
132
+ }
133
+ message = JSON.parse(data) as NSRPCMessage;
134
+ } catch (error) {
135
+ if (this.logMessages) {
136
+ console.log("!! Above message is invalid JSON, will be ignored.");
137
+ }
138
+ return;
139
+ }
140
+
141
+ if ("status" in message) {
142
+ // This is a response, dispatch it so it can be handled
143
+ const responseHandler = this.responseHandlers.get(message.id);
144
+ this.responseHandlers.delete(message.id);
145
+ if (responseHandler === undefined) {
146
+ // TODO: Got a response for a request we don't know about, log this
147
+ return;
148
+ }
149
+
150
+ if ("error" in message) {
151
+ responseHandler.reject(message.error);
152
+ } else {
153
+ responseHandler.resolve(message.result);
154
+ }
155
+ } else {
156
+ // This is a request
157
+ const responseBody = this.handleRequest(message);
158
+ if (responseBody !== undefined) {
159
+ this.sendResponse(message.id, responseBody);
160
+ }
161
+ }
162
+ }
163
+
164
+ /* Sending helpers */
165
+
166
+ private sendMessage(message: NSRPCMessage) {
167
+ const stringMessage = JSON.stringify(message)
168
+ if (this.logMessages) {
169
+ console.log("> ", stringMessage);
170
+ }
171
+ this.send(stringMessage);
172
+ }
173
+
174
+ private sendResponse(id: string | undefined, response: NSRPCResponseBody) {
175
+ if (id === undefined) {
176
+ return;
177
+ }
178
+ this.sendMessage({ ...response, nsrpc: 1, id });
179
+ }
180
+
181
+ private async sendRequest(
182
+ request: NSRPCRequestBody
183
+ ): Promise<unknown> {
184
+ const id = "req_" + randomUUID();
185
+ const response = new Promise((resolve, reject) => {
186
+ this.responseHandlers.set(id, { resolve, reject });
187
+ });
188
+
189
+ this.sendMessage({ ...request, nsrpc: 1, id });
190
+
191
+ return response;
192
+ }
193
+
194
+ /* Request handling */
195
+
196
+ private handleRequest(request: NSRPCRequest): NSRPCResponseBody | undefined {
197
+ switch (request.procedure) {
198
+ case "init":
199
+ return {
200
+ status: 501,
201
+ error: {
202
+ debugDescription: "Init procedure not implemented.",
203
+ userMessage:
204
+ "Failed to communicate with external process. (Procedure not implemented)",
205
+ },
206
+ };
207
+ case "perform":
208
+ if ("action" in request) {
209
+ return {
210
+ status: 501,
211
+ error: {
212
+ debugDescription:
213
+ "Perform procedure for (static) methods not implemented.",
214
+ userMessage:
215
+ "Failed to communicate with external process. (Procedure not implemented)",
216
+ },
217
+ };
218
+ } else {
219
+ return this.handleClosureRequest(request);
220
+ }
221
+ case "release":
222
+ return {
223
+ status: 501,
224
+ error: {
225
+ debugDescription: "Release procedure not implemented.",
226
+ userMessage:
227
+ "Failed to communicate with external process. (Procedure not implemented)",
228
+ },
229
+ };
230
+ }
231
+ }
232
+
233
+ private handleClosureRequest(
234
+ request: NSRPCPerformClosureRequest
235
+ ): NSRPCResponseBody {
236
+ const handler = this.closureTargets.get(request.target);
237
+ if (handler === undefined) {
238
+ return {
239
+ status: 404,
240
+ error: {
241
+ debugDescription: `Perform target '${request.target}' not found.`,
242
+ userMessage:
243
+ "Failed to communicate with external process. (Target not found)",
244
+ },
245
+ };
246
+ }
247
+
248
+ try {
249
+ const rawresult = handler(request.params ?? {});
250
+ const result = rawresult === undefined ? undefined : rawresult;
251
+ return {
252
+ status: 200,
253
+ result,
254
+ };
255
+ } catch (error) {
256
+ return {
257
+ status: 202,
258
+ // TODO: Would be good to have an error type that we can throw that fills these fields more specifically. (But for now it doesn't matter since this is just communicated back the the CLI and not to the user.)
259
+ error: {
260
+ debugDescription: `${error}`,
261
+ userMessage: "Handler failed to perform request.",
262
+ underlyingError: error,
263
+ },
264
+ };
265
+ }
266
+ }
267
+
268
+ /* Perform remote procedures */
269
+
270
+ async initialize(args: {
271
+ target: string;
272
+ type: string;
273
+ params?: Record<string, unknown>;
274
+ lifecycle: Object;
275
+ }) {
276
+ const target = args.target
277
+ finalizationRegistry.register(args.lifecycle, async () => {
278
+ await this.release(target);
279
+ });
280
+
281
+ await this.sendRequest({
282
+ target: args.target,
283
+ type: args.type,
284
+ params: args.params,
285
+ procedure: "init",
286
+ });
287
+ }
288
+
289
+ async perform(body: { // TODO: Add support for static method calls.
290
+ type?: string;
291
+ target?: string;
292
+ action?: string;
293
+ params?: Record<string, unknown>;
294
+ }): Promise<unknown> {
295
+ return await this.sendRequest({
296
+ ...body,
297
+ procedure: "perform",
298
+ } as any);
299
+ }
300
+
301
+ private async release(target: string) {
302
+ await this.sendRequest({
303
+ procedure: "release",
304
+ target,
305
+ });
306
+ }
307
+
308
+ /* Register locally available targets/actions */
309
+
310
+ registerClosure(options: {
311
+ handler: ClosureTarget;
312
+ lifecycle: Object;
313
+ prefix: string;
314
+ }): string {
315
+ const target = `target_${options.prefix}_${randomUUID()}`;
316
+ this.closureTargets.set(target, options.handler);
317
+
318
+ finalizationRegistry.register(options.lifecycle, () => {
319
+ this.closureTargets.delete(target);
320
+ });
321
+
322
+ return target;
323
+ }
324
+ }
@@ -0,0 +1,99 @@
1
+ import { IpcRecordKit } from "./IpcRecordKit.js";
2
+ import { Recorder, RecorderSchema, AbortReason } from "./Recorder.js";
3
+ import { existsSync } from "node:fs";
4
+
5
+ type AuthorizationStatus =
6
+ | 'notDetermined' // The user has not yet made a choice.
7
+ | 'restricted' // The user cannot change the client's status, possibly due to active restrictions such as parental controls being in place.
8
+ | 'denied' // The user explicitly denied access to the hardware supporting a media type for the client.
9
+ | 'authorized' // Application is authorized to access the hardware.
10
+
11
+ export interface Window {
12
+ id: number; // UInt32
13
+ title?: string;
14
+ frame: Bounds
15
+ level: number // Int
16
+ application_process_id?: number // Int32
17
+ application_name?: string
18
+ }
19
+
20
+ export interface Camera {
21
+ id: string;
22
+ name: string;
23
+ model_id: string;
24
+ manufacturer: string;
25
+ availability: 'available' | 'lidClosed' | 'unknownSuspended'
26
+ }
27
+
28
+ export interface Microphone {
29
+ id: string;
30
+ name: string;
31
+ model_id: string;
32
+ manufacturer: string;
33
+ availability: 'available' | 'lidClosed' | 'unknownSuspended'
34
+ }
35
+
36
+ export interface Bounds {
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ }
42
+
43
+ export class RecordKit {
44
+ private ipcRecordKit = new IpcRecordKit()
45
+
46
+ async initialize(args: { rpcBinaryPath: string, fallbackToNodeModules: boolean, logRpcMessages?: boolean }): Promise<void> {
47
+ let rpcBinaryPath = args.rpcBinaryPath
48
+ if (args.fallbackToNodeModules) {
49
+ if (!existsSync(rpcBinaryPath)) {
50
+ console.log('Falling back to RPC binary from node_modules, no file at given RPC binary path.')
51
+ rpcBinaryPath = rpcBinaryPath.replace('node_modules/electron/dist/Electron.app/Contents/Resources', 'node_modules/@nonstrict/recordkit/bin')
52
+ }
53
+ }
54
+
55
+ return this.ipcRecordKit.initialize(rpcBinaryPath, args.logRpcMessages)
56
+ }
57
+
58
+ async getWindows(): Promise<Window[]> {
59
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getWindows' }) as Window[]
60
+ }
61
+
62
+ async getCameras(): Promise<Camera[]> {
63
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras' }) as Camera[]
64
+ }
65
+
66
+ async getMicrophones(): Promise<Microphone[]> {
67
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getMicrophones' }) as Microphone[]
68
+ }
69
+
70
+ async getCameraAuthorizationStatus(): Promise<AuthorizationStatus> {
71
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getCameraAuthorizationStatus' }) as AuthorizationStatus
72
+ }
73
+
74
+ async getMicrophoneAuthorizationStatus(): Promise<AuthorizationStatus> {
75
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getMicrophoneAuthorizationStatus' }) as AuthorizationStatus
76
+ }
77
+
78
+ async getScreenRecordingAccess(): Promise<boolean> {
79
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getScreenRecordingAccess' }) as boolean
80
+ }
81
+
82
+ async requestCameraAccess(): Promise<boolean> {
83
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestCameraAccess' }) as boolean
84
+ }
85
+
86
+ async requestMicrophoneAccess(): Promise<boolean> {
87
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestMicrophoneAccess' }) as boolean
88
+ }
89
+
90
+ async requestScreenRecordingAccess(): Promise<void> {
91
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestScreenRecordingAccess' }) as void
92
+ }
93
+
94
+ async createRecorder(schema: RecorderSchema): Promise<Recorder> {
95
+ return Recorder.newInstance(this.ipcRecordKit.nsrpc, schema);
96
+ }
97
+ }
98
+
99
+ export let recordkit = new RecordKit();