@forestadmin/datasource-customizer
Advanced tools
Comparing version 1.9.3 to 1.10.0
@@ -36,3 +36,3 @@ "use strict"; | ||
async update(caller, filter, patch) { | ||
const newPatch = await this.rewritePatch(caller, 'update', patch); | ||
const newPatch = await this.rewritePatch(caller, 'update', patch, [], filter); | ||
return this.childCollection.update(caller, filter, newPatch); | ||
@@ -43,5 +43,5 @@ } | ||
*/ | ||
async rewritePatch(caller, action, patch, usedHandlers = []) { | ||
async rewritePatch(caller, action, patch, usedHandlers = [], filter) { | ||
// We rewrite the patch by applying all handlers on each field. | ||
const context = new context_1.default(this, caller, action, patch); | ||
const context = new context_1.default(this, caller, action, patch, filter); | ||
const patches = await Promise.all(Object.keys(patch).map(key => this.rewriteKey(context, key, usedHandlers))); | ||
@@ -106,2 +106,2 @@ // We now have a list of patches (one per field) that we can merge. | ||
exports.default = WriteReplacerCollectionDecorator; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9kZWNvcmF0b3JzL3dyaXRlL3dyaXRlLXJlcGxhY2UvY29sbGVjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHdFQVN5QztBQUV6Qyx3REFBa0Q7QUFHbEQsTUFBcUIsZ0NBQWlDLFNBQVEsd0NBQW1CO0lBQWpGOztRQUNVLGFBQVEsR0FBb0MsRUFBRSxDQUFDO0lBNkh6RCxDQUFDO0lBMUhDLG1CQUFtQixDQUFDLFNBQWlCLEVBQUUsVUFBMkI7UUFDaEUsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLEVBQUU7WUFDeEQsTUFBTSxJQUFJLEtBQUssQ0FDYixvQkFB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7UUFFRCxPQUFPLEdBQUcsQ0FBQztJQUNiLENBQUM7SUFFTyxRQUFRLENBQUMsS0FBYztRQUM3QixPQUFPLEtBQUssSUFBSSxPQUFPLEtBQUssS0FBSyxRQUFRLElBQUksTUFBTSxDQUFDLGNBQWMsQ0FBQyxLQUFLLENBQUMsS0FBSyxNQUFNLENBQUMsU0FBUyxDQUFDO0lBQ2pHLENBQUM7Q0FDRjtBQS9IRCxtREErSEMifQ== |
@@ -1,9 +0,10 @@ | ||
import { Caller, Collection } from '@forestadmin/datasource-toolkit'; | ||
import { Caller, Collection, Filter } from '@forestadmin/datasource-toolkit'; | ||
import CollectionCustomizationContext from '../../../context/collection-context'; | ||
import { TCollectionName, TPartialSimpleRow, TSchema } from '../../../templates'; | ||
import { TCollectionName, TFilter, TPartialSimpleRow, TSchema } from '../../../templates'; | ||
export default class WriteCustomizationContext<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> extends CollectionCustomizationContext<S, N> { | ||
readonly action: 'update' | 'create'; | ||
readonly record: TPartialSimpleRow<S, N>; | ||
constructor(collection: Collection, caller: Caller, action: 'update' | 'create', record: TPartialSimpleRow<S, N>); | ||
readonly filter?: TFilter<S, N>; | ||
constructor(collection: Collection, caller: Caller, action: 'update' | 'create', record: TPartialSimpleRow<S, N>, filter?: Filter); | ||
} | ||
//# sourceMappingURL=context.d.ts.map |
@@ -8,5 +8,6 @@ "use strict"; | ||
class WriteCustomizationContext extends collection_context_1.default { | ||
constructor(collection, caller, action, record) { | ||
constructor(collection, caller, action, record, filter) { | ||
super(collection, caller); | ||
this.action = action; | ||
this.filter = filter; | ||
this.record = Object.freeze({ ...record }); | ||
@@ -16,2 +17,2 @@ } | ||
exports.default = WriteCustomizationContext; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9kZWN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UFBTSxFQUFFLENBQUMsQ0FBQztJQUM3QyxDQUFDO0NBQ0Y7QUFyQkQsNENBcUJDIn0= |
import WriteCustomizationContext from './context'; | ||
import { TCollectionName, TFieldName, TFieldType, TPartialRow, TSchema } from '../../../templates'; | ||
export { WriteCustomizationContext }; | ||
export type WriteDefinition<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>, C extends TFieldName<S, N> = TFieldName<S, N>> = null | ((value: TFieldType<S, N, C>, context: WriteCustomizationContext<S, N>) => Promise<TPartialRow<S, N> | void> | TPartialRow<S, N> | void); | ||
//# sourceMappingURL=types.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvZGVjb3JhdG9ycy93cml0ZS93cml0ZS1yZXBsYWNlL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ== | ||
exports.WriteCustomizationContext = void 0; | ||
const context_1 = __importDefault(require("./context")); | ||
exports.WriteCustomizationContext = context_1.default; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvZGVjb3JhdG9ycy93cml0ZS93cml0ZS1yZXBsYWNlL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLHdEQUFrRDtBQUd6QyxvQ0FIRixpQkFBeUIsQ0FHRSJ9 |
@@ -13,5 +13,5 @@ export { default as CollectionCustomizer } from './collection-customizer'; | ||
export { SegmentDefinition } from './decorators/segment/types'; | ||
export { WriteDefinition } from './decorators/write/write-replace/types'; | ||
export * from './decorators/write/write-replace/types'; | ||
export * from './decorators/hook/types'; | ||
export { default as CollectionCustomizationContext } from './context/collection-context'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -30,2 +30,3 @@ "use strict"; | ||
__exportStar(require("./decorators/actions/types/fields"), exports); | ||
__exportStar(require("./decorators/write/write-replace/types"), exports); | ||
__exportStar(require("./decorators/hook/types"), exports); | ||
@@ -35,2 +36,2 @@ // Context | ||
Object.defineProperty(exports, "CollectionCustomizationContext", { enumerable: true, get: function () { return __importDefault(collection_context_1).default; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxpRUFBMEU7QUFBakUsOElBQUEsT0FBTyxPQUF3QjtBQUN4QyxpRUFBMEU7QUFBakUsOElBQUEsT0FBTyxPQUF3QjtBQUV4Qyw4Q0FBNEI7QUFDNUIsMENBQXdCO0FBRXhCLHVCQUF1QjtBQUN2QixxRUFBbUQ7QUFDbkQsb0VBQWtEO0FBUWxELDBEQUF3QztBQUV4QyxVQUFVO0FBQ1YsbUVBQXlGO0FBQWhGLHFKQUFBLE9BQU8sT0FBa0MifQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxpRUFBMEU7QUFBakUsOElBQUEsT0FBTyxPQUF3QjtBQUN4QyxpRUFBMEU7QUFBakUsOElBQUEsT0FBTyxPQUF3QjtBQUV4Qyw4Q0FBNEI7QUFDNUIsMENBQXdCO0FBRXhCLHVCQUF1QjtBQUN2QixxRUFBbUQ7QUFDbkQsb0VBQWtEO0FBT2xELHlFQUF1RDtBQUN2RCwwREFBd0M7QUFFeEMsVUFBVTtBQUNWLG1FQUF5RjtBQUFoRixxSkFBQSxPQUFPLE9BQWtDIn0= |
{ | ||
"name": "@forestadmin/datasource-customizer", | ||
"version": "1.9.3", | ||
"version": "1.10.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "GPL-3.0", |
450151
5154