@kedaruma/revlm-client 1.0.62 → 1.0.63

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.
@@ -8,7 +8,7 @@ var require_package = __commonJS({
8
8
  "package.json"(exports, module) {
9
9
  module.exports = {
10
10
  name: "@kedaruma/revlm-client",
11
- version: "1.0.62",
11
+ version: "1.0.63",
12
12
  private: false,
13
13
  description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
14
14
  keywords: [
@@ -69,7 +69,7 @@ var require_package = __commonJS({
69
69
  test: "NODE_OPTIONS=--experimental-vm-modules pnpm exec jest --config ../../jest.config.cjs packages/revlm-client/src/__tests__/ --runInBand --watchman=false --verbose"
70
70
  },
71
71
  dependencies: {
72
- "@kedaruma/revlm-shared": "workspace:*",
72
+ "@kedaruma/revlm-shared": "latest",
73
73
  bson: "^6.10.4",
74
74
  dotenv: "^17.2.3"
75
75
  },
@@ -83,6 +83,7 @@ var require_package = __commonJS({
83
83
  // src/Revlm.ts
84
84
  import { EJSON } from "bson";
85
85
  import { AuthClient } from "@kedaruma/revlm-shared";
86
+ import { initRandomBytes } from "@kedaruma/revlm-shared/random-bytes";
86
87
 
87
88
  // src/MdbCollection.ts
88
89
  var MdbCollection = class {
@@ -193,6 +194,33 @@ var SESSION_HEADER_NAME = "x-revlm-session-id";
193
194
  var STATE_STORE_KEYS = {
194
195
  refreshSecret: "refreshSecret"
195
196
  };
197
+ var randomBytesInitAttempted = false;
198
+ function resolvePlatformRandomBytes() {
199
+ const cryptoLike = globalThis?.crypto;
200
+ if (cryptoLike && typeof cryptoLike.getRandomValues === "function") {
201
+ return (length) => {
202
+ const out = new Uint8Array(length);
203
+ cryptoLike.getRandomValues(out);
204
+ return out;
205
+ };
206
+ }
207
+ try {
208
+ const nodeCrypto = __require("crypto");
209
+ if (typeof nodeCrypto?.randomBytes === "function") {
210
+ return (length) => new Uint8Array(nodeCrypto.randomBytes(length));
211
+ }
212
+ } catch {
213
+ }
214
+ return void 0;
215
+ }
216
+ function ensureRandomBytesInitialized() {
217
+ if (randomBytesInitAttempted) return;
218
+ randomBytesInitAttempted = true;
219
+ const platformRandomBytes = resolvePlatformRandomBytes();
220
+ if (platformRandomBytes) {
221
+ initRandomBytes(platformRandomBytes);
222
+ }
223
+ }
196
224
  function normalizeLogLevel(value) {
197
225
  if (!value) return "info";
198
226
  const lowered = value.toLowerCase();
@@ -265,6 +293,7 @@ var Revlm = class {
265
293
  stateStore;
266
294
  constructor(baseUrl, opts = {}) {
267
295
  if (!baseUrl) throw new Error("baseUrl is required");
296
+ ensureRandomBytesInitialized();
268
297
  this.baseUrl = baseUrl.replace(/\/$/, "");
269
298
  this.fetchImpl = resolveFetchImpl(opts.fetchImpl);
270
299
  this.defaultHeaders = opts.defaultHeaders || {};
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ var require_package = __commonJS({
35
35
  "package.json"(exports2, module2) {
36
36
  module2.exports = {
37
37
  name: "@kedaruma/revlm-client",
38
- version: "1.0.62",
38
+ version: "1.0.63",
39
39
  private: false,
40
40
  description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
41
41
  keywords: [
@@ -96,7 +96,7 @@ var require_package = __commonJS({
96
96
  test: "NODE_OPTIONS=--experimental-vm-modules pnpm exec jest --config ../../jest.config.cjs packages/revlm-client/src/__tests__/ --runInBand --watchman=false --verbose"
97
97
  },
98
98
  dependencies: {
99
- "@kedaruma/revlm-shared": "workspace:*",
99
+ "@kedaruma/revlm-shared": "latest",
100
100
  bson: "^6.10.4",
101
101
  dotenv: "^17.2.3"
102
102
  },
@@ -126,6 +126,7 @@ module.exports = __toCommonJS(index_exports);
126
126
  // src/Revlm.ts
127
127
  var import_bson = require("bson");
128
128
  var import_revlm_shared = require("@kedaruma/revlm-shared");
129
+ var import_random_bytes = require("@kedaruma/revlm-shared/random-bytes");
129
130
 
130
131
  // src/MdbCollection.ts
131
132
  var MdbCollection = class {
@@ -236,6 +237,33 @@ var SESSION_HEADER_NAME = "x-revlm-session-id";
236
237
  var STATE_STORE_KEYS = {
237
238
  refreshSecret: "refreshSecret"
238
239
  };
240
+ var randomBytesInitAttempted = false;
241
+ function resolvePlatformRandomBytes() {
242
+ const cryptoLike = globalThis?.crypto;
243
+ if (cryptoLike && typeof cryptoLike.getRandomValues === "function") {
244
+ return (length) => {
245
+ const out = new Uint8Array(length);
246
+ cryptoLike.getRandomValues(out);
247
+ return out;
248
+ };
249
+ }
250
+ try {
251
+ const nodeCrypto = require("crypto");
252
+ if (typeof nodeCrypto?.randomBytes === "function") {
253
+ return (length) => new Uint8Array(nodeCrypto.randomBytes(length));
254
+ }
255
+ } catch {
256
+ }
257
+ return void 0;
258
+ }
259
+ function ensureRandomBytesInitialized() {
260
+ if (randomBytesInitAttempted) return;
261
+ randomBytesInitAttempted = true;
262
+ const platformRandomBytes = resolvePlatformRandomBytes();
263
+ if (platformRandomBytes) {
264
+ (0, import_random_bytes.initRandomBytes)(platformRandomBytes);
265
+ }
266
+ }
239
267
  function normalizeLogLevel(value) {
240
268
  if (!value) return "info";
241
269
  const lowered = value.toLowerCase();
@@ -308,6 +336,7 @@ var Revlm = class {
308
336
  stateStore;
309
337
  constructor(baseUrl, opts = {}) {
310
338
  if (!baseUrl) throw new Error("baseUrl is required");
339
+ ensureRandomBytesInitialized();
311
340
  this.baseUrl = baseUrl.replace(/\/$/, "");
312
341
  this.fetchImpl = resolveFetchImpl(opts.fetchImpl);
313
342
  this.defaultHeaders = opts.defaultHeaders || {};
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  Revlm,
10
10
  RevlmDBDatabase,
11
11
  RevlmUser
12
- } from "./chunk-V2GBS6JY.mjs";
12
+ } from "./chunk-OBJS4AOD.mjs";
13
13
  import "./chunk-EBO3CZXG.mjs";
14
14
  export {
15
15
  App,
@@ -35,7 +35,7 @@ var require_package = __commonJS({
35
35
  "package.json"(exports2, module2) {
36
36
  module2.exports = {
37
37
  name: "@kedaruma/revlm-client",
38
- version: "1.0.62",
38
+ version: "1.0.63",
39
39
  private: false,
40
40
  description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
41
41
  keywords: [
@@ -96,7 +96,7 @@ var require_package = __commonJS({
96
96
  test: "NODE_OPTIONS=--experimental-vm-modules pnpm exec jest --config ../../jest.config.cjs packages/revlm-client/src/__tests__/ --runInBand --watchman=false --verbose"
97
97
  },
98
98
  dependencies: {
99
- "@kedaruma/revlm-shared": "workspace:*",
99
+ "@kedaruma/revlm-shared": "latest",
100
100
  bson: "^6.10.4",
101
101
  dotenv: "^17.2.3"
102
102
  },
@@ -124,6 +124,7 @@ module.exports = __toCommonJS(revlm_compat_exports);
124
124
  // src/Revlm.ts
125
125
  var import_bson = require("bson");
126
126
  var import_revlm_shared = require("@kedaruma/revlm-shared");
127
+ var import_random_bytes = require("@kedaruma/revlm-shared/random-bytes");
127
128
 
128
129
  // src/MdbCollection.ts
129
130
  var MdbCollection = class {
@@ -234,6 +235,33 @@ var SESSION_HEADER_NAME = "x-revlm-session-id";
234
235
  var STATE_STORE_KEYS = {
235
236
  refreshSecret: "refreshSecret"
236
237
  };
238
+ var randomBytesInitAttempted = false;
239
+ function resolvePlatformRandomBytes() {
240
+ const cryptoLike = globalThis?.crypto;
241
+ if (cryptoLike && typeof cryptoLike.getRandomValues === "function") {
242
+ return (length) => {
243
+ const out = new Uint8Array(length);
244
+ cryptoLike.getRandomValues(out);
245
+ return out;
246
+ };
247
+ }
248
+ try {
249
+ const nodeCrypto = require("crypto");
250
+ if (typeof nodeCrypto?.randomBytes === "function") {
251
+ return (length) => new Uint8Array(nodeCrypto.randomBytes(length));
252
+ }
253
+ } catch {
254
+ }
255
+ return void 0;
256
+ }
257
+ function ensureRandomBytesInitialized() {
258
+ if (randomBytesInitAttempted) return;
259
+ randomBytesInitAttempted = true;
260
+ const platformRandomBytes = resolvePlatformRandomBytes();
261
+ if (platformRandomBytes) {
262
+ (0, import_random_bytes.initRandomBytes)(platformRandomBytes);
263
+ }
264
+ }
237
265
  function normalizeLogLevel(value) {
238
266
  if (!value) return "info";
239
267
  const lowered = value.toLowerCase();
@@ -306,6 +334,7 @@ var Revlm = class {
306
334
  stateStore;
307
335
  constructor(baseUrl, opts = {}) {
308
336
  if (!baseUrl) throw new Error("baseUrl is required");
337
+ ensureRandomBytesInitialized();
309
338
  this.baseUrl = baseUrl.replace(/\/$/, "");
310
339
  this.fetchImpl = resolveFetchImpl(opts.fetchImpl);
311
340
  this.defaultHeaders = opts.defaultHeaders || {};
@@ -7,7 +7,7 @@ import {
7
7
  ObjectId,
8
8
  Revlm,
9
9
  RevlmUser
10
- } from "./chunk-V2GBS6JY.mjs";
10
+ } from "./chunk-OBJS4AOD.mjs";
11
11
  import "./chunk-EBO3CZXG.mjs";
12
12
  export {
13
13
  App,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kedaruma/revlm-client",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "private": false,
5
5
  "description": "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
6
6
  "keywords": [
@@ -56,9 +56,9 @@
56
56
  "access": "public"
57
57
  },
58
58
  "dependencies": {
59
+ "@kedaruma/revlm-shared": "latest",
59
60
  "bson": "^6.10.4",
60
- "dotenv": "^17.2.3",
61
- "@kedaruma/revlm-shared": "1.0.12"
61
+ "dotenv": "^17.2.3"
62
62
  },
63
63
  "devDependencies": {
64
64
  "tsup": "^8.5.1"