@flink-app/oauth-plugin 0.14.1 → 2.0.0-alpha.100

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
@@ -1,11 +1,398 @@
1
1
  # @flink-app/oauth-plugin
2
2
 
3
+ ## 2.0.0-alpha.100
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6e8166a]
8
+ - @flink-app/flink@2.0.0-alpha.100
9
+
10
+ ## 2.0.0-alpha.99
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [ed9cd2c]
15
+ - @flink-app/flink@2.0.0-alpha.99
16
+
17
+ ## 2.0.0-alpha.98
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [2f4a132]
22
+ - @flink-app/flink@2.0.0-alpha.98
23
+
24
+ ## 2.0.0-alpha.97
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [eed6bc1]
29
+ - @flink-app/flink@2.0.0-alpha.97
30
+
31
+ ## 2.0.0-alpha.96
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+ - @flink-app/flink@2.0.0-alpha.96
37
+
38
+ ## 2.0.0-alpha.95
39
+
40
+ ### Patch Changes
41
+
42
+ - @flink-app/flink@2.0.0-alpha.95
43
+
44
+ ## 2.0.0-alpha.94
45
+
46
+ ### Patch Changes
47
+
48
+ - @flink-app/flink@2.0.0-alpha.94
49
+
50
+ ## 2.0.0-alpha.93
51
+
52
+ ### Patch Changes
53
+
54
+ - @flink-app/flink@2.0.0-alpha.93
55
+
56
+ ## 2.0.0-alpha.92
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [8d23d56]
61
+ - @flink-app/flink@2.0.0-alpha.92
62
+
63
+ ## 2.0.0-alpha.91
64
+
65
+ ### Patch Changes
66
+
67
+ - @flink-app/flink@2.0.0-alpha.91
68
+
69
+ ## 2.0.0-alpha.90
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [0d84b5f]
74
+ - @flink-app/flink@2.0.0-alpha.90
75
+
76
+ ## 2.0.0-alpha.89
77
+
78
+ ### Patch Changes
79
+
80
+ - @flink-app/flink@2.0.0-alpha.89
81
+
82
+ ## 2.0.0-alpha.88
83
+
84
+ ### Patch Changes
85
+
86
+ - @flink-app/flink@2.0.0-alpha.88
87
+
88
+ ## 2.0.0-alpha.87
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies
93
+ - @flink-app/flink@2.0.0-alpha.87
94
+
95
+ ## 2.0.0-alpha.86
96
+
97
+ ### Patch Changes
98
+
99
+ - @flink-app/flink@2.0.0-alpha.86
100
+
101
+ ## 2.0.0-alpha.85
102
+
103
+ ### Patch Changes
104
+
105
+ - @flink-app/flink@2.0.0-alpha.85
106
+
107
+ ## 2.0.0-alpha.84
108
+
109
+ ### Patch Changes
110
+
111
+ - @flink-app/flink@2.0.0-alpha.84
112
+
113
+ ## 2.0.0-alpha.83
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies
118
+ - @flink-app/flink@2.0.0-alpha.83
119
+
120
+ ## 2.0.0-alpha.82
121
+
122
+ ### Patch Changes
123
+
124
+ - @flink-app/flink@2.0.0-alpha.82
125
+
126
+ ## 2.0.0-alpha.81
127
+
128
+ ### Patch Changes
129
+
130
+ - @flink-app/flink@2.0.0-alpha.81
131
+
132
+ ## 2.0.0-alpha.80
133
+
134
+ ### Patch Changes
135
+
136
+ - @flink-app/flink@2.0.0-alpha.80
137
+
138
+ ## 2.0.0-alpha.79
139
+
140
+ ### Patch Changes
141
+
142
+ - @flink-app/flink@2.0.0-alpha.79
143
+
144
+ ## 2.0.0-alpha.78
145
+
146
+ ### Patch Changes
147
+
148
+ - @flink-app/flink@2.0.0-alpha.78
149
+
150
+ ## 2.0.0-alpha.77
151
+
152
+ ### Patch Changes
153
+
154
+ - @flink-app/flink@2.0.0-alpha.77
155
+
156
+ ## 2.0.0-alpha.76
157
+
158
+ ### Patch Changes
159
+
160
+ - @flink-app/flink@2.0.0-alpha.76
161
+
162
+ ## 2.0.0-alpha.75
163
+
164
+ ### Patch Changes
165
+
166
+ - @flink-app/flink@2.0.0-alpha.75
167
+
168
+ ## 2.0.0-alpha.74
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies
173
+ - Updated dependencies
174
+ - @flink-app/flink@2.0.0-alpha.74
175
+
176
+ ## 2.0.0-alpha.73
177
+
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies
181
+ - @flink-app/flink@2.0.0-alpha.73
182
+
183
+ ## 2.0.0-alpha.72
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies
188
+ - @flink-app/flink@2.0.0-alpha.72
189
+
190
+ ## 2.0.0-alpha.71
191
+
192
+ ### Patch Changes
193
+
194
+ - @flink-app/flink@2.0.0-alpha.71
195
+
196
+ ## 2.0.0-alpha.70
197
+
198
+ ### Patch Changes
199
+
200
+ - @flink-app/flink@2.0.0-alpha.70
201
+
202
+ ## 2.0.0-alpha.69
203
+
204
+ ### Patch Changes
205
+
206
+ - @flink-app/flink@2.0.0-alpha.69
207
+
208
+ ## 2.0.0-alpha.68
209
+
210
+ ### Patch Changes
211
+
212
+ - @flink-app/flink@2.0.0-alpha.68
213
+
214
+ ## 2.0.0-alpha.67
215
+
216
+ ### Patch Changes
217
+
218
+ - Updated dependencies [418cb54]
219
+ - Updated dependencies [70d574c]
220
+ - @flink-app/flink@2.0.0-alpha.67
221
+
222
+ ## 2.0.0-alpha.66
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [5593d26]
227
+ - @flink-app/flink@2.0.0-alpha.66
228
+
229
+ ## 2.0.0-alpha.65
230
+
231
+ ### Patch Changes
232
+
233
+ - @flink-app/flink@2.0.0-alpha.65
234
+
235
+ ## 2.0.0-alpha.64
236
+
237
+ ### Patch Changes
238
+
239
+ - Updated dependencies [95b99ee]
240
+ - @flink-app/flink@2.0.0-alpha.64
241
+
242
+ ## 2.0.0-alpha.63
243
+
244
+ ### Patch Changes
245
+
246
+ - Updated dependencies [810df2c]
247
+ - Updated dependencies [8dd0752]
248
+ - @flink-app/flink@2.0.0-alpha.63
249
+
250
+ ## 2.0.0-alpha.62
251
+
252
+ ### Patch Changes
253
+
254
+ - Updated dependencies
255
+ - @flink-app/flink@2.0.0-alpha.62
256
+
257
+ ## 2.0.0-alpha.61
258
+
259
+ ### Patch Changes
260
+
261
+ - @flink-app/flink@2.0.0-alpha.61
262
+
263
+ ## 2.0.0-alpha.60
264
+
265
+ ### Patch Changes
266
+
267
+ - @flink-app/flink@2.0.0-alpha.60
268
+
269
+ ## 2.0.0-alpha.59
270
+
271
+ ### Patch Changes
272
+
273
+ - Updated dependencies [dbc2119]
274
+ - @flink-app/flink@2.0.0-alpha.59
275
+
276
+ ## 2.0.0-alpha.58
277
+
278
+ ### Patch Changes
279
+
280
+ - Updated dependencies
281
+ - @flink-app/flink@2.0.0-alpha.58
282
+
283
+ ## 2.0.0-alpha.57
284
+
285
+ ### Patch Changes
286
+
287
+ - Updated dependencies [ef7f495]
288
+ - Updated dependencies [2d53aa4]
289
+ - Updated dependencies [b3cc5d1]
290
+ - Updated dependencies [d377fac]
291
+ - Updated dependencies [4ad44c0]
292
+ - Updated dependencies [90f80c7]
293
+ - Updated dependencies [f0887e7]
294
+ - Updated dependencies [68c46d3]
295
+ - Updated dependencies [4ad44c0]
296
+ - Updated dependencies
297
+ - @flink-app/flink@2.0.0-alpha.57
298
+
299
+ ## 2.0.0-alpha.56
300
+
301
+ ### Patch Changes
302
+
303
+ - Zod 3.x compat
304
+ - Updated dependencies
305
+ - Updated dependencies [0203256]
306
+ - @flink-app/flink@2.0.0-alpha.56
307
+
308
+ ## 2.0.0-alpha.55
309
+
310
+ ### Patch Changes
311
+
312
+ - Updated dependencies [3267206]
313
+ - Updated dependencies [497b7c2]
314
+ - Updated dependencies [3267206]
315
+ - @flink-app/flink@2.0.0-alpha.55
316
+
317
+ ## 2.0.0-alpha.53
318
+
319
+ ### Patch Changes
320
+
321
+ - Updated dependencies [669c806]
322
+ - @flink-app/flink@2.0.0-alpha.53
323
+
324
+ ## 2.0.0-alpha.52
325
+
326
+ ### Patch Changes
327
+
328
+ - Updated dependencies [fe9f8f2]
329
+ - @flink-app/flink@2.0.0-alpha.52
330
+
331
+ ## 2.0.0-alpha.51
332
+
333
+ ### Patch Changes
334
+
335
+ - fix: add peerDependencies to all plugins and adapters
336
+
337
+ **Breaking Change Prevention:**
338
+
339
+ - Added "@flink-app/flink": ">=2.0.0-alpha.0" as peerDependency to all plugins
340
+ - Fixed oidc-plugin peerDependencies from "workspace:\*" to proper version ranges
341
+ - Fixed oauth-plugin to include @flink-app/flink peerDependency
342
+
343
+ **JWT Auth Plugin Interface Fix:**
344
+
345
+ - Removed redundant createToken declaration from JwtAuthPlugin interface
346
+ - The method is already inherited from FlinkAuthPlugin, this fixes TypeScript type checking issues
347
+
348
+ **Why this matters:**
349
+
350
+ - Ensures only one version of @flink-app/flink exists in node_modules
351
+ - Prevents type conflicts when TypeScript resolves interfaces across packages
352
+ - Follows standard plugin architecture best practices (same pattern as React, Webpack, etc.)
353
+ - Package managers now warn if incompatible versions are installed
354
+ - @flink-app/flink@2.0.0-alpha.51
355
+
356
+ ## 2.0.0-alpha.50
357
+
358
+ ## 2.0.0-alpha.49
359
+
360
+ ### Patch Changes
361
+
362
+ - Typescript include fix
363
+
364
+ ## 2.0.0-alpha.48
365
+
366
+ ## 1.0.0
367
+
368
+ ### Minor Changes
369
+
370
+ - Align minor version, from now all packages in monorepo will have same version
371
+
372
+ ### Patch Changes
373
+
374
+ - ee21c29: Normalize query parameters to predictable string types
375
+
376
+ Query parameters are now automatically normalized to `string | string[]` types before reaching handlers:
377
+
378
+ - Single values: converted to strings (e.g., `?page=1` → `{ page: "1" }`)
379
+ - Repeated parameters: converted to string arrays (e.g., `?tag=a&tag=b` → `{ tag: ["a", "b"] }`)
380
+ - All types (numbers, booleans, etc.) from Express parser are converted to strings
381
+
382
+ **Breaking Change (Minor):**
383
+
384
+ - `Query` type changed from `{ [x: string]: string | string[] | undefined }` to `Record<string, string | string[]>`
385
+ - `Params` type changed from `Request["params"]` to explicit `Record<string, string>`
386
+ - Removed `undefined` from query/param types since normalization ensures values are never undefined
387
+ - Updated OAuth and OIDC plugin query type definitions to satisfy new Query constraint
388
+
389
+ This ensures predictable query and path parameter handling regardless of Express parser configuration. Handlers can reliably parse string values as needed using `Number()`, `parseInt()`, boolean comparisons, etc.
3
390
 
4
391
  ## 0.14.1
5
392
 
6
393
  ### Patch Changes
7
394
 
8
- - fix: restore compatibility between core framework and plugins after 0.14.0 release
395
+ - fix: restore compatibility between core framework and plugins after 0.14.0 release
9
396
 
10
397
  ## 0.13.1
11
398
 
package/README.md CHANGED
@@ -107,7 +107,7 @@ const app = new FlinkApp<Context>({
107
107
  });
108
108
  } else {
109
109
  // Link provider to existing user
110
- await ctx.repos.userRepo.updateOne(user._id, {
110
+ await ctx.repos.userRepo.updateById(user._id, {
111
111
  oauthProviders: [...user.oauthProviders, { provider, providerId: profile.id }],
112
112
  });
113
113
  }
@@ -664,7 +664,7 @@ onAuthSuccess: async ({ profile, provider }, ctx) => {
664
664
  const isAlreadyLinked = existingProviders.some((p) => p.provider === provider && p.providerId === profile.id);
665
665
 
666
666
  if (!isAlreadyLinked) {
667
- await ctx.repos.userRepo.updateOne(user._id, {
667
+ await ctx.repos.userRepo.updateById(user._id, {
668
668
  oauthProviders: [...existingProviders, { provider, providerId: profile.id }],
669
669
  });
670
670
  }
@@ -142,7 +142,7 @@ const CallbackOAuth = async ({ ctx, req }) => {
142
142
  // Create or update OAuth connection
143
143
  const existingConnection = await ctx.repos.oauthConnectionRepo.findByUserAndProvider(user._id, provider);
144
144
  if (existingConnection) {
145
- await ctx.repos.oauthConnectionRepo.updateOne(existingConnection._id, {
145
+ await ctx.repos.oauthConnectionRepo.updateById(existingConnection._id, {
146
146
  accessToken: encryptedAccessToken,
147
147
  refreshToken: encryptedRefreshToken,
148
148
  scope: tokens.scope || "",
@@ -1,15 +1,18 @@
1
1
  /**
2
2
  * Query parameters for OAuth callback request
3
+ *
4
+ * Note: All query parameters are normalized to strings or string arrays by Flink.
5
+ * Providers may send additional query parameters beyond those listed here.
3
6
  */
4
- export default interface CallbackRequest {
7
+ type CallbackRequest = Record<string, string | string[]> & {
5
8
  /**
6
9
  * Authorization code from OAuth provider
7
10
  */
8
- code: string;
11
+ code?: string;
9
12
  /**
10
13
  * CSRF protection state parameter
11
14
  */
12
- state: string;
15
+ state?: string;
13
16
  /**
14
17
  * Optional error from OAuth provider
15
18
  * Common values: access_denied, invalid_request, unauthorized_client, etc.
@@ -26,7 +29,7 @@ export default interface CallbackRequest {
26
29
  /**
27
30
  * Response type - 'json' returns JSON instead of redirect
28
31
  */
29
- response_type?: "json";
32
+ response_type?: "json" | string;
30
33
  /**
31
34
  * Granted scopes (provider-specific)
32
35
  * May be sent by GitHub, Google, and other providers
@@ -49,5 +52,5 @@ export default interface CallbackRequest {
49
52
  * Session state or other provider-specific parameters
50
53
  */
51
54
  session_state?: string;
52
- [key: string]: string | undefined;
53
- }
55
+ };
56
+ export default CallbackRequest;
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Query parameters for OAuth initiate request
3
+ *
4
+ * Note: All query parameters are normalized to strings or string arrays by Flink.
3
5
  */
4
- export default interface InitiateRequest {
6
+ type InitiateRequest = Record<string, string | string[]> & {
5
7
  /**
6
8
  * Optional redirect URI to return to after OAuth flow completes
7
9
  */
8
10
  redirectUri?: string;
9
- [key: string]: string | undefined;
10
- }
11
+ };
12
+ export default InitiateRequest;
@@ -138,7 +138,7 @@ async function start() {
138
138
  if (!isLinked) {
139
139
  // Link new provider to existing user
140
140
  console.log(`Linking ${provider} to existing user:`, user.email);
141
- user = await ctx.repos.userRepo.updateOne(user._id!, {
141
+ user = await ctx.repos.userRepo.updateById(user._id!, {
142
142
  oauthProviders: [
143
143
  ...user.oauthProviders,
144
144
  { provider, providerId: profile.id },
@@ -134,7 +134,7 @@ async function start() {
134
134
  `WARNING: Provider ID changed for ${provider}. Updating...`
135
135
  );
136
136
  // Update provider ID (rare case where user's provider ID changed)
137
- user = await ctx.repos.userRepo.updateOne(user._id!, {
137
+ user = await ctx.repos.userRepo.updateById(user._id!, {
138
138
  oauthProviders: user.oauthProviders.map((p) =>
139
139
  p.provider === provider
140
140
  ? { ...p, providerId: profile.id }
@@ -149,7 +149,7 @@ async function start() {
149
149
  // Link new provider to existing user
150
150
  console.log(`Linking ${provider} to existing user ${user.email}`);
151
151
 
152
- user = await ctx.repos.userRepo.updateOne(user._id!, {
152
+ user = await ctx.repos.userRepo.updateById(user._id!, {
153
153
  oauthProviders: [
154
154
  ...user.oauthProviders,
155
155
  {
@@ -350,7 +350,7 @@ const DeleteProviderHandler: Handler<
350
350
  ? updatedProviders[0].provider
351
351
  : user.primaryProvider;
352
352
 
353
- await ctx.repos.userRepo.updateOne(userId, {
353
+ await ctx.repos.userRepo.updateById(userId, {
354
354
  oauthProviders: updatedProviders,
355
355
  primaryProvider: newPrimaryProvider,
356
356
  updatedAt: new Date(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/oauth-plugin",
3
- "version": "0.14.1",
3
+ "version": "2.0.0-alpha.100",
4
4
  "description": "Flink plugin for OAuth 2.0 authentication with GitHub and Google providers",
5
5
  "author": "joel@frost.se",
6
6
  "license": "MIT",
@@ -10,6 +10,7 @@
10
10
  "access": "public"
11
11
  },
12
12
  "peerDependencies": {
13
+ "@flink-app/flink": ">=2.0.0-alpha.100",
13
14
  "mongodb": "^6.15.0"
14
15
  },
15
16
  "devDependencies": {
@@ -19,9 +20,9 @@
19
20
  "jwt-simple": "^0.5.6",
20
21
  "ts-node": "^10.9.2",
21
22
  "tsc-watch": "^4.2.9",
22
- "@flink-app/test-utils": "0.14.1",
23
- "@flink-app/flink": "0.14.1",
24
- "@flink-app/jwt-auth-plugin": "0.14.1"
23
+ "@flink-app/flink": "2.0.0-alpha.100",
24
+ "@flink-app/jwt-auth-plugin": "2.0.0-alpha.100",
25
+ "@flink-app/test-utils": "2.0.0-alpha.100"
25
26
  },
26
27
  "gitHead": "4243e3b3cd6d4e1ca001a61baa8436bf2bbe4113",
27
28
  "scripts": {
@@ -177,7 +177,7 @@ const CallbackOAuth: GetHandler<any, any, PathParams, CallbackRequest> = async (
177
177
  const existingConnection = await ctx.repos.oauthConnectionRepo.findByUserAndProvider(user._id, provider);
178
178
 
179
179
  if (existingConnection) {
180
- await ctx.repos.oauthConnectionRepo.updateOne(existingConnection._id!, {
180
+ await ctx.repos.oauthConnectionRepo.updateById(existingConnection._id!, {
181
181
  accessToken: encryptedAccessToken,
182
182
  refreshToken: encryptedRefreshToken,
183
183
  scope: tokens.scope || "",
@@ -1,16 +1,19 @@
1
1
  /**
2
2
  * Query parameters for OAuth callback request
3
+ *
4
+ * Note: All query parameters are normalized to strings or string arrays by Flink.
5
+ * Providers may send additional query parameters beyond those listed here.
3
6
  */
4
- export default interface CallbackRequest {
7
+ type CallbackRequest = Record<string, string | string[]> & {
5
8
  /**
6
9
  * Authorization code from OAuth provider
7
10
  */
8
- code: string;
11
+ code?: string;
9
12
 
10
13
  /**
11
14
  * CSRF protection state parameter
12
15
  */
13
- state: string;
16
+ state?: string;
14
17
 
15
18
  /**
16
19
  * Optional error from OAuth provider
@@ -31,7 +34,7 @@ export default interface CallbackRequest {
31
34
  /**
32
35
  * Response type - 'json' returns JSON instead of redirect
33
36
  */
34
- response_type?: "json";
37
+ response_type?: "json" | string;
35
38
 
36
39
  /**
37
40
  * Granted scopes (provider-specific)
@@ -59,6 +62,6 @@ export default interface CallbackRequest {
59
62
  * Session state or other provider-specific parameters
60
63
  */
61
64
  session_state?: string;
65
+ };
62
66
 
63
- [key: string]: string | undefined;
64
- }
67
+ export default CallbackRequest;
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Query parameters for OAuth initiate request
3
+ *
4
+ * Note: All query parameters are normalized to strings or string arrays by Flink.
3
5
  */
4
- export default interface InitiateRequest {
6
+ type InitiateRequest = Record<string, string | string[]> & {
5
7
  /**
6
8
  * Optional redirect URI to return to after OAuth flow completes
7
9
  */
8
10
  redirectUri?: string;
9
- [key: string]: string | undefined;
10
- }
11
+ };
12
+
13
+ export default InitiateRequest;