@insignia-education/api-sdk-js 0.15.63 → 0.15.66
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/.ai/guidelines/research-order.md +29 -0
- package/.claude/agents/product-spec-architect.md +163 -0
- package/.claude/agents/senior-code-reviewer.md +109 -0
- package/.claude/agents/senior-software-developer.md +90 -0
- package/.claude/agents/senior-software-maintainer.md +121 -0
- package/.claude/skills/general/documentation/SKILL.md +49 -0
- package/.claude/skills/general/handoff/SKILL.md +15 -0
- package/.claude/skills/general/investigation/SKILL.md +53 -0
- package/.claude/skills/general/performance/SKILL.md +31 -0
- package/.claude/skills/git/pull-request/SKILL.md +47 -0
- package/.claude/skills/how-to-create-skills/SKILL.md +82 -0
- package/.github/workflows/npm-publish-github-packages.yml +22 -98
- package/CLAUDE.md +60 -0
- package/package.json +1 -1
- package/src/api/v1/Users.js +12 -2
- package/.env +0 -1
- package/.env.test +0 -5
- package/coverage/clover.xml +0 -135
- package/coverage/coverage-final.json +0 -2
- package/coverage/lcov-report/Client.js.html +0 -463
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -116
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/Client.js.html +0 -463
- package/coverage/lcov-report/src/api/index.html +0 -116
- package/coverage/lcov-report/src/api/index.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Accounts.js.html +0 -151
- package/coverage/lcov-report/src/api/v1/Admin.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Auth.js.html +0 -157
- package/coverage/lcov-report/src/api/v1/Categories.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Changelogs.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/Configs.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/ContactForms.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/ConversationalTopics.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Countries.js.html +0 -112
- package/coverage/lcov-report/src/api/v1/Coupons.js.html +0 -142
- package/coverage/lcov-report/src/api/v1/Courses.js.html +0 -436
- package/coverage/lcov-report/src/api/v1/Currencies.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/Dashboard.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/EducationCenter.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/Employee.js.html +0 -169
- package/coverage/lcov-report/src/api/v1/Files.js.html +0 -160
- package/coverage/lcov-report/src/api/v1/Forums.js.html +0 -175
- package/coverage/lcov-report/src/api/v1/Hashes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Insignias.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Languages.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/MailBlacklist.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/MailingLists.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Offers.js.html +0 -142
- package/coverage/lcov-report/src/api/v1/Organizations.js.html +0 -199
- package/coverage/lcov-report/src/api/v1/PaymentMethods.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Payments.js.html +0 -310
- package/coverage/lcov-report/src/api/v1/Premiums.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Quizzes.js.html +0 -214
- package/coverage/lcov-report/src/api/v1/Sales.js.html +0 -148
- package/coverage/lcov-report/src/api/v1/Search.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/ShortLinks.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Surveys.js.html +0 -181
- package/coverage/lcov-report/src/api/v1/Taxes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Teacher.js.html +0 -322
- package/coverage/lcov-report/src/api/v1/Telegram.js.html +0 -124
- package/coverage/lcov-report/src/api/v1/TwoFactor.js.html +0 -145
- package/coverage/lcov-report/src/api/v1/UserSessionTypes.js.html +0 -112
- package/coverage/lcov-report/src/api/v1/UserTypes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Users.js.html +0 -700
- package/coverage/lcov-report/src/api/v1/Utm.js.html +0 -151
- package/coverage/lcov-report/src/api/v1/Webauthn.js.html +0 -190
- package/coverage/lcov-report/src/api/v1/Zoom.js.html +0 -124
- package/coverage/lcov-report/src/api/v1/index.html +0 -716
- package/coverage/lcov-report/src/api/v1/index.js.html +0 -373
- package/coverage/lcov-report/src/index.html +0 -131
- package/coverage/lcov-report/src/index.js.html +0 -109
- package/coverage/lcov-report/tests/helpers.js.html +0 -145
- package/coverage/lcov-report/tests/index.html +0 -116
- package/coverage/lcov.info +0 -207
- package/coverage/test-report.html +0 -277
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance
|
|
3
|
+
description: Minimal performance checklist for this thin HTTP client SDK — there is very little performance surface here (no rendering, no queries, no server). Use when a consumer reports a resource method being called redundantly or a method doing unnecessary work per call. Triggers on "performance", "slow", "redundant calls", "optimize", "duplicate requests".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Performance — Minimal Checklist
|
|
7
|
+
|
|
8
|
+
This is a thin, zero-dependency HTTP wrapper. It has no database, no rendering, no compute-heavy
|
|
9
|
+
work, and no server process — most of the performance surface that a full application has simply
|
|
10
|
+
doesn't exist here. Don't manufacture a heavier profiling process than the codebase warrants; this
|
|
11
|
+
skill is intentionally short.
|
|
12
|
+
|
|
13
|
+
The two things actually worth checking:
|
|
14
|
+
|
|
15
|
+
1. **Redundant/duplicate calls from a consumer using a method in a loop.** A resource method is a
|
|
16
|
+
1:1 wrapper around one `api` call — if `front` (or another consumer) calls the same method
|
|
17
|
+
repeatedly inside a loop with the same or overlapping args, that's a consumer-side batching
|
|
18
|
+
problem, not something to fix inside the SDK method itself. Flag it to the consumer rather than
|
|
19
|
+
adding caching/batching logic into a resource class (that would violate thin-wrapper discipline
|
|
20
|
+
— see `AGENTS.md` and the `senior-software-developer`/`senior-code-reviewer` agents).
|
|
21
|
+
2. **Unnecessary payload transformation or cloning per call.** A resource method should pass
|
|
22
|
+
params/body through to the client with the minimum work needed to shape the HTTP request — no
|
|
23
|
+
deep-cloning, no reshaping the response, no redundant `JSON.parse(JSON.stringify(...))`-style
|
|
24
|
+
copies. If a method is doing more than constructing the call and returning the client's
|
|
25
|
+
response, that's very likely a correctness/scope issue (see `general/investigation` and the
|
|
26
|
+
thin-wrapper rule), not just a performance one.
|
|
27
|
+
|
|
28
|
+
If a real latency problem is reported, it is almost certainly in `api` (query performance, N+1,
|
|
29
|
+
slow external integration) or in network conditions — not in this SDK. Point the investigation at
|
|
30
|
+
`api`'s own performance tooling (see its `AGENTS.md`/performance skill) rather than profiling this
|
|
31
|
+
repo.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-pull-request-api-sdk-js
|
|
3
|
+
description: Create a pull request following insignia-education conventions for this repo — no Jira link, no PR template, but a repo-specific pre-flight checklist (endpoint exists in api, integration test present, v1-freeze respected, publish-pipeline awareness). Use whenever creating a PR in `api-sdk-js`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Pull Request — insignia-education/api-sdk-js
|
|
7
|
+
|
|
8
|
+
No `.github/PULL_REQUEST_TEMPLATE.md` exists in this repo — write a plain body with `## Summary`
|
|
9
|
+
and `## Test plan` sections (see the repo-level PR instructions for the exact mechanics of
|
|
10
|
+
`gh pr create`). This skill adds the checks specific to this repo, on top of that.
|
|
11
|
+
|
|
12
|
+
## Pre-flight checklist
|
|
13
|
+
|
|
14
|
+
- **The `api` endpoint is real and already merged/available.** Never add a speculative SDK method
|
|
15
|
+
for an endpoint that doesn't exist yet in `api` — confirm the route/controller is merged (and,
|
|
16
|
+
ideally, deployed somewhere reachable) before opening this PR. Per `AGENTS.md`'s sync rule, this
|
|
17
|
+
SDK follows `api`; it never leads it.
|
|
18
|
+
- **An integration test was added or updated.** Per `AGENTS.md`, a new/changed method isn't
|
|
19
|
+
verified until its test in `tests/integration/api/v1/` passes against a locally running `api`.
|
|
20
|
+
A PR that changes a resource method without a corresponding test change is incomplete — call it
|
|
21
|
+
out explicitly if deferring this is unavoidable.
|
|
22
|
+
- **Test coverage includes missing/malformed params and permissions per role**, not just the happy
|
|
23
|
+
path — per `AGENTS.md`'s testing coverage requirements.
|
|
24
|
+
- **`v1` freeze respected.** If the diff touches `src/api/v1/`, confirm it's additive (new
|
|
25
|
+
method/resource) and not a breaking change to an existing method's signature or return shape, and
|
|
26
|
+
that `InsigniaApiV1`'s constructor is unchanged. A breaking change belongs under a future
|
|
27
|
+
`src/api/v2/`, not a `v1` edit.
|
|
28
|
+
- **No runtime dependency added**, no hardcoded base URL, no hardcoded human-readable string in
|
|
29
|
+
source (errors must expose `status`/`data` only — see `AGENTS.md`'s i18n rule).
|
|
30
|
+
- **Merging this PR to `master` is a deploy action, not a routine merge.** Per `CLAUDE.md`'s
|
|
31
|
+
deployment section, a push to `master` (unless `[skip ci]`) auto-bumps this package's patch
|
|
32
|
+
version, publishes it to npm, pushes a direct commit to `front`'s `beta` branch, and opens a PR
|
|
33
|
+
against `front`'s `master` — all without further human action beyond the merge itself. Don't
|
|
34
|
+
merge here as though it's a no-op; know that it triggers all of the above.
|
|
35
|
+
|
|
36
|
+
## Body format
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
## Summary
|
|
40
|
+
<1-3 bullets>
|
|
41
|
+
|
|
42
|
+
## Test plan
|
|
43
|
+
<checklist of what was tested / how to verify>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Omit sections that would be empty. No ticket link, no deployment labels — this repo doesn't use
|
|
47
|
+
them.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: how-to-create-skills
|
|
3
|
+
description: How to author and organize skills in this repo's `.claude/skills/` — the domain/general taxonomy, the composability principle (split knowledge from method), SKILL.md frontmatter, naming, and when to split vs combine a skill. Use whenever creating a new skill, editing an existing one, splitting a monolithic skill, or deciding where a skill belongs. Triggers on "create a skill", "new skill", "add a skill", "organize skills", "skill structure".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# How to Create Skills
|
|
7
|
+
|
|
8
|
+
This is the meta-skill. It defines the conventions every other skill in `.claude/skills/` follows. **This skill is intentionally exempt from those conventions** — it lives at the top level with no domain, because it describes the system rather than participating in it.
|
|
9
|
+
|
|
10
|
+
## The one principle: split *knowledge* from *method*, then compose
|
|
11
|
+
|
|
12
|
+
A skill is either:
|
|
13
|
+
- **Domain knowledge** — *what exists and where it lives* (a map): resource/versioning structure, file paths, conventions, entry points. No domain-map skill exists here yet — the closest thing today is `AGENTS.md` plus `.ai/guidelines/research-order.md`.
|
|
14
|
+
- **A general process** — *how to do something*, independent of domain (a method): investigating drift, documenting, opening a PR. Example: `investigation`, `general/documentation`.
|
|
15
|
+
|
|
16
|
+
Never fuse the two. If a domain-map skill is added later (e.g. `v2` once the next API version gets its own resource modules), there should not be a `v2-investigation` skill — there should be `v2` (the map) and `investigation` (the method), composed together. The cross-product emerges from composition, not from a bespoke combined skill.
|
|
17
|
+
|
|
18
|
+
**Why:** the method is reusable across every version/resource, and the map is reusable across every process. Fusing them forces you to re-teach the investigation method for each version and re-map the resources for each activity.
|
|
19
|
+
|
|
20
|
+
### How composition works in practice
|
|
21
|
+
- A general process skill says: *"pair me with the relevant domain skill for the map."*
|
|
22
|
+
- A domain skill says: *"for investigating drift, also load `investigation`; for a new method, also load `general/documentation`."*
|
|
23
|
+
- Cross-reference by skill `name` in prose so the reader knows what to load alongside.
|
|
24
|
+
|
|
25
|
+
## Folder taxonomy: domain → sub-domain → process → skill-name
|
|
26
|
+
|
|
27
|
+
Organize the path from most-specific domain down to the leaf. Cross-cutting process skills that belong to no single domain live under `general/`.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
.claude/skills/
|
|
31
|
+
├── how-to-create-skills/ ← this meta-skill (exempt from the pattern)
|
|
32
|
+
├── <domain>/ ← domain knowledge (git, v2, …)
|
|
33
|
+
│ ├── SKILL.md ← the domain map itself (optional)
|
|
34
|
+
│ └── <sub-domain-or-process>/SKILL.md
|
|
35
|
+
└── general/ ← domain-agnostic process skills
|
|
36
|
+
└── <process>/SKILL.md ← performance, investigation, documentation, handoff, …
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Rules:
|
|
40
|
+
- **Domain first.** If a skill is about *one* domain, nest it under that domain (`git/pull-request`).
|
|
41
|
+
- **General bucket.** If a skill's method applies across domains, put it in `general/` (`general/performance`).
|
|
42
|
+
- Any `SKILL.md` anywhere under `.claude/skills/**` is discovered — folders are for humans, the `name` field is the identifier.
|
|
43
|
+
- Prefer the **most general** phrasing a skill can honestly carry. Keep repo-specific specifics (class names, endpoint paths) inside the skill, but frame the transferable method first.
|
|
44
|
+
|
|
45
|
+
## Deciding: split or combine?
|
|
46
|
+
|
|
47
|
+
| Signal | Action |
|
|
48
|
+
|---|---|
|
|
49
|
+
| The skill mixes "where the code is" with "how to profile/debug it" | **Split** into a domain skill + a `general/` process skill |
|
|
50
|
+
| Two skills always get loaded together and neither stands alone | Consider **combining** — but first check whether one is really a sub-domain of the other |
|
|
51
|
+
| A process skill keeps accreting domain-specific class/resource names | Move those facts into the **domain** skill; keep the method general |
|
|
52
|
+
| A domain skill starts explaining testing/PR mechanics in depth | Move that into a **general** process skill and cross-reference |
|
|
53
|
+
|
|
54
|
+
## SKILL.md format
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
---
|
|
58
|
+
name: <kebab-case, unique across all skills>
|
|
59
|
+
description: <what it does + WHEN to use it + trigger phrases. This is the ONLY thing the model sees when deciding to load the skill — make it match how people actually phrase the task. For composables, name the skills to load alongside.>
|
|
60
|
+
argument-hint: "<optional, for slash-invoked skills>"
|
|
61
|
+
disable-model-invocation: true # optional — manual /invoke only
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# Title
|
|
65
|
+
|
|
66
|
+
Body: tables and short imperative steps first, prose last. Cross-reference
|
|
67
|
+
composable skills by name. Note file:line references but tell the reader to
|
|
68
|
+
verify them against current code.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Frontmatter notes:
|
|
72
|
+
- **`name`** must be unique and stable — it's the slash command and the invocation id. Renaming breaks existing references, so rename deliberately.
|
|
73
|
+
- **`description`** is load-bearing: it's matched against the user's request to auto-activate the skill. Lead with capability, then "Use when…", then trigger phrases.
|
|
74
|
+
- **`disable-model-invocation: true`** makes the skill manual-only (`/name …`). Use for router/workflow skills that shouldn't fire automatically.
|
|
75
|
+
|
|
76
|
+
## Authoring checklist
|
|
77
|
+
1. Is this **knowledge** or **method**? Put it in the right place; don't fuse.
|
|
78
|
+
2. Does an existing skill already cover it? Extend that instead of duplicating.
|
|
79
|
+
3. Can the wording be more general without losing accuracy? Generalize.
|
|
80
|
+
4. Name the composable siblings to load alongside.
|
|
81
|
+
5. Write the `description` the way a user would ask for it.
|
|
82
|
+
6. Keep the body scannable: tables + steps first.
|
|
@@ -1,114 +1,38 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Publish Package
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write
|
|
13
|
-
outputs:
|
|
14
|
-
version: ${{ steps.bump.outputs.version }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
|
|
18
|
-
- name: Setup node
|
|
19
|
-
uses: actions/setup-node@v4
|
|
20
|
-
with:
|
|
21
|
-
node-version: 25
|
|
22
|
-
registry-url: 'https://registry.npmjs.org/'
|
|
23
|
-
|
|
24
|
-
- name: Configure git
|
|
25
|
-
run: |
|
|
26
|
-
git config user.name "github-actions[bot]"
|
|
27
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
28
|
-
|
|
29
|
-
- name: Bump patch version
|
|
30
|
-
id: bump
|
|
31
|
-
run: |
|
|
32
|
-
NEW_VERSION=$(npm version patch -m "chore: release v%s [skip ci]")
|
|
33
|
-
echo "version=${NEW_VERSION#v}" >> "$GITHUB_OUTPUT"
|
|
34
|
-
|
|
35
|
-
- name: Push version bump
|
|
36
|
-
run: git push origin HEAD:master --follow-tags
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write # Required for OIDC
|
|
10
|
+
contents: write # Required to commit the version bump back to master
|
|
37
11
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
env:
|
|
41
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
42
|
-
|
|
43
|
-
sync-front:
|
|
44
|
-
needs: bump-and-publish
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
45
14
|
runs-on: ubuntu-latest
|
|
46
|
-
env:
|
|
47
|
-
SDK_VERSION: ${{ needs.bump-and-publish.outputs.version }}
|
|
48
15
|
steps:
|
|
49
|
-
-
|
|
50
|
-
run: sleep 15
|
|
51
|
-
|
|
52
|
-
- name: Setup node
|
|
53
|
-
uses: actions/setup-node@v4
|
|
54
|
-
with:
|
|
55
|
-
node-version: 24
|
|
16
|
+
- uses: actions/checkout@v6
|
|
56
17
|
|
|
57
|
-
|
|
58
|
-
- name: Checkout front (beta)
|
|
59
|
-
uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-node@v6
|
|
60
19
|
with:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
20
|
+
node-version: '24'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
package-manager-cache: false # never use caching in release builds
|
|
23
|
+
- run: npm ci
|
|
24
|
+
- run: npm run build --if-present
|
|
25
|
+
# npm test disabled: integration suite needs a live api backend, no CI service for it yet
|
|
65
26
|
|
|
66
|
-
-
|
|
67
|
-
working-directory: front-beta
|
|
68
|
-
run: npm install "@insignia-education/api-sdk-js@${SDK_VERSION}"
|
|
27
|
+
- run: npm version patch --no-git-tag-version
|
|
69
28
|
|
|
70
|
-
|
|
71
|
-
|
|
29
|
+
# Pushing with GITHUB_TOKEN doesn't retrigger this workflow, so no [skip ci] loop risk.
|
|
30
|
+
- name: Commit version bump
|
|
72
31
|
run: |
|
|
73
32
|
git config user.name "github-actions[bot]"
|
|
74
33
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
75
34
|
git add package.json package-lock.json
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
else
|
|
79
|
-
git commit -m "chore: bump @insignia-education/api-sdk-js to ${SDK_VERSION}"
|
|
80
|
-
git push origin beta
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
# ---- master: open a PR for review ----
|
|
84
|
-
- name: Checkout front (master)
|
|
85
|
-
uses: actions/checkout@v4
|
|
86
|
-
with:
|
|
87
|
-
repository: insignia-education/front
|
|
88
|
-
ref: master
|
|
89
|
-
token: ${{ secrets.FRONT_REPO_PAT }}
|
|
90
|
-
path: front-master
|
|
35
|
+
git commit -m "chore: bump version to $(node -p "require('./package.json').version")"
|
|
36
|
+
git push
|
|
91
37
|
|
|
92
|
-
-
|
|
93
|
-
working-directory: front-master
|
|
94
|
-
run: npm install "@insignia-education/api-sdk-js@${SDK_VERSION}"
|
|
95
|
-
|
|
96
|
-
- name: Open PR against master
|
|
97
|
-
working-directory: front-master
|
|
98
|
-
env:
|
|
99
|
-
GH_TOKEN: ${{ secrets.FRONT_REPO_PAT }}
|
|
100
|
-
run: |
|
|
101
|
-
git config user.name "github-actions[bot]"
|
|
102
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
103
|
-
if git diff --quiet; then
|
|
104
|
-
echo "No changes, skipping PR"
|
|
105
|
-
exit 0
|
|
106
|
-
fi
|
|
107
|
-
BRANCH="chore/bump-api-sdk-js-${SDK_VERSION}"
|
|
108
|
-
git checkout -b "$BRANCH"
|
|
109
|
-
git add package.json package-lock.json
|
|
110
|
-
git commit -m "chore: bump @insignia-education/api-sdk-js to ${SDK_VERSION}"
|
|
111
|
-
git push origin "$BRANCH"
|
|
112
|
-
gh pr create --repo insignia-education/front --base master --head "$BRANCH" \
|
|
113
|
-
--title "chore: bump @insignia-education/api-sdk-js to ${SDK_VERSION}" \
|
|
114
|
-
--body "Automated dependency bump triggered by insignia-education/api-sdk-js@${SDK_VERSION}."
|
|
38
|
+
- run: npm publish # Or: npm stage publish
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
> **Status: Active — the sole client for `insignia-education/api`.**
|
|
6
|
+
> A thin, zero-runtime-dependency JavaScript SDK wrapping the Laravel 12 backend
|
|
7
|
+
> [`insignia-education/api`](../api). Its only consumer is
|
|
8
|
+
> [`insignia-education/front`](../front) (React 19 + Vite 8 SPA) — `front` never calls `api`
|
|
9
|
+
> directly. `v1` is being finalized and will be permanently frozen once stable; a future `v2`
|
|
10
|
+
> is added alongside `v1`, never in place of it.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
> The canonical agent-readable version of these instructions is **`AGENTS.md`** (same directory). Both
|
|
15
|
+
> files are kept in sync; CLAUDE.md adds Claude Code–specific detail where needed. Read `AGENTS.md` first
|
|
16
|
+
> for versioning rules, structure, conventions, testing coverage requirements, the i18n rule, the
|
|
17
|
+
> API↔SDK sync rule, and the "Never do" list — none of that is repeated here.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Related repos
|
|
22
|
+
|
|
23
|
+
| Repo | Role |
|
|
24
|
+
|---|---|
|
|
25
|
+
| [`api`](../api) | Laravel backend this SDK wraps. Any endpoint added, renamed, or removed there must be mirrored here in the same task — see `AGENTS.md`'s sync rule. |
|
|
26
|
+
| [`front`](../front) | The sole consumer. Talks to `api` exclusively through this package — a method missing here is a method `front` cannot use. |
|
|
27
|
+
|
|
28
|
+
This SDK has no independent purpose — it only exists to mirror `api`. When in doubt about what a
|
|
29
|
+
method should do, the answer is "whatever the matching `api` endpoint does," not a judgment call
|
|
30
|
+
made here.
|
|
31
|
+
|
|
32
|
+
## Deployment / publish (GitHub Actions — read this before touching `master`)
|
|
33
|
+
|
|
34
|
+
`.github/workflows/npm-publish-github-packages.yml` runs on every push to `master` (skipped only
|
|
35
|
+
if the commit message contains `[skip ci]`). It is **not** a manual `npm publish` a human runs by
|
|
36
|
+
hand — merging a PR to `master` is the trigger, and that merge is a human action, so the "never
|
|
37
|
+
publish on your own initiative" rule in `AGENTS.md` still applies to *merging to master*, not just
|
|
38
|
+
to running `npm publish` directly.
|
|
39
|
+
|
|
40
|
+
What the workflow actually does, in order:
|
|
41
|
+
|
|
42
|
+
1. **`bump-and-publish`** — bumps the patch version (`npm version patch -m "chore: release v%s
|
|
43
|
+
[skip ci]"`), pushes the version-bump commit + tag back to `master`, then publishes the package
|
|
44
|
+
to npm (`npm publish --access public`, using `secrets.NPM_TOKEN`).
|
|
45
|
+
2. **`sync-front`** (runs after publish, waits 15s for npm registry propagation) — automatically
|
|
46
|
+
syncs `front` using `secrets.FRONT_REPO_PAT`:
|
|
47
|
+
- **`beta` branch**: checks it out, runs `npm install @insignia-education/api-sdk-js@<new
|
|
48
|
+
version>`, commits, and **pushes directly** — no review step.
|
|
49
|
+
- **`master` branch**: checks it out, runs the same install, and **opens a PR** against
|
|
50
|
+
`front`'s `master` (`chore/bump-api-sdk-js-<version>`) for human review — it does not merge
|
|
51
|
+
itself.
|
|
52
|
+
|
|
53
|
+
**Practical implications:**
|
|
54
|
+
- Merging a PR to this repo's `master` is not just "ship the SDK change" — it also auto-bumps
|
|
55
|
+
`front`'s `beta` branch with no human in the loop, and opens (but does not merge) a PR against
|
|
56
|
+
`front`'s `master`. Treat a `master` merge here as a deploy action, not a routine commit.
|
|
57
|
+
- There is no manual "bump the consumer's `package.json`" step to perform for `beta` — CI already
|
|
58
|
+
does it. A human only needs to review/merge the auto-opened PR against `front`'s `master`.
|
|
59
|
+
- Requires `secrets.NPM_TOKEN` (npm publish) and `secrets.FRONT_REPO_PAT` (push to `front` +
|
|
60
|
+
open PRs there) to be configured on this repo.
|
package/package.json
CHANGED
package/src/api/v1/Users.js
CHANGED
|
@@ -48,15 +48,19 @@ export default class Users {
|
|
|
48
48
|
}
|
|
49
49
|
courseNotes(userId) { return this.#nested(userId, 'course-notes'); }
|
|
50
50
|
|
|
51
|
-
/** get() accepts
|
|
51
|
+
/** get() accepts optional { courseId, withTrashed } filters — withTrashed also returns soft-deleted attempts. */
|
|
52
52
|
quizzes(userId) {
|
|
53
53
|
const base = `/users/${userId}/quizzes`;
|
|
54
54
|
const client = this.#client;
|
|
55
55
|
return {
|
|
56
|
-
get:
|
|
56
|
+
get: (id = null, { courseId, withTrashed } = {}) => id
|
|
57
|
+
? client.get(`${base}/${id}`)
|
|
58
|
+
: client.get(base, { course_id: courseId, with_trashed: withTrashed ? 1 : undefined }),
|
|
57
59
|
create: (data) => client.put(base, data),
|
|
58
60
|
edit: (id, data) => client.patch(`${base}/${id}`, data),
|
|
59
61
|
delete: (id) => client.del(`${base}/${id}`),
|
|
62
|
+
/** Puts a soft-deleted attempt back. */
|
|
63
|
+
restore: (id) => client.post(`${base}/${id}/restore`),
|
|
60
64
|
/**
|
|
61
65
|
* Upload the file a student attaches as their answer to a
|
|
62
66
|
* document_upload (PDF) or audio_answer (recording) question
|
|
@@ -78,6 +82,12 @@ export default class Users {
|
|
|
78
82
|
create: (data) => client.put(base, data),
|
|
79
83
|
edit: (id, data) => client.patch(`${base}/${id}`, data),
|
|
80
84
|
delete: (id) => client.del(`${base}/${id}`),
|
|
85
|
+
/**
|
|
86
|
+
* Individual sessions only: clears teacher/course/date/time/meeting info
|
|
87
|
+
* so the slot can be rebooked. The owner may reset up to 1h before the
|
|
88
|
+
* session starts; a seller-and-above may reset any time.
|
|
89
|
+
*/
|
|
90
|
+
reset: (id) => client.post(`${base}/${id}/reset`),
|
|
81
91
|
};
|
|
82
92
|
}
|
|
83
93
|
|
package/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
INSIGNIA_EDUCATION_API_BASE_URL=http://localhost:8000
|
package/.env.test
DELETED
package/coverage/clover.xml
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="1786375129197" clover="3.2.0">
|
|
3
|
-
<project timestamp="1786375129197" name="All files">
|
|
4
|
-
<metrics statements="126" coveredstatements="94" conditionals="44" coveredconditionals="35" methods="14" coveredmethods="13" elements="184" coveredelements="142" complexity="0" loc="126" ncloc="126" packages="1" files="1" classes="1"/>
|
|
5
|
-
<file name="Client.js" path="/Users/roquendo/code/insignia-education/api-sdk-js/src/Client.js">
|
|
6
|
-
<metrics statements="126" coveredstatements="94" conditionals="44" coveredconditionals="35" methods="14" coveredmethods="13"/>
|
|
7
|
-
<line num="1" count="1" type="stmt"/>
|
|
8
|
-
<line num="2" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
9
|
-
<line num="3" count="1" type="stmt"/>
|
|
10
|
-
<line num="4" count="1" type="stmt"/>
|
|
11
|
-
<line num="5" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
12
|
-
<line num="6" count="27" type="stmt"/>
|
|
13
|
-
<line num="7" count="27" type="stmt"/>
|
|
14
|
-
<line num="8" count="1" type="stmt"/>
|
|
15
|
-
<line num="9" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
16
|
-
<line num="10" count="27" type="stmt"/>
|
|
17
|
-
<line num="11" count="26" type="cond" truecount="2" falsecount="0"/>
|
|
18
|
-
<line num="12" count="27" type="cond" truecount="1" falsecount="0"/>
|
|
19
|
-
<line num="13" count="27" type="stmt"/>
|
|
20
|
-
<line num="14" count="27" type="cond" truecount="2" falsecount="0"/>
|
|
21
|
-
<line num="15" count="27" type="stmt"/>
|
|
22
|
-
<line num="16" count="27" type="stmt"/>
|
|
23
|
-
<line num="17" count="27" type="stmt"/>
|
|
24
|
-
<line num="18" count="1" type="stmt"/>
|
|
25
|
-
<line num="19" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
26
|
-
<line num="20" count="23" type="stmt"/>
|
|
27
|
-
<line num="21" count="23" type="stmt"/>
|
|
28
|
-
<line num="22" count="23" type="stmt"/>
|
|
29
|
-
<line num="23" count="23" type="stmt"/>
|
|
30
|
-
<line num="24" count="23" type="stmt"/>
|
|
31
|
-
<line num="25" count="23" type="cond" truecount="0" falsecount="1"/>
|
|
32
|
-
<line num="26" count="23" type="stmt"/>
|
|
33
|
-
<line num="27" count="23" type="stmt"/>
|
|
34
|
-
<line num="28" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
35
|
-
<line num="29" count="23" type="stmt"/>
|
|
36
|
-
<line num="30" count="23" type="stmt"/>
|
|
37
|
-
<line num="31" count="23" type="stmt"/>
|
|
38
|
-
<line num="32" count="1" type="stmt"/>
|
|
39
|
-
<line num="33" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
40
|
-
<line num="34" count="23" type="cond" truecount="2" falsecount="0"/>
|
|
41
|
-
<line num="35" count="1" type="stmt"/>
|
|
42
|
-
<line num="36" count="1" type="stmt"/>
|
|
43
|
-
<line num="37" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
44
|
-
<line num="38" count="1" type="stmt"/>
|
|
45
|
-
<line num="39" count="1" type="stmt"/>
|
|
46
|
-
<line num="40" count="1" type="stmt"/>
|
|
47
|
-
<line num="41" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
48
|
-
<line num="42" count="23" type="cond" truecount="0" falsecount="1"/>
|
|
49
|
-
<line num="43" count="23" type="stmt"/>
|
|
50
|
-
<line num="44" count="23" type="stmt"/>
|
|
51
|
-
<line num="45" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
52
|
-
<line num="46" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
53
|
-
<line num="47" count="23" type="cond" truecount="1" falsecount="1"/>
|
|
54
|
-
<line num="48" count="23" type="stmt"/>
|
|
55
|
-
<line num="49" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
56
|
-
<line num="50" count="1" type="stmt"/>
|
|
57
|
-
<line num="51" count="1" type="stmt"/>
|
|
58
|
-
<line num="52" count="1" type="cond" truecount="0" falsecount="1"/>
|
|
59
|
-
<line num="53" count="1" type="stmt"/>
|
|
60
|
-
<line num="54" count="1" type="stmt"/>
|
|
61
|
-
<line num="55" count="1" type="stmt"/>
|
|
62
|
-
<line num="56" count="23" type="stmt"/>
|
|
63
|
-
<line num="57" count="1" type="stmt"/>
|
|
64
|
-
<line num="58" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
65
|
-
<line num="59" count="23" type="cond" truecount="2" falsecount="0"/>
|
|
66
|
-
<line num="60" count="22" type="stmt"/>
|
|
67
|
-
<line num="61" count="22" type="stmt"/>
|
|
68
|
-
<line num="62" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
69
|
-
<line num="63" count="1" type="stmt"/>
|
|
70
|
-
<line num="64" count="1" type="cond" truecount="0" falsecount="1"/>
|
|
71
|
-
<line num="65" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
72
|
-
<line num="66" count="21" type="stmt"/>
|
|
73
|
-
<line num="67" count="21" type="stmt"/>
|
|
74
|
-
<line num="68" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
75
|
-
<line num="69" count="1" type="stmt"/>
|
|
76
|
-
<line num="70" count="1" type="stmt"/>
|
|
77
|
-
<line num="71" count="1" type="cond" truecount="0" falsecount="1"/>
|
|
78
|
-
<line num="72" count="0" type="stmt"/>
|
|
79
|
-
<line num="73" count="0" type="stmt"/>
|
|
80
|
-
<line num="74" count="23" type="stmt"/>
|
|
81
|
-
<line num="75" count="1" type="stmt"/>
|
|
82
|
-
<line num="76" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
83
|
-
<line num="77" count="23" type="stmt"/>
|
|
84
|
-
<line num="78" count="23" type="cond" truecount="1" falsecount="0"/>
|
|
85
|
-
<line num="79" count="23" type="stmt"/>
|
|
86
|
-
<line num="80" count="23" type="stmt"/>
|
|
87
|
-
<line num="81" count="23" type="cond" truecount="0" falsecount="1"/>
|
|
88
|
-
<line num="82" count="0" type="stmt"/>
|
|
89
|
-
<line num="83" count="0" type="stmt"/>
|
|
90
|
-
<line num="84" count="0" type="stmt"/>
|
|
91
|
-
<line num="85" count="0" type="stmt"/>
|
|
92
|
-
<line num="86" count="0" type="stmt"/>
|
|
93
|
-
<line num="87" count="23" type="stmt"/>
|
|
94
|
-
<line num="88" count="23" type="cond" truecount="3" falsecount="0"/>
|
|
95
|
-
<line num="89" count="23" type="stmt"/>
|
|
96
|
-
<line num="90" count="1" type="stmt"/>
|
|
97
|
-
<line num="91" count="1" type="stmt"/>
|
|
98
|
-
<line num="92" count="0" type="stmt"/>
|
|
99
|
-
<line num="93" count="0" type="stmt"/>
|
|
100
|
-
<line num="94" count="0" type="stmt"/>
|
|
101
|
-
<line num="95" count="0" type="stmt"/>
|
|
102
|
-
<line num="96" count="0" type="stmt"/>
|
|
103
|
-
<line num="97" count="0" type="stmt"/>
|
|
104
|
-
<line num="98" count="0" type="stmt"/>
|
|
105
|
-
<line num="99" count="0" type="stmt"/>
|
|
106
|
-
<line num="100" count="0" type="stmt"/>
|
|
107
|
-
<line num="101" count="0" type="stmt"/>
|
|
108
|
-
<line num="102" count="0" type="stmt"/>
|
|
109
|
-
<line num="103" count="0" type="stmt"/>
|
|
110
|
-
<line num="104" count="0" type="stmt"/>
|
|
111
|
-
<line num="105" count="0" type="stmt"/>
|
|
112
|
-
<line num="106" count="0" type="stmt"/>
|
|
113
|
-
<line num="107" count="0" type="stmt"/>
|
|
114
|
-
<line num="108" count="0" type="stmt"/>
|
|
115
|
-
<line num="109" count="0" type="stmt"/>
|
|
116
|
-
<line num="110" count="0" type="stmt"/>
|
|
117
|
-
<line num="111" count="0" type="stmt"/>
|
|
118
|
-
<line num="112" count="1" type="stmt"/>
|
|
119
|
-
<line num="113" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
120
|
-
<line num="114" count="14" type="cond" truecount="0" falsecount="2"/>
|
|
121
|
-
<line num="115" count="0" type="stmt"/>
|
|
122
|
-
<line num="116" count="0" type="stmt"/>
|
|
123
|
-
<line num="117" count="0" type="stmt"/>
|
|
124
|
-
<line num="118" count="0" type="stmt"/>
|
|
125
|
-
<line num="119" count="0" type="stmt"/>
|
|
126
|
-
<line num="120" count="14" type="stmt"/>
|
|
127
|
-
<line num="121" count="14" type="stmt"/>
|
|
128
|
-
<line num="122" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
129
|
-
<line num="123" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
130
|
-
<line num="124" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
131
|
-
<line num="125" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
132
|
-
<line num="126" count="1" type="stmt"/>
|
|
133
|
-
</file>
|
|
134
|
-
</project>
|
|
135
|
-
</coverage>
|