@nmnmcc/ability 1.0.1 → 2.0.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.
Files changed (127) hide show
  1. package/README.md +112 -69
  2. package/dist/Authorizer.d.ts +43 -47
  3. package/dist/Authorizer.d.ts.map +1 -1
  4. package/dist/Authorizer.js +5 -290
  5. package/dist/Authorizer.js.map +1 -1
  6. package/dist/Condition.d.ts +164 -332
  7. package/dist/Condition.d.ts.map +1 -1
  8. package/dist/Condition.js +75 -890
  9. package/dist/Condition.js.map +1 -1
  10. package/dist/Decision.d.ts +13 -13
  11. package/dist/Decision.d.ts.map +1 -1
  12. package/dist/Decision.js.map +1 -1
  13. package/dist/Domain.d.ts +10 -21
  14. package/dist/Domain.d.ts.map +1 -1
  15. package/dist/Domain.js +4 -62
  16. package/dist/Domain.js.map +1 -1
  17. package/dist/HttpApi.d.ts +31 -7
  18. package/dist/HttpApi.d.ts.map +1 -1
  19. package/dist/HttpApi.js +25 -8
  20. package/dist/HttpApi.js.map +1 -1
  21. package/dist/Limits.d.ts +114 -0
  22. package/dist/Limits.d.ts.map +1 -0
  23. package/dist/Limits.js +132 -0
  24. package/dist/Limits.js.map +1 -0
  25. package/dist/Policy.d.ts +271 -269
  26. package/dist/Policy.d.ts.map +1 -1
  27. package/dist/Policy.js +68 -1177
  28. package/dist/Policy.js.map +1 -1
  29. package/dist/Resource.d.ts +4 -177
  30. package/dist/Resource.d.ts.map +1 -1
  31. package/dist/Resource.js +4 -803
  32. package/dist/Resource.js.map +1 -1
  33. package/dist/index.d.ts +3 -4
  34. package/dist/index.js +4 -5
  35. package/dist/internal/algebra.js +267 -0
  36. package/dist/internal/algebra.js.map +1 -0
  37. package/dist/internal/analysis.js +245 -0
  38. package/dist/internal/analysis.js.map +1 -0
  39. package/dist/internal/authorizer.d.ts +30 -0
  40. package/dist/internal/authorizer.d.ts.map +1 -0
  41. package/dist/internal/authorizer.js +221 -0
  42. package/dist/internal/authorizer.js.map +1 -0
  43. package/dist/internal/bind.js +286 -0
  44. package/dist/internal/bind.js.map +1 -0
  45. package/dist/internal/catalog.d.ts +56 -0
  46. package/dist/internal/catalog.d.ts.map +1 -0
  47. package/dist/internal/catalog.js +292 -0
  48. package/dist/internal/catalog.js.map +1 -0
  49. package/dist/internal/decide.js +166 -0
  50. package/dist/internal/decide.js.map +1 -0
  51. package/dist/internal/domain.js +32 -0
  52. package/dist/internal/domain.js.map +1 -0
  53. package/dist/internal/json.js +134 -0
  54. package/dist/internal/json.js.map +1 -0
  55. package/dist/internal/limits.d.ts +14 -0
  56. package/dist/internal/limits.d.ts.map +1 -0
  57. package/dist/internal/limits.js +43 -0
  58. package/dist/internal/limits.js.map +1 -0
  59. package/dist/internal/nodes.d.ts +121 -0
  60. package/dist/internal/nodes.d.ts.map +1 -0
  61. package/dist/internal/nodes.js +277 -0
  62. package/dist/internal/nodes.js.map +1 -0
  63. package/dist/internal/patterns.js +110 -0
  64. package/dist/internal/patterns.js.map +1 -0
  65. package/dist/internal/policy-json.js +255 -0
  66. package/dist/internal/policy-json.js.map +1 -0
  67. package/dist/internal/policy-nodes.d.ts +61 -0
  68. package/dist/internal/policy-nodes.d.ts.map +1 -0
  69. package/dist/internal/policy-nodes.js +146 -0
  70. package/dist/internal/policy-nodes.js.map +1 -0
  71. package/dist/internal/policy.d.ts +42 -0
  72. package/dist/internal/policy.d.ts.map +1 -0
  73. package/dist/internal/policy.js +124 -0
  74. package/dist/internal/policy.js.map +1 -0
  75. package/dist/internal/read.js +39 -0
  76. package/dist/internal/read.js.map +1 -0
  77. package/dist/internal/resource.js +115 -0
  78. package/dist/internal/resource.js.map +1 -0
  79. package/dist/internal/rule.d.ts +26 -0
  80. package/dist/internal/rule.d.ts.map +1 -0
  81. package/dist/internal/rule.js +93 -0
  82. package/dist/internal/rule.js.map +1 -0
  83. package/dist/internal/search.d.ts +22 -0
  84. package/dist/internal/search.d.ts.map +1 -0
  85. package/dist/internal/search.js +274 -0
  86. package/dist/internal/search.js.map +1 -0
  87. package/dist/internal/suggest.js +46 -0
  88. package/dist/internal/suggest.js.map +1 -0
  89. package/package.json +3 -4
  90. package/src/Authorizer.ts +67 -583
  91. package/src/Condition.ts +339 -2095
  92. package/src/Decision.ts +6 -5
  93. package/src/Domain.ts +12 -69
  94. package/src/HttpApi.ts +72 -10
  95. package/src/Limits.ts +132 -0
  96. package/src/Policy.ts +386 -2772
  97. package/src/Resource.ts +7 -1548
  98. package/src/index.ts +3 -9
  99. package/src/internal/algebra.ts +482 -0
  100. package/src/internal/analysis.ts +478 -0
  101. package/src/internal/authorizer.ts +418 -0
  102. package/src/internal/bind.ts +596 -0
  103. package/src/internal/catalog.ts +534 -0
  104. package/src/internal/decide.ts +402 -0
  105. package/src/internal/domain.ts +66 -0
  106. package/src/internal/json.ts +260 -0
  107. package/src/internal/limits.ts +78 -0
  108. package/src/internal/nodes.ts +404 -0
  109. package/src/internal/patterns.ts +211 -0
  110. package/src/internal/policy-json.ts +484 -0
  111. package/src/internal/policy-nodes.ts +207 -0
  112. package/src/internal/policy.ts +264 -0
  113. package/src/internal/read.ts +55 -0
  114. package/src/internal/resource.ts +180 -0
  115. package/src/internal/rule.ts +181 -0
  116. package/src/internal/search.ts +541 -0
  117. package/src/internal/suggest.ts +104 -0
  118. package/dist/Principal.d.ts +0 -35
  119. package/dist/Principal.d.ts.map +0 -1
  120. package/dist/Principal.js +0 -37
  121. package/dist/Principal.js.map +0 -1
  122. package/dist/Rule.d.ts +0 -275
  123. package/dist/Rule.d.ts.map +0 -1
  124. package/dist/Rule.js +0 -257
  125. package/dist/Rule.js.map +0 -1
  126. package/src/Principal.ts +0 -41
  127. package/src/Rule.ts +0 -683
package/dist/Policy.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { Descriptor } from "./Resource.js";
2
- import { Builder, Condition, Encoded, Example, FieldSelector, Reads, Variance } from "./Condition.js";
3
- import { ActionOf, Any as Any$1, DataOf, Kind, Principal, ValueOf } from "./Domain.js";
4
- import { Any as Any$2, Builder as Builder$1, Error as Error$1, OpaqueOf as OpaqueOf$1, Rule, Services as Services$1 } from "./Rule.js";
1
+ import { Kind } from "./Resource.js";
2
+ import { Any as Any$1, Builder as Builder$1, Condition, Encoded, ErrorOf, Example, FieldName, FieldSelector, OpaqueOf as OpaqueOf$1, Provided, Reads, ReadsOf, ServicesOf } from "./Condition.js";
3
+ import { ActionOf, Any as Any$2, AnyAction, AnyValue, CommonAction, DataOf, Kind as Kind$1, Meta, Principal, Resources, ValueOf } from "./Domain.js";
4
+ import { All, Any as Any$3, Ceiling, FirstOf, Node as Node$1, Rules } from "./internal/policy-nodes.js";
5
+ import { PolicyData, PolicyError as PolicyError$1 } from "./internal/policy.js";
5
6
  import { Decision } from "./Decision.js";
6
7
  import * as Context from "effect/Context";
7
8
  import * as Effect from "effect/Effect";
@@ -9,7 +10,7 @@ import * as Schema from "effect/Schema";
9
10
  import * as Data from "effect/Data";
10
11
  import * as Pipeable from "effect/Pipeable";
11
12
  declare namespace Policy_d_exports {
12
- export { Algorithm, AllNode, Any, AnyKindRequest, AnyNode, AnyRequest, CeilingNode, Coverage, DomainOf, EncodedNode, EncodedRule, Error, Explanation, FieldlessRequest, FieldlessTarget, FirstOfNode, KindRequest, KindTarget, Node, OpaqueOf, Options, Policy, Request, ResidualReads, Residuals, RulesNode, Scope, Services, Step, Target, TypedNode, all, any, ceiling, coverage, decide, decideSync, define, empty, explain, firstOf, fitsKind, isPolicy, permittedFields, provideContext, residual, residuals, rules, schema, scopeHasValue, scopeIsEmpty };
13
+ export { ActionFor, ActionForTargets, Algorithm, AllNode, Any, AnyNode, AnyRequest, AnyRule, Builder, CeilingNode, ConditionFor, Coverage, DataFor, DomainOf, EncodedNode, EncodedRule, Explanation, FieldFor, FieldlessRequest, FieldlessTarget, FirstOfNode, KindOf, KindRequest, KindTarget, Node, OpaqueOf, Options, Policy, PolicyError, Request, ResidualReads, Rule, RuleOptions, RuleShape, RuleTarget, RulesNode, Scope, Step, Target, TargetOf, ValueFor, all, any, builder, ceiling, coverage, decide, decideSync, define, explain, firstOf, permittedFields, provideContext, residual, rule, schema };
13
14
  }
14
15
  /**
15
16
  * @stability stable
@@ -18,102 +19,56 @@ declare namespace Policy_d_exports {
18
19
  */
19
20
  export type Algorithm = "denyOverrides" | "permitOverrides" | "firstApplicable" | "lastApplicable";
20
21
  /**
22
+ * A list of rules with a combining algorithm.
23
+ *
21
24
  * @stability stable
22
25
  * @category models
23
26
  * @since 0.3.0
24
27
  */
25
- export interface RulesNode {
26
- readonly _tag: "Rules";
27
- readonly algorithm: Algorithm;
28
- readonly rules: ReadonlyArray<Any$2>;
29
- }
28
+ export type RulesNode = Rules;
30
29
  /**
31
30
  * @stability stable
32
31
  * @category models
33
32
  * @since 0.3.0
34
33
  */
35
- export interface AllNode {
36
- readonly _tag: "All";
37
- readonly policies: ReadonlyArray<Node>;
38
- }
34
+ export type AllNode = All;
39
35
  /**
40
36
  * @stability stable
41
37
  * @category models
42
38
  * @since 0.3.0
43
39
  */
44
- export interface AnyNode {
45
- readonly _tag: "Any";
46
- readonly policies: ReadonlyArray<Node>;
47
- }
40
+ export type AnyNode = Any$3;
48
41
  /**
49
42
  * @stability stable
50
43
  * @category models
51
44
  * @since 0.3.0
52
45
  */
53
- export interface FirstOfNode {
54
- readonly _tag: "FirstOf";
55
- readonly policies: ReadonlyArray<Node>;
56
- }
46
+ export type FirstOfNode = FirstOf;
57
47
  /**
58
48
  * @stability stable
59
49
  * @category models
60
50
  * @since 0.3.0
61
51
  */
62
- export interface CeilingNode {
63
- readonly _tag: "Ceiling";
64
- readonly cap: Node;
65
- readonly policy: Node;
66
- }
52
+ export type CeilingNode = Ceiling;
67
53
  /**
68
- * The nodes of a policy tree.
54
+ * The nodes of a policy tree, without types. Each node is a class, and only
55
+ * the functions of this module and the Schema make one.
69
56
  *
70
57
  * @stability stable
71
58
  * @category models
72
59
  * @since 0.3.0
73
60
  */
74
- export type Node = RulesNode | AllNode | AnyNode | FirstOfNode | CeilingNode;
61
+ export type Node = Node$1;
75
62
  /**
76
- * The tree of a policy with the types of its predicates and its domain `D`.
77
- * Each rule and each child has the types too, and `"~Node"` is only in the types. A node made by
78
- * hand does not have it. So the node of one policy, or a part of it, can not
79
- * go into a policy with other types.
80
- *
81
- * @stability stable
82
- * @category models
83
- * @since 1.0.0
84
- */
85
- export type TypedNode<E = never, R = never, O = never, D = any> = ({
86
- readonly _tag: "Rules";
87
- readonly algorithm: Algorithm;
88
- readonly rules: ReadonlyArray<Rule<E, R, O, D, never>>;
89
- } | {
90
- readonly _tag: "All" | "Any" | "FirstOf";
91
- readonly policies: ReadonlyArray<TypedNode<E, R, O, D>>;
92
- } | {
93
- readonly _tag: "Ceiling";
94
- readonly cap: TypedNode<E, R, O, D>;
95
- readonly policy: TypedNode<E, R, O, D>;
96
- }) & {
97
- readonly "~Node": Variance<E, R, O>;
98
- };
99
- /**
100
- * A policy for the domain `D`. `E`, `R` and `O` come from the conditions of
101
- * its rules. See `Condition.Condition`.
63
+ * A policy for the domain `D`. `X` is `Condition.Opaque` when a rule of the
64
+ * policy has a predicate, and `never` when the policy is plain data. A plain
65
+ * policy can become JSON, and `decideSync` takes it.
102
66
  *
103
67
  * @stability stable
104
68
  * @category models
105
69
  * @since 0.3.0
106
70
  */
107
- export interface Policy<D extends Any$1, E = never, R = never, O = never> extends Pipeable.Pipeable {
108
- readonly domain: D;
109
- readonly node: TypedNode<E, R, O, D>;
110
- readonly "~Policy": Variance<E, R, O>;
111
- /**
112
- * Only in the types. A policy reads the values and the principal of its
113
- * domain, so a policy of one domain is not a policy of a wider domain.
114
- */
115
- readonly "~Domain": (domain: D) => D;
116
- }
71
+ export type Policy<D extends Any$2, X = never> = PolicyData<D, X>;
117
72
  /**
118
73
  * Any policy.
119
74
  *
@@ -121,7 +76,7 @@ export interface Policy<D extends Any$1, E = never, R = never, O = never> extend
121
76
  * @category models
122
77
  * @since 0.3.0
123
78
  */
124
- export type Any = Policy<any, any, any, any>;
79
+ export type Any = Policy<any, any>;
125
80
  /**
126
81
  * The domain of a policy.
127
82
  *
@@ -129,37 +84,17 @@ export type Any = Policy<any, any, any, any>;
129
84
  * @category utility types
130
85
  * @since 0.3.0
131
86
  */
132
- export type DomainOf<P> = P extends Policy<infer D, any, any, any> ? D : never;
87
+ export type DomainOf<P> = P extends Policy<infer D, any> ? D : never;
133
88
  /**
134
- * The error type of a policy.
135
- *
136
- * @stability stable
137
- * @category utility types
138
- * @since 0.3.0
139
- */
140
- export type Error<P> = P extends {
141
- readonly "~Policy"?: Variance<infer E, infer _R, infer _O>;
142
- } ? E : never;
143
- /**
144
- * The service type of a policy.
145
- *
146
- * @stability stable
147
- * @category utility types
148
- * @since 0.3.0
149
- */
150
- export type Services<P> = P extends {
151
- readonly "~Policy"?: Variance<infer _E, infer R, infer _O>;
152
- } ? R : never;
153
- /**
154
- * `Condition.Opaque` when a policy has a predicate.
89
+ * The mark of a policy or a rule: `Condition.Opaque` when it has a predicate.
155
90
  *
156
91
  * @stability stable
157
92
  * @category utility types
158
93
  * @since 0.3.0
159
94
  */
160
95
  export type OpaqueOf<P> = P extends {
161
- readonly "~Policy"?: Variance<infer _E, infer _R, infer O>;
162
- } ? O : never;
96
+ readonly "~Opaque": () => infer X;
97
+ } ? X : never;
163
98
  /**
164
99
  * One act on one resource value, for each kind of the domain. The action must
165
100
  * be an action of the kind, and the field must be a field of the kind.
@@ -168,13 +103,13 @@ export type OpaqueOf<P> = P extends {
168
103
  * @category models
169
104
  * @since 0.3.0
170
105
  */
171
- export type Target<D> = { [K in Kind<D>]: {
106
+ export type Target<D> = { [K in Kind$1<D>]: {
172
107
  readonly action: ActionOf<D, K>;
173
108
  readonly resource: ValueOf<D, K>;
174
109
  readonly field?: FieldSelector<DataOf<D, K>>;
175
110
  /** A target has a resource value or a kind, never both. */
176
111
  readonly kind?: never;
177
- }; }[Kind<D>];
112
+ }; }[Kind$1<D>];
178
113
  /**
179
114
  * A {@link Target} with no field. Each kind keeps its own actions.
180
115
  *
@@ -182,11 +117,11 @@ export type Target<D> = { [K in Kind<D>]: {
182
117
  * @category models
183
118
  * @since 0.3.0
184
119
  */
185
- export type FieldlessTarget<D> = { [K in Kind<D>]: {
120
+ export type FieldlessTarget<D> = { [K in Kind$1<D>]: {
186
121
  readonly action: ActionOf<D, K>;
187
122
  readonly resource: ValueOf<D, K>;
188
123
  readonly kind?: never;
189
- }; }[Kind<D>];
124
+ }; }[Kind$1<D>];
190
125
  /**
191
126
  * A scope: a part of a kind, as a condition on its values. It gets a builder
192
127
  * with the types of the kind and of the principal, like the condition of a
@@ -196,7 +131,7 @@ export type FieldlessTarget<D> = { [K in Kind<D>]: {
196
131
  * @category models
197
132
  * @since 1.0.0
198
133
  */
199
- export type Scope<D, K extends string> = (builder: Builder<DataOf<D, K>, ValueOf<D, K>, Principal<D>>) => Condition<never, never, never, Reads<ValueOf<D, K>, Principal<D>>>;
134
+ export type Scope<D, K extends string> = (builder: Builder$1<DataOf<D, K>, ValueOf<D, K>, Principal<D>>) => Condition<Reads<ValueOf<D, K>, Principal<D>>>;
200
135
  /**
201
136
  * One act on one kind of resource, with no value. With `within`, the target is
202
137
  * only the values of the kind in the scope. Without it, the target is every
@@ -206,7 +141,7 @@ export type Scope<D, K extends string> = (builder: Builder<DataOf<D, K>, ValueOf
206
141
  * @category models
207
142
  * @since 0.3.0
208
143
  */
209
- export type KindTarget<D> = { [K in Kind<D>]: {
144
+ export type KindTarget<D> = { [K in Kind$1<D>]: {
210
145
  readonly action: ActionOf<D, K>;
211
146
  readonly kind: K;
212
147
  readonly field?: FieldSelector<DataOf<D, K>>;
@@ -214,7 +149,7 @@ export type KindTarget<D> = { [K in Kind<D>]: {
214
149
  readonly within?: Scope<D, K>;
215
150
  /** A target has a resource value or a kind, never both. */
216
151
  readonly resource?: never;
217
- }; }[Kind<D>];
152
+ }; }[Kind$1<D>];
218
153
  /**
219
154
  * A request: a principal, an action, and a resource value.
220
155
  *
@@ -268,7 +203,7 @@ export interface AnyRequest {
268
203
  */
269
204
  export interface Step {
270
205
  readonly path: ReadonlyArray<number>;
271
- readonly rule: Any$2;
206
+ readonly rule: AnyRule;
272
207
  readonly applies: boolean;
273
208
  }
274
209
  /**
@@ -283,6 +218,186 @@ export interface Explanation {
283
218
  readonly decision: Decision;
284
219
  readonly steps: ReadonlyArray<Step>;
285
220
  }
221
+ /**
222
+ * A rule for the domain `D`. `I` is what the tests of its condition read, and
223
+ * `X` is its mark: see `Condition.Condition`. A predicate reads the values and
224
+ * the principal of its domain, so a rule may go only into a policy of its own
225
+ * domain. A rule from {@link rule} has the domain `any`.
226
+ *
227
+ * @stability stable
228
+ * @category models
229
+ * @since 0.3.0
230
+ */
231
+ export interface Rule<D = any, I = unknown, X = never> extends RuleShape<I, X>, Pipeable.Pipeable {
232
+ readonly "~Opaque": () => X;
233
+ readonly "~Domain": (domain: D) => D;
234
+ [Symbol.iterator](): Generator<Rule<D, I, X>, Rule<D, I, X>, unknown>;
235
+ }
236
+ /**
237
+ * The data of a rule.
238
+ *
239
+ * @stability stable
240
+ * @category models
241
+ * @since 1.0.0
242
+ */
243
+ export interface RuleShape<I = unknown, X = never> {
244
+ readonly _tag: "Allow" | "Deny";
245
+ readonly actions: ReadonlyArray<string>;
246
+ readonly resources: ReadonlyArray<string>;
247
+ readonly when?: Condition<I, X>;
248
+ readonly fields?: ReadonlyArray<string>;
249
+ readonly reason?: string;
250
+ readonly id?: string;
251
+ readonly meta?: unknown;
252
+ /**
253
+ * The domain of the builder that made the rule. Two domains may have the
254
+ * same types but other paths, so the types can not tell them apart. It is
255
+ * not in the JSON form of a rule.
256
+ */
257
+ readonly domain?: Any$2;
258
+ }
259
+ /**
260
+ * Any rule.
261
+ *
262
+ * @stability stable
263
+ * @category models
264
+ * @since 0.3.0
265
+ */
266
+ export type AnyRule = Rule<any, never, any>;
267
+ /**
268
+ * A resource in a rule: a kind name, a resource of the domain, or `"*"`.
269
+ *
270
+ * @stability stable
271
+ * @category models
272
+ * @since 0.3.0
273
+ */
274
+ export type RuleTarget<D> = Kind$1<D> | Resources<D> | "*";
275
+ /**
276
+ * The kind name of a target.
277
+ *
278
+ * @stability stable
279
+ * @category utility types
280
+ * @since 0.3.0
281
+ */
282
+ export type KindOf<T> = T extends string ? T : Kind<T>;
283
+ /**
284
+ * The actions that a rule may use for the kinds `K`.
285
+ *
286
+ * @stability stable
287
+ * @category utility types
288
+ * @since 0.3.0
289
+ */
290
+ export type ActionFor<D, K> = "*" | ("*" extends K ? AnyAction<D> : ActionOf<D, Extract<K, string>>);
291
+ /**
292
+ * The targets in the resource argument of a rule: the one target, or the
293
+ * targets of a list.
294
+ *
295
+ * @stability stable
296
+ * @category utility types
297
+ * @since 1.0.0
298
+ */
299
+ export type TargetOf<Res> = Res extends ReadonlyArray<infer X> ? X : Res;
300
+ /**
301
+ * The actions that a rule may use for its resource argument. A list of
302
+ * resources may use an action of any of them. One target with a union type
303
+ * may use only an action of every kind in the union, because its value may be
304
+ * any one of them. When the argument may be a list or one target, the rule
305
+ * may use only an action that each of these shapes allows.
306
+ *
307
+ * @stability stable
308
+ * @category utility types
309
+ * @since 1.0.0
310
+ */
311
+ export type ActionForTargets<D, Res> = (Res extends ReadonlyArray<infer X> ? (action: ActionFor<D, KindOf<X>>) => void : (action: ActionForTarget<D, Res>) => void) extends ((action: infer A) => void) ? A : never;
312
+ /** The actions for one target that is not a list. */
313
+ type ActionForTarget<D, Res> = "*" | ("*" extends KindOf<Res> ? AnyAction<D> : CommonAction<D, Extract<KindOf<Res>, string>>);
314
+ /**
315
+ * The data type of the kinds `K`. For `"*"` it has no fields.
316
+ *
317
+ * @stability stable
318
+ * @category utility types
319
+ * @since 0.3.0
320
+ */
321
+ export type DataFor<D, K> = "*" extends K ? {} : DataOf<D, Extract<K, string>>;
322
+ /**
323
+ * The value type of the kinds `K`.
324
+ *
325
+ * @stability stable
326
+ * @category utility types
327
+ * @since 0.3.0
328
+ */
329
+ export type ValueFor<D, K> = "*" extends K ? AnyValue<D> : ValueOf<D, Extract<K, string>>;
330
+ /**
331
+ * A field name or a field pattern of the kinds `K`.
332
+ *
333
+ * @stability stable
334
+ * @category models
335
+ * @since 0.3.0
336
+ */
337
+ export type FieldFor<D, K> = FieldName<DataFor<D, K>> | `${string}*${string}`;
338
+ /**
339
+ * A condition that a rule for the kinds `K` may have. Its predicates may read
340
+ * only the values of these kinds and the principal of the domain.
341
+ *
342
+ * @stability stable
343
+ * @category models
344
+ * @since 1.0.0
345
+ */
346
+ export type ConditionFor<D, K> = Condition<Reads<ValueFor<D, K>, Principal<D>>, any>;
347
+ /**
348
+ * The options of a rule.
349
+ *
350
+ * @stability stable
351
+ * @category models
352
+ * @since 0.3.0
353
+ */
354
+ export interface RuleOptions<D, K, C extends Any$1> {
355
+ /** The condition. It gets a builder with the types of the resource. */
356
+ readonly when?: (builder: Builder$1<DataFor<D, K>, ValueFor<D, K>, Principal<D>>) => C;
357
+ readonly fields?: ReadonlyArray<FieldFor<D, K>>;
358
+ readonly reason?: string;
359
+ readonly id?: string;
360
+ readonly meta?: Meta<D>;
361
+ }
362
+ type SingleOrArray<A> = A | ReadonlyArray<A>;
363
+ /**
364
+ * Makes rules with the types of a domain.
365
+ *
366
+ * @stability stable
367
+ * @category models
368
+ * @since 0.3.0
369
+ */
370
+ export interface Builder<D> {
371
+ readonly allow: <const Res extends SingleOrArray<RuleTarget<D>>, const A extends ActionForTargets<D, Res>, const C extends ConditionFor<D, KindOf<TargetOf<Res>>> = Condition>(action: SingleOrArray<A>, resource: Res, options?: RuleOptions<D, KindOf<TargetOf<Res>>, C>) => Rule<D, ReadsOf<C>, OpaqueOf$1<C>>;
372
+ readonly deny: <const Res extends SingleOrArray<RuleTarget<D>>, const A extends ActionForTargets<D, Res>, const C extends ConditionFor<D, KindOf<TargetOf<Res>>> = Condition>(action: SingleOrArray<A>, resource: Res, options?: RuleOptions<D, KindOf<TargetOf<Res>>, C>) => Rule<D, ReadsOf<C>, OpaqueOf$1<C>>;
373
+ }
374
+ /**
375
+ * Makes rules with the types of a domain. `Policy.define` gives one to its
376
+ * generator. Use this one to make rules outside of a generator.
377
+ *
378
+ * @example
379
+ * ```ts
380
+ * const _ = Policy.builder(App)
381
+ * const rule = _.allow("read", Document, {
382
+ * when: ($) => $.eq("ownerId", $.principal("id")),
383
+ * })
384
+ * ```
385
+ *
386
+ * @stability stable
387
+ * @category constructors
388
+ * @since 2.0.0
389
+ */
390
+ export declare const builder: <D extends Any$2>(domain: D) => Builder<D>;
391
+ /**
392
+ * Makes a rule from its data, with no types. It does not check the data
393
+ * against a domain: a policy does that when the rule goes into it. Use
394
+ * {@link builder} for rules with types, or {@link schema} for rules from JSON.
395
+ *
396
+ * @stability stable
397
+ * @category constructors
398
+ * @since 2.0.0
399
+ */
400
+ export declare const rule: <I = unknown, X = never>(data: RuleShape<I, X>) => Rule<any, NoInfer<I>, NoInfer<X>>;
286
401
  /**
287
402
  * The options of a list of rules.
288
403
  *
@@ -295,13 +410,26 @@ export interface Options {
295
410
  readonly algorithm?: Algorithm;
296
411
  }
297
412
  /**
298
- * Makes a policy from a list of rules.
413
+ * The error when a rule does not fit its domain: it names a kind, an action,
414
+ * a field or a field of the principal that the domain does not have, or it
415
+ * tests a field with a value that the field can not hold. It has one issue
416
+ * for each problem, with its path, and a suggestion when a name has a mistake.
299
417
  *
300
418
  * @stability stable
301
- * @category constructors
302
- * @since 0.3.0
419
+ * @category errors
420
+ * @since 2.0.0
421
+ */
422
+ export declare const PolicyError: typeof PolicyError$1;
423
+ /**
424
+ * @stability stable
425
+ * @category errors
426
+ * @since 2.0.0
303
427
  */
304
- export declare const rules: <D extends Any$1, Rules extends Rule<any, any, any, D, never>>(domain: D, rules: Iterable<Rules>, options?: Options) => Policy<D, Error$1<Rules>, Services$1<Rules>, OpaqueOf$1<Rules>>;
428
+ export type PolicyError = PolicyError$1;
429
+ /** The mark of a union of rules: `Condition.Opaque` when one has a predicate. */
430
+ type RulesOpaque<Rules> = Rules extends {
431
+ readonly "~Opaque": () => infer X;
432
+ } ? X : never;
305
433
  /**
306
434
  * Makes a policy from a generator function that gives rules. It is pure and it
307
435
  * gives its result at once.
@@ -320,16 +448,8 @@ export declare const rules: <D extends Any$1, Rules extends Rule<any, any, any,
320
448
  * @category constructors
321
449
  * @since 0.3.0
322
450
  */
323
- export declare const define: <D extends Any$1>(domain: D, options?: Options) => <Rules extends Rule<any, any, any, D, never>, A>(body: (builder: Builder$1<D>) => Generator<Rules, A, unknown>) => Policy<D, Error$1<Rules>, Services$1<Rules>, OpaqueOf$1<Rules>>;
324
- /**
325
- * A policy with no rules. It is not applicable to any request.
326
- *
327
- * @stability stable
328
- * @category constructors
329
- * @since 0.3.0
330
- */
331
- export declare const empty: <D extends Any$1>(domain: D) => Policy<D>;
332
- type Combined<D extends Any$1, Ps extends ReadonlyArray<Any>> = Policy<D, Error<Ps[number]>, Services<Ps[number]>, OpaqueOf<Ps[number]>>;
451
+ export declare const define: <D extends Any$2>(domain: D, options?: Options) => <Rules extends Rule<D, never, any>, A>(body: (builder: Builder<D>) => Generator<Rules, A, unknown>) => Policy<D, RulesOpaque<Rules>>;
452
+ type Combined<D extends Any$2, Ps extends ReadonlyArray<Any>> = Policy<D, OpaqueOf<Ps[number]>>;
333
453
  /**
334
454
  * Every policy must allow, and one deny is enough to deny. With some policies
335
455
  * not applicable and none that deny, the result is not applicable.
@@ -338,7 +458,7 @@ type Combined<D extends Any$1, Ps extends ReadonlyArray<Any>> = Policy<D, Error<
338
458
  * @category combinators
339
459
  * @since 0.3.0
340
460
  */
341
- export declare const all: <const Ps extends readonly [Policy<any, any, any, any>, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
461
+ export declare const all: <const Ps extends readonly [Any, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
342
462
  /**
343
463
  * One allow is enough. Without an allow, one deny gives a deny.
344
464
  *
@@ -346,7 +466,7 @@ export declare const all: <const Ps extends readonly [Policy<any, any, any, any>
346
466
  * @category combinators
347
467
  * @since 0.3.0
348
468
  */
349
- export declare const any: <const Ps extends readonly [Policy<any, any, any, any>, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
469
+ export declare const any: <const Ps extends readonly [Any, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
350
470
  /**
351
471
  * The first policy that allows or denies gives the answer.
352
472
  *
@@ -354,7 +474,7 @@ export declare const any: <const Ps extends readonly [Policy<any, any, any, any>
354
474
  * @category combinators
355
475
  * @since 0.3.0
356
476
  */
357
- export declare const firstOf: <const Ps extends readonly [Policy<any, any, any, any>, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
477
+ export declare const firstOf: <const Ps extends readonly [Any, ...Array<Any>]>(policies: Ps) => Combined<DomainOf<Ps[0]>, Ps>;
358
478
  /**
359
479
  * Puts a limit on a policy. A deny from `cap` always wins. An allow from `cap`
360
480
  * does nothing.
@@ -364,8 +484,8 @@ export declare const firstOf: <const Ps extends readonly [Policy<any, any, any,
364
484
  * @since 0.3.0
365
485
  */
366
486
  export declare const ceiling: {
367
- <D extends Any$1, E2, R2, O2>(cap: Policy<D, E2, R2, O2>): <E, R, O>(policy: Policy<D, E, R, O>) => Policy<D, E | E2, R | R2, O | O2>;
368
- <D extends Any$1, E, R, O, E2, R2, O2>(policy: Policy<D, E, R, O>, cap: Policy<D, E2, R2, O2>): Policy<D, E | E2, R | R2, O | O2>;
487
+ <D extends Any$2, X2>(cap: Policy<D, X2>): <X>(policy: Policy<D, X>) => Policy<D, X | X2>;
488
+ <D extends Any$2, X, X2>(policy: Policy<D, X>, cap: Policy<D, X2>): Policy<D, X | X2>;
369
489
  };
370
490
  /**
371
491
  * Gives the services in `context` to every predicate of a policy, so the
@@ -376,24 +496,9 @@ export declare const ceiling: {
376
496
  * @since 1.0.0
377
497
  */
378
498
  export declare const provideContext: {
379
- <R>(context: Context.Context<R>): <D extends Any$1, E, O>(policy: Policy<D, E, R, O>) => Policy<D, E, never, O>;
380
- <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O>, context: Context.Context<R>): Policy<D, E, never, O>;
499
+ <R>(context: Context.Context<R>): <D extends Any$2, X>(policy: Policy<D, X> & ([ServicesOf<X>] extends [R] ? unknown : never)) => Policy<D, Provided<X>>;
500
+ <D extends Any$2, X>(policy: Policy<D, X>, context: Context.Context<ServicesOf<X>>): Policy<D, Provided<X>>;
381
501
  };
382
- /**
383
- * Tests if a request fits its kind: the action is an action of the kind, and
384
- * the field, if there is one, is a field of the kind. The types check this,
385
- * but a value with a union type, or a value from outside, may get past them.
386
- * A rule for every action (`"*"`) must not cover an action that the kind does
387
- * not have, so such a request is not applicable.
388
- *
389
- * @stability stable
390
- * @category predicates
391
- * @since 1.0.0
392
- */
393
- export declare const fitsKind: (descriptor: Descriptor, request: {
394
- readonly action: string;
395
- readonly field?: string | undefined;
396
- }) => boolean;
397
502
  /**
398
503
  * Gives the decision of a policy for a request.
399
504
  *
@@ -401,10 +506,7 @@ export declare const fitsKind: (descriptor: Descriptor, request: {
401
506
  * @category evaluation
402
507
  * @since 0.3.0
403
508
  */
404
- export declare const decide: {
405
- <D extends Any$1 = never>(request: Request<D>): <E, R, O>(policy: Policy<D, E, R, O>) => Effect.Effect<Decision, E, R>;
406
- <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O>, request: Request<NoInfer<D>>): Effect.Effect<Decision, E, R>;
407
- };
509
+ export declare const decide: <D extends Any$2, X>(policy: Policy<D, X>, request: Request<NoInfer<D>>) => Effect.Effect<Decision, ErrorOf<X>, ServicesOf<X>>;
408
510
  /**
409
511
  * Gives the decision of a policy with no predicates, at once.
410
512
  *
@@ -412,29 +514,22 @@ export declare const decide: {
412
514
  * @category evaluation
413
515
  * @since 0.3.0
414
516
  */
415
- export declare const decideSync: {
416
- <D extends Any$1 = never>(request: Request<D>): (policy: Policy<D>) => Decision;
417
- <D extends Any$1>(policy: Policy<D>, request: Request<NoInfer<D>>): Decision;
418
- };
517
+ export declare const decideSync: <D extends Any$2>(policy: Policy<D>, request: Request<NoInfer<D>>) => Decision;
419
518
  /**
420
519
  * Gives the decision of a policy and the rules that were tested to make it.
421
520
  *
422
- * One node may be a child of many nodes. A node with no predicate that the
423
- * request may use gives the same decision each time, so its rules are tested,
424
- * and are in the steps, only the first time. So a small tree with many shared
425
- * nodes gives a short list of steps.
521
+ * One node may be a child of many nodes. Its rules are tested, and are in the
522
+ * steps, each time that the decision comes to it.
426
523
  *
427
524
  * @stability stable
428
525
  * @category evaluation
429
526
  * @since 0.3.0
430
527
  */
431
- export declare const explain: {
432
- <D extends Any$1 = never>(request: Request<D>): <E, R, O>(policy: Policy<D, E, R, O>) => Effect.Effect<Explanation, E, R>;
433
- <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O>, request: Request<NoInfer<D>>): Effect.Effect<Explanation, E, R>;
434
- };
528
+ export declare const explain: <D extends Any$2, X>(policy: Policy<D, X>, request: Request<NoInfer<D>>) => Effect.Effect<Explanation, ErrorOf<X>, ServicesOf<X>>;
435
529
  /**
436
530
  * Gives the fields of a resource value that the policy lets a request use. It
437
- * tests each field of the resource Schema, with dots for nested fields.
531
+ * tests each field that a list of fields shows: each scalar, record or array
532
+ * of the resource Schema, with dots for nested fields.
438
533
  *
439
534
  * A field that holds more than one value, such as a record, is left out when a
440
535
  * deny rule names a part of it. The list can not name that part, and the whole
@@ -444,48 +539,7 @@ export declare const explain: {
444
539
  * @category evaluation
445
540
  * @since 0.3.0
446
541
  */
447
- export declare const permittedFields: {
448
- <D extends Any$1 = never>(request: FieldlessRequest<D>): <E, R, O>(policy: Policy<D, E, R, O>) => Effect.Effect<ReadonlyArray<string>, E, R>;
449
- <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O>, request: FieldlessRequest<NoInfer<D>>): Effect.Effect<ReadonlyArray<string>, E, R>;
450
- };
451
- /**
452
- * The two residual conditions of a request. See {@link residuals}.
453
- *
454
- * @stability stable
455
- * @category models
456
- * @since 1.0.0
457
- */
458
- export interface Residuals<E = never, R = never, O = never, I = unknown> {
459
- /** The condition on resource values for which the policy allows. */
460
- readonly allow: Condition<E, R, O, I>;
461
- /** The condition on resource values for which the policy denies. */
462
- readonly deny: Condition<E, R, O, I>;
463
- }
464
- /**
465
- * A request about a kind of resource, with no types.
466
- *
467
- * @stability stable
468
- * @category models
469
- * @since 1.0.0
470
- */
471
- export interface AnyKindRequest {
472
- readonly principal: object;
473
- readonly action: string;
474
- readonly kind: string;
475
- readonly field?: string | undefined;
476
- /**
477
- * A scope needs the types of the domain for its builder. With the request
478
- * first, the domain is not known yet, so give the policy first.
479
- */
480
- readonly within?: never;
481
- }
482
- /**
483
- * `unknown` when the request `Req` is a request of the type `T`, and `never`
484
- * when it is not. With the request first and the policy later, the request is
485
- * checked when the policy, and so the domain, is known. For a union, each
486
- * member must be such a request.
487
- */
488
- type Fits<Req, T> = [Req] extends [T] ? unknown : never;
542
+ export declare const permittedFields: <D extends Any$2, X>(policy: Policy<D, X>, request: FieldlessRequest<NoInfer<D>>) => Effect.Effect<ReadonlyArray<string>, ErrorOf<X>, ServicesOf<X>>;
489
543
  /**
490
544
  * What a residual condition reads: a value of the kind `K`. The principal is
491
545
  * already in it. A residual is for one kind, so when `K` is a union of kinds,
@@ -497,14 +551,6 @@ type Fits<Req, T> = [Req] extends [T] ? unknown : never;
497
551
  * @since 1.0.0
498
552
  */
499
553
  export type ResidualReads<D, K> = Reads<(K extends unknown ? (value: ValueOf<D, K & string>) => void : never) extends ((value: infer V) => void) ? V : never, unknown>;
500
- /** A request about a kind with no types, with the scope of a target. */
501
- interface ScopedRequest {
502
- readonly principal: object;
503
- readonly action: string;
504
- readonly kind: string;
505
- readonly field?: string | undefined;
506
- readonly within?: unknown;
507
- }
508
554
  /**
509
555
  * Gives the condition on resource values for which the policy allows a
510
556
  * request. It has no principal fields and no `Under` nodes, so you can give it
@@ -524,31 +570,14 @@ interface ScopedRequest {
524
570
  *
525
571
  * A policy tree may use the condition of a child two times, so a small policy
526
572
  * may give a very large condition. When the condition would have more than
527
- * 10000 nodes or 500 levels, this function throws an error. In an
528
- * `Authorizer`, the error is
529
- * a defect, so the check fails.
573
+ * 10000 nodes, this function throws an error. In an `Authorizer`, the error
574
+ * is a defect, so the check fails.
530
575
  *
531
576
  * @stability stable
532
577
  * @category evaluation
533
578
  * @since 0.3.0
534
579
  */
535
- export declare const residual: {
536
- <const Req extends AnyKindRequest>(request: Req): <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O> & Fits<Req, KindRequest<D>>) => Condition<E, R, O, ResidualReads<D, Req["kind"]>>;
537
- <D extends Any$1, E, R, O, const Req extends KindRequest<NoInfer<D>>>(policy: Policy<D, E, R, O>, request: Req): Condition<E, R, O, ResidualReads<D, Req["kind"]>>;
538
- };
539
- /**
540
- * Gives both residual conditions of a request: the values that the policy
541
- * allows, and the values that it denies. A value in neither is not
542
- * applicable. See {@link residual}.
543
- *
544
- * @stability stable
545
- * @category evaluation
546
- * @since 1.0.0
547
- */
548
- export declare const residuals: {
549
- <const Req extends AnyKindRequest>(request: Req): <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O> & Fits<Req, KindRequest<D>>) => Residuals<E, R, O, ResidualReads<D, Req["kind"]>>;
550
- <D extends Any$1, E, R, O, const Req extends KindRequest<NoInfer<D>>>(policy: Policy<D, E, R, O>, request: Req): Residuals<E, R, O, ResidualReads<D, Req["kind"]>>;
551
- };
580
+ export declare const residual: <D extends Any$2, X, const Req extends KindRequest<NoInfer<D>>>(policy: Policy<D, X>, request: Req) => Condition<ResidualReads<D, Req["kind"]>, X>;
552
581
  /**
553
582
  * How much of a scope a policy allows. In each case, `condition` is the exact
554
583
  * condition on the values in the scope that the policy allows: give it to
@@ -568,67 +597,43 @@ export declare const residuals: {
568
597
  * @category models
569
598
  * @since 1.0.0
570
599
  */
571
- export type Coverage<E = never, R = never, O = never, I = unknown> = Data.TaggedEnum<{
600
+ export type Coverage<I = unknown, X = never> = Data.TaggedEnum<{
572
601
  All: {
573
- readonly condition: Condition<E, R, O, I>;
602
+ readonly condition: Condition<I, X>;
574
603
  };
575
604
  None: {
576
- readonly condition: Condition<E, R, O, I>;
605
+ readonly condition: Condition<I, X>;
577
606
  };
578
607
  Some: {
579
- readonly condition: Condition<E, R, O, I>;
608
+ readonly condition: Condition<I, X>;
580
609
  readonly allowed: Example;
581
610
  readonly refused: Example;
582
611
  };
583
612
  Unknown: {
584
- readonly condition: Condition<E, R, O, I>;
585
- readonly reason: "predicate" | "budget" | "schema";
613
+ readonly condition: Condition<I, X>;
614
+ readonly reason: "predicate" | "budget";
586
615
  };
587
616
  }>;
588
- /**
589
- * Tests if the scope of a request has a value of the Schema of its kind. The
590
- * answer is `true` only when the search finds such a value. When the search
591
- * can not say, the answer is `false`. So a "yes" from it is safe to act on,
592
- * as for the question "may the decider answer for this scope?".
593
- *
594
- * @stability stable
595
- * @category evaluation
596
- * @since 1.0.0
597
- */
598
- export declare const scopeHasValue: (policy: Any, request: ScopedRequest) => boolean;
599
- /**
600
- * Tests if the scope of a request has no value of the Schema of its kind. A
601
- * scope with a mistake, such as two values for one field, is empty. With no
602
- * scope, the answer is `false` when the kind has a value. When the search can
603
- * not say, the answer is `false`.
604
- *
605
- * @stability stable
606
- * @category evaluation
607
- * @since 1.0.0
608
- */
609
- export declare const scopeIsEmpty: (policy: Any, request: ScopedRequest) => boolean;
610
617
  /**
611
618
  * Tells how much of a scope the policy allows: all of it, none of it, or some
612
619
  * of it. See {@link Coverage}. With no scope (`within`), the scope is every
613
620
  * value of the kind.
614
621
  *
615
- * The answer comes from {@link Condition.satisfiable} with the Schema of the
616
- * resource, so it is exact for the values of the Schema. When a condition
617
- * tests a field that is not a plain scalar (see `Resource.isPlainField`),
618
- * such as a field with a check other than a finite or integer check, the
619
- * answer is `Unknown`, and a check on the kind says no.
622
+ * The answer comes from {@link Condition.satisfiable} with the shape of the
623
+ * Schema of the resource. `All` and `None` hold for every value of the
624
+ * Schema. `Some` means that, by the shape of the Schema, a value may get
625
+ * either answer: a check such as a minimum length may still stop one of the
626
+ * examples. `Unknown` comes only from a predicate or from the budget of the
627
+ * search.
620
628
  *
621
- * `Some` means that some value of the Schema is allowed. It does not mean that
622
- * such a value is in your database. To know that, run `condition` as a query.
629
+ * `Some` does not mean that such a value is in your database. To know that,
630
+ * run `condition` as a query.
623
631
  *
624
632
  * @stability stable
625
633
  * @category evaluation
626
634
  * @since 1.0.0
627
635
  */
628
- export declare const coverage: {
629
- <const Req extends AnyKindRequest>(request: Req): <D extends Any$1, E, R, O>(policy: Policy<D, E, R, O> & Fits<Req, KindRequest<D>>) => Coverage<E, R, O, ResidualReads<D, Req["kind"]>>;
630
- <D extends Any$1, E, R, O, const Req extends KindRequest<NoInfer<D>>>(policy: Policy<D, E, R, O>, request: Req): Coverage<E, R, O, ResidualReads<D, Req["kind"]>>;
631
- };
636
+ export declare const coverage: <D extends Any$2, X, const Req extends KindRequest<NoInfer<D>>>(policy: Policy<D, X>, request: Req) => Coverage<ResidualReads<D, Req["kind"]>, X>;
632
637
  /**
633
638
  * The JSON form of a rule.
634
639
  *
@@ -665,23 +670,20 @@ export type EncodedNode = {
665
670
  readonly cap: EncodedNode;
666
671
  readonly policy: EncodedNode;
667
672
  };
668
- /**
669
- * Tests if a value is a policy.
670
- *
671
- * @stability stable
672
- * @category guards
673
- * @since 0.3.0
674
- */
675
- export declare const isPolicy: (u: unknown) => u is Any;
676
673
  /**
677
674
  * The Schema of the policies of a domain with no predicates. Decoding checks
678
675
  * every kind, action, field and principal field against the domain, and the
679
676
  * `meta` of each rule against the `meta` Schema of the domain.
680
677
  *
678
+ * The decoder takes at most 256 levels of policies and 500 levels of
679
+ * conditions, and at most 1000000 objects and array items, with a shared
680
+ * object counted for each place. It reads only the own data fields of the
681
+ * input.
682
+ *
681
683
  * @stability stable
682
684
  * @category schemas
683
685
  * @since 0.3.0
684
686
  */
685
- export declare const schema: <D extends Any$1>(domain: D) => Schema.Codec<Policy<D>, EncodedNode>;
687
+ export declare const schema: <D extends Any$2>(domain: D) => Schema.Codec<Policy<D>, EncodedNode>;
686
688
  export { Policy_d_exports };
687
689
  //# sourceMappingURL=Policy.d.ts.map