een-api-toolkit 0.0.8 → 0.0.11

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/CHANGELOG.md CHANGED
@@ -2,222 +2,125 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.0.8] - 2025-12-27
5
+ ## [0.0.11] - 2025-12-27
6
6
 
7
- ### 📋 Release Summary
7
+ ### Release Summary
8
8
 
9
- #### PR #9: Release v0.0.8: Dependency upgrades and release notes enhancement
9
+ #### PR #10: Release v0.0.8: Workflow improvements
10
10
  ## Summary
11
11
 
12
- This release upgrades development dependencies to resolve security vulnerabilities and enhances the release workflow with auto-generated release notes from PR descriptions.
13
-
14
- ### Dependency Upgrades
15
- | Package | From | To |
16
- |---------|------|-----|
17
- | @types/node | ^20.10.0 | ^22.0.0 |
18
- | @vitejs/plugin-vue | ^5.0.0 | ^6.0.0 |
19
- | typescript | ^5.3.0 | ~5.8.0 |
20
- | vite | ^5.0.0 | ^7.3.0 |
21
- | vite-plugin-dts | ^3.7.0 | ^4.5.4 |
22
- | vitest | ^1.2.0 | ^4.0.16 |
23
- | vue-tsc | ^1.8.0 | ^3.2.1 |
24
-
25
- ### Build Warning Fixes
26
- - Reorder package.json exports (`types` before `import`/`require`)
27
- - Pin TypeScript to ~5.8.0 for API Extractor compatibility
28
- - Suppress dynamic/static import warning (not applicable to single-file library)
29
- - Make lazy-loader concurrency-safe by caching promise
30
-
31
- ### Release Notes Enhancement
32
- - Auto-generate release summary from merged PR descriptions
33
- - Include `RELEASE-NOTES-vX.X.X.md` as GitHub release asset
34
- - Add direct link to release notes in Slack success notification
35
-
36
- ## Test plan
37
- - [x] Unit tests pass (7/7)
38
- - [x] Lint passes (0 errors)
39
- - [x] TypeScript type checking passes
40
- - [x] Build succeeds with no warnings
41
- - [x] Package verification passes
42
-
43
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
44
-
45
- #### PR #7: Release v0.0.6
46
- ## Summary
47
- Release v0.0.6 with workflow reliability improvements.
48
-
49
- ## Changes
50
-
51
- ### Version
52
- - Bump: 0.0.5 → 0.0.6
12
+ This release improves the CI/CD workflow by splitting testing and publishing into separate stages, and fixes release notes to only include changes since the last release.
53
13
 
54
14
  ### Workflow Improvements
55
- - Add version check to skip publish if version already exists on npm
56
- - Skip GitHub Release and Slack notification if already published
57
- - Add repository link to success Slack notification
58
- - Enhance failure Slack notification with:
59
- - Repository link
60
- - Direct link to failed workflow run
15
+ - **Split workflows**: Separated testing (`test-release.yml`) from publishing (`npm-publish.yml`)
16
+ - Test workflow runs lint, typecheck, tests, and package verification
17
+ - Publish workflow triggers only after tests pass
18
+ - **Release notes fix**: Now only includes PRs merged in the current release (not all historical PRs)
61
19
 
62
- ## Why
63
- PR #6 merge triggered the publish workflow, but version 0.0.5 was already published, causing failure. The new version check prevents this.
20
+ ## Test plan
21
+ - [x] Workflow files have valid YAML syntax
22
+ - [x] Test workflow triggers on PR merge to production
23
+ - [x] Publish workflow triggers on test success via `workflow_run`
24
+ - [x] Both workflows support manual dispatch
64
25
 
65
26
  🤖 Generated with [Claude Code](https://claude.com/claude-code)
66
27
 
67
- #### PR #6: feat: Enhanced release notifications and GitHub Releases
28
+ #### PR #11: Release v0.0.8: Vue-basic example improvements and e2e tests
68
29
  ## Summary
69
- - Add GitHub Release creation alongside npm publish
70
- - Enhance Slack notifications with more details and links
71
30
 
72
- ## Changes
73
-
74
- ### GitHub Release (`npm-publish.yml`)
75
- - Creates GitHub Release with version tag (e.g., `v0.0.6`)
76
- - Attaches npm tarball to the release
77
- - Generates release notes with:
78
- - Installation command
79
- - Package details (npm link, version, size, release time in CST)
80
- - Links to npm, documentation, and changelog
31
+ - Update vue-basic example dependencies to match main package (fix vulnerabilities)
32
+ - Improve example README with clearer setup instructions and proxy link
33
+ - Add stop script to kill port 3333 before starting dev server
34
+ - Include examples folder in npm package releases
35
+ - Add Playwright e2e tests for vue-basic example (7 test cases)
36
+ - Add example e2e tests to test-release workflow
81
37
 
82
- ### Enhanced Slack Notification
83
- - Clickable link to npm package
84
- - Clickable link to GitHub Release
85
- - Package size
86
- - Release timestamp in America/Chicago timezone
38
+ ## Commits
87
39
 
88
- ### Documentation
89
- - Updated CLAUDE.md to document GitHub Release functionality
40
+ - `0ee7e87` fix: Update vue-basic example dependencies and docs
41
+ - `de16d82` feat: Add stop script to vue-basic example
42
+ - `c3bbf6f` feat: Include examples in npm package
43
+ - `d2a3d25` feat: Add Playwright e2e tests for vue-basic example
90
44
 
91
45
  ## Test plan
92
- - [ ] Merge PR and verify GitHub Release is created
93
- - [ ] Verify Slack notification includes all new fields
94
- - [ ] Verify release notes are properly formatted
46
+
47
+ - [ ] Verify test-release workflow runs example e2e tests
48
+ - [ ] Verify npm package includes examples folder
49
+ - [ ] Verify example app runs correctly with `npm run dev`
95
50
 
96
51
  🤖 Generated with [Claude Code](https://claude.com/claude-code)
97
52
 
98
- #### PR #5: ci: Add npm publish workflow
53
+ #### PR #12: Release v0.0.11: Authenticated e2e tests and versioning improvements
99
54
  ## Summary
100
- - Add automated npm publish workflow triggered when PRs merge to production
101
- - Include manual trigger option with dry run mode for testing
102
- - Slack notifications for publish success/failure
55
+ - Add authenticated e2e tests for vue-basic example that perform actual OAuth login through the UI
56
+ - Fix version bump trigger to include examples/ and .github/workflows/ changes
57
+ - Implement independent versioning for example app (separate from main package)
103
58
 
104
59
  ## Changes
105
- - New `.github/workflows/npm-publish.yml` workflow
60
+ - **examples/vue-basic/e2e/auth.spec.ts**: 3 new authenticated test cases using real OAuth login flow
61
+ - **.husky/pre-commit**: Separate version bumps for main package vs example
62
+ - **.github/workflows/test-release.yml**: Pass auth secrets to example e2e tests
63
+ - **examples/vue-basic/playwright.config.ts**: dotenv loading for local development
106
64
 
107
65
  ## Test plan
108
- - [ ] Verify workflow syntax is valid
109
- - [ ] After merge, manually trigger with dry_run=true to test
110
- - [ ] Manually trigger without dry_run to publish v0.0.5 to npm
66
+ - [ ] Verify unauthenticated e2e tests pass
67
+ - [ ] Verify authenticated e2e tests pass (require TEST_USER/TEST_PASSWORD secrets)
68
+ - [ ] Verify tests skip gracefully when credentials not available
69
+ - [ ] Verify version bumping works for both main package and example changes
111
70
 
112
71
  🤖 Generated with [Claude Code](https://claude.com/claude-code)
113
72
 
114
- #### PR #4: Release v0.0.5: Documentation system and example app
73
+ #### PR #13: Release v0.0.12: Fix e2e test failures and improve test configuration
115
74
  ## Summary
116
-
117
- - Add comprehensive documentation system with TypeDoc and AI-CONTEXT.md
118
- - Create complete Vue 3 example application
119
- - Add disclaimer to README
75
+ - Fix e2e test failures caused by Home.vue login button not triggering OAuth redirect
76
+ - Consolidate test suites and remove Authenticated/Unauthenticated naming distinction
77
+ - Add fail-fast configuration to stop tests on first failure
78
+ - Rename npm-publish workflow to "Publish Release"
120
79
 
121
80
  ## Changes
122
-
123
- ### Documentation System
124
- - **TypeDoc integration** - Auto-generates API docs from JSDoc comments
125
- - **AI-CONTEXT.md** - Single-file comprehensive reference for AI assistants (~700 lines)
126
- - **Enhanced JSDoc** - All exports documented with examples, @param, @returns, @category
127
- - **npm scripts** - `docs`, `docs:api`, `docs:ai-context`
128
-
129
- ### Example Application
130
- - Complete Vue 3 app in `examples/vue-basic/`
131
- - OAuth flow (login, callback, logout)
132
- - User list with pagination using composables
133
- - Auth guards for protected routes
134
- - Configured for EEN IDP requirement (http://127.0.0.1:3333)
135
-
136
- ### README Updates
137
- - Added disclaimer (no warranty, not associated with EEN)
138
- - Added Documentation section with links
139
-
140
- ## New Exports
141
- - `getRedirectUri()` - Config function for OAuth redirect URI
142
- - `TokenResponse` - Type for OAuth token response
143
- - `UseCurrentUserOptions`, `UseUsersOptions`, `UseUserOptions` - Composable option types
81
+ - **examples/vue-basic/src/views/Home.vue**: Login button now calls `getAuthUrl()` directly instead of routing to /login
82
+ - **examples/vue-basic/e2e/auth.spec.ts**: Consolidated tests, added proxy accessibility check, tests skip when proxy unavailable
83
+ - **examples/vue-basic/e2e/app.spec.ts**: Renamed suite from "Unauthenticated" to "App"
84
+ - **examples/vue-basic/playwright.config.ts**: Added `maxFailures: 1`, disabled retries, sequential test execution
85
+ - **.github/workflows/npm-publish.yml**: Renamed workflow to "Publish Release"
144
86
 
145
87
  ## Test plan
146
- - [x] `npm run build` passes
147
- - [x] `npm run lint` passes
148
- - [x] `npm run docs` generates successfully
149
- - [ ] Code review passes
88
+ - [x] All 14 e2e tests pass locally with proxy on port 8787
89
+ - [x] Lint passes
90
+ - [x] TypeScript type check passes
91
+ - [x] Build succeeds
150
92
 
151
93
  🤖 Generated with [Claude Code](https://claude.com/claude-code)
152
94
 
153
- #### PR #3: Release v0.0.2: E2E tests and security documentation
154
- ## Summary
155
-
156
- This PR adds comprehensive E2E testing infrastructure and security documentation to the toolkit.
157
-
158
- ### Changes
159
-
160
- **E2E Testing with Playwright**
161
- - Added `auth-helper.ts` for OAuth login with token caching
162
- - Added `auth.spec.ts` to validate auth helper functionality
163
- - Added `users.spec.ts` with 5 tests for Users API endpoints
164
- - Configured Playwright for Chromium-only testing with single worker
165
- - Added `test:e2e` and `test:e2e:ui` npm scripts
166
-
167
- **Documentation**
168
- - Added security model section to CLAUDE.md (refresh token isolation)
169
- - Added security/robustness priorities statement
170
-
171
- **Bug Fixes**
172
- - Excluded e2e folder from Vitest to prevent test conflicts
173
-
174
- ### Test Results
175
- - Unit tests: 7 passed
176
- - E2E tests: 6 passed (auth helper + 5 Users API tests)
177
- - Lint: 1 warning (intentional console in debug.ts)
178
- - Build: Success
179
-
180
- ### Version
181
- `0.0.2`
182
-
183
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
184
-
185
- #### PR #2: Initial project setup and planning documentation
186
- ## Summary
187
-
188
- - Add comprehensive project planning documentation (CLAUDE.md, README.md)
189
- - Set up development tooling (scripts, skills, .env configuration)
190
- - Configure local proxy URL for development
191
- - Add GitHub secrets sync script
192
-
193
- ## Changes
194
-
195
- ### Documentation
196
- - **CLAUDE.md**: Technical guidance for Claude Code including architecture, patterns, API specs, workflows
197
- - **README.md**: Developer usage documentation with examples, setup instructions, configuration
198
-
199
- ### Configuration
200
- - **.env.example**: Environment variable template
201
- - **scripts/sync-secrets.sh**: Sync .env to GitHub repository secrets
202
-
203
- ### Skills
204
- - **.claude/skills/PR-and-check/**: PR workflow skill for feature branches
205
-
206
- ## Test Plan
207
- - [ ] Review documentation for accuracy
208
- - [ ] Verify sync-secrets.sh works with `--dry-run`
209
95
 
210
- 🤖 Generated with [Claude Code](https://claude.ai/code)
96
+ ### Detailed Changes
211
97
 
98
+ #### Features
99
+ - feat: Add authenticated e2e tests for example app
100
+ - feat: Add Playwright e2e tests for vue-basic example
101
+ - feat: Include examples in npm package
102
+ - feat: Add stop script to vue-basic example
212
103
 
213
- ### 📝 Detailed Changes
104
+ #### Bug Fixes
105
+ - fix: Handle localStorage access errors in clearAuthState
106
+ - fix: Address code review feedback for PR #13
107
+ - fix: Fix e2e test failures and improve test configuration
108
+ - fix: Address remaining code review concerns from PR #12
109
+ - fix: Address code review concerns from PR #12
110
+ - fix: Separate version bumps for main package and example
111
+ - fix: Include examples and workflows in version bump trigger
112
+ - fix: Address HIGH/MEDIUM review issues from PR #11
113
+ - fix: Address PR #11 review feedback
114
+ - fix: Update vue-basic example dependencies and docs
115
+ - fix: Address PR #10 review feedback
116
+ - fix: Limit release notes to changes since last release
214
117
 
215
- #### 📦 Other Changes
216
- - Merge pull request #9 from klaushofrichter/develop
118
+ #### Other Changes
119
+ - refactor: Split publish workflow into test and publish stages
217
120
 
218
121
  ### Links
219
122
  - [npm package](https://www.npmjs.com/package/een-api-toolkit)
220
- - [Full Changelog](https://github.com/klaushofrichter/een-api-toolkit/commits/v0.0.8)
123
+ - [Full Changelog](https://github.com/klaushofrichter/een-api-toolkit/compare/v0.0.8...v0.0.11)
221
124
 
222
125
  ---
223
- *Released: 2025-12-27 10:23:46 CST*
126
+ *Released: 2025-12-27 18:40:49 CST*
@@ -0,0 +1,12 @@
1
+ # EEN OAuth Client ID (required)
2
+ VITE_EEN_CLIENT_ID=your-een-client-id
3
+
4
+ # OAuth Proxy URL (required)
5
+ VITE_PROXY_URL=http://localhost:8787
6
+
7
+ # OAuth Redirect URI (MUST be http://127.0.0.1:3333 - EEN IDP requirement)
8
+ # Do not change this value - the EEN Identity Provider only permits this URL
9
+ VITE_REDIRECT_URI=http://127.0.0.1:3333
10
+
11
+ # Enable debug logging (optional)
12
+ VITE_DEBUG=true
@@ -0,0 +1,146 @@
1
+ # EEN API Toolkit - Vue 3 Example
2
+
3
+ A complete example showing how to use the een-api-toolkit in a Vue 3 application.
4
+
5
+ ## Features Demonstrated
6
+
7
+ - OAuth authentication flow (login, callback, logout)
8
+ - Protected routes with navigation guards
9
+ - useCurrentUser composable for current user profile
10
+ - useUsers composable with pagination
11
+ - Error handling
12
+ - Reactive authentication state
13
+
14
+ ## Setup
15
+
16
+ ### Prerequisites
17
+
18
+ 1. **Start the OAuth proxy** (required for authentication):
19
+
20
+ The OAuth proxy is a separate project that handles token management securely.
21
+ Clone and run it from: https://github.com/klaushofrichter/een-oauth-proxy
22
+
23
+ ```bash
24
+ # In a separate terminal, from the een-oauth-proxy directory
25
+ npm install
26
+ npm run dev
27
+ ```
28
+
29
+ The proxy should be running at `http://localhost:8787`.
30
+
31
+ ### Example Setup
32
+
33
+ All commands below should be run from this example directory (`examples/vue-basic/`):
34
+
35
+ 2. Copy the environment file:
36
+ ```bash
37
+ # From examples/vue-basic/
38
+ cp .env.example .env
39
+ ```
40
+
41
+ 3. Edit `.env` with your EEN credentials:
42
+ ```env
43
+ VITE_EEN_CLIENT_ID=your-client-id
44
+ VITE_PROXY_URL=http://localhost:8787
45
+ # DO NOT change the redirect URI - EEN IDP only permits this URL
46
+ VITE_REDIRECT_URI=http://127.0.0.1:3333
47
+ ```
48
+
49
+ 4. Install dependencies and start:
50
+ ```bash
51
+ # From examples/vue-basic/
52
+ npm install
53
+ npm run dev
54
+ ```
55
+
56
+ 5. Open http://127.0.0.1:3333 in your browser.
57
+
58
+ **Important:** The EEN Identity Provider only permits `http://127.0.0.1:3333` as the OAuth redirect URI. Do not use `localhost` or other ports.
59
+
60
+ ## Project Structure
61
+
62
+ ```
63
+ src/
64
+ ├── main.ts # App entry, toolkit initialization
65
+ ├── App.vue # Root component with navigation
66
+ ├── router/
67
+ │ └── index.ts # Vue Router with auth guards
68
+ └── views/
69
+ ├── Home.vue # Home page with user profile
70
+ ├── Login.vue # OAuth login redirect
71
+ ├── Callback.vue # OAuth callback handler
72
+ ├── Users.vue # User list with pagination
73
+ └── Logout.vue # Logout handler
74
+ ```
75
+
76
+ ## Key Code Examples
77
+
78
+ ### Initializing the Toolkit (main.ts)
79
+
80
+ ```typescript
81
+ import { initEenToolkit } from 'een-api-toolkit'
82
+
83
+ initEenToolkit({
84
+ proxyUrl: import.meta.env.VITE_PROXY_URL,
85
+ clientId: import.meta.env.VITE_EEN_CLIENT_ID,
86
+ debug: true
87
+ })
88
+ ```
89
+
90
+ ### OAuth Login (Login.vue)
91
+
92
+ ```typescript
93
+ import { getAuthUrl } from 'een-api-toolkit'
94
+
95
+ function login() {
96
+ window.location.href = getAuthUrl()
97
+ }
98
+ ```
99
+
100
+ ### OAuth Callback (Callback.vue)
101
+
102
+ ```typescript
103
+ import { handleAuthCallback } from 'een-api-toolkit'
104
+
105
+ const url = new URL(window.location.href)
106
+ const code = url.searchParams.get('code')
107
+ const state = url.searchParams.get('state')
108
+
109
+ const { error } = await handleAuthCallback(code, state)
110
+ if (error) {
111
+ // Handle error
112
+ } else {
113
+ router.push('/dashboard')
114
+ }
115
+ ```
116
+
117
+ ### Using Composables (Users.vue)
118
+
119
+ ```vue
120
+ <script setup>
121
+ import { useUsers } from 'een-api-toolkit'
122
+
123
+ const { users, loading, error, hasNextPage, fetchNextPage } = useUsers({ pageSize: 10 })
124
+ </script>
125
+
126
+ <template>
127
+ <ul v-for="user in users" :key="user.id">
128
+ <li>{{ user.email }}</li>
129
+ </ul>
130
+ <button v-if="hasNextPage" @click="fetchNextPage">Load More</button>
131
+ </template>
132
+ ```
133
+
134
+ ### Auth Guard (router/index.ts)
135
+
136
+ ```typescript
137
+ router.beforeEach((to, from, next) => {
138
+ const authStore = useAuthStore()
139
+
140
+ if (to.meta.requiresAuth && !authStore.isAuthenticated) {
141
+ next('/login')
142
+ } else {
143
+ next()
144
+ }
145
+ })
146
+ ```
@@ -0,0 +1,61 @@
1
+ import { test, expect } from '@playwright/test'
2
+
3
+ test.describe('Vue Basic Example - App', () => {
4
+ test.beforeEach(async ({ page }) => {
5
+ await page.goto('/')
6
+ })
7
+
8
+ test('app loads with correct title', async ({ page }) => {
9
+ await expect(page).toHaveTitle(/EEN API Toolkit/)
10
+ })
11
+
12
+ test('header displays app name', async ({ page }) => {
13
+ await expect(page.locator('[data-testid="app-title"]')).toHaveText('EEN API Toolkit Example')
14
+ })
15
+
16
+ test('navigation shows Home and Login links when not authenticated', async ({ page }) => {
17
+ // Home link should be visible
18
+ await expect(page.locator('[data-testid="nav-home"]')).toBeVisible()
19
+
20
+ // Login link should be visible (not authenticated)
21
+ await expect(page.locator('[data-testid="nav-login"]')).toBeVisible()
22
+
23
+ // Users and Logout should NOT be visible (requires auth)
24
+ await expect(page.locator('[data-testid="nav-users"]')).not.toBeVisible()
25
+ await expect(page.locator('[data-testid="nav-logout"]')).not.toBeVisible()
26
+ })
27
+
28
+ test('home page shows not logged in message', async ({ page }) => {
29
+ await expect(page.locator('[data-testid="not-authenticated"]')).toBeVisible()
30
+ await expect(page.locator('[data-testid="not-authenticated-message"]')).toBeVisible()
31
+ await expect(page.locator('[data-testid="login-button"]')).toBeVisible()
32
+ })
33
+
34
+ test('login page displays login button', async ({ page }) => {
35
+ await page.goto('/login')
36
+
37
+ await expect(page.locator('[data-testid="login-title"]')).toHaveText('Login')
38
+ await expect(page.locator('[data-testid="login-button"]')).toBeVisible()
39
+ })
40
+
41
+ test('protected route redirects to login', async ({ page }) => {
42
+ await page.goto('/users')
43
+
44
+ // Should be redirected to login page
45
+ await page.waitForURL('/login')
46
+ await expect(page).toHaveURL('/login')
47
+ await expect(page.locator('[data-testid="login-title"]')).toHaveText('Login')
48
+ })
49
+
50
+ test('navigation between pages works', async ({ page }) => {
51
+ // Click Login link
52
+ await page.click('[data-testid="nav-login"]')
53
+ await page.waitForURL('/login')
54
+ await expect(page).toHaveURL('/login')
55
+
56
+ // Click Home link
57
+ await page.click('[data-testid="nav-home"]')
58
+ await page.waitForURL('/')
59
+ await expect(page).toHaveURL('/')
60
+ })
61
+ })