@ubiquity-os/plugin-sdk 3.2.2 → 3.3.4
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/dist/signature.js +11 -1
- package/dist/signature.mjs +9 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -127,6 +127,7 @@ interface Options$1 {
|
|
|
127
127
|
* @deprecated This disables signature verification - only for local development
|
|
128
128
|
*/
|
|
129
129
|
bypassSignatureVerification?: boolean;
|
|
130
|
+
returnDataToKernel?: boolean;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, options?: Options$1): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,7 @@ interface Options$1 {
|
|
|
127
127
|
* @deprecated This disables signature verification - only for local development
|
|
128
128
|
*/
|
|
129
129
|
bypassSignatureVerification?: boolean;
|
|
130
|
+
returnDataToKernel?: boolean;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, options?: Options$1): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,11 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
|
|
|
62
62
|
_PluginRuntimeInfo._instance = new CfRuntimeInfo(env);
|
|
63
63
|
break;
|
|
64
64
|
case "deno":
|
|
65
|
-
|
|
65
|
+
if (process.env.CI) {
|
|
66
|
+
_PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
|
|
67
|
+
} else {
|
|
68
|
+
_PluginRuntimeInfo._instance = new DenoRuntimeInfo(env);
|
|
69
|
+
}
|
|
66
70
|
break;
|
|
67
71
|
case "node":
|
|
68
72
|
_PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
|
|
@@ -162,7 +166,8 @@ function getPluginOptions(options) {
|
|
|
162
166
|
envSchema: options?.envSchema,
|
|
163
167
|
commandSchema: options?.commandSchema,
|
|
164
168
|
// eslint-disable-next-line sonarjs/deprecation
|
|
165
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
169
|
+
bypassSignatureVerification: options?.bypassSignatureVerification || false,
|
|
170
|
+
returnDataToKernel: options?.returnDataToKernel ?? true
|
|
166
171
|
};
|
|
167
172
|
}
|
|
168
173
|
|
|
@@ -528,7 +533,9 @@ async function createActionsPlugin(handler, options) {
|
|
|
528
533
|
try {
|
|
529
534
|
const result = await handler(context2);
|
|
530
535
|
core.setOutput("result", result);
|
|
531
|
-
|
|
536
|
+
if (pluginOptions?.returnDataToKernel) {
|
|
537
|
+
await returnDataToKernel(pluginGithubToken, inputs.stateId, result);
|
|
538
|
+
}
|
|
532
539
|
} catch (error) {
|
|
533
540
|
await handleError(context2, pluginOptions, error);
|
|
534
541
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,11 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
|
|
|
23
23
|
_PluginRuntimeInfo._instance = new CfRuntimeInfo(env);
|
|
24
24
|
break;
|
|
25
25
|
case "deno":
|
|
26
|
-
|
|
26
|
+
if (process.env.CI) {
|
|
27
|
+
_PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
|
|
28
|
+
} else {
|
|
29
|
+
_PluginRuntimeInfo._instance = new DenoRuntimeInfo(env);
|
|
30
|
+
}
|
|
27
31
|
break;
|
|
28
32
|
case "node":
|
|
29
33
|
_PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
|
|
@@ -123,7 +127,8 @@ function getPluginOptions(options) {
|
|
|
123
127
|
envSchema: options?.envSchema,
|
|
124
128
|
commandSchema: options?.commandSchema,
|
|
125
129
|
// eslint-disable-next-line sonarjs/deprecation
|
|
126
|
-
bypassSignatureVerification: options?.bypassSignatureVerification || false
|
|
130
|
+
bypassSignatureVerification: options?.bypassSignatureVerification || false,
|
|
131
|
+
returnDataToKernel: options?.returnDataToKernel ?? true
|
|
127
132
|
};
|
|
128
133
|
}
|
|
129
134
|
|
|
@@ -489,7 +494,9 @@ async function createActionsPlugin(handler, options) {
|
|
|
489
494
|
try {
|
|
490
495
|
const result = await handler(context2);
|
|
491
496
|
core.setOutput("result", result);
|
|
492
|
-
|
|
497
|
+
if (pluginOptions?.returnDataToKernel) {
|
|
498
|
+
await returnDataToKernel(pluginGithubToken, inputs.stateId, result);
|
|
499
|
+
}
|
|
493
500
|
} catch (error) {
|
|
494
501
|
await handleError(context2, pluginOptions, error);
|
|
495
502
|
}
|
package/dist/signature.js
CHANGED
|
@@ -25,6 +25,16 @@ __export(signature_exports, {
|
|
|
25
25
|
verifySignature: () => verifySignature
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(signature_exports);
|
|
28
|
+
|
|
29
|
+
// src/helpers/compression.ts
|
|
30
|
+
var import_node_zlib = require("zlib");
|
|
31
|
+
function compressString(str) {
|
|
32
|
+
const input = Buffer.from(str, "utf8");
|
|
33
|
+
const compressed = (0, import_node_zlib.brotliCompressSync)(input);
|
|
34
|
+
return Buffer.from(compressed).toString("base64");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/signature.ts
|
|
28
38
|
var PluginInput = class {
|
|
29
39
|
_privateKey;
|
|
30
40
|
stateId;
|
|
@@ -48,7 +58,7 @@ var PluginInput = class {
|
|
|
48
58
|
const inputs = {
|
|
49
59
|
stateId: this.stateId,
|
|
50
60
|
eventName: this.eventName,
|
|
51
|
-
eventPayload: JSON.stringify(this.eventPayload),
|
|
61
|
+
eventPayload: compressString(JSON.stringify(this.eventPayload)),
|
|
52
62
|
settings: JSON.stringify(this.settings),
|
|
53
63
|
authToken: this.authToken,
|
|
54
64
|
ref: this.ref,
|
package/dist/signature.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
// src/helpers/compression.ts
|
|
2
|
+
import { brotliCompressSync, brotliDecompressSync } from "node:zlib";
|
|
3
|
+
function compressString(str) {
|
|
4
|
+
const input = Buffer.from(str, "utf8");
|
|
5
|
+
const compressed = brotliCompressSync(input);
|
|
6
|
+
return Buffer.from(compressed).toString("base64");
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
// src/signature.ts
|
|
2
10
|
var PluginInput = class {
|
|
3
11
|
_privateKey;
|
|
@@ -22,7 +30,7 @@ var PluginInput = class {
|
|
|
22
30
|
const inputs = {
|
|
23
31
|
stateId: this.stateId,
|
|
24
32
|
eventName: this.eventName,
|
|
25
|
-
eventPayload: JSON.stringify(this.eventPayload),
|
|
33
|
+
eventPayload: compressString(JSON.stringify(this.eventPayload)),
|
|
26
34
|
settings: JSON.stringify(this.settings),
|
|
27
35
|
authToken: this.authToken,
|
|
28
36
|
ref: this.ref,
|