@codifycli/plugin-core 1.0.1 → 1.1.0-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.
@@ -0,0 +1,5 @@
1
+ {
2
+ "disabledMcpjsonServers": [
3
+ "supabase"
4
+ ]
5
+ }
@@ -87,7 +87,9 @@ export class Plugin {
87
87
  operatingSystems: resource.settings.operatingSystems,
88
88
  linuxDistros: resource.settings.linuxDistros,
89
89
  sensitiveParameters,
90
- allowMultiple
90
+ allowMultiple,
91
+ defaultConfig: resource.settings.defaultConfig,
92
+ exampleConfigs: resource.settings.exampleConfigs,
91
93
  };
92
94
  }
93
95
  async match(data) {
@@ -1,7 +1,7 @@
1
1
  import { LinuxDistro, OS, StringIndexedObject } from '@codifycli/schemas';
2
2
  import { JSONSchemaType } from 'ajv';
3
3
  import { StatefulParameterController } from '../stateful-parameter/stateful-parameter-controller.js';
4
- import { ArrayParameterSetting, DefaultParameterSetting, InputTransformation, ResourceSettings } from './resource-settings.js';
4
+ import { ArrayParameterSetting, DefaultParameterSetting, ExampleConfigs, InputTransformation, ResourceSettings } from './resource-settings.js';
5
5
  export interface ParsedStatefulParameterSetting extends DefaultParameterSetting {
6
6
  type: 'stateful';
7
7
  controller: StatefulParameterController<any, unknown>;
@@ -31,6 +31,8 @@ export declare class ParsedResourceSettings<T extends StringIndexedObject> imple
31
31
  operatingSystems: Array<OS>;
32
32
  linuxDistros?: Array<LinuxDistro>;
33
33
  isSensitive?: boolean;
34
+ defaultConfig: Partial<T>;
35
+ exampleConfigs: ExampleConfigs;
34
36
  private settings;
35
37
  constructor(settings: ResourceSettings<T>);
36
38
  get typeId(): string;
@@ -13,6 +13,8 @@ export class ParsedResourceSettings {
13
13
  operatingSystems;
14
14
  linuxDistros;
15
15
  isSensitive;
16
+ defaultConfig;
17
+ exampleConfigs;
16
18
  settings;
17
19
  constructor(settings) {
18
20
  this.settings = settings;
@@ -4,6 +4,15 @@ import { ZodObject } from 'zod';
4
4
  import { ArrayStatefulParameter, StatefulParameter } from '../stateful-parameter/stateful-parameter.js';
5
5
  import { ParsedResourceSettings } from './parsed-resource-settings.js';
6
6
  import { RefreshContext } from './resource.js';
7
+ export interface ExampleConfig extends Record<string, unknown> {
8
+ title: string;
9
+ configs: Array<Record<string, unknown>>;
10
+ description?: string;
11
+ }
12
+ export interface ExampleConfigs {
13
+ example1: ExampleConfig;
14
+ example2: ExampleConfig;
15
+ }
7
16
  export interface InputTransformation {
8
17
  to: (input: any) => Promise<any> | any;
9
18
  from: (current: any, original: any) => Promise<any> | any;
@@ -162,6 +171,17 @@ export interface ResourceSettings<T extends StringIndexedObject> {
162
171
  */
163
172
  refreshMapper?: (input: Partial<T>, context: RefreshContext<T>) => Partial<T>;
164
173
  };
174
+ /**
175
+ * Represents the default config that is added to the editor with prefilled properties. For some resources
176
+ *
177
+ * @type {Partial<T>}
178
+ */
179
+ defaultConfig?: Partial<T>;
180
+ /**
181
+ * A collection of example configs used to give users an idea on how to use this specific resource. These examples
182
+ * don't need to be limited to just the current resource. They can include other resources as well
183
+ */
184
+ exampleConfigs: ExampleConfigs;
165
185
  }
166
186
  /**
167
187
  * The type of parameter. This value is mainly used to determine a pre-set equality method for comparing the current
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codifycli/plugin-core",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-beta3",
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.0.0",
38
+ "@codifycli/schemas": "1.1.0-beta2",
39
39
  "@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
40
40
  "ajv": "^8.18.0",
41
41
  "ajv-formats": "^2.1.1",
@@ -127,7 +127,9 @@ export class Plugin {
127
127
  operatingSystems: resource.settings.operatingSystems,
128
128
  linuxDistros: resource.settings.linuxDistros,
129
129
  sensitiveParameters,
130
- allowMultiple
130
+ allowMultiple,
131
+ defaultConfig: resource.settings.defaultConfig,
132
+ exampleConfigs: resource.settings.exampleConfigs,
131
133
  }
132
134
  }
133
135
 
@@ -6,6 +6,7 @@ import { StatefulParameterController } from '../stateful-parameter/stateful-para
6
6
  import {
7
7
  ArrayParameterSetting,
8
8
  DefaultParameterSetting,
9
+ ExampleConfigs,
9
10
  InputTransformation,
10
11
  ParameterSetting,
11
12
  resolveElementEqualsFn,
@@ -56,6 +57,9 @@ export class ParsedResourceSettings<T extends StringIndexedObject> implements Re
56
57
 
57
58
  isSensitive?: boolean;
58
59
 
60
+ defaultConfig!: Partial<T>;
61
+ exampleConfigs!: ExampleConfigs;
62
+
59
63
  private settings: ResourceSettings<T>;
60
64
 
61
65
  constructor(settings: ResourceSettings<T>) {
@@ -15,6 +15,17 @@ import {
15
15
  import { ParsedResourceSettings } from './parsed-resource-settings.js';
16
16
  import { RefreshContext } from './resource.js';
17
17
 
18
+ export interface ExampleConfig extends Record<string, unknown> {
19
+ title: string;
20
+ configs: Array<Record<string, unknown>>;
21
+ description?: string;
22
+ }
23
+
24
+ export interface ExampleConfigs {
25
+ example1: ExampleConfig;
26
+ example2: ExampleConfig;
27
+ }
28
+
18
29
  export interface InputTransformation {
19
30
  to: (input: any) => Promise<any> | any;
20
31
  from: (current: any, original: any) => Promise<any> | any;
@@ -194,6 +205,19 @@ export interface ResourceSettings<T extends StringIndexedObject> {
194
205
  */
195
206
  refreshMapper?: (input: Partial<T>, context: RefreshContext<T>) => Partial<T>;
196
207
  }
208
+
209
+ /**
210
+ * Represents the default config that is added to the editor with prefilled properties. For some resources
211
+ *
212
+ * @type {Partial<T>}
213
+ */
214
+ defaultConfig?: Partial<T>
215
+
216
+ /**
217
+ * A collection of example configs used to give users an idea on how to use this specific resource. These examples
218
+ * don't need to be limited to just the current resource. They can include other resources as well
219
+ */
220
+ exampleConfigs: ExampleConfigs
197
221
  }
198
222
 
199
223
  /**