space-data-module-sdk 0.9.0 → 0.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "space-data-module-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
6
6
  "type": "module",
@@ -9,8 +9,13 @@
9
9
  // - "params" / "result": one aligned record of the operation's table here (TAB WIRE_FORMAT ALIGNED_BINARY, TYPE_REF
10
10
  // SCHEMA_NAME "HostOps.fbs", ROOT_TYPE the table, BYTE_LENGTH its size);
11
11
  // - a list port (e.g. "entries"): a run of aligned records of one table, back to back at a fixed stride;
12
- // - a raw port (e.g. "body", "records", "url", "sql", "path"): unbounded bytes, verbatim - bodies, keys, record
13
- // streams (size-prefixed frames concatenated), and text that may exceed an aligned string (UTF-8).
12
+ // - a raw port (e.g. "body", "records", "url", "sql", "path", "config"): unbounded bytes, verbatim - bodies, keys,
13
+ // record streams (size-prefixed frames concatenated), typed FlatBuffers (plugin.getConfig's ModuleConfig), and
14
+ // text that may exceed an aligned string (UTF-8).
15
+ // - SQL values (raw "params" in, raw "cells" out) use FlatSQL's own tagged parameter encoding (flatsql capi
16
+ // decodeParamsNoThrow), value after value with no count: u8 tag, u32 little-endian payload length, payload.
17
+ // Tags: 0 null (length 0), 1 bool (1 byte, 0 / 1), 2 i64 (8 bytes LE), 3 f64 (8 bytes LE), 4 string (UTF-8),
18
+ // 5 bytes.
14
19
  // Aligned strings hold at most 255 bytes; a value that does not fit is refused, never truncated. Times are Unix
15
20
  // milliseconds UTC. A zero or an empty string means "not given" and the host applies the documented default: aligned records have no
16
21
  // schema defaults (an unset field reads zero), so every field here is phrased so that zero is the default.
@@ -37,16 +42,9 @@ table HasCapabilityParams { CAPABILITY: string (aligned_max_length: 64); }
37
42
  /// LENGTH 1..8192 (0 = 32); the bytes come back on raw "data".
38
43
  table RandomBytesParams { LENGTH: uint32; }
39
44
 
40
- enum configEntryKind : ubyte { String, Number, Bool }
41
- /// One configured value; nested tables and lists are flattened into dotted paths ("targets.0.provider_id",
42
- /// "widths.1"). plugin.getConfig answers with a run of these on list "entries".
43
- table ConfigEntry {
44
- KEY: string (aligned_max_length: 255);
45
- KIND: configEntryKind;
46
- STRING_VALUE: string (aligned_max_length: 255);
47
- NUMBER_VALUE: double;
48
- BOOL_VALUE: bool;
49
- }
45
+ // plugin.getConfig answers on raw "config" with one ModuleConfig FlatBuffer (schemas/runtime/ModuleConfig.fbs, file
46
+ // identifier MCFG, not size-prefixed): typed values, number and string lists, nested tables - one compact buffer, read
47
+ // in place (typedHostcall.hpp sdm_piv::get_config()).
50
48
 
51
49
  // ---- http (raw in: "url", "headers" (an HTTP header block, "name: value" lines), "body"; raw out: the same) --------
52
50
 
@@ -86,7 +84,7 @@ table StoredRecordMeta {
86
84
  SOURCE_NAME: string (aligned_max_length: 128);
87
85
  BATCH_ID: string (aligned_max_length: 128);
88
86
  PRODUCER_PEER_ID: string (aligned_max_length: 128);
89
- LICENSE: string (aligned_max_length: 64);
87
+ LICENSE: string (aligned_max_length: 128);
90
88
  }
91
89
 
92
90
  /// One record on raw "data"; the result names its CID.
@@ -110,16 +108,17 @@ table StorageExpireResult { DELETED: uint64; MISSING: uint64; CAPPED: bool; }
110
108
 
111
109
  enum reconcileKind : ubyte { Duplicates, None, Current }
112
110
  /// One batch: raw "records" (size-prefixed record stream), optional raw "archive" (the source document, kept under
113
- /// ARCHIVE_SOURCE/ARCHIVE_NAME when the host has an archive root), optional "provenance" record.
111
+ /// ARCHIVE_SOURCE/ARCHIVE_NAME when the host has an archive root), optional list "provenance" (one Provenance) and
112
+ /// optional list "provenance_attributes" (ProvenanceAttribute, in order).
114
113
  table StorageIngestParams {
115
114
  SCHEMA: string (aligned_max_length: 64);
116
115
  PROVIDER_ID: string (aligned_max_length: 128);
117
116
  SOURCE_NAME: string (aligned_max_length: 128);
118
117
  BATCH_ID: string (aligned_max_length: 128);
119
118
  SOURCE_URL: string (aligned_max_length: 255);
120
- CONTENT_KEY_ID: string (aligned_max_length: 64);
119
+ CONTENT_KEY_ID: string (aligned_max_length: 128);
121
120
  SOURCE_PEER: string (aligned_max_length: 128);
122
- LICENSE: string (aligned_max_length: 64);
121
+ LICENSE: string (aligned_max_length: 128);
123
122
  LICENSE_URL: string (aligned_max_length: 255);
124
123
  CITATION: string (aligned_max_length: 255);
125
124
  SHARE_ALIKE: bool;
@@ -130,17 +129,23 @@ table StorageIngestParams {
130
129
  table Provenance {
131
130
  SOURCE_URL: string (aligned_max_length: 255);
132
131
  HTTP_STATUS: int32;
133
- ETAG: string (aligned_max_length: 128);
132
+ ETAG: string (aligned_max_length: 255);
134
133
  LAST_MODIFIED: string (aligned_max_length: 64);
135
134
  CONTENT_TYPE: string (aligned_max_length: 128);
136
135
  RETRIEVED_MS: uint64;
137
- PARSER: string (aligned_max_length: 64);
138
- PARSER_VERSION: string (aligned_max_length: 32);
136
+ PARSER: string (aligned_max_length: 128);
137
+ PARSER_VERSION: string (aligned_max_length: 64);
139
138
  SOURCE_SHA256: string (aligned_max_length: 64);
140
139
  NORMALIZED_SHA256: string (aligned_max_length: 64);
141
140
  NORMALIZED_COUNT: uint64;
142
141
  FROM_CACHE: bool;
143
142
  }
143
+ /// Descriptive provenance a parser has no Provenance field for (method, units, date range, counts), as name / value
144
+ /// pairs in order (list "provenance_attributes"; the runtime IngestRequest's Provenance.ATTRIBUTES).
145
+ table ProvenanceAttribute {
146
+ NAME: string (aligned_max_length: 128);
147
+ VALUE: string (aligned_max_length: 255);
148
+ }
144
149
  table StorageIngestResult {
145
150
  SCHEMA: string (aligned_max_length: 64);
146
151
  BATCH_ID: string (aligned_max_length: 128);
@@ -151,16 +156,7 @@ table StorageIngestResult {
151
156
  PROVENANCE_FILE: string (aligned_max_length: 255);
152
157
  }
153
158
 
154
- enum sqlValueKind : ubyte { Null, Bool, I64, F64, Str }
155
- /// One SQL parameter (list "sql_params") or result cell (list "cells", row-major).
156
- table SqlValue {
157
- KIND: sqlValueKind;
158
- BOOL_VALUE: bool;
159
- I64_VALUE: int64;
160
- F64_VALUE: double;
161
- STR_VALUE: string (aligned_max_length: 255);
162
- }
163
- /// raw "sql", list "sql_params"; the answer: a StreamResult with raw "stream" (deliver Inline) or its BodyRef.
159
+ /// raw "sql", raw "params" (tagged SQL values); the answer: a StreamResult with raw "stream" (deliver Inline) or its BodyRef.
164
160
  table SqlStreamParams { DELIVER: deliverMode; }
165
161
  table StreamResult {
166
162
  ROWS: uint64;
@@ -176,8 +172,8 @@ table EpochStreamParams {
176
172
  DELIVER: deliverMode;
177
173
  }
178
174
  enum sandboxWant : ubyte { Stream, Rows, Auto }
179
- /// raw "sql", list "sql_params"; Stream answers like SqlStream, Rows with list "columns" (TextValue) and list
180
- /// "cells" (SqlValue, row-major).
175
+ /// raw "sql", raw "params" (tagged SQL values); Stream answers like SqlStream, Rows with list "columns" (TextValue)
176
+ /// and raw "cells" (tagged SQL values, row-major: ROWS x COLUMNS of them).
181
177
  table SandboxQueryParams { WANT: sandboxWant; DELIVER: deliverMode; }
182
178
  table SandboxQueryResult { KIND: sandboxWant; ROWS: uint64; COLUMNS: uint32; REF: BodyRef; }
183
179
  /// storage.query_surface: list "tables", list "columns".
@@ -193,7 +189,7 @@ table SurfaceColumn {
193
189
  PLACEHOLDER: bool;
194
190
  }
195
191
  table QuerySurfaceLimits { TIMEOUT_MS: uint32; MAX_ROWS: uint64; MAX_BYTES: uint64; }
196
- /// raw "sql", list "sql_params", list "projection" (TextValue); the key comes back as a TextValue.
192
+ /// raw "sql", raw "params" (tagged SQL values), list "projection" (TextValue); the key comes back as a TextValue.
197
193
  table CacheKeyParams {
198
194
  SCHEMA_NAME: string (aligned_max_length: 64);
199
195
  SCHEMA_VERSION: string (aligned_max_length: 32);
@@ -302,7 +298,7 @@ table P2pPnmEntry {
302
298
  GOSSIP_PEER_ID: string (aligned_max_length: 128);
303
299
  STANDARD: string (aligned_max_length: 16);
304
300
  SCHEMA: string (aligned_max_length: 64);
305
- FILE_ID: string (aligned_max_length: 16);
301
+ FILE_ID: string (aligned_max_length: 255);
306
302
  FILE_NAME: string (aligned_max_length: 255);
307
303
  CID: string (aligned_max_length: 128);
308
304
  PUBLISH_MS: uint64;
@@ -324,7 +320,7 @@ table P2pLatestDataset {
324
320
  STANDARD: string (aligned_max_length: 16);
325
321
  SCHEMA: string (aligned_max_length: 64);
326
322
  PNM_CID: string (aligned_max_length: 128);
327
- PNM_FILE_ID: string (aligned_max_length: 16);
323
+ PNM_FILE_ID: string (aligned_max_length: 255);
328
324
  PNM_PUBLISH_MS: uint64;
329
325
  PNM_SIGNATURE_VERIFIED: bool;
330
326
  PNM_ATTRIBUTION: string (aligned_max_length: 16);
@@ -40,6 +40,9 @@ table Provenance {
40
40
  SCHEMA_COUNTS: [uint64];
41
41
  WARNINGS: [string];
42
42
  FROM_CACHE: bool;
43
+ /// Descriptive provenance the parser has no field above for - the method, units, the date range covered, counts
44
+ /// of what was dropped or filled - as name / value pairs, kept in order (a name may repeat). Values are text.
45
+ ATTRIBUTES: [Header];
43
46
  }
44
47
 
45
48
  /// A request to store one batch of records with its source tags (the storage-ingest host connector). The records
@@ -17,6 +17,8 @@ export const RecommendedCapabilityIds = Object.freeze([
17
17
  "protocol_handle",
18
18
  "protocol_dial",
19
19
  "p2p_read",
20
+ "node_status_read",
21
+ "node_activity_read",
20
22
  "database",
21
23
  "storage_adapter",
22
24
  "storage_query",
@@ -24,6 +26,7 @@ export const RecommendedCapabilityIds = Object.freeze([
24
26
  "storage_ingest",
25
27
  "context_read",
26
28
  "context_write",
29
+ "secrets",
27
30
  "process_exec",
28
31
  "crypto_hash",
29
32
  "crypto_sign",