buzzcasting-storage 3.22.2 → 4.1.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/bin/production-assets.mjs +162 -0
- 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 +27 -20
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,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Prepares a StencilJS tenant build for deploy, and refuses one that cannot be served.
|
|
4
|
+
*
|
|
5
|
+
* Every tenant repository (axa, axagroup, chanel, admo, bayer, cplus, sncf) needs the same two
|
|
6
|
+
* things after `stencil build`, and used to carry its own copy of this script to get them. The
|
|
7
|
+
* copies drift: a pattern retired from the CDN in one repo keeps shipping from another. So the
|
|
8
|
+
* check lives here, in the package they all already depend on, and their `postbuild` is a bin
|
|
9
|
+
* call.
|
|
10
|
+
*
|
|
11
|
+
* 1. Rewrite `www/index.html`. The pages are developed against a second Stencil dev server, so
|
|
12
|
+
* `src/index.html` loads `http://localhost:3333/build/buzzcasting-app.esm.js` - the convention
|
|
13
|
+
* every tenant shares. A built `www/` keeps that URL verbatim, so shipping it as-is means every
|
|
14
|
+
* device asks a host that only exists on a developer's machine. Stencil has no conditional HTML
|
|
15
|
+
* and rewriting the source would break `npm start`, so the rewrite happens on the output: dev
|
|
16
|
+
* keeps working, production gets the per-tenant storage path the presentation blade uses.
|
|
17
|
+
*
|
|
18
|
+
* 2. Refuse a page that still points at a dead app bundle - the dev URL, the retired
|
|
19
|
+
* `cdn.buzzcasting.net/components/...` packages, the dead animate.css path. Scoped to the app
|
|
20
|
+
* bundle on purpose: a page may legitimately point somewhere else on localhost.
|
|
21
|
+
*
|
|
22
|
+
* 3. Refuse a build the deploy cannot publish. touchflows-deploy publishes the project and
|
|
23
|
+
* symlinks `current/dist/<slug>` at `storage/app/public/customers/<slug>`; the presentation
|
|
24
|
+
* blade then requests `/storage/customers/<slug>/<slug>.esm.js`, with <slug> taken from the
|
|
25
|
+
* tenant host (`axa`, `axagroup`). Stencil's `dist` target already names the entry after the
|
|
26
|
+
* namespace, so nothing is renamed on the way out - the one thing the build must get right is
|
|
27
|
+
* that `dist/<slug>/<slug>.esm.js` exists.
|
|
28
|
+
*
|
|
29
|
+
* Usage: `buzzcasting-production-assets` in a tenant repo after `stencil build` (cwd = repo root).
|
|
30
|
+
* Exit: 0 ready to publish, 1 something would 404 once deployed.
|
|
31
|
+
*/
|
|
32
|
+
import { readdirSync, readFileSync, realpathSync, statSync, writeFileSync } from 'node:fs'
|
|
33
|
+
import { join } from 'node:path'
|
|
34
|
+
import { fileURLToPath } from 'node:url'
|
|
35
|
+
|
|
36
|
+
const WWW = 'www'
|
|
37
|
+
const DIST = 'dist'
|
|
38
|
+
const DEV = 'http://localhost:3333/build/buzzcasting-app.'
|
|
39
|
+
const PROD = '/storage/buzzcasting/buzzcasting-app.'
|
|
40
|
+
|
|
41
|
+
/** Anything that would ship a dead or local-only reference to the app bundle. */
|
|
42
|
+
export const FORBIDDEN = [
|
|
43
|
+
'localhost:3333/build/buzzcasting-app',
|
|
44
|
+
'cdn.buzzcasting.net/components/buzzcasting',
|
|
45
|
+
'cdn.buzzcasting.net/buzzcasting/app',
|
|
46
|
+
'cdn.buzzcasting.net/components/app/test/',
|
|
47
|
+
'cdn.buzzcasting.net/components/common/test/',
|
|
48
|
+
'cdn.buzzcasting.net/components/presentation/test/',
|
|
49
|
+
'cdn.buzzcasting.net/components/animate.css',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
function htmlFiles(dir, out = []) {
|
|
53
|
+
for (const entry of readdirSync(dir)) {
|
|
54
|
+
const path = join(dir, entry)
|
|
55
|
+
if (statSync(path).isDirectory()) htmlFiles(path, out)
|
|
56
|
+
else if (entry.endsWith('.html')) out.push(path)
|
|
57
|
+
}
|
|
58
|
+
return out
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The directory the deploy publishes: `dist/<slug>/<slug>.esm.js`.
|
|
63
|
+
*
|
|
64
|
+
* Exactly one directory under `dist/` may hold an entry named after itself. Zero means the
|
|
65
|
+
* lazy-loader output target changed shape and every embedded widget would 404; more than one is
|
|
66
|
+
* ambiguous, so neither is published silently.
|
|
67
|
+
*/
|
|
68
|
+
export function findPublishableBundle(distDir = DIST) {
|
|
69
|
+
let dirs = []
|
|
70
|
+
try {
|
|
71
|
+
dirs = readdirSync(distDir).filter((entry) => statSync(join(distDir, entry)).isDirectory())
|
|
72
|
+
} catch {
|
|
73
|
+
return { bundles: [], dirs: [] }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const bundles = dirs.filter((dir) => {
|
|
77
|
+
try {
|
|
78
|
+
return statSync(join(distDir, dir, `${dir}.esm.js`)).isFile()
|
|
79
|
+
} catch {
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return { bundles, dirs }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Run the postbuild over a repository.
|
|
89
|
+
*
|
|
90
|
+
* Never throws for an ordinary "this build is not publishable" outcome: it reports and returns a
|
|
91
|
+
* non-zero exit code, so a failing build reads as a build failure rather than a crash.
|
|
92
|
+
*/
|
|
93
|
+
export function productionAssets({ cwd = process.cwd(), log = console.log, error = console.error } = {}) {
|
|
94
|
+
let failures = 0
|
|
95
|
+
|
|
96
|
+
let files = []
|
|
97
|
+
try {
|
|
98
|
+
files = htmlFiles(join(cwd, WWW))
|
|
99
|
+
} catch {
|
|
100
|
+
files = []
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (files.length === 0) {
|
|
104
|
+
error(`production-assets: no HTML under ${WWW}/ - run stencil build first`)
|
|
105
|
+
return { exitCode: 1, rewritten: 0, files: 0 }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let rewritten = 0
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
const before = readFileSync(file, 'utf8')
|
|
111
|
+
const after = before.split(DEV).join(PROD)
|
|
112
|
+
if (after !== before) {
|
|
113
|
+
writeFileSync(file, after)
|
|
114
|
+
rewritten++
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (const bad of FORBIDDEN) {
|
|
118
|
+
if (after.includes(bad)) {
|
|
119
|
+
error(`production-assets: ${file} still references ${bad}`)
|
|
120
|
+
failures++
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const { bundles, dirs } = findPublishableBundle(join(cwd, DIST))
|
|
126
|
+
if (bundles.length !== 1) {
|
|
127
|
+
error(
|
|
128
|
+
`production-assets: expected exactly one ${DIST}/<slug>/<slug>.esm.js, found ${bundles.length}` +
|
|
129
|
+
(dirs.length ? ` (directories: ${dirs.join(', ')})` : ` (no ${DIST}/ - run stencil build first)`),
|
|
130
|
+
)
|
|
131
|
+
failures++
|
|
132
|
+
} else {
|
|
133
|
+
log(
|
|
134
|
+
`production-assets: publishable bundle ${DIST}/${bundles[0]}/${bundles[0]}.esm.js -> /storage/customers/${bundles[0]}/`,
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
log(`production-assets: ${rewritten}/${files.length} file(s) rewritten to ${PROD}...`)
|
|
139
|
+
|
|
140
|
+
return { exitCode: failures === 0 ? 0 : 1, rewritten, files: files.length }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Was this file run, or just imported for its tests?
|
|
145
|
+
*
|
|
146
|
+
* `node_modules/.bin` shims (and pnpm's store links) reach the script through a symlink, so the
|
|
147
|
+
* argv path and `import.meta.url` differ textually while naming the same file. Comparing them
|
|
148
|
+
* directly made the bin a silent no-op when a tenant's `postbuild` called it - a guard that
|
|
149
|
+
* passes without checking anything, which is worse than one that fails.
|
|
150
|
+
*/
|
|
151
|
+
function invokedDirectly() {
|
|
152
|
+
if (process.argv[1] === undefined) return false
|
|
153
|
+
try {
|
|
154
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))
|
|
155
|
+
} catch {
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (invokedDirectly()) {
|
|
161
|
+
process.exit(productionAssets().exitCode)
|
|
162
|
+
}
|
|
@@ -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 {}
|