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

@ronin/schema

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ronin/schema - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

7

dist/index.d.ts

@@ -8,3 +8,6 @@ import { Model as Model$1, ModelIndex, ModelField, ModelTrigger } from '@ronin/compiler';

}
type Primitives = ReturnType<typeof link> | ReturnType<typeof string> | ReturnType<typeof boolean> | ReturnType<typeof number> | ReturnType<typeof json> | ReturnType<typeof date> | ReturnType<typeof blob>;
type Primitives = ReturnType<typeof link> | ReturnType<typeof string> | ReturnType<typeof boolean> | ReturnType<typeof number> | ReturnType<typeof json> | ReturnType<typeof date> | ReturnType<typeof blob> | NestedFields;
interface NestedFields {
[key: string]: Primitives;
}
interface Model<Fields> extends Omit<Model$1, 'fields' | 'indexes' | 'triggers' | 'presets'> {

@@ -57,3 +60,3 @@ fields?: Fields;

type FieldsToTypes<F> = F extends Record<string, Primitives> ? {
[K in keyof F]: F[K]['type'] extends 'string' ? string : F[K]['type'] extends 'number' ? number : F[K]['type'] extends 'boolean' ? boolean : F[K]['type'] extends 'link' ? string : F[K]['type'] extends 'json' ? object : F[K]['type'] extends 'blob' ? Blob : F[K]['type'] extends 'date' ? Date : never;
[K in keyof F]: F[K] extends Record<string, Primitives> ? FieldsToTypes<F[K]> : F[K]['type'] extends 'string' ? string : F[K]['type'] extends 'number' ? number : F[K]['type'] extends 'boolean' ? boolean : F[K]['type'] extends 'link' ? string : F[K]['type'] extends 'json' ? object : F[K]['type'] extends 'blob' ? Blob : F[K]['type'] extends 'date' ? Date : never;
} : RoninFields;

@@ -60,0 +63,0 @@ type ForbiddenKeys = 'id' | 'ronin' | 'ronin.updatedAt' | 'ronin.createdBy' | 'ronin.updatedBy' | 'ronin.createdAt' | 'ronin.locked';

@@ -80,17 +80,27 @@ // src/model/primitives/blob.ts

var serializeFields = (fields) => {
return Object.entries(fields ?? {}).map(([key, value]) => {
const { type, unique, defaultValue, required, name } = value;
const { actions, model: model2 } = value;
return {
slug: key,
name,
unique: unique ?? false,
required: required ?? false,
defaultValue,
type,
// @ts-expect-error: The `target` property exists in the model.
target: model2?.slug,
actions
};
});
return Object.entries(fields ?? {}).flatMap(
([key, value]) => {
if (!("type" in value)) {
const result = {};
for (const k of Object.keys(value)) {
result[`${key}.${k}`] = value[k];
}
return serializeFields(result);
}
const { type, unique, defaultValue, required, name } = value;
const { actions, model: model2 } = value;
return {
slug: key,
name,
unique: unique ?? false,
required: required ?? false,
defaultValue,
// @ts-expect-error: The `type` property exists in the model.
type,
// @ts-expect-error: The `target` property exists in the model.
target: model2?.slug,
actions
};
}
);
};

@@ -97,0 +107,0 @@ var serializePresets = (presets) => {

{
"name": "@ronin/schema",
"version": "0.1.2",
"version": "0.1.3",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Allows for defining the schema of a RONIN database in code.",

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