capns 0.33.9334 → 0.34.9370

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.
Files changed (2) hide show
  1. package/capns.js +25 -5
  2. package/package.json +1 -1
package/capns.js CHANGED
@@ -1239,11 +1239,27 @@ class Cap {
1239
1239
  this.mediaSpecs = {}; // Spec ID resolution table
1240
1240
  this.arguments = { required: [], optional: [] };
1241
1241
  this.output = null;
1242
- this.accepts_stdin = false;
1242
+ this.stdin = null; // If present, media URN that stdin expects. Null means no stdin.
1243
1243
  this.metadata_json = metadataJson;
1244
1244
  this.registered_by = null; // Registration attribution
1245
1245
  }
1246
1246
 
1247
+ /**
1248
+ * Check if cap accepts stdin
1249
+ * @returns {boolean} Whether this capability accepts stdin
1250
+ */
1251
+ acceptsStdin() {
1252
+ return this.stdin !== null && this.stdin !== undefined;
1253
+ }
1254
+
1255
+ /**
1256
+ * Get the media type expected for stdin
1257
+ * @returns {string|null} The media URN for stdin, or null if cap doesn't accept stdin
1258
+ */
1259
+ stdinMediaType() {
1260
+ return this.stdin;
1261
+ }
1262
+
1247
1263
  /**
1248
1264
  * Resolve a media URN to a MediaSpec using this cap's mediaSpecs table
1249
1265
  * @param {string} mediaUrn - The media URN (e.g., "media:type=string;v=1")
@@ -1399,7 +1415,7 @@ class Cap {
1399
1415
  JSON.stringify(this.mediaSpecs) === JSON.stringify(other.mediaSpecs) &&
1400
1416
  JSON.stringify(this.arguments) === JSON.stringify(other.arguments) &&
1401
1417
  JSON.stringify(this.output) === JSON.stringify(other.output) &&
1402
- this.accepts_stdin === other.accepts_stdin &&
1418
+ this.stdin === other.stdin &&
1403
1419
  JSON.stringify(this.metadata_json) === JSON.stringify(other.metadata_json) &&
1404
1420
  JSON.stringify(this.registered_by) === JSON.stringify(other.registered_by);
1405
1421
  }
@@ -1426,10 +1442,14 @@ class Cap {
1426
1442
  metadata: this.metadata,
1427
1443
  media_specs: this.mediaSpecs,
1428
1444
  arguments: this.arguments,
1429
- output: this.output,
1430
- accepts_stdin: this.accepts_stdin
1445
+ output: this.output
1431
1446
  };
1432
1447
 
1448
+ // Only include stdin if present (absence means no stdin)
1449
+ if (this.stdin !== null && this.stdin !== undefined) {
1450
+ result.stdin = this.stdin;
1451
+ }
1452
+
1433
1453
  if (this.metadata_json !== null && this.metadata_json !== undefined) {
1434
1454
  result.metadata_json = this.metadata_json;
1435
1455
  }
@@ -1458,7 +1478,7 @@ class Cap {
1458
1478
  cap.mediaSpecs = json.media_specs || json.mediaSpecs || {};
1459
1479
  cap.arguments = json.arguments || { required: [], optional: [] };
1460
1480
  cap.output = json.output;
1461
- cap.accepts_stdin = json.accepts_stdin || false;
1481
+ cap.stdin = json.stdin || null; // Absence or null means no stdin
1462
1482
  cap.registered_by = json.registered_by ? RegisteredBy.fromJSON(json.registered_by) : null;
1463
1483
  return cap;
1464
1484
  }
package/package.json CHANGED
@@ -32,5 +32,5 @@
32
32
  "scripts": {
33
33
  "test": "node capns.test.js"
34
34
  },
35
- "version": "0.33.9334"
35
+ "version": "0.34.9370"
36
36
  }