@extrahorizon/exh-cli 1.10.1 → 1.11.0-dev-116-019a889

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/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Extra Horizon CLI changelog
2
2
 
3
+ ### v1.11.0
4
+ * Added `defaultPriority` as an option to the task config
5
+
3
6
  ### v1.10.1
4
7
  * Updated the ExH SDK to `8.8.1` to fix a security warning from `axios`
5
8
 
@@ -1,7 +1,7 @@
1
1
  /// <reference types="yargs" />
2
2
  export declare const command = "sync";
3
3
  export declare const desc = "Sync a task. Will create the task first if it doesn't exist yet";
4
- export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "description" | "code" | "name" | "path" | "entryPoint" | "runtime" | "env" | "timeLimit" | "memoryLimit" | "executionPermission"> & import("yargs").InferredOptionTypes<{
4
+ export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "description" | "code" | "name" | "path" | "entryPoint" | "runtime" | "env" | "timeLimit" | "memoryLimit" | "executionPermission" | "defaultPriority"> & import("yargs").InferredOptionTypes<{
5
5
  path: {
6
6
  demandOption: false;
7
7
  describe: string;
@@ -49,6 +49,9 @@ export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs
49
49
  executionPermission: {
50
50
  type: "string";
51
51
  };
52
+ defaultPriority: {
53
+ type: "number";
54
+ };
52
55
  }>>;
53
56
  export declare const handler: ({ sdk, ...cmdLineParams }: {
54
57
  [x: string]: any;
@@ -59,6 +59,9 @@ const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
59
59
  executionPermission: {
60
60
  type: 'string',
61
61
  },
62
+ defaultPriority: {
63
+ type: 'number',
64
+ },
62
65
  })
63
66
  .check(async ({ path, entryPoint, runtime, name, code, executionPermission }) => {
64
67
  if (!path && (!name || !code || !runtime || !entryPoint)) {
@@ -87,8 +90,14 @@ async function syncSingleTask(sdk, config) {
87
90
  code: file.toString('base64'),
88
91
  runtime: config.runtime,
89
92
  };
93
+ if (config.executionPermission || config.defaultPriority) {
94
+ request.executionOptions = {};
95
+ }
96
+ if (config.defaultPriority) {
97
+ request.executionOptions.defaultPriority = config.defaultPriority;
98
+ }
90
99
  if (config.executionPermission) {
91
- request.executionOptions = { permissionMode: config.executionPermission };
100
+ request.executionOptions.permissionMode = config.executionPermission;
92
101
  }
93
102
  if (config.timeLimit) {
94
103
  request.timeLimit = config.timeLimit;
@@ -13,6 +13,7 @@ export interface TaskConfig {
13
13
  memoryLimit?: number;
14
14
  environment?: Record<string, string>;
15
15
  executionPermission?: permissionModes;
16
+ defaultPriority?: number;
16
17
  retryPolicy?: {
17
18
  enabled: boolean;
18
19
  errorsToRetry: string[];
@@ -25,4 +26,4 @@ export interface TaskConfig {
25
26
  export declare function assertExecutionPermission(mode: string): asserts mode is permissionModes | undefined;
26
27
  export declare function validateConfig(config: TaskConfig): Promise<boolean>;
27
28
  export declare function loadSingleConfigFile(path: string): Promise<TaskConfig>;
28
- export declare function getValidatedConfigIterator({ path, name, code, entryPoint, runtime, description, timeLimit, memoryLimit, executionPermission, env }: any): AsyncGenerator<TaskConfig>;
29
+ export declare function getValidatedConfigIterator({ path, name, code, entryPoint, runtime, description, timeLimit, memoryLimit, executionPermission, env, defaultPriority }: any): AsyncGenerator<TaskConfig>;
@@ -99,7 +99,7 @@ async function loadSingleConfigFile(path) {
99
99
  return taskConfig;
100
100
  }
101
101
  exports.loadSingleConfigFile = loadSingleConfigFile;
102
- async function* getValidatedConfigIterator({ path, name, code, entryPoint, runtime, description, timeLimit, memoryLimit, executionPermission, env }) {
102
+ async function* getValidatedConfigIterator({ path, name, code, entryPoint, runtime, description, timeLimit, memoryLimit, executionPermission, env, defaultPriority }) {
103
103
  let taskConfig = {};
104
104
  if (path) {
105
105
  const stat = await fs.stat(path);
@@ -147,6 +147,9 @@ async function* getValidatedConfigIterator({ path, name, code, entryPoint, runti
147
147
  if (executionPermission) {
148
148
  taskConfig.executionPermission = executionPermission;
149
149
  }
150
+ if (defaultPriority) {
151
+ taskConfig.defaultPriority = defaultPriority;
152
+ }
150
153
  if (env && env.length) {
151
154
  const envArr = Array.isArray(env) ? env : [env];
152
155
  taskConfig.environment = envArr.map(e => e.split('=')).filter(e => e.length === 2).reduce((prev, curr) => ({ ...prev, [curr[0]]: curr[1] }), {});
@@ -71,6 +71,10 @@
71
71
  "public"
72
72
  ]
73
73
  },
74
+ "defaultPriority": {
75
+ "description": "The default priority assigned to all tasks created for this function, unless a priority is specified for a task explicitly",
76
+ "type": "integer"
77
+ },
74
78
  "environment": {
75
79
  "description": "The environment variables added to the Function execution runtime.",
76
80
  "type": "object",
@@ -10,7 +10,8 @@ export interface FunctionCreation {
10
10
  memoryLimit?: number;
11
11
  environmentVariables?: Record<string, any>;
12
12
  executionOptions?: {
13
- permissionMode: permissionModes;
13
+ permissionMode?: permissionModes;
14
+ defaultPriority?: number;
14
15
  };
15
16
  retryPolicy?: {
16
17
  enabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/exh-cli",
3
- "version": "1.10.1",
3
+ "version": "1.11.0-dev-116-019a889",
4
4
  "main": "build/index.js",
5
5
  "exports": "./build/index.js",
6
6
  "license": "MIT",