gingersnap 0.22.0 → 0.23.1
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/data-structures/object/Queue.cjs +4 -2
- package/data-structures/object/Queue.mjs +4 -2
- package/future/future.cjs +5 -14
- package/future/future.d.ts +1 -1
- package/future/future.mjs +5 -14
- package/networking/NetworkService.cjs +5 -1
- package/networking/NetworkService.mjs +5 -1
- package/package.json +1 -1
- package/stream/call.cjs +3 -1
- package/stream/call.mjs +3 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
4
4
|
var WatchableObject = require('./WatchableObject.cjs');
|
|
5
|
-
var FutureCancelled = require('../../errors/FutureCancelled.cjs');
|
|
6
5
|
var QueueEmptyError = require('../../errors/QueueEmptyError.cjs');
|
|
7
6
|
var future = require('../../future/future.cjs');
|
|
8
7
|
require('ramda');
|
|
@@ -126,7 +125,10 @@ class Queue extends WatchableObject.WatchableObject {
|
|
|
126
125
|
}
|
|
127
126
|
catch (e) {
|
|
128
127
|
if (e instanceof ValueDestroyedError.ValueDestroyedError) {
|
|
129
|
-
|
|
128
|
+
return {
|
|
129
|
+
done: true,
|
|
130
|
+
value: null,
|
|
131
|
+
};
|
|
130
132
|
}
|
|
131
133
|
throw e;
|
|
132
134
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.mjs';
|
|
2
2
|
import { WatchableObject } from './WatchableObject.mjs';
|
|
3
|
-
import { FutureCancelled } from '../../errors/FutureCancelled.mjs';
|
|
4
3
|
import { QueueEmptyError } from '../../errors/QueueEmptyError.mjs';
|
|
5
4
|
import { Future } from '../../future/future.mjs';
|
|
6
5
|
import 'ramda';
|
|
@@ -124,7 +123,10 @@ class Queue extends WatchableObject {
|
|
|
124
123
|
}
|
|
125
124
|
catch (e) {
|
|
126
125
|
if (e instanceof ValueDestroyedError) {
|
|
127
|
-
|
|
126
|
+
return {
|
|
127
|
+
done: true,
|
|
128
|
+
value: null,
|
|
129
|
+
};
|
|
128
130
|
}
|
|
129
131
|
throw e;
|
|
130
132
|
}
|
package/future/future.cjs
CHANGED
|
@@ -371,7 +371,7 @@ class Future {
|
|
|
371
371
|
* @private
|
|
372
372
|
*/
|
|
373
373
|
then(onFulfilled, onRejected) {
|
|
374
|
-
|
|
374
|
+
this.__run__(onFulfilled, onRejected).catch(() => { });
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* Executes the future. Should only be triggered by the JS runtime via then(), or the user via run()
|
|
@@ -415,27 +415,16 @@ class Future {
|
|
|
415
415
|
}
|
|
416
416
|
return result$1;
|
|
417
417
|
}))
|
|
418
|
-
.then((v) => {
|
|
419
|
-
onFulfilled === null || onFulfilled === void 0 ? void 0 : onFulfilled(v);
|
|
420
|
-
return v;
|
|
421
|
-
})
|
|
422
418
|
.catch((error) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
423
419
|
const handler = this.findFailureHandler();
|
|
424
420
|
if (!handler) {
|
|
425
421
|
if (!(error instanceof Error)) {
|
|
426
422
|
error = new FutureError.FutureError(error);
|
|
427
423
|
}
|
|
428
|
-
onRejected === null || onRejected === void 0 ? void 0 : onRejected(error);
|
|
429
424
|
throw error;
|
|
430
425
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return yield resolvePromise(Promise.resolve(result));
|
|
434
|
-
}
|
|
435
|
-
catch (e) {
|
|
436
|
-
onRejected === null || onRejected === void 0 ? void 0 : onRejected(e);
|
|
437
|
-
throw e;
|
|
438
|
-
}
|
|
426
|
+
const result = yield this.postResultProcessing(handler(error));
|
|
427
|
+
return yield resolvePromise(Promise.resolve(result));
|
|
439
428
|
}));
|
|
440
429
|
};
|
|
441
430
|
this.underLyingPromise = resolvePromise(new Promise((resolve, reject) => {
|
|
@@ -502,6 +491,7 @@ class Future {
|
|
|
502
491
|
}))
|
|
503
492
|
.then((v) => {
|
|
504
493
|
this.completedResult = v;
|
|
494
|
+
onFulfilled === null || onFulfilled === void 0 ? void 0 : onFulfilled(v);
|
|
505
495
|
return v;
|
|
506
496
|
})
|
|
507
497
|
.catch((e) => {
|
|
@@ -513,6 +503,7 @@ class Future {
|
|
|
513
503
|
})
|
|
514
504
|
.catch((e) => {
|
|
515
505
|
this.failureResult = e instanceof Error ? e : new Error(String(e));
|
|
506
|
+
onRejected === null || onRejected === void 0 ? void 0 : onRejected(this.failureResult);
|
|
516
507
|
throw this.failureResult;
|
|
517
508
|
})
|
|
518
509
|
.finally(() => {
|
package/future/future.d.ts
CHANGED
|
@@ -179,7 +179,7 @@ export declare class Future<T> {
|
|
|
179
179
|
* Internal. Only to be called by the internal JS runtime during await
|
|
180
180
|
* @private
|
|
181
181
|
*/
|
|
182
|
-
then(onFulfilled: (v: T) => void, onRejected: (reason: unknown) => void):
|
|
182
|
+
then(onFulfilled: (v: T) => void, onRejected: (reason: unknown) => void): void;
|
|
183
183
|
/**
|
|
184
184
|
* Executes the future. Should only be triggered by the JS runtime via then(), or the user via run()
|
|
185
185
|
* @param onFulfilled
|
package/future/future.mjs
CHANGED
|
@@ -350,7 +350,7 @@ class Future {
|
|
|
350
350
|
* @private
|
|
351
351
|
*/
|
|
352
352
|
then(onFulfilled, onRejected) {
|
|
353
|
-
|
|
353
|
+
this.__run__(onFulfilled, onRejected).catch(() => { });
|
|
354
354
|
}
|
|
355
355
|
/**
|
|
356
356
|
* Executes the future. Should only be triggered by the JS runtime via then(), or the user via run()
|
|
@@ -394,27 +394,16 @@ class Future {
|
|
|
394
394
|
}
|
|
395
395
|
return result;
|
|
396
396
|
}))
|
|
397
|
-
.then((v) => {
|
|
398
|
-
onFulfilled === null || onFulfilled === void 0 ? void 0 : onFulfilled(v);
|
|
399
|
-
return v;
|
|
400
|
-
})
|
|
401
397
|
.catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
402
398
|
const handler = this.findFailureHandler();
|
|
403
399
|
if (!handler) {
|
|
404
400
|
if (!(error instanceof Error)) {
|
|
405
401
|
error = new FutureError(error);
|
|
406
402
|
}
|
|
407
|
-
onRejected === null || onRejected === void 0 ? void 0 : onRejected(error);
|
|
408
403
|
throw error;
|
|
409
404
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return yield resolvePromise(Promise.resolve(result));
|
|
413
|
-
}
|
|
414
|
-
catch (e) {
|
|
415
|
-
onRejected === null || onRejected === void 0 ? void 0 : onRejected(e);
|
|
416
|
-
throw e;
|
|
417
|
-
}
|
|
405
|
+
const result = yield this.postResultProcessing(handler(error));
|
|
406
|
+
return yield resolvePromise(Promise.resolve(result));
|
|
418
407
|
}));
|
|
419
408
|
};
|
|
420
409
|
this.underLyingPromise = resolvePromise(new Promise((resolve, reject) => {
|
|
@@ -481,6 +470,7 @@ class Future {
|
|
|
481
470
|
}))
|
|
482
471
|
.then((v) => {
|
|
483
472
|
this.completedResult = v;
|
|
473
|
+
onFulfilled === null || onFulfilled === void 0 ? void 0 : onFulfilled(v);
|
|
484
474
|
return v;
|
|
485
475
|
})
|
|
486
476
|
.catch((e) => {
|
|
@@ -492,6 +482,7 @@ class Future {
|
|
|
492
482
|
})
|
|
493
483
|
.catch((e) => {
|
|
494
484
|
this.failureResult = e instanceof Error ? e : new Error(String(e));
|
|
485
|
+
onRejected === null || onRejected === void 0 ? void 0 : onRejected(this.failureResult);
|
|
495
486
|
throw this.failureResult;
|
|
496
487
|
})
|
|
497
488
|
.finally(() => {
|
|
@@ -116,7 +116,11 @@ class NetworkService {
|
|
|
116
116
|
return result.clone();
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
const lookup = (retries = 0) => request.request(url, {
|
|
119
|
+
const lookup = (retries = 0) => request.request(url, {
|
|
120
|
+
headers,
|
|
121
|
+
method: requestType.toString(),
|
|
122
|
+
body,
|
|
123
|
+
}).thenApply(({ value: resp }) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
120
124
|
let credentials;
|
|
121
125
|
if (resp.status === http.HTTPStatus.UNAUTHORIZED &&
|
|
122
126
|
!value.noAuth &&
|
|
@@ -95,7 +95,11 @@ class NetworkService {
|
|
|
95
95
|
return result.clone();
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const lookup = (retries = 0) => request(url, {
|
|
98
|
+
const lookup = (retries = 0) => request(url, {
|
|
99
|
+
headers,
|
|
100
|
+
method: requestType.toString(),
|
|
101
|
+
body,
|
|
102
|
+
}).thenApply(({ value: resp }) => __awaiter(this, void 0, void 0, function* () {
|
|
99
103
|
let credentials;
|
|
100
104
|
if (resp.status === HTTPStatus.UNAUTHORIZED &&
|
|
101
105
|
!value.noAuth &&
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"gingersnap","version":"0.
|
|
1
|
+
{"name":"gingersnap","version":"0.23.1","description":"A general purpose library built with the aim of filling the gaps of javascript shortcomings","dependencies":{"@msgpack/msgpack":"^3.0.0-beta2","browser-or-node":"^3.0.0-pre.0","modern-isomorphic-ws":"^1.0.5","object-hash":"^3.0.0","papaparse":"^5.4.1","protobufjs":"^7.2.6","ramda":"^0.30.1","reflect-metadata":"^0.2.2","tslib":"^2.6.3","uuid":"^9.0.1","ws":"^8.16.0","x2js":"^3.4.4"},"author":"CookieNerds LLC","exports":{"./synchronize":{"import":{"types":"./synchronize.d.ts","default":"./synchronize.mjs"},"require":{"types":"./synchronize.d.ts","default":"./synchronize.cjs"}},"./mocks":{"import":{"types":"./mocks.d.ts","default":"./mocks.mjs"},"require":{"types":"./mocks.d.ts","default":"./mocks.cjs"}},"./socket":{"import":{"types":"./socket.d.ts","default":"./socket.mjs"},"require":{"types":"./socket.d.ts","default":"./socket.cjs"}},"./typing":{"import":{"types":"./typing.d.ts","default":"./typing.mjs"},"require":{"types":"./typing.d.ts","default":"./typing.cjs"}},"./stream":{"import":{"types":"./stream/index.d.ts","default":"./stream.mjs"},"require":{"types":"./stream/index.d.ts","default":"./stream.cjs"}},"./reflection/injector":{"import":{"types":"./reflection/injector.d.ts","default":"./reflection/injector.mjs"},"require":{"types":"./reflection/injector.d.ts","default":"./reflection/injector.cjs"}},"./stream/call":{"import":{"types":"./stream/call.d.ts","default":"./stream/call.mjs"},"require":{"types":"./stream/call.d.ts","default":"./stream/call.cjs"}},"./stream/state":{"import":{"types":"./stream/state.d.ts","default":"./stream/state.mjs"},"require":{"types":"./stream/state.d.ts","default":"./stream/state.cjs"}},"./stream/collector":{"import":{"types":"./stream/collector.d.ts","default":"./stream/collector.mjs"},"require":{"types":"./stream/collector.d.ts","default":"./stream/collector.cjs"}},"./stream/observable":{"import":{"types":"./stream/observable.d.ts","default":"./stream/observable.mjs"},"require":{"types":"./stream/observable.d.ts","default":"./stream/observable.cjs"}},"./networking":{"import":{"types":"./networking/index.d.ts","default":"./networking.mjs"},"require":{"types":"./networking/index.d.ts","default":"./networking.cjs"}},"./managers":{"import":{"types":"./managers/index.d.ts","default":"./managers.mjs"},"require":{"types":"./managers/index.d.ts","default":"./managers.cjs"}},"./future":{"import":{"types":"./future/index.d.ts","default":"./future.mjs"},"require":{"types":"./future/index.d.ts","default":"./future.cjs"}},"./errors":{"import":{"types":"./errors/index.d.ts","default":"./errors.mjs"},"require":{"types":"./errors/index.d.ts","default":"./errors.cjs"}},"./data-structures/array":{"import":{"types":"./data-structures/array/index.d.ts","default":"./data-structures/array.mjs"},"require":{"types":"./data-structures/array/index.d.ts","default":"./data-structures/array.cjs"}},"./data-structures/object":{"import":{"types":"./data-structures/object/index.d.ts","default":"./data-structures/object.mjs"},"require":{"types":"./data-structures/object/index.d.ts","default":"./data-structures/object.cjs"}},"./data/decoders":{"import":{"types":"./data/decoders/index.d.ts","default":"./data/decoders.mjs"},"require":{"types":"./data/decoders/index.d.ts","default":"./data/decoders.cjs"}},"./data/model":{"import":{"types":"./data/model/index.d.ts","default":"./data/model.mjs"},"require":{"types":"./data/model/index.d.ts","default":"./data/model.cjs"}},"./data/bus":{"import":{"types":"./data/bus.d.ts","default":"./data/bus.mjs"},"require":{"types":"./data/bus.d.ts","default":"./data/bus.cjs"}},"./data/value":{"import":{"types":"./data/value.d.ts","default":"./data/value.mjs"},"require":{"types":"./data/value.d.ts","default":"./data/value.cjs"}},"./store":{"import":{"types":"./store/index.d.ts","default":"./store.mjs"},"require":{"types":"./store/index.d.ts","default":"./store.cjs"}},"./functools":{"import":{"types":"./functools/index.d.ts","default":"./functools.mjs"},"require":{"types":"./functools/index.d.ts","default":"./functools.cjs"}}}}
|
package/stream/call.cjs
CHANGED
|
@@ -48,7 +48,9 @@ class Callable extends stream.Stream {
|
|
|
48
48
|
if (Array.isArray(json) && this.arrayResponseSupport && ((_b = this.ModelClass) === null || _b === void 0 ? void 0 : _b.name) === String.name) {
|
|
49
49
|
return json.map((v) => (typeof v !== "string" ? String(v) : v));
|
|
50
50
|
}
|
|
51
|
-
const invoker = this.ModelClass.prototype instanceof model.Model
|
|
51
|
+
const invoker = this.ModelClass.prototype instanceof model.Model
|
|
52
|
+
? this.ModelClass.fromJSON.bind(this.ModelClass)
|
|
53
|
+
: this.ModelClass;
|
|
52
54
|
if ((json instanceof Array || Array.isArray(json)) && this.arrayResponseSupport) {
|
|
53
55
|
return json.map((v) => invoker(v));
|
|
54
56
|
}
|
package/stream/call.mjs
CHANGED
|
@@ -46,7 +46,9 @@ class Callable extends Stream {
|
|
|
46
46
|
if (Array.isArray(json) && this.arrayResponseSupport && ((_b = this.ModelClass) === null || _b === void 0 ? void 0 : _b.name) === String.name) {
|
|
47
47
|
return json.map((v) => (typeof v !== "string" ? String(v) : v));
|
|
48
48
|
}
|
|
49
|
-
const invoker = this.ModelClass.prototype instanceof Model
|
|
49
|
+
const invoker = this.ModelClass.prototype instanceof Model
|
|
50
|
+
? this.ModelClass.fromJSON.bind(this.ModelClass)
|
|
51
|
+
: this.ModelClass;
|
|
50
52
|
if ((json instanceof Array || Array.isArray(json)) && this.arrayResponseSupport) {
|
|
51
53
|
return json.map((v) => invoker(v));
|
|
52
54
|
}
|