@ubiquity-os/plugin-sdk 1.0.7 → 1.0.8
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 -8
- package/dist/index.d.ts +5 -8
- package/dist/index.js +10 -3
- package/dist/index.mjs +9 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,21 +6,18 @@ import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
|
6
6
|
import { Hono } from 'hono';
|
|
7
7
|
import * as _octokit_core_dist_types_types from '@octokit/core/dist-types/types';
|
|
8
8
|
import * as _octokit_plugin_paginate_graphql from '@octokit/plugin-paginate-graphql';
|
|
9
|
-
import * as _octokit_request_error from '@octokit/request-error';
|
|
10
|
-
import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
|
|
11
9
|
import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-endpoint-methods';
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
10
|
+
import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
|
|
11
|
+
import * as _octokit_request_error from '@octokit/request-error';
|
|
12
|
+
import { Octokit } from '@octokit/core';
|
|
14
13
|
|
|
15
|
-
declare const customOctokit: typeof
|
|
16
|
-
paginate: _octokit_plugin_paginate_rest.PaginateInterface;
|
|
17
|
-
}) & _octokit_core_dist_types_types.Constructor<_octokit_plugin_rest_endpoint_methods.Api & {
|
|
14
|
+
declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
|
|
18
15
|
retry: {
|
|
19
16
|
retryRequest: (error: _octokit_request_error.RequestError, retries: number, retryAfter: number) => _octokit_request_error.RequestError;
|
|
20
17
|
};
|
|
21
18
|
} & {
|
|
22
19
|
paginate: _octokit_plugin_paginate_rest.PaginateInterface;
|
|
23
|
-
} & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
|
|
20
|
+
} & _octokit_plugin_rest_endpoint_methods.Api & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
|
|
24
21
|
|
|
25
22
|
interface Context<TConfig = unknown, TEnv = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
26
23
|
eventName: TSupportedEvents;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,21 +6,18 @@ import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
|
6
6
|
import { Hono } from 'hono';
|
|
7
7
|
import * as _octokit_core_dist_types_types from '@octokit/core/dist-types/types';
|
|
8
8
|
import * as _octokit_plugin_paginate_graphql from '@octokit/plugin-paginate-graphql';
|
|
9
|
-
import * as _octokit_request_error from '@octokit/request-error';
|
|
10
|
-
import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
|
|
11
9
|
import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-endpoint-methods';
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
10
|
+
import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
|
|
11
|
+
import * as _octokit_request_error from '@octokit/request-error';
|
|
12
|
+
import { Octokit } from '@octokit/core';
|
|
14
13
|
|
|
15
|
-
declare const customOctokit: typeof
|
|
16
|
-
paginate: _octokit_plugin_paginate_rest.PaginateInterface;
|
|
17
|
-
}) & _octokit_core_dist_types_types.Constructor<_octokit_plugin_rest_endpoint_methods.Api & {
|
|
14
|
+
declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
|
|
18
15
|
retry: {
|
|
19
16
|
retryRequest: (error: _octokit_request_error.RequestError, retries: number, retryAfter: number) => _octokit_request_error.RequestError;
|
|
20
17
|
};
|
|
21
18
|
} & {
|
|
22
19
|
paginate: _octokit_plugin_paginate_rest.PaginateInterface;
|
|
23
|
-
} & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
|
|
20
|
+
} & _octokit_plugin_rest_endpoint_methods.Api & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
|
|
24
21
|
|
|
25
22
|
interface Context<TConfig = unknown, TEnv = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
26
23
|
eventName: TSupportedEvents;
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ var KERNEL_APP_ID = 975031;
|
|
|
111
111
|
var BOT_USER_ID = 178941584;
|
|
112
112
|
|
|
113
113
|
// src/octokit.ts
|
|
114
|
-
var
|
|
114
|
+
var import_core = require("@octokit/core");
|
|
115
115
|
var import_plugin_paginate_rest = require("@octokit/plugin-paginate-rest");
|
|
116
116
|
var import_plugin_rest_endpoint_methods = require("@octokit/plugin-rest-endpoint-methods");
|
|
117
117
|
var import_plugin_retry = require("@octokit/plugin-retry");
|
|
@@ -133,7 +133,7 @@ var defaultOptions = {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
var customOctokit =
|
|
136
|
+
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) => {
|
|
137
137
|
return { ...defaultOptions, ...instanceOptions };
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -289,7 +289,14 @@ async function createActionsPlugin(handler, options) {
|
|
|
289
289
|
core.setFailed("Error: PLUGIN_GITHUB_TOKEN env is not set");
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const
|
|
292
|
+
const inputPayload = github.context.payload.inputs;
|
|
293
|
+
const inputSchemaErrors = [...import_value2.Value.Errors(inputSchema2, inputPayload)];
|
|
294
|
+
if (inputSchemaErrors.length) {
|
|
295
|
+
console.dir(inputSchemaErrors, { depth: null });
|
|
296
|
+
core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const inputs = import_value2.Value.Decode(inputSchema2, inputPayload);
|
|
293
300
|
const signature = inputs.signature;
|
|
294
301
|
if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
|
|
295
302
|
core.setFailed(`Error: Invalid signature`);
|
package/dist/index.mjs
CHANGED
|
@@ -67,7 +67,7 @@ var KERNEL_APP_ID = 975031;
|
|
|
67
67
|
var BOT_USER_ID = 178941584;
|
|
68
68
|
|
|
69
69
|
// src/octokit.ts
|
|
70
|
-
import { Octokit } from "@octokit/
|
|
70
|
+
import { Octokit } from "@octokit/core";
|
|
71
71
|
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
|
72
72
|
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
|
|
73
73
|
import { retry } from "@octokit/plugin-retry";
|
|
@@ -245,7 +245,14 @@ async function createActionsPlugin(handler, options) {
|
|
|
245
245
|
core.setFailed("Error: PLUGIN_GITHUB_TOKEN env is not set");
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const inputPayload = github.context.payload.inputs;
|
|
249
|
+
const inputSchemaErrors = [...Value2.Errors(inputSchema2, inputPayload)];
|
|
250
|
+
if (inputSchemaErrors.length) {
|
|
251
|
+
console.dir(inputSchemaErrors, { depth: null });
|
|
252
|
+
core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const inputs = Value2.Decode(inputSchema2, inputPayload);
|
|
249
256
|
const signature = inputs.signature;
|
|
250
257
|
if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
|
|
251
258
|
core.setFailed(`Error: Invalid signature`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubiquity-os/plugin-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "SDK for plugin support.",
|
|
5
5
|
"author": "Ubiquity DAO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@octokit/rest": "^21.0.2",
|
|
51
51
|
"@octokit/types": "^13.6.1",
|
|
52
52
|
"@octokit/webhooks": "^13.3.0",
|
|
53
|
-
"@sinclair/typebox": "^0.33.
|
|
53
|
+
"@sinclair/typebox": "^0.33.21",
|
|
54
54
|
"@ubiquity-os/ubiquity-os-logger": "^1.3.2",
|
|
55
55
|
"dotenv": "^16.4.5",
|
|
56
56
|
"hono": "^4.6.9"
|