@milaboratories/pl-client 2.16.7 → 2.16.9
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.
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.cjs +2 -2
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.cjs.map +1 -1
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.js +2 -2
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.js.map +1 -1
- package/dist/core/abstract_stream.d.ts +18 -0
- package/dist/core/abstract_stream.d.ts.map +1 -0
- package/dist/core/client.cjs +6 -6
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.d.ts +3 -3
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +6 -6
- package/dist/core/client.js.map +1 -1
- package/dist/core/config.cjs +3 -0
- package/dist/core/config.cjs.map +1 -1
- package/dist/core/config.d.ts +4 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +3 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/driver.cjs +11 -0
- package/dist/core/driver.cjs.map +1 -1
- package/dist/core/driver.d.ts +8 -2
- package/dist/core/driver.d.ts.map +1 -1
- package/dist/core/driver.js +11 -1
- package/dist/core/driver.js.map +1 -1
- package/dist/core/errors.cjs +9 -0
- package/dist/core/errors.cjs.map +1 -1
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/ll_client.cjs +194 -39
- package/dist/core/ll_client.cjs.map +1 -1
- package/dist/core/ll_client.d.ts +36 -15
- package/dist/core/ll_client.d.ts.map +1 -1
- package/dist/core/ll_client.js +195 -40
- package/dist/core/ll_client.js.map +1 -1
- package/dist/core/ll_transaction.cjs.map +1 -1
- package/dist/core/ll_transaction.d.ts +3 -3
- package/dist/core/ll_transaction.d.ts.map +1 -1
- package/dist/core/ll_transaction.js.map +1 -1
- package/dist/core/transaction.cjs +2 -2
- package/dist/core/transaction.cjs.map +1 -1
- package/dist/core/transaction.js +2 -2
- package/dist/core/transaction.js.map +1 -1
- package/dist/core/type_conversion.cjs +2 -2
- package/dist/core/type_conversion.cjs.map +1 -1
- package/dist/core/type_conversion.d.ts +2 -2
- package/dist/core/type_conversion.d.ts.map +1 -1
- package/dist/core/type_conversion.js +2 -2
- package/dist/core/type_conversion.js.map +1 -1
- package/dist/core/unauth_client.cjs +4 -8
- package/dist/core/unauth_client.cjs.map +1 -1
- package/dist/core/unauth_client.d.ts +1 -1
- package/dist/core/unauth_client.d.ts.map +1 -1
- package/dist/core/unauth_client.js +4 -8
- package/dist/core/unauth_client.js.map +1 -1
- package/dist/core/wire.d.ts +34 -0
- package/dist/core/wire.d.ts.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.d.ts +4 -2
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +25 -25
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.js +25 -25
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts +73 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/google/api/http.d.ts +28 -32
- package/dist/proto-grpc/google/api/http.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.js.map +1 -0
- package/dist/{proto → proto-grpc}/google/protobuf/descriptor.d.ts +6 -152
- package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.js.map +1 -0
- package/dist/proto-grpc/google/protobuf/empty.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/struct.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -0
- package/dist/{proto → proto-grpc}/google/protobuf/wrappers.d.ts +0 -27
- package/dist/proto-grpc/google/protobuf/wrappers.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/code.cjs +240 -0
- package/dist/proto-grpc/google/rpc/code.cjs.map +1 -0
- package/dist/proto-grpc/google/rpc/code.d.ts +219 -0
- package/dist/proto-grpc/google/rpc/code.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/code.js +240 -0
- package/dist/proto-grpc/google/rpc/code.js.map +1 -0
- package/dist/proto-grpc/google/rpc/error_details.d.ts +654 -0
- package/dist/proto-grpc/google/rpc/error_details.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/http.d.ts +121 -0
- package/dist/proto-grpc/google/rpc/http.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/status.d.ts +55 -0
- package/dist/proto-grpc/google/rpc/status.d.ts.map +1 -0
- package/dist/proto-rest/index.cjs +64 -0
- package/dist/proto-rest/index.cjs.map +1 -0
- package/dist/proto-rest/index.d.ts +23 -0
- package/dist/proto-rest/index.d.ts.map +1 -0
- package/dist/proto-rest/index.js +61 -0
- package/dist/proto-rest/index.js.map +1 -0
- package/dist/proto-rest/plapi.d.ts +1488 -0
- package/dist/proto-rest/plapi.d.ts.map +1 -0
- package/package.json +6 -3
- package/src/core/abstract_stream.ts +25 -0
- package/src/core/client.ts +8 -8
- package/src/core/config.ts +9 -0
- package/src/core/driver.ts +13 -2
- package/src/core/errors.ts +7 -1
- package/src/core/ll_client.test.ts +1 -1
- package/src/core/ll_client.ts +212 -42
- package/src/core/ll_transaction.test.ts +1 -1
- package/src/core/ll_transaction.ts +4 -4
- package/src/core/transaction.ts +1 -1
- package/src/core/type_conversion.ts +3 -3
- package/src/core/unauth_client.test.ts +6 -0
- package/src/core/unauth_client.ts +8 -12
- package/src/core/wire.ts +40 -0
- package/src/index.ts +3 -1
- package/src/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.ts +5 -3
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.ts +25 -25
- package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.ts +209 -0
- package/src/{proto → proto-grpc}/google/api/http.ts +29 -33
- package/src/{proto → proto-grpc}/google/protobuf/descriptor.ts +11 -221
- package/src/{proto → proto-grpc}/google/protobuf/wrappers.ts +4 -38
- package/src/proto-grpc/google/rpc/code.ts +236 -0
- package/src/proto-grpc/google/rpc/error_details.ts +1386 -0
- package/src/proto-grpc/google/rpc/http.ts +307 -0
- package/src/proto-grpc/google/rpc/status.ts +127 -0
- package/src/proto-rest/index.ts +83 -0
- package/src/proto-rest/plapi.ts +1488 -0
- package/dist/core/grpc.d.ts +0 -16
- package/dist/core/grpc.d.ts.map +0 -1
- package/dist/core/http.d.ts +0 -2
- package/dist/core/http.d.ts.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +0 -40
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +0 -116
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +0 -46
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +0 -170
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +0 -51
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +0 -176
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +0 -131
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +0 -320
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +0 -1
- package/dist/proto/google/api/http.d.ts.map +0 -1
- package/dist/proto/google/protobuf/any.cjs.map +0 -1
- package/dist/proto/google/protobuf/any.d.ts.map +0 -1
- package/dist/proto/google/protobuf/any.js.map +0 -1
- package/dist/proto/google/protobuf/descriptor.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.cjs.map +0 -1
- package/dist/proto/google/protobuf/duration.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.js.map +0 -1
- package/dist/proto/google/protobuf/empty.d.ts.map +0 -1
- package/dist/proto/google/protobuf/struct.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.cjs.map +0 -1
- package/dist/proto/google/protobuf/timestamp.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/proto/google/protobuf/wrappers.d.ts.map +0 -1
- package/src/core/grpc.ts +0 -17
- package/src/core/http.ts +0 -178
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +0 -45
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +0 -313
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +0 -51
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +0 -406
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +0 -59
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +0 -489
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +0 -148
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +0 -719
- /package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/empty.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/struct.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.js +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/import.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/any.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/duration.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/empty.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/struct.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/timestamp.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sources":["../../src/core/transaction.ts"],"sourcesContent":["// TODO: fix this\n/* eslint-disable no-prototype-builtins */\nimport type {\n AnyResourceId,\n LocalResourceId,\n OptionalResourceId,\n BasicResourceData,\n FieldData,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceType,\n FutureFieldType } from './types';\nimport {\n createLocalResourceId,\n ensureResourceIdNotNull,\n MaxTxId,\n isLocalResourceId,\n extractBasicResourceData,\n isNullResourceId,\n} from './types';\nimport type {\n ClientMessageRequest,\n LLPlTransaction,\n OneOfKind,\n ServerMessageResponse,\n} from './ll_transaction';\nimport { TxAPI_Open_Request_WritableTx } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport type { NonUndefined } from 'utility-types';\nimport { toBytes } from '../util/util';\nimport { fieldTypeToProto, protoToField, protoToResource } from './type_conversion';\nimport { canonicalJsonBytes, canonicalJsonGzBytes, deepFreeze, notEmpty } from '@milaboratories/ts-helpers';\nimport { isNotFoundError } from './errors';\nimport type { FinalResourceDataPredicate } from './final';\nimport type { LRUCache } from 'lru-cache';\nimport type { ResourceDataCacheRecord } from './cache';\nimport type { TxStat } from './stat';\nimport { initialTxStatWithoutTime } from './stat';\nimport type { ErrorResourceData } from './error_resource';\nimport { ErrorResourceType } from './error_resource';\nimport { JsonGzObject, JsonObject } from '../helpers/pl';\nimport { PromiseTracker } from './PromiseTracker';\n\n/** Reference to resource, used only within transaction */\nexport interface ResourceRef {\n /** Global resource id of newly created resources, become available only\n * after response for the corresponding creation request is received. */\n readonly globalId: Promise<ResourceId>;\n\n /** Transaction-local resource id is assigned right after resource creation\n * request is sent, and can be used right away */\n readonly localId: LocalResourceId;\n}\n\n/** Key-Value pair from resource-attached KV storage */\nexport interface KeyValue {\n key: string;\n value: Uint8Array;\n}\n\n/** Key-Value pair from resource-attached KV storage */\nexport interface KeyValueString {\n key: string;\n value: string;\n}\n\ninterface _FieldId<RId> {\n /** Parent resource id */\n resourceId: RId;\n /** Field name */\n fieldName: string;\n}\n\nexport type FieldId = _FieldId<ResourceId>;\nexport type FieldRef = _FieldId<ResourceRef>;\nexport type LocalFieldId = _FieldId<LocalResourceId>;\nexport type AnyFieldId = FieldId | LocalFieldId;\n\nexport type AnyResourceRef = ResourceRef | ResourceId;\nexport type AnyFieldRef = _FieldId<AnyResourceRef>; // FieldRef | FieldId\nexport type AnyRef = AnyResourceRef | AnyFieldRef;\n\nexport function isField(ref: AnyRef): ref is AnyFieldRef {\n return ref.hasOwnProperty('resourceId') && ref.hasOwnProperty('fieldName');\n}\n\nexport function isResource(ref: AnyRef): ref is AnyResourceRef {\n return (\n typeof ref === 'bigint' || (ref.hasOwnProperty('globalId') && ref.hasOwnProperty('localId'))\n );\n}\n\nexport function isResourceId(ref: AnyRef): ref is ResourceId {\n return typeof ref === 'bigint' && !isLocalResourceId(ref) && !isNullResourceId(ref);\n}\n\nexport function isFieldRef(ref: AnyFieldRef): ref is FieldRef {\n return isResourceRef(ref.resourceId);\n}\n\nexport function isResourceRef(ref: AnyResourceRef): ref is ResourceRef {\n return ref.hasOwnProperty('globalId') && ref.hasOwnProperty('localId');\n}\n\nexport function toFieldId(ref: AnyFieldRef): AnyFieldId {\n if (isFieldRef(ref)) return { resourceId: ref.resourceId.localId, fieldName: ref.fieldName };\n else return ref as FieldId;\n}\n\nexport async function toGlobalFieldId(ref: AnyFieldRef): Promise<FieldId> {\n if (isFieldRef(ref))\n return { resourceId: await ref.resourceId.globalId, fieldName: ref.fieldName };\n else return ref as FieldId;\n}\n\nexport function toResourceId(ref: AnyResourceRef): AnyResourceId {\n if (isResourceRef(ref)) return ref.localId;\n else return ref;\n}\n\nexport async function toGlobalResourceId(ref: AnyResourceRef): Promise<ResourceId> {\n if (isResourceRef(ref)) return await ref.globalId;\n else return ref;\n}\n\nexport function field(resourceId: AnyResourceRef, fieldName: string): AnyFieldRef {\n return { resourceId, fieldName };\n}\n\n/** If transaction commit failed due to write conflicts */\nexport class TxCommitConflict extends Error {\n name = 'TxCommitConflict';\n}\n\nasync function notFoundToUndefined<T>(cb: () => Promise<T>): Promise<T | undefined> {\n try {\n return await cb();\n } catch (e) {\n if (isNotFoundError(e)) return undefined;\n throw e;\n }\n}\n\n/**\n * Decorator that wraps the method's returned promise with this.track()\n * This ensures that the promise will be awaited before the transaction is completed.\n */\nfunction tracked<T extends (this: PlTransaction, ...a: any[]) => Promise<any>>(\n value: T,\n _context: ClassMethodDecoratorContext,\n) {\n return function (\n this: PlTransaction,\n ...args: Parameters<T>\n ): ReturnType<T> {\n return this.track(value.apply(this, args)) as ReturnType<T>;\n } as unknown as T;\n}\n\n/**\n * Each platform transaction has 3 stages:\n * - initialization (txOpen message -> txInfo response)\n * - communication (create resources, fields, references and so on)\n * - finalization (txCommit or txDiscard message)\n *\n * This class encapsulates finalization stage and provides ready-to-communication transaction object.\n * */\nexport class PlTransaction {\n private readonly globalTxId: Promise<bigint>;\n private readonly localTxId: number = PlTransaction.nextLocalTxId();\n\n /** Used in caching */\n private readonly txOpenTimestamp = Date.now();\n\n private localResourceIdCounter = 0;\n\n /** Store logical tx open / closed state to prevent invalid sequence of requests.\n * True means output stream was completed.\n * Contract: there must be no async operations between setting this field to true and sending complete signal to stream. */\n private _completed = false;\n\n private globalTxIdWasAwaited: boolean = false;\n\n public readonly pending = new PromiseTracker();\n\n private readonly _startTime = Date.now();\n private readonly _stat = initialTxStatWithoutTime();\n public get stat(): TxStat {\n return {\n ...this._stat,\n timeMs: Date.now() - this._startTime,\n };\n }\n\n constructor(\n private readonly ll: LLPlTransaction,\n public readonly name: string,\n public readonly writable: boolean,\n private readonly _clientRoot: OptionalResourceId,\n private readonly finalPredicate: FinalResourceDataPredicate,\n private readonly sharedResourceDataCache: LRUCache<ResourceId, ResourceDataCacheRecord>,\n private readonly enableFormattedErrors: boolean = false,\n ) {\n // initiating transaction\n this.globalTxId = this.sendSingleAndParse(\n {\n oneofKind: 'txOpen',\n txOpen: {\n name,\n enableFormattedErrors,\n writable: writable\n ? TxAPI_Open_Request_WritableTx.WRITABLE\n : TxAPI_Open_Request_WritableTx.NOT_WRITABLE,\n },\n },\n (r) => notEmpty(r.txOpen.tx?.id),\n );\n\n void this.track(this.globalTxId);\n\n // To avoid floating promise\n this.globalTxId.catch((err) => {\n if (!this.globalTxIdWasAwaited) {\n console.warn(err);\n }\n });\n\n // Adding stats\n this._stat.txCount++;\n }\n\n /**\n * Collect all pending promises for the transaction finalization.\n */\n public track<T>(promiseOrCallback: Promise<T> | (() => Promise<T>)): Promise<T> {\n return this.pending.track(promiseOrCallback);\n }\n\n private async drainAndAwaitPendingOps(): Promise<void> {\n // awaiting these pending operations first, to catch any errors\n await this.pending.awaitAll();\n }\n\n private sendSingleAndParse<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>, T>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>) => T,\n ): Promise<T> {\n return this.pending.track(async () => {\n const rawResponsePromise = this.ll.send(r, false);\n\n void this.pending.track(rawResponsePromise);\n\n await this.drainAndAwaitPendingOps();\n\n // awaiting our result, and parsing the response\n return parser(await rawResponsePromise);\n });\n }\n\n private sendMultiAndParse<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>, T>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>[]) => T,\n ): Promise<T> {\n return this.pending.track(async () => {\n const rawResponsePromise = this.ll.send(r, true);\n\n void this.pending.track(rawResponsePromise);\n\n await this.drainAndAwaitPendingOps();\n\n // awaiting our result, and parsing the response\n return parser(await rawResponsePromise);\n });\n }\n\n private async sendVoidSync<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n ): Promise<void> {\n await this.ll.send(r, false);\n }\n\n /** Requests sent with this method should never produce recoverable errors */\n private sendVoidAsync<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n ): void {\n void this.track(this.sendVoidSync(r));\n }\n\n private checkTxOpen() {\n if (this._completed) throw new Error('Transaction already closed');\n }\n\n public get completed() {\n return this._completed;\n }\n\n /** Commit & closes transaction. {@link TxCommitConflict} is thrown on\n * commit conflicts. */\n public async commit() {\n this.checkTxOpen();\n\n // tx will accept no requests after this one\n this._completed = true;\n\n if (!this.writable) {\n // no need to explicitly commit or reject read-only tx\n const completeResult = this.track(this.ll.complete());\n await this.drainAndAwaitPendingOps();\n await completeResult;\n await this.ll.await();\n } else {\n const commitResponse = this.track(this.sendSingleAndParse(\n { oneofKind: 'txCommit', txCommit: {} },\n (r) => r.txCommit.success,\n ));\n\n // send closing frame right after commit to save some time on round-trips\n const completeResult = this.track(this.ll.complete());\n\n // now when we pushed all packets into the stream, we should wait for any\n // pending void operations from before, to catch any errors\n await this.drainAndAwaitPendingOps();\n\n if (!(await commitResponse)) throw new TxCommitConflict();\n\n await completeResult;\n\n // await event-loop completion\n await this.ll.await();\n }\n }\n\n public async discard() {\n this.checkTxOpen();\n\n // tx will accept no requests after this one\n this._completed = true;\n\n const discardResponse = this.sendVoidSync({ oneofKind: 'txDiscard', txDiscard: {} });\n void this.track(discardResponse);\n // send closing frame right after commit to save some time on round-trips\n const completeResult = this.track(this.ll.complete());\n\n // now when we pushed all packets into the stream, we should wait for any\n // pending void operations from before, to catch any errors\n await this.drainAndAwaitPendingOps();\n\n await discardResponse;\n await completeResult;\n await this.ll.await();\n }\n\n //\n // Main tx methods\n //\n\n public get clientRoot(): ResourceId {\n return ensureResourceIdNotNull(this._clientRoot);\n }\n\n //\n // Resources\n //\n\n public createSingleton(\n name: string,\n type: ResourceType,\n errorIfExists: boolean = false,\n ): ResourceRef {\n const localId = this.nextLocalResourceId(false);\n\n const globalId = this.sendSingleAndParse(\n {\n oneofKind: 'resourceCreateSingleton',\n resourceCreateSingleton: {\n type,\n id: localId,\n data: Buffer.from(name),\n errorIfExists,\n },\n },\n (r) => r.resourceCreateSingleton.resourceId as ResourceId,\n );\n\n void this.track(globalId);\n\n return { globalId, localId };\n }\n\n public getSingleton(name: string, loadFields: true): Promise<ResourceData>;\n public getSingleton(name: string, loadFields: false): Promise<BasicResourceData>;\n public getSingleton(\n name: string,\n loadFields: boolean = true,\n ): Promise<BasicResourceData | ResourceData> {\n return this.sendSingleAndParse(\n {\n oneofKind: 'resourceGetSingleton',\n resourceGetSingleton: {\n data: Buffer.from(name),\n loadFields,\n },\n },\n (r) => protoToResource(notEmpty(r.resourceGetSingleton.resource)),\n );\n }\n\n private createResource<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n root: boolean,\n req: (localId: LocalResourceId) => OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>) => bigint,\n ): ResourceRef {\n const localId = this.nextLocalResourceId(root);\n\n const globalId = this.sendSingleAndParse(req(localId), (r) => parser(r) as ResourceId);\n\n void this.track(globalId);\n\n return { globalId, localId };\n }\n\n public createRoot(type: ResourceType): ResourceRef {\n this._stat.rootsCreated++;\n return this.createResource(\n true,\n (localId) => ({ oneofKind: 'resourceCreateRoot', resourceCreateRoot: { type, id: localId } }),\n (r) => r.resourceCreateRoot.resourceId,\n );\n }\n\n public createStruct(type: ResourceType, data?: Uint8Array | string): ResourceRef {\n this._stat.structsCreated++;\n this._stat.structsCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateStruct',\n resourceCreateStruct: {\n type,\n id: localId,\n data: data === undefined ? undefined : typeof data === 'string' ? Buffer.from(data) : data,\n },\n }),\n (r) => r.resourceCreateStruct.resourceId,\n );\n }\n\n public createEphemeral(type: ResourceType, data?: Uint8Array | string): ResourceRef {\n this._stat.ephemeralsCreated++;\n this._stat.ephemeralsCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateEphemeral',\n resourceCreateEphemeral: {\n type,\n id: localId,\n data: data === undefined ? undefined : typeof data === 'string' ? Buffer.from(data) : data,\n },\n }),\n (r) => r.resourceCreateEphemeral.resourceId,\n );\n }\n\n public createValue(\n type: ResourceType,\n data: Uint8Array | string,\n errorIfExists: boolean = false,\n ): ResourceRef {\n this._stat.valuesCreated++;\n this._stat.valuesCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateValue',\n resourceCreateValue: {\n type,\n id: localId,\n data: typeof data === 'string' ? Buffer.from(data) : data,\n errorIfExists,\n },\n }),\n (r) => r.resourceCreateValue.resourceId,\n );\n }\n\n public createJsonValue(data: unknown): ResourceRef {\n const jsonData = canonicalJsonBytes(data);\n return this.createValue(JsonObject, jsonData, false);\n }\n\n public createJsonGzValue(data: unknown, minSizeToGzip: number | undefined = 16_384): ResourceRef {\n const { data: jsonData, isGzipped } = canonicalJsonGzBytes(data, minSizeToGzip);\n return this.createValue(isGzipped ? JsonGzObject : JsonObject, jsonData, false);\n }\n\n public createError(message: string): ResourceRef {\n return this.createValue(ErrorResourceType, JSON.stringify({ message } satisfies ErrorResourceData));\n }\n\n public setResourceName(name: string, rId: AnyResourceRef): void {\n this.sendVoidAsync({\n oneofKind: 'resourceNameSet',\n resourceNameSet: { resourceId: toResourceId(rId), name },\n });\n }\n\n public deleteResourceName(name: string): void {\n this.sendVoidAsync({ oneofKind: 'resourceNameDelete', resourceNameDelete: { name } });\n }\n\n public getResourceByName(name: string): Promise<ResourceId> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceNameGet', resourceNameGet: { name } },\n (r) => ensureResourceIdNotNull(r.resourceNameGet.resourceId as OptionalResourceId),\n );\n }\n\n public checkResourceNameExists(name: string): Promise<boolean> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceNameExists', resourceNameExists: { name } },\n (r) => r.resourceNameExists.exists,\n );\n }\n\n public removeResource(rId: ResourceId): void {\n this.sendVoidAsync({ oneofKind: 'resourceRemove', resourceRemove: { id: rId } });\n }\n\n public resourceExists(rId: ResourceId): Promise<boolean> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceExists', resourceExists: { resourceId: rId } },\n (r) => r.resourceExists.exists,\n );\n }\n\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(rId: AnyResourceRef, loadFields: true): Promise<ResourceData>;\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(rId: AnyResourceRef, loadFields: false): Promise<BasicResourceData>;\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean\n ): Promise<BasicResourceData | ResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: true,\n ignoreCache: boolean\n ): Promise<ResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: false,\n ignoreCache: boolean\n ): Promise<BasicResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean,\n ignoreCache: boolean\n ): Promise<BasicResourceData | ResourceData>;\n @tracked\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean = true,\n ignoreCache: boolean = false,\n ): Promise<BasicResourceData | ResourceData> {\n if (!ignoreCache && !isResourceRef(rId) && !isLocalResourceId(rId)) {\n // checking if we can return result from cache\n const fromCache = this.sharedResourceDataCache.get(rId);\n if (fromCache && fromCache.cacheTxOpenTimestamp < this.txOpenTimestamp) {\n if (!loadFields) {\n this._stat.rGetDataCacheHits++;\n this._stat.rGetDataCacheBytes += fromCache.basicData.data?.length ?? 0;\n return fromCache.basicData;\n } else if (fromCache.data) {\n this._stat.rGetDataCacheHits++;\n this._stat.rGetDataCacheBytes += fromCache.basicData.data?.length ?? 0;\n this._stat.rGetDataCacheFields += fromCache.data.fields.length;\n return fromCache.data;\n }\n }\n }\n\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceGet',\n resourceGet: { resourceId: toResourceId(rId), loadFields: loadFields },\n },\n (r) => protoToResource(notEmpty(r.resourceGet.resource)),\n );\n\n this._stat.rGetDataNetRequests++;\n this._stat.rGetDataNetBytes += result.data?.length ?? 0;\n this._stat.rGetDataNetFields += result.fields.length;\n\n // we will cache only final resource data states\n // caching result even if we were ignore the cache\n if (!isResourceRef(rId) && !isLocalResourceId(rId) && this.finalPredicate(result)) {\n deepFreeze(result);\n const fromCache = this.sharedResourceDataCache.get(rId);\n if (fromCache) {\n if (loadFields && !fromCache.data) {\n fromCache.data = result;\n // updating timestamp because we updated the record\n fromCache.cacheTxOpenTimestamp = this.txOpenTimestamp;\n }\n } else {\n const basicData = extractBasicResourceData(result);\n deepFreeze(basicData);\n if (loadFields)\n this.sharedResourceDataCache.set(rId, {\n basicData,\n data: result,\n cacheTxOpenTimestamp: this.txOpenTimestamp,\n });\n else\n this.sharedResourceDataCache.set(rId, {\n basicData,\n data: undefined,\n cacheTxOpenTimestamp: this.txOpenTimestamp,\n });\n }\n }\n\n return result;\n }\n\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: true\n ): Promise<ResourceData | undefined>;\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: false\n ): Promise<BasicResourceData | undefined>;\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: boolean\n ): Promise<BasicResourceData | ResourceData | undefined>;\n @tracked\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: boolean = true,\n ): Promise<BasicResourceData | ResourceData | undefined> {\n // calling this method will ignore cache, because user intention is to detect resource absence\n // which cache will prevent\n const result = await notFoundToUndefined(\n async () => await this.getResourceData(rId, loadFields, true),\n );\n\n // cleaning cache record if resource was removed from the db\n if (result === undefined && !isResourceRef(rId) && !isLocalResourceId(rId))\n this.sharedResourceDataCache.delete(rId);\n\n return result;\n }\n\n /**\n * Inform platform that resource will not get any new input fields.\n * This is required, when client creates resource without schema and wants\n * controller to start calculations.\n * Most controllers will not start calculations even when all inputs\n * have their values, if inputs list is not locked.\n */\n public lockInputs(rId: AnyResourceRef): void {\n this._stat.inputsLocked++;\n this.sendVoidAsync({\n oneofKind: 'resourceLockInputs',\n resourceLockInputs: { resourceId: toResourceId(rId) },\n });\n }\n\n /**\n * Inform platform that resource will not get any new output fields.\n * This is required for resource to pass deduplication.\n */\n public lockOutputs(rId: AnyResourceRef): void {\n this._stat.outputsLocked++;\n this.sendVoidAsync({\n oneofKind: 'resourceLockOutputs',\n resourceLockOutputs: { resourceId: toResourceId(rId) },\n });\n }\n\n public lock(rID: AnyResourceRef): void {\n this.lockInputs(rID);\n this.lockOutputs(rID);\n }\n\n public setResourceError(rId: AnyResourceRef, ref: AnyResourceRef): void {\n this.sendVoidAsync({\n oneofKind: 'resourceSetError',\n resourceSetError: { resourceId: toResourceId(rId), errorResourceId: toResourceId(ref) },\n });\n }\n\n //\n // Fields\n //\n\n public createField(fId: AnyFieldRef, fieldType: FieldType, value?: AnyRef): void {\n this._stat.fieldsCreated++;\n this.sendVoidAsync({\n oneofKind: 'fieldCreate',\n fieldCreate: { type: fieldTypeToProto(fieldType), id: toFieldId(fId) },\n });\n if (value !== undefined) this.setField(fId, value);\n }\n\n public fieldExists(fId: AnyFieldRef): Promise<boolean> {\n return this.sendSingleAndParse(\n {\n oneofKind: 'fieldExists',\n fieldExists: { field: toFieldId(fId) },\n },\n (r) => r.fieldExists.exists,\n );\n }\n\n public setField(fId: AnyFieldRef, ref: AnyRef): void {\n this._stat.fieldsSet++;\n if (isResource(ref))\n this.sendVoidAsync({\n oneofKind: 'fieldSet',\n fieldSet: {\n field: toFieldId(fId),\n value: {\n resourceId: toResourceId(ref),\n fieldName: '', // default value, read as undefined\n },\n },\n });\n else\n this.sendVoidAsync({\n oneofKind: 'fieldSet',\n fieldSet: {\n field: toFieldId(fId),\n value: toFieldId(ref),\n },\n });\n }\n\n public setFieldError(fId: AnyFieldRef, ref: AnyResourceRef): void {\n this._stat.fieldsSet++;\n this.sendVoidAsync({\n oneofKind: 'fieldSetError',\n fieldSetError: { field: toFieldId(fId), errResourceId: toResourceId(ref) },\n });\n }\n\n public getField(fId: AnyFieldRef): Promise<FieldData> {\n this._stat.fieldsGet++;\n return this.sendSingleAndParse(\n { oneofKind: 'fieldGet', fieldGet: { field: toFieldId(fId) } },\n (r) => protoToField(notEmpty(r.fieldGet.field)),\n );\n }\n\n @tracked\n public async getFieldIfExists(fId: AnyFieldRef): Promise<FieldData | undefined> {\n return notFoundToUndefined(async () => await this.getField(fId));\n }\n\n public resetField(fId: AnyFieldRef): void {\n this.sendVoidAsync({ oneofKind: 'fieldReset', fieldReset: { field: toFieldId(fId) } });\n }\n\n public removeField(fId: AnyFieldRef): void {\n this.sendVoidAsync({ oneofKind: 'fieldRemove', fieldRemove: { field: toFieldId(fId) } });\n }\n\n //\n // KV\n //\n\n @tracked\n public async listKeyValues(rId: AnyResourceRef): Promise<KeyValue[]> {\n const result = await this.sendMultiAndParse(\n {\n oneofKind: 'resourceKeyValueList',\n resourceKeyValueList: { resourceId: toResourceId(rId), startFrom: '', limit: 0 },\n },\n (r) => r.map((e) => e.resourceKeyValueList.record!),\n );\n\n this._stat.kvListRequests++;\n this._stat.kvListEntries += result.length;\n for (const kv of result) this._stat.kvListBytes += kv.key.length + kv.value.length;\n\n return result;\n }\n\n @tracked\n public async listKeyValuesString(rId: AnyResourceRef): Promise<KeyValueString[]> {\n return (await this.listKeyValues(rId)).map(({ key, value }) => ({\n key,\n value: Buffer.from(value).toString(),\n }));\n }\n\n @tracked\n public async listKeyValuesIfResourceExists(rId: AnyResourceRef): Promise<KeyValue[] | undefined> {\n return notFoundToUndefined(async () => await this.listKeyValues(rId));\n }\n\n @tracked\n public async listKeyValuesStringIfResourceExists(\n rId: AnyResourceRef,\n ): Promise<KeyValueString[] | undefined> {\n return notFoundToUndefined(async () => await this.listKeyValuesString(rId));\n }\n\n public setKValue(rId: AnyResourceRef, key: string, value: Uint8Array | string): void {\n this._stat.kvSetRequests++;\n this._stat.kvSetBytes++;\n this.sendVoidAsync({\n oneofKind: 'resourceKeyValueSet',\n resourceKeyValueSet: {\n resourceId: toResourceId(rId),\n key,\n value: toBytes(value),\n },\n });\n }\n\n public deleteKValue(rId: AnyResourceRef, key: string): void {\n this.sendVoidAsync({\n oneofKind: 'resourceKeyValueDelete',\n resourceKeyValueDelete: {\n resourceId: toResourceId(rId),\n key,\n },\n });\n }\n\n @tracked\n public async getKValue(rId: AnyResourceRef, key: string): Promise<Uint8Array> {\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceKeyValueGet',\n resourceKeyValueGet: { resourceId: toResourceId(rId), key },\n },\n (r) => r.resourceKeyValueGet.value,\n );\n\n this._stat.kvGetRequests++;\n this._stat.kvGetBytes += result.length;\n\n return result;\n }\n\n @tracked\n public async getKValueString(rId: AnyResourceRef, key: string): Promise<string> {\n return Buffer.from(await this.getKValue(rId, key)).toString();\n }\n\n @tracked\n public async getKValueJson<T>(rId: AnyResourceRef, key: string): Promise<T> {\n return JSON.parse(await this.getKValueString(rId, key)) as T;\n }\n\n @tracked\n public async getKValueIfExists(\n rId: AnyResourceRef,\n key: string,\n ): Promise<Uint8Array | undefined> {\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceKeyValueGetIfExists',\n resourceKeyValueGetIfExists: { resourceId: toResourceId(rId), key },\n },\n (r) =>\n r.resourceKeyValueGetIfExists.exists ? r.resourceKeyValueGetIfExists.value : undefined,\n );\n\n this._stat.kvGetRequests++;\n this._stat.kvGetBytes += result?.length ?? 0;\n\n return result;\n }\n\n @tracked\n public async getKValueStringIfExists(\n rId: AnyResourceRef,\n key: string,\n ): Promise<string | undefined> {\n const data = await this.getKValueIfExists(rId, key);\n return data === undefined ? undefined : Buffer.from(data).toString();\n }\n\n @tracked\n public async getKValueJsonIfExists<T>(rId: AnyResourceRef, key: string): Promise<T | undefined> {\n const str = await this.getKValueString(rId, key);\n if (str === undefined) return undefined;\n return JSON.parse(str) as T;\n }\n\n //\n // Cache\n //\n // TODO\n\n //\n // High level ops\n //\n\n /** Resolves existing or create first level resource from */\n public getFutureFieldValue(rId: AnyRef, fieldName: string, fieldType: FutureFieldType): FieldRef {\n const data = Buffer.from(JSON.stringify({ fieldName, fieldType }));\n const getFieldResource = this.createEphemeral({ name: 'json/getField', version: '1' }, data);\n this.setField({ resourceId: getFieldResource, fieldName: 'resource' }, rId);\n return { resourceId: getFieldResource, fieldName: 'result' };\n }\n\n //\n // Technical\n //\n\n public async getGlobalTxId() {\n this.globalTxIdWasAwaited = true;\n return await this.globalTxId;\n }\n\n /** Closes output event stream */\n public async complete() {\n if (this._completed) return;\n this._completed = true;\n const completeResult = this.track(this.ll.complete());\n await this.drainAndAwaitPendingOps();\n await completeResult;\n }\n\n /** Await incoming message loop termination and throw\n * any leftover errors if it was unsuccessful */\n public async await() {\n await this.ll.await();\n }\n\n //\n // Helpers\n //\n\n private nextLocalResourceId(root: boolean): LocalResourceId {\n return createLocalResourceId(root, ++this.localResourceIdCounter, this.localTxId);\n }\n\n private static localTxIdCounter = 0;\n\n private static nextLocalTxId() {\n PlTransaction.localTxIdCounter++;\n if (PlTransaction.localTxIdCounter === MaxTxId) PlTransaction.localTxIdCounter = 1;\n return PlTransaction.localTxIdCounter;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAkFM,SAAU,OAAO,CAAC,GAAW,EAAA;AACjC,IAAA,OAAO,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,GAAG,CAA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UAAU,GAAG,IAAI;AACtB,YAAA,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;AACrD,YAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;AACpC,YAAA,MAAM,cAAc;QACtB;AAEA;AACgD;AACzC,QAAA,MAAM,KAAK,GAAA;AAChB,YAAA,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;QACvB;;;;AAMQ,QAAA,mBAAmB,CAAC,IAAa,EAAA;AACvC,YAAA,OAAO,qBAAqB,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC;QACnF;AAEQ,QAAA,OAAO,gBAAgB,GAAG,CAAC;AAE3B,QAAA,OAAO,aAAa,GAAA;YAC1B,aAAa,CAAC,gBAAgB,EAAE;AAChC,YAAA,IAAI,aAAa,CAAC,gBAAgB,KAAK,OAAO;AAAE,gBAAA,aAAa,CAAC,gBAAgB,GAAG,CAAC;YAClF,OAAO,aAAa,CAAC,gBAAgB;QACvC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"transaction.js","sources":["../../src/core/transaction.ts"],"sourcesContent":["// TODO: fix this\n/* eslint-disable no-prototype-builtins */\nimport type {\n AnyResourceId,\n LocalResourceId,\n OptionalResourceId,\n BasicResourceData,\n FieldData,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceType,\n FutureFieldType } from './types';\nimport {\n createLocalResourceId,\n ensureResourceIdNotNull,\n MaxTxId,\n isLocalResourceId,\n extractBasicResourceData,\n isNullResourceId,\n} from './types';\nimport type {\n ClientMessageRequest,\n LLPlTransaction,\n OneOfKind,\n ServerMessageResponse,\n} from './ll_transaction';\nimport { TxAPI_Open_Request_WritableTx } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport type { NonUndefined } from 'utility-types';\nimport { toBytes } from '../util/util';\nimport { fieldTypeToProto, protoToField, protoToResource } from './type_conversion';\nimport { canonicalJsonBytes, canonicalJsonGzBytes, deepFreeze, notEmpty } from '@milaboratories/ts-helpers';\nimport { isNotFoundError } from './errors';\nimport type { FinalResourceDataPredicate } from './final';\nimport type { LRUCache } from 'lru-cache';\nimport type { ResourceDataCacheRecord } from './cache';\nimport type { TxStat } from './stat';\nimport { initialTxStatWithoutTime } from './stat';\nimport type { ErrorResourceData } from './error_resource';\nimport { ErrorResourceType } from './error_resource';\nimport { JsonGzObject, JsonObject } from '../helpers/pl';\nimport { PromiseTracker } from './PromiseTracker';\n\n/** Reference to resource, used only within transaction */\nexport interface ResourceRef {\n /** Global resource id of newly created resources, become available only\n * after response for the corresponding creation request is received. */\n readonly globalId: Promise<ResourceId>;\n\n /** Transaction-local resource id is assigned right after resource creation\n * request is sent, and can be used right away */\n readonly localId: LocalResourceId;\n}\n\n/** Key-Value pair from resource-attached KV storage */\nexport interface KeyValue {\n key: string;\n value: Uint8Array;\n}\n\n/** Key-Value pair from resource-attached KV storage */\nexport interface KeyValueString {\n key: string;\n value: string;\n}\n\ninterface _FieldId<RId> {\n /** Parent resource id */\n resourceId: RId;\n /** Field name */\n fieldName: string;\n}\n\nexport type FieldId = _FieldId<ResourceId>;\nexport type FieldRef = _FieldId<ResourceRef>;\nexport type LocalFieldId = _FieldId<LocalResourceId>;\nexport type AnyFieldId = FieldId | LocalFieldId;\n\nexport type AnyResourceRef = ResourceRef | ResourceId;\nexport type AnyFieldRef = _FieldId<AnyResourceRef>; // FieldRef | FieldId\nexport type AnyRef = AnyResourceRef | AnyFieldRef;\n\nexport function isField(ref: AnyRef): ref is AnyFieldRef {\n return ref.hasOwnProperty('resourceId') && ref.hasOwnProperty('fieldName');\n}\n\nexport function isResource(ref: AnyRef): ref is AnyResourceRef {\n return (\n typeof ref === 'bigint' || (ref.hasOwnProperty('globalId') && ref.hasOwnProperty('localId'))\n );\n}\n\nexport function isResourceId(ref: AnyRef): ref is ResourceId {\n return typeof ref === 'bigint' && !isLocalResourceId(ref) && !isNullResourceId(ref);\n}\n\nexport function isFieldRef(ref: AnyFieldRef): ref is FieldRef {\n return isResourceRef(ref.resourceId);\n}\n\nexport function isResourceRef(ref: AnyResourceRef): ref is ResourceRef {\n return ref.hasOwnProperty('globalId') && ref.hasOwnProperty('localId');\n}\n\nexport function toFieldId(ref: AnyFieldRef): AnyFieldId {\n if (isFieldRef(ref)) return { resourceId: ref.resourceId.localId, fieldName: ref.fieldName };\n else return ref as FieldId;\n}\n\nexport async function toGlobalFieldId(ref: AnyFieldRef): Promise<FieldId> {\n if (isFieldRef(ref))\n return { resourceId: await ref.resourceId.globalId, fieldName: ref.fieldName };\n else return ref as FieldId;\n}\n\nexport function toResourceId(ref: AnyResourceRef): AnyResourceId {\n if (isResourceRef(ref)) return ref.localId;\n else return ref;\n}\n\nexport async function toGlobalResourceId(ref: AnyResourceRef): Promise<ResourceId> {\n if (isResourceRef(ref)) return await ref.globalId;\n else return ref;\n}\n\nexport function field(resourceId: AnyResourceRef, fieldName: string): AnyFieldRef {\n return { resourceId, fieldName };\n}\n\n/** If transaction commit failed due to write conflicts */\nexport class TxCommitConflict extends Error {\n name = 'TxCommitConflict';\n}\n\nasync function notFoundToUndefined<T>(cb: () => Promise<T>): Promise<T | undefined> {\n try {\n return await cb();\n } catch (e) {\n if (isNotFoundError(e)) return undefined;\n throw e;\n }\n}\n\n/**\n * Decorator that wraps the method's returned promise with this.track()\n * This ensures that the promise will be awaited before the transaction is completed.\n */\nfunction tracked<T extends (this: PlTransaction, ...a: any[]) => Promise<any>>(\n value: T,\n _context: ClassMethodDecoratorContext,\n) {\n return function (\n this: PlTransaction,\n ...args: Parameters<T>\n ): ReturnType<T> {\n return this.track(value.apply(this, args)) as ReturnType<T>;\n } as unknown as T;\n}\n\n/**\n * Each platform transaction has 3 stages:\n * - initialization (txOpen message -> txInfo response)\n * - communication (create resources, fields, references and so on)\n * - finalization (txCommit or txDiscard message)\n *\n * This class encapsulates finalization stage and provides ready-to-communication transaction object.\n * */\nexport class PlTransaction {\n private readonly globalTxId: Promise<bigint>;\n private readonly localTxId: number = PlTransaction.nextLocalTxId();\n\n /** Used in caching */\n private readonly txOpenTimestamp = Date.now();\n\n private localResourceIdCounter = 0;\n\n /** Store logical tx open / closed state to prevent invalid sequence of requests.\n * True means output stream was completed.\n * Contract: there must be no async operations between setting this field to true and sending complete signal to stream. */\n private _completed = false;\n\n private globalTxIdWasAwaited: boolean = false;\n\n public readonly pending = new PromiseTracker();\n\n private readonly _startTime = Date.now();\n private readonly _stat = initialTxStatWithoutTime();\n public get stat(): TxStat {\n return {\n ...this._stat,\n timeMs: Date.now() - this._startTime,\n };\n }\n\n constructor(\n private readonly ll: LLPlTransaction,\n public readonly name: string,\n public readonly writable: boolean,\n private readonly _clientRoot: OptionalResourceId,\n private readonly finalPredicate: FinalResourceDataPredicate,\n private readonly sharedResourceDataCache: LRUCache<ResourceId, ResourceDataCacheRecord>,\n private readonly enableFormattedErrors: boolean = false,\n ) {\n // initiating transaction\n this.globalTxId = this.sendSingleAndParse(\n {\n oneofKind: 'txOpen',\n txOpen: {\n name,\n enableFormattedErrors,\n writable: writable\n ? TxAPI_Open_Request_WritableTx.WRITABLE\n : TxAPI_Open_Request_WritableTx.NOT_WRITABLE,\n },\n },\n (r) => notEmpty(r.txOpen.tx?.id),\n );\n\n void this.track(this.globalTxId);\n\n // To avoid floating promise\n this.globalTxId.catch((err) => {\n if (!this.globalTxIdWasAwaited) {\n console.warn(err);\n }\n });\n\n // Adding stats\n this._stat.txCount++;\n }\n\n /**\n * Collect all pending promises for the transaction finalization.\n */\n public track<T>(promiseOrCallback: Promise<T> | (() => Promise<T>)): Promise<T> {\n return this.pending.track(promiseOrCallback);\n }\n\n private async drainAndAwaitPendingOps(): Promise<void> {\n // awaiting these pending operations first, to catch any errors\n await this.pending.awaitAll();\n }\n\n private sendSingleAndParse<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>, T>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>) => T,\n ): Promise<T> {\n return this.pending.track(async () => {\n const rawResponsePromise = this.ll.send(r, false);\n\n void this.pending.track(rawResponsePromise);\n\n await this.drainAndAwaitPendingOps();\n\n // awaiting our result, and parsing the response\n return parser(await rawResponsePromise);\n });\n }\n\n private sendMultiAndParse<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>, T>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>[]) => T,\n ): Promise<T> {\n return this.pending.track(async () => {\n const rawResponsePromise = this.ll.send(r, true);\n\n void this.pending.track(rawResponsePromise);\n\n await this.drainAndAwaitPendingOps();\n\n // awaiting our result, and parsing the response\n return parser(await rawResponsePromise);\n });\n }\n\n private async sendVoidSync<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n ): Promise<void> {\n await this.ll.send(r, false);\n }\n\n /** Requests sent with this method should never produce recoverable errors */\n private sendVoidAsync<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n r: OneOfKind<ClientMessageRequest, Kind>,\n ): void {\n void this.track(this.sendVoidSync(r));\n }\n\n private checkTxOpen() {\n if (this._completed) throw new Error('Transaction already closed');\n }\n\n public get completed() {\n return this._completed;\n }\n\n /** Commit & closes transaction. {@link TxCommitConflict} is thrown on\n * commit conflicts. */\n public async commit() {\n this.checkTxOpen();\n\n // tx will accept no requests after this one\n this._completed = true;\n\n if (!this.writable) {\n // no need to explicitly commit or reject read-only tx\n const completeResult = this.track(this.ll.complete());\n await this.drainAndAwaitPendingOps();\n await completeResult;\n await this.ll.await();\n } else {\n const commitResponse = this.track(this.sendSingleAndParse(\n { oneofKind: 'txCommit', txCommit: {} },\n (r) => r.txCommit.success,\n ));\n\n // send closing frame right after commit to save some time on round-trips\n const completeResult = this.track(this.ll.complete());\n\n // now when we pushed all packets into the stream, we should wait for any\n // pending void operations from before, to catch any errors\n await this.drainAndAwaitPendingOps();\n\n if (!(await commitResponse)) throw new TxCommitConflict();\n\n await completeResult;\n\n // await event-loop completion\n await this.ll.await();\n }\n }\n\n public async discard() {\n this.checkTxOpen();\n\n // tx will accept no requests after this one\n this._completed = true;\n\n const discardResponse = this.sendVoidSync({ oneofKind: 'txDiscard', txDiscard: {} });\n void this.track(discardResponse);\n // send closing frame right after commit to save some time on round-trips\n const completeResult = this.track(this.ll.complete());\n\n // now when we pushed all packets into the stream, we should wait for any\n // pending void operations from before, to catch any errors\n await this.drainAndAwaitPendingOps();\n\n await discardResponse;\n await completeResult;\n await this.ll.await();\n }\n\n //\n // Main tx methods\n //\n\n public get clientRoot(): ResourceId {\n return ensureResourceIdNotNull(this._clientRoot);\n }\n\n //\n // Resources\n //\n\n public createSingleton(\n name: string,\n type: ResourceType,\n errorIfExists: boolean = false,\n ): ResourceRef {\n const localId = this.nextLocalResourceId(false);\n\n const globalId = this.sendSingleAndParse(\n {\n oneofKind: 'resourceCreateSingleton',\n resourceCreateSingleton: {\n type,\n id: localId,\n data: Buffer.from(name),\n errorIfExists,\n },\n },\n (r) => r.resourceCreateSingleton.resourceId as ResourceId,\n );\n\n void this.track(globalId);\n\n return { globalId, localId };\n }\n\n public getSingleton(name: string, loadFields: true): Promise<ResourceData>;\n public getSingleton(name: string, loadFields: false): Promise<BasicResourceData>;\n public getSingleton(\n name: string,\n loadFields: boolean = true,\n ): Promise<BasicResourceData | ResourceData> {\n return this.sendSingleAndParse(\n {\n oneofKind: 'resourceGetSingleton',\n resourceGetSingleton: {\n data: Buffer.from(name),\n loadFields,\n },\n },\n (r) => protoToResource(notEmpty(r.resourceGetSingleton.resource)),\n );\n }\n\n private createResource<Kind extends NonUndefined<ClientMessageRequest['oneofKind']>>(\n root: boolean,\n req: (localId: LocalResourceId) => OneOfKind<ClientMessageRequest, Kind>,\n parser: (resp: OneOfKind<ServerMessageResponse, Kind>) => bigint,\n ): ResourceRef {\n const localId = this.nextLocalResourceId(root);\n\n const globalId = this.sendSingleAndParse(req(localId), (r) => parser(r) as ResourceId);\n\n void this.track(globalId);\n\n return { globalId, localId };\n }\n\n public createRoot(type: ResourceType): ResourceRef {\n this._stat.rootsCreated++;\n return this.createResource(\n true,\n (localId) => ({ oneofKind: 'resourceCreateRoot', resourceCreateRoot: { type, id: localId } }),\n (r) => r.resourceCreateRoot.resourceId,\n );\n }\n\n public createStruct(type: ResourceType, data?: Uint8Array | string): ResourceRef {\n this._stat.structsCreated++;\n this._stat.structsCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateStruct',\n resourceCreateStruct: {\n type,\n id: localId,\n data: data === undefined ? undefined : typeof data === 'string' ? Buffer.from(data) : data,\n },\n }),\n (r) => r.resourceCreateStruct.resourceId,\n );\n }\n\n public createEphemeral(type: ResourceType, data?: Uint8Array | string): ResourceRef {\n this._stat.ephemeralsCreated++;\n this._stat.ephemeralsCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateEphemeral',\n resourceCreateEphemeral: {\n type,\n id: localId,\n data: data === undefined ? undefined : typeof data === 'string' ? Buffer.from(data) : data,\n },\n }),\n (r) => r.resourceCreateEphemeral.resourceId,\n );\n }\n\n public createValue(\n type: ResourceType,\n data: Uint8Array | string,\n errorIfExists: boolean = false,\n ): ResourceRef {\n this._stat.valuesCreated++;\n this._stat.valuesCreatedDataBytes += data?.length ?? 0;\n return this.createResource(\n false,\n (localId) => ({\n oneofKind: 'resourceCreateValue',\n resourceCreateValue: {\n type,\n id: localId,\n data: typeof data === 'string' ? Buffer.from(data) : data,\n errorIfExists,\n },\n }),\n (r) => r.resourceCreateValue.resourceId,\n );\n }\n\n public createJsonValue(data: unknown): ResourceRef {\n const jsonData = canonicalJsonBytes(data);\n return this.createValue(JsonObject, jsonData, false);\n }\n\n public createJsonGzValue(data: unknown, minSizeToGzip: number | undefined = 16_384): ResourceRef {\n const { data: jsonData, isGzipped } = canonicalJsonGzBytes(data, minSizeToGzip);\n return this.createValue(isGzipped ? JsonGzObject : JsonObject, jsonData, false);\n }\n\n public createError(message: string): ResourceRef {\n return this.createValue(ErrorResourceType, JSON.stringify({ message } satisfies ErrorResourceData));\n }\n\n public setResourceName(name: string, rId: AnyResourceRef): void {\n this.sendVoidAsync({\n oneofKind: 'resourceNameSet',\n resourceNameSet: { resourceId: toResourceId(rId), name },\n });\n }\n\n public deleteResourceName(name: string): void {\n this.sendVoidAsync({ oneofKind: 'resourceNameDelete', resourceNameDelete: { name } });\n }\n\n public getResourceByName(name: string): Promise<ResourceId> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceNameGet', resourceNameGet: { name } },\n (r) => ensureResourceIdNotNull(r.resourceNameGet.resourceId as OptionalResourceId),\n );\n }\n\n public checkResourceNameExists(name: string): Promise<boolean> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceNameExists', resourceNameExists: { name } },\n (r) => r.resourceNameExists.exists,\n );\n }\n\n public removeResource(rId: ResourceId): void {\n this.sendVoidAsync({ oneofKind: 'resourceRemove', resourceRemove: { id: rId } });\n }\n\n public resourceExists(rId: ResourceId): Promise<boolean> {\n return this.sendSingleAndParse(\n { oneofKind: 'resourceExists', resourceExists: { resourceId: rId } },\n (r) => r.resourceExists.exists,\n );\n }\n\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(rId: AnyResourceRef, loadFields: true): Promise<ResourceData>;\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(rId: AnyResourceRef, loadFields: false): Promise<BasicResourceData>;\n /** This method may return stale resource state from cache if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean\n ): Promise<BasicResourceData | ResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: true,\n ignoreCache: boolean\n ): Promise<ResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: false,\n ignoreCache: boolean\n ): Promise<BasicResourceData>;\n /** This method may return stale resource state from cache if ignoreCache == false if resource was removed */\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean,\n ignoreCache: boolean\n ): Promise<BasicResourceData | ResourceData>;\n @tracked\n public async getResourceData(\n rId: AnyResourceRef,\n loadFields: boolean = true,\n ignoreCache: boolean = false,\n ): Promise<BasicResourceData | ResourceData> {\n if (!ignoreCache && !isResourceRef(rId) && !isLocalResourceId(rId)) {\n // checking if we can return result from cache\n const fromCache = this.sharedResourceDataCache.get(rId);\n if (fromCache && fromCache.cacheTxOpenTimestamp < this.txOpenTimestamp) {\n if (!loadFields) {\n this._stat.rGetDataCacheHits++;\n this._stat.rGetDataCacheBytes += fromCache.basicData.data?.length ?? 0;\n return fromCache.basicData;\n } else if (fromCache.data) {\n this._stat.rGetDataCacheHits++;\n this._stat.rGetDataCacheBytes += fromCache.basicData.data?.length ?? 0;\n this._stat.rGetDataCacheFields += fromCache.data.fields.length;\n return fromCache.data;\n }\n }\n }\n\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceGet',\n resourceGet: { resourceId: toResourceId(rId), loadFields: loadFields },\n },\n (r) => protoToResource(notEmpty(r.resourceGet.resource)),\n );\n\n this._stat.rGetDataNetRequests++;\n this._stat.rGetDataNetBytes += result.data?.length ?? 0;\n this._stat.rGetDataNetFields += result.fields.length;\n\n // we will cache only final resource data states\n // caching result even if we were ignore the cache\n if (!isResourceRef(rId) && !isLocalResourceId(rId) && this.finalPredicate(result)) {\n deepFreeze(result);\n const fromCache = this.sharedResourceDataCache.get(rId);\n if (fromCache) {\n if (loadFields && !fromCache.data) {\n fromCache.data = result;\n // updating timestamp because we updated the record\n fromCache.cacheTxOpenTimestamp = this.txOpenTimestamp;\n }\n } else {\n const basicData = extractBasicResourceData(result);\n deepFreeze(basicData);\n if (loadFields)\n this.sharedResourceDataCache.set(rId, {\n basicData,\n data: result,\n cacheTxOpenTimestamp: this.txOpenTimestamp,\n });\n else\n this.sharedResourceDataCache.set(rId, {\n basicData,\n data: undefined,\n cacheTxOpenTimestamp: this.txOpenTimestamp,\n });\n }\n }\n\n return result;\n }\n\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: true\n ): Promise<ResourceData | undefined>;\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: false\n ): Promise<BasicResourceData | undefined>;\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: boolean\n ): Promise<BasicResourceData | ResourceData | undefined>;\n @tracked\n public async getResourceDataIfExists(\n rId: AnyResourceRef,\n loadFields: boolean = true,\n ): Promise<BasicResourceData | ResourceData | undefined> {\n // calling this method will ignore cache, because user intention is to detect resource absence\n // which cache will prevent\n const result = await notFoundToUndefined(\n async () => await this.getResourceData(rId, loadFields, true),\n );\n\n // cleaning cache record if resource was removed from the db\n if (result === undefined && !isResourceRef(rId) && !isLocalResourceId(rId))\n this.sharedResourceDataCache.delete(rId);\n\n return result;\n }\n\n /**\n * Inform platform that resource will not get any new input fields.\n * This is required, when client creates resource without schema and wants\n * controller to start calculations.\n * Most controllers will not start calculations even when all inputs\n * have their values, if inputs list is not locked.\n */\n public lockInputs(rId: AnyResourceRef): void {\n this._stat.inputsLocked++;\n this.sendVoidAsync({\n oneofKind: 'resourceLockInputs',\n resourceLockInputs: { resourceId: toResourceId(rId) },\n });\n }\n\n /**\n * Inform platform that resource will not get any new output fields.\n * This is required for resource to pass deduplication.\n */\n public lockOutputs(rId: AnyResourceRef): void {\n this._stat.outputsLocked++;\n this.sendVoidAsync({\n oneofKind: 'resourceLockOutputs',\n resourceLockOutputs: { resourceId: toResourceId(rId) },\n });\n }\n\n public lock(rID: AnyResourceRef): void {\n this.lockInputs(rID);\n this.lockOutputs(rID);\n }\n\n public setResourceError(rId: AnyResourceRef, ref: AnyResourceRef): void {\n this.sendVoidAsync({\n oneofKind: 'resourceSetError',\n resourceSetError: { resourceId: toResourceId(rId), errorResourceId: toResourceId(ref) },\n });\n }\n\n //\n // Fields\n //\n\n public createField(fId: AnyFieldRef, fieldType: FieldType, value?: AnyRef): void {\n this._stat.fieldsCreated++;\n this.sendVoidAsync({\n oneofKind: 'fieldCreate',\n fieldCreate: { type: fieldTypeToProto(fieldType), id: toFieldId(fId) },\n });\n if (value !== undefined) this.setField(fId, value);\n }\n\n public fieldExists(fId: AnyFieldRef): Promise<boolean> {\n return this.sendSingleAndParse(\n {\n oneofKind: 'fieldExists',\n fieldExists: { field: toFieldId(fId) },\n },\n (r) => r.fieldExists.exists,\n );\n }\n\n public setField(fId: AnyFieldRef, ref: AnyRef): void {\n this._stat.fieldsSet++;\n if (isResource(ref))\n this.sendVoidAsync({\n oneofKind: 'fieldSet',\n fieldSet: {\n field: toFieldId(fId),\n value: {\n resourceId: toResourceId(ref),\n fieldName: '', // default value, read as undefined\n },\n },\n });\n else\n this.sendVoidAsync({\n oneofKind: 'fieldSet',\n fieldSet: {\n field: toFieldId(fId),\n value: toFieldId(ref),\n },\n });\n }\n\n public setFieldError(fId: AnyFieldRef, ref: AnyResourceRef): void {\n this._stat.fieldsSet++;\n this.sendVoidAsync({\n oneofKind: 'fieldSetError',\n fieldSetError: { field: toFieldId(fId), errResourceId: toResourceId(ref) },\n });\n }\n\n public getField(fId: AnyFieldRef): Promise<FieldData> {\n this._stat.fieldsGet++;\n return this.sendSingleAndParse(\n { oneofKind: 'fieldGet', fieldGet: { field: toFieldId(fId) } },\n (r) => protoToField(notEmpty(r.fieldGet.field)),\n );\n }\n\n @tracked\n public async getFieldIfExists(fId: AnyFieldRef): Promise<FieldData | undefined> {\n return notFoundToUndefined(async () => await this.getField(fId));\n }\n\n public resetField(fId: AnyFieldRef): void {\n this.sendVoidAsync({ oneofKind: 'fieldReset', fieldReset: { field: toFieldId(fId) } });\n }\n\n public removeField(fId: AnyFieldRef): void {\n this.sendVoidAsync({ oneofKind: 'fieldRemove', fieldRemove: { field: toFieldId(fId) } });\n }\n\n //\n // KV\n //\n\n @tracked\n public async listKeyValues(rId: AnyResourceRef): Promise<KeyValue[]> {\n const result = await this.sendMultiAndParse(\n {\n oneofKind: 'resourceKeyValueList',\n resourceKeyValueList: { resourceId: toResourceId(rId), startFrom: '', limit: 0 },\n },\n (r) => r.map((e) => e.resourceKeyValueList.record!),\n );\n\n this._stat.kvListRequests++;\n this._stat.kvListEntries += result.length;\n for (const kv of result) this._stat.kvListBytes += kv.key.length + kv.value.length;\n\n return result;\n }\n\n @tracked\n public async listKeyValuesString(rId: AnyResourceRef): Promise<KeyValueString[]> {\n return (await this.listKeyValues(rId)).map(({ key, value }) => ({\n key,\n value: Buffer.from(value).toString(),\n }));\n }\n\n @tracked\n public async listKeyValuesIfResourceExists(rId: AnyResourceRef): Promise<KeyValue[] | undefined> {\n return notFoundToUndefined(async () => await this.listKeyValues(rId));\n }\n\n @tracked\n public async listKeyValuesStringIfResourceExists(\n rId: AnyResourceRef,\n ): Promise<KeyValueString[] | undefined> {\n return notFoundToUndefined(async () => await this.listKeyValuesString(rId));\n }\n\n public setKValue(rId: AnyResourceRef, key: string, value: Uint8Array | string): void {\n this._stat.kvSetRequests++;\n this._stat.kvSetBytes++;\n this.sendVoidAsync({\n oneofKind: 'resourceKeyValueSet',\n resourceKeyValueSet: {\n resourceId: toResourceId(rId),\n key,\n value: toBytes(value),\n },\n });\n }\n\n public deleteKValue(rId: AnyResourceRef, key: string): void {\n this.sendVoidAsync({\n oneofKind: 'resourceKeyValueDelete',\n resourceKeyValueDelete: {\n resourceId: toResourceId(rId),\n key,\n },\n });\n }\n\n @tracked\n public async getKValue(rId: AnyResourceRef, key: string): Promise<Uint8Array> {\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceKeyValueGet',\n resourceKeyValueGet: { resourceId: toResourceId(rId), key },\n },\n (r) => r.resourceKeyValueGet.value,\n );\n\n this._stat.kvGetRequests++;\n this._stat.kvGetBytes += result.length;\n\n return result;\n }\n\n @tracked\n public async getKValueString(rId: AnyResourceRef, key: string): Promise<string> {\n return Buffer.from(await this.getKValue(rId, key)).toString();\n }\n\n @tracked\n public async getKValueJson<T>(rId: AnyResourceRef, key: string): Promise<T> {\n return JSON.parse(await this.getKValueString(rId, key)) as T;\n }\n\n @tracked\n public async getKValueIfExists(\n rId: AnyResourceRef,\n key: string,\n ): Promise<Uint8Array | undefined> {\n const result = await this.sendSingleAndParse(\n {\n oneofKind: 'resourceKeyValueGetIfExists',\n resourceKeyValueGetIfExists: { resourceId: toResourceId(rId), key },\n },\n (r) =>\n r.resourceKeyValueGetIfExists.exists ? r.resourceKeyValueGetIfExists.value : undefined,\n );\n\n this._stat.kvGetRequests++;\n this._stat.kvGetBytes += result?.length ?? 0;\n\n return result;\n }\n\n @tracked\n public async getKValueStringIfExists(\n rId: AnyResourceRef,\n key: string,\n ): Promise<string | undefined> {\n const data = await this.getKValueIfExists(rId, key);\n return data === undefined ? undefined : Buffer.from(data).toString();\n }\n\n @tracked\n public async getKValueJsonIfExists<T>(rId: AnyResourceRef, key: string): Promise<T | undefined> {\n const str = await this.getKValueString(rId, key);\n if (str === undefined) return undefined;\n return JSON.parse(str) as T;\n }\n\n //\n // Cache\n //\n // TODO\n\n //\n // High level ops\n //\n\n /** Resolves existing or create first level resource from */\n public getFutureFieldValue(rId: AnyRef, fieldName: string, fieldType: FutureFieldType): FieldRef {\n const data = Buffer.from(JSON.stringify({ fieldName, fieldType }));\n const getFieldResource = this.createEphemeral({ name: 'json/getField', version: '1' }, data);\n this.setField({ resourceId: getFieldResource, fieldName: 'resource' }, rId);\n return { resourceId: getFieldResource, fieldName: 'result' };\n }\n\n //\n // Technical\n //\n\n public async getGlobalTxId() {\n this.globalTxIdWasAwaited = true;\n return await this.globalTxId;\n }\n\n /** Closes output event stream */\n public async complete() {\n if (this._completed) return;\n this._completed = true;\n const completeResult = this.track(this.ll.complete());\n await this.drainAndAwaitPendingOps();\n await completeResult;\n }\n\n /** Await incoming message loop termination and throw\n * any leftover errors if it was unsuccessful */\n public async await() {\n await this.ll.await();\n }\n\n //\n // Helpers\n //\n\n private nextLocalResourceId(root: boolean): LocalResourceId {\n return createLocalResourceId(root, ++this.localResourceIdCounter, this.localTxId);\n }\n\n private static localTxIdCounter = 0;\n\n private static nextLocalTxId() {\n PlTransaction.localTxIdCounter++;\n if (PlTransaction.localTxIdCounter === MaxTxId) PlTransaction.localTxIdCounter = 1;\n return PlTransaction.localTxIdCounter;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAkFM,SAAU,OAAO,CAAC,GAAW,EAAA;AACjC,IAAA,OAAO,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC;AAC5E;AAEM,SAAU,UAAU,CAAC,GAAW,EAAA;IACpC,QACE,OAAO,GAAG,KAAK,QAAQ,KAAK,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAEhG;AAEM,SAAU,YAAY,CAAC,GAAW,EAAA;AACtC,IAAA,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;AACrF;AAEM,SAAU,UAAU,CAAC,GAAgB,EAAA;AACzC,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC;AACtC;AAEM,SAAU,aAAa,CAAC,GAAmB,EAAA;AAC/C,IAAA,OAAO,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC;AACxE;AAEM,SAAU,SAAS,CAAC,GAAgB,EAAA;IACxC,IAAI,UAAU,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE;;AACvF,QAAA,OAAO,GAAc;AAC5B;AAEO,eAAe,eAAe,CAAC,GA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QAAQ,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC;YAC3E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC9D;;;;AAMO,QAAA,MAAM,aAAa,GAAA;AACxB,YAAA,IAAI,CAAC,oBAAoB,GAAG,IAAI;AAChC,YAAA,OAAO,MAAM,IAAI,CAAC,UAAU;QAC9B;;AAGO,QAAA,MAAM,QAAQ,GAAA;YACnB,IAAI,IAAI,CAAC,UAAU;gBAAE;AACrB,YAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,YAAA,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;AACrD,YAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;AACpC,YAAA,MAAM,cAAc;QACtB;AAEA;AACgD;AACzC,QAAA,MAAM,KAAK,GAAA;AAChB,YAAA,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;QACvB;;;;AAMQ,QAAA,mBAAmB,CAAC,IAAa,EAAA;AACvC,YAAA,OAAO,qBAAqB,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC;QACnF;AAEQ,QAAA,OAAO,gBAAgB,GAAG,CAAC;AAE3B,QAAA,OAAO,aAAa,GAAA;YAC1B,aAAa,CAAC,gBAAgB,EAAE;AAChC,YAAA,IAAI,aAAa,CAAC,gBAAgB,KAAK,OAAO;AAAE,gBAAA,aAAa,CAAC,gBAAgB,GAAG,CAAC;YAClF,OAAO,aAAa,CAAC,gBAAgB;QACvC;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var api_types = require('../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs');
|
|
4
|
-
var base_types = require('../proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs');
|
|
3
|
+
var api_types = require('../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs');
|
|
4
|
+
var base_types = require('../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs');
|
|
5
5
|
var types = require('./types.cjs');
|
|
6
6
|
var tsHelpers = require('@milaboratories/ts-helpers');
|
|
7
7
|
var errors = require('./errors.cjs');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_conversion.cjs","sources":["../../src/core/type_conversion.ts"],"sourcesContent":["import type {\n Field,\n Resource } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport {\n Field_ValueStatus,\n Resource_Kind,\n} from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport { FieldType as GrpcFieldType } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/base_types';\nimport type {\n FieldData,\n FieldStatus,\n OptionalResourceId,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceKind,\n} from './types';\nimport {\n NullResourceId,\n} from './types';\nimport { assertNever, notEmpty } from '@milaboratories/ts-helpers';\nimport { throwPlNotFoundError } from './errors';\n\nconst ResourceErrorField = 'resourceError';\n\nfunction resourceIsDeleted(proto: Resource): boolean {\n return proto.deletedTime !== undefined && proto.deletedTime.seconds !== 0n;\n}\n\n/** Throws \"native\" pl not found error, if resource is marked as deleted. */\nexport function protoToResource(proto: Resource): ResourceData {\n if (resourceIsDeleted(proto)) throwPlNotFoundError('resource deleted');\n return {\n id: proto.id as ResourceId,\n originalResourceId: proto.originalResourceId as OptionalResourceId,\n type: notEmpty(proto.type),\n data: proto.data,\n inputsLocked: proto.inputsLocked,\n outputsLocked: proto.outputsLocked,\n resourceReady: proto.resourceReady,\n kind: protoToResourceKind(proto.kind),\n error: protoToError(proto),\n final: proto.isFinal,\n fields: proto.fields?.filter((f) => f.id!.fieldName !== ResourceErrorField).map(protoToField),\n };\n}\n\nfunction protoToResourceKind(proto: Resource_Kind): ResourceKind {\n switch (proto) {\n case Resource_Kind.STRUCTURAL:\n return 'Structural';\n case Resource_Kind.VALUE:\n return 'Value';\n }\n\n throw new Error('invalid ResourceKind: ' + proto);\n}\n\nfunction protoToError(proto: Resource): OptionalResourceId {\n const f = proto.fields.find((f) => f?.id?.fieldName === ResourceErrorField);\n return (f?.error ?? NullResourceId) as OptionalResourceId;\n}\n\nexport function protoToField(proto: Field): FieldData {\n return {\n name: notEmpty(proto.id?.fieldName),\n type: protoToFieldType(proto.type),\n status: protoToFieldStatus(proto.valueStatus),\n value: proto.value as OptionalResourceId,\n error: proto.error as OptionalResourceId,\n valueIsFinal: proto.valueIsFinal,\n };\n}\n\nfunction protoToFieldType(proto: GrpcFieldType): FieldType {\n switch (proto) {\n case GrpcFieldType.INPUT:\n return 'Input';\n case GrpcFieldType.OUTPUT:\n return 'Output';\n case GrpcFieldType.SERVICE:\n return 'Service';\n case GrpcFieldType.ONE_TIME_WRITABLE:\n return 'OTW';\n case GrpcFieldType.DYNAMIC:\n return 'Dynamic';\n case GrpcFieldType.MULTIPLE_TIMES_WRITABLE:\n return 'MTW';\n default:\n throw new Error('invalid FieldType: ' + proto);\n }\n}\n\nfunction protoToFieldStatus(proto: Field_ValueStatus): FieldStatus {\n switch (proto) {\n case Field_ValueStatus.EMPTY:\n return 'Empty';\n case Field_ValueStatus.ASSIGNED:\n return 'Assigned';\n case Field_ValueStatus.RESOLVED:\n return 'Resolved';\n default:\n throw new Error('invalid FieldStatus: ' + proto);\n }\n}\n\nexport function fieldTypeToProto(type: FieldType): GrpcFieldType {\n switch (type) {\n case 'Input':\n return GrpcFieldType.INPUT;\n case 'Output':\n return GrpcFieldType.OUTPUT;\n case 'Dynamic':\n return GrpcFieldType.DYNAMIC;\n case 'Service':\n return GrpcFieldType.SERVICE;\n case 'MTW':\n return GrpcFieldType.MULTIPLE_TIMES_WRITABLE;\n case 'OTW':\n return GrpcFieldType.ONE_TIME_WRITABLE;\n default:\n return assertN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B,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;QACnB,KAAKA,2BAAiB,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;AACnB,QAAA;AACE,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC;;AAEtD;AAEM,SAAU,gBAAgB,CAAC,IAAe,EAAA;IAC9C,QAAQ,IAAI;AACV,QAAA,KAAK,OAAO;YACV,OAAOD,oBAAa,CAAC,KAAK;AAC5B,QAAA,KAAK,QAAQ;YACX,OAAOA,oBAAa,CAAC,MAAM;AAC7B,QAAA,KAAK,SAAS;YACZ,OAAOA,oBAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,SAAS;YACZ,OAAOA,oBAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,KAAK;YACR,OAAOA,oBAAa,CAAC,uBAAuB;AAC9C,QAAA,KAAK,KAAK;YACR,OAAOA,oBAAa,CAAC,iBAAiB;AACxC,QAAA;AACE,YAAA,OAAOE,qBAAW,CAAC,IAAI,CAAC;;AAE9B;;;;;;"}
|
|
1
|
+
{"version":3,"file":"type_conversion.cjs","sources":["../../src/core/type_conversion.ts"],"sourcesContent":["import type {\n Field,\n Resource } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport {\n Field_ValueStatus,\n Resource_Kind,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport { FieldType as GrpcFieldType } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types';\nimport type {\n FieldData,\n FieldStatus,\n OptionalResourceId,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceKind,\n} from './types';\nimport {\n NullResourceId,\n} from './types';\nimport { assertNever, notEmpty } from '@milaboratories/ts-helpers';\nimport { throwPlNotFoundError } from './errors';\n\nconst ResourceErrorField = 'resourceError';\n\nfunction resourceIsDeleted(proto: Resource): boolean {\n return proto.deletedTime !== undefined && proto.deletedTime.seconds !== 0n;\n}\n\n/** Throws \"native\" pl not found error, if resource is marked as deleted. */\nexport function protoToResource(proto: Resource): ResourceData {\n if (resourceIsDeleted(proto)) throwPlNotFoundError('resource deleted');\n return {\n id: proto.id as ResourceId,\n originalResourceId: proto.originalResourceId as OptionalResourceId,\n type: notEmpty(proto.type),\n data: proto.data,\n inputsLocked: proto.inputsLocked,\n outputsLocked: proto.outputsLocked,\n resourceReady: proto.resourceReady,\n kind: protoToResourceKind(proto.kind),\n error: protoToError(proto),\n final: proto.isFinal,\n fields: proto.fields?.filter((f) => f.id!.fieldName !== ResourceErrorField).map(protoToField),\n };\n}\n\nfunction protoToResourceKind(proto: Resource_Kind): ResourceKind {\n switch (proto) {\n case Resource_Kind.STRUCTURAL:\n return 'Structural';\n case Resource_Kind.VALUE:\n return 'Value';\n }\n\n throw new Error('invalid ResourceKind: ' + proto);\n}\n\nfunction protoToError(proto: Resource): OptionalResourceId {\n const f = proto.fields.find((f) => f?.id?.fieldName === ResourceErrorField);\n return (f?.error ?? NullResourceId) as OptionalResourceId;\n}\n\nexport function protoToField(proto: Field): FieldData {\n return {\n name: notEmpty(proto.id?.fieldName),\n type: protoToFieldType(proto.type),\n status: protoToFieldStatus(proto.valueStatus),\n value: proto.value as OptionalResourceId,\n error: proto.error as OptionalResourceId,\n valueIsFinal: proto.valueIsFinal,\n };\n}\n\nfunction protoToFieldType(proto: GrpcFieldType): FieldType {\n switch (proto) {\n case GrpcFieldType.INPUT:\n return 'Input';\n case GrpcFieldType.OUTPUT:\n return 'Output';\n case GrpcFieldType.SERVICE:\n return 'Service';\n case GrpcFieldType.ONE_TIME_WRITABLE:\n return 'OTW';\n case GrpcFieldType.DYNAMIC:\n return 'Dynamic';\n case GrpcFieldType.MULTIPLE_TIMES_WRITABLE:\n return 'MTW';\n default:\n throw new Error('invalid FieldType: ' + proto);\n }\n}\n\nfunction protoToFieldStatus(proto: Field_ValueStatus): FieldStatus {\n switch (proto) {\n case Field_ValueStatus.EMPTY:\n return 'Empty';\n case Field_ValueStatus.ASSIGNED:\n return 'Assigned';\n case Field_ValueStatus.RESOLVED:\n return 'Resolved';\n default:\n throw new Error('invalid FieldStatus: ' + proto);\n }\n}\n\nexport function fieldTypeToProto(type: FieldType): GrpcFieldType {\n switch (type) {\n case 'Input':\n return GrpcFieldType.INPUT;\n case 'Output':\n return GrpcFieldType.OUTPUT;\n case 'Dynamic':\n return GrpcFieldType.DYNAMIC;\n case 'Service':\n return GrpcFieldType.SERVICE;\n case 'MTW':\n return GrpcFieldType.MULTIPLE_TIMES_WRITABLE;\n case 'OTW':\n return GrpcFieldType.ONE_TIME_WRITABLE;\n default:\n return assertNever(type);\n }\n}\n"],"names":["throwPlNotFoundError","notEmpty","Resource_Kind","NullResourceId","GrpcFieldType","Field_ValueStatus","assertNever"],"mappings":";;;;;;;;AAuBA,MAAM,kBAAkB,GAAG,eAAe;AAE1C,SAAS,iBAAiB,CAAC,KAAe,EAAA;AACxC,IAAA,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,KAAK,EAAE;AAC5E;AAEA;AACM,SAAU,eAAe,CAAC,KAAe,EAAA;IAC7C,IAAI,iBAAiB,CAAC,KAAK,CAAC;QAAEA,2BAAoB,CAAC,kBAAkB,CAAC;IACtE,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAgB;QAC1B,kBAAkB,EAAE,KAAK,CAAC,kBAAwC;AAClE,QAAA,IAAI,EAAEC,kBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,aAAa,EAAE,KAAK,CAAC,aAAa;AAClC,QAAA,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;AACrC,QAAA,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE,KAAK,CAAC,OAAO;Q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KAAKA,oBAAa,CAAC,iBAAiB;AAClC,YAAA,OAAO,KAAK;QACd,KAAKA,oBAAa,CAAC,OAAO;AACxB,YAAA,OAAO,SAAS;QAClB,KAAKA,oBAAa,CAAC,uBAAuB;AACxC,YAAA,OAAO,KAAK;AACd,QAAA;AACE,YAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,KAAK,CAAC;;AAEpD;AAEA,SAAS,kBAAkB,CAAC,KAAwB,EAAA;IAClD,QAAQ,KAAK;QACX,KAAKC,2BAAiB,CAAC,KAAK;AAC1B,YAAA,OAAO,OAAO;QAChB,KAAKA,2BAAiB,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;QACnB,KAAKA,2BAAiB,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;AACnB,QAAA;AACE,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC;;AAEtD;AAEM,SAAU,gBAAgB,CAAC,IAAe,EAAA;IAC9C,QAAQ,IAAI;AACV,QAAA,KAAK,OAAO;YACV,OAAOD,oBAAa,CAAC,KAAK;AAC5B,QAAA,KAAK,QAAQ;YACX,OAAOA,oBAAa,CAAC,MAAM;AAC7B,QAAA,KAAK,SAAS;YACZ,OAAOA,oBAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,SAAS;YACZ,OAAOA,oBAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,KAAK;YACR,OAAOA,oBAAa,CAAC,uBAAuB;AAC9C,QAAA,KAAK,KAAK;YACR,OAAOA,oBAAa,CAAC,iBAAiB;AACxC,QAAA;AACE,YAAA,OAAOE,qBAAW,CAAC,IAAI,CAAC;;AAE9B;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Field, Resource } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types';
|
|
2
|
-
import { FieldType as GrpcFieldType } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/base_types';
|
|
1
|
+
import type { Field, Resource } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types';
|
|
2
|
+
import { FieldType as GrpcFieldType } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types';
|
|
3
3
|
import type { FieldData, FieldType, ResourceData } from './types';
|
|
4
4
|
/** Throws "native" pl not found error, if resource is marked as deleted. */
|
|
5
5
|
export declare function protoToResource(proto: Resource): ResourceData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_conversion.d.ts","sourceRoot":"","sources":["../../src/core/type_conversion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"type_conversion.d.ts","sourceRoot":"","sources":["../../src/core/type_conversion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,QAAQ,EAAE,MAAM,qEAAqE,CAAC;AAKxF,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,sEAAsE,CAAC;AAClH,OAAO,KAAK,EACV,SAAS,EAGT,SAAS,EACT,YAAY,EAGb,MAAM,SAAS,CAAC;AAajB,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,CAe7D;AAkBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CASpD;AAkCD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,aAAa,CAiB/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Resource_Kind, Field_ValueStatus } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js';
|
|
2
|
-
import { FieldType } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js';
|
|
1
|
+
import { Resource_Kind, Field_ValueStatus } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js';
|
|
2
|
+
import { FieldType } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js';
|
|
3
3
|
import { NullResourceId } from './types.js';
|
|
4
4
|
import { notEmpty, assertNever } from '@milaboratories/ts-helpers';
|
|
5
5
|
import { throwPlNotFoundError } from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_conversion.js","sources":["../../src/core/type_conversion.ts"],"sourcesContent":["import type {\n Field,\n Resource } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport {\n Field_ValueStatus,\n Resource_Kind,\n} from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport { FieldType as GrpcFieldType } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/base_types';\nimport type {\n FieldData,\n FieldStatus,\n OptionalResourceId,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceKind,\n} from './types';\nimport {\n NullResourceId,\n} from './types';\nimport { assertNever, notEmpty } from '@milaboratories/ts-helpers';\nimport { throwPlNotFoundError } from './errors';\n\nconst ResourceErrorField = 'resourceError';\n\nfunction resourceIsDeleted(proto: Resource): boolean {\n return proto.deletedTime !== undefined && proto.deletedTime.seconds !== 0n;\n}\n\n/** Throws \"native\" pl not found error, if resource is marked as deleted. */\nexport function protoToResource(proto: Resource): ResourceData {\n if (resourceIsDeleted(proto)) throwPlNotFoundError('resource deleted');\n return {\n id: proto.id as ResourceId,\n originalResourceId: proto.originalResourceId as OptionalResourceId,\n type: notEmpty(proto.type),\n data: proto.data,\n inputsLocked: proto.inputsLocked,\n outputsLocked: proto.outputsLocked,\n resourceReady: proto.resourceReady,\n kind: protoToResourceKind(proto.kind),\n error: protoToError(proto),\n final: proto.isFinal,\n fields: proto.fields?.filter((f) => f.id!.fieldName !== ResourceErrorField).map(protoToField),\n };\n}\n\nfunction protoToResourceKind(proto: Resource_Kind): ResourceKind {\n switch (proto) {\n case Resource_Kind.STRUCTURAL:\n return 'Structural';\n case Resource_Kind.VALUE:\n return 'Value';\n }\n\n throw new Error('invalid ResourceKind: ' + proto);\n}\n\nfunction protoToError(proto: Resource): OptionalResourceId {\n const f = proto.fields.find((f) => f?.id?.fieldName === ResourceErrorField);\n return (f?.error ?? NullResourceId) as OptionalResourceId;\n}\n\nexport function protoToField(proto: Field): FieldData {\n return {\n name: notEmpty(proto.id?.fieldName),\n type: protoToFieldType(proto.type),\n status: protoToFieldStatus(proto.valueStatus),\n value: proto.value as OptionalResourceId,\n error: proto.error as OptionalResourceId,\n valueIsFinal: proto.valueIsFinal,\n };\n}\n\nfunction protoToFieldType(proto: GrpcFieldType): FieldType {\n switch (proto) {\n case GrpcFieldType.INPUT:\n return 'Input';\n case GrpcFieldType.OUTPUT:\n return 'Output';\n case GrpcFieldType.SERVICE:\n return 'Service';\n case GrpcFieldType.ONE_TIME_WRITABLE:\n return 'OTW';\n case GrpcFieldType.DYNAMIC:\n return 'Dynamic';\n case GrpcFieldType.MULTIPLE_TIMES_WRITABLE:\n return 'MTW';\n default:\n throw new Error('invalid FieldType: ' + proto);\n }\n}\n\nfunction protoToFieldStatus(proto: Field_ValueStatus): FieldStatus {\n switch (proto) {\n case Field_ValueStatus.EMPTY:\n return 'Empty';\n case Field_ValueStatus.ASSIGNED:\n return 'Assigned';\n case Field_ValueStatus.RESOLVED:\n return 'Resolved';\n default:\n throw new Error('invalid FieldStatus: ' + proto);\n }\n}\n\nexport function fieldTypeToProto(type: FieldType): GrpcFieldType {\n switch (type) {\n case 'Input':\n return GrpcFieldType.INPUT;\n case 'Output':\n return GrpcFieldType.OUTPUT;\n case 'Dynamic':\n return GrpcFieldType.DYNAMIC;\n case 'Service':\n return GrpcFieldType.SERVICE;\n case 'MTW':\n return GrpcFieldType.MULTIPLE_TIMES_WRITABLE;\n case 'OTW':\n return GrpcFieldType.ONE_TIME_WRITABLE;\n default:\n return assertNever(type);\n }\n}\n"],"names":["GrpcFieldType"],"mappings":";;;;;;AAuBA,MAAM,kBAAkB,GAAG,eAAe;AAE1C,SAAS,iBAAiB,CAAC,KAAe,EAAA;AACxC,IAAA,OAAO,KAAK,CA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AAQ,IAAI;AACV,QAAA,KAAK,OAAO;YACV,OAAOA,SAAa,CAAC,KAAK;AAC5B,QAAA,KAAK,QAAQ;YACX,OAAOA,SAAa,CAAC,MAAM;AAC7B,QAAA,KAAK,SAAS;YACZ,OAAOA,SAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,SAAS;YACZ,OAAOA,SAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,KAAK;YACR,OAAOA,SAAa,CAAC,uBAAuB;AAC9C,QAAA,KAAK,KAAK;YACR,OAAOA,SAAa,CAAC,iBAAiB;AACxC,QAAA;AACE,YAAA,OAAO,WAAW,CAAC,IAAI,CAAC;;AAE9B;;;;"}
|
|
1
|
+
{"version":3,"file":"type_conversion.js","sources":["../../src/core/type_conversion.ts"],"sourcesContent":["import type {\n Field,\n Resource } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport {\n Field_ValueStatus,\n Resource_Kind,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types';\nimport { FieldType as GrpcFieldType } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types';\nimport type {\n FieldData,\n FieldStatus,\n OptionalResourceId,\n FieldType,\n ResourceData,\n ResourceId,\n ResourceKind,\n} from './types';\nimport {\n NullResourceId,\n} from './types';\nimport { assertNever, notEmpty } from '@milaboratories/ts-helpers';\nimport { throwPlNotFoundError } from './errors';\n\nconst ResourceErrorField = 'resourceError';\n\nfunction resourceIsDeleted(proto: Resource): boolean {\n return proto.deletedTime !== undefined && proto.deletedTime.seconds !== 0n;\n}\n\n/** Throws \"native\" pl not found error, if resource is marked as deleted. */\nexport function protoToResource(proto: Resource): ResourceData {\n if (resourceIsDeleted(proto)) throwPlNotFoundError('resource deleted');\n return {\n id: proto.id as ResourceId,\n originalResourceId: proto.originalResourceId as OptionalResourceId,\n type: notEmpty(proto.type),\n data: proto.data,\n inputsLocked: proto.inputsLocked,\n outputsLocked: proto.outputsLocked,\n resourceReady: proto.resourceReady,\n kind: protoToResourceKind(proto.kind),\n error: protoToError(proto),\n final: proto.isFinal,\n fields: proto.fields?.filter((f) => f.id!.fieldName !== ResourceErrorField).map(protoToField),\n };\n}\n\nfunction protoToResourceKind(proto: Resource_Kind): ResourceKind {\n switch (proto) {\n case Resource_Kind.STRUCTURAL:\n return 'Structural';\n case Resource_Kind.VALUE:\n return 'Value';\n }\n\n throw new Error('invalid ResourceKind: ' + proto);\n}\n\nfunction protoToError(proto: Resource): OptionalResourceId {\n const f = proto.fields.find((f) => f?.id?.fieldName === ResourceErrorField);\n return (f?.error ?? NullResourceId) as OptionalResourceId;\n}\n\nexport function protoToField(proto: Field): FieldData {\n return {\n name: notEmpty(proto.id?.fieldName),\n type: protoToFieldType(proto.type),\n status: protoToFieldStatus(proto.valueStatus),\n value: proto.value as OptionalResourceId,\n error: proto.error as OptionalResourceId,\n valueIsFinal: proto.valueIsFinal,\n };\n}\n\nfunction protoToFieldType(proto: GrpcFieldType): FieldType {\n switch (proto) {\n case GrpcFieldType.INPUT:\n return 'Input';\n case GrpcFieldType.OUTPUT:\n return 'Output';\n case GrpcFieldType.SERVICE:\n return 'Service';\n case GrpcFieldType.ONE_TIME_WRITABLE:\n return 'OTW';\n case GrpcFieldType.DYNAMIC:\n return 'Dynamic';\n case GrpcFieldType.MULTIPLE_TIMES_WRITABLE:\n return 'MTW';\n default:\n throw new Error('invalid FieldType: ' + proto);\n }\n}\n\nfunction protoToFieldStatus(proto: Field_ValueStatus): FieldStatus {\n switch (proto) {\n case Field_ValueStatus.EMPTY:\n return 'Empty';\n case Field_ValueStatus.ASSIGNED:\n return 'Assigned';\n case Field_ValueStatus.RESOLVED:\n return 'Resolved';\n default:\n throw new Error('invalid FieldStatus: ' + proto);\n }\n}\n\nexport function fieldTypeToProto(type: FieldType): GrpcFieldType {\n switch (type) {\n case 'Input':\n return GrpcFieldType.INPUT;\n case 'Output':\n return GrpcFieldType.OUTPUT;\n case 'Dynamic':\n return GrpcFieldType.DYNAMIC;\n case 'Service':\n return GrpcFieldType.SERVICE;\n case 'MTW':\n return GrpcFieldType.MULTIPLE_TIMES_WRITABLE;\n case 'OTW':\n return GrpcFieldType.ONE_TIME_WRITABLE;\n default:\n return assertNever(type);\n }\n}\n"],"names":["GrpcFieldType"],"mappings":";;;;;;AAuBA,MAAM,kBAAkB,GAAG,eAAe;AAE1C,SAAS,iBAAiB,CAAC,KAAe,EAAA;AACxC,IAAA,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,KAAK,EAAE;AAC5E;AAEA;AACM,SAAU,eAAe,CAAC,KAAe,EAAA;IAC7C,IAAI,iBAAiB,CAAC,KAAK,CAAC;QAAE,oBAAoB,CAAC,kBAAkB,CAAC;IACtE,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAgB;QAC1B,kBAAkB,EAAE,KAAK,CAAC,kBAAwC;AAClE,QAAA,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,aAAa,EAAE,KAAK,CAAC,aAAa;AAClC,QAAA,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;AACrC,QAAA,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE,KAAK,CAAC,OAAO;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAG,CAAC,SAAS,KAAK,kBAAkB,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;KAC9F;AACH;AAEA,SAAS,mBAAmB,CAAC,KAAoB,EAAA;IAC/C,QAAQ,KAAK;QACX,KAAK,aAAa,CAAC,UAAU;AAC3B,YAAA,OAAO,YAAY;QACrB,KAAK,aAAa,CAAC,KAAK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B,CAAC,KAAK;AAC1B,YAAA,OAAO,OAAO;QAChB,KAAK,iBAAiB,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;QACnB,KAAK,iBAAiB,CAAC,QAAQ;AAC7B,YAAA,OAAO,UAAU;AACnB,QAAA;AACE,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC;;AAEtD;AAEM,SAAU,gBAAgB,CAAC,IAAe,EAAA;IAC9C,QAAQ,IAAI;AACV,QAAA,KAAK,OAAO;YACV,OAAOA,SAAa,CAAC,KAAK;AAC5B,QAAA,KAAK,QAAQ;YACX,OAAOA,SAAa,CAAC,MAAM;AAC7B,QAAA,KAAK,SAAS;YACZ,OAAOA,SAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,SAAS;YACZ,OAAOA,SAAa,CAAC,OAAO;AAC9B,QAAA,KAAK,KAAK;YACR,OAAOA,SAAa,CAAC,uBAAuB;AAC9C,QAAA,KAAK,KAAK;YACR,OAAOA,SAAa,CAAC,iBAAiB;AACxC,QAAA;AACE,YAAA,OAAO,WAAW,CAAC,IAAI,CAAC;;AAE9B;;;;"}
|
|
@@ -11,22 +11,18 @@ class UnauthenticatedPlClient {
|
|
|
11
11
|
this.ll = new ll_client.LLPlClient(configOrAddress);
|
|
12
12
|
}
|
|
13
13
|
async ping() {
|
|
14
|
-
return
|
|
14
|
+
return await this.ll.ping();
|
|
15
15
|
}
|
|
16
16
|
async authMethods() {
|
|
17
|
-
return
|
|
17
|
+
return await this.ll.authMethods();
|
|
18
18
|
}
|
|
19
19
|
async requireAuth() {
|
|
20
20
|
return (await this.authMethods()).methods.length > 0;
|
|
21
21
|
}
|
|
22
22
|
async login(user, password) {
|
|
23
23
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64'),
|
|
27
|
-
},
|
|
28
|
-
}).response;
|
|
29
|
-
const jwtToken = tsHelpers.notEmpty(response.token);
|
|
24
|
+
const token = await this.ll.getJwtToken(BigInt(this.ll.conf.authTTLSeconds), { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') });
|
|
25
|
+
const jwtToken = tsHelpers.notEmpty(token);
|
|
30
26
|
if (jwtToken === '')
|
|
31
27
|
throw new Error('empty token');
|
|
32
28
|
return { jwtToken };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.cjs","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n constructor(configOrAddress: PlClientConfig | string) {\n this.ll = new LLPlClient(configOrAddress);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return
|
|
1
|
+
{"version":3,"file":"unauth_client.cjs","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n constructor(configOrAddress: PlClientConfig | string) {\n this.ll = new LLPlClient(configOrAddress);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":["LLPlClient","notEmpty","UnauthenticatedError"],"mappings":";;;;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAY,eAAwC,EAAA;QAClD,IAAI,CAAC,EAAE,GAAG,IAAIA,oBAAU,CAAC,eAAe,CAAC;IAC3C;AAEO,IAAA,MAAM,IAAI,GAAA;AACf,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE;IAC7B;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;IACpC;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;IACtD;AAEO,IAAA,MAAM,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAA;AAC/C,QAAA,IAAI;AACF,YAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CACrC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,EACnC,EAAE,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CACpF;AACD,YAAA,MAAM,QAAQ,GAAGC,kBAAQ,CAAC,KAAK,CAAC;YAChC,IAAI,QAAQ,KAAK,EAAE;AAAE,gBAAA,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;YACnD,OAAO,EAAE,QAAQ,EAAE;QACrB;QAAE,OAAO,CAAM,EAAE;AACf,YAAA,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB;AAAE,gBAAA,MAAM,IAAIC,2BAAoB,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,YAAA,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB;IACF;AACD;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthInformation, PlClientConfig } from './config';
|
|
2
|
-
import type { AuthAPI_ListMethods_Response, MaintenanceAPI_Ping_Response } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';
|
|
2
|
+
import type { AuthAPI_ListMethods_Response, MaintenanceAPI_Ping_Response } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';
|
|
3
3
|
import { LLPlClient } from './ll_client';
|
|
4
4
|
/** Primarily used for initial authentication (login) */
|
|
5
5
|
export declare class UnauthenticatedPlClient {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.d.ts","sourceRoot":"","sources":["../../src/core/unauth_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,
|
|
1
|
+
{"version":3,"file":"unauth_client.d.ts","sourceRoot":"","sources":["../../src/core/unauth_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,wDAAwD;AACxD,qBAAa,uBAAuB;IAClC,SAAgB,EAAE,EAAE,UAAU,CAAC;gBAEnB,eAAe,EAAE,cAAc,GAAG,MAAM;IAIvC,IAAI,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI7C,WAAW,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAIpD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAc7E"}
|
|
@@ -9,22 +9,18 @@ class UnauthenticatedPlClient {
|
|
|
9
9
|
this.ll = new LLPlClient(configOrAddress);
|
|
10
10
|
}
|
|
11
11
|
async ping() {
|
|
12
|
-
return
|
|
12
|
+
return await this.ll.ping();
|
|
13
13
|
}
|
|
14
14
|
async authMethods() {
|
|
15
|
-
return
|
|
15
|
+
return await this.ll.authMethods();
|
|
16
16
|
}
|
|
17
17
|
async requireAuth() {
|
|
18
18
|
return (await this.authMethods()).methods.length > 0;
|
|
19
19
|
}
|
|
20
20
|
async login(user, password) {
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64'),
|
|
25
|
-
},
|
|
26
|
-
}).response;
|
|
27
|
-
const jwtToken = notEmpty(response.token);
|
|
22
|
+
const token = await this.ll.getJwtToken(BigInt(this.ll.conf.authTTLSeconds), { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') });
|
|
23
|
+
const jwtToken = notEmpty(token);
|
|
28
24
|
if (jwtToken === '')
|
|
29
25
|
throw new Error('empty token');
|
|
30
26
|
return { jwtToken };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.js","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n constructor(configOrAddress: PlClientConfig | string) {\n this.ll = new LLPlClient(configOrAddress);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return
|
|
1
|
+
{"version":3,"file":"unauth_client.js","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n constructor(configOrAddress: PlClientConfig | string) {\n this.ll = new LLPlClient(configOrAddress);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":[],"mappings":";;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAY,eAAwC,EAAA;QAClD,IAAI,CAAC,EAAE,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC;IAC3C;AAEO,IAAA,MAAM,IAAI,GAAA;AACf,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE;IAC7B;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;IACpC;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;IACtD;AAEO,IAAA,MAAM,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAA;AAC/C,QAAA,IAAI;AACF,YAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CACrC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,EACnC,EAAE,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CACpF;AACD,YAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;YAChC,IAAI,QAAQ,KAAK,EAAE;AAAE,gBAAA,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;YACnD,OAAO,EAAE,QAAQ,EAAE;QACrB;QAAE,OAAO,CAAM,EAAE;AACf,YAAA,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB;AAAE,gBAAA,MAAM,IAAI,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,YAAA,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB;IACF;AACD;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
2
|
+
import type { Dispatcher } from 'undici';
|
|
3
|
+
import type { PlClientConfig } from './config';
|
|
4
|
+
import type { Middleware } from 'openapi-fetch';
|
|
5
|
+
/**
|
|
6
|
+
* Options for the HTTP client to properly reach the PL server API when
|
|
7
|
+
* it works in WebSocket + REST mode.
|
|
8
|
+
*/
|
|
9
|
+
export type RestConnection = {
|
|
10
|
+
type: 'rest';
|
|
11
|
+
Config: PlClientConfig;
|
|
12
|
+
Dispatcher: Dispatcher;
|
|
13
|
+
Middlewares: Middleware[];
|
|
14
|
+
};
|
|
15
|
+
export type GrpcConnection = {
|
|
16
|
+
type: 'grpc';
|
|
17
|
+
Transport: GrpcTransport;
|
|
18
|
+
};
|
|
19
|
+
export type WireConnection = RestConnection | GrpcConnection;
|
|
20
|
+
/**
|
|
21
|
+
* A provider for a wire (gRPC, HTTP, etc.) client.
|
|
22
|
+
* The client is created on demand, and is reset when the transport is reset.
|
|
23
|
+
* This is useful for cases where the client is used in a loop, and the transport is reset after each iteration.
|
|
24
|
+
*/
|
|
25
|
+
export interface WireClientProvider<Client> {
|
|
26
|
+
get(): Client;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A factory for wire client providers.
|
|
30
|
+
*/
|
|
31
|
+
export interface WireClientProviderFactory {
|
|
32
|
+
createWireClientProvider<Client>(clientConstructor: (transport: WireConnection) => Client): WireClientProvider<Client>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/core/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC;AAI7D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,MAAM;IACxC,GAAG,IAAI,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;CACxH"}
|
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ var final = require('./core/final.cjs');
|
|
|
14
14
|
var tx_helpers = require('./helpers/tx_helpers.cjs');
|
|
15
15
|
var poll = require('./helpers/poll.cjs');
|
|
16
16
|
var test_config = require('./test/test_config.cjs');
|
|
17
|
+
var index = require('./proto-rest/index.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
@@ -56,9 +57,11 @@ exports.DEFAULT_RO_TX_TIMEOUT = config.DEFAULT_RO_TX_TIMEOUT;
|
|
|
56
57
|
exports.DEFAULT_RW_TX_TIMEOUT = config.DEFAULT_RW_TX_TIMEOUT;
|
|
57
58
|
exports.DEFAULT_TOKEN_TTL_SECONDS = config.DEFAULT_TOKEN_TTL_SECONDS;
|
|
58
59
|
exports.DefaultRetryOptions = config.DefaultRetryOptions;
|
|
60
|
+
exports.SUPPORTED_WIRE_PROTOCOLS = config.SUPPORTED_WIRE_PROTOCOLS;
|
|
59
61
|
exports.plAddressToConfig = config.plAddressToConfig;
|
|
60
62
|
exports.PlClient = client.PlClient;
|
|
61
63
|
exports.addRTypeToMetadata = driver.addRTypeToMetadata;
|
|
64
|
+
exports.createRTypeRoutingHeader = driver.createRTypeRoutingHeader;
|
|
62
65
|
exports.PlTransaction = transaction.PlTransaction;
|
|
63
66
|
exports.TxCommitConflict = transaction.TxCommitConflict;
|
|
64
67
|
exports.field = transaction.field;
|
|
@@ -96,4 +99,5 @@ exports.PollResourceAccessor = poll.PollResourceAccessor;
|
|
|
96
99
|
exports.PollTxAccessor = poll.PollTxAccessor;
|
|
97
100
|
exports.poll = poll.poll;
|
|
98
101
|
exports.TestHelpers = test_config;
|
|
102
|
+
exports.RestAPI = index;
|
|
99
103
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ export * from './core/default_client';
|
|
|
9
9
|
export * from './core/unauth_client';
|
|
10
10
|
export * from './core/auth';
|
|
11
11
|
export * from './core/final';
|
|
12
|
-
export * from './core/
|
|
12
|
+
export * from './core/wire';
|
|
13
13
|
export * from './helpers/tx_helpers';
|
|
14
14
|
export * from './helpers/poll';
|
|
15
15
|
export * as TestHelpers from './test/test_config';
|
|
16
|
+
export * as RestAPI from './proto-rest';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { MaxLocalId, MaxTxId, NullResourceId, bigintToResourceId, checkLocalityOfResourceId, createGlobalResourceId, createLocalResourceId, ensureResourceIdNotNull, extractBasicResourceData, extractTxId, getField, isAnyResourceId, isLocalResourceId, isNotNullResourceId, isNullResourceId, isRootResourceId, jsonToData, resDataToJson, resourceIdFromString, resourceIdToString, resourceType, resourceTypeToString, resourceTypesEqual, stringifyWithResourceId } from './core/types.js';
|
|
2
2
|
import * as pl from './helpers/pl.js';
|
|
3
3
|
export { pl as Pl };
|
|
4
|
-
export { AnonymousAuthInformation, DEFAULT_AUTH_MAX_REFRESH, DEFAULT_MAX_CACHE_BYTES, DEFAULT_REQUEST_TIMEOUT, DEFAULT_RETRY_BACKOFF_ALGORITHM, DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER, DEFAULT_RETRY_INITIAL_DELAY, DEFAULT_RETRY_JITTER, DEFAULT_RETRY_LINEAR_BACKOFF_STEP, DEFAULT_RETRY_MAX_ATTEMPTS, DEFAULT_RO_TX_TIMEOUT, DEFAULT_RW_TX_TIMEOUT, DEFAULT_TOKEN_TTL_SECONDS, DefaultRetryOptions, plAddressToConfig } from './core/config.js';
|
|
4
|
+
export { AnonymousAuthInformation, DEFAULT_AUTH_MAX_REFRESH, DEFAULT_MAX_CACHE_BYTES, DEFAULT_REQUEST_TIMEOUT, DEFAULT_RETRY_BACKOFF_ALGORITHM, DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER, DEFAULT_RETRY_INITIAL_DELAY, DEFAULT_RETRY_JITTER, DEFAULT_RETRY_LINEAR_BACKOFF_STEP, DEFAULT_RETRY_MAX_ATTEMPTS, DEFAULT_RO_TX_TIMEOUT, DEFAULT_RW_TX_TIMEOUT, DEFAULT_TOKEN_TTL_SECONDS, DefaultRetryOptions, SUPPORTED_WIRE_PROTOCOLS, plAddressToConfig } from './core/config.js';
|
|
5
5
|
export { PlClient } from './core/client.js';
|
|
6
|
-
export { addRTypeToMetadata } from './core/driver.js';
|
|
6
|
+
export { addRTypeToMetadata, createRTypeRoutingHeader } from './core/driver.js';
|
|
7
7
|
export { PlTransaction, TxCommitConflict, field, isField, isFieldRef, isResource, isResourceId, isResourceRef, toFieldId, toGlobalFieldId, toGlobalResourceId, toResourceId } from './core/transaction.js';
|
|
8
8
|
export { DisconnectedError, PlError, PlErrorCodeNotFound, RecoverablePlError, UnauthenticatedError, UnrecoverablePlError, isConnectionProblem, isNotFoundError, isTimeoutOrCancelError, isUnauthenticated, rethrowMeaningfulError, throwPlNotFoundError } from './core/errors.js';
|
|
9
9
|
export { defaultPlClient, tryGetFileConfig } from './core/default_client.js';
|
|
@@ -14,4 +14,6 @@ export { valErr } from './helpers/tx_helpers.js';
|
|
|
14
14
|
export { ContinuePolling, DefaultPollingRetryOptions, PollResourceAccessor, PollTxAccessor, poll } from './helpers/poll.js';
|
|
15
15
|
import * as test_config from './test/test_config.js';
|
|
16
16
|
export { test_config as TestHelpers };
|
|
17
|
+
import * as index from './proto-rest/index.js';
|
|
18
|
+
export { index as RestAPI };
|
|
17
19
|
//# sourceMappingURL=index.js.map
|