@ubiquity-os/plugin-sdk 3.5.3 → 3.5.4

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.
@@ -50,14 +50,16 @@ interface LoggerInterface {
50
50
  }
51
51
  /**
52
52
  * Handles fetching and managing plugin configurations from GitHub repositories.
53
- * Prioritizes production configuration (`.ubiquity-os.config.yml`) over development configuration (`.ubiquity-os.config.dev.yml`).
53
+ * Prioritizes production configuration (`.ubiquity-os.config.yml`) over development configuration (`.ubiquity-os.config.dev.yml`),
54
+ * except if the `_environment` value is provided to the constructor.
54
55
  **/
55
56
  declare class ConfigurationHandler {
56
57
  private readonly _logger;
57
58
  private readonly _octokit;
59
+ private readonly _environment;
58
60
  private _manifestCache;
59
61
  private _manifestPromiseCache;
60
- constructor(_logger: LoggerInterface, _octokit: Context["octokit"]);
62
+ constructor(_logger: LoggerInterface, _octokit: Context["octokit"], _environment?: "development" | "production" | null);
61
63
  /**
62
64
  * Retrieves the configuration for the current plugin based on its manifest.
63
65
  * @param manifest - The plugin manifest containing the `short_name` identifier
@@ -82,7 +84,7 @@ declare class ConfigurationHandler {
82
84
  };
83
85
  }>;
84
86
  /**
85
- * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors if any.
87
+ * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors, if any.
86
88
  *
87
89
  * @param owner The repository owner
88
90
  * @param repository The repository name
@@ -50,14 +50,16 @@ interface LoggerInterface {
50
50
  }
51
51
  /**
52
52
  * Handles fetching and managing plugin configurations from GitHub repositories.
53
- * Prioritizes production configuration (`.ubiquity-os.config.yml`) over development configuration (`.ubiquity-os.config.dev.yml`).
53
+ * Prioritizes production configuration (`.ubiquity-os.config.yml`) over development configuration (`.ubiquity-os.config.dev.yml`),
54
+ * except if the `_environment` value is provided to the constructor.
54
55
  **/
55
56
  declare class ConfigurationHandler {
56
57
  private readonly _logger;
57
58
  private readonly _octokit;
59
+ private readonly _environment;
58
60
  private _manifestCache;
59
61
  private _manifestPromiseCache;
60
- constructor(_logger: LoggerInterface, _octokit: Context["octokit"]);
62
+ constructor(_logger: LoggerInterface, _octokit: Context["octokit"], _environment?: "development" | "production" | null);
61
63
  /**
62
64
  * Retrieves the configuration for the current plugin based on its manifest.
63
65
  * @param manifest - The plugin manifest containing the `short_name` identifier
@@ -82,7 +84,7 @@ declare class ConfigurationHandler {
82
84
  };
83
85
  }>;
84
86
  /**
85
- * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors if any.
87
+ * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors, if any.
86
88
  *
87
89
  * @param owner The repository owner
88
90
  * @param repository The repository name
@@ -118,9 +118,10 @@ var CONFIG_PROD_FULL_PATH = ".github/.ubiquity-os.config.yml";
118
118
  var CONFIG_DEV_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
119
119
  var CONFIG_ORG_REPO = ".ubiquity-os";
120
120
  var ConfigurationHandler = class {
121
- constructor(_logger, _octokit) {
121
+ constructor(_logger, _octokit, _environment = null) {
122
122
  this._logger = _logger;
123
123
  this._octokit = _octokit;
124
+ this._environment = _environment;
124
125
  }
125
126
  _manifestCache = {};
126
127
  _manifestPromiseCache = {};
@@ -197,7 +198,7 @@ var ConfigurationHandler = class {
197
198
  };
198
199
  }
199
200
  /**
200
- * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors if any.
201
+ * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors, if any.
201
202
  *
202
203
  * @param owner The repository owner
203
204
  * @param repository The repository name
@@ -239,7 +240,17 @@ var ConfigurationHandler = class {
239
240
  this._logger.error("Repo or owner is not defined, cannot download the requested file");
240
241
  return null;
241
242
  }
242
- const pathList = [CONFIG_PROD_FULL_PATH, CONFIG_DEV_FULL_PATH];
243
+ let pathList;
244
+ switch (this._environment) {
245
+ case "development":
246
+ pathList = [CONFIG_DEV_FULL_PATH];
247
+ break;
248
+ case "production":
249
+ pathList = [CONFIG_PROD_FULL_PATH];
250
+ break;
251
+ default:
252
+ pathList = [CONFIG_PROD_FULL_PATH, CONFIG_DEV_FULL_PATH];
253
+ }
243
254
  for (const filePath of pathList) {
244
255
  try {
245
256
  this._logger.debug("Attempting to fetch configuration", { owner, repository, filePath });
@@ -81,9 +81,10 @@ var CONFIG_PROD_FULL_PATH = ".github/.ubiquity-os.config.yml";
81
81
  var CONFIG_DEV_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
82
82
  var CONFIG_ORG_REPO = ".ubiquity-os";
83
83
  var ConfigurationHandler = class {
84
- constructor(_logger, _octokit) {
84
+ constructor(_logger, _octokit, _environment = null) {
85
85
  this._logger = _logger;
86
86
  this._octokit = _octokit;
87
+ this._environment = _environment;
87
88
  }
88
89
  _manifestCache = {};
89
90
  _manifestPromiseCache = {};
@@ -160,7 +161,7 @@ var ConfigurationHandler = class {
160
161
  };
161
162
  }
162
163
  /**
163
- * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors if any.
164
+ * Retrieves the configuration from the given owner/repository. Also returns the raw data and errors, if any.
164
165
  *
165
166
  * @param owner The repository owner
166
167
  * @param repository The repository name
@@ -202,7 +203,17 @@ var ConfigurationHandler = class {
202
203
  this._logger.error("Repo or owner is not defined, cannot download the requested file");
203
204
  return null;
204
205
  }
205
- const pathList = [CONFIG_PROD_FULL_PATH, CONFIG_DEV_FULL_PATH];
206
+ let pathList;
207
+ switch (this._environment) {
208
+ case "development":
209
+ pathList = [CONFIG_DEV_FULL_PATH];
210
+ break;
211
+ case "production":
212
+ pathList = [CONFIG_PROD_FULL_PATH];
213
+ break;
214
+ default:
215
+ pathList = [CONFIG_PROD_FULL_PATH, CONFIG_DEV_FULL_PATH];
216
+ }
206
217
  for (const filePath of pathList) {
207
218
  try {
208
219
  this._logger.debug("Attempting to fetch configuration", { owner, repository, filePath });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubiquity-os/plugin-sdk",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "description": "SDK for plugin support.",
5
5
  "author": "Ubiquity DAO",
6
6
  "license": "MIT",