refactor(plugin-workflow): change files mode to 644 (#755)
This commit is contained in:
parent
2a18967418
commit
58b4febdf8
0
packages/plugins/workflow/client.d.ts
vendored
Executable file → Normal file
0
packages/plugins/workflow/client.d.ts
vendored
Executable file → Normal file
0
packages/plugins/workflow/client.js
Executable file → Normal file
0
packages/plugins/workflow/client.js
Executable file → Normal file
0
packages/plugins/workflow/server.d.ts
vendored
Executable file → Normal file
0
packages/plugins/workflow/server.d.ts
vendored
Executable file → Normal file
0
packages/plugins/workflow/server.js
Executable file → Normal file
0
packages/plugins/workflow/server.js
Executable file → Normal file
@ -36,9 +36,11 @@ export interface Instruction {
|
|||||||
): InstructionResult
|
): InstructionResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type InstructionConstructor<T> = { new(p: Plugin): T };
|
||||||
|
|
||||||
export default function<T extends Instruction>(
|
export default function<T extends Instruction>(
|
||||||
plugin,
|
plugin,
|
||||||
more: { [key: string]: T | { new(p: Plugin): T } } = {}
|
more: { [key: string]: T | InstructionConstructor<T> } = {}
|
||||||
) {
|
) {
|
||||||
const { instructions } = plugin;
|
const { instructions } = plugin;
|
||||||
|
|
||||||
@ -52,13 +54,14 @@ export default function<T extends Instruction>(
|
|||||||
'create',
|
'create',
|
||||||
'update',
|
'update',
|
||||||
'destroy'
|
'destroy'
|
||||||
].reduce((result, key) => Object.assign(result, { [key]: key }), {});
|
].reduce((result, key) => Object.assign(result, {
|
||||||
|
[key]: requireModule(path.isAbsolute(key) ? key : path.join(__dirname, key))
|
||||||
|
}), {});
|
||||||
|
|
||||||
for (const [name, value] of Object.entries({ ...more, ...natives })) {
|
for (const [name, instruction] of Object.entries({ ...more, ...natives })) {
|
||||||
const instruction = typeof value === 'string'
|
instructions.register(name, typeof instruction === 'function'
|
||||||
? requireModule(path.isAbsolute(value) ? value : path.join(__dirname, value))
|
? new (instruction as InstructionConstructor<T>)(plugin)
|
||||||
: value;
|
: instruction
|
||||||
|
);
|
||||||
instructions.register(name, typeof instruction === 'function' ? new instruction(plugin) : instruction);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user