@getpara/web-sdk 2.13.0 → 2.14.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.
@@ -247,23 +247,27 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCo
247
247
  function initializeWorker(ctx) {
248
248
  return __async(this, null, function* () {
249
249
  return new Promise((resolve, reject) => __async(this, null, function* () {
250
- const workId = uuid.v4();
251
- const worker = yield setupWorker(
252
- ctx,
253
- () => __async(this, null, function* () {
254
- resolve();
255
- }),
256
- (error) => {
257
- reject(error);
258
- },
259
- workId
260
- );
261
- worker.postMessage({
262
- env: ctx.env,
263
- apiKey: ctx.apiKey,
264
- functionType: "INIT",
265
- workId
266
- });
250
+ try {
251
+ const workId = uuid.v4();
252
+ const worker = yield setupWorker(
253
+ ctx,
254
+ () => __async(this, null, function* () {
255
+ resolve();
256
+ }),
257
+ (error) => {
258
+ reject(error);
259
+ },
260
+ workId
261
+ );
262
+ worker.postMessage({
263
+ env: ctx.env,
264
+ apiKey: ctx.apiKey,
265
+ functionType: "INIT",
266
+ workId
267
+ });
268
+ } catch (error) {
269
+ reject(error);
270
+ }
267
271
  }));
268
272
  });
269
273
  }
@@ -39,6 +39,9 @@ function setupWorker(ctx, resFunction, errorFunction, workId, errorContext) {
39
39
  };
40
40
  return syncWorker;
41
41
  }
42
+ if (typeof Worker === "undefined") {
43
+ throw new Error("Worker is not available in this environment. ParaWeb must be used in a browser context.");
44
+ }
42
45
  const timeoutId = setTimeout(() => {
43
46
  removeWorkId(workId, true);
44
47
  }, CLEAR_WORKER_TIMEOUT_MS);
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@getpara/web-sdk",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "2.13.0",
6
- "@getpara/user-management-client": "2.13.0",
5
+ "@getpara/core-sdk": "2.14.0",
6
+ "@getpara/user-management-client": "2.14.0",
7
7
  "base64url": "^3.0.1",
8
8
  "buffer": "6.0.3",
9
9
  "cbor-web": "^9.0.2",
@@ -28,7 +28,7 @@
28
28
  "dist",
29
29
  "package.json"
30
30
  ],
31
- "gitHead": "75ac5d1ebe87366c23bb4e485481deb1b593e299",
31
+ "gitHead": "8ac7cfbe3b106a42e53f6e5439f484ab11b0e1f3",
32
32
  "main": "dist/index.js",
33
33
  "scripts": {
34
34
  "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",