h1v3 0.7.5 → 0.7.6

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 CHANGED
@@ -1,29 +1,113 @@
1
1
  # h1v3
2
2
  A firebase web platform
3
3
 
4
+
4
5
  # Install
5
6
 
6
7
  ```
7
8
  npm install h1v3
8
9
  ```
9
10
 
10
- # Event stores
11
- Built on Firebase Real-time Database allowing simple projections updated when events are written. See [event-stores.md](event-stores.md).
11
+ ## Meta data
12
+
13
+ ### Define your store paths
14
+
15
+ e.g. /h1v3.paths.js
16
+ ```javascript
17
+ const root = "/h1v3";
18
+ const teamPath = `${root}/teams/$tid`;
19
+ const userPath = `${root}/users/$uid`;
20
+
21
+ const h1v3 = {
22
+ team: {
23
+ membership: {
24
+ path: `${teamPath}/membership`
25
+ },
26
+ details: {
27
+ path: `${teamPath}/details`
28
+ },
29
+ },
30
+ user: {
31
+ teams: {
32
+ path: `${userPath}/teams`
33
+ },
34
+ profile: {
35
+ path: `${userPath}/profile`
36
+ }
37
+ },
38
+ userInvites: {
39
+ path: `${root}/user-invites/$emailId`
40
+ },
41
+ o11y: {
42
+ path: `${root}/o11y/$id`
43
+ }
44
+ };
45
+
46
+ h1v3.team.documents = {
47
+ path: `${teamPath}/data/$did`
48
+ };
49
+
50
+ export default h1v3;
51
+ ```
52
+
53
+ ### Register metadata endpoint
54
+
55
+ e.g. functions/index.js
12
56
 
13
- # Web platform
14
- The web platform covers the following (headless) functionality:
15
- - message bus
16
- - login
17
- - firebase initialisation
57
+ ```javascript
58
+ import { setGlobalOptions } from "firebase-functions";
59
+ import { configureMetadataEndpoint } from "h1v3";
60
+ import { onRequest } from "firebase-functions/https";
61
+ import * as h1v3Config from "./h1v3.config.js";
62
+ import paths from "./h1v3.paths.js";
18
63
 
19
- You can install the web platform using `npx h1v3 vendor-web`
64
+ setGlobalOptions({ maxInstances: 10 });
20
65
 
21
- **Note** if using the Web UI platform, the web platform will be installed and used by default
66
+ export * from "./h1v3.config.js";
67
+
68
+ export const store_meta = configureMetadataEndpoint({
69
+
70
+ module: h1v3Config,
71
+ paths,
72
+ region: h1v3Config.region,
73
+ onRequest
74
+
75
+ });
76
+ ```
77
+
78
+ ### (Optional) register a redirect for firebase hosting
79
+
80
+ e.g. firebase.json
81
+ ```json
82
+ {
83
+ . . .
84
+ "hosting": {
85
+ . . .
86
+ "rewrites": [
87
+ {
88
+ "source": "/store_meta",
89
+ "function": {
90
+ "functionId": "store_meta"
91
+ }
92
+ }
93
+ ]
94
+ },
95
+ . . .
96
+ }
97
+ ```
98
+
99
+ This allows you to, in the browser, do:
100
+ ```javascript
101
+ const meta = import("/store_meta") with { type: "json" }
102
+ ```
22
103
 
23
- # Web UI platform
24
- The following components build on the headless web platform:
25
- - login
26
- - error notifications
27
- - Styling and registration of Web Awesome components
104
+ # Implicit Google API dependencies
28
105
 
29
- You can install the web platform UI (and headlesss) platform using `npx h1v3 vendor-webui`
106
+ Note - this is an incomplete list...
107
+ - Firebase (various APIs)
108
+ - Cloud Functions API
109
+ - Cloud Resource Manager API
110
+ - Cloud Run Admin API
111
+ - Eventarc API
112
+ - IAM Service Account Credentials API
113
+ - Security Token Service API
@@ -33,8 +33,10 @@ if (useEmulator) {
33
33
 
34
34
  const resp = await fetch("http://127.0.0.1:4400/emulators");
35
35
  const emulators = await resp.json();
36
- connectAuthEmulator(auth, `http://${emulators.auth.host}:${emulators.auth.port}`);
37
- connectDatabaseEmulator(db, emulators.database.host, emulators.database.port);
36
+ if (emulators?.auth)
37
+ connectAuthEmulator(auth, `http://${emulators.auth.host}:${emulators.auth.port}`);
38
+ if (emulators?.database)
39
+ connectDatabaseEmulator(db, emulators.database.host, emulators.database.port);
38
40
 
39
41
  }
40
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h1v3",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "",