@ubiquity-os/plugin-sdk 3.2.0 → 3.2.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.js +8 -3
- package/dist/index.mjs +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -360,6 +360,11 @@ function compressString(str) {
|
|
|
360
360
|
const compressed = (0, import_brotli.compress)(input);
|
|
361
361
|
return Buffer.from(compressed).toString("base64");
|
|
362
362
|
}
|
|
363
|
+
function decompressString(compressed) {
|
|
364
|
+
const buffer = Buffer.from(compressed, "base64");
|
|
365
|
+
const decompressed = (0, import_brotli.decompress)(buffer);
|
|
366
|
+
return Buffer.from(decompressed).toString("utf8");
|
|
367
|
+
}
|
|
363
368
|
|
|
364
369
|
// src/octokit.ts
|
|
365
370
|
var import_core = require("@octokit/core");
|
|
@@ -431,9 +436,9 @@ var commandCallSchema = import_typebox.Type.Union([import_typebox.Type.Null(), i
|
|
|
431
436
|
// src/types/util.ts
|
|
432
437
|
var import_typebox2 = require("@sinclair/typebox");
|
|
433
438
|
var import_value2 = require("@sinclair/typebox/value");
|
|
434
|
-
function jsonType(type) {
|
|
439
|
+
function jsonType(type, decompress2 = false) {
|
|
435
440
|
return import_typebox2.Type.Transform(import_typebox2.Type.String()).Decode((value) => {
|
|
436
|
-
const parsed = JSON.parse(value);
|
|
441
|
+
const parsed = JSON.parse(decompress2 ? decompressString(value) : value);
|
|
437
442
|
return import_value2.Value.Decode(type, import_value2.Value.Default(type, parsed));
|
|
438
443
|
}).Encode((value) => JSON.stringify(value));
|
|
439
444
|
}
|
|
@@ -442,7 +447,7 @@ function jsonType(type) {
|
|
|
442
447
|
var inputSchema = import_typebox3.Type.Object({
|
|
443
448
|
stateId: import_typebox3.Type.String(),
|
|
444
449
|
eventName: import_typebox3.Type.String(),
|
|
445
|
-
eventPayload: jsonType(import_typebox3.Type.Record(import_typebox3.Type.String(), import_typebox3.Type.Any())),
|
|
450
|
+
eventPayload: jsonType(import_typebox3.Type.Record(import_typebox3.Type.String(), import_typebox3.Type.Any()), true),
|
|
446
451
|
command: jsonType(commandCallSchema),
|
|
447
452
|
authToken: import_typebox3.Type.String(),
|
|
448
453
|
settings: jsonType(import_typebox3.Type.Record(import_typebox3.Type.String(), import_typebox3.Type.Any())),
|
package/dist/index.mjs
CHANGED
|
@@ -322,6 +322,11 @@ function compressString(str) {
|
|
|
322
322
|
const compressed = compress(input);
|
|
323
323
|
return Buffer.from(compressed).toString("base64");
|
|
324
324
|
}
|
|
325
|
+
function decompressString(compressed) {
|
|
326
|
+
const buffer = Buffer.from(compressed, "base64");
|
|
327
|
+
const decompressed = decompress(buffer);
|
|
328
|
+
return Buffer.from(decompressed).toString("utf8");
|
|
329
|
+
}
|
|
325
330
|
|
|
326
331
|
// src/octokit.ts
|
|
327
332
|
import { Octokit } from "@octokit/core";
|
|
@@ -393,9 +398,9 @@ var commandCallSchema = T.Union([T.Null(), T.Object({ name: T.String(), paramete
|
|
|
393
398
|
// src/types/util.ts
|
|
394
399
|
import { Type } from "@sinclair/typebox";
|
|
395
400
|
import { Value as Value2 } from "@sinclair/typebox/value";
|
|
396
|
-
function jsonType(type) {
|
|
401
|
+
function jsonType(type, decompress2 = false) {
|
|
397
402
|
return Type.Transform(Type.String()).Decode((value) => {
|
|
398
|
-
const parsed = JSON.parse(value);
|
|
403
|
+
const parsed = JSON.parse(decompress2 ? decompressString(value) : value);
|
|
399
404
|
return Value2.Decode(type, Value2.Default(type, parsed));
|
|
400
405
|
}).Encode((value) => JSON.stringify(value));
|
|
401
406
|
}
|
|
@@ -404,7 +409,7 @@ function jsonType(type) {
|
|
|
404
409
|
var inputSchema = T2.Object({
|
|
405
410
|
stateId: T2.String(),
|
|
406
411
|
eventName: T2.String(),
|
|
407
|
-
eventPayload: jsonType(T2.Record(T2.String(), T2.Any())),
|
|
412
|
+
eventPayload: jsonType(T2.Record(T2.String(), T2.Any()), true),
|
|
408
413
|
command: jsonType(commandCallSchema),
|
|
409
414
|
authToken: T2.String(),
|
|
410
415
|
settings: jsonType(T2.Record(T2.String(), T2.Any())),
|