@unaffi/schema 1.1.3 → 1.1.4
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 +23 -3
- package/collections/favourite.schema.ts +20 -0
- package/collections/profile.schema.d.ts +0 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,9 @@ Example:
|
|
|
14
14
|
```js
|
|
15
15
|
/** @type {import('@unaffi/schema').Profile} */
|
|
16
16
|
const profile = await getProfile();
|
|
17
|
+
|
|
18
|
+
/** @type {import('@unaffi/schema').Profile[]} */
|
|
19
|
+
const dependants = await getDependants();
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
or define it at the top of the page to use the type throughout the file:
|
|
@@ -22,15 +25,32 @@ or define it at the top of the page to use the type throughout the file:
|
|
|
22
25
|
|
|
23
26
|
/** @type {Profile} */
|
|
24
27
|
const profile = await getProfile();
|
|
28
|
+
|
|
29
|
+
/** @type {Profile[]} */
|
|
30
|
+
const dependants = await getDependants();
|
|
31
|
+
```
|
|
32
|
+
or define it in a `types/index.js` file (where the file directory, `types`, is a peer directory or the peer of a parent directory of the file you will be using it).
|
|
33
|
+
```js
|
|
34
|
+
/** @typedef {import('@unaffi/schema').Profile} Profile */
|
|
25
35
|
```
|
|
36
|
+
and then in the svelte file you need it:
|
|
37
|
+
```js
|
|
38
|
+
/** @type {Profile} */
|
|
39
|
+
const profile = await getProfile();
|
|
40
|
+
|
|
41
|
+
/** @type {Profile[]} */
|
|
42
|
+
const dependants = await getDependants();
|
|
43
|
+
```
|
|
44
|
+
NOTE: This 3rd option only works in Svelte Projects – I believe in vite projects.
|
|
45
|
+
|
|
26
46
|
|
|
27
47
|
## Updating the Schema
|
|
28
48
|
1. **Bump the version** in the `package.json`:
|
|
29
49
|
```jsonc
|
|
30
50
|
{
|
|
31
|
-
// …
|
|
32
|
-
"version": "1.0.0", // to "1.0.1" | Always update 3rd number, unless it is a large update (such as an extra
|
|
33
|
-
// …
|
|
51
|
+
// …existing code…
|
|
52
|
+
"version": "1.0.0", // to "1.0.1" | Always update 3rd number, unless it is a large update (such as an extra collection added). Never update 1st number unless we restart unaffi's schema entirely.
|
|
53
|
+
// …existing code…
|
|
34
54
|
}
|
|
35
55
|
```
|
|
36
56
|
2. Update **Github**:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Base } from "../base.schema";
|
|
2
|
+
import type * as DB from "../index";
|
|
3
|
+
|
|
4
|
+
export interface Favourite extends Base {
|
|
5
|
+
readonly file_id: string;
|
|
6
|
+
|
|
7
|
+
is_unfavourite: boolean;
|
|
8
|
+
|
|
9
|
+
profile_id: DB.Profile["profile_id"];
|
|
10
|
+
profile?: DB.Profile;
|
|
11
|
+
|
|
12
|
+
org_id?: DB.Org["org_id"];
|
|
13
|
+
org?: DB.Org;
|
|
14
|
+
|
|
15
|
+
service_id?: DB.Service["service_id"];
|
|
16
|
+
service?: DB.Service;
|
|
17
|
+
|
|
18
|
+
location_id?: DB.Location["location_id"];
|
|
19
|
+
location?: DB.Location;
|
|
20
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./collections/action.schema";
|
|
|
2
2
|
export * from "./collections/collaborator.schema";
|
|
3
3
|
export * from "./collections/contactpoint.schema";
|
|
4
4
|
export * from "./collections/facility.schema";
|
|
5
|
+
export * from "./collections/favourite.schema";
|
|
5
6
|
export * from "./collections/file.schema";
|
|
6
7
|
export * from "./collections/form.schema";
|
|
7
8
|
export * from "./collections/instance.schema";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unaffi/schema",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "This reflects what the API returns, and not what the DB Schema looks like in MongoDB. Can be imported into any repo and be used by both TS and JS (JSDocs) code.",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"scripts": {
|