breeze-client / breeze
Variable: breeze
constbreeze:object
Defined in: src/breeze.ts:161
Every class, enum and helper of the Breeze 2.x API in one object - the breeze that 2.x code imports or finds as a global. Kept so that code written against 2.x runs unchanged. New code imports what it uses by name, which lets a bundler leave out the rest.
Type Declaration
AbstractDataServiceAdapter
AbstractDataServiceAdapter: typeof
AbstractDataServiceAdapter
The base class of Breeze's data service adapters, for anyone writing one. The same as the AbstractDataServiceAdapter export.
assertConfig
assertConfig:
any
Always null. Breeze 2.x exposed its argument-checking helpers here; Breeze 3 does not.
assertParam
assertParam:
any
Always null. Breeze 2.x exposed its argument-checking helpers here; Breeze 3 does not.
AutoGeneratedKeyType
AutoGeneratedKeyType: typeof
AutoGeneratedKeyType
The same as the AutoGeneratedKeyType export.
BooleanQueryOp
BooleanQueryOp: typeof
BooleanQueryOp
The operators that combine predicates in a query - and, or and not - as an enum. The same as the BooleanQueryOp export.
ComplexAspect
ComplexAspect: typeof
ComplexAspect
The same as the ComplexAspect export.
ComplexType
ComplexType: typeof
ComplexType
The same as the ComplexType export.
config
config:
BreezeConfig
The same as the config export: the older adapter-registration API. New code calls configureBreeze instead.
core
core:
object
The same as the core export.
core.arrayAddItemUnique
arrayAddItemUnique: <
T>(array,item) =>void=arrayAddItemUnique
Pushes item onto array unless the array already holds it.
Add item if not already in array
Type Parameters
T
T
Parameters
array
T[]
item
T
Returns
void
core.arrayEquals
arrayEquals: (
a1,a2,equalsFn?) =>boolean=arrayEquals
Whether two arrays have the same length and equal elements, compared with === or with equalsFn if given. An element that is itself an array is compared element by element, with ===. False if either array is null or undefined.
Parameters
a1
any[]
a2
any[]
equalsFn?
(x1, x2) => boolean
Returns
boolean
core.arrayFirst
arrayFirst: <
T>(array,predicate) =>T=arrayFirst
The first element for which predicate is true, or null. Like Array.prototype.find, except for returning null rather than undefined.
Return first element matching predicate
Type Parameters
T
T
Parameters
array
T[]
predicate
Predicate<any>
Returns
T
core.arrayFlatMap
arrayFlatMap:
object=arrayFlatMap
Deprecated
Use arr.flatMap(fn), which this now calls.
core.arrayIndexOf
arrayIndexOf: <
T>(array,predicate) =>number=arrayIndexOf
The index of the first element for which predicate is true, or -1. The same as Array.prototype.findIndex.
Return index of first element matching predicate
Type Parameters
T
T
Parameters
array
T[]
predicate
Predicate<any>
Returns
number
core.arrayRemoveItem
arrayRemoveItem: <
T>(array,predicateOrItem,shouldRemoveMultiple?) =>boolean=arrayRemoveItem
Removes from array, in place, either predicateOrItem itself or the elements that predicateOrItem, a function, matches. Removes only the last match unless shouldRemoveMultiple is true. Returns whether anything was removed.
Remove items from the array
Type Parameters
T
T
Parameters
array
T[]
predicateOrItem
T | Predicate<T>
item to remove, or function to determine matching item
shouldRemoveMultiple?
boolean
true to keep removing after first match, false otherwise
Returns
boolean
core.arraySlice
arraySlice:
object=arraySlice
Deprecated
Use arr.slice(start, end), or Array.prototype.slice.call(arrayLike) for an arguments object. That is what this now does.
core.arrayZip
arrayZip: (
a1,a2,callback) =>any[] =arrayZip
Combines the elements of two arrays pairwise with callback. The result is as long as the shorter array.
Combine array elements using the callback. Returns array with length == min(a1.length, a2.length)
Parameters
a1
any[]
a2
any[]
callback
(x1, x2) => any
Returns
any[]
core.durationToSeconds
durationToSeconds: (
duration) =>number=durationToSeconds
Converts an ISO 8601 duration such as PT1H30M to seconds, counting a year as 360 days and a month as 30. Throws for a string that is not a duration.
Parameters
duration
string
Returns
number
core.extend
extend: (
target,source?,propNames?) =>Object=extend
Copies properties from source onto target and returns target: all of source's own enumerable properties, or only propNames when given. A shallow copy, like Object.assign.
Copy properties from source to target. Returns target.
Parameters
target
Object
source?
Object
propNames?
string[]
Returns
Object
core.formatString
formatString:
object=formatString
Replaces %1, %2, ... in str with the arguments that follow it: formatString('a %1 and a %2', 'cat', 'dog') is 'a cat and a dog'.
core.getMapArray
getMapArray: <
K,V>(map,key) =>V[] =getMapArray
The array stored in map under key, after storing an empty one there if there was none.
Returns the array stored under key, creating it if absent.
Type Parameters
K
K
V
V
Parameters
map
Map<K, V[]>
key
K
Returns
V[]
core.getOwnPropertyValues
getOwnPropertyValues: (
source) =>any[] =getOwnPropertyValues
The values of an object's own enumerable properties. Object.values(obj), except that null or undefined gives [].
Return an array of property values from source
Parameters
source
Object
Returns
any[]
core.getPropertyDescriptor
getPropertyDescriptor: (
obj,propertyName) =>PropertyDescriptor|undefined=getPropDescriptor
The descriptor of propertyName on obj or, failing that, on the nearest prototype that has it; undefined if none does. Unlike Object.getOwnPropertyDescriptor, it searches the prototype chain.
Parameters
obj
Object
propertyName
string
Returns
PropertyDescriptor | undefined
core.getUuid
getUuid:
object=getUuid
Deprecated
Use crypto.randomUUID(). This calls it where it exists and falls back to a Math.random() implementation in a browser outside a secure context, where it does not.
core.hasOwnProperty
hasOwnProperty:
object=hasOwnProperty
Deprecated
Use Object.hasOwn(obj, key), which this now calls.
core.identity
identity: (
x) =>any=identity
Returns its argument.
Parameters
x
any
Returns
any
core.isDate
isDate: (
o) =>boolean=isDate
Whether o is a Date holding a valid time - not an Invalid Date.
Parameters
o
any
Returns
boolean
core.isDateString
isDateString: (
s) =>boolean=isDateString
Whether s is an ISO 8601 date-time with a time zone, such as 2024-05-01T10:30:00Z or 2024-05-01T10:30:00.5+02:00. A string with no time zone, or a date with no time, is not.
Parameters
s
string
Returns
boolean
core.isDuration
isDuration: (
value) =>boolean=isDuration
Whether value is a string that looks like an ISO 8601 duration, such as PT1H. A quick check of its shape, not a full parse - see core.durationToSeconds.
Parameters
value
any
Returns
boolean
core.isEmpty
isEmpty: (
obj) =>boolean=isEmpty
Whether obj is null, undefined, or has no own enumerable properties.
Parameters
obj
any
Returns
boolean
core.isFunction
isFunction: (
o) =>boolean=isFunction
Whether o is an ordinary function. False for async and generator functions: it checks Object.prototype.toString, which names those differently.
Parameters
o
any
Returns
boolean
core.isGuid
isGuid: (
value) =>boolean=isGuid
Whether value is a string in GUID form: 8-4-4-4-12 hexadecimal digits.
Parameters
value
any
Returns
boolean
core.isSettable
isSettable: (
obj,propertyName) =>boolean=isSettable
Whether obj[propertyName] can be assigned: true if no object on the prototype chain defines it, or if its descriptor is writable or has a setter.
Parameters
obj
Object
propertyName
string
Returns
boolean
core.map
map: <
T>(items,fn,includeNull?) =>any=map
Array.prototype.map that also takes a single value, which it passes to fn and returns the result of. Null or undefined is returned as is. With includeNull false, an element whose result is null or undefined is left as a hole in the returned array.
a version of Array.map that doesn't require an array, i.e. works on arrays and scalars.
Type Parameters
T
T
Parameters
items
T | T[]
fn
(v, ix?) => any
includeNull?
boolean
Returns
any
core.memoize
memoize: (
fn) =>any=memoize
Wraps fn so that it runs once for each distinct set of arguments and afterwards returns the stored result. Arguments are keyed by value, objects by their JSON.stringify. The results are stored on fn itself and never released.
Remember & return the value of fn() when it was called with its current args
Parameters
fn
any
Returns
any
core.noop
noop: () =>
void=noop
Does nothing.
Returns
void
core.objectFirst
objectFirst: (
obj,kvPredicate) => {key:string;value:any; } |null=objectFirst
The first of an object's own enumerable properties for which kvPredicate(key, value) is true, as { key, value }; null if there is none.
Parameters
obj
Object
kvPredicate
(key, val) => boolean
Returns
Type Literal
{ key: string; value: any; }
key
key:
string
The property's name.
value
value:
any
The property's value.
null
core.objectForEach
objectForEach: (
obj,kvFn) =>void=objectForEach
Calls kvFn(key, value) for each of an object's own enumerable properties. Does nothing for null or undefined.
Parameters
obj
Object
kvFn
(key, val) => any
Returns
void
core.objectMap
objectMap: (
obj,kvFn?) =>any[] =objectMap
Calls kvFn(key, value) for each of an object's own enumerable properties and returns the results, leaving out any that are undefined. Without kvFn, returns the values.
Parameters
obj
Object
kvFn?
(key, val) => any
Returns
any[]
core.pluck
pluck: (
propertyName) => (obj) =>any=pluck
A function that returns an object's propertyName: people.map(core.pluck('firstName')).
can be used like persons.map(pluck("firstName"))
Parameters
propertyName
any
Returns
(obj) => any
core.propEq
propEq: (
propertyName,value) => (obj) =>boolean=propEq
A predicate that is true for an object whose propertyName is === value: people.filter(core.propEq('firstName', 'John')).
can be used like: persons.filter(propEq("firstName", "John"))
Parameters
propertyName
string
value
any
Returns
(obj) => boolean
core.propsEq
propsEq: (
property1Name,property2Name,value) => (obj) =>boolean=propsEq
A predicate that is true for an object whose property1Name or property2Name is === value.
can be used like: persons.filter(propEq("firstName", "FirstName", "John"))
Parameters
property1Name
string
property2Name
string
value
any
Returns
(obj) => boolean
core.resolveProperties
resolveProperties: (
sources,propertyNames) =>any=resolveProperties
An object with each of propertyNames taken from the first of sources in which it is not undefined. Breeze uses it to combine a query's settings with its manager's and the defaults, in QueryOptions.resolve and DataService.resolve.
Resolves the values of a list of properties by checking each property in multiple sources until a value is found.
Parameters
sources
Object[]
propertyNames
string[]
Returns
any
core.setAsDefault
setAsDefault: (
target,ctor) =>any=setAsDefault
Creates an instance of ctor from target, fills in whatever it leaves unset from the current ctor.defaultInstance, and makes that the new ctor.defaultInstance. Returns target. The setAsDefault() methods of QueryOptions, SaveOptions, NamingConvention and LocalQueryComparisonOptions are built on it.
Set ctor.defaultInstance to an instance of ctor with properties from target. We want to insure that the object returned by ctor.defaultInstance is always immutable Use 'target' as the primary template for the ctor.defaultInstance; Use current 'ctor.defaultInstance' as the template for any missing properties creates a new instance for ctor.defaultInstance returns target unchanged
Parameters
target
Object
ctor
{(...args): any; defaultInstance?: any; }
defaultInstance?
any
Returns
any
core.stringEndsWith
stringEndsWith:
object=stringEndsWith
Deprecated
Use str.endsWith(suffix), with the same caveat about nulls as core.stringStartsWith.
core.strings
strings:
object=strings
Text that Breeze uses in its error messages.
core.strings.TO_TYPE
TO_TYPE:
string="Add 'EntityQuery.toType()' to your query, or call 'MetadataStore.setEntityTypeForResourceName()' to register an EntityType for this resourceName."
Advice appended to errors about a query whose entity type Breeze cannot determine.
core.stringStartsWith
stringStartsWith:
object=stringStartsWith
Deprecated
Use str.startsWith(prefix). Not quite the same: this answers false for a null string and true for a null prefix, where the built-in throws and compares against the text "null" respectively. Guard the null yourself.
core.toArray
toArray: (
item) =>any[] =toArray
[] for null or undefined, the array itself for an array, and [item] for anything else.
Parameters
item
any
Returns
any[]
core.toJson
toJson: (
source,template,target) =>Object=toJson
Copies properties of source to target, a new object by default, as template directs, and returns target. Each key of template names a property to copy; a key such as 'a,b' also accepts b as another name for a. The template's value is the property's default: a property equal to it (by ==), undefined, or an empty array is left out. If the template's value is a function, it converts the property's value instead, and a BreezeEnum is written as its name. Breeze's metadata classes build their toJSON output with it.
'source' is an object that will be transformed into another 'template' is a map where the keys: are the keys to return if a key contains ','s then the key is treated as a delimited string with first of the keys being the key to return and the others all valid aliases for this key 'values' are either 1) the 'default' value of the key 2) a function that takes in the source value and should return the value to set The value from the source is then set on the target, after first passing thru the fn, if provided, UNLESS: 1) it is the default value 2) it is undefined ( nulls WILL be set) 'target' is optional
- if it exists then properties of the target will be set ( overwritten if the exist)
- if it does not exist then a new object will be created as filled. 'target is returned.
Parameters
source
Object
template
Object
target?
Object = {}
Returns
Object
core.toJSONSafe
toJSONSafe: (
obj,replacer?) =>any=toJSONSafe
A copy of obj that JSON.stringify can serialize even when the object graph has cycles: a reference back to an object already being copied is left out. Uses an object's own toJSON when it has one, leaves out functions, and passes each property through replacer when given, leaving out any it returns undefined for.
Safely perform toJSON logic on objects with cycles.
Parameters
obj
any
replacer?
(prop, value) => any
Returns
any
core.toJSONSafeReplacer
toJSONSafeReplacer: (
prop,val) =>any=toJSONSafeReplacer
A replacer for core.toJSONSafe that leaves out an entity's Breeze members - entityAspect, complexAspect, entityType, complexType, getProperty, setProperty and constructor - and any property whose name starts with _ or $. Breeze serializes unmapped property values with it.
Replacer function for toJSONSafe, when serializing entities. Excludes entityAspect and other internal properties.
Parameters
prop
string
val
any
Returns
any
core.updateWithDefaults
updateWithDefaults: (
target,defaults) =>any=updateWithDefaults
Copies each property of defaults onto target where target's is undefined, and returns target.
Copy properties from defaults iff undefined on target. Returns target.
Parameters
target
Object
defaults
Object
Returns
any
core.using
using: (
obj,property,tempValue,fn) =>any=using
Sets obj[property] to tempValue, calls fn, then restores the original value, deleting the property if it had none, whether or not fn throws. Returns what fn returns.
Execute fn while obj has tempValue for property
Parameters
obj
Object
property
string
tempValue
any
fn
() => any
Returns
any
core.wrapExecution
wrapExecution: (
startFn,endFn,fn) =>any=wrapExecution
Calls startFn(), then fn(), then endFn(state) with what startFn returned, whether or not fn throws. If it throws and the state is an object, the error is set on state.error first. Returns what fn returns.
Call state = startFn(), call fn(), call endFn(state)
Parameters
startFn
() => any
endFn
(state) => any
fn
() => any
Returns
any
DataProperty
DataProperty: typeof
DataProperty
The same as the DataProperty export.
DataService
DataService: typeof
DataService
The same as the DataService export.
DataType
DataType: typeof
DataType
The same as the DataType export.
EntityAction
EntityAction: typeof
EntityAction
The same as the EntityAction export.
EntityAspect
EntityAspect: typeof
EntityAspect
The same as the EntityAspect export.
EntityKey
EntityKey: typeof
EntityKey
The same as the EntityKey export.
EntityManager
EntityManager: typeof
EntityManager
The same as the EntityManager export.
EntityQuery
EntityQuery: typeof
EntityQuery
The same as the EntityQuery export.
EntityState
EntityState: typeof
EntityState
The same as the EntityState export.
EntityType
EntityType: typeof
EntityType
The same as the EntityType export.
Event
Event: typeof
BreezeEvent=BreezeEvent
The same as the BreezeEvent export, under its 2.x name.
FetchStrategy
FetchStrategy: typeof
FetchStrategy
The same as the FetchStrategy export.
FilterQueryOp
FilterQueryOp: typeof
FilterQueryOp
The same as the FilterQueryOp export.
InterfaceRegistry
InterfaceRegistry: typeof
InterfaceRegistry
The same as the InterfaceRegistry export.
JsonResultsAdapter
JsonResultsAdapter: typeof
JsonResultsAdapter
The same as the JsonResultsAdapter export.
KeyGenerator
KeyGenerator: typeof
KeyGenerator
The same as the KeyGenerator export.
LocalQueryComparisonOptions
LocalQueryComparisonOptions: typeof
LocalQueryComparisonOptions
The same as the LocalQueryComparisonOptions export.
makeComplexArray
makeComplexArray:
object
Turns an array into the array behind a collection of complex objects. For model library adapter authors; Breeze's own adapter calls it when it sets up an entity.
makePrimitiveArray
makePrimitiveArray:
object
Turns an array into the array behind a collection of primitive values. For model library adapter authors; Breeze's own adapter calls it when it sets up an entity.
makeRelationArray
makeRelationArray:
object
Turns an array into the RelationArray behind a collection navigation property. For model library adapter authors; Breeze's own adapter calls it when it sets up an entity.
MergeStrategy
MergeStrategy: typeof
MergeStrategy
The same as the MergeStrategy export.
MetadataStore
MetadataStore: typeof
MetadataStore
The same as the MetadataStore export.
NamingConvention
NamingConvention: typeof
NamingConvention
The same as the NamingConvention export.
NavigationProperty
NavigationProperty: typeof
NavigationProperty
The same as the NavigationProperty export.
OrderByClause
OrderByClause: typeof
OrderByClause
The class that holds a query's orderBy. Exposed for Breeze's own tests; applications do not need it.
Param
Param: typeof
Param
Breeze's internal argument-checking helper. Applications do not need it.
Predicate
Predicate: typeof
Predicate
The same as the Predicate export.
QueryOptions
QueryOptions: typeof
QueryOptions
The same as the QueryOptions export.
SaveOptions
SaveOptions: typeof
SaveOptions
The same as the SaveOptions export.
ValidationError
ValidationError: typeof
ValidationError
The same as the ValidationError export.
ValidationOptions
ValidationOptions: typeof
ValidationOptions
The same as the ValidationOptions export.
Validator
Validator: typeof
Validator
The same as the Validator export.
version
version:
string="3.0.0"
The version of breeze-client. A test keeps it equal to the one in package.json.