From 7409c18f4ad1ec5d60a03aeb138514b20e073e9c Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 25 May 2026 19:07:32 +0800 Subject: [PATCH 1/4] Support protobuf native schema --- .eslintignore | 1 + index.d.ts | 16 + index.js | 2 + package-lock.json | 22 + package.json | 3 +- src/ProtobufNativeSchema.js | 76 ++++ src/SchemaInfo.cc | 62 +-- src/SchemaInfo.h | 10 +- tests/protobuf_native_schema.test.js | 96 ++++ .../generated/user_event_pb.d.ts | 164 +++++++ .../generated/user_event_pb.js | 412 ++++++++++++++++++ .../generated/user_event_root.json | 33 ++ yarn.lock | 245 ++++++++--- 13 files changed, 1061 insertions(+), 81 deletions(-) create mode 100644 src/ProtobufNativeSchema.js create mode 100644 tests/protobuf_native_schema.test.js create mode 100644 tests/protobuf_schema/generated/user_event_pb.d.ts create mode 100644 tests/protobuf_schema/generated/user_event_pb.js create mode 100644 tests/protobuf_schema/generated/user_event_root.json diff --git a/.eslintignore b/.eslintignore index ea4442c5..117f9f20 100644 --- a/.eslintignore +++ b/.eslintignore @@ -19,3 +19,4 @@ examples perf +tests/protobuf_schema/generated diff --git a/index.d.ts b/index.d.ts index 607842fa..8e6fb85d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -225,6 +225,21 @@ export interface SchemaInfo { properties?: Record; } +export namespace ProtobufNativeSchema { + interface CreateSchemaInfoFromRootOptions { + root: any; + rootMessageTypeName: string; + rootFileDescriptorName: string; + schemaType?: 'ProtobufNative'; + syntax?: 'proto3' | 'proto2' | string; + name?: string; + properties?: Record; + } + + function createRootFromJson(rootJson: Record): any; + function createSchemaInfoFromRoot(options: CreateSchemaInfoFromRootOptions): SchemaInfo; +} + export interface DeadLetterPolicy { deadLetterTopic: string; maxRedeliverCount?: number; @@ -385,6 +400,7 @@ export type SchemaType = 'Float32' | 'Float64' | 'KeyValue' | + 'ProtobufNative' | 'Bytes' | 'AutoConsume' | 'AutoPublish'; diff --git a/index.js b/index.js index d909251c..57ae7619 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,7 @@ const AuthenticationToken = require('./src/AuthenticationToken'); const AuthenticationOauth2 = require('./src/AuthenticationOauth2'); const AuthenticationBasic = require('./src/AuthenticationBasic'); const Client = require('./src/Client'); +const ProtobufNativeSchema = require('./src/ProtobufNativeSchema'); const LogLevel = { DEBUG: 0, @@ -43,6 +44,7 @@ const Pulsar = { AuthenticationToken, AuthenticationOauth2, AuthenticationBasic, + ProtobufNativeSchema, LogLevel, }; diff --git a/package-lock.json b/package-lock.json index e5f892cf..f9e17da8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "license-check-and-add": "^4.0.5", "license-checker": "^25.0.1", "lodash": "^4.17.21", + "protobufjs": "^8.4.2", "typedoc": "^0.23.28", "typescript": "^4.9.5" }, @@ -6251,6 +6252,13 @@ "dev": true, "license": "MIT" }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -7045,6 +7053,20 @@ "node": ">= 6" } }, + "node_modules/protobufjs": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-8.4.2.tgz", + "integrity": "sha512-64rfNzkWOZAIazXzpBFPWq6F9up6gMvTzjE2oWIzApx2N/dqVUEE7+bCn2+40780dFVtKOUab8QfxJ6KJDWbqA==", + "dev": true, + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/psl": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", diff --git a/package.json b/package.json index f8ec1cc3..1fc58687 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,8 @@ "license-checker": "^25.0.1", "lodash": "^4.17.21", "typedoc": "^0.23.28", - "typescript": "^4.9.5" + "typescript": "^4.9.5", + "protobufjs": "^8.4.2" }, "dependencies": { "@mapbox/node-pre-gyp": "^2.0.3", diff --git a/src/ProtobufNativeSchema.js b/src/ProtobufNativeSchema.js new file mode 100644 index 00000000..fc838cd8 --- /dev/null +++ b/src/ProtobufNativeSchema.js @@ -0,0 +1,76 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +require('protobufjs/ext/descriptor'); + +const protobuf = require('protobufjs'); +const descriptor = require('protobufjs/ext/descriptor'); + +const normalizeTypeName = (typeName) => typeName.replace(/^\./, ''); + +const createSchemaInfoFromRoot = ({ + root, + rootMessageTypeName, + rootFileDescriptorName, + schemaType = 'ProtobufNative', + syntax = 'proto3', + name = rootMessageTypeName, + properties = {}, +}) => { + if (!root) { + throw new Error('root is required'); + } + if (!rootMessageTypeName) { + throw new Error('rootMessageTypeName is required'); + } + if (!rootFileDescriptorName) { + throw new Error('rootFileDescriptorName is required'); + } + + const normalizedTypeName = normalizeTypeName(rootMessageTypeName); + const rootMessageType = root.lookupType(normalizedTypeName); + const packageName = normalizedTypeName.split('.').slice(0, -1).join('.'); + const namespace = packageName ? root.lookup(packageName) : root; + + // protobufjs reflection JSON does not retain the source file name. Set it + // before exporting a FileDescriptorSet, mirroring descriptor->file()->name(). + namespace.filename = rootFileDescriptorName; + root.resolveAll(); + + const fileDescriptorSet = root.toDescriptor(syntax); + const fileDescriptorSetBytes = descriptor.FileDescriptorSet.encode(fileDescriptorSet).finish(); + + return { + schemaType, + name, + schema: JSON.stringify({ + fileDescriptorSet: Buffer.from(fileDescriptorSetBytes).toString('base64'), + rootMessageTypeName: normalizeTypeName(rootMessageType.fullName), + rootFileDescriptorName, + }), + properties, + }; +}; + +const createRootFromJson = (rootJson) => protobuf.Root.fromJSON(rootJson); + +module.exports = { + createRootFromJson, + createSchemaInfoFromRoot, +}; diff --git a/src/SchemaInfo.cc b/src/SchemaInfo.cc index b6943f23..0065b8b8 100644 --- a/src/SchemaInfo.cc +++ b/src/SchemaInfo.cc @@ -17,6 +17,8 @@ * under the License. */ #include "SchemaInfo.h" +#include +#include #include static const std::string CFG_SCHEMA_TYPE = "schemaType"; @@ -24,28 +26,38 @@ static const std::string CFG_NAME = "name"; static const std::string CFG_SCHEMA = "schema"; static const std::string CFG_PROPS = "properties"; -static const std::map SCHEMA_TYPE = {{"None", pulsar_None}, - {"String", pulsar_String}, - {"Json", pulsar_Json}, - {"Protobuf", pulsar_Protobuf}, - {"Avro", pulsar_Avro}, - {"Boolean", pulsar_Boolean}, - {"Int8", pulsar_Int8}, - {"Int16", pulsar_Int16}, - {"Int32", pulsar_Int32}, - {"Int64", pulsar_Int64}, - {"Float32", pulsar_Float32}, - {"Float64", pulsar_Float64}, - {"KeyValue", pulsar_KeyValue}, - {"Bytes", pulsar_Bytes}, - {"AutoConsume", pulsar_AutoConsume}, - {"AutoPublish", pulsar_AutoPublish}}; +struct _pulsar_producer_configuration { + pulsar::ProducerConfiguration conf; +}; -SchemaInfo::SchemaInfo(const Napi::Object &schemaInfo) : cSchemaType(pulsar_Bytes), name("BYTES"), schema() { - this->cProperties = pulsar_string_map_create(); +struct _pulsar_consumer_configuration { + pulsar::ConsumerConfiguration consumerConfiguration; +}; + +static const std::map SCHEMA_TYPE = { + {"None", static_cast(0)}, + {"String", static_cast(1)}, + {"Json", static_cast(2)}, + {"Protobuf", static_cast(3)}, + {"Avro", static_cast(4)}, + {"Boolean", static_cast(5)}, + {"Int8", static_cast(6)}, + {"Int16", static_cast(7)}, + {"Int32", static_cast(8)}, + {"Int64", static_cast(9)}, + {"Float32", static_cast(10)}, + {"Float64", static_cast(11)}, + {"KeyValue", static_cast(15)}, + {"ProtobufNative", static_cast(20)}, + {"Bytes", static_cast(-1)}, + {"AutoConsume", static_cast(-3)}, + {"AutoPublish", static_cast(-4)}}; + +SchemaInfo::SchemaInfo(const Napi::Object &schemaInfo) + : schemaType(static_cast(-1)), name("BYTES"), schema() { if (schemaInfo.Has(CFG_SCHEMA_TYPE) && schemaInfo.Get(CFG_SCHEMA_TYPE).IsString()) { this->name = schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value(); - this->cSchemaType = SCHEMA_TYPE.at(schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value()); + this->schemaType = SCHEMA_TYPE.at(schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value()); } if (schemaInfo.Has(CFG_NAME) && schemaInfo.Get(CFG_NAME).IsString()) { this->name = schemaInfo.Get(CFG_NAME).ToString().Utf8Value(); @@ -60,19 +72,19 @@ SchemaInfo::SchemaInfo(const Napi::Object &schemaInfo) : cSchemaType(pulsar_Byte for (int i = 0; i < size; i++) { Napi::String key = arr.Get(i).ToString(); Napi::String value = propObj.Get(key).ToString(); - pulsar_string_map_put(this->cProperties, key.Utf8Value().c_str(), value.Utf8Value().c_str()); + this->properties[key.Utf8Value()] = value.Utf8Value(); } } } void SchemaInfo::SetProducerSchema(std::shared_ptr cProducerConfiguration) { - pulsar_producer_configuration_set_schema_info(cProducerConfiguration.get(), this->cSchemaType, - this->name.c_str(), this->schema.c_str(), this->cProperties); + cProducerConfiguration->conf.setSchema( + pulsar::SchemaInfo(this->schemaType, this->name, this->schema, this->properties)); } void SchemaInfo::SetConsumerSchema(std::shared_ptr cConsumerConfiguration) { - pulsar_consumer_configuration_set_schema_info(cConsumerConfiguration.get(), this->cSchemaType, - this->name.c_str(), this->schema.c_str(), this->cProperties); + cConsumerConfiguration->consumerConfiguration.setSchema( + pulsar::SchemaInfo(this->schemaType, this->name, this->schema, this->properties)); } -SchemaInfo::~SchemaInfo() { pulsar_string_map_free(this->cProperties); } +SchemaInfo::~SchemaInfo() {} diff --git a/src/SchemaInfo.h b/src/SchemaInfo.h index 90674f5f..ab746e85 100644 --- a/src/SchemaInfo.h +++ b/src/SchemaInfo.h @@ -20,9 +20,13 @@ #ifndef SCHEMA_INFO_H #define SCHEMA_INFO_H +#include +#include #include -#include +#include #include +#include +#include class SchemaInfo { public: @@ -32,10 +36,10 @@ class SchemaInfo { void SetConsumerSchema(std::shared_ptr cConsumerConfiguration); private: - pulsar_schema_type cSchemaType; + pulsar::SchemaType schemaType; std::string name; std::string schema; - pulsar_string_map_t *cProperties; + std::map properties; }; #endif diff --git a/tests/protobuf_native_schema.test.js b/tests/protobuf_native_schema.test.js new file mode 100644 index 00000000..27485f5f --- /dev/null +++ b/tests/protobuf_native_schema.test.js @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +const Pulsar = require('../index'); +const { pulsar } = require('./protobuf_schema/generated/user_event_pb'); +const userEventRootJson = require('./protobuf_schema/generated/user_event_root.json'); + +(() => { + describe('ProtobufNativeSchema', () => { + test('produce and consume protobuf native messages', async () => { + const topic = `persistent://public/default/protobuf-native-schema-${Date.now()}`; + const subscription = `protobuf-native-sub-${Date.now()}`; + const userEventRoot = Pulsar.ProtobufNativeSchema.createRootFromJson(userEventRootJson); + const schema = Pulsar.ProtobufNativeSchema.createSchemaInfoFromRoot({ + root: userEventRoot, + rootMessageTypeName: 'pulsar.example.UserEvent', + rootFileDescriptorName: 'user_event.proto', + }); + + expect(schema.schemaType).toBe('ProtobufNative'); + + const client = new Pulsar.Client({ + serviceUrl: 'pulsar://localhost:6650', + operationTimeoutSeconds: 30, + }); + + let producer; + let consumer; + + try { + consumer = await client.subscribe({ + topic, + subscription, + subscriptionType: 'Shared', + ackTimeoutMs: 10000, + schema, + }); + + producer = await client.createProducer({ + topic, + sendTimeoutMs: 30000, + batchingEnabled: true, + schema, + }); + + const sent = []; + for (let i = 0; i < 5; i += 1) { + const userEvent = pulsar.example.UserEvent.create({ + id: `user-${i}`, + name: `User ${i}`, + age: 20 + i, + tags: ['nodejs', 'protobuf'], + }); + const data = Buffer.from(pulsar.example.UserEvent.encode(userEvent).finish()); + sent.push(pulsar.example.UserEvent.toObject(userEvent)); + await producer.send({ data }); + } + await producer.flush(); + + const received = []; + for (let i = 0; i < sent.length; i += 1) { + const msg = await consumer.receive(); + const userEvent = pulsar.example.UserEvent.decode(msg.getData()); + received.push(pulsar.example.UserEvent.toObject(userEvent)); + await consumer.acknowledge(msg); + } + + expect(received).toEqual(sent); + } finally { + if (producer) { + await producer.close(); + } + if (consumer) { + await consumer.close(); + } + await client.close(); + } + }, 30000); + }); +})(); diff --git a/tests/protobuf_schema/generated/user_event_pb.d.ts b/tests/protobuf_schema/generated/user_event_pb.d.ts new file mode 100644 index 00000000..ae649461 --- /dev/null +++ b/tests/protobuf_schema/generated/user_event_pb.d.ts @@ -0,0 +1,164 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import * as $protobuf from "protobufjs"; +import Long = require("long"); + +/** Namespace pulsar. */ +export namespace pulsar { + + /** Namespace example. */ + namespace example { + + /** + * Properties of a UserEvent. + * @deprecated Use pulsar.example.UserEvent.$Properties instead. + */ + interface IUserEvent extends pulsar.example.UserEvent.$Properties { + } + + /** Represents a UserEvent. */ + class UserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: pulsar.example.UserEvent.$Properties); + + /** Unknown fields preserved while decoding */ + $unknowns?: Uint8Array[]; + + /** UserEvent id. */ + id: string; + + /** UserEvent name. */ + name: string; + + /** UserEvent age. */ + age: number; + + /** UserEvent tags. */ + tags: string[]; + + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + static create(properties: pulsar.example.UserEvent.$Shape): pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape; + static create(properties?: pulsar.example.UserEvent.$Properties): pulsar.example.UserEvent; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link pulsar.example.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + static encode(message: pulsar.example.UserEvent.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link pulsar.example.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + static encodeDelimited(message: pulsar.example.UserEvent.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns {pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns {pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape; + + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + static fromObject(object: { [k: string]: any }): pulsar.example.UserEvent; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + static toObject(message: pulsar.example.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + toJSON(): { [k: string]: any }; + + /** + * Gets the type url for UserEvent + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` + * @returns The type url + */ + static getTypeUrl(prefix?: string): string; + } + + namespace UserEvent { + + /** Properties of a UserEvent. */ + interface $Properties { + + /** UserEvent id */ + id?: (string|null); + + /** UserEvent name */ + name?: (string|null); + + /** UserEvent age */ + age?: (number|null); + + /** UserEvent tags */ + tags?: (string[]|null); + + /** Unknown fields preserved while decoding */ + $unknowns?: Uint8Array[]; + } + + /** Shape of a UserEvent. */ + type $Shape = pulsar.example.UserEvent.$Properties; + } + } +} diff --git a/tests/protobuf_schema/generated/user_event_pb.js b/tests/protobuf_schema/generated/user_event_pb.js new file mode 100644 index 00000000..8748c36f --- /dev/null +++ b/tests/protobuf_schema/generated/user_event_pb.js @@ -0,0 +1,412 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-mixed-operators, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars, default-case, jsdoc/require-param*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.pulsar = (function() { + + /** + * Namespace pulsar. + * @exports pulsar + * @namespace + */ + var pulsar = {}; + + pulsar.example = (function() { + + /** + * Namespace example. + * @memberof pulsar + * @namespace + */ + var example = {}; + + example.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @typedef {Object} pulsar.example.UserEvent.$Properties + * @property {string|null} [id] UserEvent id + * @property {string|null} [name] UserEvent name + * @property {number|null} [age] UserEvent age + * @property {Array.|null} [tags] UserEvent tags + * @property {Array.} [$unknowns] Unknown fields preserved while decoding + */ + + /** + * Properties of a UserEvent. + * @memberof pulsar.example + * @interface IUserEvent + * @augments pulsar.example.UserEvent.$Properties + * @deprecated Use pulsar.example.UserEvent.$Properties instead. + */ + + /** + * Shape of a UserEvent. + * @typedef {pulsar.example.UserEvent.$Properties} pulsar.example.UserEvent.$Shape + */ + + /** + * Constructs a new UserEvent. + * @memberof pulsar.example + * @classdesc Represents a UserEvent. + * @constructor + * @param {pulsar.example.UserEvent.$Properties=} [properties] Properties to set + * @property {Array.} [$unknowns] Unknown fields preserved while decoding + */ + function UserEvent(properties) { + this.tags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent id. + * @member {string} id + * @memberof pulsar.example.UserEvent + * @instance + */ + UserEvent.prototype.id = ""; + + /** + * UserEvent name. + * @member {string} name + * @memberof pulsar.example.UserEvent + * @instance + */ + UserEvent.prototype.name = ""; + + /** + * UserEvent age. + * @member {number} age + * @memberof pulsar.example.UserEvent + * @instance + */ + UserEvent.prototype.age = 0; + + /** + * UserEvent tags. + * @member {Array.} tags + * @memberof pulsar.example.UserEvent + * @instance + */ + UserEvent.prototype.tags = $util.emptyArray; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof pulsar.example.UserEvent + * @static + * @param {pulsar.example.UserEvent.$Properties=} [properties] Properties to set + * @returns {pulsar.example.UserEvent} UserEvent instance + * @type {{ + * (properties: pulsar.example.UserEvent.$Shape): pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape; + * (properties?: pulsar.example.UserEvent.$Properties): pulsar.example.UserEvent; + * }} + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link pulsar.example.UserEvent.verify|verify} messages. + * @function encode + * @memberof pulsar.example.UserEvent + * @static + * @param {pulsar.example.UserEvent.$Properties} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer, _depth) { + if (!writer) + writer = $Writer.create(); + if (_depth === undefined) + _depth = 0; + if (_depth > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.age != null && Object.hasOwnProperty.call(message, "age")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.age); + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tags[i]); + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) + for (var i = 0; i < message.$unknowns.length; ++i) + writer.raw(message.$unknowns[i]); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link pulsar.example.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof pulsar.example.UserEvent + * @static + * @param {pulsar.example.UserEvent.$Properties} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof pulsar.example.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length, _end, _depth, _target) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (_depth === undefined) + _depth = 0; + if (_depth > $Reader.recursionLimit) + throw Error("max depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.pulsar.example.UserEvent(), value; + while (reader.pos < end) { + var start = reader.pos; + var tag = reader.tag(); + if (tag === _end) { + _end = undefined; + break; + } + var wireType = tag & 7; + switch (tag >>>= 3) { + case 1: { + if (wireType !== 2) + break; + if ((value = reader.string()).length) + message.id = value; + else + delete message.id; + continue; + } + case 2: { + if (wireType !== 2) + break; + if ((value = reader.string()).length) + message.name = value; + else + delete message.name; + continue; + } + case 3: { + if (wireType !== 0) + break; + if (value = reader.int32()) + message.age = value; + else + delete message.age; + continue; + } + case 4: { + if (wireType !== 2) + break; + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + continue; + } + } + reader.skipType(wireType, _depth, tag); + $util.makeProp(message, "$unknowns", false); + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); + } + if (_end !== undefined) + throw Error("missing end group"); + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof pulsar.example.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {pulsar.example.UserEvent & pulsar.example.UserEvent.$Shape} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof pulsar.example.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message, _depth) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (_depth === undefined) + _depth = 0; + if (_depth > $util.recursionLimit) + return "max depth exceeded"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.age != null && message.hasOwnProperty("age")) + if (!$util.isInteger(message.age)) + return "age: integer expected"; + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof pulsar.example.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {pulsar.example.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object, _depth) { + if (object instanceof $root.pulsar.example.UserEvent) + return object; + if (_depth === undefined) + _depth = 0; + if (_depth > $util.recursionLimit) + throw Error("max depth exceeded"); + var message = new $root.pulsar.example.UserEvent(); + if (object.id != null) + if (typeof object.id !== "string" || object.id.length) + message.id = String(object.id); + if (object.name != null) + if (typeof object.name !== "string" || object.name.length) + message.name = String(object.name); + if (object.age != null) + if (Number(object.age) !== 0) + message.age = object.age | 0; + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".pulsar.example.UserEvent.tags: array expected"); + message.tags = Array(object.tags.length); + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof pulsar.example.UserEvent + * @static + * @param {pulsar.example.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options, _depth) { + if (!options) + options = {}; + if (_depth === undefined) + _depth = 0; + if (_depth > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.tags = []; + if (options.defaults) { + object.id = ""; + object.name = ""; + object.age = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.age != null && message.hasOwnProperty("age")) + object.age = message.age; + if (message.tags && message.tags.length) { + object.tags = Array(message.tags.length); + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof pulsar.example.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the type url for UserEvent + * @function getTypeUrl + * @memberof pulsar.example.UserEvent + * @static + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` + * @returns {string} The type url + */ + UserEvent.getTypeUrl = function getTypeUrl(prefix) { + if (prefix === undefined) + prefix = "type.googleapis.com"; + return prefix + "/pulsar.example.UserEvent"; + }; + + return UserEvent; + })(); + + return example; + })(); + + return pulsar; +})(); + +module.exports = $root; diff --git a/tests/protobuf_schema/generated/user_event_root.json b/tests/protobuf_schema/generated/user_event_root.json new file mode 100644 index 00000000..140cd97a --- /dev/null +++ b/tests/protobuf_schema/generated/user_event_root.json @@ -0,0 +1,33 @@ +{ + "nested": { + "pulsar": { + "nested": { + "example": { + "nested": { + "UserEvent": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "name": { + "type": "string", + "id": 2 + }, + "age": { + "type": "int32", + "id": 3 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 4 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 5f93d006..64070e5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,14 +7,23 @@ resolved "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz" integrity sha512-H71nDOOL8Y7kWRLqf6Sums+01Q5msqBW2KhDUTemh1tvY04eSkSXrK0uj/4mmY0Xr16/3zyZmsrxN7CKuRbNRg== -"@babel/code-frame@7.12.11", "@babel/code-frame@^7.0.0": +"@babel/code-frame@^7.0.0", "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz" integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" -"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": +"@babel/code-frame@^7.12.13": + version "7.27.1" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz" + integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== + dependencies: + "@babel/helper-validator-identifier" "^7.27.1" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/code-frame@^7.27.1": version "7.27.1" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz" integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== @@ -28,7 +37,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.4.tgz" integrity sha512-YsmSKC29MJwf0gF8Rjjrg5LQCmyh+j/nD8/eP7f+BeoQTKYqs9RoWbjGOdy0+1Ekr68RJZMUOPVQaQisnIo4Rw== -"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.8.0": +"@babel/core@^7.0.0", "@babel/core@^7.0.0 || ^8.0.0-0", "@babel/core@^7.0.0-0", "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.8.0": version "7.28.4" resolved "https://registry.npmjs.org/@babel/core/-/core-7.28.4.tgz" integrity sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA== @@ -561,7 +570,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": +"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -769,16 +778,16 @@ abab@^2.0.3, abab@^2.0.5: resolved "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -abbrev@1: - version "1.1.1" - resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" - integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - abbrev@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/abbrev/-/abbrev-3.0.1.tgz" integrity sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg== +abbrev@1: + version "1.1.1" + resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + acorn-globals@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz" @@ -797,7 +806,7 @@ acorn-walk@^7.1.1: resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn@^7.1.1, acorn@^7.4.0: +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^7.1.1, acorn@^7.4.0: version "7.4.1" resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== @@ -807,6 +816,11 @@ acorn@^8.2.4: resolved "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz" integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== +agent-base@^7.1.2: + version "7.1.4" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz" + integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== + agent-base@6: version "6.0.2" resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz" @@ -814,11 +828,6 @@ agent-base@6: dependencies: debug "4" -agent-base@^7.1.2: - version "7.1.4" - resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz" - integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== - ajv@^6.10.0, ajv@^6.12.4: version "6.14.0" resolved "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz" @@ -866,7 +875,14 @@ ansi-sequence-parser@^1.1.0: resolved "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.3.tgz" integrity sha512-+fksAx9eG3Ab6LDnLs3ZqZa8KVJ/jYnX+D4Qe1azX+LFGFAXqynCQLOdLpNYN/l9e7l6hMWwZbrnctqr6eSQSw== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.0: + version "3.2.1" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -1079,6 +1095,11 @@ balanced-match@^1.0.0: resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +balanced-match@^4.0.2: + version "4.0.4" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz" + integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== + base64-js@^1.2.0: version "1.5.1" resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" @@ -1096,6 +1117,14 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" +brace-expansion@^1.1.7: + version "1.1.12" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz" + integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + brace-expansion@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz" @@ -1103,6 +1132,13 @@ brace-expansion@^2.0.2: dependencies: balanced-match "^1.0.0" +brace-expansion@^5.0.2: + version "5.0.4" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz" + integrity sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg== + dependencies: + balanced-match "^4.0.2" + braces@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" @@ -1115,7 +1151,7 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.24.0: +browserslist@^4.24.0, "browserslist@>= 4.21.0": version "4.26.2" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.26.2.tgz" integrity sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A== @@ -1184,7 +1220,16 @@ caniuse-lite@^1.0.30001741: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001745.tgz" integrity sha512-ywt6i8FzvdgrrrGbr1jZVObnVv6adj+0if2/omv9cmR2oiZs30zL4DIyaptKcbOrBdOIc74QTMoJvSE2QHh5UQ== -chalk@^2.4.1, chalk@^2.4.2: +chalk@^2.4.1: + version "2.4.2" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^2.4.2: version "2.4.2" resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1221,7 +1266,7 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz" integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== -clang-format@^1.4.0: +clang-format@^1.0.0, clang-format@^1.4.0: version "1.8.0" resolved "https://registry.npmjs.org/clang-format/-/clang-format-1.8.0.tgz" integrity sha512-pK8gzfu55/lHzIpQ1givIbWfn3eXnU7SfxqIwVgnn5jEM6j4ZJYjpFqFs4iSBPNedzRMmfjYjuQhu657WAXHXw== @@ -1272,16 +1317,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" @@ -1299,6 +1344,11 @@ commander@^6.1.0: resolved "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz" integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + confusing-browser-globals@^1.0.10: version "1.0.11" resolved "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz" @@ -1381,20 +1431,27 @@ data-view-byte-offset@^1.0.1: es-errors "^1.3.0" is-data-view "^1.0.1" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.4.3" - resolved "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz" - integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== +debug@^3.1.0: + version "3.2.7" + resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: - ms "^2.1.3" + ms "^2.1.1" -debug@^3.1.0, debug@^3.2.7: +debug@^3.2.7: version "3.2.7" resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: ms "^2.1.1" +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@4: + version "4.4.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== + dependencies: + ms "^2.1.3" + debuglog@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz" @@ -1707,7 +1764,7 @@ eslint-module-utils@^2.12.1: dependencies: debug "^3.2.7" -eslint-plugin-import@^2.22.0: +eslint-plugin-import@^2.22.0, eslint-plugin-import@^2.22.1: version "2.32.0" resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz" integrity sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA== @@ -1761,7 +1818,12 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: +eslint-visitor-keys@^1.1.0: + version "1.3.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== @@ -1771,7 +1833,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint@^7.8.1: +eslint@*, "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9", "eslint@^5.16.0 || ^6.8.0 || ^7.2.0", eslint@^7.8.1, eslint@>=5: version "7.32.0" resolved "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== @@ -1850,7 +1912,12 @@ estraverse@^4.1.1: resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0, estraverse@^5.2.0: +estraverse@^5.1.0: + version "5.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +estraverse@^5.2.0: version "5.3.0" resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1980,7 +2047,7 @@ flat-cache@^3.0.4: flatted@^3.2.9: version "3.4.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.4.2.tgz#f5c23c107f0f37de8dbdf24f13722b3b98d52726" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz" integrity sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA== for-each@^0.3.3, for-each@^0.3.5: @@ -1990,7 +2057,7 @@ for-each@^0.3.3, for-each@^0.3.5: dependencies: is-callable "^1.2.7" -form-data@^3.0.0, form-data@^4.0.1: +form-data@^4.0.1: version "4.0.5" resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz" integrity sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w== @@ -2291,7 +2358,12 @@ ignore@^4.0.6: resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.1, ignore@^5.1.2, ignore@^5.2.0: +ignore@^5.1.1, ignore@^5.1.2: + version "5.3.2" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== + +ignore@^5.2.0: version "5.3.2" resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== @@ -2851,7 +2923,7 @@ jest-resolve-dependencies@^27.5.1: jest-regex-util "^27.5.1" jest-snapshot "^27.5.1" -jest-resolve@^27.5.1: +jest-resolve@*, jest-resolve@^27.5.1: version "27.5.1" resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz" integrity sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw== @@ -3200,6 +3272,11 @@ lodash@^4.17.21, lodash@^4.7.0: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== +long@^5.3.2: + version "5.3.2" + resolved "https://registry.npmjs.org/long/-/long-5.3.2.tgz" + integrity sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -3271,10 +3348,38 @@ mimic-fn@^2.1.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@*, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2, minimatch@^7.1.3, minimatch@^9.0.0: - version "9.0.9" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e" - integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== +minimatch@*: + version "10.2.4" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz" + integrity sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg== + dependencies: + brace-expansion "^5.0.2" + +minimatch@^3.0.4: + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.1.1: + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.1.2: + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^7.1.3: + version "7.4.9" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-7.4.9.tgz" + integrity sha512-Brg/fp/iAVDOQoHxkuN5bEYhyQlZhxddI78yWsCbeEwTHXQjlNLtiJDUsp1GIptVqMI7/gkJMz4vVAc01mpoBw== dependencies: brace-expansion "^2.0.2" @@ -3283,7 +3388,12 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -minipass@^7.0.4, minipass@^7.1.2: +minipass@^7.0.4: + version "7.1.3" + resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== + +minipass@^7.1.2: version "7.1.3" resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz" integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== @@ -3585,7 +3695,7 @@ picocolors@^1.0.0, picocolors@^1.1.1: picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz" integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== pirates@^4.0.4: @@ -3632,6 +3742,13 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +protobufjs@^8.4.2: + version "8.4.2" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-8.4.2.tgz" + integrity sha512-64rfNzkWOZAIazXzpBFPWq6F9up6gMvTzjE2oWIzApx2N/dqVUEE7+bCn2+40780dFVtKOUab8QfxJ6KJDWbqA== + dependencies: + long "^5.3.2" + psl@^1.1.33: version "1.15.0" resolved "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz" @@ -3834,12 +3951,17 @@ saxes@^5.0.1: dependencies: xmlchars "^2.2.0" -"semver@2 || 3 || 4 || 5", semver@^5.5.0: +semver@^5.5.0: version "5.7.2" resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.3.0, semver@^6.3.1: +semver@^6.3.0: + version "6.3.1" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^6.3.1: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -3849,6 +3971,11 @@ semver@^7.2.1, semver@^7.3.2, semver@^7.3.5, semver@^7.5.3: resolved "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz" integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== +"semver@2 || 3 || 4 || 5": + version "5.7.2" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" @@ -4080,7 +4207,16 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4150,7 +4286,12 @@ strip-final-newline@^2.0.0: resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -4205,9 +4346,9 @@ table@^6.0.9: string-width "^4.2.3" strip-ansi "^6.0.1" -tar@^7.4.0, tar@^7.5.8: +tar@^7.5.8: version "7.5.11" - resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.11.tgz#1250fae45d98806b36d703b30973fa8e0a6d8868" + resolved "https://registry.npmjs.org/tar/-/tar-7.5.11.tgz" integrity sha512-ChjMH33/KetonMTAtpYdgUFr0tbz69Fp2v7zWxQfYZX4g5ZN2nOBXm1R2xyA+lMIKrLKIoKAwFj93jE/avX9cQ== dependencies: "@isaacs/fs-minipass" "^4.0.0" @@ -4255,7 +4396,7 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tough-cookie@^4.0.0, tough-cookie@^4.1.3: +tough-cookie@^4.1.3: version "4.1.4" resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz" integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== @@ -4388,7 +4529,7 @@ typedoc@^0.23.28: minimatch "^7.1.3" shiki "^0.14.1" -typescript@^4.9.5: +typescript@^4.9.5, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta", "typescript@4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x": version "4.9.5" resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== From f4847862d2866a5f53d21d608a4ade0510c305ab Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 25 May 2026 19:56:23 +0800 Subject: [PATCH 2/4] update package.js --- package-lock.json | 6 ++---- package.json | 6 +++--- yarn.lock | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index f9e17da8..444d07bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "dependencies": { "@mapbox/node-pre-gyp": "^2.0.3", "bindings": "^1.5.0", - "node-addon-api": "^4.3.0" + "node-addon-api": "^4.3.0", + "protobufjs": "^8.4.2" }, "devDependencies": { "@seadub/clang-format-lint": "0.0.2", @@ -29,7 +30,6 @@ "license-check-and-add": "^4.0.5", "license-checker": "^25.0.1", "lodash": "^4.17.21", - "protobufjs": "^8.4.2", "typedoc": "^0.23.28", "typescript": "^4.9.5" }, @@ -6256,7 +6256,6 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", - "dev": true, "license": "Apache-2.0" }, "node_modules/lru-cache": { @@ -7057,7 +7056,6 @@ "version": "8.4.2", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-8.4.2.tgz", "integrity": "sha512-64rfNzkWOZAIazXzpBFPWq6F9up6gMvTzjE2oWIzApx2N/dqVUEE7+bCn2+40780dFVtKOUab8QfxJ6KJDWbqA==", - "dev": true, "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { diff --git a/package.json b/package.json index 1fc58687..9eb68c9d 100644 --- a/package.json +++ b/package.json @@ -61,13 +61,13 @@ "license-checker": "^25.0.1", "lodash": "^4.17.21", "typedoc": "^0.23.28", - "typescript": "^4.9.5", - "protobufjs": "^8.4.2" + "typescript": "^4.9.5" }, "dependencies": { "@mapbox/node-pre-gyp": "^2.0.3", "bindings": "^1.5.0", - "node-addon-api": "^4.3.0" + "node-addon-api": "^4.3.0", + "protobufjs": "^8.4.2" }, "binary": { "module_name": "pulsar", diff --git a/yarn.lock b/yarn.lock index 64070e5b..d4e3336b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3269,7 +3269,7 @@ lodash.truncate@^4.4.2: lodash@^4.17.21, lodash@^4.7.0: version "4.18.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz" integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== long@^5.3.2: From c413d156ec89100cc2d95e557e98ada319b4f5f0 Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 25 May 2026 20:51:06 +0800 Subject: [PATCH 3/4] address code review --- src/ProtobufNativeSchema.js | 2 -- src/SchemaInfo.cc | 11 +++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ProtobufNativeSchema.js b/src/ProtobufNativeSchema.js index fc838cd8..6b8dd6f6 100644 --- a/src/ProtobufNativeSchema.js +++ b/src/ProtobufNativeSchema.js @@ -17,8 +17,6 @@ * under the License. */ -require('protobufjs/ext/descriptor'); - const protobuf = require('protobufjs'); const descriptor = require('protobufjs/ext/descriptor'); diff --git a/src/SchemaInfo.cc b/src/SchemaInfo.cc index 0065b8b8..6abd5933 100644 --- a/src/SchemaInfo.cc +++ b/src/SchemaInfo.cc @@ -56,8 +56,15 @@ static const std::map SCHEMA_TYPE = { SchemaInfo::SchemaInfo(const Napi::Object &schemaInfo) : schemaType(static_cast(-1)), name("BYTES"), schema() { if (schemaInfo.Has(CFG_SCHEMA_TYPE) && schemaInfo.Get(CFG_SCHEMA_TYPE).IsString()) { - this->name = schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value(); - this->schemaType = SCHEMA_TYPE.at(schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value()); + std::string typeStr = schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value(); + auto it = SCHEMA_TYPE.find(typeStr); + if (it == SCHEMA_TYPE.end()) { + Napi::TypeError::New(schemaInfo.Env(), "Unknown schemaType: " + typeStr) + .ThrowAsJavaScriptException(); + return; + } + this->name = typeStr; + this->schemaType = it->second; } if (schemaInfo.Has(CFG_NAME) && schemaInfo.Get(CFG_NAME).IsString()) { this->name = schemaInfo.Get(CFG_NAME).ToString().Utf8Value(); From 4d24730148e42e319114471243e9cbc742d27b3e Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 25 May 2026 21:00:15 +0800 Subject: [PATCH 4/4] fix lint --- src/SchemaInfo.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SchemaInfo.cc b/src/SchemaInfo.cc index 6abd5933..ed09a798 100644 --- a/src/SchemaInfo.cc +++ b/src/SchemaInfo.cc @@ -59,8 +59,7 @@ SchemaInfo::SchemaInfo(const Napi::Object &schemaInfo) std::string typeStr = schemaInfo.Get(CFG_SCHEMA_TYPE).ToString().Utf8Value(); auto it = SCHEMA_TYPE.find(typeStr); if (it == SCHEMA_TYPE.end()) { - Napi::TypeError::New(schemaInfo.Env(), "Unknown schemaType: " + typeStr) - .ThrowAsJavaScriptException(); + Napi::TypeError::New(schemaInfo.Env(), "Unknown schemaType: " + typeStr).ThrowAsJavaScriptException(); return; } this->name = typeStr;