@magda/typescript-common 1.2.1 → 2.0.0-alpha.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/dist/OpaCompileResponseParser.d.ts +260 -36
- package/dist/OpaCompileResponseParser.js +697 -297
- package/dist/OpaCompileResponseParser.js.map +1 -1
- package/dist/SQLUtils.d.ts +70 -0
- package/dist/SQLUtils.js +263 -0
- package/dist/SQLUtils.js.map +1 -0
- package/dist/ServerError.d.ts +9 -0
- package/dist/ServerError.js +17 -0
- package/dist/ServerError.js.map +1 -0
- package/dist/authorization-api/authMiddleware.d.ts +60 -1
- package/dist/authorization-api/authMiddleware.js +155 -3
- package/dist/authorization-api/authMiddleware.js.map +1 -1
- package/dist/authorization-api/constants.d.ts +5 -0
- package/dist/authorization-api/constants.js +13 -0
- package/dist/authorization-api/constants.js.map +1 -0
- package/dist/authorization-api/model.d.ts +2 -7
- package/dist/express/getNoCacheHeaders.d.ts +6 -0
- package/dist/express/getNoCacheHeaders.js +9 -0
- package/dist/express/getNoCacheHeaders.js.map +1 -0
- package/dist/express/setResponseNoCache.d.ts +3 -0
- package/dist/express/setResponseNoCache.js +9 -0
- package/dist/express/setResponseNoCache.js.map +1 -0
- package/dist/generated/registry/api.d.ts +47 -2
- package/dist/generated/registry/api.js +197 -2
- package/dist/generated/registry/api.js.map +1 -1
- package/dist/getAbsoluteUrl.d.ts +3 -2
- package/dist/getAbsoluteUrl.js +2 -1
- package/dist/getAbsoluteUrl.js.map +1 -1
- package/dist/getStorageUrl.d.ts +34 -0
- package/dist/getStorageUrl.js +138 -0
- package/dist/getStorageUrl.js.map +1 -0
- package/dist/handleServerError.d.ts +2 -0
- package/dist/handleServerError.js +17 -0
- package/dist/handleServerError.js.map +1 -0
- package/dist/opa/AspectQuery.d.ts +71 -0
- package/dist/opa/AspectQuery.js +219 -0
- package/dist/opa/AspectQuery.js.map +1 -0
- package/dist/opa/AuthDecision.d.ts +51 -0
- package/dist/opa/AuthDecision.js +241 -0
- package/dist/opa/AuthDecision.js.map +1 -0
- package/dist/opa/AuthDecisionQueryClient.d.ts +23 -0
- package/dist/opa/AuthDecisionQueryClient.js +113 -0
- package/dist/opa/AuthDecisionQueryClient.js.map +1 -0
- package/dist/pgTypes.d.ts +1 -0
- package/dist/pgTypes.js +18 -0
- package/dist/pgTypes.js.map +1 -0
- package/dist/registry/AuthorizedRegistryClient.d.ts +1 -0
- package/dist/registry/AuthorizedRegistryClient.js +17 -0
- package/dist/registry/AuthorizedRegistryClient.js.map +1 -1
- package/dist/registry/RegistryClient.d.ts +11 -0
- package/dist/registry/RegistryClient.js +46 -0
- package/dist/registry/RegistryClient.js.map +1 -1
- package/dist/test/getAuthDecision.spec.js +2 -2
- package/dist/test/getAuthDecision.spec.js.map +1 -1
- package/dist/test/getStorageUrl.spec.d.ts +1 -0
- package/dist/test/getStorageUrl.spec.js +95 -0
- package/dist/test/getStorageUrl.spec.js.map +1 -0
- package/dist/test/sampleAuthDecisions/content.json +29 -0
- package/dist/test/sampleAuthDecisions/datasetPermissionWithOrgUnitConstraint.json +79 -0
- package/dist/test/sampleAuthDecisions/extraLargeResponse.json +2519 -0
- package/dist/test/sampleAuthDecisions/simple.json +29 -0
- package/dist/test/sampleAuthDecisions/singleTermAspectRef.json +39 -0
- package/dist/test/sampleAuthDecisions/unconditionalFalseSimple.json +6 -0
- package/dist/test/sampleAuthDecisions/unconditionalNotMacthed.json +6 -0
- package/dist/test/sampleAuthDecisions/unconditionalNotMacthedWithExtraRefs.json +6 -0
- package/dist/test/sampleAuthDecisions/unconditionalTrue.json +6 -0
- package/dist/test/sampleAuthDecisions/unconditionalTrueSimple.json +6 -0
- package/dist/test/sampleAuthDecisions/unconditionalTrueWithDefaultRule.json +6 -0
- package/dist/test/sampleAuthDecisions/withDefaultRule.json +6 -0
- package/dist/test/{sampleOpaResponse.json → sampleOpaResponses/content.json} +0 -0
- package/dist/test/sampleOpaResponses/datasetPermissionWithOrgUnitConstraint.json +341 -0
- package/dist/test/sampleOpaResponses/extraLargeResponse.json +104869 -0
- package/dist/test/{sampleOpaResponseSimple.json → sampleOpaResponses/simple.json} +0 -0
- package/dist/test/sampleOpaResponses/singleTermAspectRef.json +233 -0
- package/dist/test/sampleOpaResponses/unconditionalFalseSimple.json +3 -0
- package/dist/test/sampleOpaResponses/unconditionalNotMacthed.json +73 -0
- package/dist/test/sampleOpaResponses/unconditionalNotMacthedWithExtraRefs.json +155 -0
- package/dist/test/{sampleOpaResponseUnconditionalTrue.json → sampleOpaResponses/unconditionalTrue.json} +0 -0
- package/dist/test/sampleOpaResponses/unconditionalTrueSimple.json +48 -0
- package/dist/test/{sampleOpaResponseUnconditionalTrueWithDefaultRule.json → sampleOpaResponses/unconditionalTrueWithDefaultRule.json} +0 -0
- package/dist/test/{sampleOpaResponseWithDefaultRule.json → sampleOpaResponses/withDefaultRule.json} +0 -0
- package/dist/test/testOpaCompileResponseParser.spec.js +212 -20
- package/dist/test/testOpaCompileResponseParser.spec.js.map +1 -1
- package/package.json +9 -3
|
@@ -53,6 +53,17 @@ export declare class RegoRule {
|
|
|
53
53
|
* @memberof RegoRule
|
|
54
54
|
*/
|
|
55
55
|
value: RegoValue;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the rule contains any expressions that has any resolvable references.
|
|
58
|
+
* reference start with `input.` should be considered as non-resolvable in context of partial evaluation.
|
|
59
|
+
* When this field is set to `true`, we should not attempt to evaluate this expression.
|
|
60
|
+
* i.e. evaluate() method should return immediately.
|
|
61
|
+
* This will speed up evaluation process.
|
|
62
|
+
*
|
|
63
|
+
* @type {boolean}
|
|
64
|
+
* @memberof RegoRule
|
|
65
|
+
*/
|
|
66
|
+
hasNoResolvableRef: boolean;
|
|
56
67
|
/**
|
|
57
68
|
* All Rego expressions in this rule's rule body. @see RegoExp
|
|
58
69
|
*
|
|
@@ -86,6 +97,24 @@ export declare class RegoRule {
|
|
|
86
97
|
*/
|
|
87
98
|
private parser;
|
|
88
99
|
constructor(options: RegoRuleOptions);
|
|
100
|
+
/**
|
|
101
|
+
* OPA PE result might contain duplicate expressions.
|
|
102
|
+
* https://github.com/open-policy-agent/opa/issues/4516
|
|
103
|
+
* This method will remove those duplication by simply string comparison.
|
|
104
|
+
*
|
|
105
|
+
* @return {*}
|
|
106
|
+
* @memberof RegoRule
|
|
107
|
+
*/
|
|
108
|
+
removeDuplicateExpressions(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Test whether the rule is an "impossible" rule.
|
|
111
|
+
* If so, the rule should be simply discarded.
|
|
112
|
+
* See: https://github.com/open-policy-agent/opa/issues/4516
|
|
113
|
+
*
|
|
114
|
+
* @return {*} {boolean}
|
|
115
|
+
* @memberof RegoRule
|
|
116
|
+
*/
|
|
117
|
+
isImpossible(): boolean;
|
|
89
118
|
clone(options?: Partial<RegoRuleOptions>): RegoRule;
|
|
90
119
|
/**
|
|
91
120
|
* Re-evaluate this rule
|
|
@@ -95,6 +124,13 @@ export declare class RegoRule {
|
|
|
95
124
|
* @memberof RegoRule
|
|
96
125
|
*/
|
|
97
126
|
evaluate(): this;
|
|
127
|
+
/**
|
|
128
|
+
* Whether or not the rule is resolvable (i.e. we can tell whether it's matched or not) now.
|
|
129
|
+
*
|
|
130
|
+
* @return {*} {boolean}
|
|
131
|
+
* @memberof RegoRule
|
|
132
|
+
*/
|
|
133
|
+
isResolvable(): boolean;
|
|
98
134
|
/**
|
|
99
135
|
* Generate Human Readable string of this rule
|
|
100
136
|
* If it's fully evaluated, the output will be true or false (or actual rule value)
|
|
@@ -104,6 +140,57 @@ export declare class RegoRule {
|
|
|
104
140
|
* @memberof RegoRule
|
|
105
141
|
*/
|
|
106
142
|
toHumanReadableString(): string;
|
|
143
|
+
toData(): {
|
|
144
|
+
default: boolean;
|
|
145
|
+
value: RegoValue;
|
|
146
|
+
fullName: string;
|
|
147
|
+
name: string;
|
|
148
|
+
expressions: ({
|
|
149
|
+
negated: boolean;
|
|
150
|
+
terms: {
|
|
151
|
+
type: string;
|
|
152
|
+
value: RegoTermValue;
|
|
153
|
+
}[];
|
|
154
|
+
index?: undefined;
|
|
155
|
+
} | {
|
|
156
|
+
negated: boolean;
|
|
157
|
+
index: number;
|
|
158
|
+
terms: {
|
|
159
|
+
type: string;
|
|
160
|
+
value: RegoTermValue;
|
|
161
|
+
}[];
|
|
162
|
+
} | {
|
|
163
|
+
terms: {
|
|
164
|
+
type: string;
|
|
165
|
+
value: RegoTermValue;
|
|
166
|
+
}[];
|
|
167
|
+
negated?: undefined;
|
|
168
|
+
index?: undefined;
|
|
169
|
+
} | {
|
|
170
|
+
index: number;
|
|
171
|
+
terms: {
|
|
172
|
+
type: string;
|
|
173
|
+
value: RegoTermValue;
|
|
174
|
+
}[];
|
|
175
|
+
negated?: undefined;
|
|
176
|
+
})[];
|
|
177
|
+
};
|
|
178
|
+
toJson(): string;
|
|
179
|
+
toConciseData(): {
|
|
180
|
+
default: boolean;
|
|
181
|
+
value: RegoValue;
|
|
182
|
+
fullName: string;
|
|
183
|
+
name: string;
|
|
184
|
+
expressions: {
|
|
185
|
+
negated: boolean;
|
|
186
|
+
operator: string;
|
|
187
|
+
operands: {
|
|
188
|
+
isRef: boolean;
|
|
189
|
+
value: RegoTermValue;
|
|
190
|
+
}[];
|
|
191
|
+
}[];
|
|
192
|
+
};
|
|
193
|
+
toConciseJSON(): string;
|
|
107
194
|
/**
|
|
108
195
|
* Create RegoRule from Opa response data
|
|
109
196
|
*
|
|
@@ -124,8 +211,16 @@ export interface RegoRefPart {
|
|
|
124
211
|
value: string;
|
|
125
212
|
}
|
|
126
213
|
export declare const RegoOperators: {
|
|
127
|
-
|
|
214
|
+
readonly eq: "=";
|
|
215
|
+
readonly equal: "=";
|
|
216
|
+
readonly neq: "!=";
|
|
217
|
+
readonly lt: "<";
|
|
218
|
+
readonly gt: ">";
|
|
219
|
+
readonly lte: "<=";
|
|
220
|
+
readonly gte: ">=";
|
|
128
221
|
};
|
|
222
|
+
export declare type RegoOperatorAstString = keyof typeof RegoOperators;
|
|
223
|
+
export declare type RegoOperatorString = typeof RegoOperators[RegoOperatorAstString];
|
|
129
224
|
export declare type RegoTermValue = RegoRef | RegoValue;
|
|
130
225
|
/**
|
|
131
226
|
* RegoTerm represent the basic elements that creates an expressions.
|
|
@@ -141,6 +236,17 @@ export declare class RegoTerm {
|
|
|
141
236
|
type: string;
|
|
142
237
|
value: RegoTermValue;
|
|
143
238
|
private parser;
|
|
239
|
+
/**
|
|
240
|
+
* Whether the expression contains any resolvable references.
|
|
241
|
+
* reference start with `input.` should be considered as non-resolvable in context of partial evaluation.
|
|
242
|
+
* When this field is set to `true`, we should not attempt to evaluate this expression.
|
|
243
|
+
* i.e. evaluate() method should return immediately.
|
|
244
|
+
* This will speed up evaluation process.
|
|
245
|
+
*
|
|
246
|
+
* @type {boolean}
|
|
247
|
+
* @memberof RegoTerm
|
|
248
|
+
*/
|
|
249
|
+
hasNoResolvableRef: boolean;
|
|
144
250
|
constructor(type: string, value: RegoTermValue, parser: OpaCompileResponseParser);
|
|
145
251
|
clone(): RegoTerm;
|
|
146
252
|
/**
|
|
@@ -149,7 +255,7 @@ export declare class RegoTerm {
|
|
|
149
255
|
* @returns
|
|
150
256
|
* @memberof RegoTerm
|
|
151
257
|
*/
|
|
152
|
-
asString():
|
|
258
|
+
asString(): string;
|
|
153
259
|
/**
|
|
154
260
|
* If it's a reference term. A operator is an Reference term as well
|
|
155
261
|
*
|
|
@@ -217,7 +323,7 @@ export declare class RegoTerm {
|
|
|
217
323
|
* @returns {string}
|
|
218
324
|
* @memberof RegoTerm
|
|
219
325
|
*/
|
|
220
|
-
asOperator():
|
|
326
|
+
asOperator(): "=" | "!=" | "<" | ">" | "<=" | ">=";
|
|
221
327
|
/**
|
|
222
328
|
* If it's a operator term
|
|
223
329
|
*
|
|
@@ -232,6 +338,23 @@ export declare class RegoTerm {
|
|
|
232
338
|
* @memberof RegoTerm
|
|
233
339
|
*/
|
|
234
340
|
getValue(): RegoValue;
|
|
341
|
+
/**
|
|
342
|
+
* Whether or not the RegoTerm is resolvable
|
|
343
|
+
*
|
|
344
|
+
* @return {*} {boolean}
|
|
345
|
+
* @memberof RegoTerm
|
|
346
|
+
*/
|
|
347
|
+
isValueResolvable(): boolean;
|
|
348
|
+
toData(): {
|
|
349
|
+
type: string;
|
|
350
|
+
value: RegoTermValue;
|
|
351
|
+
};
|
|
352
|
+
toJson(): string;
|
|
353
|
+
toConciseData(): {
|
|
354
|
+
isRef: boolean;
|
|
355
|
+
value: RegoTermValue;
|
|
356
|
+
};
|
|
357
|
+
toConciseJSON(): string;
|
|
235
358
|
static parseFromData(data: any, parser: OpaCompileResponseParser): RegoTerm;
|
|
236
359
|
}
|
|
237
360
|
/**
|
|
@@ -248,6 +371,17 @@ export declare class RegoExp {
|
|
|
248
371
|
* @memberof RegoExp
|
|
249
372
|
*/
|
|
250
373
|
terms: RegoTerm[];
|
|
374
|
+
/**
|
|
375
|
+
* Whether the expression contains any resolvable references.
|
|
376
|
+
* reference start with `input.` should be considered as non-resolvable in context of partial evaluation.
|
|
377
|
+
* When this field is set to `true`, we should not attempt to evaluate this expression.
|
|
378
|
+
* i.e. evaluate() method should return immediately.
|
|
379
|
+
* This will speed up evaluation process.
|
|
380
|
+
*
|
|
381
|
+
* @type {boolean}
|
|
382
|
+
* @memberof RegoExp
|
|
383
|
+
*/
|
|
384
|
+
hasNoResolvableRef: boolean;
|
|
251
385
|
/**
|
|
252
386
|
* Whether this expression is a negative expression
|
|
253
387
|
* i.e. it's final evaluation result should be `false` if result is `true`
|
|
@@ -286,7 +420,15 @@ export declare class RegoExp {
|
|
|
286
420
|
* @returns
|
|
287
421
|
* @memberof RegoExp
|
|
288
422
|
*/
|
|
289
|
-
termsAsString():
|
|
423
|
+
termsAsString(): string;
|
|
424
|
+
/**
|
|
425
|
+
* Print concise format expression string presentation.
|
|
426
|
+
* Can be used for debugging
|
|
427
|
+
*
|
|
428
|
+
* @return {*}
|
|
429
|
+
* @memberof RegoExp
|
|
430
|
+
*/
|
|
431
|
+
asString(): string;
|
|
290
432
|
/**
|
|
291
433
|
* Output human readable string
|
|
292
434
|
*
|
|
@@ -301,7 +443,25 @@ export declare class RegoExp {
|
|
|
301
443
|
* @memberof RegoExp
|
|
302
444
|
*/
|
|
303
445
|
getValue(): number | Object;
|
|
304
|
-
|
|
446
|
+
/**
|
|
447
|
+
* Whether or not a expression should be considered as "matched".
|
|
448
|
+
* If all expressions of a rule are "matched", the rule will be considered as "matched".
|
|
449
|
+
* Thus, the rule has a value.
|
|
450
|
+
*
|
|
451
|
+
* Please note: if an expression's value is `0`, empty string "", null etc, the expression is considered as "matched".
|
|
452
|
+
* We only consider an expression as "Not Matched" when the expression has value `false` or is undefined.
|
|
453
|
+
*
|
|
454
|
+
* @return {boolean}
|
|
455
|
+
* @memberof RegoExp
|
|
456
|
+
*/
|
|
457
|
+
isMatched(): boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Whether or not the expression is resolvable now.
|
|
460
|
+
*
|
|
461
|
+
* @return {boolean}
|
|
462
|
+
* @memberof RegoExp
|
|
463
|
+
*/
|
|
464
|
+
isResolvable(): boolean;
|
|
305
465
|
/**
|
|
306
466
|
* Convert operator term to string and put rest operands into an array.
|
|
307
467
|
* And then return a [Operator, Operands] structure
|
|
@@ -309,7 +469,7 @@ export declare class RegoExp {
|
|
|
309
469
|
* @returns {[string, RegoTerm[]]}
|
|
310
470
|
* @memberof RegoExp
|
|
311
471
|
*/
|
|
312
|
-
toOperatorOperandsArray(): [
|
|
472
|
+
toOperatorOperandsArray(): [RegoOperatorString, RegoTerm[]];
|
|
313
473
|
/**
|
|
314
474
|
* Try to evaluate the expression
|
|
315
475
|
*
|
|
@@ -317,6 +477,45 @@ export declare class RegoExp {
|
|
|
317
477
|
* @memberof RegoExp
|
|
318
478
|
*/
|
|
319
479
|
evaluate(): this;
|
|
480
|
+
toData(index?: number, ignoreIndex?: boolean, ignoreNegated?: boolean): {
|
|
481
|
+
negated: boolean;
|
|
482
|
+
terms: {
|
|
483
|
+
type: string;
|
|
484
|
+
value: RegoTermValue;
|
|
485
|
+
}[];
|
|
486
|
+
index?: undefined;
|
|
487
|
+
} | {
|
|
488
|
+
negated: boolean;
|
|
489
|
+
index: number;
|
|
490
|
+
terms: {
|
|
491
|
+
type: string;
|
|
492
|
+
value: RegoTermValue;
|
|
493
|
+
}[];
|
|
494
|
+
} | {
|
|
495
|
+
terms: {
|
|
496
|
+
type: string;
|
|
497
|
+
value: RegoTermValue;
|
|
498
|
+
}[];
|
|
499
|
+
negated?: undefined;
|
|
500
|
+
index?: undefined;
|
|
501
|
+
} | {
|
|
502
|
+
index: number;
|
|
503
|
+
terms: {
|
|
504
|
+
type: string;
|
|
505
|
+
value: RegoTermValue;
|
|
506
|
+
}[];
|
|
507
|
+
negated?: undefined;
|
|
508
|
+
};
|
|
509
|
+
toJSON(index?: number, ignoreIndex?: boolean, ignoreNegated?: boolean): string;
|
|
510
|
+
toConciseData(): {
|
|
511
|
+
negated: boolean;
|
|
512
|
+
operator: string;
|
|
513
|
+
operands: {
|
|
514
|
+
isRef: boolean;
|
|
515
|
+
value: RegoTermValue;
|
|
516
|
+
}[];
|
|
517
|
+
};
|
|
518
|
+
toConciseJSON(): string;
|
|
320
519
|
static parseFromData(expData: any, parser: OpaCompileResponseParser): RegoExp;
|
|
321
520
|
}
|
|
322
521
|
/**
|
|
@@ -328,8 +527,24 @@ export declare class RegoExp {
|
|
|
328
527
|
*/
|
|
329
528
|
export declare class RegoRef {
|
|
330
529
|
parts: RegoRefPart[];
|
|
530
|
+
/**
|
|
531
|
+
* Whether the expression contains any resolvable references.
|
|
532
|
+
* reference start with `input.` should be considered as non-resolvable in context of partial evaluation.
|
|
533
|
+
* When this field is set to `true`, we should not attempt to evaluate this expression.
|
|
534
|
+
* i.e. evaluate() method should return immediately.
|
|
535
|
+
* This will speed up evaluation process.
|
|
536
|
+
*
|
|
537
|
+
* @type {boolean}
|
|
538
|
+
* @memberof RegoRef
|
|
539
|
+
*/
|
|
540
|
+
hasNoResolvableRef: boolean;
|
|
331
541
|
constructor(parts: RegoRefPart[]);
|
|
332
542
|
clone(): RegoRef;
|
|
543
|
+
toData(): {
|
|
544
|
+
type: string;
|
|
545
|
+
value: RegoRefPart[];
|
|
546
|
+
};
|
|
547
|
+
toJson(): string;
|
|
333
548
|
static parseFromData(data: any): RegoRef;
|
|
334
549
|
static convertToFullRefString(parts: RegoRefPart[]): string;
|
|
335
550
|
removeAllPrefixs(str: string, removalPrefixs?: string[]): string;
|
|
@@ -340,7 +555,7 @@ export declare class RegoRef {
|
|
|
340
555
|
hasCollectionLookup(): boolean;
|
|
341
556
|
isSimpleCollectionLookup(): boolean;
|
|
342
557
|
isResolveAsCollectionValue(): boolean;
|
|
343
|
-
asOperator():
|
|
558
|
+
asOperator(): RegoOperatorString | null;
|
|
344
559
|
}
|
|
345
560
|
export interface CompleteRuleResult {
|
|
346
561
|
fullName: string;
|
|
@@ -350,6 +565,30 @@ export interface CompleteRuleResult {
|
|
|
350
565
|
residualRules?: RegoRule[];
|
|
351
566
|
}
|
|
352
567
|
export declare function value2String(value: RegoValue): string;
|
|
568
|
+
export declare class RegoRuleSet {
|
|
569
|
+
fullName: string;
|
|
570
|
+
name: string;
|
|
571
|
+
rules: RegoRule[];
|
|
572
|
+
defaultRule: RegoRule | null;
|
|
573
|
+
value?: any;
|
|
574
|
+
isCompleteEvaluated: boolean;
|
|
575
|
+
parser: OpaCompileResponseParser;
|
|
576
|
+
/**
|
|
577
|
+
* Whether the ruleSet contains any rules that has any resolvable references.
|
|
578
|
+
* reference start with `input.` should be considered as non-resolvable in context of partial evaluation.
|
|
579
|
+
* When this field is set to `true`, we should not attempt to evaluate this expression.
|
|
580
|
+
* i.e. evaluate() method should return immediately.
|
|
581
|
+
* This will speed up evaluation process.
|
|
582
|
+
*
|
|
583
|
+
* @type {boolean}
|
|
584
|
+
* @memberof RegoRuleSet
|
|
585
|
+
*/
|
|
586
|
+
hasNoResolvableRef: boolean;
|
|
587
|
+
constructor(parser: OpaCompileResponseParser, rules: RegoRule[], fullName?: string, name?: string);
|
|
588
|
+
evaluate(): RegoRuleSet;
|
|
589
|
+
isResolvable(): boolean;
|
|
590
|
+
getResidualRules(): RegoRule[];
|
|
591
|
+
}
|
|
353
592
|
/**
|
|
354
593
|
* OPA result Parser
|
|
355
594
|
*
|
|
@@ -387,6 +626,15 @@ export default class OpaCompileResponseParser {
|
|
|
387
626
|
* @memberof OpaCompileResponseParser
|
|
388
627
|
*/
|
|
389
628
|
rules: RegoRule[];
|
|
629
|
+
/**
|
|
630
|
+
* Parsed, compressed & evaluated rule sets
|
|
631
|
+
*
|
|
632
|
+
* @type {RegoRuleSet[]}
|
|
633
|
+
* @memberof OpaCompileResponseParser
|
|
634
|
+
*/
|
|
635
|
+
ruleSets: {
|
|
636
|
+
[fullName: string]: RegoRuleSet;
|
|
637
|
+
};
|
|
390
638
|
queries: RegoExp[];
|
|
391
639
|
/**
|
|
392
640
|
* A cache of all resolved rule result
|
|
@@ -407,6 +655,7 @@ export default class OpaCompileResponseParser {
|
|
|
407
655
|
* @memberof OpaCompileResponseParser
|
|
408
656
|
*/
|
|
409
657
|
readonly pseudoQueryRuleName: string;
|
|
658
|
+
private ruleDuplicationCheckCache;
|
|
410
659
|
private setQueryRuleResult;
|
|
411
660
|
/**
|
|
412
661
|
* Parse OPA result Response
|
|
@@ -416,26 +665,10 @@ export default class OpaCompileResponseParser {
|
|
|
416
665
|
* @memberof OpaCompileResponseParser
|
|
417
666
|
*/
|
|
418
667
|
parse(json: any): RegoRule[];
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
* `CompleteRule` rule involves no `unknowns`
|
|
424
|
-
*
|
|
425
|
-
* Only for internal usage
|
|
426
|
-
*
|
|
427
|
-
* @private
|
|
428
|
-
* @memberof OpaCompileResponseParser
|
|
429
|
-
*/
|
|
430
|
-
private calculateCompleteRuleResult;
|
|
431
|
-
/**
|
|
432
|
-
* Only for internal usage
|
|
433
|
-
*
|
|
434
|
-
* @returns
|
|
435
|
-
* @private
|
|
436
|
-
* @memberof OpaCompileResponseParser
|
|
437
|
-
*/
|
|
438
|
-
private reduceDependencies;
|
|
668
|
+
addRule(rule: RegoRule): void;
|
|
669
|
+
isRefResolvable(fullName: string): boolean;
|
|
670
|
+
getRefValue(fullName: string): any;
|
|
671
|
+
private resolveAllRuleSets;
|
|
439
672
|
/**
|
|
440
673
|
* Call to evaluate a rule
|
|
441
674
|
*
|
|
@@ -466,15 +699,6 @@ export default class OpaCompileResponseParser {
|
|
|
466
699
|
* @memberof OpaCompileResponseParser
|
|
467
700
|
*/
|
|
468
701
|
evaluateAsHumanReadableString(): string;
|
|
469
|
-
/**
|
|
470
|
-
* Only for internal usage
|
|
471
|
-
*
|
|
472
|
-
* @param {RegoRule} rule
|
|
473
|
-
* @returns {CompleteRuleResult}
|
|
474
|
-
* @private
|
|
475
|
-
* @memberof OpaCompileResponseParser
|
|
476
|
-
*/
|
|
477
|
-
private createCompleteRuleResult;
|
|
478
702
|
reportWarns(msg: string): void;
|
|
479
703
|
}
|
|
480
704
|
export declare function unknown2Ref(unknown: string): string;
|