@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
package/bin/.gitkeep ADDED
File without changes
Binary file
package/build.sh ADDED
@@ -0,0 +1,32 @@
1
+ #!/bin/bash -e
2
+
3
+ # Check arguments
4
+ VERSION_NUMBER="$1"
5
+
6
+ if [ -z "$VERSION_NUMBER" ]; then
7
+ echo "Missing version argument: ./build.sh 0.3.4"
8
+ exit 1
9
+ fi
10
+
11
+
12
+ # Clean up previous artifact directory
13
+ rm -r ./dist || echo "No old build to remove"
14
+
15
+ # Set version in package.json
16
+ function restore_package_json {
17
+ npm version 0.0.0
18
+ echo "Restored version"
19
+ }
20
+
21
+ # register the cleanup function to be called on the EXIT signal
22
+ trap restore_package_json EXIT
23
+
24
+ echo "Updating version number"
25
+ npm version $VERSION_NUMBER
26
+
27
+
28
+ # Build recordkit-electron
29
+ npm run build
30
+ contents=(*)
31
+ mkdir dist
32
+ cp -r ${contents[*]} dist
package/jest.config.js ADDED
@@ -0,0 +1,16 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ export default {
3
+ preset: "ts-jest/presets/default-esm",
4
+ testEnvironment: "node",
5
+ moduleNameMapper: {
6
+ "^(\\.{1,2}/.*)\\.js$": "$1",
7
+ },
8
+ transform: {
9
+ "^.+\\.tsx?$": [
10
+ "ts-jest",
11
+ {
12
+ useESM: true,
13
+ },
14
+ ],
15
+ },
16
+ };
@@ -1,6 +1,5 @@
1
1
  import { NSRPC } from "./NonstrictRPC.js";
2
2
  export declare class IpcRecordKit {
3
- private logMessages;
4
3
  private childProcess?;
5
4
  readonly nsrpc: NSRPC;
6
5
  constructor();
@@ -2,7 +2,6 @@ import { spawn } from 'node:child_process';
2
2
  import * as readline from 'readline';
3
3
  import { NSRPC } from "./NonstrictRPC.js";
4
4
  export class IpcRecordKit {
5
- logMessages = false;
6
5
  childProcess;
7
6
  nsrpc;
8
7
  constructor() {
@@ -12,7 +11,7 @@ export class IpcRecordKit {
12
11
  if (this.childProcess !== undefined) {
13
12
  throw new Error('RecordKit RPC: Already initialized.');
14
13
  }
15
- this.logMessages = logMessages;
14
+ this.nsrpc.logMessages = logMessages;
16
15
  this.childProcess = await new Promise((resolve, reject) => {
17
16
  const childProcess = spawn(recordKitRpcPath);
18
17
  childProcess.on('spawn', () => { resolve(childProcess); });
@@ -23,9 +22,6 @@ export class IpcRecordKit {
23
22
  throw new Error('RecordKit RPC: No stdout stream on child process.');
24
23
  }
25
24
  readline.createInterface({ input: stdout }).on('line', (line) => {
26
- if (logMessages) {
27
- console.log("< ", line.trimEnd());
28
- }
29
25
  this.nsrpc.receive(line);
30
26
  });
31
27
  }
@@ -34,9 +30,7 @@ export class IpcRecordKit {
34
30
  if (!stdin) {
35
31
  throw new Error('RecordKit RPC: Missing stdin stream.');
36
32
  }
37
- if (this.logMessages) {
38
- console.log("> ", message);
39
- }
40
33
  stdin.write(message + "\n");
41
34
  }
42
35
  }
36
+ //# sourceMappingURL=IpcRecordKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IpcRecordKit.js","sourceRoot":"","sources":["../src/IpcRecordKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,OAAO,YAAY;IACf,YAAY,CAAgB;IAC3B,KAAK,CAAQ;IAEtB;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,gBAAwB,EAAE,cAAuB,KAAK;QACrE,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QAAC,CAAC;QAE/F,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtE,MAAM,YAAY,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA;YAC5C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;YACzD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;QAEF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAA;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QAAC,CAAC;QAErF,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,OAAe;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QAAC,CAAC;QACvE,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;CACF"}
@@ -7,6 +7,7 @@ export interface NSRPCPerformClosureRequest {
7
7
  }
8
8
  type ClosureTarget = (params: Record<string, unknown>) => Record<string, unknown> | void;
9
9
  export declare class NSRPC {
10
+ logMessages: boolean;
10
11
  private readonly send;
11
12
  private responseHandlers;
12
13
  private closureTargets;
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "crypto";
2
2
  import { finalizationRegistry } from "./finalizationRegistry.js";
3
3
  export class NSRPC {
4
+ logMessages = false;
4
5
  send;
5
6
  responseHandlers = new Map();
6
7
  closureTargets = new Map();
@@ -9,10 +10,21 @@ export class NSRPC {
9
10
  }
10
11
  receive(data) {
11
12
  // TODO: For now we just assume the message is a valid NSRPC message, but we should:
12
- // - Handle invalid JSON comming in
13
13
  // - Check if the nsrpc property is set to a number in the range of 1..<2
14
14
  // - Validate the message against the defined interfaces above
15
- const message = JSON.parse(data);
15
+ let message;
16
+ try {
17
+ if (this.logMessages) {
18
+ console.log("< ", data.trimEnd());
19
+ }
20
+ message = JSON.parse(data);
21
+ }
22
+ catch (error) {
23
+ if (this.logMessages) {
24
+ console.log("!! Above message is invalid JSON, will be ignored.");
25
+ }
26
+ return;
27
+ }
16
28
  if ("status" in message) {
17
29
  // This is a response, dispatch it so it can be handled
18
30
  const responseHandler = this.responseHandlers.get(message.id);
@@ -38,7 +50,11 @@ export class NSRPC {
38
50
  }
39
51
  /* Sending helpers */
40
52
  sendMessage(message) {
41
- this.send(JSON.stringify(message));
53
+ const stringMessage = JSON.stringify(message);
54
+ if (this.logMessages) {
55
+ console.log("> ", stringMessage);
56
+ }
57
+ this.send(stringMessage);
42
58
  }
43
59
  sendResponse(id, response) {
44
60
  if (id === undefined) {
@@ -154,3 +170,4 @@ export class NSRPC {
154
170
  return target;
155
171
  }
156
172
  }
173
+ //# sourceMappingURL=NonstrictRPC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NonstrictRPC.js","sourceRoot":"","sources":["../src/NonstrictRPC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AA+GjE,MAAM,OAAO,KAAK;IAChB,WAAW,GAAG,KAAK,CAAC;IACH,IAAI,CAA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C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,50 @@
1
+ import { Recorder, RecorderSchema } from "./Recorder.js";
2
+ type AuthorizationStatus = 'notDetermined' | 'restricted' | 'denied' | 'authorized';
3
+ export interface Window {
4
+ id: number;
5
+ title?: string;
6
+ frame: Bounds;
7
+ level: number;
8
+ application_process_id?: number;
9
+ application_name?: string;
10
+ }
11
+ export interface Camera {
12
+ id: string;
13
+ name: string;
14
+ model_id: string;
15
+ manufacturer: string;
16
+ availability: 'available' | 'lidClosed' | 'unknownSuspended';
17
+ }
18
+ export interface Microphone {
19
+ id: string;
20
+ name: string;
21
+ model_id: string;
22
+ manufacturer: string;
23
+ availability: 'available' | 'lidClosed' | 'unknownSuspended';
24
+ }
25
+ export interface Bounds {
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ }
31
+ export declare class RecordKit {
32
+ private ipcRecordKit;
33
+ initialize(args: {
34
+ rpcBinaryPath: string;
35
+ fallbackToNodeModules: boolean;
36
+ logRpcMessages?: boolean;
37
+ }): Promise<void>;
38
+ getWindows(): Promise<Window[]>;
39
+ getCameras(): Promise<Camera[]>;
40
+ getMicrophones(): Promise<Microphone[]>;
41
+ getCameraAuthorizationStatus(): Promise<AuthorizationStatus>;
42
+ getMicrophoneAuthorizationStatus(): Promise<AuthorizationStatus>;
43
+ getScreenRecordingAccess(): Promise<boolean>;
44
+ requestCameraAccess(): Promise<boolean>;
45
+ requestMicrophoneAccess(): Promise<boolean>;
46
+ requestScreenRecordingAccess(): Promise<void>;
47
+ createRecorder(schema: RecorderSchema): Promise<Recorder>;
48
+ }
49
+ export declare let recordkit: RecordKit;
50
+ export {};
@@ -0,0 +1,48 @@
1
+ import { IpcRecordKit } from "./IpcRecordKit.js";
2
+ import { Recorder } from "./Recorder.js";
3
+ import { existsSync } from "node:fs";
4
+ export class RecordKit {
5
+ ipcRecordKit = new IpcRecordKit();
6
+ async initialize(args) {
7
+ let rpcBinaryPath = args.rpcBinaryPath;
8
+ if (args.fallbackToNodeModules) {
9
+ if (!existsSync(rpcBinaryPath)) {
10
+ console.log('Falling back to RPC binary from node_modules, no file at given RPC binary path.');
11
+ rpcBinaryPath = rpcBinaryPath.replace('node_modules/electron/dist/Electron.app/Contents/Resources', 'node_modules/@nonstrict/recordkit/bin');
12
+ }
13
+ }
14
+ return this.ipcRecordKit.initialize(rpcBinaryPath, args.logRpcMessages);
15
+ }
16
+ async getWindows() {
17
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getWindows' });
18
+ }
19
+ async getCameras() {
20
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras' });
21
+ }
22
+ async getMicrophones() {
23
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getMicrophones' });
24
+ }
25
+ async getCameraAuthorizationStatus() {
26
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getCameraAuthorizationStatus' });
27
+ }
28
+ async getMicrophoneAuthorizationStatus() {
29
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getMicrophoneAuthorizationStatus' });
30
+ }
31
+ async getScreenRecordingAccess() {
32
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getScreenRecordingAccess' });
33
+ }
34
+ async requestCameraAccess() {
35
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestCameraAccess' });
36
+ }
37
+ async requestMicrophoneAccess() {
38
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestMicrophoneAccess' });
39
+ }
40
+ async requestScreenRecordingAccess() {
41
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestScreenRecordingAccess' });
42
+ }
43
+ async createRecorder(schema) {
44
+ return Recorder.newInstance(this.ipcRecordKit.nsrpc, schema);
45
+ }
46
+ }
47
+ export let recordkit = new RecordKit();
48
+ //# sourceMappingURL=RecordKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordKit.js","sourceRoot":"","sources":["../src/RecordKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAA+B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAwCrC,MAAM,OAAO,SAAS;IACZ,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;IAEzC,KAAK,CAAC,UAAU,CAAC,IAAyF;QACxG,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC/B,OAAO,CAAC,GAAG,CAAC,iFAAiF,CAAC,CAAA;gBAC9F,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,4DAA4D,EAAE,uCAAuC,CAAC,CAAA;YAC9I,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;IACzE,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAa,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAa,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EA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AE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF;AAED,MAAM,CAAC,IAAI,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
@@ -0,0 +1,59 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import { NSRPC } from "./NonstrictRPC.js";
4
+ import { EventEmitter } from "stream";
5
+ import { Camera, Microphone, Window } from "./RecordKit.js";
6
+ export interface RecorderSchema {
7
+ output_directory?: string;
8
+ items: RecorderSchemaItem[];
9
+ }
10
+ export type RecorderSchemaItem = WebcamSchema | WindowBasedCropSchema;
11
+ export interface WebcamSchema {
12
+ type: 'webcam';
13
+ filename?: string;
14
+ camera: Camera | string;
15
+ microphone: Microphone | string;
16
+ }
17
+ export interface WindowBasedCropSchema {
18
+ type: 'windowBasedCrop';
19
+ filename?: string;
20
+ window: Window | number;
21
+ shows_cursor?: boolean;
22
+ mouse_events?: boolean;
23
+ }
24
+ export type AbortReason = {
25
+ reason: 'userStopped';
26
+ result: RecordingResult;
27
+ } | {
28
+ reason: 'interrupted';
29
+ result: RecordingResult;
30
+ error: RecordKitError;
31
+ } | {
32
+ reason: 'failed';
33
+ error: RecordKitError;
34
+ };
35
+ export interface RecordingResult {
36
+ url: string;
37
+ info: BundleInfo;
38
+ }
39
+ export interface RecordKitError {
40
+ message?: string;
41
+ error_group: string;
42
+ debug_description: string;
43
+ }
44
+ export interface BundleInfo {
45
+ version: 1;
46
+ files: {
47
+ type: 'screen' | 'webcam' | 'mouse';
48
+ filename: string;
49
+ }[];
50
+ }
51
+ export declare class Recorder extends EventEmitter {
52
+ private readonly rpc;
53
+ private readonly target;
54
+ static newInstance(rpc: NSRPC, schema: RecorderSchema): Promise<Recorder>;
55
+ constructor(rpc: NSRPC, target: string);
56
+ prepare(): Promise<void>;
57
+ start(): Promise<void>;
58
+ stop(): Promise<RecordingResult>;
59
+ }
@@ -1,20 +1,35 @@
1
1
  import { randomUUID } from "crypto";
2
2
  import { EventEmitter } from "stream";
3
- export class RecordingSession extends EventEmitter {
3
+ export class Recorder extends EventEmitter {
4
4
  rpc;
5
5
  target;
6
6
  static async newInstance(rpc, schema) {
7
- const target = 'RecordingSession_' + randomUUID();
8
- const object = new RecordingSession(rpc, target);
7
+ const target = 'Recorder_' + randomUUID();
8
+ const object = new Recorder(rpc, target);
9
+ schema.items.forEach(item => {
10
+ if (item.type == 'webcam') {
11
+ if (typeof item.camera != 'string') {
12
+ item.camera = item.camera.id;
13
+ }
14
+ if (typeof item.microphone != 'string') {
15
+ item.microphone = item.microphone.id;
16
+ }
17
+ }
18
+ if (item.type == 'windowBasedCrop') {
19
+ if (typeof item.window != 'number') {
20
+ item.window = item.window.id;
21
+ }
22
+ }
23
+ });
9
24
  const weakRefObject = new WeakRef(object);
10
25
  const onAbortInstance = rpc.registerClosure({
11
26
  handler: (params) => { weakRefObject.deref()?.emit('abort', params.reason); },
12
- prefix: 'RecordingSession.onAbort',
27
+ prefix: 'Recorder.onAbort',
13
28
  lifecycle: object
14
29
  });
15
30
  await rpc.initialize({
16
31
  target,
17
- type: 'RecordingSession',
32
+ type: 'Recorder',
18
33
  params: { schema, onAbortInstance },
19
34
  lifecycle: object
20
35
  });
@@ -35,3 +50,4 @@ export class RecordingSession extends EventEmitter {
35
50
  return await this.rpc.perform({ target: this.target, action: 'stop' });
36
51
  }
37
52
  }
53
+ //# sourceMappingURL=Recorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Recorder.js","sourceRoot":"","sources":["../src/Recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAmDtC,MAAM,OAAO,QAAS,SAAQ,YAAY;IACvB,GAAG,CAAQ;IACX,MAAM,CAAS;IAEhC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAU,EAAE,MAAsB;QACzD,MAAM,MAAM,GAAG,WAAW,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AAC;QAEH,OAAO,MAAM,CAAA;IACf,CAAC;IAED,YAAY,GAAU,EAAE,MAAc;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAoB,CAAC;IAC5F,CAAC;CACF"}
@@ -1 +1,2 @@
1
1
  export const finalizationRegistry = new FinalizationRegistry(async (destructor) => { await destructor(); });
2
+ //# sourceMappingURL=finalizationRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalizationRegistry.js","sourceRoot":"","sources":["../src/finalizationRegistry.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAa,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,MAAM,UAAU,EAAE,CAAA,CAAC,CAAC,CAAC,CAAA"}
@@ -4,6 +4,7 @@ var node_child_process = require('node:child_process');
4
4
  var readline = require('readline');
5
5
  var crypto = require('crypto');
6
6
  var stream = require('stream');
7
+ var node_fs = require('node:fs');
7
8
 
8
9
  function _interopNamespaceDefault(e) {
9
10
  var n = Object.create(null);
@@ -27,6 +28,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
27
28
  const finalizationRegistry = new FinalizationRegistry(async (destructor) => { await destructor(); });
28
29
 
29
30
  class NSRPC {
31
+ logMessages = false;
30
32
  send;
31
33
  responseHandlers = new Map();
32
34
  closureTargets = new Map();
@@ -35,10 +37,21 @@ class NSRPC {
35
37
  }
36
38
  receive(data) {
37
39
  // TODO: For now we just assume the message is a valid NSRPC message, but we should:
38
- // - Handle invalid JSON comming in
39
40
  // - Check if the nsrpc property is set to a number in the range of 1..<2
40
41
  // - Validate the message against the defined interfaces above
41
- const message = JSON.parse(data);
42
+ let message;
43
+ try {
44
+ if (this.logMessages) {
45
+ console.log("< ", data.trimEnd());
46
+ }
47
+ message = JSON.parse(data);
48
+ }
49
+ catch (error) {
50
+ if (this.logMessages) {
51
+ console.log("!! Above message is invalid JSON, will be ignored.");
52
+ }
53
+ return;
54
+ }
42
55
  if ("status" in message) {
43
56
  // This is a response, dispatch it so it can be handled
44
57
  const responseHandler = this.responseHandlers.get(message.id);
@@ -64,7 +77,11 @@ class NSRPC {
64
77
  }
65
78
  /* Sending helpers */
66
79
  sendMessage(message) {
67
- this.send(JSON.stringify(message));
80
+ const stringMessage = JSON.stringify(message);
81
+ if (this.logMessages) {
82
+ console.log("> ", stringMessage);
83
+ }
84
+ this.send(stringMessage);
68
85
  }
69
86
  sendResponse(id, response) {
70
87
  if (id === undefined) {
@@ -182,7 +199,6 @@ class NSRPC {
182
199
  }
183
200
 
184
201
  class IpcRecordKit {
185
- logMessages = false;
186
202
  childProcess;
187
203
  nsrpc;
188
204
  constructor() {
@@ -192,7 +208,7 @@ class IpcRecordKit {
192
208
  if (this.childProcess !== undefined) {
193
209
  throw new Error('RecordKit RPC: Already initialized.');
194
210
  }
195
- this.logMessages = logMessages;
211
+ this.nsrpc.logMessages = logMessages;
196
212
  this.childProcess = await new Promise((resolve, reject) => {
197
213
  const childProcess = node_child_process.spawn(recordKitRpcPath);
198
214
  childProcess.on('spawn', () => { resolve(childProcess); });
@@ -203,9 +219,6 @@ class IpcRecordKit {
203
219
  throw new Error('RecordKit RPC: No stdout stream on child process.');
204
220
  }
205
221
  readline__namespace.createInterface({ input: stdout }).on('line', (line) => {
206
- if (logMessages) {
207
- console.log("< ", line.trimEnd());
208
- }
209
222
  this.nsrpc.receive(line);
210
223
  });
211
224
  }
@@ -214,28 +227,40 @@ class IpcRecordKit {
214
227
  if (!stdin) {
215
228
  throw new Error('RecordKit RPC: Missing stdin stream.');
216
229
  }
217
- if (this.logMessages) {
218
- console.log("> ", message);
219
- }
220
230
  stdin.write(message + "\n");
221
231
  }
222
232
  }
223
233
 
224
- class RecordingSession extends stream.EventEmitter {
234
+ class Recorder extends stream.EventEmitter {
225
235
  rpc;
226
236
  target;
227
237
  static async newInstance(rpc, schema) {
228
- const target = 'RecordingSession_' + crypto.randomUUID();
229
- const object = new RecordingSession(rpc, target);
238
+ const target = 'Recorder_' + crypto.randomUUID();
239
+ const object = new Recorder(rpc, target);
240
+ schema.items.forEach(item => {
241
+ if (item.type == 'webcam') {
242
+ if (typeof item.camera != 'string') {
243
+ item.camera = item.camera.id;
244
+ }
245
+ if (typeof item.microphone != 'string') {
246
+ item.microphone = item.microphone.id;
247
+ }
248
+ }
249
+ if (item.type == 'windowBasedCrop') {
250
+ if (typeof item.window != 'number') {
251
+ item.window = item.window.id;
252
+ }
253
+ }
254
+ });
230
255
  const weakRefObject = new WeakRef(object);
231
256
  const onAbortInstance = rpc.registerClosure({
232
257
  handler: (params) => { weakRefObject.deref()?.emit('abort', params.reason); },
233
- prefix: 'RecordingSession.onAbort',
258
+ prefix: 'Recorder.onAbort',
234
259
  lifecycle: object
235
260
  });
236
261
  await rpc.initialize({
237
262
  target,
238
- type: 'RecordingSession',
263
+ type: 'Recorder',
239
264
  params: { schema, onAbortInstance },
240
265
  lifecycle: object
241
266
  });
@@ -259,23 +284,48 @@ class RecordingSession extends stream.EventEmitter {
259
284
 
260
285
  class RecordKit {
261
286
  ipcRecordKit = new IpcRecordKit();
262
- async initialize(rpcBinaryPath, logRpcMessages = false) {
263
- console.log('Initializing with path:', rpcBinaryPath);
264
- return this.ipcRecordKit.initialize(rpcBinaryPath, logRpcMessages);
287
+ async initialize(args) {
288
+ let rpcBinaryPath = args.rpcBinaryPath;
289
+ if (args.fallbackToNodeModules) {
290
+ if (!node_fs.existsSync(rpcBinaryPath)) {
291
+ console.log('Falling back to RPC binary from node_modules, no file at given RPC binary path.');
292
+ rpcBinaryPath = rpcBinaryPath.replace('node_modules/electron/dist/Electron.app/Contents/Resources', 'node_modules/@nonstrict/recordkit/bin');
293
+ }
294
+ }
295
+ return this.ipcRecordKit.initialize(rpcBinaryPath, args.logRpcMessages);
265
296
  }
266
297
  async getWindows() {
267
- return await this.ipcRecordKit.nsrpc.perform({ type: 'RecordingSession', action: 'getWindows' });
298
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getWindows' });
268
299
  }
269
300
  async getCameras() {
270
- return await this.ipcRecordKit.nsrpc.perform({ type: 'RecordingSession', action: 'getCameras' });
301
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras' });
271
302
  }
272
303
  async getMicrophones() {
273
- return await this.ipcRecordKit.nsrpc.perform({ type: 'RecordingSession', action: 'getMicrophones' });
304
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getMicrophones' });
305
+ }
306
+ async getCameraAuthorizationStatus() {
307
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getCameraAuthorizationStatus' });
308
+ }
309
+ async getMicrophoneAuthorizationStatus() {
310
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getMicrophoneAuthorizationStatus' });
311
+ }
312
+ async getScreenRecordingAccess() {
313
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getScreenRecordingAccess' });
314
+ }
315
+ async requestCameraAccess() {
316
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestCameraAccess' });
317
+ }
318
+ async requestMicrophoneAccess() {
319
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestMicrophoneAccess' });
320
+ }
321
+ async requestScreenRecordingAccess() {
322
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestScreenRecordingAccess' });
274
323
  }
275
- async createSession(schema) {
276
- return RecordingSession.newInstance(this.ipcRecordKit.nsrpc, schema);
324
+ async createRecorder(schema) {
325
+ return Recorder.newInstance(this.ipcRecordKit.nsrpc, schema);
277
326
  }
278
327
  }
279
328
  let recordkit = new RecordKit();
280
329
 
281
330
  exports.recordkit = recordkit;
331
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["finalizationRegistry.js","NonstrictRPC.js","IpcRecordKit.js","Recorder.js","RecordKit.js"],"sourcesContent":["export const finalizationRegistry = new FinalizationRegistry(async (destructor) => { await destructor(); });\n//# sourceMappingURL=finalizationRegistry.js.map","import { randomUUID } from \"crypto\";\nimport { finalizationRegistry } from \"./finalizationRegistry.js\";\nexport class NSRPC {\n logMessages = false;\n send;\n responseHandlers = new Map();\n closureTargets = new Map();\n constructor(send) {\n this.send = send;\n }\n receive(data) {\n // TODO: For now we just assume the message is a valid NSRPC message, but we should:\n // - Check if the nsrpc property is set to a number in the range of 1..<2\n // - Validate the message against the defined interfaces above\n let message;\n try {\n if (this.logMessages) {\n console.log(\"< \", data.trimEnd());\n }\n message = JSON.parse(data);\n }\n catch (error) {\n if (this.logMessages) {\n console.log(\"!! Above message is invalid JSON, will be ignored.\");\n }\n return;\n }\n if (\"status\" in message) {\n // This is a response, dispatch it so it can be handled\n const responseHandler = this.responseHandlers.get(message.id);\n this.responseHandlers.delete(message.id);\n if (responseHandler === undefined) {\n // TODO: Got a response for a request we don't know about, log this\n return;\n }\n if (\"error\" in message) {\n responseHandler.reject(message.error);\n }\n else {\n responseHandler.resolve(message.result);\n }\n }\n else {\n // This is a request\n const responseBody = this.handleRequest(message);\n if (responseBody !== undefined) {\n this.sendResponse(message.id, responseBody);\n }\n }\n }\n /* Sending helpers */\n sendMessage(message) {\n const stringMessage = JSON.stringify(message);\n if (this.logMessages) {\n console.log(\"> \", stringMessage);\n }\n this.send(stringMessage);\n }\n sendResponse(id, response) {\n if (id === undefined) {\n return;\n }\n this.sendMessage({ ...response, nsrpc: 1, id });\n }\n async sendRequest(request) {\n const id = \"req_\" + randomUUID();\n const response = new Promise((resolve, reject) => {\n this.responseHandlers.set(id, { resolve, reject });\n });\n this.sendMessage({ ...request, nsrpc: 1, id });\n return response;\n }\n /* Request handling */\n handleRequest(request) {\n switch (request.procedure) {\n case \"init\":\n return {\n status: 501,\n error: {\n debugDescription: \"Init procedure not implemented.\",\n userMessage: \"Failed to communicate with external process. (Procedure not implemented)\",\n },\n };\n case \"perform\":\n if (\"action\" in request) {\n return {\n status: 501,\n error: {\n debugDescription: \"Perform procedure for (static) methods not implemented.\",\n userMessage: \"Failed to communicate with external process. (Procedure not implemented)\",\n },\n };\n }\n else {\n return this.handleClosureRequest(request);\n }\n case \"release\":\n return {\n status: 501,\n error: {\n debugDescription: \"Release procedure not implemented.\",\n userMessage: \"Failed to communicate with external process. (Procedure not implemented)\",\n },\n };\n }\n }\n handleClosureRequest(request) {\n const handler = this.closureTargets.get(request.target);\n if (handler === undefined) {\n return {\n status: 404,\n error: {\n debugDescription: `Perform target '${request.target}' not found.`,\n userMessage: \"Failed to communicate with external process. (Target not found)\",\n },\n };\n }\n try {\n const rawresult = handler(request.params ?? {});\n const result = rawresult === undefined ? undefined : rawresult;\n return {\n status: 200,\n result,\n };\n }\n catch (error) {\n return {\n status: 202,\n // 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.)\n error: {\n debugDescription: `${error}`,\n userMessage: \"Handler failed to perform request.\",\n underlyingError: error,\n },\n };\n }\n }\n /* Perform remote procedures */\n async initialize(args) {\n const target = args.target;\n finalizationRegistry.register(args.lifecycle, async () => {\n await this.release(target);\n });\n await this.sendRequest({\n target: args.target,\n type: args.type,\n params: args.params,\n procedure: \"init\",\n });\n }\n async perform(body) {\n return await this.sendRequest({\n ...body,\n procedure: \"perform\",\n });\n }\n async release(target) {\n await this.sendRequest({\n procedure: \"release\",\n target,\n });\n }\n /* Register locally available targets/actions */\n registerClosure(options) {\n const target = `target_${options.prefix}_${randomUUID()}`;\n this.closureTargets.set(target, options.handler);\n finalizationRegistry.register(options.lifecycle, () => {\n this.closureTargets.delete(target);\n });\n return target;\n }\n}\n//# sourceMappingURL=NonstrictRPC.js.map","import { spawn } from 'node:child_process';\nimport * as readline from 'readline';\nimport { NSRPC } from \"./NonstrictRPC.js\";\nexport class IpcRecordKit {\n childProcess;\n nsrpc;\n constructor() {\n this.nsrpc = new NSRPC((message) => this.write(message));\n }\n async initialize(recordKitRpcPath, logMessages = false) {\n if (this.childProcess !== undefined) {\n throw new Error('RecordKit RPC: Already initialized.');\n }\n this.nsrpc.logMessages = logMessages;\n this.childProcess = await new Promise((resolve, reject) => {\n const childProcess = spawn(recordKitRpcPath);\n childProcess.on('spawn', () => { resolve(childProcess); });\n childProcess.on('error', (error) => { reject(error); });\n });\n const { stdout } = this.childProcess;\n if (!stdout) {\n throw new Error('RecordKit RPC: No stdout stream on child process.');\n }\n readline.createInterface({ input: stdout }).on('line', (line) => {\n this.nsrpc.receive(line);\n });\n }\n write(message) {\n const stdin = this.childProcess?.stdin;\n if (!stdin) {\n throw new Error('RecordKit RPC: Missing stdin stream.');\n }\n stdin.write(message + \"\\n\");\n }\n}\n//# sourceMappingURL=IpcRecordKit.js.map","import { randomUUID } from \"crypto\";\nimport { EventEmitter } from \"stream\";\nexport class Recorder extends EventEmitter {\n rpc;\n target;\n static async newInstance(rpc, schema) {\n const target = 'Recorder_' + randomUUID();\n const object = new Recorder(rpc, target);\n schema.items.forEach(item => {\n if (item.type == 'webcam') {\n if (typeof item.camera != 'string') {\n item.camera = item.camera.id;\n }\n if (typeof item.microphone != 'string') {\n item.microphone = item.microphone.id;\n }\n }\n if (item.type == 'windowBasedCrop') {\n if (typeof item.window != 'number') {\n item.window = item.window.id;\n }\n }\n });\n const weakRefObject = new WeakRef(object);\n const onAbortInstance = rpc.registerClosure({\n handler: (params) => { weakRefObject.deref()?.emit('abort', params.reason); },\n prefix: 'Recorder.onAbort',\n lifecycle: object\n });\n await rpc.initialize({\n target,\n type: 'Recorder',\n params: { schema, onAbortInstance },\n lifecycle: object\n });\n return object;\n }\n constructor(rpc, target) {\n super();\n this.rpc = rpc;\n this.target = target;\n }\n async prepare() {\n await this.rpc.perform({ target: this.target, action: 'prepare' });\n }\n async start() {\n await this.rpc.perform({ target: this.target, action: 'start' });\n }\n async stop() {\n return await this.rpc.perform({ target: this.target, action: 'stop' });\n }\n}\n//# sourceMappingURL=Recorder.js.map","import { IpcRecordKit } from \"./IpcRecordKit.js\";\nimport { Recorder } from \"./Recorder.js\";\nimport { existsSync } from \"node:fs\";\nexport class RecordKit {\n ipcRecordKit = new IpcRecordKit();\n async initialize(args) {\n let rpcBinaryPath = args.rpcBinaryPath;\n if (args.fallbackToNodeModules) {\n if (!existsSync(rpcBinaryPath)) {\n console.log('Falling back to RPC binary from node_modules, no file at given RPC binary path.');\n rpcBinaryPath = rpcBinaryPath.replace('node_modules/electron/dist/Electron.app/Contents/Resources', 'node_modules/@nonstrict/recordkit/bin');\n }\n }\n return this.ipcRecordKit.initialize(rpcBinaryPath, args.logRpcMessages);\n }\n async getWindows() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getWindows' });\n }\n async getCameras() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras' });\n }\n async getMicrophones() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getMicrophones' });\n }\n async getCameraAuthorizationStatus() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getCameraAuthorizationStatus' });\n }\n async getMicrophoneAuthorizationStatus() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getMicrophoneAuthorizationStatus' });\n }\n async getScreenRecordingAccess() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getScreenRecordingAccess' });\n }\n async requestCameraAccess() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestCameraAccess' });\n }\n async requestMicrophoneAccess() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestMicrophoneAccess' });\n }\n async requestScreenRecordingAccess() {\n return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestScreenRecordingAccess' });\n }\n async createRecorder(schema) {\n return Recorder.newInstance(this.ipcRecordKit.nsrpc, schema);\n }\n}\nexport let recordkit = new RecordKit();\n//# sourceMappingURL=RecordKit.js.map"],"names":["randomUUID","spawn","readline","EventEmitter","existsSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,OAAO,UAAU,KAAK,EAAE,MAAM,UAAU,EAAE,CAAC,EAAE,CAAC;;ACEpG,MAAM,KAAK,CAAC;AACnB,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,IAAI,CAAC;AACT,IAAI,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;AACjC,IAAI,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,IAAI,WAAW,CAAC,IAAI,EAAE;AACtB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACzB,KAAK;AACL,IAAI,OAAO,CAAC,IAAI,EAAE;AAClB;AACA;AACA;AACA,QAAQ,IAAI,OAAO,CAAC;AACpB,QAAQ,IAAI;AACZ,YAAY,IAAI,IAAI,CAAC,WAAW,EAAE;AAClC,gBAAgB,OAAO,CAAC,GAAG,CA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,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACzH,KAAK;AACL,IAAI,MAAM,4BAA4B,GAAG;AACzC,QAAQ,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC,CAAC;AAC9H,KAAK;AACL,IAAI,MAAM,cAAc,CAAC,MAAM,EAAE;AACjC,QAAQ,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACrE,KAAK;AACL,CAAC;AACS,IAAC,SAAS,GAAG,IAAI,SAAS;;;;"}
package/out/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type * from './RecordKit.js';
2
+ export type * from './Recorder.js';
3
+ export { recordkit } from './RecordKit.js';
@@ -1 +1,2 @@
1
1
  export { recordkit } from './RecordKit.js';
2
+ //# sourceMappingURL=index.js.map