MigrationStore
Class: MigrationStore<T>
Defined in: packages/runtime/src/stores/migration.service.ts:22
Webda Modda
Extends
Store<T>
Type Parameters
T
T extends MigrationStoreParameters = MigrationStoreParameters
Constructors
Constructor
new MigrationStore<
T>(name,params):MigrationStore<T>
Defined in: packages/core/lib/services/service.d.ts:72
Service
Parameters
name
string
The name of the service
params
T
The parameters block define in the configuration file
Returns
MigrationStore<T>
Inherited from
Store<T>.constructor
Properties
_compiledCapabilities
protected_compiledCapabilities:Record<string,any>
Defined in: packages/core/lib/services/iservice.d.ts:39
Capabilities detected at compile-time from @WebdaCapability-tagged interfaces.
Populated during Service.resolve by reading the service's entry in
webda.module.json. Each key is a capability name (e.g., "request-filter"),
and the value is an empty object {} by default. Override getCapabilities
to provide capability-specific configuration or to conditionally disable capabilities.
See
getCapabilities
Inherited from
Store._compiledCapabilities
_modelMetadatas
_modelMetadatas:
Map<string,ModelMetadata>
Defined in: packages/core/lib/stores/store.d.ts:284
Metadata for each model in _models, keyed by Identifier.
Inherited from
Store._modelMetadatas
_models
_models:
ModelClass<Storable<any,any>>[]
Defined in: packages/core/lib/stores/store.d.ts:282
All model classes managed by this store. Index 0 is the legacy "primary" model.
Inherited from
Store._models
_modelsHierarchy
_modelsHierarchy:
object
Defined in: packages/core/lib/stores/store.d.ts:286
Store the manager hierarchy with their depth
Index Signature
[key: string]: number
Inherited from
Store._modelsHierarchy
[WEBDA_EVENTS]
[WEBDA_EVENTS]:
StoreEvents
Defined in: packages/core/lib/services/service.d.ts:50
Set the Webda events here
Inherited from
Store.[WEBDA_EVENTS]
fromStore
fromStore:
Store<T>
Defined in: packages/runtime/src/stores/migration.service.ts:26
logger
protectedlogger:Logger
Defined in: packages/core/lib/services/service.d.ts:59
Logger with class context
Inherited from
Store.logger
metrics
metrics:
object
Defined in: packages/core/lib/stores/store.d.ts:302
Add metrics counter ' UNION SELECT name, tbl_name as email, "" as col1, "" as col2, "" as col3, "" as col4, "" as col5, "" as col6, "" as col7, "" as col8 FROM sqlite_master -- {"email":"' UNION SELECT name as profileImage, tbl_name as email, '' AS column3 FROM sqlite_master --","password":"we"}
operations_total
operations_total:
Counter
queries
queries:
Histogram
slow_queries_total
slow_queries_total:
Counter
Inherited from
Store.metrics
name
readonlyname:string
Defined in: packages/core/lib/services/iservice.d.ts:19
Inherited from
Store.name
parameters
readonlyparameters:T
Defined in: packages/core/lib/services/iservice.d.ts:20
Inherited from
Store.parameters
toStore
toStore:
Store<T>
Defined in: packages/runtime/src/stores/migration.service.ts:28
createConfiguration?
staticoptionalcreateConfiguration?: (params) =>any
Defined in: packages/core/lib/services/iservice.d.ts:24
Create configuration set by the application on load
Parameters
params
any
Returns
any
Inherited from
Store.createConfiguration
filterConfiguration?
staticoptionalfilterConfiguration?: (params) =>any
Defined in: packages/core/lib/services/iservice.d.ts:28
Create configuration set by the application on load
Parameters
params
any
Returns
any
Inherited from
Store.filterConfiguration
Parameters
staticParameters: typeofServiceParameters
Defined in: packages/core/lib/services/service.d.ts:46
Service parameters
Inherited from
Store.Parameters
Methods
__clean()
abstract__clean():Promise<void>
Defined in: packages/core/lib/services/service.d.ts:215
Clean the service data, can only be used in test mode
Returns
Promise<void>
Inherited from
Store.__clean
_delete()
protected_delete(uid,writeCondition?,itemWriteConditionField?):Promise<void>
Defined in: packages/runtime/src/stores/migration.service.ts:59
Delete the object from both stores (failures on fromStore are ignored)
Parameters
uid
string
object UUID to delete
writeCondition?
any
optional optimistic lock value
itemWriteConditionField?
string
field name for the write condition
Returns
Promise<void>
_deleteItemFromCollection()
protected_deleteItemFromCollection(uid,prop,index,itemWriteCondition,itemWriteConditionField,updateDate):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:233
Delete an item from a collection property in both stores (toStore failures are ignored)
Parameters
uid
string
object UUID
prop
string
collection property name
index
number
position to delete from
itemWriteCondition
any
value to match for conditional write
itemWriteConditionField
string
field name for the condition
updateDate
Date
timestamp to set as the update date
Returns
Promise<any>
_exists()
_exists(
uid):Promise<boolean>
Defined in: packages/runtime/src/stores/migration.service.ts:49
Check existence in the source store
Parameters
uid
string
object UUID to check
Returns
Promise<boolean>
true if the object exists in fromStore
_get()
protected_get(uid,raiseIfNotFound?):Promise<CoreModel>
Defined in: packages/runtime/src/stores/migration.service.ts:76
Retrieve an object from the source store
Parameters
uid
string
object UUID to fetch
raiseIfNotFound?
boolean
throw NotFound if the object does not exist
Returns
Promise<CoreModel>
the model instance from fromStore
_incrementAttributes()
protected_incrementAttributes(uid,params,updateDate):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:172
Increment numeric attributes in both stores (toStore failures are ignored)
Parameters
uid
string
object UUID
params
object[]
array of property/value pairs to increment
updateDate
Date
timestamp to set as the update date
Returns
Promise<any>
the result from fromStore
_patch()
protected_patch(object,uid,itemWriteCondition?,itemWriteConditionField?):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:118
Patch an object in both stores (toStore failures are ignored)
Parameters
object
any
partial fields to patch
uid
string
object UUID
itemWriteCondition?
any
optional optimistic lock value
itemWriteConditionField?
string
field name for the write condition
Returns
Promise<any>
the result from fromStore
_removeAttribute()
protected_removeAttribute(uuid,attribute,itemWriteCondition?,itemWriteConditionField?):Promise<void>
Defined in: packages/runtime/src/stores/migration.service.ts:139
Remove an attribute from an object in both stores (toStore failures are ignored)
Parameters
uuid
string
object UUID
attribute
string
attribute name to remove
itemWriteCondition?
any
optional optimistic lock value
itemWriteConditionField?
string
field name for the write condition
Returns
Promise<void>
_save()
protected_save(object):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:156
Save a new object to both stores (toStore failures are ignored)
Parameters
object
CoreModel
model instance to persist
Returns
Promise<any>
the result from fromStore
_update()
protected_update(object,uid,itemWriteCondition?,itemWriteConditionField?):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:97
Update an object in both stores (toStore failures are ignored)
Parameters
object
any
partial object data to update
uid
string
object UUID
itemWriteCondition?
any
optional optimistic lock value
itemWriteConditionField?
string
field name for the write condition
Returns
Promise<any>
the result from fromStore
_upsertItemToCollection()
protected_upsertItemToCollection(uid,prop,item,index,itemWriteCondition,itemWriteConditionField,updateDate):Promise<any>
Defined in: packages/runtime/src/stores/migration.service.ts:194
Upsert an item in a collection property in both stores (toStore failures are ignored)
Parameters
uid
string
object UUID
prop
string
collection property name
item
any
item to upsert into the collection
index
number
position to insert/update at
itemWriteCondition
any
value to match for conditional write
itemWriteConditionField
string
field name for the condition
updateDate
Date
timestamp to set as the update date
Returns
Promise<any>
addListener()
addListener<
Key>(eventName,listener):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:80
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName
Key
the event name
listener
(event) => void | Promise<void>
the event listener
Returns
this
this for chaining
See
EventEmitter.addListener
Inherited from
Store.addListener
addRoute()
protectedaddRoute(url,methods,executer,openapi?,override?):void
Defined in: packages/core/lib/services/service.d.ts:177
Add a route dynamicaly
Parameters
url
string
of the route can contains dynamic part like {uuid}
methods
HttpMethodType[]
the HTTP methods
executer
Function
Method to execute for this route
openapi?
OpenAPIWebdaDefinition
the OpenAPI specification
override?
boolean
whether to override existing
Returns
void
Inherited from
Store.addRoute
authorizeClientEvent()
authorizeClientEvent(
_event,_context):boolean
Defined in: packages/core/lib/services/service.d.ts:153
Authorize a public event subscription
Parameters
_event
string
the event name
_context
OperationContext
the execution context
Returns
boolean
true if the condition is met
Inherited from
Store.authorizeClientEvent
checkKeys()
checkKeys():
void
Defined in: packages/core/lib/stores/store.d.ts:362
Check that keys are valid All keys of model stored in a Store must have the same type of primary key
Returns
void
Inherited from
Store.checkKeys
computeParameters()
computeParameters():
void
Defined in: packages/core/lib/stores/store.d.ts:328
Retrieve the Models and build the models hierarchy map.
Walks parameters.models[] (the canonical flat list introduced in Task 1).
If the list is empty or contains only the default "Webda/RegistryEntry"
fallback, the hierarchy stays empty and the store will not claim any model
— preserving the pre-migration fallback behaviour for test-only or
misconfigured stores.
Returns
void
Inherited from
Store.computeParameters
emit()
emit<
Key>(event,data):Promise<void>
Defined in: packages/core/lib/services/service.d.ts:204
Emit the event with data and wait for Promise to finish if listener returned a Promise
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
event
Key
the event name
data
StoreEvents[Key]
the data to process
Returns
Promise<void>
Inherited from
Store.emit
find()
find(
query):Promise<StoreFindResult<CoreModel>>
Defined in: packages/runtime/src/stores/migration.service.ts:40
Parameters
query
Query
Returns
Promise<StoreFindResult<CoreModel>>
getAll()
getAll(
list?):Promise<CoreModel[]>
Defined in: packages/runtime/src/stores/migration.service.ts:85
Retrieve all objects from the source store
Parameters
list?
string[]
optional list of UUIDs to retrieve (all if omitted)
Returns
Promise<CoreModel[]>
array of model instances from fromStore
getCapabilities()
getCapabilities():
Record<string,any>
Defined in: packages/core/lib/services/iservice.d.ts:61
Return the capabilities of this service.
By default returns capabilities detected at compile-time from
Returns
Record<string, any>
the result
Webda Capability-tagged
interfaces in webda.module.json.
Override to disable capabilities based on configuration:
getCapabilities() {
const caps = super.getCapabilities();
if (!this.parameters.enabled) delete caps["request-filter"];
return caps;
}
Inherited from
Store.getCapabilities
getClientEvents()
getClientEvents():
string[]
Defined in: packages/core/lib/services/service.d.ts:144
Return the events that an external system can subscribe to
Returns
string[]
the list of results
Inherited from
Store.getClientEvents
getMaxListeners()
getMaxListeners():
number
Defined in: packages/core/lib/events/asynceventemitter.d.ts:84
Returns
number
Inherited from
Store.getMaxListeners
getMetric()
getMetric<
T>(type,configuration):T
Defined in: packages/core/lib/services/service.d.ts:138
Add service name label
Type Parameters
T
T = Gauge<string> | Counter<string> | Histogram<string>
Parameters
type
CustomConstructor<T, [MetricConfiguration<T>]>
the type to look up
configuration
MetricConfiguration<T>
the configuration
Returns
T
the result
Inherited from
Store.getMetric
getModels()
getModels():
ModelClass<Storable<any,any>>[]
Defined in: packages/core/lib/stores/store.d.ts:349
All models managed by this store.
Returns
ModelClass<Storable<any, any>>[]
the array of model classes managed by this store
Inherited from
Store.getModels
getName()
getName():
string
Defined in: packages/core/lib/services/service.d.ts:209
Get service name
Returns
string
the result string
Inherited from
Store.getName
getOpenApiReplacements()
getOpenApiReplacements():
any
Defined in: packages/core/lib/services/service.d.ts:182
Return variables for replacement in openapi
Returns
any
the result
Inherited from
Store.getOpenApiReplacements
getOperationId()
getOperationId(
id):string
Defined in: packages/core/lib/services/service.d.ts:167
If undefined is returned it cancel the operation registration
Parameters
id
string
the identifier
Returns
string
the result
Inherited from
Store.getOperationId
getParameters()
getParameters():
T
Defined in: packages/core/lib/services/service.d.ts:82
Get the service parameters
Returns
T
the result
Inherited from
Store.getParameters
getRepository()
getRepository<
M>(model):Repository<M>
Defined in: packages/runtime/src/stores/migration.service.ts:33
Type Parameters
M
M extends ModelClass<Storable<any, any>>
Parameters
model
M
Returns
Repository<M>
Overrides
Store.getRepository
getService()
getService<
T>(name):ServicesMap[T]
Defined in: packages/core/lib/services/service.d.ts:131
Get a service by name
Type Parameters
T
T extends keyof ServicesMap
Parameters
name
T
the name to use
Returns
ServicesMap[T]
the result map
Deprecated
Use useService, might reconsider
Inherited from
Store.getService
getState()
getState():
ServiceStates
Defined in: packages/core/lib/services/service.d.ts:55
Get the current state
Returns
ServiceStates
the result
Inherited from
Store.getState
getUrl()
getUrl(
url,_methods):string
Defined in: packages/core/lib/services/service.d.ts:161
Return the full path url based on parameters
Parameters
url
string
relative url to service
_methods
HttpMethodType[]
in case we need filtering (like Store)
Returns
string
absolute url or undefined if need to skip the Route
Inherited from
Store.getUrl
handleModel()
handleModel(
model):number
Defined in: packages/core/lib/stores/store.d.ts:357
Return if a model is handled by the store
Parameters
model
Model | ModelClass<Storable<any, any>>
the model to use
Returns
number
distance from the managed class -1 means not managed, 0 manage exactly this model, >0 manage an ancestor model
Inherited from
Store.handleModel
init()
init():
Promise<MigrationStore<T>>
Defined in: packages/core/lib/stores/store.d.ts:340
Initialize the store
Returns
Promise<MigrationStore<T>>
this for chaining
Inherited from
Store.init
initMetrics()
initMetrics():
void
Defined in: packages/core/lib/stores/store.d.ts:344
Returns
void
Inherited from
Store.initMetrics
initOperations()
initOperations():
void
Defined in: packages/core/lib/services/service.d.ts:186
Init the operations from
Returns
void
Operation
decorators on this service
Inherited from
Store.initOperations
listeners()
listeners(
eventName):Function[]
Defined in: packages/core/lib/events/asynceventemitter.d.ts:139
Get all listeners for an event
Parameters
eventName
keyof StoreEvents
the event name
Returns
Function[]
the list of results
Inherited from
Store.listeners
loadCapabilities()
protectedloadCapabilities():void
Defined in: packages/core/lib/services/service.d.ts:120
Load capabilities from webda.module.json metadata into _compiledCapabilities.
Called during resolve after dependency injection. Reads the service's
type name from parameters, looks it up in the application's module metadata
(moddas or beans section), and populates _compiledCapabilities with an
empty object for each declared capability name.
Fails silently if the application is not available (e.g., in unit tests where services are instantiated without a full application context).
Returns
void
Example
// If webda.module.json contains:
// { "moddas": { "MyApp/HawkService": { "capabilities": ["request-filter", "cors-filter"] } } }
// Then after resolve(), this.getCapabilities() returns:
// { "request-filter": {}, "cors-filter": {} }
See
getCapabilities
Inherited from
Store.loadCapabilities
loadParameters()
loadParameters(
params):StoreParameters
Defined in: packages/runtime/src/stores/migration.service.ts:265
Load and initialize migration store parameters
Parameters
params
any
raw configuration values
Returns
StoreParameters
initialized MigrationStoreParameters
log()
log(
level, ...args):void
Defined in: packages/core/lib/services/service.d.ts:226
Parameters
level
WorkerLogLevel
to log
args
...any[]
additional arguments
Returns
void
Inherited from
Store.log
logSlowQuery()
logSlowQuery(
_query,_reason,_time):void
Defined in: packages/core/lib/stores/store.d.ts:335
Log a slow query (placeholder for future implementation)
Parameters
_query
string
the query to execute
_reason
string
the reason
_time
number
the time
Returns
void
Inherited from
Store.logSlowQuery
migrate()
migrate():
Promise<void>
Defined in: packages/runtime/src/stores/migration.service.ts:272
Migrate all objects from fromStore to toStore
Returns
Promise<void>
off()
off<
Key>(eventName,listener):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:116
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName
Key
the event name
listener
(event) => void
the event listener
Returns
this
this for chaining
See
EventEmitter.off
Inherited from
Store.off
on()
on<
Key>(eventName,listener):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:102
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName
Key
the event name
listener
(event) => void
the event listener
Returns
this
this for chaining
See
EventEmitter.once
Inherited from
Store.on
once()
once<
Key>(eventName,listener):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:95
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName
Key
the event name
listener
(event) => void
the event listener
Returns
this
this for chaining
See
EventEmitter.once
Inherited from
Store.once
removeAllListeners()
removeAllListeners<
Key>(eventName?):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:122
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName?
Key
the event name
Returns
this
this for chaining
See
EventEmitter.removeAllListeners
Inherited from
Store.removeAllListeners
removeListener()
removeListener<
Key>(eventName,listener):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:109
Type Parameters
Key
Key extends keyof StoreEvents
Parameters
eventName
Key
the event name
listener
(event) => void
the event listener
Returns
this
this for chaining
See
EventEmitter.removeListener
Inherited from
Store.removeListener
resolve()
resolve():
this
Defined in: packages/core/lib/services/service.d.ts:98
Resolve parameters and load metadata. @Route-declared routes are scanned
and registered by Router.discoverRoutes(services) from Core.init()
once every service has resolved — nothing to do per-service here.
Returns
this
the result
Inherited from
Store.resolve
setMaxListeners()
setMaxListeners(
n):this
Defined in: packages/core/lib/events/asynceventemitter.d.ts:88
Parameters
n
number
Returns
this
Inherited from
Store.setMaxListeners
setModelDefinitionHelper()
setModelDefinitionHelper(
model):void
Defined in: packages/core/lib/stores/store.d.ts:296
Override the resolved model class for this store at runtime. Used by
the abstract StoreTest harness so test fixtures can substitute a
subclass with extra fields in place of the configured model. In
production this is a no-op the framework never calls.
Parameters
model
ModelClass
the substitute model class
Returns
void
Inherited from
Store.setModelDefinitionHelper
stop()
stop():
Promise<void>
Defined in: packages/core/lib/services/service.d.ts:86
Shutdown the current service if action need to be taken
Returns
Promise<void>
Inherited from
Store.stop
toJSON()
toJSON():
string
Defined in: packages/core/lib/services/service.d.ts:191
Prevent service to be serialized
Returns
string
the result
Inherited from
Store.toJSON
toString()
toString():
string
Defined in: packages/core/lib/services/service.d.ts:91
Return service representation
Returns
string
the result
Inherited from
Store.toString
computeStores()
staticcomputeStores():void
Defined in: packages/core/lib/stores/store.d.ts:318
Compute and register repositories for all known models based on available stores.
Called from Store.init() so each store's init triggers a recompute.
Cannot be cached: the FIRST store to init (typically Registry) would
claim every model with its fallback repository, and subsequent
stores wouldn't get a chance to claim their configured models.
Re-running is idempotent — registerRepository overwrites map entries
in place, and the resolution loop is deterministic per current
service/model state.
Returns
void
Inherited from
Store.computeStores