@cntryl/fitz 0.0.1 → 0.0.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/dist/index.cjs +18 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -16
- package/dist/index.mjs.map +1 -1
- package/dist/types/domains/stream/codec.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4141,7 +4141,7 @@ const StreamCodec = {
|
|
|
4141
4141
|
},
|
|
4142
4142
|
/**
|
|
4143
4143
|
* Encode READ request
|
|
4144
|
-
* Payload: [route: string][start_offset: u64][limit: u64][has_max_bytes: u8][max_bytes?: u64][has_filter: u8][filter_length?:
|
|
4144
|
+
* Payload: [route: string][start_offset: u64][limit: u64][has_max_bytes: u8][max_bytes?: u64][has_filter: u8][filter_length?: u32_be][filter?: custom]
|
|
4145
4145
|
*/
|
|
4146
4146
|
encodeRead(route, startOffset, limit, options) {
|
|
4147
4147
|
const writer = new BufferWriter(256);
|
|
@@ -4155,11 +4155,11 @@ const StreamCodec = {
|
|
|
4155
4155
|
const filter = options?.filter;
|
|
4156
4156
|
if (filter && filter.clauses.length > 0) {
|
|
4157
4157
|
writer.writeU8(1);
|
|
4158
|
-
const
|
|
4159
|
-
|
|
4160
|
-
const
|
|
4161
|
-
|
|
4162
|
-
writer.
|
|
4158
|
+
const filterWriter = new BufferWriter(64);
|
|
4159
|
+
encodeStreamFilterSet(filter, filterWriter);
|
|
4160
|
+
const filterBytes = filterWriter.getBufferView();
|
|
4161
|
+
writer.writeU32BE(filterBytes.length);
|
|
4162
|
+
writer.writeBytes(filterBytes);
|
|
4163
4163
|
} else writer.writeU8(0);
|
|
4164
4164
|
return writer.getBufferView();
|
|
4165
4165
|
},
|
|
@@ -4377,27 +4377,29 @@ const StreamCodec = {
|
|
|
4377
4377
|
}
|
|
4378
4378
|
};
|
|
4379
4379
|
function encodeStreamFilterSet(filter, writer) {
|
|
4380
|
-
writer.
|
|
4380
|
+
writer.writeU8(0);
|
|
4381
|
+
writer.writeU8(241);
|
|
4382
|
+
writer.writeU32BE(filter.clauses.length);
|
|
4381
4383
|
for (const clause of filter.clauses) encodeStreamFilterClause(writer, clause);
|
|
4382
4384
|
}
|
|
4383
4385
|
function encodeStreamFilterClause(writer, clause) {
|
|
4384
4386
|
switch (clause.kind) {
|
|
4385
4387
|
case "Equals":
|
|
4386
|
-
writer.
|
|
4387
|
-
writer.
|
|
4388
|
+
writer.writeU8(0);
|
|
4389
|
+
writer.writeString(clause.value);
|
|
4388
4390
|
return;
|
|
4389
4391
|
case "NotEquals":
|
|
4390
|
-
writer.
|
|
4391
|
-
writer.
|
|
4392
|
+
writer.writeU8(1);
|
|
4393
|
+
writer.writeString(clause.value);
|
|
4392
4394
|
return;
|
|
4393
4395
|
case "StartsWith":
|
|
4394
|
-
writer.
|
|
4395
|
-
writer.
|
|
4396
|
+
writer.writeU8(2);
|
|
4397
|
+
writer.writeString(clause.value);
|
|
4396
4398
|
return;
|
|
4397
4399
|
case "AnyOf":
|
|
4398
|
-
writer.
|
|
4399
|
-
writer.
|
|
4400
|
-
for (const value of clause.values) writer.
|
|
4400
|
+
writer.writeU8(3);
|
|
4401
|
+
writer.writeU32BE(clause.values.length);
|
|
4402
|
+
for (const value of clause.values) writer.writeString(value);
|
|
4401
4403
|
return;
|
|
4402
4404
|
}
|
|
4403
4405
|
}
|