@owlmeans/server-auth-token 0.1.18-rc.3 → 0.1.18-rc.5

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
@@ -6,7 +6,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
6
6
  your project's skill store (`.agents/skills/`):
7
7
 
8
8
  ```sh
9
- npx @owlmeans/agent-skills@^0.1.18-rc.15
9
+ npx @owlmeans/agent-skills@^0.1.18-rc.17
10
10
  ```
11
11
 
12
12
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/server-auth-token",
4
- "version": "0.1.18-rc.3",
5
- "generatedAt": "2026-09-12T08:39:52.739Z",
4
+ "version": "0.1.18-rc.5",
5
+ "generatedAt": "2026-09-12T12:59:24.922Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/server-auth-token
9
9
 
10
10
  **Layer:** Server
11
- **Install:** `"@owlmeans/server-auth-token": "^0.1.18-rc.3"` in `dependencies`
11
+ **Install:** `"@owlmeans/server-auth-token": "^0.1.18-rc.5"` in `dependencies`
12
12
  **Contracts:** `@owlmeans/auth-token` — the record, the routes, the format helpers
13
13
 
14
14
  ## Key Exports
@@ -1,4 +1,4 @@
1
- import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint';
1
+ import type { EntrypointTree } from '@owlmeans/entrypoint';
2
2
  /**
3
3
  * Let an access token authenticate every route that already has a guard.
4
4
  *
@@ -11,5 +11,5 @@ import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint';
11
11
  * than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
12
12
  * drop one, so the refusal has to live where the credential is inspected.
13
13
  */
14
- export declare const withAuthTokenCoguard: <Protocol extends EntrypointProtocolDeclaration>(declarations: readonly Protocol[], guard?: string) => Protocol[];
14
+ export declare const withAuthTokenCoguard: <Tree extends EntrypointTree>(tree: Tree, guard?: string) => Tree;
15
15
  //# sourceMappingURL=coguard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coguard.d.ts","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AAEzE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,6BAA6B,gBACnE,SAAS,QAAQ,EAAE,UAAS,MAAM,KAC/C,QAAQ,EAIT,CAAA"}
1
+ {"version":3,"file":"coguard.d.ts","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,cAAc,QACxD,IAAI,UAAS,MAAM,KACxB,IAID,CAAA"}
package/build/coguard.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token';
2
- import { decorateEntrypoint } from '@owlmeans/entrypoint';
2
+ import { decorateEntrypoint, mapProtocols } from '@owlmeans/entrypoint';
3
3
  /**
4
4
  * Let an access token authenticate every route that already has a guard.
5
5
  *
@@ -12,7 +12,7 @@ import { decorateEntrypoint } from '@owlmeans/entrypoint';
12
12
  * than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
13
13
  * drop one, so the refusal has to live where the credential is inspected.
14
14
  */
15
- export const withAuthTokenCoguard = (declarations, guard = GUARD_AUTH_TOKEN) => declarations.map(declaration => {
15
+ export const withAuthTokenCoguard = (tree, guard = GUARD_AUTH_TOKEN) => mapProtocols(tree, declaration => {
16
16
  if (declaration.guards.length < 1 || declaration.guards.includes(guard))
17
17
  return declaration;
18
18
  return decorateEntrypoint(declaration, { guards: [...declaration.guards, guard] });
@@ -1 +1 @@
1
- {"version":3,"file":"coguard.js","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,YAAiC,EAAE,KAAK,GAAW,gBAAgB,EACvD,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;IAC9C,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAA;IAE3F,OAAO,kBAAkB,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;AACpF,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"coguard.js","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGvE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAU,EAAE,KAAK,GAAW,gBAAgB,EACtC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE;IAC1C,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAA;IAE3F,OAAO,kBAAkB,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;AACpF,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/server-auth-token",
3
- "version": "0.1.18-rc.3",
3
+ "version": "0.1.18-rc.5",
4
4
  "license": "MIT",
5
5
  "description": "The server half of OwlMeans access tokens — the store, the guard that verifies a presented token, the management handlers and the coguard that admits one on an existing route.",
6
6
  "type": "module",
@@ -24,16 +24,16 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@noble/hashes": "^1.5.0",
27
- "@owlmeans/auth": "^0.1.18-rc.12",
28
- "@owlmeans/auth-common": "^0.1.18-rc.16",
29
- "@owlmeans/auth-token": "^0.1.18-rc.3",
30
- "@owlmeans/context": "^0.1.18-rc.11",
31
- "@owlmeans/entrypoint": "^0.1.18-rc.14",
32
- "@owlmeans/mongo-resource": "^0.1.18-rc.15",
33
- "@owlmeans/resource": "^0.1.18-rc.12",
34
- "@owlmeans/server-api": "^0.1.18-rc.20",
35
- "@owlmeans/server-auth-identity": "^0.1.18-rc.16",
36
- "@owlmeans/server-context": "^0.1.18-rc.15",
27
+ "@owlmeans/auth": "^0.1.18-rc.14",
28
+ "@owlmeans/auth-common": "^0.1.18-rc.18",
29
+ "@owlmeans/auth-token": "^0.1.18-rc.5",
30
+ "@owlmeans/context": "^0.1.18-rc.13",
31
+ "@owlmeans/entrypoint": "^0.1.18-rc.16",
32
+ "@owlmeans/mongo-resource": "^0.1.18-rc.17",
33
+ "@owlmeans/resource": "^0.1.18-rc.14",
34
+ "@owlmeans/server-api": "^0.1.18-rc.22",
35
+ "@owlmeans/server-auth-identity": "^0.1.18-rc.18",
36
+ "@owlmeans/server-context": "^0.1.18-rc.17",
37
37
  "@scure/base": "^1.1.9"
38
38
  },
39
39
  "devDependencies": {
package/src/coguard.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token'
2
- import { decorateEntrypoint } from '@owlmeans/entrypoint'
3
- import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint'
2
+ import { decorateEntrypoint, mapProtocols } from '@owlmeans/entrypoint'
3
+ import type { EntrypointTree } from '@owlmeans/entrypoint'
4
4
 
5
5
  /**
6
6
  * Let an access token authenticate every route that already has a guard.
@@ -14,9 +14,9 @@ import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint'
14
14
  * than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
15
15
  * drop one, so the refusal has to live where the credential is inspected.
16
16
  */
17
- export const withAuthTokenCoguard = <Protocol extends EntrypointProtocolDeclaration>(
18
- declarations: readonly Protocol[], guard: string = GUARD_AUTH_TOKEN,
19
- ): Protocol[] => declarations.map(declaration => {
17
+ export const withAuthTokenCoguard = <Tree extends EntrypointTree>(
18
+ tree: Tree, guard: string = GUARD_AUTH_TOKEN,
19
+ ): Tree => mapProtocols(tree, declaration => {
20
20
  if (declaration.guards.length < 1 || declaration.guards.includes(guard)) return declaration
21
21
 
22
22
  return decorateEntrypoint(declaration, { guards: [...declaration.guards, guard] })
@@ -1,13 +1,13 @@
1
1
  import { describe, expect, test } from 'bun:test'
2
2
  import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token'
3
- import { openProtocol } from '@owlmeans/entrypoint'
3
+ import { openProtocol, protocols } from '@owlmeans/entrypoint'
4
4
  import { route } from '@owlmeans/route'
5
5
  import { withAuthTokenCoguard } from '../src/coguard.js'
6
6
 
7
7
  describe('@owlmeans/server-auth-token — the coguard', () => {
8
8
  test('decorates a guarded protocol and leaves the primary guard first', () => {
9
9
  const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
10
- const [decorated] = withAuthTokenCoguard([guarded])
10
+ const [decorated] = protocols(withAuthTokenCoguard({ guarded }))
11
11
 
12
12
  expect(decorated.guards).toEqual(['auth', GUARD_AUTH_TOKEN])
13
13
  expect(guarded.guards).toEqual(['auth'])
@@ -15,20 +15,20 @@ describe('@owlmeans/server-auth-token — the coguard', () => {
15
15
 
16
16
  test('leaves an unguarded protocol unchanged', () => {
17
17
  const open = openProtocol(route('open', '/open'))
18
- expect(withAuthTokenCoguard([open])[0]).toBe(open)
18
+ expect(protocols(withAuthTokenCoguard({ open }))[0]).toBe(open)
19
19
  })
20
20
 
21
21
  test('is idempotent', () => {
22
22
  const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
23
- const [once] = withAuthTokenCoguard([guarded])
24
- const [twice] = withAuthTokenCoguard([once])
23
+ const [once] = protocols(withAuthTokenCoguard({ guarded }))
24
+ const [twice] = protocols(withAuthTokenCoguard({ once }))
25
25
 
26
26
  expect(twice.guards).toEqual(['auth', GUARD_AUTH_TOKEN])
27
27
  })
28
28
 
29
29
  test('honours a custom guard alias', () => {
30
30
  const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
31
- expect(withAuthTokenCoguard([guarded], 'other-guard')[0].guards)
31
+ expect(protocols(withAuthTokenCoguard({ guarded }, 'other-guard'))[0].guards)
32
32
  .toEqual(['auth', 'other-guard'])
33
33
  })
34
34
  })