buzzcasting-storage 3.21.8 → 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/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -4,16 +4,17 @@ 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: Local Storage, Session Storage, IDB Keyval, Dexie, Window object
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 five interchangeable storage backends, the Dexie schema, and the staleness/expiry model (there isn't much of one).
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
+ - [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.
17
18
 
18
19
  ## Features
19
20
 
@@ -84,7 +85,7 @@ The project contains the following scripts:
84
85
 
85
86
  - `dev` - Start the development server
86
87
  - `build` - Build for production
87
- - `release` - Generate changelog and npm publish
88
+ - `release` - Generate changelog, bump the version, tag, and push - the pushed tag triggers CI to actually run `npm publish` (see [documentation/release-process.md](documentation/release-process.md))
88
89
  - `lint` - Checks your code for any linting errors
89
90
  - `test` - Run all tests
90
91
  - `test:watch` - Run all tests with watch mode
@@ -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":""}
@@ -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,175 +1,2 @@
1
- import { IModal } from 'buzzcasting-utils';
2
- import { IPreference } from 'buzzcasting-utils';
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
- deleteSlide: (query: IQuery) => Promise<IResponse | number | undefined>;
40
- deleteSlides: () => Promise<IResponse | number | undefined>;
41
- getPresentation: (query: IQuery) => Promise<IResponse | undefined>;
42
- getPresentations: (query?: IQuery) => Promise<IResponse | undefined>;
43
- setPresentation: (query: IQuery) => Promise<IResponse | undefined>;
44
- loadPresentation: (query: IQuery) => Promise<number>;
45
- storePresentation: (query: IQuery) => Promise<IResponse | number>;
46
- deletePresentation: (query: IQuery) => Promise<IResponse | number | undefined>;
47
- deletePresentations: () => Promise<IResponse | number | undefined>;
48
- getPreference: (preference: IPreference) => Promise<IResponse | undefined>;
49
- getPreferences: (query?: IQuery) => Promise<IResponse | undefined>;
50
- setPreference: (preference: IPreference) => Promise<IResponse | undefined>;
51
- loadPreference: (preference: IPreference) => Promise<IResponse | undefined>;
52
- storePreference: (preference: IPreference) => Promise<IResponse | number>;
53
- getWidget: (query: IQuery) => Promise<IResponse | undefined>;
54
- getWidgets: (query?: IQuery) => Promise<IResponse | undefined>;
55
- setWidget: (query: IQuery) => Promise<IResponse | number | undefined>;
56
- deleteWidget: (query: IQuery) => Promise<IResponse | number | undefined>;
57
- deleteWidgets: () => Promise<IResponse | number | undefined>;
58
- loadDashboards: (query?: IQuery) => Promise<IResponse | undefined>;
59
- getDashboard: (query: IQuery) => Promise<IResponse | undefined>;
60
- deleteDashboard: (query: IQuery) => Promise<IResponse | number | undefined>;
61
- deleteDashboards: () => Promise<IResponse | number | undefined>;
62
- getDashboards: () => Promise<IResponse | undefined>;
63
- setDashboard: (query: IQuery) => Promise<IResponse | undefined>;
64
- loadImages: (folder: string) => Promise<IResponse | undefined>;
65
- storeImage: (imageFile: FormData) => Promise<IResponse | number>;
66
- deleteImage: (folderName: string, imageName: string) => Promise<IResponse | number>;
67
- getImages: (query: IQuery) => Promise<IResponse | undefined>;
68
- setImage: (query: IQuery) => Promise<IResponse | undefined>;
69
- getHash: (resource: string, query: IQuery) => Promise<any>;
70
- setHash: (resource: string, query: IQuery) => Promise<number>;
71
- clearHash: () => Promise<number>;
72
- }
73
-
74
- export declare class BuzzcastingStorageReader {
75
- private sm;
76
- constructor(options: IStorageOptions);
77
- /**
78
- * Retieve Cloud Data
79
- * @param query Widgets parameters, type "cloud"
80
- * @returns IResponse
81
- */
82
- getCloud: (query: IQuery) => Promise<IResponse>;
83
- /**
84
- * Retieve Message Data
85
- * @param query Widgets parameters, type "messages"
86
- * @returns IResponse
87
- */
88
- getMessages: (query: IQuery) => Promise<IResponse>;
89
- /**
90
- * Retrieve Series Data
91
- * @param query Widgets parameters, type "series"
92
- * @returns IResponse
93
- */
94
- getSeries: (query: IQuery) => Promise<IResponse>;
95
- }
96
-
97
- declare interface IprocessResponse {
98
- code: number;
99
- hash: string;
100
- }
101
-
102
- /**
103
- * Main class for managing widgets and data updates
104
- */
105
- export declare class Widget {
106
- private storageReader;
107
- private broadcastChannel;
108
- private element;
109
- private query;
110
- private callbacks;
111
- /**
112
- * Main container for managing widgets and data updates
113
- *
114
- * @param element widget web component
115
- * @param callbacks functions in the widget that will receive the update
116
- * @param selector container for the element - by default buzzcasting-app (optional)
117
- */
118
- constructor(element: HTMLElement, callbacks: Array<(arg: IResponse) => void>, selector?: string);
119
- addCallbackListener(cb: (arg: IResponse) => void): void;
120
- /**
121
- * Data received from BroadcastChannel
122
- * data that is broadcast needs to be a IMessage[] |ICloud or ISeries structure
123
- * WIDGET_UPDATE is used to trigger fetching on the broadcast channel,
124
- * but also to trigger data retrieval on the widget
125
- */
126
- broadcastListener(): void;
127
- /**
128
- * This is used to register the component on the container's broadcast channel
129
- * This takes place when the container indicates it has finished loading (ready)
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;
141
- /**
142
- * Generic call to any query type
143
- *
144
- * @returns IResponse
145
- */
146
- getData: () => Promise<IResponse>;
147
- /**
148
- * Get Widget Coud Data
149
- *
150
- * @returns IResponse
151
- */
152
- getCloud: () => Promise<IResponse>;
153
- /**
154
- * Get Widget Messages Data
155
- *
156
- * @returns IResponse
157
- */
158
- getMessages: () => Promise<IResponse>;
159
- /**
160
- * Get Widget Series Data
161
- *
162
- * @returns IResponse
163
- */
164
- getSeries: () => Promise<IResponse>;
165
- /**
166
- * Emit a show modal event using the element's attributes
167
- * the component is the web component name to show
168
- *
169
- * @param modal IModal
170
- */
171
- showModal: (modal: IModal) => void;
172
- destroy(): void;
173
- }
174
-
175
- export { }
1
+ export * from './index.js'
2
+ export {}