mikser-io-whitebox 4.0.0 → 5.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.
Files changed (3) hide show
  1. package/README.md +23 -18
  2. package/index.js +11 -3
  3. package/package.json +31 -31
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  WhiteBox integration for [Mikser](https://github.com/almero-digital-marketing/mikser-io). Pushes processed entities to a WhiteBox `feed` service and synchronises a watched folder with a WhiteBox `storage` service.
4
4
 
5
+ For projects that publish into a WhiteBox-backed downstream — a multi-site network, an editorial backend, or an external content consumer. The push happens inside mikser's normal cycle (no separate sync job, no cron, no out-of-band drift) and respects `--clear` for a clean rebuild of the remote state.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -12,26 +14,29 @@ npm install mikser-io-whitebox
12
14
 
13
15
  ```js
14
16
  // mikser.config.js
17
+ import { whitebox } from 'mikser-io-whitebox'
18
+
15
19
  export default {
16
- plugins: ['whitebox'],
17
- whitebox: {
18
- context: 'my-project',
19
- services: {
20
- feed: {
21
- url: 'https://feed.example.com',
22
- token: 'FEED_TOKEN',
23
- expire: '10 days',
24
- match: (entity) => entity.type === 'document'
25
- },
26
- storage: {
27
- url: 'https://storage.example.com',
28
- token: 'STORAGE_TOKEN',
29
- storageFolder: 'storage',
30
- expire: '10 days',
31
- match: (entity) => entity.id.startsWith('/storage/')
20
+ plugins: [
21
+ whitebox({
22
+ context: 'my-project',
23
+ services: {
24
+ feed: {
25
+ url: 'https://feed.example.com',
26
+ token: 'FEED_TOKEN',
27
+ expire: '10 days',
28
+ match: (entity) => entity.type === 'document'
29
+ },
30
+ storage: {
31
+ url: 'https://storage.example.com',
32
+ token: 'STORAGE_TOKEN',
33
+ storageFolder: 'storage',
34
+ expire: '10 days',
35
+ match: (entity) => entity.id.startsWith('/storage/')
36
+ }
32
37
  }
33
- }
34
- }
38
+ })
39
+ ]
35
40
  }
36
41
  ```
37
42
 
package/index.js CHANGED
@@ -5,9 +5,17 @@ import MID from 'node-machine-id'
5
5
  import feed from './src/feed.js'
6
6
  import storage from './src/storage.js'
7
7
 
8
- export default (core) => {
8
+ export function whitebox(options = {}) {
9
+ return (core) => {
9
10
  const { runtime, useLogger, onLoaded } = core
10
11
 
12
+ // Lazy migration: feed.js / storage.js still read runtime.config.whitebox
13
+ // directly. Mirror options into that slot so internal helpers keep
14
+ // working without a per-file refactor. Plugin-side reads inside this
15
+ // factory use `options.X` and the mirror gets removed when the
16
+ // helpers move off the config slot.
17
+ runtime.config.whitebox = options
18
+
11
19
  async function whiteboxApi(service, route, data) {
12
20
  const logger = useLogger()
13
21
  const { services } = runtime.config.whitebox
@@ -36,7 +44,7 @@ export default (core) => {
36
44
 
37
45
  onLoaded(() => {
38
46
  const logger = useLogger()
39
- logger.info('WhiteBox context: %s', runtime.config.whitebox?.context)
47
+ logger.info('WhiteBox context: %s', options.context)
40
48
  })
41
49
 
42
50
  return {
@@ -45,5 +53,5 @@ export default (core) => {
45
53
  ...feed({ ...core, whiteboxApi, useMachineId }),
46
54
  ...storage({ ...core, whiteboxApi, useMachineId }),
47
55
  }
48
-
56
+ }
49
57
  }
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "mikser-io-whitebox",
3
- "version": "4.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/almero-digital-marketing/mikser-io-whitebox.git"
13
- },
14
- "author": "",
15
- "license": "MIT",
16
- "bugs": {
17
- "url": "https://github.com/almero-digital-marketing/mikser-io-whitebox/issues"
18
- },
19
- "homepage": "https://github.com/almero-digital-marketing/mikser-io-whitebox#readme",
20
- "peerDependencies": {
21
- "mikser-io": "^6.0.0"
22
- },
23
- "dependencies": {
24
- "aguid": "^2.0.0",
25
- "axios": "^1.16.0",
26
- "form-data": "^4.0.5",
27
- "globby": "^16.2.0",
28
- "lodash": "^4.18.1",
29
- "node-machine-id": "^1.1.12",
30
- "p-map": "^7.0.4",
31
- "uuid": "^14.0.0"
32
- }
2
+ "name": "mikser-io-whitebox",
3
+ "version": "5.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/almero-digital-marketing/mikser-io-whitebox.git"
13
+ },
14
+ "author": "",
15
+ "license": "MIT",
16
+ "bugs": {
17
+ "url": "https://github.com/almero-digital-marketing/mikser-io-whitebox/issues"
18
+ },
19
+ "homepage": "https://github.com/almero-digital-marketing/mikser-io-whitebox#readme",
20
+ "peerDependencies": {
21
+ "mikser-io": "^9.0.0"
22
+ },
23
+ "dependencies": {
24
+ "aguid": "^2.0.0",
25
+ "axios": "^1.17.0",
26
+ "form-data": "^4.0.5",
27
+ "globby": "^16.2.0",
28
+ "lodash": "^4.18.1",
29
+ "node-machine-id": "^1.1.12",
30
+ "p-map": "^7.0.4",
31
+ "uuid": "^14.0.0"
32
+ }
33
33
  }