@cloudflare/workers-oauth-provider 0.0.4-0 → 0.0.4

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.
@@ -37,7 +37,7 @@ var OAuthProviderImpl = class {
37
37
  * @param options - Configuration options for the provider
38
38
  */
39
39
  constructor(options) {
40
- this.typedApiHandlers = /* @__PURE__ */ new Map();
40
+ this.typedApiHandlers = [];
41
41
  const hasSingleHandlerConfig = !!(options.apiRoute && options.apiHandler);
42
42
  const hasMultiHandlerConfig = !!options.apiHandlers;
43
43
  if (hasSingleHandlerConfig && hasMultiHandlerConfig) {
@@ -56,16 +56,16 @@ var OAuthProviderImpl = class {
56
56
  if (Array.isArray(options.apiRoute)) {
57
57
  options.apiRoute.forEach((route, index) => {
58
58
  this.validateEndpoint(route, `apiRoute[${index}]`);
59
- this.typedApiHandlers.set(route, apiHandler);
59
+ this.typedApiHandlers.push([route, apiHandler]);
60
60
  });
61
61
  } else {
62
62
  this.validateEndpoint(options.apiRoute, "apiRoute");
63
- this.typedApiHandlers.set(options.apiRoute, apiHandler);
63
+ this.typedApiHandlers.push([options.apiRoute, apiHandler]);
64
64
  }
65
65
  } else {
66
66
  for (const [route, handler] of Object.entries(options.apiHandlers)) {
67
67
  this.validateEndpoint(route, `apiHandlers key: ${route}`);
68
- this.typedApiHandlers.set(route, this.validateHandler(handler, `apiHandlers[${route}]`));
68
+ this.typedApiHandlers.push([route, this.validateHandler(handler, `apiHandlers[${route}]`)]);
69
69
  }
70
70
  }
71
71
  this.validateEndpoint(options.authorizeEndpoint, "authorizeEndpoint");
@@ -226,7 +226,7 @@ var OAuthProviderImpl = class {
226
226
  * @returns True if the URL matches any of the API routes
227
227
  */
228
228
  isApiRequest(url) {
229
- for (const route of this.typedApiHandlers.keys()) {
229
+ for (const [route, _] of this.typedApiHandlers) {
230
230
  if (this.matchApiRoute(url, route)) {
231
231
  return true;
232
232
  }
@@ -239,7 +239,7 @@ var OAuthProviderImpl = class {
239
239
  * @returns The TypedHandler for the URL, or undefined if no handler matches
240
240
  */
241
241
  findApiHandlerForUrl(url) {
242
- for (const [route, handler] of this.typedApiHandlers.entries()) {
242
+ for (const [route, handler] of this.typedApiHandlers) {
243
243
  if (this.matchApiRoute(url, route)) {
244
244
  return handler;
245
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/workers-oauth-provider",
3
- "version": "0.0.4-0",
3
+ "version": "0.0.4",
4
4
  "description": "OAuth provider for Cloudflare Workers",
5
5
  "main": "dist/oauth-provider.js",
6
6
  "types": "dist/oauth-provider.d.ts",