Comparing version 2.0.0-beta.19 to 2.0.0-beta.20
@@ -1,6 +0,5 @@ | ||
import { type Segments } from './types'; | ||
import { Doc } from './Doc'; | ||
import { RootModel } from './Model'; | ||
import { JSONObject } from 'sharedb/lib/sharedb'; | ||
import { Path, ReadonlyDeep, ShallowCopiedValue } from '../types'; | ||
import type { Path, ReadonlyDeep, ShallowCopiedValue, Segments } from '../types'; | ||
export declare class ModelCollections { | ||
@@ -7,0 +6,0 @@ docs: Record<string, any>; |
@@ -22,3 +22,3 @@ /** | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/data-loading-contexts | ||
* @see https://derbyjs.github.io/derby/models/contexts | ||
*/ | ||
@@ -33,3 +33,3 @@ context(contextId: string): ChildModel<T>; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/data-loading-contexts | ||
* @see https://derbyjs.github.io/derby/models/contexts | ||
*/ | ||
@@ -40,3 +40,3 @@ unload(contextId?: string): void; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/data-loading-contexts | ||
* @see https://derbyjs.github.io/derby/models/contexts | ||
*/ | ||
@@ -43,0 +43,0 @@ unloadAll(): void; |
@@ -1,2 +0,2 @@ | ||
import { type Segments } from './types'; | ||
import { type Segments } from '../types'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Construct a tree root when invoked without any arguments. Children nodes are |
@@ -1,2 +0,2 @@ | ||
import { type Segments } from './types'; | ||
import { type Segments } from '../types'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Construct a tree root when invoked without any arguments. Children nodes are |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { EventListenerTree } from './EventListenerTree'; | ||
import { type Segments } from './types'; | ||
import type { Path, PathLike } from '../types'; | ||
import type { Path, PathLike, Segments } from '../types'; | ||
export type ModelEvent = ChangeEvent | InsertEvent | RemoveEvent | MoveEvent | LoadEvent | UnloadEvent; | ||
@@ -61,3 +60,3 @@ export interface ModelOnEventMap { | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/events | ||
* @see https://derbyjs.github.io/derby/models/events | ||
*/ | ||
@@ -79,3 +78,3 @@ on<T extends keyof ModelOnEventMap>(eventType: T, pathPattern: PathLike, options: { | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/components/events | ||
* @see https://derbyjs.github.io/derby/components/events | ||
*/ | ||
@@ -82,0 +81,0 @@ once<T extends keyof ModelOnEventMap>(eventType: T, pathPattern: string, options: { |
import { Model } from './Model'; | ||
import { type Segments } from './types'; | ||
import type { Path, PathLike } from '../types'; | ||
import type { Path, PathLike, Segments } from '../types'; | ||
interface PaginationOptions { | ||
@@ -10,3 +9,3 @@ skip?: number; | ||
[key: string]: S; | ||
}) => boolean) | null; | ||
}) => boolean) | string | null; | ||
type SortFn<S> = (a: S, B: S) => number; | ||
@@ -29,8 +28,8 @@ declare module './Model' { | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/filters-and-sorts | ||
* @see https://derbyjs.github.io/derby/models/filters-sorts | ||
*/ | ||
filter<S>(inputPath: PathLike, additionalInputPaths: PathLike[], options: PaginationOptions, fn?: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, additionalInputPaths: PathLike[], fn?: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, options: PaginationOptions, fn?: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, fn?: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, additionalInputPaths: PathLike[], options: PaginationOptions, fn: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, additionalInputPaths: PathLike[], fn: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, options: PaginationOptions, fn: FilterFn<S>): Filter<S>; | ||
filter<S>(inputPath: PathLike, fn: FilterFn<S>): Filter<S>; | ||
removeAllFilters: (subpath: Path) => void; | ||
@@ -50,3 +49,3 @@ /** | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/filters-and-sorts | ||
* @see https://derbyjs.github.io/derby/models/filters-sorts | ||
*/ | ||
@@ -53,0 +52,0 @@ sort<S>(inputPath: PathLike, additionalInputPaths: PathLike[], options: PaginationOptions, fn: SortFn<S>): Filter<S>; |
@@ -24,24 +24,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
function parseFilterArguments(model, args) { | ||
var fn, options, inputPaths; | ||
// first arg always path | ||
var fn = args.pop(); | ||
var options, inputPaths; | ||
var path = model.path(args.shift()); | ||
if (!args.length) { | ||
return { | ||
path: path, | ||
inputPaths: null, | ||
options: options, | ||
fn: function () { return true; }, | ||
}; | ||
} | ||
var last = args[args.length - 1]; | ||
if (typeof last === 'function') { | ||
// fn null if optional | ||
// filter can be string | ||
fn = args.pop(); | ||
} | ||
if (args.length && fn == null) { | ||
// named function | ||
fn = args.pop(); | ||
} | ||
last = args[args.length - 1]; | ||
if (!model.isPath(last) && !Array.isArray(last)) { | ||
@@ -48,0 +30,0 @@ options = args.pop(); |
@@ -1,6 +0,5 @@ | ||
import { type Segments } from './types'; | ||
import { Model } from './Model'; | ||
import { EventListenerTree } from './EventListenerTree'; | ||
import { EventMapTree } from './EventMapTree'; | ||
import type { Path, PathLike, ReadonlyDeep } from '../types'; | ||
import type { Path, PathLike, ReadonlyDeep, Segments } from '../types'; | ||
declare class NamedFns { | ||
@@ -68,3 +67,3 @@ } | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/reactive-functions | ||
* @see https://derbyjs.github.io/derby/models/reactive-functions | ||
*/ | ||
@@ -103,3 +102,3 @@ evaluate<Out, Ins extends StartFnParam[]>(inputPaths: PathLike[], options: ModelStartOptions, fn: (...inputs: Ins) => Out): Out; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/reactive-functions | ||
* @see https://derbyjs.github.io/derby/models/reactive-functions | ||
*/ | ||
@@ -106,0 +105,0 @@ start<Out, Ins extends StartFnParam[]>(outputPath: PathLike, inputPaths: PathLike[], options: ModelStartOptions, fn: ModelFn<Ins, Out> | string): Out; |
@@ -1,3 +0,2 @@ | ||
import type { Callback, Path, ArrayItemType } from '../types'; | ||
import { type Segments } from './types'; | ||
import type { Callback, Path, ArrayItemType, Segments } from '../types'; | ||
declare module './Model' { | ||
@@ -52,4 +51,4 @@ interface Model<T> { | ||
increment(subpath: Path, value?: number, cb?: ErrorCallback): number; | ||
incrementPromised(value?: number): Promise<number>; | ||
incrementPromised(subpath: Path, value?: number): Promise<number>; | ||
incrementPromised(value?: number): Promise<void>; | ||
incrementPromised(subpath: Path, value?: number): Promise<void>; | ||
_increment(segments: Segments, value: number, cb?: ErrorCallback): number; | ||
@@ -65,4 +64,4 @@ /** | ||
push(subpath: Path, value: any, cb?: ErrorCallback): number; | ||
pushPromised(value: any): Promise<number>; | ||
pushPromised(subpath: Path, value: any): Promise<number>; | ||
pushPromised(value: any): Promise<void>; | ||
pushPromised(subpath: Path, value: any): Promise<void>; | ||
_push(segments: Segments, value: any, cb?: ErrorCallback): number; | ||
@@ -69,0 +68,0 @@ unshift(value: any): void; |
@@ -153,3 +153,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var segments = this._splitPath(subpath); | ||
return this._create(segments, value, cb); | ||
this._create(segments, value, cb); | ||
}; | ||
@@ -175,3 +175,3 @@ Model_1.Model.prototype.createPromised = promisify(Model_1.Model.prototype.create); | ||
} | ||
return this._mutate(segments, create, cb); | ||
this._mutate(segments, create, cb); | ||
}; | ||
@@ -208,3 +208,3 @@ Model_1.Model.prototype.createNull = function () { | ||
var segments = this._splitPath(subpath); | ||
return this._createNull(segments, value, cb); | ||
this._createNull(segments, value, cb); | ||
}; | ||
@@ -217,3 +217,3 @@ Model_1.Model.prototype.createNullPromised = promisify(Model_1.Model.prototype.createNull); | ||
return; | ||
return this._create(segments, value, cb); | ||
this._create(segments, value, cb); | ||
}; | ||
@@ -220,0 +220,0 @@ Model_1.Model.prototype.add = function () { |
import { type Context } from './contexts'; | ||
import { type Segments } from './types'; | ||
import { type Segments } from '../types'; | ||
import { ChildModel, ErrorCallback, Model } from './Model'; | ||
@@ -50,3 +50,3 @@ import { CollectionMap } from './CollectionMap'; | ||
destroy(): void; | ||
fetch(cb: ErrorCallback): this; | ||
fetch(cb?: ErrorCallback): this; | ||
fetchPromised: any; | ||
@@ -53,0 +53,0 @@ subscribe(cb?: ErrorCallback): this; |
import { EventListenerTree } from './EventListenerTree'; | ||
import { EventMapTree } from './EventMapTree'; | ||
import { Model } from './Model'; | ||
import { type Segments } from './types'; | ||
import { type Filter } from './filter'; | ||
import { type Query } from './Query'; | ||
import type { Path, PathLike } from '../types'; | ||
import type { Path, PathLike, Segments } from '../types'; | ||
type Refable = string | number | Model<any> | Query | Filter<unknown>; | ||
@@ -30,3 +29,3 @@ export interface RefOptions { | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/references | ||
* @see https://derbyjs.github.io/derby/models/refs | ||
*/ | ||
@@ -47,3 +46,3 @@ refList<S>(outputPath: PathLike, collectionPath: PathLike, idsPath: PathLike, options?: { | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/references | ||
* @see https://derbyjs.github.io/derby/models/refs | ||
*/ | ||
@@ -58,3 +57,3 @@ ref<S>(to: PathLike): ChildModel<S>; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/references | ||
* @see https://derbyjs.github.io/derby/models/refs | ||
*/ | ||
@@ -61,0 +60,0 @@ removeRef(path: PathLike): void; |
import { Callback, Path, ReadonlyDeep } from '../types'; | ||
import { type Segments } from './types'; | ||
import { type Segments } from '../types'; | ||
declare module './Model' { | ||
@@ -4,0 +4,0 @@ interface Model<T> { |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var util = require('../util'); | ||
var util = require("../util"); | ||
var Model_1 = require("./Model"); | ||
@@ -4,0 +4,0 @@ var arrayDiff = require('arraydiff'); |
@@ -16,3 +16,3 @@ import { Model } from './Model'; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/backends#loading-data-into-a-model | ||
* @see https://derbyjs.github.io/derby/models/backends#loading-data-into-a-model | ||
*/ | ||
@@ -38,3 +38,3 @@ fetch(items: Subscribable[], cb?: ErrorCallback): Model<T>; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/backends#loading-data-into-a-model | ||
* @see https://derbyjs.github.io/derby/models/backends#loading-data-into-a-model | ||
*/ | ||
@@ -56,3 +56,3 @@ subscribe(items: Subscribable[], cb?: ErrorCallback): Model<T>; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/backends#loading-data-into-a-model | ||
* @see https://derbyjs.github.io/derby/models/backends#loading-data-into-a-model | ||
*/ | ||
@@ -75,3 +75,3 @@ unfetch(items: Subscribable[], cb?: ErrorCallback): Model<T>; | ||
* | ||
* @see https://derbyjs.com/docs/derby-0.10/models/backends#loading-data-into-a-model | ||
* @see https://derbyjs.github.io/derby/models/backends#loading-data-into-a-model | ||
*/ | ||
@@ -78,0 +78,0 @@ unsubscribe(items: Subscribable[], cb?: ErrorCallback): Model<T>; |
@@ -6,2 +6,3 @@ import { Model } from "./Model"; | ||
export type PathLike = Path | Model<any>; | ||
export type Segments = Array<Path>; | ||
export type Primitive = boolean | number | string | null | undefined; | ||
@@ -8,0 +9,0 @@ /** If `T` is an array, produces the type of the array items. */ |
export declare const deepEqual: any; | ||
export declare const isServer: boolean; | ||
export declare function asyncGroup(cb: any): () => (err: any) => void; | ||
export declare function asyncGroup(cb: any): () => (err?: Error) => void; | ||
export declare function castSegments(segments: Readonly<string | string[]>): any; | ||
@@ -5,0 +5,0 @@ export declare function contains(segments: any, testSegments: any): boolean; |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "2.0.0-beta.19", | ||
"version": "2.0.0-beta.20", | ||
"main": "./lib/index.js", | ||
@@ -15,0 +15,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309838
8285