@owlmeans/client-route 0.1.18-rc.46 → 0.1.18-rc.48

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
@@ -5,32 +5,32 @@ Client-side route model extension — marks routes as client-side and provides U
5
5
  ## Overview
6
6
 
7
7
  - `route(routeModel, opts?)` — wraps a `RouteModel` into a `ClientRouteModel` (marks `_client: true`)
8
- - `isClientRouteModel(route)` — type guard distinguishing client routes from server routes
9
- - `extractParams(path)` — extracts path parameter names (`:param` segments) from a URL pattern
8
+ - `clientRouteHelper.isClientRouteModel(route)` — type guard distinguishing client routes from server routes
9
+ - `clientRouteHelper.extractParams(path)` — extracts path parameter names (`:param` segments) from a URL pattern
10
10
  - Used internally by `@owlmeans/client-entrypoint` when building client-side entrypoint URLs
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/client-route@^0.1.18-rc.46
15
+ bun add @owlmeans/client-route@^0.1.18-rc.48
16
16
  ```
17
17
 
18
18
  ## Usage
19
19
 
20
20
  ```typescript
21
- import { route, isClientRouteModel, extractParams } from '@owlmeans/client-route'
21
+ import { route, clientRouteHelper } from '@owlmeans/client-route'
22
22
  import type { ClientRouteModel } from '@owlmeans/client-route'
23
23
 
24
24
  // Wrap a route as a client route
25
25
  const clientRoute = route(someRouteModel, { overrides: { service: 'api' } })
26
26
 
27
27
  // Type guard
28
- if (isClientRouteModel(arg)) {
28
+ if (clientRouteHelper.isClientRouteModel(arg)) {
29
29
  // arg is ClientRouteModel
30
30
  }
31
31
 
32
32
  // Extract named params from a path pattern
33
- const params = extractParams('/projects/:projectId/items/:itemId')
33
+ const params = clientRouteHelper.extractParams('/projects/:projectId/items/:itemId')
34
34
  // => ['projectId', 'itemId']
35
35
  ```
36
36
 
@@ -41,11 +41,11 @@ const params = extractParams('/projects/:projectId/items/:itemId')
41
41
  Converts a `RouteModel` to a `ClientRouteModel`. Options: `overrides?: Partial<ClientRoute>` — the
42
42
  overrides only fill in declaration fields that are still unset.
43
43
 
44
- ### `isClientRouteModel(route): route is ClientRouteModel`
44
+ ### `clientRouteHelper.isClientRouteModel(route): route is ClientRouteModel`
45
45
 
46
46
  Returns `true` if the route was created with `route()`.
47
47
 
48
- ### `extractParams(path): string[]`
48
+ ### `clientRouteHelper.extractParams(path): string[]`
49
49
 
50
50
  Returns the list of `:param` segment names in a URL pattern string.
51
51
 
@@ -59,7 +59,7 @@ and `address()` on demand against the context that asks.
59
59
 
60
60
  - [`@owlmeans/route`](../route) — `RouteModel`, `RouteDeclaration` base types and the pure
61
61
  `resolvePath` / `resolveMount` / `resolveAddress` utilities under `@owlmeans/route/utils`
62
- - [`@owlmeans/client-entrypoint`](../client-entrypoint) — uses `route()` and `isClientRouteModel()` when constructing entrypoints
62
+ - [`@owlmeans/client-entrypoint`](../client-entrypoint) — uses `route()` and `clientRouteHelper.isClientRouteModel()` when constructing entrypoints
63
63
 
64
64
  <!-- owlmeans:agent-guidance:start -->
65
65
  ## Agent guidance
@@ -69,7 +69,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
69
69
  your project's skill store (`.agents/skills/`):
70
70
 
71
71
  ```sh
72
- npx @owlmeans/agent-skills@^0.1.18-rc.47
72
+ npx @owlmeans/agent-skills@^0.1.18-rc.49
73
73
  ```
74
74
 
75
75
  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/client-route",
4
- "version": "0.1.18-rc.46",
5
- "generatedAt": "2026-10-03T20:05:07.584Z",
4
+ "version": "0.1.18-rc.48",
5
+ "generatedAt": "2026-10-05T21:03:06.366Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/client-route
9
9
 
10
10
  **Layer:** Client
11
- **Install:** `"@owlmeans/client-route": "^0.1.18-rc.46"` in `dependencies`
11
+ **Install:** `"@owlmeans/client-route": "^0.1.18-rc.48"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
@@ -0,0 +1,9 @@
1
+ import type { ClientRouteModel } from '../types.js';
2
+ /** Reads client route models and their paths. */
3
+ export interface ClientRouteHelper {
4
+ /** Whether a route model was marked as a client one. */
5
+ isClientRouteModel: (route: Object) => route is ClientRouteModel;
6
+ /** The names of the `:param` segments of a path, in order. */
7
+ extractParams: (path: string) => string[];
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/helper/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,IAAI,gBAAgB,CAAA;IAChE,8DAA8D;IAC9D,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAA;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/helper/types.ts"],"names":[],"mappings":""}
package/build/helper.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ClientRouteModel } from './types.js';
2
- export declare const isClientRouteModel: (route: Object) => route is ClientRouteModel;
3
- export declare const extractParams: (path: string) => string[];
1
+ import type { ClientRouteHelper } from './helper/types.js';
2
+ export declare const createClientRouteHelper: () => ClientRouteHelper;
3
+ export declare const clientRouteHelper: ClientRouteHelper;
4
4
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,KAAK,IAAI,gBACxC,CAAA;AAEpB,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,MAAM,EAIlD,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,uBAAuB,QAAO,iBAW1C,CAAA;AAED,eAAO,MAAM,iBAAiB,mBAA4B,CAAA"}
package/build/helper.js CHANGED
@@ -1,8 +1,12 @@
1
1
  import { PARAM, SEP, normalizePath } from '@owlmeans/route';
2
- export const isClientRouteModel = (route) => '_client' in route;
3
- export const extractParams = (path) => {
4
- path = normalizePath(path);
5
- return path.split(SEP).map(item => item.startsWith(PARAM) ? item.slice(1) : null)
6
- .filter(param => param);
2
+ export const createClientRouteHelper = () => {
3
+ const isClientRouteModel = (route) => '_client' in route;
4
+ const extractParams = (path) => {
5
+ path = normalizePath(path);
6
+ return path.split(SEP).map(item => item.startsWith(PARAM) ? item.slice(1) : null)
7
+ .filter(param => param);
8
+ };
9
+ return { isClientRouteModel, extractParams };
7
10
  };
11
+ export const clientRouteHelper = createClientRouteHelper();
8
12
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAA6B,EAAE,CAC7E,SAAS,IAAI,KAAK,CAAA;AAEpB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAY,EAAE;IACtD,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;SAC9E,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAa,CAAA;AACvC,CAAC,CAAA"}
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAsB,EAAE;IAC7D,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAA6B,EAAE,CACtE,SAAS,IAAI,KAAK,CAAA;IAEpB,MAAM,aAAa,GAAG,CAAC,IAAY,EAAY,EAAE;QAC/C,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;aAC9E,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAa,CAAA;IACvC,CAAC,CAAA;IAED,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,EAAE,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './model.js';
2
2
  export type * from './types.js';
3
+ export type * from './helper/types.js';
3
4
  export * from './helper.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAC1B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAC1B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,mBAAmB,CAAA;AACtC,cAAc,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAE1B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAG1B,cAAc,aAAa,CAAA"}
package/build/model.js CHANGED
@@ -1,4 +1,4 @@
1
- import { overrideParams } from '@owlmeans/route/utils';
1
+ import { routeDeclarationHelper } from '@owlmeans/route/utils';
2
2
  /**
3
3
  * Mark a route model as a client one and fill in whatever the declaration left blank.
4
4
  * The declared `path` stays the segment this route contributes — the entrypoint composes the
@@ -9,7 +9,7 @@ export const route = (route, opts) => {
9
9
  ...route,
10
10
  _client: true
11
11
  };
12
- overrideParams(model.route, opts?.overrides);
12
+ routeDeclarationHelper.overrideParams(model.route, opts?.overrides);
13
13
  return model;
14
14
  };
15
15
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,IAAyB,EAAoB,EAAE;IACtF,MAAM,KAAK,GAAqB;QAC9B,GAAI,KAA0B;QAE9B,OAAO,EAAE,IAAI;KACd,CAAA;IAED,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAE5C,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,IAAyB,EAAoB,EAAE;IACtF,MAAM,KAAK,GAAqB;QAC9B,GAAI,KAA0B;QAE9B,OAAO,EAAE,IAAI;KACd,CAAA;IAED,sBAAsB,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAEnE,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/client-route",
3
- "version": "0.1.18-rc.46",
3
+ "version": "0.1.18-rc.48",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -21,8 +21,8 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@owlmeans/client-context": "^0.1.18-rc.46",
25
- "@owlmeans/route": "^0.1.18-rc.33"
24
+ "@owlmeans/client-context": "^0.1.18-rc.48",
25
+ "@owlmeans/route": "^0.1.18-rc.35"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@owlmeans/dep-config": "workspace:*",
@@ -0,0 +1,9 @@
1
+ import type { ClientRouteModel } from '../types.js'
2
+
3
+ /** Reads client route models and their paths. */
4
+ export interface ClientRouteHelper {
5
+ /** Whether a route model was marked as a client one. */
6
+ isClientRouteModel: (route: Object) => route is ClientRouteModel
7
+ /** The names of the `:param` segments of a path, in order. */
8
+ extractParams: (path: string) => string[]
9
+ }
package/src/helper.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  import { PARAM, SEP, normalizePath } from '@owlmeans/route'
2
- import { ClientRouteModel } from './types.js'
2
+ import type { ClientRouteModel } from './types.js'
3
+ import type { ClientRouteHelper } from './helper/types.js'
3
4
 
4
- export const isClientRouteModel = (route: Object): route is ClientRouteModel =>
5
- '_client' in route
5
+ export const createClientRouteHelper = (): ClientRouteHelper => {
6
+ const isClientRouteModel = (route: Object): route is ClientRouteModel =>
7
+ '_client' in route
6
8
 
7
- export const extractParams = (path: string): string[] => {
8
- path = normalizePath(path)
9
- return path.split(SEP).map(item => item.startsWith(PARAM) ? item.slice(1) : null)
10
- .filter(param => param) as string[]
9
+ const extractParams = (path: string): string[] => {
10
+ path = normalizePath(path)
11
+ return path.split(SEP).map(item => item.startsWith(PARAM) ? item.slice(1) : null)
12
+ .filter(param => param) as string[]
13
+ }
14
+
15
+ return { isClientRouteModel, extractParams }
11
16
  }
17
+
18
+ export const clientRouteHelper = createClientRouteHelper()
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
2
  export * from './model.js'
3
3
  export type * from './types.js'
4
+ export type * from './helper/types.js'
4
5
  export * from './helper.js'
package/src/model.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { RouteModel } from '@owlmeans/route'
2
2
  import type { ClientRouteModel, ClientRouteOptions } from './types.js'
3
- import { overrideParams } from '@owlmeans/route/utils'
3
+ import { routeDeclarationHelper } from '@owlmeans/route/utils'
4
4
 
5
5
  /**
6
6
  * Mark a route model as a client one and fill in whatever the declaration left blank.
@@ -14,7 +14,7 @@ export const route = (route: RouteModel, opts?: ClientRouteOptions): ClientRoute
14
14
  _client: true
15
15
  }
16
16
 
17
- overrideParams(model.route, opts?.overrides)
17
+ routeDeclarationHelper.overrideParams(model.route, opts?.overrides)
18
18
 
19
19
  return model
20
20
  }