buzzcasting-storage 3.21.5 → 3.21.8
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/README.md +38 -41
- package/dist/buzzcasting-storage.d.ts +10 -0
- package/dist/buzzcasting-storage.esm.js +66 -19
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,15 @@ BuzzCasting Social Media Wall & Dataviz [More info](https://www.touchflows.com/s
|
|
|
6
6
|
|
|
7
7
|
Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Window object
|
|
8
8
|
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
`docs/` is typedoc-generated API reference (regenerated by `npm run docs`, overwritten every time — don't hand-edit it). Hand-written architecture guides live in [`documentation/`](documentation/) instead:
|
|
12
|
+
|
|
13
|
+
- [documentation/architecture.md](documentation/architecture.md) — the `BuzzcastingStorageManager`/`Widget`/`BuzzcastingStorageReader` pipeline, the subscribe → fetch → hash-diff → broadcast → re-read data flow, and why a `Widget` can only ever render `cloud`/`series`/`messages` data.
|
|
14
|
+
- [documentation/storage-backends.md](documentation/storage-backends.md) — the five interchangeable storage backends, the Dexie schema, and the staleness/expiry model (there isn't much of one).
|
|
15
|
+
- [documentation/known-issues.md](documentation/known-issues.md) — confirmed bugs and inconsistencies in the current codebase (e.g. `ApiClient.loadDashboards` actually fetching the widgets endpoint, not a dashboards one) worth knowing about before you hit them yourself.
|
|
16
|
+
- [documentation/moderation.md](documentation/moderation.md) — `hideMessage`/`hideLabels`: a soft `visible` flag in Dexie plus a remote call for messages, a remote-only call with no local implementation at all for cloud labels, and the separate, deployment-time `MODERATION` enum that gates which messages are ever fetched in the first place.
|
|
17
|
+
|
|
9
18
|
## Features
|
|
10
19
|
|
|
11
20
|
- ✨ Fully customized [eslint](https://eslint.org/) configuration based on the config by [Antfu](https://github.com/antfu/eslint-config)
|
|
@@ -18,59 +27,47 @@ Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Wind
|
|
|
18
27
|
|
|
19
28
|
## Get started
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
import BuzzcastingStorageManager, {
|
|
25
|
-
IMessages,
|
|
26
|
-
IQuery,
|
|
27
|
-
IStorageManager,
|
|
28
|
-
} from 'buzzcasting-storage'
|
|
29
|
-
|
|
30
|
-
const options: IStorageManager = {
|
|
31
|
-
app: 'my-subdomain',
|
|
32
|
-
version: 'v4',
|
|
33
|
-
token: 'meta',
|
|
34
|
-
bearer: 'bearer_token',
|
|
35
|
-
storage: 'dexie',
|
|
36
|
-
moderation: 'none',
|
|
37
|
-
beforeTime: null,
|
|
38
|
-
delay: 0,
|
|
39
|
-
period: 0,
|
|
40
|
-
}
|
|
30
|
+
This package has two entry points, used by two different kinds of consumer — see [documentation/architecture.md](documentation/architecture.md) for the full picture.
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
**A rendered widget component** (e.g. a `cards-widget`/`series-widget`/`cloud-widget` in `buzzcasting-app`) uses `Widget`, keyed off its own `data-*` attributes:
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
```ts
|
|
35
|
+
import { Widget } from 'buzzcasting-storage'
|
|
36
|
+
import type { IResponse } from 'buzzcasting-utils'
|
|
37
|
+
|
|
38
|
+
// element.dataset.{widget,dashboard,type} become the query; window.__bc.opts
|
|
39
|
+
// must already be set up by the host app (it supplies `presentation`).
|
|
40
|
+
const setData = (response: IResponse) => {
|
|
41
|
+
if (!response.success) return
|
|
42
|
+
// ...update component state from response.data
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
const
|
|
45
|
+
const widget = new Widget(element, [setData])
|
|
46
|
+
widget.subscribe() // registers with the app-level BuzzcastingStorageManager
|
|
51
47
|
```
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
`Widget` only supports `series`, `cloud`, and `messages` query types — nothing else (this is a hard architectural constraint, see [documentation/architecture.md](documentation/architecture.md)).
|
|
54
50
|
|
|
55
|
-
The
|
|
51
|
+
**The host app itself** (once, at startup) constructs the orchestrator every `Widget` rendezvouses with over a shared `BroadcastChannel`:
|
|
56
52
|
|
|
57
53
|
```ts
|
|
58
|
-
|
|
54
|
+
import { BuzzcastingStorageManager } from 'buzzcasting-storage'
|
|
55
|
+
import type { IStorageOptions } from 'buzzcasting-utils'
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const options: IStorageOptions = {
|
|
58
|
+
app: 'my-subdomain',
|
|
59
|
+
version: 'v4',
|
|
60
|
+
presentation: 'presentation_id',
|
|
61
|
+
locale: 'en-US',
|
|
62
|
+
bearer: 'bearer_token',
|
|
63
|
+
storage: 'dexie', // the only backend actually exercised in production - see documentation/storage-backends.md
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
break
|
|
70
|
-
default:
|
|
71
|
-
// console.log('[storage]', messageEvent.data)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
66
|
+
const storageManager = new BuzzcastingStorageManager(options)
|
|
67
|
+
storageManager.startBroadcastListener() // begins listening for widget SUBSCRIBE/UPDATE events
|
|
68
|
+
|
|
69
|
+
// on whatever interval/event the host app decides:
|
|
70
|
+
await storageManager.update()
|
|
74
71
|
```
|
|
75
72
|
|
|
76
73
|
### Git Clone
|
|
@@ -25,6 +25,7 @@ export declare class BuzzcastingStorageManager {
|
|
|
25
25
|
cleanMessages: () => Promise<void>;
|
|
26
26
|
hideMessage: (query: IQuery) => Promise<IResponse>;
|
|
27
27
|
hideLabels: (query: IQuery) => Promise<IResponse>;
|
|
28
|
+
approveMessage: (query: IQuery) => Promise<void>;
|
|
28
29
|
getSubscribers: () => Promise<any[]>;
|
|
29
30
|
deleteSubscribers: () => Promise<any[]>;
|
|
30
31
|
bulk: (table: string, queries: IQuery[]) => Promise<IResponse | number | undefined>;
|
|
@@ -128,6 +129,15 @@ export declare class Widget {
|
|
|
128
129
|
* This takes place when the container indicates it has finished loading (ready)
|
|
129
130
|
*/
|
|
130
131
|
subscribe(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Tell the container to drop this widget from its subscriber list - the
|
|
134
|
+
* counterpart to subscribe(), called from destroy() when the widget's own
|
|
135
|
+
* component unmounts (e.g. the builder switches to a different slide).
|
|
136
|
+
* Without this, the container's subscriber list only ever grows: every
|
|
137
|
+
* widget ever mounted in the session stays in it, and every periodic
|
|
138
|
+
* refresh re-fetches all of them, not just the ones actually on screen.
|
|
139
|
+
*/
|
|
140
|
+
unsubscribe(): void;
|
|
131
141
|
/**
|
|
132
142
|
* Generic call to any query type
|
|
133
143
|
*
|
|
@@ -13,7 +13,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
13
13
|
}({}), u = function(e) {
|
|
14
14
|
return e.API = "color:white;background-color:grey;padding:0 4px 0 4px;border-radius:5px;", e.APP = "color:white;background-color:navy;padding:0 4px 0 4px;border-radius:5px;", e.BROADCAST = "color:navy;background-color:orange;padding:0 4px 0 4px;border-radius:5px;", e.CLOUD = "color:purple;background-color:mistyrose;padding:0 4px 0 4px;border-radius:5px;", e.DATA = "color:grey;background-color:lightskyblue;padding:0 4px 0 4px;border-radius:5px;", e.ERROR = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.GET_DATA = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;", e.HIDE = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.KO = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.MESSAGES = "color:white;background-color:darkslateblue;padding:0 4px 0 4px;border-radius:5px;", e.NO_UPDATES = "color:grey;border:1px solid grey;padding:0 4px 0 4px;border-radius:5px;", e.NONE = "color:transparent;background-color:transparent;", e.OK = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;", e.PRESENTATION = "color:white;background-color:darkred;padding:0 4px 0 4px;border-radius:5px;", e.SERIES = "color:purple;background-color:thistle;padding:0 4px 0 4px;border-radius:5px;", e.SLIDE = "color:black;background-color:yellow;padding:0 4px 0 4px;border-radius:5px;", e.STORAGE = "color:black;background-color:cyan;padding:0 4px 0 4px;border-radius:5px;", e.SUBSCRIBE = "color:white;background-color:dodgerblue;padding:0 4px 0 4px;border-radius:5px;", e.WIDGET = "color:black;background-color:lemonchiffon;padding:0 4px 0 4px;border-radius:5px;", e.WS = "color:white;background-color:green;padding:0 4px 0 4px;border-radius:5px;", e;
|
|
15
15
|
}({}), d = function(e) {
|
|
16
|
-
return e.ADD_SLIDE = "addSlide", e.APP_READY = "appReady", e.API_UPDATE = "apiUpdate", e.BACKGROUND_UPDATE = "backgroundUpdate", e.BUILDER_PREVIEW = "builderPreview", e.COMPONENT_UPDATE = "componentUpdate", e.APPROVE_MESSAGE = "approveMessage", e.CHANNEL = "channel", e.CLEAN_MESSAGES = "cleanMessages", e.CLOSE_BUILDER_DIALOG = "closeBuilderDialog", e.CLOSE_BUILDER_MODAL = "closeBuilderModal", e.CLOSE_MODAL = "closeModal", e.COLOR_UPDATE = "colorUpdate", e.COMPONENT_INDEX = "componentIndex", e.CSS_SET = "setCss", e.CSS_STORE = "storeCss", e.DASHBOARD_LOAD = "loadDashboard", e.DASHBOARD_STORE = "storeDashboard", e.DASHBOARD_UPDATED = "dashboardUpdated", e.ERROR = "error", e.HIDE_MESSAGE = "hideMessage", e.
|
|
16
|
+
return e.ADD_SLIDE = "addSlide", e.APP_READY = "appReady", e.API_UPDATE = "apiUpdate", e.BACKGROUND_UPDATE = "backgroundUpdate", e.BUILDER_PREVIEW = "builderPreview", e.COMPONENT_UPDATE = "componentUpdate", e.APPROVE_MESSAGE = "approveMessage", e.CHANNEL = "channel", e.CLEAN_MESSAGES = "cleanMessages", e.CLOSE_BUILDER_DIALOG = "closeBuilderDialog", e.CLOSE_BUILDER_MODAL = "closeBuilderModal", e.CLOSE_MODAL = "closeModal", e.COLOR_UPDATE = "colorUpdate", e.COMPONENT_INDEX = "componentIndex", e.CSS_SET = "setCss", e.CSS_STORE = "storeCss", e.DASHBOARD_LOAD = "loadDashboard", e.DASHBOARD_STORE = "storeDashboard", e.DASHBOARD_UPDATED = "dashboardUpdated", e.ERROR = "error", e.HIDE_MESSAGE = "hideMessage", e.IMAGE_GET = "getImage", e.IMAGE_SET = "setImage", e.IMAGE_STORED = "imageStored", e.LAYOUT_UPDATE = "layoutUpdate", e.PREV_SLIDE = "prevSlide", e.RELOAD_PRESENTATION = "reloadPresentation", e.STAR_MESSAGE = "starMessage", e.GOTO_SLIDE = "gotoSlide", e.NEXT_SLIDE = "nextSlide", e.PREFERENCE_LOAD = "loadPreference", e.PREFERENCE_STORE = "storePreference", e.PREFERENCE_UPDATED = "preferenceUpdated", e.PAUSE_PRESENTATION = "pausePresentation", e.PRESENTATION_READY = "presentationReady", e.PRESENTATION_LOAD = "loadPresentation", e.PRESENTATION_STORE = "storePresentation", e.PRESENTATION_UPDATED = "presentationUpdated", e.ROW_COL_UPDATE = "rowcolupdate", e.SCREENSHOT_TAKE = "takeScreenshot", e.SCREENSHOT_STORE = "storeScreenshot", e.SECTION_UPDATE = "sectionUpdate", e.SHOW_BUILDER_DIALOG = "showBuilderDialog", e.SHOW_BUILDER_MODAL = "showBuilderModal", e.SHOW_MODAL = "showModal", e.SLIDE_DID_LOAD = "slideDidLoad", e.SLIDE_GET = "getSlide", e.SLIDE_GOTO = "slideGoto", e.SLIDE_LOAD = "loadSlide", e.SLIDE_READY = "slideReady", e.SLIDE_SAVED = "slideSaved", e.SLIDE_SET = "setSlide", e.SLIDE_STORE = "storeSlide", e.SLIDE_STORED = "slideStored", e.SLIDE_TRANSITIONER = "slideTransitioner", e.SLIDE_UPDATED = "slideUpdated", e.START_TRANSITIONER = "startTransitioner", e.STORAGE_INIT = "storageInit", e.STREAM = "stream", e.SUBSCRIBE = "subscribe", e.UNSUBSCRIBE = "unsubscribe", e.SUSPEND_ACCOUNT = "suspendAccount", e.SWITCH_PRESENTATION = "switchPresentation", e.REMOVE_CLOUD = "removeCloud", e.UPDATE = "update", e.UPLOAD_COMPLETED = "uploadCompleted", e.VERSION = "version", e.WIDGETS_CLEAR = "widgetsClear", e.WIDGET_DID_LOAD = "widgetDidLoad", e.WIDGET_DID_UPDATE = "widgetDidUpdate", e.WIDGET_LOAD = "widgetLoad", e.WIDGET_STORE = "widgetStore", e.WIDGET_UPDATE = "widgetUpdate", e.WS_API_REQUEST = "wsApiRequest", e.WS_API_RESPONSE = "wsApiResponse", e.WS_API_UPDATE = "wsApiUpdate", e;
|
|
17
17
|
}({}), f = function(e) {
|
|
18
18
|
return e.APPROVED = "approved", e.BEFORE = "before", e.DELAYED = "delayed", e.NONE = "none", e.REALTIME = "realtime", e;
|
|
19
19
|
}({}), p = function(e) {
|
|
@@ -159,7 +159,7 @@ function D(e, t) {
|
|
|
159
159
|
}({});
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region package.json
|
|
162
|
-
var te = "3.21.
|
|
162
|
+
var te = "3.21.7", ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
163
163
|
(function(n, r) {
|
|
164
164
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self, n.readNDJSONStream = r());
|
|
165
165
|
})(e, (function() {
|
|
@@ -284,7 +284,7 @@ var te = "3.21.4", ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
284
284
|
async hideLabels(e) {
|
|
285
285
|
let { version: t } = this.options, n = this.formHeaders(), r = new URLSearchParams(), i = e.labels || [];
|
|
286
286
|
for (let [e, t] of i.entries()) r.append(`custom_filters[${e}]`, t);
|
|
287
|
-
return console.info("%capi%c %cput", u.API, u.NONE, u.GET_DATA, d.
|
|
287
|
+
return console.info("%capi%c %cput", u.API, u.NONE, u.GET_DATA, d.REMOVE_CLOUD, e.widget, i), await fetch([
|
|
288
288
|
this.url,
|
|
289
289
|
"api",
|
|
290
290
|
t,
|
|
@@ -457,9 +457,13 @@ var te = "3.21.4", ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
457
457
|
}));
|
|
458
458
|
}
|
|
459
459
|
async storePreference(e) {
|
|
460
|
-
let { version: t } = this.options, n = this.
|
|
460
|
+
let { version: t } = this.options, n = `Bearer ${this.options.bearer}`, r = { headers: new Headers({
|
|
461
|
+
Authorization: n,
|
|
462
|
+
"Content-Type": "application/json",
|
|
463
|
+
Accept: "application/json"
|
|
464
|
+
}) };
|
|
461
465
|
delete e.update;
|
|
462
|
-
let
|
|
466
|
+
let i = JSON.stringify({ data: e });
|
|
463
467
|
return w(3, [
|
|
464
468
|
"%capi%c %cstorePreference",
|
|
465
469
|
u.API,
|
|
@@ -470,11 +474,10 @@ var te = "3.21.4", ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
470
474
|
this.url,
|
|
471
475
|
"api",
|
|
472
476
|
t,
|
|
473
|
-
l.PREFERENCES
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
body: r,
|
|
477
|
+
l.PREFERENCES
|
|
478
|
+
].join("/") + "/", {
|
|
479
|
+
...r,
|
|
480
|
+
body: i,
|
|
478
481
|
method: "post"
|
|
479
482
|
}).then((e) => {
|
|
480
483
|
if (!e.ok) throw Error(e.statusText);
|
|
@@ -4600,11 +4603,11 @@ var { liveQuery: A, mergeRanges: ae, rangesOverlap: j, RangeSet: oe, cmp: se, En
|
|
|
4600
4603
|
query: e
|
|
4601
4604
|
};
|
|
4602
4605
|
let t = e?.order ?? "utc", n = Math.floor(Date.now() / 1e3), r = e?.period ?? 0;
|
|
4603
|
-
e.since = r === 0 ? n - 2592e3 : n - r, e.before = this.options.
|
|
4606
|
+
e.since = r === 0 ? n - 2592e3 : n - r, e.before = this.options.moderation === f.DELAYED && this.options.delay ? n - this.options.delay : n;
|
|
4604
4607
|
let i = (t) => t.utc > (e?.since || 0), a = (t) => t.utc < (e?.before || n);
|
|
4605
4608
|
try {
|
|
4606
4609
|
let n = this.db.table(l.TOPICS).where("widget_id").equals(e.widget).filter(i).filter(a);
|
|
4607
|
-
|
|
4610
|
+
this.options.moderation === f.APPROVED ? n.and((e) => e.approved === 1) : n.and((e) => e.visible === 1), n.reverse();
|
|
4608
4611
|
let r = await n.limit(e?.limit ?? 25).sortBy(t);
|
|
4609
4612
|
if (r.length === 0) return {
|
|
4610
4613
|
data: null,
|
|
@@ -4652,6 +4655,9 @@ var { liveQuery: A, mergeRanges: ae, rangesOverlap: j, RangeSet: oe, cmp: se, En
|
|
|
4652
4655
|
hideMessage = async (e, t) => {
|
|
4653
4656
|
await this.db.table(l.TOPICS).where("message_id").equals(e).modify({ visible: +!!t }).catch((e) => (console.error("%chide%c %cstorage%c %cmessage", u.KO, u.NONE, u.STORAGE, u.NONE, u.HIDE, e.message), 0));
|
|
4654
4657
|
};
|
|
4658
|
+
approveMessage = async (e, t) => {
|
|
4659
|
+
await this.db.table(l.TOPICS).where("message_id").equals(e).modify({ approved: +!!t }).catch((e) => (console.error("%capprove%c %cstorage%c %cmessage", u.KO, u.NONE, u.STORAGE, u.NONE, u.OK, e.message), 0));
|
|
4660
|
+
};
|
|
4655
4661
|
setMessages = async (e, t) => {
|
|
4656
4662
|
if (e.type !== l.MESSAGES) return 400;
|
|
4657
4663
|
let n = t.data.title, r = 0;
|
|
@@ -5173,6 +5179,9 @@ var ge = class {
|
|
|
5173
5179
|
hideMessage = async (e, t) => {
|
|
5174
5180
|
console.debug(`hideMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5175
5181
|
};
|
|
5182
|
+
approveMessage = async (e, t) => {
|
|
5183
|
+
console.debug(`approveMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5184
|
+
};
|
|
5176
5185
|
getDashboard = async (e) => await F(E(e)).then((e) => e).catch((t) => (console.warn("%capi", u.API, l.SLIDE, e.id), {
|
|
5177
5186
|
data: null,
|
|
5178
5187
|
message: `Widget ${e.data.id} load error: ${t.message}`,
|
|
@@ -5320,9 +5329,9 @@ var ge = class {
|
|
|
5320
5329
|
options;
|
|
5321
5330
|
constructor(e) {
|
|
5322
5331
|
this.options = e, Storage.prototype.setObject = function(e, t) {
|
|
5323
|
-
this.
|
|
5332
|
+
this.setItem(e, JSON.stringify(t));
|
|
5324
5333
|
}, Storage.prototype.getObject = function(e) {
|
|
5325
|
-
let t = this.
|
|
5334
|
+
let t = this.getItem(e);
|
|
5326
5335
|
return t && JSON.parse(t);
|
|
5327
5336
|
};
|
|
5328
5337
|
}
|
|
@@ -5398,6 +5407,9 @@ var ge = class {
|
|
|
5398
5407
|
hideMessage = async (e, t) => {
|
|
5399
5408
|
console.debug(`hideMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5400
5409
|
};
|
|
5410
|
+
approveMessage = async (e, t) => {
|
|
5411
|
+
console.debug(`approveMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5412
|
+
};
|
|
5401
5413
|
getDashboard = async (e) => {
|
|
5402
5414
|
try {
|
|
5403
5415
|
return localStorage.getObject(`${l.DASHBOARD}.${e.id}`);
|
|
@@ -5678,6 +5690,9 @@ var ge = class {
|
|
|
5678
5690
|
hideMessage = async (e, t) => {
|
|
5679
5691
|
console.debug(`hideMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5680
5692
|
};
|
|
5693
|
+
approveMessage = async (e, t) => {
|
|
5694
|
+
console.debug(`approveMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5695
|
+
};
|
|
5681
5696
|
bulk = async (e, t) => 404;
|
|
5682
5697
|
get = async (e, t) => 404;
|
|
5683
5698
|
set = async (e, t) => 404;
|
|
@@ -5956,6 +5971,9 @@ var ge = class {
|
|
|
5956
5971
|
hideMessage = async (e, t) => {
|
|
5957
5972
|
console.debug(`hideMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5958
5973
|
};
|
|
5974
|
+
approveMessage = async (e, t) => {
|
|
5975
|
+
console.debug(`approveMessage ${e} ${t} not implemented for ${this.options.storage}`);
|
|
5976
|
+
};
|
|
5959
5977
|
bulk = async (e, t) => 404;
|
|
5960
5978
|
get = async (e, t) => 404;
|
|
5961
5979
|
set = async (e, t) => 404;
|
|
@@ -6178,10 +6196,10 @@ var ge = class {
|
|
|
6178
6196
|
this.sm = new pe(e);
|
|
6179
6197
|
break;
|
|
6180
6198
|
case p.LOCAL:
|
|
6181
|
-
this.sm = new
|
|
6199
|
+
this.sm = new _e(e);
|
|
6182
6200
|
break;
|
|
6183
6201
|
case p.SESSION:
|
|
6184
|
-
this.sm = new
|
|
6202
|
+
this.sm = new ve(e);
|
|
6185
6203
|
break;
|
|
6186
6204
|
case p.KEYVAL:
|
|
6187
6205
|
this.sm = new ge(e);
|
|
@@ -6411,6 +6429,9 @@ var ge = class {
|
|
|
6411
6429
|
t
|
|
6412
6430
|
]), this.addSubscriber(t));
|
|
6413
6431
|
break;
|
|
6432
|
+
case d.UNSUBSCRIBE:
|
|
6433
|
+
e.data.data.widget !== void 0 && this.deleteSubscriber(e.data.data);
|
|
6434
|
+
break;
|
|
6414
6435
|
case d.UPDATE:
|
|
6415
6436
|
w(3, [
|
|
6416
6437
|
"%cupdate%c %capi%c %cstorage",
|
|
@@ -6470,6 +6491,18 @@ var ge = class {
|
|
|
6470
6491
|
]), await this.api.hideMessage(e);
|
|
6471
6492
|
};
|
|
6472
6493
|
hideLabels = async (e) => await this.api.hideLabels(e);
|
|
6494
|
+
approveMessage = async (e) => {
|
|
6495
|
+
let t = await this.sm?.approveMessage(e.id, +!!e.approved);
|
|
6496
|
+
w(3, [
|
|
6497
|
+
"%capprove%c %cstorage%c %cmessages",
|
|
6498
|
+
u.OK,
|
|
6499
|
+
u.NONE,
|
|
6500
|
+
u.STORAGE,
|
|
6501
|
+
u.NONE,
|
|
6502
|
+
u.MESSAGES,
|
|
6503
|
+
`${t} messages approved`
|
|
6504
|
+
]);
|
|
6505
|
+
};
|
|
6473
6506
|
getSubscribers = async () => await new Promise((e) => e(this.subscribers));
|
|
6474
6507
|
deleteSubscribers = async () => (this.subscribers = [], await new Promise((e) => e(this.subscribers)));
|
|
6475
6508
|
bulk = async (e, t) => await this.sm?.bulk(e, t);
|
|
@@ -6521,10 +6554,10 @@ var ge = class {
|
|
|
6521
6554
|
this.sm = new pe(e);
|
|
6522
6555
|
break;
|
|
6523
6556
|
case p.LOCAL:
|
|
6524
|
-
this.sm = new
|
|
6557
|
+
this.sm = new _e(e);
|
|
6525
6558
|
break;
|
|
6526
6559
|
case p.SESSION:
|
|
6527
|
-
this.sm = new
|
|
6560
|
+
this.sm = new ve(e);
|
|
6528
6561
|
break;
|
|
6529
6562
|
case p.KEYVAL:
|
|
6530
6563
|
this.sm = new ge(e);
|
|
@@ -6617,6 +6650,20 @@ var ge = class {
|
|
|
6617
6650
|
this.query
|
|
6618
6651
|
]));
|
|
6619
6652
|
}
|
|
6653
|
+
unsubscribe() {
|
|
6654
|
+
this.query.widget?.length && (this.broadcastChannel.postMessage({
|
|
6655
|
+
event: d.UNSUBSCRIBE,
|
|
6656
|
+
data: this.query
|
|
6657
|
+
}), w(3, [
|
|
6658
|
+
`%cunsubscribe%c %cwidget%c %c${this.query.type}`,
|
|
6659
|
+
u.SUBSCRIBE,
|
|
6660
|
+
u.NONE,
|
|
6661
|
+
u.WIDGET,
|
|
6662
|
+
u.NONE,
|
|
6663
|
+
T(this.query),
|
|
6664
|
+
this.query.widget
|
|
6665
|
+
]));
|
|
6666
|
+
}
|
|
6620
6667
|
getData = async () => {
|
|
6621
6668
|
switch (this.query.type) {
|
|
6622
6669
|
case l.CLOUD: return await this.getCloud();
|
|
@@ -6718,7 +6765,7 @@ var ge = class {
|
|
|
6718
6765
|
window.dispatchEvent(t);
|
|
6719
6766
|
};
|
|
6720
6767
|
destroy() {
|
|
6721
|
-
this.broadcastChannel.close();
|
|
6768
|
+
this.unsubscribe(), this.broadcastChannel.close();
|
|
6722
6769
|
}
|
|
6723
6770
|
};
|
|
6724
6771
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buzzcasting-storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.21.
|
|
4
|
+
"version": "3.21.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Mark Tamis, TouchFlows SAS",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "^8.66.0",
|
|
45
45
|
"@typescript-eslint/parser": "^8.66.0",
|
|
46
46
|
"@vitest/coverage-v8": "^4.1.10",
|
|
47
|
-
"buzzcasting-utils": "^1.13.
|
|
47
|
+
"buzzcasting-utils": "^1.13.9",
|
|
48
48
|
"camelcase": "^9.0.0",
|
|
49
49
|
"changelogen": "^0.6.2",
|
|
50
50
|
"eslint": "^9.39.5",
|