@aptre/protobuf-es-lite 0.4.5 → 0.4.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/binary-encoding.d.ts +1 -1
- package/dist/codegen-info.d.ts +1 -1
- package/dist/google/protobuf/any.pb.d.ts +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/util.d.ts +1 -0
- package/dist/util.js +8 -0
- package/package.json +5 -5
|
@@ -359,7 +359,7 @@ export declare class BinaryReader implements IBinaryReader {
|
|
|
359
359
|
/**
|
|
360
360
|
* Read a `uint32` field, an unsigned 32 bit varint.
|
|
361
361
|
*/
|
|
362
|
-
uint32:
|
|
362
|
+
uint32: IBinaryReader["uint32"];
|
|
363
363
|
/**
|
|
364
364
|
* Read a `int32` field, a signed 32 bit varint.
|
|
365
365
|
*/
|
package/dist/codegen-info.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare const codegenInfo: {
|
|
|
44
44
|
readonly createEnumType: RuntimeSymbolInfo;
|
|
45
45
|
readonly createMessageType: RuntimeSymbolInfo;
|
|
46
46
|
};
|
|
47
|
-
readonly wktSourceFiles:
|
|
47
|
+
readonly wktSourceFiles: ReadonlyArray<string>;
|
|
48
48
|
};
|
|
49
49
|
export type RuntimeSymbolName = keyof typeof codegenInfo.symbols;
|
|
50
50
|
export type CodegenInfo = typeof codegenInfo;
|
|
@@ -137,10 +137,10 @@ declare const Any_Wkt: {
|
|
|
137
137
|
toJson(msg: Any, options?: Partial<JsonWriteOptions>): JsonValue;
|
|
138
138
|
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): Any;
|
|
139
139
|
packFrom<T extends Message<T>>(out: Any, message: Message<T>, messageType: MessageType<T>): void;
|
|
140
|
-
unpackTo<
|
|
141
|
-
unpack<
|
|
142
|
-
message: Message<
|
|
143
|
-
messageType: MessageType<
|
|
140
|
+
unpackTo<T extends Message<T>>(msg: Any, target: Message<T>, targetMessageType: MessageType<T>): boolean;
|
|
141
|
+
unpack<T extends Message<T>>(msg: Any, registry: IMessageTypeRegistry): {
|
|
142
|
+
message: Message<T>;
|
|
143
|
+
messageType: MessageType<T>;
|
|
144
144
|
} | undefined;
|
|
145
145
|
is(msg: Any, msgType: MessageType | string): boolean;
|
|
146
146
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export { jsonReadEnum, jsonReadField, jsonReadMapKey, jsonReadScalar, jsonReadMe
|
|
|
16
16
|
export { binaryReadField, binaryReadMapEntry, binaryReadScalar, binaryReadScalarLTString, binaryReadMessage, binaryWriteField, binaryWriteScalar, binaryWritePacked, binaryWriteMapEntry, binaryWriteMessage, binaryMakeReadOptions, binaryMakeWriteOptions, BinaryReadOptions, BinaryWriteOptions, } from "./binary.js";
|
|
17
17
|
export type { IMessageTypeRegistry, IServiceTypeRegistry, IEnumTypeRegistry, } from "./type-registry.js";
|
|
18
18
|
export { compareFieldZeroValue, isMessageZeroValue, getFieldZeroValue, } from "./zero-value.js";
|
|
19
|
+
export { unixMilliToDate, getFieldDefaultValueExpression, getFieldTypeInfo, getFieldZeroValueExpression, } from "./util.js";
|
package/dist/index.js
CHANGED
|
@@ -14,3 +14,4 @@ export { Timestamp, Duration, Any, Empty, DoubleValue, FloatValue, Int64Value, U
|
|
|
14
14
|
export { jsonReadEnum, jsonReadField, jsonReadMapKey, jsonReadScalar, jsonReadMessage, jsonWriteEnum, jsonWriteField, jsonWriteScalar, jsonWriteMessage, jsonDebugValue, jsonMakeReadOptions, jsonMakeWriteOptions, } from "./json.js";
|
|
15
15
|
export { binaryReadField, binaryReadMapEntry, binaryReadScalar, binaryReadScalarLTString, binaryReadMessage, binaryWriteField, binaryWriteScalar, binaryWritePacked, binaryWriteMapEntry, binaryWriteMessage, binaryMakeReadOptions, binaryMakeWriteOptions, } from "./binary.js";
|
|
16
16
|
export { compareFieldZeroValue, isMessageZeroValue, getFieldZeroValue, } from "./zero-value.js";
|
|
17
|
+
export { unixMilliToDate, getFieldDefaultValueExpression, getFieldTypeInfo, getFieldZeroValueExpression, } from "./util.js";
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Printable } from "./protoplugin/ecmascript/index.js";
|
|
2
2
|
import { DescExtension, DescField } from "./descriptor-set.js";
|
|
3
|
+
export declare function unixMilliToDate(unixMilliseconds: bigint): Date;
|
|
3
4
|
export declare function getFieldTypeInfo(field: DescField | DescExtension): {
|
|
4
5
|
typing: Printable;
|
|
5
6
|
optional: boolean;
|
package/dist/util.js
CHANGED
|
@@ -16,6 +16,14 @@ import { FieldDescriptorProto_Label } from "./google/protobuf/descriptor.pb.js";
|
|
|
16
16
|
import { codegenInfo } from "./codegen-info.js";
|
|
17
17
|
import { LongType, ScalarType } from "./scalar.js";
|
|
18
18
|
import { localName } from "./names.js";
|
|
19
|
+
// unixMilliToDate converts the unix milliseconds bigint into a Date.
|
|
20
|
+
// Throws an error if the bigint is outside the safe range of Number values.
|
|
21
|
+
export function unixMilliToDate(unixMilliseconds) {
|
|
22
|
+
if (unixMilliseconds < -8640000000000000n || unixMilliseconds > 8640000000000000n) {
|
|
23
|
+
throw new Error("Timestamp is outside the range that can be safely represented by a JavaScript Date");
|
|
24
|
+
}
|
|
25
|
+
return new Date(Number(unixMilliseconds));
|
|
26
|
+
}
|
|
19
27
|
export function getFieldTypeInfo(field) {
|
|
20
28
|
const typing = [];
|
|
21
29
|
let typingInferrableFromZeroValue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptre/protobuf-es-lite",
|
|
3
3
|
"description": "Lightweight Protobuf codegen for TypeScript and JavaScript.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.7",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"url": "git+ssh://git@github.com/aperturerobotics/protobuf-es-lite.git"
|
|
@@ -74,17 +74,17 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.12.13",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
78
|
-
"@typescript-eslint/parser": "^
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
78
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
79
79
|
"eslint": "^9.3.0",
|
|
80
80
|
"eslint-config-prettier": "^9.1.0",
|
|
81
81
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
82
82
|
"lint-staged": ">=15.2.5",
|
|
83
83
|
"pre-commit": "^1.2.2",
|
|
84
84
|
"prettier": "^3.2.5",
|
|
85
|
-
"rimraf": "^
|
|
85
|
+
"rimraf": "^6.0.0",
|
|
86
86
|
"typescript": "^5.4.5",
|
|
87
|
-
"vitest": "^
|
|
87
|
+
"vitest": "^2.0.0"
|
|
88
88
|
},
|
|
89
89
|
"lint-staged": {
|
|
90
90
|
"package.json": "prettier --write",
|