buzzcasting-storage 3.22.2 → 4.0.0
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 +2 -2
- package/dist/api/api.d.ts +55 -0
- package/dist/api/api.d.ts.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/request.d.ts +1 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/sse.d.ts +1 -0
- package/dist/api/sse.d.ts.map +1 -0
- package/dist/api/stream.d.ts +1 -0
- package/dist/api/stream.d.ts.map +1 -0
- package/dist/api/ws.d.ts +1 -0
- package/dist/api/ws.d.ts.map +1 -0
- package/dist/buzzcasting-storage.d.ts +2 -176
- package/dist/buzzcasting-storage.esm.js +1399 -5867
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/manager/index.d.ts +74 -0
- package/dist/manager/index.d.ts.map +1 -0
- package/dist/reader/index.d.ts +24 -0
- package/dist/reader/index.d.ts.map +1 -0
- package/dist/storage/dexie.d.ts +173 -0
- package/dist/storage/dexie.d.ts.map +1 -0
- package/dist/storage/factory.d.ts +30 -0
- package/dist/storage/factory.d.ts.map +1 -0
- package/dist/storage/keyval.d.ts +111 -0
- package/dist/storage/keyval.d.ts.map +1 -0
- package/dist/storage/window.d.ts +94 -0
- package/dist/storage/window.d.ts.map +1 -0
- package/dist/widget/index.d.ts +74 -0
- package/dist/widget/index.d.ts.map +1 -0
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -4,14 +4,14 @@ This is a wrapper class to use multiple storage options with BuzzCasting.
|
|
|
4
4
|
|
|
5
5
|
BuzzCasting Social Media Wall & Dataviz [More info](https://www.touchflows.com/services-buzzcasting-social-media-wall/).
|
|
6
6
|
|
|
7
|
-
Currently supported are:
|
|
7
|
+
Currently supported are: Dexie, IDB Keyval, Window object
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
|
11
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
12
|
|
|
13
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
|
|
14
|
+
- [documentation/storage-backends.md](documentation/storage-backends.md) — the three interchangeable storage backends, the Dexie schema, and the staleness/expiry model (there isn't much of one).
|
|
15
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
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
17
|
- [documentation/release-process.md](documentation/release-process.md) — `npm run release` bumps/tags/pushes locally, but the actual `npm publish` now happens in CI on that tag push (via npm Trusted Publishing/OIDC, no stored token) - what to do if a release run fails.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IPreference, IQuery, IResponse, IStorageOptions } from 'buzzcasting-utils';
|
|
2
|
+
export default class ApiClient {
|
|
3
|
+
private options;
|
|
4
|
+
private url;
|
|
5
|
+
constructor(options: IStorageOptions);
|
|
6
|
+
private headers;
|
|
7
|
+
private fileHeaders;
|
|
8
|
+
private formHeaders;
|
|
9
|
+
get(query: IQuery): Promise<IResponse>;
|
|
10
|
+
ndjson(queries: IQuery[]): Promise<any>;
|
|
11
|
+
hideMessage(query: IQuery): Promise<any>;
|
|
12
|
+
hideLabels(query: IQuery): Promise<any>;
|
|
13
|
+
loadSlide(query: IQuery): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a brand-new slide (as opposed to storeSlide(), which PUTs an
|
|
16
|
+
* update to an already-existing id). POSTs to the slides collection
|
|
17
|
+
* rather than an :id resource, and - unlike storeSlide() - takes no id at
|
|
18
|
+
* all: every real slide id observed (e.g. "01kfgn8bsyc74j4eyg6h3j8dj7") is
|
|
19
|
+
* a ULID, almost certainly generated server-side on insert, so the
|
|
20
|
+
* created record's real id comes back in the response instead. The
|
|
21
|
+
* backoffice route this expects does not exist yet at time of writing
|
|
22
|
+
* (see documentation/adding-slides.md in buzzcasting-app), so this call
|
|
23
|
+
* is expected to fail (404/405) until that route is added.
|
|
24
|
+
*
|
|
25
|
+
* ex: window.__bc.storage.createSlide({data: {json: {...}, html:'', title:'New Slide', presentation_id:'01...'}})
|
|
26
|
+
*
|
|
27
|
+
* @param query
|
|
28
|
+
* @returns the created slide, or a `{success: false}` envelope on failure
|
|
29
|
+
*/
|
|
30
|
+
createSlide(query: IQuery): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Store slide definition
|
|
33
|
+
* ex: window.__bc.storage.storeSlide({id:'1',type:'slide', data: {json: {a:'b'},html:'<div/>',css:'abc'}, update: true}) // update: stockage sur le serveur
|
|
34
|
+
*
|
|
35
|
+
* @param query
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
storeSlide(query: IQuery): Promise<any>;
|
|
39
|
+
loadPresentation(query: IQuery): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Store slide definition
|
|
42
|
+
* ex: window.__bc.storage.storeSlide({id:'1',type:'slide', data: {json: {a:'b'},html:'<div/>',css:'abc'}, update: true}) // update: stockage sur le serveur
|
|
43
|
+
*
|
|
44
|
+
* @param query
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
storePresentation(query: IQuery): Promise<any>;
|
|
48
|
+
loadPreference(preference: IPreference): Promise<any>;
|
|
49
|
+
storePreference(preference: IPreference): Promise<any>;
|
|
50
|
+
loadDashboards(query?: IQuery): Promise<any>;
|
|
51
|
+
loadImages(folderName: string): Promise<any>;
|
|
52
|
+
storeImage(imageFile: FormData): Promise<any>;
|
|
53
|
+
deleteImage(folderName: string, imageName: string): Promise<any>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIX,WAAW,EACX,MAAM,EACN,SAAS,EACT,eAAe,EACf,MAAM,mBAAmB,CAAC;AAK3B,MAAM,CAAC,OAAO,OAAO,SAAS;IAC7B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,GAAG,CAAS;gBAER,OAAO,EAAE,eAAe;IAKpC,OAAO,CAAC,OAAO,CAUb;IAEF,OAAO,CAAC,WAAW,CAOjB;IAEF,OAAO,CAAC,WAAW,CAUjB;IAEW,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAiEtC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAiBvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAqCxC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA2CvC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoEnD;;;;;;;;;;;;;;;OAeG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoCrD;;;;;;OAMG;IAEU,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA8CvC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAiD1D;;;;;;OAMG;IAEU,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAsC9C,cAAc,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IA+CrD,eAAe,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAqDtD,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA4C5C,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA6C5C,UAAU,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAqC7C,WAAW,CACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,CAAC;CAoCf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/api/sse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/api/stream.ts"],"names":[],"mappings":""}
|
package/dist/api/ws.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=ws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/api/ws.ts"],"names":[],"mappings":""}
|
|
@@ -1,176 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { IQuery } from 'buzzcasting-utils';
|
|
4
|
-
import { IResponse } from 'buzzcasting-utils';
|
|
5
|
-
import { IStorageOptions } from 'buzzcasting-utils';
|
|
6
|
-
|
|
7
|
-
export declare class BuzzcastingStorageManager {
|
|
8
|
-
private sm;
|
|
9
|
-
private api;
|
|
10
|
-
private bc;
|
|
11
|
-
private options;
|
|
12
|
-
private subscribers;
|
|
13
|
-
constructor(options: IStorageOptions);
|
|
14
|
-
addSubscriber(query: IQuery): void;
|
|
15
|
-
deleteSubscriber(query: IQuery): void;
|
|
16
|
-
update: (params: any) => Promise<void>;
|
|
17
|
-
stream: () => void;
|
|
18
|
-
apiQuery: (apiQuery: any) => Promise<IprocessResponse>;
|
|
19
|
-
processResponse: (apiResp: any, params: any) => Promise<IprocessResponse>;
|
|
20
|
-
startBroadcastListener: () => void;
|
|
21
|
-
broadcastMessage: (eventName: string, detail: any) => void;
|
|
22
|
-
private broadcastUpdate;
|
|
23
|
-
hide: (query: IQuery) => void;
|
|
24
|
-
private actions;
|
|
25
|
-
cleanMessages: () => Promise<void>;
|
|
26
|
-
hideMessage: (query: IQuery) => Promise<IResponse>;
|
|
27
|
-
hideLabels: (query: IQuery) => Promise<IResponse>;
|
|
28
|
-
approveMessage: (query: IQuery) => Promise<void>;
|
|
29
|
-
getSubscribers: () => Promise<any[]>;
|
|
30
|
-
deleteSubscribers: () => Promise<any[]>;
|
|
31
|
-
bulk: (table: string, queries: IQuery[]) => Promise<IResponse | number | undefined>;
|
|
32
|
-
get: (table: string, query: IQuery) => Promise<IResponse | number | undefined>;
|
|
33
|
-
set: (table: string, query: IQuery) => Promise<IResponse | number | undefined>;
|
|
34
|
-
getSlide: (query: IQuery) => Promise<IResponse | undefined>;
|
|
35
|
-
getSlides: (query: IQuery) => Promise<IResponse | undefined>;
|
|
36
|
-
setSlide: (query: IQuery) => Promise<IResponse | undefined>;
|
|
37
|
-
loadSlide: (query: IQuery) => Promise<number>;
|
|
38
|
-
storeSlide: (query: IQuery) => Promise<IResponse | number>;
|
|
39
|
-
createSlide: (query: IQuery) => Promise<IResponse | number>;
|
|
40
|
-
deleteSlide: (query: IQuery) => Promise<IResponse | number | undefined>;
|
|
41
|
-
deleteSlides: () => Promise<IResponse | number | undefined>;
|
|
42
|
-
getPresentation: (query: IQuery) => Promise<IResponse | undefined>;
|
|
43
|
-
getPresentations: (query?: IQuery) => Promise<IResponse | undefined>;
|
|
44
|
-
setPresentation: (query: IQuery) => Promise<IResponse | undefined>;
|
|
45
|
-
loadPresentation: (query: IQuery) => Promise<number>;
|
|
46
|
-
storePresentation: (query: IQuery) => Promise<IResponse | number>;
|
|
47
|
-
deletePresentation: (query: IQuery) => Promise<IResponse | number | undefined>;
|
|
48
|
-
deletePresentations: () => Promise<IResponse | number | undefined>;
|
|
49
|
-
getPreference: (preference: IPreference) => Promise<IResponse | undefined>;
|
|
50
|
-
getPreferences: (query?: IQuery) => Promise<IResponse | undefined>;
|
|
51
|
-
setPreference: (preference: IPreference) => Promise<IResponse | undefined>;
|
|
52
|
-
loadPreference: (preference: IPreference) => Promise<IResponse | undefined>;
|
|
53
|
-
storePreference: (preference: IPreference) => Promise<IResponse | number>;
|
|
54
|
-
getWidget: (query: IQuery) => Promise<IResponse | undefined>;
|
|
55
|
-
getWidgets: (query?: IQuery) => Promise<IResponse | undefined>;
|
|
56
|
-
setWidget: (query: IQuery) => Promise<IResponse | number | undefined>;
|
|
57
|
-
deleteWidget: (query: IQuery) => Promise<IResponse | number | undefined>;
|
|
58
|
-
deleteWidgets: () => Promise<IResponse | number | undefined>;
|
|
59
|
-
loadDashboards: (query?: IQuery) => Promise<IResponse | undefined>;
|
|
60
|
-
getDashboard: (query: IQuery) => Promise<IResponse | undefined>;
|
|
61
|
-
deleteDashboard: (query: IQuery) => Promise<IResponse | number | undefined>;
|
|
62
|
-
deleteDashboards: () => Promise<IResponse | number | undefined>;
|
|
63
|
-
getDashboards: () => Promise<IResponse | undefined>;
|
|
64
|
-
setDashboard: (query: IQuery) => Promise<IResponse | undefined>;
|
|
65
|
-
loadImages: (folder: string) => Promise<IResponse | undefined>;
|
|
66
|
-
storeImage: (imageFile: FormData) => Promise<IResponse | number>;
|
|
67
|
-
deleteImage: (folderName: string, imageName: string) => Promise<IResponse | number>;
|
|
68
|
-
getImages: (query: IQuery) => Promise<IResponse | undefined>;
|
|
69
|
-
setImage: (query: IQuery) => Promise<IResponse | undefined>;
|
|
70
|
-
getHash: (resource: string, query: IQuery) => Promise<any>;
|
|
71
|
-
setHash: (resource: string, query: IQuery) => Promise<number>;
|
|
72
|
-
clearHash: () => Promise<number>;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export declare class BuzzcastingStorageReader {
|
|
76
|
-
private sm;
|
|
77
|
-
constructor(options: IStorageOptions);
|
|
78
|
-
/**
|
|
79
|
-
* Retieve Cloud Data
|
|
80
|
-
* @param query Widgets parameters, type "cloud"
|
|
81
|
-
* @returns IResponse
|
|
82
|
-
*/
|
|
83
|
-
getCloud: (query: IQuery) => Promise<IResponse>;
|
|
84
|
-
/**
|
|
85
|
-
* Retieve Message Data
|
|
86
|
-
* @param query Widgets parameters, type "messages"
|
|
87
|
-
* @returns IResponse
|
|
88
|
-
*/
|
|
89
|
-
getMessages: (query: IQuery) => Promise<IResponse>;
|
|
90
|
-
/**
|
|
91
|
-
* Retrieve Series Data
|
|
92
|
-
* @param query Widgets parameters, type "series"
|
|
93
|
-
* @returns IResponse
|
|
94
|
-
*/
|
|
95
|
-
getSeries: (query: IQuery) => Promise<IResponse>;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
declare interface IprocessResponse {
|
|
99
|
-
code: number;
|
|
100
|
-
hash: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Main class for managing widgets and data updates
|
|
105
|
-
*/
|
|
106
|
-
export declare class Widget {
|
|
107
|
-
private storageReader;
|
|
108
|
-
private broadcastChannel;
|
|
109
|
-
private element;
|
|
110
|
-
private query;
|
|
111
|
-
private callbacks;
|
|
112
|
-
/**
|
|
113
|
-
* Main container for managing widgets and data updates
|
|
114
|
-
*
|
|
115
|
-
* @param element widget web component
|
|
116
|
-
* @param callbacks functions in the widget that will receive the update
|
|
117
|
-
* @param selector container for the element - by default buzzcasting-app (optional)
|
|
118
|
-
*/
|
|
119
|
-
constructor(element: HTMLElement, callbacks: Array<(arg: IResponse) => void>, selector?: string);
|
|
120
|
-
addCallbackListener(cb: (arg: IResponse) => void): void;
|
|
121
|
-
/**
|
|
122
|
-
* Data received from BroadcastChannel
|
|
123
|
-
* data that is broadcast needs to be a IMessage[] |ICloud or ISeries structure
|
|
124
|
-
* WIDGET_UPDATE is used to trigger fetching on the broadcast channel,
|
|
125
|
-
* but also to trigger data retrieval on the widget
|
|
126
|
-
*/
|
|
127
|
-
broadcastListener(): void;
|
|
128
|
-
/**
|
|
129
|
-
* This is used to register the component on the container's broadcast channel
|
|
130
|
-
* This takes place when the container indicates it has finished loading (ready)
|
|
131
|
-
*/
|
|
132
|
-
subscribe(): void;
|
|
133
|
-
/**
|
|
134
|
-
* Tell the container to drop this widget from its subscriber list - the
|
|
135
|
-
* counterpart to subscribe(), called from destroy() when the widget's own
|
|
136
|
-
* component unmounts (e.g. the builder switches to a different slide).
|
|
137
|
-
* Without this, the container's subscriber list only ever grows: every
|
|
138
|
-
* widget ever mounted in the session stays in it, and every periodic
|
|
139
|
-
* refresh re-fetches all of them, not just the ones actually on screen.
|
|
140
|
-
*/
|
|
141
|
-
unsubscribe(): void;
|
|
142
|
-
/**
|
|
143
|
-
* Generic call to any query type
|
|
144
|
-
*
|
|
145
|
-
* @returns IResponse
|
|
146
|
-
*/
|
|
147
|
-
getData: () => Promise<IResponse>;
|
|
148
|
-
/**
|
|
149
|
-
* Get Widget Coud Data
|
|
150
|
-
*
|
|
151
|
-
* @returns IResponse
|
|
152
|
-
*/
|
|
153
|
-
getCloud: () => Promise<IResponse>;
|
|
154
|
-
/**
|
|
155
|
-
* Get Widget Messages Data
|
|
156
|
-
*
|
|
157
|
-
* @returns IResponse
|
|
158
|
-
*/
|
|
159
|
-
getMessages: () => Promise<IResponse>;
|
|
160
|
-
/**
|
|
161
|
-
* Get Widget Series Data
|
|
162
|
-
*
|
|
163
|
-
* @returns IResponse
|
|
164
|
-
*/
|
|
165
|
-
getSeries: () => Promise<IResponse>;
|
|
166
|
-
/**
|
|
167
|
-
* Emit a show modal event using the element's attributes
|
|
168
|
-
* the component is the web component name to show
|
|
169
|
-
*
|
|
170
|
-
* @param modal IModal
|
|
171
|
-
*/
|
|
172
|
-
showModal: (modal: IModal) => void;
|
|
173
|
-
destroy(): void;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export { }
|
|
1
|
+
export * from './index.js'
|
|
2
|
+
export {}
|