@ubiquity-os/plugin-sdk 3.1.10 → 3.1.11

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.mts CHANGED
@@ -52,7 +52,7 @@ declare class CommentHandler {
52
52
  _getIssueNumber(context: Context): number | undefined;
53
53
  _getCommentId(context: Context): number | undefined;
54
54
  _extractIssueContext(context: Context): IssueContext | null;
55
- _processMessage(context: Context, message: LogReturn | Error): Promise<{
55
+ _processMessage(context: Context, message: LogReturn | Error): {
56
56
  metadata: {
57
57
  message: string;
58
58
  name: string;
@@ -88,14 +88,14 @@ declare class CommentHandler {
88
88
  level: _ubiquity_os_ubiquity_os_logger.LogLevel;
89
89
  type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
90
90
  };
91
- }>;
91
+ };
92
92
  _getInstigatorName(context: Context): string;
93
- _createMetadataContent(context: Context, metadata: Metadata): Promise<{
93
+ _createMetadataContent(context: Context, metadata: Metadata): {
94
94
  header: string;
95
95
  jsonPretty: string;
96
- }>;
96
+ };
97
97
  _formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
98
- createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): Promise<string>;
98
+ createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
99
99
  private _createCommentBody;
100
100
  postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
101
101
  }
package/dist/index.d.ts CHANGED
@@ -52,7 +52,7 @@ declare class CommentHandler {
52
52
  _getIssueNumber(context: Context): number | undefined;
53
53
  _getCommentId(context: Context): number | undefined;
54
54
  _extractIssueContext(context: Context): IssueContext | null;
55
- _processMessage(context: Context, message: LogReturn | Error): Promise<{
55
+ _processMessage(context: Context, message: LogReturn | Error): {
56
56
  metadata: {
57
57
  message: string;
58
58
  name: string;
@@ -88,14 +88,14 @@ declare class CommentHandler {
88
88
  level: _ubiquity_os_ubiquity_os_logger.LogLevel;
89
89
  type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
90
90
  };
91
- }>;
91
+ };
92
92
  _getInstigatorName(context: Context): string;
93
- _createMetadataContent(context: Context, metadata: Metadata): Promise<{
93
+ _createMetadataContent(context: Context, metadata: Metadata): {
94
94
  header: string;
95
95
  jsonPretty: string;
96
- }>;
96
+ };
97
97
  _formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
98
- createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): Promise<string>;
98
+ createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
99
99
  private _createCommentBody;
100
100
  postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
101
101
  }
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
76
76
  };
77
77
  var CfRuntimeInfo = class extends PluginRuntimeInfo {
78
78
  get version() {
79
- return Promise.resolve(this._env.CLOUDFLARE_VERSION_METADATA?.id ?? "CLOUDFLARE_VERSION_METADATA");
79
+ return this._env.CLOUDFLARE_VERSION_METADATA?.id ?? "CLOUDFLARE_VERSION_METADATA";
80
80
  }
81
81
  get runUrl() {
82
82
  const accountId = this._env.CLOUDFLARE_ACCOUNT_ID ?? "<missing-cloudflare-account-id>";
@@ -89,7 +89,7 @@ var CfRuntimeInfo = class extends PluginRuntimeInfo {
89
89
  };
90
90
  var NodeRuntimeInfo = class extends PluginRuntimeInfo {
91
91
  get version() {
92
- return Promise.resolve(import_github.default.context.sha);
92
+ return import_github.default.context.sha;
93
93
  }
94
94
  get runUrl() {
95
95
  return import_github.default.context.payload.repository ? `${import_github.default.context.payload.repository?.html_url}/actions/runs/${import_github.default.context.runId}` : "http://localhost";
@@ -97,7 +97,7 @@ var NodeRuntimeInfo = class extends PluginRuntimeInfo {
97
97
  };
98
98
  var DenoRuntimeInfo = class extends PluginRuntimeInfo {
99
99
  get version() {
100
- return Promise.resolve(Deno.env.get("DENO_DEPLOYMENT_ID"));
100
+ return Deno.env.get("DENO_DEPLOYMENT_ID");
101
101
  }
102
102
  get runUrl() {
103
103
  const projectName = Deno.env.get("DENO_PROJECT_NAME");
@@ -235,7 +235,7 @@ var CommentHandler = class _CommentHandler {
235
235
  repo: context2.payload.repository.name
236
236
  };
237
237
  }
238
- async _processMessage(context2, message) {
238
+ _processMessage(context2, message) {
239
239
  if (message instanceof Error) {
240
240
  const metadata2 = {
241
241
  message: message.message,
@@ -258,11 +258,11 @@ var CommentHandler = class _CommentHandler {
258
258
  }
259
259
  return context2.payload.sender?.login || _CommentHandler.HEADER_NAME;
260
260
  }
261
- async _createMetadataContent(context2, metadata) {
261
+ _createMetadataContent(context2, metadata) {
262
262
  const jsonPretty = sanitizeMetadata(metadata);
263
263
  const instigatorName = this._getInstigatorName(context2);
264
264
  const runUrl = PluginRuntimeInfo.getInstance().runUrl;
265
- const version = await PluginRuntimeInfo.getInstance().version;
265
+ const version = PluginRuntimeInfo.getInstance().version;
266
266
  const callingFnName = metadata.caller || "anonymous";
267
267
  return {
268
268
  header: `<!-- ${_CommentHandler.HEADER_NAME} - ${callingFnName} - ${version} - @${instigatorName} - ${runUrl}`,
@@ -277,12 +277,12 @@ var CommentHandler = class _CommentHandler {
277
277
  /*
278
278
  * Creates the body for the comment, embeds the metadata and the header hidden in the body as well.
279
279
  */
280
- async createCommentBody(context2, message, options) {
280
+ createCommentBody(context2, message, options) {
281
281
  return this._createCommentBody(context2, message, options);
282
282
  }
283
- async _createCommentBody(context2, message, options) {
284
- const { metadata, logMessage } = await this._processMessage(context2, message);
285
- const { header, jsonPretty } = await this._createMetadataContent(context2, metadata);
283
+ _createCommentBody(context2, message, options) {
284
+ const { metadata, logMessage } = this._processMessage(context2, message);
285
+ const { header, jsonPretty } = this._createMetadataContent(context2, metadata);
286
286
  const metadataContent = this._formatMetadataContent(logMessage, header, jsonPretty);
287
287
  return `${options?.raw ? logMessage?.raw : logMessage?.diff}
288
288
 
@@ -295,7 +295,7 @@ ${metadataContent}
295
295
  context2.logger.info("Cannot post comment: missing issue context in payload");
296
296
  return null;
297
297
  }
298
- const body = await this._createCommentBody(context2, message, options);
298
+ const body = this._createCommentBody(context2, message, options);
299
299
  const { issueNumber, commentId, owner, repo } = issueContext;
300
300
  const params = { owner, repo, body, issueNumber };
301
301
  if (options.updateComment) {
package/dist/index.mjs CHANGED
@@ -38,7 +38,7 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
38
38
  };
39
39
  var CfRuntimeInfo = class extends PluginRuntimeInfo {
40
40
  get version() {
41
- return Promise.resolve(this._env.CLOUDFLARE_VERSION_METADATA?.id ?? "CLOUDFLARE_VERSION_METADATA");
41
+ return this._env.CLOUDFLARE_VERSION_METADATA?.id ?? "CLOUDFLARE_VERSION_METADATA";
42
42
  }
43
43
  get runUrl() {
44
44
  const accountId = this._env.CLOUDFLARE_ACCOUNT_ID ?? "<missing-cloudflare-account-id>";
@@ -51,7 +51,7 @@ var CfRuntimeInfo = class extends PluginRuntimeInfo {
51
51
  };
52
52
  var NodeRuntimeInfo = class extends PluginRuntimeInfo {
53
53
  get version() {
54
- return Promise.resolve(github.context.sha);
54
+ return github.context.sha;
55
55
  }
56
56
  get runUrl() {
57
57
  return github.context.payload.repository ? `${github.context.payload.repository?.html_url}/actions/runs/${github.context.runId}` : "http://localhost";
@@ -59,7 +59,7 @@ var NodeRuntimeInfo = class extends PluginRuntimeInfo {
59
59
  };
60
60
  var DenoRuntimeInfo = class extends PluginRuntimeInfo {
61
61
  get version() {
62
- return Promise.resolve(Deno.env.get("DENO_DEPLOYMENT_ID"));
62
+ return Deno.env.get("DENO_DEPLOYMENT_ID");
63
63
  }
64
64
  get runUrl() {
65
65
  const projectName = Deno.env.get("DENO_PROJECT_NAME");
@@ -197,7 +197,7 @@ var CommentHandler = class _CommentHandler {
197
197
  repo: context2.payload.repository.name
198
198
  };
199
199
  }
200
- async _processMessage(context2, message) {
200
+ _processMessage(context2, message) {
201
201
  if (message instanceof Error) {
202
202
  const metadata2 = {
203
203
  message: message.message,
@@ -220,11 +220,11 @@ var CommentHandler = class _CommentHandler {
220
220
  }
221
221
  return context2.payload.sender?.login || _CommentHandler.HEADER_NAME;
222
222
  }
223
- async _createMetadataContent(context2, metadata) {
223
+ _createMetadataContent(context2, metadata) {
224
224
  const jsonPretty = sanitizeMetadata(metadata);
225
225
  const instigatorName = this._getInstigatorName(context2);
226
226
  const runUrl = PluginRuntimeInfo.getInstance().runUrl;
227
- const version = await PluginRuntimeInfo.getInstance().version;
227
+ const version = PluginRuntimeInfo.getInstance().version;
228
228
  const callingFnName = metadata.caller || "anonymous";
229
229
  return {
230
230
  header: `<!-- ${_CommentHandler.HEADER_NAME} - ${callingFnName} - ${version} - @${instigatorName} - ${runUrl}`,
@@ -239,12 +239,12 @@ var CommentHandler = class _CommentHandler {
239
239
  /*
240
240
  * Creates the body for the comment, embeds the metadata and the header hidden in the body as well.
241
241
  */
242
- async createCommentBody(context2, message, options) {
242
+ createCommentBody(context2, message, options) {
243
243
  return this._createCommentBody(context2, message, options);
244
244
  }
245
- async _createCommentBody(context2, message, options) {
246
- const { metadata, logMessage } = await this._processMessage(context2, message);
247
- const { header, jsonPretty } = await this._createMetadataContent(context2, metadata);
245
+ _createCommentBody(context2, message, options) {
246
+ const { metadata, logMessage } = this._processMessage(context2, message);
247
+ const { header, jsonPretty } = this._createMetadataContent(context2, metadata);
248
248
  const metadataContent = this._formatMetadataContent(logMessage, header, jsonPretty);
249
249
  return `${options?.raw ? logMessage?.raw : logMessage?.diff}
250
250
 
@@ -257,7 +257,7 @@ ${metadataContent}
257
257
  context2.logger.info("Cannot post comment: missing issue context in payload");
258
258
  return null;
259
259
  }
260
- const body = await this._createCommentBody(context2, message, options);
260
+ const body = this._createCommentBody(context2, message, options);
261
261
  const { issueNumber, commentId, owner, repo } = issueContext;
262
262
  const params = { owner, repo, body, issueNumber };
263
263
  if (options.updateComment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubiquity-os/plugin-sdk",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "SDK for plugin support.",
5
5
  "author": "Ubiquity DAO",
6
6
  "license": "MIT",