openmates 0.11.0-alpha.26 → 0.11.0-alpha.27
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/{chunk-6U4SYUEB.js → chunk-TAH6ZMGO.js} +128 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
|
@@ -6323,6 +6323,7 @@ function prepareUrlEmbeds(message) {
|
|
|
6323
6323
|
}
|
|
6324
6324
|
|
|
6325
6325
|
// src/embedRenderers.ts
|
|
6326
|
+
import qrcode2 from "qrcode-terminal";
|
|
6326
6327
|
var str = (v) => typeof v === "string" && v.length > 0 ? v : null;
|
|
6327
6328
|
var DIRECT_TYPES = /* @__PURE__ */ new Set([
|
|
6328
6329
|
"code",
|
|
@@ -6490,6 +6491,9 @@ async function renderEmbedPreview(embed, client) {
|
|
|
6490
6491
|
case "videos/get_transcript":
|
|
6491
6492
|
renderVideoTranscriptPreview(c, ln);
|
|
6492
6493
|
break;
|
|
6494
|
+
case "videos/create":
|
|
6495
|
+
await renderRemotionCreatePreview(embed, c, ln, client);
|
|
6496
|
+
break;
|
|
6493
6497
|
case "health/search_appointments":
|
|
6494
6498
|
await renderHealthSearchPreview(c, ln, client);
|
|
6495
6499
|
break;
|
|
@@ -6598,6 +6602,9 @@ async function renderEmbedFullscreen(embed, client) {
|
|
|
6598
6602
|
case "videos/get_transcript":
|
|
6599
6603
|
renderVideoTranscriptFullscreen(c);
|
|
6600
6604
|
break;
|
|
6605
|
+
case "videos/create":
|
|
6606
|
+
await renderRemotionCreateFullscreen(embed, c, client);
|
|
6607
|
+
break;
|
|
6601
6608
|
case "health/search_appointments":
|
|
6602
6609
|
await renderHealthSearchFullscreen(c, client);
|
|
6603
6610
|
break;
|
|
@@ -6706,6 +6713,127 @@ async function renderVideosSearchFullscreen(c, client) {
|
|
|
6706
6713
|
console.log();
|
|
6707
6714
|
}
|
|
6708
6715
|
}
|
|
6716
|
+
async function renderRemotionCreatePreview(embed, c, ln, client) {
|
|
6717
|
+
const meta = remotionMeta(c);
|
|
6718
|
+
ln(`\x1B[1m${meta.filename}\x1B[0m`);
|
|
6719
|
+
ln(`${meta.statusText} \x1B[2mv${meta.sourceVersion} \xB7 ${meta.durationSeconds}s \xB7 ${meta.width}x${meta.height}\x1B[0m`);
|
|
6720
|
+
if (meta.layers.length > 0) {
|
|
6721
|
+
ln(`Timeline: ${meta.layers.slice(0, 4).join(" \u2192 ")}`);
|
|
6722
|
+
}
|
|
6723
|
+
if (meta.error) {
|
|
6724
|
+
ln(`\x1B[31m${meta.error}\x1B[0m`);
|
|
6725
|
+
}
|
|
6726
|
+
if (meta.status === "finished") {
|
|
6727
|
+
await renderRemotionShareLink(embed.embedId, client, ln);
|
|
6728
|
+
}
|
|
6729
|
+
}
|
|
6730
|
+
async function renderRemotionCreateFullscreen(embed, c, client) {
|
|
6731
|
+
const meta = remotionMeta(c);
|
|
6732
|
+
process.stdout.write(`\x1B[1m${meta.filename}\x1B[0m
|
|
6733
|
+
`);
|
|
6734
|
+
process.stdout.write(`${meta.statusText} \x1B[2mv${meta.sourceVersion} \xB7 ${meta.durationSeconds}s \xB7 ${meta.width}x${meta.height}\x1B[0m
|
|
6735
|
+
|
|
6736
|
+
`);
|
|
6737
|
+
if (meta.layers.length > 0) {
|
|
6738
|
+
process.stdout.write("Timeline:\n");
|
|
6739
|
+
for (const layer of meta.layers) {
|
|
6740
|
+
process.stdout.write(` - ${layer}
|
|
6741
|
+
`);
|
|
6742
|
+
}
|
|
6743
|
+
process.stdout.write("\n");
|
|
6744
|
+
}
|
|
6745
|
+
if (meta.source) {
|
|
6746
|
+
process.stdout.write("Source:\n");
|
|
6747
|
+
process.stdout.write("```tsx\n");
|
|
6748
|
+
process.stdout.write(`${meta.source.trim()}
|
|
6749
|
+
`);
|
|
6750
|
+
process.stdout.write("```\n\n");
|
|
6751
|
+
}
|
|
6752
|
+
if (meta.error) {
|
|
6753
|
+
process.stdout.write(`\x1B[31mError:\x1B[0m ${meta.error}
|
|
6754
|
+
|
|
6755
|
+
`);
|
|
6756
|
+
}
|
|
6757
|
+
if (meta.status === "finished") {
|
|
6758
|
+
await renderRemotionShareLink(embed.embedId, client, (line) => process.stdout.write(`${line}
|
|
6759
|
+
`));
|
|
6760
|
+
} else {
|
|
6761
|
+
process.stdout.write("Run again after rendering finishes to get the rendered video link and QR code.\n");
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6764
|
+
async function renderRemotionShareLink(embedId, client, ln) {
|
|
6765
|
+
try {
|
|
6766
|
+
const url = await client.createEmbedShareLink(embedId);
|
|
6767
|
+
ln(`Rendered video link: ${url}`);
|
|
6768
|
+
ln("QR code:");
|
|
6769
|
+
const qr = await generateQr(url);
|
|
6770
|
+
for (const line of qr.split("\n")) {
|
|
6771
|
+
if (line.trim().length > 0) ln(line);
|
|
6772
|
+
}
|
|
6773
|
+
} catch (error) {
|
|
6774
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6775
|
+
ln(`\x1B[2mShare link unavailable: ${message}\x1B[0m`);
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6778
|
+
function generateQr(value) {
|
|
6779
|
+
return new Promise((resolve5) => {
|
|
6780
|
+
qrcode2.generate(value, { small: true }, (qr) => resolve5(qr));
|
|
6781
|
+
});
|
|
6782
|
+
}
|
|
6783
|
+
function remotionMeta(c) {
|
|
6784
|
+
const source = str(c.remotion_source) ?? str(c.source) ?? "";
|
|
6785
|
+
const fps = firstInt(source, /fps\s*[:=]\s*(\d+)/) ?? 30;
|
|
6786
|
+
const frames = firstInt(source, /durationInFrames\s*[:=]\s*(\d+)/) ?? 150;
|
|
6787
|
+
const status = str(c.status) ?? "processing";
|
|
6788
|
+
return {
|
|
6789
|
+
filename: str(c.filename) ?? str(c.title) ?? "Composition.tsx",
|
|
6790
|
+
status,
|
|
6791
|
+
statusText: remotionStatusText(status),
|
|
6792
|
+
source,
|
|
6793
|
+
sourceVersion: numberValue(c.current_source_version ?? c.source_version) ?? 1,
|
|
6794
|
+
durationSeconds: Math.max(1, Math.ceil(frames / Math.max(1, fps))),
|
|
6795
|
+
width: firstInt(source, /width\s*[:=]\s*(\d+)/) ?? 1920,
|
|
6796
|
+
height: firstInt(source, /height\s*[:=]\s*(\d+)/) ?? 1080,
|
|
6797
|
+
layers: remotionLayers(source),
|
|
6798
|
+
error: str(c.error) ?? str(c.error_message)
|
|
6799
|
+
};
|
|
6800
|
+
}
|
|
6801
|
+
function remotionStatusText(status) {
|
|
6802
|
+
switch (status) {
|
|
6803
|
+
case "rendering":
|
|
6804
|
+
return "Rendering video...";
|
|
6805
|
+
case "processing":
|
|
6806
|
+
return "Preparing Remotion source...";
|
|
6807
|
+
case "finished":
|
|
6808
|
+
return "Rendered video ready";
|
|
6809
|
+
case "cancelled":
|
|
6810
|
+
return "Render stopped";
|
|
6811
|
+
case "needs_rerender":
|
|
6812
|
+
return "Needs rerender";
|
|
6813
|
+
case "error":
|
|
6814
|
+
return "Render failed";
|
|
6815
|
+
default:
|
|
6816
|
+
return status;
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6819
|
+
function remotionLayers(source) {
|
|
6820
|
+
const names = [...source.matchAll(/<([A-Z][A-Za-z0-9]*)\b/g)].map((match) => match[1]).filter((name) => name && !["AbsoluteFill", "Sequence", "Img", "Audio", "Video"].includes(name));
|
|
6821
|
+
return Array.from(new Set(names.length > 0 ? names : ["Composition"])).slice(0, 6);
|
|
6822
|
+
}
|
|
6823
|
+
function firstInt(source, regex) {
|
|
6824
|
+
const match = regex.exec(source);
|
|
6825
|
+
if (!match?.[1]) return null;
|
|
6826
|
+
const value = Number.parseInt(match[1], 10);
|
|
6827
|
+
return Number.isFinite(value) ? value : null;
|
|
6828
|
+
}
|
|
6829
|
+
function numberValue(value) {
|
|
6830
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
6831
|
+
if (typeof value === "string" && value.trim()) {
|
|
6832
|
+
const parsed = Number.parseInt(value, 10);
|
|
6833
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
6834
|
+
}
|
|
6835
|
+
return null;
|
|
6836
|
+
}
|
|
6709
6837
|
function renderMapsSearchPreview(c, ln) {
|
|
6710
6838
|
const results = c.results;
|
|
6711
6839
|
if (Array.isArray(results) && results.length > 0) {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmates",
|
|
3
|
-
"version": "0.11.0-alpha.
|
|
3
|
+
"version": "0.11.0-alpha.27",
|
|
4
4
|
"description": "OpenMates CLI and SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"test:unit:e2e-provisioning": "node --test tests/e2e-provisioning.test.ts",
|
|
24
24
|
"test:unit:ws": "node --test --experimental-strip-types tests/ws.test.ts",
|
|
25
25
|
"test:unit:url-embed": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/urlEmbed.test.ts",
|
|
26
|
+
"test:unit:embed-renderers": "node --test --experimental-strip-types tests/embedRenderers.test.ts",
|
|
26
27
|
"test:unit:server": "node --test --experimental-strip-types tests/server.test.ts",
|
|
27
28
|
"test:unit:billing": "node --test tests/billing.test.ts",
|
|
28
29
|
"test:unit:account-delete": "node --test tests/account-delete.test.ts",
|
|
29
30
|
"test:unit:cli": "node --test tests/cli.test.ts",
|
|
30
|
-
"test": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/crypto.test.ts tests/storage.test.ts tests/keychain.test.ts tests/mentions.test.ts tests/outputRedactor.test.ts tests/fileEmbed.test.ts tests/embedCreator.test.ts tests/shareEncryption.test.ts tests/server.test.ts tests/ws.test.ts tests/urlEmbed.test.ts && node --test tests/cli.test.ts tests/billing.test.ts tests/account-delete.test.ts tests/signup.test.ts tests/security-setup.test.ts tests/e2e-provisioning.test.ts"
|
|
31
|
+
"test": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/crypto.test.ts tests/storage.test.ts tests/keychain.test.ts tests/mentions.test.ts tests/outputRedactor.test.ts tests/fileEmbed.test.ts tests/embedCreator.test.ts tests/shareEncryption.test.ts tests/server.test.ts tests/ws.test.ts tests/urlEmbed.test.ts && node --test --experimental-strip-types tests/embedRenderers.test.ts && node --test tests/cli.test.ts tests/billing.test.ts tests/account-delete.test.ts tests/signup.test.ts tests/security-setup.test.ts tests/e2e-provisioning.test.ts"
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"openmates",
|