Skip to content

Commit

Permalink
refactor(core): simplify namespace definition
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Feb 17, 2024
1 parent 361df0a commit 1e08b2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/core/lib/plugins/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default {
// If raw_input is activated, just pass arguments as is
// Always one action since arguments are erased
if (child?.metadata?.raw_input) {
action.args = args;
action.metadata.raw_input = true;
}
action.args = args;
Expand Down
13 changes: 5 additions & 8 deletions packages/core/lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,13 @@ const session = function(args, options = {}) {
return contextualize([
...args,
{
$namespace: namespace
$namespace: namespace || []
}
]);
}
});
action.parent = options.parent;
action.plugins = plugins;
if (action.metadata.namespace == null) {
action.metadata.namespace = [];
}
// Initialize the registry to manage action registration
action.registry = registry.create({
plugins: action.plugins,
Expand Down Expand Up @@ -141,12 +138,12 @@ const session = function(args, options = {}) {
const result = new Promise(async function(resolve, reject) {
try {
// Hook intented to modify the current action being created
action = (await action.plugins.call({
name: 'nikita:normalize',
action = await action.plugins.call({
name: "nikita:normalize",
args: action,
hooks: action.hooks?.on_normalize || action.on_normalize,
handler: normalize
}));
handler: normalize,
});
} catch (error) {
schedulers.out.end(error);
return reject(error);
Expand Down

0 comments on commit 1e08b2c

Please sign in to comment.