@cedar-policy/cedar-wasm 4.9.0 → 4.9.1

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.
@@ -80,6 +80,17 @@ export interface NamespaceDefinition<N> {
80
80
  annotations?: Annotations;
81
81
  }
82
82
 
83
+ export interface PartialAuthorizationCall {
84
+ principal: EntityUid | null;
85
+ action: EntityUid | null;
86
+ resource: EntityUid | null;
87
+ context: Context;
88
+ schema?: Schema;
89
+ validateRequest?: boolean;
90
+ policies: PolicySet;
91
+ entities: Entities;
92
+ }
93
+
83
94
  export interface PolicyJson {
84
95
  effect: Effect;
85
96
  principal: PrincipalConstraint;
@@ -105,6 +116,16 @@ export interface RecordType<N> {
105
116
  additionalAttributes?: boolean;
106
117
  }
107
118
 
119
+ export interface ResidualResponse {
120
+ decision: Decision | null;
121
+ satisfied: PolicyId[];
122
+ errored: PolicyId[];
123
+ mayBeDetermining: PolicyId[];
124
+ mustBeDetermining: PolicyId[];
125
+ residuals: Record<string, PolicyJson>;
126
+ nontrivialResiduals: PolicyId[];
127
+ }
128
+
108
129
  export interface Response {
109
130
  decision: Decision;
110
131
  diagnostics: Diagnostics;
@@ -212,6 +233,8 @@ export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | {
212
233
 
213
234
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
214
235
 
236
+ export type PartialAuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "residuals"; response: ResidualResponse; warnings: DetailedError[] };
237
+
215
238
  export type PatternElem = "Wildcard" | { Literal: SmolStr };
216
239
 
217
240
  export type Policy = string | PolicyJson;
@@ -310,6 +333,12 @@ export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidReq
310
333
  */
311
334
  export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
312
335
 
336
+ /**
337
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
338
+ * [`PartialAuthorizationAnswer`] types
339
+ */
340
+ export function isAuthorizedPartial(call: PartialAuthorizationCall): PartialAuthorizationAnswer;
341
+
313
342
  /**
314
343
  * Takes a `PolicySet` represented as string and return the policies
315
344
  * and templates split into vecs and sorted by id.
package/esm/cedar_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./cedar_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- checkParseContext, checkParseEntities, checkParsePolicySet, checkParseSchema, formatPolicies, getCedarLangVersion, getCedarSDKVersion, getCedarVersion, getValidRequestEnvsPolicy, getValidRequestEnvsTemplate, isAuthorized, policySetTextToParts, policyToJson, policyToText, preparsePolicySet, preparseSchema, schemaToJson, schemaToJsonWithResolvedTypes, schemaToText, statefulIsAuthorized, templateToJson, templateToText, validate
8
+ checkParseContext, checkParseEntities, checkParsePolicySet, checkParseSchema, formatPolicies, getCedarLangVersion, getCedarSDKVersion, getCedarVersion, getValidRequestEnvsPolicy, getValidRequestEnvsTemplate, isAuthorized, isAuthorizedPartial, policySetTextToParts, policyToJson, policyToText, preparsePolicySet, preparseSchema, schemaToJson, schemaToJsonWithResolvedTypes, schemaToText, statefulIsAuthorized, templateToJson, templateToText, validate
9
9
  } from "./cedar_wasm_bg.js";
@@ -129,6 +129,17 @@ export function isAuthorized(call) {
129
129
  return ret;
130
130
  }
131
131
 
132
+ /**
133
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
134
+ * [`PartialAuthorizationAnswer`] types
135
+ * @param {PartialAuthorizationCall} call
136
+ * @returns {PartialAuthorizationAnswer}
137
+ */
138
+ export function isAuthorizedPartial(call) {
139
+ const ret = wasm.isAuthorizedPartial(call);
140
+ return ret;
141
+ }
142
+
132
143
  /**
133
144
  * Takes a `PolicySet` represented as string and return the policies
134
145
  * and templates split into vecs and sorted by id.
Binary file
@@ -5,10 +5,16 @@ export const getCedarSDKVersion: () => [number, number];
5
5
  export const getValidRequestEnvsPolicy: (a: any, b: any) => any;
6
6
  export const getValidRequestEnvsTemplate: (a: any, b: any) => any;
7
7
  export const getCedarVersion: () => [number, number];
8
+ export const isAuthorized: (a: any) => any;
9
+ export const isAuthorizedPartial: (a: any) => any;
10
+ export const preparsePolicySet: (a: number, b: number, c: any) => any;
11
+ export const preparseSchema: (a: number, b: number, c: any) => any;
12
+ export const statefulIsAuthorized: (a: any) => any;
8
13
  export const checkParseContext: (a: any) => any;
9
14
  export const checkParseEntities: (a: any) => any;
10
15
  export const checkParsePolicySet: (a: any) => any;
11
16
  export const checkParseSchema: (a: any) => any;
17
+ export const formatPolicies: (a: any) => any;
12
18
  export const validate: (a: any) => any;
13
19
  export const policySetTextToParts: (a: number, b: number) => any;
14
20
  export const policyToJson: (a: any) => any;
@@ -19,11 +25,6 @@ export const schemaToText: (a: any) => any;
19
25
  export const templateToJson: (a: any) => any;
20
26
  export const templateToText: (a: any) => any;
21
27
  export const getCedarLangVersion: () => [number, number];
22
- export const formatPolicies: (a: any) => any;
23
- export const isAuthorized: (a: any) => any;
24
- export const preparsePolicySet: (a: number, b: number, c: any) => any;
25
- export const preparseSchema: (a: number, b: number, c: any) => any;
26
- export const statefulIsAuthorized: (a: any) => any;
27
28
  export const __wbindgen_malloc: (a: number, b: number) => number;
28
29
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
29
30
  export const __wbindgen_exn_store: (a: number) => void;
package/esm/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "type": "module",
4
4
  "description": "Wasm bindings and typescript types for Cedar lib",
5
- "version": "4.9.0",
5
+ "version": "4.9.1",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -80,6 +80,17 @@ export interface NamespaceDefinition<N> {
80
80
  annotations?: Annotations;
81
81
  }
82
82
 
83
+ export interface PartialAuthorizationCall {
84
+ principal: EntityUid | null;
85
+ action: EntityUid | null;
86
+ resource: EntityUid | null;
87
+ context: Context;
88
+ schema?: Schema;
89
+ validateRequest?: boolean;
90
+ policies: PolicySet;
91
+ entities: Entities;
92
+ }
93
+
83
94
  export interface PolicyJson {
84
95
  effect: Effect;
85
96
  principal: PrincipalConstraint;
@@ -105,6 +116,16 @@ export interface RecordType<N> {
105
116
  additionalAttributes?: boolean;
106
117
  }
107
118
 
119
+ export interface ResidualResponse {
120
+ decision: Decision | null;
121
+ satisfied: PolicyId[];
122
+ errored: PolicyId[];
123
+ mayBeDetermining: PolicyId[];
124
+ mustBeDetermining: PolicyId[];
125
+ residuals: Record<string, PolicyJson>;
126
+ nontrivialResiduals: PolicyId[];
127
+ }
128
+
108
129
  export interface Response {
109
130
  decision: Decision;
110
131
  diagnostics: Diagnostics;
@@ -212,6 +233,8 @@ export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | {
212
233
 
213
234
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
214
235
 
236
+ export type PartialAuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "residuals"; response: ResidualResponse; warnings: DetailedError[] };
237
+
215
238
  export type PatternElem = "Wildcard" | { Literal: SmolStr };
216
239
 
217
240
  export type Policy = string | PolicyJson;
@@ -310,6 +333,12 @@ export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidReq
310
333
  */
311
334
  export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
312
335
 
336
+ /**
337
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
338
+ * [`PartialAuthorizationAnswer`] types
339
+ */
340
+ export function isAuthorizedPartial(call: PartialAuthorizationCall): PartialAuthorizationAnswer;
341
+
313
342
  /**
314
343
  * Takes a `PolicySet` represented as string and return the policies
315
344
  * and templates split into vecs and sorted by id.
@@ -142,6 +142,18 @@ function isAuthorized(call) {
142
142
  }
143
143
  exports.isAuthorized = isAuthorized;
144
144
 
145
+ /**
146
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
147
+ * [`PartialAuthorizationAnswer`] types
148
+ * @param {PartialAuthorizationCall} call
149
+ * @returns {PartialAuthorizationAnswer}
150
+ */
151
+ function isAuthorizedPartial(call) {
152
+ const ret = wasm.isAuthorizedPartial(call);
153
+ return ret;
154
+ }
155
+ exports.isAuthorizedPartial = isAuthorizedPartial;
156
+
145
157
  /**
146
158
  * Takes a `PolicySet` represented as string and return the policies
147
159
  * and templates split into vecs and sorted by id.
Binary file
@@ -5,10 +5,16 @@ export const getCedarSDKVersion: () => [number, number];
5
5
  export const getValidRequestEnvsPolicy: (a: any, b: any) => any;
6
6
  export const getValidRequestEnvsTemplate: (a: any, b: any) => any;
7
7
  export const getCedarVersion: () => [number, number];
8
+ export const isAuthorized: (a: any) => any;
9
+ export const isAuthorizedPartial: (a: any) => any;
10
+ export const preparsePolicySet: (a: number, b: number, c: any) => any;
11
+ export const preparseSchema: (a: number, b: number, c: any) => any;
12
+ export const statefulIsAuthorized: (a: any) => any;
8
13
  export const checkParseContext: (a: any) => any;
9
14
  export const checkParseEntities: (a: any) => any;
10
15
  export const checkParsePolicySet: (a: any) => any;
11
16
  export const checkParseSchema: (a: any) => any;
17
+ export const formatPolicies: (a: any) => any;
12
18
  export const validate: (a: any) => any;
13
19
  export const policySetTextToParts: (a: number, b: number) => any;
14
20
  export const policyToJson: (a: any) => any;
@@ -19,11 +25,6 @@ export const schemaToText: (a: any) => any;
19
25
  export const templateToJson: (a: any) => any;
20
26
  export const templateToText: (a: any) => any;
21
27
  export const getCedarLangVersion: () => [number, number];
22
- export const formatPolicies: (a: any) => any;
23
- export const isAuthorized: (a: any) => any;
24
- export const preparsePolicySet: (a: number, b: number, c: any) => any;
25
- export const preparseSchema: (a: number, b: number, c: any) => any;
26
- export const statefulIsAuthorized: (a: any) => any;
27
28
  export const __wbindgen_malloc: (a: number, b: number) => number;
28
29
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
29
30
  export const __wbindgen_exn_store: (a: number) => void;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "4.9.0",
4
+ "version": "4.9.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "type": "module",
4
4
  "description": "Wasm bindings and typescript types for Cedar lib",
5
- "version": "4.9.0",
5
+ "version": "4.9.1",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -80,6 +80,17 @@ export interface NamespaceDefinition<N> {
80
80
  annotations?: Annotations;
81
81
  }
82
82
 
83
+ export interface PartialAuthorizationCall {
84
+ principal: EntityUid | null;
85
+ action: EntityUid | null;
86
+ resource: EntityUid | null;
87
+ context: Context;
88
+ schema?: Schema;
89
+ validateRequest?: boolean;
90
+ policies: PolicySet;
91
+ entities: Entities;
92
+ }
93
+
83
94
  export interface PolicyJson {
84
95
  effect: Effect;
85
96
  principal: PrincipalConstraint;
@@ -105,6 +116,16 @@ export interface RecordType<N> {
105
116
  additionalAttributes?: boolean;
106
117
  }
107
118
 
119
+ export interface ResidualResponse {
120
+ decision: Decision | null;
121
+ satisfied: PolicyId[];
122
+ errored: PolicyId[];
123
+ mayBeDetermining: PolicyId[];
124
+ mustBeDetermining: PolicyId[];
125
+ residuals: Record<string, PolicyJson>;
126
+ nontrivialResiduals: PolicyId[];
127
+ }
128
+
108
129
  export interface Response {
109
130
  decision: Decision;
110
131
  diagnostics: Diagnostics;
@@ -212,6 +233,8 @@ export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | {
212
233
 
213
234
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
214
235
 
236
+ export type PartialAuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "residuals"; response: ResidualResponse; warnings: DetailedError[] };
237
+
215
238
  export type PatternElem = "Wildcard" | { Literal: SmolStr };
216
239
 
217
240
  export type Policy = string | PolicyJson;
@@ -310,6 +333,12 @@ export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidReq
310
333
  */
311
334
  export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
312
335
 
336
+ /**
337
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
338
+ * [`PartialAuthorizationAnswer`] types
339
+ */
340
+ export function isAuthorizedPartial(call: PartialAuthorizationCall): PartialAuthorizationAnswer;
341
+
313
342
  /**
314
343
  * Takes a `PolicySet` represented as string and return the policies
315
344
  * and templates split into vecs and sorted by id.
@@ -398,10 +427,16 @@ export interface InitOutput {
398
427
  readonly getValidRequestEnvsPolicy: (a: any, b: any) => any;
399
428
  readonly getValidRequestEnvsTemplate: (a: any, b: any) => any;
400
429
  readonly getCedarVersion: () => [number, number];
430
+ readonly isAuthorized: (a: any) => any;
431
+ readonly isAuthorizedPartial: (a: any) => any;
432
+ readonly preparsePolicySet: (a: number, b: number, c: any) => any;
433
+ readonly preparseSchema: (a: number, b: number, c: any) => any;
434
+ readonly statefulIsAuthorized: (a: any) => any;
401
435
  readonly checkParseContext: (a: any) => any;
402
436
  readonly checkParseEntities: (a: any) => any;
403
437
  readonly checkParsePolicySet: (a: any) => any;
404
438
  readonly checkParseSchema: (a: any) => any;
439
+ readonly formatPolicies: (a: any) => any;
405
440
  readonly validate: (a: any) => any;
406
441
  readonly policySetTextToParts: (a: number, b: number) => any;
407
442
  readonly policyToJson: (a: any) => any;
@@ -412,11 +447,6 @@ export interface InitOutput {
412
447
  readonly templateToJson: (a: any) => any;
413
448
  readonly templateToText: (a: any) => any;
414
449
  readonly getCedarLangVersion: () => [number, number];
415
- readonly formatPolicies: (a: any) => any;
416
- readonly isAuthorized: (a: any) => any;
417
- readonly preparsePolicySet: (a: number, b: number, c: any) => any;
418
- readonly preparseSchema: (a: number, b: number, c: any) => any;
419
- readonly statefulIsAuthorized: (a: any) => any;
420
450
  readonly __wbindgen_malloc: (a: number, b: number) => number;
421
451
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
422
452
  readonly __wbindgen_exn_store: (a: number) => void;
package/web/cedar_wasm.js CHANGED
@@ -131,6 +131,17 @@ export function isAuthorized(call) {
131
131
  return ret;
132
132
  }
133
133
 
134
+ /**
135
+ * Basic interface for partial evaluation, using [`AuthorizationCall`] and
136
+ * [`PartialAuthorizationAnswer`] types
137
+ * @param {PartialAuthorizationCall} call
138
+ * @returns {PartialAuthorizationAnswer}
139
+ */
140
+ export function isAuthorizedPartial(call) {
141
+ const ret = wasm.isAuthorizedPartial(call);
142
+ return ret;
143
+ }
144
+
134
145
  /**
135
146
  * Takes a `PolicySet` represented as string and return the policies
136
147
  * and templates split into vecs and sorted by id.
Binary file
@@ -5,10 +5,16 @@ export const getCedarSDKVersion: () => [number, number];
5
5
  export const getValidRequestEnvsPolicy: (a: any, b: any) => any;
6
6
  export const getValidRequestEnvsTemplate: (a: any, b: any) => any;
7
7
  export const getCedarVersion: () => [number, number];
8
+ export const isAuthorized: (a: any) => any;
9
+ export const isAuthorizedPartial: (a: any) => any;
10
+ export const preparsePolicySet: (a: number, b: number, c: any) => any;
11
+ export const preparseSchema: (a: number, b: number, c: any) => any;
12
+ export const statefulIsAuthorized: (a: any) => any;
8
13
  export const checkParseContext: (a: any) => any;
9
14
  export const checkParseEntities: (a: any) => any;
10
15
  export const checkParsePolicySet: (a: any) => any;
11
16
  export const checkParseSchema: (a: any) => any;
17
+ export const formatPolicies: (a: any) => any;
12
18
  export const validate: (a: any) => any;
13
19
  export const policySetTextToParts: (a: number, b: number) => any;
14
20
  export const policyToJson: (a: any) => any;
@@ -19,11 +25,6 @@ export const schemaToText: (a: any) => any;
19
25
  export const templateToJson: (a: any) => any;
20
26
  export const templateToText: (a: any) => any;
21
27
  export const getCedarLangVersion: () => [number, number];
22
- export const formatPolicies: (a: any) => any;
23
- export const isAuthorized: (a: any) => any;
24
- export const preparsePolicySet: (a: number, b: number, c: any) => any;
25
- export const preparseSchema: (a: number, b: number, c: any) => any;
26
- export const statefulIsAuthorized: (a: any) => any;
27
28
  export const __wbindgen_malloc: (a: number, b: number) => number;
28
29
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
29
30
  export const __wbindgen_exn_store: (a: number) => void;
package/web/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "type": "module",
4
4
  "description": "Wasm bindings and typescript types for Cedar lib",
5
- "version": "4.9.0",
5
+ "version": "4.9.1",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",