@owlmeans/iam 0.1.18-rc.49 → 0.1.18-rc.50

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.
Files changed (70) hide show
  1. package/README.md +2 -2
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/iam/SKILL.md +1 -1
  4. package/build/consts.d.ts +1 -1
  5. package/build/consts.d.ts.map +1 -1
  6. package/build/facet.d.ts +10 -0
  7. package/build/facet.d.ts.map +1 -0
  8. package/build/facet.js +16 -0
  9. package/build/facet.js.map +1 -0
  10. package/build/gate/param.d.ts +4 -29
  11. package/build/gate/param.d.ts.map +1 -1
  12. package/build/gate/param.js +72 -88
  13. package/build/gate/param.js.map +1 -1
  14. package/build/gate/resolve.d.ts +1 -1
  15. package/build/gate/resolve.d.ts.map +1 -1
  16. package/build/gate/types.d.ts +109 -0
  17. package/build/gate/types.d.ts.map +1 -0
  18. package/build/gate/types.js +2 -0
  19. package/build/gate/types.js.map +1 -0
  20. package/build/gate/validate.d.ts +3 -14
  21. package/build/gate/validate.d.ts.map +1 -1
  22. package/build/gate/validate.js +88 -95
  23. package/build/gate/validate.js.map +1 -1
  24. package/build/index.d.ts +5 -0
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js +1 -0
  27. package/build/index.js.map +1 -1
  28. package/build/permission/types.d.ts +35 -0
  29. package/build/permission/types.d.ts.map +1 -0
  30. package/build/permission/types.js +2 -0
  31. package/build/permission/types.js.map +1 -0
  32. package/build/permission.d.ts +5 -18
  33. package/build/permission.d.ts.map +1 -1
  34. package/build/permission.js +29 -34
  35. package/build/permission.js.map +1 -1
  36. package/build/runtime/types.d.ts +90 -0
  37. package/build/runtime/types.d.ts.map +1 -0
  38. package/build/runtime/types.js +2 -0
  39. package/build/runtime/types.js.map +1 -0
  40. package/build/runtime.d.ts +1 -1
  41. package/build/runtime.d.ts.map +1 -1
  42. package/build/schemas.d.ts +1 -1
  43. package/build/schemas.d.ts.map +1 -1
  44. package/build/types.d.ts +3 -172
  45. package/build/types.d.ts.map +1 -1
  46. package/build/utils/types.d.ts +12 -0
  47. package/build/utils/types.d.ts.map +1 -0
  48. package/build/utils/types.js +2 -0
  49. package/build/utils/types.js.map +1 -0
  50. package/build/utils.d.ts +1 -10
  51. package/build/utils.d.ts.map +1 -1
  52. package/build/utils.js +0 -15
  53. package/build/utils.js.map +1 -1
  54. package/package.json +7 -7
  55. package/src/consts.ts +1 -1
  56. package/src/facet.ts +17 -0
  57. package/src/gate/param.ts +79 -92
  58. package/src/gate/resolve.ts +1 -1
  59. package/src/gate/types.ts +117 -0
  60. package/src/gate/validate.ts +93 -98
  61. package/src/index.ts +5 -0
  62. package/src/permission/types.ts +33 -0
  63. package/src/permission.ts +39 -39
  64. package/src/runtime/types.ts +107 -0
  65. package/src/runtime.ts +2 -2
  66. package/src/schemas.ts +1 -1
  67. package/src/types.ts +3 -199
  68. package/src/utils/types.ts +11 -0
  69. package/src/utils.ts +1 -18
  70. package/tests/gate-param.spec.ts +25 -26
package/README.md CHANGED
@@ -15,7 +15,7 @@ Provider-agnostic IAM abstraction for the OwlMeans framework — `IamService` in
15
15
  ## Installation
16
16
 
17
17
  ```bash
18
- bun add @owlmeans/iam@^0.1.18-rc.49
18
+ bun add @owlmeans/iam@^0.1.18-rc.50
19
19
  ```
20
20
 
21
21
  ## Usage
@@ -38,7 +38,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
38
38
  your project's skill store (`.agents/skills/`):
39
39
 
40
40
  ```sh
41
- npx @owlmeans/agent-skills@^0.1.18-rc.48
41
+ npx @owlmeans/agent-skills@^0.1.18-rc.49
42
42
  ```
43
43
 
44
44
  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/iam",
4
- "version": "0.1.18-rc.49",
5
- "generatedAt": "2026-10-05T08:32:19.105Z",
4
+ "version": "0.1.18-rc.50",
5
+ "generatedAt": "2026-10-05T21:03:06.386Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ metadata:
8
8
 
9
9
  # Using `@owlmeans/iam`
10
10
 
11
- **Install:** `"@owlmeans/iam": "^0.1.18-rc.49"` in `dependencies`
11
+ **Install:** `"@owlmeans/iam": "^0.1.18-rc.50"` in `dependencies`
12
12
 
13
13
  Provider-agnostic IAM abstraction: the `IamService` interface, the permission and grant shapes, the
14
14
  gate-param grammar, `hasPermission`, and the declarations of the provider's runtime IAM API. It
package/build/consts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IamRuntimeAck, IamRuntimeGrantQuery, IamRuntimeMemberInvite, IamRuntimeMemberParams, IamRuntimeOrganizationCreate, IamRuntimeOrganizationParams, IamRuntimeOrganizationUpdate } from './types.js';
1
+ import type { IamRuntimeAck, IamRuntimeGrantQuery, IamRuntimeMemberInvite, IamRuntimeMemberParams, IamRuntimeOrganizationCreate, IamRuntimeOrganizationParams, IamRuntimeOrganizationUpdate } from './runtime/types.js';
2
2
  import type { JSONSchemaType } from 'ajv';
3
3
  export declare const DEFAULT_ALIAS = "iam-service";
4
4
  export declare const IAM_MODE_KEYCLOAK = "keycloak";
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AAC/M,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAGzC,eAAO,MAAM,aAAa,gBAAgB,CAAA;AAE1C,eAAO,MAAM,iBAAiB,aAAa,CAAA;AAC3C,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C;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+ * A facet a backend cannot provide: every method throws `IamUnsupported(what)`.
3
+ *
4
+ * It throws SYNCHRONOUSLY, because a facet may carry synchronous methods (`subjects.identify`) and a
5
+ * rejected promise would hand those a value of the wrong type; an awaited call rejects the same way
6
+ * either way. Caller code turns the refusal into a fallback, exactly as for any other unsupported
7
+ * operation.
8
+ */
9
+ export declare const unsupportedFacet: <T extends object>(what: string) => T;
10
+ //# sourceMappingURL=facet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../src/facet.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,QAAQ,MAAM,KAAG,CAK9D,CAAA"}
package/build/facet.js ADDED
@@ -0,0 +1,16 @@
1
+ import { IamUnsupported } from './errors.js';
2
+ import { INERT_KEYS } from './consts.local.js';
3
+ /**
4
+ * A facet a backend cannot provide: every method throws `IamUnsupported(what)`.
5
+ *
6
+ * It throws SYNCHRONOUSLY, because a facet may carry synchronous methods (`subjects.identify`) and a
7
+ * rejected promise would hand those a value of the wrong type; an awaited call rejects the same way
8
+ * either way. Caller code turns the refusal into a fallback, exactly as for any other unsupported
9
+ * operation.
10
+ */
11
+ export const unsupportedFacet = (what) => new Proxy(Object.freeze({}), {
12
+ get: (_, key) => typeof key === 'symbol' || INERT_KEYS.has(key)
13
+ ? undefined
14
+ : () => { throw new IamUnsupported(what); },
15
+ });
16
+ //# sourceMappingURL=facet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facet.js","sourceRoot":"","sources":["../src/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAmB,IAAY,EAAK,EAAE,CACpE,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAM,EAAE;IAChC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QAC7D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,cAAc,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;CAC7C,CAAC,CAAA"}
@@ -1,31 +1,6 @@
1
- import { GateParamSource } from '../consts.js';
2
- import type { GateResourceSelector, GateParamProblem, ParsedGateParam } from '../types.js';
3
- /**
4
- * Read the `@…` half of a gate param.
5
- *
6
- * Two forms, and the difference between them is deliberate:
7
- *
8
- * `@enquiryId` — bare. A FLAT key, searched in `params` then `query`. It is never split on
9
- * a dot, because a query key legally contains one and splitting it would
10
- * change the meaning of selectors already deployed.
11
- * `@body:order.id` — qualified. An explicit source and a nested path.
12
- *
13
- * The rule worth remembering: the bare form is lenient and flat, the qualified form is strict and
14
- * nested.
15
- */
16
- export declare const parseGateSelector: (selector: string) => GateResourceSelector | GateParamProblem;
17
- /**
18
- * Split a gate param into the permission it checks and where the resource id comes from.
19
- *
20
- * Splits at the FIRST `@`. Everything before it is the permission name looked up in the subject's
21
- * grants; everything after says where to read the resource id at request time. The suffix is the
22
- * gate's syntax and nothing else's — a permission stored or granted under a name containing one is a
23
- * key nothing ever looks up.
24
- */
1
+ import type { GateParamHelper, ParsedGateParam } from './types.js';
2
+ export declare const createGateParamHelper: () => GateParamHelper;
3
+ export declare const gateParamHelper: GateParamHelper;
4
+ /** @deprecated compat:factory-refactor — use `gateParamHelper.parseGateParam(…)` */
25
5
  export declare const parseGateParam: (param: string) => ParsedGateParam;
26
- /** Compose a gate param. The inverse of `parseGateParam` for every selector it accepts. */
27
- export declare const formatGateParam: (permission: string, selector?: string | {
28
- source?: GateParamSource;
29
- path: string[];
30
- }) => string;
31
6
  //# sourceMappingURL=param.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/gate/param.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG1F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,aAAc,MAAM,KAAG,oBAAoB,GAAG,gBA6C3E,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,eAoB9C,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,eAAe,eACd,MAAM,aACP,MAAM,GAAG;IAAE,MAAM,CAAC,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,KAC/D,MAmBF,CAAA"}
1
+ {"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/gate/param.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAA0C,eAAe,EAAE,MAAM,YAAY,CAAA;AAG1G,eAAO,MAAM,qBAAqB,QAAO,eA+FxC,CAAA;AAED,eAAO,MAAM,eAAe,iBAA0B,CAAA;AAEtD,oFAAoF;AACpF,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,eAAwD,CAAA"}
@@ -1,99 +1,83 @@
1
1
  import { RESOURCE_PARAM_SEPARATOR, RESOURCE_SOURCE_SEPARATOR, RESOURCE_PATH_SEPARATOR, GateParamErrorCode, DEFAULT_GATE_PARAM_SOURCES } from '../consts.js';
2
2
  import { SOURCES } from './consts.local.js';
3
- /**
4
- * Read the `@…` half of a gate param.
5
- *
6
- * Two forms, and the difference between them is deliberate:
7
- *
8
- * `@enquiryId` — bare. A FLAT key, searched in `params` then `query`. It is never split on
9
- * a dot, because a query key legally contains one and splitting it would
10
- * change the meaning of selectors already deployed.
11
- * `@body:order.id` — qualified. An explicit source and a nested path.
12
- *
13
- * The rule worth remembering: the bare form is lenient and flat, the qualified form is strict and
14
- * nested.
15
- */
16
- export const parseGateSelector = (selector) => {
17
- if (selector === '') {
18
- return { code: GateParamErrorCode.EmptySelector, detail: 'the selector after "@" is empty' };
19
- }
20
- const idx = selector.indexOf(RESOURCE_SOURCE_SEPARATOR);
21
- if (idx < 0) {
3
+ export const createGateParamHelper = () => {
4
+ const parseGateSelector = (selector) => {
5
+ if (selector === '') {
6
+ return { code: GateParamErrorCode.EmptySelector, detail: 'the selector after "@" is empty' };
7
+ }
8
+ const idx = selector.indexOf(RESOURCE_SOURCE_SEPARATOR);
9
+ if (idx < 0) {
10
+ return {
11
+ selector,
12
+ path: [selector],
13
+ sources: DEFAULT_GATE_PARAM_SOURCES
14
+ };
15
+ }
16
+ const source = selector.slice(0, idx);
17
+ const rest = selector.slice(idx + 1);
18
+ if (!SOURCES.includes(source)) {
19
+ return {
20
+ code: GateParamErrorCode.UnknownSource,
21
+ detail: `"${source}" is not one of ${SOURCES.join(', ')}`
22
+ };
23
+ }
24
+ if (rest === '') {
25
+ return {
26
+ code: GateParamErrorCode.EmptySelector,
27
+ detail: `"${source}:" names no path`
28
+ };
29
+ }
30
+ const path = rest.split(RESOURCE_PATH_SEPARATOR);
31
+ if (path.some(segment => segment === '')) {
32
+ return {
33
+ code: GateParamErrorCode.EmptySegment,
34
+ detail: `"${rest}" has an empty path segment`
35
+ };
36
+ }
22
37
  return {
23
38
  selector,
24
- path: [selector],
25
- sources: DEFAULT_GATE_PARAM_SOURCES
39
+ source: source,
40
+ path,
41
+ sources: [source]
26
42
  };
27
- }
28
- const source = selector.slice(0, idx);
29
- const rest = selector.slice(idx + 1);
30
- if (!SOURCES.includes(source)) {
31
- return {
32
- code: GateParamErrorCode.UnknownSource,
33
- detail: `"${source}" is not one of ${SOURCES.join(', ')}`
34
- };
35
- }
36
- if (rest === '') {
37
- return {
38
- code: GateParamErrorCode.EmptySelector,
39
- detail: `"${source}:" names no path`
40
- };
41
- }
42
- const path = rest.split(RESOURCE_PATH_SEPARATOR);
43
- if (path.some(segment => segment === '')) {
43
+ };
44
+ const parseGateParam = (param) => {
45
+ const idx = param.indexOf(RESOURCE_PARAM_SEPARATOR);
46
+ if (idx < 0) {
47
+ return { permission: param };
48
+ }
49
+ const permission = param.slice(0, idx);
50
+ const selector = param.slice(idx + 1);
51
+ const parsed = parseGateSelector(selector);
52
+ if ('code' in parsed) {
53
+ return { permission, resourceParam: selector, error: parsed };
54
+ }
44
55
  return {
45
- code: GateParamErrorCode.EmptySegment,
46
- detail: `"${rest}" has an empty path segment`
56
+ permission,
57
+ // Kept for readers written against the flat form. Only meaningful when the form IS flat.
58
+ ...(parsed.source == null ? { resourceParam: selector } : {}),
59
+ resource: parsed
47
60
  };
48
- }
49
- return {
50
- selector,
51
- source: source,
52
- path,
53
- sources: [source]
54
61
  };
55
- };
56
- /**
57
- * Split a gate param into the permission it checks and where the resource id comes from.
58
- *
59
- * Splits at the FIRST `@`. Everything before it is the permission name looked up in the subject's
60
- * grants; everything after says where to read the resource id at request time. The suffix is the
61
- * gate's syntax and nothing else's — a permission stored or granted under a name containing one is a
62
- * key nothing ever looks up.
63
- */
64
- export const parseGateParam = (param) => {
65
- const idx = param.indexOf(RESOURCE_PARAM_SEPARATOR);
66
- if (idx < 0) {
67
- return { permission: param };
68
- }
69
- const permission = param.slice(0, idx);
70
- const selector = param.slice(idx + 1);
71
- const parsed = parseGateSelector(selector);
72
- if ('code' in parsed) {
73
- return { permission, resourceParam: selector, error: parsed };
74
- }
75
- return {
76
- permission,
77
- // Kept for readers written against the flat form. Only meaningful when the form IS flat.
78
- ...(parsed.source == null ? { resourceParam: selector } : {}),
79
- resource: parsed
62
+ const formatGateParam = (permission, selector) => {
63
+ if (selector == null) {
64
+ return permission;
65
+ }
66
+ if (typeof selector === 'string') {
67
+ return selector === '' ? permission : `${permission}${RESOURCE_PARAM_SEPARATOR}${selector}`;
68
+ }
69
+ if (selector.path.length < 1) {
70
+ return permission;
71
+ }
72
+ const path = selector.path.join(RESOURCE_PATH_SEPARATOR);
73
+ const tail = selector.source == null
74
+ ? path
75
+ : `${selector.source}${RESOURCE_SOURCE_SEPARATOR}${path}`;
76
+ return `${permission}${RESOURCE_PARAM_SEPARATOR}${tail}`;
80
77
  };
78
+ return { parseGateSelector, parseGateParam, formatGateParam };
81
79
  };
82
- /** Compose a gate param. The inverse of `parseGateParam` for every selector it accepts. */
83
- export const formatGateParam = (permission, selector) => {
84
- if (selector == null) {
85
- return permission;
86
- }
87
- if (typeof selector === 'string') {
88
- return selector === '' ? permission : `${permission}${RESOURCE_PARAM_SEPARATOR}${selector}`;
89
- }
90
- if (selector.path.length < 1) {
91
- return permission;
92
- }
93
- const path = selector.path.join(RESOURCE_PATH_SEPARATOR);
94
- const tail = selector.source == null
95
- ? path
96
- : `${selector.source}${RESOURCE_SOURCE_SEPARATOR}${path}`;
97
- return `${permission}${RESOURCE_PARAM_SEPARATOR}${tail}`;
98
- };
80
+ export const gateParamHelper = createGateParamHelper();
81
+ /** @deprecated compat:factory-refactor — use `gateParamHelper.parseGateParam(…)` */
82
+ export const parseGateParam = (param) => gateParamHelper.parseGateParam(param);
99
83
  //# sourceMappingURL=param.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"param.js","sourceRoot":"","sources":["../../src/gate/param.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAAE,yBAAyB,EAAE,uBAAuB,EAC3D,kBAAkB,EAAE,0BAA0B,EAChE,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAA2C,EAAE;IAC7F,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,EAAE,IAAI,EAAE,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAA;IAC9F,CAAC;IAED,M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,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { GateRequestLike, GateResourceSelector, GateResourceResolution } from '../types.js';
1
+ import type { GateRequestLike, GateResourceSelector, GateResourceResolution } from './types.js';
2
2
  /**
3
3
  * Resolve the resource id a selector points at.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/gate/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AA4EhG;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QACzB,eAAe,YAAY,oBAAoB,KACnD,sBA2BF,CAAA"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/gate/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AA4E/F;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QACzB,eAAe,YAAY,oBAAoB,KACnD,sBA2BF,CAAA"}
@@ -0,0 +1,109 @@
1
+ import type { GateParamSource, GateParamErrorCode, GateResolutionFailure } from '../consts.js';
2
+ /**
3
+ * The parts of a request a gate selector may read.
4
+ *
5
+ * Structural on purpose: `AbstractRequest` is assignable to it, so `@owlmeans/server-iam` passes its
6
+ * request straight through, while tooling outside the server stack can resolve a selector against a
7
+ * plain object without taking a dependency on `@owlmeans/entrypoint`.
8
+ */
9
+ export interface GateRequestLike {
10
+ params?: unknown;
11
+ query?: unknown;
12
+ body?: unknown;
13
+ headers?: unknown;
14
+ auth?: unknown;
15
+ }
16
+ /** Where one gate param reads its resource id from. */
17
+ export interface GateResourceSelector {
18
+ /** The selector text exactly as written, for diagnostics. */
19
+ readonly selector: string;
20
+ /** Undefined for the bare form, which searches `sources` in order. */
21
+ readonly source?: GateParamSource;
22
+ /** Length 1 and UNSPLIT for the bare form — a bare key may legally contain dots. */
23
+ readonly path: string[];
24
+ /** The explicit source, or `DEFAULT_GATE_PARAM_SOURCES`. */
25
+ readonly sources: GateParamSource[];
26
+ }
27
+ export interface GateParamProblem {
28
+ code: GateParamErrorCode;
29
+ detail: string;
30
+ }
31
+ export interface ParsedGateParam {
32
+ permission: string;
33
+ /**
34
+ * @deprecated The bare-form flat key, kept so existing readers keep compiling. Read `resource`,
35
+ * which carries the source and the path for both forms.
36
+ */
37
+ resourceParam?: string;
38
+ resource?: GateResourceSelector;
39
+ error?: GateParamProblem;
40
+ }
41
+ export interface GateResourceResolution {
42
+ id?: string;
43
+ from?: GateParamSource;
44
+ reason?: GateResolutionFailure;
45
+ }
46
+ /** What an entrypoint declares, so a selector can be checked against it before it is ever deployed. */
47
+ export interface GateParamAudit {
48
+ routePath?: string;
49
+ routeParams?: string[];
50
+ filter?: {
51
+ query?: object;
52
+ params?: object;
53
+ body?: object;
54
+ headers?: object;
55
+ };
56
+ }
57
+ export interface GateParamIssue {
58
+ param: string;
59
+ code: GateParamErrorCode;
60
+ detail: string;
61
+ }
62
+ /** The gate-param grammar: `<permission>@<selector>` read, written and taken apart. */
63
+ export interface GateParamHelper {
64
+ /**
65
+ * Read the `@…` half of a gate param.
66
+ *
67
+ * Two forms, and the difference between them is deliberate:
68
+ *
69
+ * `@enquiryId` — bare. A FLAT key, searched in `params` then `query`. It is never split on
70
+ * a dot, because a query key legally contains one and splitting it would
71
+ * change the meaning of selectors already deployed.
72
+ * `@body:order.id` — qualified. An explicit source and a nested path.
73
+ *
74
+ * The rule worth remembering: the bare form is lenient and flat, the qualified form is strict and
75
+ * nested.
76
+ */
77
+ parseGateSelector: (selector: string) => GateResourceSelector | GateParamProblem;
78
+ /**
79
+ * Split a gate param into the permission it checks and where the resource id comes from.
80
+ *
81
+ * Splits at the FIRST `@`. Everything before it is the permission name looked up in the subject's
82
+ * grants; everything after says where to read the resource id at request time. The suffix is the
83
+ * gate's syntax and nothing else's — a permission stored or granted under a name containing one is a
84
+ * key nothing ever looks up.
85
+ */
86
+ parseGateParam: (param: string) => ParsedGateParam;
87
+ /** Compose a gate param. The inverse of `parseGateParam` for every selector it accepts. */
88
+ formatGateParam: (permission: string, selector?: string | {
89
+ source?: GateParamSource;
90
+ path: string[];
91
+ }) => string;
92
+ }
93
+ /** Gate params checked against the entrypoint that declares them. */
94
+ export interface GateValidationHelper {
95
+ /** The `:name` segments of a route template. */
96
+ routeParamsOf: (path: string) => string[];
97
+ /**
98
+ * Check gate params against what their entrypoint declares.
99
+ *
100
+ * Reports only what is provable from the declaration itself. Anything that would need a guess is
101
+ * left alone: a check that fires on correct code stops being read.
102
+ *
103
+ * Meant to run where a mistake can still be fixed — while code is being generated, or once per alias
104
+ * as a diagnostic. It must never decide a request: with `some()` semantics across params, one
105
+ * malformed sibling must not be able to refuse a legitimately passing one.
106
+ */
107
+ validateGateParams: (params: string[], audit?: GateParamAudit) => GateParamIssue[];
108
+ }
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gate/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAE9F;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;IACjC,oFAAoF;IACpF,QAAQ,CAA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AQ,CAAC,EAAE,MAAM,GAAG;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,KAC7D,MAAM,CAAA;CACZ;AAED,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAA;IACzC;;;;;;;;;OASG;IACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,cAAc,KAAK,cAAc,EAAE,CAAA;CACnF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/gate/types.ts"],"names":[],"mappings":""}
@@ -1,15 +1,4 @@
1
- import type { GateParamAudit, GateParamIssue } from '../types.js';
2
- /** The `:name` segments of a route template. */
3
- export declare const routeParamsOf: (path: string) => string[];
4
- /**
5
- * Check gate params against what their entrypoint declares.
6
- *
7
- * Reports only what is provable from the declaration itself. Anything that would need a guess is
8
- * left alone: a check that fires on correct code stops being read.
9
- *
10
- * Meant to run where a mistake can still be fixed — while code is being generated, or once per alias
11
- * as a diagnostic. It must never decide a request: with `some()` semantics across params, one
12
- * malformed sibling must not be able to refuse a legitimately passing one.
13
- */
14
- export declare const validateGateParams: (params: string[], audit?: GateParamAudit) => GateParamIssue[];
1
+ import type { GateValidationHelper } from './types.js';
2
+ export declare const createGateValidationHelper: () => GateValidationHelper;
3
+ export declare const gateValidationHelper: GateValidationHelper;
15
4
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/gate/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AAIvF,gDAAgD;AAChD,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,MAAM,EAGH,CAAA;AAqFhD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,WAAY,MAAM,EAAE,UAAU,cAAc,KAAG,cAAc,EAsB3F,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/gate/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwD,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAI5G,eAAO,MAAM,0BAA0B,QAAO,oBAkH7C,CAAA;AAED,eAAO,MAAM,oBAAoB,sBAA+B,CAAA"}