Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function (target, property) {
if (!property) {
throw Error("Decorator should be used on property only!");
}
var meta = metadata.getOrCreateOwn(metadata.properties, ModelMetadata, target);
meta.serializableProps.push(property);
meta.propertyDefs[property] = {
enumerable: true,
get: target.propertyGetter(property),
set: target.propertySetter(property)
};
meta.propertyDefs["_" + property] = {
enumerable: false,
value: defaultValue,
writable: true
};
};
}
function UIDataModel(id) {
this.busy = false;
this.idProperty = "id";
this.loaded = false;
this.metadata = metadata.getOrCreateOwn(metadata.properties, ModelMetadata, Object.getPrototypeOf(this));
Object.defineProperties(this, this.metadata.propertyDefs);
this.metadata.original = __assign({}, this.serialize());
this.metadata.updated = __assign({}, this.serialize());
Object.defineProperties(this, {
apiSlug: {
enumerable: false,
writable: true
},
busy: {
enumerable: false
},
httpClient: {
enumerable: false,
value: Container.instance.get(UIHttpService),
writable: false
},
return (target, property) => {
if (!property) {
throw Error("Decorator should be used on property only!");
}
const meta = Metadata.getOrCreateOwn(
Metadata.properties,
ModelMetadata,
target
) as ModelMetadata;
meta.serializableProps.push(property);
meta.propertyDefs[property] = {
enumerable: true,
get: target.propertyGetter(property),
set: target.propertySetter(property)
};
meta.propertyDefs["_" + property] = {
enumerable: false,
value: defaultValue,
writable: true
};
};
constructor(options: any = {}) {
this.metadata = Metadata.getOrCreateOwn(Metadata.properties, DSMetadata, Object.getPrototypeOf(this)) as DSMetadata;
this.logger = getLogger(this.constructor.name);
options = Object.assign({}, DEFAULT_OPTIONS, options);
Object.keys(options).forEach(key => (this.hasOwnProperty(key) && (this[key] = options[key]))
|| (this.metadata.hasOwnProperty(key) && (this.metadata[key] = options[key])));
}
return (target, property) => {
if (!property) {
throw Error("Decorator should be used on property only!");
}
const meta = Metadata.getOrCreateOwn(
Metadata.properties,
ModelMetadata,
target
) as ModelMetadata;
meta.serializableProps.push(property);
meta.propertyDefs[property] = {
enumerable: true,
get: target.propertyGetter(property),
set: target.propertySetter(property)
};
meta.propertyDefs["_" + property] = {
enumerable: false,
value: defaultValue,
writable: true
};
};
return (target, property) => {
if (!property) {
throw Error("Decorator should be used on property only!");
}
const meta = metadata.getOrCreateOwn(metadata.properties, ModelMetadata, target);
meta.serializableProps.push(property);
meta.propertyDefs[property] = {
enumerable: true,
get: target.propertyGetter(property),
set: target.propertySetter(property)
};
meta.propertyDefs["_" + property] = {
enumerable: false,
value: defaultValue,
writable: true
};
};
}
constructor(id) {
this.busy = false;
this.loaded = false;
this.idProperty = 'id';
this.metadata = Metadata.getOrCreateOwn(Metadata.properties, ModelMetadata, Object.getPrototypeOf(this));
Object.defineProperties(this, this.metadata.propertyDefs);
this.metadata.original = _.cloneDeep(this.serialize());
this.metadata.updated = _.cloneDeep(this.serialize());
Object.defineProperties(this, {
id: {
enumerable: true,
writable: true
},
apiSlug: {
enumerable: false,
writable: true
},
idProperty: {
enumerable: false,
writable: true
},
constructor(options = {}) {
this.data = [];
this.busy = false;
this.loaded = false;
this.paginate = false;
this.metadata = Metadata.getOrCreateOwn(Metadata.properties, DSMetadata, Object.getPrototypeOf(this));
this.logger = getLogger(this.constructor.name);
options = Object.assign({}, DEFAULT_OPTIONS, options);
Object.keys(options).forEach(key => (this.hasOwnProperty(key) && (this[key] = options[key]))
|| (this.metadata.hasOwnProperty(key) && (this.metadata[key] = options[key])));
}
load(dataList = []) {
constructor(id?) {
this.metadata = Metadata.getOrCreateOwn(Metadata.properties, ModelMetadata, Object.getPrototypeOf(this)) as ModelMetadata;
Object.defineProperties(this, this.metadata.propertyDefs);
this.metadata.original = _.cloneDeep(this.serialize());
this.metadata.updated = _.cloneDeep(this.serialize());
Object.defineProperties(this, {
id: {
enumerable: true,
writable: true
},
apiSlug: {
enumerable: false,
writable: true
},
idProperty: {
enumerable: false,