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

@ronin/syntax

Package Overview
Dependencies
Maintainers
0
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ronin/syntax - npm Package Compare versions

Comparing version 0.2.5-corny-ron-1099-experimental-64 to 0.2.5-leo-ron-1099-experimental-65

dist/chunk-NWNBS5JL.js

2

dist/queries.d.ts

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

export { c as PromiseTuple, S as SyntaxItem, d as getBatchProxy, e as getProperty, g as getSyntaxProxy, s as setProperty } from './queries-hEG0GOi0.js';
export { P as PromiseTuple, S as SyntaxItem, a as getBatchProxy, b as getProperty, g as getSyntaxProxy, s as setProperty } from './index-BdksbSXk.js';

@@ -6,3 +6,3 @@ import {

setProperty
} from "./chunk-W5GO56GM.js";
} from "./chunk-NWNBS5JL.js";
export {

@@ -9,0 +9,0 @@ getBatchProxy,

@@ -1,168 +0,1 @@

import { P as PublicModel, M as ModelIndex, a as ModelField, b as ModelTrigger, G as GetInstructions, W as WithInstruction, S as SyntaxItem } from './queries-hEG0GOi0.js';
interface RoninFields {
/**
* The unique identifier for this record.
*/
id: string;
/**
* Contains metadata about the record like creation date, last update, etc.
*/
ronin: string;
}
type Primitives = ReturnType<typeof link> | ReturnType<typeof string> | ReturnType<typeof boolean> | ReturnType<typeof number> | ReturnType<typeof json> | ReturnType<typeof date> | ReturnType<typeof blob> | Chain<FieldOutput<'string' | 'number' | 'boolean' | 'link' | 'json' | 'date' | 'blob'>, 'name' | 'displayAs' | 'unique' | 'required' | 'defaultValue' | 'computedAs' | 'check'> | NestedFieldsPrimitives;
interface NestedFieldsPrimitives {
[key: string]: Primitives;
}
interface Model<Fields> extends Omit<PublicModel, 'fields' | 'indexes' | 'triggers' | 'presets'> {
/**
* The fields that make up this model.
*/
fields?: Fields;
/**
* Database indexes to optimize query performance.
*/
indexes?: Array<ModelIndex<Array<ModelField & {
slug: keyof Fields;
}>>>;
/**
* Queries that run automatically in response to other queries.
*/
triggers?: Array<ModelTrigger<Array<ModelField & {
slug: keyof Fields;
}>>>;
/**
* Predefined query instructions that can be reused across multiple different queries.
*/
presets?: Record<string, GetInstructions | WithInstruction>;
}
type FieldsToTypes<F> = F extends Record<string, Primitives> ? {
[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;
type ForbiddenKeys = 'id' | 'ronin' | 'ronin.updatedAt' | 'ronin.createdBy' | 'ronin.updatedBy' | 'ronin.createdAt' | 'ronin.locked';
type RecordWithoutForbiddenKeys<V> = {
[K in Exclude<string, ForbiddenKeys>]: V;
} & {
[K in ForbiddenKeys]?: never;
};
type Expand<T> = T extends infer O ? {
[K in keyof O]: O[K];
} : never;
/**
* Generates a model definition and adds default fields to the provided model.
*
* @example
* ```ts
* const Account = model({
* slug: 'account',
* pluralSlug: 'accounts',
* fields: {
* name: string()
* },
* });
* ```
*
* @template T - A generic type representing the model structure, which contains a slug
* and fields.
* @param model - An object containing the slug and fields of the model.
*
* @returns The generated model definition.
*/
declare const model: <Fields extends RecordWithoutForbiddenKeys<Primitives>>(model: Model<Fields>) => Expand<FieldsToTypes<Fields>> & Expand<RoninFields>;
type ModelFieldExpression = Omit<ModelField, 'check' | 'computedAs' | 'defaultValue'> & {
check?: (fields: Record<string, string>) => string;
computedAs?: {
kind: 'VIRTUAL' | 'STORED';
value: (fields: Record<string, string>) => string;
};
defaultValue?: (fields: Record<string, string>) => string;
};
/** A utility type that maps an attribute's type to a function signature. */
type AttributeSignature<T, Attribute> = T extends boolean ? () => any : Attribute extends keyof Omit<ModelFieldExpression, 'type' | 'slug'> ? (value: ModelFieldExpression[Attribute]) => any : never;
/**
* Represents a chain of field attributes in the form of a function chain.
*
* - `Attrs`: The interface describing your attributes (e.g., { required: boolean; }).
* - `Used`: A union of the keys already used in the chain.
*
* For each attribute key `K` not in `Used`, create a method using the signature derived
* from that attribute's type. Calling it returns a new `Chain` marking `K` as used.
*/
type Chain<Attrs, Used extends keyof Attrs = never> = {
[K in Exclude<keyof Attrs, Used | 'type'>]: (...args: Parameters<AttributeSignature<Attrs[K], K>>) => Chain<Attrs, Used | K>;
} & ('type' extends keyof Attrs ? {
readonly type: Attrs['type'];
} : {});
type FieldInput<Type> = Partial<Omit<Extract<ModelFieldExpression, {
type: Type;
}>, 'slug' | 'type'>>;
type FieldOutput<Type extends ModelFieldExpression['type']> = Omit<Extract<ModelFieldExpression, {
type: Type;
}>, 'slug'>;
type SyntaxField<Type extends ModelFieldExpression['type']> = SyntaxItem<FieldOutput<Type>>;
/**
* Creates a string field definition returning an object that includes the field type
* ("string") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "string" with the specified attributes.
*/
declare const string: (initialAttributes?: FieldInput<"string">) => Chain<FieldOutput<"string">>;
/**
* Creates a number field definition returning an object that includes the field type
* ("number") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "number" with the specified attributes.
*/
declare const number: (initialAttributes?: FieldInput<"number">) => Chain<FieldOutput<"number">>;
/**
* Creates a link field definition returning an object that includes the field type
* ("link") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "link" with the specified attributes.
*/
declare const link: (initialAttributes?: FieldInput<"link">) => Chain<FieldOutput<"link">>;
/**
* Creates a JSON field definition returning an object that includes the field type
* ("json") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "json" with the specified attributes.
*/
declare const json: (initialAttributes?: FieldInput<"json">) => Chain<FieldOutput<"json">>;
/**
* Creates a date field definition returning an object that includes the field type
* ("date") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "date" with the specified attributes.
*/
declare const date: (initialAttributes?: FieldInput<"date">) => Chain<FieldOutput<"date">>;
/**
* Creates a boolean field definition returning an object that includes the field type
* ("boolean") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "boolean" with the specified attributes.
*/
declare const boolean: (initialAttributes?: FieldInput<"boolean">) => Chain<FieldOutput<"boolean">>;
/**
* Creates a blob field definition returning an object that includes the field type
* ("blob") and attributes.
*
* @param attributes - Optional field attributes.
*
* @returns A field of type "blob" with the specified attributes.
*/
declare const blob: (initialAttributes?: FieldInput<"blob">) => Chain<FieldOutput<"blob">>;
export { type Chain, type FieldOutput, type ModelFieldExpression, type SyntaxField, blob, boolean, date, json, link, model, number, string };
export { c as SyntaxField, h as blob, f as boolean, e as date, j as json, l as link, m as model, n as number, d as string } from './index-BdksbSXk.js';

@@ -10,3 +10,3 @@ import {

string
} from "./chunk-W5GO56GM.js";
} from "./chunk-NWNBS5JL.js";
export {

@@ -13,0 +13,0 @@ blob,

{
"name": "@ronin/syntax",
"version": "0.2.5-corny-ron-1099-experimental-64",
"version": "0.2.5-leo-ron-1099-experimental-65",
"type": "module",

@@ -44,4 +44,4 @@ "description": "Allows for defining RONIN queries and schemas in code.",

"@biomejs/biome": "1.9.4",
"@ronin/compiler": "0.14.6",
"@types/bun": "1.1.16",
"@ronin/compiler": "0.14.9",
"@types/bun": "1.1.18",
"tsup": "8.3.5",

@@ -48,0 +48,0 @@ "typescript": "5.7.3"

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