@focusbc/bbs-lib 0.0.2

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 (54) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +3 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/overlay/index.d.ts +2 -0
  6. package/dist/overlay/index.d.ts.map +1 -0
  7. package/dist/overlay/index.js +2 -0
  8. package/dist/overlay/index.js.map +1 -0
  9. package/dist/overlay/map-object-to-shape-instance.mapper.d.ts +9 -0
  10. package/dist/overlay/map-object-to-shape-instance.mapper.d.ts.map +1 -0
  11. package/dist/overlay/map-object-to-shape-instance.mapper.js +75 -0
  12. package/dist/overlay/map-object-to-shape-instance.mapper.js.map +1 -0
  13. package/dist/overlay/map-overlay.d.ts +86 -0
  14. package/dist/overlay/map-overlay.d.ts.map +1 -0
  15. package/dist/overlay/map-overlay.js +289 -0
  16. package/dist/overlay/map-overlay.js.map +1 -0
  17. package/dist/overlay/overlay-dynamic-layer.builder.d.ts +16 -0
  18. package/dist/overlay/overlay-dynamic-layer.builder.d.ts.map +1 -0
  19. package/dist/overlay/overlay-dynamic-layer.builder.js +202 -0
  20. package/dist/overlay/overlay-dynamic-layer.builder.js.map +1 -0
  21. package/dist/overlay/overlay-static-layer.builder.d.ts +20 -0
  22. package/dist/overlay/overlay-static-layer.builder.d.ts.map +1 -0
  23. package/dist/overlay/overlay-static-layer.builder.js +97 -0
  24. package/dist/overlay/overlay-static-layer.builder.js.map +1 -0
  25. package/dist/types/events.d.ts +9 -0
  26. package/dist/types/events.d.ts.map +1 -0
  27. package/dist/types/events.js +2 -0
  28. package/dist/types/events.js.map +1 -0
  29. package/dist/types/index.d.ts +6 -0
  30. package/dist/types/index.d.ts.map +1 -0
  31. package/dist/types/index.js +6 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/types/overlay-options.d.ts +25 -0
  34. package/dist/types/overlay-options.d.ts.map +1 -0
  35. package/dist/types/overlay-options.js +2 -0
  36. package/dist/types/overlay-options.js.map +1 -0
  37. package/dist/types/shape-instance.d.ts +15 -0
  38. package/dist/types/shape-instance.d.ts.map +1 -0
  39. package/dist/types/shape-instance.js +2 -0
  40. package/dist/types/shape-instance.js.map +1 -0
  41. package/dist/types/shape-style.d.ts +16 -0
  42. package/dist/types/shape-style.d.ts.map +1 -0
  43. package/dist/types/shape-style.js +2 -0
  44. package/dist/types/shape-style.js.map +1 -0
  45. package/dist/types/shape-type.d.ts +35 -0
  46. package/dist/types/shape-type.d.ts.map +1 -0
  47. package/dist/types/shape-type.js +2 -0
  48. package/dist/types/shape-type.js.map +1 -0
  49. package/dist/utils/rotation.utils.d.ts +18 -0
  50. package/dist/utils/rotation.utils.d.ts.map +1 -0
  51. package/dist/utils/rotation.utils.js +27 -0
  52. package/dist/utils/rotation.utils.js.map +1 -0
  53. package/package.json +50 -0
  54. package/readme.md +154 -0
package/readme.md ADDED
@@ -0,0 +1,154 @@
1
+ # `@focusbc/bbs-lib`
2
+
3
+ TypeScript library wrapping `deck.gl` and [`@focusbc/map-rendering`](https://www.npmjs.com/package/@focusbc/map-rendering) for BBS map rendering.
4
+
5
+ The library exposes a high-level `MapOverlay` API that receives the BBS map context returned by the integration API and renders the corresponding static and dynamic map layers.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ The package is published to npm under the `@focusbc` scope.
12
+
13
+ ```bash
14
+ # Using yarn
15
+ yarn add @focusbc/bbs-lib
16
+
17
+ # Using npm
18
+ npm install @focusbc/bbs-lib
19
+ ```
20
+
21
+ Because this package depends on `@focusbc/map-rendering` and deck.gl, consumers should use compatible deck.gl versions with the ones declared by the package.
22
+
23
+ ---
24
+
25
+ ## Usage
26
+
27
+ ```html
28
+ <div id="map-overlay" style="position: relative; width: 100%; height: 100%;"></div>
29
+ ```
30
+
31
+ ```ts
32
+ import { MapOverlay, type MapContext } from '@focusbc/bbs-lib'
33
+
34
+ const context: MapContext = {
35
+ // Context returned by the BBS/integration API
36
+ }
37
+
38
+ const overlay = MapOverlay.initialize(document.getElementById('map-overlay')!, context)
39
+
40
+ // Later, when the event/site changes:
41
+ overlay.setContext(newContext)
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Development
47
+
48
+ Install dependencies and build the library from the `bbs-lib/` directory:
49
+
50
+ ```bash
51
+ yarn install
52
+ yarn build
53
+ ```
54
+
55
+ From the repository root you can also run:
56
+
57
+ ```bash
58
+ yarn bbs-lib build
59
+ ```
60
+
61
+ The build output is generated under `dist/`. Only `dist/**/*` and this README are included in the published npm package.
62
+
63
+ ---
64
+
65
+ ## Sandbox (local manual testing)
66
+
67
+ A small static page under `sandbox/` can be used to test `MapOverlay` against the integration API BBS endpoints.
68
+
69
+ 1. Copy `sandbox/config.example.ts` to `sandbox/config.ts` and set:
70
+ - `INTEGRATION_API_BASE` — for example, `http://localhost:5016`
71
+ - `BBS_API_KEY` — must match `Settings.BbsApiKey` in your local integration-api config
72
+
73
+ 2. Start `integration-api` locally.
74
+
75
+ 3. Build and serve the sandbox:
76
+
77
+ ```bash
78
+ cd bbs-lib
79
+ yarn install
80
+ yarn sandbox:build
81
+ npx --yes serve sandbox -p 5173
82
+ ```
83
+
84
+ For continuous rebuild on save:
85
+
86
+ ```bash
87
+ yarn sandbox:watch
88
+ ```
89
+
90
+ Open `http://localhost:5173`, select an event, then a site. The overlay calls `MapOverlay.initialize` on first site selection and `setContext` on subsequent changes.
91
+
92
+ ---
93
+
94
+ ## Releasing the library
95
+
96
+ The release process is handled by `bbs-lib/scripts/release-lib.sh` and can be started from inside `bbs-lib/`:
97
+
98
+ ```bash
99
+ yarn release:lib
100
+ ```
101
+
102
+ By default, this performs a patch release, for example `1.0.0` → `1.0.1`.
103
+
104
+ You can also choose the version bump explicitly:
105
+
106
+ ```bash
107
+ yarn release:lib patch
108
+ yarn release:lib minor
109
+ yarn release:lib major
110
+ ```
111
+
112
+ From the repository root, the equivalent command is:
113
+
114
+ ```bash
115
+ yarn release:bbs-lib
116
+ ```
117
+
118
+ ### Release prerequisites
119
+
120
+ 1. You must have access to publish `@focusbc/bbs-lib` under the `@focusbc` npm scope.
121
+ 2. You must have the Google Cloud CLI installed and authenticated.
122
+ 3. Your Google Cloud user must be able to decrypt/encrypt with the existing KMS key used by `auxiliary/scripts/decrypt_file.sh` and `auxiliary/scripts/encrypt_file.sh`.
123
+ 4. `bbs-lib/.npmrc.enc` must exist. This is the encrypted version of the npm credentials file and is the only credential file that should be committed.
124
+
125
+ ### Creating `bbs-lib/.npmrc.enc` for the first time
126
+
127
+ Create a temporary plaintext `bbs-lib/.npmrc` file:
128
+
129
+ ```ini
130
+ //registry.npmjs.org/:_authToken=<NPM_TOKEN>
131
+ ```
132
+
133
+ Then encrypt it using the repository KMS helper and remove the plaintext file:
134
+
135
+ ```bash
136
+ cd bbs-lib
137
+ bash ../auxiliary/scripts/encrypt_file.sh .npmrc .npmrc.enc
138
+ rm .npmrc
139
+ ```
140
+
141
+ Commit `bbs-lib/.npmrc.enc`. Do **not** commit `bbs-lib/.npmrc`.
142
+
143
+ ### What happens during release
144
+
145
+ When you run `yarn release:lib`, the script:
146
+
147
+ 1. Decrypts `bbs-lib/.npmrc.enc` into a temporary local `bbs-lib/.npmrc`.
148
+ 2. Bumps `package.json` using `npm version <patch|minor|major> --no-git-tag-version`.
149
+ 3. Builds the package with `npm run build`.
150
+ 4. Publishes the package to `https://registry.npmjs.org/` with `npm publish --access public`.
151
+ 5. Re-encrypts the temporary `.npmrc` back into `.npmrc.enc`.
152
+ 6. Removes the plaintext `.npmrc` from disk.
153
+
154
+ If the release fails after the version bump, review `package.json` before retrying because the version may already have been changed locally.