@sorisdk/matcher 0.1.1 → 0.1.3

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/LICENSE.md ADDED
@@ -0,0 +1,50 @@
1
+ Software Use License Agreement
2
+
3
+ Copyright (c) iPlateia Inc. All rights reserved.
4
+
5
+ This Software Use License Agreement ("Agreement") is a binding agreement between iPlateia Inc. ("Company") and the person or entity that installs, accesses, or uses this package ("Licensee").
6
+
7
+ By installing, copying, accessing, or using the package, Licensee agrees to be bound by this Agreement. If Licensee does not agree, Licensee must not install, access, or use the package.
8
+
9
+ 1. Grant of License
10
+
11
+ Subject to Licensee's full compliance with this Agreement, the Company grants Licensee a limited, non-exclusive, non-transferable, non-sublicensable, revocable license to use the package in object code or compiled form solely for Licensee's internal business use or other use expressly authorized by the Company.
12
+
13
+ 2. Restrictions
14
+
15
+ Licensee must not, and must not permit any third party to:
16
+
17
+ - modify, adapt, translate, alter, or create derivative works of the package;
18
+ - reverse engineer, decompile, disassemble, decode, or otherwise attempt to derive the source code, underlying ideas, algorithms, file formats, or trade secrets of the package, except to the limited extent such restriction is prohibited by mandatory law;
19
+ - copy, publish, distribute, transmit, disclose, sublicense, assign, sell, rent, lease, lend, transfer, pledge, or otherwise make the package available to any third party;
20
+ - remove, obscure, or alter any copyright, trademark, confidentiality, or proprietary notice contained in the package;
21
+ - use the package in violation of applicable law, public policy, or the Company's usage conditions;
22
+ - use the package to disclose survey content, logs, technical information, or other service-related information to any third party.
23
+
24
+ 3. Ownership and Reservation of Rights
25
+
26
+ The package is licensed, not sold. The package, including all intellectual property rights in and to the package, remains the exclusive property of the Company and its licensors. No rights are granted except as expressly stated in this Agreement.
27
+
28
+ 4. Confidentiality
29
+
30
+ Any non-public information obtained through access to or use of the package, including technical materials, performance information, documentation, data formats, and service-related content, is confidential. Licensee must keep such information strictly confidential and must not disclose it to any third party without the Company's prior written consent.
31
+
32
+ 5. Changes, Suspension, and Termination
33
+
34
+ The Company may modify, suspend, restrict, or discontinue all or part of the package at any time if reasonably required for operational, technical, security, or business reasons. If Licensee breaches this Agreement, the Company may immediately suspend or terminate this Agreement and Licensee's right to use the package. Upon termination, Licensee must immediately stop using the package and delete all copies in Licensee's possession or control.
35
+
36
+ 6. Disclaimer
37
+
38
+ To the maximum extent permitted by law, the package is provided on an "as is" and "as available" basis without warranties of any kind, whether express, implied, statutory, or otherwise, including any implied warranties of merchantability, fitness for a particular purpose, title, non-infringement, accuracy, availability, or uninterrupted operation.
39
+
40
+ 7. Limitation of Liability
41
+
42
+ To the maximum extent permitted by law, the Company will not be liable for any indirect, incidental, special, consequential, exemplary, or punitive damages, or for any loss of profits, revenues, business, goodwill, data, or use, arising out of or related to this Agreement or the package, even if advised of the possibility of such damages.
43
+
44
+ 8. Governing Law
45
+
46
+ This Agreement is governed by the laws of the Republic of Korea, without regard to conflict of laws principles.
47
+
48
+ 9. Entire Agreement
49
+
50
+ This Agreement constitutes the entire agreement between Licensee and the Company regarding the package and supersedes all prior or contemporaneous understandings relating to the package.
package/README.md CHANGED
@@ -14,6 +14,11 @@ npm install @sorisdk/matcher
14
14
 
15
15
  Vite-based apps need `vite-plugin-wasm`.
16
16
 
17
+ The default loader is intended to work in both Vite dev/build and Nuxt client production bundles. If you need to override wasm loading explicitly, pass either:
18
+
19
+ - `loader: () => import("@sorisdk/matcher/generated/core.js")`
20
+ - `wasmModule: await import("@sorisdk/matcher/generated/core.js")`
21
+
17
22
  ## Minimal example
18
23
 
19
24
  ```ts
@@ -35,6 +40,20 @@ const result = await session.match(new Uint8Array([1, 2, 3]));
35
40
  console.log(result.best);
36
41
  ```
37
42
 
43
+ ## Advanced wasm loading
44
+
45
+ ```ts
46
+ import { MatcherSession, initMatcher } from "@sorisdk/matcher";
47
+
48
+ await initMatcher({
49
+ loader: () => import("@sorisdk/matcher/generated/core.js")
50
+ });
51
+
52
+ const session = new MatcherSession({
53
+ wasmModule: await import("@sorisdk/matcher/generated/core.js")
54
+ });
55
+ ```
56
+
38
57
  ## Pack loading
39
58
 
40
59
  `loadPack(...)` accepts:
@@ -0,0 +1,5 @@
1
+ import * as generatedModule from "./generated/core.js";
2
+
3
+ export default async function defaultWasmLoader() {
4
+ return generatedModule;
5
+ }
@@ -1,7 +1,7 @@
1
1
  /* @ts-self-types="./core.d.ts" */
2
-
3
2
  import * as wasm from "./core_bg.wasm";
4
3
  import { __wbg_set_wasm } from "./core_bg.js";
4
+
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
@@ -149,11 +149,11 @@ if (Symbol.dispose) WasmMatcherEngine.prototype[Symbol.dispose] = WasmMatcherEng
149
149
  export function init_matcher_wasm() {
150
150
  wasm.init_matcher_wasm();
151
151
  }
152
- export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
152
+ export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
153
153
  const ret = Error(getStringFromWasm0(arg0, arg1));
154
154
  return ret;
155
155
  }
156
- export function __wbg_Number_a5a435bd7bbec835(arg0) {
156
+ export function __wbg_Number_32bf70a599af1d4b(arg0) {
157
157
  const ret = Number(arg0);
158
158
  return ret;
159
159
  }
@@ -164,46 +164,46 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
164
164
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
165
165
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
166
166
  }
167
- export function __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1(arg0) {
167
+ export function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {
168
168
  const v = arg0;
169
169
  const ret = typeof(v) === 'boolean' ? v : undefined;
170
170
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
171
171
  }
172
- export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
172
+ export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
173
173
  const ret = debugString(arg1);
174
174
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
175
175
  const len1 = WASM_VECTOR_LEN;
176
176
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
177
177
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
178
178
  }
179
- export function __wbg___wbindgen_in_41dbb8413020e076(arg0, arg1) {
179
+ export function __wbg___wbindgen_in_a5d8b22e52b24dd1(arg0, arg1) {
180
180
  const ret = arg0 in arg1;
181
181
  return ret;
182
182
  }
183
- export function __wbg___wbindgen_is_null_0b605fc6b167c56f(arg0) {
183
+ export function __wbg___wbindgen_is_null_52ff4ec04186736f(arg0) {
184
184
  const ret = arg0 === null;
185
185
  return ret;
186
186
  }
187
- export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
187
+ export function __wbg___wbindgen_is_object_63322ec0cd6ea4ef(arg0) {
188
188
  const val = arg0;
189
189
  const ret = typeof(val) === 'object' && val !== null;
190
190
  return ret;
191
191
  }
192
- export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
192
+ export function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {
193
193
  const ret = arg0 === undefined;
194
194
  return ret;
195
195
  }
196
- export function __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b(arg0, arg1) {
196
+ export function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {
197
197
  const ret = arg0 == arg1;
198
198
  return ret;
199
199
  }
200
- export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
200
+ export function __wbg___wbindgen_number_get_c7f42aed0525c451(arg0, arg1) {
201
201
  const obj = arg1;
202
202
  const ret = typeof(obj) === 'number' ? obj : undefined;
203
203
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
204
204
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
205
205
  }
206
- export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
206
+ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
207
207
  const obj = arg1;
208
208
  const ret = typeof(obj) === 'string' ? obj : undefined;
209
209
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -211,7 +211,7 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
211
211
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
212
212
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
213
213
  }
214
- export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
214
+ export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
215
215
  throw new Error(getStringFromWasm0(arg0, arg1));
216
216
  }
217
217
  export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
@@ -229,7 +229,7 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
229
229
  const ret = arg0[arg1];
230
230
  return ret;
231
231
  }
232
- export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
232
+ export function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(arg0) {
233
233
  let result;
234
234
  try {
235
235
  result = arg0 instanceof ArrayBuffer;
@@ -239,7 +239,7 @@ export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
239
239
  const ret = result;
240
240
  return ret;
241
241
  }
242
- export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
242
+ export function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(arg0) {
243
243
  let result;
244
244
  try {
245
245
  result = arg0 instanceof Uint8Array;
@@ -249,38 +249,38 @@ export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
249
249
  const ret = result;
250
250
  return ret;
251
251
  }
252
- export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
252
+ export function __wbg_isSafeInteger_4fc213d1989d6d2a(arg0) {
253
253
  const ret = Number.isSafeInteger(arg0);
254
254
  return ret;
255
255
  }
256
- export function __wbg_length_ea16607d7b61445b(arg0) {
256
+ export function __wbg_length_9f1775224cf1d815(arg0) {
257
257
  const ret = arg0.length;
258
258
  return ret;
259
259
  }
260
- export function __wbg_new_227d7c05414eb861() {
261
- const ret = new Error();
260
+ export function __wbg_new_0c7403db6e782f19(arg0) {
261
+ const ret = new Uint8Array(arg0);
262
262
  return ret;
263
263
  }
264
- export function __wbg_new_5f486cdf45a04d78(arg0) {
265
- const ret = new Uint8Array(arg0);
264
+ export function __wbg_new_227d7c05414eb861() {
265
+ const ret = new Error();
266
266
  return ret;
267
267
  }
268
- export function __wbg_new_a70fbab9066b301f() {
268
+ export function __wbg_new_682678e2f47e32bc() {
269
269
  const ret = new Array();
270
270
  return ret;
271
271
  }
272
- export function __wbg_new_ab79df5bd7c26067() {
272
+ export function __wbg_new_aa8d0fa9762c29bd() {
273
273
  const ret = new Object();
274
274
  return ret;
275
275
  }
276
- export function __wbg_now_16f0c993d5dd6c27() {
276
+ export function __wbg_now_a9b7df1cbee90986() {
277
277
  const ret = Date.now();
278
278
  return ret;
279
279
  }
280
- export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
280
+ export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
281
281
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
282
282
  }
283
- export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
283
+ export function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {
284
284
  arg0[arg1 >>> 0] = arg2;
285
285
  }
286
286
  export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
Binary file
package/dist/index.js CHANGED
@@ -289,11 +289,8 @@ function getCallable(obj, names) {
289
289
  return null;
290
290
  }
291
291
  var defaultLoader = async () => {
292
- const generatedModuleUrl = new URL("./generated/core.js", import.meta.url);
293
- return import(
294
- /* @vite-ignore */
295
- generatedModuleUrl.href
296
- );
292
+ const loaderModule = await import("./default-loader.js");
293
+ return loaderModule.default();
297
294
  };
298
295
  var INTERNAL_DUPLICATE_MATCH_FLAG = "__matcherDuplicate";
299
296
  var WrappedDatabase = class {
@@ -380,15 +377,18 @@ var WrappedMatcher = class {
380
377
  if (!raw) {
381
378
  return null;
382
379
  }
383
- if (typeof raw === "object" && raw !== null && raw.duplicate === true && raw.best) {
384
- const normalized = normalizeResult(raw.best);
385
- Object.defineProperty(normalized, INTERNAL_DUPLICATE_MATCH_FLAG, {
386
- value: true,
387
- enumerable: false,
388
- configurable: false,
389
- writable: false
390
- });
391
- return normalized;
380
+ if (typeof raw === "object" && raw !== null) {
381
+ const duplicateResult = raw;
382
+ if (duplicateResult.duplicate === true && duplicateResult.best) {
383
+ const normalized = normalizeResult(duplicateResult.best);
384
+ Object.defineProperty(normalized, INTERNAL_DUPLICATE_MATCH_FLAG, {
385
+ value: true,
386
+ enumerable: false,
387
+ configurable: false,
388
+ writable: false
389
+ });
390
+ return normalized;
391
+ }
392
392
  }
393
393
  return normalizeResult(raw);
394
394
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorisdk/matcher",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Browser WASM SDK for audio fingerprint matching",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "matcher"
31
31
  ],
32
32
  "author": "comfuture",
33
- "license": "MIT",
33
+ "license": "SEE LICENSE IN LICENSE.md",
34
34
  "homepage": "https://docs.soriapi.com/ko/integration/web",
35
35
  "devDependencies": {
36
36
  "tsup": "^8.5.0",
@@ -40,7 +40,7 @@
40
40
  "scripts": {
41
41
  "build:wasm": "node ../../scripts/build-wasm-package.mjs matcher",
42
42
  "build:assets": "node ./scripts/copy-assets.mjs",
43
- "build": "tsup src/index.ts --format esm --dts && pnpm run build:wasm && pnpm run build:assets",
43
+ "build": "tsup src/index.ts --format esm --dts && pnpm run build:wasm && pnpm run build:assets && node ../../scripts/write-default-loader.mjs packages/matcher ./generated/core.js",
44
44
  "test": "vitest run",
45
45
  "test:watch": "vitest"
46
46
  }