Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cerbos/core

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerbos/core - npm Package Compare versions

Comparing version 0.13.0 to 0.14.0

16

lib/client.d.ts

@@ -188,3 +188,3 @@ import type { _RPC, _Request, _Response, _Service } from "./rpcs";

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -194,3 +194,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -213,3 +213,3 @@ * actions: ["view", "edit"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -221,3 +221,3 @@ * resources: [

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -230,3 +230,3 @@ * actions: ["view", "edit"],

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -444,3 +444,3 @@ * actions: ["delete"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -450,3 +450,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -499,3 +499,3 @@ * action: "view",

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -502,0 +502,0 @@ * resource: { kind: "document" },

@@ -24,2 +24,4 @@ "use strict";

class Client {
options;
transport;
/** @internal */

@@ -155,3 +157,3 @@ constructor(transport, options) {

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -161,3 +163,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -191,3 +193,3 @@ * actions: ["view", "edit"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -199,3 +201,3 @@ * resources: [

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -208,3 +210,3 @@ * actions: ["view", "edit"],

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -451,3 +453,3 @@ * actions: ["delete"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -457,3 +459,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -518,3 +520,3 @@ * action: "view",

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -521,0 +523,0 @@ * resource: { kind: "document" },

@@ -227,7 +227,10 @@ "use strict";

exports.checkResourcesRequestToProtobuf = checkResourcesRequestToProtobuf;
function principalToProtobuf({ id, roles, attributes = {}, policyVersion = "", scope = "", }) {
function principalToProtobuf({ id, roles, attr = {}, attributes = {}, policyVersion = "", scope = "", }) {
return {
id,
roles,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -243,7 +246,10 @@ scope,

}
function resourceToProtobuf({ kind, id, attributes = {}, policyVersion = "", scope = "", }) {
function resourceToProtobuf({ kind, id, attr = {}, attributes = {}, policyVersion = "", scope = "", }) {
return {
kind,
id,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -314,6 +320,9 @@ scope,

exports.planResourcesRequestToProtobuf = planResourcesRequestToProtobuf;
function resourceQueryToProtobuf({ kind, attributes = {}, policyVersion = "", scope = "", }) {
function resourceQueryToProtobuf({ kind, attr = {}, attributes = {}, policyVersion = "", scope = "", }) {
return {
kind,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -320,0 +329,0 @@ scope,

@@ -54,2 +54,4 @@ "use strict";

class NotOK extends Error {
code;
details;
/**

@@ -107,2 +109,3 @@ * Parse a JSON-serialized unsuccessful response.

class ValidationFailed extends Error {
validationErrors;
constructor(

@@ -109,0 +112,0 @@ /**

@@ -10,2 +10,10 @@ "use strict";

class CheckResourcesResponse {
/**
* The identifier for tracing the request.
*/
requestId;
/**
* The outcomes of the permission checks for each resource.
*/
results;
constructor({ requestId, results, }) {

@@ -12,0 +20,0 @@ this.requestId = requestId;

@@ -11,2 +11,28 @@ "use strict";

class CheckResourcesResult {
/**
* The resource that was checked.
*/
resource;
/**
* The policy decisions for each action.
*/
actions;
/**
* Any schema validation errors for the principal or resource attributes.
*/
validationErrors;
/**
* Additional information about how the policy decisions were reached.
*
* @remarks
* `undefined` if {@link CheckResourcesRequest.includeMetadata | includeMetadata} was `false`.
*/
metadata;
/**
* User-defined outputs from policy rule evaluations.
*
* @remarks
* Requires the Cerbos policy decision point server to be at least v0.27.
*/
outputs;
constructor({ resource, actions, validationErrors, metadata, outputs, }) {

@@ -13,0 +39,0 @@ this.resource = resource;

@@ -10,2 +10,4 @@ "use strict";

class PlanExpression {
operator;
operands;
constructor(

@@ -12,0 +14,0 @@ /**

@@ -10,2 +10,3 @@ "use strict";

class PlanExpressionValue {
value;
constructor(

@@ -12,0 +13,0 @@ /**

@@ -10,2 +10,3 @@ "use strict";

class PlanExpressionVariable {
name;
constructor(

@@ -12,0 +13,0 @@ /**

@@ -21,2 +21,9 @@ import type { Value } from "./Value";

*/
attr?: Record<string, Value>;
/**
* Application-specific attributes describing the principal (deprecated).
*
* @defaultValue `{}`
* @deprecated Use {@link Principal.attr} instead, for consistency with policy expressions.
*/
attributes?: Record<string, Value>;

@@ -23,0 +30,0 @@ /**

@@ -21,2 +21,9 @@ import type { Value } from "./Value";

*/
attr?: Record<string, Value>;
/**
* Application-specific attributes describing the resource (deprecated).
*
* @defaultValue `{}`
* @deprecated Use {@link Resource.attr} instead, for consistency with policy expressions.
*/
attributes?: Record<string, Value>;

@@ -23,0 +30,0 @@ /**

@@ -10,3 +10,3 @@ import type { Resource } from "./Resource";

*/
export type ResourceSearch = Omit<Resource, "attributes">;
export type ResourceSearch = Omit<Resource, "attr" | "attributes">;
//# sourceMappingURL=ResourceSearch.d.ts.map

@@ -12,2 +12,3 @@ "use strict";

class SchemaDefinition {
bytes;
constructor(

@@ -14,0 +15,0 @@ /**

{
"name": "@cerbos/core",
"version": "0.13.0",
"version": "0.14.0",
"description": "Common types used by the @cerbos/grpc and @cerbos/http client libraries",

@@ -17,3 +17,3 @@ "repository": {

"engines": {
"node": ">= 16"
"node": ">= 18"
},

@@ -30,7 +30,7 @@ "main": "./lib/index.js",

"dependencies": {
"uuid": "^9.0.0"
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/uuid": "9.0.2"
"@types/uuid": "9.0.4"
}
}

@@ -288,3 +288,3 @@ import {

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -294,3 +294,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -330,3 +330,3 @@ * actions: ["view", "edit"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -338,3 +338,3 @@ * resources: [

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -347,3 +347,3 @@ * actions: ["view", "edit"],

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -642,3 +642,3 @@ * actions: ["delete"],

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -648,3 +648,3 @@ * resource: {

* id: "1",
* attributes: { owner: "user@example.com" },
* attr: { owner: "user@example.com" },
* },

@@ -718,3 +718,3 @@ * action: "view",

* roles: ["USER"],
* attributes: { tier: "PREMIUM" },
* attr: { tier: "PREMIUM" },
* },

@@ -721,0 +721,0 @@ * resource: { kind: "document" },

@@ -413,2 +413,3 @@ import { v4 as uuidv4 } from "uuid";

roles,
attr = {},
attributes = {},

@@ -421,3 +422,6 @@ policyVersion = "",

roles,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -441,2 +445,3 @@ scope,

id,
attr = {},
attributes = {},

@@ -449,3 +454,6 @@ policyVersion = "",

id,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -543,2 +551,3 @@ scope,

kind,
attr = {},
attributes = {},

@@ -550,3 +559,6 @@ policyVersion = "",

kind,
attr: attributes,
attr: {
...attributes,
...attr,
},
policyVersion,

@@ -553,0 +565,0 @@ scope,

@@ -24,2 +24,10 @@ import type { Value } from "./Value";

*/
attr?: Record<string, Value>;
/**
* Application-specific attributes describing the principal (deprecated).
*
* @defaultValue `{}`
* @deprecated Use {@link Principal.attr} instead, for consistency with policy expressions.
*/
attributes?: Record<string, Value>;

@@ -26,0 +34,0 @@

@@ -24,2 +24,10 @@ import type { Value } from "./Value";

*/
attr?: Record<string, Value>;
/**
* Application-specific attributes describing the resource (deprecated).
*
* @defaultValue `{}`
* @deprecated Use {@link Resource.attr} instead, for consistency with policy expressions.
*/
attributes?: Record<string, Value>;

@@ -26,0 +34,0 @@

@@ -11,2 +11,2 @@ import type { Resource } from "./Resource";

*/
export type ResourceSearch = Omit<Resource, "attributes">;
export type ResourceSearch = Omit<Resource, "attr" | "attributes">;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc