@pluv/persistence-cloudflare-transactional-storage 2.2.4 → 2.2.6

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/persistence-cloudflare-transactional-storage@2.2.4 build /home/runner/work/pluv/pluv/packages/persistence-cloudflare-transactional-storage
2
+ > @pluv/persistence-cloudflare-transactional-storage@2.2.6 build /home/runner/work/pluv/pluv/packages/persistence-cloudflare-transactional-storage
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 11.34 KB
12
- CJS ⚡️ Build success in 93ms
13
- ESM dist/index.mjs 10.28 KB
14
- ESM ⚡️ Build success in 95ms
11
+ ESM dist/index.mjs 11.15 KB
12
+ ESM ⚡️ Build success in 89ms
13
+ CJS dist/index.js 12.12 KB
14
+ CJS ⚡️ Build success in 94ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3109ms
17
- DTS dist/index.d.mts 1.21 KB
18
- DTS dist/index.d.ts 1.21 KB
16
+ DTS ⚡️ Build success in 2940ms
17
+ DTS dist/index.d.mts 1.22 KB
18
+ DTS dist/index.d.ts 1.22 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @pluv/persistence-cloudflare-transactional-storage
2
2
 
3
+ ## 2.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/io@2.2.6
8
+ - @pluv/types@2.2.6
9
+
10
+ ## 2.2.5
11
+
12
+ ### Patch Changes
13
+
14
+ - @pluv/io@2.2.5
15
+ - @pluv/types@2.2.5
16
+
3
17
  ## 2.2.4
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -19,7 +19,7 @@ declare class PersistenceCloudflareTransactionalStorage extends AbstractPersiste
19
19
  getUsersSize(room: string): Promise<number>;
20
20
  initialize(roomContext: {
21
21
  state: DurableObjectState;
22
- }): this;
22
+ }): typeof this;
23
23
  setStorageState(room: string, state: string): Promise<void>;
24
24
  private _getStorageKey;
25
25
  private _getUserKey;
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ declare class PersistenceCloudflareTransactionalStorage extends AbstractPersiste
19
19
  getUsersSize(room: string): Promise<number>;
20
20
  initialize(roomContext: {
21
21
  state: DurableObjectState;
22
- }): this;
22
+ }): typeof this;
23
23
  setStorageState(room: string, state: string): Promise<void>;
24
24
  private _getStorageKey;
25
25
  private _getUserKey;
package/dist/index.js CHANGED
@@ -2,7 +2,21 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
6
20
  var __export = (target, all) => {
7
21
  for (var name in all)
8
22
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -74,12 +88,13 @@ var KV_STORAGE_PREFIX = "$PLUV_STORAGE;";
74
88
  var KV_USER_PREFIX = "$PLUV_USER";
75
89
  var SQLITE_STORAGE_TABLE = "__pluv_storage";
76
90
  var SQLITE_USER_TABLE = "__pluv_user";
77
- var PersistenceCloudflareTransactionalStorage = class extends import_io.AbstractPersistence {
91
+ var PersistenceCloudflareTransactionalStorage = class _PersistenceCloudflareTransactionalStorage extends import_io.AbstractPersistence {
78
92
  constructor(config) {
79
93
  super();
80
94
  this._state = null;
81
95
  this._initialized = null;
82
96
  const { mode } = config;
97
+ this._initialized = config._initialized;
83
98
  this._mode = mode;
84
99
  }
85
100
  addUser(room, connectionId, user) {
@@ -297,7 +312,7 @@ var PersistenceCloudflareTransactionalStorage = class extends import_io.Abstract
297
312
  });
298
313
  }
299
314
  initialize(roomContext) {
300
- this._initialized = (() => __async(this, null, function* () {
315
+ const initialized = (() => __async(this, null, function* () {
301
316
  const { state } = roomContext;
302
317
  this._state = state;
303
318
  if (this._mode === "sqlite") {
@@ -316,7 +331,9 @@ var PersistenceCloudflareTransactionalStorage = class extends import_io.Abstract
316
331
  }
317
332
  return true;
318
333
  }))();
319
- return this;
334
+ return new _PersistenceCloudflareTransactionalStorage(__spreadValues({
335
+ mode: this._mode
336
+ }, { _initialized: initialized }));
320
337
  }
321
338
  setStorageState(room, state) {
322
339
  return __async(this, null, function* () {
package/dist/index.mjs CHANGED
@@ -1,3 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
1
17
  var __async = (__this, __arguments, generator) => {
2
18
  return new Promise((resolve, reject) => {
3
19
  var fulfilled = (value) => {
@@ -49,12 +65,13 @@ var KV_STORAGE_PREFIX = "$PLUV_STORAGE;";
49
65
  var KV_USER_PREFIX = "$PLUV_USER";
50
66
  var SQLITE_STORAGE_TABLE = "__pluv_storage";
51
67
  var SQLITE_USER_TABLE = "__pluv_user";
52
- var PersistenceCloudflareTransactionalStorage = class extends AbstractPersistence {
68
+ var PersistenceCloudflareTransactionalStorage = class _PersistenceCloudflareTransactionalStorage extends AbstractPersistence {
53
69
  constructor(config) {
54
70
  super();
55
71
  this._state = null;
56
72
  this._initialized = null;
57
73
  const { mode } = config;
74
+ this._initialized = config._initialized;
58
75
  this._mode = mode;
59
76
  }
60
77
  addUser(room, connectionId, user) {
@@ -272,7 +289,7 @@ var PersistenceCloudflareTransactionalStorage = class extends AbstractPersistenc
272
289
  });
273
290
  }
274
291
  initialize(roomContext) {
275
- this._initialized = (() => __async(this, null, function* () {
292
+ const initialized = (() => __async(this, null, function* () {
276
293
  const { state } = roomContext;
277
294
  this._state = state;
278
295
  if (this._mode === "sqlite") {
@@ -291,7 +308,9 @@ var PersistenceCloudflareTransactionalStorage = class extends AbstractPersistenc
291
308
  }
292
309
  return true;
293
310
  }))();
294
- return this;
311
+ return new _PersistenceCloudflareTransactionalStorage(__spreadValues({
312
+ mode: this._mode
313
+ }, { _initialized: initialized }));
295
314
  }
296
315
  setStorageState(room, state) {
297
316
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/persistence-cloudflare-transactional-storage",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "@pluv/io crdt storage persistence for cloudflare via transactional storage",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,16 +17,16 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@pluv/io": "^2.2.4",
21
- "@pluv/types": "^2.2.4"
20
+ "@pluv/io": "^2.2.6",
21
+ "@pluv/types": "^2.2.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@cloudflare/workers-types": "^4.20250521.0",
25
25
  "eslint": "^9.27.0",
26
26
  "tsup": "^8.5.0",
27
27
  "typescript": "^5.8.3",
28
- "@pluv/tsconfig": "^2.2.4",
29
- "eslint-config-pluv": "^2.2.4"
28
+ "@pluv/tsconfig": "^2.2.6",
29
+ "eslint-config-pluv": "^2.2.6"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -28,6 +28,7 @@ export class PersistenceCloudflareTransactionalStorage extends AbstractPersisten
28
28
 
29
29
  const { mode } = config;
30
30
 
31
+ this._initialized = (config as any)._initialized;
31
32
  this._mode = mode;
32
33
  }
33
34
 
@@ -287,8 +288,8 @@ export class PersistenceCloudflareTransactionalStorage extends AbstractPersisten
287
288
  }
288
289
  }
289
290
 
290
- public initialize(roomContext: { state: DurableObjectState }): this {
291
- this._initialized = (async () => {
291
+ public initialize(roomContext: { state: DurableObjectState }): typeof this {
292
+ const initialized = (async () => {
292
293
  const { state } = roomContext;
293
294
 
294
295
  this._state = state;
@@ -311,7 +312,10 @@ export class PersistenceCloudflareTransactionalStorage extends AbstractPersisten
311
312
  return true as const;
312
313
  })();
313
314
 
314
- return this;
315
+ return new PersistenceCloudflareTransactionalStorage({
316
+ mode: this._mode,
317
+ ...{ _initialized: initialized },
318
+ }) as typeof this;
315
319
  }
316
320
 
317
321
  public async setStorageState(room: string, state: string): Promise<void> {