@ubiquity-os/plugin-sdk 1.0.10 → 1.1.0

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.
@@ -1,48 +1,10 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- createActionsPlugin: () => createActionsPlugin,
34
- createPlugin: () => createPlugin,
35
- postComment: () => postComment
36
- });
37
- module.exports = __toCommonJS(src_exports);
38
-
39
1
  // src/server.ts
40
- var import_typebox = require("@sinclair/typebox");
41
- var import_value = require("@sinclair/typebox/value");
42
- var import_ubiquity_os_logger = require("@ubiquity-os/ubiquity-os-logger");
43
- var import_hono = require("hono");
44
- var import_adapter = require("hono/adapter");
45
- var import_http_exception = require("hono/http-exception");
2
+ import { Type as T } from "@sinclair/typebox";
3
+ import { Value } from "@sinclair/typebox/value";
4
+ import { LOG_LEVEL, LogReturn, Logs } from "@ubiquity-os/ubiquity-os-logger";
5
+ import { Hono } from "hono";
6
+ import { env as honoEnv } from "hono/adapter";
7
+ import { HTTPException } from "hono/http-exception";
46
8
 
47
9
  // src/util.ts
48
10
  function sanitizeMetadata(obj) {
@@ -98,12 +60,12 @@ JQIDAQAB
98
60
  `;
99
61
 
100
62
  // src/octokit.ts
101
- var import_core = require("@octokit/core");
102
- var import_plugin_paginate_rest = require("@octokit/plugin-paginate-rest");
103
- var import_plugin_rest_endpoint_methods = require("@octokit/plugin-rest-endpoint-methods");
104
- var import_plugin_retry = require("@octokit/plugin-retry");
105
- var import_plugin_throttling = require("@octokit/plugin-throttling");
106
- var import_plugin_paginate_graphql = require("@octokit/plugin-paginate-graphql");
63
+ import { Octokit } from "@octokit/core";
64
+ import { paginateRest } from "@octokit/plugin-paginate-rest";
65
+ import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
66
+ import { retry } from "@octokit/plugin-retry";
67
+ import { throttling } from "@octokit/plugin-throttling";
68
+ import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
107
69
  var defaultOptions = {
108
70
  throttle: {
109
71
  onAbuseLimit: (retryAfter, options, octokit) => {
@@ -120,7 +82,7 @@ var defaultOptions = {
120
82
  }
121
83
  }
122
84
  };
123
- var customOctokit = import_core.Octokit.plugin(import_plugin_throttling.throttling, import_plugin_retry.retry, import_plugin_paginate_rest.paginateRest, import_plugin_rest_endpoint_methods.restEndpointMethods, import_plugin_paginate_graphql.paginateGraphQL).defaults((instanceOptions) => {
85
+ var customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, paginateGraphQL).defaults((instanceOptions) => {
124
86
  return { ...defaultOptions, ...instanceOptions };
125
87
  });
126
88
 
@@ -133,7 +95,8 @@ async function verifySignature(publicKeyPem, inputs, signature) {
133
95
  eventPayload: inputs.eventPayload,
134
96
  settings: inputs.settings,
135
97
  authToken: inputs.authToken,
136
- ref: inputs.ref
98
+ ref: inputs.ref,
99
+ command: inputs.command
137
100
  };
138
101
  const pemContents = publicKeyPem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").trim();
139
102
  const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
@@ -157,88 +120,97 @@ async function verifySignature(publicKeyPem, inputs, signature) {
157
120
  }
158
121
 
159
122
  // src/server.ts
160
- var inputSchema = import_typebox.Type.Object({
161
- stateId: import_typebox.Type.String(),
162
- eventName: import_typebox.Type.String(),
163
- eventPayload: import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any()),
164
- authToken: import_typebox.Type.String(),
165
- settings: import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any()),
166
- ref: import_typebox.Type.String(),
167
- signature: import_typebox.Type.String(),
168
- bypassSignatureVerification: import_typebox.Type.Optional(
169
- import_typebox.Type.Boolean({
170
- default: false,
171
- description: "Bypass signature verification (caution: only use this if you know what you're doing)"
172
- })
173
- )
123
+ var inputSchema = T.Object({
124
+ stateId: T.String(),
125
+ eventName: T.String(),
126
+ eventPayload: T.Record(T.String(), T.Any()),
127
+ command: T.Union([T.Null(), T.Object({ name: T.String(), parameters: T.Unknown() })]),
128
+ authToken: T.String(),
129
+ settings: T.Record(T.String(), T.Any()),
130
+ ref: T.String(),
131
+ signature: T.String()
174
132
  });
175
133
  function createPlugin(handler, manifest, options) {
176
134
  const pluginOptions = {
177
135
  kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
178
- logLevel: options?.logLevel ?? import_ubiquity_os_logger.LOG_LEVEL.INFO,
136
+ logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
179
137
  postCommentOnError: options?.postCommentOnError ?? true,
180
138
  settingsSchema: options?.settingsSchema,
181
- envSchema: options?.envSchema
139
+ envSchema: options?.envSchema,
140
+ commandSchema: options?.commandSchema,
141
+ bypassSignatureVerification: options?.bypassSignatureVerification || false
182
142
  };
183
- const app = new import_hono.Hono();
143
+ const app = new Hono();
184
144
  app.get("/manifest.json", (ctx) => {
185
145
  return ctx.json(manifest);
186
146
  });
187
147
  app.post("/", async (ctx) => {
188
148
  if (ctx.req.header("content-type") !== "application/json") {
189
- throw new import_http_exception.HTTPException(400, { message: "Content-Type must be application/json" });
149
+ throw new HTTPException(400, { message: "Content-Type must be application/json" });
190
150
  }
191
151
  const body = await ctx.req.json();
192
- const inputSchemaErrors = [...import_value.Value.Errors(inputSchema, body)];
152
+ const inputSchemaErrors = [...Value.Errors(inputSchema, body)];
193
153
  if (inputSchemaErrors.length) {
194
- console.dir(inputSchemaErrors, { depth: null });
195
- throw new import_http_exception.HTTPException(400, { message: "Invalid body" });
154
+ console.log(inputSchemaErrors, { depth: null });
155
+ throw new HTTPException(400, { message: "Invalid body" });
196
156
  }
197
- const inputs = import_value.Value.Decode(inputSchema, body);
157
+ const inputs = Value.Decode(inputSchema, body);
198
158
  const signature = inputs.signature;
199
- if (!options?.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
200
- throw new import_http_exception.HTTPException(400, { message: "Invalid signature" });
159
+ if (!pluginOptions.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
160
+ throw new HTTPException(400, { message: "Invalid signature" });
201
161
  }
202
162
  let config2;
203
163
  if (pluginOptions.settingsSchema) {
204
164
  try {
205
- config2 = import_value.Value.Decode(pluginOptions.settingsSchema, import_value.Value.Default(pluginOptions.settingsSchema, inputs.settings));
165
+ config2 = Value.Decode(pluginOptions.settingsSchema, Value.Default(pluginOptions.settingsSchema, inputs.settings));
206
166
  } catch (e) {
207
- console.dir(...import_value.Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
167
+ console.log(...Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
208
168
  throw e;
209
169
  }
210
170
  } else {
211
171
  config2 = inputs.settings;
212
172
  }
213
173
  let env;
214
- const honoEnvironment = (0, import_adapter.env)(ctx);
174
+ const honoEnvironment = honoEnv(ctx);
215
175
  if (pluginOptions.envSchema) {
216
176
  try {
217
- env = import_value.Value.Decode(pluginOptions.envSchema, import_value.Value.Default(pluginOptions.envSchema, honoEnvironment));
177
+ env = Value.Decode(pluginOptions.envSchema, Value.Default(pluginOptions.envSchema, honoEnvironment));
218
178
  } catch (e) {
219
- console.dir(...import_value.Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
179
+ console.log(...Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
220
180
  throw e;
221
181
  }
222
182
  } else {
223
183
  env = ctx.env;
224
184
  }
185
+ let command = null;
186
+ if (inputs.command && pluginOptions.commandSchema) {
187
+ try {
188
+ command = Value.Decode(pluginOptions.commandSchema, Value.Default(pluginOptions.commandSchema, inputs.command));
189
+ } catch (e) {
190
+ console.log(...Value.Errors(pluginOptions.commandSchema, inputs.command), { depth: null });
191
+ throw e;
192
+ }
193
+ } else if (inputs.command) {
194
+ command = inputs.command;
195
+ }
225
196
  const context2 = {
226
197
  eventName: inputs.eventName,
227
198
  payload: inputs.eventPayload,
199
+ command,
228
200
  octokit: new customOctokit({ auth: inputs.authToken }),
229
201
  config: config2,
230
202
  env,
231
- logger: new import_ubiquity_os_logger.Logs(pluginOptions.logLevel)
203
+ logger: new Logs(pluginOptions.logLevel)
232
204
  };
233
205
  try {
234
206
  const result = await handler(context2);
235
- return ctx.json({ stateId: inputs.stateId, output: result });
207
+ return ctx.json({ stateId: inputs.stateId, output: result ?? {} });
236
208
  } catch (error) {
237
209
  console.error(error);
238
210
  let loggerError;
239
211
  if (error instanceof Error) {
240
212
  loggerError = context2.logger.error(`Error: ${error}`, { error });
241
- } else if (error instanceof import_ubiquity_os_logger.LogReturn) {
213
+ } else if (error instanceof LogReturn) {
242
214
  loggerError = error;
243
215
  } else {
244
216
  loggerError = context2.logger.error(`Error: ${error}`);
@@ -246,84 +218,116 @@ function createPlugin(handler, manifest, options) {
246
218
  if (pluginOptions.postCommentOnError && loggerError) {
247
219
  await postComment(context2, loggerError);
248
220
  }
249
- throw new import_http_exception.HTTPException(500, { message: "Unexpected error" });
221
+ throw new HTTPException(500, { message: "Unexpected error" });
250
222
  }
251
223
  });
252
224
  return app;
253
225
  }
254
226
 
255
227
  // src/actions.ts
256
- var core = __toESM(require("@actions/core"), 1);
257
- var github = __toESM(require("@actions/github"), 1);
258
- var import_typebox2 = require("@sinclair/typebox");
259
- var import_value2 = require("@sinclair/typebox/value");
260
- var import_ubiquity_os_logger2 = require("@ubiquity-os/ubiquity-os-logger");
261
- var import_dotenv = require("dotenv");
262
- (0, import_dotenv.config)();
263
- var inputSchema2 = import_typebox2.Type.Object({
264
- stateId: import_typebox2.Type.String(),
265
- eventName: import_typebox2.Type.String(),
266
- eventPayload: import_typebox2.Type.String(),
267
- authToken: import_typebox2.Type.String(),
268
- settings: import_typebox2.Type.String(),
269
- ref: import_typebox2.Type.String(),
270
- signature: import_typebox2.Type.String()
228
+ import * as core from "@actions/core";
229
+ import * as github from "@actions/github";
230
+ import { Type as T3 } from "@sinclair/typebox";
231
+ import { Value as Value3 } from "@sinclair/typebox/value";
232
+ import { LOG_LEVEL as LOG_LEVEL2, LogReturn as LogReturn2, Logs as Logs2 } from "@ubiquity-os/ubiquity-os-logger";
233
+ import { config } from "dotenv";
234
+
235
+ // src/types/util.ts
236
+ import { Type } from "@sinclair/typebox";
237
+ import { Value as Value2 } from "@sinclair/typebox/value";
238
+ function jsonType(type) {
239
+ return Type.Transform(Type.String()).Decode((value) => {
240
+ const parsed = JSON.parse(value);
241
+ return Value2.Decode(type, Value2.Default(type, parsed));
242
+ }).Encode((value) => JSON.stringify(value));
243
+ }
244
+
245
+ // src/types/command.ts
246
+ import { Type as T2 } from "@sinclair/typebox";
247
+ var commandCallSchema = T2.Union([T2.Null(), T2.Object({ name: T2.String(), parameters: T2.Unknown() })]);
248
+
249
+ // src/actions.ts
250
+ config();
251
+ var inputSchema2 = T3.Object({
252
+ stateId: T3.String(),
253
+ eventName: T3.String(),
254
+ eventPayload: jsonType(T3.Record(T3.String(), T3.Any())),
255
+ command: jsonType(commandCallSchema),
256
+ authToken: T3.String(),
257
+ settings: jsonType(T3.Record(T3.String(), T3.Any())),
258
+ ref: T3.String(),
259
+ signature: T3.String()
271
260
  });
272
261
  async function createActionsPlugin(handler, options) {
273
262
  const pluginOptions = {
274
- logLevel: options?.logLevel ?? import_ubiquity_os_logger2.LOG_LEVEL.INFO,
263
+ logLevel: options?.logLevel ?? LOG_LEVEL2.INFO,
275
264
  postCommentOnError: options?.postCommentOnError ?? true,
276
265
  settingsSchema: options?.settingsSchema,
277
266
  envSchema: options?.envSchema,
278
- kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY
267
+ commandSchema: options?.commandSchema,
268
+ kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
269
+ bypassSignatureVerification: options?.bypassSignatureVerification || false
279
270
  };
280
271
  const pluginGithubToken = process.env.PLUGIN_GITHUB_TOKEN;
281
272
  if (!pluginGithubToken) {
282
273
  core.setFailed("Error: PLUGIN_GITHUB_TOKEN env is not set");
283
274
  return;
284
275
  }
276
+ const body = github.context.payload.inputs;
277
+ const signature = body.signature;
278
+ if (!pluginOptions.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, body, signature)) {
279
+ core.setFailed(`Error: Invalid signature`);
280
+ return;
281
+ }
285
282
  const inputPayload = github.context.payload.inputs;
286
- const inputSchemaErrors = [...import_value2.Value.Errors(inputSchema2, inputPayload)];
283
+ const inputSchemaErrors = [...Value3.Errors(inputSchema2, inputPayload)];
287
284
  if (inputSchemaErrors.length) {
288
285
  console.dir(inputSchemaErrors, { depth: null });
289
286
  core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
290
287
  return;
291
288
  }
292
- const inputs = import_value2.Value.Decode(inputSchema2, inputPayload);
293
- const signature = inputs.signature;
294
- if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
295
- core.setFailed(`Error: Invalid signature`);
296
- return;
297
- }
289
+ const inputs = Value3.Decode(inputSchema2, inputPayload);
298
290
  let config2;
299
291
  if (pluginOptions.settingsSchema) {
300
292
  try {
301
- config2 = import_value2.Value.Decode(pluginOptions.settingsSchema, import_value2.Value.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
293
+ config2 = Value3.Decode(pluginOptions.settingsSchema, Value3.Default(pluginOptions.settingsSchema, inputs.settings));
302
294
  } catch (e) {
303
- console.dir(...import_value2.Value.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
295
+ console.dir(...Value3.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
304
296
  throw e;
305
297
  }
306
298
  } else {
307
- config2 = JSON.parse(inputs.settings);
299
+ config2 = inputs.settings;
308
300
  }
309
301
  let env;
310
302
  if (pluginOptions.envSchema) {
311
303
  try {
312
- env = import_value2.Value.Decode(pluginOptions.envSchema, import_value2.Value.Default(pluginOptions.envSchema, process.env));
304
+ env = Value3.Decode(pluginOptions.envSchema, Value3.Default(pluginOptions.envSchema, process.env));
313
305
  } catch (e) {
314
- console.dir(...import_value2.Value.Errors(pluginOptions.envSchema, process.env), { depth: null });
306
+ console.dir(...Value3.Errors(pluginOptions.envSchema, process.env), { depth: null });
315
307
  throw e;
316
308
  }
317
309
  } else {
318
310
  env = process.env;
319
311
  }
312
+ let command = null;
313
+ if (inputs.command && pluginOptions.commandSchema) {
314
+ try {
315
+ command = Value3.Decode(pluginOptions.commandSchema, Value3.Default(pluginOptions.commandSchema, inputs.command));
316
+ } catch (e) {
317
+ console.dir(...Value3.Errors(pluginOptions.commandSchema, inputs.command), { depth: null });
318
+ throw e;
319
+ }
320
+ } else if (inputs.command) {
321
+ command = inputs.command;
322
+ }
320
323
  const context2 = {
321
324
  eventName: inputs.eventName,
322
- payload: JSON.parse(inputs.eventPayload),
325
+ payload: inputs.eventPayload,
326
+ command,
323
327
  octokit: new customOctokit({ auth: inputs.authToken }),
324
328
  config: config2,
325
329
  env,
326
- logger: new import_ubiquity_os_logger2.Logs(pluginOptions.logLevel)
330
+ logger: new Logs2(pluginOptions.logLevel)
327
331
  };
328
332
  try {
329
333
  const result = await handler(context2);
@@ -335,7 +339,7 @@ async function createActionsPlugin(handler, options) {
335
339
  if (error instanceof Error) {
336
340
  core.setFailed(error);
337
341
  loggerError = context2.logger.error(`Error: ${error}`, { error });
338
- } else if (error instanceof import_ubiquity_os_logger2.LogReturn) {
342
+ } else if (error instanceof LogReturn2) {
339
343
  core.setFailed(error.logMessage.raw);
340
344
  loggerError = error;
341
345
  } else {
@@ -378,9 +382,8 @@ async function returnDataToKernel(repoToken, stateId, output) {
378
382
  }
379
383
  });
380
384
  }
381
- // Annotate the CommonJS export names for ESM import in node:
382
- 0 && (module.exports = {
385
+ export {
383
386
  createActionsPlugin,
384
387
  createPlugin,
385
388
  postComment
386
- });
389
+ };
@@ -5,6 +5,7 @@ declare const runEvent: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"bra
5
5
  declare const commandSchema: _sinclair_typebox.TObject<{
6
6
  description: _sinclair_typebox.TString;
7
7
  "ubiquity:example": _sinclair_typebox.TString;
8
+ parameters: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
8
9
  }>;
9
10
  declare const manifestSchema: _sinclair_typebox.TObject<{
10
11
  name: _sinclair_typebox.TString;
@@ -12,9 +13,11 @@ declare const manifestSchema: _sinclair_typebox.TObject<{
12
13
  commands: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TObject<{
13
14
  description: _sinclair_typebox.TString;
14
15
  "ubiquity:example": _sinclair_typebox.TString;
16
+ parameters: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
15
17
  }>>>;
16
18
  "ubiquity:listeners": _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"branch_protection_configuration" | "branch_protection_configuration.disabled" | "branch_protection_configuration.enabled" | "branch_protection_rule" | "branch_protection_rule.created" | "branch_protection_rule.deleted" | "branch_protection_rule.edited" | "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested" | "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested" | "code_scanning_alert" | "code_scanning_alert.appeared_in_branch" | "code_scanning_alert.closed_by_user" | "code_scanning_alert.created" | "code_scanning_alert.fixed" | "code_scanning_alert.reopened" | "code_scanning_alert.reopened_by_user" | "commit_comment" | "commit_comment.created" | "create" | "custom_property" | "custom_property.created" | "custom_property.deleted" | "custom_property.updated" | "custom_property_values" | "custom_property_values.updated" | "delete" | "dependabot_alert" | "dependabot_alert.auto_dismissed" | "dependabot_alert.auto_reopened" | "dependabot_alert.created" | "dependabot_alert.dismissed" | "dependabot_alert.fixed" | "dependabot_alert.reintroduced" | "dependabot_alert.reopened" | "deploy_key" | "deploy_key.created" | "deploy_key.deleted" | "deployment" | "deployment.created" | "deployment_protection_rule" | "deployment_protection_rule.requested" | "deployment_review" | "deployment_review.approved" | "deployment_review.rejected" | "deployment_review.requested" | "deployment_status" | "deployment_status.created" | "discussion" | "discussion.answered" | "discussion.category_changed" | "discussion.closed" | "discussion.created" | "discussion.deleted" | "discussion.edited" | "discussion.labeled" | "discussion.locked" | "discussion.pinned" | "discussion.reopened" | "discussion.transferred" | "discussion.unanswered" | "discussion.unlabeled" | "discussion.unlocked" | "discussion.unpinned" | "discussion_comment" | "discussion_comment.created" | "discussion_comment.deleted" | "discussion_comment.edited" | "fork" | "github_app_authorization" | "github_app_authorization.revoked" | "gollum" | "installation" | "installation.created" | "installation.deleted" | "installation.new_permissions_accepted" | "installation.suspend" | "installation.unsuspend" | "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed" | "installation_target" | "installation_target.renamed" | "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited" | "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.locked" | "issues.milestoned" | "issues.opened" | "issues.pinned" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled" | "issues.unlocked" | "issues.unpinned" | "label" | "label.created" | "label.deleted" | "label.edited" | "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased" | "member" | "member.added" | "member.edited" | "member.removed" | "membership" | "membership.added" | "membership.removed" | "merge_group" | "merge_group.checks_requested" | "merge_group.destroyed" | "meta" | "meta.deleted" | "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened" | "org_block" | "org_block.blocked" | "org_block.unblocked" | "organization" | "organization.deleted" | "organization.member_added" | "organization.member_invited" | "organization.member_removed" | "organization.renamed" | "package" | "package.published" | "package.updated" | "page_build" | "personal_access_token_request" | "personal_access_token_request.approved" | "personal_access_token_request.cancelled" | "personal_access_token_request.created" | "personal_access_token_request.denied" | "ping" | "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened" | "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved" | "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved" | "projects_v2" | "projects_v2.closed" | "projects_v2.created" | "projects_v2.deleted" | "projects_v2.edited" | "projects_v2.reopened" | "projects_v2_item" | "projects_v2_item.archived" | "projects_v2_item.converted" | "projects_v2_item.created" | "projects_v2_item.deleted" | "projects_v2_item.edited" | "projects_v2_item.reordered" | "projects_v2_item.restored" | "public" | "pull_request" | "pull_request.assigned" | "pull_request.auto_merge_disabled" | "pull_request.auto_merge_enabled" | "pull_request.closed" | "pull_request.converted_to_draft" | "pull_request.demilestoned" | "pull_request.dequeued" | "pull_request.edited" | "pull_request.enqueued" | "pull_request.labeled" | "pull_request.locked" | "pull_request.milestoned" | "pull_request.opened" | "pull_request.ready_for_review" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.synchronize" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.unlocked" | "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted" | "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited" | "pull_request_review_thread" | "pull_request_review_thread.resolved" | "pull_request_review_thread.unresolved" | "push" | "registry_package" | "registry_package.published" | "registry_package.updated" | "release" | "release.created" | "release.deleted" | "release.edited" | "release.prereleased" | "release.published" | "release.released" | "release.unpublished" | "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.edited" | "repository.privatized" | "repository.publicized" | "repository.renamed" | "repository.transferred" | "repository.unarchived" | "repository_advisory" | "repository_advisory.published" | "repository_advisory.reported" | "repository_dispatch" | "repository_dispatch.sample.collected" | "repository_import" | "repository_ruleset" | "repository_ruleset.created" | "repository_ruleset.deleted" | "repository_ruleset.edited" | "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.reopen" | "repository_vulnerability_alert.resolve" | "secret_scanning_alert" | "secret_scanning_alert.created" | "secret_scanning_alert.reopened" | "secret_scanning_alert.resolved" | "secret_scanning_alert.revoked" | "secret_scanning_alert.validated" | "secret_scanning_alert_location" | "secret_scanning_alert_location.created" | "security_advisory" | "security_advisory.published" | "security_advisory.updated" | "security_advisory.withdrawn" | "security_and_analysis" | "sponsorship" | "sponsorship.cancelled" | "sponsorship.created" | "sponsorship.edited" | "sponsorship.pending_cancellation" | "sponsorship.pending_tier_change" | "sponsorship.tier_changed" | "star" | "star.created" | "star.deleted" | "status" | "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository" | "team_add" | "watch" | "watch.started" | "workflow_dispatch" | "workflow_job" | "workflow_job.completed" | "workflow_job.in_progress" | "workflow_job.queued" | "workflow_job.waiting" | "workflow_run" | "workflow_run.completed" | "workflow_run.in_progress" | "workflow_run.requested">[]>>>;
17
19
  configuration: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
20
+ skipBotEvents: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
18
21
  }>;
19
22
  type Manifest = Static<typeof manifestSchema>;
20
23
 
@@ -5,6 +5,7 @@ declare const runEvent: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"bra
5
5
  declare const commandSchema: _sinclair_typebox.TObject<{
6
6
  description: _sinclair_typebox.TString;
7
7
  "ubiquity:example": _sinclair_typebox.TString;
8
+ parameters: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
8
9
  }>;
9
10
  declare const manifestSchema: _sinclair_typebox.TObject<{
10
11
  name: _sinclair_typebox.TString;
@@ -12,9 +13,11 @@ declare const manifestSchema: _sinclair_typebox.TObject<{
12
13
  commands: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TObject<{
13
14
  description: _sinclair_typebox.TString;
14
15
  "ubiquity:example": _sinclair_typebox.TString;
16
+ parameters: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
15
17
  }>>>;
16
18
  "ubiquity:listeners": _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"branch_protection_configuration" | "branch_protection_configuration.disabled" | "branch_protection_configuration.enabled" | "branch_protection_rule" | "branch_protection_rule.created" | "branch_protection_rule.deleted" | "branch_protection_rule.edited" | "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested" | "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested" | "code_scanning_alert" | "code_scanning_alert.appeared_in_branch" | "code_scanning_alert.closed_by_user" | "code_scanning_alert.created" | "code_scanning_alert.fixed" | "code_scanning_alert.reopened" | "code_scanning_alert.reopened_by_user" | "commit_comment" | "commit_comment.created" | "create" | "custom_property" | "custom_property.created" | "custom_property.deleted" | "custom_property.updated" | "custom_property_values" | "custom_property_values.updated" | "delete" | "dependabot_alert" | "dependabot_alert.auto_dismissed" | "dependabot_alert.auto_reopened" | "dependabot_alert.created" | "dependabot_alert.dismissed" | "dependabot_alert.fixed" | "dependabot_alert.reintroduced" | "dependabot_alert.reopened" | "deploy_key" | "deploy_key.created" | "deploy_key.deleted" | "deployment" | "deployment.created" | "deployment_protection_rule" | "deployment_protection_rule.requested" | "deployment_review" | "deployment_review.approved" | "deployment_review.rejected" | "deployment_review.requested" | "deployment_status" | "deployment_status.created" | "discussion" | "discussion.answered" | "discussion.category_changed" | "discussion.closed" | "discussion.created" | "discussion.deleted" | "discussion.edited" | "discussion.labeled" | "discussion.locked" | "discussion.pinned" | "discussion.reopened" | "discussion.transferred" | "discussion.unanswered" | "discussion.unlabeled" | "discussion.unlocked" | "discussion.unpinned" | "discussion_comment" | "discussion_comment.created" | "discussion_comment.deleted" | "discussion_comment.edited" | "fork" | "github_app_authorization" | "github_app_authorization.revoked" | "gollum" | "installation" | "installation.created" | "installation.deleted" | "installation.new_permissions_accepted" | "installation.suspend" | "installation.unsuspend" | "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed" | "installation_target" | "installation_target.renamed" | "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited" | "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.locked" | "issues.milestoned" | "issues.opened" | "issues.pinned" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled" | "issues.unlocked" | "issues.unpinned" | "label" | "label.created" | "label.deleted" | "label.edited" | "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased" | "member" | "member.added" | "member.edited" | "member.removed" | "membership" | "membership.added" | "membership.removed" | "merge_group" | "merge_group.checks_requested" | "merge_group.destroyed" | "meta" | "meta.deleted" | "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened" | "org_block" | "org_block.blocked" | "org_block.unblocked" | "organization" | "organization.deleted" | "organization.member_added" | "organization.member_invited" | "organization.member_removed" | "organization.renamed" | "package" | "package.published" | "package.updated" | "page_build" | "personal_access_token_request" | "personal_access_token_request.approved" | "personal_access_token_request.cancelled" | "personal_access_token_request.created" | "personal_access_token_request.denied" | "ping" | "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened" | "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved" | "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved" | "projects_v2" | "projects_v2.closed" | "projects_v2.created" | "projects_v2.deleted" | "projects_v2.edited" | "projects_v2.reopened" | "projects_v2_item" | "projects_v2_item.archived" | "projects_v2_item.converted" | "projects_v2_item.created" | "projects_v2_item.deleted" | "projects_v2_item.edited" | "projects_v2_item.reordered" | "projects_v2_item.restored" | "public" | "pull_request" | "pull_request.assigned" | "pull_request.auto_merge_disabled" | "pull_request.auto_merge_enabled" | "pull_request.closed" | "pull_request.converted_to_draft" | "pull_request.demilestoned" | "pull_request.dequeued" | "pull_request.edited" | "pull_request.enqueued" | "pull_request.labeled" | "pull_request.locked" | "pull_request.milestoned" | "pull_request.opened" | "pull_request.ready_for_review" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.synchronize" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.unlocked" | "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted" | "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited" | "pull_request_review_thread" | "pull_request_review_thread.resolved" | "pull_request_review_thread.unresolved" | "push" | "registry_package" | "registry_package.published" | "registry_package.updated" | "release" | "release.created" | "release.deleted" | "release.edited" | "release.prereleased" | "release.published" | "release.released" | "release.unpublished" | "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.edited" | "repository.privatized" | "repository.publicized" | "repository.renamed" | "repository.transferred" | "repository.unarchived" | "repository_advisory" | "repository_advisory.published" | "repository_advisory.reported" | "repository_dispatch" | "repository_dispatch.sample.collected" | "repository_import" | "repository_ruleset" | "repository_ruleset.created" | "repository_ruleset.deleted" | "repository_ruleset.edited" | "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.reopen" | "repository_vulnerability_alert.resolve" | "secret_scanning_alert" | "secret_scanning_alert.created" | "secret_scanning_alert.reopened" | "secret_scanning_alert.resolved" | "secret_scanning_alert.revoked" | "secret_scanning_alert.validated" | "secret_scanning_alert_location" | "secret_scanning_alert_location.created" | "security_advisory" | "security_advisory.published" | "security_advisory.updated" | "security_advisory.withdrawn" | "security_and_analysis" | "sponsorship" | "sponsorship.cancelled" | "sponsorship.created" | "sponsorship.edited" | "sponsorship.pending_cancellation" | "sponsorship.pending_tier_change" | "sponsorship.tier_changed" | "star" | "star.created" | "star.deleted" | "status" | "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository" | "team_add" | "watch" | "watch.started" | "workflow_dispatch" | "workflow_job" | "workflow_job.completed" | "workflow_job.in_progress" | "workflow_job.queued" | "workflow_job.waiting" | "workflow_run" | "workflow_run.completed" | "workflow_run.in_progress" | "workflow_run.requested">[]>>>;
17
19
  configuration: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
20
+ skipBotEvents: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
18
21
  }>;
19
22
  type Manifest = Static<typeof manifestSchema>;
20
23
 
package/dist/manifest.js CHANGED
@@ -1,20 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
1
20
  // src/types/manifest.ts
2
- import { Type as T } from "@sinclair/typebox";
3
- import { emitterEventNames } from "@octokit/webhooks";
4
- var runEvent = T.Union(emitterEventNames.map((o) => T.Literal(o)));
5
- var commandSchema = T.Object({
6
- description: T.String({ minLength: 1 }),
7
- "ubiquity:example": T.String({ minLength: 1 })
21
+ var manifest_exports = {};
22
+ __export(manifest_exports, {
23
+ commandSchema: () => commandSchema,
24
+ manifestSchema: () => manifestSchema,
25
+ runEvent: () => runEvent
26
+ });
27
+ module.exports = __toCommonJS(manifest_exports);
28
+ var import_typebox = require("@sinclair/typebox");
29
+ var import_webhooks = require("@octokit/webhooks");
30
+ var runEvent = import_typebox.Type.Union(import_webhooks.emitterEventNames.map((o) => import_typebox.Type.Literal(o)));
31
+ var commandSchema = import_typebox.Type.Object({
32
+ description: import_typebox.Type.String({ minLength: 1 }),
33
+ "ubiquity:example": import_typebox.Type.String({ minLength: 1 }),
34
+ parameters: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any()))
8
35
  });
9
- var manifestSchema = T.Object({
10
- name: T.String({ minLength: 1 }),
11
- description: T.Optional(T.String({ default: "" })),
12
- commands: T.Optional(T.Record(T.String(), commandSchema, { default: {} })),
13
- "ubiquity:listeners": T.Optional(T.Array(runEvent, { default: [] })),
14
- configuration: T.Optional(T.Record(T.String(), T.Any(), { default: {} }))
36
+ var manifestSchema = import_typebox.Type.Object({
37
+ name: import_typebox.Type.String({ minLength: 1 }),
38
+ description: import_typebox.Type.Optional(import_typebox.Type.String({ default: "" })),
39
+ commands: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String({ pattern: "^[A-Za-z-_]+$" }), commandSchema, { default: {} })),
40
+ "ubiquity:listeners": import_typebox.Type.Optional(import_typebox.Type.Array(runEvent, { default: [] })),
41
+ configuration: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any(), { default: {} })),
42
+ skipBotEvents: import_typebox.Type.Optional(import_typebox.Type.Boolean({ default: true }))
15
43
  });
16
- export {
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
17
46
  commandSchema,
18
47
  manifestSchema,
19
48
  runEvent
20
- };
49
+ });
@@ -0,0 +1,22 @@
1
+ // src/types/manifest.ts
2
+ import { Type as T } from "@sinclair/typebox";
3
+ import { emitterEventNames } from "@octokit/webhooks";
4
+ var runEvent = T.Union(emitterEventNames.map((o) => T.Literal(o)));
5
+ var commandSchema = T.Object({
6
+ description: T.String({ minLength: 1 }),
7
+ "ubiquity:example": T.String({ minLength: 1 }),
8
+ parameters: T.Optional(T.Record(T.String(), T.Any()))
9
+ });
10
+ var manifestSchema = T.Object({
11
+ name: T.String({ minLength: 1 }),
12
+ description: T.Optional(T.String({ default: "" })),
13
+ commands: T.Optional(T.Record(T.String({ pattern: "^[A-Za-z-_]+$" }), commandSchema, { default: {} })),
14
+ "ubiquity:listeners": T.Optional(T.Array(runEvent, { default: [] })),
15
+ configuration: T.Optional(T.Record(T.String(), T.Any(), { default: {} })),
16
+ skipBotEvents: T.Optional(T.Boolean({ default: true }))
17
+ });
18
+ export {
19
+ commandSchema,
20
+ manifestSchema,
21
+ runEvent
22
+ };
@@ -0,0 +1,16 @@
1
+ import * as _octokit_core_dist_types_types from '@octokit/core/dist-types/types';
2
+ import * as _octokit_plugin_paginate_graphql from '@octokit/plugin-paginate-graphql';
3
+ import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-endpoint-methods';
4
+ import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
5
+ import * as _octokit_request_error from '@octokit/request-error';
6
+ import { Octokit } from '@octokit/core';
7
+
8
+ declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
9
+ retry: {
10
+ retryRequest: (error: _octokit_request_error.RequestError, retries: number, retryAfter: number) => _octokit_request_error.RequestError;
11
+ };
12
+ } & {
13
+ paginate: _octokit_plugin_paginate_rest.PaginateInterface;
14
+ } & _octokit_plugin_rest_endpoint_methods.Api & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
15
+
16
+ export { customOctokit };
@@ -0,0 +1,16 @@
1
+ import * as _octokit_core_dist_types_types from '@octokit/core/dist-types/types';
2
+ import * as _octokit_plugin_paginate_graphql from '@octokit/plugin-paginate-graphql';
3
+ import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-endpoint-methods';
4
+ import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
5
+ import * as _octokit_request_error from '@octokit/request-error';
6
+ import { Octokit } from '@octokit/core';
7
+
8
+ declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
9
+ retry: {
10
+ retryRequest: (error: _octokit_request_error.RequestError, retries: number, retryAfter: number) => _octokit_request_error.RequestError;
11
+ };
12
+ } & {
13
+ paginate: _octokit_plugin_paginate_rest.PaginateInterface;
14
+ } & _octokit_plugin_rest_endpoint_methods.Api & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
15
+
16
+ export { customOctokit };