@insignia-education/api-sdk-js 0.15.53 → 0.15.55
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/.nvmrc +1 -1
- package/AGENTS.md +14 -0
- package/package.json +2 -2
- package/src/api/v1/Employee.js +2 -2
- package/src/api/v1/Users.js +25 -2
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
25
|
package/AGENTS.md
CHANGED
|
@@ -87,11 +87,25 @@ The SDK is language-neutral — it must never contain human-readable strings.
|
|
|
87
87
|
- Removed endpoint → remove or deprecate the corresponding SDK method
|
|
88
88
|
- Never leave the SDK behind the API; the `front` repo relies solely on this SDK
|
|
89
89
|
|
|
90
|
+
## Consumption — never symlink
|
|
91
|
+
|
|
92
|
+
Consumers (`front`, `api`) must install this package the normal npm way — **never** via a symlink
|
|
93
|
+
(`npm link`, a manual `ln -s` into a consumer's `node_modules`, etc.), even for local iteration.
|
|
94
|
+
|
|
95
|
+
- A symlinked package looks like it works, but an `npm install`/`npm ci` in the consumer repo can
|
|
96
|
+
silently replace the link with a stale registry copy — the consumer keeps running old SDK code
|
|
97
|
+
with no error, and edits stop propagating until someone notices at runtime.
|
|
98
|
+
- Instead: bump this package's version (`npm version patch|minor`) and have the human publish it
|
|
99
|
+
(`npm publish`), then bump the version range in the consumer's `package.json` and run
|
|
100
|
+
`npm install` there.
|
|
101
|
+
- Never publish on your own initiative — publishing is a human action.
|
|
102
|
+
|
|
90
103
|
## Never do
|
|
91
104
|
- Don't add runtime dependencies
|
|
92
105
|
- Don't change the constructor signature of `InsigniaApiV1`
|
|
93
106
|
- Don't hardcode API base URLs — always receive from constructor
|
|
94
107
|
- Don't let the SDK lag behind `api` — update both in the same task
|
|
108
|
+
- Don't symlink this package into a consumer's `node_modules` — publish it instead
|
|
95
109
|
|
|
96
110
|
|
|
97
111
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insignia-education/api-sdk-js",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.55",
|
|
4
4
|
"description": "JavaScript SDK for the Insignia Education API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Insignia Education",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=25"
|
|
24
24
|
},
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/insignia-education/api-sdk-js/issues"
|
package/src/api/v1/Employee.js
CHANGED
|
@@ -10,8 +10,8 @@ export default class Employee {
|
|
|
10
10
|
return {
|
|
11
11
|
/** All teachers' sessions for a given date (YYYY-MM-DD). */
|
|
12
12
|
sessions: (date) => this.#client.get(`${base}/sessions`, { date }),
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Every teacher's recurring weekly availability for individual sessions (day-of-week templates, not booked dates). */
|
|
14
|
+
individualAvailability: () => this.#client.get(`${base}/teachers/individual-availability`),
|
|
15
15
|
/** All sessions for one course_date, any teacher. */
|
|
16
16
|
courseDateSessions: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/sessions`),
|
|
17
17
|
/** Mark a student's attendance on any teacher's session. */
|
package/src/api/v1/Users.js
CHANGED
|
@@ -47,8 +47,31 @@ export default class Users {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
courseNotes(userId) { return this.#nested(userId, 'course-notes'); }
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
|
|
51
|
+
/** get() accepts an optional { courseId } filter to narrow to a single course. */
|
|
52
|
+
quizzes(userId) {
|
|
53
|
+
const base = `/users/${userId}/quizzes`;
|
|
54
|
+
const client = this.#client;
|
|
55
|
+
return {
|
|
56
|
+
get: (id = null, { courseId } = {}) => id ? client.get(`${base}/${id}`) : client.get(courseId ? `${base}?course_id=${courseId}` : base),
|
|
57
|
+
create: (data) => client.put(base, data),
|
|
58
|
+
edit: (id, data) => client.patch(`${base}/${id}`, data),
|
|
59
|
+
delete: (id) => client.del(`${base}/${id}`),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** get() accepts an optional { courseId } filter to narrow to a single course. */
|
|
64
|
+
sessions(userId) {
|
|
65
|
+
const base = `/users/${userId}/sessions`;
|
|
66
|
+
const client = this.#client;
|
|
67
|
+
return {
|
|
68
|
+
get: (id = null, { courseId } = {}) => id ? client.get(`${base}/${id}`) : client.get(courseId ? `${base}?course_id=${courseId}` : base),
|
|
69
|
+
create: (data) => client.put(base, data),
|
|
70
|
+
edit: (id, data) => client.patch(`${base}/${id}`, data),
|
|
71
|
+
delete: (id) => client.del(`${base}/${id}`),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
52
75
|
surveys(userId) { return this.#nested(userId, 'surveys'); }
|
|
53
76
|
cart(userId) { return this.#nested(userId, 'cart'); }
|
|
54
77
|
|