/** * Set value. * * @param {*} value * @param {Object?} labels * @param {Number?} timestamp * @returns * @memberof InfoMetric */ set(value, labels, timestamp) { const hash = this.hashingLabels(labels); let item = this.values.get(hash); if (item) { if (value != item.value) { item.value = value; item.timestamp = timestamp == null ? Date.now() : timestamp; this.changed(value, labels, timestamp); } } else { item = { value, labels: pick(labels, this.labelNames), timestamp: timestamp == null ? Date.now() : timestamp }; this.values.set(hash, item); this.changed(value, labels, timestamp); } return item; }
item = { value, labels: pick(labels, this.labelNames), timestamp: timestamp == null ? Date.now() : timestamp, };
safeResponse() { return pick(this, [ 'id', 'firstName', 'lastName', 'email', 'createdAt', 'updatedAt', ]); }
program .command('list-identifiers <baseUrl>') .option('-p, --metadata-prefix <prefix>') .option('-f, --from <DATE>', 'from date YYYY-MM-DD or ISO8601') .option('-u, --until <DATE>', 'from date YYYY-MM-DD or ISO8601') .option('-s, --set <SETSPEC>', 'set specifier, e.g., "math"') .action((baseUrl, _options) => wrapAsync(async () => { const options = pick(_options, 'metadataPrefix', 'from', 'until', 'set') const oaiPmh = new OaiPmh(baseUrl) await printList(oaiPmh.listIdentifiers(options)) }))
/** * Extract options from request query and return the object subset. */ public getOptionsFromQuery(query) { return this._parseQuery(pick(query, spindleOptions)) }
async configure (settings) { if (!settings || typeof settings !== 'object') throw new Error('Invalid argument') // manifest updates let manifestUpdates = pick(settings, DAT_CONFIGURABLE_FIELDS) if (Object.keys(manifestUpdates).length === 0) { // no manifest updates return } await pda.updateManifest(this._dataStructure, settings) }
program .command('list-metadata-formats <baseUrl>') .option('-i, --identifier <id>') .action((baseUrl, _options) => wrapAsync(async () => { const options = pick(_options, 'identifier') const oaiPmh = new OaiPmh(baseUrl) const result = await oaiPmh.listMetadataFormats(options) printJson(result) }))
overrideConfiguration(name, value) { const current = pick(this.props, 'viewType', 'markEdits', 'language'); const newConfiguration = { ...current, [name]: value }; this.props.onChange(newConfiguration); }
/** * Validates that the keys required for message update are set on the target * object and that each key's value is of the correct type. * @function validateUpdateManifest * @returns {Boolean} - returns a boolean indicating whether or not the * instances required keys are correctly set for the update payload export */ validateUpdateManifest () { return every(pick(this, REQUIRED_MSG_UPDATE_EXPORT_KEYS), isString); }
async create (params) { const order = pick(params, [ 'age.code', 'age.name', 'brand.code', 'brand.name', 'model.code', 'model.name' ]) return this.__model.create(order) }
program .command('list-records <baseUrl>') .option('-p, --metadata-prefix <prefix>') .option('-f, --from <DATE>', 'from date YYYY-MM-DD or ISO8601') .option('-u, --until <DATE>', 'from date YYYY-MM-DD or ISO8601') .option('-s, --set <SETSPEC>', 'set specifier, e.g., "math"') .action((baseUrl, _options) => wrapAsync(async () => { const options = pick(_options, 'metadataPrefix', 'from', 'until', 'set') const oaiPmh = new OaiPmh(baseUrl) await printList(oaiPmh.listRecords(options)) }))
/** * Validates that the keys required for basic message creation are set on * the target object and that each key's value is of the correct type. * @function validateCreateManifest * @returns {Boolean} - returns a boolean indicating whether or not the * instances required keys are correctly set for creation payload export */ validateCreateManifest () { return every(pick(this, REQUIRED_MSG_CREATE_EXPORT_KEYS), isString); }
safeResponse() { return pick(this, [ 'id', 'firstName', 'lastName', 'email', 'createdAt', 'updatedAt', ]); }
getElementRects() { return pick(this, [ `elementRect`, `contentRect`, `elementWorldRect`, `contentWorldRect`, `elementClipRect`, `contentClipRect`, `scrollRect` ]); }