@ubiquity-os/plugin-sdk 1.0.10 → 1.0.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/constants.js CHANGED
@@ -1,3 +1,34 @@
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
+
20
+ // src/constants.ts
21
+ var constants_exports = {};
22
+ __export(constants_exports, {
23
+ BOT_USER_ID: () => BOT_USER_ID,
24
+ CONFIG_FULL_PATH: () => CONFIG_FULL_PATH,
25
+ CONFIG_ORG_REPO: () => CONFIG_ORG_REPO,
26
+ DEV_CONFIG_FULL_PATH: () => DEV_CONFIG_FULL_PATH,
27
+ KERNEL_APP_ID: () => KERNEL_APP_ID,
28
+ KERNEL_PUBLIC_KEY: () => KERNEL_PUBLIC_KEY
29
+ });
30
+ module.exports = __toCommonJS(constants_exports);
31
+
1
32
  // src/types/config.ts
2
33
  var CONFIG_FULL_PATH = ".github/.ubiquity-os.config.yml";
3
34
  var DEV_CONFIG_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
@@ -16,11 +47,12 @@ JQIDAQAB
16
47
  `;
17
48
  var KERNEL_APP_ID = 975031;
18
49
  var BOT_USER_ID = 178941584;
19
- export {
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
20
52
  BOT_USER_ID,
21
53
  CONFIG_FULL_PATH,
22
54
  CONFIG_ORG_REPO,
23
55
  DEV_CONFIG_FULL_PATH,
24
56
  KERNEL_APP_ID,
25
57
  KERNEL_PUBLIC_KEY
26
- };
58
+ });
@@ -0,0 +1,26 @@
1
+ // src/types/config.ts
2
+ var CONFIG_FULL_PATH = ".github/.ubiquity-os.config.yml";
3
+ var DEV_CONFIG_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
4
+ var CONFIG_ORG_REPO = ".ubiquity-os";
5
+
6
+ // src/constants.ts
7
+ var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
8
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
9
+ uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
10
+ U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
11
+ I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
12
+ wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
13
+ Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
14
+ JQIDAQAB
15
+ -----END PUBLIC KEY-----
16
+ `;
17
+ var KERNEL_APP_ID = 975031;
18
+ var BOT_USER_ID = 178941584;
19
+ export {
20
+ BOT_USER_ID,
21
+ CONFIG_FULL_PATH,
22
+ CONFIG_ORG_REPO,
23
+ DEV_CONFIG_FULL_PATH,
24
+ KERNEL_APP_ID,
25
+ KERNEL_PUBLIC_KEY
26
+ };
@@ -9,7 +9,7 @@ import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-end
9
9
  import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
10
10
  import * as _octokit_request_error from '@octokit/request-error';
11
11
  import { Octokit } from '@octokit/core';
12
- import { Manifest } from './manifest.cjs';
12
+ import { Manifest } from './manifest.mjs';
13
13
 
14
14
  declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
15
15
  retry: {
package/dist/index.js CHANGED
@@ -1,10 +1,48 @@
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
+
1
39
  // src/server.ts
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";
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");
8
46
 
9
47
  // src/util.ts
10
48
  function sanitizeMetadata(obj) {
@@ -60,12 +98,12 @@ JQIDAQAB
60
98
  `;
61
99
 
62
100
  // src/octokit.ts
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";
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");
69
107
  var defaultOptions = {
70
108
  throttle: {
71
109
  onAbuseLimit: (retryAfter, options, octokit) => {
@@ -82,7 +120,7 @@ var defaultOptions = {
82
120
  }
83
121
  }
84
122
  };
85
- var customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, paginateGraphQL).defaults((instanceOptions) => {
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) => {
86
124
  return { ...defaultOptions, ...instanceOptions };
87
125
  });
88
126
 
@@ -119,16 +157,16 @@ async function verifySignature(publicKeyPem, inputs, signature) {
119
157
  }
120
158
 
121
159
  // src/server.ts
122
- var inputSchema = T.Object({
123
- stateId: T.String(),
124
- eventName: T.String(),
125
- eventPayload: T.Record(T.String(), T.Any()),
126
- authToken: T.String(),
127
- settings: T.Record(T.String(), T.Any()),
128
- ref: T.String(),
129
- signature: T.String(),
130
- bypassSignatureVerification: T.Optional(
131
- T.Boolean({
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({
132
170
  default: false,
133
171
  description: "Bypass signature verification (caution: only use this if you know what you're doing)"
134
172
  })
@@ -137,48 +175,48 @@ var inputSchema = T.Object({
137
175
  function createPlugin(handler, manifest, options) {
138
176
  const pluginOptions = {
139
177
  kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
140
- logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
178
+ logLevel: options?.logLevel ?? import_ubiquity_os_logger.LOG_LEVEL.INFO,
141
179
  postCommentOnError: options?.postCommentOnError ?? true,
142
180
  settingsSchema: options?.settingsSchema,
143
181
  envSchema: options?.envSchema
144
182
  };
145
- const app = new Hono();
183
+ const app = new import_hono.Hono();
146
184
  app.get("/manifest.json", (ctx) => {
147
185
  return ctx.json(manifest);
148
186
  });
149
187
  app.post("/", async (ctx) => {
150
188
  if (ctx.req.header("content-type") !== "application/json") {
151
- throw new HTTPException(400, { message: "Content-Type must be application/json" });
189
+ throw new import_http_exception.HTTPException(400, { message: "Content-Type must be application/json" });
152
190
  }
153
191
  const body = await ctx.req.json();
154
- const inputSchemaErrors = [...Value.Errors(inputSchema, body)];
192
+ const inputSchemaErrors = [...import_value.Value.Errors(inputSchema, body)];
155
193
  if (inputSchemaErrors.length) {
156
194
  console.dir(inputSchemaErrors, { depth: null });
157
- throw new HTTPException(400, { message: "Invalid body" });
195
+ throw new import_http_exception.HTTPException(400, { message: "Invalid body" });
158
196
  }
159
- const inputs = Value.Decode(inputSchema, body);
197
+ const inputs = import_value.Value.Decode(inputSchema, body);
160
198
  const signature = inputs.signature;
161
199
  if (!options?.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
162
- throw new HTTPException(400, { message: "Invalid signature" });
200
+ throw new import_http_exception.HTTPException(400, { message: "Invalid signature" });
163
201
  }
164
202
  let config2;
165
203
  if (pluginOptions.settingsSchema) {
166
204
  try {
167
- config2 = Value.Decode(pluginOptions.settingsSchema, Value.Default(pluginOptions.settingsSchema, inputs.settings));
205
+ config2 = import_value.Value.Decode(pluginOptions.settingsSchema, import_value.Value.Default(pluginOptions.settingsSchema, inputs.settings));
168
206
  } catch (e) {
169
- console.dir(...Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
207
+ console.dir(...import_value.Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
170
208
  throw e;
171
209
  }
172
210
  } else {
173
211
  config2 = inputs.settings;
174
212
  }
175
213
  let env;
176
- const honoEnvironment = honoEnv(ctx);
214
+ const honoEnvironment = (0, import_adapter.env)(ctx);
177
215
  if (pluginOptions.envSchema) {
178
216
  try {
179
- env = Value.Decode(pluginOptions.envSchema, Value.Default(pluginOptions.envSchema, honoEnvironment));
217
+ env = import_value.Value.Decode(pluginOptions.envSchema, import_value.Value.Default(pluginOptions.envSchema, honoEnvironment));
180
218
  } catch (e) {
181
- console.dir(...Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
219
+ console.dir(...import_value.Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
182
220
  throw e;
183
221
  }
184
222
  } else {
@@ -190,7 +228,7 @@ function createPlugin(handler, manifest, options) {
190
228
  octokit: new customOctokit({ auth: inputs.authToken }),
191
229
  config: config2,
192
230
  env,
193
- logger: new Logs(pluginOptions.logLevel)
231
+ logger: new import_ubiquity_os_logger.Logs(pluginOptions.logLevel)
194
232
  };
195
233
  try {
196
234
  const result = await handler(context2);
@@ -200,7 +238,7 @@ function createPlugin(handler, manifest, options) {
200
238
  let loggerError;
201
239
  if (error instanceof Error) {
202
240
  loggerError = context2.logger.error(`Error: ${error}`, { error });
203
- } else if (error instanceof LogReturn) {
241
+ } else if (error instanceof import_ubiquity_os_logger.LogReturn) {
204
242
  loggerError = error;
205
243
  } else {
206
244
  loggerError = context2.logger.error(`Error: ${error}`);
@@ -208,32 +246,32 @@ function createPlugin(handler, manifest, options) {
208
246
  if (pluginOptions.postCommentOnError && loggerError) {
209
247
  await postComment(context2, loggerError);
210
248
  }
211
- throw new HTTPException(500, { message: "Unexpected error" });
249
+ throw new import_http_exception.HTTPException(500, { message: "Unexpected error" });
212
250
  }
213
251
  });
214
252
  return app;
215
253
  }
216
254
 
217
255
  // src/actions.ts
218
- import * as core from "@actions/core";
219
- import * as github from "@actions/github";
220
- import { Type as T2 } from "@sinclair/typebox";
221
- import { Value as Value2 } from "@sinclair/typebox/value";
222
- import { LOG_LEVEL as LOG_LEVEL2, LogReturn as LogReturn2, Logs as Logs2 } from "@ubiquity-os/ubiquity-os-logger";
223
- import { config } from "dotenv";
224
- config();
225
- var inputSchema2 = T2.Object({
226
- stateId: T2.String(),
227
- eventName: T2.String(),
228
- eventPayload: T2.String(),
229
- authToken: T2.String(),
230
- settings: T2.String(),
231
- ref: T2.String(),
232
- signature: T2.String()
256
+ var core = __toESM(require("@actions/core"));
257
+ var github = __toESM(require("@actions/github"));
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()
233
271
  });
234
272
  async function createActionsPlugin(handler, options) {
235
273
  const pluginOptions = {
236
- logLevel: options?.logLevel ?? LOG_LEVEL2.INFO,
274
+ logLevel: options?.logLevel ?? import_ubiquity_os_logger2.LOG_LEVEL.INFO,
237
275
  postCommentOnError: options?.postCommentOnError ?? true,
238
276
  settingsSchema: options?.settingsSchema,
239
277
  envSchema: options?.envSchema,
@@ -245,13 +283,13 @@ async function createActionsPlugin(handler, options) {
245
283
  return;
246
284
  }
247
285
  const inputPayload = github.context.payload.inputs;
248
- const inputSchemaErrors = [...Value2.Errors(inputSchema2, inputPayload)];
286
+ const inputSchemaErrors = [...import_value2.Value.Errors(inputSchema2, inputPayload)];
249
287
  if (inputSchemaErrors.length) {
250
288
  console.dir(inputSchemaErrors, { depth: null });
251
289
  core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
252
290
  return;
253
291
  }
254
- const inputs = Value2.Decode(inputSchema2, inputPayload);
292
+ const inputs = import_value2.Value.Decode(inputSchema2, inputPayload);
255
293
  const signature = inputs.signature;
256
294
  if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
257
295
  core.setFailed(`Error: Invalid signature`);
@@ -260,9 +298,9 @@ async function createActionsPlugin(handler, options) {
260
298
  let config2;
261
299
  if (pluginOptions.settingsSchema) {
262
300
  try {
263
- config2 = Value2.Decode(pluginOptions.settingsSchema, Value2.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
301
+ config2 = import_value2.Value.Decode(pluginOptions.settingsSchema, import_value2.Value.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
264
302
  } catch (e) {
265
- console.dir(...Value2.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
303
+ console.dir(...import_value2.Value.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
266
304
  throw e;
267
305
  }
268
306
  } else {
@@ -271,9 +309,9 @@ async function createActionsPlugin(handler, options) {
271
309
  let env;
272
310
  if (pluginOptions.envSchema) {
273
311
  try {
274
- env = Value2.Decode(pluginOptions.envSchema, Value2.Default(pluginOptions.envSchema, process.env));
312
+ env = import_value2.Value.Decode(pluginOptions.envSchema, import_value2.Value.Default(pluginOptions.envSchema, process.env));
275
313
  } catch (e) {
276
- console.dir(...Value2.Errors(pluginOptions.envSchema, process.env), { depth: null });
314
+ console.dir(...import_value2.Value.Errors(pluginOptions.envSchema, process.env), { depth: null });
277
315
  throw e;
278
316
  }
279
317
  } else {
@@ -285,7 +323,7 @@ async function createActionsPlugin(handler, options) {
285
323
  octokit: new customOctokit({ auth: inputs.authToken }),
286
324
  config: config2,
287
325
  env,
288
- logger: new Logs2(pluginOptions.logLevel)
326
+ logger: new import_ubiquity_os_logger2.Logs(pluginOptions.logLevel)
289
327
  };
290
328
  try {
291
329
  const result = await handler(context2);
@@ -297,7 +335,7 @@ async function createActionsPlugin(handler, options) {
297
335
  if (error instanceof Error) {
298
336
  core.setFailed(error);
299
337
  loggerError = context2.logger.error(`Error: ${error}`, { error });
300
- } else if (error instanceof LogReturn2) {
338
+ } else if (error instanceof import_ubiquity_os_logger2.LogReturn) {
301
339
  core.setFailed(error.logMessage.raw);
302
340
  loggerError = error;
303
341
  } else {
@@ -340,8 +378,9 @@ async function returnDataToKernel(repoToken, stateId, output) {
340
378
  }
341
379
  });
342
380
  }
343
- export {
381
+ // Annotate the CommonJS export names for ESM import in node:
382
+ 0 && (module.exports = {
344
383
  createActionsPlugin,
345
384
  createPlugin,
346
385
  postComment
347
- };
386
+ });
@@ -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
 
@@ -157,16 +119,16 @@ async function verifySignature(publicKeyPem, inputs, signature) {
157
119
  }
158
120
 
159
121
  // 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({
122
+ var inputSchema = T.Object({
123
+ stateId: T.String(),
124
+ eventName: T.String(),
125
+ eventPayload: T.Record(T.String(), T.Any()),
126
+ authToken: T.String(),
127
+ settings: T.Record(T.String(), T.Any()),
128
+ ref: T.String(),
129
+ signature: T.String(),
130
+ bypassSignatureVerification: T.Optional(
131
+ T.Boolean({
170
132
  default: false,
171
133
  description: "Bypass signature verification (caution: only use this if you know what you're doing)"
172
134
  })
@@ -175,48 +137,48 @@ var inputSchema = import_typebox.Type.Object({
175
137
  function createPlugin(handler, manifest, options) {
176
138
  const pluginOptions = {
177
139
  kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
178
- logLevel: options?.logLevel ?? import_ubiquity_os_logger.LOG_LEVEL.INFO,
140
+ logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
179
141
  postCommentOnError: options?.postCommentOnError ?? true,
180
142
  settingsSchema: options?.settingsSchema,
181
143
  envSchema: options?.envSchema
182
144
  };
183
- const app = new import_hono.Hono();
145
+ const app = new Hono();
184
146
  app.get("/manifest.json", (ctx) => {
185
147
  return ctx.json(manifest);
186
148
  });
187
149
  app.post("/", async (ctx) => {
188
150
  if (ctx.req.header("content-type") !== "application/json") {
189
- throw new import_http_exception.HTTPException(400, { message: "Content-Type must be application/json" });
151
+ throw new HTTPException(400, { message: "Content-Type must be application/json" });
190
152
  }
191
153
  const body = await ctx.req.json();
192
- const inputSchemaErrors = [...import_value.Value.Errors(inputSchema, body)];
154
+ const inputSchemaErrors = [...Value.Errors(inputSchema, body)];
193
155
  if (inputSchemaErrors.length) {
194
156
  console.dir(inputSchemaErrors, { depth: null });
195
- throw new import_http_exception.HTTPException(400, { message: "Invalid body" });
157
+ throw new HTTPException(400, { message: "Invalid body" });
196
158
  }
197
- const inputs = import_value.Value.Decode(inputSchema, body);
159
+ const inputs = Value.Decode(inputSchema, body);
198
160
  const signature = inputs.signature;
199
161
  if (!options?.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
200
- throw new import_http_exception.HTTPException(400, { message: "Invalid signature" });
162
+ throw new HTTPException(400, { message: "Invalid signature" });
201
163
  }
202
164
  let config2;
203
165
  if (pluginOptions.settingsSchema) {
204
166
  try {
205
- config2 = import_value.Value.Decode(pluginOptions.settingsSchema, import_value.Value.Default(pluginOptions.settingsSchema, inputs.settings));
167
+ config2 = Value.Decode(pluginOptions.settingsSchema, Value.Default(pluginOptions.settingsSchema, inputs.settings));
206
168
  } catch (e) {
207
- console.dir(...import_value.Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
169
+ console.dir(...Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
208
170
  throw e;
209
171
  }
210
172
  } else {
211
173
  config2 = inputs.settings;
212
174
  }
213
175
  let env;
214
- const honoEnvironment = (0, import_adapter.env)(ctx);
176
+ const honoEnvironment = honoEnv(ctx);
215
177
  if (pluginOptions.envSchema) {
216
178
  try {
217
- env = import_value.Value.Decode(pluginOptions.envSchema, import_value.Value.Default(pluginOptions.envSchema, honoEnvironment));
179
+ env = Value.Decode(pluginOptions.envSchema, Value.Default(pluginOptions.envSchema, honoEnvironment));
218
180
  } catch (e) {
219
- console.dir(...import_value.Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
181
+ console.dir(...Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
220
182
  throw e;
221
183
  }
222
184
  } else {
@@ -228,7 +190,7 @@ function createPlugin(handler, manifest, options) {
228
190
  octokit: new customOctokit({ auth: inputs.authToken }),
229
191
  config: config2,
230
192
  env,
231
- logger: new import_ubiquity_os_logger.Logs(pluginOptions.logLevel)
193
+ logger: new Logs(pluginOptions.logLevel)
232
194
  };
233
195
  try {
234
196
  const result = await handler(context2);
@@ -238,7 +200,7 @@ function createPlugin(handler, manifest, options) {
238
200
  let loggerError;
239
201
  if (error instanceof Error) {
240
202
  loggerError = context2.logger.error(`Error: ${error}`, { error });
241
- } else if (error instanceof import_ubiquity_os_logger.LogReturn) {
203
+ } else if (error instanceof LogReturn) {
242
204
  loggerError = error;
243
205
  } else {
244
206
  loggerError = context2.logger.error(`Error: ${error}`);
@@ -246,32 +208,32 @@ function createPlugin(handler, manifest, options) {
246
208
  if (pluginOptions.postCommentOnError && loggerError) {
247
209
  await postComment(context2, loggerError);
248
210
  }
249
- throw new import_http_exception.HTTPException(500, { message: "Unexpected error" });
211
+ throw new HTTPException(500, { message: "Unexpected error" });
250
212
  }
251
213
  });
252
214
  return app;
253
215
  }
254
216
 
255
217
  // 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()
218
+ import * as core from "@actions/core";
219
+ import * as github from "@actions/github";
220
+ import { Type as T2 } from "@sinclair/typebox";
221
+ import { Value as Value2 } from "@sinclair/typebox/value";
222
+ import { LOG_LEVEL as LOG_LEVEL2, LogReturn as LogReturn2, Logs as Logs2 } from "@ubiquity-os/ubiquity-os-logger";
223
+ import { config } from "dotenv";
224
+ config();
225
+ var inputSchema2 = T2.Object({
226
+ stateId: T2.String(),
227
+ eventName: T2.String(),
228
+ eventPayload: T2.String(),
229
+ authToken: T2.String(),
230
+ settings: T2.String(),
231
+ ref: T2.String(),
232
+ signature: T2.String()
271
233
  });
272
234
  async function createActionsPlugin(handler, options) {
273
235
  const pluginOptions = {
274
- logLevel: options?.logLevel ?? import_ubiquity_os_logger2.LOG_LEVEL.INFO,
236
+ logLevel: options?.logLevel ?? LOG_LEVEL2.INFO,
275
237
  postCommentOnError: options?.postCommentOnError ?? true,
276
238
  settingsSchema: options?.settingsSchema,
277
239
  envSchema: options?.envSchema,
@@ -283,13 +245,13 @@ async function createActionsPlugin(handler, options) {
283
245
  return;
284
246
  }
285
247
  const inputPayload = github.context.payload.inputs;
286
- const inputSchemaErrors = [...import_value2.Value.Errors(inputSchema2, inputPayload)];
248
+ const inputSchemaErrors = [...Value2.Errors(inputSchema2, inputPayload)];
287
249
  if (inputSchemaErrors.length) {
288
250
  console.dir(inputSchemaErrors, { depth: null });
289
251
  core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
290
252
  return;
291
253
  }
292
- const inputs = import_value2.Value.Decode(inputSchema2, inputPayload);
254
+ const inputs = Value2.Decode(inputSchema2, inputPayload);
293
255
  const signature = inputs.signature;
294
256
  if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
295
257
  core.setFailed(`Error: Invalid signature`);
@@ -298,9 +260,9 @@ async function createActionsPlugin(handler, options) {
298
260
  let config2;
299
261
  if (pluginOptions.settingsSchema) {
300
262
  try {
301
- config2 = import_value2.Value.Decode(pluginOptions.settingsSchema, import_value2.Value.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
263
+ config2 = Value2.Decode(pluginOptions.settingsSchema, Value2.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
302
264
  } catch (e) {
303
- console.dir(...import_value2.Value.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
265
+ console.dir(...Value2.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
304
266
  throw e;
305
267
  }
306
268
  } else {
@@ -309,9 +271,9 @@ async function createActionsPlugin(handler, options) {
309
271
  let env;
310
272
  if (pluginOptions.envSchema) {
311
273
  try {
312
- env = import_value2.Value.Decode(pluginOptions.envSchema, import_value2.Value.Default(pluginOptions.envSchema, process.env));
274
+ env = Value2.Decode(pluginOptions.envSchema, Value2.Default(pluginOptions.envSchema, process.env));
313
275
  } catch (e) {
314
- console.dir(...import_value2.Value.Errors(pluginOptions.envSchema, process.env), { depth: null });
276
+ console.dir(...Value2.Errors(pluginOptions.envSchema, process.env), { depth: null });
315
277
  throw e;
316
278
  }
317
279
  } else {
@@ -323,7 +285,7 @@ async function createActionsPlugin(handler, options) {
323
285
  octokit: new customOctokit({ auth: inputs.authToken }),
324
286
  config: config2,
325
287
  env,
326
- logger: new import_ubiquity_os_logger2.Logs(pluginOptions.logLevel)
288
+ logger: new Logs2(pluginOptions.logLevel)
327
289
  };
328
290
  try {
329
291
  const result = await handler(context2);
@@ -335,7 +297,7 @@ async function createActionsPlugin(handler, options) {
335
297
  if (error instanceof Error) {
336
298
  core.setFailed(error);
337
299
  loggerError = context2.logger.error(`Error: ${error}`, { error });
338
- } else if (error instanceof import_ubiquity_os_logger2.LogReturn) {
300
+ } else if (error instanceof LogReturn2) {
339
301
  core.setFailed(error.logMessage.raw);
340
302
  loggerError = error;
341
303
  } else {
@@ -378,9 +340,8 @@ async function returnDataToKernel(repoToken, stateId, output) {
378
340
  }
379
341
  });
380
342
  }
381
- // Annotate the CommonJS export names for ESM import in node:
382
- 0 && (module.exports = {
343
+ export {
383
344
  createActionsPlugin,
384
345
  createPlugin,
385
346
  postComment
386
- });
347
+ };
package/dist/manifest.js CHANGED
@@ -1,20 +1,47 @@
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 })
8
34
  });
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: {} }))
35
+ var manifestSchema = import_typebox.Type.Object({
36
+ name: import_typebox.Type.String({ minLength: 1 }),
37
+ description: import_typebox.Type.Optional(import_typebox.Type.String({ default: "" })),
38
+ commands: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), commandSchema, { default: {} })),
39
+ "ubiquity:listeners": import_typebox.Type.Optional(import_typebox.Type.Array(runEvent, { default: [] })),
40
+ configuration: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any(), { default: {} }))
15
41
  });
16
- export {
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
17
44
  commandSchema,
18
45
  manifestSchema,
19
46
  runEvent
20
- };
47
+ });
@@ -0,0 +1,20 @@
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
+ });
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: {} }))
15
+ });
16
+ export {
17
+ commandSchema,
18
+ manifestSchema,
19
+ runEvent
20
+ };
package/dist/signature.js CHANGED
@@ -1,4 +1,29 @@
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/signature.ts
21
+ var signature_exports = {};
22
+ __export(signature_exports, {
23
+ signPayload: () => signPayload,
24
+ verifySignature: () => verifySignature
25
+ });
26
+ module.exports = __toCommonJS(signature_exports);
2
27
  async function verifySignature(publicKeyPem, inputs, signature) {
3
28
  try {
4
29
  const inputsOrdered = {
@@ -49,7 +74,8 @@ async function signPayload(payload, privateKey) {
49
74
  const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", _privateKey, data);
50
75
  return btoa(String.fromCharCode(...new Uint8Array(signature)));
51
76
  }
52
- export {
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
53
79
  signPayload,
54
80
  verifySignature
55
- };
81
+ });
@@ -1,29 +1,4 @@
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
-
20
1
  // src/signature.ts
21
- var signature_exports = {};
22
- __export(signature_exports, {
23
- signPayload: () => signPayload,
24
- verifySignature: () => verifySignature
25
- });
26
- module.exports = __toCommonJS(signature_exports);
27
2
  async function verifySignature(publicKeyPem, inputs, signature) {
28
3
  try {
29
4
  const inputsOrdered = {
@@ -74,8 +49,7 @@ async function signPayload(payload, privateKey) {
74
49
  const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", _privateKey, data);
75
50
  return btoa(String.fromCharCode(...new Uint8Array(signature)));
76
51
  }
77
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
52
+ export {
79
53
  signPayload,
80
54
  verifySignature
81
- });
55
+ };
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@ubiquity-os/plugin-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "SDK for plugin support.",
5
5
  "author": "Ubiquity DAO",
6
6
  "license": "MIT",
7
7
  "engines": {
8
8
  "node": ">=20.10.0"
9
9
  },
10
- "type": "module",
11
10
  "module": "dist/index.mjs",
12
11
  "main": "dist/index.js",
13
12
  "typings": "dist/index.d.ts",
@@ -1,58 +0,0 @@
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
-
20
- // src/constants.ts
21
- var constants_exports = {};
22
- __export(constants_exports, {
23
- BOT_USER_ID: () => BOT_USER_ID,
24
- CONFIG_FULL_PATH: () => CONFIG_FULL_PATH,
25
- CONFIG_ORG_REPO: () => CONFIG_ORG_REPO,
26
- DEV_CONFIG_FULL_PATH: () => DEV_CONFIG_FULL_PATH,
27
- KERNEL_APP_ID: () => KERNEL_APP_ID,
28
- KERNEL_PUBLIC_KEY: () => KERNEL_PUBLIC_KEY
29
- });
30
- module.exports = __toCommonJS(constants_exports);
31
-
32
- // src/types/config.ts
33
- var CONFIG_FULL_PATH = ".github/.ubiquity-os.config.yml";
34
- var DEV_CONFIG_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
35
- var CONFIG_ORG_REPO = ".ubiquity-os";
36
-
37
- // src/constants.ts
38
- var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
39
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
40
- uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
41
- U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
42
- I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
43
- wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
44
- Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
45
- JQIDAQAB
46
- -----END PUBLIC KEY-----
47
- `;
48
- var KERNEL_APP_ID = 975031;
49
- var BOT_USER_ID = 178941584;
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- BOT_USER_ID,
53
- CONFIG_FULL_PATH,
54
- CONFIG_ORG_REPO,
55
- DEV_CONFIG_FULL_PATH,
56
- KERNEL_APP_ID,
57
- KERNEL_PUBLIC_KEY
58
- });
package/dist/manifest.cjs DELETED
@@ -1,47 +0,0 @@
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
-
20
- // src/types/manifest.ts
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
- });
35
- var manifestSchema = import_typebox.Type.Object({
36
- name: import_typebox.Type.String({ minLength: 1 }),
37
- description: import_typebox.Type.Optional(import_typebox.Type.String({ default: "" })),
38
- commands: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), commandSchema, { default: {} })),
39
- "ubiquity:listeners": import_typebox.Type.Optional(import_typebox.Type.Array(runEvent, { default: [] })),
40
- configuration: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any(), { default: {} }))
41
- });
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- commandSchema,
45
- manifestSchema,
46
- runEvent
47
- });
File without changes
File without changes
File without changes