gomtm 0.0.43 → 0.0.45

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.
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { Any, FieldOptions, Message, MessageOptions, MethodOptions, proto3 } from "@bufbuild/protobuf";
7
+ import { Any, FieldMask, FieldOptions, Message, MessageOptions, MethodOptions, proto3 } from "@bufbuild/protobuf";
8
8
  var ErrorReason = /* @__PURE__ */ ((ErrorReason2) => {
9
9
  ErrorReason2[ErrorReason2["GREETER_UNSPECIFIED"] = 0] = "GREETER_UNSPECIFIED";
10
10
  ErrorReason2[ErrorReason2["USER_NOT_FOUND"] = 1] = "USER_NOT_FOUND";
@@ -450,56 +450,56 @@ __publicField(_LoginReq, "fields", proto3.util.newFieldList(() => [
450
450
  }
451
451
  ]));
452
452
  let LoginReq = _LoginReq;
453
- const _Error = class _Error extends Message {
453
+ const _MtmError = class _MtmError extends Message {
454
454
  constructor(data) {
455
455
  super();
456
456
  /**
457
- * @generated from field: string code = 1;
457
+ * @generated from field: string err_code = 1;
458
458
  */
459
- __publicField(this, "code", "");
459
+ __publicField(this, "errCode", "");
460
460
  /**
461
- * @generated from field: string Message = 2;
461
+ * @generated from field: string err_message = 2;
462
462
  */
463
- __publicField(this, "Message", "");
463
+ __publicField(this, "errMessage", "");
464
464
  proto3.util.initPartial(data, this);
465
465
  }
466
466
  static fromBinary(bytes, options) {
467
- return new _Error().fromBinary(bytes, options);
467
+ return new _MtmError().fromBinary(bytes, options);
468
468
  }
469
469
  static fromJson(jsonValue, options) {
470
- return new _Error().fromJson(jsonValue, options);
470
+ return new _MtmError().fromJson(jsonValue, options);
471
471
  }
472
472
  static fromJsonString(jsonString, options) {
473
- return new _Error().fromJsonString(jsonString, options);
473
+ return new _MtmError().fromJsonString(jsonString, options);
474
474
  }
475
475
  static equals(a, b) {
476
- return proto3.util.equals(_Error, a, b);
476
+ return proto3.util.equals(_MtmError, a, b);
477
477
  }
478
478
  };
479
- __publicField(_Error, "runtime", proto3);
480
- __publicField(_Error, "typeName", "sppb.Error");
481
- __publicField(_Error, "fields", proto3.util.newFieldList(() => [
479
+ __publicField(_MtmError, "runtime", proto3);
480
+ __publicField(_MtmError, "typeName", "sppb.MtmError");
481
+ __publicField(_MtmError, "fields", proto3.util.newFieldList(() => [
482
482
  {
483
483
  no: 1,
484
- name: "code",
484
+ name: "err_code",
485
485
  kind: "scalar",
486
486
  T: 9
487
487
  /* ScalarType.STRING */
488
488
  },
489
489
  {
490
490
  no: 2,
491
- name: "Message",
491
+ name: "err_message",
492
492
  kind: "scalar",
493
493
  T: 9
494
494
  /* ScalarType.STRING */
495
495
  }
496
496
  ]));
497
- let Error2 = _Error;
497
+ let MtmError = _MtmError;
498
498
  const _LoginReply = class _LoginReply extends Message {
499
499
  constructor(data) {
500
500
  super();
501
501
  /**
502
- * @generated from field: sppb.Error error = 1;
502
+ * @generated from field: optional sppb.MtmError error = 1;
503
503
  */
504
504
  __publicField(this, "error");
505
505
  /**
@@ -524,7 +524,7 @@ const _LoginReply = class _LoginReply extends Message {
524
524
  __publicField(_LoginReply, "runtime", proto3);
525
525
  __publicField(_LoginReply, "typeName", "sppb.LoginReply");
526
526
  __publicField(_LoginReply, "fields", proto3.util.newFieldList(() => [
527
- { no: 1, name: "error", kind: "message", T: Error2 },
527
+ { no: 1, name: "error", kind: "message", T: MtmError, opt: true },
528
528
  {
529
529
  no: 2,
530
530
  name: "access_token",
@@ -534,40 +534,6 @@ __publicField(_LoginReply, "fields", proto3.util.newFieldList(() => [
534
534
  }
535
535
  ]));
536
536
  let LoginReply = _LoginReply;
537
- const _MeReq = class _MeReq extends Message {
538
- constructor(data) {
539
- super();
540
- /**
541
- * @generated from field: string token = 1;
542
- */
543
- __publicField(this, "token", "");
544
- proto3.util.initPartial(data, this);
545
- }
546
- static fromBinary(bytes, options) {
547
- return new _MeReq().fromBinary(bytes, options);
548
- }
549
- static fromJson(jsonValue, options) {
550
- return new _MeReq().fromJson(jsonValue, options);
551
- }
552
- static fromJsonString(jsonString, options) {
553
- return new _MeReq().fromJsonString(jsonString, options);
554
- }
555
- static equals(a, b) {
556
- return proto3.util.equals(_MeReq, a, b);
557
- }
558
- };
559
- __publicField(_MeReq, "runtime", proto3);
560
- __publicField(_MeReq, "typeName", "sppb.MeReq");
561
- __publicField(_MeReq, "fields", proto3.util.newFieldList(() => [
562
- {
563
- no: 1,
564
- name: "token",
565
- kind: "scalar",
566
- T: 9
567
- /* ScalarType.STRING */
568
- }
569
- ]));
570
- let MeReq = _MeReq;
571
537
  const _User = class _User extends Message {
572
538
  constructor(data) {
573
539
  super();
@@ -3530,28 +3496,6 @@ __publicField(_UserNavItem, "fields", proto3.util.newFieldList(() => [
3530
3496
  }
3531
3497
  ]));
3532
3498
  let UserNavItem = _UserNavItem;
3533
- const _UserinfoReq = class _UserinfoReq extends Message {
3534
- constructor(data) {
3535
- super();
3536
- proto3.util.initPartial(data, this);
3537
- }
3538
- static fromBinary(bytes, options) {
3539
- return new _UserinfoReq().fromBinary(bytes, options);
3540
- }
3541
- static fromJson(jsonValue, options) {
3542
- return new _UserinfoReq().fromJson(jsonValue, options);
3543
- }
3544
- static fromJsonString(jsonString, options) {
3545
- return new _UserinfoReq().fromJsonString(jsonString, options);
3546
- }
3547
- static equals(a, b) {
3548
- return proto3.util.equals(_UserinfoReq, a, b);
3549
- }
3550
- };
3551
- __publicField(_UserinfoReq, "runtime", proto3);
3552
- __publicField(_UserinfoReq, "typeName", "sppb.UserinfoReq");
3553
- __publicField(_UserinfoReq, "fields", proto3.util.newFieldList(() => []));
3554
- let UserinfoReq = _UserinfoReq;
3555
3499
  const _UserinfoRes = class _UserinfoRes extends Message {
3556
3500
  constructor(data) {
3557
3501
  super();
@@ -4399,152 +4343,6 @@ __publicField(_BlogTagUpdateReq, "fields", proto3.util.newFieldList(() => [
4399
4343
  }
4400
4344
  ]));
4401
4345
  let BlogTagUpdateReq = _BlogTagUpdateReq;
4402
- const _BlogHostGetReq = class _BlogHostGetReq extends Message {
4403
- constructor(data) {
4404
- super();
4405
- /**
4406
- * @generated from field: uint32 id = 1;
4407
- */
4408
- __publicField(this, "id", 0);
4409
- proto3.util.initPartial(data, this);
4410
- }
4411
- static fromBinary(bytes, options) {
4412
- return new _BlogHostGetReq().fromBinary(bytes, options);
4413
- }
4414
- static fromJson(jsonValue, options) {
4415
- return new _BlogHostGetReq().fromJson(jsonValue, options);
4416
- }
4417
- static fromJsonString(jsonString, options) {
4418
- return new _BlogHostGetReq().fromJsonString(jsonString, options);
4419
- }
4420
- static equals(a, b) {
4421
- return proto3.util.equals(_BlogHostGetReq, a, b);
4422
- }
4423
- };
4424
- __publicField(_BlogHostGetReq, "runtime", proto3);
4425
- __publicField(_BlogHostGetReq, "typeName", "sppb.BlogHostGetReq");
4426
- __publicField(_BlogHostGetReq, "fields", proto3.util.newFieldList(() => [
4427
- {
4428
- no: 1,
4429
- name: "id",
4430
- kind: "scalar",
4431
- T: 13
4432
- /* ScalarType.UINT32 */
4433
- }
4434
- ]));
4435
- let BlogHostGetReq = _BlogHostGetReq;
4436
- const _BlogHostCreateReq = class _BlogHostCreateReq extends Message {
4437
- constructor(data) {
4438
- super();
4439
- /**
4440
- * @generated from field: uint32 id = 1;
4441
- */
4442
- __publicField(this, "id", 0);
4443
- /**
4444
- * @generated from field: string host = 2;
4445
- */
4446
- __publicField(this, "host", "");
4447
- /**
4448
- * @generated from field: uint32 site_id = 3;
4449
- */
4450
- __publicField(this, "siteId", 0);
4451
- proto3.util.initPartial(data, this);
4452
- }
4453
- static fromBinary(bytes, options) {
4454
- return new _BlogHostCreateReq().fromBinary(bytes, options);
4455
- }
4456
- static fromJson(jsonValue, options) {
4457
- return new _BlogHostCreateReq().fromJson(jsonValue, options);
4458
- }
4459
- static fromJsonString(jsonString, options) {
4460
- return new _BlogHostCreateReq().fromJsonString(jsonString, options);
4461
- }
4462
- static equals(a, b) {
4463
- return proto3.util.equals(_BlogHostCreateReq, a, b);
4464
- }
4465
- };
4466
- __publicField(_BlogHostCreateReq, "runtime", proto3);
4467
- __publicField(_BlogHostCreateReq, "typeName", "sppb.BlogHostCreateReq");
4468
- __publicField(_BlogHostCreateReq, "fields", proto3.util.newFieldList(() => [
4469
- {
4470
- no: 1,
4471
- name: "id",
4472
- kind: "scalar",
4473
- T: 13
4474
- /* ScalarType.UINT32 */
4475
- },
4476
- {
4477
- no: 2,
4478
- name: "host",
4479
- kind: "scalar",
4480
- T: 9
4481
- /* ScalarType.STRING */
4482
- },
4483
- {
4484
- no: 3,
4485
- name: "site_id",
4486
- kind: "scalar",
4487
- T: 13
4488
- /* ScalarType.UINT32 */
4489
- }
4490
- ]));
4491
- let BlogHostCreateReq = _BlogHostCreateReq;
4492
- const _BlogHostUpdateReq = class _BlogHostUpdateReq extends Message {
4493
- constructor(data) {
4494
- super();
4495
- /**
4496
- * @generated from field: uint32 id = 1;
4497
- */
4498
- __publicField(this, "id", 0);
4499
- /**
4500
- * @generated from field: string title = 2;
4501
- */
4502
- __publicField(this, "title", "");
4503
- /**
4504
- * @generated from field: uint32 site_id = 3;
4505
- */
4506
- __publicField(this, "siteId", 0);
4507
- proto3.util.initPartial(data, this);
4508
- }
4509
- static fromBinary(bytes, options) {
4510
- return new _BlogHostUpdateReq().fromBinary(bytes, options);
4511
- }
4512
- static fromJson(jsonValue, options) {
4513
- return new _BlogHostUpdateReq().fromJson(jsonValue, options);
4514
- }
4515
- static fromJsonString(jsonString, options) {
4516
- return new _BlogHostUpdateReq().fromJsonString(jsonString, options);
4517
- }
4518
- static equals(a, b) {
4519
- return proto3.util.equals(_BlogHostUpdateReq, a, b);
4520
- }
4521
- };
4522
- __publicField(_BlogHostUpdateReq, "runtime", proto3);
4523
- __publicField(_BlogHostUpdateReq, "typeName", "sppb.BlogHostUpdateReq");
4524
- __publicField(_BlogHostUpdateReq, "fields", proto3.util.newFieldList(() => [
4525
- {
4526
- no: 1,
4527
- name: "id",
4528
- kind: "scalar",
4529
- T: 13
4530
- /* ScalarType.UINT32 */
4531
- },
4532
- {
4533
- no: 2,
4534
- name: "title",
4535
- kind: "scalar",
4536
- T: 9
4537
- /* ScalarType.STRING */
4538
- },
4539
- {
4540
- no: 3,
4541
- name: "site_id",
4542
- kind: "scalar",
4543
- T: 13
4544
- /* ScalarType.UINT32 */
4545
- }
4546
- ]));
4547
- let BlogHostUpdateReq = _BlogHostUpdateReq;
4548
4346
  const _BlogPostMeta = class _BlogPostMeta extends Message {
4549
4347
  constructor(data) {
4550
4348
  super();
@@ -7474,6 +7272,73 @@ __publicField(_FormGetReq, "fields", proto3.util.newFieldList(() => [
7474
7272
  }
7475
7273
  ]));
7476
7274
  let FormGetReq = _FormGetReq;
7275
+ const _DemoGetProductionRequest = class _DemoGetProductionRequest extends Message {
7276
+ constructor(data) {
7277
+ super();
7278
+ /**
7279
+ * @generated from field: string production_id = 1;
7280
+ */
7281
+ __publicField(this, "productionId", "");
7282
+ /**
7283
+ * @generated from field: google.protobuf.FieldMask field_mask = 2;
7284
+ */
7285
+ __publicField(this, "fieldMask");
7286
+ proto3.util.initPartial(data, this);
7287
+ }
7288
+ static fromBinary(bytes, options) {
7289
+ return new _DemoGetProductionRequest().fromBinary(bytes, options);
7290
+ }
7291
+ static fromJson(jsonValue, options) {
7292
+ return new _DemoGetProductionRequest().fromJson(jsonValue, options);
7293
+ }
7294
+ static fromJsonString(jsonString, options) {
7295
+ return new _DemoGetProductionRequest().fromJsonString(jsonString, options);
7296
+ }
7297
+ static equals(a, b) {
7298
+ return proto3.util.equals(_DemoGetProductionRequest, a, b);
7299
+ }
7300
+ };
7301
+ __publicField(_DemoGetProductionRequest, "runtime", proto3);
7302
+ __publicField(_DemoGetProductionRequest, "typeName", "sppb.DemoGetProductionRequest");
7303
+ __publicField(_DemoGetProductionRequest, "fields", proto3.util.newFieldList(() => [
7304
+ {
7305
+ no: 1,
7306
+ name: "production_id",
7307
+ kind: "scalar",
7308
+ T: 9
7309
+ /* ScalarType.STRING */
7310
+ },
7311
+ { no: 2, name: "field_mask", kind: "message", T: FieldMask }
7312
+ ]));
7313
+ let DemoGetProductionRequest = _DemoGetProductionRequest;
7314
+ const _FormCreateReq = class _FormCreateReq extends Message {
7315
+ constructor(data) {
7316
+ super();
7317
+ /**
7318
+ * @generated from field: sppb.FormSchema input = 1;
7319
+ */
7320
+ __publicField(this, "input");
7321
+ proto3.util.initPartial(data, this);
7322
+ }
7323
+ static fromBinary(bytes, options) {
7324
+ return new _FormCreateReq().fromBinary(bytes, options);
7325
+ }
7326
+ static fromJson(jsonValue, options) {
7327
+ return new _FormCreateReq().fromJson(jsonValue, options);
7328
+ }
7329
+ static fromJsonString(jsonString, options) {
7330
+ return new _FormCreateReq().fromJsonString(jsonString, options);
7331
+ }
7332
+ static equals(a, b) {
7333
+ return proto3.util.equals(_FormCreateReq, a, b);
7334
+ }
7335
+ };
7336
+ __publicField(_FormCreateReq, "runtime", proto3);
7337
+ __publicField(_FormCreateReq, "typeName", "sppb.FormCreateReq");
7338
+ __publicField(_FormCreateReq, "fields", proto3.util.newFieldList(() => [
7339
+ { no: 1, name: "input", kind: "message", T: FormSchema }
7340
+ ]));
7341
+ let FormCreateReq = _FormCreateReq;
7477
7342
  const slugs = proto3.makeExtension(
7478
7343
  "sppb.slugs",
7479
7344
  FieldOptions,
@@ -7540,9 +7405,6 @@ export {
7540
7405
  BlogCategorieUpdateReq,
7541
7406
  BlogCategorieUpdateReqply,
7542
7407
  BlogCleanReq,
7543
- BlogHostCreateReq,
7544
- BlogHostGetReq,
7545
- BlogHostUpdateReq,
7546
7408
  BlogNavItem,
7547
7409
  BlogPost,
7548
7410
  BlogPostCreateReq,
@@ -7569,15 +7431,16 @@ export {
7569
7431
  CurdViewGetReq,
7570
7432
  CurdViewGetRes,
7571
7433
  CurdViewUpdateReq,
7434
+ DemoGetProductionRequest,
7572
7435
  DevInitConfig,
7573
7436
  DomainCollResult,
7574
7437
  Empty,
7575
- Error2 as Error,
7576
7438
  ErrorReason,
7577
7439
  ErrorRes,
7578
7440
  EventSpSiteScreenshotOk,
7579
7441
  EventSpSiteVisit,
7580
7442
  FieldMarks,
7443
+ FormCreateReq,
7581
7444
  FormGetReq,
7582
7445
  FormSchema,
7583
7446
  FormSchemsField,
@@ -7595,8 +7458,8 @@ export {
7595
7458
  LogLine,
7596
7459
  LoginReply,
7597
7460
  LoginReq,
7598
- MeReq,
7599
7461
  MtDate,
7462
+ MtmError,
7600
7463
  MtmMeta,
7601
7464
  MtmServer,
7602
7465
  MtmServerListReq,
@@ -7664,7 +7527,6 @@ export {
7664
7527
  UserNav,
7665
7528
  UserNavItem,
7666
7529
  UserUpdateReq,
7667
- UserinfoReq,
7668
7530
  UserinfoRes,
7669
7531
  event_name,
7670
7532
  is_sub_title,
@@ -1,5 +1,6 @@
1
1
  import { Message, PartialMessage, ServiceType } from "@bufbuild/protobuf";
2
- import { MtUnaryCallError } from "./connectquery/utils";
2
+ import { PlainMessage } from ".";
3
+ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
3
4
  import { ExtInfo } from "./mtmcore";
4
5
  type CustomRequestInit = RequestInit & {
5
6
  enableCache?: boolean;
@@ -9,5 +10,5 @@ export declare const newMtmFetch: (extInfo: ExtInfo, initGlobal?: CustomRequestI
9
10
  export declare function getMtmApiUrl(backendUrl: string): string;
10
11
  export declare function createMtConnectTransport(backendUrl: string, extInfo: ExtInfo): import("@connectrpc/connect").Transport;
11
12
  export declare function createClient<T extends ServiceType>(extInfo: ExtInfo, svc: T, options: CustomRequestInit): import("@connectrpc/connect").PromiseClient<T>;
12
- export declare function mtmCallUnaryMethod<I extends Message<I>, O extends Message<O>>(extInfo: ExtInfo, svc: string, method: string, input?: PartialMessage<I> | undefined): Promise<O | MtUnaryCallError>;
13
+ export declare function mtmCallUnaryMethod<I extends Message<I>, O extends Message<O>>(extInfo: ExtInfo, svc: string, method: string, input?: PartialMessage<I> | undefined): Promise<O | PlainMessage<MtmError>>;
13
14
  export {};
@@ -38,6 +38,7 @@ import { createPromiseClient } from "@connectrpc/connect";
38
38
  import { createConnectTransport } from "@connectrpc/connect-web";
39
39
  import { camelCase, merge } from "lodash";
40
40
  import { HeaderMtmHost } from "./consts";
41
+ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
41
42
  import { fetchMiddleWithCache } from "./http/fetchMiddleWithCache";
42
43
  import { GetMtmServiceByTypeName, anypbTypeReg } from "./messageTypeRegistry";
43
44
  import { extGetMemBackend, extGetSitehost, extGetToken } from "./mtmcore";
@@ -71,8 +72,8 @@ const newMtmFetch = (extInfo, initGlobal) => {
71
72
  } catch (e) {
72
73
  console.error("mtmfetch error", e);
73
74
  const errorRsp = {
74
- error_code: "-1",
75
- error_message: (e == null ? void 0 : e.toString()) || "unknow error"
75
+ errCode: "-1",
76
+ errMessage: (e == null ? void 0 : e.toString()) || "unknow error"
76
77
  };
77
78
  const errorResponse = new Response(JSON.stringify(errorRsp), {
78
79
  status: 200,
@@ -119,10 +120,10 @@ function mtmCallUnaryMethod(extInfo, svc, method, input) {
119
120
  });
120
121
  const fn = client[methodName];
121
122
  if (!fn) {
122
- return {
123
- error_code: "-2",
124
- error_message: `missing method ${svc}.${methodName}`
125
- };
123
+ return new MtmError({
124
+ errCode: "-2",
125
+ errMessage: `missing method ${svc}.${methodName}`
126
+ });
126
127
  }
127
128
  try {
128
129
  const result = yield client[methodName](input);
@@ -130,8 +131,8 @@ function mtmCallUnaryMethod(extInfo, svc, method, input) {
130
131
  } catch (e) {
131
132
  console.error("[mtmCallUnaryMethod error]", e.stack);
132
133
  const errorRsp = {
133
- error_code: "-2",
134
- error_message: (e == null ? void 0 : e.toString()) || "unknow error"
134
+ errCode: "-2",
135
+ errMessage: (e == null ? void 0 : e.toString()) || "unknow error"
135
136
  };
136
137
  return errorRsp;
137
138
  }
@@ -1,8 +1,9 @@
1
1
  import { InfiniteData, UseMutationResult, UseSuspenseInfiniteQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
- import { MtUnaryCallError } from "./connectquery/utils";
2
+ import { Message, PlainMessage } from ".";
3
+ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
3
4
  export type * from '@tanstack/react-query';
4
5
  export declare function createQueryKey(svc: string, method: string, input?: any): any[];
5
6
  export declare function createInfiniteQueryKey(svc: string, method: string, input?: any): any[];
6
- export declare function useMtmSuspenseQuery<T = any>(serviceName: string, methodName: string, input?: any): UseSuspenseQueryResult<any>;
7
- export declare function useMtmSuspenseInfiniteQuery<T = any>(serviceName: string, methodName: string, input?: any): UseSuspenseInfiniteQueryResult<InfiniteData<T & MtUnaryCallError>, MtUnaryCallError>;
7
+ export declare function useMtmSuspenseQuery<T extends Message<T>>(serviceName: string, methodName: string, input?: any): UseSuspenseQueryResult<T>;
8
+ export declare function useMtmSuspenseInfiniteQuery<T extends Message<T>>(serviceName: string, methodName: string, input?: any): UseSuspenseInfiniteQueryResult<InfiniteData<T & PlainMessage<MtmError>>, PlainMessage<MtmError>>;
8
9
  export declare function useMtmMutation(serviceName: string, methodName: string): UseMutationResult<any>;
@@ -36,7 +36,8 @@ function useMtmSuspenseQuery(serviceName, methodName, input) {
36
36
  queryKey: createQueryKey(serviceName, methodName, input),
37
37
  queryFn: (k) => __async(this, null, function* () {
38
38
  const result = yield mtmCallUnaryMethod(extInfo, serviceName, methodName, input || {});
39
- return toPlainMessage(result);
39
+ const a = result;
40
+ return toPlainMessage(a);
40
41
  })
41
42
  });
42
43
  }
@@ -46,7 +47,8 @@ function useMtmSuspenseInfiniteQuery(serviceName, methodName, input) {
46
47
  queryKey: createInfiniteQueryKey(serviceName, methodName, input),
47
48
  queryFn: (k) => __async(this, null, function* () {
48
49
  const result = yield mtmCallUnaryMethod(extInfo, serviceName, methodName, input || {});
49
- return toPlainMessage(result);
50
+ const a = result;
51
+ return toPlainMessage(a);
50
52
  }),
51
53
  initialPageParam: {
52
54
  page: ""