codify-plugin-lib 1.0.182-beta1 → 1.0.182-beta3

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/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './resource/resource.js';
11
11
  export * from './resource/resource-settings.js';
12
12
  export * from './stateful-parameter/stateful-parameter.js';
13
13
  export * from './utils/index.js';
14
+ export * from './utils/verbosity-level.js';
14
15
  export declare function runPlugin(plugin: Plugin): Promise<void>;
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ export * from './resource/resource.js';
11
11
  export * from './resource/resource-settings.js';
12
12
  export * from './stateful-parameter/stateful-parameter.js';
13
13
  export * from './utils/index.js';
14
+ export * from './utils/verbosity-level.js';
14
15
  export async function runPlugin(plugin) {
15
16
  const messageHandler = new MessageHandler(plugin);
16
17
  process.on('message', (message) => messageHandler.onMessage(message));
@@ -4,8 +4,8 @@ import { BackgroundPty } from '../pty/background-pty.js';
4
4
  import { getPty } from '../pty/index.js';
5
5
  import { SequentialPty } from '../pty/seqeuntial-pty.js';
6
6
  import { ResourceController } from '../resource/resource-controller.js';
7
- import { VerbosityLevel } from '../utils/internal-utils.js';
8
7
  import { ptyLocalStorage } from '../utils/pty-local-storage.js';
8
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
9
9
  export class Plugin {
10
10
  name;
11
11
  resourceControllers;
@@ -6,7 +6,7 @@ import * as fs from 'node:fs/promises';
6
6
  import stripAnsi from 'strip-ansi';
7
7
  import { debugLog } from '../utils/debug.js';
8
8
  import { Shell, Utils } from '../utils/index.js';
9
- import { VerbosityLevel } from '../utils/internal-utils.js';
9
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
10
10
  import { SpawnError } from './index.js';
11
11
  import { PromiseQueue } from './promise-queue.js';
12
12
  EventEmitter.defaultMaxListeners = 1000;
@@ -2,7 +2,7 @@ import pty from '@homebridge/node-pty-prebuilt-multiarch';
2
2
  import { EventEmitter } from 'node:events';
3
3
  import stripAnsi from 'strip-ansi';
4
4
  import { Shell, Utils } from '../utils/index.js';
5
- import { VerbosityLevel } from '../utils/internal-utils.js';
5
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
6
6
  import { SpawnError, SpawnStatus } from './index.js';
7
7
  EventEmitter.defaultMaxListeners = 1000;
8
8
  /**
@@ -35,7 +35,7 @@ export class SequentialPty {
35
35
  // Initial terminal dimensions
36
36
  const initialCols = process.stdout.columns ?? 80;
37
37
  const initialRows = process.stdout.rows ?? 24;
38
- const args = (options?.interactive ?? true) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`];
38
+ const args = (options?.interactive ?? false) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`];
39
39
  // Run the command in a pty for interactivity
40
40
  const mPty = pty.spawn(this.getDefaultShell(), args, {
41
41
  ...options,
@@ -1,4 +1,5 @@
1
1
  import { OS } from 'codify-schemas';
2
+ export declare function isDebug(): boolean;
2
3
  export declare enum Shell {
3
4
  ZSH = "zsh",
4
5
  BASH = "bash",
@@ -1,5 +1,8 @@
1
1
  import os from 'node:os';
2
2
  import path from 'node:path';
3
+ export function isDebug() {
4
+ return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
5
+ }
3
6
  export var Shell;
4
7
  (function (Shell) {
5
8
  Shell["ZSH"] = "zsh";
@@ -1,10 +1,4 @@
1
1
  import { ResourceConfig, StringIndexedObject } from 'codify-schemas';
2
- export declare const VerbosityLevel: {
3
- level: number;
4
- get(): number;
5
- set(level: number): void;
6
- };
7
- export declare function isDebug(): boolean;
8
2
  export declare function splitUserConfig<T extends StringIndexedObject>(config: ResourceConfig & T): {
9
3
  parameters: T;
10
4
  coreParameters: ResourceConfig;
@@ -1,17 +1,5 @@
1
1
  import os from 'node:os';
2
2
  import path from 'node:path';
3
- export const VerbosityLevel = new class {
4
- level = 0;
5
- get() {
6
- return this.level;
7
- }
8
- set(level) {
9
- this.level = level;
10
- }
11
- };
12
- export function isDebug() {
13
- return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
14
- }
15
3
  export function splitUserConfig(config) {
16
4
  const coreParameters = {
17
5
  type: config.type,
@@ -0,0 +1,5 @@
1
+ export declare const VerbosityLevel: {
2
+ level: number;
3
+ get(): number;
4
+ set(level: number): void;
5
+ };
@@ -0,0 +1,9 @@
1
+ export const VerbosityLevel = new class {
2
+ level = 0;
3
+ get() {
4
+ return this.level;
5
+ }
6
+ set(level) {
7
+ this.level = level;
8
+ }
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.182-beta1",
3
+ "version": "1.0.182-beta3",
4
4
  "description": "Library plugin library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './resource/resource.js'
13
13
  export * from './resource/resource-settings.js'
14
14
  export * from './stateful-parameter/stateful-parameter.js'
15
15
  export * from './utils/index.js'
16
+ export * from './utils/verbosity-level.js'
16
17
 
17
18
  export async function runPlugin(plugin: Plugin) {
18
19
  const messageHandler = new MessageHandler(plugin);
@@ -24,8 +24,8 @@ import { getPty } from '../pty/index.js';
24
24
  import { SequentialPty } from '../pty/seqeuntial-pty.js';
25
25
  import { Resource } from '../resource/resource.js';
26
26
  import { ResourceController } from '../resource/resource-controller.js';
27
- import { VerbosityLevel } from '../utils/internal-utils.js';
28
27
  import { ptyLocalStorage } from '../utils/pty-local-storage.js';
28
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
29
29
 
30
30
  export class Plugin {
31
31
  planStorage: Map<string, Plan<any>>;
@@ -7,7 +7,7 @@ import stripAnsi from 'strip-ansi';
7
7
 
8
8
  import { debugLog } from '../utils/debug.js';
9
9
  import { Shell, Utils } from '../utils/index.js';
10
- import { VerbosityLevel } from '../utils/internal-utils.js';
10
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
11
11
  import { IPty, SpawnError, SpawnOptions, SpawnResult } from './index.js';
12
12
  import { PromiseQueue } from './promise-queue.js';
13
13
 
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
3
3
  import stripAnsi from 'strip-ansi';
4
4
 
5
5
  import { Shell, Utils } from '../utils/index.js';
6
- import { VerbosityLevel } from '../utils/internal-utils.js';
6
+ import { VerbosityLevel } from '../utils/verbosity-level.js';
7
7
  import { IPty, SpawnError, SpawnOptions, SpawnResult, SpawnStatus } from './index.js';
8
8
 
9
9
  EventEmitter.defaultMaxListeners = 1000;
@@ -46,7 +46,7 @@ export class SequentialPty implements IPty {
46
46
  const initialCols = process.stdout.columns ?? 80;
47
47
  const initialRows = process.stdout.rows ?? 24;
48
48
 
49
- const args = (options?.interactive ?? true) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`]
49
+ const args = (options?.interactive ?? false) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`]
50
50
 
51
51
  // Run the command in a pty for interactivity
52
52
  const mPty = pty.spawn(this.getDefaultShell(), args, {
@@ -2,6 +2,10 @@ import { OS } from 'codify-schemas';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
 
5
+ export function isDebug(): boolean {
6
+ return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
7
+ }
8
+
5
9
  export enum Shell {
6
10
  ZSH = 'zsh',
7
11
  BASH = 'bash',
@@ -2,22 +2,6 @@ import { ResourceConfig, StringIndexedObject } from 'codify-schemas';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
 
5
- export const VerbosityLevel = new class {
6
- level = 0;
7
-
8
- get() {
9
- return this.level;
10
- }
11
-
12
- set(level: number) {
13
- this.level = level;
14
- }
15
- }
16
-
17
- export function isDebug(): boolean {
18
- return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
19
- }
20
-
21
5
  export function splitUserConfig<T extends StringIndexedObject>(
22
6
  config: ResourceConfig & T
23
7
  ): { parameters: T; coreParameters: ResourceConfig } {
@@ -0,0 +1,11 @@
1
+ export const VerbosityLevel = new class {
2
+ level = 0;
3
+
4
+ get() {
5
+ return this.level;
6
+ }
7
+
8
+ set(level: number) {
9
+ this.level = level;
10
+ }
11
+ }