@telperion/reactive-storage 1.2.0 → 1.3.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/.build-manifest.json +86 -0
- package/README.md +6 -6
- package/fesm/reactive-storage.mjs +639 -0
- package/fesm/reactive-storage.mjs.map +1 -0
- package/index.cjs +17 -8
- package/index.cjs.map +1 -0
- package/index.d.cts +6 -0
- package/index.d.ts +6 -5
- package/index.js +5 -6
- package/index.js.map +1 -1
- package/json-parse.cjs +5 -3
- package/json-parse.cjs.map +1 -0
- package/json-parse.d.cts +8 -0
- package/json-parse.d.ts +3 -1
- package/json-parse.js +2 -1
- package/json-parse.js.map +1 -1
- package/package.json +60 -31
- package/reactive-cookie-storage.cjs +69 -50
- package/reactive-cookie-storage.cjs.map +1 -0
- package/reactive-cookie-storage.d.cts +77 -0
- package/reactive-cookie-storage.d.ts +48 -40
- package/reactive-cookie-storage.js +60 -41
- package/reactive-cookie-storage.js.map +1 -1
- package/reactive-storage.cjs +168 -83
- package/reactive-storage.cjs.map +1 -0
- package/reactive-storage.d.cts +165 -0
- package/reactive-storage.d.ts +118 -37
- package/reactive-storage.js +128 -43
- package/reactive-storage.js.map +1 -1
- package/reactive-web-local-storage.cjs +30 -8
- package/reactive-web-local-storage.cjs.map +1 -0
- package/reactive-web-local-storage.d.cts +37 -0
- package/reactive-web-local-storage.d.ts +30 -5
- package/reactive-web-local-storage.js +27 -5
- package/reactive-web-local-storage.js.map +1 -1
- package/reactive-web-session-storage.cjs +24 -8
- package/reactive-web-session-storage.cjs.map +1 -0
- package/reactive-web-session-storage.d.cts +31 -0
- package/reactive-web-session-storage.d.ts +24 -5
- package/reactive-web-session-storage.js +21 -5
- package/reactive-web-session-storage.js.map +1 -1
- package/reactive-web-storage.cjs +42 -27
- package/reactive-web-storage.cjs.map +1 -0
- package/reactive-web-storage.d.cts +47 -0
- package/reactive-web-storage.d.ts +28 -10
- package/reactive-web-storage.js +33 -18
- package/reactive-web-storage.js.map +1 -1
- package/async-iterator.polyfill.cjs +0 -87
- package/async-iterator.polyfill.d.ts +0 -2
- package/async-iterator.polyfill.js +0 -86
- package/async-iterator.polyfill.js.map +0 -1
- package/regex-parser.cjs +0 -29
- package/regex-parser.d.ts +0 -11
- package/regex-parser.js +0 -27
- package/regex-parser.js.map +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copied from https://github.com/ReactiveX/rxjs/blob/master/packages/observable/src/observable.ts
|
|
2
|
-
export function toAsyncIterator(observable) {
|
|
3
|
-
let subscription;
|
|
4
|
-
let hasError = false;
|
|
5
|
-
let error;
|
|
6
|
-
let completed = false;
|
|
7
|
-
const values = [];
|
|
8
|
-
const deferreds = [];
|
|
9
|
-
const handleError = (err) => {
|
|
10
|
-
hasError = true;
|
|
11
|
-
error = err;
|
|
12
|
-
while (deferreds.length) {
|
|
13
|
-
const [_, reject] = deferreds.shift();
|
|
14
|
-
reject(err);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const handleComplete = () => {
|
|
18
|
-
completed = true;
|
|
19
|
-
while (deferreds.length) {
|
|
20
|
-
const [resolve] = deferreds.shift();
|
|
21
|
-
resolve({ value: undefined, done: true });
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
next: () => {
|
|
26
|
-
if (!subscription) {
|
|
27
|
-
// We only want to start the subscription when the user starts iterating.
|
|
28
|
-
subscription = observable.subscribe({
|
|
29
|
-
next: (value) => {
|
|
30
|
-
if (deferreds.length) {
|
|
31
|
-
const [resolve] = deferreds.shift();
|
|
32
|
-
resolve({ value, done: false });
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
values.push(value);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
error: handleError,
|
|
39
|
-
complete: handleComplete,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
// If we already have some values in our buffer, we'll return the next one.
|
|
43
|
-
if (values.length) {
|
|
44
|
-
return Promise.resolve({ value: values.shift(), done: false });
|
|
45
|
-
}
|
|
46
|
-
// This was already completed, so we're just going to return a done result.
|
|
47
|
-
if (completed) {
|
|
48
|
-
return Promise.resolve({ value: undefined, done: true });
|
|
49
|
-
}
|
|
50
|
-
// There was an error, so we're going to return an error result.
|
|
51
|
-
if (hasError) {
|
|
52
|
-
return Promise.reject(error);
|
|
53
|
-
}
|
|
54
|
-
// Otherwise, we need to make them wait for a value.
|
|
55
|
-
return new Promise((resolve, reject) => {
|
|
56
|
-
deferreds.push([resolve, reject]);
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
throw: (err) => {
|
|
60
|
-
subscription?.unsubscribe();
|
|
61
|
-
// NOTE: I did some research on this, and as of Feb 2023, Chrome doesn't seem to do
|
|
62
|
-
// anything with pending promises returned from `next()` when `throw()` is called.
|
|
63
|
-
// However, for consumption of observables, I don't want RxJS taking the heat for that
|
|
64
|
-
// quirk/leak of the type. So we're going to reject all pending promises we've nexted out here.
|
|
65
|
-
handleError(err);
|
|
66
|
-
return Promise.reject(err);
|
|
67
|
-
},
|
|
68
|
-
return: () => {
|
|
69
|
-
subscription?.unsubscribe();
|
|
70
|
-
// NOTE: I did some research on this, and as of Feb 2023, Chrome doesn't seem to do
|
|
71
|
-
// anything with pending promises returned from `next()` when `throw()` is called.
|
|
72
|
-
// However, for consumption of observables, I don't want RxJS taking the heat for that
|
|
73
|
-
// quirk/leak of the type. So we're going to resolve all pending promises we've nexted out here.
|
|
74
|
-
handleComplete();
|
|
75
|
-
return Promise.resolve({ value: undefined, done: true });
|
|
76
|
-
},
|
|
77
|
-
[Symbol.asyncIterator]() {
|
|
78
|
-
return this;
|
|
79
|
-
},
|
|
80
|
-
async [Symbol.asyncDispose]() {
|
|
81
|
-
subscription?.unsubscribe();
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
//# sourceMappingURL=async-iterator.polyfill.js.map
|
|
@@ -1 +0,0 @@
|
|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F,gGAAgG;YAChG,cAAc,EAAE,CAAC;YAEjB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;YACzB,YAAY,EAAE,WAAW,EAAE,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC","file":"async-iterator.polyfill.js","sourcesContent":["// Copied from https://github.com/ReactiveX/rxjs/blob/master/packages/observable/src/observable.ts\n\nimport type { Observable, Subscription } from \"rxjs\";\n\nexport function toAsyncIterator<T>(observable: Observable<T>): AsyncGenerator<T, void, void> {\n\n let subscription: Subscription | undefined;\n let hasError = false;\n let error: unknown;\n let completed = false;\n const values: T[] = [];\n const deferreds: [(value: IteratorResult<T>) => void, (reason: unknown) => void][] = [];\n const handleError = (err: unknown) => {\n hasError = true;\n error = err;\n\n while (deferreds.length) {\n const [_, reject] = deferreds.shift()!;\n reject(err);\n }\n };\n const handleComplete = () => {\n completed = true;\n\n while (deferreds.length) {\n const [resolve] = deferreds.shift()!;\n resolve({ value: undefined, done: true });\n }\n };\n\n return {\n next: (): Promise<IteratorResult<T>> => {\n if (!subscription) {\n // We only want to start the subscription when the user starts iterating.\n subscription = observable.subscribe({\n next: (value) => {\n if (deferreds.length) {\n const [resolve] = deferreds.shift()!;\n resolve({ value, done: false });\n } else {\n values.push(value);\n }\n },\n error: handleError,\n complete: handleComplete,\n });\n }\n\n // If we already have some values in our buffer, we'll return the next one.\n if (values.length) {\n return Promise.resolve({ value: values.shift()!, done: false });\n }\n\n // This was already completed, so we're just going to return a done result.\n if (completed) {\n return Promise.resolve({ value: undefined, done: true });\n }\n\n // There was an error, so we're going to return an error result.\n if (hasError) {\n return Promise.reject(error);\n }\n\n // Otherwise, we need to make them wait for a value.\n return new Promise((resolve, reject) => {\n deferreds.push([resolve, reject]);\n });\n },\n throw: (err): Promise<IteratorResult<T>> => {\n subscription?.unsubscribe();\n // NOTE: I did some research on this, and as of Feb 2023, Chrome doesn't seem to do\n // anything with pending promises returned from `next()` when `throw()` is called.\n // However, for consumption of observables, I don't want RxJS taking the heat for that\n // quirk/leak of the type. So we're going to reject all pending promises we've nexted out here.\n handleError(err);\n\n return Promise.reject(err);\n },\n return: (): Promise<IteratorResult<T>> => {\n subscription?.unsubscribe();\n // NOTE: I did some research on this, and as of Feb 2023, Chrome doesn't seem to do\n // anything with pending promises returned from `next()` when `throw()` is called.\n // However, for consumption of observables, I don't want RxJS taking the heat for that\n // quirk/leak of the type. So we're going to resolve all pending promises we've nexted out here.\n handleComplete();\n\n return Promise.resolve({ value: undefined, done: true });\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n async [Symbol.asyncDispose]() {\n subscription?.unsubscribe();\n },\n };\n}\n"]}
|
package/regex-parser.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copied from `https://github.com/IonicaBizau/regex-parser.js/blob/master/lib/index.js`
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RegexParser = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* RegexParser
|
|
7
|
-
* Parses a string input.
|
|
8
|
-
*
|
|
9
|
-
* @name RegexParser
|
|
10
|
-
* @function
|
|
11
|
-
* @param {String} input The string input that should be parsed as regular
|
|
12
|
-
* expression.
|
|
13
|
-
* @return {RegExp} The parsed regular expression.
|
|
14
|
-
*/
|
|
15
|
-
const RegexParser = function (input) {
|
|
16
|
-
// Validate input
|
|
17
|
-
if (typeof input !== "string") {
|
|
18
|
-
throw new Error("Invalid input. Input must be a string");
|
|
19
|
-
}
|
|
20
|
-
// Parse input
|
|
21
|
-
const m = input.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
22
|
-
// Invalid flags
|
|
23
|
-
if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
24
|
-
return RegExp(input);
|
|
25
|
-
}
|
|
26
|
-
// Create the regular expression
|
|
27
|
-
return new RegExp(m[2], m[3]);
|
|
28
|
-
};
|
|
29
|
-
exports.RegexParser = RegexParser;
|
package/regex-parser.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RegexParser
|
|
3
|
-
* Parses a string input.
|
|
4
|
-
*
|
|
5
|
-
* @name RegexParser
|
|
6
|
-
* @function
|
|
7
|
-
* @param {String} input The string input that should be parsed as regular
|
|
8
|
-
* expression.
|
|
9
|
-
* @return {RegExp} The parsed regular expression.
|
|
10
|
-
*/
|
|
11
|
-
export declare const RegexParser: (input: string) => RegExp;
|
package/regex-parser.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Copied from `https://github.com/IonicaBizau/regex-parser.js/blob/master/lib/index.js`
|
|
2
|
-
/**
|
|
3
|
-
* RegexParser
|
|
4
|
-
* Parses a string input.
|
|
5
|
-
*
|
|
6
|
-
* @name RegexParser
|
|
7
|
-
* @function
|
|
8
|
-
* @param {String} input The string input that should be parsed as regular
|
|
9
|
-
* expression.
|
|
10
|
-
* @return {RegExp} The parsed regular expression.
|
|
11
|
-
*/
|
|
12
|
-
export const RegexParser = function (input) {
|
|
13
|
-
// Validate input
|
|
14
|
-
if (typeof input !== "string") {
|
|
15
|
-
throw new Error("Invalid input. Input must be a string");
|
|
16
|
-
}
|
|
17
|
-
// Parse input
|
|
18
|
-
const m = input.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
19
|
-
// Invalid flags
|
|
20
|
-
if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
21
|
-
return RegExp(input);
|
|
22
|
-
}
|
|
23
|
-
// Create the regular expression
|
|
24
|
-
return new RegExp(m[2], m[3]);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=regex-parser.js.map
|
package/regex-parser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/reactive-storage/src/regex-parser.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAS,KAAa;IAE/C,iBAAiB;IACjB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC7D,CAAC;IAED,cAAc;IACd,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,sBAAsB,CAAE,CAAC;IAE/C,gBAAgB;IAChB,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,gCAAgC;IAChC,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC","file":"regex-parser.js","sourcesContent":["// Copied from `https://github.com/IonicaBizau/regex-parser.js/blob/master/lib/index.js`\n\n/**\n * RegexParser\n * Parses a string input.\n *\n * @name RegexParser\n * @function\n * @param {String} input The string input that should be parsed as regular\n * expression.\n * @return {RegExp} The parsed regular expression.\n */\nexport const RegexParser = function(input: string) {\n\n // Validate input\n if (typeof input !== \"string\") {\n throw new Error(\"Invalid input. Input must be a string\");\n }\n\n // Parse input\n const m = input.match(/(\\/?)(.+)\\1([a-z]*)/i)!;\n\n // Invalid flags\n if (m[3] && !/^(?!.*?(.).*?\\1)[gmixXsuUAJ]+$/.test(m[3])) {\n return RegExp(input);\n }\n\n // Create the regular expression\n return new RegExp(m[2], m[3]);\n};\n"]}
|