@agile-ts/core
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -0,0 +0,0 @@ # Change Log |
@@ -0,0 +0,0 @@ import { Runtime, SubController } from './runtime'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import { Collection, CollectionKey, DefaultItem, ItemKey } from './collection'; |
@@ -0,0 +0,0 @@ import { CreateObserverConfigInterface, CreateRuntimeJobConfigInterface, IngestConfigInterface, Observer, RuntimeJob } from '../../runtime'; |
@@ -109,3 +109,3 @@ import { CreateStatePersistentConfigInterface, EnhancedState, StateIngestConfigInterface, StateObserversInterface } from '../../state'; | ||
*/ | ||
persist(config?: GroupPersistConfigInterface): this; | ||
persist(config?: GroupPersistConfigInterface<Array<ItemKey>>): this; | ||
/** | ||
@@ -172,3 +172,3 @@ * Rebuilds the output of the Group | ||
} | ||
export interface GroupPersistConfigInterface extends CreateStatePersistentConfigInterface { | ||
export interface GroupPersistConfigInterface<ValueType = any> extends CreateStatePersistentConfigInterface<ValueType> { | ||
/** | ||
@@ -175,0 +175,0 @@ * Whether to format the specified Storage key following the Collection Group Storage key pattern. |
@@ -1,3 +0,1 @@ | ||
import { Agile } from '../agile'; | ||
import { Collection, CreateCollectionConfig, DefaultItem } from './collection'; | ||
export * from './collection'; | ||
@@ -9,21 +7,2 @@ export * from './collection.persistent'; | ||
export * from './selector'; | ||
/** | ||
* Returns a newly created Collection. | ||
* | ||
* A Collection manages a reactive set of Information | ||
* that we need to remember globally at a later point in time. | ||
* While providing a toolkit to use and mutate this set of Information. | ||
* | ||
* It is designed for arrays of data objects following the same pattern. | ||
* | ||
* Each of these data object must have a unique `primaryKey` to be correctly identified later. | ||
* | ||
* You can create as many global Collections as you need. | ||
* | ||
* [Learn more..](https://agile-ts.org/docs/core/agile-instance/methods#createcollection) | ||
* | ||
* @public | ||
* @param config - Configuration object | ||
* @param agileInstance - Instance of Agile the Collection belongs to. | ||
*/ | ||
export declare function createCollection<DataType extends DefaultItem = DefaultItem>(config?: CreateCollectionConfig<DataType>, agileInstance?: Agile): Collection<DataType>; | ||
export * from './public'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import { Observer } from '../runtime'; |
@@ -1,44 +0,3 @@ | ||
import { CreateAgileSubInstanceInterface } from '../shared'; | ||
import { Computed, ComputeFunctionType, CreateComputedConfigInterface, DependableAgileInstancesType } from './computed'; | ||
export * from './computed'; | ||
export * from './computed.tracker'; | ||
/** | ||
* Returns a newly created Computed. | ||
* | ||
* A Computed is an extension of the State Class | ||
* that computes its value based on a specified compute function. | ||
* | ||
* The computed value will be cached to avoid unnecessary recomputes | ||
* and is only recomputed when one of its direct dependencies changes. | ||
* | ||
* Direct dependencies can be States and Collections. | ||
* So when, for example, a dependent State value changes, the computed value is recomputed. | ||
* | ||
* [Learn more..](https://agile-ts.org/docs/core/agile-instance/methods#createcomputed) | ||
* | ||
* @public | ||
* @param computeFunction - Function to compute the computed value. | ||
* @param config - Configuration object | ||
*/ | ||
export declare function createComputed<ComputedValueType = any>(computeFunction: ComputeFunctionType<ComputedValueType>, config?: CreateComputedConfigInterfaceWithAgile): Computed<ComputedValueType>; | ||
/** | ||
* Returns a newly created Computed. | ||
* | ||
* A Computed is an extension of the State Class | ||
* that computes its value based on a specified compute function. | ||
* | ||
* The computed value will be cached to avoid unnecessary recomputes | ||
* and is only recomputed when one of its direct dependencies changes. | ||
* | ||
* Direct dependencies can be States and Collections. | ||
* So when, for example, a dependent State value changes, the computed value is recomputed. | ||
* | ||
* [Learn more..](https://agile-ts.org/docs/core/agile-instance/methods#createcomputed) | ||
* | ||
* @public | ||
* @param computeFunction - Function to compute the computed value. | ||
* @param deps - Hard-coded dependencies on which the Computed Class should depend. | ||
*/ | ||
export declare function createComputed<ComputedValueType = any>(computeFunction: ComputeFunctionType<ComputedValueType>, deps?: Array<DependableAgileInstancesType>): Computed<ComputedValueType>; | ||
export interface CreateComputedConfigInterfaceWithAgile extends CreateAgileSubInstanceInterface, CreateComputedConfigInterface { | ||
} | ||
export * from './public'; |
import { defineConfig, generateId, normalizeArray, isValidObject, isFunction, copy } from '@agile-ts/utils'; | ||
import { logCodeManager } from '../logCodeManager.js'; | ||
import { Item } from './item.js'; | ||
import { Selector } from './selector.js'; | ||
import { Item } from './item/index.js'; | ||
import { Selector } from './selector/index.js'; | ||
import { Group, TrackedChangeMethod } from './group/index.js'; | ||
@@ -6,0 +6,0 @@ import { CollectionPersistent } from './collection.persistent.js'; |
@@ -7,4 +7,2 @@ import { Agile as Agile$1 } from './agile.js'; | ||
export { createStorage } from './storages/index.js'; | ||
export { createCollection } from './collection/index.js'; | ||
export { createComputed } from './computed/index.js'; | ||
export { assignSharedAgileInstance, getAgileInstance, sharedAgileInstance as shared, sharedAgileInstance } from './shared.js'; | ||
@@ -36,6 +34,8 @@ export { Integrations } from './integrations/integrations.js'; | ||
export { GroupObserver } from './collection/group/group.observer.js'; | ||
export { Item } from './collection/item.js'; | ||
export { Selector } from './collection/selector.js'; | ||
export { Item } from './collection/item/index.js'; | ||
export { Selector } from './collection/selector/index.js'; | ||
export { createCollection } from './collection/public/createCollection.js'; | ||
export { Computed } from './computed/computed.js'; | ||
export { ComputedTracker } from './computed/computed.tracker.js'; | ||
export { createComputed } from './computed/public/createComputed.js'; | ||
@@ -42,0 +42,0 @@ var Agile = Agile$1; |
@@ -56,3 +56,3 @@ import { defineConfig, copy, generateId, equal, notEqual, createArrayFromObject, isFunction } from '@agile-ts/utils'; | ||
this.sideEffects(job); | ||
job.observer.previousValue = Object.freeze(copy(observer.value)); | ||
job.observer.previousValue = copy(observer.value); | ||
job.observer.value = copy(state._value); | ||
@@ -59,0 +59,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { defineConfig } from '@agile-ts/utils'; | ||
import { defineConfig, copy } from '@agile-ts/utils'; | ||
import { Persistent } from '../storages/persistent.js'; | ||
@@ -115,3 +115,3 @@ import { getSharedStorageManager } from '../storages/shared.js'; | ||
if (config["storage"] == null || config.storage) { | ||
(_a = getSharedStorageManager()) == null ? void 0 : _a.set(storageItemKey, this.onSave != null ? this.onSave(this.state().getPersistableValue()) : this.state().getPersistableValue(), this.storageKeys); | ||
(_a = getSharedStorageManager()) == null ? void 0 : _a.set(storageItemKey, this.onSave != null ? this.onSave(copy(this.state().getPersistableValue())) : this.state().getPersistableValue(), this.storageKeys); | ||
} | ||
@@ -118,0 +118,0 @@ } |
@@ -0,0 +0,0 @@ import { Agile } from './agile'; |
export * from './integrations'; | ||
export * from './integration'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import type { Logger } from '@agile-ts/logger'; |
@@ -0,0 +0,0 @@ export * from './runtime'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ import { SubscriptionContainer } from './subscription'; |
@@ -0,0 +0,0 @@ import { SubscriptionContainer, SubscriptionContainerConfigInterface } from './SubscriptionContainer'; |
@@ -0,0 +0,0 @@ import { SubscriptionContainer, SubscriptionContainerConfigInterface } from './SubscriptionContainer'; |
@@ -0,0 +0,0 @@ import { Observer } from '../../observer'; |
@@ -0,0 +0,0 @@ export * from './container/SubscriptionContainer'; |
@@ -0,0 +0,0 @@ import { Agile } from '../../agile'; |
@@ -0,0 +0,0 @@ import { Agile } from './agile'; |
@@ -0,0 +0,0 @@ export * from './state'; |
@@ -0,0 +0,0 @@ import { EnhancedState } from '../state.enhanced'; |
@@ -0,0 +0,0 @@ import { State } from '../state'; |
@@ -0,0 +0,0 @@ import { EnhancedState } from '../state.enhanced'; |
@@ -0,0 +0,0 @@ import { CreateAgileSubInstanceInterface } from '../../shared'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -205,3 +205,3 @@ /// <reference types="node" /> | ||
*/ | ||
persist(config?: CreateStatePersistentConfigInterface): this; | ||
persist(config?: CreateStatePersistentConfigInterface<ValueType>): this; | ||
/** | ||
@@ -208,0 +208,0 @@ * Fires immediately after the persisted `value` |
@@ -0,0 +0,0 @@ import { IngestConfigInterface, Observer, ObserverKey, SubscriptionContainer } from '../runtime'; |
@@ -15,3 +15,3 @@ import { CreatePersistentConfigInterface, Persistent, PersistentKey } from '../storages'; | ||
*/ | ||
constructor(state: EnhancedState<ValueType>, config?: CreateStatePersistentConfigInterface); | ||
constructor(state: EnhancedState<ValueType>, config?: CreateStatePersistentConfigInterface<ValueType>); | ||
/** | ||
@@ -18,0 +18,0 @@ * Loads the persisted value into the State |
@@ -0,0 +0,0 @@ import { RuntimeJob, RuntimeJobConfigInterface, RuntimeJobKey } from '../runtime'; |
@@ -0,0 +0,0 @@ import { CreateStorageConfigInterface, Storage } from './storage'; |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import { CreateAgileSubInstanceInterface } from '../shared'; |
@@ -0,0 +0,0 @@ export declare class Storage { |
@@ -0,0 +0,0 @@ import { Agile } from '../agile'; |
@@ -0,0 +0,0 @@ import { Observer } from './runtime'; |
{ | ||
"name": "@agile-ts/core", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"author": "BennoDev", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -0,0 +0,0 @@ <img src="https://raw.githubusercontent.com/agile-ts/agile/master/static/header_background.png" alt="AgileTs"> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
820697
89
10390