How to use the @authx/scopes.isStrictSuperset function in @authx/scopes

To help you get started, we’ve selected a few @authx/scopes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / packages / authx / src / util / explanations.ts View on Github external
for (const [variableKey, variableValue] of Object.entries(parameters)) {
        const domain = new RegExp(`(\\(${escapeRegExp(variableKey)}\\))`, "g");
        description = description.replace(domain, variableValue);
      }

      explanationsByScope[result] = explanationsByScope[result] || [];
      explanationsByScope[result].push({
        scope: result,
        description: description,

        // TODO: I don't believe these are necessarily correct. However, they
        // work with my limited initial test cases, and I've already spent far
        // too much time on this.
        degreesOfFreedom: [
          // The "exact" degree of freedom.
          isStrictSuperset(query, result) ? 1 : 0,

          // The "parameter" degrees of freedom.
          Object.keys(parameters).length,

          // The "template" degrees of freedom.
          templateSegmentCount
        ]
      });
    }
  }

  // Filter the results to remove redundant explanations that were not
  // explicitly requested.
  const allExplanationScopes = Object.keys(explanationsByScope);
  const filteredResults: Explanation[] = [];
  for (const scope of allExplanationScopes) {
github the-control-group / authx / packages / authx / src / util / humanizeScopes.ts View on Github external
    (text, i) => !isStrictSuperset(resultScopes, resultScopes[i])
  );
github the-control-group / authx / packages / authx / src / util / explanations.ts View on Github external
      allExplanationScopes.some(s => isStrictSuperset(s, scope))
    ) {

@authx/scopes

This is a small collection of utility functions for AuthX scopes. These scopes are human-readable, fully OAuth2-compatible, and support both pattern matching and set algebra.

MIT
Latest version published 7 months ago

Package Health Score

67 / 100
Full package analysis