@mochabug/adaptkit 1.0.0-rc.5 → 1.0.0-rc.7
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/bin/index.js +32 -2
- package/bin/index.js.map +2 -2
- package/bin/publish.d.ts.map +1 -1
- package/package.json +4 -4
package/bin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// <define:__PACKAGE_JSON__>
|
|
4
|
-
var define_PACKAGE_JSON_default = { name: "@mochabug/adaptkit", version: "1.0.0-rc.
|
|
4
|
+
var define_PACKAGE_JSON_default = { name: "@mochabug/adaptkit", version: "1.0.0-rc.7" };
|
|
5
5
|
|
|
6
6
|
// node_modules/@bufbuild/protobuf/dist/esm/is-message.js
|
|
7
7
|
function isMessage(arg, schema) {
|
|
@@ -5417,6 +5417,36 @@ function isPathSafe(filePath) {
|
|
|
5417
5417
|
}
|
|
5418
5418
|
async function sendPlugin(opts) {
|
|
5419
5419
|
const lookup = {};
|
|
5420
|
+
async function createMetadataRequest(filePath) {
|
|
5421
|
+
if (!filePath || lookup[filePath]) {
|
|
5422
|
+
return;
|
|
5423
|
+
}
|
|
5424
|
+
if (!isPathSafe(filePath)) {
|
|
5425
|
+
throw new Error(
|
|
5426
|
+
`The file path is not safe: ${filePath}. It must be contained inside the manifest folder. Invalid manifest`
|
|
5427
|
+
);
|
|
5428
|
+
}
|
|
5429
|
+
if (!fs4.existsSync(filePath)) {
|
|
5430
|
+
throw new Error(
|
|
5431
|
+
`The path does not exists: ${filePath}. Invalid manifest`
|
|
5432
|
+
);
|
|
5433
|
+
}
|
|
5434
|
+
const buffer = fs4.readFileSync(filePath, "utf-8");
|
|
5435
|
+
console.log(buffer);
|
|
5436
|
+
lookup[filePath] = true;
|
|
5437
|
+
return create(UploadPluginRequestSchema, {
|
|
5438
|
+
data: {
|
|
5439
|
+
case: "file",
|
|
5440
|
+
value: {
|
|
5441
|
+
data: toBinary(
|
|
5442
|
+
VertexConfigMetadataSchema,
|
|
5443
|
+
fromJsonString(VertexConfigMetadataSchema, buffer)
|
|
5444
|
+
),
|
|
5445
|
+
name: filePath
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5448
|
+
});
|
|
5449
|
+
}
|
|
5420
5450
|
async function createFileRequest(filePath, imgOpts) {
|
|
5421
5451
|
if (!filePath || lookup[filePath]) {
|
|
5422
5452
|
return;
|
|
@@ -5488,7 +5518,7 @@ async function sendPlugin(opts) {
|
|
|
5488
5518
|
}
|
|
5489
5519
|
for (let vertex of opts.manifest.vertices) {
|
|
5490
5520
|
files.push(createFileRequest(vertex.logo, [40, 40]));
|
|
5491
|
-
files.push(
|
|
5521
|
+
files.push(createMetadataRequest(vertex.metadata));
|
|
5492
5522
|
if (vertex.config) {
|
|
5493
5523
|
files.push(createFileRequest(vertex.config));
|
|
5494
5524
|
}
|