@cedar-policy/cedar-wasm 4.5.0 → 4.5.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.
- package/esm/cedar_wasm.d.ts +129 -132
- package/esm/cedar_wasm_bg.js +68 -68
- package/esm/cedar_wasm_bg.wasm +0 -0
- package/esm/cedar_wasm_bg.wasm.d.ts +10 -10
- package/esm/package.json +1 -1
- package/nodejs/cedar_wasm.d.ts +129 -132
- package/nodejs/cedar_wasm.js +68 -68
- package/nodejs/cedar_wasm_bg.wasm +0 -0
- package/nodejs/cedar_wasm_bg.wasm.d.ts +10 -10
- package/nodejs/package.json +1 -1
- package/package.json +1 -1
- package/web/cedar_wasm.d.ts +139 -142
- package/web/cedar_wasm.js +68 -68
- package/web/cedar_wasm_bg.wasm +0 -0
- package/web/cedar_wasm_bg.wasm.d.ts +10 -10
- package/web/package.json +1 -1
package/esm/cedar_wasm.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function getCedarVersion(): string;
|
|
4
|
+
export function getCedarSDKVersion(): string;
|
|
3
5
|
/**
|
|
4
6
|
* Get valid request environment
|
|
5
7
|
*/
|
|
@@ -8,27 +10,18 @@ export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidReq
|
|
|
8
10
|
* Get valid request environment
|
|
9
11
|
*/
|
|
10
12
|
export function getValidRequestEnvsPolicy(t: Policy, s: Schema): GetValidRequestEnvsResult;
|
|
11
|
-
export function getCedarVersion(): string;
|
|
12
|
-
export function getCedarSDKVersion(): string;
|
|
13
|
-
/**
|
|
14
|
-
* Parse a policy set and optionally validate it against a provided schema
|
|
15
|
-
*
|
|
16
|
-
* This is the basic validator interface, using [`ValidationCall`] and
|
|
17
|
-
* [`ValidationAnswer`] types
|
|
18
|
-
*/
|
|
19
|
-
export function validate(call: ValidationCall): ValidationAnswer;
|
|
20
13
|
/**
|
|
21
|
-
* Check whether a
|
|
14
|
+
* Check whether a set of entities successfully parses.
|
|
22
15
|
*/
|
|
23
|
-
export function
|
|
16
|
+
export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
|
|
24
17
|
/**
|
|
25
18
|
* Check whether a schema successfully parses.
|
|
26
19
|
*/
|
|
27
20
|
export function checkParseSchema(schema: Schema): CheckParseAnswer;
|
|
28
21
|
/**
|
|
29
|
-
* Check whether a set
|
|
22
|
+
* Check whether a policy set successfully parses.
|
|
30
23
|
*/
|
|
31
|
-
export function
|
|
24
|
+
export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
|
|
32
25
|
/**
|
|
33
26
|
* Check whether a context successfully parses.
|
|
34
27
|
*/
|
|
@@ -38,99 +31,111 @@ export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
|
|
|
38
31
|
*/
|
|
39
32
|
export function formatPolicies(call: FormattingCall): FormattingAnswer;
|
|
40
33
|
/**
|
|
41
|
-
*
|
|
34
|
+
* Return the Cedar (textual) representation of a template.
|
|
42
35
|
*/
|
|
43
|
-
export function
|
|
36
|
+
export function templateToText(template: Template): PolicyToTextAnswer;
|
|
37
|
+
/**
|
|
38
|
+
* Return the JSON representation of a policy.
|
|
39
|
+
*/
|
|
40
|
+
export function policyToJson(policy: Policy): PolicyToJsonAnswer;
|
|
44
41
|
/**
|
|
45
|
-
* Takes a PolicySet represented as string and return the policies
|
|
42
|
+
* Takes a `PolicySet` represented as string and return the policies
|
|
46
43
|
* and templates split into vecs and sorted by id.
|
|
47
44
|
*/
|
|
48
45
|
export function policySetTextToParts(policyset_str: string): PolicySetTextToPartsAnswer;
|
|
49
46
|
/**
|
|
50
|
-
* Return the
|
|
47
|
+
* Return the JSON representation of a schema.
|
|
51
48
|
*/
|
|
52
|
-
export function
|
|
49
|
+
export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
|
|
53
50
|
/**
|
|
54
|
-
* Return the Cedar (textual) representation of a
|
|
51
|
+
* Return the Cedar (textual) representation of a schema.
|
|
55
52
|
*/
|
|
56
|
-
export function
|
|
53
|
+
export function schemaToText(schema: Schema): SchemaToTextAnswer;
|
|
57
54
|
/**
|
|
58
|
-
* Return the
|
|
55
|
+
* Return the Cedar (textual) representation of a policy.
|
|
59
56
|
*/
|
|
60
|
-
export function
|
|
57
|
+
export function policyToText(policy: Policy): PolicyToTextAnswer;
|
|
61
58
|
/**
|
|
62
59
|
* Return the JSON representation of a template.
|
|
63
60
|
*/
|
|
64
61
|
export function templateToJson(template: Template): PolicyToJsonAnswer;
|
|
65
62
|
/**
|
|
66
|
-
*
|
|
63
|
+
* Parse a policy set and optionally validate it against a provided schema
|
|
64
|
+
*
|
|
65
|
+
* This is the basic validator interface, using [`ValidationCall`] and
|
|
66
|
+
* [`ValidationAnswer`] types
|
|
67
67
|
*/
|
|
68
|
-
export function
|
|
68
|
+
export function validate(call: ValidationCall): ValidationAnswer;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
71
71
|
*/
|
|
72
|
-
export function
|
|
72
|
+
export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
|
|
73
73
|
/**
|
|
74
74
|
* Get language version of Cedar
|
|
75
75
|
*/
|
|
76
76
|
export function getCedarLangVersion(): string;
|
|
77
77
|
export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
|
|
78
78
|
|
|
79
|
-
export interface ValidationCall {
|
|
80
|
-
validationSettings?: ValidationSettings;
|
|
81
|
-
schema: Schema;
|
|
82
|
-
policies: PolicySet;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface ValidationSettings {
|
|
86
|
-
mode: ValidationMode;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ValidationError {
|
|
90
|
-
policyId: string;
|
|
91
|
-
error: DetailedError;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
|
|
95
|
-
|
|
96
|
-
export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
|
|
97
|
-
|
|
98
79
|
export interface EntitiesParsingCall {
|
|
99
80
|
entities: Entities;
|
|
100
81
|
schema?: Schema | null;
|
|
101
82
|
}
|
|
102
83
|
|
|
84
|
+
export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
|
|
85
|
+
|
|
103
86
|
export interface ContextParsingCall {
|
|
104
87
|
context: Context;
|
|
105
88
|
schema?: Schema | null;
|
|
106
89
|
action?: EntityUid | null;
|
|
107
90
|
}
|
|
108
91
|
|
|
92
|
+
export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
|
|
93
|
+
|
|
109
94
|
export interface FormattingCall {
|
|
110
95
|
policyText: string;
|
|
111
96
|
lineWidth?: number;
|
|
112
97
|
indentWidth?: number;
|
|
113
98
|
}
|
|
114
99
|
|
|
115
|
-
export type
|
|
100
|
+
export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
|
|
116
101
|
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
|
|
103
|
+
|
|
104
|
+
export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
|
|
105
|
+
|
|
106
|
+
export type PolicySetTextToPartsAnswer = { type: "success"; policies: string[]; policy_templates: string[] } | { type: "failure"; errors: DetailedError[] };
|
|
107
|
+
|
|
108
|
+
export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
|
|
109
|
+
|
|
110
|
+
export interface ValidationSettings {
|
|
111
|
+
mode: ValidationMode;
|
|
120
112
|
}
|
|
121
113
|
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
|
|
115
|
+
|
|
116
|
+
export interface ValidationCall {
|
|
117
|
+
validationSettings?: ValidationSettings;
|
|
118
|
+
schema: Schema;
|
|
119
|
+
policies: PolicySet;
|
|
125
120
|
}
|
|
126
121
|
|
|
127
|
-
export interface
|
|
122
|
+
export interface ValidationError {
|
|
128
123
|
policyId: string;
|
|
129
124
|
error: DetailedError;
|
|
130
125
|
}
|
|
131
126
|
|
|
132
127
|
export type AuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; response: Response; warnings: DetailedError[] };
|
|
133
128
|
|
|
129
|
+
export interface AuthorizationError {
|
|
130
|
+
policyId: string;
|
|
131
|
+
error: DetailedError;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface Response {
|
|
135
|
+
decision: Decision;
|
|
136
|
+
diagnostics: Diagnostics;
|
|
137
|
+
}
|
|
138
|
+
|
|
134
139
|
export interface AuthorizationCall {
|
|
135
140
|
principal: EntityUid;
|
|
136
141
|
action: EntityUid;
|
|
@@ -142,22 +147,23 @@ export interface AuthorizationCall {
|
|
|
142
147
|
entities: Entities;
|
|
143
148
|
}
|
|
144
149
|
|
|
145
|
-
export
|
|
150
|
+
export interface Diagnostics {
|
|
151
|
+
reason: PolicyId[];
|
|
152
|
+
errors: AuthorizationError[];
|
|
153
|
+
}
|
|
146
154
|
|
|
147
|
-
export type
|
|
155
|
+
export type PolicyId = string;
|
|
148
156
|
|
|
149
|
-
export type
|
|
157
|
+
export type SlotId = string;
|
|
150
158
|
|
|
151
|
-
export type
|
|
159
|
+
export type ValidationMode = "strict";
|
|
152
160
|
|
|
153
|
-
export type
|
|
161
|
+
export type StaticPolicySet = string | Policy[] | Record<PolicyId, Policy>;
|
|
154
162
|
|
|
155
|
-
export type
|
|
163
|
+
export type Context = Record<string, CedarValueJson>;
|
|
156
164
|
|
|
157
|
-
export interface
|
|
158
|
-
|
|
159
|
-
templates?: Record<PolicyId, Template>;
|
|
160
|
-
templateLinks?: TemplateLink[];
|
|
165
|
+
export interface SourceLabel extends SourceLocation {
|
|
166
|
+
label: string | null;
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
export interface TemplateLink {
|
|
@@ -166,27 +172,15 @@ export interface TemplateLink {
|
|
|
166
172
|
values: Record<SlotId, EntityUid>;
|
|
167
173
|
}
|
|
168
174
|
|
|
169
|
-
export type StaticPolicySet = string | Policy[] | Record<PolicyId, Policy>;
|
|
170
|
-
|
|
171
|
-
export type Template = string | PolicyJson;
|
|
172
|
-
|
|
173
175
|
export type Policy = string | PolicyJson;
|
|
174
176
|
|
|
175
|
-
export type
|
|
176
|
-
|
|
177
|
-
export type Context = Record<string, CedarValueJson>;
|
|
178
|
-
|
|
179
|
-
export type EntityUid = EntityUidJson;
|
|
177
|
+
export type Schema = string | SchemaJson<string>;
|
|
180
178
|
|
|
181
179
|
export interface SourceLocation {
|
|
182
180
|
start: number;
|
|
183
181
|
end: number;
|
|
184
182
|
}
|
|
185
183
|
|
|
186
|
-
export interface SourceLabel extends SourceLocation {
|
|
187
|
-
label: string | null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
184
|
export type Severity = "advice" | "warning" | "error";
|
|
191
185
|
|
|
192
186
|
export interface DetailedError {
|
|
@@ -199,30 +193,21 @@ export interface DetailedError {
|
|
|
199
193
|
related?: DetailedError[];
|
|
200
194
|
}
|
|
201
195
|
|
|
202
|
-
export
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
export type ValidationMode = "strict";
|
|
207
|
-
|
|
208
|
-
export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
|
|
209
|
-
|
|
210
|
-
export interface PrincipalOrResourceIsConstraint {
|
|
211
|
-
entity_type: string;
|
|
212
|
-
in?: PrincipalOrResourceInConstraint;
|
|
196
|
+
export interface PolicySet {
|
|
197
|
+
staticPolicies?: StaticPolicySet;
|
|
198
|
+
templates?: Record<PolicyId, Template>;
|
|
199
|
+
templateLinks?: TemplateLink[];
|
|
213
200
|
}
|
|
214
201
|
|
|
215
|
-
export type
|
|
216
|
-
|
|
217
|
-
export type EqConstraint = { entity: EntityUidJson } | { slot: string };
|
|
202
|
+
export type Template = string | PolicyJson;
|
|
218
203
|
|
|
219
|
-
export type
|
|
204
|
+
export type EntityUid = EntityUidJson;
|
|
220
205
|
|
|
221
|
-
export type
|
|
206
|
+
export type Entities = Array<EntityJson>;
|
|
222
207
|
|
|
223
|
-
export type
|
|
208
|
+
export type Annotation = SmolStr;
|
|
224
209
|
|
|
225
|
-
export type
|
|
210
|
+
export type Decision = "allow" | "deny";
|
|
226
211
|
|
|
227
212
|
export interface EntityJson {
|
|
228
213
|
uid: EntityUidJson;
|
|
@@ -231,34 +216,29 @@ export interface EntityJson {
|
|
|
231
216
|
tags?: Record<string, CedarValueJson>;
|
|
232
217
|
}
|
|
233
218
|
|
|
234
|
-
export type
|
|
219
|
+
export type Expr = ExprNoExt | ExtFuncCall;
|
|
235
220
|
|
|
236
|
-
export type
|
|
221
|
+
export type ExtFuncCall = {} & Record<string, Array<Expr>>;
|
|
237
222
|
|
|
238
223
|
export type PatternElem = "Wildcard" | { Literal: SmolStr };
|
|
239
224
|
|
|
240
|
-
export type
|
|
225
|
+
export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: string } | { "!": { arg: Expr } } | { neg: { arg: Expr } } | { "==": { left: Expr; right: Expr } } | { "!=": { left: Expr; right: Expr } } | { in: { left: Expr; right: Expr } } | { "<": { left: Expr; right: Expr } } | { "<=": { left: Expr; right: Expr } } | { ">": { left: Expr; right: Expr } } | { ">=": { left: Expr; right: Expr } } | { "&&": { left: Expr; right: Expr } } | { "||": { left: Expr; right: Expr } } | { "+": { left: Expr; right: Expr } } | { "-": { left: Expr; right: Expr } } | { "*": { left: Expr; right: Expr } } | { contains: { left: Expr; right: Expr } } | { containsAll: { left: Expr; right: Expr } } | { containsAny: { left: Expr; right: Expr } } | { isEmpty: { arg: Expr } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
|
|
241
226
|
|
|
242
227
|
export type TypeVariant<N> = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: Type<N> } | ({ type: "Record" } & RecordType<N>) | { type: "Entity"; name: N } | { type: "EntityOrCommon"; name: N } | { type: "Extension"; name: UnreservedId };
|
|
243
228
|
|
|
244
|
-
export interface RecordType<N> {
|
|
245
|
-
attributes: Record<SmolStr, TypeOfAttribute<N>>;
|
|
246
|
-
additionalAttributes?: boolean;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export type Type<N> = ({} & TypeVariant<N>) | { type: N };
|
|
250
|
-
|
|
251
229
|
export interface ActionEntityUID<N> {
|
|
252
230
|
id: SmolStr;
|
|
253
231
|
type?: N;
|
|
254
232
|
}
|
|
255
233
|
|
|
256
|
-
export interface
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
234
|
+
export interface StandardEntityType<N> {
|
|
235
|
+
memberOfTypes?: N[];
|
|
236
|
+
shape?: AttributesOrContext<N>;
|
|
237
|
+
tags?: Type<N>;
|
|
260
238
|
}
|
|
261
239
|
|
|
240
|
+
export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
|
|
241
|
+
|
|
262
242
|
export interface ActionType<N> {
|
|
263
243
|
attributes?: Record<SmolStr, CedarValueJson>;
|
|
264
244
|
appliesTo?: ApplySpec<N>;
|
|
@@ -266,15 +246,7 @@ export interface ActionType<N> {
|
|
|
266
246
|
annotations?: Annotations;
|
|
267
247
|
}
|
|
268
248
|
|
|
269
|
-
export type
|
|
270
|
-
|
|
271
|
-
export interface StandardEntityType<N> {
|
|
272
|
-
memberOfTypes?: N[];
|
|
273
|
-
shape?: AttributesOrContext<N>;
|
|
274
|
-
tags?: Type<N>;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export type EntityTypeKind<N> = StandardEntityType<N> | { enum: NonEmpty<SmolStr> };
|
|
249
|
+
export type Type<N> = ({} & TypeVariant<N>) | { type: N };
|
|
278
250
|
|
|
279
251
|
export interface NamespaceDefinition<N> {
|
|
280
252
|
commonTypes?: Record<CommonTypeId, CommonType<N>>;
|
|
@@ -283,33 +255,58 @@ export interface NamespaceDefinition<N> {
|
|
|
283
255
|
annotations?: Annotations;
|
|
284
256
|
}
|
|
285
257
|
|
|
258
|
+
export interface ApplySpec<N> {
|
|
259
|
+
resourceTypes: N[];
|
|
260
|
+
principalTypes: N[];
|
|
261
|
+
context?: AttributesOrContext<N>;
|
|
262
|
+
}
|
|
263
|
+
|
|
286
264
|
export type CommonTypeId = string;
|
|
287
265
|
|
|
288
|
-
export type
|
|
266
|
+
export type AttributesOrContext<N> = Type<N>;
|
|
289
267
|
|
|
290
|
-
export type
|
|
268
|
+
export type EntityTypeKind<N> = StandardEntityType<N> | { enum: NonEmpty<SmolStr> };
|
|
291
269
|
|
|
292
|
-
export
|
|
270
|
+
export interface RecordType<N> {
|
|
271
|
+
attributes: Record<SmolStr, TypeOfAttribute<N>>;
|
|
272
|
+
additionalAttributes?: boolean;
|
|
273
|
+
}
|
|
293
274
|
|
|
294
|
-
export type
|
|
275
|
+
export type Var = "principal" | "action" | "resource" | "context";
|
|
295
276
|
|
|
296
|
-
export
|
|
277
|
+
export interface TypeAndId {
|
|
278
|
+
type: string;
|
|
279
|
+
id: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArgs } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
|
|
297
283
|
|
|
298
284
|
export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
|
|
299
285
|
|
|
300
|
-
export
|
|
301
|
-
fn: string;
|
|
302
|
-
arg: CedarValueJson;
|
|
303
|
-
}
|
|
286
|
+
export type FnAndArgs = { fn: string; arg: CedarValueJson } | { fn: string; args: CedarValueJson[] };
|
|
304
287
|
|
|
305
|
-
export
|
|
306
|
-
|
|
307
|
-
|
|
288
|
+
export type Annotations = Record<string, Annotation>;
|
|
289
|
+
|
|
290
|
+
export type UnreservedId = string;
|
|
291
|
+
|
|
292
|
+
export type AnyId = SmolStr;
|
|
293
|
+
|
|
294
|
+
export interface PrincipalOrResourceIsConstraint {
|
|
295
|
+
entity_type: string;
|
|
296
|
+
in?: PrincipalOrResourceInConstraint;
|
|
308
297
|
}
|
|
309
298
|
|
|
310
|
-
export type
|
|
299
|
+
export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
|
|
311
300
|
|
|
312
|
-
export type
|
|
301
|
+
export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
|
|
302
|
+
|
|
303
|
+
export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
|
|
304
|
+
|
|
305
|
+
export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
|
|
306
|
+
|
|
307
|
+
export type EqConstraint = { entity: EntityUidJson } | { slot: string };
|
|
308
|
+
|
|
309
|
+
export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
|
|
313
310
|
|
|
314
311
|
export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
|
|
315
312
|
|
|
@@ -322,7 +319,7 @@ export interface PolicyJson {
|
|
|
322
319
|
annotations?: Annotations;
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
export type
|
|
322
|
+
export type Effect = "permit" | "forbid";
|
|
326
323
|
|
|
327
324
|
type SmolStr = string;
|
|
328
325
|
export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
|
package/esm/cedar_wasm_bg.js
CHANGED
|
@@ -109,28 +109,6 @@ function getDataViewMemory0() {
|
|
|
109
109
|
}
|
|
110
110
|
return cachedDataViewMemory0;
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Get valid request environment
|
|
114
|
-
* @param {Template} t
|
|
115
|
-
* @param {Schema} s
|
|
116
|
-
* @returns {GetValidRequestEnvsResult}
|
|
117
|
-
*/
|
|
118
|
-
export function getValidRequestEnvsTemplate(t, s) {
|
|
119
|
-
const ret = wasm.getValidRequestEnvsTemplate(t, s);
|
|
120
|
-
return ret;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Get valid request environment
|
|
125
|
-
* @param {Policy} t
|
|
126
|
-
* @param {Schema} s
|
|
127
|
-
* @returns {GetValidRequestEnvsResult}
|
|
128
|
-
*/
|
|
129
|
-
export function getValidRequestEnvsPolicy(t, s) {
|
|
130
|
-
const ret = wasm.getValidRequestEnvsPolicy(t, s);
|
|
131
|
-
return ret;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
112
|
/**
|
|
135
113
|
* @returns {string}
|
|
136
114
|
*/
|
|
@@ -164,25 +142,34 @@ export function getCedarSDKVersion() {
|
|
|
164
142
|
}
|
|
165
143
|
|
|
166
144
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* @param {ValidationCall} call
|
|
172
|
-
* @returns {ValidationAnswer}
|
|
145
|
+
* Get valid request environment
|
|
146
|
+
* @param {Template} t
|
|
147
|
+
* @param {Schema} s
|
|
148
|
+
* @returns {GetValidRequestEnvsResult}
|
|
173
149
|
*/
|
|
174
|
-
export function
|
|
175
|
-
const ret = wasm.
|
|
150
|
+
export function getValidRequestEnvsTemplate(t, s) {
|
|
151
|
+
const ret = wasm.getValidRequestEnvsTemplate(t, s);
|
|
176
152
|
return ret;
|
|
177
153
|
}
|
|
178
154
|
|
|
179
155
|
/**
|
|
180
|
-
*
|
|
181
|
-
* @param {
|
|
156
|
+
* Get valid request environment
|
|
157
|
+
* @param {Policy} t
|
|
158
|
+
* @param {Schema} s
|
|
159
|
+
* @returns {GetValidRequestEnvsResult}
|
|
160
|
+
*/
|
|
161
|
+
export function getValidRequestEnvsPolicy(t, s) {
|
|
162
|
+
const ret = wasm.getValidRequestEnvsPolicy(t, s);
|
|
163
|
+
return ret;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Check whether a set of entities successfully parses.
|
|
168
|
+
* @param {EntitiesParsingCall} call
|
|
182
169
|
* @returns {CheckParseAnswer}
|
|
183
170
|
*/
|
|
184
|
-
export function
|
|
185
|
-
const ret = wasm.
|
|
171
|
+
export function checkParseEntities(call) {
|
|
172
|
+
const ret = wasm.checkParseEntities(call);
|
|
186
173
|
return ret;
|
|
187
174
|
}
|
|
188
175
|
|
|
@@ -197,12 +184,12 @@ export function checkParseSchema(schema) {
|
|
|
197
184
|
}
|
|
198
185
|
|
|
199
186
|
/**
|
|
200
|
-
* Check whether a set
|
|
201
|
-
* @param {
|
|
187
|
+
* Check whether a policy set successfully parses.
|
|
188
|
+
* @param {PolicySet} policies
|
|
202
189
|
* @returns {CheckParseAnswer}
|
|
203
190
|
*/
|
|
204
|
-
export function
|
|
205
|
-
const ret = wasm.
|
|
191
|
+
export function checkParsePolicySet(policies) {
|
|
192
|
+
const ret = wasm.checkParsePolicySet(policies);
|
|
206
193
|
return ret;
|
|
207
194
|
}
|
|
208
195
|
|
|
@@ -227,17 +214,27 @@ export function formatPolicies(call) {
|
|
|
227
214
|
}
|
|
228
215
|
|
|
229
216
|
/**
|
|
230
|
-
*
|
|
231
|
-
* @param {
|
|
232
|
-
* @returns {
|
|
217
|
+
* Return the Cedar (textual) representation of a template.
|
|
218
|
+
* @param {Template} template
|
|
219
|
+
* @returns {PolicyToTextAnswer}
|
|
233
220
|
*/
|
|
234
|
-
export function
|
|
235
|
-
const ret = wasm.
|
|
221
|
+
export function templateToText(template) {
|
|
222
|
+
const ret = wasm.templateToText(template);
|
|
236
223
|
return ret;
|
|
237
224
|
}
|
|
238
225
|
|
|
239
226
|
/**
|
|
240
|
-
*
|
|
227
|
+
* Return the JSON representation of a policy.
|
|
228
|
+
* @param {Policy} policy
|
|
229
|
+
* @returns {PolicyToJsonAnswer}
|
|
230
|
+
*/
|
|
231
|
+
export function policyToJson(policy) {
|
|
232
|
+
const ret = wasm.policyToJson(policy);
|
|
233
|
+
return ret;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Takes a `PolicySet` represented as string and return the policies
|
|
241
238
|
* and templates split into vecs and sorted by id.
|
|
242
239
|
* @param {string} policyset_str
|
|
243
240
|
* @returns {PolicySetTextToPartsAnswer}
|
|
@@ -250,32 +247,32 @@ export function policySetTextToParts(policyset_str) {
|
|
|
250
247
|
}
|
|
251
248
|
|
|
252
249
|
/**
|
|
253
|
-
* Return the
|
|
254
|
-
* @param {
|
|
255
|
-
* @returns {
|
|
250
|
+
* Return the JSON representation of a schema.
|
|
251
|
+
* @param {Schema} schema
|
|
252
|
+
* @returns {SchemaToJsonAnswer}
|
|
256
253
|
*/
|
|
257
|
-
export function
|
|
258
|
-
const ret = wasm.
|
|
254
|
+
export function schemaToJson(schema) {
|
|
255
|
+
const ret = wasm.schemaToJson(schema);
|
|
259
256
|
return ret;
|
|
260
257
|
}
|
|
261
258
|
|
|
262
259
|
/**
|
|
263
|
-
* Return the Cedar (textual) representation of a
|
|
264
|
-
* @param {
|
|
265
|
-
* @returns {
|
|
260
|
+
* Return the Cedar (textual) representation of a schema.
|
|
261
|
+
* @param {Schema} schema
|
|
262
|
+
* @returns {SchemaToTextAnswer}
|
|
266
263
|
*/
|
|
267
|
-
export function
|
|
268
|
-
const ret = wasm.
|
|
264
|
+
export function schemaToText(schema) {
|
|
265
|
+
const ret = wasm.schemaToText(schema);
|
|
269
266
|
return ret;
|
|
270
267
|
}
|
|
271
268
|
|
|
272
269
|
/**
|
|
273
|
-
* Return the
|
|
270
|
+
* Return the Cedar (textual) representation of a policy.
|
|
274
271
|
* @param {Policy} policy
|
|
275
|
-
* @returns {
|
|
272
|
+
* @returns {PolicyToTextAnswer}
|
|
276
273
|
*/
|
|
277
|
-
export function
|
|
278
|
-
const ret = wasm.
|
|
274
|
+
export function policyToText(policy) {
|
|
275
|
+
const ret = wasm.policyToText(policy);
|
|
279
276
|
return ret;
|
|
280
277
|
}
|
|
281
278
|
|
|
@@ -290,22 +287,25 @@ export function templateToJson(template) {
|
|
|
290
287
|
}
|
|
291
288
|
|
|
292
289
|
/**
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
290
|
+
* Parse a policy set and optionally validate it against a provided schema
|
|
291
|
+
*
|
|
292
|
+
* This is the basic validator interface, using [`ValidationCall`] and
|
|
293
|
+
* [`ValidationAnswer`] types
|
|
294
|
+
* @param {ValidationCall} call
|
|
295
|
+
* @returns {ValidationAnswer}
|
|
296
296
|
*/
|
|
297
|
-
export function
|
|
298
|
-
const ret = wasm.
|
|
297
|
+
export function validate(call) {
|
|
298
|
+
const ret = wasm.validate(call);
|
|
299
299
|
return ret;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
304
|
-
* @param {
|
|
305
|
-
* @returns {
|
|
303
|
+
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
304
|
+
* @param {AuthorizationCall} call
|
|
305
|
+
* @returns {AuthorizationAnswer}
|
|
306
306
|
*/
|
|
307
|
-
export function
|
|
308
|
-
const ret = wasm.
|
|
307
|
+
export function isAuthorized(call) {
|
|
308
|
+
const ret = wasm.isAuthorized(call);
|
|
309
309
|
return ret;
|
|
310
310
|
}
|
|
311
311
|
|
package/esm/cedar_wasm_bg.wasm
CHANGED
|
Binary file
|