New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

data-prism

Package Overview
Dependencies
Maintainers
0
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-prism - npm Package Compare versions

Comparing version 0.0.39 to 0.0.40

coverage/base.css

2

dist/graph/query-graph.js

@@ -102,3 +102,3 @@ import { defaultExpressionEngine } from "@data-prism/expressions";

if (!(head in curValue))
throw new Error(`${propQuery} is an invalid attribute or path`);
return undefined;
return extractPath(curValue?.[head], tail);

@@ -105,0 +105,0 @@ };

@@ -50,3 +50,3 @@ const attributeTypes = [

if (!(idAttribute in resource.attributes)) {
throw new Error(`Invalid schema. An id attribute is required. Please ensure "${idAttribute}" attribute is defined on resource type "${resKey}".`);
throw new Error(`Invalid schema. An id attribute is required. Please ensure the "${idAttribute}" attribute is defined on resource type "${resKey}".`);
}

@@ -53,0 +53,0 @@ Object.entries(resource.attributes).forEach(([attrKey, attribute]) => {

@@ -27,4 +27,4 @@ import Ajv, { ErrorObject } from "ajv";

export declare const defaultValidator: Ajv;
export declare const createValidator: ({ schemas }?: {
schemas?: any[];
export declare const createValidator: ({ ajvSchemas }?: {
ajvSchemas?: any[];
}) => Ajv;

@@ -31,0 +31,0 @@ export declare function validateCreateResource(schema: Schema, resource: CreateResource, validator?: Ajv): ErrorObject[];

@@ -9,6 +9,6 @@ import Ajv from "ajv";

addFormats(defaultValidator);
export const createValidator = ({ schemas = [] } = {}) => {
export const createValidator = ({ ajvSchemas = [] } = {}) => {
const ajv = new Ajv();
addFormats(ajv);
schemas.forEach((schema) => ajv.addSchema(schema));
ajvSchemas.forEach((schema) => ajv.addSchema(schema));
if (!("https://data-prism.dev/schemas/geojson.schema.json" in ajv.schemas)) {

@@ -15,0 +15,0 @@ ajv.addSchema(geoJSONSchema);

{
"name": "data-prism",
"version": "0.0.39",
"version": "0.0.40",
"type": "module",

@@ -12,2 +12,3 @@ "main": "./dist/index.js",

"build": "tsc -p ./tsconfig.json",
"coverage": "vitest run --coverage",
"test": "NODE_ENV=test vitest"

@@ -18,4 +19,5 @@ },

"devDependencies": {
"@vitest/coverage-istanbul": "^3.0.4",
"typescript": "^5.1.3",
"vitest": "^0.31.4"
"vitest": "^3.0.4"
},

@@ -22,0 +24,0 @@ "publishConfig": {

@@ -135,3 +135,3 @@ import { defaultExpressionEngine } from "@data-prism/expressions";

if (!(head in curValue))
throw new Error(`${propQuery} is an invalid attribute or path`);
return undefined;

@@ -138,0 +138,0 @@ return extractPath(curValue?.[head], tail);

@@ -129,3 +129,3 @@ type SchemaAttribute = {

throw new Error(
`Invalid schema. An id attribute is required. Please ensure "${idAttribute}" attribute is defined on resource type "${resKey}".`,
`Invalid schema. An id attribute is required. Please ensure the "${idAttribute}" attribute is defined on resource type "${resKey}".`,
);

@@ -132,0 +132,0 @@ }

@@ -34,7 +34,7 @@ import Ajv, { ErrorObject, Schema as AjvSchema } from "ajv";

export const createValidator = ({ schemas = [] } = {}) => {
export const createValidator = ({ ajvSchemas = [] } = {}) => {
const ajv = new Ajv();
addFormats(ajv);
schemas.forEach((schema) => ajv.addSchema(schema));
ajvSchemas.forEach((schema) => ajv.addSchema(schema));
if (!("https://data-prism.dev/schemas/geojson.schema.json" in ajv.schemas)) {

@@ -41,0 +41,0 @@ ajv.addSchema(geoJSONSchema);

@@ -85,2 +85,15 @@ import { expect, it } from "vitest";

it("should not validate a schema with a missing resource type", () => {
expect(() =>
ensureValidSchema({
resources: {
buildings: {
attributes: { id: {} },
relationships: {},
},
},
}),
).toThrowError();
});
it("should not validate a schema with an invalid resource type", () => {

@@ -91,4 +104,4 @@ expect(() =>

buildings: {
attributes: { id: { type: "string" } },
relationships: { builder: { cardinality: "one", type: "builders" } },
attributes: { id: { type: "nothing" } },
relationships: {},
},

@@ -131,1 +144,18 @@ },

});
it("should not validate a schema with an invalid resource type", () => {
expect(() => {
ensureValidSchema({
resources: {
buildings: {
attributes: { id: { type: "string" } },
relationships: { builder: { cardinality: "one", type: "fake" } },
},
builders: {
attributes: { id: { type: "string" } },
relationships: {},
},
},
});
}).toThrowError();
});

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