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.1.9-leo-ron-1097-experimental-44 to 0.1.9-leo-ron-1097-experimental-45

dist/queries-CWtJe_zj.d.ts

106

dist/queries.d.ts

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

import { AsyncLocalStorage } from 'node:async_hooks';
import { Q as Query } from './index.d-CMkIzj0q.js';
declare const setProperty: <T extends object, K>(obj: T, path: string, value: K) => T;
/**
* Gets the property value of an object based on the given path segments
* of the property.
*
* @param obj - The object to get the property value from.
* @param pathSegments - An array of property keys leading up to the final
* property at the end.
*
* @returns The property value at the specified path or `undefined` if the path
* does not exist.
*
* @example
* const exampleObject = \{
* user: \{
* name: \{
* first: 'John',
* last: 'Doe'
* \},
* age: 30
* \}
* \};
* console.log(getProperty(exampleObject, ['user', 'name', 'first'])); // Output: 'John'
* console.log(getProperty(exampleObject, ['user', 'age'])); // Output: 30
* console.log(getProperty(exampleObject, ['user', 'non', 'existing'])); // Output: undefined
*/
declare const getProperty: (obj: object, path: string) => unknown;
/**
* Utility type to convert a tuple of promises into a tuple of their resolved types.
*/
type PromiseTuple<T extends [Promise<any>, ...Array<Promise<any>>] | Array<Promise<any>>> = {
[P in keyof T]: Awaited<T[P]>;
};
/**
* Utility type that represents a particular query and any options that should
* be used when executing it.
*/
interface SyntaxItem<Structure = unknown> {
structure: Structure;
options?: Record<string, unknown>;
}
/**
* A list of options that may be passed for every individual query. The type is meant to
* represent a generic list of options without specific properties. The specific
* properties are defined by the client that re-exports the syntax package.
*/
type QueryOptions = Record<string, unknown> & {
asyncContext?: AsyncLocalStorage<any>;
};
/**
* A utility function that creates a proxy object to handle dynamic property access and
* function calls, which is used to compose the query and schema syntax.
*
* @param config - An object containing configuration for the composed structure.
*
* @returns A proxy object that intercepts property access and function calls.
*
* ### Usage
* ```typescript
* const get = getSyntaxProxy({
* rootProperty: 'get',
* // Execute the query and return the result
* callback: async (query) => {}
* });
*
* const result = await get.account();
*
* const result = await get.account.with.email('mike@gmail.com');
* ```
*/
declare const getSyntaxProxy: (config?: {
rootProperty?: string;
callback?: (query: Query, options?: Record<string, unknown>) => Promise<any> | any;
propertyValue?: unknown;
}) => any;
/**
* Executes a batch of operations and handles their results. It is used to
* execute multiple queries at once and return their results at once.
*
* @param operations - A function that returns an array of Promises. Each
* Promise should resolve with a Query object.
* @param queriesHandler - A function that handles the execution of the queries.
* This function is expected to receive an array of Query objects and return a
* Promise that resolves with the results of the queries.
*
* @returns A Promise that resolves with a tuple of the results of the queries.
*
* ### Usage
* ```typescript
* const results = await batch(() => [
* get.accounts(),
* get.account.with.email('mike@gmail.com')
* ], async (queries) => {
* // Execute the queries and return their results
* });
* ```
*/
declare const getBatchProxy: <T extends [Promise<any> | any, ...Array<Promise<any> | any>] | (Promise<any> | any)[]>(operations: () => T, options: QueryOptions | undefined, queriesHandler: (queries: Array<SyntaxItem<Query>>, options?: QueryOptions) => Promise<any> | any) => Promise<PromiseTuple<T>> | T;
export { type PromiseTuple, type SyntaxItem, getBatchProxy, getProperty, getSyntaxProxy, setProperty };
import 'node:async_hooks';
export { c as PromiseTuple, S as SyntaxItem, d as getBatchProxy, e as getProperty, g as getSyntaxProxy, s as setProperty } from './queries-CWtJe_zj.js';

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

import { P as PublicModel, G as GetInstructions, W as WithInstruction, M as ModelIndex, a as ModelField, b as ModelTrigger } from './index.d-CMkIzj0q.js';
import { P as PublicModel, G as GetInstructions, W as WithInstruction, M as ModelIndex, a as ModelField, b as ModelTrigger, S as SyntaxItem } from './queries-CWtJe_zj.js';
import 'node:async_hooks';

@@ -89,5 +90,6 @@ interface RoninFields {

} : {});
type FieldOutput<T extends ModelField['type']> = Omit<Extract<ModelField, {
type: T;
type FieldOutput<Type extends ModelField['type']> = Omit<Extract<ModelField, {
type: Type;
}>, 'slug'>;
type SyntaxField<Type extends ModelField['type']> = SyntaxItem<FieldOutput<Type>>;
/**

@@ -291,2 +293,2 @@ * Creates a string field definition returning an object that includes the field type

export { type FieldOutput, blob, boolean, date, json, link, model, number, string };
export { type SyntaxField, blob, boolean, date, json, link, model, number, string };
{
"name": "@ronin/syntax",
"version": "0.1.9-leo-ron-1097-experimental-44",
"version": "0.1.9-leo-ron-1097-experimental-45",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Allows for defining RONIN queries and schemas 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