@milaboratories/pl-client 2.11.8 → 2.11.10

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 (184) hide show
  1. package/dist/core/auth.cjs +24 -0
  2. package/dist/core/auth.cjs.map +1 -0
  3. package/dist/core/auth.d.ts +1 -1
  4. package/dist/core/auth.js +21 -0
  5. package/dist/core/auth.js.map +1 -0
  6. package/dist/core/cache.d.ts +1 -1
  7. package/dist/core/client.cjs +288 -0
  8. package/dist/core/client.cjs.map +1 -0
  9. package/dist/core/client.d.ts +10 -10
  10. package/dist/core/client.js +267 -0
  11. package/dist/core/client.js.map +1 -0
  12. package/dist/core/config.cjs +111 -0
  13. package/dist/core/config.cjs.map +1 -0
  14. package/dist/core/config.d.ts +1 -1
  15. package/dist/core/config.js +95 -0
  16. package/dist/core/config.js.map +1 -0
  17. package/dist/core/default_client.cjs +143 -0
  18. package/dist/core/default_client.cjs.map +1 -0
  19. package/dist/core/default_client.d.ts +1 -1
  20. package/dist/core/default_client.js +120 -0
  21. package/dist/core/default_client.js.map +1 -0
  22. package/dist/core/driver.cjs +14 -0
  23. package/dist/core/driver.cjs.map +1 -0
  24. package/dist/core/driver.d.ts +5 -5
  25. package/dist/core/driver.js +12 -0
  26. package/dist/core/driver.js.map +1 -0
  27. package/dist/core/error_resource.cjs +9 -0
  28. package/dist/core/error_resource.cjs.map +1 -0
  29. package/dist/core/error_resource.d.ts +1 -1
  30. package/dist/core/error_resource.js +7 -0
  31. package/dist/core/error_resource.js.map +1 -0
  32. package/dist/core/errors.cjs +106 -0
  33. package/dist/core/errors.cjs.map +1 -0
  34. package/dist/core/errors.d.ts +1 -1
  35. package/dist/core/errors.js +93 -0
  36. package/dist/core/errors.js.map +1 -0
  37. package/dist/core/final.cjs +98 -0
  38. package/dist/core/final.cjs.map +1 -0
  39. package/dist/core/final.d.ts +2 -2
  40. package/dist/core/final.js +96 -0
  41. package/dist/core/final.js.map +1 -0
  42. package/dist/core/grpc.d.ts +1 -1
  43. package/dist/core/http.d.ts +1 -0
  44. package/dist/core/ll_client.cjs +266 -0
  45. package/dist/core/ll_client.cjs.map +1 -0
  46. package/dist/core/ll_client.d.ts +3 -3
  47. package/dist/core/ll_client.js +264 -0
  48. package/dist/core/ll_client.js.map +1 -0
  49. package/dist/core/ll_transaction.cjs +236 -0
  50. package/dist/core/ll_transaction.cjs.map +1 -0
  51. package/dist/core/ll_transaction.d.ts +2 -2
  52. package/dist/core/ll_transaction.js +233 -0
  53. package/dist/core/ll_transaction.js.map +1 -0
  54. package/dist/core/stat.cjs +74 -0
  55. package/dist/core/stat.cjs.map +1 -0
  56. package/dist/core/stat.js +70 -0
  57. package/dist/core/stat.js.map +1 -0
  58. package/dist/core/transaction.cjs +626 -0
  59. package/dist/core/transaction.cjs.map +1 -0
  60. package/dist/core/transaction.d.ts +6 -6
  61. package/dist/core/transaction.js +613 -0
  62. package/dist/core/transaction.js.map +1 -0
  63. package/dist/core/type_conversion.cjs +106 -0
  64. package/dist/core/type_conversion.cjs.map +1 -0
  65. package/dist/core/type_conversion.d.ts +2 -2
  66. package/dist/core/type_conversion.js +102 -0
  67. package/dist/core/type_conversion.js.map +1 -0
  68. package/dist/core/types.cjs +159 -0
  69. package/dist/core/types.cjs.map +1 -0
  70. package/dist/core/types.js +134 -0
  71. package/dist/core/types.js.map +1 -0
  72. package/dist/core/unauth_client.cjs +43 -0
  73. package/dist/core/unauth_client.cjs.map +1 -0
  74. package/dist/core/unauth_client.d.ts +2 -2
  75. package/dist/core/unauth_client.js +41 -0
  76. package/dist/core/unauth_client.js.map +1 -0
  77. package/dist/helpers/pl.cjs +124 -0
  78. package/dist/helpers/pl.cjs.map +1 -0
  79. package/dist/helpers/pl.d.ts +10 -2
  80. package/dist/helpers/pl.js +94 -0
  81. package/dist/helpers/pl.js.map +1 -0
  82. package/dist/helpers/poll.cjs +148 -0
  83. package/dist/helpers/poll.cjs.map +1 -0
  84. package/dist/helpers/poll.d.ts +4 -4
  85. package/dist/helpers/poll.js +123 -0
  86. package/dist/helpers/poll.js.map +1 -0
  87. package/dist/helpers/rich_resource_types.d.ts +1 -0
  88. package/dist/helpers/smart_accessors.d.ts +1 -0
  89. package/dist/helpers/state_helpers.d.ts +1 -1
  90. package/dist/helpers/tx_helpers.cjs +25 -0
  91. package/dist/helpers/tx_helpers.cjs.map +1 -0
  92. package/dist/helpers/tx_helpers.d.ts +2 -2
  93. package/dist/helpers/tx_helpers.js +23 -0
  94. package/dist/helpers/tx_helpers.js.map +1 -0
  95. package/dist/index.cjs +99 -0
  96. package/dist/index.cjs.map +1 -0
  97. package/dist/index.js +16 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs +71 -0
  100. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -0
  101. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +7 -2
  102. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js +69 -0
  103. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -0
  104. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +8 -5
  105. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +7 -2
  106. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +8 -5
  107. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +8 -3
  108. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +11 -5
  109. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +8 -3
  110. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +13 -5
  111. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +7 -2
  112. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +12238 -0
  113. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -0
  114. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +223 -0
  115. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -0
  116. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +57 -5
  117. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +221 -0
  118. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -0
  119. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +21 -7
  120. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js +12086 -0
  121. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -0
  122. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +1127 -0
  123. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -0
  124. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +11 -4
  125. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +1113 -0
  126. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -0
  127. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +152 -0
  128. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -0
  129. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +6 -1
  130. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +149 -0
  131. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -0
  132. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +22 -7
  133. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +500 -0
  134. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -0
  135. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +7 -2
  136. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +496 -0
  137. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -0
  138. package/dist/proto/google/api/http.d.ts +6 -1
  139. package/dist/proto/google/protobuf/any.cjs +151 -0
  140. package/dist/proto/google/protobuf/any.cjs.map +1 -0
  141. package/dist/proto/google/protobuf/any.d.ts +10 -1
  142. package/dist/proto/google/protobuf/any.js +149 -0
  143. package/dist/proto/google/protobuf/any.js.map +1 -0
  144. package/dist/proto/google/protobuf/descriptor.d.ts +6 -1
  145. package/dist/proto/google/protobuf/duration.cjs +105 -0
  146. package/dist/proto/google/protobuf/duration.cjs.map +1 -0
  147. package/dist/proto/google/protobuf/duration.d.ts +9 -1
  148. package/dist/proto/google/protobuf/duration.js +103 -0
  149. package/dist/proto/google/protobuf/duration.js.map +1 -0
  150. package/dist/proto/google/protobuf/empty.d.ts +6 -1
  151. package/dist/proto/google/protobuf/struct.d.ts +9 -1
  152. package/dist/proto/google/protobuf/timestamp.cjs +133 -0
  153. package/dist/proto/google/protobuf/timestamp.cjs.map +1 -0
  154. package/dist/proto/google/protobuf/timestamp.d.ts +9 -1
  155. package/dist/proto/google/protobuf/timestamp.js +131 -0
  156. package/dist/proto/google/protobuf/timestamp.js.map +1 -0
  157. package/dist/proto/google/protobuf/wrappers.d.ts +9 -1
  158. package/dist/test/test_config.cjs +149 -0
  159. package/dist/test/test_config.cjs.map +1 -0
  160. package/dist/test/test_config.d.ts +1 -1
  161. package/dist/test/test_config.js +123 -0
  162. package/dist/test/test_config.js.map +1 -0
  163. package/dist/util/pl.cjs +8 -0
  164. package/dist/util/pl.cjs.map +1 -0
  165. package/dist/util/pl.js +6 -0
  166. package/dist/util/pl.js.map +1 -0
  167. package/dist/util/util.cjs +17 -0
  168. package/dist/util/util.cjs.map +1 -0
  169. package/dist/util/util.js +15 -0
  170. package/dist/util/util.js.map +1 -0
  171. package/package.json +14 -11
  172. package/src/core/client.test.ts +1 -0
  173. package/src/core/config.test.ts +1 -0
  174. package/src/core/error.test.ts +1 -0
  175. package/src/core/ll_client.test.ts +1 -0
  176. package/src/core/ll_transaction.test.ts +1 -0
  177. package/src/core/transaction.test.ts +1 -0
  178. package/src/core/types.test.ts +1 -0
  179. package/src/core/unauth_client.test.ts +1 -0
  180. package/src/helpers/rich_resource_types.test.ts +2 -0
  181. package/src/test/test_config.test.ts +1 -0
  182. package/src/util/util.test.ts +1 -0
  183. package/dist/index.mjs +0 -14537
  184. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,148 @@
1
+ 'use strict';
2
+
3
+ var tsHelpers = require('@milaboratories/ts-helpers');
4
+ var types = require('../core/types.cjs');
5
+ var tp = require('node:timers/promises');
6
+
7
+ function _interopNamespaceDefault(e) {
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var tp__namespace = /*#__PURE__*/_interopNamespaceDefault(tp);
25
+
26
+ /** This error tells state assertion mechanism that required state is not yet ready */
27
+ class ContinuePolling extends Error {
28
+ name = 'ContinuePolling';
29
+ }
30
+ const DefaultPollFieldTraverseOps = {
31
+ failOnError: true,
32
+ onlyFinal: false,
33
+ };
34
+ class PollResourceAccessor {
35
+ tx;
36
+ data;
37
+ path;
38
+ constructor(tx, data, path) {
39
+ this.tx = tx;
40
+ this.data = data;
41
+ this.path = path;
42
+ }
43
+ final() {
44
+ if (!this.data.final)
45
+ throw new ContinuePolling();
46
+ return this;
47
+ }
48
+ async requireNoError() {
49
+ if (types.isNullResourceId(this.data.error))
50
+ return this;
51
+ await this.tx.throwError(this.data.error, this.path);
52
+ // hmm... https://github.com/microsoft/TypeScript/issues/34955
53
+ return this;
54
+ }
55
+ getFieldData(name, expectedType) {
56
+ const fieldData = this.data.fields.find((f) => f.name === name);
57
+ if (fieldData !== undefined) {
58
+ if (expectedType !== undefined && fieldData.type !== expectedType)
59
+ throw new Error(`Unexpected field type. Expected ${expectedType}, found ${fieldData.type}`);
60
+ return fieldData;
61
+ }
62
+ if (((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked)
63
+ || (expectedType === 'Output' && this.data.outputsLocked))
64
+ throw new Error(
65
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions
66
+ `Field "${name}" not found. Expected type: ${expectedType}, state: ${this.data}`);
67
+ throw new ContinuePolling();
68
+ }
69
+ async get(name, ops = {}) {
70
+ const { expectedType, failOnError } = { ...DefaultPollFieldTraverseOps, ...ops };
71
+ const path = [...this.path, name];
72
+ const fieldData = this.getFieldData(name, expectedType);
73
+ if (types.isNotNullResourceId(fieldData.error) && (failOnError || types.isNullResourceId(fieldData.value)))
74
+ await this.tx.throwError(fieldData.error, path);
75
+ if (types.isNullResourceId(fieldData.value))
76
+ throw new ContinuePolling();
77
+ return await this.tx.get(fieldData.value, failOnError, path);
78
+ }
79
+ async getMulti(ops, ...names) {
80
+ return await Promise.all(names.map((name) => this.get(name, ops)));
81
+ }
82
+ async getMultiObj(ops, ...names) {
83
+ return Object.fromEntries(await Promise.all(names.map(async (name) => [name, await this.get(name, ops)])));
84
+ }
85
+ async getAllFinal(ops = {}) {
86
+ return await this.getMultiObj(ops, ...this.data.fields
87
+ .filter((f) => f.valueIsFinal || types.isNotNullResourceId(f.error))
88
+ .map((f) => f.name));
89
+ }
90
+ async getKValue(key) {
91
+ const value = await this.tx.tx.getKValueStringIfExists(this.data.id, key);
92
+ if (value === undefined)
93
+ throw new ContinuePolling();
94
+ return value;
95
+ }
96
+ async getKValueObj(key) {
97
+ return JSON.parse(await this.getKValue(key));
98
+ }
99
+ }
100
+ class PollTxAccessor {
101
+ tx;
102
+ constructor(tx) {
103
+ this.tx = tx;
104
+ }
105
+ async get(rid, failOnError = true, path = []) {
106
+ const data = await this.tx.getResourceData(rid, true);
107
+ const accessor = new PollResourceAccessor(this, data, [...path, types.resourceIdToString(rid)]);
108
+ if (failOnError)
109
+ await accessor.requireNoError();
110
+ return accessor;
111
+ }
112
+ async throwError(error, path = []) {
113
+ const errorRes = await this.get(error);
114
+ const errorText = Buffer.from(tsHelpers.notEmpty(errorRes.data.data)).toString();
115
+ throw new Error(`${path.join(' -> ')} = ${errorText}`);
116
+ }
117
+ }
118
+ const DefaultPollingRetryOptions = {
119
+ type: 'linearBackoff',
120
+ jitter: 0,
121
+ maxAttempts: 100,
122
+ backoffStep: 10,
123
+ initialDelay: 10,
124
+ };
125
+ async function poll(cl, cb, retryOptions = DefaultPollingRetryOptions, txName = 'polling') {
126
+ let retryState = tsHelpers.createRetryState(retryOptions);
127
+ while (true) {
128
+ try {
129
+ return await cl.withReadTx(txName, async (tx) => {
130
+ return await cb(new PollTxAccessor(tx));
131
+ });
132
+ }
133
+ catch (e) {
134
+ // Rethrowing any error except the "not ready yet"
135
+ if (!(e instanceof ContinuePolling))
136
+ throw e;
137
+ }
138
+ await tp__namespace.setTimeout(retryState.nextDelay);
139
+ retryState = tsHelpers.nextRetryStateOrError(retryState);
140
+ }
141
+ }
142
+
143
+ exports.ContinuePolling = ContinuePolling;
144
+ exports.DefaultPollingRetryOptions = DefaultPollingRetryOptions;
145
+ exports.PollResourceAccessor = PollResourceAccessor;
146
+ exports.PollTxAccessor = PollTxAccessor;
147
+ exports.poll = poll;
148
+ //# sourceMappingURL=poll.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.cjs","sources":["../../src/helpers/poll.ts"],"sourcesContent":["import type { PlClient } from '../core/client';\nimport type {\n RetryOptions,\n} from '@milaboratories/ts-helpers';\nimport {\n createRetryState,\n nextRetryStateOrError,\n notEmpty,\n} from '@milaboratories/ts-helpers';\nimport type {\n FieldData,\n FieldType,\n ResourceData,\n ResourceId } from '../core/types';\nimport {\n isNotNullResourceId,\n isNullResourceId,\n resourceIdToString,\n} from '../core/types';\nimport type { PlTransaction } from '../core/transaction';\nimport * as tp from 'node:timers/promises';\n\n/** This error tells state assertion mechanism that required state is not yet ready */\nexport class ContinuePolling extends Error {\n name = 'ContinuePolling';\n}\n\nexport type PollFieldTraverseOps = {\n expectedType?: FieldType;\n /** Fail if error present along with the value, if value not present,\n * but error do, exception will be thrown anyway. */\n failOnError: boolean;\n /** Traverse only if field report its value as final. */\n onlyFinal: boolean;\n};\n\nconst DefaultPollFieldTraverseOps: PollFieldTraverseOps = {\n failOnError: true,\n onlyFinal: false,\n};\n\nexport class PollResourceAccessor {\n constructor(\n public readonly tx: PollTxAccessor,\n public readonly data: ResourceData,\n public readonly path: string[],\n ) {}\n\n public final(): PollResourceAccessor {\n if (!this.data.final) throw new ContinuePolling();\n return this;\n }\n\n public async requireNoError(): Promise<PollResourceAccessor> {\n if (isNullResourceId(this.data.error)) return this;\n await this.tx.throwError(this.data.error, this.path);\n // hmm... https://github.com/microsoft/TypeScript/issues/34955\n return this;\n }\n\n public getFieldData(name: string, expectedType?: FieldType): FieldData {\n const fieldData = this.data.fields.find((f) => f.name === name);\n\n if (fieldData !== undefined) {\n if (expectedType !== undefined && fieldData.type !== expectedType)\n throw new Error(`Unexpected field type. Expected ${expectedType}, found ${fieldData.type}`);\n return fieldData;\n }\n\n if (\n ((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked)\n || (expectedType === 'Output' && this.data.outputsLocked)\n )\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions\n `Field \"${name}\" not found. Expected type: ${expectedType}, state: ${this.data}`,\n );\n\n throw new ContinuePolling();\n }\n\n public async get(\n name: string,\n ops: Partial<PollFieldTraverseOps> = {},\n ): Promise<PollResourceAccessor> {\n const { expectedType, failOnError } = { ...DefaultPollFieldTraverseOps, ...ops };\n const path = [...this.path, name];\n\n const fieldData = this.getFieldData(name, expectedType);\n if (isNotNullResourceId(fieldData.error) && (failOnError || isNullResourceId(fieldData.value)))\n await this.tx.throwError(fieldData.error, path);\n\n if (isNullResourceId(fieldData.value)) throw new ContinuePolling();\n\n return await this.tx.get(fieldData.value, failOnError, path);\n }\n\n public async getMulti(\n ops: Partial<PollFieldTraverseOps>,\n ...names: string[]\n ): Promise<PollResourceAccessor[]> {\n return await Promise.all(names.map((name) => this.get(name, ops)));\n }\n\n public async getMultiObj<Key extends string>(\n ops: Partial<PollFieldTraverseOps>,\n ...names: Key[]\n ): Promise<Record<Key, PollResourceAccessor>> {\n return Object.fromEntries(\n await Promise.all(names.map(async (name) => [name, await this.get(name, ops)])),\n );\n }\n\n public async getAllFinal(\n ops: Partial<PollFieldTraverseOps> = {},\n ): Promise<Record<string, PollResourceAccessor>> {\n return await this.getMultiObj(\n ops,\n ...this.data.fields\n .filter((f) => f.valueIsFinal || isNotNullResourceId(f.error))\n .map((f) => f.name),\n );\n }\n\n public async getKValue(key: string): Promise<string> {\n const value = await this.tx.tx.getKValueStringIfExists(this.data.id, key);\n if (value === undefined) throw new ContinuePolling();\n return value;\n }\n\n public async getKValueObj<T>(key: string): Promise<T> {\n return JSON.parse(await this.getKValue(key)) as T;\n }\n}\n\nexport class PollTxAccessor {\n constructor(public readonly tx: PlTransaction) {}\n\n public async get(\n rid: ResourceId,\n failOnError: boolean = true,\n path: string[] = [],\n ): Promise<PollResourceAccessor> {\n const data = await this.tx.getResourceData(rid, true);\n const accessor = new PollResourceAccessor(this, data, [...path, resourceIdToString(rid)]);\n if (failOnError) await accessor.requireNoError();\n return accessor;\n }\n\n async throwError(error: ResourceId, path: string[] = []): Promise<never> {\n const errorRes = await this.get(error);\n const errorText = Buffer.from(notEmpty(errorRes.data.data)).toString();\n throw new Error(`${path.join(' -> ')} = ${errorText}`);\n }\n}\n\nexport const DefaultPollingRetryOptions: RetryOptions = {\n type: 'linearBackoff',\n jitter: 0,\n maxAttempts: 100,\n backoffStep: 10,\n initialDelay: 10,\n};\n\nexport async function poll<T>(\n cl: PlClient,\n cb: (tx: PollTxAccessor) => Promise<T>,\n retryOptions: RetryOptions = DefaultPollingRetryOptions,\n txName: string = 'polling',\n): Promise<T> {\n let retryState = createRetryState(retryOptions);\n while (true) {\n try {\n return await cl.withReadTx(txName, async (tx) => {\n return await cb(new PollTxAccessor(tx));\n });\n } catch (e: any) {\n // Rethrowing any error except the \"not ready yet\"\n if (!(e instanceof ContinuePolling)) throw e;\n }\n await tp.setTimeout(retryState.nextDelay);\n retryState = nextRetryStateOrError(retryState);\n }\n}\n"],"names":["isNullResourceId","isNotNullResourceId","resourceIdToString","notEmpty","createRetryState","tp","nextRetryStateOrError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;AACM,MAAO,eAAgB,SAAQ,KAAK,CAAA;IACxC,IAAI,GAAG,iBAAiB;AACzB;AAWD,MAAM,2BAA2B,GAAyB;AACxD,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,SAAS,EAAE,KAAK;CACjB;MAEY,oBAAoB,CAAA;AAEb,IAAA,EAAA;AACA,IAAA,IAAA;AACA,IAAA,IAAA;AAHlB,IAAA,WAAA,CACkB,EAAkB,EAClB,IAAkB,EAClB,IAAc,EAAA;QAFd,IAAA,CAAA,EAAE,GAAF,EAAE;QACF,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,IAAI,GAAJ,IAAI;IACnB;IAEI,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,eAAe,EAAE;AACjD,QAAA,OAAO,IAAI;IACb;AAEO,IAAA,MAAM,cAAc,GAAA;AACzB,QAAA,IAAIA,sBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,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M,IAAI,KAAK,CAAC,CAAA,EAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,GAAA,EAAM,SAAS,CAAA,CAAE,CAAC;IACxD;AACD;AAEM,MAAM,0BAA0B,GAAiB;AACtD,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,YAAY,EAAE,EAAE;;AAGX,eAAe,IAAI,CACxB,EAAY,EACZ,EAAsC,EACtC,YAAA,GAA6B,0BAA0B,EACvD,SAAiB,SAAS,EAAA;AAE1B,IAAA,IAAI,UAAU,GAAGC,0BAAgB,CAAC,YAAY,CAAC;IAC/C,OAAO,IAAI,EAAE;AACX,QAAA,IAAI;YACF,OAAO,MAAM,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,KAAI;gBAC9C,OAAO,MAAM,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,CAAC,CAAC;AACzC,YAAA,CAAC,CAAC;QACJ;QAAE,OAAO,CAAM,EAAE;;AAEf,YAAA,IAAI,EAAE,CAAC,YAAY,eAAe,CAAC;AAAE,gBAAA,MAAM,CAAC;QAC9C;QACA,MAAMC,aAAE,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;AACzC,QAAA,UAAU,GAAGC,+BAAqB,CAAC,UAAU,CAAC;IAChD;AACF;;;;;;;;"}
@@ -1,7 +1,7 @@
1
- import { PlClient } from '../core/client';
2
- import { RetryOptions } from '@milaboratories/ts-helpers';
3
- import { FieldData, FieldType, ResourceData, ResourceId } from '../core/types';
4
- import { PlTransaction } from '../core/transaction';
1
+ import type { PlClient } from '../core/client';
2
+ import type { RetryOptions } from '@milaboratories/ts-helpers';
3
+ import type { FieldData, FieldType, ResourceData, ResourceId } from '../core/types';
4
+ import type { PlTransaction } from '../core/transaction';
5
5
  /** This error tells state assertion mechanism that required state is not yet ready */
6
6
  export declare class ContinuePolling extends Error {
7
7
  name: string;
@@ -0,0 +1,123 @@
1
+ import { notEmpty, createRetryState, nextRetryStateOrError } from '@milaboratories/ts-helpers';
2
+ import { isNullResourceId, isNotNullResourceId, resourceIdToString } from '../core/types.js';
3
+ import * as tp from 'node:timers/promises';
4
+
5
+ /** This error tells state assertion mechanism that required state is not yet ready */
6
+ class ContinuePolling extends Error {
7
+ name = 'ContinuePolling';
8
+ }
9
+ const DefaultPollFieldTraverseOps = {
10
+ failOnError: true,
11
+ onlyFinal: false,
12
+ };
13
+ class PollResourceAccessor {
14
+ tx;
15
+ data;
16
+ path;
17
+ constructor(tx, data, path) {
18
+ this.tx = tx;
19
+ this.data = data;
20
+ this.path = path;
21
+ }
22
+ final() {
23
+ if (!this.data.final)
24
+ throw new ContinuePolling();
25
+ return this;
26
+ }
27
+ async requireNoError() {
28
+ if (isNullResourceId(this.data.error))
29
+ return this;
30
+ await this.tx.throwError(this.data.error, this.path);
31
+ // hmm... https://github.com/microsoft/TypeScript/issues/34955
32
+ return this;
33
+ }
34
+ getFieldData(name, expectedType) {
35
+ const fieldData = this.data.fields.find((f) => f.name === name);
36
+ if (fieldData !== undefined) {
37
+ if (expectedType !== undefined && fieldData.type !== expectedType)
38
+ throw new Error(`Unexpected field type. Expected ${expectedType}, found ${fieldData.type}`);
39
+ return fieldData;
40
+ }
41
+ if (((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked)
42
+ || (expectedType === 'Output' && this.data.outputsLocked))
43
+ throw new Error(
44
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions
45
+ `Field "${name}" not found. Expected type: ${expectedType}, state: ${this.data}`);
46
+ throw new ContinuePolling();
47
+ }
48
+ async get(name, ops = {}) {
49
+ const { expectedType, failOnError } = { ...DefaultPollFieldTraverseOps, ...ops };
50
+ const path = [...this.path, name];
51
+ const fieldData = this.getFieldData(name, expectedType);
52
+ if (isNotNullResourceId(fieldData.error) && (failOnError || isNullResourceId(fieldData.value)))
53
+ await this.tx.throwError(fieldData.error, path);
54
+ if (isNullResourceId(fieldData.value))
55
+ throw new ContinuePolling();
56
+ return await this.tx.get(fieldData.value, failOnError, path);
57
+ }
58
+ async getMulti(ops, ...names) {
59
+ return await Promise.all(names.map((name) => this.get(name, ops)));
60
+ }
61
+ async getMultiObj(ops, ...names) {
62
+ return Object.fromEntries(await Promise.all(names.map(async (name) => [name, await this.get(name, ops)])));
63
+ }
64
+ async getAllFinal(ops = {}) {
65
+ return await this.getMultiObj(ops, ...this.data.fields
66
+ .filter((f) => f.valueIsFinal || isNotNullResourceId(f.error))
67
+ .map((f) => f.name));
68
+ }
69
+ async getKValue(key) {
70
+ const value = await this.tx.tx.getKValueStringIfExists(this.data.id, key);
71
+ if (value === undefined)
72
+ throw new ContinuePolling();
73
+ return value;
74
+ }
75
+ async getKValueObj(key) {
76
+ return JSON.parse(await this.getKValue(key));
77
+ }
78
+ }
79
+ class PollTxAccessor {
80
+ tx;
81
+ constructor(tx) {
82
+ this.tx = tx;
83
+ }
84
+ async get(rid, failOnError = true, path = []) {
85
+ const data = await this.tx.getResourceData(rid, true);
86
+ const accessor = new PollResourceAccessor(this, data, [...path, resourceIdToString(rid)]);
87
+ if (failOnError)
88
+ await accessor.requireNoError();
89
+ return accessor;
90
+ }
91
+ async throwError(error, path = []) {
92
+ const errorRes = await this.get(error);
93
+ const errorText = Buffer.from(notEmpty(errorRes.data.data)).toString();
94
+ throw new Error(`${path.join(' -> ')} = ${errorText}`);
95
+ }
96
+ }
97
+ const DefaultPollingRetryOptions = {
98
+ type: 'linearBackoff',
99
+ jitter: 0,
100
+ maxAttempts: 100,
101
+ backoffStep: 10,
102
+ initialDelay: 10,
103
+ };
104
+ async function poll(cl, cb, retryOptions = DefaultPollingRetryOptions, txName = 'polling') {
105
+ let retryState = createRetryState(retryOptions);
106
+ while (true) {
107
+ try {
108
+ return await cl.withReadTx(txName, async (tx) => {
109
+ return await cb(new PollTxAccessor(tx));
110
+ });
111
+ }
112
+ catch (e) {
113
+ // Rethrowing any error except the "not ready yet"
114
+ if (!(e instanceof ContinuePolling))
115
+ throw e;
116
+ }
117
+ await tp.setTimeout(retryState.nextDelay);
118
+ retryState = nextRetryStateOrError(retryState);
119
+ }
120
+ }
121
+
122
+ export { ContinuePolling, DefaultPollingRetryOptions, PollResourceAccessor, PollTxAccessor, poll };
123
+ //# sourceMappingURL=poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.js","sources":["../../src/helpers/poll.ts"],"sourcesContent":["import type { PlClient } from '../core/client';\nimport type {\n RetryOptions,\n} from '@milaboratories/ts-helpers';\nimport {\n createRetryState,\n nextRetryStateOrError,\n notEmpty,\n} from '@milaboratories/ts-helpers';\nimport type {\n FieldData,\n FieldType,\n ResourceData,\n ResourceId } from '../core/types';\nimport {\n isNotNullResourceId,\n isNullResourceId,\n resourceIdToString,\n} from '../core/types';\nimport type { PlTransaction } from '../core/transaction';\nimport * as tp from 'node:timers/promises';\n\n/** This error tells state assertion mechanism that required state is not yet ready */\nexport class ContinuePolling extends Error {\n name = 'ContinuePolling';\n}\n\nexport type PollFieldTraverseOps = {\n expectedType?: FieldType;\n /** Fail if error present along with the value, if value not present,\n * but error do, exception will be thrown anyway. */\n failOnError: boolean;\n /** Traverse only if field report its value as final. */\n onlyFinal: boolean;\n};\n\nconst DefaultPollFieldTraverseOps: PollFieldTraverseOps = {\n failOnError: true,\n onlyFinal: false,\n};\n\nexport class PollResourceAccessor {\n constructor(\n public readonly tx: PollTxAccessor,\n public readonly data: ResourceData,\n public readonly path: string[],\n ) {}\n\n public final(): PollResourceAccessor {\n if (!this.data.final) throw new ContinuePolling();\n return this;\n }\n\n public async requireNoError(): Promise<PollResourceAccessor> {\n if (isNullResourceId(this.data.error)) return this;\n await this.tx.throwError(this.data.error, this.path);\n // hmm... https://github.com/microsoft/TypeScript/issues/34955\n return this;\n }\n\n public getFieldData(name: string, expectedType?: FieldType): FieldData {\n const fieldData = this.data.fields.find((f) => f.name === name);\n\n if (fieldData !== undefined) {\n if (expectedType !== undefined && fieldData.type !== expectedType)\n throw new Error(`Unexpected field type. Expected ${expectedType}, found ${fieldData.type}`);\n return fieldData;\n }\n\n if (\n ((expectedType === 'Input' || expectedType === 'Service') && this.data.inputsLocked)\n || (expectedType === 'Output' && this.data.outputsLocked)\n )\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions\n `Field \"${name}\" not found. Expected type: ${expectedType}, state: ${this.data}`,\n );\n\n throw new ContinuePolling();\n }\n\n public async get(\n name: string,\n ops: Partial<PollFieldTraverseOps> = {},\n ): Promise<PollResourceAccessor> {\n const { expectedType, failOnError } = { ...DefaultPollFieldTraverseOps, ...ops };\n const path = [...this.path, name];\n\n const fieldData = this.getFieldData(name, expectedType);\n if (isNotNullResourceId(fieldData.error) && (failOnError || isNullResourceId(fieldData.value)))\n await this.tx.throwError(fieldData.error, path);\n\n if (isNullResourceId(fieldData.value)) throw new ContinuePolling();\n\n return await this.tx.get(fieldData.value, failOnError, path);\n }\n\n public async getMulti(\n ops: Partial<PollFieldTraverseOps>,\n ...names: string[]\n ): Promise<PollResourceAccessor[]> {\n return await Promise.all(names.map((name) => this.get(name, ops)));\n }\n\n public async getMultiObj<Key extends string>(\n ops: Partial<PollFieldTraverseOps>,\n ...names: Key[]\n ): Promise<Record<Key, PollResourceAccessor>> {\n return Object.fromEntries(\n await Promise.all(names.map(async (name) => [name, await this.get(name, ops)])),\n );\n }\n\n public async getAllFinal(\n ops: Partial<PollFieldTraverseOps> = {},\n ): Promise<Record<string, PollResourceAccessor>> {\n return await this.getMultiObj(\n ops,\n ...this.data.fields\n .filter((f) => f.valueIsFinal || isNotNullResourceId(f.error))\n .map((f) => f.name),\n );\n }\n\n public async getKValue(key: string): Promise<string> {\n const value = await this.tx.tx.getKValueStringIfExists(this.data.id, key);\n if (value === undefined) throw new ContinuePolling();\n return value;\n }\n\n public async getKValueObj<T>(key: string): Promise<T> {\n return JSON.parse(await this.getKValue(key)) as T;\n }\n}\n\nexport class PollTxAccessor {\n constructor(public readonly tx: PlTransaction) {}\n\n public async get(\n rid: ResourceId,\n failOnError: boolean = true,\n path: string[] = [],\n ): Promise<PollResourceAccessor> {\n const data = await this.tx.getResourceData(rid, true);\n const accessor = new PollResourceAccessor(this, data, [...path, resourceIdToString(rid)]);\n if (failOnError) await accessor.requireNoError();\n return accessor;\n }\n\n async throwError(error: ResourceId, path: string[] = []): Promise<never> {\n const errorRes = await this.get(error);\n const errorText = Buffer.from(notEmpty(errorRes.data.data)).toString();\n throw new Error(`${path.join(' -> ')} = ${errorText}`);\n }\n}\n\nexport const DefaultPollingRetryOptions: RetryOptions = {\n type: 'linearBackoff',\n jitter: 0,\n maxAttempts: 100,\n backoffStep: 10,\n initialDelay: 10,\n};\n\nexport async function poll<T>(\n cl: PlClient,\n cb: (tx: PollTxAccessor) => Promise<T>,\n retryOptions: RetryOptions = DefaultPollingRetryOptions,\n txName: string = 'polling',\n): Promise<T> {\n let retryState = createRetryState(retryOptions);\n while (true) {\n try {\n return await cl.withReadTx(txName, async (tx) => {\n return await cb(new PollTxAccessor(tx));\n });\n } catch (e: any) {\n // Rethrowing any error except the \"not ready yet\"\n if (!(e instanceof ContinuePolling)) throw e;\n }\n await tp.setTimeout(retryState.nextDelay);\n retryState = nextRetryStateOrError(retryState);\n }\n}\n"],"names":[],"mappings":";;;;AAsBA;AACM,MAAO,eAAgB,SAAQ,KAAK,CAAA;IACxC,IAAI,GAAG,iBAAiB;AACzB;AAWD,MAAM,2BAA2B,GAAyB;AACxD,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,SAAS,EAAE,KAAK;CACjB;MAEY,oBAAoB,CAAA;AAEb,IAAA,EAAA;AACA,IAAA,IAAA;AACA,IAAA,IAAA;AAHlB,IAAA,WAAA,CACkB,EAAkB,EAClB,IAAkB,EAClB,IAAc,EAAA;QAFd,IAAA,CAAA,EAAE,GAAF,EAAE;QACF,IAAA,C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ource_types.d.ts.map
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=smart_accessors.d.ts.map
@@ -1,3 +1,3 @@
1
- import { FieldData } from '../core/types';
1
+ import type { FieldData } from '../core/types';
2
2
  export declare function fieldResolved(data: Pick<FieldData, 'value' | 'error'>): boolean;
3
3
  //# sourceMappingURL=state_helpers.d.ts.map
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var types = require('../core/types.cjs');
4
+ var tsHelpers = require('@milaboratories/ts-helpers');
5
+
6
+ async function valErr(tx, f) {
7
+ const result = {
8
+ valueId: f.value,
9
+ errorId: f.error,
10
+ error: '',
11
+ };
12
+ if (types.isNotNullResourceId(f.error)) {
13
+ const e = await tx.getResourceData(f.error, true);
14
+ const deserializationResult = tsHelpers.cachedDeserialize(tsHelpers.notEmpty(e.data));
15
+ if (typeof deserializationResult !== 'string') {
16
+ const dataStr = tsHelpers.notEmpty(e.data).toString();
17
+ throw new Error(`Unexpected error structure: ${dataStr.substring(0, Math.min(dataStr.length, 100))}...`);
18
+ }
19
+ result.error = deserializationResult;
20
+ }
21
+ return result;
22
+ }
23
+
24
+ exports.valErr = valErr;
25
+ //# sourceMappingURL=tx_helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx_helpers.cjs","sources":["../../src/helpers/tx_helpers.ts"],"sourcesContent":["import type { PlTransaction } from '../core/transaction';\nimport type { FieldData, OptionalResourceId } from '../core/types';\nimport { isNotNullResourceId } from '../core/types';\nimport { cachedDeserialize, notEmpty } from '@milaboratories/ts-helpers';\n\nexport interface ValErr {\n valueId: OptionalResourceId;\n errorId: OptionalResourceId;\n error?: string;\n}\n\nexport async function valErr(tx: PlTransaction, f: FieldData): Promise<ValErr> {\n const result = {\n valueId: f.value,\n errorId: f.error,\n error: '',\n };\n\n if (isNotNullResourceId(f.error)) {\n const e = await tx.getResourceData(f.error, true);\n const deserializationResult = cachedDeserialize(notEmpty(e.data));\n if (typeof deserializationResult !== 'string') {\n const dataStr = notEmpty(e.data).toString();\n throw new Error(`Unexpected error structure: ${dataStr.substring(0, Math.min(dataStr.length, 100))}...`);\n }\n result.error = deserializationResult;\n }\n\n return result;\n}\n"],"names":["isNotNullResourceId","cachedDeserialize","notEmpty"],"mappings":";;;;;AAWO,eAAe,MAAM,CAAC,EAAiB,EAAE,CAAY,EAAA;AAC1D,IAAA,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,CAAC,CAAC,KAAK;QAChB,OAAO,EAAE,CAAC,CAAC,KAAK;AAChB,QAAA,KAAK,EAAE,EAAE;KACV;AAED,IAAA,IAAIA,yBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;AAChC,QAAA,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC;QACjD,MAAM,qBAAqB,GAAGC,2BAAiB,CAACC,kBAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjE,QAAA,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;YAC7C,MAAM,OAAO,GAAGA,kBAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,CAAA,4BAAA,EAA+B,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA,GAAA,CAAK,CAAC;QAC1G;AACA,QAAA,MAAM,CAAC,KAAK,GAAG,qBAAqB;IACtC;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -1,5 +1,5 @@
1
- import { PlTransaction } from '../core/transaction';
2
- import { FieldData, OptionalResourceId } from '../core/types';
1
+ import type { PlTransaction } from '../core/transaction';
2
+ import type { FieldData, OptionalResourceId } from '../core/types';
3
3
  export interface ValErr {
4
4
  valueId: OptionalResourceId;
5
5
  errorId: OptionalResourceId;
@@ -0,0 +1,23 @@
1
+ import { isNotNullResourceId } from '../core/types.js';
2
+ import { cachedDeserialize, notEmpty } from '@milaboratories/ts-helpers';
3
+
4
+ async function valErr(tx, f) {
5
+ const result = {
6
+ valueId: f.value,
7
+ errorId: f.error,
8
+ error: '',
9
+ };
10
+ if (isNotNullResourceId(f.error)) {
11
+ const e = await tx.getResourceData(f.error, true);
12
+ const deserializationResult = cachedDeserialize(notEmpty(e.data));
13
+ if (typeof deserializationResult !== 'string') {
14
+ const dataStr = notEmpty(e.data).toString();
15
+ throw new Error(`Unexpected error structure: ${dataStr.substring(0, Math.min(dataStr.length, 100))}...`);
16
+ }
17
+ result.error = deserializationResult;
18
+ }
19
+ return result;
20
+ }
21
+
22
+ export { valErr };
23
+ //# sourceMappingURL=tx_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx_helpers.js","sources":["../../src/helpers/tx_helpers.ts"],"sourcesContent":["import type { PlTransaction } from '../core/transaction';\nimport type { FieldData, OptionalResourceId } from '../core/types';\nimport { isNotNullResourceId } from '../core/types';\nimport { cachedDeserialize, notEmpty } from '@milaboratories/ts-helpers';\n\nexport interface ValErr {\n valueId: OptionalResourceId;\n errorId: OptionalResourceId;\n error?: string;\n}\n\nexport async function valErr(tx: PlTransaction, f: FieldData): Promise<ValErr> {\n const result = {\n valueId: f.value,\n errorId: f.error,\n error: '',\n };\n\n if (isNotNullResourceId(f.error)) {\n const e = await tx.getResourceData(f.error, true);\n const deserializationResult = cachedDeserialize(notEmpty(e.data));\n if (typeof deserializationResult !== 'string') {\n const dataStr = notEmpty(e.data).toString();\n throw new Error(`Unexpected error structure: ${dataStr.substring(0, Math.min(dataStr.length, 100))}...`);\n }\n result.error = deserializationResult;\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;AAWO,eAAe,MAAM,CAAC,EAAiB,EAAE,CAAY,EAAA;AAC1D,IAAA,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,CAAC,CAAC,KAAK;QAChB,OAAO,EAAE,CAAC,CAAC,KAAK;AAChB,QAAA,KAAK,EAAE,EAAE;KACV;AAED,IAAA,IAAI,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;AAChC,QAAA,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC;QACjD,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjE,QAAA,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;YAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,CAAA,4BAAA,EAA+B,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA,GAAA,CAAK,CAAC;QAC1G;AACA,QAAA,MAAM,CAAC,KAAK,GAAG,qBAAqB;IACtC;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
package/dist/index.cjs ADDED
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ var types = require('./core/types.cjs');
4
+ var pl = require('./helpers/pl.cjs');
5
+ var config = require('./core/config.cjs');
6
+ var client = require('./core/client.cjs');
7
+ var driver = require('./core/driver.cjs');
8
+ var transaction = require('./core/transaction.cjs');
9
+ var errors = require('./core/errors.cjs');
10
+ var default_client = require('./core/default_client.cjs');
11
+ var unauth_client = require('./core/unauth_client.cjs');
12
+ var auth = require('./core/auth.cjs');
13
+ var final = require('./core/final.cjs');
14
+ var tx_helpers = require('./helpers/tx_helpers.cjs');
15
+ var poll = require('./helpers/poll.cjs');
16
+ var test_config = require('./test/test_config.cjs');
17
+
18
+
19
+
20
+ exports.MaxLocalId = types.MaxLocalId;
21
+ exports.MaxTxId = types.MaxTxId;
22
+ exports.NullResourceId = types.NullResourceId;
23
+ exports.bigintToResourceId = types.bigintToResourceId;
24
+ exports.checkLocalityOfResourceId = types.checkLocalityOfResourceId;
25
+ exports.createGlobalResourceId = types.createGlobalResourceId;
26
+ exports.createLocalResourceId = types.createLocalResourceId;
27
+ exports.ensureResourceIdNotNull = types.ensureResourceIdNotNull;
28
+ exports.extractBasicResourceData = types.extractBasicResourceData;
29
+ exports.extractTxId = types.extractTxId;
30
+ exports.getField = types.getField;
31
+ exports.isAnyResourceId = types.isAnyResourceId;
32
+ exports.isLocalResourceId = types.isLocalResourceId;
33
+ exports.isNotNullResourceId = types.isNotNullResourceId;
34
+ exports.isNullResourceId = types.isNullResourceId;
35
+ exports.isRootResourceId = types.isRootResourceId;
36
+ exports.jsonToData = types.jsonToData;
37
+ exports.resDataToJson = types.resDataToJson;
38
+ exports.resourceIdFromString = types.resourceIdFromString;
39
+ exports.resourceIdToString = types.resourceIdToString;
40
+ exports.resourceType = types.resourceType;
41
+ exports.resourceTypeToString = types.resourceTypeToString;
42
+ exports.resourceTypesEqual = types.resourceTypesEqual;
43
+ exports.stringifyWithResourceId = types.stringifyWithResourceId;
44
+ exports.Pl = pl;
45
+ exports.AnonymousAuthInformation = config.AnonymousAuthInformation;
46
+ exports.DEFAULT_AUTH_MAX_REFRESH = config.DEFAULT_AUTH_MAX_REFRESH;
47
+ exports.DEFAULT_MAX_CACHE_BYTES = config.DEFAULT_MAX_CACHE_BYTES;
48
+ exports.DEFAULT_REQUEST_TIMEOUT = config.DEFAULT_REQUEST_TIMEOUT;
49
+ exports.DEFAULT_RETRY_BACKOFF_ALGORITHM = config.DEFAULT_RETRY_BACKOFF_ALGORITHM;
50
+ exports.DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER = config.DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER;
51
+ exports.DEFAULT_RETRY_INITIAL_DELAY = config.DEFAULT_RETRY_INITIAL_DELAY;
52
+ exports.DEFAULT_RETRY_JITTER = config.DEFAULT_RETRY_JITTER;
53
+ exports.DEFAULT_RETRY_LINEAR_BACKOFF_STEP = config.DEFAULT_RETRY_LINEAR_BACKOFF_STEP;
54
+ exports.DEFAULT_RETRY_MAX_ATTEMPTS = config.DEFAULT_RETRY_MAX_ATTEMPTS;
55
+ exports.DEFAULT_RO_TX_TIMEOUT = config.DEFAULT_RO_TX_TIMEOUT;
56
+ exports.DEFAULT_RW_TX_TIMEOUT = config.DEFAULT_RW_TX_TIMEOUT;
57
+ exports.DEFAULT_TOKEN_TTL_SECONDS = config.DEFAULT_TOKEN_TTL_SECONDS;
58
+ exports.DefaultRetryOptions = config.DefaultRetryOptions;
59
+ exports.plAddressToConfig = config.plAddressToConfig;
60
+ exports.PlClient = client.PlClient;
61
+ exports.addRTypeToMetadata = driver.addRTypeToMetadata;
62
+ exports.PlTransaction = transaction.PlTransaction;
63
+ exports.TxCommitConflict = transaction.TxCommitConflict;
64
+ exports.field = transaction.field;
65
+ exports.isField = transaction.isField;
66
+ exports.isFieldRef = transaction.isFieldRef;
67
+ exports.isResource = transaction.isResource;
68
+ exports.isResourceId = transaction.isResourceId;
69
+ exports.isResourceRef = transaction.isResourceRef;
70
+ exports.toFieldId = transaction.toFieldId;
71
+ exports.toGlobalFieldId = transaction.toGlobalFieldId;
72
+ exports.toGlobalResourceId = transaction.toGlobalResourceId;
73
+ exports.toResourceId = transaction.toResourceId;
74
+ exports.DisconnectedError = errors.DisconnectedError;
75
+ exports.PlError = errors.PlError;
76
+ exports.PlErrorCodeNotFound = errors.PlErrorCodeNotFound;
77
+ exports.RecoverablePlError = errors.RecoverablePlError;
78
+ exports.UnauthenticatedError = errors.UnauthenticatedError;
79
+ exports.UnrecoverablePlError = errors.UnrecoverablePlError;
80
+ exports.isConnectionProblem = errors.isConnectionProblem;
81
+ exports.isNotFoundError = errors.isNotFoundError;
82
+ exports.isTimeoutOrCancelError = errors.isTimeoutOrCancelError;
83
+ exports.isUnauthenticated = errors.isUnauthenticated;
84
+ exports.rethrowMeaningfulError = errors.rethrowMeaningfulError;
85
+ exports.throwPlNotFoundError = errors.throwPlNotFoundError;
86
+ exports.defaultPlClient = default_client.defaultPlClient;
87
+ exports.tryGetFileConfig = default_client.tryGetFileConfig;
88
+ exports.UnauthenticatedPlClient = unauth_client.UnauthenticatedPlClient;
89
+ exports.expirationFromAuthInformation = auth.expirationFromAuthInformation;
90
+ exports.inferAuthRefreshTime = auth.inferAuthRefreshTime;
91
+ exports.DefaultFinalResourceDataPredicate = final.DefaultFinalResourceDataPredicate;
92
+ exports.valErr = tx_helpers.valErr;
93
+ exports.ContinuePolling = poll.ContinuePolling;
94
+ exports.DefaultPollingRetryOptions = poll.DefaultPollingRetryOptions;
95
+ exports.PollResourceAccessor = poll.PollResourceAccessor;
96
+ exports.PollTxAccessor = poll.PollTxAccessor;
97
+ exports.poll = poll.poll;
98
+ exports.TestHelpers = test_config;
99
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}