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

@contember/schema-utils

Package Overview
Dependencies
Maintainers
5
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/schema-utils - npm Package Compare versions

Comparing version 1.3.0-alpha.13 to 1.3.0-beta.1

12

dist/src/lax/schema.d.ts

@@ -88,10 +88,10 @@ import * as Typesafe from '@contember/typesafe';

})>;
export declare type LaxSchemaField = ReturnType<typeof LaxSchemaField>;
export declare type LaxSchemaEnum = Extract<LaxSchemaField, {
export type LaxSchemaField = ReturnType<typeof LaxSchemaField>;
export type LaxSchemaEnum = Extract<LaxSchemaField, {
type: 'enum';
}>;
export declare type LaxSchemaColumn = Extract<LaxSchemaField, {
export type LaxSchemaColumn = Extract<LaxSchemaField, {
type: 'int' | 'float' | 'boolean' | 'string' | 'json' | 'datetime' | 'date' | 'uuid';
}>;
export declare type LaxSchemaRelation = Extract<LaxSchemaField, {
export type LaxSchemaRelation = Extract<LaxSchemaField, {
type: 'oneHasOne' | 'oneHasOneInverse' | 'manyHasMany' | 'manyHasManyInverse' | 'oneHasMany' | 'manyHasOne';

@@ -189,3 +189,3 @@ }>;

}>;
export declare type LaxSchemaEntity = ReturnType<typeof LaxSchemaEntity>;
export type LaxSchemaEntity = ReturnType<typeof LaxSchemaEntity>;
export declare const LaxSchema: Typesafe.Type<{

@@ -285,4 +285,4 @@ readonly entities: {

}>;
export declare type LaxSchema = ReturnType<typeof LaxSchema>;
export type LaxSchema = ReturnType<typeof LaxSchema>;
export {};
//# sourceMappingURL=schema.d.ts.map

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

ModelErrorCode["NOT_OWNING_SIDE"] = "notOwningSide";
})(ModelErrorCode = exports.ModelErrorCode || (exports.ModelErrorCode = {}));
})(ModelErrorCode || (exports.ModelErrorCode = ModelErrorCode = {}));
class ModelError extends Error {

@@ -15,0 +15,0 @@ constructor(code, message) {

@@ -1,2 +0,2 @@

export declare type GetForeignKeyConstraintNameArgs = {
export type GetForeignKeyConstraintNameArgs = {
fromTable: string;

@@ -7,7 +7,7 @@ fromColumn: string;

};
export declare type GetUniqueConstraintNameArgs = {
export type GetUniqueConstraintNameArgs = {
tableName: string;
columnNames: string[];
};
export declare type GetIndexNameArgs = {
export type GetIndexNameArgs = {
tableName: string;

@@ -14,0 +14,0 @@ columnNames: string[];

@@ -7,3 +7,5 @@ "use strict";

const normalizeSchema = (schema) => {
var _a, _b;
var _a, _b, _c, _d;
const adminRoleDefinition = (_b = (_a = schema.acl.roles) === null || _a === void 0 ? void 0 : _a[schema_1.ProjectRole.ADMIN]) !== null && _b !== void 0 ? _b : {};
const contentAdminRoleDefinition = (_d = (_c = schema.acl.roles) === null || _c === void 0 ? void 0 : _c[schema_1.ProjectRole.CONTENT_ADMIN]) !== null && _d !== void 0 ? _d : {};
return {

@@ -28,2 +30,3 @@ ...schema,

import: true,
...adminRoleDefinition.content,
},

@@ -33,5 +36,6 @@ system: {

import: true,
...adminRoleDefinition.system,
},
debug: true,
...(((_a = schema.acl.roles) === null || _a === void 0 ? void 0 : _a[schema_1.ProjectRole.ADMIN]) || {}),
...adminRoleDefinition,
},

@@ -51,2 +55,3 @@ [schema_1.ProjectRole.CONTENT_ADMIN]: {

import: true,
...contentAdminRoleDefinition.content,
},

@@ -57,4 +62,5 @@ system: {

import: true,
...contentAdminRoleDefinition.system,
},
...(((_b = schema.acl.roles) === null || _b === void 0 ? void 0 : _b[schema_1.ProjectRole.CONTENT_ADMIN]) || {}),
...contentAdminRoleDefinition,
},

@@ -61,0 +67,0 @@ [schema_1.ProjectRole.DEPLOYER]: {

@@ -34,4 +34,4 @@ "use strict";

const tenantPermissionsSchema = Typesafe.partial({
invite: Typesafe.boolean,
unmanagedInvite: Typesafe.boolean,
invite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
unmanagedInvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
manage: membershipMatchRuleSchema,

@@ -38,0 +38,0 @@ });

@@ -1,7 +0,7 @@

declare type Path = (string | number)[];
declare type CompareError = {
type Path = (string | number)[];
type CompareError = {
path: Path;
message: string;
};
declare type Comparator = (a: unknown, b: unknown) => CompareError[];
type Comparator = (a: unknown, b: unknown) => CompareError[];
export declare const compareArraysIgnoreOrder: (a: unknown, b: unknown, path: Path) => {

@@ -8,0 +8,0 @@ path: Path;

@@ -5,3 +5,3 @@ export declare class Literal {

}
export declare type FormatterPath = ({
export type FormatterPath = ({
type: 'array';

@@ -12,4 +12,4 @@ } | {

})[];
export declare type IndentDecider = (value: any, path: FormatterPath) => boolean;
export type IndentDecider = (value: any, path: FormatterPath) => boolean;
export declare const printJsValue: (value: any, shouldIndentCb?: IndentDecider, path?: FormatterPath) => string;
//# sourceMappingURL=printJsValue.d.ts.map

@@ -1,2 +0,2 @@

export declare type ValidationErrorCode = 'MODEL_NAME_MISMATCH' | 'MODEL_UNDEFINED_FIELD' | 'MODEL_UNDEFINED_ENTITY' | 'MODEL_RELATION_REQUIRED' | 'MODEL_INVALID_RELATION_DEFINITION' | 'MODEL_INVALID_COLUMN_DEFINITION' | 'MODEL_INVALID_VIEW_USAGE' | 'MODEL_INVALID_IDENTIFIER' | 'MODEL_NAME_COLLISION' | 'ACL_INVALID_CONDITION' | 'ACL_UNDEFINED_VARIABLE' | 'ACL_UNDEFINED_FIELD' | 'ACL_UNDEFINED_PREDICATE' | 'ACL_UNDEFINED_ROLE' | 'ACL_UNDEFINED_ENTITY' | 'ACTIONS_NAME_MISMATCH' | 'ACTIONS_INVALID_CONDITION' | 'ACTIONS_UNDEFINED_FIELD' | 'ACTIONS_UNDEFINED_ENTITY' | 'ACTIONS_UNDEFINED_TRIGGER_TARGET' | 'ACTIONS_INVALID_SELECTION' | 'VALIDATION_UNDEFINED_ENTITY' | 'VALIDATION_UNDEFINED_FIELD' | 'VALIDATION_NOT_IMPLEMENTED';
export type ValidationErrorCode = 'MODEL_NAME_MISMATCH' | 'MODEL_UNDEFINED_FIELD' | 'MODEL_UNDEFINED_ENTITY' | 'MODEL_RELATION_REQUIRED' | 'MODEL_INVALID_RELATION_DEFINITION' | 'MODEL_INVALID_COLUMN_DEFINITION' | 'MODEL_INVALID_VIEW_USAGE' | 'MODEL_INVALID_IDENTIFIER' | 'MODEL_NAME_COLLISION' | 'ACL_INVALID_CONDITION' | 'ACL_UNDEFINED_VARIABLE' | 'ACL_UNDEFINED_FIELD' | 'ACL_UNDEFINED_PREDICATE' | 'ACL_UNDEFINED_ROLE' | 'ACL_UNDEFINED_ENTITY' | 'ACTIONS_NAME_MISMATCH' | 'ACTIONS_INVALID_CONDITION' | 'ACTIONS_UNDEFINED_FIELD' | 'ACTIONS_UNDEFINED_ENTITY' | 'ACTIONS_UNDEFINED_TRIGGER_TARGET' | 'ACTIONS_INVALID_SELECTION' | 'VALIDATION_UNDEFINED_ENTITY' | 'VALIDATION_UNDEFINED_FIELD' | 'VALIDATION_NOT_IMPLEMENTED';
export interface ValidationError {

@@ -3,0 +3,0 @@ path: (string | number)[];

@@ -112,3 +112,3 @@ "use strict";

MembershipValidationErrorType["VARIABLE_INVALID"] = "variableInvalid";
})(MembershipValidationErrorType = exports.MembershipValidationErrorType || (exports.MembershipValidationErrorType = {}));
})(MembershipValidationErrorType || (exports.MembershipValidationErrorType = MembershipValidationErrorType = {}));
//# sourceMappingURL=MembershipResolver.js.map

@@ -5,2 +5,3 @@ import { Schema } from '@contember/schema';

code: ValidationErrorCode;
skipUntil?: string;
path?: string;

@@ -7,0 +8,0 @@ }

@@ -14,3 +14,3 @@ "use strict";

exports.categoryEditorVariable = schema_definition_1.AclDefinition.createEntityVariable('category', 'Category', exports.editorRole);
let Article = class Article {
let Article = exports.Article = class Article {
constructor() {

@@ -22,3 +22,3 @@ this.title = schema_definition_1.SchemaDefinition.stringColumn();

};
Article = __decorate([
exports.Article = Article = __decorate([
schema_definition_1.AclDefinition.allow(exports.readerRole, {

@@ -34,4 +34,3 @@ read: true,

], Article);
exports.Article = Article;
let Category = class Category {
let Category = exports.Category = class Category {
constructor() {

@@ -41,3 +40,3 @@ this.name = schema_definition_1.SchemaDefinition.stringColumn();

};
Category = __decorate([
exports.Category = Category = __decorate([
schema_definition_1.AclDefinition.allow(exports.readerRole, {

@@ -50,3 +49,2 @@ read: true,

], Category);
exports.Category = Category;
//# sourceMappingURL=acl.js.map

@@ -11,3 +11,3 @@ "use strict";

const schema_definition_1 = require("@contember/schema-definition");
let Article = class Article {
let Article = exports.Article = class Article {
constructor() {

@@ -17,6 +17,5 @@ this.title = schema_definition_1.SchemaDefinition.stringColumn();

};
Article = __decorate([
exports.Article = Article = __decorate([
schema_definition_1.SchemaDefinition.Unique('title')
], Article);
exports.Article = Article;
//# sourceMappingURL=unique.js.map
{
"name": "@contember/schema-utils",
"version": "1.3.0-alpha.13",
"version": "1.3.0-beta.1",
"license": "Apache-2.0",

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

"scripts": {
"test": "vitest"
"test": "vitest --dir ./tests/cases"
},
"dependencies": {
"@contember/schema": "1.3.0-alpha.13",
"@contember/typesafe": "1.3.0-alpha.13"
"@contember/schema": "1.3.0-beta.1",
"@contember/typesafe": "1.3.0-beta.1"
},
"devDependencies": {
"@contember/schema-definition": "1.3.0-alpha.13",
"@contember/schema-definition": "1.3.0-beta.1",
"@types/node": "^18"
}
}

@@ -5,2 +5,5 @@ import { Acl, ProjectRole, Schema } from '@contember/schema'

export const normalizeSchema = <S extends Schema>(schema: S): S => {
const adminRoleDefinition: Partial<Acl.RolePermissions> = schema.acl.roles?.[ProjectRole.ADMIN] ?? {}
const contentAdminRoleDefinition: Partial<Acl.RolePermissions> = schema.acl.roles?.[ProjectRole.CONTENT_ADMIN] ?? {}
return {

@@ -25,2 +28,3 @@ ...schema,

import: true,
...adminRoleDefinition.content,
},

@@ -30,5 +34,6 @@ system: {

import: true,
...adminRoleDefinition.system,
},
debug: true,
...((schema.acl.roles?.[ProjectRole.ADMIN] as Acl.RolePermissions | undefined) || {}),
...adminRoleDefinition,
},

@@ -48,2 +53,3 @@ [ProjectRole.CONTENT_ADMIN]: {

import: true,
...contentAdminRoleDefinition.content,
},

@@ -54,4 +60,5 @@ system: {

import: true,
...contentAdminRoleDefinition.system,
},
...((schema.acl.roles?.[ProjectRole.CONTENT_ADMIN] as Acl.RolePermissions | undefined) || {}),
...contentAdminRoleDefinition,
},

@@ -58,0 +65,0 @@ [ProjectRole.DEPLOYER]: {

@@ -22,4 +22,4 @@ import { Acl, Model } from '@contember/schema'

const tenantPermissionsSchema = Typesafe.partial({
invite: Typesafe.boolean,
unmanagedInvite: Typesafe.boolean,
invite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
unmanagedInvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
manage: membershipMatchRuleSchema,

@@ -26,0 +26,0 @@ })

@@ -10,2 +10,3 @@ import { Schema } from '@contember/schema'

code: ValidationErrorCode
skipUntil?: string
path?: string

@@ -12,0 +13,0 @@ }

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

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