From 47f21f17c50b76fc3206a36a10778e3eb00c279a Mon Sep 17 00:00:00 2001 From: Rogger Valverde Date: Tue, 16 Nov 2021 21:27:26 -0500 Subject: [PATCH] feat(identity-based-policy): add whyCannot method (#71) --- README.md | 3 +++ dist/main.d.ts | 24 ++++++++++++++++- dist/main.es.js | 14 ++++++++++ dist/main.es.js.map | 2 +- dist/main.js | 14 ++++++++++ dist/main.js.map | 2 +- .../api/iam-policies.actionbasedtype.md | 11 ++++++++ .../api/iam-policies.conditionblock.md | 11 ++++++++ docs/gitbook/api/iam-policies.conditionkey.md | 11 ++++++++ docs/gitbook/api/iam-policies.conditionmap.md | 11 ++++++++ .../api/iam-policies.conditionresolver.md | 11 ++++++++ .../api/iam-policies.decomposestring.body.md | 11 ++++++++ .../api/iam-policies.decomposestring.end.md | 11 ++++++++ .../api/iam-policies.decomposestring.md | 22 +++++++++++++++ .../api/iam-policies.decomposestring.post.md | 11 ++++++++ .../api/iam-policies.decomposestring.pre.md | 11 ++++++++ .../api/iam-policies.decomposestring.start.md | 11 ++++++++ docs/gitbook/api/iam-policies.effectblock.md | 11 ++++++++ ...ies.evaluateactionbasedinterface.action.md | 11 ++++++++ ...es.evaluateactionbasedinterface.context.md | 11 ++++++++ ...m-policies.evaluateactionbasedinterface.md | 19 +++++++++++++ ...policies.evaluateidentitybasedinterface.md | 19 +++++++++++++ ...evaluateidentitybasedinterface.resource.md | 11 ++++++++ ...policies.evaluateresourcebasedinterface.md | 21 +++++++++++++++ ...valuateresourcebasedinterface.principal.md | 11 ++++++++ ...ateresourcebasedinterface.principaltype.md | 11 ++++++++ ...evaluateresourcebasedinterface.resource.md | 11 ++++++++ .../api/iam-policies.identitybasedpolicy.md | 2 ++ ...iam-policies.identitybasedpolicy.whycan.md | 23 ++++++++++++++++ ...-policies.identitybasedpolicy.whycannot.md | 23 ++++++++++++++++ .../api/iam-policies.identitybasedtype.md | 11 ++++++++ ...licies.matchactionbasedinterface.action.md | 11 ++++++++ .../iam-policies.matchactionbasedinterface.md | 19 +++++++++++++ ...tchconditioninterface.conditionresolver.md | 11 ++++++++ ...olicies.matchconditioninterface.context.md | 11 ++++++++ .../iam-policies.matchconditioninterface.md | 19 +++++++++++++ ...tchconditionresolverinterface.condition.md | 11 ++++++++ ...tionresolverinterface.conditionresolver.md | 11 ++++++++ ...matchconditionresolverinterface.context.md | 11 ++++++++ ...olicies.matchconditionresolverinterface.md | 22 +++++++++++++++ ...es.matchconditionresolverinterface.path.md | 11 ++++++++ ...s.matchconditionresolverinterface.value.md | 11 ++++++++ ...am-policies.matchidentitybasedinterface.md | 19 +++++++++++++ ...es.matchidentitybasedinterface.resource.md | 11 ++++++++ ...am-policies.matchresourcebasedinterface.md | 21 +++++++++++++++ ...s.matchresourcebasedinterface.principal.md | 11 ++++++++ ...tchresourcebasedinterface.principaltype.md | 11 ++++++++ ...es.matchresourcebasedinterface.resource.md | 11 ++++++++ docs/gitbook/api/iam-policies.md | 27 +++++++++++++++++++ .../iam-policies.memoizeinterface.cache.md | 11 ++++++++ .../api/iam-policies.memoizeinterface.md | 19 +++++++++++++ docs/gitbook/api/iam-policies.patterns.md | 11 ++++++++ docs/gitbook/api/iam-policies.principalmap.md | 11 ++++++++ .../api/iam-policies.proxyoptions.get.md | 14 ++++++++++ docs/gitbook/api/iam-policies.proxyoptions.md | 19 +++++++++++++ .../api/iam-policies.proxyoptions.set.md | 14 ++++++++++ .../api/iam-policies.resourcebasedtype.md | 11 ++++++++ ...m-policies.statementinterface.condition.md | 11 ++++++++ .../iam-policies.statementinterface.effect.md | 11 ++++++++ .../api/iam-policies.statementinterface.md | 20 ++++++++++++++ .../iam-policies.statementinterface.sid.md | 11 ++++++++ main.ts | 1 + package.json | 3 ++- src/IdentityBasedPolicy.test.ts | 18 +++++++++++++ src/IdentityBasedPolicy.ts | 18 +++++++++++++ 65 files changed, 844 insertions(+), 4 deletions(-) create mode 100644 docs/gitbook/api/iam-policies.actionbasedtype.md create mode 100644 docs/gitbook/api/iam-policies.conditionblock.md create mode 100644 docs/gitbook/api/iam-policies.conditionkey.md create mode 100644 docs/gitbook/api/iam-policies.conditionmap.md create mode 100644 docs/gitbook/api/iam-policies.conditionresolver.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.body.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.end.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.post.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.pre.md create mode 100644 docs/gitbook/api/iam-policies.decomposestring.start.md create mode 100644 docs/gitbook/api/iam-policies.effectblock.md create mode 100644 docs/gitbook/api/iam-policies.evaluateactionbasedinterface.action.md create mode 100644 docs/gitbook/api/iam-policies.evaluateactionbasedinterface.context.md create mode 100644 docs/gitbook/api/iam-policies.evaluateactionbasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.resource.md create mode 100644 docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principal.md create mode 100644 docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principaltype.md create mode 100644 docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.resource.md create mode 100644 docs/gitbook/api/iam-policies.identitybasedpolicy.whycan.md create mode 100644 docs/gitbook/api/iam-policies.identitybasedpolicy.whycannot.md create mode 100644 docs/gitbook/api/iam-policies.identitybasedtype.md create mode 100644 docs/gitbook/api/iam-policies.matchactionbasedinterface.action.md create mode 100644 docs/gitbook/api/iam-policies.matchactionbasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.matchconditioninterface.conditionresolver.md create mode 100644 docs/gitbook/api/iam-policies.matchconditioninterface.context.md create mode 100644 docs/gitbook/api/iam-policies.matchconditioninterface.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.condition.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.conditionresolver.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.context.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.path.md create mode 100644 docs/gitbook/api/iam-policies.matchconditionresolverinterface.value.md create mode 100644 docs/gitbook/api/iam-policies.matchidentitybasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.matchidentitybasedinterface.resource.md create mode 100644 docs/gitbook/api/iam-policies.matchresourcebasedinterface.md create mode 100644 docs/gitbook/api/iam-policies.matchresourcebasedinterface.principal.md create mode 100644 docs/gitbook/api/iam-policies.matchresourcebasedinterface.principaltype.md create mode 100644 docs/gitbook/api/iam-policies.matchresourcebasedinterface.resource.md create mode 100644 docs/gitbook/api/iam-policies.memoizeinterface.cache.md create mode 100644 docs/gitbook/api/iam-policies.memoizeinterface.md create mode 100644 docs/gitbook/api/iam-policies.patterns.md create mode 100644 docs/gitbook/api/iam-policies.principalmap.md create mode 100644 docs/gitbook/api/iam-policies.proxyoptions.get.md create mode 100644 docs/gitbook/api/iam-policies.proxyoptions.md create mode 100644 docs/gitbook/api/iam-policies.proxyoptions.set.md create mode 100644 docs/gitbook/api/iam-policies.resourcebasedtype.md create mode 100644 docs/gitbook/api/iam-policies.statementinterface.condition.md create mode 100644 docs/gitbook/api/iam-policies.statementinterface.effect.md create mode 100644 docs/gitbook/api/iam-policies.statementinterface.md create mode 100644 docs/gitbook/api/iam-policies.statementinterface.sid.md diff --git a/README.md b/README.md index e788088..44cf5eb 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,12 @@ Supports these glob features: Please click on the language that you prefer - Translations: + - [Chinese docs](https://roggervalf.github.io/iam-policies/zh-CN/) by [@mickymao1110](https://github.com/mickymao1110) (< v3.5.0 ) - [English docs](https://roggervalf.github.io/iam-policies/en/) by [@roggervalf](https://github.com/roggervalf) +- [Api documentation](https://github.com/roggervalf/iam-policies/blob/master/docs/gitbook/api/index.md) + ## Article [How to build a Deno module](https://medium.com/@rogger.valverde/how-to-build-a-deno-module-dc383eee8edb) diff --git a/dist/main.d.ts b/dist/main.d.ts index df4d280..6fa563a 100644 --- a/dist/main.d.ts +++ b/dist/main.d.ts @@ -75,12 +75,23 @@ interface OptionalResourceBlock { interface OptionalNotResourceBlock { notResource?: Patterns; } +declare type ConditionKey = string | number | boolean; +interface ConditionMap { + [key: string]: ConditionKey[] | ConditionKey; +} declare type ConditionBlock = Record>; interface StatementInterface { sid?: string; effect?: EffectBlock; condition?: ConditionBlock; } +interface DecomposeString { + start: number; + end: number; + pre: string; + body: string; + post: string; +} declare type Resolver = (data: any, expected: any) => boolean; interface ConditionResolver { [key: string]: Resolver; @@ -89,6 +100,13 @@ interface MatchConditionInterface { context?: T; conditionResolver?: ConditionResolver; } +interface MatchConditionResolverInterface { + context: T; + conditionResolver?: ConditionResolver; + path: string; + condition: string; + value: any; +} interface MatchActionBasedInterface extends MatchConditionInterface { action: string; } @@ -112,6 +130,9 @@ interface EvaluateResourceBasedInterface extends EvaluateActio principalType?: string; resource?: string; } +interface MemoizeInterface extends Function { + cache: Map; +} declare type ActionBasedType = StatementInterface & (ActionBlock | NotActionBlock); declare type IdentityBasedType = StatementInterface & (ActionBlock | NotActionBlock) & (ResourceBlock | NotResourceBlock); declare type ResourceBasedType = StatementInterface & (OptionalPrincipalBlock | OptionalNotPrincipalBlock) & (ActionBlock | NotActionBlock) & (OptionalResourceBlock | OptionalNotResourceBlock); @@ -237,6 +258,7 @@ declare class IdentityBasedPolicy extends Policy, { action, resource, context }: EvaluateIdentityBasedInterface): boolean; whyCan(this: IdentityBasedPolicy, { action, resource, context }: EvaluateIdentityBasedInterface): IdentityBasedType[]; cannot(this: IdentityBasedPolicy, { action, resource, context }: EvaluateIdentityBasedInterface): boolean; + whyCannot(this: IdentityBasedPolicy, { action, resource, context }: EvaluateIdentityBasedInterface): IdentityBasedType[]; } interface ResourceBasedPolicyInterface { @@ -256,4 +278,4 @@ declare class ResourceBasedPolicy extends Policy, { principal, action, resource, principalType, context }: EvaluateResourceBasedInterface): boolean; } -export { ActionBased, ActionBasedPolicy, ActionBasedPolicyInterface, IdentityBased, IdentityBasedPolicy, ResourceBased, ResourceBasedPolicy, applyContext, getValueFromPath }; +export { ActionBased, ActionBasedPolicy, ActionBasedPolicyInterface, ActionBasedType, ConditionBlock, ConditionKey, ConditionMap, ConditionResolver, DecomposeString, EffectBlock, EvaluateActionBasedInterface, EvaluateIdentityBasedInterface, EvaluateResourceBasedInterface, IdentityBased, IdentityBasedPolicy, IdentityBasedType, MatchActionBasedInterface, MatchConditionInterface, MatchConditionResolverInterface, MatchIdentityBasedInterface, MatchResourceBasedInterface, MemoizeInterface, Patterns, PrincipalMap, ProxyOptions, ResourceBased, ResourceBasedPolicy, ResourceBasedType, StatementInterface, applyContext, getValueFromPath }; diff --git a/dist/main.es.js b/dist/main.es.js index 91e21df..a0b3003 100644 --- a/dist/main.es.js +++ b/dist/main.es.js @@ -1712,6 +1712,20 @@ class IdentityBasedPolicy extends Policy { conditionResolver: this.conditionResolver })); } + whyCannot({ action, resource, context }) { + return this.denyStatements.reduce((statements, currentStatement) => { + const matches = currentStatement.matches({ + action, + resource, + context: context || this.context, + conditionResolver: this.conditionResolver + }); + if (matches) { + return [...statements, currentStatement.getStatement()]; + } + return statements; + }, []); + } } class ResourceBasedPolicy extends Policy { diff --git a/dist/main.es.js.map b/dist/main.es.js.map index 2c7ad23..87635b6 100644 --- a/dist/main.es.js.map +++ b/dist/main.es.js.map @@ -1 +1 @@ -{"version":3,"file":"main.es.js","sources":["../src/utils/getTag.ts","../src/utils/isSymbol.ts","../src/utils/toKey.ts","../src/utils/isKey.ts","../src/utils/memoize.ts","../src/utils/memoizeCapped.ts","../src/utils/stringToPath.ts","../src/utils/getValueFromPath.ts","../src/utils/applyContext.ts","../src/utils/decomposeString.ts","../src/utils/braceExpand.ts","../src/Matcher.ts","../src/utils/mersenneTwister.ts","../src/utils/generateUUID.ts","../src/conditionOperators/boolean/bool.ts","../src/conditionOperators/date/convertDate.ts","../src/conditionOperators/date/dateEquals.ts","../src/conditionOperators/date/dateGreaterThan.ts","../src/conditionOperators/date/dateGreaterThanEquals.ts","../src/conditionOperators/date/dateLessThan.ts","../src/conditionOperators/date/dateLessThanEquals.ts","../src/conditionOperators/date/dateNotEquals.ts","../src/conditionOperators/numeric/numericEquals.ts","../src/conditionOperators/numeric/numericGreaterThan.ts","../src/conditionOperators/numeric/numericGreaterThanEquals.ts","../src/conditionOperators/numeric/numericLessThan.ts","../src/conditionOperators/numeric/numericLessThanEquals.ts","../src/conditionOperators/numeric/numericNotEquals.ts","../src/conditionOperators/string/stringEquals.ts","../src/conditionOperators/string/stringEqualsIgnoreCase.ts","../src/conditionOperators/string/stringLike.ts","../src/conditionOperators/string/stringLikeIfExists.ts","../src/conditionOperators/string/stringNotEquals.ts","../src/conditionOperators/string/stringNotEqualsIgnoreCase.ts","../src/conditionOperators/index.ts","../src/Statement.ts","../src/ActionBasedStatement.ts","../src/IdentityBasedStatement.ts","../src/ResourceBasedStatement.ts","../src/Policy.ts","../src/ActionBasedPolicy.ts","../src/IdentityBasedPolicy.ts","../src/ResourceBasedPolicy.ts"],"sourcesContent":["/**\n * Gets the `toStringTag` of `value`.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n * @example\n * ```javascript\n * getTag(1)\n * // => '[object Number]'\n *\n * getTag(null)\n * // => '[object Null]'\n * ```\n */\nexport function getTag(value: unknown): string {\n return Object.prototype.toString.call(value);\n}\n","import { getTag } from './getTag';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @since 3.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n * ```javascript\n * isSymbol(Symbol())\n * // => true\n *\n * isSymbol('abc')\n * // => false\n * ```\n */\nexport function isSymbol(value?: unknown): value is symbol {\n const type = typeof value;\n return (\n type === 'symbol' ||\n (type === 'object' && value !== null && getTag(value) === '[object Symbol]')\n );\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used as references for various `Number` constants. */\nconst INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n * @example\n *\n * toKey(Symbol.iterator)\n * // => true\n *\n * toKey('abc')\n * // => false\n */\nexport function toKey(value: unknown): string | symbol {\n if (typeof value === 'string' || isSymbol(value)) {\n return value;\n }\n\n return value === 0 && 1 / value === -INFINITY ? '-0' : `${value}`;\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used to match property names within property paths. */\nconst reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\nconst reIsPlainProp = /^\\w*$/; //matches any word character (alphanumeric and underscore)\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n * @example\n * ```javascript\n * isKey(1)\n * // => true\n *\n * isKey('example[test]')\n * // => false\n *\n * isKey('a.b')\n * // => false\n *\n * const obj = {\n * '[a]': 5,\n * 'b.c': true\n * };\n *\n * isKey('[a]', obj)\n * // => true\n *\n * isKey('b.c', obj)\n * // => true\n * ```\n */\nexport function isKey(value: unknown, object?: T): boolean {\n const type = typeof value;\n if (\n type === 'number' ||\n type === 'boolean' ||\n value === null ||\n value === undefined ||\n isSymbol(value)\n ) {\n return true;\n }\n if (typeof value === 'string') {\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object !== null && value in Object(object))\n );\n }\n return false;\n}\n","import { MemoizeInterface } from '../types';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * @since 3.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n * ```javascript\n * const object = { 'a': 1, 'b': 2 }\n * const other = { 'c': 3, 'd': 4 }\n *\n * const values = memoize(values)\n * values(object)\n * // => [1, 2]\n *\n * values(other)\n * // => [3, 4]\n *\n * object.a = 2\n * values(object)\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b'])\n * values(object)\n * // => ['a', 'b']\n * ```\n */\nexport function memoize(\n func: (...args: unknown[]) => any,\n resolver?: (...args: unknown[]) => any\n): MemoizeInterface {\n const memoized = function (\n this: (...args: unknown[]) => any,\n ...args: unknown[]\n ): MemoizeInterface {\n const key = resolver ? resolver.apply(this, args) : args[0];\n const cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = func.apply(this, args);\n cache.set(key, result);\n return result;\n };\n memoized.cache = new Map();\n return memoized;\n}\n\n/*const memoize = (fn: Function): Function => {\n const cache = {};\n return (...args): any => {\n const stringifiedArgs = JSON.stringify(args);\n const result = (cache[stringifiedArgs] =\n typeof cache[stringifiedArgs] === 'undefined'\n ? fn(...args)\n : cache[stringifiedArgs]);\n return result;\n };\n};*/\n","import { memoize } from './memoize';\nimport { MemoizeInterface } from '../types';\n\n/** Used as the maximum memoize cache size. */\nexport const MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @since 3.1.0\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nexport function memoizeCapped(\n func: (...args: any) => unknown\n): MemoizeInterface {\n const result = memoize(func, (key: unknown) => {\n const { cache } = result;\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n return result;\n}\n","import { memoizeCapped } from './memoizeCapped';\n\nconst charCodeOfDot = '.'.charCodeAt(0);\nconst reEscapeChar = /\\\\(\\\\)?/g;\nconst rePropName = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\x02)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\x02' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n);\n\n/**\n * Converts `string` to a property path array.\n *\n * @since 3.1.0\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nexport const stringToPath = memoizeCapped((string: string) => {\n const result = [];\n if (string.charCodeAt(0) === charCodeOfDot) {\n result.push('');\n }\n string.replace(\n rePropName,\n (\n match: string,\n expression: string,\n quote: string,\n subString: string\n ): string => {\n let key = match;\n if (quote) {\n key = subString.replace(reEscapeChar, '$1');\n } else if (expression) {\n key = expression.trim();\n }\n result.push(key);\n return '';\n }\n );\n return result;\n});\n","import { toKey } from './toKey';\nimport { isKey } from './isKey';\nimport { stringToPath } from './stringToPath';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nexport function castPath(\n value: unknown,\n object: U\n): Array {\n if (Array.isArray(value)) {\n return value;\n }\n\n return isKey(value, object) ? [value] : stringToPath(value);\n}\n\n/**\n * The base implementation of `get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nexport function baseGet(\n object: U,\n path: Array | string\n): any {\n const newPath = castPath(path, object);\n\n let index = 0;\n const length = newPath.length;\n\n let value: any = object;\n while (value instanceof Object && index < length) {\n value = value[toKey(newPath[index++])];\n }\n\n return index && index === length ? value : undefined;\n}\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @since 3.1.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * const object = { 'a': [{ 'b': { 'c': 3 } }] }\n *\n * getValueFromPath(object, 'a[0].b.c')\n * // => 3\n *\n * getValueFromPath(object, ['a', '0', 'b', 'c'])\n * // => 3\n *\n * getValueFromPath(object, 'a.b.c', 'default')\n * // => 'default'\n */\nexport function getValueFromPath(\n object: U,\n path: Array | string,\n defaultValue?: unknown\n): any {\n const result = object === null ? undefined : baseGet(object, path);\n\n return result === undefined ? defaultValue : result;\n}\n","import { getValueFromPath } from './getValueFromPath';\n\nconst reDelimiters = /\\${([^}]*)}/g;\nconst trim = / +(?= )|^\\s+|\\s+$/g;\n\nconst specialTrim = (str: string): string => str.replace(trim, '');\n\n/**\n * Apply the context value in a string.\n *\n * @param {string} str Pattern string, containing context path.\n * @param {object} context Object to get values from path.\n * @returns {string} Returns a string with embedded context values.\n * @example\n * ```javascript\n * const context = {\n * user: { id: 456, bestFriends: [123, 532, 987] }\n * };\n * applyContext('secrets:${user.id}:*', context)\n * // => 'secrets:456:*'\n *\n * applyContext('secrets:${user.bestFriends}:*', context)\n * // => 'secrets:{123,532,987}:*'\n *\n * applyContext('secrets:${company.address}:account', context)\n * // => 'secrets:undefined:account'\n * ```\n */\nexport function applyContext(\n str: string,\n context?: T\n): string {\n if (!context) return str;\n\n return specialTrim(\n str.replace(reDelimiters, (_, path: string) => {\n const value = getValueFromPath(context, path);\n if (Array.isArray(value)) return `{${value}}`;\n if (value instanceof Object) return 'undefined';\n\n return String(value);\n })\n );\n}\n","import { DecomposeString } from '../types';\n\n/**\n * Get index range where separators are found.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {number[]} Returns the beginning and final index for those matches.\n * @example\n * ```javascript\n * getIndexRange('first', 'Second', 'firstAndSecond')\n * // => [0, 8]\n *\n * getIndexRange('First', 'Second', '++FirstAndSecond**')\n * // => [2, 10]\n * ```\n */\nfunction getIndexRange(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): number[] {\n const beginningIndex = str.indexOf(initialSeparator);\n const finalIndex = str.indexOf(finalSeparator, beginningIndex + 1);\n\n if (beginningIndex >= 0 && finalIndex > 0) {\n return [beginningIndex, finalIndex];\n }\n\n return [-1, -1];\n}\n\n/**\n * Object returned by decomposeString function\n *\n * @typedef {Object} DecomposedString\n * @property {number} start Beginning index for first separator match\n * @property {number} end Final index for second separator match\n * @property {string} pre Substring before first separator\n * @property {string} body Substring between separators\n * @property {string} post Substring after second separator\n */\n\n/**\n * Decompose string in pre, body and post strings by using separators.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {DecomposedString} Returns a decompose string.\n * @example\n * ```javascript\n * decomposeString('first', 'Second', 'firstAndSecond')\n * // => { start: 0, end: 8, pre: '', body: 'And', post: '' }\n *\n * decomposeString('First', 'Second', '++FirstAndSecond**')\n * // => { start: 2, end: 10, pre: '++', body: 'And', post: '**' }\n * ```\n */\nexport function decomposeString(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): DecomposeString {\n const [beginningIndex, finalIndex] = getIndexRange(\n initialSeparator,\n finalSeparator,\n str\n );\n\n return {\n start: beginningIndex,\n end: finalIndex,\n pre: beginningIndex >= 0 ? str.slice(0, beginningIndex) : '',\n body:\n beginningIndex >= 0\n ? str.slice(beginningIndex + initialSeparator.length, finalIndex)\n : '',\n post:\n beginningIndex >= 0 ? str.slice(finalIndex + finalSeparator.length) : ''\n };\n}\n","import { decomposeString } from './decomposeString';\n\n/**\n * Generate an array of string depending on {} blocks.\n *\n * @param {string} pattern Pattern string that can contains {} blocks.\n * @returns {string[]} Returns an array of string with all the combinations.\n * @example\n * ```javascript\n * braceExpand('${13}')\n * // => ['{13}']\n *\n * braceExpand('a{b,f,m}p')\n * // => ['abp','afp','amp']\n *\n * braceExpand('-v{,,}')\n * // => ['-v','-v','-v']\n * ```\n */\nconst braceExpand = (pattern: string): string[] => {\n if (!pattern.match(/{.*}/)) {\n return [pattern];\n }\n\n return expand(pattern, true);\n};\n\nconst expand = (str: string, isTop?: boolean): string[] => {\n const expansions = [] as string[];\n const balance = decomposeString('{', '}', str);\n if (balance.start < 0) return [str];\n\n const parts = balance.body.split(',');\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = balance.pre;\n const postParts = balance.post.length ? expand(balance.post, false) : [''];\n\n if (/\\$$/.test(balance.pre)) {\n postParts.forEach((postPart) => {\n const expansion = `${balance.pre.slice(0, -1)}{${\n balance.body\n }}${postPart}`;\n expansions.push(expansion);\n });\n } else {\n parts.forEach((part: string) => {\n postParts.forEach((postPart) => {\n const expansion = pre + part + postPart;\n if (!isTop || expansion) expansions.push(expansion);\n });\n });\n }\n\n return expansions;\n};\n\nexport { braceExpand };\n","import { braceExpand } from './utils/braceExpand';\n\nexport class Matcher {\n private readonly pattern: string;\n private readonly maxLength: number;\n private readonly set: (string | RegExp)[];\n private readonly empty: boolean;\n\n constructor(pattern: string, maxLength = 1024 * 64) {\n this.set = [];\n this.pattern = pattern.trim();\n this.maxLength = maxLength;\n this.empty = !this.pattern ? true : false;\n\n const set = braceExpand(pattern);\n this.set = set.map((val) => this.parse(val));\n this.set = this.set.filter((s) => {\n return Boolean(s);\n });\n }\n\n match(this: Matcher, str: string): boolean {\n if (this.empty) return str === '';\n\n return this.set.some((pattern) => this.matchOne(str, pattern));\n }\n\n private parse(pattern: string): string | RegExp {\n if (pattern.length > this.maxLength) {\n throw new TypeError('Pattern is too long');\n }\n let regExp;\n let hasSpecialCharacter = false;\n if (pattern === '') return '';\n\n const re = pattern.replace(/\\*/g, () => {\n hasSpecialCharacter = true;\n return '.+?';\n });\n\n // skip the regexp for non-* patterns\n // unescape anything in it, though, so that it'll be\n // an exact match.\n if (!hasSpecialCharacter) {\n return pattern.replace(/\\\\(.)/g, '$1');\n }\n\n try {\n regExp = new RegExp('^' + re + '$');\n } catch (error) {\n // If it was an invalid regular expression, then it can't match\n // anything.\n return new RegExp('$.');\n }\n\n return regExp;\n }\n\n private matchOne(str: string, pattern: string | RegExp): boolean {\n if (typeof pattern === 'string') {\n return str === pattern;\n }\n\n return Boolean(str.match(pattern));\n }\n}\n","/*\n https://github.com/banksean wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over each other's state.\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n var m = new MersenneTwister();\n var randomNumber = m.random();\n You can also call the other genrand_{foo}() methods on the instance.\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n var m = new MersenneTwister(123);\n and that will always produce the same random sequence.\n Sean McCullough (banksean@gmail.com)\n*/\n\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n Before using, initialize the state by using init_seed(seed)\n or init_by_array(init_key, key_length).\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nexport class MersenneTwister {\n private readonly N: number;\n private readonly M: number;\n private readonly MATRIX_A: number;\n private readonly UPPER_MASK: number;\n private readonly LOWER_MASK: number;\n private readonly mt: number[];\n private mti: number;\n\n constructor(seed?: number | number[]) {\n /* Period parameters */\n this.N = 624;\n this.M = 397;\n this.MATRIX_A = 0x9908b0df; /* constant vector a */\n this.UPPER_MASK = 0x80000000; /* most significant w-r bits */\n this.LOWER_MASK = 0x7fffffff; /* least significant r bits */\n\n this.mt = new Array(this.N); /* the array for the state vector */\n this.mti = this.N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n if (Array.isArray(seed)) {\n if (seed.length > 0) this.initByArray(seed, seed.length);\n } else {\n if (seed === undefined) {\n this.initSeed(new Date().getTime());\n } else {\n this.initSeed(seed);\n }\n }\n }\n\n /* initializes mt[N] with a seed */\n /* origin name init_genrand */\n initSeed(seed: number): void {\n this.mt[0] = seed >>> 0;\n for (this.mti = 1; this.mti < this.N; this.mti++) {\n const s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n this.mt[this.mti] =\n ((((s & 0xffff0000) >>> 16) * 1812433253) << 16) +\n (s & 0x0000ffff) * 1812433253 +\n this.mti;\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n this.mt[this.mti] >>>= 0;\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n initByArray(initKey: number[], keyLength: number): void {\n this.initSeed(19650218);\n let i = 1;\n let j = 0;\n let k = this.N > keyLength ? this.N : keyLength;\n for (; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1664525) << 16) +\n (s & 0x0000ffff) * 1664525)) +\n initKey[j] +\n j; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n j++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n if (j >= keyLength) j = 0;\n }\n for (k = this.N - 1; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) +\n (s & 0x0000ffff) * 1566083941)) -\n i; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n }\n\n this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n /* origin name genrand_int32 */\n randomInt32(): number {\n let y;\n const mag01 = [0x0, this.MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (this.mti >= this.N) {\n /* generate N words at one time */\n let kk;\n\n if (this.mti === this.N + 1)\n /* if init_seed() has not been called, */\n this.initSeed(5489); /* a default initial seed is used */\n\n for (kk = 0; kk < this.N - this.M; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n for (; kk < this.N - 1; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] =\n this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n y =\n (this.mt[this.N - 1] & this.UPPER_MASK) |\n (this.mt[0] & this.LOWER_MASK);\n this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n this.mti = 0;\n }\n\n y = this.mt[this.mti++];\n\n /* Tempering */\n y ^= y >>> 11;\n y ^= (y << 7) & 0x9d2c5680;\n y ^= (y << 15) & 0xefc60000;\n y ^= y >>> 18;\n\n return y >>> 0;\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n /* origin name genrand_int31 */\n randomInt31(): number {\n return this.randomInt32() >>> 1;\n }\n\n /* generates a random number on [0,1]-real-interval */\n /* origin name genrand_real1 */\n randomReal1(): number {\n return this.randomInt32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n /* origin name genrand_real2 */\n randomReal2(): number {\n return this.randomInt32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n /* origin name genrand_real3 */\n randomReal3(): number {\n return (this.randomInt32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n /* origin name genrand_res53 */\n randomRes53(): number {\n const a = this.randomInt32() >>> 5;\n const b = this.randomInt32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n }\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n","import { MersenneTwister } from './mersenneTwister';\n\nconst replacePlaceholders = (mersenne: MersenneTwister) => (\n placeholder: string\n): string => {\n const random = Math.floor(mersenne.randomReal2() * 16);\n\n const value = placeholder === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n};\n\n/**\n * Generate a uuid.\n *\n * @private\n * @since 3.5.0\n * @returns {string} Returns the generated uuid.\n * @example\n * ```javascript\n * generateUUID()\n * // => 49e71c40-9b21-4371-9699-2def33f62e66\n *\n * generateUUID()\n * // => da94f128-4247-48e3-bc73-d0cae46b5093\n * ```\n */\nexport function generateUUID(): string {\n const mersenne = new MersenneTwister();\n const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\n return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders(mersenne));\n}\n","/**\n * Boolean matching.\n *\n * @since 4.7.0\n * @category Boolean\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * bool(true, true)\n * // => true\n *\n * bool(true, false)\n * // => false\n * ```\n */\nexport function bool(data: boolean, expected: boolean): boolean {\n return (\n data === expected\n );\n}\n","export type DateType = Date | string;\n\nexport const convertDate = (date: DateType): number=>{\n if(date instanceof Date){\n return date.getTime();\n }\n\n return Date.parse(date);\n}","import {DateType, convertDate} from './convertDate';\n\n/**\n * Exact date matching.\n *\n * @since 4.8.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * dateEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateEquals('December 15, 2000 03:24:00', 'December 10, 2001 03:24:00')\n * // => false\n * ```\n */\nexport function dateEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData === convertedExpectation\n );\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than `expected value`.\n * @example\n * ```javascript\n * dateGreaterThan('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateGreaterThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData > convertedExpectation;\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching at or after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than or equals `expected value`.\n * @example\n * ```javascript\n * dateGreaterThanEquals('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:25:00')\n * // => false\n * ```\n */\nexport function dateGreaterThanEquals(\n data: DateType,\n expected: DateType\n): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData >= convertedExpectation;\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is before than `expected value`.\n * @example\n * ```javascript\n * dateLessThan('December 15, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateLessThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData < convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching at or before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal or before than `expected value`.\n * @example\n * ```javascript\n * dateLessThanEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateLessThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThanEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData <= convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Negated date matching.\n *\n * @since 4.9.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * dateNotEquals('December 15, 1994 03:24:00', 'December 16, 1995 03:24:00')\n * // => true\n *\n * dateNotEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateNotEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData !== convertedExpectation\n );\n}\n","/**\n * Exact numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * numericEquals(5, 5)\n * // => true\n *\n * numericEquals(2, 4)\n * // => false\n * ```\n */\nexport function numericEquals(data: number, expected: number): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Numeric greater than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than `expected value`.\n * @example\n * ```javascript\n * numericGreaterThan(6, 5)\n * // => true\n *\n * numericGreaterThan(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThan(data: number, expected: number): boolean {\n return (\n data > expected\n );\n}\n","/**\n * Numeric greater than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than or equals `expected value`.\n * @example\n * ```javascript\n * numericGreaterThanEquals(5, 5)\n * // => true\n *\n * numericGreaterThanEquals(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThanEquals(data: number, expected: number): boolean {\n return (\n data >= expected\n );\n}\n","/**\n * Numeric less than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than `expected value`.\n * @example\n * ```javascript\n * numericLessThan(5, 6)\n * // => true\n *\n * numericLessThan(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThan(data: number, expected: number): boolean {\n return (\n data < expected\n );\n}\n","/**\n * Numeric less than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than or equals `expected value`.\n * @example\n * ```javascript\n * numericLessThanEquals(5, 5)\n * // => true\n *\n * numericLessThanEquals(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThanEquals(data: number, expected: number): boolean {\n return (\n data <= expected\n );\n}\n","/**\n * Negated numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * numericNotEquals(2, 4)\n * // => true\n *\n * numericNotEquals(5, 5)\n * // => false\n * ```\n */\nexport function numericNotEquals(data: number, expected: number): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Exact string matching, case sensitive.\n *\n * @since 4.3.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEquals('hi', 'hi')\n * // => true\n *\n * stringEquals('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEquals(data: string, expected: string): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Exact string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEqualsIgnoreCase('hi', 'Hi')\n * // => true\n *\n * stringEqualsIgnoreCase('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() === expected.toLowerCase()\n );\n}\n","import {Matcher} from '../../Matcher';\n\n/**\n * Case-sensitive matching. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.5.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value`.\n * @example\n * ```javascript\n * stringLike('newHouse', 'new*')\n * // => true\n *\n * stringLike('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLike(data: string, expected: string): boolean {\n return (\n new Matcher(data).match(expected)\n );\n}\n","import {stringLike} from './stringLike';\n\n/**\n * Case-sensitive matching if exist. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.12.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value` or if it does not exist.\n * @example\n * ```javascript\n * stringLikeIfExists(undefined, 'new*')\n * // => true\n *\n * stringLikeIfExists('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLikeIfExists(data: string | undefined, expected: string): boolean {\n return data?(\n stringLike(data,expected)\n ):true;\n}\n","/**\n * Negated string matching.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEquals('hi', 'no')\n * // => true\n * \n * stringNotEquals('hi', 'hi')\n * // => false\n * ```\n */\nexport function stringNotEquals(data: string, expected: string): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Negated string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEqualsIgnoreCase('hi', 'no')\n * // => true\n * \n * stringNotEqualsIgnoreCase('hi', 'Hi')\n * // => false\n * ```\n */\nexport function stringNotEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() !== expected.toLowerCase()\n );\n}\n","import { bool } from './boolean/bool';\nimport { dateEquals } from './date/dateEquals';\nimport { dateGreaterThan } from './date/dateGreaterThan';\nimport { dateGreaterThanEquals } from './date/dateGreaterThanEquals';\nimport { dateLessThan } from './date/dateLessThan';\nimport { dateLessThanEquals } from './date/dateLessThanEquals';\nimport { dateNotEquals } from './date/dateNotEquals';\nimport { numericEquals } from './numeric/numericEquals';\nimport { numericGreaterThan } from './numeric/numericGreaterThan';\nimport { numericGreaterThanEquals } from './numeric/numericGreaterThanEquals';\nimport { numericLessThan } from './numeric/numericLessThan';\nimport { numericLessThanEquals } from './numeric/numericLessThanEquals';\nimport { numericNotEquals } from './numeric/numericNotEquals';\nimport { stringEquals } from './string/stringEquals';\nimport { stringEqualsIgnoreCase } from './string/stringEqualsIgnoreCase';\nimport { stringLike } from './string/stringLike';\nimport { stringLikeIfExists } from './string/stringLikeIfExists';\nimport { stringNotEquals } from './string/stringNotEquals';\nimport { stringNotEqualsIgnoreCase } from './string/stringNotEqualsIgnoreCase';\n\nexport const operators: Record = {\n bool,\n dateEquals,\n dateGreaterThan,\n dateGreaterThanEquals,\n dateLessThan,\n dateLessThanEquals,\n dateNotEquals,\n numericEquals,\n numericGreaterThan,\n numericGreaterThanEquals,\n numericLessThan,\n numericLessThanEquals,\n numericNotEquals,\n stringEquals,\n stringEqualsIgnoreCase,\n stringLike,\n stringLikeIfExists,\n stringNotEquals,\n stringNotEqualsIgnoreCase\n};\n","import {\n EffectBlock,\n ConditionBlock,\n StatementInterface,\n MatchConditionInterface,\n MatchConditionResolverInterface\n} from './types';\nimport { getValueFromPath } from './utils/getValueFromPath';\nimport { generateUUID } from './utils/generateUUID';\nimport {operators} from './conditionOperators';\n\nabstract class Statement {\n protected sid: string;\n protected readonly condition?: ConditionBlock;\n effect: EffectBlock;\n\n constructor({ sid, effect = 'allow', condition }: StatementInterface) {\n if (!sid) {\n this.sid = generateUUID();\n } else {\n this.sid = sid;\n }\n this.effect = effect;\n this.condition = condition;\n }\n\n matchConditions(\n this: Statement,\n { context, conditionResolver }: MatchConditionInterface\n ): boolean {\n const { condition: conditions } = this;\n\n if(conditions && context){\n return Object.keys(conditions).every((condition) =>\n Object.keys(conditions[condition]).every((path) => {\n const conditionValues = conditions[condition][path];\n if (conditionValues instanceof Array) {\n return conditionValues.some((value) =>\n this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value\n })\n );\n }\n\n return this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value: conditionValues\n });\n })\n )\n }\n\n return true;\n }\n\n private evaluateCondition(\n this: Statement,\n { context, conditionResolver={}, path, value, condition }: MatchConditionResolverInterface\n ): boolean {\n\n const currentResolver= conditionResolver[condition] || operators[condition]\n\n if(currentResolver){\n return currentResolver(\n getValueFromPath(context, path),\n value\n )\n }\n return false;\n }\n}\n\nexport { Statement };\n","import { ActionBasedType, MatchActionBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ActionBased extends Statement {\n private action?: string[];\n private notAction?: string[];\n private statement: ActionBasedType;\n\n constructor(action: ActionBasedType) {\n super(action);\n this.checkAndAssignActions(action);\n this.statement = { ...action, sid: this.sid };\n }\n\n getStatement(this: ActionBased): ActionBasedType {\n return this.statement;\n }\n\n matches(\n this: ActionBased,\n { action, context, conditionResolver }: MatchActionBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(action: ActionBasedType): void {\n const hasAction = 'action' in action;\n const hasNotAction = 'notAction' in action;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ActionBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in action) {\n this.action =\n typeof action.action === 'string' ? [action.action] : action.action;\n } else {\n this.notAction =\n typeof action.notAction === 'string'\n ? [action.notAction]\n : action.notAction;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n}\n\nexport { ActionBased };\n","import { IdentityBasedType, MatchIdentityBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass IdentityBased extends Statement {\n private resource?: string[];\n private action?: string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: IdentityBasedType;\n\n constructor(identity: IdentityBasedType) {\n super(identity);\n this.checkAndAssignActions(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: IdentityBased): IdentityBasedType {\n return this.statement;\n }\n\n matches(\n this: IdentityBased,\n {\n action,\n resource,\n context,\n conditionResolver\n }: MatchIdentityBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(identity: IdentityBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'IdentityBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignResources(identity: IdentityBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'IdentityBased statement should have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n } else {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { IdentityBased };\n","import {\n PrincipalMap,\n MatchResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ResourceBased extends Statement {\n private principal?: PrincipalMap | string[];\n private resource?: string[];\n private action?: string[];\n private notPrincipal?: PrincipalMap | string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: ResourceBasedType;\n private hasPrincipals: boolean;\n private hasResources: boolean;\n\n constructor(identity: ResourceBasedType) {\n super(identity);\n this.hasPrincipals = false;\n this.hasResources = false;\n this.checkAndAssignActions(identity);\n this.checkAndAssignPrincipals(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: ResourceBased): ResourceBasedType {\n return this.statement;\n }\n\n matches(\n this: ResourceBased,\n {\n principal,\n action,\n resource,\n principalType,\n context,\n conditionResolver\n }: MatchResourceBasedInterface\n ): boolean {\n return (\n this.matchPrincipalAndNotPrincipal(principal, principalType, context) &&\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResourceAndNotResource(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n /*valueComing principal noPrincipal\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchPrincipalAndNotPrincipal(\n principal?: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (principal) {\n if (this.hasPrincipals)\n return (\n this.matchPrincipals(principal, principalType, context) &&\n this.matchNotPrincipals(principal, principalType, context)\n );\n return false;\n }\n if (this.hasPrincipals) return false;\n return true;\n }\n\n /*valueComing resource noResource\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchResourceAndNotResource(resource?: string, context?: T): boolean {\n if (resource) {\n if (this.hasResources)\n return (\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context)\n );\n return false;\n }\n if (this.hasResources) return false;\n return true;\n }\n\n private checkAndAssignActions(identity: ResourceBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ResourceBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignPrincipals(identity: ResourceBasedType): void {\n const hasPrincipal = 'principal' in identity;\n const hasNotPrincipal = 'notPrincipal' in identity;\n if (hasPrincipal && hasNotPrincipal) {\n throw new TypeError(\n 'ResourceBased statement could have a principal or a notPrincipal attribute, no both'\n );\n }\n if ('principal' in identity) {\n this.principal =\n typeof identity.principal === 'string'\n ? [identity.principal]\n : identity.principal;\n this.hasPrincipals = true;\n } else if ('notPrincipal' in identity) {\n this.notPrincipal =\n typeof identity.notPrincipal === 'string'\n ? [identity.notPrincipal]\n : identity.notPrincipal;\n this.hasPrincipals = true;\n }\n }\n\n private checkAndAssignResources(identity: ResourceBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'ResourceBased statement could have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n this.hasResources = true;\n } else if ('notResource' in identity) {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n this.hasResources = true;\n }\n }\n\n private matchPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.principal) {\n if (this.principal instanceof Array) {\n return principalType\n ? false\n : this.principal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.principal[principalType];\n if (principalValues instanceof Array) {\n return principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return false;\n }\n return false;\n }\n }\n return true;\n }\n\n private matchNotPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.notPrincipal) {\n if (this.notPrincipal instanceof Array) {\n return principalType\n ? true\n : !this.notPrincipal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.notPrincipal[principalType];\n if (principalValues instanceof Array) {\n return !principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return !new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return true;\n }\n return true;\n }\n }\n return true;\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { ResourceBased };\n","import { MatchConditionInterface, ConditionResolver } from './types';\n\nabstract class Policy {\n protected context?: T;\n protected conditionResolver?: ConditionResolver;\n\n constructor({ context, conditionResolver }: MatchConditionInterface) {\n this.context = context;\n this.conditionResolver = conditionResolver;\n }\n\n setContext(this: Policy, context: T): void {\n this.context = context;\n }\n\n getContext(this: Policy): T | undefined {\n return this.context;\n }\n\n setConditionResolver(\n this: Policy,\n conditionResolver: ConditionResolver\n ): void {\n this.conditionResolver = conditionResolver;\n }\n\n getConditionResolver(this: Policy): ConditionResolver | undefined {\n return this.conditionResolver;\n }\n\n abstract getStatements(this: Policy): U[];\n}\n\nexport { Policy };\n","import {\n ActionBasedType,\n ConditionResolver,\n EvaluateActionBasedInterface,\n ProxyOptions\n} from './types';\nimport { ActionBased } from './ActionBasedStatement';\nimport { Policy } from './Policy';\n\nexport interface ActionBasedPolicyInterface {\n statements: ActionBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ActionBasedPolicy extends Policy<\n T,\n ActionBasedType\n> {\n private denyStatements: ActionBased[];\n private allowStatements: ActionBased[];\n private statements: ActionBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ActionBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ActionBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(this: ActionBasedPolicy, statement: ActionBasedType): void {\n const statementInstance = new ActionBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ActionBasedPolicy): ActionBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n const args = { action, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n cannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n generateProxy(\n this: ActionBasedPolicy,\n obj: U,\n options: ProxyOptions = {}\n ): U {\n const { get = {}, set = {} } = options;\n const { allow: allowGet = true, propertyMap: propertyMapGet = {} } = get;\n const { allow: allowSet = true, propertyMap: propertyMapSet = {} } = set;\n const handler = {\n ...(allowGet\n ? {\n get: (target: U, prop: string | symbol): any => {\n const property = Reflect.has(propertyMapGet, prop)\n ? Reflect.get(propertyMapGet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.get(target, prop);\n } else {\n throw new Error(`Unauthorize to get ${prop} property`);\n }\n } else {\n return Reflect.get(target, prop);\n }\n }\n }\n : {}),\n ...(allowSet\n ? {\n set: (target: U, prop: string | symbol, value: any): boolean => {\n const property = Reflect.has(propertyMapSet, prop)\n ? Reflect.get(propertyMapSet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.set(target, prop, value);\n } else {\n throw new Error(`Unauthorize to set ${prop} property`);\n }\n } else {\n return false;\n }\n }\n }\n : {})\n };\n\n return new Proxy(obj, handler);\n }\n}\n","import {\n ConditionResolver,\n EvaluateIdentityBasedInterface,\n IdentityBasedType\n} from './types';\nimport { IdentityBased } from './IdentityBasedStatement';\nimport { Policy } from './Policy';\n\ninterface IdentityBasedPolicyInterface {\n statements: IdentityBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class IdentityBasedPolicy extends Policy<\n T,\n IdentityBasedType\n> {\n private denyStatements: IdentityBased[];\n private allowStatements: IdentityBased[];\n private statements: IdentityBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: IdentityBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new IdentityBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: IdentityBasedPolicy,\n statement: IdentityBasedType\n ): void {\n const statementInstance = new IdentityBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: IdentityBasedPolicy): IdentityBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n const args = { action, resource, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n\n cannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n","import {\n ConditionResolver,\n EvaluateResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { ResourceBased } from './ResourceBasedStatement';\nimport { Policy } from './Policy';\n\ninterface ResourceBasedPolicyInterface {\n statements: ResourceBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ResourceBasedPolicy extends Policy<\n T,\n ResourceBasedType\n> {\n private denyStatements: ResourceBased[];\n private allowStatements: ResourceBased[];\n private statements: ResourceBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ResourceBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ResourceBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: ResourceBasedPolicy,\n statement: ResourceBasedType\n ): void {\n const statementInstance = new ResourceBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ResourceBasedPolicy): ResourceBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n const args = { principal, action, resource, principalType, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n cannot(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;SAgBgB,MAAM,CAAC,KAAc;IACnC,OAAO,MAAM,C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,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAAC;KACxD;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;KACxB;IAED,QAAQ,CAEN,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC7C;IAED,GAAG,CAED,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KACjC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;IAED,MAAM,CAEJ,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,KAChC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;;;;;"} \ No newline at end of file +{"version":3,"file":"main.es.js","sources":["../src/utils/getTag.ts","../src/utils/isSymbol.ts","../src/utils/toKey.ts","../src/utils/isKey.ts","../src/utils/memoize.ts","../src/utils/memoizeCapped.ts","../src/utils/stringToPath.ts","../src/utils/getValueFromPath.ts","../src/utils/applyContext.ts","../src/utils/decomposeString.ts","../src/utils/braceExpand.ts","../src/Matcher.ts","../src/utils/mersenneTwister.ts","../src/utils/generateUUID.ts","../src/conditionOperators/boolean/bool.ts","../src/conditionOperators/date/convertDate.ts","../src/conditionOperators/date/dateEquals.ts","../src/conditionOperators/date/dateGreaterThan.ts","../src/conditionOperators/date/dateGreaterThanEquals.ts","../src/conditionOperators/date/dateLessThan.ts","../src/conditionOperators/date/dateLessThanEquals.ts","../src/conditionOperators/date/dateNotEquals.ts","../src/conditionOperators/numeric/numericEquals.ts","../src/conditionOperators/numeric/numericGreaterThan.ts","../src/conditionOperators/numeric/numericGreaterThanEquals.ts","../src/conditionOperators/numeric/numericLessThan.ts","../src/conditionOperators/numeric/numericLessThanEquals.ts","../src/conditionOperators/numeric/numericNotEquals.ts","../src/conditionOperators/string/stringEquals.ts","../src/conditionOperators/string/stringEqualsIgnoreCase.ts","../src/conditionOperators/string/stringLike.ts","../src/conditionOperators/string/stringLikeIfExists.ts","../src/conditionOperators/string/stringNotEquals.ts","../src/conditionOperators/string/stringNotEqualsIgnoreCase.ts","../src/conditionOperators/index.ts","../src/Statement.ts","../src/ActionBasedStatement.ts","../src/IdentityBasedStatement.ts","../src/ResourceBasedStatement.ts","../src/Policy.ts","../src/ActionBasedPolicy.ts","../src/IdentityBasedPolicy.ts","../src/ResourceBasedPolicy.ts"],"sourcesContent":["/**\n * Gets the `toStringTag` of `value`.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n * @example\n * ```javascript\n * getTag(1)\n * // => '[object Number]'\n *\n * getTag(null)\n * // => '[object Null]'\n * ```\n */\nexport function getTag(value: unknown): string {\n return Object.prototype.toString.call(value);\n}\n","import { getTag } from './getTag';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @since 3.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n * ```javascript\n * isSymbol(Symbol())\n * // => true\n *\n * isSymbol('abc')\n * // => false\n * ```\n */\nexport function isSymbol(value?: unknown): value is symbol {\n const type = typeof value;\n return (\n type === 'symbol' ||\n (type === 'object' && value !== null && getTag(value) === '[object Symbol]')\n );\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used as references for various `Number` constants. */\nconst INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n * @example\n *\n * toKey(Symbol.iterator)\n * // => true\n *\n * toKey('abc')\n * // => false\n */\nexport function toKey(value: unknown): string | symbol {\n if (typeof value === 'string' || isSymbol(value)) {\n return value;\n }\n\n return value === 0 && 1 / value === -INFINITY ? '-0' : `${value}`;\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used to match property names within property paths. */\nconst reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\nconst reIsPlainProp = /^\\w*$/; //matches any word character (alphanumeric and underscore)\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n * @example\n * ```javascript\n * isKey(1)\n * // => true\n *\n * isKey('example[test]')\n * // => false\n *\n * isKey('a.b')\n * // => false\n *\n * const obj = {\n * '[a]': 5,\n * 'b.c': true\n * };\n *\n * isKey('[a]', obj)\n * // => true\n *\n * isKey('b.c', obj)\n * // => true\n * ```\n */\nexport function isKey(value: unknown, object?: T): boolean {\n const type = typeof value;\n if (\n type === 'number' ||\n type === 'boolean' ||\n value === null ||\n value === undefined ||\n isSymbol(value)\n ) {\n return true;\n }\n if (typeof value === 'string') {\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object !== null && value in Object(object))\n );\n }\n return false;\n}\n","import { MemoizeInterface } from '../types';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * @since 3.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n * ```javascript\n * const object = { 'a': 1, 'b': 2 }\n * const other = { 'c': 3, 'd': 4 }\n *\n * const values = memoize(values)\n * values(object)\n * // => [1, 2]\n *\n * values(other)\n * // => [3, 4]\n *\n * object.a = 2\n * values(object)\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b'])\n * values(object)\n * // => ['a', 'b']\n * ```\n */\nexport function memoize(\n func: (...args: unknown[]) => any,\n resolver?: (...args: unknown[]) => any\n): MemoizeInterface {\n const memoized = function (\n this: (...args: unknown[]) => any,\n ...args: unknown[]\n ): MemoizeInterface {\n const key = resolver ? resolver.apply(this, args) : args[0];\n const cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = func.apply(this, args);\n cache.set(key, result);\n return result;\n };\n memoized.cache = new Map();\n return memoized;\n}\n\n/*const memoize = (fn: Function): Function => {\n const cache = {};\n return (...args): any => {\n const stringifiedArgs = JSON.stringify(args);\n const result = (cache[stringifiedArgs] =\n typeof cache[stringifiedArgs] === 'undefined'\n ? fn(...args)\n : cache[stringifiedArgs]);\n return result;\n };\n};*/\n","import { memoize } from './memoize';\nimport { MemoizeInterface } from '../types';\n\n/** Used as the maximum memoize cache size. */\nexport const MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @since 3.1.0\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nexport function memoizeCapped(\n func: (...args: any) => unknown\n): MemoizeInterface {\n const result = memoize(func, (key: unknown) => {\n const { cache } = result;\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n return result;\n}\n","import { memoizeCapped } from './memoizeCapped';\n\nconst charCodeOfDot = '.'.charCodeAt(0);\nconst reEscapeChar = /\\\\(\\\\)?/g;\nconst rePropName = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\x02)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\x02' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n);\n\n/**\n * Converts `string` to a property path array.\n *\n * @since 3.1.0\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nexport const stringToPath = memoizeCapped((string: string) => {\n const result = [];\n if (string.charCodeAt(0) === charCodeOfDot) {\n result.push('');\n }\n string.replace(\n rePropName,\n (\n match: string,\n expression: string,\n quote: string,\n subString: string\n ): string => {\n let key = match;\n if (quote) {\n key = subString.replace(reEscapeChar, '$1');\n } else if (expression) {\n key = expression.trim();\n }\n result.push(key);\n return '';\n }\n );\n return result;\n});\n","import { toKey } from './toKey';\nimport { isKey } from './isKey';\nimport { stringToPath } from './stringToPath';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nexport function castPath(\n value: unknown,\n object: U\n): Array {\n if (Array.isArray(value)) {\n return value;\n }\n\n return isKey(value, object) ? [value] : stringToPath(value);\n}\n\n/**\n * The base implementation of `get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nexport function baseGet(\n object: U,\n path: Array | string\n): any {\n const newPath = castPath(path, object);\n\n let index = 0;\n const length = newPath.length;\n\n let value: any = object;\n while (value instanceof Object && index < length) {\n value = value[toKey(newPath[index++])];\n }\n\n return index && index === length ? value : undefined;\n}\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @since 3.1.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * const object = { 'a': [{ 'b': { 'c': 3 } }] }\n *\n * getValueFromPath(object, 'a[0].b.c')\n * // => 3\n *\n * getValueFromPath(object, ['a', '0', 'b', 'c'])\n * // => 3\n *\n * getValueFromPath(object, 'a.b.c', 'default')\n * // => 'default'\n */\nexport function getValueFromPath(\n object: U,\n path: Array | string,\n defaultValue?: unknown\n): any {\n const result = object === null ? undefined : baseGet(object, path);\n\n return result === undefined ? defaultValue : result;\n}\n","import { getValueFromPath } from './getValueFromPath';\n\nconst reDelimiters = /\\${([^}]*)}/g;\nconst trim = / +(?= )|^\\s+|\\s+$/g;\n\nconst specialTrim = (str: string): string => str.replace(trim, '');\n\n/**\n * Apply the context value in a string.\n *\n * @param {string} str Pattern string, containing context path.\n * @param {object} context Object to get values from path.\n * @returns {string} Returns a string with embedded context values.\n * @example\n * ```javascript\n * const context = {\n * user: { id: 456, bestFriends: [123, 532, 987] }\n * };\n * applyContext('secrets:${user.id}:*', context)\n * // => 'secrets:456:*'\n *\n * applyContext('secrets:${user.bestFriends}:*', context)\n * // => 'secrets:{123,532,987}:*'\n *\n * applyContext('secrets:${company.address}:account', context)\n * // => 'secrets:undefined:account'\n * ```\n */\nexport function applyContext(\n str: string,\n context?: T\n): string {\n if (!context) return str;\n\n return specialTrim(\n str.replace(reDelimiters, (_, path: string) => {\n const value = getValueFromPath(context, path);\n if (Array.isArray(value)) return `{${value}}`;\n if (value instanceof Object) return 'undefined';\n\n return String(value);\n })\n );\n}\n","import { DecomposeString } from '../types';\n\n/**\n * Get index range where separators are found.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {number[]} Returns the beginning and final index for those matches.\n * @example\n * ```javascript\n * getIndexRange('first', 'Second', 'firstAndSecond')\n * // => [0, 8]\n *\n * getIndexRange('First', 'Second', '++FirstAndSecond**')\n * // => [2, 10]\n * ```\n */\nfunction getIndexRange(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): number[] {\n const beginningIndex = str.indexOf(initialSeparator);\n const finalIndex = str.indexOf(finalSeparator, beginningIndex + 1);\n\n if (beginningIndex >= 0 && finalIndex > 0) {\n return [beginningIndex, finalIndex];\n }\n\n return [-1, -1];\n}\n\n/**\n * Object returned by decomposeString function\n *\n * @typedef {Object} DecomposedString\n * @property {number} start Beginning index for first separator match\n * @property {number} end Final index for second separator match\n * @property {string} pre Substring before first separator\n * @property {string} body Substring between separators\n * @property {string} post Substring after second separator\n */\n\n/**\n * Decompose string in pre, body and post strings by using separators.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {DecomposedString} Returns a decompose string.\n * @example\n * ```javascript\n * decomposeString('first', 'Second', 'firstAndSecond')\n * // => { start: 0, end: 8, pre: '', body: 'And', post: '' }\n *\n * decomposeString('First', 'Second', '++FirstAndSecond**')\n * // => { start: 2, end: 10, pre: '++', body: 'And', post: '**' }\n * ```\n */\nexport function decomposeString(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): DecomposeString {\n const [beginningIndex, finalIndex] = getIndexRange(\n initialSeparator,\n finalSeparator,\n str\n );\n\n return {\n start: beginningIndex,\n end: finalIndex,\n pre: beginningIndex >= 0 ? str.slice(0, beginningIndex) : '',\n body:\n beginningIndex >= 0\n ? str.slice(beginningIndex + initialSeparator.length, finalIndex)\n : '',\n post:\n beginningIndex >= 0 ? str.slice(finalIndex + finalSeparator.length) : ''\n };\n}\n","import { decomposeString } from './decomposeString';\n\n/**\n * Generate an array of string depending on {} blocks.\n *\n * @param {string} pattern Pattern string that can contains {} blocks.\n * @returns {string[]} Returns an array of string with all the combinations.\n * @example\n * ```javascript\n * braceExpand('${13}')\n * // => ['{13}']\n *\n * braceExpand('a{b,f,m}p')\n * // => ['abp','afp','amp']\n *\n * braceExpand('-v{,,}')\n * // => ['-v','-v','-v']\n * ```\n */\nconst braceExpand = (pattern: string): string[] => {\n if (!pattern.match(/{.*}/)) {\n return [pattern];\n }\n\n return expand(pattern, true);\n};\n\nconst expand = (str: string, isTop?: boolean): string[] => {\n const expansions = [] as string[];\n const balance = decomposeString('{', '}', str);\n if (balance.start < 0) return [str];\n\n const parts = balance.body.split(',');\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = balance.pre;\n const postParts = balance.post.length ? expand(balance.post, false) : [''];\n\n if (/\\$$/.test(balance.pre)) {\n postParts.forEach((postPart) => {\n const expansion = `${balance.pre.slice(0, -1)}{${\n balance.body\n }}${postPart}`;\n expansions.push(expansion);\n });\n } else {\n parts.forEach((part: string) => {\n postParts.forEach((postPart) => {\n const expansion = pre + part + postPart;\n if (!isTop || expansion) expansions.push(expansion);\n });\n });\n }\n\n return expansions;\n};\n\nexport { braceExpand };\n","import { braceExpand } from './utils/braceExpand';\n\nexport class Matcher {\n private readonly pattern: string;\n private readonly maxLength: number;\n private readonly set: (string | RegExp)[];\n private readonly empty: boolean;\n\n constructor(pattern: string, maxLength = 1024 * 64) {\n this.set = [];\n this.pattern = pattern.trim();\n this.maxLength = maxLength;\n this.empty = !this.pattern ? true : false;\n\n const set = braceExpand(pattern);\n this.set = set.map((val) => this.parse(val));\n this.set = this.set.filter((s) => {\n return Boolean(s);\n });\n }\n\n match(this: Matcher, str: string): boolean {\n if (this.empty) return str === '';\n\n return this.set.some((pattern) => this.matchOne(str, pattern));\n }\n\n private parse(pattern: string): string | RegExp {\n if (pattern.length > this.maxLength) {\n throw new TypeError('Pattern is too long');\n }\n let regExp;\n let hasSpecialCharacter = false;\n if (pattern === '') return '';\n\n const re = pattern.replace(/\\*/g, () => {\n hasSpecialCharacter = true;\n return '.+?';\n });\n\n // skip the regexp for non-* patterns\n // unescape anything in it, though, so that it'll be\n // an exact match.\n if (!hasSpecialCharacter) {\n return pattern.replace(/\\\\(.)/g, '$1');\n }\n\n try {\n regExp = new RegExp('^' + re + '$');\n } catch (error) {\n // If it was an invalid regular expression, then it can't match\n // anything.\n return new RegExp('$.');\n }\n\n return regExp;\n }\n\n private matchOne(str: string, pattern: string | RegExp): boolean {\n if (typeof pattern === 'string') {\n return str === pattern;\n }\n\n return Boolean(str.match(pattern));\n }\n}\n","/*\n https://github.com/banksean wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over each other's state.\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n var m = new MersenneTwister();\n var randomNumber = m.random();\n You can also call the other genrand_{foo}() methods on the instance.\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n var m = new MersenneTwister(123);\n and that will always produce the same random sequence.\n Sean McCullough (banksean@gmail.com)\n*/\n\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n Before using, initialize the state by using init_seed(seed)\n or init_by_array(init_key, key_length).\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nexport class MersenneTwister {\n private readonly N: number;\n private readonly M: number;\n private readonly MATRIX_A: number;\n private readonly UPPER_MASK: number;\n private readonly LOWER_MASK: number;\n private readonly mt: number[];\n private mti: number;\n\n constructor(seed?: number | number[]) {\n /* Period parameters */\n this.N = 624;\n this.M = 397;\n this.MATRIX_A = 0x9908b0df; /* constant vector a */\n this.UPPER_MASK = 0x80000000; /* most significant w-r bits */\n this.LOWER_MASK = 0x7fffffff; /* least significant r bits */\n\n this.mt = new Array(this.N); /* the array for the state vector */\n this.mti = this.N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n if (Array.isArray(seed)) {\n if (seed.length > 0) this.initByArray(seed, seed.length);\n } else {\n if (seed === undefined) {\n this.initSeed(new Date().getTime());\n } else {\n this.initSeed(seed);\n }\n }\n }\n\n /* initializes mt[N] with a seed */\n /* origin name init_genrand */\n initSeed(seed: number): void {\n this.mt[0] = seed >>> 0;\n for (this.mti = 1; this.mti < this.N; this.mti++) {\n const s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n this.mt[this.mti] =\n ((((s & 0xffff0000) >>> 16) * 1812433253) << 16) +\n (s & 0x0000ffff) * 1812433253 +\n this.mti;\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n this.mt[this.mti] >>>= 0;\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n initByArray(initKey: number[], keyLength: number): void {\n this.initSeed(19650218);\n let i = 1;\n let j = 0;\n let k = this.N > keyLength ? this.N : keyLength;\n for (; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1664525) << 16) +\n (s & 0x0000ffff) * 1664525)) +\n initKey[j] +\n j; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n j++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n if (j >= keyLength) j = 0;\n }\n for (k = this.N - 1; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) +\n (s & 0x0000ffff) * 1566083941)) -\n i; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n }\n\n this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n /* origin name genrand_int32 */\n randomInt32(): number {\n let y;\n const mag01 = [0x0, this.MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (this.mti >= this.N) {\n /* generate N words at one time */\n let kk;\n\n if (this.mti === this.N + 1)\n /* if init_seed() has not been called, */\n this.initSeed(5489); /* a default initial seed is used */\n\n for (kk = 0; kk < this.N - this.M; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n for (; kk < this.N - 1; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] =\n this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n y =\n (this.mt[this.N - 1] & this.UPPER_MASK) |\n (this.mt[0] & this.LOWER_MASK);\n this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n this.mti = 0;\n }\n\n y = this.mt[this.mti++];\n\n /* Tempering */\n y ^= y >>> 11;\n y ^= (y << 7) & 0x9d2c5680;\n y ^= (y << 15) & 0xefc60000;\n y ^= y >>> 18;\n\n return y >>> 0;\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n /* origin name genrand_int31 */\n randomInt31(): number {\n return this.randomInt32() >>> 1;\n }\n\n /* generates a random number on [0,1]-real-interval */\n /* origin name genrand_real1 */\n randomReal1(): number {\n return this.randomInt32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n /* origin name genrand_real2 */\n randomReal2(): number {\n return this.randomInt32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n /* origin name genrand_real3 */\n randomReal3(): number {\n return (this.randomInt32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n /* origin name genrand_res53 */\n randomRes53(): number {\n const a = this.randomInt32() >>> 5;\n const b = this.randomInt32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n }\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n","import { MersenneTwister } from './mersenneTwister';\n\nconst replacePlaceholders = (mersenne: MersenneTwister) => (\n placeholder: string\n): string => {\n const random = Math.floor(mersenne.randomReal2() * 16);\n\n const value = placeholder === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n};\n\n/**\n * Generate a uuid.\n *\n * @private\n * @since 3.5.0\n * @returns {string} Returns the generated uuid.\n * @example\n * ```javascript\n * generateUUID()\n * // => 49e71c40-9b21-4371-9699-2def33f62e66\n *\n * generateUUID()\n * // => da94f128-4247-48e3-bc73-d0cae46b5093\n * ```\n */\nexport function generateUUID(): string {\n const mersenne = new MersenneTwister();\n const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\n return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders(mersenne));\n}\n","/**\n * Boolean matching.\n *\n * @since 4.7.0\n * @category Boolean\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * bool(true, true)\n * // => true\n *\n * bool(true, false)\n * // => false\n * ```\n */\nexport function bool(data: boolean, expected: boolean): boolean {\n return (\n data === expected\n );\n}\n","export type DateType = Date | string;\n\nexport const convertDate = (date: DateType): number=>{\n if(date instanceof Date){\n return date.getTime();\n }\n\n return Date.parse(date);\n}","import {DateType, convertDate} from './convertDate';\n\n/**\n * Exact date matching.\n *\n * @since 4.8.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * dateEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateEquals('December 15, 2000 03:24:00', 'December 10, 2001 03:24:00')\n * // => false\n * ```\n */\nexport function dateEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData === convertedExpectation\n );\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than `expected value`.\n * @example\n * ```javascript\n * dateGreaterThan('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateGreaterThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData > convertedExpectation;\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching at or after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than or equals `expected value`.\n * @example\n * ```javascript\n * dateGreaterThanEquals('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:25:00')\n * // => false\n * ```\n */\nexport function dateGreaterThanEquals(\n data: DateType,\n expected: DateType\n): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData >= convertedExpectation;\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is before than `expected value`.\n * @example\n * ```javascript\n * dateLessThan('December 15, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateLessThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData < convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching at or before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal or before than `expected value`.\n * @example\n * ```javascript\n * dateLessThanEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateLessThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThanEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData <= convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Negated date matching.\n *\n * @since 4.9.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * dateNotEquals('December 15, 1994 03:24:00', 'December 16, 1995 03:24:00')\n * // => true\n *\n * dateNotEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateNotEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData !== convertedExpectation\n );\n}\n","/**\n * Exact numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * numericEquals(5, 5)\n * // => true\n *\n * numericEquals(2, 4)\n * // => false\n * ```\n */\nexport function numericEquals(data: number, expected: number): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Numeric greater than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than `expected value`.\n * @example\n * ```javascript\n * numericGreaterThan(6, 5)\n * // => true\n *\n * numericGreaterThan(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThan(data: number, expected: number): boolean {\n return (\n data > expected\n );\n}\n","/**\n * Numeric greater than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than or equals `expected value`.\n * @example\n * ```javascript\n * numericGreaterThanEquals(5, 5)\n * // => true\n *\n * numericGreaterThanEquals(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThanEquals(data: number, expected: number): boolean {\n return (\n data >= expected\n );\n}\n","/**\n * Numeric less than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than `expected value`.\n * @example\n * ```javascript\n * numericLessThan(5, 6)\n * // => true\n *\n * numericLessThan(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThan(data: number, expected: number): boolean {\n return (\n data < expected\n );\n}\n","/**\n * Numeric less than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than or equals `expected value`.\n * @example\n * ```javascript\n * numericLessThanEquals(5, 5)\n * // => true\n *\n * numericLessThanEquals(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThanEquals(data: number, expected: number): boolean {\n return (\n data <= expected\n );\n}\n","/**\n * Negated numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * numericNotEquals(2, 4)\n * // => true\n *\n * numericNotEquals(5, 5)\n * // => false\n * ```\n */\nexport function numericNotEquals(data: number, expected: number): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Exact string matching, case sensitive.\n *\n * @since 4.3.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEquals('hi', 'hi')\n * // => true\n *\n * stringEquals('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEquals(data: string, expected: string): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Exact string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEqualsIgnoreCase('hi', 'Hi')\n * // => true\n *\n * stringEqualsIgnoreCase('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() === expected.toLowerCase()\n );\n}\n","import {Matcher} from '../../Matcher';\n\n/**\n * Case-sensitive matching. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.5.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value`.\n * @example\n * ```javascript\n * stringLike('newHouse', 'new*')\n * // => true\n *\n * stringLike('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLike(data: string, expected: string): boolean {\n return (\n new Matcher(data).match(expected)\n );\n}\n","import {stringLike} from './stringLike';\n\n/**\n * Case-sensitive matching if exist. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.12.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value` or if it does not exist.\n * @example\n * ```javascript\n * stringLikeIfExists(undefined, 'new*')\n * // => true\n *\n * stringLikeIfExists('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLikeIfExists(data: string | undefined, expected: string): boolean {\n return data?(\n stringLike(data,expected)\n ):true;\n}\n","/**\n * Negated string matching.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEquals('hi', 'no')\n * // => true\n * \n * stringNotEquals('hi', 'hi')\n * // => false\n * ```\n */\nexport function stringNotEquals(data: string, expected: string): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Negated string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEqualsIgnoreCase('hi', 'no')\n * // => true\n * \n * stringNotEqualsIgnoreCase('hi', 'Hi')\n * // => false\n * ```\n */\nexport function stringNotEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() !== expected.toLowerCase()\n );\n}\n","import { bool } from './boolean/bool';\nimport { dateEquals } from './date/dateEquals';\nimport { dateGreaterThan } from './date/dateGreaterThan';\nimport { dateGreaterThanEquals } from './date/dateGreaterThanEquals';\nimport { dateLessThan } from './date/dateLessThan';\nimport { dateLessThanEquals } from './date/dateLessThanEquals';\nimport { dateNotEquals } from './date/dateNotEquals';\nimport { numericEquals } from './numeric/numericEquals';\nimport { numericGreaterThan } from './numeric/numericGreaterThan';\nimport { numericGreaterThanEquals } from './numeric/numericGreaterThanEquals';\nimport { numericLessThan } from './numeric/numericLessThan';\nimport { numericLessThanEquals } from './numeric/numericLessThanEquals';\nimport { numericNotEquals } from './numeric/numericNotEquals';\nimport { stringEquals } from './string/stringEquals';\nimport { stringEqualsIgnoreCase } from './string/stringEqualsIgnoreCase';\nimport { stringLike } from './string/stringLike';\nimport { stringLikeIfExists } from './string/stringLikeIfExists';\nimport { stringNotEquals } from './string/stringNotEquals';\nimport { stringNotEqualsIgnoreCase } from './string/stringNotEqualsIgnoreCase';\n\nexport const operators: Record = {\n bool,\n dateEquals,\n dateGreaterThan,\n dateGreaterThanEquals,\n dateLessThan,\n dateLessThanEquals,\n dateNotEquals,\n numericEquals,\n numericGreaterThan,\n numericGreaterThanEquals,\n numericLessThan,\n numericLessThanEquals,\n numericNotEquals,\n stringEquals,\n stringEqualsIgnoreCase,\n stringLike,\n stringLikeIfExists,\n stringNotEquals,\n stringNotEqualsIgnoreCase\n};\n","import {\n EffectBlock,\n ConditionBlock,\n StatementInterface,\n MatchConditionInterface,\n MatchConditionResolverInterface\n} from './types';\nimport { getValueFromPath } from './utils/getValueFromPath';\nimport { generateUUID } from './utils/generateUUID';\nimport {operators} from './conditionOperators';\n\nabstract class Statement {\n protected sid: string;\n protected readonly condition?: ConditionBlock;\n effect: EffectBlock;\n\n constructor({ sid, effect = 'allow', condition }: StatementInterface) {\n if (!sid) {\n this.sid = generateUUID();\n } else {\n this.sid = sid;\n }\n this.effect = effect;\n this.condition = condition;\n }\n\n matchConditions(\n this: Statement,\n { context, conditionResolver }: MatchConditionInterface\n ): boolean {\n const { condition: conditions } = this;\n\n if(conditions && context){\n return Object.keys(conditions).every((condition) =>\n Object.keys(conditions[condition]).every((path) => {\n const conditionValues = conditions[condition][path];\n if (conditionValues instanceof Array) {\n return conditionValues.some((value) =>\n this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value\n })\n );\n }\n\n return this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value: conditionValues\n });\n })\n )\n }\n\n return true;\n }\n\n private evaluateCondition(\n this: Statement,\n { context, conditionResolver={}, path, value, condition }: MatchConditionResolverInterface\n ): boolean {\n\n const currentResolver= conditionResolver[condition] || operators[condition]\n\n if(currentResolver){\n return currentResolver(\n getValueFromPath(context, path),\n value\n )\n }\n return false;\n }\n}\n\nexport { Statement };\n","import { ActionBasedType, MatchActionBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ActionBased extends Statement {\n private action?: string[];\n private notAction?: string[];\n private statement: ActionBasedType;\n\n constructor(action: ActionBasedType) {\n super(action);\n this.checkAndAssignActions(action);\n this.statement = { ...action, sid: this.sid };\n }\n\n getStatement(this: ActionBased): ActionBasedType {\n return this.statement;\n }\n\n matches(\n this: ActionBased,\n { action, context, conditionResolver }: MatchActionBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(action: ActionBasedType): void {\n const hasAction = 'action' in action;\n const hasNotAction = 'notAction' in action;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ActionBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in action) {\n this.action =\n typeof action.action === 'string' ? [action.action] : action.action;\n } else {\n this.notAction =\n typeof action.notAction === 'string'\n ? [action.notAction]\n : action.notAction;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n}\n\nexport { ActionBased };\n","import { IdentityBasedType, MatchIdentityBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass IdentityBased extends Statement {\n private resource?: string[];\n private action?: string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: IdentityBasedType;\n\n constructor(identity: IdentityBasedType) {\n super(identity);\n this.checkAndAssignActions(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: IdentityBased): IdentityBasedType {\n return this.statement;\n }\n\n matches(\n this: IdentityBased,\n {\n action,\n resource,\n context,\n conditionResolver\n }: MatchIdentityBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(identity: IdentityBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'IdentityBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignResources(identity: IdentityBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'IdentityBased statement should have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n } else {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { IdentityBased };\n","import {\n PrincipalMap,\n MatchResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ResourceBased extends Statement {\n private principal?: PrincipalMap | string[];\n private resource?: string[];\n private action?: string[];\n private notPrincipal?: PrincipalMap | string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: ResourceBasedType;\n private hasPrincipals: boolean;\n private hasResources: boolean;\n\n constructor(identity: ResourceBasedType) {\n super(identity);\n this.hasPrincipals = false;\n this.hasResources = false;\n this.checkAndAssignActions(identity);\n this.checkAndAssignPrincipals(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: ResourceBased): ResourceBasedType {\n return this.statement;\n }\n\n matches(\n this: ResourceBased,\n {\n principal,\n action,\n resource,\n principalType,\n context,\n conditionResolver\n }: MatchResourceBasedInterface\n ): boolean {\n return (\n this.matchPrincipalAndNotPrincipal(principal, principalType, context) &&\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResourceAndNotResource(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n /*valueComing principal noPrincipal\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchPrincipalAndNotPrincipal(\n principal?: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (principal) {\n if (this.hasPrincipals)\n return (\n this.matchPrincipals(principal, principalType, context) &&\n this.matchNotPrincipals(principal, principalType, context)\n );\n return false;\n }\n if (this.hasPrincipals) return false;\n return true;\n }\n\n /*valueComing resource noResource\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchResourceAndNotResource(resource?: string, context?: T): boolean {\n if (resource) {\n if (this.hasResources)\n return (\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context)\n );\n return false;\n }\n if (this.hasResources) return false;\n return true;\n }\n\n private checkAndAssignActions(identity: ResourceBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ResourceBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignPrincipals(identity: ResourceBasedType): void {\n const hasPrincipal = 'principal' in identity;\n const hasNotPrincipal = 'notPrincipal' in identity;\n if (hasPrincipal && hasNotPrincipal) {\n throw new TypeError(\n 'ResourceBased statement could have a principal or a notPrincipal attribute, no both'\n );\n }\n if ('principal' in identity) {\n this.principal =\n typeof identity.principal === 'string'\n ? [identity.principal]\n : identity.principal;\n this.hasPrincipals = true;\n } else if ('notPrincipal' in identity) {\n this.notPrincipal =\n typeof identity.notPrincipal === 'string'\n ? [identity.notPrincipal]\n : identity.notPrincipal;\n this.hasPrincipals = true;\n }\n }\n\n private checkAndAssignResources(identity: ResourceBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'ResourceBased statement could have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n this.hasResources = true;\n } else if ('notResource' in identity) {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n this.hasResources = true;\n }\n }\n\n private matchPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.principal) {\n if (this.principal instanceof Array) {\n return principalType\n ? false\n : this.principal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.principal[principalType];\n if (principalValues instanceof Array) {\n return principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return false;\n }\n return false;\n }\n }\n return true;\n }\n\n private matchNotPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.notPrincipal) {\n if (this.notPrincipal instanceof Array) {\n return principalType\n ? true\n : !this.notPrincipal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.notPrincipal[principalType];\n if (principalValues instanceof Array) {\n return !principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return !new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return true;\n }\n return true;\n }\n }\n return true;\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { ResourceBased };\n","import { MatchConditionInterface, ConditionResolver } from './types';\n\nabstract class Policy {\n protected context?: T;\n protected conditionResolver?: ConditionResolver;\n\n constructor({ context, conditionResolver }: MatchConditionInterface) {\n this.context = context;\n this.conditionResolver = conditionResolver;\n }\n\n setContext(this: Policy, context: T): void {\n this.context = context;\n }\n\n getContext(this: Policy): T | undefined {\n return this.context;\n }\n\n setConditionResolver(\n this: Policy,\n conditionResolver: ConditionResolver\n ): void {\n this.conditionResolver = conditionResolver;\n }\n\n getConditionResolver(this: Policy): ConditionResolver | undefined {\n return this.conditionResolver;\n }\n\n abstract getStatements(this: Policy): U[];\n}\n\nexport { Policy };\n","import {\n ActionBasedType,\n ConditionResolver,\n EvaluateActionBasedInterface,\n ProxyOptions\n} from './types';\nimport { ActionBased } from './ActionBasedStatement';\nimport { Policy } from './Policy';\n\nexport interface ActionBasedPolicyInterface {\n statements: ActionBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ActionBasedPolicy extends Policy<\n T,\n ActionBasedType\n> {\n private denyStatements: ActionBased[];\n private allowStatements: ActionBased[];\n private statements: ActionBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ActionBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ActionBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(this: ActionBasedPolicy, statement: ActionBasedType): void {\n const statementInstance = new ActionBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ActionBasedPolicy): ActionBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n const args = { action, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n cannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n generateProxy(\n this: ActionBasedPolicy,\n obj: U,\n options: ProxyOptions = {}\n ): U {\n const { get = {}, set = {} } = options;\n const { allow: allowGet = true, propertyMap: propertyMapGet = {} } = get;\n const { allow: allowSet = true, propertyMap: propertyMapSet = {} } = set;\n const handler = {\n ...(allowGet\n ? {\n get: (target: U, prop: string | symbol): any => {\n const property = Reflect.has(propertyMapGet, prop)\n ? Reflect.get(propertyMapGet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.get(target, prop);\n } else {\n throw new Error(`Unauthorize to get ${prop} property`);\n }\n } else {\n return Reflect.get(target, prop);\n }\n }\n }\n : {}),\n ...(allowSet\n ? {\n set: (target: U, prop: string | symbol, value: any): boolean => {\n const property = Reflect.has(propertyMapSet, prop)\n ? Reflect.get(propertyMapSet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.set(target, prop, value);\n } else {\n throw new Error(`Unauthorize to set ${prop} property`);\n }\n } else {\n return false;\n }\n }\n }\n : {})\n };\n\n return new Proxy(obj, handler);\n }\n}\n","import {\n ConditionResolver,\n EvaluateIdentityBasedInterface,\n IdentityBasedType\n} from './types';\nimport { IdentityBased } from './IdentityBasedStatement';\nimport { Policy } from './Policy';\n\ninterface IdentityBasedPolicyInterface {\n statements: IdentityBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class IdentityBasedPolicy extends Policy<\n T,\n IdentityBasedType\n> {\n private denyStatements: IdentityBased[];\n private allowStatements: IdentityBased[];\n private statements: IdentityBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: IdentityBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new IdentityBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: IdentityBasedPolicy,\n statement: IdentityBasedType\n ): void {\n const statementInstance = new IdentityBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: IdentityBasedPolicy): IdentityBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n const args = { action, resource, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n\n cannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n}\n","import {\n ConditionResolver,\n EvaluateResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { ResourceBased } from './ResourceBasedStatement';\nimport { Policy } from './Policy';\n\ninterface ResourceBasedPolicyInterface {\n statements: ResourceBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ResourceBasedPolicy extends Policy<\n T,\n ResourceBasedType\n> {\n private denyStatements: ResourceBased[];\n private allowStatements: ResourceBased[];\n private statements: ResourceBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ResourceBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ResourceBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: ResourceBasedPolicy,\n statement: ResourceBasedType\n ): void {\n const statementInstance = new ResourceBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ResourceBasedPolicy): ResourceBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n const args = { principal, action, resource, principalType, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n cannot(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;SAgBgB,MAAM,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C;;AChBA;;;;;;;;;;;;;;;;SAgBgB,QAAQ,CAAC,KAAe;IACtC,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,QACE,IAAI,KAAK,QAAQ;SAChB,IAAI,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC,EAC5E;AACJ;;ACtBA;AACA,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;;;;;;;SAegB,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;AACpE;;ACxBA;AACA,MAAM,YAAY,GAAG,kDAAkD,CAAC;AACxE,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA+BgB,KAAK,CAAmB,KAAc,EAAE,MAAU;IAChE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC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AAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC7C;IAED,GAAG,CAED,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KACjC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;IAED,MAAM,CAEJ,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,KAChC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;;;;;"} \ No newline at end of file diff --git a/dist/main.js b/dist/main.js index 2d77bbd..031dcad 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1716,6 +1716,20 @@ class IdentityBasedPolicy extends Policy { conditionResolver: this.conditionResolver })); } + whyCannot({ action, resource, context }) { + return this.denyStatements.reduce((statements, currentStatement) => { + const matches = currentStatement.matches({ + action, + resource, + context: context || this.context, + conditionResolver: this.conditionResolver + }); + if (matches) { + return [...statements, currentStatement.getStatement()]; + } + return statements; + }, []); + } } class ResourceBasedPolicy extends Policy { diff --git a/dist/main.js.map b/dist/main.js.map index a9a01d9..8bbfad7 100644 --- a/dist/main.js.map +++ b/dist/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sources":["../src/utils/getTag.ts","../src/utils/isSymbol.ts","../src/utils/toKey.ts","../src/utils/isKey.ts","../src/utils/memoize.ts","../src/utils/memoizeCapped.ts","../src/utils/stringToPath.ts","../src/utils/getValueFromPath.ts","../src/utils/applyContext.ts","../src/utils/decomposeString.ts","../src/utils/braceExpand.ts","../src/Matcher.ts","../src/utils/mersenneTwister.ts","../src/utils/generateUUID.ts","../src/conditionOperators/boolean/bool.ts","../src/conditionOperators/date/convertDate.ts","../src/conditionOperators/date/dateEquals.ts","../src/conditionOperators/date/dateGreaterThan.ts","../src/conditionOperators/date/dateGreaterThanEquals.ts","../src/conditionOperators/date/dateLessThan.ts","../src/conditionOperators/date/dateLessThanEquals.ts","../src/conditionOperators/date/dateNotEquals.ts","../src/conditionOperators/numeric/numericEquals.ts","../src/conditionOperators/numeric/numericGreaterThan.ts","../src/conditionOperators/numeric/numericGreaterThanEquals.ts","../src/conditionOperators/numeric/numericLessThan.ts","../src/conditionOperators/numeric/numericLessThanEquals.ts","../src/conditionOperators/numeric/numericNotEquals.ts","../src/conditionOperators/string/stringEquals.ts","../src/conditionOperators/string/stringEqualsIgnoreCase.ts","../src/conditionOperators/string/stringLike.ts","../src/conditionOperators/string/stringLikeIfExists.ts","../src/conditionOperators/string/stringNotEquals.ts","../src/conditionOperators/string/stringNotEqualsIgnoreCase.ts","../src/conditionOperators/index.ts","../src/Statement.ts","../src/ActionBasedStatement.ts","../src/IdentityBasedStatement.ts","../src/ResourceBasedStatement.ts","../src/Policy.ts","../src/ActionBasedPolicy.ts","../src/IdentityBasedPolicy.ts","../src/ResourceBasedPolicy.ts"],"sourcesContent":["/**\n * Gets the `toStringTag` of `value`.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n * @example\n * ```javascript\n * getTag(1)\n * // => '[object Number]'\n *\n * getTag(null)\n * // => '[object Null]'\n * ```\n */\nexport function getTag(value: unknown): string {\n return Object.prototype.toString.call(value);\n}\n","import { getTag } from './getTag';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @since 3.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n * ```javascript\n * isSymbol(Symbol())\n * // => true\n *\n * isSymbol('abc')\n * // => false\n * ```\n */\nexport function isSymbol(value?: unknown): value is symbol {\n const type = typeof value;\n return (\n type === 'symbol' ||\n (type === 'object' && value !== null && getTag(value) === '[object Symbol]')\n );\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used as references for various `Number` constants. */\nconst INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n * @example\n *\n * toKey(Symbol.iterator)\n * // => true\n *\n * toKey('abc')\n * // => false\n */\nexport function toKey(value: unknown): string | symbol {\n if (typeof value === 'string' || isSymbol(value)) {\n return value;\n }\n\n return value === 0 && 1 / value === -INFINITY ? '-0' : `${value}`;\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used to match property names within property paths. */\nconst reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\nconst reIsPlainProp = /^\\w*$/; //matches any word character (alphanumeric and underscore)\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n * @example\n * ```javascript\n * isKey(1)\n * // => true\n *\n * isKey('example[test]')\n * // => false\n *\n * isKey('a.b')\n * // => false\n *\n * const obj = {\n * '[a]': 5,\n * 'b.c': true\n * };\n *\n * isKey('[a]', obj)\n * // => true\n *\n * isKey('b.c', obj)\n * // => true\n * ```\n */\nexport function isKey(value: unknown, object?: T): boolean {\n const type = typeof value;\n if (\n type === 'number' ||\n type === 'boolean' ||\n value === null ||\n value === undefined ||\n isSymbol(value)\n ) {\n return true;\n }\n if (typeof value === 'string') {\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object !== null && value in Object(object))\n );\n }\n return false;\n}\n","import { MemoizeInterface } from '../types';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * @since 3.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n * ```javascript\n * const object = { 'a': 1, 'b': 2 }\n * const other = { 'c': 3, 'd': 4 }\n *\n * const values = memoize(values)\n * values(object)\n * // => [1, 2]\n *\n * values(other)\n * // => [3, 4]\n *\n * object.a = 2\n * values(object)\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b'])\n * values(object)\n * // => ['a', 'b']\n * ```\n */\nexport function memoize(\n func: (...args: unknown[]) => any,\n resolver?: (...args: unknown[]) => any\n): MemoizeInterface {\n const memoized = function (\n this: (...args: unknown[]) => any,\n ...args: unknown[]\n ): MemoizeInterface {\n const key = resolver ? resolver.apply(this, args) : args[0];\n const cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = func.apply(this, args);\n cache.set(key, result);\n return result;\n };\n memoized.cache = new Map();\n return memoized;\n}\n\n/*const memoize = (fn: Function): Function => {\n const cache = {};\n return (...args): any => {\n const stringifiedArgs = JSON.stringify(args);\n const result = (cache[stringifiedArgs] =\n typeof cache[stringifiedArgs] === 'undefined'\n ? fn(...args)\n : cache[stringifiedArgs]);\n return result;\n };\n};*/\n","import { memoize } from './memoize';\nimport { MemoizeInterface } from '../types';\n\n/** Used as the maximum memoize cache size. */\nexport const MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @since 3.1.0\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nexport function memoizeCapped(\n func: (...args: any) => unknown\n): MemoizeInterface {\n const result = memoize(func, (key: unknown) => {\n const { cache } = result;\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n return result;\n}\n","import { memoizeCapped } from './memoizeCapped';\n\nconst charCodeOfDot = '.'.charCodeAt(0);\nconst reEscapeChar = /\\\\(\\\\)?/g;\nconst rePropName = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\x02)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\x02' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n);\n\n/**\n * Converts `string` to a property path array.\n *\n * @since 3.1.0\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nexport const stringToPath = memoizeCapped((string: string) => {\n const result = [];\n if (string.charCodeAt(0) === charCodeOfDot) {\n result.push('');\n }\n string.replace(\n rePropName,\n (\n match: string,\n expression: string,\n quote: string,\n subString: string\n ): string => {\n let key = match;\n if (quote) {\n key = subString.replace(reEscapeChar, '$1');\n } else if (expression) {\n key = expression.trim();\n }\n result.push(key);\n return '';\n }\n );\n return result;\n});\n","import { toKey } from './toKey';\nimport { isKey } from './isKey';\nimport { stringToPath } from './stringToPath';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nexport function castPath(\n value: unknown,\n object: U\n): Array {\n if (Array.isArray(value)) {\n return value;\n }\n\n return isKey(value, object) ? [value] : stringToPath(value);\n}\n\n/**\n * The base implementation of `get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nexport function baseGet(\n object: U,\n path: Array | string\n): any {\n const newPath = castPath(path, object);\n\n let index = 0;\n const length = newPath.length;\n\n let value: any = object;\n while (value instanceof Object && index < length) {\n value = value[toKey(newPath[index++])];\n }\n\n return index && index === length ? value : undefined;\n}\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @since 3.1.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * const object = { 'a': [{ 'b': { 'c': 3 } }] }\n *\n * getValueFromPath(object, 'a[0].b.c')\n * // => 3\n *\n * getValueFromPath(object, ['a', '0', 'b', 'c'])\n * // => 3\n *\n * getValueFromPath(object, 'a.b.c', 'default')\n * // => 'default'\n */\nexport function getValueFromPath(\n object: U,\n path: Array | string,\n defaultValue?: unknown\n): any {\n const result = object === null ? undefined : baseGet(object, path);\n\n return result === undefined ? defaultValue : result;\n}\n","import { getValueFromPath } from './getValueFromPath';\n\nconst reDelimiters = /\\${([^}]*)}/g;\nconst trim = / +(?= )|^\\s+|\\s+$/g;\n\nconst specialTrim = (str: string): string => str.replace(trim, '');\n\n/**\n * Apply the context value in a string.\n *\n * @param {string} str Pattern string, containing context path.\n * @param {object} context Object to get values from path.\n * @returns {string} Returns a string with embedded context values.\n * @example\n * ```javascript\n * const context = {\n * user: { id: 456, bestFriends: [123, 532, 987] }\n * };\n * applyContext('secrets:${user.id}:*', context)\n * // => 'secrets:456:*'\n *\n * applyContext('secrets:${user.bestFriends}:*', context)\n * // => 'secrets:{123,532,987}:*'\n *\n * applyContext('secrets:${company.address}:account', context)\n * // => 'secrets:undefined:account'\n * ```\n */\nexport function applyContext(\n str: string,\n context?: T\n): string {\n if (!context) return str;\n\n return specialTrim(\n str.replace(reDelimiters, (_, path: string) => {\n const value = getValueFromPath(context, path);\n if (Array.isArray(value)) return `{${value}}`;\n if (value instanceof Object) return 'undefined';\n\n return String(value);\n })\n );\n}\n","import { DecomposeString } from '../types';\n\n/**\n * Get index range where separators are found.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {number[]} Returns the beginning and final index for those matches.\n * @example\n * ```javascript\n * getIndexRange('first', 'Second', 'firstAndSecond')\n * // => [0, 8]\n *\n * getIndexRange('First', 'Second', '++FirstAndSecond**')\n * // => [2, 10]\n * ```\n */\nfunction getIndexRange(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): number[] {\n const beginningIndex = str.indexOf(initialSeparator);\n const finalIndex = str.indexOf(finalSeparator, beginningIndex + 1);\n\n if (beginningIndex >= 0 && finalIndex > 0) {\n return [beginningIndex, finalIndex];\n }\n\n return [-1, -1];\n}\n\n/**\n * Object returned by decomposeString function\n *\n * @typedef {Object} DecomposedString\n * @property {number} start Beginning index for first separator match\n * @property {number} end Final index for second separator match\n * @property {string} pre Substring before first separator\n * @property {string} body Substring between separators\n * @property {string} post Substring after second separator\n */\n\n/**\n * Decompose string in pre, body and post strings by using separators.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {DecomposedString} Returns a decompose string.\n * @example\n * ```javascript\n * decomposeString('first', 'Second', 'firstAndSecond')\n * // => { start: 0, end: 8, pre: '', body: 'And', post: '' }\n *\n * decomposeString('First', 'Second', '++FirstAndSecond**')\n * // => { start: 2, end: 10, pre: '++', body: 'And', post: '**' }\n * ```\n */\nexport function decomposeString(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): DecomposeString {\n const [beginningIndex, finalIndex] = getIndexRange(\n initialSeparator,\n finalSeparator,\n str\n );\n\n return {\n start: beginningIndex,\n end: finalIndex,\n pre: beginningIndex >= 0 ? str.slice(0, beginningIndex) : '',\n body:\n beginningIndex >= 0\n ? str.slice(beginningIndex + initialSeparator.length, finalIndex)\n : '',\n post:\n beginningIndex >= 0 ? str.slice(finalIndex + finalSeparator.length) : ''\n };\n}\n","import { decomposeString } from './decomposeString';\n\n/**\n * Generate an array of string depending on {} blocks.\n *\n * @param {string} pattern Pattern string that can contains {} blocks.\n * @returns {string[]} Returns an array of string with all the combinations.\n * @example\n * ```javascript\n * braceExpand('${13}')\n * // => ['{13}']\n *\n * braceExpand('a{b,f,m}p')\n * // => ['abp','afp','amp']\n *\n * braceExpand('-v{,,}')\n * // => ['-v','-v','-v']\n * ```\n */\nconst braceExpand = (pattern: string): string[] => {\n if (!pattern.match(/{.*}/)) {\n return [pattern];\n }\n\n return expand(pattern, true);\n};\n\nconst expand = (str: string, isTop?: boolean): string[] => {\n const expansions = [] as string[];\n const balance = decomposeString('{', '}', str);\n if (balance.start < 0) return [str];\n\n const parts = balance.body.split(',');\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = balance.pre;\n const postParts = balance.post.length ? expand(balance.post, false) : [''];\n\n if (/\\$$/.test(balance.pre)) {\n postParts.forEach((postPart) => {\n const expansion = `${balance.pre.slice(0, -1)}{${\n balance.body\n }}${postPart}`;\n expansions.push(expansion);\n });\n } else {\n parts.forEach((part: string) => {\n postParts.forEach((postPart) => {\n const expansion = pre + part + postPart;\n if (!isTop || expansion) expansions.push(expansion);\n });\n });\n }\n\n return expansions;\n};\n\nexport { braceExpand };\n","import { braceExpand } from './utils/braceExpand';\n\nexport class Matcher {\n private readonly pattern: string;\n private readonly maxLength: number;\n private readonly set: (string | RegExp)[];\n private readonly empty: boolean;\n\n constructor(pattern: string, maxLength = 1024 * 64) {\n this.set = [];\n this.pattern = pattern.trim();\n this.maxLength = maxLength;\n this.empty = !this.pattern ? true : false;\n\n const set = braceExpand(pattern);\n this.set = set.map((val) => this.parse(val));\n this.set = this.set.filter((s) => {\n return Boolean(s);\n });\n }\n\n match(this: Matcher, str: string): boolean {\n if (this.empty) return str === '';\n\n return this.set.some((pattern) => this.matchOne(str, pattern));\n }\n\n private parse(pattern: string): string | RegExp {\n if (pattern.length > this.maxLength) {\n throw new TypeError('Pattern is too long');\n }\n let regExp;\n let hasSpecialCharacter = false;\n if (pattern === '') return '';\n\n const re = pattern.replace(/\\*/g, () => {\n hasSpecialCharacter = true;\n return '.+?';\n });\n\n // skip the regexp for non-* patterns\n // unescape anything in it, though, so that it'll be\n // an exact match.\n if (!hasSpecialCharacter) {\n return pattern.replace(/\\\\(.)/g, '$1');\n }\n\n try {\n regExp = new RegExp('^' + re + '$');\n } catch (error) {\n // If it was an invalid regular expression, then it can't match\n // anything.\n return new RegExp('$.');\n }\n\n return regExp;\n }\n\n private matchOne(str: string, pattern: string | RegExp): boolean {\n if (typeof pattern === 'string') {\n return str === pattern;\n }\n\n return Boolean(str.match(pattern));\n }\n}\n","/*\n https://github.com/banksean wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over each other's state.\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n var m = new MersenneTwister();\n var randomNumber = m.random();\n You can also call the other genrand_{foo}() methods on the instance.\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n var m = new MersenneTwister(123);\n and that will always produce the same random sequence.\n Sean McCullough (banksean@gmail.com)\n*/\n\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n Before using, initialize the state by using init_seed(seed)\n or init_by_array(init_key, key_length).\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nexport class MersenneTwister {\n private readonly N: number;\n private readonly M: number;\n private readonly MATRIX_A: number;\n private readonly UPPER_MASK: number;\n private readonly LOWER_MASK: number;\n private readonly mt: number[];\n private mti: number;\n\n constructor(seed?: number | number[]) {\n /* Period parameters */\n this.N = 624;\n this.M = 397;\n this.MATRIX_A = 0x9908b0df; /* constant vector a */\n this.UPPER_MASK = 0x80000000; /* most significant w-r bits */\n this.LOWER_MASK = 0x7fffffff; /* least significant r bits */\n\n this.mt = new Array(this.N); /* the array for the state vector */\n this.mti = this.N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n if (Array.isArray(seed)) {\n if (seed.length > 0) this.initByArray(seed, seed.length);\n } else {\n if (seed === undefined) {\n this.initSeed(new Date().getTime());\n } else {\n this.initSeed(seed);\n }\n }\n }\n\n /* initializes mt[N] with a seed */\n /* origin name init_genrand */\n initSeed(seed: number): void {\n this.mt[0] = seed >>> 0;\n for (this.mti = 1; this.mti < this.N; this.mti++) {\n const s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n this.mt[this.mti] =\n ((((s & 0xffff0000) >>> 16) * 1812433253) << 16) +\n (s & 0x0000ffff) * 1812433253 +\n this.mti;\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n this.mt[this.mti] >>>= 0;\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n initByArray(initKey: number[], keyLength: number): void {\n this.initSeed(19650218);\n let i = 1;\n let j = 0;\n let k = this.N > keyLength ? this.N : keyLength;\n for (; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1664525) << 16) +\n (s & 0x0000ffff) * 1664525)) +\n initKey[j] +\n j; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n j++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n if (j >= keyLength) j = 0;\n }\n for (k = this.N - 1; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) +\n (s & 0x0000ffff) * 1566083941)) -\n i; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n }\n\n this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n /* origin name genrand_int32 */\n randomInt32(): number {\n let y;\n const mag01 = [0x0, this.MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (this.mti >= this.N) {\n /* generate N words at one time */\n let kk;\n\n if (this.mti === this.N + 1)\n /* if init_seed() has not been called, */\n this.initSeed(5489); /* a default initial seed is used */\n\n for (kk = 0; kk < this.N - this.M; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n for (; kk < this.N - 1; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] =\n this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n y =\n (this.mt[this.N - 1] & this.UPPER_MASK) |\n (this.mt[0] & this.LOWER_MASK);\n this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n this.mti = 0;\n }\n\n y = this.mt[this.mti++];\n\n /* Tempering */\n y ^= y >>> 11;\n y ^= (y << 7) & 0x9d2c5680;\n y ^= (y << 15) & 0xefc60000;\n y ^= y >>> 18;\n\n return y >>> 0;\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n /* origin name genrand_int31 */\n randomInt31(): number {\n return this.randomInt32() >>> 1;\n }\n\n /* generates a random number on [0,1]-real-interval */\n /* origin name genrand_real1 */\n randomReal1(): number {\n return this.randomInt32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n /* origin name genrand_real2 */\n randomReal2(): number {\n return this.randomInt32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n /* origin name genrand_real3 */\n randomReal3(): number {\n return (this.randomInt32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n /* origin name genrand_res53 */\n randomRes53(): number {\n const a = this.randomInt32() >>> 5;\n const b = this.randomInt32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n }\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n","import { MersenneTwister } from './mersenneTwister';\n\nconst replacePlaceholders = (mersenne: MersenneTwister) => (\n placeholder: string\n): string => {\n const random = Math.floor(mersenne.randomReal2() * 16);\n\n const value = placeholder === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n};\n\n/**\n * Generate a uuid.\n *\n * @private\n * @since 3.5.0\n * @returns {string} Returns the generated uuid.\n * @example\n * ```javascript\n * generateUUID()\n * // => 49e71c40-9b21-4371-9699-2def33f62e66\n *\n * generateUUID()\n * // => da94f128-4247-48e3-bc73-d0cae46b5093\n * ```\n */\nexport function generateUUID(): string {\n const mersenne = new MersenneTwister();\n const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\n return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders(mersenne));\n}\n","/**\n * Boolean matching.\n *\n * @since 4.7.0\n * @category Boolean\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * bool(true, true)\n * // => true\n *\n * bool(true, false)\n * // => false\n * ```\n */\nexport function bool(data: boolean, expected: boolean): boolean {\n return (\n data === expected\n );\n}\n","export type DateType = Date | string;\n\nexport const convertDate = (date: DateType): number=>{\n if(date instanceof Date){\n return date.getTime();\n }\n\n return Date.parse(date);\n}","import {DateType, convertDate} from './convertDate';\n\n/**\n * Exact date matching.\n *\n * @since 4.8.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * dateEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateEquals('December 15, 2000 03:24:00', 'December 10, 2001 03:24:00')\n * // => false\n * ```\n */\nexport function dateEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData === convertedExpectation\n );\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than `expected value`.\n * @example\n * ```javascript\n * dateGreaterThan('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateGreaterThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData > convertedExpectation;\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching at or after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than or equals `expected value`.\n * @example\n * ```javascript\n * dateGreaterThanEquals('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:25:00')\n * // => false\n * ```\n */\nexport function dateGreaterThanEquals(\n data: DateType,\n expected: DateType\n): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData >= convertedExpectation;\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is before than `expected value`.\n * @example\n * ```javascript\n * dateLessThan('December 15, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateLessThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData < convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching at or before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal or before than `expected value`.\n * @example\n * ```javascript\n * dateLessThanEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateLessThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThanEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData <= convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Negated date matching.\n *\n * @since 4.9.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * dateNotEquals('December 15, 1994 03:24:00', 'December 16, 1995 03:24:00')\n * // => true\n *\n * dateNotEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateNotEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData !== convertedExpectation\n );\n}\n","/**\n * Exact numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * numericEquals(5, 5)\n * // => true\n *\n * numericEquals(2, 4)\n * // => false\n * ```\n */\nexport function numericEquals(data: number, expected: number): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Numeric greater than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than `expected value`.\n * @example\n * ```javascript\n * numericGreaterThan(6, 5)\n * // => true\n *\n * numericGreaterThan(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThan(data: number, expected: number): boolean {\n return (\n data > expected\n );\n}\n","/**\n * Numeric greater than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than or equals `expected value`.\n * @example\n * ```javascript\n * numericGreaterThanEquals(5, 5)\n * // => true\n *\n * numericGreaterThanEquals(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThanEquals(data: number, expected: number): boolean {\n return (\n data >= expected\n );\n}\n","/**\n * Numeric less than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than `expected value`.\n * @example\n * ```javascript\n * numericLessThan(5, 6)\n * // => true\n *\n * numericLessThan(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThan(data: number, expected: number): boolean {\n return (\n data < expected\n );\n}\n","/**\n * Numeric less than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than or equals `expected value`.\n * @example\n * ```javascript\n * numericLessThanEquals(5, 5)\n * // => true\n *\n * numericLessThanEquals(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThanEquals(data: number, expected: number): boolean {\n return (\n data <= expected\n );\n}\n","/**\n * Negated numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * numericNotEquals(2, 4)\n * // => true\n *\n * numericNotEquals(5, 5)\n * // => false\n * ```\n */\nexport function numericNotEquals(data: number, expected: number): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Exact string matching, case sensitive.\n *\n * @since 4.3.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEquals('hi', 'hi')\n * // => true\n *\n * stringEquals('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEquals(data: string, expected: string): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Exact string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEqualsIgnoreCase('hi', 'Hi')\n * // => true\n *\n * stringEqualsIgnoreCase('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() === expected.toLowerCase()\n );\n}\n","import {Matcher} from '../../Matcher';\n\n/**\n * Case-sensitive matching. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.5.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value`.\n * @example\n * ```javascript\n * stringLike('newHouse', 'new*')\n * // => true\n *\n * stringLike('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLike(data: string, expected: string): boolean {\n return (\n new Matcher(data).match(expected)\n );\n}\n","import {stringLike} from './stringLike';\n\n/**\n * Case-sensitive matching if exist. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.12.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value` or if it does not exist.\n * @example\n * ```javascript\n * stringLikeIfExists(undefined, 'new*')\n * // => true\n *\n * stringLikeIfExists('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLikeIfExists(data: string | undefined, expected: string): boolean {\n return data?(\n stringLike(data,expected)\n ):true;\n}\n","/**\n * Negated string matching.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEquals('hi', 'no')\n * // => true\n * \n * stringNotEquals('hi', 'hi')\n * // => false\n * ```\n */\nexport function stringNotEquals(data: string, expected: string): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Negated string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEqualsIgnoreCase('hi', 'no')\n * // => true\n * \n * stringNotEqualsIgnoreCase('hi', 'Hi')\n * // => false\n * ```\n */\nexport function stringNotEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() !== expected.toLowerCase()\n );\n}\n","import { bool } from './boolean/bool';\nimport { dateEquals } from './date/dateEquals';\nimport { dateGreaterThan } from './date/dateGreaterThan';\nimport { dateGreaterThanEquals } from './date/dateGreaterThanEquals';\nimport { dateLessThan } from './date/dateLessThan';\nimport { dateLessThanEquals } from './date/dateLessThanEquals';\nimport { dateNotEquals } from './date/dateNotEquals';\nimport { numericEquals } from './numeric/numericEquals';\nimport { numericGreaterThan } from './numeric/numericGreaterThan';\nimport { numericGreaterThanEquals } from './numeric/numericGreaterThanEquals';\nimport { numericLessThan } from './numeric/numericLessThan';\nimport { numericLessThanEquals } from './numeric/numericLessThanEquals';\nimport { numericNotEquals } from './numeric/numericNotEquals';\nimport { stringEquals } from './string/stringEquals';\nimport { stringEqualsIgnoreCase } from './string/stringEqualsIgnoreCase';\nimport { stringLike } from './string/stringLike';\nimport { stringLikeIfExists } from './string/stringLikeIfExists';\nimport { stringNotEquals } from './string/stringNotEquals';\nimport { stringNotEqualsIgnoreCase } from './string/stringNotEqualsIgnoreCase';\n\nexport const operators: Record = {\n bool,\n dateEquals,\n dateGreaterThan,\n dateGreaterThanEquals,\n dateLessThan,\n dateLessThanEquals,\n dateNotEquals,\n numericEquals,\n numericGreaterThan,\n numericGreaterThanEquals,\n numericLessThan,\n numericLessThanEquals,\n numericNotEquals,\n stringEquals,\n stringEqualsIgnoreCase,\n stringLike,\n stringLikeIfExists,\n stringNotEquals,\n stringNotEqualsIgnoreCase\n};\n","import {\n EffectBlock,\n ConditionBlock,\n StatementInterface,\n MatchConditionInterface,\n MatchConditionResolverInterface\n} from './types';\nimport { getValueFromPath } from './utils/getValueFromPath';\nimport { generateUUID } from './utils/generateUUID';\nimport {operators} from './conditionOperators';\n\nabstract class Statement {\n protected sid: string;\n protected readonly condition?: ConditionBlock;\n effect: EffectBlock;\n\n constructor({ sid, effect = 'allow', condition }: StatementInterface) {\n if (!sid) {\n this.sid = generateUUID();\n } else {\n this.sid = sid;\n }\n this.effect = effect;\n this.condition = condition;\n }\n\n matchConditions(\n this: Statement,\n { context, conditionResolver }: MatchConditionInterface\n ): boolean {\n const { condition: conditions } = this;\n\n if(conditions && context){\n return Object.keys(conditions).every((condition) =>\n Object.keys(conditions[condition]).every((path) => {\n const conditionValues = conditions[condition][path];\n if (conditionValues instanceof Array) {\n return conditionValues.some((value) =>\n this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value\n })\n );\n }\n\n return this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value: conditionValues\n });\n })\n )\n }\n\n return true;\n }\n\n private evaluateCondition(\n this: Statement,\n { context, conditionResolver={}, path, value, condition }: MatchConditionResolverInterface\n ): boolean {\n\n const currentResolver= conditionResolver[condition] || operators[condition]\n\n if(currentResolver){\n return currentResolver(\n getValueFromPath(context, path),\n value\n )\n }\n return false;\n }\n}\n\nexport { Statement };\n","import { ActionBasedType, MatchActionBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ActionBased extends Statement {\n private action?: string[];\n private notAction?: string[];\n private statement: ActionBasedType;\n\n constructor(action: ActionBasedType) {\n super(action);\n this.checkAndAssignActions(action);\n this.statement = { ...action, sid: this.sid };\n }\n\n getStatement(this: ActionBased): ActionBasedType {\n return this.statement;\n }\n\n matches(\n this: ActionBased,\n { action, context, conditionResolver }: MatchActionBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(action: ActionBasedType): void {\n const hasAction = 'action' in action;\n const hasNotAction = 'notAction' in action;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ActionBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in action) {\n this.action =\n typeof action.action === 'string' ? [action.action] : action.action;\n } else {\n this.notAction =\n typeof action.notAction === 'string'\n ? [action.notAction]\n : action.notAction;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n}\n\nexport { ActionBased };\n","import { IdentityBasedType, MatchIdentityBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass IdentityBased extends Statement {\n private resource?: string[];\n private action?: string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: IdentityBasedType;\n\n constructor(identity: IdentityBasedType) {\n super(identity);\n this.checkAndAssignActions(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: IdentityBased): IdentityBasedType {\n return this.statement;\n }\n\n matches(\n this: IdentityBased,\n {\n action,\n resource,\n context,\n conditionResolver\n }: MatchIdentityBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(identity: IdentityBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'IdentityBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignResources(identity: IdentityBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'IdentityBased statement should have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n } else {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { IdentityBased };\n","import {\n PrincipalMap,\n MatchResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ResourceBased extends Statement {\n private principal?: PrincipalMap | string[];\n private resource?: string[];\n private action?: string[];\n private notPrincipal?: PrincipalMap | string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: ResourceBasedType;\n private hasPrincipals: boolean;\n private hasResources: boolean;\n\n constructor(identity: ResourceBasedType) {\n super(identity);\n this.hasPrincipals = false;\n this.hasResources = false;\n this.checkAndAssignActions(identity);\n this.checkAndAssignPrincipals(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: ResourceBased): ResourceBasedType {\n return this.statement;\n }\n\n matches(\n this: ResourceBased,\n {\n principal,\n action,\n resource,\n principalType,\n context,\n conditionResolver\n }: MatchResourceBasedInterface\n ): boolean {\n return (\n this.matchPrincipalAndNotPrincipal(principal, principalType, context) &&\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResourceAndNotResource(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n /*valueComing principal noPrincipal\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchPrincipalAndNotPrincipal(\n principal?: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (principal) {\n if (this.hasPrincipals)\n return (\n this.matchPrincipals(principal, principalType, context) &&\n this.matchNotPrincipals(principal, principalType, context)\n );\n return false;\n }\n if (this.hasPrincipals) return false;\n return true;\n }\n\n /*valueComing resource noResource\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchResourceAndNotResource(resource?: string, context?: T): boolean {\n if (resource) {\n if (this.hasResources)\n return (\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context)\n );\n return false;\n }\n if (this.hasResources) return false;\n return true;\n }\n\n private checkAndAssignActions(identity: ResourceBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ResourceBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignPrincipals(identity: ResourceBasedType): void {\n const hasPrincipal = 'principal' in identity;\n const hasNotPrincipal = 'notPrincipal' in identity;\n if (hasPrincipal && hasNotPrincipal) {\n throw new TypeError(\n 'ResourceBased statement could have a principal or a notPrincipal attribute, no both'\n );\n }\n if ('principal' in identity) {\n this.principal =\n typeof identity.principal === 'string'\n ? [identity.principal]\n : identity.principal;\n this.hasPrincipals = true;\n } else if ('notPrincipal' in identity) {\n this.notPrincipal =\n typeof identity.notPrincipal === 'string'\n ? [identity.notPrincipal]\n : identity.notPrincipal;\n this.hasPrincipals = true;\n }\n }\n\n private checkAndAssignResources(identity: ResourceBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'ResourceBased statement could have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n this.hasResources = true;\n } else if ('notResource' in identity) {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n this.hasResources = true;\n }\n }\n\n private matchPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.principal) {\n if (this.principal instanceof Array) {\n return principalType\n ? false\n : this.principal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.principal[principalType];\n if (principalValues instanceof Array) {\n return principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return false;\n }\n return false;\n }\n }\n return true;\n }\n\n private matchNotPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.notPrincipal) {\n if (this.notPrincipal instanceof Array) {\n return principalType\n ? true\n : !this.notPrincipal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.notPrincipal[principalType];\n if (principalValues instanceof Array) {\n return !principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return !new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return true;\n }\n return true;\n }\n }\n return true;\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { ResourceBased };\n","import { MatchConditionInterface, ConditionResolver } from './types';\n\nabstract class Policy {\n protected context?: T;\n protected conditionResolver?: ConditionResolver;\n\n constructor({ context, conditionResolver }: MatchConditionInterface) {\n this.context = context;\n this.conditionResolver = conditionResolver;\n }\n\n setContext(this: Policy, context: T): void {\n this.context = context;\n }\n\n getContext(this: Policy): T | undefined {\n return this.context;\n }\n\n setConditionResolver(\n this: Policy,\n conditionResolver: ConditionResolver\n ): void {\n this.conditionResolver = conditionResolver;\n }\n\n getConditionResolver(this: Policy): ConditionResolver | undefined {\n return this.conditionResolver;\n }\n\n abstract getStatements(this: Policy): U[];\n}\n\nexport { Policy };\n","import {\n ActionBasedType,\n ConditionResolver,\n EvaluateActionBasedInterface,\n ProxyOptions\n} from './types';\nimport { ActionBased } from './ActionBasedStatement';\nimport { Policy } from './Policy';\n\nexport interface ActionBasedPolicyInterface {\n statements: ActionBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ActionBasedPolicy extends Policy<\n T,\n ActionBasedType\n> {\n private denyStatements: ActionBased[];\n private allowStatements: ActionBased[];\n private statements: ActionBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ActionBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ActionBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(this: ActionBasedPolicy, statement: ActionBasedType): void {\n const statementInstance = new ActionBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ActionBasedPolicy): ActionBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n const args = { action, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n cannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n generateProxy(\n this: ActionBasedPolicy,\n obj: U,\n options: ProxyOptions = {}\n ): U {\n const { get = {}, set = {} } = options;\n const { allow: allowGet = true, propertyMap: propertyMapGet = {} } = get;\n const { allow: allowSet = true, propertyMap: propertyMapSet = {} } = set;\n const handler = {\n ...(allowGet\n ? {\n get: (target: U, prop: string | symbol): any => {\n const property = Reflect.has(propertyMapGet, prop)\n ? Reflect.get(propertyMapGet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.get(target, prop);\n } else {\n throw new Error(`Unauthorize to get ${prop} property`);\n }\n } else {\n return Reflect.get(target, prop);\n }\n }\n }\n : {}),\n ...(allowSet\n ? {\n set: (target: U, prop: string | symbol, value: any): boolean => {\n const property = Reflect.has(propertyMapSet, prop)\n ? Reflect.get(propertyMapSet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.set(target, prop, value);\n } else {\n throw new Error(`Unauthorize to set ${prop} property`);\n }\n } else {\n return false;\n }\n }\n }\n : {})\n };\n\n return new Proxy(obj, handler);\n }\n}\n","import {\n ConditionResolver,\n EvaluateIdentityBasedInterface,\n IdentityBasedType\n} from './types';\nimport { IdentityBased } from './IdentityBasedStatement';\nimport { Policy } from './Policy';\n\ninterface IdentityBasedPolicyInterface {\n statements: IdentityBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class IdentityBasedPolicy extends Policy<\n T,\n IdentityBasedType\n> {\n private denyStatements: IdentityBased[];\n private allowStatements: IdentityBased[];\n private statements: IdentityBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: IdentityBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new IdentityBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: IdentityBasedPolicy,\n statement: IdentityBasedType\n ): void {\n const statementInstance = new IdentityBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: IdentityBasedPolicy): IdentityBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n const args = { action, resource, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n\n cannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n","import {\n ConditionResolver,\n EvaluateResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { ResourceBased } from './ResourceBasedStatement';\nimport { Policy } from './Policy';\n\ninterface ResourceBasedPolicyInterface {\n statements: ResourceBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ResourceBasedPolicy extends Policy<\n T,\n ResourceBasedType\n> {\n private denyStatements: ResourceBased[];\n private allowStatements: ResourceBased[];\n private statements: ResourceBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ResourceBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ResourceBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: ResourceBasedPolicy,\n statement: ResourceBasedType\n ): void {\n const statementInstance = new ResourceBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ResourceBasedPolicy): ResourceBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n const args = { principal, action, resource, principalType, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n cannot(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;SAgBgB,MAAM,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C;;AChBA;;;;;;;;;;;;;;;;SAgBgB,QAAQ,CAAC,KAAe;IACtC,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,QACE,IAAI,KAAK,QAAQ;SAChB,IAAI,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC,EAC5E;AACJ;;ACtBA;AACA,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;;;;;;;SAegB,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;AACpE;;ACxBA;AACA,MAAM,YAAY,GAAG,kDAAkD,CAAC;AACxE,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA+BgB,KAAK,CAAmB,KAAc,EAAE,MAAU;IAChE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,IACE,IAAI,KAAK,QAAQ;QACjB,IAAI,KAAK,SAAS;QAClB,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS;QACnB,QAAQ,CAAC,KAAK,CAAC,EACf;QACA,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,KAAK,KAA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I,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"main.js","sources":["../src/utils/getTag.ts","../src/utils/isSymbol.ts","../src/utils/toKey.ts","../src/utils/isKey.ts","../src/utils/memoize.ts","../src/utils/memoizeCapped.ts","../src/utils/stringToPath.ts","../src/utils/getValueFromPath.ts","../src/utils/applyContext.ts","../src/utils/decomposeString.ts","../src/utils/braceExpand.ts","../src/Matcher.ts","../src/utils/mersenneTwister.ts","../src/utils/generateUUID.ts","../src/conditionOperators/boolean/bool.ts","../src/conditionOperators/date/convertDate.ts","../src/conditionOperators/date/dateEquals.ts","../src/conditionOperators/date/dateGreaterThan.ts","../src/conditionOperators/date/dateGreaterThanEquals.ts","../src/conditionOperators/date/dateLessThan.ts","../src/conditionOperators/date/dateLessThanEquals.ts","../src/conditionOperators/date/dateNotEquals.ts","../src/conditionOperators/numeric/numericEquals.ts","../src/conditionOperators/numeric/numericGreaterThan.ts","../src/conditionOperators/numeric/numericGreaterThanEquals.ts","../src/conditionOperators/numeric/numericLessThan.ts","../src/conditionOperators/numeric/numericLessThanEquals.ts","../src/conditionOperators/numeric/numericNotEquals.ts","../src/conditionOperators/string/stringEquals.ts","../src/conditionOperators/string/stringEqualsIgnoreCase.ts","../src/conditionOperators/string/stringLike.ts","../src/conditionOperators/string/stringLikeIfExists.ts","../src/conditionOperators/string/stringNotEquals.ts","../src/conditionOperators/string/stringNotEqualsIgnoreCase.ts","../src/conditionOperators/index.ts","../src/Statement.ts","../src/ActionBasedStatement.ts","../src/IdentityBasedStatement.ts","../src/ResourceBasedStatement.ts","../src/Policy.ts","../src/ActionBasedPolicy.ts","../src/IdentityBasedPolicy.ts","../src/ResourceBasedPolicy.ts"],"sourcesContent":["/**\n * Gets the `toStringTag` of `value`.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n * @example\n * ```javascript\n * getTag(1)\n * // => '[object Number]'\n *\n * getTag(null)\n * // => '[object Null]'\n * ```\n */\nexport function getTag(value: unknown): string {\n return Object.prototype.toString.call(value);\n}\n","import { getTag } from './getTag';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @since 3.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n * ```javascript\n * isSymbol(Symbol())\n * // => true\n *\n * isSymbol('abc')\n * // => false\n * ```\n */\nexport function isSymbol(value?: unknown): value is symbol {\n const type = typeof value;\n return (\n type === 'symbol' ||\n (type === 'object' && value !== null && getTag(value) === '[object Symbol]')\n );\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used as references for various `Number` constants. */\nconst INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n * @example\n *\n * toKey(Symbol.iterator)\n * // => true\n *\n * toKey('abc')\n * // => false\n */\nexport function toKey(value: unknown): string | symbol {\n if (typeof value === 'string' || isSymbol(value)) {\n return value;\n }\n\n return value === 0 && 1 / value === -INFINITY ? '-0' : `${value}`;\n}\n","import { isSymbol } from './isSymbol';\n\n/** Used to match property names within property paths. */\nconst reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\nconst reIsPlainProp = /^\\w*$/; //matches any word character (alphanumeric and underscore)\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @since 3.1.0\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n * @example\n * ```javascript\n * isKey(1)\n * // => true\n *\n * isKey('example[test]')\n * // => false\n *\n * isKey('a.b')\n * // => false\n *\n * const obj = {\n * '[a]': 5,\n * 'b.c': true\n * };\n *\n * isKey('[a]', obj)\n * // => true\n *\n * isKey('b.c', obj)\n * // => true\n * ```\n */\nexport function isKey(value: unknown, object?: T): boolean {\n const type = typeof value;\n if (\n type === 'number' ||\n type === 'boolean' ||\n value === null ||\n value === undefined ||\n isSymbol(value)\n ) {\n return true;\n }\n if (typeof value === 'string') {\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object !== null && value in Object(object))\n );\n }\n return false;\n}\n","import { MemoizeInterface } from '../types';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * @since 3.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n * ```javascript\n * const object = { 'a': 1, 'b': 2 }\n * const other = { 'c': 3, 'd': 4 }\n *\n * const values = memoize(values)\n * values(object)\n * // => [1, 2]\n *\n * values(other)\n * // => [3, 4]\n *\n * object.a = 2\n * values(object)\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b'])\n * values(object)\n * // => ['a', 'b']\n * ```\n */\nexport function memoize(\n func: (...args: unknown[]) => any,\n resolver?: (...args: unknown[]) => any\n): MemoizeInterface {\n const memoized = function (\n this: (...args: unknown[]) => any,\n ...args: unknown[]\n ): MemoizeInterface {\n const key = resolver ? resolver.apply(this, args) : args[0];\n const cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = func.apply(this, args);\n cache.set(key, result);\n return result;\n };\n memoized.cache = new Map();\n return memoized;\n}\n\n/*const memoize = (fn: Function): Function => {\n const cache = {};\n return (...args): any => {\n const stringifiedArgs = JSON.stringify(args);\n const result = (cache[stringifiedArgs] =\n typeof cache[stringifiedArgs] === 'undefined'\n ? fn(...args)\n : cache[stringifiedArgs]);\n return result;\n };\n};*/\n","import { memoize } from './memoize';\nimport { MemoizeInterface } from '../types';\n\n/** Used as the maximum memoize cache size. */\nexport const MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @since 3.1.0\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nexport function memoizeCapped(\n func: (...args: any) => unknown\n): MemoizeInterface {\n const result = memoize(func, (key: unknown) => {\n const { cache } = result;\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n return result;\n}\n","import { memoizeCapped } from './memoizeCapped';\n\nconst charCodeOfDot = '.'.charCodeAt(0);\nconst reEscapeChar = /\\\\(\\\\)?/g;\nconst rePropName = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\x02)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\x02' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n);\n\n/**\n * Converts `string` to a property path array.\n *\n * @since 3.1.0\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nexport const stringToPath = memoizeCapped((string: string) => {\n const result = [];\n if (string.charCodeAt(0) === charCodeOfDot) {\n result.push('');\n }\n string.replace(\n rePropName,\n (\n match: string,\n expression: string,\n quote: string,\n subString: string\n ): string => {\n let key = match;\n if (quote) {\n key = subString.replace(reEscapeChar, '$1');\n } else if (expression) {\n key = expression.trim();\n }\n result.push(key);\n return '';\n }\n );\n return result;\n});\n","import { toKey } from './toKey';\nimport { isKey } from './isKey';\nimport { stringToPath } from './stringToPath';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nexport function castPath(\n value: unknown,\n object: U\n): Array {\n if (Array.isArray(value)) {\n return value;\n }\n\n return isKey(value, object) ? [value] : stringToPath(value);\n}\n\n/**\n * The base implementation of `get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nexport function baseGet(\n object: U,\n path: Array | string\n): any {\n const newPath = castPath(path, object);\n\n let index = 0;\n const length = newPath.length;\n\n let value: any = object;\n while (value instanceof Object && index < length) {\n value = value[toKey(newPath[index++])];\n }\n\n return index && index === length ? value : undefined;\n}\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @since 3.1.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * const object = { 'a': [{ 'b': { 'c': 3 } }] }\n *\n * getValueFromPath(object, 'a[0].b.c')\n * // => 3\n *\n * getValueFromPath(object, ['a', '0', 'b', 'c'])\n * // => 3\n *\n * getValueFromPath(object, 'a.b.c', 'default')\n * // => 'default'\n */\nexport function getValueFromPath(\n object: U,\n path: Array | string,\n defaultValue?: unknown\n): any {\n const result = object === null ? undefined : baseGet(object, path);\n\n return result === undefined ? defaultValue : result;\n}\n","import { getValueFromPath } from './getValueFromPath';\n\nconst reDelimiters = /\\${([^}]*)}/g;\nconst trim = / +(?= )|^\\s+|\\s+$/g;\n\nconst specialTrim = (str: string): string => str.replace(trim, '');\n\n/**\n * Apply the context value in a string.\n *\n * @param {string} str Pattern string, containing context path.\n * @param {object} context Object to get values from path.\n * @returns {string} Returns a string with embedded context values.\n * @example\n * ```javascript\n * const context = {\n * user: { id: 456, bestFriends: [123, 532, 987] }\n * };\n * applyContext('secrets:${user.id}:*', context)\n * // => 'secrets:456:*'\n *\n * applyContext('secrets:${user.bestFriends}:*', context)\n * // => 'secrets:{123,532,987}:*'\n *\n * applyContext('secrets:${company.address}:account', context)\n * // => 'secrets:undefined:account'\n * ```\n */\nexport function applyContext(\n str: string,\n context?: T\n): string {\n if (!context) return str;\n\n return specialTrim(\n str.replace(reDelimiters, (_, path: string) => {\n const value = getValueFromPath(context, path);\n if (Array.isArray(value)) return `{${value}}`;\n if (value instanceof Object) return 'undefined';\n\n return String(value);\n })\n );\n}\n","import { DecomposeString } from '../types';\n\n/**\n * Get index range where separators are found.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {number[]} Returns the beginning and final index for those matches.\n * @example\n * ```javascript\n * getIndexRange('first', 'Second', 'firstAndSecond')\n * // => [0, 8]\n *\n * getIndexRange('First', 'Second', '++FirstAndSecond**')\n * // => [2, 10]\n * ```\n */\nfunction getIndexRange(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): number[] {\n const beginningIndex = str.indexOf(initialSeparator);\n const finalIndex = str.indexOf(finalSeparator, beginningIndex + 1);\n\n if (beginningIndex >= 0 && finalIndex > 0) {\n return [beginningIndex, finalIndex];\n }\n\n return [-1, -1];\n}\n\n/**\n * Object returned by decomposeString function\n *\n * @typedef {Object} DecomposedString\n * @property {number} start Beginning index for first separator match\n * @property {number} end Final index for second separator match\n * @property {string} pre Substring before first separator\n * @property {string} body Substring between separators\n * @property {string} post Substring after second separator\n */\n\n/**\n * Decompose string in pre, body and post strings by using separators.\n *\n * @private\n * @since 3.1.1\n * @param {string} initialSeparator First string to be found.\n * @param {string} finalSeparator Second string to be found.\n * @param {string} str String to be decomposed.\n * @returns {DecomposedString} Returns a decompose string.\n * @example\n * ```javascript\n * decomposeString('first', 'Second', 'firstAndSecond')\n * // => { start: 0, end: 8, pre: '', body: 'And', post: '' }\n *\n * decomposeString('First', 'Second', '++FirstAndSecond**')\n * // => { start: 2, end: 10, pre: '++', body: 'And', post: '**' }\n * ```\n */\nexport function decomposeString(\n initialSeparator: string,\n finalSeparator: string,\n str: string\n): DecomposeString {\n const [beginningIndex, finalIndex] = getIndexRange(\n initialSeparator,\n finalSeparator,\n str\n );\n\n return {\n start: beginningIndex,\n end: finalIndex,\n pre: beginningIndex >= 0 ? str.slice(0, beginningIndex) : '',\n body:\n beginningIndex >= 0\n ? str.slice(beginningIndex + initialSeparator.length, finalIndex)\n : '',\n post:\n beginningIndex >= 0 ? str.slice(finalIndex + finalSeparator.length) : ''\n };\n}\n","import { decomposeString } from './decomposeString';\n\n/**\n * Generate an array of string depending on {} blocks.\n *\n * @param {string} pattern Pattern string that can contains {} blocks.\n * @returns {string[]} Returns an array of string with all the combinations.\n * @example\n * ```javascript\n * braceExpand('${13}')\n * // => ['{13}']\n *\n * braceExpand('a{b,f,m}p')\n * // => ['abp','afp','amp']\n *\n * braceExpand('-v{,,}')\n * // => ['-v','-v','-v']\n * ```\n */\nconst braceExpand = (pattern: string): string[] => {\n if (!pattern.match(/{.*}/)) {\n return [pattern];\n }\n\n return expand(pattern, true);\n};\n\nconst expand = (str: string, isTop?: boolean): string[] => {\n const expansions = [] as string[];\n const balance = decomposeString('{', '}', str);\n if (balance.start < 0) return [str];\n\n const parts = balance.body.split(',');\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = balance.pre;\n const postParts = balance.post.length ? expand(balance.post, false) : [''];\n\n if (/\\$$/.test(balance.pre)) {\n postParts.forEach((postPart) => {\n const expansion = `${balance.pre.slice(0, -1)}{${\n balance.body\n }}${postPart}`;\n expansions.push(expansion);\n });\n } else {\n parts.forEach((part: string) => {\n postParts.forEach((postPart) => {\n const expansion = pre + part + postPart;\n if (!isTop || expansion) expansions.push(expansion);\n });\n });\n }\n\n return expansions;\n};\n\nexport { braceExpand };\n","import { braceExpand } from './utils/braceExpand';\n\nexport class Matcher {\n private readonly pattern: string;\n private readonly maxLength: number;\n private readonly set: (string | RegExp)[];\n private readonly empty: boolean;\n\n constructor(pattern: string, maxLength = 1024 * 64) {\n this.set = [];\n this.pattern = pattern.trim();\n this.maxLength = maxLength;\n this.empty = !this.pattern ? true : false;\n\n const set = braceExpand(pattern);\n this.set = set.map((val) => this.parse(val));\n this.set = this.set.filter((s) => {\n return Boolean(s);\n });\n }\n\n match(this: Matcher, str: string): boolean {\n if (this.empty) return str === '';\n\n return this.set.some((pattern) => this.matchOne(str, pattern));\n }\n\n private parse(pattern: string): string | RegExp {\n if (pattern.length > this.maxLength) {\n throw new TypeError('Pattern is too long');\n }\n let regExp;\n let hasSpecialCharacter = false;\n if (pattern === '') return '';\n\n const re = pattern.replace(/\\*/g, () => {\n hasSpecialCharacter = true;\n return '.+?';\n });\n\n // skip the regexp for non-* patterns\n // unescape anything in it, though, so that it'll be\n // an exact match.\n if (!hasSpecialCharacter) {\n return pattern.replace(/\\\\(.)/g, '$1');\n }\n\n try {\n regExp = new RegExp('^' + re + '$');\n } catch (error) {\n // If it was an invalid regular expression, then it can't match\n // anything.\n return new RegExp('$.');\n }\n\n return regExp;\n }\n\n private matchOne(str: string, pattern: string | RegExp): boolean {\n if (typeof pattern === 'string') {\n return str === pattern;\n }\n\n return Boolean(str.match(pattern));\n }\n}\n","/*\n https://github.com/banksean wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over each other's state.\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n var m = new MersenneTwister();\n var randomNumber = m.random();\n You can also call the other genrand_{foo}() methods on the instance.\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n var m = new MersenneTwister(123);\n and that will always produce the same random sequence.\n Sean McCullough (banksean@gmail.com)\n*/\n\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n Before using, initialize the state by using init_seed(seed)\n or init_by_array(init_key, key_length).\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nexport class MersenneTwister {\n private readonly N: number;\n private readonly M: number;\n private readonly MATRIX_A: number;\n private readonly UPPER_MASK: number;\n private readonly LOWER_MASK: number;\n private readonly mt: number[];\n private mti: number;\n\n constructor(seed?: number | number[]) {\n /* Period parameters */\n this.N = 624;\n this.M = 397;\n this.MATRIX_A = 0x9908b0df; /* constant vector a */\n this.UPPER_MASK = 0x80000000; /* most significant w-r bits */\n this.LOWER_MASK = 0x7fffffff; /* least significant r bits */\n\n this.mt = new Array(this.N); /* the array for the state vector */\n this.mti = this.N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n if (Array.isArray(seed)) {\n if (seed.length > 0) this.initByArray(seed, seed.length);\n } else {\n if (seed === undefined) {\n this.initSeed(new Date().getTime());\n } else {\n this.initSeed(seed);\n }\n }\n }\n\n /* initializes mt[N] with a seed */\n /* origin name init_genrand */\n initSeed(seed: number): void {\n this.mt[0] = seed >>> 0;\n for (this.mti = 1; this.mti < this.N; this.mti++) {\n const s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n this.mt[this.mti] =\n ((((s & 0xffff0000) >>> 16) * 1812433253) << 16) +\n (s & 0x0000ffff) * 1812433253 +\n this.mti;\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n this.mt[this.mti] >>>= 0;\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n initByArray(initKey: number[], keyLength: number): void {\n this.initSeed(19650218);\n let i = 1;\n let j = 0;\n let k = this.N > keyLength ? this.N : keyLength;\n for (; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1664525) << 16) +\n (s & 0x0000ffff) * 1664525)) +\n initKey[j] +\n j; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n j++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n if (j >= keyLength) j = 0;\n }\n for (k = this.N - 1; k; k--) {\n const s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] =\n (this.mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) +\n (s & 0x0000ffff) * 1566083941)) -\n i; /* non linear */\n this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */\n i++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n }\n\n this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n /* origin name genrand_int32 */\n randomInt32(): number {\n let y;\n const mag01 = [0x0, this.MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (this.mti >= this.N) {\n /* generate N words at one time */\n let kk;\n\n if (this.mti === this.N + 1)\n /* if init_seed() has not been called, */\n this.initSeed(5489); /* a default initial seed is used */\n\n for (kk = 0; kk < this.N - this.M; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n for (; kk < this.N - 1; kk++) {\n y =\n (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] =\n this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n y =\n (this.mt[this.N - 1] & this.UPPER_MASK) |\n (this.mt[0] & this.LOWER_MASK);\n this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n this.mti = 0;\n }\n\n y = this.mt[this.mti++];\n\n /* Tempering */\n y ^= y >>> 11;\n y ^= (y << 7) & 0x9d2c5680;\n y ^= (y << 15) & 0xefc60000;\n y ^= y >>> 18;\n\n return y >>> 0;\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n /* origin name genrand_int31 */\n randomInt31(): number {\n return this.randomInt32() >>> 1;\n }\n\n /* generates a random number on [0,1]-real-interval */\n /* origin name genrand_real1 */\n randomReal1(): number {\n return this.randomInt32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n /* origin name genrand_real2 */\n randomReal2(): number {\n return this.randomInt32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n /* origin name genrand_real3 */\n randomReal3(): number {\n return (this.randomInt32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n /* origin name genrand_res53 */\n randomRes53(): number {\n const a = this.randomInt32() >>> 5;\n const b = this.randomInt32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n }\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n","import { MersenneTwister } from './mersenneTwister';\n\nconst replacePlaceholders = (mersenne: MersenneTwister) => (\n placeholder: string\n): string => {\n const random = Math.floor(mersenne.randomReal2() * 16);\n\n const value = placeholder === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n};\n\n/**\n * Generate a uuid.\n *\n * @private\n * @since 3.5.0\n * @returns {string} Returns the generated uuid.\n * @example\n * ```javascript\n * generateUUID()\n * // => 49e71c40-9b21-4371-9699-2def33f62e66\n *\n * generateUUID()\n * // => da94f128-4247-48e3-bc73-d0cae46b5093\n * ```\n */\nexport function generateUUID(): string {\n const mersenne = new MersenneTwister();\n const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\n return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders(mersenne));\n}\n","/**\n * Boolean matching.\n *\n * @since 4.7.0\n * @category Boolean\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * bool(true, true)\n * // => true\n *\n * bool(true, false)\n * // => false\n * ```\n */\nexport function bool(data: boolean, expected: boolean): boolean {\n return (\n data === expected\n );\n}\n","export type DateType = Date | string;\n\nexport const convertDate = (date: DateType): number=>{\n if(date instanceof Date){\n return date.getTime();\n }\n\n return Date.parse(date);\n}","import {DateType, convertDate} from './convertDate';\n\n/**\n * Exact date matching.\n *\n * @since 4.8.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * dateEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateEquals('December 15, 2000 03:24:00', 'December 10, 2001 03:24:00')\n * // => false\n * ```\n */\nexport function dateEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData === convertedExpectation\n );\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than `expected value`.\n * @example\n * ```javascript\n * dateGreaterThan('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateGreaterThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData > convertedExpectation;\n}\n","import { DateType, convertDate } from './convertDate';\n\n/**\n * Matching at or after a specific date and time\n *\n * @since 4.11.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is after than or equals `expected value`.\n * @example\n * ```javascript\n * dateGreaterThanEquals('December 17, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateGreaterThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:25:00')\n * // => false\n * ```\n */\nexport function dateGreaterThanEquals(\n data: DateType,\n expected: DateType\n): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return convertedData >= convertedExpectation;\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is before than `expected value`.\n * @example\n * ```javascript\n * dateLessThan('December 15, 1994 03:24:00', 'December 16, 1994 03:24:00')\n * // => true\n *\n * dateLessThan('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThan(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData < convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Matching at or before a specific date and time\n *\n * @since 4.10.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal or before than `expected value`.\n * @example\n * ```javascript\n * dateLessThanEquals('December 15, 1994 03:24:00', 'December 15, 1994 03:24:00')\n * // => true\n *\n * dateLessThanEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateLessThanEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData <= convertedExpectation\n );\n}\n","import {DateType, convertDate} from './convertDate';\n\n/**\n * Negated date matching.\n *\n * @since 4.9.0\n * @category Date\n * @param {Date} data The value to be compared.\n * @param {Date} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * dateNotEquals('December 15, 1994 03:24:00', 'December 16, 1995 03:24:00')\n * // => true\n *\n * dateNotEquals('December 15, 2000 03:24:00', 'December 15, 2000 03:24:00')\n * // => false\n * ```\n */\nexport function dateNotEquals(data: DateType, expected: DateType): boolean {\n const convertedData = convertDate(data);\n const convertedExpectation = convertDate(expected);\n return (\n convertedData !== convertedExpectation\n );\n}\n","/**\n * Exact numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * numericEquals(5, 5)\n * // => true\n *\n * numericEquals(2, 4)\n * // => false\n * ```\n */\nexport function numericEquals(data: number, expected: number): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Numeric greater than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than `expected value`.\n * @example\n * ```javascript\n * numericGreaterThan(6, 5)\n * // => true\n *\n * numericGreaterThan(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThan(data: number, expected: number): boolean {\n return (\n data > expected\n );\n}\n","/**\n * Numeric greater than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is greater than or equals `expected value`.\n * @example\n * ```javascript\n * numericGreaterThanEquals(5, 5)\n * // => true\n *\n * numericGreaterThanEquals(4, 8)\n * // => false\n * ```\n */\nexport function numericGreaterThanEquals(data: number, expected: number): boolean {\n return (\n data >= expected\n );\n}\n","/**\n * Numeric less than matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than `expected value`.\n * @example\n * ```javascript\n * numericLessThan(5, 6)\n * // => true\n *\n * numericLessThan(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThan(data: number, expected: number): boolean {\n return (\n data < expected\n );\n}\n","/**\n * Numeric less than or equals matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is less than or equals `expected value`.\n * @example\n * ```javascript\n * numericLessThanEquals(5, 5)\n * // => true\n *\n * numericLessThanEquals(8, 4)\n * // => false\n * ```\n */\nexport function numericLessThanEquals(data: number, expected: number): boolean {\n return (\n data <= expected\n );\n}\n","/**\n * Negated numeric matching.\n *\n * @since 4.6.0\n * @category Numeric\n * @param {number} data The value to be compared.\n * @param {number} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * numericNotEquals(2, 4)\n * // => true\n *\n * numericNotEquals(5, 5)\n * // => false\n * ```\n */\nexport function numericNotEquals(data: number, expected: number): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Exact string matching, case sensitive.\n *\n * @since 4.3.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEquals('hi', 'hi')\n * // => true\n *\n * stringEquals('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEquals(data: string, expected: string): boolean {\n return (\n data === expected\n );\n}\n","/**\n * Exact string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal to `expected value`.\n * @example\n * ```javascript\n * stringEqualsIgnoreCase('hi', 'Hi')\n * // => true\n *\n * stringEqualsIgnoreCase('hi', 'no')\n * // => false\n * ```\n */\nexport function stringEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() === expected.toLowerCase()\n );\n}\n","import {Matcher} from '../../Matcher';\n\n/**\n * Case-sensitive matching. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.5.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value`.\n * @example\n * ```javascript\n * stringLike('newHouse', 'new*')\n * // => true\n *\n * stringLike('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLike(data: string, expected: string): boolean {\n return (\n new Matcher(data).match(expected)\n );\n}\n","import {stringLike} from './stringLike';\n\n/**\n * Case-sensitive matching if exist. The values can include a multi-character match wildcard (*) anywhere in the string.\n *\n * @since 4.12.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is equal like `expected value` or if it does not exist.\n * @example\n * ```javascript\n * stringLikeIfExists(undefined, 'new*')\n * // => true\n *\n * stringLikeIfExists('House', 'new*')\n * // => false\n * ```\n */\nexport function stringLikeIfExists(data: string | undefined, expected: string): boolean {\n return data?(\n stringLike(data,expected)\n ):true;\n}\n","/**\n * Negated string matching.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEquals('hi', 'no')\n * // => true\n * \n * stringNotEquals('hi', 'hi')\n * // => false\n * ```\n */\nexport function stringNotEquals(data: string, expected: string): boolean {\n return (\n data !== expected\n );\n}\n","/**\n * Negated string matching, ignoring case.\n *\n * @since 4.4.0\n * @category String\n * @param {string} data The value to be compared.\n * @param {string} expected The expected value.\n * @returns {boolean} Returns `true` if `value` is not equal to `expected value`.\n * @example\n * ```javascript\n * stringNotEqualsIgnoreCase('hi', 'no')\n * // => true\n * \n * stringNotEqualsIgnoreCase('hi', 'Hi')\n * // => false\n * ```\n */\nexport function stringNotEqualsIgnoreCase(data: string, expected: string): boolean {\n return (\n data.toLowerCase() !== expected.toLowerCase()\n );\n}\n","import { bool } from './boolean/bool';\nimport { dateEquals } from './date/dateEquals';\nimport { dateGreaterThan } from './date/dateGreaterThan';\nimport { dateGreaterThanEquals } from './date/dateGreaterThanEquals';\nimport { dateLessThan } from './date/dateLessThan';\nimport { dateLessThanEquals } from './date/dateLessThanEquals';\nimport { dateNotEquals } from './date/dateNotEquals';\nimport { numericEquals } from './numeric/numericEquals';\nimport { numericGreaterThan } from './numeric/numericGreaterThan';\nimport { numericGreaterThanEquals } from './numeric/numericGreaterThanEquals';\nimport { numericLessThan } from './numeric/numericLessThan';\nimport { numericLessThanEquals } from './numeric/numericLessThanEquals';\nimport { numericNotEquals } from './numeric/numericNotEquals';\nimport { stringEquals } from './string/stringEquals';\nimport { stringEqualsIgnoreCase } from './string/stringEqualsIgnoreCase';\nimport { stringLike } from './string/stringLike';\nimport { stringLikeIfExists } from './string/stringLikeIfExists';\nimport { stringNotEquals } from './string/stringNotEquals';\nimport { stringNotEqualsIgnoreCase } from './string/stringNotEqualsIgnoreCase';\n\nexport const operators: Record = {\n bool,\n dateEquals,\n dateGreaterThan,\n dateGreaterThanEquals,\n dateLessThan,\n dateLessThanEquals,\n dateNotEquals,\n numericEquals,\n numericGreaterThan,\n numericGreaterThanEquals,\n numericLessThan,\n numericLessThanEquals,\n numericNotEquals,\n stringEquals,\n stringEqualsIgnoreCase,\n stringLike,\n stringLikeIfExists,\n stringNotEquals,\n stringNotEqualsIgnoreCase\n};\n","import {\n EffectBlock,\n ConditionBlock,\n StatementInterface,\n MatchConditionInterface,\n MatchConditionResolverInterface\n} from './types';\nimport { getValueFromPath } from './utils/getValueFromPath';\nimport { generateUUID } from './utils/generateUUID';\nimport {operators} from './conditionOperators';\n\nabstract class Statement {\n protected sid: string;\n protected readonly condition?: ConditionBlock;\n effect: EffectBlock;\n\n constructor({ sid, effect = 'allow', condition }: StatementInterface) {\n if (!sid) {\n this.sid = generateUUID();\n } else {\n this.sid = sid;\n }\n this.effect = effect;\n this.condition = condition;\n }\n\n matchConditions(\n this: Statement,\n { context, conditionResolver }: MatchConditionInterface\n ): boolean {\n const { condition: conditions } = this;\n\n if(conditions && context){\n return Object.keys(conditions).every((condition) =>\n Object.keys(conditions[condition]).every((path) => {\n const conditionValues = conditions[condition][path];\n if (conditionValues instanceof Array) {\n return conditionValues.some((value) =>\n this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value\n })\n );\n }\n\n return this.evaluateCondition({\n context,\n conditionResolver,\n condition,\n path,\n value: conditionValues\n });\n })\n )\n }\n\n return true;\n }\n\n private evaluateCondition(\n this: Statement,\n { context, conditionResolver={}, path, value, condition }: MatchConditionResolverInterface\n ): boolean {\n\n const currentResolver= conditionResolver[condition] || operators[condition]\n\n if(currentResolver){\n return currentResolver(\n getValueFromPath(context, path),\n value\n )\n }\n return false;\n }\n}\n\nexport { Statement };\n","import { ActionBasedType, MatchActionBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ActionBased extends Statement {\n private action?: string[];\n private notAction?: string[];\n private statement: ActionBasedType;\n\n constructor(action: ActionBasedType) {\n super(action);\n this.checkAndAssignActions(action);\n this.statement = { ...action, sid: this.sid };\n }\n\n getStatement(this: ActionBased): ActionBasedType {\n return this.statement;\n }\n\n matches(\n this: ActionBased,\n { action, context, conditionResolver }: MatchActionBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(action: ActionBasedType): void {\n const hasAction = 'action' in action;\n const hasNotAction = 'notAction' in action;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ActionBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in action) {\n this.action =\n typeof action.action === 'string' ? [action.action] : action.action;\n } else {\n this.notAction =\n typeof action.notAction === 'string'\n ? [action.notAction]\n : action.notAction;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n}\n\nexport { ActionBased };\n","import { IdentityBasedType, MatchIdentityBasedInterface } from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass IdentityBased extends Statement {\n private resource?: string[];\n private action?: string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: IdentityBasedType;\n\n constructor(identity: IdentityBasedType) {\n super(identity);\n this.checkAndAssignActions(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: IdentityBased): IdentityBasedType {\n return this.statement;\n }\n\n matches(\n this: IdentityBased,\n {\n action,\n resource,\n context,\n conditionResolver\n }: MatchIdentityBasedInterface\n ): boolean {\n return (\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n private checkAndAssignActions(identity: IdentityBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'IdentityBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignResources(identity: IdentityBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'IdentityBased statement should have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n } else {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n }\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { IdentityBased };\n","import {\n PrincipalMap,\n MatchResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { Matcher } from './Matcher';\nimport { Statement } from './Statement';\nimport { applyContext } from './utils/applyContext';\n\nclass ResourceBased extends Statement {\n private principal?: PrincipalMap | string[];\n private resource?: string[];\n private action?: string[];\n private notPrincipal?: PrincipalMap | string[];\n private notResource?: string[];\n private notAction?: string[];\n private statement: ResourceBasedType;\n private hasPrincipals: boolean;\n private hasResources: boolean;\n\n constructor(identity: ResourceBasedType) {\n super(identity);\n this.hasPrincipals = false;\n this.hasResources = false;\n this.checkAndAssignActions(identity);\n this.checkAndAssignPrincipals(identity);\n this.checkAndAssignResources(identity);\n this.statement = { ...identity, sid: this.sid };\n }\n\n getStatement(this: ResourceBased): ResourceBasedType {\n return this.statement;\n }\n\n matches(\n this: ResourceBased,\n {\n principal,\n action,\n resource,\n principalType,\n context,\n conditionResolver\n }: MatchResourceBasedInterface\n ): boolean {\n return (\n this.matchPrincipalAndNotPrincipal(principal, principalType, context) &&\n this.matchActions(action, context) &&\n this.matchNotActions(action, context) &&\n this.matchResourceAndNotResource(resource, context) &&\n this.matchConditions({ context, conditionResolver })\n );\n }\n\n /*valueComing principal noPrincipal\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchPrincipalAndNotPrincipal(\n principal?: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (principal) {\n if (this.hasPrincipals)\n return (\n this.matchPrincipals(principal, principalType, context) &&\n this.matchNotPrincipals(principal, principalType, context)\n );\n return false;\n }\n if (this.hasPrincipals) return false;\n return true;\n }\n\n /*valueComing resource noResource\n true false false false\n true true false true or false\n true false true true or false\n false false false true\n false true false false\n false false true false*/\n private matchResourceAndNotResource(resource?: string, context?: T): boolean {\n if (resource) {\n if (this.hasResources)\n return (\n this.matchResources(resource, context) &&\n this.matchNotResources(resource, context)\n );\n return false;\n }\n if (this.hasResources) return false;\n return true;\n }\n\n private checkAndAssignActions(identity: ResourceBasedType): void {\n const hasAction = 'action' in identity;\n const hasNotAction = 'notAction' in identity;\n if (hasAction && hasNotAction) {\n throw new TypeError(\n 'ResourceBased statement should have an action or a notAction attribute, no both'\n );\n }\n if ('action' in identity) {\n this.action =\n typeof identity.action === 'string'\n ? [identity.action]\n : identity.action;\n } else {\n this.notAction =\n typeof identity.notAction === 'string'\n ? [identity.notAction]\n : identity.notAction;\n }\n }\n\n private checkAndAssignPrincipals(identity: ResourceBasedType): void {\n const hasPrincipal = 'principal' in identity;\n const hasNotPrincipal = 'notPrincipal' in identity;\n if (hasPrincipal && hasNotPrincipal) {\n throw new TypeError(\n 'ResourceBased statement could have a principal or a notPrincipal attribute, no both'\n );\n }\n if ('principal' in identity) {\n this.principal =\n typeof identity.principal === 'string'\n ? [identity.principal]\n : identity.principal;\n this.hasPrincipals = true;\n } else if ('notPrincipal' in identity) {\n this.notPrincipal =\n typeof identity.notPrincipal === 'string'\n ? [identity.notPrincipal]\n : identity.notPrincipal;\n this.hasPrincipals = true;\n }\n }\n\n private checkAndAssignResources(identity: ResourceBasedType): void {\n const hasResource = 'resource' in identity;\n const hasNotResource = 'notResource' in identity;\n if (hasResource && hasNotResource) {\n throw new TypeError(\n 'ResourceBased statement could have a resource or a notResource attribute, no both'\n );\n }\n if ('resource' in identity) {\n this.resource =\n typeof identity.resource === 'string'\n ? [identity.resource]\n : identity.resource;\n this.hasResources = true;\n } else if ('notResource' in identity) {\n this.notResource =\n typeof identity.notResource === 'string'\n ? [identity.notResource]\n : identity.notResource;\n this.hasResources = true;\n }\n }\n\n private matchPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.principal) {\n if (this.principal instanceof Array) {\n return principalType\n ? false\n : this.principal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.principal[principalType];\n if (principalValues instanceof Array) {\n return principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return false;\n }\n return false;\n }\n }\n return true;\n }\n\n private matchNotPrincipals(\n principal: string,\n principalType?: string,\n context?: T\n ): boolean {\n if (this.notPrincipal) {\n if (this.notPrincipal instanceof Array) {\n return principalType\n ? true\n : !this.notPrincipal.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else {\n if (principalType) {\n const principalValues = this.notPrincipal[principalType];\n if (principalValues instanceof Array) {\n return !principalValues.some((a) =>\n new Matcher(applyContext(a, context)).match(principal)\n );\n } else if (principalValues) {\n return !new Matcher(applyContext(principalValues, context)).match(\n principal\n );\n }\n return true;\n }\n return true;\n }\n }\n return true;\n }\n\n private matchActions(action: string, context?: T): boolean {\n return this.action\n ? this.action.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchNotActions(action: string, context?: T): boolean {\n return this.notAction\n ? !this.notAction.some((a) =>\n new Matcher(applyContext(a, context)).match(action)\n )\n : true;\n }\n\n private matchResources(resource: string, context?: T): boolean {\n return this.resource\n ? this.resource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n\n private matchNotResources(resource: string, context?: T): boolean {\n return this.notResource\n ? !this.notResource.some((a) =>\n new Matcher(applyContext(a, context)).match(resource)\n )\n : true;\n }\n}\n\nexport { ResourceBased };\n","import { MatchConditionInterface, ConditionResolver } from './types';\n\nabstract class Policy {\n protected context?: T;\n protected conditionResolver?: ConditionResolver;\n\n constructor({ context, conditionResolver }: MatchConditionInterface) {\n this.context = context;\n this.conditionResolver = conditionResolver;\n }\n\n setContext(this: Policy, context: T): void {\n this.context = context;\n }\n\n getContext(this: Policy): T | undefined {\n return this.context;\n }\n\n setConditionResolver(\n this: Policy,\n conditionResolver: ConditionResolver\n ): void {\n this.conditionResolver = conditionResolver;\n }\n\n getConditionResolver(this: Policy): ConditionResolver | undefined {\n return this.conditionResolver;\n }\n\n abstract getStatements(this: Policy): U[];\n}\n\nexport { Policy };\n","import {\n ActionBasedType,\n ConditionResolver,\n EvaluateActionBasedInterface,\n ProxyOptions\n} from './types';\nimport { ActionBased } from './ActionBasedStatement';\nimport { Policy } from './Policy';\n\nexport interface ActionBasedPolicyInterface {\n statements: ActionBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ActionBasedPolicy extends Policy<\n T,\n ActionBasedType\n> {\n private denyStatements: ActionBased[];\n private allowStatements: ActionBased[];\n private statements: ActionBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ActionBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ActionBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(this: ActionBasedPolicy, statement: ActionBasedType): void {\n const statementInstance = new ActionBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ActionBasedPolicy): ActionBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n const args = { action, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n cannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: ActionBasedPolicy,\n { action, context }: EvaluateActionBasedInterface\n ): ActionBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as ActionBasedType[]);\n }\n\n generateProxy(\n this: ActionBasedPolicy,\n obj: U,\n options: ProxyOptions = {}\n ): U {\n const { get = {}, set = {} } = options;\n const { allow: allowGet = true, propertyMap: propertyMapGet = {} } = get;\n const { allow: allowSet = true, propertyMap: propertyMapSet = {} } = set;\n const handler = {\n ...(allowGet\n ? {\n get: (target: U, prop: string | symbol): any => {\n const property = Reflect.has(propertyMapGet, prop)\n ? Reflect.get(propertyMapGet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.get(target, prop);\n } else {\n throw new Error(`Unauthorize to get ${prop} property`);\n }\n } else {\n return Reflect.get(target, prop);\n }\n }\n }\n : {}),\n ...(allowSet\n ? {\n set: (target: U, prop: string | symbol, value: any): boolean => {\n const property = Reflect.has(propertyMapSet, prop)\n ? Reflect.get(propertyMapSet, prop)\n : prop;\n if (typeof prop === 'string') {\n if (this.evaluate({ action: property })) {\n return Reflect.set(target, prop, value);\n } else {\n throw new Error(`Unauthorize to set ${prop} property`);\n }\n } else {\n return false;\n }\n }\n }\n : {})\n };\n\n return new Proxy(obj, handler);\n }\n}\n","import {\n ConditionResolver,\n EvaluateIdentityBasedInterface,\n IdentityBasedType\n} from './types';\nimport { IdentityBased } from './IdentityBasedStatement';\nimport { Policy } from './Policy';\n\ninterface IdentityBasedPolicyInterface {\n statements: IdentityBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class IdentityBasedPolicy extends Policy<\n T,\n IdentityBasedType\n> {\n private denyStatements: IdentityBased[];\n private allowStatements: IdentityBased[];\n private statements: IdentityBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: IdentityBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new IdentityBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: IdentityBasedPolicy,\n statement: IdentityBasedType\n ): void {\n const statementInstance = new IdentityBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: IdentityBasedPolicy): IdentityBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n const args = { action, resource, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCan(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.allowStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n\n cannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n whyCannot(\n this: IdentityBasedPolicy,\n { action, resource, context }: EvaluateIdentityBasedInterface\n ): IdentityBasedType[] {\n return this.denyStatements.reduce((statements, currentStatement) => {\n const matches = currentStatement.matches({\n action,\n resource,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n });\n if (matches) {\n return [...statements, currentStatement.getStatement()];\n }\n return statements;\n }, [] as IdentityBasedType[]);\n }\n}\n","import {\n ConditionResolver,\n EvaluateResourceBasedInterface,\n ResourceBasedType\n} from './types';\nimport { ResourceBased } from './ResourceBasedStatement';\nimport { Policy } from './Policy';\n\ninterface ResourceBasedPolicyInterface {\n statements: ResourceBasedType[];\n conditionResolver?: ConditionResolver;\n context?: T;\n}\n\nexport class ResourceBasedPolicy extends Policy<\n T,\n ResourceBasedType\n> {\n private denyStatements: ResourceBased[];\n private allowStatements: ResourceBased[];\n private statements: ResourceBasedType[];\n\n constructor({\n statements,\n conditionResolver,\n context\n }: ResourceBasedPolicyInterface) {\n super({ context, conditionResolver });\n const statementInstances = statements.map(\n (statement) => new ResourceBased(statement)\n );\n this.allowStatements = statementInstances.filter(\n (s) => s.effect === 'allow'\n );\n this.denyStatements = statementInstances.filter((s) => s.effect === 'deny');\n this.statements = statementInstances.map((statement) =>\n statement.getStatement()\n );\n }\n\n addStatement(\n this: ResourceBasedPolicy,\n statement: ResourceBasedType\n ): void {\n const statementInstance = new ResourceBased(statement);\n if (statementInstance.effect === 'allow') {\n this.allowStatements.push(statementInstance);\n } else {\n this.denyStatements.push(statementInstance);\n }\n this.statements.push(statementInstance.getStatement());\n }\n\n getStatements(this: ResourceBasedPolicy): ResourceBasedType[] {\n return this.statements;\n }\n\n evaluate(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n const args = { principal, action, resource, principalType, context };\n return !this.cannot(args) && this.can(args);\n }\n\n can(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.allowStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n\n cannot(\n this: ResourceBasedPolicy,\n {\n principal,\n action,\n resource,\n principalType,\n context\n }: EvaluateResourceBasedInterface\n ): boolean {\n return this.denyStatements.some((s) =>\n s.matches({\n principal,\n action,\n resource,\n principalType,\n context: context || this.context,\n conditionResolver: this.conditionResolver\n })\n );\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;SAgBgB,MAAM,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C;;AChBA;;;;;;;;;;;;;;;;SAgBgB,QAAQ,CAAC,KAAe;IACtC,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,QACE,IAAI,KAAK,QAAQ;SAChB,IAAI,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC,EAC5E;AACJ;;ACtBA;AACA,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;;;;;;;SAegB,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;AACpE;;AC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,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC7C;IAED,GAAG,CAED,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KACjC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;IAED,MAAM,CAEJ,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,OAAO,EAC2B;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,KAChC,CAAC,CAAC,OAAO,CAAC;YACR,SAAS;YACT,MAAM;YACN,QAAQ;YACR,aAAa;YACb,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CACH,CAAC;KACH;;;;;;;;;;;;"} \ No newline at end of file diff --git a/docs/gitbook/api/iam-policies.actionbasedtype.md b/docs/gitbook/api/iam-policies.actionbasedtype.md new file mode 100644 index 0000000..d563ee1 --- /dev/null +++ b/docs/gitbook/api/iam-policies.actionbasedtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ActionBasedType](./iam-policies.actionbasedtype.md) + +## ActionBasedType type + +Signature: + +```typescript +declare type ActionBasedType = StatementInterface & (ActionBlock | NotActionBlock); +``` diff --git a/docs/gitbook/api/iam-policies.conditionblock.md b/docs/gitbook/api/iam-policies.conditionblock.md new file mode 100644 index 0000000..a6f5613 --- /dev/null +++ b/docs/gitbook/api/iam-policies.conditionblock.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ConditionBlock](./iam-policies.conditionblock.md) + +## ConditionBlock type + +Signature: + +```typescript +declare type ConditionBlock = Record>; +``` diff --git a/docs/gitbook/api/iam-policies.conditionkey.md b/docs/gitbook/api/iam-policies.conditionkey.md new file mode 100644 index 0000000..fdcc0cc --- /dev/null +++ b/docs/gitbook/api/iam-policies.conditionkey.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ConditionKey](./iam-policies.conditionkey.md) + +## ConditionKey type + +Signature: + +```typescript +declare type ConditionKey = string | number | boolean; +``` diff --git a/docs/gitbook/api/iam-policies.conditionmap.md b/docs/gitbook/api/iam-policies.conditionmap.md new file mode 100644 index 0000000..2fe8861 --- /dev/null +++ b/docs/gitbook/api/iam-policies.conditionmap.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ConditionMap](./iam-policies.conditionmap.md) + +## ConditionMap interface + +Signature: + +```typescript +interface ConditionMap +``` diff --git a/docs/gitbook/api/iam-policies.conditionresolver.md b/docs/gitbook/api/iam-policies.conditionresolver.md new file mode 100644 index 0000000..1d83104 --- /dev/null +++ b/docs/gitbook/api/iam-policies.conditionresolver.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ConditionResolver](./iam-policies.conditionresolver.md) + +## ConditionResolver interface + +Signature: + +```typescript +interface ConditionResolver +``` diff --git a/docs/gitbook/api/iam-policies.decomposestring.body.md b/docs/gitbook/api/iam-policies.decomposestring.body.md new file mode 100644 index 0000000..1cfdfa5 --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.body.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) > [body](./iam-policies.decomposestring.body.md) + +## DecomposeString.body property + +Signature: + +```typescript +body: string; +``` diff --git a/docs/gitbook/api/iam-policies.decomposestring.end.md b/docs/gitbook/api/iam-policies.decomposestring.end.md new file mode 100644 index 0000000..cb27f6a --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.end.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) > [end](./iam-policies.decomposestring.end.md) + +## DecomposeString.end property + +Signature: + +```typescript +end: number; +``` diff --git a/docs/gitbook/api/iam-policies.decomposestring.md b/docs/gitbook/api/iam-policies.decomposestring.md new file mode 100644 index 0000000..6237c74 --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) + +## DecomposeString interface + +Signature: + +```typescript +interface DecomposeString +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [body](./iam-policies.decomposestring.body.md) | string | | +| [end](./iam-policies.decomposestring.end.md) | number | | +| [post](./iam-policies.decomposestring.post.md) | string | | +| [pre](./iam-policies.decomposestring.pre.md) | string | | +| [start](./iam-policies.decomposestring.start.md) | number | | + diff --git a/docs/gitbook/api/iam-policies.decomposestring.post.md b/docs/gitbook/api/iam-policies.decomposestring.post.md new file mode 100644 index 0000000..5d155b6 --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.post.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) > [post](./iam-policies.decomposestring.post.md) + +## DecomposeString.post property + +Signature: + +```typescript +post: string; +``` diff --git a/docs/gitbook/api/iam-policies.decomposestring.pre.md b/docs/gitbook/api/iam-policies.decomposestring.pre.md new file mode 100644 index 0000000..bb081cc --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.pre.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) > [pre](./iam-policies.decomposestring.pre.md) + +## DecomposeString.pre property + +Signature: + +```typescript +pre: string; +``` diff --git a/docs/gitbook/api/iam-policies.decomposestring.start.md b/docs/gitbook/api/iam-policies.decomposestring.start.md new file mode 100644 index 0000000..d8ad238 --- /dev/null +++ b/docs/gitbook/api/iam-policies.decomposestring.start.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [DecomposeString](./iam-policies.decomposestring.md) > [start](./iam-policies.decomposestring.start.md) + +## DecomposeString.start property + +Signature: + +```typescript +start: number; +``` diff --git a/docs/gitbook/api/iam-policies.effectblock.md b/docs/gitbook/api/iam-policies.effectblock.md new file mode 100644 index 0000000..1bc9df9 --- /dev/null +++ b/docs/gitbook/api/iam-policies.effectblock.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EffectBlock](./iam-policies.effectblock.md) + +## EffectBlock type + +Signature: + +```typescript +declare type EffectBlock = 'allow' | 'deny'; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.action.md b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.action.md new file mode 100644 index 0000000..9c3e087 --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.action.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateActionBasedInterface](./iam-policies.evaluateactionbasedinterface.md) > [action](./iam-policies.evaluateactionbasedinterface.action.md) + +## EvaluateActionBasedInterface.action property + +Signature: + +```typescript +action: string; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.context.md b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.context.md new file mode 100644 index 0000000..69a83ca --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.context.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateActionBasedInterface](./iam-policies.evaluateactionbasedinterface.md) > [context](./iam-policies.evaluateactionbasedinterface.context.md) + +## EvaluateActionBasedInterface.context property + +Signature: + +```typescript +context?: T; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.md b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.md new file mode 100644 index 0000000..59eab90 --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateactionbasedinterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateActionBasedInterface](./iam-policies.evaluateactionbasedinterface.md) + +## EvaluateActionBasedInterface interface + +Signature: + +```typescript +interface EvaluateActionBasedInterface +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [action](./iam-policies.evaluateactionbasedinterface.action.md) | string | | +| [context?](./iam-policies.evaluateactionbasedinterface.context.md) | T | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.md b/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.md new file mode 100644 index 0000000..6506393 --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateIdentityBasedInterface](./iam-policies.evaluateidentitybasedinterface.md) + +## EvaluateIdentityBasedInterface interface + +Signature: + +```typescript +interface EvaluateIdentityBasedInterface extends EvaluateActionBasedInterface +``` +Extends: EvaluateActionBasedInterface<T> + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [resource](./iam-policies.evaluateidentitybasedinterface.resource.md) | string | | + diff --git a/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.resource.md b/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.resource.md new file mode 100644 index 0000000..157920c --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateidentitybasedinterface.resource.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateIdentityBasedInterface](./iam-policies.evaluateidentitybasedinterface.md) > [resource](./iam-policies.evaluateidentitybasedinterface.resource.md) + +## EvaluateIdentityBasedInterface.resource property + +Signature: + +```typescript +resource: string; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.md b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.md new file mode 100644 index 0000000..bb7ab75 --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateResourceBasedInterface](./iam-policies.evaluateresourcebasedinterface.md) + +## EvaluateResourceBasedInterface interface + +Signature: + +```typescript +interface EvaluateResourceBasedInterface extends EvaluateActionBasedInterface +``` +Extends: EvaluateActionBasedInterface<T> + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [principal?](./iam-policies.evaluateresourcebasedinterface.principal.md) | string | (Optional) | +| [principalType?](./iam-policies.evaluateresourcebasedinterface.principaltype.md) | string | (Optional) | +| [resource?](./iam-policies.evaluateresourcebasedinterface.resource.md) | string | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principal.md b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principal.md new file mode 100644 index 0000000..6e26f3c --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateResourceBasedInterface](./iam-policies.evaluateresourcebasedinterface.md) > [principal](./iam-policies.evaluateresourcebasedinterface.principal.md) + +## EvaluateResourceBasedInterface.principal property + +Signature: + +```typescript +principal?: string; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principaltype.md b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principaltype.md new file mode 100644 index 0000000..dbebec0 --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.principaltype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateResourceBasedInterface](./iam-policies.evaluateresourcebasedinterface.md) > [principalType](./iam-policies.evaluateresourcebasedinterface.principaltype.md) + +## EvaluateResourceBasedInterface.principalType property + +Signature: + +```typescript +principalType?: string; +``` diff --git a/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.resource.md b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.resource.md new file mode 100644 index 0000000..decc66f --- /dev/null +++ b/docs/gitbook/api/iam-policies.evaluateresourcebasedinterface.resource.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [EvaluateResourceBasedInterface](./iam-policies.evaluateresourcebasedinterface.md) > [resource](./iam-policies.evaluateresourcebasedinterface.resource.md) + +## EvaluateResourceBasedInterface.resource property + +Signature: + +```typescript +resource?: string; +``` diff --git a/docs/gitbook/api/iam-policies.identitybasedpolicy.md b/docs/gitbook/api/iam-policies.identitybasedpolicy.md index 650a136..1198312 100644 --- a/docs/gitbook/api/iam-policies.identitybasedpolicy.md +++ b/docs/gitbook/api/iam-policies.identitybasedpolicy.md @@ -26,4 +26,6 @@ declare class IdentityBasedPolicy extends Policy + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [IdentityBasedPolicy](./iam-policies.identitybasedpolicy.md) > [whyCan](./iam-policies.identitybasedpolicy.whycan.md) + +## IdentityBasedPolicy.whyCan() method + +Signature: + +```typescript +whyCan(this: IdentityBasedPolicy, { action, resource, context }: EvaluateIdentityBasedInterface): IdentityBasedType[]; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| this | IdentityBasedPolicy<T> | | +| { action, resource, context } | EvaluateIdentityBasedInterface<T> | | + +Returns: + +IdentityBasedType\[\] + diff --git a/docs/gitbook/api/iam-policies.identitybasedpolicy.whycannot.md b/docs/gitbook/api/iam-policies.identitybasedpolicy.whycannot.md new file mode 100644 index 0000000..4575b1d --- /dev/null +++ b/docs/gitbook/api/iam-policies.identitybasedpolicy.whycannot.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [IdentityBasedPolicy](./iam-policies.identitybasedpolicy.md) > [whyCannot](./iam-policies.identitybasedpolicy.whycannot.md) + +## IdentityBasedPolicy.whyCannot() method + +Signature: + +```typescript +whyCannot(this: IdentityBasedPolicy, { action, resource, context }: EvaluateIdentityBasedInterface): IdentityBasedType[]; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| this | IdentityBasedPolicy<T> | | +| { action, resource, context } | EvaluateIdentityBasedInterface<T> | | + +Returns: + +IdentityBasedType\[\] + diff --git a/docs/gitbook/api/iam-policies.identitybasedtype.md b/docs/gitbook/api/iam-policies.identitybasedtype.md new file mode 100644 index 0000000..a9fe8f6 --- /dev/null +++ b/docs/gitbook/api/iam-policies.identitybasedtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [IdentityBasedType](./iam-policies.identitybasedtype.md) + +## IdentityBasedType type + +Signature: + +```typescript +declare type IdentityBasedType = StatementInterface & (ActionBlock | NotActionBlock) & (ResourceBlock | NotResourceBlock); +``` diff --git a/docs/gitbook/api/iam-policies.matchactionbasedinterface.action.md b/docs/gitbook/api/iam-policies.matchactionbasedinterface.action.md new file mode 100644 index 0000000..1c36e3d --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchactionbasedinterface.action.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchActionBasedInterface](./iam-policies.matchactionbasedinterface.md) > [action](./iam-policies.matchactionbasedinterface.action.md) + +## MatchActionBasedInterface.action property + +Signature: + +```typescript +action: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchactionbasedinterface.md b/docs/gitbook/api/iam-policies.matchactionbasedinterface.md new file mode 100644 index 0000000..a2dc84d --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchactionbasedinterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchActionBasedInterface](./iam-policies.matchactionbasedinterface.md) + +## MatchActionBasedInterface interface + +Signature: + +```typescript +interface MatchActionBasedInterface extends MatchConditionInterface +``` +Extends: MatchConditionInterface<T> + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [action](./iam-policies.matchactionbasedinterface.action.md) | string | | + diff --git a/docs/gitbook/api/iam-policies.matchconditioninterface.conditionresolver.md b/docs/gitbook/api/iam-policies.matchconditioninterface.conditionresolver.md new file mode 100644 index 0000000..4547713 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditioninterface.conditionresolver.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionInterface](./iam-policies.matchconditioninterface.md) > [conditionResolver](./iam-policies.matchconditioninterface.conditionresolver.md) + +## MatchConditionInterface.conditionResolver property + +Signature: + +```typescript +conditionResolver?: ConditionResolver; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditioninterface.context.md b/docs/gitbook/api/iam-policies.matchconditioninterface.context.md new file mode 100644 index 0000000..50da853 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditioninterface.context.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionInterface](./iam-policies.matchconditioninterface.md) > [context](./iam-policies.matchconditioninterface.context.md) + +## MatchConditionInterface.context property + +Signature: + +```typescript +context?: T; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditioninterface.md b/docs/gitbook/api/iam-policies.matchconditioninterface.md new file mode 100644 index 0000000..6ff8b4d --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditioninterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionInterface](./iam-policies.matchconditioninterface.md) + +## MatchConditionInterface interface + +Signature: + +```typescript +interface MatchConditionInterface +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [conditionResolver?](./iam-policies.matchconditioninterface.conditionresolver.md) | ConditionResolver | (Optional) | +| [context?](./iam-policies.matchconditioninterface.context.md) | T | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.condition.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.condition.md new file mode 100644 index 0000000..e62ef04 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.condition.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) > [condition](./iam-policies.matchconditionresolverinterface.condition.md) + +## MatchConditionResolverInterface.condition property + +Signature: + +```typescript +condition: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.conditionresolver.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.conditionresolver.md new file mode 100644 index 0000000..c1c2182 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.conditionresolver.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) > [conditionResolver](./iam-policies.matchconditionresolverinterface.conditionresolver.md) + +## MatchConditionResolverInterface.conditionResolver property + +Signature: + +```typescript +conditionResolver?: ConditionResolver; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.context.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.context.md new file mode 100644 index 0000000..b3f0487 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.context.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) > [context](./iam-policies.matchconditionresolverinterface.context.md) + +## MatchConditionResolverInterface.context property + +Signature: + +```typescript +context: T; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.md new file mode 100644 index 0000000..8c5533b --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) + +## MatchConditionResolverInterface interface + +Signature: + +```typescript +interface MatchConditionResolverInterface +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [condition](./iam-policies.matchconditionresolverinterface.condition.md) | string | | +| [conditionResolver?](./iam-policies.matchconditionresolverinterface.conditionresolver.md) | ConditionResolver | (Optional) | +| [context](./iam-policies.matchconditionresolverinterface.context.md) | T | | +| [path](./iam-policies.matchconditionresolverinterface.path.md) | string | | +| [value](./iam-policies.matchconditionresolverinterface.value.md) | any | | + diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.path.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.path.md new file mode 100644 index 0000000..60bee61 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.path.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) > [path](./iam-policies.matchconditionresolverinterface.path.md) + +## MatchConditionResolverInterface.path property + +Signature: + +```typescript +path: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchconditionresolverinterface.value.md b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.value.md new file mode 100644 index 0000000..ec49263 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchconditionresolverinterface.value.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) > [value](./iam-policies.matchconditionresolverinterface.value.md) + +## MatchConditionResolverInterface.value property + +Signature: + +```typescript +value: any; +``` diff --git a/docs/gitbook/api/iam-policies.matchidentitybasedinterface.md b/docs/gitbook/api/iam-policies.matchidentitybasedinterface.md new file mode 100644 index 0000000..0502b56 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchidentitybasedinterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchIdentityBasedInterface](./iam-policies.matchidentitybasedinterface.md) + +## MatchIdentityBasedInterface interface + +Signature: + +```typescript +interface MatchIdentityBasedInterface extends MatchActionBasedInterface +``` +Extends: MatchActionBasedInterface<T> + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [resource](./iam-policies.matchidentitybasedinterface.resource.md) | string | | + diff --git a/docs/gitbook/api/iam-policies.matchidentitybasedinterface.resource.md b/docs/gitbook/api/iam-policies.matchidentitybasedinterface.resource.md new file mode 100644 index 0000000..6b874d7 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchidentitybasedinterface.resource.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchIdentityBasedInterface](./iam-policies.matchidentitybasedinterface.md) > [resource](./iam-policies.matchidentitybasedinterface.resource.md) + +## MatchIdentityBasedInterface.resource property + +Signature: + +```typescript +resource: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchresourcebasedinterface.md b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.md new file mode 100644 index 0000000..24fe810 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchResourceBasedInterface](./iam-policies.matchresourcebasedinterface.md) + +## MatchResourceBasedInterface interface + +Signature: + +```typescript +interface MatchResourceBasedInterface extends MatchActionBasedInterface +``` +Extends: MatchActionBasedInterface<T> + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [principal?](./iam-policies.matchresourcebasedinterface.principal.md) | string | (Optional) | +| [principalType?](./iam-policies.matchresourcebasedinterface.principaltype.md) | string | (Optional) | +| [resource?](./iam-policies.matchresourcebasedinterface.resource.md) | string | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principal.md b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principal.md new file mode 100644 index 0000000..a040e62 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchResourceBasedInterface](./iam-policies.matchresourcebasedinterface.md) > [principal](./iam-policies.matchresourcebasedinterface.principal.md) + +## MatchResourceBasedInterface.principal property + +Signature: + +```typescript +principal?: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principaltype.md b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principaltype.md new file mode 100644 index 0000000..fbe6ce7 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.principaltype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchResourceBasedInterface](./iam-policies.matchresourcebasedinterface.md) > [principalType](./iam-policies.matchresourcebasedinterface.principaltype.md) + +## MatchResourceBasedInterface.principalType property + +Signature: + +```typescript +principalType?: string; +``` diff --git a/docs/gitbook/api/iam-policies.matchresourcebasedinterface.resource.md b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.resource.md new file mode 100644 index 0000000..89aae58 --- /dev/null +++ b/docs/gitbook/api/iam-policies.matchresourcebasedinterface.resource.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MatchResourceBasedInterface](./iam-policies.matchresourcebasedinterface.md) > [resource](./iam-policies.matchresourcebasedinterface.resource.md) + +## MatchResourceBasedInterface.resource property + +Signature: + +```typescript +resource?: string; +``` diff --git a/docs/gitbook/api/iam-policies.md b/docs/gitbook/api/iam-policies.md index 37c4291..b0a2a24 100644 --- a/docs/gitbook/api/iam-policies.md +++ b/docs/gitbook/api/iam-policies.md @@ -27,4 +27,31 @@ | Interface | Description | | --- | --- | | [ActionBasedPolicyInterface](./iam-policies.actionbasedpolicyinterface.md) | | +| [ConditionMap](./iam-policies.conditionmap.md) | | +| [ConditionResolver](./iam-policies.conditionresolver.md) | | +| [DecomposeString](./iam-policies.decomposestring.md) | | +| [EvaluateActionBasedInterface](./iam-policies.evaluateactionbasedinterface.md) | | +| [EvaluateIdentityBasedInterface](./iam-policies.evaluateidentitybasedinterface.md) | | +| [EvaluateResourceBasedInterface](./iam-policies.evaluateresourcebasedinterface.md) | | +| [MatchActionBasedInterface](./iam-policies.matchactionbasedinterface.md) | | +| [MatchConditionInterface](./iam-policies.matchconditioninterface.md) | | +| [MatchConditionResolverInterface](./iam-policies.matchconditionresolverinterface.md) | | +| [MatchIdentityBasedInterface](./iam-policies.matchidentitybasedinterface.md) | | +| [MatchResourceBasedInterface](./iam-policies.matchresourcebasedinterface.md) | | +| [MemoizeInterface](./iam-policies.memoizeinterface.md) | | +| [PrincipalMap](./iam-policies.principalmap.md) | | +| [ProxyOptions](./iam-policies.proxyoptions.md) | | +| [StatementInterface](./iam-policies.statementinterface.md) | | + +## Type Aliases + +| Type Alias | Description | +| --- | --- | +| [ActionBasedType](./iam-policies.actionbasedtype.md) | | +| [ConditionBlock](./iam-policies.conditionblock.md) | | +| [ConditionKey](./iam-policies.conditionkey.md) | | +| [EffectBlock](./iam-policies.effectblock.md) | | +| [IdentityBasedType](./iam-policies.identitybasedtype.md) | | +| [Patterns](./iam-policies.patterns.md) | | +| [ResourceBasedType](./iam-policies.resourcebasedtype.md) | | diff --git a/docs/gitbook/api/iam-policies.memoizeinterface.cache.md b/docs/gitbook/api/iam-policies.memoizeinterface.cache.md new file mode 100644 index 0000000..8933b88 --- /dev/null +++ b/docs/gitbook/api/iam-policies.memoizeinterface.cache.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MemoizeInterface](./iam-policies.memoizeinterface.md) > [cache](./iam-policies.memoizeinterface.cache.md) + +## MemoizeInterface.cache property + +Signature: + +```typescript +cache: Map; +``` diff --git a/docs/gitbook/api/iam-policies.memoizeinterface.md b/docs/gitbook/api/iam-policies.memoizeinterface.md new file mode 100644 index 0000000..e847955 --- /dev/null +++ b/docs/gitbook/api/iam-policies.memoizeinterface.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [MemoizeInterface](./iam-policies.memoizeinterface.md) + +## MemoizeInterface interface + +Signature: + +```typescript +interface MemoizeInterface extends Function +``` +Extends: Function + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [cache](./iam-policies.memoizeinterface.cache.md) | Map<any, any> | | + diff --git a/docs/gitbook/api/iam-policies.patterns.md b/docs/gitbook/api/iam-policies.patterns.md new file mode 100644 index 0000000..2d47075 --- /dev/null +++ b/docs/gitbook/api/iam-policies.patterns.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [Patterns](./iam-policies.patterns.md) + +## Patterns type + +Signature: + +```typescript +declare type Patterns = string[] | string; +``` diff --git a/docs/gitbook/api/iam-policies.principalmap.md b/docs/gitbook/api/iam-policies.principalmap.md new file mode 100644 index 0000000..350f4f6 --- /dev/null +++ b/docs/gitbook/api/iam-policies.principalmap.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [PrincipalMap](./iam-policies.principalmap.md) + +## PrincipalMap interface + +Signature: + +```typescript +interface PrincipalMap +``` diff --git a/docs/gitbook/api/iam-policies.proxyoptions.get.md b/docs/gitbook/api/iam-policies.proxyoptions.get.md new file mode 100644 index 0000000..f20d0c0 --- /dev/null +++ b/docs/gitbook/api/iam-policies.proxyoptions.get.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ProxyOptions](./iam-policies.proxyoptions.md) > [get](./iam-policies.proxyoptions.get.md) + +## ProxyOptions.get property + +Signature: + +```typescript +get?: { + allow?: boolean; + propertyMap?: Record; + }; +``` diff --git a/docs/gitbook/api/iam-policies.proxyoptions.md b/docs/gitbook/api/iam-policies.proxyoptions.md new file mode 100644 index 0000000..cbbb709 --- /dev/null +++ b/docs/gitbook/api/iam-policies.proxyoptions.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ProxyOptions](./iam-policies.proxyoptions.md) + +## ProxyOptions interface + +Signature: + +```typescript +interface ProxyOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [get?](./iam-policies.proxyoptions.get.md) | { allow?: boolean; propertyMap?: Record<string, string>; } | (Optional) | +| [set?](./iam-policies.proxyoptions.set.md) | { allow?: boolean; propertyMap?: Record<string, string>; } | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.proxyoptions.set.md b/docs/gitbook/api/iam-policies.proxyoptions.set.md new file mode 100644 index 0000000..4f4bf16 --- /dev/null +++ b/docs/gitbook/api/iam-policies.proxyoptions.set.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ProxyOptions](./iam-policies.proxyoptions.md) > [set](./iam-policies.proxyoptions.set.md) + +## ProxyOptions.set property + +Signature: + +```typescript +set?: { + allow?: boolean; + propertyMap?: Record; + }; +``` diff --git a/docs/gitbook/api/iam-policies.resourcebasedtype.md b/docs/gitbook/api/iam-policies.resourcebasedtype.md new file mode 100644 index 0000000..f75f3fa --- /dev/null +++ b/docs/gitbook/api/iam-policies.resourcebasedtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [ResourceBasedType](./iam-policies.resourcebasedtype.md) + +## ResourceBasedType type + +Signature: + +```typescript +declare type ResourceBasedType = StatementInterface & (OptionalPrincipalBlock | OptionalNotPrincipalBlock) & (ActionBlock | NotActionBlock) & (OptionalResourceBlock | OptionalNotResourceBlock); +``` diff --git a/docs/gitbook/api/iam-policies.statementinterface.condition.md b/docs/gitbook/api/iam-policies.statementinterface.condition.md new file mode 100644 index 0000000..a1c7cb9 --- /dev/null +++ b/docs/gitbook/api/iam-policies.statementinterface.condition.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [StatementInterface](./iam-policies.statementinterface.md) > [condition](./iam-policies.statementinterface.condition.md) + +## StatementInterface.condition property + +Signature: + +```typescript +condition?: ConditionBlock; +``` diff --git a/docs/gitbook/api/iam-policies.statementinterface.effect.md b/docs/gitbook/api/iam-policies.statementinterface.effect.md new file mode 100644 index 0000000..4e2343b --- /dev/null +++ b/docs/gitbook/api/iam-policies.statementinterface.effect.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [StatementInterface](./iam-policies.statementinterface.md) > [effect](./iam-policies.statementinterface.effect.md) + +## StatementInterface.effect property + +Signature: + +```typescript +effect?: EffectBlock; +``` diff --git a/docs/gitbook/api/iam-policies.statementinterface.md b/docs/gitbook/api/iam-policies.statementinterface.md new file mode 100644 index 0000000..f920696 --- /dev/null +++ b/docs/gitbook/api/iam-policies.statementinterface.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [StatementInterface](./iam-policies.statementinterface.md) + +## StatementInterface interface + +Signature: + +```typescript +interface StatementInterface +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [condition?](./iam-policies.statementinterface.condition.md) | ConditionBlock | (Optional) | +| [effect?](./iam-policies.statementinterface.effect.md) | EffectBlock | (Optional) | +| [sid?](./iam-policies.statementinterface.sid.md) | string | (Optional) | + diff --git a/docs/gitbook/api/iam-policies.statementinterface.sid.md b/docs/gitbook/api/iam-policies.statementinterface.sid.md new file mode 100644 index 0000000..c933021 --- /dev/null +++ b/docs/gitbook/api/iam-policies.statementinterface.sid.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [iam-policies](./iam-policies.md) > [StatementInterface](./iam-policies.statementinterface.md) > [sid](./iam-policies.statementinterface.sid.md) + +## StatementInterface.sid property + +Signature: + +```typescript +sid?: string; +``` diff --git a/main.ts b/main.ts index d484738..caeaf87 100644 --- a/main.ts +++ b/main.ts @@ -6,3 +6,4 @@ export * from './src/ResourceBasedStatement'; export * from './src/ActionBasedPolicy'; export * from './src/IdentityBasedPolicy'; export * from './src/ResourceBasedPolicy'; +export * from './src/types'; diff --git a/package.json b/package.json index 54b0ee4..0d08705 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,9 @@ "test:coveralls": "npm-run-all test:coverage send:coveralls", "send:coveralls": "coveralls < coverage/lcov.info", "start": "npm-run-all clean build:watch", - "prepare": "yarn build", + "precommit": "npm-run-all pretty:quick lint:staged", "predeploy": "cd example && yarn && yarn start", + "prepare": "yarn build", "semantic-release": "semantic-release" }, "config": { diff --git a/src/IdentityBasedPolicy.test.ts b/src/IdentityBasedPolicy.test.ts index b3550df..f5f006e 100644 --- a/src/IdentityBasedPolicy.test.ts +++ b/src/IdentityBasedPolicy.test.ts @@ -446,6 +446,11 @@ describe('IdentityBasedPolicy Class', () => { effect: 'deny', resource: ['posts:${user.id}:*'], action: ['write', 'read', 'update'] + }, + { + effect: 'deny', + resource: ['projects:${user.id}:*'], + action: ['write', 'read'] } ] }); @@ -457,6 +462,19 @@ describe('IdentityBasedPolicy Class', () => { context: { user: { id: 123 } } }) ).toBe(true); + expect( + policy.whyCannot({ + action: 'read', + resource: 'posts:123:sshhh', + context: { user: { id: 123 } } + }) + ).toMatchObject([ + { + effect: 'deny', + resource: ['posts:${user.id}:*'], + action: ['write', 'read', 'update'] + } + ]); expect( policy.cannot({ action: 'read', diff --git a/src/IdentityBasedPolicy.ts b/src/IdentityBasedPolicy.ts index 76e906f..f5968cf 100644 --- a/src/IdentityBasedPolicy.ts +++ b/src/IdentityBasedPolicy.ts @@ -108,4 +108,22 @@ export class IdentityBasedPolicy extends Policy< }) ); } + + whyCannot( + this: IdentityBasedPolicy, + { action, resource, context }: EvaluateIdentityBasedInterface + ): IdentityBasedType[] { + return this.denyStatements.reduce((statements, currentStatement) => { + const matches = currentStatement.matches({ + action, + resource, + context: context || this.context, + conditionResolver: this.conditionResolver + }); + if (matches) { + return [...statements, currentStatement.getStatement()]; + } + return statements; + }, [] as IdentityBasedType[]); + } }