bt-core-app 1.4.580 → 1.4.581
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/bt-core-app.js +88 -61
- package/dist/index.d.ts +3 -0
- package/package.json +1 -1
package/dist/bt-core-app.js
CHANGED
|
@@ -10251,102 +10251,129 @@ function BV() {
|
|
|
10251
10251
|
function lk(e) {
|
|
10252
10252
|
const t = "isInDemoMode", n = localStorage.getItem(t), a = H((e == null ? void 0 : e.startInDemo) == !0 || n == "true"), l = (e == null ? void 0 : e.apis) ?? [];
|
|
10253
10253
|
function r() {
|
|
10254
|
-
var
|
|
10255
|
-
((
|
|
10254
|
+
var m;
|
|
10255
|
+
((m = e == null ? void 0 : e.auth) == null ? void 0 : m.isLoggedIn.value) == !0 && (e == null || e.auth.logout()), (e == null ? void 0 : e.getAuthToken) != null && e.auth != null && e.auth.setAuth(Yw(e.getAuthToken())), a.value = !0, localStorage.setItem(t, "true"), window.location.href = location.href;
|
|
10256
10256
|
}
|
|
10257
|
-
function i(
|
|
10257
|
+
function i(m) {
|
|
10258
10258
|
a.value = !1;
|
|
10259
|
-
const
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
}), localStorage.setItem(t, "false"), (e == null ? void 0 : e.auth) != null && (e == null || e.auth.logout()), window.location.href =
|
|
10259
|
+
const g = z0();
|
|
10260
|
+
g && g._s.forEach((y) => {
|
|
10261
|
+
y.$reset();
|
|
10262
|
+
}), localStorage.setItem(t, "false"), (e == null ? void 0 : e.auth) != null && (e == null || e.auth.logout()), window.location.href = m == !0 ? location.origin : location.href;
|
|
10263
10263
|
}
|
|
10264
|
-
function o(
|
|
10265
|
-
let
|
|
10266
|
-
if (
|
|
10267
|
-
const
|
|
10268
|
-
console.log(`searching for path ${
|
|
10264
|
+
function o(m) {
|
|
10265
|
+
let g;
|
|
10266
|
+
if (m.finalUrl != null) {
|
|
10267
|
+
const y = new URL(m.finalUrl, "https://demo");
|
|
10268
|
+
console.log(`searching for path ${y.pathname} or ${y.pathname + y.search}`), g = l.find((d) => d.path == y.pathname || d.path == y.pathname + y.search);
|
|
10269
10269
|
}
|
|
10270
|
-
return
|
|
10270
|
+
return g == null && (g = l.find((y) => Array.isArray(y.nav) ? y.nav.some((d) => d == m.nav) : y.nav == m.nav)), g == null && console.log(`No api group found for ${m.nav} and path: ${m.additionalUrl}`), g;
|
|
10271
10271
|
}
|
|
10272
|
-
function s(
|
|
10273
|
-
var
|
|
10272
|
+
function s(m) {
|
|
10273
|
+
var d;
|
|
10274
10274
|
if (l == null)
|
|
10275
10275
|
return Promise.resolve("no demo data available for this api");
|
|
10276
|
-
const
|
|
10277
|
-
if (
|
|
10278
|
-
const
|
|
10279
|
-
|
|
10276
|
+
const g = m.id ?? ((d = m.data) == null ? void 0 : d.id), y = o(m);
|
|
10277
|
+
if (g != null && (y == null ? void 0 : y.data) != null) {
|
|
10278
|
+
const x = y.data.findIndex((C) => C.id == g);
|
|
10279
|
+
x >= 0 && (y.deleteAction != null ? y.deleteAction(y.data, x) : y.data.splice(x, 1));
|
|
10280
10280
|
}
|
|
10281
|
-
return new Promise(function(
|
|
10281
|
+
return new Promise(function(x) {
|
|
10282
10282
|
setTimeout(function() {
|
|
10283
|
-
|
|
10283
|
+
x({
|
|
10284
10284
|
data: void 0
|
|
10285
10285
|
});
|
|
10286
10286
|
}, 200);
|
|
10287
10287
|
});
|
|
10288
10288
|
}
|
|
10289
|
-
function c(
|
|
10290
|
-
var d
|
|
10289
|
+
function c(m, g, y) {
|
|
10290
|
+
var d = y;
|
|
10291
|
+
if (d != null && (d = d.replaceAll("/", "").replaceAll(" ", "").toLowerCase()), d != null) {
|
|
10292
|
+
if (d = d.split("?")[0], g == "Get") {
|
|
10293
|
+
if (d != null && m.getActions != null && m.getActions[d] != null)
|
|
10294
|
+
return m.getActions[d];
|
|
10295
|
+
} else if (g == "Patch") {
|
|
10296
|
+
if (d != null && m.patchActions != null && m.patchActions[d] != null)
|
|
10297
|
+
return m.patchActions[d];
|
|
10298
|
+
} else if (g == "Post" && d != null && m.postActions != null && m.postActions[d] != null)
|
|
10299
|
+
return m.postActions[d];
|
|
10300
|
+
}
|
|
10301
|
+
}
|
|
10302
|
+
function u(m) {
|
|
10303
|
+
var C, p;
|
|
10291
10304
|
if (l == null)
|
|
10292
10305
|
throw new Error("no demo data available for this api");
|
|
10293
|
-
const
|
|
10294
|
-
let
|
|
10295
|
-
|
|
10306
|
+
const g = m.id ?? ((C = m.data) == null ? void 0 : C.id), y = o(m);
|
|
10307
|
+
let d;
|
|
10308
|
+
if (y != null) {
|
|
10309
|
+
y.data ?? (y.data = []);
|
|
10310
|
+
var x = c(y, "Get", m.additionalUrl);
|
|
10311
|
+
x != null ? d = x(y.data, m, g) : y.getAction != null ? d = y.getAction(y.data, g) : g != null ? d = (p = y.data) == null ? void 0 : p.find((S) => S.id == g) : y.path != null && (d = y.data);
|
|
10312
|
+
}
|
|
10313
|
+
return d == null ? Promise.resolve(void 0) : new Promise((S) => {
|
|
10296
10314
|
setTimeout(() => {
|
|
10297
|
-
|
|
10298
|
-
data:
|
|
10315
|
+
S({
|
|
10316
|
+
data: d
|
|
10299
10317
|
});
|
|
10300
10318
|
});
|
|
10301
10319
|
});
|
|
10302
10320
|
}
|
|
10303
|
-
function
|
|
10321
|
+
function f(m) {
|
|
10304
10322
|
if (l == null)
|
|
10305
10323
|
throw new Error("no demo data available for this api");
|
|
10306
|
-
const
|
|
10307
|
-
let
|
|
10308
|
-
return
|
|
10324
|
+
const g = o(m);
|
|
10325
|
+
let y;
|
|
10326
|
+
return g != null && (g.data ?? (g.data = []), g.getAllAction != null ? y = g.getAllAction(g.data, m.params) : y = g.data), y == null ? Promise.resolve(void 0) : new Promise((d) => {
|
|
10309
10327
|
setTimeout(() => {
|
|
10310
|
-
|
|
10311
|
-
data:
|
|
10328
|
+
d({
|
|
10329
|
+
data: y,
|
|
10312
10330
|
filters: [],
|
|
10313
|
-
count: (
|
|
10331
|
+
count: (y == null ? void 0 : y.length) ?? 0
|
|
10314
10332
|
});
|
|
10315
10333
|
});
|
|
10316
10334
|
});
|
|
10317
10335
|
}
|
|
10318
|
-
function
|
|
10319
|
-
var
|
|
10336
|
+
function h(m) {
|
|
10337
|
+
var x, C;
|
|
10320
10338
|
if (l == null)
|
|
10321
10339
|
throw new Error("no demo data available for this api");
|
|
10322
|
-
const
|
|
10323
|
-
let
|
|
10324
|
-
|
|
10340
|
+
const g = o(m);
|
|
10341
|
+
let y;
|
|
10342
|
+
if (g != null) {
|
|
10343
|
+
g.data ?? (g.data = []);
|
|
10344
|
+
var d = c(g, "Post", m.additionalUrl);
|
|
10345
|
+
d != null ? y = d(g.data, m) : g.postAction != null ? y = g.postAction(g.data, m.data) : m.data != null && (m.data.id == null && (m.data.id = ((((x = g.data) == null ? void 0 : x.length) ?? 0) + 1).toString()), y = m.data, (C = g.data) == null || C.push(y));
|
|
10346
|
+
}
|
|
10347
|
+
return y == null ? Promise.resolve(void 0) : new Promise((p) => {
|
|
10325
10348
|
setTimeout(() => {
|
|
10326
|
-
|
|
10327
|
-
data:
|
|
10349
|
+
p({
|
|
10350
|
+
data: y
|
|
10328
10351
|
});
|
|
10329
10352
|
});
|
|
10330
10353
|
});
|
|
10331
10354
|
}
|
|
10332
|
-
function
|
|
10333
|
-
var
|
|
10355
|
+
function v(m) {
|
|
10356
|
+
var x, C;
|
|
10334
10357
|
if (l == null)
|
|
10335
10358
|
throw new Error("no demo data available for this api");
|
|
10336
|
-
const
|
|
10337
|
-
let
|
|
10338
|
-
if (
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10359
|
+
const g = o(m);
|
|
10360
|
+
let y;
|
|
10361
|
+
if (g != null) {
|
|
10362
|
+
g.data ?? (g.data = []);
|
|
10363
|
+
var d = c(g, "Patch", m.additionalUrl);
|
|
10364
|
+
if (d != null)
|
|
10365
|
+
y = d(g.data, m);
|
|
10366
|
+
else if (g.patchAction != null)
|
|
10367
|
+
y = g.patchAction(g.data, m.data);
|
|
10368
|
+
else if (m.data.id != null) {
|
|
10369
|
+
const p = (x = g.data) == null ? void 0 : x.findIndex((S) => S.id == m.data.id);
|
|
10370
|
+
p != null && p > -1 && ((C = g.data) == null || C.splice(p, 1, m.data)), y = m.data;
|
|
10371
|
+
}
|
|
10372
|
+
}
|
|
10373
|
+
return y == null ? Promise.resolve(void 0) : new Promise((p) => {
|
|
10347
10374
|
setTimeout(() => {
|
|
10348
|
-
|
|
10349
|
-
data:
|
|
10375
|
+
p({
|
|
10376
|
+
data: y
|
|
10350
10377
|
});
|
|
10351
10378
|
});
|
|
10352
10379
|
});
|
|
@@ -10357,10 +10384,10 @@ function lk(e) {
|
|
|
10357
10384
|
startDemo: r,
|
|
10358
10385
|
data: l,
|
|
10359
10386
|
deleteItem: s,
|
|
10360
|
-
get:
|
|
10361
|
-
getAll:
|
|
10362
|
-
post:
|
|
10363
|
-
patch:
|
|
10387
|
+
get: u,
|
|
10388
|
+
getAll: f,
|
|
10389
|
+
post: h,
|
|
10390
|
+
patch: v
|
|
10364
10391
|
}, hc;
|
|
10365
10392
|
}
|
|
10366
10393
|
let bn;
|
package/dist/index.d.ts
CHANGED
|
@@ -552,6 +552,9 @@ export declare interface DemoApiGroup {
|
|
|
552
552
|
getAction?: <T>(list: T[], id?: string) => T | any;
|
|
553
553
|
patchAction?: <T>(list: T[], item: any) => T | any;
|
|
554
554
|
postAction?: <T>(list: T[], item: any) => T | any;
|
|
555
|
+
getActions?: Record<string, <T>(list: T[], pathOptions?: PathOptions, id?: string) => any>;
|
|
556
|
+
postActions?: Record<string, <T>(list: T[], pathOptions?: PathOptions, id?: string) => any>;
|
|
557
|
+
patchActions?: Record<string, <T>(list: T[], pathOptions?: PathOptions, id?: string) => any>;
|
|
555
558
|
}
|
|
556
559
|
|
|
557
560
|
export declare const demoKey: unique symbol;
|
package/package.json
CHANGED