Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const authentication = require('@feathersjs/authentication');
const errors = require('@feathersjs/errors');
const logger = require('winston');
const SKIP = require('@feathersjs/feathers').SKIP;
const dbtimestamp = require('../../hooks/dbtimestamp');
const ensureMatchingUUID = require('../../hooks/ensureuuid');
const internalOnly = require('../../hooks/internalonly');
const internalApi = require('../../hooks/internalapi');
const updateApiRequiredFields = [
'commit',
'manifest'
];
class UpdateHooks {
constructor() {
}
/*
- Other hooks anywhere set context.result.
Semaphores:
- params.$ignoreDeletedAt
softDelete2() is a no-op for any call with set to true. This allows you to make service calls
while ignoring the deletedAt prop. You are then responsible for setting & maintaining deletedAt.
- params.$disableSoftDelete2
Set to true for probing get and removing patch service calls made by softDelete().
Custom replacements functions for these calls must set this as well.
These types of calls do not run all the get or patch hooks.
- Calls made on the server can set these param props. Clients cannot without server code allowing
them to do so. You should not use softDelete if you decide this is a security weakness.
*/
const errors = require('@feathersjs/errors');
const SKIP = require('@feathersjs/feathers').SKIP;
const { callingParams } = require('./calling-params');
const defaultDeletedAt = 'deletedAt';
const deletedMessage = 'Record not found, is logically deleted.';
module.exports = function (options = {}) {
const keepOnCreate = !!options.keepOnCreate;
const skipProbeOnGet = !!options.skipProbeOnGet;
const allowIgnoreDeletedAt = 'allowIgnoreDeletedAt' in options ? !!options.allowIgnoreDeletedAt : true;
const patchCall = options.patchCall || defaultPatchCall;
const deletedAt = options.deletedAt || 'deletedAt';
return async function (context) {
const method = context.method;
const hasId = context.id !== undefined && context.id !== null;