@firestore-emulator/proto
Version:
Generated Firestore Protobufs For Firestore Emulator
317 lines (316 loc) • 10.1 kB
JavaScript
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/api/resource.ts
var resource_exports = {};
__export(resource_exports, {
ResourceDescriptor: () => ResourceDescriptor,
ResourceDescriptorHistory: () => ResourceDescriptorHistory,
ResourceDescriptorStyle: () => ResourceDescriptorStyle,
ResourceReference: () => ResourceReference
});
module.exports = __toCommonJS(resource_exports);
var pb_1 = __toESM(require("google-protobuf"));
var ResourceDescriptor = class _ResourceDescriptor extends pb_1.Message {
#one_of_decls = [];
constructor(data) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 10], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("type" in data && data.type != void 0) {
this.type = data.type;
}
if ("pattern" in data && data.pattern != void 0) {
this.pattern = data.pattern;
}
if ("name_field" in data && data.name_field != void 0) {
this.name_field = data.name_field;
}
if ("history" in data && data.history != void 0) {
this.history = data.history;
}
if ("plural" in data && data.plural != void 0) {
this.plural = data.plural;
}
if ("singular" in data && data.singular != void 0) {
this.singular = data.singular;
}
if ("style" in data && data.style != void 0) {
this.style = data.style;
}
}
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 1, "");
}
set type(value) {
pb_1.Message.setField(this, 1, value);
}
get pattern() {
return pb_1.Message.getFieldWithDefault(this, 2, []);
}
set pattern(value) {
pb_1.Message.setField(this, 2, value);
}
get name_field() {
return pb_1.Message.getFieldWithDefault(this, 3, "");
}
set name_field(value) {
pb_1.Message.setField(this, 3, value);
}
get history() {
return pb_1.Message.getFieldWithDefault(this, 4, 0 /* HISTORY_UNSPECIFIED */);
}
set history(value) {
pb_1.Message.setField(this, 4, value);
}
get plural() {
return pb_1.Message.getFieldWithDefault(this, 5, "");
}
set plural(value) {
pb_1.Message.setField(this, 5, value);
}
get singular() {
return pb_1.Message.getFieldWithDefault(this, 6, "");
}
set singular(value) {
pb_1.Message.setField(this, 6, value);
}
get style() {
return pb_1.Message.getFieldWithDefault(this, 10, []);
}
set style(value) {
pb_1.Message.setField(this, 10, value);
}
static fromObject(data) {
const message = new _ResourceDescriptor({});
if (data.type != null) {
message.type = data.type;
}
if (data.pattern != null) {
message.pattern = data.pattern;
}
if (data.name_field != null) {
message.name_field = data.name_field;
}
if (data.history != null) {
message.history = data.history;
}
if (data.plural != null) {
message.plural = data.plural;
}
if (data.singular != null) {
message.singular = data.singular;
}
if (data.style != null) {
message.style = data.style;
}
return message;
}
toObject() {
const data = {};
if (this.type != null) {
data.type = this.type;
}
if (this.pattern != null) {
data.pattern = this.pattern;
}
if (this.name_field != null) {
data.name_field = this.name_field;
}
if (this.history != null) {
data.history = this.history;
}
if (this.plural != null) {
data.plural = this.plural;
}
if (this.singular != null) {
data.singular = this.singular;
}
if (this.style != null) {
data.style = this.style;
}
return data;
}
serialize(w) {
const writer = w || new pb_1.BinaryWriter();
if (this.type.length)
writer.writeString(1, this.type);
if (this.pattern.length)
writer.writeRepeatedString(2, this.pattern);
if (this.name_field.length)
writer.writeString(3, this.name_field);
if (this.history != 0 /* HISTORY_UNSPECIFIED */)
writer.writeEnum(4, this.history);
if (this.plural.length)
writer.writeString(5, this.plural);
if (this.singular.length)
writer.writeString(6, this.singular);
if (this.style.length)
writer.writePackedEnum(10, this.style);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes) {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _ResourceDescriptor();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.type = reader.readString();
break;
case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break;
case 3:
message.name_field = reader.readString();
break;
case 4:
message.history = reader.readEnum();
break;
case 5:
message.plural = reader.readString();
break;
case 6:
message.singular = reader.readString();
break;
case 10:
message.style = reader.readPackedEnum();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(bytes) {
return _ResourceDescriptor.deserialize(bytes);
}
};
var ResourceDescriptorHistory = /* @__PURE__ */ ((ResourceDescriptorHistory2) => {
ResourceDescriptorHistory2[ResourceDescriptorHistory2["HISTORY_UNSPECIFIED"] = 0] = "HISTORY_UNSPECIFIED";
ResourceDescriptorHistory2[ResourceDescriptorHistory2["ORIGINALLY_SINGLE_PATTERN"] = 1] = "ORIGINALLY_SINGLE_PATTERN";
ResourceDescriptorHistory2[ResourceDescriptorHistory2["FUTURE_MULTI_PATTERN"] = 2] = "FUTURE_MULTI_PATTERN";
return ResourceDescriptorHistory2;
})(ResourceDescriptorHistory || {});
var ResourceDescriptorStyle = /* @__PURE__ */ ((ResourceDescriptorStyle2) => {
ResourceDescriptorStyle2[ResourceDescriptorStyle2["STYLE_UNSPECIFIED"] = 0] = "STYLE_UNSPECIFIED";
ResourceDescriptorStyle2[ResourceDescriptorStyle2["DECLARATIVE_FRIENDLY"] = 1] = "DECLARATIVE_FRIENDLY";
return ResourceDescriptorStyle2;
})(ResourceDescriptorStyle || {});
var ResourceReference = class _ResourceReference 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 ("type" in data && data.type != void 0) {
this.type = data.type;
}
if ("child_type" in data && data.child_type != void 0) {
this.child_type = data.child_type;
}
}
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 1, "");
}
set type(value) {
pb_1.Message.setField(this, 1, value);
}
get child_type() {
return pb_1.Message.getFieldWithDefault(this, 2, "");
}
set child_type(value) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data) {
const message = new _ResourceReference({});
if (data.type != null) {
message.type = data.type;
}
if (data.child_type != null) {
message.child_type = data.child_type;
}
return message;
}
toObject() {
const data = {};
if (this.type != null) {
data.type = this.type;
}
if (this.child_type != null) {
data.child_type = this.child_type;
}
return data;
}
serialize(w) {
const writer = w || new pb_1.BinaryWriter();
if (this.type.length)
writer.writeString(1, this.type);
if (this.child_type.length)
writer.writeString(2, this.child_type);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes) {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _ResourceReference();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.type = reader.readString();
break;
case 2:
message.child_type = reader.readString();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(bytes) {
return _ResourceReference.deserialize(bytes);
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ResourceDescriptor,
ResourceDescriptorHistory,
ResourceDescriptorStyle,
ResourceReference
});
//# sourceMappingURL=resource.js.map