Files
npm-core-sdk/item.ts
2025-08-19 08:32:31 +00:00

332 lines
20 KiB
TypeScript

// @generated by protobuf-ts 2.11.1 with parameter use_proto_field_name,keep_enum_prefix
// @generated from protobuf file "item.proto" (package "api", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { AttachmentSummary } from "./shared";
import { ItemStatusStruct } from "./repositoryShared";
import { LogisticVariant } from "./repositoryShared";
import { TradeItemDescriptions } from "./repositoryShared";
import { ExpiryConstraint } from "./repositoryShared";
import { MetadataElement } from "./shared";
import { EntityID } from "./shared";
import { EventHeader } from "./shared";
/**
*
* Aggregation object message
*
* @generated from protobuf message api.Item
*/
export interface Item {
/**
* @generated from protobuf field: api.EventHeader LastEventHeader = 1
*/
LastEventHeader?: EventHeader;
/**
* @generated from protobuf field: api.EntityID ID = 2
*/
ID?: EntityID;
/**
* @generated from protobuf field: api.ItemPayload Payload = 3
*/
Payload?: ItemPayload;
}
/**
* @generated from protobuf message api.ItemPayload
*/
export interface ItemPayload {
/**
* Metadata are characteristics specific to the project. They can be of several data form (string, integer, float, boolean or timestamp)
*
* @generated from protobuf field: repeated api.MetadataElement MetaData = 1
*/
MetaData: MetadataElement[];
/**
* Item components
*
* @generated from protobuf field: api.ExpiryConstraint ExpiryConstraint = 6
*/
ExpiryConstraint?: ExpiryConstraint;
/**
* @generated from protobuf field: string PhotoURI = 7
*/
PhotoURI: string;
/**
* @generated from protobuf field: repeated api.TradeItemDescriptions DescriptionsByLanguage = 3
*/
DescriptionsByLanguage: TradeItemDescriptions[]; // @option language
/**
* @generated from protobuf field: repeated api.LogisticVariant LogisticVariants = 4
*/
LogisticVariants: LogisticVariant[];
/**
* @generated from protobuf field: api.ItemStatusStruct Status = 5
*/
Status?: ItemStatusStruct; // Status field is not accessible from APIs
/**
* @generated from protobuf field: repeated api.AttachmentSummary Attachments = 8
*/
Attachments: AttachmentSummary[];
/**
* @generated from protobuf field: int32 AttachmentNumber = 9
*/
AttachmentNumber: number;
/**
* @generated from protobuf field: repeated string RemovedLogisticVariantIDs = 10
*/
RemovedLogisticVariantIDs: string[];
}
/**
* @generated from protobuf message api.ItemTriplet
*/
export interface ItemTriplet {
/**
* @generated from protobuf field: api.Item Current = 1
*/
Current?: Item;
/**
* @generated from protobuf field: api.Item Previous = 2
*/
Previous?: Item;
/**
* @generated from protobuf field: api.Item LastEvent = 3
*/
LastEvent?: Item;
}
// @generated message type with reflection information, may provide speed optimized methods
class Item$Type extends MessageType<Item> {
constructor() {
super("api.Item", [
{ no: 1, name: "LastEventHeader", kind: "message", localName: "LastEventHeader", jsonName: "LastEventHeader", T: () => EventHeader },
{ no: 2, name: "ID", kind: "message", localName: "ID", jsonName: "ID", T: () => EntityID },
{ no: 3, name: "Payload", kind: "message", localName: "Payload", jsonName: "Payload", T: () => ItemPayload }
], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { description: "Aggregation object message" } } });
}
create(value?: PartialMessage<Item>): Item {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<Item>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Item): Item {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* api.EventHeader LastEventHeader */ 1:
message.LastEventHeader = EventHeader.internalBinaryRead(reader, reader.uint32(), options, message.LastEventHeader);
break;
case /* api.EntityID ID */ 2:
message.ID = EntityID.internalBinaryRead(reader, reader.uint32(), options, message.ID);
break;
case /* api.ItemPayload Payload */ 3:
message.Payload = ItemPayload.internalBinaryRead(reader, reader.uint32(), options, message.Payload);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: Item, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* api.EventHeader LastEventHeader = 1; */
if (message.LastEventHeader)
EventHeader.internalBinaryWrite(message.LastEventHeader, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* api.EntityID ID = 2; */
if (message.ID)
EntityID.internalBinaryWrite(message.ID, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* api.ItemPayload Payload = 3; */
if (message.Payload)
ItemPayload.internalBinaryWrite(message.Payload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.Item
*/
export const Item = new Item$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ItemPayload$Type extends MessageType<ItemPayload> {
constructor() {
super("api.ItemPayload", [
{ no: 1, name: "MetaData", kind: "message", localName: "MetaData", jsonName: "MetaData", repeat: 2 /*RepeatType.UNPACKED*/, T: () => MetadataElement, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Metadata are characteristics specific to the project. They can be of several data form (string, integer, float, boolean or timestamp)" }, "api.metadata": true, "api.aggKey": "Key", "api.kpiExclude": { Items: [{ Context: "Order", Group: "order" }] }, "api.parentEntity": "Item", "api.aggAppend": "MetaDataUpdated" } },
{ no: 6, name: "ExpiryConstraint", kind: "message", localName: "ExpiryConstraint", jsonName: "ExpiryConstraint", T: () => ExpiryConstraint, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Item components" } } },
{ no: 7, name: "PhotoURI", kind: "scalar", localName: "PhotoURI", jsonName: "PhotoURI", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { example: "\"https://reflex-visibility-forever.jpg\"" }, "api.kpiItems": { Items: [{ Context: "Item", Group: "item", Queryable: true }, { Context: "Executionflow", Group: "executionflow", Queryable: true }, { Context: "Stock", Group: "stock", Queryable: true }, { Context: "Stock", Group: "stock_extended", Queryable: true, CustomType: "SimpleAggregateFunction(anyLast,String)" }] }, "api.viewType": { Types: [{ Context: "*", Type: "image" }] } } },
{ no: 3, name: "DescriptionsByLanguage", kind: "message", localName: "DescriptionsByLanguage", jsonName: "DescriptionsByLanguage", repeat: 2 /*RepeatType.UNPACKED*/, T: () => TradeItemDescriptions, options: { "api.language": true, "api.aggKey": "LanguageCodeISO6391", "api.aggAppend": "DescriptionUpdated", "api.kpiItems": { Items: [{ Context: "Item", Group: "item" }, { Context: "Executionflow", Group: "executionflow" }, { Context: "Stock", Group: "stock" }, { Context: "Stock", Group: "stock_extended", CustomType: "SimpleAggregateFunction(anyLast,String)" }] } } },
{ no: 4, name: "LogisticVariants", kind: "message", localName: "LogisticVariants", jsonName: "LogisticVariants", repeat: 2 /*RepeatType.UNPACKED*/, T: () => LogisticVariant, options: { "validate.rules": { repeated: { uniqueBaseLV: true, knownRefLV: true } }, "api.aggKey": "LVID", "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock_extended" }, { Context: "Item", Group: "item" }] }, "api.aggAppend": "LogisticVariantUpdated" } },
{ no: 5, name: "Status", kind: "message", localName: "Status", jsonName: "Status", T: () => ItemStatusStruct, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.kpiExclude": { Items: [{ Context: "Movement", Group: "movement" }] }, "api.enrichmentClear": "Handlingunit,Order,Executionflow,Stock" } },
{ no: 8, name: "Attachments", kind: "message", localName: "Attachments", jsonName: "Attachments", repeat: 2 /*RepeatType.UNPACKED*/, T: () => AttachmentSummary, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Number of attachments per type" }, "api.aggSkip": "AttachmentAdded,AttachmentRemoved", "api.enrichmentClear": "Handlingunit,Order,Executionflow,Stock" } },
{ no: 9, name: "AttachmentNumber", kind: "scalar", localName: "AttachmentNumber", jsonName: "AttachmentNumber", T: 5 /*ScalarType.INT32*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Total number of attachments" }, "api.enrichmentClear": "Handlingunit,Order,Executionflow,Stock" } },
{ no: 10, name: "RemovedLogisticVariantIDs", kind: "scalar", localName: "RemovedLogisticVariantIDs", jsonName: "RemovedLogisticVariantIDs", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "api.indexationType": { Types: [{ Context: "*", Type: "generatedText,keyword" }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortKeyword" }] } } }
]);
}
create(value?: PartialMessage<ItemPayload>): ItemPayload {
const message = globalThis.Object.create((this.messagePrototype!));
message.MetaData = [];
message.PhotoURI = "";
message.DescriptionsByLanguage = [];
message.LogisticVariants = [];
message.Attachments = [];
message.AttachmentNumber = 0;
message.RemovedLogisticVariantIDs = [];
if (value !== undefined)
reflectionMergePartial<ItemPayload>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ItemPayload): ItemPayload {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* repeated api.MetadataElement MetaData */ 1:
message.MetaData.push(MetadataElement.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* api.ExpiryConstraint ExpiryConstraint */ 6:
message.ExpiryConstraint = ExpiryConstraint.internalBinaryRead(reader, reader.uint32(), options, message.ExpiryConstraint);
break;
case /* string PhotoURI */ 7:
message.PhotoURI = reader.string();
break;
case /* repeated api.TradeItemDescriptions DescriptionsByLanguage */ 3:
message.DescriptionsByLanguage.push(TradeItemDescriptions.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* repeated api.LogisticVariant LogisticVariants */ 4:
message.LogisticVariants.push(LogisticVariant.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* api.ItemStatusStruct Status */ 5:
message.Status = ItemStatusStruct.internalBinaryRead(reader, reader.uint32(), options, message.Status);
break;
case /* repeated api.AttachmentSummary Attachments */ 8:
message.Attachments.push(AttachmentSummary.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* int32 AttachmentNumber */ 9:
message.AttachmentNumber = reader.int32();
break;
case /* repeated string RemovedLogisticVariantIDs */ 10:
message.RemovedLogisticVariantIDs.push(reader.string());
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: ItemPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated api.MetadataElement MetaData = 1; */
for (let i = 0; i < message.MetaData.length; i++)
MetadataElement.internalBinaryWrite(message.MetaData[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* repeated api.TradeItemDescriptions DescriptionsByLanguage = 3; */
for (let i = 0; i < message.DescriptionsByLanguage.length; i++)
TradeItemDescriptions.internalBinaryWrite(message.DescriptionsByLanguage[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
/* repeated api.LogisticVariant LogisticVariants = 4; */
for (let i = 0; i < message.LogisticVariants.length; i++)
LogisticVariant.internalBinaryWrite(message.LogisticVariants[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
/* api.ItemStatusStruct Status = 5; */
if (message.Status)
ItemStatusStruct.internalBinaryWrite(message.Status, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
/* api.ExpiryConstraint ExpiryConstraint = 6; */
if (message.ExpiryConstraint)
ExpiryConstraint.internalBinaryWrite(message.ExpiryConstraint, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
/* string PhotoURI = 7; */
if (message.PhotoURI !== "")
writer.tag(7, WireType.LengthDelimited).string(message.PhotoURI);
/* repeated api.AttachmentSummary Attachments = 8; */
for (let i = 0; i < message.Attachments.length; i++)
AttachmentSummary.internalBinaryWrite(message.Attachments[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
/* int32 AttachmentNumber = 9; */
if (message.AttachmentNumber !== 0)
writer.tag(9, WireType.Varint).int32(message.AttachmentNumber);
/* repeated string RemovedLogisticVariantIDs = 10; */
for (let i = 0; i < message.RemovedLogisticVariantIDs.length; i++)
writer.tag(10, WireType.LengthDelimited).string(message.RemovedLogisticVariantIDs[i]);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.ItemPayload
*/
export const ItemPayload = new ItemPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ItemTriplet$Type extends MessageType<ItemTriplet> {
constructor() {
super("api.ItemTriplet", [
{ no: 1, name: "Current", kind: "message", localName: "Current", jsonName: "Current", T: () => Item },
{ no: 2, name: "Previous", kind: "message", localName: "Previous", jsonName: "Previous", T: () => Item },
{ no: 3, name: "LastEvent", kind: "message", localName: "LastEvent", jsonName: "LastEvent", T: () => Item }
]);
}
create(value?: PartialMessage<ItemTriplet>): ItemTriplet {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<ItemTriplet>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ItemTriplet): ItemTriplet {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* api.Item Current */ 1:
message.Current = Item.internalBinaryRead(reader, reader.uint32(), options, message.Current);
break;
case /* api.Item Previous */ 2:
message.Previous = Item.internalBinaryRead(reader, reader.uint32(), options, message.Previous);
break;
case /* api.Item LastEvent */ 3:
message.LastEvent = Item.internalBinaryRead(reader, reader.uint32(), options, message.LastEvent);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: ItemTriplet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* api.Item Current = 1; */
if (message.Current)
Item.internalBinaryWrite(message.Current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* api.Item Previous = 2; */
if (message.Previous)
Item.internalBinaryWrite(message.Previous, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* api.Item LastEvent = 3; */
if (message.LastEvent)
Item.internalBinaryWrite(message.LastEvent, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.ItemTriplet
*/
export const ItemTriplet = new ItemTriplet$Type();