@cedar-policy/cedar-wasm 4.5.1 → 4.6.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 +182 -148
- package/esm/cedar_wasm_bg.js +152 -99
- package/esm/cedar_wasm_bg.wasm +0 -0
- package/esm/cedar_wasm_bg.wasm.d.ts +6 -3
- package/esm/package.json +1 -1
- package/nodejs/cedar_wasm.d.ts +182 -148
- package/nodejs/cedar_wasm.js +156 -112
- package/nodejs/cedar_wasm_bg.wasm +0 -0
- package/nodejs/cedar_wasm_bg.wasm.d.ts +6 -3
- package/nodejs/package.json +1 -1
- package/package.json +1 -1
- package/web/cedar_wasm.d.ts +188 -151
- package/web/cedar_wasm.js +155 -94
- package/web/cedar_wasm_bg.wasm +0 -0
- package/web/cedar_wasm_bg.wasm.d.ts +6 -3
- package/web/package.json +1 -1
package/esm/cedar_wasm.d.ts
CHANGED
|
@@ -5,11 +5,38 @@ export function getCedarSDKVersion(): string;
|
|
|
5
5
|
/**
|
|
6
6
|
* Get valid request environment
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function getValidRequestEnvsPolicy(t: Policy, s: Schema): GetValidRequestEnvsResult;
|
|
9
9
|
/**
|
|
10
10
|
* Get valid request environment
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidRequestEnvsResult;
|
|
13
|
+
/**
|
|
14
|
+
* Preparse and cache a policy set in thread-local storage
|
|
15
|
+
*
|
|
16
|
+
* # Errors
|
|
17
|
+
*
|
|
18
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
19
|
+
*/
|
|
20
|
+
export function preparsePolicySet(pset_id: string, policies: PolicySet): CheckParseAnswer;
|
|
21
|
+
/**
|
|
22
|
+
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
23
|
+
*/
|
|
24
|
+
export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
|
|
25
|
+
/**
|
|
26
|
+
* Stateful authorization using preparsed schemas and policy sets.
|
|
27
|
+
*
|
|
28
|
+
* This function works like [`is_authorized`] but retrieves schemas and policy sets
|
|
29
|
+
* from thread-local cache instead of parsing them on each call.
|
|
30
|
+
*/
|
|
31
|
+
export function statefulIsAuthorized(call: StatefulAuthorizationCall): AuthorizationAnswer;
|
|
32
|
+
/**
|
|
33
|
+
* Preparse and cache a schema in thread-local storage
|
|
34
|
+
*
|
|
35
|
+
* # Errors
|
|
36
|
+
*
|
|
37
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
38
|
+
*/
|
|
39
|
+
export function preparseSchema(schema_name: string, schema: Schema): CheckParseAnswer;
|
|
13
40
|
/**
|
|
14
41
|
* Check whether a set of entities successfully parses.
|
|
15
42
|
*/
|
|
@@ -27,17 +54,17 @@ export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
|
|
|
27
54
|
*/
|
|
28
55
|
export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
|
|
29
56
|
/**
|
|
30
|
-
*
|
|
57
|
+
* Return the Cedar (textual) representation of a policy.
|
|
31
58
|
*/
|
|
32
|
-
export function
|
|
59
|
+
export function policyToText(policy: Policy): PolicyToTextAnswer;
|
|
33
60
|
/**
|
|
34
|
-
* Return the Cedar (textual) representation of a
|
|
61
|
+
* Return the Cedar (textual) representation of a schema.
|
|
35
62
|
*/
|
|
36
|
-
export function
|
|
63
|
+
export function schemaToText(schema: Schema): SchemaToTextAnswer;
|
|
37
64
|
/**
|
|
38
|
-
* Return the JSON representation of a
|
|
65
|
+
* Return the JSON representation of a template.
|
|
39
66
|
*/
|
|
40
|
-
export function
|
|
67
|
+
export function templateToJson(template: Template): PolicyToJsonAnswer;
|
|
41
68
|
/**
|
|
42
69
|
* Takes a `PolicySet` represented as string and return the policies
|
|
43
70
|
* and templates split into vecs and sorted by id.
|
|
@@ -48,17 +75,21 @@ export function policySetTextToParts(policyset_str: string): PolicySetTextToPart
|
|
|
48
75
|
*/
|
|
49
76
|
export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
|
|
50
77
|
/**
|
|
51
|
-
* Return the
|
|
78
|
+
* Return the JSON representation of a policy.
|
|
52
79
|
*/
|
|
53
|
-
export function
|
|
80
|
+
export function policyToJson(policy: Policy): PolicyToJsonAnswer;
|
|
54
81
|
/**
|
|
55
|
-
* Return the Cedar (textual) representation of a
|
|
82
|
+
* Return the Cedar (textual) representation of a template.
|
|
56
83
|
*/
|
|
57
|
-
export function
|
|
84
|
+
export function templateToText(template: Template): PolicyToTextAnswer;
|
|
58
85
|
/**
|
|
59
|
-
*
|
|
86
|
+
* Get language version of Cedar
|
|
60
87
|
*/
|
|
61
|
-
export function
|
|
88
|
+
export function getCedarLangVersion(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
91
|
+
*/
|
|
92
|
+
export function formatPolicies(call: FormattingCall): FormattingAnswer;
|
|
62
93
|
/**
|
|
63
94
|
* Parse a policy set and optionally validate it against a provided schema
|
|
64
95
|
*
|
|
@@ -66,74 +97,33 @@ export function templateToJson(template: Template): PolicyToJsonAnswer;
|
|
|
66
97
|
* [`ValidationAnswer`] types
|
|
67
98
|
*/
|
|
68
99
|
export function validate(call: ValidationCall): ValidationAnswer;
|
|
69
|
-
/**
|
|
70
|
-
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
71
|
-
*/
|
|
72
|
-
export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
|
|
73
|
-
/**
|
|
74
|
-
* Get language version of Cedar
|
|
75
|
-
*/
|
|
76
|
-
export function getCedarLangVersion(): string;
|
|
77
100
|
export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
|
|
78
101
|
|
|
79
|
-
export
|
|
80
|
-
entities: Entities;
|
|
81
|
-
schema?: Schema | null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
|
|
85
|
-
|
|
86
|
-
export interface ContextParsingCall {
|
|
87
|
-
context: Context;
|
|
88
|
-
schema?: Schema | null;
|
|
89
|
-
action?: EntityUid | null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
|
|
93
|
-
|
|
94
|
-
export interface FormattingCall {
|
|
95
|
-
policyText: string;
|
|
96
|
-
lineWidth?: number;
|
|
97
|
-
indentWidth?: number;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
|
|
101
|
-
|
|
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;
|
|
112
|
-
}
|
|
102
|
+
export type SlotId = string;
|
|
113
103
|
|
|
114
|
-
export type
|
|
104
|
+
export type PolicyId = string;
|
|
115
105
|
|
|
116
|
-
export interface
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
policies: PolicySet;
|
|
106
|
+
export interface Response {
|
|
107
|
+
decision: Decision;
|
|
108
|
+
diagnostics: Diagnostics;
|
|
120
109
|
}
|
|
121
110
|
|
|
122
|
-
export interface
|
|
111
|
+
export interface AuthorizationError {
|
|
123
112
|
policyId: string;
|
|
124
113
|
error: DetailedError;
|
|
125
114
|
}
|
|
126
115
|
|
|
127
116
|
export type AuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; response: Response; warnings: DetailedError[] };
|
|
128
117
|
|
|
129
|
-
export interface
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
118
|
+
export interface StatefulAuthorizationCall {
|
|
119
|
+
principal: EntityUid;
|
|
120
|
+
action: EntityUid;
|
|
121
|
+
resource: EntityUid;
|
|
122
|
+
context: Context;
|
|
123
|
+
preparsedSchemaName?: string;
|
|
124
|
+
validateRequest?: boolean;
|
|
125
|
+
preparsedPolicySetId: string;
|
|
126
|
+
entities: Entities;
|
|
137
127
|
}
|
|
138
128
|
|
|
139
129
|
export interface AuthorizationCall {
|
|
@@ -152,19 +142,7 @@ export interface Diagnostics {
|
|
|
152
142
|
errors: AuthorizationError[];
|
|
153
143
|
}
|
|
154
144
|
|
|
155
|
-
export type
|
|
156
|
-
|
|
157
|
-
export type SlotId = string;
|
|
158
|
-
|
|
159
|
-
export type ValidationMode = "strict";
|
|
160
|
-
|
|
161
|
-
export type StaticPolicySet = string | Policy[] | Record<PolicyId, Policy>;
|
|
162
|
-
|
|
163
|
-
export type Context = Record<string, CedarValueJson>;
|
|
164
|
-
|
|
165
|
-
export interface SourceLabel extends SourceLocation {
|
|
166
|
-
label: string | null;
|
|
167
|
-
}
|
|
145
|
+
export type Severity = "advice" | "warning" | "error";
|
|
168
146
|
|
|
169
147
|
export interface TemplateLink {
|
|
170
148
|
templateId: PolicyId;
|
|
@@ -172,8 +150,6 @@ export interface TemplateLink {
|
|
|
172
150
|
values: Record<SlotId, EntityUid>;
|
|
173
151
|
}
|
|
174
152
|
|
|
175
|
-
export type Policy = string | PolicyJson;
|
|
176
|
-
|
|
177
153
|
export type Schema = string | SchemaJson<string>;
|
|
178
154
|
|
|
179
155
|
export interface SourceLocation {
|
|
@@ -181,8 +157,6 @@ export interface SourceLocation {
|
|
|
181
157
|
end: number;
|
|
182
158
|
}
|
|
183
159
|
|
|
184
|
-
export type Severity = "advice" | "warning" | "error";
|
|
185
|
-
|
|
186
160
|
export interface DetailedError {
|
|
187
161
|
message: string;
|
|
188
162
|
help: string | null;
|
|
@@ -199,15 +173,71 @@ export interface PolicySet {
|
|
|
199
173
|
templateLinks?: TemplateLink[];
|
|
200
174
|
}
|
|
201
175
|
|
|
202
|
-
export type Template = string | PolicyJson;
|
|
203
|
-
|
|
204
176
|
export type EntityUid = EntityUidJson;
|
|
205
177
|
|
|
178
|
+
export type Policy = string | PolicyJson;
|
|
179
|
+
|
|
180
|
+
export type StaticPolicySet = string | Policy[] | Record<PolicyId, Policy>;
|
|
181
|
+
|
|
182
|
+
export type Context = Record<string, CedarValueJson>;
|
|
183
|
+
|
|
206
184
|
export type Entities = Array<EntityJson>;
|
|
207
185
|
|
|
208
|
-
export
|
|
186
|
+
export interface SourceLabel extends SourceLocation {
|
|
187
|
+
label: string | null;
|
|
188
|
+
}
|
|
209
189
|
|
|
210
|
-
export type
|
|
190
|
+
export type Template = string | PolicyJson;
|
|
191
|
+
|
|
192
|
+
export type ValidationMode = "strict";
|
|
193
|
+
|
|
194
|
+
export interface EntitiesParsingCall {
|
|
195
|
+
entities: Entities;
|
|
196
|
+
schema?: Schema | null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface ContextParsingCall {
|
|
200
|
+
context: Context;
|
|
201
|
+
schema?: Schema | null;
|
|
202
|
+
action?: EntityUid | null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
|
|
206
|
+
|
|
207
|
+
export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
|
|
208
|
+
|
|
209
|
+
export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
|
|
210
|
+
|
|
211
|
+
export type PolicySetTextToPartsAnswer = { type: "success"; policies: string[]; policy_templates: string[] } | { type: "failure"; errors: DetailedError[] };
|
|
212
|
+
|
|
213
|
+
export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
|
|
214
|
+
|
|
215
|
+
export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
|
|
216
|
+
|
|
217
|
+
export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
|
|
218
|
+
|
|
219
|
+
export interface FormattingCall {
|
|
220
|
+
policyText: string;
|
|
221
|
+
lineWidth?: number;
|
|
222
|
+
indentWidth?: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ValidationSettings {
|
|
226
|
+
mode: ValidationMode;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface ValidationError {
|
|
230
|
+
policyId: string;
|
|
231
|
+
error: DetailedError;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface ValidationCall {
|
|
235
|
+
validationSettings?: ValidationSettings;
|
|
236
|
+
schema: Schema;
|
|
237
|
+
policies: PolicySet;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
|
|
211
241
|
|
|
212
242
|
export interface EntityJson {
|
|
213
243
|
uid: EntityUidJson;
|
|
@@ -216,29 +246,42 @@ export interface EntityJson {
|
|
|
216
246
|
tags?: Record<string, CedarValueJson>;
|
|
217
247
|
}
|
|
218
248
|
|
|
219
|
-
export type
|
|
249
|
+
export type AnyId = SmolStr;
|
|
220
250
|
|
|
221
|
-
export type
|
|
251
|
+
export type UnreservedId = string;
|
|
222
252
|
|
|
223
|
-
export type
|
|
253
|
+
export type Effect = "permit" | "forbid";
|
|
224
254
|
|
|
225
|
-
export type
|
|
255
|
+
export type EqConstraint = { entity: EntityUidJson } | { slot: string };
|
|
256
|
+
|
|
257
|
+
export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
|
|
258
|
+
|
|
259
|
+
export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
|
|
260
|
+
|
|
261
|
+
export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
|
|
262
|
+
|
|
263
|
+
export interface PrincipalOrResourceIsConstraint {
|
|
264
|
+
entity_type: string;
|
|
265
|
+
in?: PrincipalOrResourceInConstraint;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
|
|
269
|
+
|
|
270
|
+
export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
|
|
271
|
+
|
|
272
|
+
export type AttributesOrContext<N> = Type<N>;
|
|
226
273
|
|
|
227
274
|
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 };
|
|
228
275
|
|
|
276
|
+
export type Type<N> = ({} & TypeVariant<N>) | { type: N };
|
|
277
|
+
|
|
278
|
+
export type EntityTypeKind<N> = StandardEntityType<N> | { enum: NonEmpty<SmolStr> };
|
|
279
|
+
|
|
229
280
|
export interface ActionEntityUID<N> {
|
|
230
281
|
id: SmolStr;
|
|
231
282
|
type?: N;
|
|
232
283
|
}
|
|
233
284
|
|
|
234
|
-
export interface StandardEntityType<N> {
|
|
235
|
-
memberOfTypes?: N[];
|
|
236
|
-
shape?: AttributesOrContext<N>;
|
|
237
|
-
tags?: Type<N>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
|
|
241
|
-
|
|
242
285
|
export interface ActionType<N> {
|
|
243
286
|
attributes?: Record<SmolStr, CedarValueJson>;
|
|
244
287
|
appliesTo?: ApplySpec<N>;
|
|
@@ -246,80 +289,71 @@ export interface ActionType<N> {
|
|
|
246
289
|
annotations?: Annotations;
|
|
247
290
|
}
|
|
248
291
|
|
|
249
|
-
export type Type<N> = ({} & TypeVariant<N>) | { type: N };
|
|
250
|
-
|
|
251
|
-
export interface NamespaceDefinition<N> {
|
|
252
|
-
commonTypes?: Record<CommonTypeId, CommonType<N>>;
|
|
253
|
-
entityTypes: Record<UnreservedId, EntityType<N>>;
|
|
254
|
-
actions: Record<SmolStr, ActionType<N>>;
|
|
255
|
-
annotations?: Annotations;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
292
|
export interface ApplySpec<N> {
|
|
259
293
|
resourceTypes: N[];
|
|
260
294
|
principalTypes: N[];
|
|
261
295
|
context?: AttributesOrContext<N>;
|
|
262
296
|
}
|
|
263
297
|
|
|
264
|
-
export type
|
|
265
|
-
|
|
266
|
-
export type AttributesOrContext<N> = Type<N>;
|
|
298
|
+
export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
|
|
267
299
|
|
|
268
|
-
export
|
|
300
|
+
export interface NamespaceDefinition<N> {
|
|
301
|
+
commonTypes?: Record<CommonTypeId, CommonType<N>>;
|
|
302
|
+
entityTypes: Record<UnreservedId, EntityType<N>>;
|
|
303
|
+
actions: Record<SmolStr, ActionType<N>>;
|
|
304
|
+
annotations?: Annotations;
|
|
305
|
+
}
|
|
269
306
|
|
|
270
307
|
export interface RecordType<N> {
|
|
271
308
|
attributes: Record<SmolStr, TypeOfAttribute<N>>;
|
|
272
309
|
additionalAttributes?: boolean;
|
|
273
310
|
}
|
|
274
311
|
|
|
275
|
-
export
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
id: string;
|
|
312
|
+
export interface StandardEntityType<N> {
|
|
313
|
+
memberOfTypes?: N[];
|
|
314
|
+
shape?: AttributesOrContext<N>;
|
|
315
|
+
tags?: Type<N>;
|
|
280
316
|
}
|
|
281
317
|
|
|
282
|
-
export type
|
|
283
|
-
|
|
284
|
-
export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
|
|
285
|
-
|
|
286
|
-
export type FnAndArgs = { fn: string; arg: CedarValueJson } | { fn: string; args: CedarValueJson[] };
|
|
287
|
-
|
|
288
|
-
export type Annotations = Record<string, Annotation>;
|
|
318
|
+
export type CommonTypeId = string;
|
|
289
319
|
|
|
290
|
-
export type
|
|
320
|
+
export type Decision = "allow" | "deny";
|
|
291
321
|
|
|
292
|
-
export type
|
|
322
|
+
export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
|
|
293
323
|
|
|
294
|
-
export interface
|
|
295
|
-
|
|
296
|
-
|
|
324
|
+
export interface PolicyJson {
|
|
325
|
+
effect: Effect;
|
|
326
|
+
principal: PrincipalConstraint;
|
|
327
|
+
action: ActionConstraint;
|
|
328
|
+
resource: ResourceConstraint;
|
|
329
|
+
conditions: Clause[];
|
|
330
|
+
annotations?: Annotations;
|
|
297
331
|
}
|
|
298
332
|
|
|
299
|
-
export type
|
|
333
|
+
export type ExtFuncCall = {} & Record<string, Array<Expr>>;
|
|
300
334
|
|
|
301
|
-
export type
|
|
335
|
+
export type Expr = ExprNoExt | ExtFuncCall;
|
|
302
336
|
|
|
303
|
-
export type
|
|
337
|
+
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> };
|
|
304
338
|
|
|
305
|
-
export type
|
|
339
|
+
export type PatternElem = "Wildcard" | { Literal: SmolStr };
|
|
306
340
|
|
|
307
|
-
export type
|
|
341
|
+
export type Annotation = SmolStr;
|
|
308
342
|
|
|
309
|
-
export type
|
|
343
|
+
export type Annotations = Record<string, Annotation>;
|
|
310
344
|
|
|
311
|
-
export type
|
|
345
|
+
export type Var = "principal" | "action" | "resource" | "context";
|
|
312
346
|
|
|
313
|
-
export interface
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
action: ActionConstraint;
|
|
317
|
-
resource: ResourceConstraint;
|
|
318
|
-
conditions: Clause[];
|
|
319
|
-
annotations?: Annotations;
|
|
347
|
+
export interface TypeAndId {
|
|
348
|
+
type: string;
|
|
349
|
+
id: string;
|
|
320
350
|
}
|
|
321
351
|
|
|
322
|
-
export type
|
|
352
|
+
export type FnAndArgs = { fn: string; arg: CedarValueJson } | { fn: string; args: CedarValueJson[] };
|
|
353
|
+
|
|
354
|
+
export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
|
|
355
|
+
|
|
356
|
+
export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArgs } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
|
|
323
357
|
|
|
324
358
|
type SmolStr = string;
|
|
325
359
|
export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
|