een-api-toolkit 0.1.13 → 0.2.0

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.
@@ -9,7 +9,7 @@
9
9
  "version": "0.0.1",
10
10
  "dependencies": {
11
11
  "een-api-toolkit": "file:../..",
12
- "pinia": "^2.1.7",
12
+ "pinia": "^3.0.4",
13
13
  "vue": "^3.4.0",
14
14
  "vue-router": "^4.2.0"
15
15
  },
@@ -23,21 +23,22 @@
23
23
  }
24
24
  },
25
25
  "../..": {
26
- "version": "0.1.4",
26
+ "version": "0.1.13",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
29
  "@playwright/test": "^1.57.0",
30
- "@types/node": "^22.0.0",
31
- "@typescript-eslint/eslint-plugin": "^6.21.0",
32
- "@typescript-eslint/parser": "^6.21.0",
30
+ "@types/node": "^25.0.3",
31
+ "@typescript-eslint/eslint-plugin": "^8.51.0",
32
+ "@typescript-eslint/parser": "^8.51.0",
33
33
  "@vitejs/plugin-vue": "^6.0.0",
34
- "@vue/tsconfig": "^0.5.0",
34
+ "@vue/tsconfig": "^0.8.1",
35
35
  "dotenv": "^17.2.3",
36
- "eslint": "^8.56.0",
37
- "eslint-plugin-vue": "^9.20.0",
36
+ "eslint": "^9.39.2",
37
+ "eslint-plugin-vue": "^10.6.2",
38
+ "globals": "^17.0.0",
38
39
  "husky": "^9.1.7",
39
40
  "jsdom": "^27.4.0",
40
- "pinia": "^2.1.7",
41
+ "pinia": "^3.0.4",
41
42
  "tsx": "^4.21.0",
42
43
  "typedoc": "^0.28.15",
43
44
  "typedoc-plugin-markdown": "^4.9.0",
@@ -990,6 +991,30 @@
990
991
  "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==",
991
992
  "license": "MIT"
992
993
  },
994
+ "node_modules/@vue/devtools-kit": {
995
+ "version": "7.7.9",
996
+ "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.9.tgz",
997
+ "integrity": "sha512-PyQ6odHSgiDVd4hnTP+aDk2X4gl2HmLDfiyEnn3/oV+ckFDuswRs4IbBT7vacMuGdwY/XemxBoh302ctbsptuA==",
998
+ "license": "MIT",
999
+ "dependencies": {
1000
+ "@vue/devtools-shared": "^7.7.9",
1001
+ "birpc": "^2.3.0",
1002
+ "hookable": "^5.5.3",
1003
+ "mitt": "^3.0.1",
1004
+ "perfect-debounce": "^1.0.0",
1005
+ "speakingurl": "^14.0.1",
1006
+ "superjson": "^2.2.2"
1007
+ }
1008
+ },
1009
+ "node_modules/@vue/devtools-shared": {
1010
+ "version": "7.7.9",
1011
+ "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.9.tgz",
1012
+ "integrity": "sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==",
1013
+ "license": "MIT",
1014
+ "dependencies": {
1015
+ "rfdc": "^1.4.1"
1016
+ }
1017
+ },
993
1018
  "node_modules/@vue/language-core": {
994
1019
  "version": "3.2.1",
995
1020
  "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.2.1.tgz",
@@ -1063,6 +1088,30 @@
1063
1088
  "dev": true,
1064
1089
  "license": "MIT"
1065
1090
  },
1091
+ "node_modules/birpc": {
1092
+ "version": "2.9.0",
1093
+ "resolved": "https://registry.npmjs.org/birpc/-/birpc-2.9.0.tgz",
1094
+ "integrity": "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==",
1095
+ "license": "MIT",
1096
+ "funding": {
1097
+ "url": "https://github.com/sponsors/antfu"
1098
+ }
1099
+ },
1100
+ "node_modules/copy-anything": {
1101
+ "version": "4.0.5",
1102
+ "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-4.0.5.tgz",
1103
+ "integrity": "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==",
1104
+ "license": "MIT",
1105
+ "dependencies": {
1106
+ "is-what": "^5.2.0"
1107
+ },
1108
+ "engines": {
1109
+ "node": ">=18"
1110
+ },
1111
+ "funding": {
1112
+ "url": "https://github.com/sponsors/mesqueeb"
1113
+ }
1114
+ },
1066
1115
  "node_modules/csstype": {
1067
1116
  "version": "3.2.3",
1068
1117
  "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -1179,6 +1228,24 @@
1179
1228
  "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
1180
1229
  }
1181
1230
  },
1231
+ "node_modules/hookable": {
1232
+ "version": "5.5.3",
1233
+ "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
1234
+ "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
1235
+ "license": "MIT"
1236
+ },
1237
+ "node_modules/is-what": {
1238
+ "version": "5.5.0",
1239
+ "resolved": "https://registry.npmjs.org/is-what/-/is-what-5.5.0.tgz",
1240
+ "integrity": "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==",
1241
+ "license": "MIT",
1242
+ "engines": {
1243
+ "node": ">=18"
1244
+ },
1245
+ "funding": {
1246
+ "url": "https://github.com/sponsors/mesqueeb"
1247
+ }
1248
+ },
1182
1249
  "node_modules/magic-string": {
1183
1250
  "version": "0.30.21",
1184
1251
  "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
@@ -1188,6 +1255,12 @@
1188
1255
  "@jridgewell/sourcemap-codec": "^1.5.5"
1189
1256
  }
1190
1257
  },
1258
+ "node_modules/mitt": {
1259
+ "version": "3.0.1",
1260
+ "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
1261
+ "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
1262
+ "license": "MIT"
1263
+ },
1191
1264
  "node_modules/muggle-string": {
1192
1265
  "version": "0.4.1",
1193
1266
  "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz",
@@ -1220,6 +1293,12 @@
1220
1293
  "dev": true,
1221
1294
  "license": "MIT"
1222
1295
  },
1296
+ "node_modules/perfect-debounce": {
1297
+ "version": "1.0.0",
1298
+ "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
1299
+ "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
1300
+ "license": "MIT"
1301
+ },
1223
1302
  "node_modules/picocolors": {
1224
1303
  "version": "1.1.1",
1225
1304
  "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -1240,20 +1319,19 @@
1240
1319
  }
1241
1320
  },
1242
1321
  "node_modules/pinia": {
1243
- "version": "2.3.1",
1244
- "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.3.1.tgz",
1245
- "integrity": "sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==",
1322
+ "version": "3.0.4",
1323
+ "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
1324
+ "integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
1246
1325
  "license": "MIT",
1247
1326
  "dependencies": {
1248
- "@vue/devtools-api": "^6.6.3",
1249
- "vue-demi": "^0.14.10"
1327
+ "@vue/devtools-api": "^7.7.7"
1250
1328
  },
1251
1329
  "funding": {
1252
1330
  "url": "https://github.com/sponsors/posva"
1253
1331
  },
1254
1332
  "peerDependencies": {
1255
- "typescript": ">=4.4.4",
1256
- "vue": "^2.7.0 || ^3.5.11"
1333
+ "typescript": ">=4.5.0",
1334
+ "vue": "^3.5.11"
1257
1335
  },
1258
1336
  "peerDependenciesMeta": {
1259
1337
  "typescript": {
@@ -1261,6 +1339,15 @@
1261
1339
  }
1262
1340
  }
1263
1341
  },
1342
+ "node_modules/pinia/node_modules/@vue/devtools-api": {
1343
+ "version": "7.7.9",
1344
+ "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.9.tgz",
1345
+ "integrity": "sha512-kIE8wvwlcZ6TJTbNeU2HQNtaxLx3a84aotTITUuL/4bzfPxzajGBOoqjMhwZJ8L9qFYDU/lAYMEEm11dnZOD6g==",
1346
+ "license": "MIT",
1347
+ "dependencies": {
1348
+ "@vue/devtools-kit": "^7.7.9"
1349
+ }
1350
+ },
1264
1351
  "node_modules/playwright": {
1265
1352
  "version": "1.57.0",
1266
1353
  "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz",
@@ -1321,6 +1408,12 @@
1321
1408
  "node": "^10 || ^12 || >=14"
1322
1409
  }
1323
1410
  },
1411
+ "node_modules/rfdc": {
1412
+ "version": "1.4.1",
1413
+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
1414
+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
1415
+ "license": "MIT"
1416
+ },
1324
1417
  "node_modules/rollup": {
1325
1418
  "version": "4.54.0",
1326
1419
  "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz",
@@ -1372,6 +1465,27 @@
1372
1465
  "node": ">=0.10.0"
1373
1466
  }
1374
1467
  },
1468
+ "node_modules/speakingurl": {
1469
+ "version": "14.0.1",
1470
+ "resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz",
1471
+ "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==",
1472
+ "license": "BSD-3-Clause",
1473
+ "engines": {
1474
+ "node": ">=0.10.0"
1475
+ }
1476
+ },
1477
+ "node_modules/superjson": {
1478
+ "version": "2.2.6",
1479
+ "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.6.tgz",
1480
+ "integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==",
1481
+ "license": "MIT",
1482
+ "dependencies": {
1483
+ "copy-anything": "^4"
1484
+ },
1485
+ "engines": {
1486
+ "node": ">=16"
1487
+ }
1488
+ },
1375
1489
  "node_modules/tinyglobby": {
1376
1490
  "version": "0.2.15",
1377
1491
  "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
@@ -1521,32 +1635,6 @@
1521
1635
  }
1522
1636
  }
1523
1637
  },
1524
- "node_modules/vue-demi": {
1525
- "version": "0.14.10",
1526
- "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
1527
- "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
1528
- "hasInstallScript": true,
1529
- "license": "MIT",
1530
- "bin": {
1531
- "vue-demi-fix": "bin/vue-demi-fix.js",
1532
- "vue-demi-switch": "bin/vue-demi-switch.js"
1533
- },
1534
- "engines": {
1535
- "node": ">=12"
1536
- },
1537
- "funding": {
1538
- "url": "https://github.com/sponsors/antfu"
1539
- },
1540
- "peerDependencies": {
1541
- "@vue/composition-api": "^1.0.0-rc.1",
1542
- "vue": "^3.0.0-0 || ^2.6.0"
1543
- },
1544
- "peerDependenciesMeta": {
1545
- "@vue/composition-api": {
1546
- "optional": true
1547
- }
1548
- }
1549
- },
1550
1638
  "node_modules/vue-router": {
1551
1639
  "version": "4.6.4",
1552
1640
  "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.6.4.tgz",
@@ -4,7 +4,7 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "stop": "npx kill-port 3333",
7
+ "stop": "lsof -ti :3333 2>/dev/null | xargs -r kill -9 || echo 'Port 3333 is free'",
8
8
  "dev": "npm run stop && vite",
9
9
  "build": "vue-tsc && vite build",
10
10
  "preview": "vite preview",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "een-api-toolkit": "file:../..",
16
- "pinia": "^2.1.7",
16
+ "pinia": "^3.0.4",
17
17
  "vue": "^3.4.0",
18
18
  "vue-router": "^4.2.0"
19
19
  },
@@ -1,18 +1,39 @@
1
1
  import { defineConfig, devices } from '@playwright/test'
2
+ import dotenv from 'dotenv'
3
+ import path from 'path'
4
+ import { fileURLToPath } from 'url'
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
+
8
+ // Load .env files: parent .env first, then local .env overrides parent values
9
+ dotenv.config({ path: path.resolve(__dirname, '../../.env') })
10
+ dotenv.config({ path: path.resolve(__dirname, '.env'), override: true })
11
+
12
+ const redirectUri = process.env.VITE_REDIRECT_URI || 'http://127.0.0.1:3333'
13
+ if (!redirectUri.startsWith('http://127.0.0.1:') && !redirectUri.startsWith('http://localhost:')) {
14
+ throw new Error('VITE_REDIRECT_URI must use localhost or 127.0.0.1 for security')
15
+ }
16
+ const baseURL = redirectUri
17
+
18
+ // Export for use in test files
19
+ export { baseURL }
2
20
 
3
21
  export default defineConfig({
4
22
  testDir: './e2e',
23
+ testMatch: '**/*.spec.ts',
5
24
  fullyParallel: false,
6
25
  forbidOnly: !!process.env.CI,
7
- retries: process.env.CI ? 2 : 0,
26
+ retries: 0,
27
+ maxFailures: 1,
8
28
  workers: 1,
9
- reporter: 'html',
10
- timeout: 60000,
29
+ reporter: [['html', { open: 'never' }]],
30
+ timeout: 30000,
11
31
  use: {
12
- baseURL: 'http://127.0.0.1:3333',
32
+ baseURL,
13
33
  trace: 'on-first-retry',
14
- screenshot: 'only-on-failure'
34
+ video: 'retain-on-failure'
15
35
  },
36
+ outputDir: './e2e-results/',
16
37
  projects: [
17
38
  {
18
39
  name: 'chromium',
@@ -21,8 +42,8 @@ export default defineConfig({
21
42
  ],
22
43
  webServer: {
23
44
  command: 'npm run dev',
24
- url: 'http://127.0.0.1:3333',
45
+ url: baseURL,
25
46
  reuseExistingServer: !process.env.CI,
26
- timeout: 120000
47
+ timeout: 30000
27
48
  }
28
49
  })
@@ -2,15 +2,26 @@
2
2
 
3
3
  A complete example showing how to use the een-api-toolkit in a Vue 3 application.
4
4
 
5
+ ![Users Screenshot](users-screenshot.png)
6
+
5
7
  ## Features Demonstrated
6
8
 
7
9
  - OAuth authentication flow (login, callback, logout)
8
10
  - Protected routes with navigation guards
9
- - useCurrentUser composable for current user profile
10
- - useUsers composable with pagination
11
- - Error handling
11
+ - `getCurrentUser()` function for current user profile
12
+ - `getUsers()` function with pagination
13
+ - Error handling with Result pattern
12
14
  - Reactive authentication state
13
15
 
16
+ ## APIs Used
17
+
18
+ - `getUsers()` - List users with pagination
19
+ - `getCurrentUser()` - Get current user profile
20
+ - `useAuthStore()` - Authentication state management
21
+ - `getAuthUrl()` - Generate OAuth login URL
22
+ - `handleAuthCallback()` - Process OAuth callback
23
+ - `initEenToolkit()` - Toolkit initialization
24
+
14
25
  ## Setup
15
26
 
16
27
  ### Prerequisites
@@ -57,6 +68,8 @@ All commands below should be run from this example directory (`examples/vue-user
57
68
 
58
69
  **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
70
 
71
+ **Note:** Development and testing was done on macOS. The `npm run stop` command uses `lsof`, which is not available on Windows. Windows users should manually stop any process on port 3333 or use `npx kill-port 3333` instead.
72
+
60
73
  ## Project Structure
61
74
 
62
75
  ```
@@ -114,21 +127,51 @@ if (error) {
114
127
  }
115
128
  ```
116
129
 
117
- ### Using Composables (Users.vue)
130
+ ### Fetching Users with Pagination (Users.vue)
131
+
132
+ ```typescript
133
+ import { ref, computed } from 'vue'
134
+ import { getUsers, type User, type ListUsersParams } from 'een-api-toolkit'
135
+
136
+ const users = ref<User[]>([])
137
+ const nextPageToken = ref<string | undefined>(undefined)
138
+ const hasNextPage = computed(() => !!nextPageToken.value)
139
+
140
+ async function fetchUsers(params: ListUsersParams) {
141
+ const result = await getUsers(params)
142
+ if (result.error) {
143
+ // Handle error
144
+ } else {
145
+ users.value = result.data.results
146
+ nextPageToken.value = result.data.nextPageToken
147
+ }
148
+ }
149
+
150
+ async function fetchNextPage() {
151
+ if (!nextPageToken.value) return
152
+ const result = await getUsers({ pageSize: 10, pageToken: nextPageToken.value })
153
+ if (!result.error) {
154
+ users.value = [...users.value, ...result.data.results]
155
+ nextPageToken.value = result.data.nextPageToken
156
+ }
157
+ }
158
+ ```
159
+
160
+ ### Fetching Current User (Home.vue)
118
161
 
119
- ```vue
120
- <script setup>
121
- import { useUsers } from 'een-api-toolkit'
162
+ ```typescript
163
+ import { getCurrentUser, type UserProfile } from 'een-api-toolkit'
122
164
 
123
- const { users, loading, error, hasNextPage, fetchNextPage } = useUsers({ pageSize: 10 })
124
- </script>
165
+ const user = ref<UserProfile | null>(null)
125
166
 
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>
167
+ async function fetchUser() {
168
+ const result = await getCurrentUser()
169
+ if (result.error) {
170
+ // Handle error
171
+ } else {
172
+ user.value = result.data
173
+ }
174
+ }
132
175
  ```
133
176
 
134
177
  ### Auth Guard (router/index.ts)