h1v3 0.7.5 → 0.8.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 +131 -15
- package/dist/browser/client/firebase.js +4 -2
- package/dist/browser/client/system.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,145 @@
|
|
|
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
|
-
|
|
11
|
-
|
|
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
|
|
56
|
+
|
|
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";
|
|
63
|
+
|
|
64
|
+
setGlobalOptions({ maxInstances: 10 });
|
|
65
|
+
|
|
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
|
+
```
|
|
12
77
|
|
|
13
|
-
|
|
14
|
-
The web platform covers the following (headless) functionality:
|
|
15
|
-
- message bus
|
|
16
|
-
- login
|
|
17
|
-
- firebase initialisation
|
|
78
|
+
### (Optional) register a redirect for firebase hosting
|
|
18
79
|
|
|
19
|
-
|
|
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
|
+
```
|
|
103
|
+
|
|
104
|
+
## Vendor the client-side libraries
|
|
105
|
+
|
|
106
|
+
You can install (free) dependencies and client files for the library using npx
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx h1v3 vendor-deps
|
|
110
|
+
npx h1v3 vendor-client
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This will create folders such as:
|
|
114
|
+
- `/public/vendor/h1v3@0.7.6` (see below for suggestion on isolating your code from the library version)
|
|
115
|
+
- `/public/vendor/lit@3.3.1` (see https://lit.dev/)
|
|
116
|
+
|
|
117
|
+
You will also need to provide a vendored library of WebAwesome Pro:
|
|
118
|
+
|
|
119
|
+
- `/public/vendor/webawesome-pro` - for now this is an explicit dependency although you can symlink it to your current version of webawesome-pro. The system expects the `dist` folder to be available at `/public/vendor/webawesome-pro/dist`.
|
|
120
|
+
|
|
121
|
+
# Usage patterns
|
|
122
|
+
|
|
123
|
+
## Importing the library
|
|
124
|
+
|
|
125
|
+
When using the library in your website, you may wish to create a single import location which isolates your code from the version of h1v3 you are using. You can also use it to explicitly declare which bits of the library you are depending upon.
|
|
126
|
+
|
|
127
|
+
e.g. /public/js/h1v3.js
|
|
128
|
+
```javascript
|
|
129
|
+
export { default as bus } from "/vendor/h1v3@0.7.6/client/bus.js";
|
|
130
|
+
export { EVENT_USER_PROFILE_CHANGED } from "/vendor/h1v3@0.7.6/client/events.js";
|
|
131
|
+
export { styled } from "/vendor/h1v3@0.7.6/client/components/partials/wa-utils.js";
|
|
132
|
+
export * from "/vendor/h1v3@0.7.6/client/system.js";
|
|
133
|
+
```
|
|
20
134
|
|
|
21
|
-
**Note** if using the Web UI platform, the web platform will be installed and used by default
|
|
22
135
|
|
|
23
|
-
#
|
|
24
|
-
The following components build on the headless web platform:
|
|
25
|
-
- login
|
|
26
|
-
- error notifications
|
|
27
|
-
- Styling and registration of Web Awesome components
|
|
136
|
+
# Implicit Google API dependencies
|
|
28
137
|
|
|
29
|
-
|
|
138
|
+
Note - this is an incomplete list...
|
|
139
|
+
- Firebase (various APIs)
|
|
140
|
+
- Cloud Functions API
|
|
141
|
+
- Cloud Resource Manager API
|
|
142
|
+
- Cloud Run Admin API
|
|
143
|
+
- Eventarc API
|
|
144
|
+
- IAM Service Account Credentials API
|
|
145
|
+
- 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
|
-
|
|
37
|
-
|
|
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
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export const waDist = "/vendor
|
|
1
|
+
export const waDist = "/vendor/webawesome-pro";
|
|
2
2
|
|
|
3
3
|
// firebase
|
|
4
4
|
export * from "./firebase.js";
|
|
5
5
|
|
|
6
6
|
// vendor: webawesome
|
|
7
|
-
import "/vendor
|
|
8
|
-
import "/vendor
|
|
9
|
-
import "/vendor
|
|
10
|
-
import "/vendor
|
|
11
|
-
import "/vendor
|
|
12
|
-
import "/vendor
|
|
13
|
-
import "/vendor
|
|
7
|
+
import "/vendor/webawesome-pro/components/button/button.js";
|
|
8
|
+
import "/vendor/webawesome-pro/components/input/input.js";
|
|
9
|
+
import "/vendor/webawesome-pro/components/card/card.js";
|
|
10
|
+
import "/vendor/webawesome-pro/components/divider/divider.js";
|
|
11
|
+
import "/vendor/webawesome-pro/components/icon/icon.js";
|
|
12
|
+
import "/vendor/webawesome-pro/components/dialog/dialog.js";
|
|
13
|
+
import "/vendor/webawesome-pro/components/callout/callout.js";
|
|
14
14
|
|
|
15
15
|
// vendor: lit
|
|
16
16
|
export { html, LitElement, css, render } from "/vendor/lit@3.3.1/dist/lit-core.min.js";
|