🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@odda-studio/cms-models

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@odda-studio/cms-models - npm Package Compare versions

Comparing version
1.0.24
to
1.0.25
+13
-0
model.d.ts

@@ -593,3 +593,16 @@ import { ColumnType } from './column-type';

export declare const toEntitySchemaColumnOptions: (schema: EntitySchemaColumnOptions) => EntitySchemaColumnOptions;
export declare const NumberTypes: {};
/**
* Column types where spatial properties are used.
*/
export declare type SpatialColumnType = [
'geometry',
'geography',
'st_geometry',
'st_point'
];
export declare const DatesType: {};
export declare const StringTypes: {};
export declare const AnyTypes: {};
export declare const toApiField: (schema: EntitySchemaColumnOptions) => EntitySchemaColumnOptions;
export {};
+200
-1
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toApiField = exports.toEntitySchemaColumnOptions = exports.toEntitySchemaConfiguration = void 0;
exports.toApiField = exports.AnyTypes = exports.StringTypes = exports.DatesType = exports.NumberTypes = exports.toEntitySchemaColumnOptions = exports.toEntitySchemaConfiguration = void 0;
const toEntitySchemaConfiguration = (schema) => {

@@ -46,2 +46,184 @@ const keys = [

exports.toEntitySchemaColumnOptions = toEntitySchemaColumnOptions;
const numberTypes = [
'int',
'int2',
'int4',
'int8',
'integer',
'tinyint',
'smallint',
'mediumint',
'bigint',
'dec',
'decimal',
'smalldecimal',
'fixed',
'numeric',
'number',
'float',
'double',
'dec',
'decimal',
'smalldecimal',
'fixed',
'numeric',
'real',
'double precision',
'number',
'tinyint',
'smallint',
'mediumint',
'int',
'bigint',
'float',
'float4',
'float8',
'float64',
'int2',
'integer',
'int4',
'int8',
'int64',
'unsigned big int',
];
exports.NumberTypes = numberTypes.reduce((dict, k) => {
dict[k] = Number;
return dict;
}, {});
/**
* Column types where precision and scale properties are used.
*/
const dates = [
'datetime',
'datetime2',
'datetimeoffset',
'time',
'time with time zone',
'time without time zone',
'timestamp',
'timestamp without time zone',
'timestamp with time zone',
'timestamp with local time zone',
];
exports.DatesType = dates.reduce((dict, k) => {
dict[k] = Date;
return dict;
}, {});
/**
* Column types where column length is used.
*/
const strings = [
'character varying',
'varying character',
'char varying',
'nvarchar',
'national varchar',
'character',
'native character',
'varchar',
'char',
'nchar',
'national char',
'varchar2',
'nvarchar2',
'alphanum',
'shorttext',
'raw',
'binary',
'varbinary',
'string',
];
exports.StringTypes = strings.reduce((dict, k) => {
dict[k] = Date;
return dict;
}, {});
const unknowns = [
'simple-array',
'simple-json',
'simple-enum',
'smallmoney',
'money',
'tinyblob',
'tinytext',
'mediumblob',
'mediumtext',
'blob',
'text',
'ntext',
'citext',
'hstore',
'longblob',
'longtext',
'alphanum',
'shorttext',
'bytes',
'bytea',
'long',
'raw',
'long raw',
'bfile',
'clob',
'nclob',
'image',
'timetz',
'timestamptz',
'timestamp with local time zone',
'smalldatetime',
'date',
'interval year to month',
'interval day to second',
'interval',
'year',
'seconddate',
'point',
'line',
'lseg',
'box',
'circle',
'path',
'polygon',
'geography',
'geometry',
'linestring',
'multipoint',
'multilinestring',
'multipolygon',
'geometrycollection',
'st_geometry',
'st_point',
'int4range',
'int8range',
'numrange',
'tsrange',
'tstzrange',
'daterange',
'enum',
'set',
'cidr',
'inet',
'macaddr',
'bit',
'bit varying',
'varbit',
'tsvector',
'tsquery',
'uuid',
'xml',
'json',
'jsonb',
'varbinary',
'hierarchyid',
'sql_variant',
'rowid',
'urowid',
'uniqueidentifier',
'rowversion',
'array',
'cube',
'ltree',
];
exports.AnyTypes = unknowns.reduce((dict, k) => {
dict[k] = Object;
return dict;
}, {});
const toApiField = (schema) => {

@@ -73,4 +255,21 @@ const res = {};

});
const mappedTypes = {
date: Date,
Date: Date,
string: String,
decimal: Number,
bool: Boolean,
boolean: Boolean,
Boolean: Boolean,
};
const type = res.type;
res.type =
mappedTypes[res.type] ||
exports.AnyTypes[res.type] ||
exports.NumberTypes[res.type] ||
exports.StringTypes[res.type] ||
exports.DatesType[res.type] ||
type;
return res;
};
exports.toApiField = toApiField;
+1
-1
{
"name": "@odda-studio/cms-models",
"version": "1.0.24",
"version": "1.0.25",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",