@ubiquity-os/plugin-sdk 1.1.0 → 1.1.1
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 +5 -16
- package/dist/index.d.ts +5 -16
- package/dist/index.js +41 -42
- package/dist/index.mjs +37 -38
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as hono_types from 'hono/types';
|
|
2
2
|
import { EmitterWebhookEventName, EmitterWebhookEvent } from '@octokit/webhooks';
|
|
3
|
-
import { TAnySchema } from '@sinclair/typebox';
|
|
4
|
-
import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
5
3
|
import { Hono } from 'hono';
|
|
4
|
+
import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
6
5
|
import { customOctokit } from './octokit.mjs';
|
|
7
6
|
import { Manifest } from './manifest.mjs';
|
|
7
|
+
import { TAnySchema } from '@sinclair/typebox';
|
|
8
8
|
import '@octokit/core/dist-types/types';
|
|
9
9
|
import '@octokit/plugin-paginate-graphql';
|
|
10
10
|
import '@octokit/plugin-rest-endpoint-methods';
|
|
@@ -27,7 +27,7 @@ interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSuppor
|
|
|
27
27
|
type Return = Record<string, unknown> | undefined | void;
|
|
28
28
|
type HandlerReturn = Promise<Return> | Return;
|
|
29
29
|
|
|
30
|
-
interface Options
|
|
30
|
+
interface Options {
|
|
31
31
|
kernelPublicKey?: string;
|
|
32
32
|
logLevel?: LogLevel;
|
|
33
33
|
postCommentOnError?: boolean;
|
|
@@ -39,20 +39,9 @@ interface Options$1 {
|
|
|
39
39
|
*/
|
|
40
40
|
bypassSignatureVerification?: boolean;
|
|
41
41
|
}
|
|
42
|
-
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
postCommentOnError?: boolean;
|
|
47
|
-
settingsSchema?: TAnySchema;
|
|
48
|
-
envSchema?: TAnySchema;
|
|
49
|
-
commandSchema?: TAnySchema;
|
|
50
|
-
kernelPublicKey?: string;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated This disables signature verification - only for local development
|
|
53
|
-
*/
|
|
54
|
-
bypassSignatureVerification?: boolean;
|
|
55
|
-
}
|
|
43
|
+
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
44
|
+
|
|
56
45
|
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, options?: Options): Promise<void>;
|
|
57
46
|
|
|
58
47
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as hono_types from 'hono/types';
|
|
2
2
|
import { EmitterWebhookEventName, EmitterWebhookEvent } from '@octokit/webhooks';
|
|
3
|
-
import { TAnySchema } from '@sinclair/typebox';
|
|
4
|
-
import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
5
3
|
import { Hono } from 'hono';
|
|
4
|
+
import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
6
5
|
import { customOctokit } from './octokit.js';
|
|
7
6
|
import { Manifest } from './manifest.js';
|
|
7
|
+
import { TAnySchema } from '@sinclair/typebox';
|
|
8
8
|
import '@octokit/core/dist-types/types';
|
|
9
9
|
import '@octokit/plugin-paginate-graphql';
|
|
10
10
|
import '@octokit/plugin-rest-endpoint-methods';
|
|
@@ -27,7 +27,7 @@ interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSuppor
|
|
|
27
27
|
type Return = Record<string, unknown> | undefined | void;
|
|
28
28
|
type HandlerReturn = Promise<Return> | Return;
|
|
29
29
|
|
|
30
|
-
interface Options
|
|
30
|
+
interface Options {
|
|
31
31
|
kernelPublicKey?: string;
|
|
32
32
|
logLevel?: LogLevel;
|
|
33
33
|
postCommentOnError?: boolean;
|
|
@@ -39,20 +39,9 @@ interface Options$1 {
|
|
|
39
39
|
*/
|
|
40
40
|
bypassSignatureVerification?: boolean;
|
|
41
41
|
}
|
|
42
|
-
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
postCommentOnError?: boolean;
|
|
47
|
-
settingsSchema?: TAnySchema;
|
|
48
|
-
envSchema?: TAnySchema;
|
|
49
|
-
commandSchema?: TAnySchema;
|
|
50
|
-
kernelPublicKey?: string;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated This disables signature verification - only for local development
|
|
53
|
-
*/
|
|
54
|
-
bypassSignatureVerification?: boolean;
|
|
55
|
-
}
|
|
43
|
+
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
44
|
+
|
|
56
45
|
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, options?: Options): Promise<void>;
|
|
57
46
|
|
|
58
47
|
/**
|
package/dist/index.js
CHANGED
|
@@ -39,15 +39,42 @@ module.exports = __toCommonJS(src_exports);
|
|
|
39
39
|
// src/server.ts
|
|
40
40
|
var import_typebox = require("@sinclair/typebox");
|
|
41
41
|
var import_value = require("@sinclair/typebox/value");
|
|
42
|
-
var
|
|
42
|
+
var import_ubiquity_os_logger2 = require("@ubiquity-os/ubiquity-os-logger");
|
|
43
43
|
var import_hono = require("hono");
|
|
44
44
|
var import_adapter = require("hono/adapter");
|
|
45
45
|
var import_http_exception = require("hono/http-exception");
|
|
46
46
|
|
|
47
|
+
// src/util.ts
|
|
48
|
+
var import_ubiquity_os_logger = require("@ubiquity-os/ubiquity-os-logger");
|
|
49
|
+
|
|
50
|
+
// src/constants.ts
|
|
51
|
+
var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
52
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
|
|
53
|
+
uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
|
|
54
|
+
U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
|
|
55
|
+
I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
|
|
56
|
+
wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
|
|
57
|
+
Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
|
|
58
|
+
JQIDAQAB
|
|
59
|
+
-----END PUBLIC KEY-----
|
|
60
|
+
`;
|
|
61
|
+
|
|
47
62
|
// src/util.ts
|
|
48
63
|
function sanitizeMetadata(obj) {
|
|
49
64
|
return JSON.stringify(obj, null, 2).replace(/</g, "<").replace(/>/g, ">").replace(/--/g, "--");
|
|
50
65
|
}
|
|
66
|
+
function getPluginOptions(options) {
|
|
67
|
+
return {
|
|
68
|
+
// Important to use || and not ?? to not consider empty strings
|
|
69
|
+
kernelPublicKey: options?.kernelPublicKey || KERNEL_PUBLIC_KEY,
|
|
70
|
+
logLevel: options?.logLevel ?? import_ubiquity_os_logger.LOG_LEVEL.INFO,
|
|
71
|
+
postCommentOnError: options?.postCommentOnError ?? true,
|
|
72
|
+
settingsSchema: options?.settingsSchema,
|
|
73
|
+
envSchema: options?.envSchema,
|
|
74
|
+
commandSchema: options?.commandSchema,
|
|
75
|
+
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
76
|
+
};
|
|
77
|
+
}
|
|
51
78
|
|
|
52
79
|
// src/comment.ts
|
|
53
80
|
var HEADER_NAME = "Ubiquity";
|
|
@@ -85,18 +112,6 @@ ${metadataSerialized}
|
|
|
85
112
|
`;
|
|
86
113
|
}
|
|
87
114
|
|
|
88
|
-
// src/constants.ts
|
|
89
|
-
var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
90
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
|
|
91
|
-
uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
|
|
92
|
-
U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
|
|
93
|
-
I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
|
|
94
|
-
wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
|
|
95
|
-
Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
|
|
96
|
-
JQIDAQAB
|
|
97
|
-
-----END PUBLIC KEY-----
|
|
98
|
-
`;
|
|
99
|
-
|
|
100
115
|
// src/octokit.ts
|
|
101
116
|
var import_core = require("@octokit/core");
|
|
102
117
|
var import_plugin_paginate_rest = require("@octokit/plugin-paginate-rest");
|
|
@@ -169,15 +184,7 @@ var inputSchema = import_typebox.Type.Object({
|
|
|
169
184
|
signature: import_typebox.Type.String()
|
|
170
185
|
});
|
|
171
186
|
function createPlugin(handler, manifest, options) {
|
|
172
|
-
const pluginOptions =
|
|
173
|
-
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
|
|
174
|
-
logLevel: options?.logLevel ?? import_ubiquity_os_logger.LOG_LEVEL.INFO,
|
|
175
|
-
postCommentOnError: options?.postCommentOnError ?? true,
|
|
176
|
-
settingsSchema: options?.settingsSchema,
|
|
177
|
-
envSchema: options?.envSchema,
|
|
178
|
-
commandSchema: options?.commandSchema,
|
|
179
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
180
|
-
};
|
|
187
|
+
const pluginOptions = getPluginOptions(options);
|
|
181
188
|
const app = new import_hono.Hono();
|
|
182
189
|
app.get("/manifest.json", (ctx) => {
|
|
183
190
|
return ctx.json(manifest);
|
|
@@ -238,7 +245,7 @@ function createPlugin(handler, manifest, options) {
|
|
|
238
245
|
octokit: new customOctokit({ auth: inputs.authToken }),
|
|
239
246
|
config: config2,
|
|
240
247
|
env,
|
|
241
|
-
logger: new
|
|
248
|
+
logger: new import_ubiquity_os_logger2.Logs(pluginOptions.logLevel)
|
|
242
249
|
};
|
|
243
250
|
try {
|
|
244
251
|
const result = await handler(context2);
|
|
@@ -248,7 +255,7 @@ function createPlugin(handler, manifest, options) {
|
|
|
248
255
|
let loggerError;
|
|
249
256
|
if (error instanceof Error) {
|
|
250
257
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
251
|
-
} else if (error instanceof
|
|
258
|
+
} else if (error instanceof import_ubiquity_os_logger2.LogReturn) {
|
|
252
259
|
loggerError = error;
|
|
253
260
|
} else {
|
|
254
261
|
loggerError = context2.logger.error(`Error: ${error}`);
|
|
@@ -267,23 +274,23 @@ var core = __toESM(require("@actions/core"));
|
|
|
267
274
|
var github = __toESM(require("@actions/github"));
|
|
268
275
|
var import_typebox4 = require("@sinclair/typebox");
|
|
269
276
|
var import_value3 = require("@sinclair/typebox/value");
|
|
270
|
-
var
|
|
277
|
+
var import_ubiquity_os_logger3 = require("@ubiquity-os/ubiquity-os-logger");
|
|
271
278
|
var import_dotenv = require("dotenv");
|
|
272
279
|
|
|
273
|
-
// src/types/
|
|
280
|
+
// src/types/command.ts
|
|
274
281
|
var import_typebox2 = require("@sinclair/typebox");
|
|
282
|
+
var commandCallSchema = import_typebox2.Type.Union([import_typebox2.Type.Null(), import_typebox2.Type.Object({ name: import_typebox2.Type.String(), parameters: import_typebox2.Type.Unknown() })]);
|
|
283
|
+
|
|
284
|
+
// src/types/util.ts
|
|
285
|
+
var import_typebox3 = require("@sinclair/typebox");
|
|
275
286
|
var import_value2 = require("@sinclair/typebox/value");
|
|
276
287
|
function jsonType(type) {
|
|
277
|
-
return
|
|
288
|
+
return import_typebox3.Type.Transform(import_typebox3.Type.String()).Decode((value) => {
|
|
278
289
|
const parsed = JSON.parse(value);
|
|
279
290
|
return import_value2.Value.Decode(type, import_value2.Value.Default(type, parsed));
|
|
280
291
|
}).Encode((value) => JSON.stringify(value));
|
|
281
292
|
}
|
|
282
293
|
|
|
283
|
-
// src/types/command.ts
|
|
284
|
-
var import_typebox3 = require("@sinclair/typebox");
|
|
285
|
-
var commandCallSchema = import_typebox3.Type.Union([import_typebox3.Type.Null(), import_typebox3.Type.Object({ name: import_typebox3.Type.String(), parameters: import_typebox3.Type.Unknown() })]);
|
|
286
|
-
|
|
287
294
|
// src/actions.ts
|
|
288
295
|
(0, import_dotenv.config)();
|
|
289
296
|
var inputSchema2 = import_typebox4.Type.Object({
|
|
@@ -297,15 +304,7 @@ var inputSchema2 = import_typebox4.Type.Object({
|
|
|
297
304
|
signature: import_typebox4.Type.String()
|
|
298
305
|
});
|
|
299
306
|
async function createActionsPlugin(handler, options) {
|
|
300
|
-
const pluginOptions =
|
|
301
|
-
logLevel: options?.logLevel ?? import_ubiquity_os_logger2.LOG_LEVEL.INFO,
|
|
302
|
-
postCommentOnError: options?.postCommentOnError ?? true,
|
|
303
|
-
settingsSchema: options?.settingsSchema,
|
|
304
|
-
envSchema: options?.envSchema,
|
|
305
|
-
commandSchema: options?.commandSchema,
|
|
306
|
-
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
|
|
307
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
308
|
-
};
|
|
307
|
+
const pluginOptions = getPluginOptions(options);
|
|
309
308
|
const pluginGithubToken = process.env.PLUGIN_GITHUB_TOKEN;
|
|
310
309
|
if (!pluginGithubToken) {
|
|
311
310
|
core.setFailed("Error: PLUGIN_GITHUB_TOKEN env is not set");
|
|
@@ -365,7 +364,7 @@ async function createActionsPlugin(handler, options) {
|
|
|
365
364
|
octokit: new customOctokit({ auth: inputs.authToken }),
|
|
366
365
|
config: config2,
|
|
367
366
|
env,
|
|
368
|
-
logger: new
|
|
367
|
+
logger: new import_ubiquity_os_logger3.Logs(pluginOptions.logLevel)
|
|
369
368
|
};
|
|
370
369
|
try {
|
|
371
370
|
const result = await handler(context2);
|
|
@@ -377,7 +376,7 @@ async function createActionsPlugin(handler, options) {
|
|
|
377
376
|
if (error instanceof Error) {
|
|
378
377
|
core.setFailed(error);
|
|
379
378
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
380
|
-
} else if (error instanceof
|
|
379
|
+
} else if (error instanceof import_ubiquity_os_logger3.LogReturn) {
|
|
381
380
|
core.setFailed(error.logMessage.raw);
|
|
382
381
|
loggerError = error;
|
|
383
382
|
} else {
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
// src/server.ts
|
|
2
2
|
import { Type as T } from "@sinclair/typebox";
|
|
3
3
|
import { Value } from "@sinclair/typebox/value";
|
|
4
|
-
import {
|
|
4
|
+
import { LogReturn as LogReturn2, Logs } from "@ubiquity-os/ubiquity-os-logger";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
import { env as honoEnv } from "hono/adapter";
|
|
7
7
|
import { HTTPException } from "hono/http-exception";
|
|
8
8
|
|
|
9
|
+
// src/util.ts
|
|
10
|
+
import { LOG_LEVEL } from "@ubiquity-os/ubiquity-os-logger";
|
|
11
|
+
|
|
12
|
+
// src/constants.ts
|
|
13
|
+
var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
14
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
|
|
15
|
+
uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
|
|
16
|
+
U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
|
|
17
|
+
I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
|
|
18
|
+
wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
|
|
19
|
+
Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
|
|
20
|
+
JQIDAQAB
|
|
21
|
+
-----END PUBLIC KEY-----
|
|
22
|
+
`;
|
|
23
|
+
|
|
9
24
|
// src/util.ts
|
|
10
25
|
function sanitizeMetadata(obj) {
|
|
11
26
|
return JSON.stringify(obj, null, 2).replace(/</g, "<").replace(/>/g, ">").replace(/--/g, "--");
|
|
12
27
|
}
|
|
28
|
+
function getPluginOptions(options) {
|
|
29
|
+
return {
|
|
30
|
+
// Important to use || and not ?? to not consider empty strings
|
|
31
|
+
kernelPublicKey: options?.kernelPublicKey || KERNEL_PUBLIC_KEY,
|
|
32
|
+
logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
|
|
33
|
+
postCommentOnError: options?.postCommentOnError ?? true,
|
|
34
|
+
settingsSchema: options?.settingsSchema,
|
|
35
|
+
envSchema: options?.envSchema,
|
|
36
|
+
commandSchema: options?.commandSchema,
|
|
37
|
+
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
13
40
|
|
|
14
41
|
// src/comment.ts
|
|
15
42
|
var HEADER_NAME = "Ubiquity";
|
|
@@ -47,18 +74,6 @@ ${metadataSerialized}
|
|
|
47
74
|
`;
|
|
48
75
|
}
|
|
49
76
|
|
|
50
|
-
// src/constants.ts
|
|
51
|
-
var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
52
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
|
|
53
|
-
uBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7
|
|
54
|
-
U3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+
|
|
55
|
-
I0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf
|
|
56
|
-
wShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/
|
|
57
|
-
Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
|
|
58
|
-
JQIDAQAB
|
|
59
|
-
-----END PUBLIC KEY-----
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
77
|
// src/octokit.ts
|
|
63
78
|
import { Octokit } from "@octokit/core";
|
|
64
79
|
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
|
@@ -131,15 +146,7 @@ var inputSchema = T.Object({
|
|
|
131
146
|
signature: T.String()
|
|
132
147
|
});
|
|
133
148
|
function createPlugin(handler, manifest, options) {
|
|
134
|
-
const pluginOptions =
|
|
135
|
-
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
|
|
136
|
-
logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
|
|
137
|
-
postCommentOnError: options?.postCommentOnError ?? true,
|
|
138
|
-
settingsSchema: options?.settingsSchema,
|
|
139
|
-
envSchema: options?.envSchema,
|
|
140
|
-
commandSchema: options?.commandSchema,
|
|
141
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
142
|
-
};
|
|
149
|
+
const pluginOptions = getPluginOptions(options);
|
|
143
150
|
const app = new Hono();
|
|
144
151
|
app.get("/manifest.json", (ctx) => {
|
|
145
152
|
return ctx.json(manifest);
|
|
@@ -210,7 +217,7 @@ function createPlugin(handler, manifest, options) {
|
|
|
210
217
|
let loggerError;
|
|
211
218
|
if (error instanceof Error) {
|
|
212
219
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
213
|
-
} else if (error instanceof
|
|
220
|
+
} else if (error instanceof LogReturn2) {
|
|
214
221
|
loggerError = error;
|
|
215
222
|
} else {
|
|
216
223
|
loggerError = context2.logger.error(`Error: ${error}`);
|
|
@@ -229,9 +236,13 @@ import * as core from "@actions/core";
|
|
|
229
236
|
import * as github from "@actions/github";
|
|
230
237
|
import { Type as T3 } from "@sinclair/typebox";
|
|
231
238
|
import { Value as Value3 } from "@sinclair/typebox/value";
|
|
232
|
-
import {
|
|
239
|
+
import { LogReturn as LogReturn3, Logs as Logs2 } from "@ubiquity-os/ubiquity-os-logger";
|
|
233
240
|
import { config } from "dotenv";
|
|
234
241
|
|
|
242
|
+
// src/types/command.ts
|
|
243
|
+
import { Type as T2 } from "@sinclair/typebox";
|
|
244
|
+
var commandCallSchema = T2.Union([T2.Null(), T2.Object({ name: T2.String(), parameters: T2.Unknown() })]);
|
|
245
|
+
|
|
235
246
|
// src/types/util.ts
|
|
236
247
|
import { Type } from "@sinclair/typebox";
|
|
237
248
|
import { Value as Value2 } from "@sinclair/typebox/value";
|
|
@@ -242,10 +253,6 @@ function jsonType(type) {
|
|
|
242
253
|
}).Encode((value) => JSON.stringify(value));
|
|
243
254
|
}
|
|
244
255
|
|
|
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
256
|
// src/actions.ts
|
|
250
257
|
config();
|
|
251
258
|
var inputSchema2 = T3.Object({
|
|
@@ -259,15 +266,7 @@ var inputSchema2 = T3.Object({
|
|
|
259
266
|
signature: T3.String()
|
|
260
267
|
});
|
|
261
268
|
async function createActionsPlugin(handler, options) {
|
|
262
|
-
const pluginOptions =
|
|
263
|
-
logLevel: options?.logLevel ?? LOG_LEVEL2.INFO,
|
|
264
|
-
postCommentOnError: options?.postCommentOnError ?? true,
|
|
265
|
-
settingsSchema: options?.settingsSchema,
|
|
266
|
-
envSchema: options?.envSchema,
|
|
267
|
-
commandSchema: options?.commandSchema,
|
|
268
|
-
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
|
|
269
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
270
|
-
};
|
|
269
|
+
const pluginOptions = getPluginOptions(options);
|
|
271
270
|
const pluginGithubToken = process.env.PLUGIN_GITHUB_TOKEN;
|
|
272
271
|
if (!pluginGithubToken) {
|
|
273
272
|
core.setFailed("Error: PLUGIN_GITHUB_TOKEN env is not set");
|
|
@@ -339,7 +338,7 @@ async function createActionsPlugin(handler, options) {
|
|
|
339
338
|
if (error instanceof Error) {
|
|
340
339
|
core.setFailed(error);
|
|
341
340
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
342
|
-
} else if (error instanceof
|
|
341
|
+
} else if (error instanceof LogReturn3) {
|
|
343
342
|
core.setFailed(error.logMessage.raw);
|
|
344
343
|
loggerError = error;
|
|
345
344
|
} else {
|