Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const futureCurrentSpec = stackResource.list().map(StackSpec.fromInspect)
const futureNextSpec = getConfig(rawConfig)
.chain(config =>
Future((reject, resolve) => {
StackConfig.validate(config).matchWith({
Failure: ({ value }) => {
reject(createValidationError(value))
},
Success: ({ value }) => resolve(value)
})
})
)
.map(StackSpec.fromConfig)
return Future.parallel(Infinity, [futureCurrentSpec, futureNextSpec]).map(
([currentSpec, nextSpec]) => {
log.info({
current: currentSpec,
next: nextSpec
})
return diffSpecs(currentSpec, nextSpec)
}
)
}
.chain(reqs => Future.parallel(batchSize, reqs))));
function patch (diff) {
return Future.parallel(Infinity, [
patchResource(networkResource)(diff.networks),
patchResource(volumeResource)(diff.volumes)
]).chain(() => patchResource(serviceResource)(diff.services))
}
}
apNixConfigPath =>
parallel(
1,
apNixConfigPath([
Action.updateEditorConfig(
SELECTED_ENV_CONFIG_KEY,
config,
workspaceRoot
),
flow(
Action.applyEnvByNixConfPath(getShellCmd("env")),
map(showStatus(Label.SELECTED_ENV_NEED_RELOAD, none))
),
Action.askReload
])
).map(some)
)
function list () {
return Future.parallel(Infinity, [
networkResource.list(),
serviceResource.list(),
volumeResource.list()
])
.map(([networks, services, volumes]) => ({
networks,
services,
volumes
}))
.map(
evolve({
networks: filter(complement(isDefaultNetwork))
})
)
}
return diff => {
return Future.parallel(10, [
...map(resource.create, diff.create),
...map(resource.update, diff.update),
...map(resource.remove, diff.remove)
])
}
}