Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { name: resourceName, hasUpdate, idField, listField } = options
assert(
isString(resourceName),
`docker-up/resources/generic.js: required string 'name', given: ${resourceName}`
)
assert(
isBoolean(hasUpdate),
`docker-up/resources/generic.js: required boolean 'hasUpdate', given: ${hasUpdate}`
)
assert(
isString(idField),
`docker-up/resources/generic.js: required string 'idField', given: ${idField}`
)
assert(
isNil(listField) || isString(listField),
`docker-up/resources/generic.js: optional string 'listField', given: ${listField}`
)
return function Resource (context) {
const { docker, log } = context
return {
name: resourceName,
create,
down,
inspect,
list,
up,
// TODO implement update using remove and create
update: hasUpdate ? update : () => Future.of(null),
remove
function GenericResource (options) {
const { name: resourceName, hasUpdate, idField, listField } = options
assert(
isString(resourceName),
`docker-up/resources/generic.js: required string 'name', given: ${resourceName}`
)
assert(
isBoolean(hasUpdate),
`docker-up/resources/generic.js: required boolean 'hasUpdate', given: ${hasUpdate}`
)
assert(
isString(idField),
`docker-up/resources/generic.js: required string 'idField', given: ${idField}`
)
assert(
isNil(listField) || isString(listField),
`docker-up/resources/generic.js: optional string 'listField', given: ${listField}`
)
return function Resource (context) {
const { docker, log } = context
return {
name: resourceName,
create,
down,
inspect,
list,
function GenericResource (options) {
const { name: resourceName, hasUpdate, idField, listField } = options
assert(
isString(resourceName),
`docker-up/resources/generic.js: required string 'name', given: ${resourceName}`
)
assert(
isBoolean(hasUpdate),
`docker-up/resources/generic.js: required boolean 'hasUpdate', given: ${hasUpdate}`
)
assert(
isString(idField),
`docker-up/resources/generic.js: required string 'idField', given: ${idField}`
)
assert(
isNil(listField) || isString(listField),
`docker-up/resources/generic.js: optional string 'listField', given: ${listField}`
)
return function Resource (context) {