@milaboratories/pl-client 2.7.13 → 2.7.14

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.
Files changed (116) hide show
  1. package/dist/core/auth.d.ts.map +1 -1
  2. package/dist/core/cache.d.ts.map +1 -1
  3. package/dist/core/client.d.ts +1 -1
  4. package/dist/core/client.d.ts.map +1 -1
  5. package/dist/core/default_client.d.ts.map +1 -1
  6. package/dist/core/driver.d.ts.map +1 -1
  7. package/dist/core/errors.d.ts.map +1 -1
  8. package/dist/core/final.d.ts.map +1 -1
  9. package/dist/core/ll_client.d.ts.map +1 -1
  10. package/dist/core/ll_transaction.d.ts.map +1 -1
  11. package/dist/core/transaction.d.ts +1 -1
  12. package/dist/core/transaction.d.ts.map +1 -1
  13. package/dist/core/type_conversion.d.ts.map +1 -1
  14. package/dist/core/types.d.ts +1 -1
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/unauth_client.d.ts.map +1 -1
  17. package/dist/helpers/pl.d.ts.map +1 -1
  18. package/dist/helpers/poll.d.ts.map +1 -1
  19. package/dist/helpers/state_helpers.d.ts.map +1 -1
  20. package/dist/helpers/tx_helpers.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +4069 -4075
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +15 -15
  26. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -1
  27. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +4 -4
  28. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -1
  29. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +16 -16
  30. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -1
  31. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +4 -4
  32. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -1
  33. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +59 -59
  34. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -1
  35. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +8 -8
  36. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -1
  37. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +22 -22
  38. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -1
  39. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +72 -72
  40. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -1
  41. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +152 -152
  42. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -1
  43. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +156 -156
  44. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
  45. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +773 -773
  46. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  47. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +163 -163
  48. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -1
  49. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +22 -22
  50. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -1
  51. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +32 -32
  52. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -1
  53. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +78 -78
  54. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -1
  55. package/dist/proto/google/api/http.d.ts +89 -89
  56. package/dist/proto/google/api/http.d.ts.map +1 -1
  57. package/dist/proto/google/protobuf/any.d.ts +52 -52
  58. package/dist/proto/google/protobuf/any.d.ts.map +1 -1
  59. package/dist/proto/google/protobuf/descriptor.d.ts +1151 -1151
  60. package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
  61. package/dist/proto/google/protobuf/duration.d.ts +19 -19
  62. package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
  63. package/dist/proto/google/protobuf/empty.d.ts.map +1 -1
  64. package/dist/proto/google/protobuf/struct.d.ts +56 -56
  65. package/dist/proto/google/protobuf/struct.d.ts.map +1 -1
  66. package/dist/proto/google/protobuf/timestamp.d.ts +25 -25
  67. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
  68. package/dist/proto/google/protobuf/wrappers.d.ts +72 -72
  69. package/dist/proto/google/protobuf/wrappers.d.ts.map +1 -1
  70. package/dist/test/test_config.d.ts.map +1 -1
  71. package/dist/util/util.d.ts.map +1 -1
  72. package/package.json +7 -3
  73. package/src/core/auth.ts +3 -3
  74. package/src/core/cache.ts +1 -1
  75. package/src/core/client.ts +39 -31
  76. package/src/core/config.ts +21 -21
  77. package/src/core/default_client.ts +15 -14
  78. package/src/core/driver.ts +4 -4
  79. package/src/core/errors.ts +3 -3
  80. package/src/core/final.ts +7 -4
  81. package/src/core/ll_client.ts +31 -27
  82. package/src/core/ll_transaction.ts +17 -17
  83. package/src/core/stat.ts +2 -2
  84. package/src/core/transaction.ts +93 -95
  85. package/src/core/type_conversion.ts +11 -8
  86. package/src/core/types.ts +25 -26
  87. package/src/core/unauth_client.ts +6 -6
  88. package/src/helpers/pl.ts +8 -7
  89. package/src/helpers/poll.ts +25 -21
  90. package/src/helpers/state_helpers.ts +2 -1
  91. package/src/helpers/tx_helpers.ts +4 -3
  92. package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +74 -71
  93. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +21 -20
  94. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +240 -225
  95. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +21 -20
  96. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +290 -275
  97. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +32 -30
  98. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +388 -364
  99. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +58 -53
  100. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +490 -469
  101. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +262 -237
  102. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +11751 -11032
  103. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1155 -1114
  104. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +131 -125
  105. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +203 -200
  106. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +559 -540
  107. package/src/proto/google/api/http.ts +280 -271
  108. package/src/proto/google/protobuf/any.ts +149 -139
  109. package/src/proto/google/protobuf/descriptor.ts +2952 -2853
  110. package/src/proto/google/protobuf/duration.ts +107 -102
  111. package/src/proto/google/protobuf/empty.ts +41 -38
  112. package/src/proto/google/protobuf/struct.ts +336 -322
  113. package/src/proto/google/protobuf/timestamp.ts +131 -123
  114. package/src/proto/google/protobuf/wrappers.ts +536 -491
  115. package/src/test/test_config.ts +21 -19
  116. package/src/util/util.ts +1 -0
@@ -1,7 +1,7 @@
1
- import { AuthInformation, PlClientConfig } from './config';
2
- import {
1
+ import type { AuthInformation, PlClientConfig } from './config';
2
+ import type {
3
3
  AuthAPI_ListMethods_Response,
4
- MaintenanceAPI_Ping_Response
4
+ MaintenanceAPI_Ping_Response,
5
5
  } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';
6
6
  import { LLPlClient } from './ll_client';
7
7
  import { notEmpty } from '@milaboratories/ts-helpers';
@@ -33,9 +33,9 @@ export class UnauthenticatedPlClient {
33
33
  { expiration: { seconds: BigInt(this.ll.conf.authTTLSeconds), nanos: 0 } },
34
34
  {
35
35
  meta: {
36
- authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64')
37
- }
38
- }
36
+ authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64'),
37
+ },
38
+ },
39
39
  ).response;
40
40
  const jwtToken = notEmpty(response.token);
41
41
  if (jwtToken === '') throw new Error('empty token');
package/src/helpers/pl.ts CHANGED
@@ -7,8 +7,9 @@
7
7
  *
8
8
  */
9
9
 
10
- import { FutureFieldType, ResourceType } from '../core/types';
11
- import { AnyRef, field, FieldRef, PlTransaction, ResourceRef } from '../core/transaction';
10
+ import type { FutureFieldType, ResourceType } from '../core/types';
11
+ import type { AnyRef, FieldRef, PlTransaction, ResourceRef } from '../core/transaction';
12
+ import { field } from '../core/transaction';
12
13
 
13
14
  function rt(name: string, version: string): ResourceType {
14
15
  return { name, version };
@@ -69,14 +70,14 @@ export type PlRecord<Key extends string = string, Ref extends AnyRef = AnyRef> =
69
70
 
70
71
  export function plEntry<Key extends string = string, Ref extends AnyRef = AnyRef>(
71
72
  key: Key,
72
- ref: Ref
73
+ ref: Ref,
73
74
  ): PlRecordEntry<Key, Ref> {
74
75
  return [key, ref];
75
76
  }
76
77
 
77
78
  export function plEntries<Key extends string = string, Ref extends AnyRef = AnyRef>(
78
79
  record: PlRecord<Key, Ref>,
79
- fields?: Key[]
80
+ fields?: Key[],
80
81
  ): PlRecordEntry<Key, Ref>[] {
81
82
  return fields === undefined
82
83
  ? (Object.entries(record) as PlRecordEntry<Key, Ref>[])
@@ -88,7 +89,7 @@ export function createPlMap(
88
89
  tx: PlTransaction,
89
90
  entries: PlRecordEntry[] | PlRecord,
90
91
  ephemeral: boolean,
91
- type?: ResourceType
92
+ type?: ResourceType,
92
93
  ): ResourceRef {
93
94
  const actualType = type ?? (ephemeral ? EphStdMap : StdMap);
94
95
  const rId = ephemeral ? tx.createEphemeral(actualType) : tx.createStruct(actualType);
@@ -106,10 +107,10 @@ export function futureRecord<Key extends string>(
106
107
  rId: AnyRef,
107
108
  keys: Key[],
108
109
  fieldType: FutureFieldType,
109
- prefix: string = ''
110
+ prefix: string = '',
110
111
  ): PlRecord<Key, FieldRef> {
111
112
  return Object.fromEntries(
112
- keys.map((k) => plEntry(k, tx.getFutureFieldValue(rId, `${prefix}${k}`, fieldType)))
113
+ keys.map((k) => plEntry(k, tx.getFutureFieldValue(rId, `${prefix}${k}`, fieldType))),
113
114
  ) as PlRecord<Key, FieldRef>;
114
115
  }
115
116
 
@@ -1,20 +1,23 @@
1
- import { PlClient } from '../core/client';
1
+ import type { PlClient } from '../core/client';
2
+ import type {
3
+ RetryOptions,
4
+ } from '@milaboratories/ts-helpers';
2
5
  import {
3
6
  createRetryState,
4
7
  nextRetryStateOrError,
5
8
  notEmpty,
6
- RetryOptions
7
9
  } from '@milaboratories/ts-helpers';
8
- import {
10
+ import type {
9
11
  FieldData,
10
12
  FieldType,
13
+ ResourceData,
14
+ ResourceId } from '../core/types';
15
+ import {
11
16
  isNotNullResourceId,
12
17
  isNullResourceId,
13
- ResourceData,
14
- ResourceId,
15
- resourceIdToString
18
+ resourceIdToString,
16
19
  } from '../core/types';
17
- import { PlTransaction } from '../core/transaction';
20
+ import type { PlTransaction } from '../core/transaction';
18
21
  import * as tp from 'node:timers/promises';
19
22
 
20
23
  /** This error tells state assertion mechanism that required state is not yet ready */
@@ -31,14 +34,14 @@ export type PollFieldTraverseOps = {
31
34
 
32
35
  const DefaultPollFieldTraverseOps: PollFieldTraverseOps = {
33
36
  failOnError: true,
34
- onlyFinal: false
37
+ onlyFinal: false,
35
38
  };
36
39
 
37
40
  export class PollResourceAccessor {
38
41
  constructor(
39
42
  public readonly tx: PollTxAccessor,
40
43
  public readonly data: ResourceData,
41
- public readonly path: string[]
44
+ public readonly path: string[],
42
45
  ) {}
43
46
 
44
47
  public final(): PollResourceAccessor {
@@ -63,11 +66,12 @@ export class PollResourceAccessor {
63
66
  }
64
67
 
65
68
  if (
66
- ((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked) ||
67
- (expectedType === 'Output' && this.data.outputsLocked)
69
+ ((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked)
70
+ || (expectedType === 'Output' && this.data.outputsLocked)
68
71
  )
69
72
  throw new Error(
70
- `Field "${name}" not found. Expected type: ${expectedType}, state: ${this.data}`
73
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions
74
+ `Field "${name}" not found. Expected type: ${expectedType}, state: ${this.data}`,
71
75
  );
72
76
 
73
77
  throw new ContinuePolling();
@@ -75,9 +79,9 @@ export class PollResourceAccessor {
75
79
 
76
80
  public async get(
77
81
  name: string,
78
- ops: Partial<PollFieldTraverseOps> = {}
82
+ ops: Partial<PollFieldTraverseOps> = {},
79
83
  ): Promise<PollResourceAccessor> {
80
- const { expectedType, failOnError, onlyFinal } = { ...DefaultPollFieldTraverseOps, ...ops };
84
+ const { expectedType, failOnError } = { ...DefaultPollFieldTraverseOps, ...ops };
81
85
  const path = [...this.path, name];
82
86
 
83
87
  const fieldData = this.getFieldData(name, expectedType);
@@ -101,18 +105,18 @@ export class PollResourceAccessor {
101
105
  ...names: Key[]
102
106
  ): Promise<Record<Key, PollResourceAccessor>> {
103
107
  return Object.fromEntries(
104
- await Promise.all(names.map(async (name) => [name, await this.get(name, ops)]))
108
+ await Promise.all(names.map(async (name) => [name, await this.get(name, ops)])),
105
109
  );
106
110
  }
107
111
 
108
112
  public async getAllFinal(
109
- ops: Partial<PollFieldTraverseOps> = {}
113
+ ops: Partial<PollFieldTraverseOps> = {},
110
114
  ): Promise<Record<string, PollResourceAccessor>> {
111
115
  return await this.getMultiObj(
112
116
  ops,
113
117
  ...this.data.fields
114
118
  .filter((f) => f.valueIsFinal || isNotNullResourceId(f.error))
115
- .map((f) => f.name)
119
+ .map((f) => f.name),
116
120
  );
117
121
  }
118
122
 
@@ -133,7 +137,7 @@ export class PollTxAccessor {
133
137
  public async get(
134
138
  rid: ResourceId,
135
139
  failOnError: boolean = true,
136
- path: string[] = []
140
+ path: string[] = [],
137
141
  ): Promise<PollResourceAccessor> {
138
142
  const data = await this.tx.getResourceData(rid, true);
139
143
  const accessor = new PollResourceAccessor(this, data, [...path, resourceIdToString(rid)]);
@@ -143,7 +147,7 @@ export class PollTxAccessor {
143
147
 
144
148
  async throwError(error: ResourceId, path: string[] = []): Promise<never> {
145
149
  const errorRes = await this.get(error);
146
- let errorText = Buffer.from(notEmpty(errorRes.data.data)).toString();
150
+ const errorText = Buffer.from(notEmpty(errorRes.data.data)).toString();
147
151
  throw new Error(`${path.join(' -> ')} = ${errorText}`);
148
152
  }
149
153
  }
@@ -153,14 +157,14 @@ export const DefaultPollingRetryOptions: RetryOptions = {
153
157
  jitter: 0,
154
158
  maxAttempts: 100,
155
159
  backoffStep: 10,
156
- initialDelay: 10
160
+ initialDelay: 10,
157
161
  };
158
162
 
159
163
  export async function poll<T>(
160
164
  cl: PlClient,
161
165
  cb: (tx: PollTxAccessor) => Promise<T>,
162
166
  retryOptions: RetryOptions = DefaultPollingRetryOptions,
163
- txName: string = 'polling'
167
+ txName: string = 'polling',
164
168
  ): Promise<T> {
165
169
  let retryState = createRetryState(retryOptions);
166
170
  while (true) {
@@ -1,4 +1,5 @@
1
- import { FieldData, isNotNullResourceId } from '../core/types';
1
+ import type { FieldData } from '../core/types';
2
+ import { isNotNullResourceId } from '../core/types';
2
3
 
3
4
  export function fieldResolved(data: Pick<FieldData, 'value' | 'error'>) {
4
5
  return isNotNullResourceId(data.error) || isNotNullResourceId(data.value);
@@ -1,5 +1,6 @@
1
- import { PlTransaction } from '../core/transaction';
2
- import { FieldData, OptionalResourceId, isNotNullResourceId } from '../core/types';
1
+ import type { PlTransaction } from '../core/transaction';
2
+ import type { FieldData, OptionalResourceId } from '../core/types';
3
+ import { isNotNullResourceId } from '../core/types';
3
4
  import { notEmpty } from '@milaboratories/ts-helpers';
4
5
 
5
6
  export interface ValErr {
@@ -12,7 +13,7 @@ export async function valErr(tx: PlTransaction, f: FieldData): Promise<ValErr> {
12
13
  const result = {
13
14
  valueId: f.value,
14
15
  errorId: f.error,
15
- error: ''
16
+ error: '',
16
17
  };
17
18
 
18
19
  if (isNotNullResourceId(f.error)) {
@@ -16,16 +16,16 @@
16
16
  // See the License for the specific language governing permissions and
17
17
  // limitations under the License.
18
18
  //
19
- import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
20
- import type { IBinaryWriter } from "@protobuf-ts/runtime";
21
- import { WireType } from "@protobuf-ts/runtime";
22
- import type { BinaryReadOptions } from "@protobuf-ts/runtime";
23
- import type { IBinaryReader } from "@protobuf-ts/runtime";
24
- import { UnknownFieldHandler } from "@protobuf-ts/runtime";
25
- import type { PartialMessage } from "@protobuf-ts/runtime";
26
- import { reflectionMergePartial } from "@protobuf-ts/runtime";
27
- import { MessageType } from "@protobuf-ts/runtime";
28
- import { Any } from "../../../../../google/protobuf/any";
19
+ import type { BinaryWriteOptions } from '@protobuf-ts/runtime';
20
+ import type { IBinaryWriter } from '@protobuf-ts/runtime';
21
+ import { WireType } from '@protobuf-ts/runtime';
22
+ import type { BinaryReadOptions } from '@protobuf-ts/runtime';
23
+ import type { IBinaryReader } from '@protobuf-ts/runtime';
24
+ import { UnknownFieldHandler } from '@protobuf-ts/runtime';
25
+ import type { PartialMessage } from '@protobuf-ts/runtime';
26
+ import { reflectionMergePartial } from '@protobuf-ts/runtime';
27
+ import { MessageType } from '@protobuf-ts/runtime';
28
+ import { Any } from '../../../../../google/protobuf/any';
29
29
  /**
30
30
  * The `Status` type defines a logical error model that is suitable for
31
31
  * different programming environments, including REST APIs and RPC APIs. It is
@@ -38,86 +38,89 @@ import { Any } from "../../../../../google/protobuf/any";
38
38
  * @generated from protobuf message google.rpc.Status
39
39
  */
40
40
  export interface Status {
41
- /**
41
+ /**
42
42
  * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
43
43
  *
44
44
  * @generated from protobuf field: int32 code = 1;
45
45
  */
46
- code: number;
47
- /**
46
+ code: number;
47
+ /**
48
48
  * A developer-facing error message, which should be in English. Any
49
49
  * user-facing error message should be localized and sent in the
50
50
  * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
51
51
  *
52
52
  * @generated from protobuf field: string message = 2;
53
53
  */
54
- message: string;
55
- /**
54
+ message: string;
55
+ /**
56
56
  * A list of messages that carry the error details. There is a common set of
57
57
  * message types for APIs to use.
58
58
  *
59
59
  * @generated from protobuf field: repeated google.protobuf.Any details = 3;
60
60
  */
61
- details: Any[];
61
+ details: Any[];
62
62
  }
63
63
  // @generated message type with reflection information, may provide speed optimized methods
64
64
  class Status$Type extends MessageType<Status> {
65
- constructor() {
66
- super("google.rpc.Status", [
67
- { no: 1, name: "code", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
68
- { no: 2, name: "message", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
69
- { no: 3, name: "details", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Any }
70
- ]);
71
- }
72
- create(value?: PartialMessage<Status>): Status {
73
- const message = globalThis.Object.create((this.messagePrototype!));
74
- message.code = 0;
75
- message.message = "";
76
- message.details = [];
77
- if (value !== undefined)
78
- reflectionMergePartial<Status>(this, message, value);
79
- return message;
80
- }
81
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Status): Status {
82
- let message = target ?? this.create(), end = reader.pos + length;
83
- while (reader.pos < end) {
84
- let [fieldNo, wireType] = reader.tag();
85
- switch (fieldNo) {
86
- case /* int32 code */ 1:
87
- message.code = reader.int32();
88
- break;
89
- case /* string message */ 2:
90
- message.message = reader.string();
91
- break;
92
- case /* repeated google.protobuf.Any details */ 3:
93
- message.details.push(Any.internalBinaryRead(reader, reader.uint32(), options));
94
- break;
95
- default:
96
- let u = options.readUnknownField;
97
- if (u === "throw")
98
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
99
- let d = reader.skip(wireType);
100
- if (u !== false)
101
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
102
- }
103
- }
104
- return message;
105
- }
106
- internalBinaryWrite(message: Status, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
107
- /* int32 code = 1; */
108
- if (message.code !== 0)
109
- writer.tag(1, WireType.Varint).int32(message.code);
110
- /* string message = 2; */
111
- if (message.message !== "")
112
- writer.tag(2, WireType.LengthDelimited).string(message.message);
113
- /* repeated google.protobuf.Any details = 3; */
114
- for (let i = 0; i < message.details.length; i++)
115
- Any.internalBinaryWrite(message.details[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
116
- let u = options.writeUnknownFields;
117
- if (u !== false)
118
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
119
- return writer;
65
+ constructor() {
66
+ super('google.rpc.Status', [
67
+ { no: 1, name: 'code', kind: 'scalar', T: 5 /* ScalarType.INT32 */ },
68
+ { no: 2, name: 'message', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
69
+ { no: 3, name: 'details', kind: 'message', repeat: 1 /* RepeatType.PACKED */, T: () => Any },
70
+ ]);
71
+ }
72
+
73
+ create(value?: PartialMessage<Status>): Status {
74
+ const message = globalThis.Object.create((this.messagePrototype!));
75
+ message.code = 0;
76
+ message.message = '';
77
+ message.details = [];
78
+ if (value !== undefined)
79
+ reflectionMergePartial<Status>(this, message, value);
80
+ return message;
81
+ }
82
+
83
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Status): Status {
84
+ const message = target ?? this.create(), end = reader.pos + length;
85
+ while (reader.pos < end) {
86
+ const [fieldNo, wireType] = reader.tag();
87
+ switch (fieldNo) {
88
+ case /* int32 code */ 1:
89
+ message.code = reader.int32();
90
+ break;
91
+ case /* string message */ 2:
92
+ message.message = reader.string();
93
+ break;
94
+ case /* repeated google.protobuf.Any details */ 3:
95
+ message.details.push(Any.internalBinaryRead(reader, reader.uint32(), options));
96
+ break;
97
+ default:
98
+ const u = options.readUnknownField;
99
+ if (u === 'throw')
100
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
101
+ const d = reader.skip(wireType);
102
+ if (u !== false)
103
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
104
+ }
120
105
  }
106
+ return message;
107
+ }
108
+
109
+ internalBinaryWrite(message: Status, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
110
+ /* int32 code = 1; */
111
+ if (message.code !== 0)
112
+ writer.tag(1, WireType.Varint).int32(message.code);
113
+ /* string message = 2; */
114
+ if (message.message !== '')
115
+ writer.tag(2, WireType.LengthDelimited).string(message.message);
116
+ /* repeated google.protobuf.Any details = 3; */
117
+ for (let i = 0; i < message.details.length; i++)
118
+ Any.internalBinaryWrite(message.details[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
119
+ const u = options.writeUnknownFields;
120
+ if (u !== false)
121
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
122
+ return writer;
123
+ }
121
124
  }
122
125
  /**
123
126
  * @generated MessageType for protobuf message google.rpc.Status
@@ -1,14 +1,14 @@
1
1
  // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.proto" (package "MiLaboratories.Controller.Shared", syntax proto3)
3
3
  // tslint:disable
4
- import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
5
- import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
6
- import { Download } from "./protocol";
7
- import { stackIntercept } from "@protobuf-ts/runtime-rpc";
8
- import type { DownloadAPI_GetDownloadURL_Response } from "./protocol";
9
- import type { DownloadAPI_GetDownloadURL_Request } from "./protocol";
10
- import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
11
- import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
4
+ import type { RpcTransport } from '@protobuf-ts/runtime-rpc';
5
+ import type { ServiceInfo } from '@protobuf-ts/runtime-rpc';
6
+ import { Download } from './protocol';
7
+ import { stackIntercept } from '@protobuf-ts/runtime-rpc';
8
+ import type { DownloadAPI_GetDownloadURL_Response } from './protocol';
9
+ import type { DownloadAPI_GetDownloadURL_Request } from './protocol';
10
+ import type { UnaryCall } from '@protobuf-ts/runtime-rpc';
11
+ import type { RpcOptions } from '@protobuf-ts/runtime-rpc';
12
12
  /**
13
13
  *
14
14
  * Download provides access to any data, that can be downloaded via network.
@@ -17,10 +17,10 @@ import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
17
17
  * @generated from protobuf service MiLaboratories.Controller.Shared.Download
18
18
  */
19
19
  export interface IDownloadClient {
20
- /**
20
+ /**
21
21
  * @generated from protobuf rpc: GetDownloadURL(MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request) returns (MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response);
22
22
  */
23
- getDownloadURL(input: DownloadAPI_GetDownloadURL_Request, options?: RpcOptions): UnaryCall<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response>;
23
+ getDownloadURL(input: DownloadAPI_GetDownloadURL_Request, options?: RpcOptions): UnaryCall<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response>;
24
24
  }
25
25
  /**
26
26
  *
@@ -30,16 +30,17 @@ export interface IDownloadClient {
30
30
  * @generated from protobuf service MiLaboratories.Controller.Shared.Download
31
31
  */
32
32
  export class DownloadClient implements IDownloadClient, ServiceInfo {
33
- typeName = Download.typeName;
34
- methods = Download.methods;
35
- options = Download.options;
36
- constructor(private readonly _transport: RpcTransport) {
37
- }
38
- /**
33
+ typeName = Download.typeName;
34
+ methods = Download.methods;
35
+ options = Download.options;
36
+ constructor(private readonly _transport: RpcTransport) {
37
+ }
38
+
39
+ /**
39
40
  * @generated from protobuf rpc: GetDownloadURL(MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request) returns (MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response);
40
41
  */
41
- getDownloadURL(input: DownloadAPI_GetDownloadURL_Request, options?: RpcOptions): UnaryCall<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response> {
42
- const method = this.methods[0], opt = this._transport.mergeOptions(options);
43
- return stackIntercept<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response>("unary", this._transport, method, opt, input);
44
- }
42
+ getDownloadURL(input: DownloadAPI_GetDownloadURL_Request, options?: RpcOptions): UnaryCall<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response> {
43
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
44
+ return stackIntercept<DownloadAPI_GetDownloadURL_Request, DownloadAPI_GetDownloadURL_Response>('unary', this._transport, method, opt, input);
45
+ }
45
46
  }