Files
npm-core-sdk/itemAction.ts
2025-10-13 08:19:33 +00:00

168 lines
8.5 KiB
TypeScript

// @generated by protobuf-ts 2.11.1 with parameter use_proto_field_name,keep_enum_prefix
// @generated from protobuf file "itemAction.proto" (package "api", syntax proto3)
// tslint:disable
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } 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 { EntityID } from "./shared";
import { CommandHeader } from "./shared";
// _common_
// Action Summary
// - DeleteStock : After each Item deleted, clear the corresponding Stocks > stock.Deleted
//
/**
*
* DeleteStock : clear the stock cooresponding to the item
* by sending cumulated snapshotted quantity on stock id not already cumulated,
* by reseting the quantity of missing stock entry for the current snapshot
*
* @generated from protobuf message api.ItemDeleteStockPayload
*/
export interface ItemDeleteStockPayload {
}
/**
* @generated from protobuf message api.ItemDeleteStock
*/
export interface ItemDeleteStock {
/**
* @generated from protobuf field: api.CommandHeader Header = 1
*/
Header?: CommandHeader;
/**
* @generated from protobuf field: api.EntityID ID = 2
*/
ID?: EntityID;
/**
* @generated from protobuf field: api.ItemDeleteStockPayload Payload = 3
*/
Payload?: ItemDeleteStockPayload;
/**
* @generated from protobuf field: api.ItemDeleteStockPayload EventPayload = 4
*/
EventPayload?: ItemDeleteStockPayload;
/**
* @generated from protobuf field: api.ItemDeleteStockPayload PreviousPayload = 5
*/
PreviousPayload?: ItemDeleteStockPayload;
}
// @generated message type with reflection information, may provide speed optimized methods
class ItemDeleteStockPayload$Type extends MessageType<ItemDeleteStockPayload> {
constructor() {
super("api.ItemDeleteStockPayload", [], { "api.messageType": "Command", "api.payload": true, "api.action": "DeleteStock" });
}
create(value?: PartialMessage<ItemDeleteStockPayload>): ItemDeleteStockPayload {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<ItemDeleteStockPayload>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ItemDeleteStockPayload): ItemDeleteStockPayload {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
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: ItemDeleteStockPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.ItemDeleteStockPayload
*/
export const ItemDeleteStockPayload = new ItemDeleteStockPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ItemDeleteStock$Type extends MessageType<ItemDeleteStock> {
constructor() {
super("api.ItemDeleteStock", [
{ no: 1, name: "Header", kind: "message", localName: "Header", jsonName: "Header", T: () => CommandHeader },
{ no: 2, name: "ID", kind: "message", localName: "ID", jsonName: "ID", T: () => EntityID },
{ no: 3, name: "Payload", kind: "message", localName: "Payload", jsonName: "Payload", T: () => ItemDeleteStockPayload },
{ no: 4, name: "EventPayload", kind: "message", localName: "EventPayload", jsonName: "EventPayload", T: () => ItemDeleteStockPayload },
{ no: 5, name: "PreviousPayload", kind: "message", localName: "PreviousPayload", jsonName: "PreviousPayload", T: () => ItemDeleteStockPayload }
], { "api.messageType": "Command", "api.action": "DeleteStock", "api.resultingEvent": "stock.Deleted", "api.triggerEventFilters": "Deleted" });
}
create(value?: PartialMessage<ItemDeleteStock>): ItemDeleteStock {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<ItemDeleteStock>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ItemDeleteStock): ItemDeleteStock {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* api.CommandHeader Header */ 1:
message.Header = CommandHeader.internalBinaryRead(reader, reader.uint32(), options, message.Header);
break;
case /* api.EntityID ID */ 2:
message.ID = EntityID.internalBinaryRead(reader, reader.uint32(), options, message.ID);
break;
case /* api.ItemDeleteStockPayload Payload */ 3:
message.Payload = ItemDeleteStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.Payload);
break;
case /* api.ItemDeleteStockPayload EventPayload */ 4:
message.EventPayload = ItemDeleteStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.EventPayload);
break;
case /* api.ItemDeleteStockPayload PreviousPayload */ 5:
message.PreviousPayload = ItemDeleteStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.PreviousPayload);
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: ItemDeleteStock, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* api.CommandHeader Header = 1; */
if (message.Header)
CommandHeader.internalBinaryWrite(message.Header, 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.ItemDeleteStockPayload Payload = 3; */
if (message.Payload)
ItemDeleteStockPayload.internalBinaryWrite(message.Payload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
/* api.ItemDeleteStockPayload EventPayload = 4; */
if (message.EventPayload)
ItemDeleteStockPayload.internalBinaryWrite(message.EventPayload, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
/* api.ItemDeleteStockPayload PreviousPayload = 5; */
if (message.PreviousPayload)
ItemDeleteStockPayload.internalBinaryWrite(message.PreviousPayload, writer.tag(5, 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.ItemDeleteStock
*/
export const ItemDeleteStock = new ItemDeleteStock$Type();