@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.mjs
CHANGED
|
@@ -4144,7 +4144,7 @@ const StreamCodec = {
|
|
|
4144
4144
|
},
|
|
4145
4145
|
/**
|
|
4146
4146
|
* Encode READ request
|
|
4147
|
-
* Payload: [route: string][start_offset: u64][limit: u64][has_max_bytes: u8][max_bytes?: u64][has_filter: u8][filter_length?:
|
|
4147
|
+
* Payload: [route: string][start_offset: u64][limit: u64][has_max_bytes: u8][max_bytes?: u64][has_filter: u8][filter_length?: u32_be][filter?: custom]
|
|
4148
4148
|
*/
|
|
4149
4149
|
encodeRead(route, startOffset, limit, options) {
|
|
4150
4150
|
const writer = new BufferWriter(256);
|
|
@@ -4158,11 +4158,11 @@ const StreamCodec = {
|
|
|
4158
4158
|
const filter = options?.filter;
|
|
4159
4159
|
if (filter && filter.clauses.length > 0) {
|
|
4160
4160
|
writer.writeU8(1);
|
|
4161
|
-
const
|
|
4162
|
-
|
|
4163
|
-
const
|
|
4164
|
-
|
|
4165
|
-
writer.
|
|
4161
|
+
const filterWriter = new BufferWriter(64);
|
|
4162
|
+
encodeStreamFilterSet(filter, filterWriter);
|
|
4163
|
+
const filterBytes = filterWriter.getBufferView();
|
|
4164
|
+
writer.writeU32BE(filterBytes.length);
|
|
4165
|
+
writer.writeBytes(filterBytes);
|
|
4166
4166
|
} else writer.writeU8(0);
|
|
4167
4167
|
return writer.getBufferView();
|
|
4168
4168
|
},
|
|
@@ -4380,27 +4380,29 @@ const StreamCodec = {
|
|
|
4380
4380
|
}
|
|
4381
4381
|
};
|
|
4382
4382
|
function encodeStreamFilterSet(filter, writer) {
|
|
4383
|
-
writer.
|
|
4383
|
+
writer.writeU8(0);
|
|
4384
|
+
writer.writeU8(241);
|
|
4385
|
+
writer.writeU32BE(filter.clauses.length);
|
|
4384
4386
|
for (const clause of filter.clauses) encodeStreamFilterClause(writer, clause);
|
|
4385
4387
|
}
|
|
4386
4388
|
function encodeStreamFilterClause(writer, clause) {
|
|
4387
4389
|
switch (clause.kind) {
|
|
4388
4390
|
case "Equals":
|
|
4389
|
-
writer.
|
|
4390
|
-
writer.
|
|
4391
|
+
writer.writeU8(0);
|
|
4392
|
+
writer.writeString(clause.value);
|
|
4391
4393
|
return;
|
|
4392
4394
|
case "NotEquals":
|
|
4393
|
-
writer.
|
|
4394
|
-
writer.
|
|
4395
|
+
writer.writeU8(1);
|
|
4396
|
+
writer.writeString(clause.value);
|
|
4395
4397
|
return;
|
|
4396
4398
|
case "StartsWith":
|
|
4397
|
-
writer.
|
|
4398
|
-
writer.
|
|
4399
|
+
writer.writeU8(2);
|
|
4400
|
+
writer.writeString(clause.value);
|
|
4399
4401
|
return;
|
|
4400
4402
|
case "AnyOf":
|
|
4401
|
-
writer.
|
|
4402
|
-
writer.
|
|
4403
|
-
for (const value of clause.values) writer.
|
|
4403
|
+
writer.writeU8(3);
|
|
4404
|
+
writer.writeU32BE(clause.values.length);
|
|
4405
|
+
for (const value of clause.values) writer.writeString(value);
|
|
4404
4406
|
return;
|
|
4405
4407
|
}
|
|
4406
4408
|
}
|