@codifycli/plugin-core 1.0.1 → 1.1.0-beta1

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
+ }
@@ -11,7 +11,10 @@ export declare class Plugin {
11
11
  constructor(name: string, resourceControllers: Map<string, ResourceController<ResourceConfig>>);
12
12
  static create(name: string, resources: Resource<any>[]): Plugin;
13
13
  initialize(data: InitializeRequestData): Promise<InitializeResponseData>;
14
- getResourceInfo(data: GetResourceInfoRequestData): GetResourceInfoResponseData;
14
+ getResourceInfo(data: GetResourceInfoRequestData): {
15
+ defaultConfig: unknown;
16
+ exampleConfigs: unknown;
17
+ } & GetResourceInfoResponseData;
15
18
  match(data: MatchRequestData): Promise<MatchResponseData>;
16
19
  import(data: ImportRequestData): Promise<ImportResponseData>;
17
20
  validate(data: ValidateRequestData): Promise<ValidateResponseData>;
@@ -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,14 @@ 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 {
8
+ configs: Array<Record<string, unknown>>;
9
+ description: string;
10
+ }
11
+ export interface ExampleConfigs {
12
+ example1: ExampleConfig;
13
+ example2: ExampleConfig;
14
+ }
7
15
  export interface InputTransformation {
8
16
  to: (input: any) => Promise<any> | any;
9
17
  from: (current: any, original: any) => Promise<any> | any;
@@ -162,6 +170,17 @@ export interface ResourceSettings<T extends StringIndexedObject> {
162
170
  */
163
171
  refreshMapper?: (input: Partial<T>, context: RefreshContext<T>) => Partial<T>;
164
172
  };
173
+ /**
174
+ * Represents the default config that is added to the editor with prefilled properties. For some resources
175
+ *
176
+ * @type {Partial<T>}
177
+ */
178
+ defaultConfig?: Partial<T>;
179
+ /**
180
+ * A collection of example configs used to give users an idea on how to use this specific resource. These examples
181
+ * don't need to be limited to just the current resource. They can include other resources as well
182
+ */
183
+ exampleConfigs: ExampleConfigs;
165
184
  }
166
185
  /**
167
186
  * 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-beta1",
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",
@@ -83,7 +83,7 @@ export class Plugin {
83
83
  }
84
84
  }
85
85
 
86
- getResourceInfo(data: GetResourceInfoRequestData): GetResourceInfoResponseData {
86
+ getResourceInfo(data: GetResourceInfoRequestData): { defaultConfig: unknown; exampleConfigs: unknown } & GetResourceInfoResponseData {
87
87
  if (!this.resourceControllers.has(data.type)) {
88
88
  throw new Error(`Cannot get info for resource ${data.type}, resource doesn't exist`);
89
89
  }
@@ -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
 
@@ -5,7 +5,7 @@ import { z, ZodObject } from 'zod';
5
5
  import { StatefulParameterController } from '../stateful-parameter/stateful-parameter-controller.js';
6
6
  import {
7
7
  ArrayParameterSetting,
8
- DefaultParameterSetting,
8
+ DefaultParameterSetting, ExampleConfigs,
9
9
  InputTransformation,
10
10
  ParameterSetting,
11
11
  resolveElementEqualsFn,
@@ -56,6 +56,9 @@ export class ParsedResourceSettings<T extends StringIndexedObject> implements Re
56
56
 
57
57
  isSensitive?: boolean;
58
58
 
59
+ defaultConfig!: Partial<T>;
60
+ exampleConfigs!: ExampleConfigs;
61
+
59
62
  private settings: ResourceSettings<T>;
60
63
 
61
64
  constructor(settings: ResourceSettings<T>) {
@@ -15,6 +15,16 @@ import {
15
15
  import { ParsedResourceSettings } from './parsed-resource-settings.js';
16
16
  import { RefreshContext } from './resource.js';
17
17
 
18
+ export interface ExampleConfig {
19
+ configs: Array<Record<string, unknown>>;
20
+ description: string;
21
+ }
22
+
23
+ export interface ExampleConfigs {
24
+ example1: ExampleConfig;
25
+ example2: ExampleConfig;
26
+ }
27
+
18
28
  export interface InputTransformation {
19
29
  to: (input: any) => Promise<any> | any;
20
30
  from: (current: any, original: any) => Promise<any> | any;
@@ -194,6 +204,19 @@ export interface ResourceSettings<T extends StringIndexedObject> {
194
204
  */
195
205
  refreshMapper?: (input: Partial<T>, context: RefreshContext<T>) => Partial<T>;
196
206
  }
207
+
208
+ /**
209
+ * Represents the default config that is added to the editor with prefilled properties. For some resources
210
+ *
211
+ * @type {Partial<T>}
212
+ */
213
+ defaultConfig?: Partial<T>
214
+
215
+ /**
216
+ * A collection of example configs used to give users an idea on how to use this specific resource. These examples
217
+ * don't need to be limited to just the current resource. They can include other resources as well
218
+ */
219
+ exampleConfigs: ExampleConfigs
197
220
  }
198
221
 
199
222
  /**