@nexrender/core 1.33.0 → 1.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexrender/core",
3
- "version": "1.33.0",
3
+ "version": "1.34.1",
4
4
  "main": "src/index.js",
5
5
  "author": "Inlife",
6
6
  "scripts": {
@@ -29,5 +29,5 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "gitHead": "6f3bdccfa13723b3b43552193871973ab395d428"
32
+ "gitHead": "39b2419f93f410289ed682559f06eb3af9e2f650"
33
33
  }
package/readme.md CHANGED
@@ -36,6 +36,11 @@ const main = async () => {
36
36
  skipCleanup: true,
37
37
  addLicense: false,
38
38
  debug: true,
39
+ actions: {
40
+ "custom-action": (job, settings, {input, params}, type) => {
41
+ // Custom action code
42
+ }
43
+ },
39
44
  })
40
45
  }
41
46
 
@@ -66,3 +71,4 @@ Second one is responsible for mainly job-related operations of the full cycle: d
66
71
  * `addLicense` - boolean, providing false will disable ae_render_only_node.txt license file auto-creation (true by default)
67
72
  * `forceCommandLinePatch` - boolean, providing true will force patch re-installation
68
73
  * `onInstanceSpawn` - a callback, if provided, gets called when **aerender** instance is getting spawned, with instance pointer. Can be later used to kill a hung aerender process. Callback signature: `function (instance, job, settings) {}`
74
+ * `actions` - an object with keys corresponding to the `module` field when defining an action, value should be a function matching expected signature of an action. Used for defining actions programmatically without needing to package the action as a separate package
@@ -21,10 +21,14 @@ module.exports = actionType => (job, settings) => {
21
21
  settings.logger.log(`[${job.uid}] applying ${actionType} actions...`);
22
22
 
23
23
  return PromiseSerial((job.actions[actionType] || []).map(action => () => {
24
- return requireg(action.module)(job, settings, action, actionType).catch(err => {
25
- return Promise.reject(new Error(`Error loading ${actionType} module ${action.module}: ${err}`))
26
- });
24
+ if(settings.actions[action.module]){
25
+ return settings.actions[action.module](job, settings, action, actionType);
26
+ }else{
27
+ return requireg(action.module)(job, settings, action, actionType);
28
+ }
27
29
  })).then(() => {
28
30
  return Promise.resolve(job)
31
+ }).catch(err => {
32
+ return Promise.reject(new Error(`Error loading ${actionType} module ${action.module}: ${err}`));
29
33
  });
30
34
  }