obj/src/persistence/IdentifiableMemoryPersistence.js
/**
     * Updates a data item.
     *
     * @param correlationId    (optional) transaction id to trace execution through call chain.
     * @param item              an item to be updated.
     * @returns                 the updated data item.
     */
Updates a data item.
@param correlationId    (optional) transaction id to trace execution through call chain.
@param item              an item to be updated.
@returns                 the updated data item.
Updates a data item . @param correlationId ( optional ) transaction id to trace execution through call chain . @param item an item to be updated . @returns the updated data item .
update(correlationId, item) {
        return __awaiter(this, void 0, void 0, function* () {
            let index = this._items.map(item => item.id).indexOf(item.id);
            if (index < 0) {
                this._logger.trace(correlationId, "Item %s was not found", item.id);
                return null;
            }
            item = Object.assign({}, item);
            this._items[index] = item;
            this._logger.trace(correlationId, "Updated item %s", item.id);
            yield this.save(correlationId);
            return item;
        });
    }
update ( correlationId , item ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { let index = this . _items . map ( item => item . id ) . indexOf ( item . id ) ; if ( index < 0 ) { this . _logger . trace ( correlationId , "Item %s was not found" , item . id ) ; return null ; } item = Object . assign ( { } , item ) ; this . _items [ index ] = item ; this . _logger . trace ( correlationId , "Updated item %s" , item . id ) ; yield this . save ( correlationId ) ; return item ; } ) ; }
Updates a data item.
Updates a data item .
// Clone the object