@recappi/sdk 0.0.0 → 1.0.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 CHANGED
@@ -9,50 +9,66 @@
9
9
  Both input and output devices are recording, mixed into a single audio stream.
10
10
 
11
11
  ```ts
12
- import { writeFile } from 'node:fs/promises';
13
- import { setTimeout } from 'node:timers/promises';
12
+ import { writeFile } from "node:fs/promises";
13
+ import { setTimeout } from "node:timers/promises";
14
14
 
15
- import { ShareableContent } from '@recappi/sdk';
16
- import { createWavBuffer } from '@recappi/sdk/encode-wav';
15
+ import { ShareableContent } from "@recappi/sdk";
16
+ import { createWavBuffer } from "@recappi/sdk/encode-wav";
17
17
 
18
- const WavBuffers = []
18
+ const WavBuffers = [];
19
19
 
20
20
  let totalLength = 0;
21
21
 
22
22
  const session = ShareableContent.tapGlobalAudio([], (err, samples) => {
23
23
  if (err) {
24
- console.error('Error capturing audio:', err);
24
+ console.error("Error capturing audio:", err);
25
25
  return;
26
26
  }
27
27
  WavBuffers.push(samples);
28
28
  totalLength += samples.length;
29
29
  });
30
30
 
31
- console.info('Recording audio for 5 seconds...');
31
+ console.info("Recording audio for 5 seconds...");
32
32
 
33
33
  await setTimeout(5000); // Record for 5 seconds
34
34
 
35
35
  session.stop();
36
36
 
37
- console.info(`Recording stopped. Writing ${totalLength} samples to output.wav...`);
38
-
39
- const { buf: contactedBuffer } = WavBuffers.reduce(({ buf, offset }, cur) => {
40
- buf.set(cur, offset);
41
- return {
42
- buf,
43
- offset: offset + cur.length,
44
- }
45
- }, {
46
- buf: new Float32Array(totalLength),
47
- offset: 0,
48
- });
37
+ console.info(
38
+ `Recording stopped. Writing ${totalLength} samples to output.wav...`,
39
+ );
40
+
41
+ const { buf: contactedBuffer } = WavBuffers.reduce(
42
+ ({ buf, offset }, cur) => {
43
+ buf.set(cur, offset);
44
+ return {
45
+ buf,
46
+ offset: offset + cur.length,
47
+ };
48
+ },
49
+ {
50
+ buf: new Float32Array(totalLength),
51
+ offset: 0,
52
+ },
53
+ );
49
54
 
50
55
  console.log(`Creating WAV buffer ...`);
51
56
 
52
- const wavBuffer = Buffer.from(createWavBuffer(contactedBuffer, {
53
- sampleRate: session.sampleRate,
54
- numChannels: session.channels,
55
- }))
57
+ const wavBuffer = Buffer.from(
58
+ createWavBuffer(contactedBuffer, {
59
+ sampleRate: session.sampleRate,
60
+ numChannels: session.channels,
61
+ }),
62
+ );
63
+
64
+ await writeFile("output.wav", wavBuffer);
65
+ ```
66
+
67
+ ## Playground
56
68
 
57
- await writeFile('output.wav', wavBuffer);
69
+ ```sh
70
+ yarn install
71
+ yarn build
72
+ yarn workspace playground dev:server
73
+ yarn workspace playground dev:web
58
74
  ```
package/index.cjs CHANGED
@@ -4,553 +4,758 @@
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
6
  const { readFileSync } = require('node:fs')
7
- let nativeBinding = null
8
- const loadErrors = []
7
+ let nativeBinding = null;
8
+ const loadErrors = [];
9
9
 
10
10
  const isMusl = () => {
11
- let musl = false
12
- if (process.platform === 'linux') {
13
- musl = isMuslFromFilesystem()
11
+ let musl = false;
12
+ if (process.platform === "linux") {
13
+ musl = isMuslFromFilesystem();
14
14
  if (musl === null) {
15
- musl = isMuslFromReport()
15
+ musl = isMuslFromReport();
16
16
  }
17
17
  if (musl === null) {
18
- musl = isMuslFromChildProcess()
18
+ musl = isMuslFromChildProcess();
19
19
  }
20
20
  }
21
- return musl
22
- }
21
+ return musl;
22
+ };
23
23
 
24
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
24
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
25
25
 
26
26
  const isMuslFromFilesystem = () => {
27
27
  try {
28
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
28
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
29
29
  } catch {
30
- return null
30
+ return null;
31
31
  }
32
- }
32
+ };
33
33
 
34
34
  const isMuslFromReport = () => {
35
- let report = null
36
- if (typeof process.report?.getReport === 'function') {
37
- process.report.excludeNetwork = true
38
- report = process.report.getReport()
35
+ let report = null;
36
+ if (typeof process.report?.getReport === "function") {
37
+ process.report.excludeNetwork = true;
38
+ report = process.report.getReport();
39
39
  }
40
40
  if (!report) {
41
- return null
41
+ return null;
42
42
  }
43
43
  if (report.header && report.header.glibcVersionRuntime) {
44
- return false
44
+ return false;
45
45
  }
46
46
  if (Array.isArray(report.sharedObjects)) {
47
47
  if (report.sharedObjects.some(isFileMusl)) {
48
- return true
48
+ return true;
49
49
  }
50
50
  }
51
- return false
52
- }
51
+ return false;
52
+ };
53
53
 
54
54
  const isMuslFromChildProcess = () => {
55
55
  try {
56
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
56
+ return require("child_process")
57
+ .execSync("ldd --version", { encoding: "utf8" })
58
+ .includes("musl");
57
59
  } catch (e) {
58
60
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
59
- return false
61
+ return false;
60
62
  }
61
- }
63
+ };
62
64
 
63
65
  function requireNative() {
64
66
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
67
  try {
66
68
  return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
67
69
  } catch (err) {
68
- loadErrors.push(err)
70
+ loadErrors.push(err);
69
71
  }
70
- } else if (process.platform === 'android') {
71
- if (process.arch === 'arm64') {
72
+ } else if (process.platform === "android") {
73
+ if (process.arch === "arm64") {
72
74
  try {
73
- return require('./recording.android-arm64.node')
75
+ return require("./recording.android-arm64.node");
74
76
  } catch (e) {
75
- loadErrors.push(e)
77
+ loadErrors.push(e);
76
78
  }
77
79
  try {
78
- const binding = require('@recappi/sdk-android-arm64')
79
- const bindingPackageVersion = require('@recappi/sdk-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
- }
83
- return binding
80
+ const binding = require("@recappi/sdk-android-arm64");
81
+ const bindingPackageVersion =
82
+ require("@recappi/sdk-android-arm64/package.json").version;
83
+ if (
84
+ bindingPackageVersion !== "1.0.0" &&
85
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
86
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
87
+ ) {
88
+ throw new Error(
89
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
90
+ );
91
+ }
92
+ return binding;
84
93
  } catch (e) {
85
- loadErrors.push(e)
94
+ loadErrors.push(e);
86
95
  }
87
- } else if (process.arch === 'arm') {
96
+ } else if (process.arch === "arm") {
88
97
  try {
89
- return require('./recording.android-arm-eabi.node')
98
+ return require("./recording.android-arm-eabi.node");
90
99
  } catch (e) {
91
- loadErrors.push(e)
100
+ loadErrors.push(e);
92
101
  }
93
102
  try {
94
- const binding = require('@recappi/sdk-android-arm-eabi')
95
- const bindingPackageVersion = require('@recappi/sdk-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
- }
99
- return binding
103
+ const binding = require("@recappi/sdk-android-arm-eabi");
104
+ const bindingPackageVersion =
105
+ require("@recappi/sdk-android-arm-eabi/package.json").version;
106
+ if (
107
+ bindingPackageVersion !== "1.0.0" &&
108
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
109
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
110
+ ) {
111
+ throw new Error(
112
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
113
+ );
114
+ }
115
+ return binding;
100
116
  } catch (e) {
101
- loadErrors.push(e)
117
+ loadErrors.push(e);
102
118
  }
103
119
  } else {
104
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
120
+ loadErrors.push(
121
+ new Error(`Unsupported architecture on Android ${process.arch}`),
122
+ );
105
123
  }
106
- } else if (process.platform === 'win32') {
107
- if (process.arch === 'x64') {
108
- if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
124
+ } else if (process.platform === "win32") {
125
+ if (process.arch === "x64") {
126
+ if (
127
+ process.config?.variables?.shlib_suffix === "dll.a" ||
128
+ process.config?.variables?.node_target_type === "shared_library"
129
+ ) {
109
130
  try {
110
- return require('./recording.win32-x64-gnu.node')
111
- } catch (e) {
112
- loadErrors.push(e)
113
- }
114
- try {
115
- const binding = require('@recappi/sdk-win32-x64-gnu')
116
- const bindingPackageVersion = require('@recappi/sdk-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
+ return require("./recording.win32-x64-gnu.node");
132
+ } catch (e) {
133
+ loadErrors.push(e);
134
+ }
135
+ try {
136
+ const binding = require("@recappi/sdk-win32-x64-gnu");
137
+ const bindingPackageVersion =
138
+ require("@recappi/sdk-win32-x64-gnu/package.json").version;
139
+ if (
140
+ bindingPackageVersion !== "1.0.0" &&
141
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
142
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
143
+ ) {
144
+ throw new Error(
145
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
146
+ );
147
+ }
148
+ return binding;
149
+ } catch (e) {
150
+ loadErrors.push(e);
119
151
  }
120
- return binding
121
- } catch (e) {
122
- loadErrors.push(e)
123
- }
124
152
  } else {
125
153
  try {
126
- return require('./recording.win32-x64-msvc.node')
127
- } catch (e) {
128
- loadErrors.push(e)
129
- }
130
- try {
131
- const binding = require('@recappi/sdk-win32-x64-msvc')
132
- const bindingPackageVersion = require('@recappi/sdk-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ return require("./recording.win32-x64-msvc.node");
155
+ } catch (e) {
156
+ loadErrors.push(e);
157
+ }
158
+ try {
159
+ const binding = require("@recappi/sdk-win32-x64-msvc");
160
+ const bindingPackageVersion =
161
+ require("@recappi/sdk-win32-x64-msvc/package.json").version;
162
+ if (
163
+ bindingPackageVersion !== "1.0.0" &&
164
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
165
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
166
+ ) {
167
+ throw new Error(
168
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
169
+ );
170
+ }
171
+ return binding;
172
+ } catch (e) {
173
+ loadErrors.push(e);
135
174
  }
136
- return binding
137
- } catch (e) {
138
- loadErrors.push(e)
139
- }
140
175
  }
141
- } else if (process.arch === 'ia32') {
176
+ } else if (process.arch === "ia32") {
142
177
  try {
143
- return require('./recording.win32-ia32-msvc.node')
178
+ return require("./recording.win32-ia32-msvc.node");
144
179
  } catch (e) {
145
- loadErrors.push(e)
180
+ loadErrors.push(e);
146
181
  }
147
182
  try {
148
- const binding = require('@recappi/sdk-win32-ia32-msvc')
149
- const bindingPackageVersion = require('@recappi/sdk-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
- }
153
- return binding
183
+ const binding = require("@recappi/sdk-win32-ia32-msvc");
184
+ const bindingPackageVersion =
185
+ require("@recappi/sdk-win32-ia32-msvc/package.json").version;
186
+ if (
187
+ bindingPackageVersion !== "1.0.0" &&
188
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
189
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
190
+ ) {
191
+ throw new Error(
192
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
193
+ );
194
+ }
195
+ return binding;
154
196
  } catch (e) {
155
- loadErrors.push(e)
197
+ loadErrors.push(e);
156
198
  }
157
- } else if (process.arch === 'arm64') {
199
+ } else if (process.arch === "arm64") {
158
200
  try {
159
- return require('./recording.win32-arm64-msvc.node')
201
+ return require("./recording.win32-arm64-msvc.node");
160
202
  } catch (e) {
161
- loadErrors.push(e)
203
+ loadErrors.push(e);
162
204
  }
163
205
  try {
164
- const binding = require('@recappi/sdk-win32-arm64-msvc')
165
- const bindingPackageVersion = require('@recappi/sdk-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
- }
169
- return binding
206
+ const binding = require("@recappi/sdk-win32-arm64-msvc");
207
+ const bindingPackageVersion =
208
+ require("@recappi/sdk-win32-arm64-msvc/package.json").version;
209
+ if (
210
+ bindingPackageVersion !== "1.0.0" &&
211
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
212
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
213
+ ) {
214
+ throw new Error(
215
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
216
+ );
217
+ }
218
+ return binding;
170
219
  } catch (e) {
171
- loadErrors.push(e)
220
+ loadErrors.push(e);
172
221
  }
173
222
  } else {
174
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
223
+ loadErrors.push(
224
+ new Error(`Unsupported architecture on Windows: ${process.arch}`),
225
+ );
175
226
  }
176
- } else if (process.platform === 'darwin') {
227
+ } else if (process.platform === "darwin") {
177
228
  try {
178
- return require('./recording.darwin-universal.node')
229
+ return require("./recording.darwin-universal.node");
179
230
  } catch (e) {
180
- loadErrors.push(e)
231
+ loadErrors.push(e);
181
232
  }
182
233
  try {
183
- const binding = require('@recappi/sdk-darwin-universal')
184
- const bindingPackageVersion = require('@recappi/sdk-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
- }
188
- return binding
234
+ const binding = require("@recappi/sdk-darwin-universal");
235
+ const bindingPackageVersion =
236
+ require("@recappi/sdk-darwin-universal/package.json").version;
237
+ if (
238
+ bindingPackageVersion !== "1.0.0" &&
239
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
240
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
241
+ ) {
242
+ throw new Error(
243
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
244
+ );
245
+ }
246
+ return binding;
189
247
  } catch (e) {
190
- loadErrors.push(e)
248
+ loadErrors.push(e);
191
249
  }
192
- if (process.arch === 'x64') {
250
+ if (process.arch === "x64") {
193
251
  try {
194
- return require('./recording.darwin-x64.node')
252
+ return require("./recording.darwin-x64.node");
195
253
  } catch (e) {
196
- loadErrors.push(e)
254
+ loadErrors.push(e);
197
255
  }
198
256
  try {
199
- const binding = require('@recappi/sdk-darwin-x64')
200
- const bindingPackageVersion = require('@recappi/sdk-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
- }
204
- return binding
257
+ const binding = require("@recappi/sdk-darwin-x64");
258
+ const bindingPackageVersion =
259
+ require("@recappi/sdk-darwin-x64/package.json").version;
260
+ if (
261
+ bindingPackageVersion !== "1.0.0" &&
262
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
263
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
264
+ ) {
265
+ throw new Error(
266
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
267
+ );
268
+ }
269
+ return binding;
205
270
  } catch (e) {
206
- loadErrors.push(e)
271
+ loadErrors.push(e);
207
272
  }
208
- } else if (process.arch === 'arm64') {
273
+ } else if (process.arch === "arm64") {
209
274
  try {
210
- return require('./recording.darwin-arm64.node')
275
+ return require("./recording.darwin-arm64.node");
211
276
  } catch (e) {
212
- loadErrors.push(e)
277
+ loadErrors.push(e);
213
278
  }
214
279
  try {
215
- const binding = require('@recappi/sdk-darwin-arm64')
216
- const bindingPackageVersion = require('@recappi/sdk-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
- }
220
- return binding
280
+ const binding = require("@recappi/sdk-darwin-arm64");
281
+ const bindingPackageVersion =
282
+ require("@recappi/sdk-darwin-arm64/package.json").version;
283
+ if (
284
+ bindingPackageVersion !== "1.0.0" &&
285
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
286
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
287
+ ) {
288
+ throw new Error(
289
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
290
+ );
291
+ }
292
+ return binding;
221
293
  } catch (e) {
222
- loadErrors.push(e)
294
+ loadErrors.push(e);
223
295
  }
224
296
  } else {
225
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
297
+ loadErrors.push(
298
+ new Error(`Unsupported architecture on macOS: ${process.arch}`),
299
+ );
226
300
  }
227
- } else if (process.platform === 'freebsd') {
228
- if (process.arch === 'x64') {
301
+ } else if (process.platform === "freebsd") {
302
+ if (process.arch === "x64") {
229
303
  try {
230
- return require('./recording.freebsd-x64.node')
304
+ return require("./recording.freebsd-x64.node");
231
305
  } catch (e) {
232
- loadErrors.push(e)
306
+ loadErrors.push(e);
233
307
  }
234
308
  try {
235
- const binding = require('@recappi/sdk-freebsd-x64')
236
- const bindingPackageVersion = require('@recappi/sdk-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
- }
240
- return binding
309
+ const binding = require("@recappi/sdk-freebsd-x64");
310
+ const bindingPackageVersion =
311
+ require("@recappi/sdk-freebsd-x64/package.json").version;
312
+ if (
313
+ bindingPackageVersion !== "1.0.0" &&
314
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
315
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
316
+ ) {
317
+ throw new Error(
318
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
319
+ );
320
+ }
321
+ return binding;
241
322
  } catch (e) {
242
- loadErrors.push(e)
323
+ loadErrors.push(e);
243
324
  }
244
- } else if (process.arch === 'arm64') {
325
+ } else if (process.arch === "arm64") {
245
326
  try {
246
- return require('./recording.freebsd-arm64.node')
327
+ return require("./recording.freebsd-arm64.node");
247
328
  } catch (e) {
248
- loadErrors.push(e)
329
+ loadErrors.push(e);
249
330
  }
250
331
  try {
251
- const binding = require('@recappi/sdk-freebsd-arm64')
252
- const bindingPackageVersion = require('@recappi/sdk-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
- }
256
- return binding
332
+ const binding = require("@recappi/sdk-freebsd-arm64");
333
+ const bindingPackageVersion =
334
+ require("@recappi/sdk-freebsd-arm64/package.json").version;
335
+ if (
336
+ bindingPackageVersion !== "1.0.0" &&
337
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
338
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
339
+ ) {
340
+ throw new Error(
341
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
342
+ );
343
+ }
344
+ return binding;
257
345
  } catch (e) {
258
- loadErrors.push(e)
346
+ loadErrors.push(e);
259
347
  }
260
348
  } else {
261
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
349
+ loadErrors.push(
350
+ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`),
351
+ );
262
352
  }
263
- } else if (process.platform === 'linux') {
264
- if (process.arch === 'x64') {
353
+ } else if (process.platform === "linux") {
354
+ if (process.arch === "x64") {
265
355
  if (isMusl()) {
266
356
  try {
267
- return require('./recording.linux-x64-musl.node')
357
+ return require("./recording.linux-x64-musl.node");
268
358
  } catch (e) {
269
- loadErrors.push(e)
359
+ loadErrors.push(e);
270
360
  }
271
361
  try {
272
- const binding = require('@recappi/sdk-linux-x64-musl')
273
- const bindingPackageVersion = require('@recappi/sdk-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ const binding = require("@recappi/sdk-linux-x64-musl");
363
+ const bindingPackageVersion =
364
+ require("@recappi/sdk-linux-x64-musl/package.json").version;
365
+ if (
366
+ bindingPackageVersion !== "1.0.0" &&
367
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
369
+ ) {
370
+ throw new Error(
371
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
+ );
276
373
  }
277
- return binding
374
+ return binding;
278
375
  } catch (e) {
279
- loadErrors.push(e)
376
+ loadErrors.push(e);
280
377
  }
281
378
  } else {
282
379
  try {
283
- return require('./recording.linux-x64-gnu.node')
380
+ return require("./recording.linux-x64-gnu.node");
284
381
  } catch (e) {
285
- loadErrors.push(e)
382
+ loadErrors.push(e);
286
383
  }
287
384
  try {
288
- const binding = require('@recappi/sdk-linux-x64-gnu')
289
- const bindingPackageVersion = require('@recappi/sdk-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
385
+ const binding = require("@recappi/sdk-linux-x64-gnu");
386
+ const bindingPackageVersion =
387
+ require("@recappi/sdk-linux-x64-gnu/package.json").version;
388
+ if (
389
+ bindingPackageVersion !== "1.0.0" &&
390
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
391
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
392
+ ) {
393
+ throw new Error(
394
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
395
+ );
292
396
  }
293
- return binding
397
+ return binding;
294
398
  } catch (e) {
295
- loadErrors.push(e)
399
+ loadErrors.push(e);
296
400
  }
297
401
  }
298
- } else if (process.arch === 'arm64') {
402
+ } else if (process.arch === "arm64") {
299
403
  if (isMusl()) {
300
404
  try {
301
- return require('./recording.linux-arm64-musl.node')
405
+ return require("./recording.linux-arm64-musl.node");
302
406
  } catch (e) {
303
- loadErrors.push(e)
407
+ loadErrors.push(e);
304
408
  }
305
409
  try {
306
- const binding = require('@recappi/sdk-linux-arm64-musl')
307
- const bindingPackageVersion = require('@recappi/sdk-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ const binding = require("@recappi/sdk-linux-arm64-musl");
411
+ const bindingPackageVersion =
412
+ require("@recappi/sdk-linux-arm64-musl/package.json").version;
413
+ if (
414
+ bindingPackageVersion !== "1.0.0" &&
415
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
416
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
417
+ ) {
418
+ throw new Error(
419
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
420
+ );
310
421
  }
311
- return binding
422
+ return binding;
312
423
  } catch (e) {
313
- loadErrors.push(e)
424
+ loadErrors.push(e);
314
425
  }
315
426
  } else {
316
427
  try {
317
- return require('./recording.linux-arm64-gnu.node')
428
+ return require("./recording.linux-arm64-gnu.node");
318
429
  } catch (e) {
319
- loadErrors.push(e)
430
+ loadErrors.push(e);
320
431
  }
321
432
  try {
322
- const binding = require('@recappi/sdk-linux-arm64-gnu')
323
- const bindingPackageVersion = require('@recappi/sdk-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
433
+ const binding = require("@recappi/sdk-linux-arm64-gnu");
434
+ const bindingPackageVersion =
435
+ require("@recappi/sdk-linux-arm64-gnu/package.json").version;
436
+ if (
437
+ bindingPackageVersion !== "1.0.0" &&
438
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
439
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
440
+ ) {
441
+ throw new Error(
442
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
443
+ );
326
444
  }
327
- return binding
445
+ return binding;
328
446
  } catch (e) {
329
- loadErrors.push(e)
447
+ loadErrors.push(e);
330
448
  }
331
449
  }
332
- } else if (process.arch === 'arm') {
450
+ } else if (process.arch === "arm") {
333
451
  if (isMusl()) {
334
452
  try {
335
- return require('./recording.linux-arm-musleabihf.node')
453
+ return require("./recording.linux-arm-musleabihf.node");
336
454
  } catch (e) {
337
- loadErrors.push(e)
455
+ loadErrors.push(e);
338
456
  }
339
457
  try {
340
- const binding = require('@recappi/sdk-linux-arm-musleabihf')
341
- const bindingPackageVersion = require('@recappi/sdk-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
458
+ const binding = require("@recappi/sdk-linux-arm-musleabihf");
459
+ const bindingPackageVersion =
460
+ require("@recappi/sdk-linux-arm-musleabihf/package.json").version;
461
+ if (
462
+ bindingPackageVersion !== "1.0.0" &&
463
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
464
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
465
+ ) {
466
+ throw new Error(
467
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
468
+ );
344
469
  }
345
- return binding
470
+ return binding;
346
471
  } catch (e) {
347
- loadErrors.push(e)
472
+ loadErrors.push(e);
348
473
  }
349
474
  } else {
350
475
  try {
351
- return require('./recording.linux-arm-gnueabihf.node')
476
+ return require("./recording.linux-arm-gnueabihf.node");
352
477
  } catch (e) {
353
- loadErrors.push(e)
478
+ loadErrors.push(e);
354
479
  }
355
480
  try {
356
- const binding = require('@recappi/sdk-linux-arm-gnueabihf')
357
- const bindingPackageVersion = require('@recappi/sdk-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
+ const binding = require("@recappi/sdk-linux-arm-gnueabihf");
482
+ const bindingPackageVersion =
483
+ require("@recappi/sdk-linux-arm-gnueabihf/package.json").version;
484
+ if (
485
+ bindingPackageVersion !== "1.0.0" &&
486
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
487
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
488
+ ) {
489
+ throw new Error(
490
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
491
+ );
360
492
  }
361
- return binding
493
+ return binding;
362
494
  } catch (e) {
363
- loadErrors.push(e)
495
+ loadErrors.push(e);
364
496
  }
365
497
  }
366
- } else if (process.arch === 'loong64') {
498
+ } else if (process.arch === "loong64") {
367
499
  if (isMusl()) {
368
500
  try {
369
- return require('./recording.linux-loong64-musl.node')
501
+ return require("./recording.linux-loong64-musl.node");
370
502
  } catch (e) {
371
- loadErrors.push(e)
503
+ loadErrors.push(e);
372
504
  }
373
505
  try {
374
- const binding = require('@recappi/sdk-linux-loong64-musl')
375
- const bindingPackageVersion = require('@recappi/sdk-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
506
+ const binding = require("@recappi/sdk-linux-loong64-musl");
507
+ const bindingPackageVersion =
508
+ require("@recappi/sdk-linux-loong64-musl/package.json").version;
509
+ if (
510
+ bindingPackageVersion !== "1.0.0" &&
511
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
512
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
513
+ ) {
514
+ throw new Error(
515
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
516
+ );
378
517
  }
379
- return binding
518
+ return binding;
380
519
  } catch (e) {
381
- loadErrors.push(e)
520
+ loadErrors.push(e);
382
521
  }
383
522
  } else {
384
523
  try {
385
- return require('./recording.linux-loong64-gnu.node')
524
+ return require("./recording.linux-loong64-gnu.node");
386
525
  } catch (e) {
387
- loadErrors.push(e)
526
+ loadErrors.push(e);
388
527
  }
389
528
  try {
390
- const binding = require('@recappi/sdk-linux-loong64-gnu')
391
- const bindingPackageVersion = require('@recappi/sdk-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
529
+ const binding = require("@recappi/sdk-linux-loong64-gnu");
530
+ const bindingPackageVersion =
531
+ require("@recappi/sdk-linux-loong64-gnu/package.json").version;
532
+ if (
533
+ bindingPackageVersion !== "1.0.0" &&
534
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
535
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
536
+ ) {
537
+ throw new Error(
538
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
539
+ );
394
540
  }
395
- return binding
541
+ return binding;
396
542
  } catch (e) {
397
- loadErrors.push(e)
543
+ loadErrors.push(e);
398
544
  }
399
545
  }
400
- } else if (process.arch === 'riscv64') {
546
+ } else if (process.arch === "riscv64") {
401
547
  if (isMusl()) {
402
548
  try {
403
- return require('./recording.linux-riscv64-musl.node')
549
+ return require("./recording.linux-riscv64-musl.node");
404
550
  } catch (e) {
405
- loadErrors.push(e)
551
+ loadErrors.push(e);
406
552
  }
407
553
  try {
408
- const binding = require('@recappi/sdk-linux-riscv64-musl')
409
- const bindingPackageVersion = require('@recappi/sdk-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
554
+ const binding = require("@recappi/sdk-linux-riscv64-musl");
555
+ const bindingPackageVersion =
556
+ require("@recappi/sdk-linux-riscv64-musl/package.json").version;
557
+ if (
558
+ bindingPackageVersion !== "1.0.0" &&
559
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
560
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
561
+ ) {
562
+ throw new Error(
563
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
564
+ );
412
565
  }
413
- return binding
566
+ return binding;
414
567
  } catch (e) {
415
- loadErrors.push(e)
568
+ loadErrors.push(e);
416
569
  }
417
570
  } else {
418
571
  try {
419
- return require('./recording.linux-riscv64-gnu.node')
572
+ return require("./recording.linux-riscv64-gnu.node");
420
573
  } catch (e) {
421
- loadErrors.push(e)
574
+ loadErrors.push(e);
422
575
  }
423
576
  try {
424
- const binding = require('@recappi/sdk-linux-riscv64-gnu')
425
- const bindingPackageVersion = require('@recappi/sdk-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
577
+ const binding = require("@recappi/sdk-linux-riscv64-gnu");
578
+ const bindingPackageVersion =
579
+ require("@recappi/sdk-linux-riscv64-gnu/package.json").version;
580
+ if (
581
+ bindingPackageVersion !== "1.0.0" &&
582
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
583
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
584
+ ) {
585
+ throw new Error(
586
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
587
+ );
428
588
  }
429
- return binding
589
+ return binding;
430
590
  } catch (e) {
431
- loadErrors.push(e)
591
+ loadErrors.push(e);
432
592
  }
433
593
  }
434
- } else if (process.arch === 'ppc64') {
594
+ } else if (process.arch === "ppc64") {
435
595
  try {
436
- return require('./recording.linux-ppc64-gnu.node')
596
+ return require("./recording.linux-ppc64-gnu.node");
437
597
  } catch (e) {
438
- loadErrors.push(e)
598
+ loadErrors.push(e);
439
599
  }
440
600
  try {
441
- const binding = require('@recappi/sdk-linux-ppc64-gnu')
442
- const bindingPackageVersion = require('@recappi/sdk-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
- }
446
- return binding
601
+ const binding = require("@recappi/sdk-linux-ppc64-gnu");
602
+ const bindingPackageVersion =
603
+ require("@recappi/sdk-linux-ppc64-gnu/package.json").version;
604
+ if (
605
+ bindingPackageVersion !== "1.0.0" &&
606
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
607
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
608
+ ) {
609
+ throw new Error(
610
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
611
+ );
612
+ }
613
+ return binding;
447
614
  } catch (e) {
448
- loadErrors.push(e)
615
+ loadErrors.push(e);
449
616
  }
450
- } else if (process.arch === 's390x') {
617
+ } else if (process.arch === "s390x") {
451
618
  try {
452
- return require('./recording.linux-s390x-gnu.node')
619
+ return require("./recording.linux-s390x-gnu.node");
453
620
  } catch (e) {
454
- loadErrors.push(e)
621
+ loadErrors.push(e);
455
622
  }
456
623
  try {
457
- const binding = require('@recappi/sdk-linux-s390x-gnu')
458
- const bindingPackageVersion = require('@recappi/sdk-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
- }
462
- return binding
624
+ const binding = require("@recappi/sdk-linux-s390x-gnu");
625
+ const bindingPackageVersion =
626
+ require("@recappi/sdk-linux-s390x-gnu/package.json").version;
627
+ if (
628
+ bindingPackageVersion !== "1.0.0" &&
629
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
630
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
631
+ ) {
632
+ throw new Error(
633
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
634
+ );
635
+ }
636
+ return binding;
463
637
  } catch (e) {
464
- loadErrors.push(e)
638
+ loadErrors.push(e);
465
639
  }
466
640
  } else {
467
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
641
+ loadErrors.push(
642
+ new Error(`Unsupported architecture on Linux: ${process.arch}`),
643
+ );
468
644
  }
469
- } else if (process.platform === 'openharmony') {
470
- if (process.arch === 'arm64') {
645
+ } else if (process.platform === "openharmony") {
646
+ if (process.arch === "arm64") {
471
647
  try {
472
- return require('./recording.openharmony-arm64.node')
648
+ return require("./recording.openharmony-arm64.node");
473
649
  } catch (e) {
474
- loadErrors.push(e)
650
+ loadErrors.push(e);
475
651
  }
476
652
  try {
477
- const binding = require('@recappi/sdk-openharmony-arm64')
478
- const bindingPackageVersion = require('@recappi/sdk-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
- }
482
- return binding
653
+ const binding = require("@recappi/sdk-openharmony-arm64");
654
+ const bindingPackageVersion =
655
+ require("@recappi/sdk-openharmony-arm64/package.json").version;
656
+ if (
657
+ bindingPackageVersion !== "1.0.0" &&
658
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
659
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
660
+ ) {
661
+ throw new Error(
662
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
663
+ );
664
+ }
665
+ return binding;
483
666
  } catch (e) {
484
- loadErrors.push(e)
667
+ loadErrors.push(e);
485
668
  }
486
- } else if (process.arch === 'x64') {
669
+ } else if (process.arch === "x64") {
487
670
  try {
488
- return require('./recording.openharmony-x64.node')
671
+ return require("./recording.openharmony-x64.node");
489
672
  } catch (e) {
490
- loadErrors.push(e)
673
+ loadErrors.push(e);
491
674
  }
492
675
  try {
493
- const binding = require('@recappi/sdk-openharmony-x64')
494
- const bindingPackageVersion = require('@recappi/sdk-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
- }
498
- return binding
676
+ const binding = require("@recappi/sdk-openharmony-x64");
677
+ const bindingPackageVersion =
678
+ require("@recappi/sdk-openharmony-x64/package.json").version;
679
+ if (
680
+ bindingPackageVersion !== "1.0.0" &&
681
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
682
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
683
+ ) {
684
+ throw new Error(
685
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
686
+ );
687
+ }
688
+ return binding;
499
689
  } catch (e) {
500
- loadErrors.push(e)
690
+ loadErrors.push(e);
501
691
  }
502
- } else if (process.arch === 'arm') {
692
+ } else if (process.arch === "arm") {
503
693
  try {
504
- return require('./recording.openharmony-arm.node')
694
+ return require("./recording.openharmony-arm.node");
505
695
  } catch (e) {
506
- loadErrors.push(e)
696
+ loadErrors.push(e);
507
697
  }
508
698
  try {
509
- const binding = require('@recappi/sdk-openharmony-arm')
510
- const bindingPackageVersion = require('@recappi/sdk-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.0.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 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
- }
514
- return binding
699
+ const binding = require("@recappi/sdk-openharmony-arm");
700
+ const bindingPackageVersion =
701
+ require("@recappi/sdk-openharmony-arm/package.json").version;
702
+ if (
703
+ bindingPackageVersion !== "1.0.0" &&
704
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
705
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
706
+ ) {
707
+ throw new Error(
708
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
709
+ );
710
+ }
711
+ return binding;
515
712
  } catch (e) {
516
- loadErrors.push(e)
713
+ loadErrors.push(e);
517
714
  }
518
715
  } else {
519
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
716
+ loadErrors.push(
717
+ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`),
718
+ );
520
719
  }
521
720
  } else {
522
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
721
+ loadErrors.push(
722
+ new Error(
723
+ `Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
724
+ ),
725
+ );
523
726
  }
524
727
  }
525
728
 
526
- nativeBinding = requireNative()
729
+ nativeBinding = requireNative();
527
730
 
528
731
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
529
- let wasiBinding = null
530
- let wasiBindingError = null
732
+ let wasiBinding = null;
733
+ let wasiBindingError = null;
531
734
  try {
532
- wasiBinding = require('./recording.wasi.cjs')
533
- nativeBinding = wasiBinding
735
+ wasiBinding = require("./recording.wasi.cjs");
736
+ nativeBinding = wasiBinding;
534
737
  } catch (err) {
535
738
  if (process.env.NAPI_RS_FORCE_WASI) {
536
- wasiBindingError = err
739
+ wasiBindingError = err;
537
740
  }
538
741
  }
539
742
  if (!nativeBinding) {
540
743
  try {
541
- wasiBinding = require('@recappi/sdk-wasm32-wasi')
542
- nativeBinding = wasiBinding
744
+ wasiBinding = require("@recappi/sdk-wasm32-wasi");
745
+ nativeBinding = wasiBinding;
543
746
  } catch (err) {
544
747
  if (process.env.NAPI_RS_FORCE_WASI) {
545
- wasiBindingError.cause = err
546
- loadErrors.push(err)
748
+ wasiBindingError.cause = err;
749
+ loadErrors.push(err);
547
750
  }
548
751
  }
549
752
  }
550
- if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
551
- const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
552
- error.cause = wasiBindingError
553
- throw error
753
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
754
+ const error = new Error(
755
+ "WASI binding not found and NAPI_RS_FORCE_WASI is set to error",
756
+ );
757
+ error.cause = wasiBindingError;
758
+ throw error;
554
759
  }
555
760
  }
556
761
 
@@ -559,23 +764,25 @@ if (!nativeBinding) {
559
764
  throw new Error(
560
765
  `Cannot find native binding. ` +
561
766
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
562
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
767
+ "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
563
768
  {
564
769
  cause: loadErrors.reduce((err, cur) => {
565
- cur.cause = err
566
- return cur
770
+ cur.cause = err;
771
+ return cur;
567
772
  }),
568
773
  },
569
- )
774
+ );
570
775
  }
571
- throw new Error(`Failed to load native binding`)
776
+ throw new Error(`Failed to load native binding`);
572
777
  }
573
778
 
574
- module.exports = nativeBinding
575
- module.exports.ApplicationInfo = nativeBinding.ApplicationInfo
576
- module.exports.ApplicationListChangedSubscriber = nativeBinding.ApplicationListChangedSubscriber
577
- module.exports.ApplicationStateChangedSubscriber = nativeBinding.ApplicationStateChangedSubscriber
578
- module.exports.AudioCaptureSession = nativeBinding.AudioCaptureSession
579
- module.exports.ShareableContent = nativeBinding.ShareableContent
580
- module.exports.decodeAudio = nativeBinding.decodeAudio
581
- module.exports.decodeAudioSync = nativeBinding.decodeAudioSync
779
+ module.exports = nativeBinding;
780
+ module.exports.ApplicationInfo = nativeBinding.ApplicationInfo;
781
+ module.exports.ApplicationListChangedSubscriber =
782
+ nativeBinding.ApplicationListChangedSubscriber;
783
+ module.exports.ApplicationStateChangedSubscriber =
784
+ nativeBinding.ApplicationStateChangedSubscriber;
785
+ module.exports.AudioCaptureSession = nativeBinding.AudioCaptureSession;
786
+ module.exports.ShareableContent = nativeBinding.ShareableContent;
787
+ module.exports.decodeAudio = nativeBinding.decodeAudio;
788
+ module.exports.decodeAudioSync = nativeBinding.decodeAudioSync;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recappi/sdk",
3
- "version": "0.0.0",
3
+ "version": "1.0.0",
4
4
  "description": "Cross platform audio capture SDK",
5
5
  "main": "index.cjs",
6
6
  "types": "./index.d.cts",
@@ -75,14 +75,16 @@
75
75
  "npm-run-all2": "^8.0.4",
76
76
  "oxfmt": "^0.13.0",
77
77
  "oxlint": "^1.28.0",
78
+ "prettier": "^3.6.2",
78
79
  "tinybench": "^5.1.0",
79
80
  "typescript": "^5.9.3"
80
81
  },
81
82
  "lint-staged": {
82
83
  "*.@(js|ts|tsx)": [
83
- "oxlint --fix"
84
+ "oxlint --fix",
85
+ "oxfmt"
84
86
  ],
85
- "*.@(js|ts|tsx|yml|yaml|md|json)": [
87
+ "*.@(yml|yaml|md|json)": [
86
88
  "prettier --write"
87
89
  ],
88
90
  "*.toml": [
@@ -105,10 +107,10 @@
105
107
  },
106
108
  "packageManager": "yarn@4.11.0",
107
109
  "optionalDependencies": {
108
- "@recappi/sdk-darwin-arm64": "0.0.0",
109
- "@recappi/sdk-darwin-x64": "0.0.0",
110
- "@recappi/sdk-win32-x64-msvc": "0.0.0",
111
- "@recappi/sdk-win32-ia32-msvc": "0.0.0",
112
- "@recappi/sdk-win32-arm64-msvc": "0.0.0"
110
+ "@recappi/sdk-darwin-arm64": "1.0.0",
111
+ "@recappi/sdk-darwin-x64": "1.0.0",
112
+ "@recappi/sdk-win32-x64-msvc": "1.0.0",
113
+ "@recappi/sdk-win32-ia32-msvc": "1.0.0",
114
+ "@recappi/sdk-win32-arm64-msvc": "1.0.0"
113
115
  }
114
116
  }
@@ -1,4 +0,0 @@
1
- export declare function createWavBuffer(samples: Float32Array, options: {
2
- sampleRate: number;
3
- numChannels: number;
4
- }): ArrayBuffer;
@@ -1,38 +0,0 @@
1
- export function createWavBuffer(samples, options) {
2
- const { sampleRate = 44100, numChannels = 1 } = options;
3
- const bitsPerSample = 16;
4
- const bytesPerSample = bitsPerSample / 8;
5
- const dataSize = samples.length * bytesPerSample;
6
- const buffer = new ArrayBuffer(44 + dataSize); // WAV header is 44 bytes
7
- const view = new DataView(buffer);
8
- // Write WAV header
9
- // "RIFF" chunk descriptor
10
- writeString(view, 0, 'RIFF');
11
- view.setUint32(4, 36 + dataSize, true); // File size - 8
12
- writeString(view, 8, 'WAVE');
13
- // "fmt " sub-chunk
14
- writeString(view, 12, 'fmt ');
15
- view.setUint32(16, 16, true); // Sub-chunk size
16
- view.setUint16(20, 1, true); // Audio format (1 = PCM)
17
- view.setUint16(22, numChannels, true); // Channels
18
- view.setUint32(24, sampleRate, true); // Sample rate
19
- view.setUint32(28, sampleRate * numChannels * bytesPerSample, true); // Byte rate
20
- view.setUint16(32, numChannels * bytesPerSample, true); // Block align
21
- view.setUint16(34, bitsPerSample, true); // Bits per sample
22
- // "data" sub-chunk
23
- writeString(view, 36, 'data');
24
- view.setUint32(40, dataSize, true); // Sub-chunk size
25
- // Write audio data
26
- const offset = 44;
27
- for (let i = 0; i < samples.length; i++) {
28
- // Convert float32 to int16
29
- const s = Math.max(-1, Math.min(1, samples[i]));
30
- view.setInt16(offset + i * bytesPerSample, s < 0 ? s * 0x8000 : s * 0x7fff, true);
31
- }
32
- return buffer;
33
- }
34
- function writeString(view, offset, string) {
35
- for (let i = 0; i < string.length; i++) {
36
- view.setUint8(offset + i, string.charCodeAt(i));
37
- }
38
- }