@unaffi/schema 1.1.4 → 1.1.5
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 +53 -18
- package/collections/favourite.schema.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,12 +5,15 @@ This reflects what the API returns, **not** what the DB Schema looks like in Mon
|
|
|
5
5
|
Can be imported into any repo and be used by both TS and JS (JSDocs) code.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
|
+
|
|
8
9
|
```bash
|
|
9
10
|
npm i --save-dev @unaffi/schema
|
|
10
11
|
```
|
|
11
12
|
|
|
12
13
|
## Usage
|
|
14
|
+
|
|
13
15
|
Example:
|
|
16
|
+
|
|
14
17
|
```js
|
|
15
18
|
/** @type {import('@unaffi/schema').Profile} */
|
|
16
19
|
const profile = await getProfile();
|
|
@@ -20,6 +23,7 @@ const dependants = await getDependants();
|
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
or define it at the top of the page to use the type throughout the file:
|
|
26
|
+
|
|
23
27
|
```js
|
|
24
28
|
/** @typedef {import('@unaffi/schema').Profile} Profile */
|
|
25
29
|
|
|
@@ -29,11 +33,15 @@ const profile = await getProfile();
|
|
|
29
33
|
/** @type {Profile[]} */
|
|
30
34
|
const dependants = await getDependants();
|
|
31
35
|
```
|
|
36
|
+
|
|
32
37
|
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).
|
|
38
|
+
|
|
33
39
|
```js
|
|
34
40
|
/** @typedef {import('@unaffi/schema').Profile} Profile */
|
|
35
41
|
```
|
|
42
|
+
|
|
36
43
|
and then in the svelte file you need it:
|
|
44
|
+
|
|
37
45
|
```js
|
|
38
46
|
/** @type {Profile} */
|
|
39
47
|
const profile = await getProfile();
|
|
@@ -41,26 +49,53 @@ const profile = await getProfile();
|
|
|
41
49
|
/** @type {Profile[]} */
|
|
42
50
|
const dependants = await getDependants();
|
|
43
51
|
```
|
|
44
|
-
NOTE: This 3rd option only works in Svelte Projects – I believe in vite projects.
|
|
45
52
|
|
|
53
|
+
NOTE: This 3rd option only works in Svelte Projects – I believe in vite projects.
|
|
46
54
|
|
|
47
55
|
## Updating the Schema
|
|
56
|
+
|
|
48
57
|
1. **Bump the version** in the `package.json`:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
```jsonc
|
|
60
|
+
{
|
|
61
|
+
// …existing code…
|
|
62
|
+
"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.
|
|
63
|
+
// …existing code…
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. **Create authentication token** (one-time setup):
|
|
68
|
+
|
|
69
|
+
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
|
|
70
|
+
- Click "Generate New Token" → Select **"Granular Access Token"**
|
|
71
|
+
- Give it a name (e.g., "publish-token")
|
|
72
|
+
- Under **Packages and scopes**:
|
|
73
|
+
- Permissions: Select **Read and write**
|
|
74
|
+
- Packages: Select the `@unaffi/schema` package (or "All packages")
|
|
75
|
+
- **Important:** Check the **"Bypass 2FA"** option
|
|
76
|
+
- Click "Generate Token" and copy the token
|
|
77
|
+
|
|
78
|
+
Create a `.npmrc` file in the project root with:
|
|
79
|
+
|
|
80
|
+
```ini
|
|
81
|
+
//registry.npmjs.org/:_authToken=YOUR_TOKEN_HERE
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Replace `YOUR_TOKEN_HERE` with the token you just copied.
|
|
85
|
+
|
|
86
|
+
**Security Note:** Do not commit the `.npmrc` file content. It is in the `.gitignore` file.
|
|
87
|
+
|
|
88
|
+
3. Update **Github**:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git add .
|
|
92
|
+
git commit -m "Your commit message"
|
|
93
|
+
git push
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. Update **npm**:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm login
|
|
100
|
+
npm publish --access public
|
|
55
101
|
```
|
|
56
|
-
2. Update **Github**:
|
|
57
|
-
```bash
|
|
58
|
-
git add .
|
|
59
|
-
git commit -m "Your commit message"
|
|
60
|
-
git push
|
|
61
|
-
```
|
|
62
|
-
3. Update **npm**:
|
|
63
|
-
```bash
|
|
64
|
-
npm login
|
|
65
|
-
npm publish --access public
|
|
66
|
-
```
|
|
@@ -2,9 +2,9 @@ import type { Base } from "../base.schema";
|
|
|
2
2
|
import type * as DB from "../index";
|
|
3
3
|
|
|
4
4
|
export interface Favourite extends Base {
|
|
5
|
-
readonly
|
|
5
|
+
readonly favourite_id: string;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
is_unfavourited: boolean;
|
|
8
8
|
|
|
9
9
|
profile_id: DB.Profile["profile_id"];
|
|
10
10
|
profile?: DB.Profile;
|
|
@@ -15,6 +15,9 @@ export interface Favourite extends Base {
|
|
|
15
15
|
service_id?: DB.Service["service_id"];
|
|
16
16
|
service?: DB.Service;
|
|
17
17
|
|
|
18
|
+
schedule_id?: DB.Schedule["schedule_id"];
|
|
19
|
+
schedule?: DB.Schedule;
|
|
20
|
+
|
|
18
21
|
location_id?: DB.Location["location_id"];
|
|
19
22
|
location?: DB.Location;
|
|
20
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unaffi/schema",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
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": {
|