@julr/sesame 0.2.1 → 0.3.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.
package/README.md CHANGED
@@ -80,9 +80,7 @@ The `SesameScopes` augmentation gives you type-safe scope names throughout your
80
80
  Register OAuth routes from your `start/routes.ts` file:
81
81
 
82
82
  ```ts
83
- import { SesameManager } from '@julr/sesame'
84
-
85
- const sesame = await app.container.make(SesameManager)
83
+ import sesame from '@julr/sesame/services/main'
86
84
 
87
85
  // OAuth endpoints under /oauth
88
86
  router.group(() => {
@@ -193,7 +191,8 @@ node ace sesame:purge --retention-hours=168
193
191
  You can also call it programmatically:
194
192
 
195
193
  ```ts
196
- const sesame = await app.container.make(SesameManager)
194
+ import sesame from '@julr/sesame/services/main'
195
+
197
196
  const result = await sesame.purgeTokens({ retentionHours: 168 })
198
197
  ```
199
198
 
@@ -1,4 +1,4 @@
1
- import { a as OAuthAuthorizationCode, i as OAuthConsent, r as OAuthPendingAuthorizationRequest, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { i as OAuthAuthorizationCode, n as OAuthPendingAuthorizationRequest, r as OAuthConsent, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import "./oauth_access_token-bsoM5KeU.js";
4
4
  import { d as E_UNSUPPORTED_RESPONSE_TYPE, o as E_INVALID_REQUEST, r as E_INVALID_CLIENT } from "./oauth_error-CnJ3L8tf.js";
@@ -1,4 +1,4 @@
1
- import { t as SesameManager } from "../sesame_manager-CFq4VEIZ.js";
1
+ import { t as SesameManager } from "../sesame_manager-2iG9p7_F.js";
2
2
  import { t as __decorate } from "../decorate-BKZEjPRg.js";
3
3
  import "../oauth_access_token-bsoM5KeU.js";
4
4
  import { BaseCommand, flags } from "@adonisjs/core/ace";
@@ -1,4 +1,4 @@
1
- import { a as OAuthAuthorizationCode, i as OAuthConsent, r as OAuthPendingAuthorizationRequest, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { i as OAuthAuthorizationCode, n as OAuthPendingAuthorizationRequest, r as OAuthConsent, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import "./oauth_access_token-bsoM5KeU.js";
4
4
  import { a as E_INVALID_GRANT, o as E_INVALID_REQUEST, r as E_INVALID_CLIENT } from "./oauth_error-CnJ3L8tf.js";
package/build/index.js CHANGED
@@ -1,12 +1,11 @@
1
- import { a as OAuthAuthorizationCode, i as OAuthConsent, o as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
2
1
  import { configure } from "./configure.js";
2
+ import { a as OAuthRefreshToken, i as OAuthAuthorizationCode, r as OAuthConsent, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
3
3
  import "./decorate-BKZEjPRg.js";
4
4
  import { t as OAuthAccessToken } from "./oauth_access_token-bsoM5KeU.js";
5
5
  import { a as E_INVALID_GRANT, c as E_INVALID_TOKEN, d as E_UNSUPPORTED_RESPONSE_TYPE, f as OAuthError, i as E_INVALID_CLIENT_METADATA, l as E_SERVER_ERROR, n as E_INSUFFICIENT_SCOPE, o as E_INVALID_REQUEST, r as E_INVALID_CLIENT, s as E_INVALID_SCOPE, t as E_ACCESS_DENIED, u as E_UNSUPPORTED_GRANT_TYPE } from "./oauth_error-CnJ3L8tf.js";
6
6
  import { t as OAuthClient } from "./oauth_client-BIoY5jBR.js";
7
7
  import "./token_service-fhoA4slP.js";
8
- import { n as OAuthGuard, t as OAuthLucidUserProvider } from "./user_provider-DXAOfv8-.js";
9
- import { oauthGuard, oauthUserProvider } from "./src/guard/main.js";
8
+ import { i as OAuthGuard, n as oauthUserProvider, r as OAuthLucidUserProvider, t as oauthGuard } from "./main-C6VqRjlK.js";
10
9
  function defineConfig(config) {
11
10
  return {
12
11
  issuer: config.issuer,
@@ -1,4 +1,4 @@
1
- import { o as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { a as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import { t as OAuthAccessToken } from "./oauth_access_token-bsoM5KeU.js";
4
4
  import { r as E_INVALID_CLIENT } from "./oauth_error-CnJ3L8tf.js";
@@ -147,4 +147,15 @@ var OAuthLucidUserProvider = class {
147
147
  return this.createUserForGuard(user);
148
148
  }
149
149
  };
150
- export { OAuthGuard as n, OAuthLucidUserProvider as t };
150
+ function oauthGuard(config) {
151
+ return { async resolver(name, app) {
152
+ const emitter = await app.container.make("emitter");
153
+ const { SesameManager } = await import("./sesame_manager-BLmhC1jV.js");
154
+ const manager = await app.container.make(SesameManager);
155
+ return (ctx) => new OAuthGuard(name, ctx, emitter, config.provider, manager, config.resource);
156
+ } };
157
+ }
158
+ function oauthUserProvider(options) {
159
+ return new OAuthLucidUserProvider(options);
160
+ }
161
+ export { OAuthGuard as i, oauthUserProvider as n, OAuthLucidUserProvider as r, oauthGuard as t };
@@ -1,4 +1,4 @@
1
- import { t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import "./oauth_access_token-bsoM5KeU.js";
4
4
  import { l as E_SERVER_ERROR } from "./oauth_error-CnJ3L8tf.js";
@@ -1,4 +1,4 @@
1
- import { t as SesameManager } from "../sesame_manager-CFq4VEIZ.js";
1
+ import { t as SesameManager } from "../sesame_manager-2iG9p7_F.js";
2
2
  import "../decorate-BKZEjPRg.js";
3
3
  import "../oauth_access_token-bsoM5KeU.js";
4
4
  var SesameProvider = class {
@@ -1,4 +1,4 @@
1
- import { t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import "./oauth_access_token-bsoM5KeU.js";
4
4
  import { i as E_INVALID_CLIENT_METADATA, o as E_INVALID_REQUEST, s as E_INVALID_SCOPE, t as E_ACCESS_DENIED } from "./oauth_error-CnJ3L8tf.js";
@@ -1,4 +1,4 @@
1
- import { o as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { a as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import { t as OAuthAccessToken } from "./oauth_access_token-bsoM5KeU.js";
4
4
  import { r as E_INVALID_CLIENT } from "./oauth_error-CnJ3L8tf.js";
@@ -0,0 +1,3 @@
1
+ import { SesameManager } from '../src/sesame_manager.ts';
2
+ declare let sesame: SesameManager;
3
+ export { sesame as default };
@@ -0,0 +1,9 @@
1
+ import { t as SesameManager } from "../sesame_manager-2iG9p7_F.js";
2
+ import "../decorate-BKZEjPRg.js";
3
+ import "../oauth_access_token-bsoM5KeU.js";
4
+ import app from "@adonisjs/core/services/app";
5
+ let sesame;
6
+ await app.booted(async () => {
7
+ sesame = await app.container.make(SesameManager);
8
+ });
9
+ export { sesame as default };
@@ -1,26 +1,15 @@
1
1
  import { n as json, t as __decorate } from "./decorate-BKZEjPRg.js";
2
2
  import { t as OAuthAccessToken } from "./oauth_access_token-bsoM5KeU.js";
3
- import "node:module";
4
3
  import { DateTime } from "luxon";
5
4
  import { BaseModel, column } from "@adonisjs/lucid/orm";
6
- var __defProp = Object.defineProperty;
7
- var __exportAll = (all, no_symbols) => {
8
- let target = {};
9
- for (var name in all) __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true
12
- });
13
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
14
- return target;
15
- };
16
5
  const controllers = {
17
- token: () => import("./token_controller-ll9sjcvn.js"),
18
- authorize: () => import("./authorize_controller-BNWhlPZQ.js"),
19
- consent: () => import("./consent_controller-COvvkpHM.js"),
20
- introspect: () => import("./introspect_controller-JjAAXFIV.js"),
21
- revoke: () => import("./revoke_controller-B281b8ZO.js"),
22
- register: () => import("./register_controller-DOlN9wNl.js"),
23
- metadata: () => import("./metadata_controller-BzCjyqUG.js"),
6
+ token: () => import("./token_controller-qFmejgux.js"),
7
+ authorize: () => import("./authorize_controller-ekxbVGSh.js"),
8
+ consent: () => import("./consent_controller-CqE3-kWO.js"),
9
+ introspect: () => import("./introspect_controller-Dx3Hz87G.js"),
10
+ revoke: () => import("./revoke_controller-E15HmMCv.js"),
11
+ register: () => import("./register_controller-B7IT9U1P.js"),
12
+ metadata: () => import("./metadata_controller-CrR-rU1y.js"),
24
13
  clientInfo: () => import("./client_info_controller-BucHGx4u.js")
25
14
  };
26
15
  function registerOAuthRoutes(router) {
@@ -96,7 +85,6 @@ __decorate([column()], OAuthPendingAuthorizationRequest.prototype, "codeChalleng
96
85
  __decorate([column()], OAuthPendingAuthorizationRequest.prototype, "codeChallengeMethod", void 0);
97
86
  __decorate([column.dateTime()], OAuthPendingAuthorizationRequest.prototype, "expiresAt", void 0);
98
87
  __decorate([column.dateTime({ autoCreate: true })], OAuthPendingAuthorizationRequest.prototype, "createdAt", void 0);
99
- var sesame_manager_exports = /* @__PURE__ */ __exportAll({ SesameManager: () => SesameManager });
100
88
  var SesameManager = class {
101
89
  #config;
102
90
  constructor(config) {
@@ -173,4 +161,4 @@ var SesameManager = class {
173
161
  return result.then((r) => Array.isArray(r) ? Number(r[0] ?? 0) : Number(r));
174
162
  }
175
163
  };
176
- export { OAuthAuthorizationCode as a, OAuthConsent as i, sesame_manager_exports as n, OAuthRefreshToken as o, OAuthPendingAuthorizationRequest as r, SesameManager as t };
164
+ export { OAuthRefreshToken as a, OAuthAuthorizationCode as i, OAuthPendingAuthorizationRequest as n, OAuthConsent as r, SesameManager as t };
@@ -0,0 +1,4 @@
1
+ import { t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
+ import "./decorate-BKZEjPRg.js";
3
+ import "./oauth_access_token-bsoM5KeU.js";
4
+ export { SesameManager };
@@ -2,16 +2,5 @@ import "../../decorate-BKZEjPRg.js";
2
2
  import "../../oauth_access_token-bsoM5KeU.js";
3
3
  import "../../oauth_client-BIoY5jBR.js";
4
4
  import "../../token_service-fhoA4slP.js";
5
- import { n as OAuthGuard, t as OAuthLucidUserProvider } from "../../user_provider-DXAOfv8-.js";
6
- function oauthGuard(config) {
7
- return { async resolver(name, app) {
8
- const emitter = await app.container.make("emitter");
9
- const { SesameManager } = await import("../../sesame_manager-CFq4VEIZ.js").then((n) => n.n);
10
- const manager = await app.container.make(SesameManager);
11
- return (ctx) => new OAuthGuard(name, ctx, emitter, config.provider, manager, config.resource);
12
- } };
13
- }
14
- function oauthUserProvider(options) {
15
- return new OAuthLucidUserProvider(options);
16
- }
5
+ import { i as OAuthGuard, n as oauthUserProvider, r as OAuthLucidUserProvider, t as oauthGuard } from "../../main-C6VqRjlK.js";
17
6
  export { OAuthGuard, OAuthLucidUserProvider, oauthGuard, oauthUserProvider };
@@ -1,4 +1,4 @@
1
- import { a as OAuthAuthorizationCode, o as OAuthRefreshToken, t as SesameManager } from "./sesame_manager-CFq4VEIZ.js";
1
+ import { a as OAuthRefreshToken, i as OAuthAuthorizationCode, t as SesameManager } from "./sesame_manager-2iG9p7_F.js";
2
2
  import "./decorate-BKZEjPRg.js";
3
3
  import { t as OAuthAccessToken } from "./oauth_access_token-bsoM5KeU.js";
4
4
  import { a as E_INVALID_GRANT, o as E_INVALID_REQUEST, r as E_INVALID_CLIENT, s as E_INVALID_SCOPE, u as E_UNSUPPORTED_GRANT_TYPE } from "./oauth_error-CnJ3L8tf.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@julr/sesame",
3
3
  "description": "OAuth 2.1 + OIDC server for AdonisJS",
4
- "version": "0.2.1",
4
+ "version": "0.3.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -20,6 +20,7 @@
20
20
  "./guard": "./build/src/guard/main.js",
21
21
  "./scope_middleware": "./build/src/middleware/scope_middleware.js",
22
22
  "./any_scope_middleware": "./build/src/middleware/any_scope_middleware.js",
23
+ "./services/main": "./build/services/main.js",
23
24
  "./commands/*": "./build/commands/*.js",
24
25
  "./commands": "./build/commands/main.js"
25
26
  },
@@ -96,6 +97,7 @@
96
97
  "./index.ts",
97
98
  "./configure.ts",
98
99
  "./providers/sesame_provider.ts",
100
+ "./services/main.ts",
99
101
  "./src/guard/main.ts",
100
102
  "./commands/sesame_purge.ts",
101
103
  "./src/middleware/scope_middleware.ts",