@powerhousedao/shared 6.0.0-dev.130 → 6.0.0-dev.131
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/dist/{actions-CJe2O85M.d.ts → actions-BOJGxb-b.d.ts} +3 -3
- package/dist/actions-BOJGxb-b.d.ts.map +1 -0
- package/dist/clis/index.d.mts +11 -20
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +155 -171
- package/dist/clis/index.mjs.map +1 -1
- package/dist/document-drive/index.d.ts +2 -281
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-model/index.d.ts +2 -2
- package/dist/{index-B_GlGmHN.d.ts → index-DPuDyjPo.d.ts} +2 -2
- package/dist/{index-B_GlGmHN.d.ts.map → index-DPuDyjPo.d.ts.map} +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/processors/index.d.ts +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/{types-CtGhGlNK.d.ts → types-CYb8tB1-.d.ts} +1 -1
- package/dist/{types-CtGhGlNK.d.ts.map → types-CYb8tB1-.d.ts.map} +1 -1
- package/dist/types-D8rmW22g.d.ts +418 -0
- package/dist/types-D8rmW22g.d.ts.map +1 -0
- package/package.json +16 -16
- package/dist/actions-CJe2O85M.d.ts.map +0 -1
package/dist/clis/index.mjs
CHANGED
|
@@ -76,9 +76,10 @@ const VERSIONED_DEPENDENCIES = [
|
|
|
76
76
|
"document-model",
|
|
77
77
|
"@powerhousedao/design-system",
|
|
78
78
|
"@powerhousedao/reactor-browser",
|
|
79
|
-
"@powerhousedao/connect"
|
|
79
|
+
"@powerhousedao/connect",
|
|
80
|
+
"@powerhousedao/analytics-engine-core"
|
|
80
81
|
];
|
|
81
|
-
const VERSIONED_DEV_DEPENDENCIES = ["@powerhousedao/ph-cli"
|
|
82
|
+
const VERSIONED_DEV_DEPENDENCIES = ["@powerhousedao/ph-cli"];
|
|
82
83
|
const DEFAULT_CONFIG = {
|
|
83
84
|
documentModelsDir: "./document-models",
|
|
84
85
|
editorsDir: "./editors",
|
|
@@ -121,27 +122,6 @@ const buildArgs = {
|
|
|
121
122
|
defaultValue: () => "dist",
|
|
122
123
|
defaultValueIsSerializable: true
|
|
123
124
|
}),
|
|
124
|
-
clean: flag({
|
|
125
|
-
type: boolean,
|
|
126
|
-
long: "clean",
|
|
127
|
-
description: "Erase the contents of the output dir when building",
|
|
128
|
-
defaultValue: () => true,
|
|
129
|
-
defaultValueIsSerializable: true
|
|
130
|
-
}),
|
|
131
|
-
dts: flag({
|
|
132
|
-
type: boolean,
|
|
133
|
-
long: "dts",
|
|
134
|
-
description: "Generate type definitions for the bundled code",
|
|
135
|
-
defaultValue: () => true,
|
|
136
|
-
defaultValueIsSerializable: true
|
|
137
|
-
}),
|
|
138
|
-
sourcemap: flag({
|
|
139
|
-
type: boolean,
|
|
140
|
-
long: "sourcemap",
|
|
141
|
-
description: "Generate a sourcemap for the bundled code",
|
|
142
|
-
defaultValue: () => true,
|
|
143
|
-
defaultValueIsSerializable: true
|
|
144
|
-
}),
|
|
145
125
|
...debugArgs
|
|
146
126
|
};
|
|
147
127
|
const packageManagerArgs = {
|
|
@@ -4024,12 +4004,12 @@ var require_validate_npm_package_license = /* @__PURE__ */ __commonJSMin(((expor
|
|
|
4024
4004
|
};
|
|
4025
4005
|
}));
|
|
4026
4006
|
//#endregion
|
|
4027
|
-
//#region ../../node_modules/.pnpm/lru-cache@11.2.
|
|
4007
|
+
//#region ../../node_modules/.pnpm/lru-cache@11.2.7/node_modules/lru-cache/dist/commonjs/index.min.js
|
|
4028
4008
|
var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4029
4009
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
4030
4010
|
exports.LRUCache = void 0;
|
|
4031
|
-
var
|
|
4032
|
-
typeof R.emitWarning == "function" ? R.emitWarning(
|
|
4011
|
+
var G = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, U = /* @__PURE__ */ new Set(), R = typeof process == "object" && process ? process : {}, I = (c, t, e, i) => {
|
|
4012
|
+
typeof R.emitWarning == "function" ? R.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
4033
4013
|
}, C = globalThis.AbortController, L = globalThis.AbortSignal;
|
|
4034
4014
|
if (typeof C > "u") {
|
|
4035
4015
|
L = class {
|
|
@@ -4053,27 +4033,27 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4053
4033
|
}
|
|
4054
4034
|
}
|
|
4055
4035
|
};
|
|
4056
|
-
let
|
|
4057
|
-
|
|
4036
|
+
let c = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
4037
|
+
c && (c = !1, I("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
4058
4038
|
};
|
|
4059
4039
|
}
|
|
4060
|
-
var
|
|
4040
|
+
var x = (c) => !U.has(c), y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c), M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null, z = class extends Array {
|
|
4061
4041
|
constructor(t) {
|
|
4062
4042
|
super(t), this.fill(0);
|
|
4063
4043
|
}
|
|
4064
|
-
}, W = class
|
|
4044
|
+
}, W = class c {
|
|
4065
4045
|
heap;
|
|
4066
4046
|
length;
|
|
4067
4047
|
static #o = !1;
|
|
4068
4048
|
static create(t) {
|
|
4069
4049
|
let e = M(t);
|
|
4070
4050
|
if (!e) return [];
|
|
4071
|
-
|
|
4072
|
-
let i = new
|
|
4073
|
-
return
|
|
4051
|
+
c.#o = !0;
|
|
4052
|
+
let i = new c(t, e);
|
|
4053
|
+
return c.#o = !1, i;
|
|
4074
4054
|
}
|
|
4075
4055
|
constructor(t, e) {
|
|
4076
|
-
if (!
|
|
4056
|
+
if (!c.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
4077
4057
|
this.heap = new e(t), this.length = 0;
|
|
4078
4058
|
}
|
|
4079
4059
|
push(t) {
|
|
@@ -4083,7 +4063,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4083
4063
|
return this.heap[--this.length];
|
|
4084
4064
|
}
|
|
4085
4065
|
};
|
|
4086
|
-
exports.LRUCache = class
|
|
4066
|
+
exports.LRUCache = class c {
|
|
4087
4067
|
#o;
|
|
4088
4068
|
#c;
|
|
4089
4069
|
#w;
|
|
@@ -4148,7 +4128,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4148
4128
|
},
|
|
4149
4129
|
free: t.#b,
|
|
4150
4130
|
isBackgroundFetch: (e) => t.#e(e),
|
|
4151
|
-
backgroundFetch: (e, i, s,
|
|
4131
|
+
backgroundFetch: (e, i, s, n) => t.#x(e, i, s, n),
|
|
4152
4132
|
moveToTail: (e) => t.#D(e),
|
|
4153
4133
|
indexes: (e) => t.#F(e),
|
|
4154
4134
|
rindexes: (e) => t.#O(e),
|
|
@@ -4183,30 +4163,30 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4183
4163
|
return this.#S;
|
|
4184
4164
|
}
|
|
4185
4165
|
constructor(t) {
|
|
4186
|
-
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge:
|
|
4166
|
+
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: r, dispose: a, onInsert: w, disposeAfter: f, noDisposeOnSet: d, noUpdateTTL: g, maxSize: A = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: b, noDeleteOnStaleGet: m, allowStaleOnFetchRejection: u, allowStaleOnFetchAbort: T, ignoreFetchAbort: F, perf: v } = t;
|
|
4187
4167
|
if (v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
4188
|
-
if (this.#m = v ??
|
|
4168
|
+
if (this.#m = v ?? G, e !== 0 && !y(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
4189
4169
|
let O = e ? M(e) : Array;
|
|
4190
4170
|
if (!O) throw new Error("invalid max value: " + e);
|
|
4191
4171
|
if (this.#o = e, this.#c = A, this.maxEntrySize = p || this.#c, this.sizeCalculation = _, this.sizeCalculation) {
|
|
4192
4172
|
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
4193
4173
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
4194
4174
|
}
|
|
4195
|
-
if (
|
|
4196
|
-
if (this.#U =
|
|
4197
|
-
if (this.#L = l, this.#v = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = new Array(e).fill(void 0), this.#t = new Array(e).fill(void 0), this.#a = new O(e), this.#u = new O(e), this.#l = 0, this.#h = 0, this.#b = W.create(e), this.#n = 0, this.#_ = 0, typeof
|
|
4175
|
+
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
4176
|
+
if (this.#U = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
4177
|
+
if (this.#L = l, this.#v = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = new Array(e).fill(void 0), this.#t = new Array(e).fill(void 0), this.#a = new O(e), this.#u = new O(e), this.#l = 0, this.#h = 0, this.#b = W.create(e), this.#n = 0, this.#_ = 0, typeof a == "function" && (this.#w = a), typeof w == "function" && (this.#C = w), typeof f == "function" ? (this.#S = f, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#w, this.#I = !!this.#C, this.#f = !!this.#S, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!g, this.noDeleteOnFetchRejection = !!b, this.allowStaleOnFetchRejection = !!u, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!F, this.maxEntrySize !== 0) {
|
|
4198
4178
|
if (this.#c !== 0 && !y(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
4199
4179
|
if (!y(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
4200
4180
|
this.#B();
|
|
4201
4181
|
}
|
|
4202
|
-
if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!
|
|
4182
|
+
if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!m, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = y(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
4203
4183
|
if (!y(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
4204
4184
|
this.#j();
|
|
4205
4185
|
}
|
|
4206
4186
|
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
4207
4187
|
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
4208
4188
|
let E = "LRU_CACHE_UNBOUNDED";
|
|
4209
|
-
|
|
4189
|
+
x(E) && (U.add(E), I("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, c));
|
|
4210
4190
|
}
|
|
4211
4191
|
}
|
|
4212
4192
|
getRemainingTTL(t) {
|
|
@@ -4216,41 +4196,45 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4216
4196
|
let t = new z(this.#o), e = new z(this.#o);
|
|
4217
4197
|
this.#d = t, this.#A = e;
|
|
4218
4198
|
let i = this.ttlAutopurge ? new Array(this.#o) : void 0;
|
|
4219
|
-
this.#g = i, this.#N = (
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4199
|
+
this.#g = i, this.#N = (h, r, a = this.#m.now()) => {
|
|
4200
|
+
e[h] = r !== 0 ? a : 0, t[h] = r, s(h, r);
|
|
4201
|
+
}, this.#R = (h) => {
|
|
4202
|
+
e[h] = t[h] !== 0 ? this.#m.now() : 0, s(h, t[h]);
|
|
4203
|
+
};
|
|
4204
|
+
let s = this.ttlAutopurge ? (h, r) => {
|
|
4205
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
|
|
4206
|
+
let a = setTimeout(() => {
|
|
4207
|
+
this.#p(h) && this.#E(this.#i[h], "expire");
|
|
4208
|
+
}, r + 1);
|
|
4209
|
+
a.unref && a.unref(), i[h] = a;
|
|
4225
4210
|
}
|
|
4226
|
-
}
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
n.remainingTTL = r - (n.now - f);
|
|
4211
|
+
} : () => {};
|
|
4212
|
+
this.#z = (h, r) => {
|
|
4213
|
+
if (t[r]) {
|
|
4214
|
+
let a = t[r], w = e[r];
|
|
4215
|
+
if (!a || !w) return;
|
|
4216
|
+
h.ttl = a, h.start = w, h.now = n || o();
|
|
4217
|
+
h.remainingTTL = a - (h.now - w);
|
|
4234
4218
|
}
|
|
4235
4219
|
};
|
|
4236
|
-
let
|
|
4237
|
-
let
|
|
4220
|
+
let n = 0, o = () => {
|
|
4221
|
+
let h = this.#m.now();
|
|
4238
4222
|
if (this.ttlResolution > 0) {
|
|
4239
|
-
|
|
4240
|
-
let
|
|
4241
|
-
|
|
4223
|
+
n = h;
|
|
4224
|
+
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
4225
|
+
r.unref && r.unref();
|
|
4242
4226
|
}
|
|
4243
|
-
return
|
|
4227
|
+
return h;
|
|
4244
4228
|
};
|
|
4245
|
-
this.getRemainingTTL = (
|
|
4246
|
-
let
|
|
4247
|
-
if (
|
|
4248
|
-
let
|
|
4249
|
-
if (!
|
|
4250
|
-
return
|
|
4251
|
-
}, this.#p = (
|
|
4252
|
-
let
|
|
4253
|
-
return !!
|
|
4229
|
+
this.getRemainingTTL = (h) => {
|
|
4230
|
+
let r = this.#s.get(h);
|
|
4231
|
+
if (r === void 0) return 0;
|
|
4232
|
+
let a = t[r], w = e[r];
|
|
4233
|
+
if (!a || !w) return Infinity;
|
|
4234
|
+
return a - ((n || o()) - w);
|
|
4235
|
+
}, this.#p = (h) => {
|
|
4236
|
+
let r = e[h], a = t[h];
|
|
4237
|
+
return !!a && !!r && (n || o()) - r > a;
|
|
4254
4238
|
};
|
|
4255
4239
|
}
|
|
4256
4240
|
#R = () => {};
|
|
@@ -4261,17 +4245,17 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4261
4245
|
let t = new z(this.#o);
|
|
4262
4246
|
this.#_ = 0, this.#y = t, this.#W = (e) => {
|
|
4263
4247
|
this.#_ -= t[e], t[e] = 0;
|
|
4264
|
-
}, this.#P = (e, i, s,
|
|
4248
|
+
}, this.#P = (e, i, s, n) => {
|
|
4265
4249
|
if (this.#e(i)) return 0;
|
|
4266
|
-
if (!y(s)) if (
|
|
4267
|
-
if (typeof
|
|
4268
|
-
if (s =
|
|
4250
|
+
if (!y(s)) if (n) {
|
|
4251
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
4252
|
+
if (s = n(i, e), !y(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
4269
4253
|
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
4270
4254
|
return s;
|
|
4271
4255
|
}, this.#M = (e, i, s) => {
|
|
4272
4256
|
if (t[e] = i, this.#c) {
|
|
4273
|
-
let
|
|
4274
|
-
for (; this.#_ >
|
|
4257
|
+
let n = this.#c - t[e];
|
|
4258
|
+
for (; this.#_ > n;) this.#G(!0);
|
|
4275
4259
|
}
|
|
4276
4260
|
this.#_ += t[e], s && (s.entrySize = i, s.totalCalculatedSize = this.#_);
|
|
4277
4261
|
};
|
|
@@ -4321,20 +4305,20 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4321
4305
|
[Symbol.toStringTag] = "LRUCache";
|
|
4322
4306
|
find(t, e = {}) {
|
|
4323
4307
|
for (let i of this.#F()) {
|
|
4324
|
-
let s = this.#t[i],
|
|
4325
|
-
if (
|
|
4308
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4309
|
+
if (n !== void 0 && t(n, this.#i[i], this)) return this.get(this.#i[i], e);
|
|
4326
4310
|
}
|
|
4327
4311
|
}
|
|
4328
4312
|
forEach(t, e = this) {
|
|
4329
4313
|
for (let i of this.#F()) {
|
|
4330
|
-
let s = this.#t[i],
|
|
4331
|
-
|
|
4314
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4315
|
+
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4332
4316
|
}
|
|
4333
4317
|
}
|
|
4334
4318
|
rforEach(t, e = this) {
|
|
4335
4319
|
for (let i of this.#O()) {
|
|
4336
|
-
let s = this.#t[i],
|
|
4337
|
-
|
|
4320
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4321
|
+
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4338
4322
|
}
|
|
4339
4323
|
}
|
|
4340
4324
|
purgeStale() {
|
|
@@ -4347,25 +4331,25 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4347
4331
|
if (e === void 0) return;
|
|
4348
4332
|
let i = this.#t[e], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
4349
4333
|
if (s === void 0) return;
|
|
4350
|
-
let
|
|
4334
|
+
let n = { value: s };
|
|
4351
4335
|
if (this.#d && this.#A) {
|
|
4352
|
-
let
|
|
4353
|
-
if (
|
|
4336
|
+
let o = this.#d[e], h = this.#A[e];
|
|
4337
|
+
if (o && h) n.ttl = o - (this.#m.now() - h), n.start = Date.now();
|
|
4354
4338
|
}
|
|
4355
|
-
return this.#y && (
|
|
4339
|
+
return this.#y && (n.size = this.#y[e]), n;
|
|
4356
4340
|
}
|
|
4357
4341
|
dump() {
|
|
4358
4342
|
let t = [];
|
|
4359
4343
|
for (let e of this.#F({ allowStale: !0 })) {
|
|
4360
|
-
let i = this.#i[e], s = this.#t[e],
|
|
4361
|
-
if (
|
|
4362
|
-
let
|
|
4344
|
+
let i = this.#i[e], s = this.#t[e], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4345
|
+
if (n === void 0 || i === void 0) continue;
|
|
4346
|
+
let o = { value: n };
|
|
4363
4347
|
if (this.#d && this.#A) {
|
|
4364
|
-
|
|
4365
|
-
let
|
|
4366
|
-
|
|
4348
|
+
o.ttl = this.#d[e];
|
|
4349
|
+
let h = this.#m.now() - this.#A[e];
|
|
4350
|
+
o.start = Math.floor(Date.now() - h);
|
|
4367
4351
|
}
|
|
4368
|
-
this.#y && (
|
|
4352
|
+
this.#y && (o.size = this.#y[e]), t.unshift([i, o]);
|
|
4369
4353
|
}
|
|
4370
4354
|
return t;
|
|
4371
4355
|
}
|
|
@@ -4381,28 +4365,28 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4381
4365
|
}
|
|
4382
4366
|
set(t, e, i = {}) {
|
|
4383
4367
|
if (e === void 0) return this.delete(t), this;
|
|
4384
|
-
let { ttl: s = this.ttl, start:
|
|
4385
|
-
if (this.maxEntrySize &&
|
|
4386
|
-
let
|
|
4387
|
-
if (
|
|
4368
|
+
let { ttl: s = this.ttl, start: n, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, { noUpdateTTL: a = this.noUpdateTTL } = i, w = this.#P(t, e, i.size || 0, h);
|
|
4369
|
+
if (this.maxEntrySize && w > this.maxEntrySize) return r && (r.set = "miss", r.maxEntrySizeExceeded = !0), this.#E(t, "set"), this;
|
|
4370
|
+
let f = this.#n === 0 ? void 0 : this.#s.get(t);
|
|
4371
|
+
if (f === void 0) f = this.#n === 0 ? this.#h : this.#b.length !== 0 ? this.#b.pop() : this.#n === this.#o ? this.#G(!1) : this.#n, this.#i[f] = t, this.#t[f] = e, this.#s.set(t, f), this.#a[this.#h] = f, this.#u[f] = this.#h, this.#h = f, this.#n++, this.#M(f, w, r), r && (r.set = "add"), a = !1, this.#I && this.#C?.(e, t, "add");
|
|
4388
4372
|
else {
|
|
4389
|
-
this.#D(
|
|
4390
|
-
let d = this.#t[
|
|
4373
|
+
this.#D(f);
|
|
4374
|
+
let d = this.#t[f];
|
|
4391
4375
|
if (e !== d) {
|
|
4392
4376
|
if (this.#v && this.#e(d)) {
|
|
4393
4377
|
d.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
|
|
4394
4378
|
let { __staleWhileFetching: g } = d;
|
|
4395
|
-
g !== void 0 && !
|
|
4379
|
+
g !== void 0 && !o && (this.#T && this.#w?.(g, t, "set"), this.#f && this.#r?.push([
|
|
4396
4380
|
g,
|
|
4397
4381
|
t,
|
|
4398
4382
|
"set"
|
|
4399
4383
|
]));
|
|
4400
|
-
} else
|
|
4384
|
+
} else o || (this.#T && this.#w?.(d, t, "set"), this.#f && this.#r?.push([
|
|
4401
4385
|
d,
|
|
4402
4386
|
t,
|
|
4403
4387
|
"set"
|
|
4404
4388
|
]));
|
|
4405
|
-
if (this.#W(
|
|
4389
|
+
if (this.#W(f), this.#M(f, w, r), this.#t[f] = e, r) {
|
|
4406
4390
|
r.set = "replace";
|
|
4407
4391
|
let g = d && this.#e(d) ? d.__staleWhileFetching : d;
|
|
4408
4392
|
g !== void 0 && (r.oldValue = g);
|
|
@@ -4410,7 +4394,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4410
4394
|
} else r && (r.set = "update");
|
|
4411
4395
|
this.#I && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
4412
4396
|
}
|
|
4413
|
-
if (s !== 0 && !this.#d && this.#j(), this.#d && (
|
|
4397
|
+
if (s !== 0 && !this.#d && this.#j(), this.#d && (a || this.#N(f, s, n), r && this.#z(r, f)), !o && this.#f && this.#r) {
|
|
4414
4398
|
let d = this.#r, g;
|
|
4415
4399
|
for (; g = d?.shift();) this.#S?.(...g);
|
|
4416
4400
|
}
|
|
@@ -4420,7 +4404,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4420
4404
|
try {
|
|
4421
4405
|
for (; this.#n;) {
|
|
4422
4406
|
let t = this.#t[this.#l];
|
|
4423
|
-
if (this.#
|
|
4407
|
+
if (this.#G(!0), this.#e(t)) {
|
|
4424
4408
|
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
4425
4409
|
} else if (t !== void 0) return t;
|
|
4426
4410
|
}
|
|
@@ -4431,7 +4415,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4431
4415
|
}
|
|
4432
4416
|
}
|
|
4433
4417
|
}
|
|
4434
|
-
#
|
|
4418
|
+
#G(t) {
|
|
4435
4419
|
let e = this.#l, i = this.#i[e], s = this.#t[e];
|
|
4436
4420
|
return this.#v && this.#e(s) ? s.__abortController.abort(/* @__PURE__ */ new Error("evicted")) : (this.#T || this.#f) && (this.#T && this.#w?.(s, i, "evict"), this.#f && this.#r?.push([
|
|
4437
4421
|
s,
|
|
@@ -4440,49 +4424,49 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4440
4424
|
])), this.#W(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = void 0), t && (this.#i[e] = void 0, this.#t[e] = void 0, this.#b.push(e)), this.#n === 1 ? (this.#l = this.#h = 0, this.#b.length = 0) : this.#l = this.#a[e], this.#s.delete(i), this.#n--, e;
|
|
4441
4425
|
}
|
|
4442
4426
|
has(t, e = {}) {
|
|
4443
|
-
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e,
|
|
4444
|
-
if (
|
|
4445
|
-
let
|
|
4446
|
-
if (this.#e(
|
|
4447
|
-
if (this.#p(
|
|
4448
|
-
else return i && this.#R(
|
|
4427
|
+
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = this.#s.get(t);
|
|
4428
|
+
if (n !== void 0) {
|
|
4429
|
+
let o = this.#t[n];
|
|
4430
|
+
if (this.#e(o) && o.__staleWhileFetching === void 0) return !1;
|
|
4431
|
+
if (this.#p(n)) s && (s.has = "stale", this.#z(s, n));
|
|
4432
|
+
else return i && this.#R(n), s && (s.has = "hit", this.#z(s, n)), !0;
|
|
4449
4433
|
} else s && (s.has = "miss");
|
|
4450
4434
|
return !1;
|
|
4451
4435
|
}
|
|
4452
4436
|
peek(t, e = {}) {
|
|
4453
4437
|
let { allowStale: i = this.allowStale } = e, s = this.#s.get(t);
|
|
4454
4438
|
if (s === void 0 || !i && this.#p(s)) return;
|
|
4455
|
-
let
|
|
4456
|
-
return this.#e(
|
|
4457
|
-
}
|
|
4458
|
-
#
|
|
4459
|
-
let
|
|
4460
|
-
if (this.#e(
|
|
4461
|
-
let
|
|
4462
|
-
|
|
4439
|
+
let n = this.#t[s];
|
|
4440
|
+
return this.#e(n) ? n.__staleWhileFetching : n;
|
|
4441
|
+
}
|
|
4442
|
+
#x(t, e, i, s) {
|
|
4443
|
+
let n = e === void 0 ? void 0 : this.#t[e];
|
|
4444
|
+
if (this.#e(n)) return n;
|
|
4445
|
+
let o = new C(), { signal: h } = i;
|
|
4446
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
4463
4447
|
let r = {
|
|
4464
|
-
signal:
|
|
4448
|
+
signal: o.signal,
|
|
4465
4449
|
options: i,
|
|
4466
4450
|
context: s
|
|
4467
|
-
},
|
|
4468
|
-
let { aborted: l } =
|
|
4469
|
-
if (i.status && (l && !_ ? (i.status.fetchAborted = !0, i.status.fetchError =
|
|
4470
|
-
let
|
|
4471
|
-
return (u === g ||
|
|
4472
|
-
},
|
|
4473
|
-
let { aborted: l } =
|
|
4474
|
-
if (this.#t[e] === g && (!
|
|
4451
|
+
}, a = (p, _ = !1) => {
|
|
4452
|
+
let { aborted: l } = o.signal, S = i.ignoreFetchAbort && p !== void 0, b = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && p !== void 0);
|
|
4453
|
+
if (i.status && (l && !_ ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, S && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), l && !S && !_) return f(o.signal.reason, b);
|
|
4454
|
+
let m = g, u = this.#t[e];
|
|
4455
|
+
return (u === g || S && _ && u === void 0) && (p === void 0 ? m.__staleWhileFetching !== void 0 ? this.#t[e] = m.__staleWhileFetching : this.#E(t, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.set(t, p, r.options))), p;
|
|
4456
|
+
}, w = (p) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = p), f(p, !1)), f = (p, _) => {
|
|
4457
|
+
let { aborted: l } = o.signal, S = l && i.allowStaleOnFetchAbort, b = S || i.allowStaleOnFetchRejection, m = b || i.noDeleteOnFetchRejection, u = g;
|
|
4458
|
+
if (this.#t[e] === g && (!m || !_ && u.__staleWhileFetching === void 0 ? this.#E(t, "fetch") : S || (this.#t[e] = u.__staleWhileFetching)), b) return i.status && u.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), u.__staleWhileFetching;
|
|
4475
4459
|
if (u.__returned === u) throw p;
|
|
4476
4460
|
}, d = (p, _) => {
|
|
4477
|
-
let l = this.#L?.(t,
|
|
4478
|
-
l && l instanceof Promise && l.then((
|
|
4479
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (p(void 0), i.allowStaleOnFetchAbort && (p = (
|
|
4461
|
+
let l = this.#L?.(t, n, r);
|
|
4462
|
+
l && l instanceof Promise && l.then((S) => p(S === void 0 ? void 0 : S), _), o.signal.addEventListener("abort", () => {
|
|
4463
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (p(void 0), i.allowStaleOnFetchAbort && (p = (S) => a(S, !0)));
|
|
4480
4464
|
});
|
|
4481
4465
|
};
|
|
4482
4466
|
i.status && (i.status.fetchDispatched = !0);
|
|
4483
|
-
let g = new Promise(d).then(
|
|
4484
|
-
__abortController:
|
|
4485
|
-
__staleWhileFetching:
|
|
4467
|
+
let g = new Promise(d).then(a, w), A = Object.assign(g, {
|
|
4468
|
+
__abortController: o,
|
|
4469
|
+
__staleWhileFetching: n,
|
|
4486
4470
|
__returned: void 0
|
|
4487
4471
|
});
|
|
4488
4472
|
return e === void 0 ? (this.set(t, A, {
|
|
@@ -4496,42 +4480,42 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4496
4480
|
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof C;
|
|
4497
4481
|
}
|
|
4498
4482
|
async fetch(t, e = {}) {
|
|
4499
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet:
|
|
4483
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: r = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: w = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: g = this.ignoreFetchAbort, allowStaleOnFetchAbort: A = this.allowStaleOnFetchAbort, context: p, forceRefresh: _ = !1, status: l, signal: S } = e;
|
|
4500
4484
|
if (!this.#v) return l && (l.fetch = "get"), this.get(t, {
|
|
4501
4485
|
allowStale: i,
|
|
4502
4486
|
updateAgeOnGet: s,
|
|
4503
|
-
noDeleteOnStaleGet:
|
|
4487
|
+
noDeleteOnStaleGet: n,
|
|
4504
4488
|
status: l
|
|
4505
4489
|
});
|
|
4506
4490
|
let b = {
|
|
4507
4491
|
allowStale: i,
|
|
4508
4492
|
updateAgeOnGet: s,
|
|
4509
|
-
noDeleteOnStaleGet:
|
|
4510
|
-
ttl:
|
|
4511
|
-
noDisposeOnSet:
|
|
4493
|
+
noDeleteOnStaleGet: n,
|
|
4494
|
+
ttl: o,
|
|
4495
|
+
noDisposeOnSet: h,
|
|
4512
4496
|
size: r,
|
|
4513
|
-
sizeCalculation:
|
|
4514
|
-
noUpdateTTL:
|
|
4515
|
-
noDeleteOnFetchRejection:
|
|
4497
|
+
sizeCalculation: a,
|
|
4498
|
+
noUpdateTTL: w,
|
|
4499
|
+
noDeleteOnFetchRejection: f,
|
|
4516
4500
|
allowStaleOnFetchRejection: d,
|
|
4517
4501
|
allowStaleOnFetchAbort: A,
|
|
4518
4502
|
ignoreFetchAbort: g,
|
|
4519
4503
|
status: l,
|
|
4520
|
-
signal:
|
|
4521
|
-
},
|
|
4522
|
-
if (
|
|
4504
|
+
signal: S
|
|
4505
|
+
}, m = this.#s.get(t);
|
|
4506
|
+
if (m === void 0) {
|
|
4523
4507
|
l && (l.fetch = "miss");
|
|
4524
|
-
let u = this.#
|
|
4508
|
+
let u = this.#x(t, m, b, p);
|
|
4525
4509
|
return u.__returned = u;
|
|
4526
4510
|
} else {
|
|
4527
|
-
let u = this.#t[
|
|
4511
|
+
let u = this.#t[m];
|
|
4528
4512
|
if (this.#e(u)) {
|
|
4529
4513
|
let E = i && u.__staleWhileFetching !== void 0;
|
|
4530
4514
|
return l && (l.fetch = "inflight", E && (l.returnedStale = !0)), E ? u.__staleWhileFetching : u.__returned = u;
|
|
4531
4515
|
}
|
|
4532
|
-
let T = this.#p(
|
|
4533
|
-
if (!_ && !T) return l && (l.fetch = "hit"), this.#D(
|
|
4534
|
-
let F = this.#
|
|
4516
|
+
let T = this.#p(m);
|
|
4517
|
+
if (!_ && !T) return l && (l.fetch = "hit"), this.#D(m), s && this.#R(m), l && this.#z(l, m), u;
|
|
4518
|
+
let F = this.#x(t, m, b, p), O = F.__staleWhileFetching !== void 0 && i;
|
|
4535
4519
|
return l && (l.fetch = T ? "stale" : "refresh", O && T && (l.returnedStale = !0)), O ? F.__staleWhileFetching : F.__returned = F;
|
|
4536
4520
|
}
|
|
4537
4521
|
}
|
|
@@ -4543,20 +4527,20 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4543
4527
|
memo(t, e = {}) {
|
|
4544
4528
|
let i = this.#U;
|
|
4545
4529
|
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
4546
|
-
let { context: s, forceRefresh:
|
|
4547
|
-
if (!
|
|
4548
|
-
let r = i(t,
|
|
4549
|
-
options:
|
|
4530
|
+
let { context: s, forceRefresh: n, ...o } = e, h = this.get(t, o);
|
|
4531
|
+
if (!n && h !== void 0) return h;
|
|
4532
|
+
let r = i(t, h, {
|
|
4533
|
+
options: o,
|
|
4550
4534
|
context: s
|
|
4551
4535
|
});
|
|
4552
|
-
return this.set(t, r,
|
|
4536
|
+
return this.set(t, r, o), r;
|
|
4553
4537
|
}
|
|
4554
4538
|
get(t, e = {}) {
|
|
4555
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet:
|
|
4556
|
-
if (
|
|
4557
|
-
let r = this.#t[
|
|
4558
|
-
return
|
|
4559
|
-
} else
|
|
4539
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e, h = this.#s.get(t);
|
|
4540
|
+
if (h !== void 0) {
|
|
4541
|
+
let r = this.#t[h], a = this.#e(r);
|
|
4542
|
+
return o && this.#z(o, h), this.#p(h) ? (o && (o.get = "stale"), a ? (o && i && r.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? r.__staleWhileFetching : void 0) : (n || this.#E(t, "expire"), o && i && (o.returnedStale = !0), i ? r : void 0)) : (o && (o.get = "hit"), a ? r.__staleWhileFetching : (this.#D(h), s && this.#R(h), r));
|
|
4543
|
+
} else o && (o.get = "miss");
|
|
4560
4544
|
}
|
|
4561
4545
|
#k(t, e) {
|
|
4562
4546
|
this.#u[e] = t, this.#a[t] = e;
|
|
@@ -4574,25 +4558,25 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4574
4558
|
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this.#V(e);
|
|
4575
4559
|
else {
|
|
4576
4560
|
this.#W(s);
|
|
4577
|
-
let
|
|
4578
|
-
if (this.#e(
|
|
4579
|
-
|
|
4561
|
+
let n = this.#t[s];
|
|
4562
|
+
if (this.#e(n) ? n.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(n, t, e), this.#f && this.#r?.push([
|
|
4563
|
+
n,
|
|
4580
4564
|
t,
|
|
4581
4565
|
e
|
|
4582
4566
|
])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
4583
4567
|
else if (s === this.#l) this.#l = this.#a[s];
|
|
4584
4568
|
else {
|
|
4585
|
-
let
|
|
4586
|
-
this.#a[
|
|
4587
|
-
let
|
|
4588
|
-
this.#u[
|
|
4569
|
+
let o = this.#u[s];
|
|
4570
|
+
this.#a[o] = this.#a[s];
|
|
4571
|
+
let h = this.#a[s];
|
|
4572
|
+
this.#u[h] = this.#u[s];
|
|
4589
4573
|
}
|
|
4590
4574
|
this.#n--, this.#b.push(s);
|
|
4591
4575
|
}
|
|
4592
4576
|
}
|
|
4593
4577
|
if (this.#f && this.#r?.length) {
|
|
4594
|
-
let s = this.#r,
|
|
4595
|
-
for (;
|
|
4578
|
+
let s = this.#r, n;
|
|
4579
|
+
for (; n = s?.shift();) this.#S?.(...n);
|
|
4596
4580
|
}
|
|
4597
4581
|
return i;
|
|
4598
4582
|
}
|