@naylence/runtime 0.3.5-test.957 → 0.3.5-test.958

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.
@@ -98,12 +98,12 @@ installProcessEnvShim();
98
98
  // --- END ENV SHIM ---
99
99
 
100
100
  // This file is auto-generated during build - do not edit manually
101
- // Generated from package.json version: 0.3.5-test.957
101
+ // Generated from package.json version: 0.3.5-test.958
102
102
  /**
103
103
  * The package version, injected at build time.
104
104
  * @internal
105
105
  */
106
- const VERSION = '0.3.5-test.957';
106
+ const VERSION = '0.3.5-test.958';
107
107
 
108
108
  /**
109
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -1358,28 +1358,38 @@ class TaskSpawner {
1358
1358
  }
1359
1359
  }
1360
1360
 
1361
+ // import { getLogger } from './logging.js';
1362
+ // const logger = getLogger('naylence.fame.util.lock');
1361
1363
  class AsyncLock {
1362
1364
  constructor() {
1363
- this.tail = Promise.resolve();
1365
+ this.queue = Promise.resolve();
1364
1366
  }
1365
- async runExclusive(operation) {
1367
+ async acquire(task) {
1368
+ const currentQueue = this.queue;
1366
1369
  let release;
1367
- const next = new Promise((resolve) => {
1370
+ const nextPromise = new Promise((resolve) => {
1368
1371
  release = resolve;
1369
1372
  });
1370
- const previous = this.tail;
1371
- this.tail = previous.then(() => next, () => next);
1372
- await previous;
1373
+ // Chain the new promise to the queue
1374
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
1375
+ // Wait for the previous task to complete
1376
+ // logger.debug('waiting_for_lock');
1377
+ await currentQueue;
1378
+ // logger.debug('lock_acquired');
1373
1379
  try {
1374
- return await operation();
1380
+ return await task();
1375
1381
  }
1376
1382
  finally {
1377
1383
  release();
1384
+ // logger.debug('lock_released');
1378
1385
  }
1379
1386
  }
1387
+ async runExclusive(task) {
1388
+ return this.acquire(task);
1389
+ }
1380
1390
  }
1381
1391
  async function withLock(lock, operation) {
1382
- return await lock.runExclusive(operation);
1392
+ return await lock.acquire(operation);
1383
1393
  }
1384
1394
 
1385
1395
  /**
@@ -96,12 +96,12 @@ installProcessEnvShim();
96
96
  // --- END ENV SHIM ---
97
97
 
98
98
  // This file is auto-generated during build - do not edit manually
99
- // Generated from package.json version: 0.3.5-test.957
99
+ // Generated from package.json version: 0.3.5-test.958
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.5-test.957';
104
+ const VERSION = '0.3.5-test.958';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -1356,28 +1356,38 @@ class TaskSpawner {
1356
1356
  }
1357
1357
  }
1358
1358
 
1359
+ // import { getLogger } from './logging.js';
1360
+ // const logger = getLogger('naylence.fame.util.lock');
1359
1361
  class AsyncLock {
1360
1362
  constructor() {
1361
- this.tail = Promise.resolve();
1363
+ this.queue = Promise.resolve();
1362
1364
  }
1363
- async runExclusive(operation) {
1365
+ async acquire(task) {
1366
+ const currentQueue = this.queue;
1364
1367
  let release;
1365
- const next = new Promise((resolve) => {
1368
+ const nextPromise = new Promise((resolve) => {
1366
1369
  release = resolve;
1367
1370
  });
1368
- const previous = this.tail;
1369
- this.tail = previous.then(() => next, () => next);
1370
- await previous;
1371
+ // Chain the new promise to the queue
1372
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
1373
+ // Wait for the previous task to complete
1374
+ // logger.debug('waiting_for_lock');
1375
+ await currentQueue;
1376
+ // logger.debug('lock_acquired');
1371
1377
  try {
1372
- return await operation();
1378
+ return await task();
1373
1379
  }
1374
1380
  finally {
1375
1381
  release();
1382
+ // logger.debug('lock_released');
1376
1383
  }
1377
1384
  }
1385
+ async runExclusive(task) {
1386
+ return this.acquire(task);
1387
+ }
1378
1388
  }
1379
1389
  async function withLock(lock, operation) {
1380
- return await lock.runExclusive(operation);
1390
+ return await lock.acquire(operation);
1381
1391
  }
1382
1392
 
1383
1393
  /**
@@ -1,28 +1,38 @@
1
1
  "use strict";
2
+ // import { getLogger } from './logging.js';
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.AsyncLock = void 0;
4
5
  exports.withLock = withLock;
6
+ // const logger = getLogger('naylence.fame.util.lock');
5
7
  class AsyncLock {
6
8
  constructor() {
7
- this.tail = Promise.resolve();
9
+ this.queue = Promise.resolve();
8
10
  }
9
- async runExclusive(operation) {
11
+ async acquire(task) {
12
+ const currentQueue = this.queue;
10
13
  let release;
11
- const next = new Promise((resolve) => {
14
+ const nextPromise = new Promise((resolve) => {
12
15
  release = resolve;
13
16
  });
14
- const previous = this.tail;
15
- this.tail = previous.then(() => next, () => next);
16
- await previous;
17
+ // Chain the new promise to the queue
18
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
19
+ // Wait for the previous task to complete
20
+ // logger.debug('waiting_for_lock');
21
+ await currentQueue;
22
+ // logger.debug('lock_acquired');
17
23
  try {
18
- return await operation();
24
+ return await task();
19
25
  }
20
26
  finally {
21
27
  release();
28
+ // logger.debug('lock_released');
22
29
  }
23
30
  }
31
+ async runExclusive(task) {
32
+ return this.acquire(task);
33
+ }
24
34
  }
25
35
  exports.AsyncLock = AsyncLock;
26
36
  async function withLock(lock, operation) {
27
- return await lock.runExclusive(operation);
37
+ return await lock.acquire(operation);
28
38
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // This file is auto-generated during build - do not edit manually
3
- // Generated from package.json version: 0.3.5-test.957
3
+ // Generated from package.json version: 0.3.5-test.958
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.VERSION = void 0;
6
6
  /**
7
7
  * The package version, injected at build time.
8
8
  * @internal
9
9
  */
10
- exports.VERSION = '0.3.5-test.957';
10
+ exports.VERSION = '0.3.5-test.958';
@@ -1,23 +1,33 @@
1
+ // import { getLogger } from './logging.js';
2
+ // const logger = getLogger('naylence.fame.util.lock');
1
3
  export class AsyncLock {
2
4
  constructor() {
3
- this.tail = Promise.resolve();
5
+ this.queue = Promise.resolve();
4
6
  }
5
- async runExclusive(operation) {
7
+ async acquire(task) {
8
+ const currentQueue = this.queue;
6
9
  let release;
7
- const next = new Promise((resolve) => {
10
+ const nextPromise = new Promise((resolve) => {
8
11
  release = resolve;
9
12
  });
10
- const previous = this.tail;
11
- this.tail = previous.then(() => next, () => next);
12
- await previous;
13
+ // Chain the new promise to the queue
14
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
15
+ // Wait for the previous task to complete
16
+ // logger.debug('waiting_for_lock');
17
+ await currentQueue;
18
+ // logger.debug('lock_acquired');
13
19
  try {
14
- return await operation();
20
+ return await task();
15
21
  }
16
22
  finally {
17
23
  release();
24
+ // logger.debug('lock_released');
18
25
  }
19
26
  }
27
+ async runExclusive(task) {
28
+ return this.acquire(task);
29
+ }
20
30
  }
21
31
  export async function withLock(lock, operation) {
22
- return await lock.runExclusive(operation);
32
+ return await lock.acquire(operation);
23
33
  }
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated during build - do not edit manually
2
- // Generated from package.json version: 0.3.5-test.957
2
+ // Generated from package.json version: 0.3.5-test.958
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.5-test.957';
7
+ export const VERSION = '0.3.5-test.958';
@@ -14,12 +14,12 @@ var fastify = require('fastify');
14
14
  var websocketPlugin = require('@fastify/websocket');
15
15
 
16
16
  // This file is auto-generated during build - do not edit manually
17
- // Generated from package.json version: 0.3.5-test.957
17
+ // Generated from package.json version: 0.3.5-test.958
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.5-test.957';
22
+ const VERSION = '0.3.5-test.958';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -1274,28 +1274,38 @@ class TaskSpawner {
1274
1274
  }
1275
1275
  }
1276
1276
 
1277
+ // import { getLogger } from './logging.js';
1278
+ // const logger = getLogger('naylence.fame.util.lock');
1277
1279
  class AsyncLock {
1278
1280
  constructor() {
1279
- this.tail = Promise.resolve();
1281
+ this.queue = Promise.resolve();
1280
1282
  }
1281
- async runExclusive(operation) {
1283
+ async acquire(task) {
1284
+ const currentQueue = this.queue;
1282
1285
  let release;
1283
- const next = new Promise((resolve) => {
1286
+ const nextPromise = new Promise((resolve) => {
1284
1287
  release = resolve;
1285
1288
  });
1286
- const previous = this.tail;
1287
- this.tail = previous.then(() => next, () => next);
1288
- await previous;
1289
+ // Chain the new promise to the queue
1290
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
1291
+ // Wait for the previous task to complete
1292
+ // logger.debug('waiting_for_lock');
1293
+ await currentQueue;
1294
+ // logger.debug('lock_acquired');
1289
1295
  try {
1290
- return await operation();
1296
+ return await task();
1291
1297
  }
1292
1298
  finally {
1293
1299
  release();
1300
+ // logger.debug('lock_released');
1294
1301
  }
1295
1302
  }
1303
+ async runExclusive(task) {
1304
+ return this.acquire(task);
1305
+ }
1296
1306
  }
1297
1307
  async function withLock(lock, operation) {
1298
- return await lock.runExclusive(operation);
1308
+ return await lock.acquire(operation);
1299
1309
  }
1300
1310
 
1301
1311
  /**
@@ -13,12 +13,12 @@ import fastify from 'fastify';
13
13
  import websocketPlugin from '@fastify/websocket';
14
14
 
15
15
  // This file is auto-generated during build - do not edit manually
16
- // Generated from package.json version: 0.3.5-test.957
16
+ // Generated from package.json version: 0.3.5-test.958
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.5-test.957';
21
+ const VERSION = '0.3.5-test.958';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -1273,28 +1273,38 @@ class TaskSpawner {
1273
1273
  }
1274
1274
  }
1275
1275
 
1276
+ // import { getLogger } from './logging.js';
1277
+ // const logger = getLogger('naylence.fame.util.lock');
1276
1278
  class AsyncLock {
1277
1279
  constructor() {
1278
- this.tail = Promise.resolve();
1280
+ this.queue = Promise.resolve();
1279
1281
  }
1280
- async runExclusive(operation) {
1282
+ async acquire(task) {
1283
+ const currentQueue = this.queue;
1281
1284
  let release;
1282
- const next = new Promise((resolve) => {
1285
+ const nextPromise = new Promise((resolve) => {
1283
1286
  release = resolve;
1284
1287
  });
1285
- const previous = this.tail;
1286
- this.tail = previous.then(() => next, () => next);
1287
- await previous;
1288
+ // Chain the new promise to the queue
1289
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
1290
+ // Wait for the previous task to complete
1291
+ // logger.debug('waiting_for_lock');
1292
+ await currentQueue;
1293
+ // logger.debug('lock_acquired');
1288
1294
  try {
1289
- return await operation();
1295
+ return await task();
1290
1296
  }
1291
1297
  finally {
1292
1298
  release();
1299
+ // logger.debug('lock_released');
1293
1300
  }
1294
1301
  }
1302
+ async runExclusive(task) {
1303
+ return this.acquire(task);
1304
+ }
1295
1305
  }
1296
1306
  async function withLock(lock, operation) {
1297
- return await lock.runExclusive(operation);
1307
+ return await lock.acquire(operation);
1298
1308
  }
1299
1309
 
1300
1310
  /**
@@ -5120,28 +5120,38 @@ class EncryptedStorageProviderBase {
5120
5120
  }
5121
5121
  }
5122
5122
 
5123
+ // import { getLogger } from './logging.js';
5124
+ // const logger = getLogger('naylence.fame.util.lock');
5123
5125
  class AsyncLock {
5124
5126
  constructor() {
5125
- this.tail = Promise.resolve();
5127
+ this.queue = Promise.resolve();
5126
5128
  }
5127
- async runExclusive(operation) {
5129
+ async acquire(task) {
5130
+ const currentQueue = this.queue;
5128
5131
  let release;
5129
- const next = new Promise((resolve) => {
5132
+ const nextPromise = new Promise((resolve) => {
5130
5133
  release = resolve;
5131
5134
  });
5132
- const previous = this.tail;
5133
- this.tail = previous.then(() => next, () => next);
5134
- await previous;
5135
+ // Chain the new promise to the queue
5136
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
5137
+ // Wait for the previous task to complete
5138
+ // logger.debug('waiting_for_lock');
5139
+ await currentQueue;
5140
+ // logger.debug('lock_acquired');
5135
5141
  try {
5136
- return await operation();
5142
+ return await task();
5137
5143
  }
5138
5144
  finally {
5139
5145
  release();
5146
+ // logger.debug('lock_released');
5140
5147
  }
5141
5148
  }
5149
+ async runExclusive(task) {
5150
+ return this.acquire(task);
5151
+ }
5142
5152
  }
5143
5153
  async function withLock(lock, operation) {
5144
- return await lock.runExclusive(operation);
5154
+ return await lock.acquire(operation);
5145
5155
  }
5146
5156
 
5147
5157
  const logger$1b = getLogger('naylence.fame.storage.sqlite_storage_provider');
@@ -5528,12 +5538,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5528
5538
  }
5529
5539
 
5530
5540
  // This file is auto-generated during build - do not edit manually
5531
- // Generated from package.json version: 0.3.5-test.957
5541
+ // Generated from package.json version: 0.3.5-test.958
5532
5542
  /**
5533
5543
  * The package version, injected at build time.
5534
5544
  * @internal
5535
5545
  */
5536
- const VERSION = '0.3.5-test.957';
5546
+ const VERSION = '0.3.5-test.958';
5537
5547
 
5538
5548
  /**
5539
5549
  * Fame errors module - Fame protocol specific error classes
@@ -5119,28 +5119,38 @@ class EncryptedStorageProviderBase {
5119
5119
  }
5120
5120
  }
5121
5121
 
5122
+ // import { getLogger } from './logging.js';
5123
+ // const logger = getLogger('naylence.fame.util.lock');
5122
5124
  class AsyncLock {
5123
5125
  constructor() {
5124
- this.tail = Promise.resolve();
5126
+ this.queue = Promise.resolve();
5125
5127
  }
5126
- async runExclusive(operation) {
5128
+ async acquire(task) {
5129
+ const currentQueue = this.queue;
5127
5130
  let release;
5128
- const next = new Promise((resolve) => {
5131
+ const nextPromise = new Promise((resolve) => {
5129
5132
  release = resolve;
5130
5133
  });
5131
- const previous = this.tail;
5132
- this.tail = previous.then(() => next, () => next);
5133
- await previous;
5134
+ // Chain the new promise to the queue
5135
+ this.queue = this.queue.then(() => nextPromise, () => nextPromise);
5136
+ // Wait for the previous task to complete
5137
+ // logger.debug('waiting_for_lock');
5138
+ await currentQueue;
5139
+ // logger.debug('lock_acquired');
5134
5140
  try {
5135
- return await operation();
5141
+ return await task();
5136
5142
  }
5137
5143
  finally {
5138
5144
  release();
5145
+ // logger.debug('lock_released');
5139
5146
  }
5140
5147
  }
5148
+ async runExclusive(task) {
5149
+ return this.acquire(task);
5150
+ }
5141
5151
  }
5142
5152
  async function withLock(lock, operation) {
5143
- return await lock.runExclusive(operation);
5153
+ return await lock.acquire(operation);
5144
5154
  }
5145
5155
 
5146
5156
  const logger$1b = getLogger('naylence.fame.storage.sqlite_storage_provider');
@@ -5527,12 +5537,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5527
5537
  }
5528
5538
 
5529
5539
  // This file is auto-generated during build - do not edit manually
5530
- // Generated from package.json version: 0.3.5-test.957
5540
+ // Generated from package.json version: 0.3.5-test.958
5531
5541
  /**
5532
5542
  * The package version, injected at build time.
5533
5543
  * @internal
5534
5544
  */
5535
- const VERSION = '0.3.5-test.957';
5545
+ const VERSION = '0.3.5-test.958';
5536
5546
 
5537
5547
  /**
5538
5548
  * Fame errors module - Fame protocol specific error classes
@@ -1,5 +1,6 @@
1
1
  export declare class AsyncLock {
2
- private tail;
3
- runExclusive<T>(operation: () => Promise<T> | T): Promise<T>;
2
+ private queue;
3
+ acquire<T>(task: () => Promise<T> | T): Promise<T>;
4
+ runExclusive<T>(task: () => Promise<T> | T): Promise<T>;
4
5
  }
5
6
  export declare function withLock<T>(lock: AsyncLock, operation: () => Promise<T> | T): Promise<T>;
@@ -2,4 +2,4 @@
2
2
  * The package version, injected at build time.
3
3
  * @internal
4
4
  */
5
- export declare const VERSION = "0.3.5-test.957";
5
+ export declare const VERSION = "0.3.5-test.958";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.957",
3
+ "version": "0.3.5-test.958",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",