@codifycli/plugin-core 1.1.0-beta16 → 1.1.0-beta17

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.
@@ -8,8 +8,13 @@ export declare class Plugin {
8
8
  resourceControllers: Map<string, ResourceController<ResourceConfig>>;
9
9
  planStorage: Map<string, Plan<any>>;
10
10
  planPty: BackgroundPty;
11
- constructor(name: string, resourceControllers: Map<string, ResourceController<ResourceConfig>>);
12
- static create(name: string, resources: Resource<any>[]): Plugin;
11
+ minSupportedCliVersion: string | undefined;
12
+ constructor(name: string, resourceControllers: Map<string, ResourceController<ResourceConfig>>, options?: {
13
+ minSupportedCliVersion?: string;
14
+ });
15
+ static create(name: string, resources: Resource<any>[], options?: {
16
+ minSupportedCliVersion?: string;
17
+ }): Plugin;
13
18
  initialize(data: InitializeRequestData): Promise<InitializeResponseData>;
14
19
  getResourceInfo(data: GetResourceInfoRequestData): GetResourceInfoResponseData;
15
20
  match(data: MatchRequestData): Promise<MatchResponseData>;
@@ -11,16 +11,18 @@ export class Plugin {
11
11
  resourceControllers;
12
12
  planStorage;
13
13
  planPty = new BackgroundPty();
14
- constructor(name, resourceControllers) {
14
+ minSupportedCliVersion;
15
+ constructor(name, resourceControllers, options) {
15
16
  this.name = name;
16
17
  this.resourceControllers = resourceControllers;
17
18
  this.planStorage = new Map();
19
+ this.minSupportedCliVersion = options?.minSupportedCliVersion;
18
20
  }
19
- static create(name, resources) {
21
+ static create(name, resources, options) {
20
22
  const controllers = resources
21
23
  .map((resource) => new ResourceController(resource));
22
24
  const controllersMap = new Map(controllers.map((r) => [r.typeId, r]));
23
- return new Plugin(name, controllersMap);
25
+ return new Plugin(name, controllersMap, options);
24
26
  }
25
27
  async initialize(data) {
26
28
  if (data.verbosityLevel) {
@@ -30,6 +32,7 @@ export class Plugin {
30
32
  await controller.initialize();
31
33
  }
32
34
  return {
35
+ minSupportedCliVersion: this.minSupportedCliVersion,
33
36
  resourceDefinitions: [...this.resourceControllers.values()]
34
37
  .map((r) => {
35
38
  const sensitiveParameters = Object.entries(r.settings.parameterSettings ?? {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codifycli/plugin-core",
3
- "version": "1.1.0-beta16",
3
+ "version": "1.1.0-beta17",
4
4
  "description": "TypeScript library for building Codify plugins to manage system resources (applications, CLI tools, settings) through infrastructure-as-code",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "license": "ISC",
37
37
  "dependencies": {
38
- "@codifycli/schemas": "1.1.0-beta5",
38
+ "@codifycli/schemas": "1.1.0-beta6",
39
39
  "@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
40
40
  "ajv": "^8.18.0",
41
41
  "ajv-formats": "^2.1.1",
@@ -31,15 +31,22 @@ import { VerbosityLevel } from '../utils/verbosity-level.js';
31
31
  export class Plugin {
32
32
  planStorage: Map<string, Plan<any>>;
33
33
  planPty = new BackgroundPty();
34
+ minSupportedCliVersion: string | undefined;
34
35
 
35
36
  constructor(
36
37
  public name: string,
37
- public resourceControllers: Map<string, ResourceController<ResourceConfig>>
38
+ public resourceControllers: Map<string, ResourceController<ResourceConfig>>,
39
+ options?: { minSupportedCliVersion?: string }
38
40
  ) {
39
41
  this.planStorage = new Map();
42
+ this.minSupportedCliVersion = options?.minSupportedCliVersion;
40
43
  }
41
44
 
42
- static create(name: string, resources: Resource<any>[]) {
45
+ static create(
46
+ name: string,
47
+ resources: Resource<any>[],
48
+ options?: { minSupportedCliVersion?: string }
49
+ ) {
43
50
  const controllers = resources
44
51
  .map((resource) => new ResourceController(resource))
45
52
 
@@ -47,7 +54,7 @@ export class Plugin {
47
54
  controllers.map((r) => [r.typeId, r] as const)
48
55
  );
49
56
 
50
- return new Plugin(name, controllersMap);
57
+ return new Plugin(name, controllersMap, options);
51
58
  }
52
59
 
53
60
  async initialize(data: InitializeRequestData): Promise<InitializeResponseData> {
@@ -60,6 +67,7 @@ export class Plugin {
60
67
  }
61
68
 
62
69
  return {
70
+ minSupportedCliVersion: this.minSupportedCliVersion,
63
71
  resourceDefinitions: [...this.resourceControllers.values()]
64
72
  .map((r) => {
65
73
  const sensitiveParameters = Object.entries(r.settings.parameterSettings ?? {})