@sonisoft/now-sdk-ext-cli 1.1.0-alpha.1 → 1.1.0-alpha.2

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/README.md CHANGED
@@ -29,7 +29,7 @@ $ npm install -g @sonisoft/now-sdk-ext-cli
29
29
  $ nex COMMAND
30
30
  running command...
31
31
  $ nex (--version)
32
- @sonisoft/now-sdk-ext-cli/1.1.0-alpha.1 darwin-arm64 node-v22.6.0
32
+ @sonisoft/now-sdk-ext-cli/1.1.0-alpha.2 darwin-arm64 node-v22.6.0
33
33
  $ nex --help [COMMAND]
34
34
  USAGE
35
35
  $ nex COMMAND
@@ -39,6 +39,7 @@ USAGE
39
39
  # Commands
40
40
  <!-- commands -->
41
41
  * [`nex app`](#nex-app)
42
+ * [`nex app install`](#nex-app-install)
42
43
  * [`nex exec SCOPE FILE`](#nex-exec-scope-file)
43
44
  * [`nex help [COMMAND]`](#nex-help-command)
44
45
  * [`nex plugins`](#nex-plugins)
@@ -54,8 +55,6 @@ USAGE
54
55
 
55
56
  ## `nex app`
56
57
 
57
- Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw console output that Scripts - Background outputs to the browser in order to support the execution and result being piped to another command.
58
-
59
58
  ```
60
59
  USAGE
61
60
  $ nex app [--json] [-a <value>] [--log-level debug|warn|error|info|trace] [-u] [-i <value>] [-s <value>]
@@ -71,13 +70,34 @@ GLOBAL FLAGS
71
70
  --log-level=<option> [default: info] Specify level for logging.
72
71
  <options: debug|warn|error|info|trace>
73
72
 
73
+ EXAMPLES
74
+ $ nex app exec global test.js --auth sn_alias
75
+ test
76
+ ```
77
+
78
+ ## `nex app install`
79
+
80
+ Install or Upgrade application(s) from batch definition file
81
+
82
+ ```
83
+ USAGE
84
+ $ nex app install [--json] [-a <value>] [--log-level debug|warn|error|info|trace] [-b] [-d <value>]
85
+
86
+ FLAGS
87
+ -a, --auth=<value> Auth alias to use.
88
+ -b, --batch Install from batch definition file
89
+ -d, --definitionPath=<value> Batch definition file
90
+
91
+ GLOBAL FLAGS
92
+ --json Format output as json.
93
+ --log-level=<option> [default: info] Specify level for logging.
94
+ <options: debug|warn|error|info|trace>
95
+
74
96
  DESCRIPTION
75
- Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw
76
- console output that Scripts - Background outputs to the browser in order to support the execution and result being
77
- piped to another command.
97
+ Install or Upgrade application(s) from batch definition file
78
98
 
79
99
  EXAMPLES
80
- $ nex app exec global test.js --auth sn_alias
100
+ $ nex app install exec global test.js --auth sn_alias
81
101
  test
82
102
  ```
83
103
 
@@ -129,7 +149,7 @@ DESCRIPTION
129
149
  Display help for nex.
130
150
  ```
131
151
 
132
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.31/src/commands/help.ts)_
152
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.32/src/commands/help.ts)_
133
153
 
134
154
  ## `nex plugins`
135
155
 
@@ -152,7 +172,7 @@ EXAMPLES
152
172
  $ nex plugins
153
173
  ```
154
174
 
155
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/index.ts)_
175
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/index.ts)_
156
176
 
157
177
  ## `nex plugins add PLUGIN`
158
178
 
@@ -226,7 +246,7 @@ EXAMPLES
226
246
  $ nex plugins inspect myplugin
227
247
  ```
228
248
 
229
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/inspect.ts)_
249
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/inspect.ts)_
230
250
 
231
251
  ## `nex plugins install PLUGIN`
232
252
 
@@ -275,7 +295,7 @@ EXAMPLES
275
295
  $ nex plugins install someuser/someplugin
276
296
  ```
277
297
 
278
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/install.ts)_
298
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/install.ts)_
279
299
 
280
300
  ## `nex plugins link PATH`
281
301
 
@@ -306,7 +326,7 @@ EXAMPLES
306
326
  $ nex plugins link myplugin
307
327
  ```
308
328
 
309
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/link.ts)_
329
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/link.ts)_
310
330
 
311
331
  ## `nex plugins remove [PLUGIN]`
312
332
 
@@ -347,7 +367,7 @@ FLAGS
347
367
  --reinstall Reinstall all plugins after uninstalling.
348
368
  ```
349
369
 
350
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/reset.ts)_
370
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/reset.ts)_
351
371
 
352
372
  ## `nex plugins uninstall [PLUGIN]`
353
373
 
@@ -375,7 +395,7 @@ EXAMPLES
375
395
  $ nex plugins uninstall myplugin
376
396
  ```
377
397
 
378
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/uninstall.ts)_
398
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/uninstall.ts)_
379
399
 
380
400
  ## `nex plugins unlink [PLUGIN]`
381
401
 
@@ -419,5 +439,5 @@ DESCRIPTION
419
439
  Update installed plugins.
420
440
  ```
421
441
 
422
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.45/src/commands/plugins/update.ts)_
442
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.46/src/commands/plugins/update.ts)_
423
443
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/app/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAE5E,qBAAa,GAAI,SAAQ,oBAAoB,CAAC,OAAO,GAAG,CAAC;IAEvD,MAAM,CAAC,IAAI,KACV;IAED,MAAM,CAAC,WAAW,SAAuQ;IAEzR,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,KAAK;;;;MAKX;IAED,OAAO,CAAC,OAAO,CAAmC;IAE5C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAqD3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/app/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAE5E,qBAAa,GAAI,SAAQ,oBAAoB,CAAC,OAAO,GAAG,CAAC;IAEvD,MAAM,CAAC,IAAI,KACV;IAED,MAAM,CAAC,WAAW,SAAM;IACxB,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,KAAK;;;;MAMX;IAED,OAAO,CAAC,OAAO,CAAmC;IAE5C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0C3B"}
@@ -1,13 +1,11 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable perfectionist/sort-objects */
3
3
  import { Flags } from '@oclif/core';
4
- import { Application, BackgroundScriptExecutor, Logger, NowStringUtil } from '@sonisoft/now-sdk-ext-core';
5
- import fs from 'node:fs';
6
- import path from 'node:path';
4
+ import { Application, Logger, NowStringUtil } from '@sonisoft/now-sdk-ext-core';
7
5
  import { AuthenticatedCommand } from '../../common/authenticated-command.js';
8
6
  export class App extends AuthenticatedCommand {
9
7
  static args = {};
10
- static description = 'Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw console output that Scripts - Background outputs to the browser in order to support the execution and result being piped to another command.';
8
+ static description = '';
11
9
  static examples = [
12
10
  `<%= config.bin %> <%= command.id %> exec global test.js --auth sn_alias
13
11
  test
@@ -24,42 +22,29 @@ test
24
22
  const { args, flags } = await this.parse(App);
25
23
  this.log("App command");
26
24
  if (flags.uninstall) {
27
- this.log("Uninstalling app");
28
- if (NowStringUtil.isStringEmpty(flags.applicationId)) {
29
- this.error("Application ID is required when uninstalling an app");
30
- return;
31
- }
32
- if (NowStringUtil.isStringEmpty(flags.scope)) {
33
- this.error("Scope is required when uninstalling an app");
34
- return;
35
- }
36
- this.log("Passed checks. Uninstalling app.");
37
- const app = new Application(this.instance, flags.scope, flags.applicationId);
38
- await app.changeApplication();
39
- await app.uninstall();
40
- }
41
- if (!NowStringUtil.isStringEmpty(args.file) && !NowStringUtil.isStringEmpty(args.scope)) {
42
- try {
43
- const filePath = path.resolve(args.file);
44
- const script = fs.readFileSync(filePath).toString('utf8');
45
- const scope = args.scope ?? "global";
46
- const executor = new BackgroundScriptExecutor(this.instance, args.scope);
47
- ;
48
- const result = await executor.executeScript(script, scope, this.instance);
49
- this._logger.debug("Ran background script", result);
50
- if (result !== null && result.scriptResults !== null) {
51
- const { scriptResults } = result;
52
- for (const scriptResult of scriptResults) {
53
- this.log(scriptResult.line);
25
+ if (!NowStringUtil.isStringEmpty(args.file) && !NowStringUtil.isStringEmpty(args.scope)) {
26
+ try {
27
+ this.log("Uninstalling app");
28
+ if (NowStringUtil.isStringEmpty(flags.applicationId)) {
29
+ this.error("Application ID is required when uninstalling an app");
30
+ return;
31
+ }
32
+ if (NowStringUtil.isStringEmpty(flags.scope)) {
33
+ this.error("Scope is required when uninstalling an app");
34
+ return;
54
35
  }
36
+ this.log("Passed checks. Uninstalling app.");
37
+ const app = new Application(this.instance, flags.scope, flags.applicationId);
38
+ await app.changeApplication();
39
+ await app.uninstall();
55
40
  }
56
- else {
57
- throw new Error("Response from script execution was null or undefined. Please review logs to identify the problem.");
41
+ catch (error) {
42
+ this._logger.error("Error occurred when executing background script.", error);
43
+ this.error(error);
58
44
  }
59
45
  }
60
- catch (error) {
61
- this._logger.error("Error occurred when executing background script.", error);
62
- this.error(error);
46
+ else {
47
+ this.error("No action specified");
63
48
  }
64
49
  }
65
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/app/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+CAA+C;AAC/C,OAAO,EAAgB,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAG,WAAW,EAAE,wBAAwB,EAAG,MAAM,EAAE,aAAa,EAAuB,MAAM,4BAA4B,CAAC;AACjI,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAE5E,MAAM,OAAO,GAAI,SAAQ,oBAAgC;IAEvD,MAAM,CAAC,IAAI,GAAG,EACb,CAAA;IAED,MAAM,CAAC,WAAW,GAAG,mQAAmQ,CAAC;IAEzR,MAAM,CAAC,QAAQ,GAAG;QAChB;;CAEH;KACE,CAAA;IAED,MAAM,CAAC,KAAK,GAAG;QACb,uFAAuF;QACvF,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;QACxF,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;QAC5F,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;KACxF,CAAA;IAEO,OAAO,GAAU,IAAI,MAAM,CAAC,YA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C,EAAC,CAAC;wBAC3C,IAAI,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;wBACzD,OAAO;oBACT,CAAC;oBAED,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;oBAC7C,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAe,EAAG,KAAK,CAAC,aAAuB,CAAC,CAAC;oBAClG,MAAM,GAAG,CAAC,iBAAiB,EAAE,CAAC;oBAC9B,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;gBAG1B,CAAC;gBAAA,OAAM,KAAK,EAAC,CAAC;oBACZ,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,kDAAkD,EAAE,KAAc,CAAC,CAAC;oBACvF,IAAI,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC;gBAC7B,CAAC;YAEH,CAAC;iBAAI,CAAC;gBACJ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACpC,CAAC;QAGD,CAAC;IAEH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { AuthenticatedCommand } from '../../common/authenticated-command.js';
2
+ export declare class Install extends AuthenticatedCommand<typeof Install> {
3
+ static args: {};
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ batch: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
+ definitionPath: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ };
10
+ private _logger;
11
+ run(): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/app/install.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAE5E,qBAAa,OAAQ,SAAQ,oBAAoB,CAAC,OAAO,OAAO,CAAC;IAE/D,MAAM,CAAC,IAAI,KACV;IAED,MAAM,CAAC,WAAW,SAAkE;IAEpF,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,KAAK;;;MAKX;IAED,OAAO,CAAC,OAAO,CAA0C;IAEnD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2B3B"}
@@ -0,0 +1,40 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { Flags } from '@oclif/core';
3
+ import { ApplicationManager, Logger, NowStringUtil } from '@sonisoft/now-sdk-ext-core';
4
+ import path from 'node:path';
5
+ import { AuthenticatedCommand } from '../../common/authenticated-command.js';
6
+ export class Install extends AuthenticatedCommand {
7
+ static args = {};
8
+ static description = 'Install or Upgrade application(s) from batch definition file';
9
+ static examples = [
10
+ `<%= config.bin %> <%= command.id %> exec global test.js --auth sn_alias
11
+ test
12
+ `,
13
+ ];
14
+ static flags = {
15
+ batch: Flags.boolean({ char: 'b', description: 'Install from batch definition file', required: false }),
16
+ definitionPath: Flags.string({ char: 'd', description: 'Batch definition file', required: false }),
17
+ };
18
+ _logger = new Logger("AppInstallCommand");
19
+ async run() {
20
+ const { args, flags } = await this.parse(Install);
21
+ this.log("App Install Command Executed.");
22
+ if (!NowStringUtil.isStringEmpty(flags.batch) && !NowStringUtil.isStringEmpty(flags.definitionPath)) {
23
+ try {
24
+ this.log("Installing app");
25
+ if (NowStringUtil.isStringEmpty(flags.definitionPath)) {
26
+ this.error("Batch definition patch is required to execute install.");
27
+ return;
28
+ }
29
+ const appManager = new ApplicationManager(this.instance);
30
+ const result = await appManager.installBatch(path.resolve(flags.definitionPath));
31
+ this.log(result.toString());
32
+ }
33
+ catch (error) {
34
+ this._logger.error("Error occurred.", error);
35
+ this.error(error);
36
+ }
37
+ }
38
+ }
39
+ }
40
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/app/install.ts"],"names":[],"mappings":"AAAA,sDAAs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AI,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;oBACrE,OAAO;gBACT,CAAC;gBAED,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAwB,CAAC,CAAC,CAAC;gBAC3F,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YAE9B,CAAC;YAAA,OAAM,KAAK,EAAC,CAAC;gBACZ,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAc,CAAC,CAAC;gBACtD,IAAI,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QAGH,CAAC;IAEH,CAAC"}
@@ -3,7 +3,7 @@
3
3
  "app": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw console output that Scripts - Background outputs to the browser in order to support the execution and result being piped to another command.",
6
+ "description": "",
7
7
  "examples": [
8
8
  "<%= config.bin %> <%= command.id %> exec global test.js --auth sn_alias\ntest\n"
9
9
  ],
@@ -83,6 +83,80 @@
83
83
  "index.js"
84
84
  ]
85
85
  },
86
+ "app:install": {
87
+ "aliases": [],
88
+ "args": {},
89
+ "description": "Install or Upgrade application(s) from batch definition file",
90
+ "examples": [
91
+ "<%= config.bin %> <%= command.id %> exec global test.js --auth sn_alias\ntest\n"
92
+ ],
93
+ "flags": {
94
+ "json": {
95
+ "description": "Format output as json.",
96
+ "helpGroup": "GLOBAL",
97
+ "name": "json",
98
+ "allowNo": false,
99
+ "type": "boolean"
100
+ },
101
+ "auth": {
102
+ "char": "a",
103
+ "description": "Auth alias to use.",
104
+ "name": "auth",
105
+ "required": false,
106
+ "hasDynamicHelp": false,
107
+ "multiple": false,
108
+ "type": "option"
109
+ },
110
+ "log-level": {
111
+ "helpGroup": "GLOBAL",
112
+ "name": "log-level",
113
+ "summary": "Specify level for logging.",
114
+ "default": "info",
115
+ "hasDynamicHelp": false,
116
+ "multiple": false,
117
+ "options": [
118
+ "debug",
119
+ "warn",
120
+ "error",
121
+ "info",
122
+ "trace"
123
+ ],
124
+ "type": "option"
125
+ },
126
+ "batch": {
127
+ "char": "b",
128
+ "description": "Install from batch definition file",
129
+ "name": "batch",
130
+ "required": false,
131
+ "allowNo": false,
132
+ "type": "boolean"
133
+ },
134
+ "definitionPath": {
135
+ "char": "d",
136
+ "description": "Batch definition file",
137
+ "name": "definitionPath",
138
+ "required": false,
139
+ "hasDynamicHelp": false,
140
+ "multiple": false,
141
+ "type": "option"
142
+ }
143
+ },
144
+ "hasDynamicHelp": false,
145
+ "hiddenAliases": [],
146
+ "id": "app:install",
147
+ "pluginAlias": "@sonisoft/now-sdk-ext-cli",
148
+ "pluginName": "@sonisoft/now-sdk-ext-cli",
149
+ "pluginType": "core",
150
+ "strict": true,
151
+ "enableJsonFlag": true,
152
+ "isESM": true,
153
+ "relativePath": [
154
+ "dist",
155
+ "commands",
156
+ "app",
157
+ "install.js"
158
+ ]
159
+ },
86
160
  "exec": {
87
161
  "aliases": [],
88
162
  "args": {
@@ -152,5 +226,5 @@
152
226
  ]
153
227
  }
154
228
  },
155
- "version": "1.1.0-alpha.1"
229
+ "version": "1.1.0-alpha.2"
156
230
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sonisoft/now-sdk-ext-cli",
3
3
  "description": "A CLI extending the functionality of the ServiceNow SDK.",
4
- "version": "1.1.0-alpha.1",
4
+ "version": "1.1.0-alpha.2",
5
5
  "author": "Chris Nanda",
6
6
  "bin": {
7
7
  "nex": "./bin/run.js"
@@ -18,7 +18,7 @@
18
18
  "@servicenow/sdk-cli-core": "3.0.2",
19
19
  "@servicenow/sdk-core": "3.0.2",
20
20
  "@servicenow/sdk-project": "3.0.2",
21
- "@sonisoft/now-sdk-ext-core": "^1.0.0-alpha.32",
21
+ "@sonisoft/now-sdk-ext-core": "^1.0.0-alpha.33",
22
22
  "@ts-morph/common": "^0.24.0",
23
23
  "cometd": "^8.0.4",
24
24
  "cometd-nodejs-client": "^2.0.0",