UNPKG

@firestore-emulator/proto

Version:

Generated Firestore Protobufs For Firestore Emulator

120 lines (119 loc) 3.87 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // generated/google/protobuf/timestamp.ts var timestamp_exports = {}; __export(timestamp_exports, { Timestamp: () => Timestamp }); module.exports = __toCommonJS(timestamp_exports); var pb_1 = __toESM(require("google-protobuf")); var Timestamp = class _Timestamp extends pb_1.Message { #one_of_decls = []; constructor(data) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("seconds" in data && data.seconds != void 0) { this.seconds = data.seconds; } if ("nanos" in data && data.nanos != void 0) { this.nanos = data.nanos; } } } get seconds() { return pb_1.Message.getFieldWithDefault(this, 1, 0); } set seconds(value) { pb_1.Message.setField(this, 1, value); } get nanos() { return pb_1.Message.getFieldWithDefault(this, 2, 0); } set nanos(value) { pb_1.Message.setField(this, 2, value); } static fromObject(data) { const message = new _Timestamp({}); if (data.seconds != null) { message.seconds = data.seconds; } if (data.nanos != null) { message.nanos = data.nanos; } return message; } toObject() { const data = {}; if (this.seconds != null) { data.seconds = this.seconds; } if (this.nanos != null) { data.nanos = this.nanos; } return data; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); if (this.seconds != 0) writer.writeInt64(1, this.seconds); if (this.nanos != 0) writer.writeInt32(2, this.nanos); if (!w) return writer.getResultBuffer(); } static deserialize(bytes) { const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _Timestamp(); while (reader.nextField()) { if (reader.isEndGroup()) break; switch (reader.getFieldNumber()) { case 1: message.seconds = reader.readInt64(); break; case 2: message.nanos = reader.readInt32(); break; default: reader.skipField(); } } return message; } serializeBinary() { return this.serialize(); } static deserializeBinary(bytes) { return _Timestamp.deserialize(bytes); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Timestamp }); //# sourceMappingURL=timestamp.js.map