h1v3 0.14.0 → 0.15.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 +13 -0
- package/package.json +1 -1
- package/src/commands/generate-rules.js +5 -1
- package/src/exec-eventstore.js +0 -2
package/README.md
CHANGED
|
@@ -194,6 +194,12 @@ export const team_membership = configureEventStore(h1v3.teamMembership.store);
|
|
|
194
194
|
export const team_details = configureEventStore(h1v3.teamDetails.store, teamDetailsSchema);
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
+
I usually put these in a file called "h1v3.config.js" and then remember to export these from my top-level index.js (as shown above):
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
export * from "h1v3.config.js";
|
|
201
|
+
```
|
|
202
|
+
|
|
197
203
|
### Defining schemas
|
|
198
204
|
|
|
199
205
|
Schemas for the two built-in event stores user_profile and team_details expect a schema defined using a javascript prototype as shown below. Note that there is no required constraint. Instead the schema is a white-list of keys along with the expected type for the associated value.
|
|
@@ -274,6 +280,13 @@ function buildEmulated() {
|
|
|
274
280
|
}
|
|
275
281
|
```
|
|
276
282
|
|
|
283
|
+
## Database rules
|
|
284
|
+
|
|
285
|
+
Once you have defined your configuration (`h1v3.config.js`) you can generate your databse.rules.json file:
|
|
286
|
+
```sh
|
|
287
|
+
cd functions
|
|
288
|
+
npx h1v3 rules --output ../database.rules.json
|
|
289
|
+
```
|
|
277
290
|
|
|
278
291
|
|
|
279
292
|
|
package/package.json
CHANGED