@fraym/proto 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,13 @@ export interface RegisterMigrationRequest {
42
42
  export interface RegisterMigrationResponse {
43
43
  }
44
44
  export interface FinishMigrationRequest {
45
+ status: {
46
+ [key: string]: number;
47
+ };
48
+ }
49
+ export interface FinishMigrationRequest_StatusEntry {
50
+ key: string;
51
+ value: number;
45
52
  }
46
53
  export interface FinishMigrationResponse {
47
54
  }
@@ -130,12 +137,20 @@ export declare const RegisterMigrationResponse: {
130
137
  fromPartial(_: DeepPartial<RegisterMigrationResponse>): RegisterMigrationResponse;
131
138
  };
132
139
  export declare const FinishMigrationRequest: {
133
- encode(_: FinishMigrationRequest, writer?: _m0.Writer): _m0.Writer;
140
+ encode(message: FinishMigrationRequest, writer?: _m0.Writer): _m0.Writer;
134
141
  decode(input: _m0.Reader | Uint8Array, length?: number): FinishMigrationRequest;
135
- fromJSON(_: any): FinishMigrationRequest;
136
- toJSON(_: FinishMigrationRequest): unknown;
142
+ fromJSON(object: any): FinishMigrationRequest;
143
+ toJSON(message: FinishMigrationRequest): unknown;
137
144
  create(base?: DeepPartial<FinishMigrationRequest>): FinishMigrationRequest;
138
- fromPartial(_: DeepPartial<FinishMigrationRequest>): FinishMigrationRequest;
145
+ fromPartial(object: DeepPartial<FinishMigrationRequest>): FinishMigrationRequest;
146
+ };
147
+ export declare const FinishMigrationRequest_StatusEntry: {
148
+ encode(message: FinishMigrationRequest_StatusEntry, writer?: _m0.Writer): _m0.Writer;
149
+ decode(input: _m0.Reader | Uint8Array, length?: number): FinishMigrationRequest_StatusEntry;
150
+ fromJSON(object: any): FinishMigrationRequest_StatusEntry;
151
+ toJSON(message: FinishMigrationRequest_StatusEntry): unknown;
152
+ create(base?: DeepPartial<FinishMigrationRequest_StatusEntry>): FinishMigrationRequest_StatusEntry;
153
+ fromPartial(object: DeepPartial<FinishMigrationRequest_StatusEntry>): FinishMigrationRequest_StatusEntry;
139
154
  };
140
155
  export declare const FinishMigrationResponse: {
141
156
  encode(_: FinishMigrationResponse, writer?: _m0.Writer): _m0.Writer;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GetMigrationStatusResponse = exports.GetMigrationStatusRequest = exports.RollbackMigrationResponse = exports.RollbackMigrationRequest = exports.FinishMigrationResponse = exports.FinishMigrationRequest = exports.RegisterMigrationResponse = exports.RegisterMigrationRequest = exports.TypeArgument = exports.TypeDirective = exports.TypeField = exports.NestedType = exports.CrudType = exports.ProjectionType = exports.EnumType = exports.protobufPackage = void 0;
6
+ exports.GetMigrationStatusResponse = exports.GetMigrationStatusRequest = exports.RollbackMigrationResponse = exports.RollbackMigrationRequest = exports.FinishMigrationResponse = exports.FinishMigrationRequest_StatusEntry = exports.FinishMigrationRequest = exports.RegisterMigrationResponse = exports.RegisterMigrationRequest = exports.TypeArgument = exports.TypeDirective = exports.TypeField = exports.NestedType = exports.CrudType = exports.ProjectionType = exports.EnumType = exports.protobufPackage = void 0;
7
+ const long_1 = __importDefault(require("long"));
7
8
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
8
9
  exports.protobufPackage = "freym.projections.management";
9
10
  function createBaseEnumType() {
@@ -689,10 +690,13 @@ exports.RegisterMigrationResponse = {
689
690
  },
690
691
  };
691
692
  function createBaseFinishMigrationRequest() {
692
- return {};
693
+ return { status: {} };
693
694
  }
694
695
  exports.FinishMigrationRequest = {
695
- encode(_, writer = minimal_1.default.Writer.create()) {
696
+ encode(message, writer = minimal_1.default.Writer.create()) {
697
+ Object.entries(message.status).forEach(([key, value]) => {
698
+ exports.FinishMigrationRequest_StatusEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
699
+ });
696
700
  return writer;
697
701
  },
698
702
  decode(input, length) {
@@ -702,6 +706,15 @@ exports.FinishMigrationRequest = {
702
706
  while (reader.pos < end) {
703
707
  const tag = reader.uint32();
704
708
  switch (tag >>> 3) {
709
+ case 1:
710
+ if (tag !== 10) {
711
+ break;
712
+ }
713
+ const entry1 = exports.FinishMigrationRequest_StatusEntry.decode(reader, reader.uint32());
714
+ if (entry1.value !== undefined) {
715
+ message.status[entry1.key] = entry1.value;
716
+ }
717
+ continue;
705
718
  }
706
719
  if ((tag & 7) === 4 || tag === 0) {
707
720
  break;
@@ -710,18 +723,105 @@ exports.FinishMigrationRequest = {
710
723
  }
711
724
  return message;
712
725
  },
713
- fromJSON(_) {
714
- return {};
726
+ fromJSON(object) {
727
+ return {
728
+ status: isObject(object.status)
729
+ ? Object.entries(object.status).reduce((acc, [key, value]) => {
730
+ acc[key] = Number(value);
731
+ return acc;
732
+ }, {})
733
+ : {},
734
+ };
715
735
  },
716
- toJSON(_) {
736
+ toJSON(message) {
717
737
  const obj = {};
738
+ if (message.status) {
739
+ const entries = Object.entries(message.status);
740
+ if (entries.length > 0) {
741
+ obj.status = {};
742
+ entries.forEach(([k, v]) => {
743
+ obj.status[k] = Math.round(v);
744
+ });
745
+ }
746
+ }
718
747
  return obj;
719
748
  },
720
749
  create(base) {
721
750
  return exports.FinishMigrationRequest.fromPartial(base !== null && base !== void 0 ? base : {});
722
751
  },
723
- fromPartial(_) {
752
+ fromPartial(object) {
753
+ var _a;
724
754
  const message = createBaseFinishMigrationRequest();
755
+ message.status = Object.entries((_a = object.status) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
756
+ if (value !== undefined) {
757
+ acc[key] = Number(value);
758
+ }
759
+ return acc;
760
+ }, {});
761
+ return message;
762
+ },
763
+ };
764
+ function createBaseFinishMigrationRequest_StatusEntry() {
765
+ return { key: "", value: 0 };
766
+ }
767
+ exports.FinishMigrationRequest_StatusEntry = {
768
+ encode(message, writer = minimal_1.default.Writer.create()) {
769
+ if (message.key !== "") {
770
+ writer.uint32(10).string(message.key);
771
+ }
772
+ if (message.value !== 0) {
773
+ writer.uint32(16).int64(message.value);
774
+ }
775
+ return writer;
776
+ },
777
+ decode(input, length) {
778
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
779
+ let end = length === undefined ? reader.len : reader.pos + length;
780
+ const message = createBaseFinishMigrationRequest_StatusEntry();
781
+ while (reader.pos < end) {
782
+ const tag = reader.uint32();
783
+ switch (tag >>> 3) {
784
+ case 1:
785
+ if (tag !== 10) {
786
+ break;
787
+ }
788
+ message.key = reader.string();
789
+ continue;
790
+ case 2:
791
+ if (tag !== 16) {
792
+ break;
793
+ }
794
+ message.value = longToNumber(reader.int64());
795
+ continue;
796
+ }
797
+ if ((tag & 7) === 4 || tag === 0) {
798
+ break;
799
+ }
800
+ reader.skipType(tag & 7);
801
+ }
802
+ return message;
803
+ },
804
+ fromJSON(object) {
805
+ return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? Number(object.value) : 0 };
806
+ },
807
+ toJSON(message) {
808
+ const obj = {};
809
+ if (message.key !== "") {
810
+ obj.key = message.key;
811
+ }
812
+ if (message.value !== 0) {
813
+ obj.value = Math.round(message.value);
814
+ }
815
+ return obj;
816
+ },
817
+ create(base) {
818
+ return exports.FinishMigrationRequest_StatusEntry.fromPartial(base !== null && base !== void 0 ? base : {});
819
+ },
820
+ fromPartial(object) {
821
+ var _a, _b;
822
+ const message = createBaseFinishMigrationRequest_StatusEntry();
823
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
824
+ message.value = (_b = object.value) !== null && _b !== void 0 ? _b : 0;
725
825
  return message;
726
826
  },
727
827
  };
@@ -968,6 +1068,34 @@ exports.GetMigrationStatusResponse = {
968
1068
  return message;
969
1069
  },
970
1070
  };
1071
+ const tsProtoGlobalThis = (() => {
1072
+ if (typeof globalThis !== "undefined") {
1073
+ return globalThis;
1074
+ }
1075
+ if (typeof self !== "undefined") {
1076
+ return self;
1077
+ }
1078
+ if (typeof window !== "undefined") {
1079
+ return window;
1080
+ }
1081
+ if (typeof global !== "undefined") {
1082
+ return global;
1083
+ }
1084
+ throw "Unable to locate global object";
1085
+ })();
1086
+ function longToNumber(long) {
1087
+ if (long.gt(Number.MAX_SAFE_INTEGER)) {
1088
+ throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1089
+ }
1090
+ return long.toNumber();
1091
+ }
1092
+ if (minimal_1.default.util.Long !== long_1.default) {
1093
+ minimal_1.default.util.Long = long_1.default;
1094
+ minimal_1.default.configure();
1095
+ }
1096
+ function isObject(value) {
1097
+ return typeof value === "object" && value !== null;
1098
+ }
971
1099
  function isSet(value) {
972
1100
  return value !== null && value !== undefined;
973
1101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fraym/proto",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/fraym/proto",
6
6
  "repository": {