sello 0.1.5 → 0.1.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/dist/cli/sello.js +35 -5
- package/package.json +1 -1
- package/src/cli/sello.ts +35 -5
package/dist/cli/sello.js
CHANGED
|
@@ -246,11 +246,14 @@ function initDemoCommand(args ) {
|
|
|
246
246
|
|
|
247
247
|
console.log(`Created ${output}`);
|
|
248
248
|
console.log("");
|
|
249
|
-
console.log("
|
|
250
|
-
console.log(" npm install sello");
|
|
249
|
+
console.log("Terminal 1: keep the local dev log running");
|
|
251
250
|
console.log(" npx sello dev");
|
|
251
|
+
console.log("");
|
|
252
|
+
console.log("Terminal 2: emit and view a receipt");
|
|
252
253
|
console.log(` node ${output}`);
|
|
253
254
|
console.log(" npx sello actions");
|
|
255
|
+
console.log("");
|
|
256
|
+
console.log("Then open http://localhost:8787/actions");
|
|
254
257
|
}
|
|
255
258
|
|
|
256
259
|
function keysCommand(args ) {
|
|
@@ -517,6 +520,8 @@ function actionsViewModel(result )
|
|
|
517
520
|
|
|
518
521
|
function renderActionsHtml(result ) {
|
|
519
522
|
const view = actionsViewModel(result);
|
|
523
|
+
const actionCount = view.receipts.length;
|
|
524
|
+
const rejectedCount = view.rejected.length;
|
|
520
525
|
const rows = view.receipts.map((record) => `
|
|
521
526
|
<tr>
|
|
522
527
|
<td>${escapeHtml(record.integratedTime)}</td>
|
|
@@ -533,23 +538,48 @@ function renderActionsHtml(result ) {
|
|
|
533
538
|
<head>
|
|
534
539
|
<meta charset="utf-8">
|
|
535
540
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
541
|
+
<meta http-equiv="refresh" content="2">
|
|
536
542
|
<title>Sello Actions</title>
|
|
537
543
|
<style>
|
|
538
544
|
body { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: 40px; color: #17201d; }
|
|
545
|
+
header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
|
|
546
|
+
h1 { margin: 0; font-size: 40px; line-height: 1.1; }
|
|
547
|
+
h2 { margin: 32px 0 8px; font-size: 20px; }
|
|
548
|
+
code { background: #eef3f0; border-radius: 4px; padding: 2px 6px; }
|
|
539
549
|
table { border-collapse: collapse; width: 100%; margin-top: 16px; }
|
|
540
550
|
th, td { border-bottom: 1px solid #d8dfdc; padding: 10px 8px; text-align: left; }
|
|
541
551
|
th { color: #52615b; font-weight: 600; }
|
|
552
|
+
.summary { color: #52615b; font-size: 15px; margin: 0; white-space: nowrap; }
|
|
542
553
|
.empty { color: #52615b; margin-top: 16px; }
|
|
554
|
+
.empty p { margin: 8px 0; }
|
|
555
|
+
@media (max-width: 720px) {
|
|
556
|
+
body { margin: 24px; }
|
|
557
|
+
header { display: block; }
|
|
558
|
+
h1 { font-size: 32px; }
|
|
559
|
+
.summary { margin-top: 8px; white-space: normal; }
|
|
560
|
+
table { display: block; overflow-x: auto; }
|
|
561
|
+
}
|
|
543
562
|
</style>
|
|
544
563
|
</head>
|
|
545
564
|
<body>
|
|
546
|
-
<
|
|
547
|
-
|
|
548
|
-
|
|
565
|
+
<header>
|
|
566
|
+
<h1>Sello Actions</h1>
|
|
567
|
+
<p class="summary">${escapeHtml(actionCountLabel(actionCount))}</p>
|
|
568
|
+
</header>
|
|
569
|
+
${rows ? `<table><thead><tr><th>Integrated time</th><th>Service</th><th>Action</th><th>Result</th><th>Status</th></tr></thead><tbody>${rows}</tbody></table>` : `<section class="empty"><p>No verified actions yet.</p><p>In another terminal, run <code>npx sello emit-demo</code>.</p></section>`}
|
|
570
|
+
${rejected ? `<h2>Rejected receipts</h2><p class="summary">${escapeHtml(rejectedCountLabel(rejectedCount))}</p><ul>${rejected}</ul>` : ""}
|
|
549
571
|
</body>
|
|
550
572
|
</html>`;
|
|
551
573
|
}
|
|
552
574
|
|
|
575
|
+
function actionCountLabel(count ) {
|
|
576
|
+
return count === 1 ? "1 verified action" : `${count} verified actions`;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function rejectedCountLabel(count ) {
|
|
580
|
+
return count === 1 ? "1 rejected receipt" : `${count} rejected receipts`;
|
|
581
|
+
}
|
|
582
|
+
|
|
553
583
|
function verifyHttpProof(entry ) {
|
|
554
584
|
if (!isRecord(entry.proof)) {
|
|
555
585
|
return false;
|
package/package.json
CHANGED
package/src/cli/sello.ts
CHANGED
|
@@ -247,11 +247,14 @@ function initDemoCommand(args: string[]): void {
|
|
|
247
247
|
|
|
248
248
|
console.log(`Created ${output}`);
|
|
249
249
|
console.log("");
|
|
250
|
-
console.log("
|
|
251
|
-
console.log(" npm install sello");
|
|
250
|
+
console.log("Terminal 1: keep the local dev log running");
|
|
252
251
|
console.log(" npx sello dev");
|
|
252
|
+
console.log("");
|
|
253
|
+
console.log("Terminal 2: emit and view a receipt");
|
|
253
254
|
console.log(` node ${output}`);
|
|
254
255
|
console.log(" npx sello actions");
|
|
256
|
+
console.log("");
|
|
257
|
+
console.log("Then open http://localhost:8787/actions");
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
function keysCommand(args: string[]): void {
|
|
@@ -518,6 +521,8 @@ function actionsViewModel(result: ReturnType<typeof verifyReceipts>): ActionsVie
|
|
|
518
521
|
|
|
519
522
|
function renderActionsHtml(result: ReturnType<typeof verifyReceipts>): string {
|
|
520
523
|
const view = actionsViewModel(result);
|
|
524
|
+
const actionCount = view.receipts.length;
|
|
525
|
+
const rejectedCount = view.rejected.length;
|
|
521
526
|
const rows = view.receipts.map((record) => `
|
|
522
527
|
<tr>
|
|
523
528
|
<td>${escapeHtml(record.integratedTime)}</td>
|
|
@@ -534,23 +539,48 @@ function renderActionsHtml(result: ReturnType<typeof verifyReceipts>): string {
|
|
|
534
539
|
<head>
|
|
535
540
|
<meta charset="utf-8">
|
|
536
541
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
542
|
+
<meta http-equiv="refresh" content="2">
|
|
537
543
|
<title>Sello Actions</title>
|
|
538
544
|
<style>
|
|
539
545
|
body { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: 40px; color: #17201d; }
|
|
546
|
+
header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
|
|
547
|
+
h1 { margin: 0; font-size: 40px; line-height: 1.1; }
|
|
548
|
+
h2 { margin: 32px 0 8px; font-size: 20px; }
|
|
549
|
+
code { background: #eef3f0; border-radius: 4px; padding: 2px 6px; }
|
|
540
550
|
table { border-collapse: collapse; width: 100%; margin-top: 16px; }
|
|
541
551
|
th, td { border-bottom: 1px solid #d8dfdc; padding: 10px 8px; text-align: left; }
|
|
542
552
|
th { color: #52615b; font-weight: 600; }
|
|
553
|
+
.summary { color: #52615b; font-size: 15px; margin: 0; white-space: nowrap; }
|
|
543
554
|
.empty { color: #52615b; margin-top: 16px; }
|
|
555
|
+
.empty p { margin: 8px 0; }
|
|
556
|
+
@media (max-width: 720px) {
|
|
557
|
+
body { margin: 24px; }
|
|
558
|
+
header { display: block; }
|
|
559
|
+
h1 { font-size: 32px; }
|
|
560
|
+
.summary { margin-top: 8px; white-space: normal; }
|
|
561
|
+
table { display: block; overflow-x: auto; }
|
|
562
|
+
}
|
|
544
563
|
</style>
|
|
545
564
|
</head>
|
|
546
565
|
<body>
|
|
547
|
-
<
|
|
548
|
-
|
|
549
|
-
|
|
566
|
+
<header>
|
|
567
|
+
<h1>Sello Actions</h1>
|
|
568
|
+
<p class="summary">${escapeHtml(actionCountLabel(actionCount))}</p>
|
|
569
|
+
</header>
|
|
570
|
+
${rows ? `<table><thead><tr><th>Integrated time</th><th>Service</th><th>Action</th><th>Result</th><th>Status</th></tr></thead><tbody>${rows}</tbody></table>` : `<section class="empty"><p>No verified actions yet.</p><p>In another terminal, run <code>npx sello emit-demo</code>.</p></section>`}
|
|
571
|
+
${rejected ? `<h2>Rejected receipts</h2><p class="summary">${escapeHtml(rejectedCountLabel(rejectedCount))}</p><ul>${rejected}</ul>` : ""}
|
|
550
572
|
</body>
|
|
551
573
|
</html>`;
|
|
552
574
|
}
|
|
553
575
|
|
|
576
|
+
function actionCountLabel(count: number): string {
|
|
577
|
+
return count === 1 ? "1 verified action" : `${count} verified actions`;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function rejectedCountLabel(count: number): string {
|
|
581
|
+
return count === 1 ? "1 rejected receipt" : `${count} rejected receipts`;
|
|
582
|
+
}
|
|
583
|
+
|
|
554
584
|
function verifyHttpProof(entry: ReturnType<typeof deserializeEntry>): boolean {
|
|
555
585
|
if (!isRecord(entry.proof)) {
|
|
556
586
|
return false;
|