@ahoo-wang/wow-client 9.9.0 → 10.0.0-alpha.4
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/README.md +85 -230
- package/README.zh-CN.md +74 -209
- package/dist/commands.cjs +2 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +123 -0
- package/dist/commands.d.ts +123 -0
- package/dist/commands.es.js +96 -0
- package/dist/commands.es.js.map +1 -0
- package/dist/dsl/aggregation/types.cjs.map +1 -1
- package/dist/dsl/aggregation/types.d.cts +1 -1
- package/dist/dsl/aggregation/types.d.ts +1 -1
- package/dist/dsl/aggregation/types.es.js.map +1 -1
- package/dist/dsl/cursorQuery.cjs.map +1 -1
- package/dist/dsl/cursorQuery.d.cts +7 -8
- package/dist/dsl/cursorQuery.d.ts +7 -8
- package/dist/dsl/cursorQuery.es.js.map +1 -1
- package/dist/dsl/descriptor.cjs.map +1 -1
- package/dist/dsl/descriptor.d.cts +8 -1
- package/dist/dsl/descriptor.d.ts +8 -1
- package/dist/dsl/descriptor.es.js.map +1 -1
- package/dist/dsl/documents.d.cts +1 -1
- package/dist/dsl/documents.d.ts +1 -1
- package/dist/dsl/filter/types.d.cts +2 -1
- package/dist/dsl/filter/types.d.ts +2 -1
- package/dist/dsl/projection.cjs.map +1 -1
- package/dist/dsl/projection.d.cts +22 -0
- package/dist/dsl/projection.d.ts +22 -0
- package/dist/dsl/projection.es.js.map +1 -1
- package/dist/dsl/queryErrorCodes.cjs +2 -0
- package/dist/dsl/queryErrorCodes.cjs.map +1 -0
- package/dist/{error → dsl}/queryErrorCodes.d.cts +25 -24
- package/dist/{error → dsl}/queryErrorCodes.d.ts +25 -24
- package/dist/{error → dsl}/queryErrorCodes.es.js +2 -1
- package/dist/{error/queryErrorCodes.cjs.map → dsl/queryErrorCodes.es.js.map} +1 -1
- package/dist/dsl.cjs +1 -1
- package/dist/dsl.d.cts +1 -2
- package/dist/dsl.d.ts +1 -2
- package/dist/dsl.es.js +2 -3
- package/dist/exactJson.cjs +3 -0
- package/dist/exactJson.cjs.map +1 -0
- package/dist/exactJson.d.cts +54 -0
- package/dist/exactJson.d.ts +54 -0
- package/dist/exactJson.es.js +213 -0
- package/dist/exactJson.es.js.map +1 -0
- package/dist/http.cjs +2 -0
- package/dist/http.cjs.map +1 -0
- package/dist/http.d.cts +96 -0
- package/dist/http.d.ts +96 -0
- package/dist/http.es.js +77 -0
- package/dist/http.es.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -17
- package/dist/index.d.ts +19 -17
- package/dist/index.es.js +10 -36
- package/dist/manifest.cjs +2 -0
- package/dist/manifest.cjs.map +1 -0
- package/dist/manifest.d.cts +109 -0
- package/dist/manifest.d.ts +109 -0
- package/dist/manifest.es.js +14 -0
- package/dist/manifest.es.js.map +1 -0
- package/dist/problem.cjs +2 -0
- package/dist/problem.cjs.map +1 -0
- package/dist/problem.d.cts +211 -0
- package/dist/problem.d.ts +211 -0
- package/dist/problem.es.js +138 -0
- package/dist/problem.es.js.map +1 -0
- package/dist/queries.cjs +2 -0
- package/dist/queries.cjs.map +1 -0
- package/dist/queries.d.cts +182 -0
- package/dist/queries.d.ts +182 -0
- package/dist/queries.es.js +112 -0
- package/dist/queries.es.js.map +1 -0
- package/dist/state.cjs +2 -0
- package/dist/state.cjs.map +1 -0
- package/dist/state.d.cts +75 -0
- package/dist/state.d.ts +75 -0
- package/dist/state.es.js +70 -0
- package/dist/state.es.js.map +1 -0
- package/dist/streams.cjs +2 -0
- package/dist/streams.cjs.map +1 -0
- package/dist/streams.d.cts +74 -0
- package/dist/streams.d.ts +74 -0
- package/dist/streams.es.js +103 -0
- package/dist/streams.es.js.map +1 -0
- package/dist/wait.cjs +2 -0
- package/dist/wait.cjs.map +1 -0
- package/dist/wait.d.cts +61 -0
- package/dist/wait.d.ts +61 -0
- package/dist/wait.es.js +44 -0
- package/dist/wait.es.js.map +1 -0
- package/dist/wire.cjs +2 -0
- package/dist/wire.cjs.map +1 -0
- package/dist/wire.d.cts +326 -0
- package/dist/wire.d.ts +326 -0
- package/dist/wire.es.js +10 -0
- package/dist/wire.es.js.map +1 -0
- package/package.json +4 -16
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs +0 -1
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js +0 -9
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs +0 -1
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js +0 -6
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs +0 -1
- package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js +0 -8
- package/dist/client/bindMethods.cjs +0 -2
- package/dist/client/bindMethods.cjs.map +0 -1
- package/dist/client/bindMethods.d.cts +0 -13
- package/dist/client/bindMethods.d.ts +0 -13
- package/dist/client/bindMethods.es.js +0 -19
- package/dist/client/bindMethods.es.js.map +0 -1
- package/dist/client/command/commandClient.cjs +0 -2
- package/dist/client/command/commandClient.cjs.map +0 -1
- package/dist/client/command/commandClient.d.cts +0 -67
- package/dist/client/command/commandClient.d.ts +0 -67
- package/dist/client/command/commandClient.es.js +0 -38
- package/dist/client/command/commandClient.es.js.map +0 -1
- package/dist/client/command/commandHeaders.cjs +0 -2
- package/dist/client/command/commandHeaders.cjs.map +0 -1
- package/dist/client/command/commandHeaders.d.cts +0 -75
- package/dist/client/command/commandHeaders.d.ts +0 -75
- package/dist/client/command/commandHeaders.es.js +0 -31
- package/dist/client/command/commandHeaders.es.js.map +0 -1
- package/dist/client/command/commandRequest.cjs +0 -2
- package/dist/client/command/commandRequest.cjs.map +0 -1
- package/dist/client/command/commandRequest.d.cts +0 -180
- package/dist/client/command/commandRequest.d.ts +0 -180
- package/dist/client/command/commandRequest.es.js +0 -31
- package/dist/client/command/commandRequest.es.js.map +0 -1
- package/dist/client/command/commandResult.d.cts +0 -15
- package/dist/client/command/commandResult.d.ts +0 -15
- package/dist/client/command/index.d.cts +0 -5
- package/dist/client/command/index.d.ts +0 -5
- package/dist/client/command/types.d.cts +0 -71
- package/dist/client/command/types.d.ts +0 -71
- package/dist/client/metadata/index.d.cts +0 -2
- package/dist/client/metadata/index.d.ts +0 -2
- package/dist/client/metadata/wowMetadata.d.cts +0 -48
- package/dist/client/metadata/wowMetadata.d.ts +0 -48
- package/dist/client/metadata/wowMetadataClient.cjs +0 -2
- package/dist/client/metadata/wowMetadataClient.cjs.map +0 -1
- package/dist/client/metadata/wowMetadataClient.d.cts +0 -23
- package/dist/client/metadata/wowMetadataClient.d.ts +0 -23
- package/dist/client/metadata/wowMetadataClient.es.js +0 -25
- package/dist/client/metadata/wowMetadataClient.es.js.map +0 -1
- package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs +0 -2
- package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs.map +0 -1
- package/dist/client/query/dataset/datasetDescriptorEndpoint.d.cts +0 -8
- package/dist/client/query/dataset/datasetDescriptorEndpoint.d.ts +0 -8
- package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js +0 -34
- package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js.map +0 -1
- package/dist/client/query/dataset/datasetDirectoryClient.cjs +0 -2
- package/dist/client/query/dataset/datasetDirectoryClient.cjs.map +0 -1
- package/dist/client/query/dataset/datasetDirectoryClient.d.cts +0 -29
- package/dist/client/query/dataset/datasetDirectoryClient.d.ts +0 -29
- package/dist/client/query/dataset/datasetDirectoryClient.es.js +0 -25
- package/dist/client/query/dataset/datasetDirectoryClient.es.js.map +0 -1
- package/dist/client/query/dataset/datasetQueryApi.d.cts +0 -40
- package/dist/client/query/dataset/datasetQueryApi.d.ts +0 -40
- package/dist/client/query/dataset/datasetQueryClient.cjs +0 -2
- package/dist/client/query/dataset/datasetQueryClient.cjs.map +0 -1
- package/dist/client/query/dataset/datasetQueryClient.d.cts +0 -57
- package/dist/client/query/dataset/datasetQueryClient.d.ts +0 -57
- package/dist/client/query/dataset/datasetQueryClient.es.js +0 -154
- package/dist/client/query/dataset/datasetQueryClient.es.js.map +0 -1
- package/dist/client/query/dataset/endpointPaths.cjs +0 -2
- package/dist/client/query/dataset/endpointPaths.cjs.map +0 -1
- package/dist/client/query/dataset/endpointPaths.d.cts +0 -9
- package/dist/client/query/dataset/endpointPaths.d.ts +0 -9
- package/dist/client/query/dataset/endpointPaths.es.js +0 -14
- package/dist/client/query/dataset/endpointPaths.es.js.map +0 -1
- package/dist/client/query/dataset/index.d.cts +0 -3
- package/dist/client/query/dataset/index.d.ts +0 -3
- package/dist/client/query/descriptor/descriptorEndpoints.cjs +0 -2
- package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +0 -1
- package/dist/client/query/descriptor/descriptorEndpoints.d.cts +0 -29
- package/dist/client/query/descriptor/descriptorEndpoints.d.ts +0 -29
- package/dist/client/query/descriptor/descriptorEndpoints.es.js +0 -69
- package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +0 -1
- package/dist/client/query/descriptor/endpointPaths.cjs +0 -2
- package/dist/client/query/descriptor/endpointPaths.cjs.map +0 -1
- package/dist/client/query/descriptor/endpointPaths.d.cts +0 -4
- package/dist/client/query/descriptor/endpointPaths.d.ts +0 -4
- package/dist/client/query/descriptor/endpointPaths.es.js +0 -9
- package/dist/client/query/descriptor/endpointPaths.es.js.map +0 -1
- package/dist/client/query/descriptor/index.d.cts +0 -2
- package/dist/client/query/descriptor/index.d.ts +0 -2
- package/dist/client/query/descriptor/queryDescriptorApi.d.cts +0 -58
- package/dist/client/query/descriptor/queryDescriptorApi.d.ts +0 -58
- package/dist/client/query/descriptor/queryDescriptorClient.cjs +0 -2
- package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +0 -1
- package/dist/client/query/descriptor/queryDescriptorClient.d.cts +0 -61
- package/dist/client/query/descriptor/queryDescriptorClient.d.ts +0 -61
- package/dist/client/query/descriptor/queryDescriptorClient.es.js +0 -20
- package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +0 -1
- package/dist/client/query/event/endpointPaths.cjs +0 -2
- package/dist/client/query/event/endpointPaths.cjs.map +0 -1
- package/dist/client/query/event/endpointPaths.d.cts +0 -8
- package/dist/client/query/event/endpointPaths.d.ts +0 -8
- package/dist/client/query/event/endpointPaths.es.js +0 -13
- package/dist/client/query/event/endpointPaths.es.js.map +0 -1
- package/dist/client/query/event/eventStreamQueryApi.d.cts +0 -29
- package/dist/client/query/event/eventStreamQueryApi.d.ts +0 -29
- package/dist/client/query/event/eventStreamQueryClient.cjs +0 -2
- package/dist/client/query/event/eventStreamQueryClient.cjs.map +0 -1
- package/dist/client/query/event/eventStreamQueryClient.d.cts +0 -193
- package/dist/client/query/event/eventStreamQueryClient.d.ts +0 -193
- package/dist/client/query/event/eventStreamQueryClient.es.js +0 -160
- package/dist/client/query/event/eventStreamQueryClient.es.js.map +0 -1
- package/dist/client/query/event/index.d.cts +0 -2
- package/dist/client/query/event/index.d.ts +0 -2
- package/dist/client/query/factory.cjs +0 -2
- package/dist/client/query/factory.cjs.map +0 -1
- package/dist/client/query/factory.d.cts +0 -165
- package/dist/client/query/factory.d.ts +0 -165
- package/dist/client/query/factory.es.js +0 -45
- package/dist/client/query/factory.es.js.map +0 -1
- package/dist/client/query/index.d.cts +0 -7
- package/dist/client/query/index.d.ts +0 -7
- package/dist/client/query/queryApi.d.cts +0 -68
- package/dist/client/query/queryApi.d.ts +0 -68
- package/dist/client/query/requests.d.cts +0 -24
- package/dist/client/query/requests.d.ts +0 -24
- package/dist/client/query/snapshot/endpointPaths.cjs +0 -2
- package/dist/client/query/snapshot/endpointPaths.cjs.map +0 -1
- package/dist/client/query/snapshot/endpointPaths.d.cts +0 -12
- package/dist/client/query/snapshot/endpointPaths.d.ts +0 -12
- package/dist/client/query/snapshot/endpointPaths.es.js +0 -17
- package/dist/client/query/snapshot/endpointPaths.es.js.map +0 -1
- package/dist/client/query/snapshot/index.d.cts +0 -2
- package/dist/client/query/snapshot/index.d.ts +0 -2
- package/dist/client/query/snapshot/snapshotQueryApi.d.cts +0 -101
- package/dist/client/query/snapshot/snapshotQueryApi.d.ts +0 -101
- package/dist/client/query/snapshot/snapshotQueryClient.cjs +0 -2
- package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +0 -1
- package/dist/client/query/snapshot/snapshotQueryClient.d.cts +0 -372
- package/dist/client/query/snapshot/snapshotQueryClient.d.ts +0 -372
- package/dist/client/query/snapshot/snapshotQueryClient.es.js +0 -239
- package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +0 -1
- package/dist/client/query/state/endpointPaths.cjs +0 -2
- package/dist/client/query/state/endpointPaths.cjs.map +0 -1
- package/dist/client/query/state/endpointPaths.d.cts +0 -10
- package/dist/client/query/state/endpointPaths.d.ts +0 -10
- package/dist/client/query/state/endpointPaths.es.js +0 -14
- package/dist/client/query/state/endpointPaths.es.js.map +0 -1
- package/dist/client/query/state/index.d.cts +0 -4
- package/dist/client/query/state/index.d.ts +0 -4
- package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +0 -36
- package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +0 -36
- package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +0 -2
- package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +0 -1
- package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +0 -58
- package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +0 -58
- package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +0 -56
- package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +0 -1
- package/dist/client/query/state/loadStateAggregateApi.d.cts +0 -37
- package/dist/client/query/state/loadStateAggregateApi.d.ts +0 -37
- package/dist/client/query/state/loadStateAggregateClient.cjs +0 -2
- package/dist/client/query/state/loadStateAggregateClient.cjs.map +0 -1
- package/dist/client/query/state/loadStateAggregateClient.d.cts +0 -62
- package/dist/client/query/state/loadStateAggregateClient.d.ts +0 -62
- package/dist/client/query/state/loadStateAggregateClient.es.js +0 -65
- package/dist/client/query/state/loadStateAggregateClient.es.js.map +0 -1
- package/dist/client/routing.cjs +0 -2
- package/dist/client/routing.cjs.map +0 -1
- package/dist/client/routing.d.cts +0 -47
- package/dist/client/routing.d.ts +0 -47
- package/dist/client/routing.es.js +0 -8
- package/dist/client/routing.es.js.map +0 -1
- package/dist/error/errorInfo.cjs +0 -2
- package/dist/error/errorInfo.cjs.map +0 -1
- package/dist/error/errorInfo.d.cts +0 -139
- package/dist/error/errorInfo.d.ts +0 -139
- package/dist/error/errorInfo.es.js +0 -32
- package/dist/error/errorInfo.es.js.map +0 -1
- package/dist/error/headers.cjs +0 -2
- package/dist/error/headers.cjs.map +0 -1
- package/dist/error/headers.d.cts +0 -39
- package/dist/error/headers.d.ts +0 -39
- package/dist/error/headers.es.js +0 -10
- package/dist/error/headers.es.js.map +0 -1
- package/dist/error/index.d.cts +0 -21
- package/dist/error/index.d.ts +0 -21
- package/dist/error/queryErrorCodes.cjs +0 -2
- package/dist/error/queryErrorCodes.es.js.map +0 -1
- package/dist/error/wowError.cjs +0 -2
- package/dist/error/wowError.cjs.map +0 -1
- package/dist/error/wowError.d.cts +0 -99
- package/dist/error/wowError.d.ts +0 -99
- package/dist/error/wowError.es.js +0 -53
- package/dist/error/wowError.es.js.map +0 -1
- package/dist/legacy/condition.cjs +0 -2
- package/dist/legacy/condition.cjs.map +0 -1
- package/dist/legacy/condition.d.cts +0 -517
- package/dist/legacy/condition.d.ts +0 -517
- package/dist/legacy/condition.es.js +0 -338
- package/dist/legacy/condition.es.js.map +0 -1
- package/dist/legacy/index.d.cts +0 -16
- package/dist/legacy/index.d.ts +0 -16
- package/dist/legacy/locale/en_US.cjs +0 -2
- package/dist/legacy/locale/en_US.cjs.map +0 -1
- package/dist/legacy/locale/en_US.d.cts +0 -7
- package/dist/legacy/locale/en_US.d.ts +0 -7
- package/dist/legacy/locale/en_US.es.js +0 -50
- package/dist/legacy/locale/en_US.es.js.map +0 -1
- package/dist/legacy/locale/operatorLocale.d.cts +0 -10
- package/dist/legacy/locale/operatorLocale.d.ts +0 -10
- package/dist/legacy/locale/zh_CN.cjs +0 -2
- package/dist/legacy/locale/zh_CN.cjs.map +0 -1
- package/dist/legacy/locale/zh_CN.d.cts +0 -7
- package/dist/legacy/locale/zh_CN.d.ts +0 -7
- package/dist/legacy/locale/zh_CN.es.js +0 -50
- package/dist/legacy/locale/zh_CN.es.js.map +0 -1
- package/dist/legacy/operator.cjs +0 -2
- package/dist/legacy/operator.cjs.map +0 -1
- package/dist/legacy/operator.d.cts +0 -218
- package/dist/legacy/operator.d.ts +0 -218
- package/dist/legacy/operator.es.js +0 -25
- package/dist/legacy/operator.es.js.map +0 -1
- package/dist/legacy/queryable.cjs +0 -2
- package/dist/legacy/queryable.cjs.map +0 -1
- package/dist/legacy/queryable.d.cts +0 -61
- package/dist/legacy/queryable.d.ts +0 -61
- package/dist/legacy/queryable.es.js +0 -34
- package/dist/legacy/queryable.es.js.map +0 -1
- package/dist/legacy.cjs +0 -1
- package/dist/legacy.es.js +0 -6
- package/dist/model/abac.cjs +0 -2
- package/dist/model/abac.cjs.map +0 -1
- package/dist/model/abac.d.cts +0 -33
- package/dist/model/abac.d.ts +0 -33
- package/dist/model/abac.es.js +0 -6
- package/dist/model/abac.es.js.map +0 -1
- package/dist/model/bi.cjs +0 -2
- package/dist/model/bi.cjs.map +0 -1
- package/dist/model/bi.d.cts +0 -12
- package/dist/model/bi.d.ts +0 -12
- package/dist/model/bi.es.js +0 -8
- package/dist/model/bi.es.js.map +0 -1
- package/dist/model/command.cjs +0 -2
- package/dist/model/command.cjs.map +0 -1
- package/dist/model/command.d.cts +0 -137
- package/dist/model/command.d.ts +0 -137
- package/dist/model/command.es.js +0 -8
- package/dist/model/command.es.js.map +0 -1
- package/dist/model/common.d.cts +0 -19
- package/dist/model/common.d.ts +0 -19
- package/dist/model/domainEventStream.cjs +0 -2
- package/dist/model/domainEventStream.cjs.map +0 -1
- package/dist/model/domainEventStream.d.cts +0 -109
- package/dist/model/domainEventStream.d.ts +0 -109
- package/dist/model/domainEventStream.es.js +0 -23
- package/dist/model/domainEventStream.es.js.map +0 -1
- package/dist/model/function.cjs +0 -2
- package/dist/model/function.cjs.map +0 -1
- package/dist/model/function.d.cts +0 -41
- package/dist/model/function.d.ts +0 -41
- package/dist/model/function.es.js +0 -8
- package/dist/model/function.es.js.map +0 -1
- package/dist/model/index.d.cts +0 -24
- package/dist/model/index.d.ts +0 -24
- package/dist/model/messaging.d.cts +0 -5
- package/dist/model/messaging.d.ts +0 -5
- package/dist/model/modeling.d.cts +0 -145
- package/dist/model/modeling.d.ts +0 -145
- package/dist/model/naming.d.cts +0 -27
- package/dist/model/naming.d.ts +0 -27
- package/dist/model/snapshot.cjs +0 -2
- package/dist/model/snapshot.cjs.map +0 -1
- package/dist/model/snapshot.d.cts +0 -53
- package/dist/model/snapshot.d.ts +0 -53
- package/dist/model/snapshot.es.js +0 -20
- package/dist/model/snapshot.es.js.map +0 -1
- package/dist/transport/endpoints.cjs +0 -2
- package/dist/transport/endpoints.cjs.map +0 -1
- package/dist/transport/endpoints.d.cts +0 -79
- package/dist/transport/endpoints.d.ts +0 -79
- package/dist/transport/endpoints.es.js +0 -14
- package/dist/transport/endpoints.es.js.map +0 -1
- package/dist/transport/eventStreams.cjs +0 -2
- package/dist/transport/eventStreams.cjs.map +0 -1
- package/dist/transport/eventStreams.d.cts +0 -25
- package/dist/transport/eventStreams.d.ts +0 -25
- package/dist/transport/eventStreams.es.js +0 -21
- package/dist/transport/eventStreams.es.js.map +0 -1
- package/dist/transport/index.d.cts +0 -1
- package/dist/transport/index.d.ts +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export * from './
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* `@ahoo-wang/wow-client`: the client of a Wow service's public
|
|
3
|
+
* routes — commands with `Wow-Wait` and their event streams, state reads and
|
|
4
|
+
* traces, the snapshot, event and dataset query routes, the Manifest, and
|
|
5
|
+
* RFC 9457 problems as {@link WowProblemError}s with retry hints. Code
|
|
6
|
+
* `wow-generator` generates from a Manifest builds on it.
|
|
7
|
+
*
|
|
8
|
+
* Build queries with the DSL of `@ahoo-wang/wow-client/dsl`.
|
|
9
|
+
*/
|
|
10
|
+
export { type ApplyTags, CommandGateway, type CommandOptions, commandSegment, type CreateCommandOptions, type LifecycleCommand, LifecycleCommands, newRequestId, type TransferOwner, type TransferSpace, } from './commands.cjs';
|
|
11
|
+
export { parseJson, stringifyJson, type TextNumbers, textNumbersBy, type TextNumbersByName, } from './exactJson.cjs';
|
|
12
|
+
export { formatScope, type RequestOptions, type TargetScope, type WowClientOptions, WowHeaders, } from './http.cjs';
|
|
13
|
+
export { type AggregateManifest, type CommandManifest, type ContextManifest, type Creation, type ErrorManifest, type EventManifest, fetchManifest, type Manifest, MANIFEST_FORMAT, type QueryManifest, type RouteManifest, type SubscriptionManifest, } from './manifest.cjs';
|
|
14
|
+
export * from './wire.cjs';
|
|
15
|
+
export { FRAMEWORK_ERROR_PREFIX, type FrameworkErrorCode, FrameworkErrorCodes, isProblem, parseRetryAfter, type Problem, PROBLEM_TYPE_PREFIX, readProblem, requestIdOf, type RetryHint, retryHintOf, toWowProblemError, WowProblemError, } from './problem.cjs';
|
|
16
|
+
export { type CountQuery, type CountResult, DatasetClient, type DescriptorResult, EventQueryClient, type ListStreamOptions, type Including, type PagedQuery, type PagedResult, QueryModelClient, queryPath, SnapshotQueryClient, type TotalMode, } from './queries.cjs';
|
|
17
|
+
export { StateClient, type StateReadOptions, type StateReadResult, type StateTraceOptions, } from './state.cjs';
|
|
18
|
+
export { type CommandResultStream, type StreamedRow, type StreamEnd, type StreamEndReason, type StreamResumeOptions, } from './streams.cjs';
|
|
19
|
+
export { formatHop, formatWaitPlan, formatWaitTimeout, SNAPSHOT_SUBSCRIPTION, wait, type WaitOptions, } from './wait.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export * from './
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* `@ahoo-wang/wow-client`: the client of a Wow service's public
|
|
3
|
+
* routes — commands with `Wow-Wait` and their event streams, state reads and
|
|
4
|
+
* traces, the snapshot, event and dataset query routes, the Manifest, and
|
|
5
|
+
* RFC 9457 problems as {@link WowProblemError}s with retry hints. Code
|
|
6
|
+
* `wow-generator` generates from a Manifest builds on it.
|
|
7
|
+
*
|
|
8
|
+
* Build queries with the DSL of `@ahoo-wang/wow-client/dsl`.
|
|
9
|
+
*/
|
|
10
|
+
export { type ApplyTags, CommandGateway, type CommandOptions, commandSegment, type CreateCommandOptions, type LifecycleCommand, LifecycleCommands, newRequestId, type TransferOwner, type TransferSpace, } from './commands.js';
|
|
11
|
+
export { parseJson, stringifyJson, type TextNumbers, textNumbersBy, type TextNumbersByName, } from './exactJson.js';
|
|
12
|
+
export { formatScope, type RequestOptions, type TargetScope, type WowClientOptions, WowHeaders, } from './http.js';
|
|
13
|
+
export { type AggregateManifest, type CommandManifest, type ContextManifest, type Creation, type ErrorManifest, type EventManifest, fetchManifest, type Manifest, MANIFEST_FORMAT, type QueryManifest, type RouteManifest, type SubscriptionManifest, } from './manifest.js';
|
|
14
|
+
export * from './wire.js';
|
|
15
|
+
export { FRAMEWORK_ERROR_PREFIX, type FrameworkErrorCode, FrameworkErrorCodes, isProblem, parseRetryAfter, type Problem, PROBLEM_TYPE_PREFIX, readProblem, requestIdOf, type RetryHint, retryHintOf, toWowProblemError, WowProblemError, } from './problem.js';
|
|
16
|
+
export { type CountQuery, type CountResult, DatasetClient, type DescriptorResult, EventQueryClient, type ListStreamOptions, type Including, type PagedQuery, type PagedResult, QueryModelClient, queryPath, SnapshotQueryClient, type TotalMode, } from './queries.js';
|
|
17
|
+
export { StateClient, type StateReadOptions, type StateReadResult, type StateTraceOptions, } from './state.js';
|
|
18
|
+
export { type CommandResultStream, type StreamedRow, type StreamEnd, type StreamEndReason, type StreamResumeOptions, } from './streams.js';
|
|
19
|
+
export { formatHop, formatWaitPlan, formatWaitTimeout, SNAPSHOT_SUBSCRIPTION, wait, type WaitOptions, } from './wait.js';
|
package/dist/index.es.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { PagingMode as I, QueryConstraintTypes as L, QueryFieldRoles as R, QueryModels as z, QueryValueKind as B, QueryValueTypes as V, SensitivityLevel as H } from "./dsl/descriptor.es.js";
|
|
12
|
-
import { ErrorCodes as U, RecoverableType as W } from "./error/errorInfo.es.js";
|
|
13
|
-
import { WowHeaders as G } from "./error/headers.es.js";
|
|
14
|
-
import { WowError as K, isErrorInfo as q, toWowError as J } from "./error/wowError.es.js";
|
|
15
|
-
import { CommandStage as Y } from "./model/command.es.js";
|
|
16
|
-
import { COMMAND_STREAM_ENDPOINT as X, QUERY_STREAM_ENDPOINT as Z } from "./transport/endpoints.es.js";
|
|
17
|
-
import { CommandClient as Q } from "./client/command/commandClient.es.js";
|
|
18
|
-
import { CommandHeaders as $ } from "./client/command/commandHeaders.es.js";
|
|
19
|
-
import { EMPTY_ABAC_TAGS as ee, WILDCARD_ABAC_TAG_VALUES as te } from "./model/abac.es.js";
|
|
20
|
-
import { MessageHeaderSqlType as ne } from "./model/bi.es.js";
|
|
21
|
-
import { DomainEventStreamMetadataFields as re } from "./model/domainEventStream.es.js";
|
|
22
|
-
import { FunctionKind as ie } from "./model/function.es.js";
|
|
23
|
-
import { SnapshotMetadataFields as ae } from "./model/snapshot.es.js";
|
|
24
|
-
import { commandHeaders as oe, waitStrategy as se } from "./client/command/commandRequest.es.js";
|
|
25
|
-
import { WowMetadataClient as ce } from "./client/metadata/wowMetadataClient.es.js";
|
|
26
|
-
import { EventStreamQueryClient as le } from "./client/query/event/eventStreamQueryClient.es.js";
|
|
27
|
-
import { SnapshotQueryClient as ue } from "./client/query/snapshot/snapshotQueryClient.es.js";
|
|
28
|
-
import { LoadStateAggregateClient as de } from "./client/query/state/loadStateAggregateClient.es.js";
|
|
29
|
-
import { LoadOwnerStateAggregateClient as fe } from "./client/query/state/loadOwnerStateAggregateClient.es.js";
|
|
30
|
-
import { QueryDescriptorClient as pe } from "./client/query/descriptor/queryDescriptorClient.es.js";
|
|
31
|
-
import { ResourceAttributionPathSpec as me } from "./client/routing.es.js";
|
|
32
|
-
import { DatasetQueryClient as he, datasetBasePath as ge } from "./client/query/dataset/datasetQueryClient.es.js";
|
|
33
|
-
import { DatasetDirectoryClient as _e } from "./client/query/dataset/datasetDirectoryClient.es.js";
|
|
34
|
-
import { QueryClientFactory as ve } from "./client/query/factory.es.js";
|
|
35
|
-
import { QueryErrorCodes as ye } from "./error/queryErrorCodes.es.js";
|
|
36
|
-
export { i as AGGREGATION_LIMITS, a as AggregationDatePart, o as AggregationDateUnit, s as AggregationExpressionOperator, c as AggregationExpressionType, l as AggregationFunction, u as AggregationGroupScope, d as AggregationGroupType, f as AggregationMetricType, X as COMMAND_STREAM_ENDPOINT, Q as CommandClient, $ as CommandHeaders, Y as CommandStage, p as ComparisonOperator, O as DEFAULT_CURSOR_SIZE, E as DEFAULT_PAGINATION, _e as DatasetDirectoryClient, he as DatasetQueryClient, m as DateDiffUnit, y as DeletionState, h as DerivedExpressionType, re as DomainEventStreamMetadataFields, ee as EMPTY_ABAC_TAGS, U as ErrorCodes, le as EventStreamQueryClient, e as FilterOperator, ie as FunctionKind, g as HavingExpressionType, fe as LoadOwnerStateAggregateClient, de as LoadStateAggregateClient, k as MAX_CURSOR_SIZE, A as MAX_CURSOR_SORT_FIELDS, ne as MessageHeaderSqlType, I as PagingMode, Z as QUERY_STREAM_ENDPOINT, ve as QueryClientFactory, L as QueryConstraintTypes, pe as QueryDescriptorClient, ye as QueryErrorCodes, R as QueryFieldRoles, z as QueryModels, B as QueryValueKind, V as QueryValueTypes, W as RecoverableType, me as ResourceAttributionPathSpec, _ as RunningFunction, t as SearchMode, H as SensitivityLevel, ae as SnapshotMetadataFields, ue as SnapshotQueryClient, x as SortDirection, n as StringComparison, r as TimeUnit, te as WILDCARD_ABAC_TAG_VALUES, v as WindowFunction, K as WowError, G as WowHeaders, ce as WowMetadataClient, w as aggregation, S as asc, oe as commandHeaders, j as cursorQuery, ge as datasetBasePath, C as desc, b as filter, q as isErrorInfo, M as listQuery, N as pagedList, P as pagedQuery, D as pagination, T as projection, F as singleQuery, J as toWowError, se as waitStrategy };
|
|
1
|
+
import { parseJson as e, stringifyJson as t, textNumbersBy as n } from "./exactJson.es.js";
|
|
2
|
+
import { FRAMEWORK_ERROR_PREFIX as r, FrameworkErrorCodes as i, PROBLEM_TYPE_PREFIX as a, WowProblemError as o, isProblem as s, parseRetryAfter as c, readProblem as l, requestIdOf as u, retryHintOf as d, toWowProblemError as f } from "./problem.es.js";
|
|
3
|
+
import { WowHeaders as p, formatScope as m } from "./http.es.js";
|
|
4
|
+
import { Stage as h } from "./wire.es.js";
|
|
5
|
+
import { SNAPSHOT_SUBSCRIPTION as g, formatHop as _, formatWaitPlan as v, formatWaitTimeout as y, wait as b } from "./wait.es.js";
|
|
6
|
+
import { CommandGateway as x, LifecycleCommands as S, commandSegment as C, newRequestId as w } from "./commands.es.js";
|
|
7
|
+
import { MANIFEST_FORMAT as T, fetchManifest as E } from "./manifest.es.js";
|
|
8
|
+
import { DatasetClient as D, EventQueryClient as O, QueryModelClient as k, SnapshotQueryClient as A, queryPath as j } from "./queries.es.js";
|
|
9
|
+
import { StateClient as M } from "./state.es.js";
|
|
10
|
+
export { x as CommandGateway, D as DatasetClient, O as EventQueryClient, r as FRAMEWORK_ERROR_PREFIX, i as FrameworkErrorCodes, S as LifecycleCommands, T as MANIFEST_FORMAT, a as PROBLEM_TYPE_PREFIX, k as QueryModelClient, g as SNAPSHOT_SUBSCRIPTION, A as SnapshotQueryClient, h as Stage, M as StateClient, p as WowHeaders, o as WowProblemError, C as commandSegment, E as fetchManifest, _ as formatHop, m as formatScope, v as formatWaitPlan, y as formatWaitTimeout, s as isProblem, w as newRequestId, e as parseJson, c as parseRetryAfter, j as queryPath, l as readProblem, u as requestIdOf, d as retryHintOf, t as stringifyJson, n as textNumbersBy, f as toWowProblemError, b as wait };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.cjs","names":["json","send","require_http","MANIFEST_FORMAT","fetchManifest","client"],"sources":["../src/manifest.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n json,\n type RequestOptions,\n send,\n type WowClientOptions,\n} from './http.js';\nimport type { Ownership } from './wire.js';\n\n/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */\nexport interface RouteManifest {\n readonly method: string;\n readonly path: string;\n}\n\n/** Whether a command creates its aggregate. */\nexport type Creation = 'NONE' | 'REQUIRED' | 'ALLOWED';\n\n/** A command of an aggregate (decisions D104, D176, D182). */\nexport interface CommandManifest {\n readonly name: string;\n readonly aliases?: readonly string[];\n /** `#/$defs/<key>`. */\n readonly schema: string;\n readonly creation?: Creation;\n readonly produces?: readonly string[];\n readonly routes?: readonly RouteManifest[];\n readonly mounted?: boolean;\n readonly transformsTo?: readonly string[];\n}\n\n/** An event of an aggregate and its revision. */\nexport interface EventManifest {\n readonly name: string;\n readonly aliases?: readonly string[];\n readonly revision?: number;\n readonly schema: string;\n}\n\n/** A query model of an aggregate: `snapshot` or `events` (decision D128). */\nexport interface QueryManifest {\n readonly model: string;\n readonly routes?: readonly RouteManifest[];\n}\n\n/** An aggregate of a bounded context. */\nexport interface AggregateManifest {\n readonly name: string;\n readonly description?: string;\n readonly state: { readonly schema: string; readonly fingerprint?: string };\n readonly snapshot?: { readonly enabled?: boolean };\n readonly commands?: readonly CommandManifest[];\n readonly events?: readonly EventManifest[];\n readonly lifecycle?: readonly string[];\n readonly queries?: readonly QueryManifest[];\n readonly schedules?: readonly string[];\n readonly ownership?: Ownership;\n}\n\n/** A subscription of a bounded context (design 04 §1). */\nexport interface SubscriptionManifest {\n /** `processor.function`, as a `handled` hop names it. */\n readonly name: string;\n readonly kind: 'PROJECTION' | 'REACTOR' | 'SAGA';\n readonly source: {\n readonly context?: string;\n readonly aggregates?: readonly string[];\n readonly events?: readonly string[];\n };\n readonly derives?: readonly string[];\n readonly rejected?: readonly string[];\n readonly committed?: readonly string[];\n readonly [property: string]: unknown;\n}\n\n/** An error code and the HTTP status it is answered with. */\nexport interface ErrorManifest {\n readonly code: string;\n readonly status: number;\n readonly description?: string;\n}\n\n/** A bounded context of the Manifest. */\nexport interface ContextManifest {\n readonly name: string;\n readonly description?: string;\n readonly aggregates?: readonly AggregateManifest[];\n readonly subscriptions?: readonly SubscriptionManifest[];\n readonly published?: readonly {\n readonly aggregate: string;\n readonly topic: string;\n readonly includeState?: boolean;\n }[];\n readonly errors?: readonly ErrorManifest[];\n}\n\n/**\n * A service's Manifest (decisions D17, D73–D76): its contexts, aggregates,\n * commands, events, routes and error codes, and the JSON Schemas they refer\n * to under `$defs`. `wow-generator` generates typed clients from it.\n */\nexport interface Manifest {\n readonly format: number;\n readonly service?: { readonly name: string; readonly version?: string };\n readonly contexts: readonly ContextManifest[];\n readonly errors?: readonly ErrorManifest[];\n readonly $defs?: Readonly<Record<string, unknown>>;\n}\n\n/** The format of the Manifest this client reads. */\nexport const MANIFEST_FORMAT = 1;\n\n/**\n * The service's Manifest, `GET /wow/manifest`, authorized as any API.\n *\n * @param client - How the service is reached\n * @param options - Headers and cancellation\n */\nexport async function fetchManifest(\n client: WowClientOptions = {},\n options?: RequestOptions,\n): Promise<Manifest> {\n return json<Manifest>(\n await send(client, { method: 'GET', path: '/wow/manifest', options }),\n );\n}\n"],"mappings":"8BA0HA,IAAaG,EAAkB,EAQ/B,eAAsBC,EACpB,EAA2B,CAAC,EAC5B,EACmB,CACnB,OAAOJ,EAAAA,KACL,MAAMC,EAAAA,KAAKI,EAAQ,CAAE,OAAQ,MAAO,KAAM,gBAAiB,SAAQ,CAAC,CACtE,CACF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { RequestOptions, WowClientOptions } from './http.cjs';
|
|
2
|
+
import { Ownership } from './wire.cjs';
|
|
3
|
+
/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */
|
|
4
|
+
export interface RouteManifest {
|
|
5
|
+
readonly method: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
/** Whether a command creates its aggregate. */
|
|
9
|
+
export type Creation = 'NONE' | 'REQUIRED' | 'ALLOWED';
|
|
10
|
+
/** A command of an aggregate (decisions D104, D176, D182). */
|
|
11
|
+
export interface CommandManifest {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly aliases?: readonly string[];
|
|
14
|
+
/** `#/$defs/<key>`. */
|
|
15
|
+
readonly schema: string;
|
|
16
|
+
readonly creation?: Creation;
|
|
17
|
+
readonly produces?: readonly string[];
|
|
18
|
+
readonly routes?: readonly RouteManifest[];
|
|
19
|
+
readonly mounted?: boolean;
|
|
20
|
+
readonly transformsTo?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** An event of an aggregate and its revision. */
|
|
23
|
+
export interface EventManifest {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly aliases?: readonly string[];
|
|
26
|
+
readonly revision?: number;
|
|
27
|
+
readonly schema: string;
|
|
28
|
+
}
|
|
29
|
+
/** A query model of an aggregate: `snapshot` or `events` (decision D128). */
|
|
30
|
+
export interface QueryManifest {
|
|
31
|
+
readonly model: string;
|
|
32
|
+
readonly routes?: readonly RouteManifest[];
|
|
33
|
+
}
|
|
34
|
+
/** An aggregate of a bounded context. */
|
|
35
|
+
export interface AggregateManifest {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly state: {
|
|
39
|
+
readonly schema: string;
|
|
40
|
+
readonly fingerprint?: string;
|
|
41
|
+
};
|
|
42
|
+
readonly snapshot?: {
|
|
43
|
+
readonly enabled?: boolean;
|
|
44
|
+
};
|
|
45
|
+
readonly commands?: readonly CommandManifest[];
|
|
46
|
+
readonly events?: readonly EventManifest[];
|
|
47
|
+
readonly lifecycle?: readonly string[];
|
|
48
|
+
readonly queries?: readonly QueryManifest[];
|
|
49
|
+
readonly schedules?: readonly string[];
|
|
50
|
+
readonly ownership?: Ownership;
|
|
51
|
+
}
|
|
52
|
+
/** A subscription of a bounded context (design 04 §1). */
|
|
53
|
+
export interface SubscriptionManifest {
|
|
54
|
+
/** `processor.function`, as a `handled` hop names it. */
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly kind: 'PROJECTION' | 'REACTOR' | 'SAGA';
|
|
57
|
+
readonly source: {
|
|
58
|
+
readonly context?: string;
|
|
59
|
+
readonly aggregates?: readonly string[];
|
|
60
|
+
readonly events?: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
readonly derives?: readonly string[];
|
|
63
|
+
readonly rejected?: readonly string[];
|
|
64
|
+
readonly committed?: readonly string[];
|
|
65
|
+
readonly [property: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
/** An error code and the HTTP status it is answered with. */
|
|
68
|
+
export interface ErrorManifest {
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly status: number;
|
|
71
|
+
readonly description?: string;
|
|
72
|
+
}
|
|
73
|
+
/** A bounded context of the Manifest. */
|
|
74
|
+
export interface ContextManifest {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly description?: string;
|
|
77
|
+
readonly aggregates?: readonly AggregateManifest[];
|
|
78
|
+
readonly subscriptions?: readonly SubscriptionManifest[];
|
|
79
|
+
readonly published?: readonly {
|
|
80
|
+
readonly aggregate: string;
|
|
81
|
+
readonly topic: string;
|
|
82
|
+
readonly includeState?: boolean;
|
|
83
|
+
}[];
|
|
84
|
+
readonly errors?: readonly ErrorManifest[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A service's Manifest (decisions D17, D73–D76): its contexts, aggregates,
|
|
88
|
+
* commands, events, routes and error codes, and the JSON Schemas they refer
|
|
89
|
+
* to under `$defs`. `wow-generator` generates typed clients from it.
|
|
90
|
+
*/
|
|
91
|
+
export interface Manifest {
|
|
92
|
+
readonly format: number;
|
|
93
|
+
readonly service?: {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly version?: string;
|
|
96
|
+
};
|
|
97
|
+
readonly contexts: readonly ContextManifest[];
|
|
98
|
+
readonly errors?: readonly ErrorManifest[];
|
|
99
|
+
readonly $defs?: Readonly<Record<string, unknown>>;
|
|
100
|
+
}
|
|
101
|
+
/** The format of the Manifest this client reads. */
|
|
102
|
+
export declare const MANIFEST_FORMAT = 1;
|
|
103
|
+
/**
|
|
104
|
+
* The service's Manifest, `GET /wow/manifest`, authorized as any API.
|
|
105
|
+
*
|
|
106
|
+
* @param client - How the service is reached
|
|
107
|
+
* @param options - Headers and cancellation
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchManifest(client?: WowClientOptions, options?: RequestOptions): Promise<Manifest>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { RequestOptions, WowClientOptions } from './http.js';
|
|
2
|
+
import { Ownership } from './wire.js';
|
|
3
|
+
/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */
|
|
4
|
+
export interface RouteManifest {
|
|
5
|
+
readonly method: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
/** Whether a command creates its aggregate. */
|
|
9
|
+
export type Creation = 'NONE' | 'REQUIRED' | 'ALLOWED';
|
|
10
|
+
/** A command of an aggregate (decisions D104, D176, D182). */
|
|
11
|
+
export interface CommandManifest {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly aliases?: readonly string[];
|
|
14
|
+
/** `#/$defs/<key>`. */
|
|
15
|
+
readonly schema: string;
|
|
16
|
+
readonly creation?: Creation;
|
|
17
|
+
readonly produces?: readonly string[];
|
|
18
|
+
readonly routes?: readonly RouteManifest[];
|
|
19
|
+
readonly mounted?: boolean;
|
|
20
|
+
readonly transformsTo?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** An event of an aggregate and its revision. */
|
|
23
|
+
export interface EventManifest {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly aliases?: readonly string[];
|
|
26
|
+
readonly revision?: number;
|
|
27
|
+
readonly schema: string;
|
|
28
|
+
}
|
|
29
|
+
/** A query model of an aggregate: `snapshot` or `events` (decision D128). */
|
|
30
|
+
export interface QueryManifest {
|
|
31
|
+
readonly model: string;
|
|
32
|
+
readonly routes?: readonly RouteManifest[];
|
|
33
|
+
}
|
|
34
|
+
/** An aggregate of a bounded context. */
|
|
35
|
+
export interface AggregateManifest {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly state: {
|
|
39
|
+
readonly schema: string;
|
|
40
|
+
readonly fingerprint?: string;
|
|
41
|
+
};
|
|
42
|
+
readonly snapshot?: {
|
|
43
|
+
readonly enabled?: boolean;
|
|
44
|
+
};
|
|
45
|
+
readonly commands?: readonly CommandManifest[];
|
|
46
|
+
readonly events?: readonly EventManifest[];
|
|
47
|
+
readonly lifecycle?: readonly string[];
|
|
48
|
+
readonly queries?: readonly QueryManifest[];
|
|
49
|
+
readonly schedules?: readonly string[];
|
|
50
|
+
readonly ownership?: Ownership;
|
|
51
|
+
}
|
|
52
|
+
/** A subscription of a bounded context (design 04 §1). */
|
|
53
|
+
export interface SubscriptionManifest {
|
|
54
|
+
/** `processor.function`, as a `handled` hop names it. */
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly kind: 'PROJECTION' | 'REACTOR' | 'SAGA';
|
|
57
|
+
readonly source: {
|
|
58
|
+
readonly context?: string;
|
|
59
|
+
readonly aggregates?: readonly string[];
|
|
60
|
+
readonly events?: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
readonly derives?: readonly string[];
|
|
63
|
+
readonly rejected?: readonly string[];
|
|
64
|
+
readonly committed?: readonly string[];
|
|
65
|
+
readonly [property: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
/** An error code and the HTTP status it is answered with. */
|
|
68
|
+
export interface ErrorManifest {
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly status: number;
|
|
71
|
+
readonly description?: string;
|
|
72
|
+
}
|
|
73
|
+
/** A bounded context of the Manifest. */
|
|
74
|
+
export interface ContextManifest {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly description?: string;
|
|
77
|
+
readonly aggregates?: readonly AggregateManifest[];
|
|
78
|
+
readonly subscriptions?: readonly SubscriptionManifest[];
|
|
79
|
+
readonly published?: readonly {
|
|
80
|
+
readonly aggregate: string;
|
|
81
|
+
readonly topic: string;
|
|
82
|
+
readonly includeState?: boolean;
|
|
83
|
+
}[];
|
|
84
|
+
readonly errors?: readonly ErrorManifest[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A service's Manifest (decisions D17, D73–D76): its contexts, aggregates,
|
|
88
|
+
* commands, events, routes and error codes, and the JSON Schemas they refer
|
|
89
|
+
* to under `$defs`. `wow-generator` generates typed clients from it.
|
|
90
|
+
*/
|
|
91
|
+
export interface Manifest {
|
|
92
|
+
readonly format: number;
|
|
93
|
+
readonly service?: {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly version?: string;
|
|
96
|
+
};
|
|
97
|
+
readonly contexts: readonly ContextManifest[];
|
|
98
|
+
readonly errors?: readonly ErrorManifest[];
|
|
99
|
+
readonly $defs?: Readonly<Record<string, unknown>>;
|
|
100
|
+
}
|
|
101
|
+
/** The format of the Manifest this client reads. */
|
|
102
|
+
export declare const MANIFEST_FORMAT = 1;
|
|
103
|
+
/**
|
|
104
|
+
* The service's Manifest, `GET /wow/manifest`, authorized as any API.
|
|
105
|
+
*
|
|
106
|
+
* @param client - How the service is reached
|
|
107
|
+
* @param options - Headers and cancellation
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchManifest(client?: WowClientOptions, options?: RequestOptions): Promise<Manifest>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { json as e, send as t } from "./http.es.js";
|
|
2
|
+
//#region src/manifest.ts
|
|
3
|
+
var n = 1;
|
|
4
|
+
async function r(n = {}, r) {
|
|
5
|
+
return e(await t(n, {
|
|
6
|
+
method: "GET",
|
|
7
|
+
path: "/wow/manifest",
|
|
8
|
+
options: r
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as MANIFEST_FORMAT, r as fetchManifest };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=manifest.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.es.js","names":["MANIFEST_FORMAT","fetchManifest","json","send","client"],"sources":["../src/manifest.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n json,\n type RequestOptions,\n send,\n type WowClientOptions,\n} from './http.js';\nimport type { Ownership } from './wire.js';\n\n/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */\nexport interface RouteManifest {\n readonly method: string;\n readonly path: string;\n}\n\n/** Whether a command creates its aggregate. */\nexport type Creation = 'NONE' | 'REQUIRED' | 'ALLOWED';\n\n/** A command of an aggregate (decisions D104, D176, D182). */\nexport interface CommandManifest {\n readonly name: string;\n readonly aliases?: readonly string[];\n /** `#/$defs/<key>`. */\n readonly schema: string;\n readonly creation?: Creation;\n readonly produces?: readonly string[];\n readonly routes?: readonly RouteManifest[];\n readonly mounted?: boolean;\n readonly transformsTo?: readonly string[];\n}\n\n/** An event of an aggregate and its revision. */\nexport interface EventManifest {\n readonly name: string;\n readonly aliases?: readonly string[];\n readonly revision?: number;\n readonly schema: string;\n}\n\n/** A query model of an aggregate: `snapshot` or `events` (decision D128). */\nexport interface QueryManifest {\n readonly model: string;\n readonly routes?: readonly RouteManifest[];\n}\n\n/** An aggregate of a bounded context. */\nexport interface AggregateManifest {\n readonly name: string;\n readonly description?: string;\n readonly state: { readonly schema: string; readonly fingerprint?: string };\n readonly snapshot?: { readonly enabled?: boolean };\n readonly commands?: readonly CommandManifest[];\n readonly events?: readonly EventManifest[];\n readonly lifecycle?: readonly string[];\n readonly queries?: readonly QueryManifest[];\n readonly schedules?: readonly string[];\n readonly ownership?: Ownership;\n}\n\n/** A subscription of a bounded context (design 04 §1). */\nexport interface SubscriptionManifest {\n /** `processor.function`, as a `handled` hop names it. */\n readonly name: string;\n readonly kind: 'PROJECTION' | 'REACTOR' | 'SAGA';\n readonly source: {\n readonly context?: string;\n readonly aggregates?: readonly string[];\n readonly events?: readonly string[];\n };\n readonly derives?: readonly string[];\n readonly rejected?: readonly string[];\n readonly committed?: readonly string[];\n readonly [property: string]: unknown;\n}\n\n/** An error code and the HTTP status it is answered with. */\nexport interface ErrorManifest {\n readonly code: string;\n readonly status: number;\n readonly description?: string;\n}\n\n/** A bounded context of the Manifest. */\nexport interface ContextManifest {\n readonly name: string;\n readonly description?: string;\n readonly aggregates?: readonly AggregateManifest[];\n readonly subscriptions?: readonly SubscriptionManifest[];\n readonly published?: readonly {\n readonly aggregate: string;\n readonly topic: string;\n readonly includeState?: boolean;\n }[];\n readonly errors?: readonly ErrorManifest[];\n}\n\n/**\n * A service's Manifest (decisions D17, D73–D76): its contexts, aggregates,\n * commands, events, routes and error codes, and the JSON Schemas they refer\n * to under `$defs`. `wow-generator` generates typed clients from it.\n */\nexport interface Manifest {\n readonly format: number;\n readonly service?: { readonly name: string; readonly version?: string };\n readonly contexts: readonly ContextManifest[];\n readonly errors?: readonly ErrorManifest[];\n readonly $defs?: Readonly<Record<string, unknown>>;\n}\n\n/** The format of the Manifest this client reads. */\nexport const MANIFEST_FORMAT = 1;\n\n/**\n * The service's Manifest, `GET /wow/manifest`, authorized as any API.\n *\n * @param client - How the service is reached\n * @param options - Headers and cancellation\n */\nexport async function fetchManifest(\n client: WowClientOptions = {},\n options?: RequestOptions,\n): Promise<Manifest> {\n return json<Manifest>(\n await send(client, { method: 'GET', path: '/wow/manifest', options }),\n );\n}\n"],"mappings":";;AA0HA,IAAaA,IAAkB;AAQ/B,eAAsBC,EACpB,IAA2B,CAAC,GAC5B,GACmB;CACnB,OAAOC,EACL,MAAMC,EAAKC,GAAQ;EAAE,QAAQ;EAAO,MAAM;EAAiB;CAAQ,CAAC,CACtE;AACF"}
|
package/dist/problem.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={AUTH_UNAUTHENTICATED:`wow.auth.unauthenticated`,AUTH_FORBIDDEN:`wow.auth.forbidden`,AGGREGATE_FORBIDDEN:`wow.aggregate.forbidden`,COMMAND_MALFORMED:`wow.command.malformed`,COMMAND_INVALID:`wow.command.invalid`,WAIT_INVALID:`wow.wait.invalid`,COMMAND_UNHANDLED:`wow.command.unhandled`,AGGREGATE_NOT_FOUND:`wow.aggregate.not-found`,AGGREGATE_EXISTS:`wow.aggregate.exists`,AGGREGATE_VERSION_MISMATCH:`wow.aggregate.version-mismatch`,COMMAND_REQUEST_ID_REUSED:`wow.command.request-id-reused`,COMMAND_CONTENDED:`wow.command.contended`,AGGREGATE_DELETED:`wow.aggregate.deleted`,COMMAND_BUSY:`wow.command.busy`,COMMAND_UNKNOWN:`wow.command.unknown`,COMMAND_FAILED:`wow.command.failed`,NODE_CLOSING:`wow.node.closing`,NODE_STANDBY:`wow.node.standby`,STORAGE_UNAVAILABLE:`wow.storage.unavailable`,SCHEDULE_NOT_DUE:`wow.schedule.not-due`,SCHEDULE_JOB_INVALID:`wow.schedule.job-invalid`,SUBSCRIPTION_PARKED:`wow.subscription.parked`,WAIT_TIMEOUT:`wow.wait.timeout`,QUERY_MALFORMED:`wow.query.malformed`,QUERY_INVALID:`wow.query.invalid`,QUERY_FAILED:`wow.query.failed`,QUERY_TIMEOUT:`wow.query.timeout`,QUERY_BUSY:`wow.query.busy`,QUERY_NOT_FOUND:`wow.query.not-found`,QUERY_DATASET_NOT_FOUND:`wow.query.dataset-not-found`,QUERY_MIN_VERSION_NOT_REACHED:`wow.query.min-version-not-reached`,QUERY_DATASET_UNAVAILABLE:`wow.query.dataset-unavailable`,CALL_COMMAND_FORBIDDEN:`wow.call.command-forbidden`},t=`wow.`,n=`urn:wow:error:`,r=new Set([`type`,`title`,`status`,`detail`,`instance`,`code`,`violations`,`result`,`extensions`]);function i(e){if(e.extensions!==void 0)return e;let t=Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)));return Object.keys(t).length===0?e:{...e,extensions:t}}var a=new Map([[e.COMMAND_UNKNOWN,!0],[e.NODE_CLOSING,!0],[e.NODE_STANDBY,!0],[e.STORAGE_UNAVAILABLE,!0],[e.SCHEDULE_NOT_DUE,!0],[e.COMMAND_BUSY,!0],[e.QUERY_BUSY,!1],[e.QUERY_MIN_VERSION_NOT_REACHED,!1],[e.COMMAND_CONTENDED,!0],[e.WAIT_TIMEOUT,!0]]);function o(e,t,n){let r=e===void 0?void 0:a.get(e),i=r!==void 0||e===void 0&&t===503;return{retryable:i,sameRequestId:r??i,...n===void 0?{}:{afterMs:n}}}var s=class extends Error{get requestId(){return this.result?.requestId??c.get(this)}constructor(e,t={}){super(e.code?`[${e.code}] ${e.detail??e.title}`:`${e.status} ${e.detail??e.title}`),this.name=`WowProblemError`,this.problem=i(e),this.status=e.status,e.code!==void 0&&(this.code=e.code),this.violations=e.violations??[],e.result!==void 0&&(this.result=e.result),this.retry=o(e.code,e.status,t.retryAfterMs),t.cause!==void 0&&(this.cause=t.cause)}get isFramework(){return this.code?.startsWith(`wow.`)??!1}},c=new WeakMap;function l(e,t){(typeof e==`object`&&e||typeof e==`function`)&&(c.has(e)||c.set(e,t))}function u(e){return e instanceof s?e.requestId:typeof e==`object`&&e||typeof e==`function`?c.get(e):void 0}function d(e){return typeof e==`object`&&!!e&&typeof e.status==`number`}function f(e,t=Date.now()){if(!e)return;let n=e.trim();if(/^\d+$/.test(n))return Number(n)*1e3;let r=Date.parse(n);return Number.isNaN(r)?void 0:Math.max(0,r-t)}async function p(e){let t;try{t=await e.clone().json()}catch{}if(d(t)){let n=t.code??(t.type?.startsWith(`urn:wow:error:`)?t.type.slice(14):void 0);return i({...t,type:t.type??`about:blank`,title:t.title??e.statusText,...n===void 0?{}:{code:n}})}return{type:`about:blank`,title:e.statusText,status:e.status}}async function m(e){if(e instanceof s)return e;if(typeof e!=`object`||!e)return;let{exchange:t,cause:n}=e;if(n instanceof s)return n;let r=t?.response;if(!r||r.ok)return;let i=await p(r),a=f(r.headers.get(`Retry-After`));return new s(i,{cause:e,...a===void 0?{}:{retryAfterMs:a}})}exports.FRAMEWORK_ERROR_PREFIX=t,exports.FrameworkErrorCodes=e,exports.PROBLEM_TYPE_PREFIX=n,exports.WowProblemError=s,exports.isProblem=d,exports.parseRetryAfter=f,exports.readProblem=p,exports.rememberRequestId=l,exports.requestIdOf=u,exports.retryHintOf=o,exports.toWowProblemError=m;
|
|
2
|
+
//# sourceMappingURL=problem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.cjs","names":["FrameworkErrorCodes","FRAMEWORK_ERROR_PREFIX","PROBLEM_TYPE_PREFIX","PROBLEM_MEMBERS","withExtensions","problem","extensions","name","RETRYABLE","retryHintOf","sameRequestId","code","retryable","status","afterMs","WowProblemError","SENT_REQUEST_IDS","options","rememberRequestId","error","requestId","requestIdOf","isProblem","value","parseRetryAfter","trimmed","date","now","readProblem","body","response","toWowProblemError","cause","exchange","retryAfterMs"],"sources":["../src/problem.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CommandResult, Violation } from './wire.js';\n\n/**\n * The framework's error codes (design 05 §3, decisions D102, D103, D130),\n * each answered with the status of the Manifest's `errors` table. A domain\n * rejection has a code of its own, answered with 422 unless the service\n * configures another status.\n */\nexport const FrameworkErrorCodes = {\n /** 401: the request carries no valid credentials. */\n AUTH_UNAUTHENTICATED: 'wow.auth.unauthenticated',\n /** 403: the caller may not send this command. */\n AUTH_FORBIDDEN: 'wow.auth.forbidden',\n /** 403: the aggregate is outside the caller's scope. */\n AGGREGATE_FORBIDDEN: 'wow.aggregate.forbidden',\n /** 400: the command body cannot be read as the command type. */\n COMMAND_MALFORMED: 'wow.command.malformed',\n /** 400: the command failed validation; the problem lists the violations. */\n COMMAND_INVALID: 'wow.command.invalid',\n /** 400: the wait is not a chain the runtime can follow. */\n WAIT_INVALID: 'wow.wait.invalid',\n /** 400: the aggregate does not handle this command. */\n COMMAND_UNHANDLED: 'wow.command.unhandled',\n /** 404: the aggregate does not exist. */\n AGGREGATE_NOT_FOUND: 'wow.aggregate.not-found',\n /** 409: the aggregate already exists. */\n AGGREGATE_EXISTS: 'wow.aggregate.exists',\n /** 409, or 412 with `If-Match`: the aggregate is not at the expected version. */\n AGGREGATE_VERSION_MISMATCH: 'wow.aggregate.version-mismatch',\n /** 409: the request id was used by another command. */\n COMMAND_REQUEST_ID_REUSED: 'wow.command.request-id-reused',\n /** 409: concurrent writers kept winning; retrying with the same request id is safe. */\n COMMAND_CONTENDED: 'wow.command.contended',\n /** 410: the aggregate is deleted; only RestoreAggregate applies. */\n AGGREGATE_DELETED: 'wow.aggregate.deleted',\n /** 429: the command was not taken, its aggregate or the node being busy; retry later. */\n COMMAND_BUSY: 'wow.command.busy',\n /** 503: whether the command committed is unknown; retrying with the same request id is safe. */\n COMMAND_UNKNOWN: 'wow.command.unknown',\n /** 500: the command's handling failed with an unexpected error; it committed nothing, and a retry fails alike. */\n COMMAND_FAILED: 'wow.command.failed',\n /** 503: the node is shutting down; retry on another node. */\n NODE_CLOSING: 'wow.node.closing',\n /** 503: the node is on standby until a migration's cut-over; it serves reads only. */\n NODE_STANDBY: 'wow.node.standby',\n /** 503, with `Retry-After`: a store could not be reached in time; retry later. */\n STORAGE_UNAVAILABLE: 'wow.storage.unavailable',\n /** 503: a scheduled command arrived too long before its due time; it is sent again later. */\n SCHEDULE_NOT_DUE: 'wow.schedule.not-due',\n /** 400: the job command does not fit its job or instance (decision D198). */\n SCHEDULE_JOB_INVALID: 'wow.schedule.job-invalid',\n /** 500: a subscription on the wait chain parked the aggregate. */\n SUBSCRIPTION_PARKED: 'wow.subscription.parked',\n /** 504: the wait ran out of time; the command may have committed. */\n WAIT_TIMEOUT: 'wow.wait.timeout',\n /** 400: the query body cannot be read as a query. */\n QUERY_MALFORMED: 'wow.query.malformed',\n /** 400: the query failed admission; each violation has its code. */\n QUERY_INVALID: 'wow.query.invalid',\n /** 500: the query backend failed to run the query. */\n QUERY_FAILED: 'wow.query.failed',\n /** 504: the query ran longer than its budget allows; not retried (decision D254 ③). */\n QUERY_TIMEOUT: 'wow.query.timeout',\n /** 429, with `Retry-After`: the query's store runs as many queries as it allows; retry later. */\n QUERY_BUSY: 'wow.query.busy',\n /**\n * 404: a `single` query matched no record, whatever its model (review R4-Q,\n * Q-4); a state read by id that finds none is `wow.aggregate.not-found`.\n */\n QUERY_NOT_FOUND: 'wow.query.not-found',\n /** 404: no dataset of that name is served to the caller. */\n QUERY_DATASET_NOT_FOUND: 'wow.query.dataset-not-found',\n /**\n * 409, with `Retry-After`: a state read asked for a version (`minVersion`) the\n * aggregate has not reached within the wait; the problem's `version` is its\n * current one (review R4-Q, Q-13).\n */\n QUERY_MIN_VERSION_NOT_REACHED: 'wow.query.min-version-not-reached',\n /** 409: the dataset is served but cannot be queried now (it needs revision, decision D259). */\n QUERY_DATASET_UNAVAILABLE: 'wow.query.dataset-unavailable',\n /** 403: the calling service may not call this command (a synchronous call on the internal port, decision D226). */\n CALL_COMMAND_FORBIDDEN: 'wow.call.command-forbidden',\n} as const;\n\n/** A {@link FrameworkErrorCodes} value. */\nexport type FrameworkErrorCode =\n (typeof FrameworkErrorCodes)[keyof typeof FrameworkErrorCodes];\n\n/** The prefix of every framework code, and of no domain code. */\nexport const FRAMEWORK_ERROR_PREFIX = 'wow.';\n\n/** The prefix of a problem's `type` that carries a Wow code. */\nexport const PROBLEM_TYPE_PREFIX = 'urn:wow:error:';\n\n/**\n * An RFC 9457 problem as a Wow service writes it (decisions D101, D102):\n * `type` is `urn:wow:error:<code>`, or `about:blank` for an error that is\n * only HTTP's (a missing route, 406, 415).\n */\nexport interface Problem {\n readonly type: string;\n readonly title: string;\n readonly status: number;\n readonly detail?: string;\n /** The Wow code; absent for an error that is only HTTP's. */\n readonly code?: string;\n readonly violations?: readonly Violation[];\n /** The whole result of a command that has a ref. */\n readonly result?: CommandResult;\n /**\n * The problem's extension members (RFC 9457): every member the server\n * wrote besides the ones above and `instance`, such as a rejection's\n * structured data (decision D211). Absent when it wrote none.\n */\n readonly extensions?: Readonly<Record<string, unknown>>;\n}\n\n/** The members of a problem that are not extension members. */\nconst PROBLEM_MEMBERS: ReadonlySet<string> = new Set([\n 'type',\n 'title',\n 'status',\n 'detail',\n 'instance',\n 'code',\n 'violations',\n 'result',\n 'extensions',\n]);\n\n/**\n * `problem` with its extension members gathered as `extensions` (internal):\n * a problem read from the wire carries them as top-level members.\n */\nfunction withExtensions(problem: Problem): Problem {\n if (problem.extensions !== undefined) return problem;\n const extensions = Object.fromEntries(\n Object.entries(problem).filter(([name]) => !PROBLEM_MEMBERS.has(name)),\n );\n return Object.keys(extensions).length === 0\n ? problem\n : { ...problem, extensions };\n}\n\n/**\n * What a client may do about a failed request: whether retrying can succeed,\n * whether to keep the request id (`Wow-Request-Id`) so the server\n * deduplicates a command that did commit, and how long to wait first.\n */\nexport interface RetryHint {\n readonly retryable: boolean;\n /** Retry with the same `Wow-Request-Id`: a commit is then answered as a duplicate. */\n readonly sameRequestId: boolean;\n /** The server's `Retry-After`, in milliseconds. */\n readonly afterMs?: number;\n}\n\n/**\n * The codes a retry may get past, each with whether to keep the request id:\n * the 503s (`wow.command.unknown`, `wow.node.closing`, `wow.node.standby`,\n * `wow.storage.unavailable`, `wow.schedule.not-due`),\n * the 429s `wow.command.busy` and `wow.query.busy`, the 409s `wow.command.contended` and\n * `wow.query.min-version-not-reached` (once the command commits), and the 504\n * `wow.wait.timeout`, whose command may have committed.\n */\nconst RETRYABLE: ReadonlyMap<string, boolean> = new Map([\n [FrameworkErrorCodes.COMMAND_UNKNOWN, true],\n [FrameworkErrorCodes.NODE_CLOSING, true],\n [FrameworkErrorCodes.NODE_STANDBY, true],\n [FrameworkErrorCodes.STORAGE_UNAVAILABLE, true],\n [FrameworkErrorCodes.SCHEDULE_NOT_DUE, true],\n [FrameworkErrorCodes.COMMAND_BUSY, true],\n [FrameworkErrorCodes.QUERY_BUSY, false],\n [FrameworkErrorCodes.QUERY_MIN_VERSION_NOT_REACHED, false],\n [FrameworkErrorCodes.COMMAND_CONTENDED, true],\n [FrameworkErrorCodes.WAIT_TIMEOUT, true],\n]);\n\n/**\n * The retry hint of a problem with `code` and `status`: a code of the\n * retryable table, or a 503 without a code (a proxy's), may be retried.\n *\n * @param code - The problem's Wow code, if any\n * @param status - The HTTP status\n * @param afterMs - The `Retry-After` the response carried, in milliseconds\n */\nexport function retryHintOf(\n code: string | undefined,\n status: number,\n afterMs?: number,\n): RetryHint {\n const sameRequestId = code === undefined ? undefined : RETRYABLE.get(code);\n const retryable =\n sameRequestId !== undefined || (code === undefined && status === 503);\n return {\n retryable,\n sameRequestId: sameRequestId ?? retryable,\n ...(afterMs === undefined ? {} : { afterMs }),\n };\n}\n\n/**\n * A request a Wow service answered with a problem: a non-2xx response, a\n * command result that did not succeed, or the `error` event that ends a\n * streamed query.\n */\nexport class WowProblemError extends Error {\n override readonly name = 'WowProblemError';\n /** The problem as the server wrote it. */\n readonly problem: Problem;\n /** The HTTP status. */\n readonly status: number;\n /** The Wow code; absent for an error that is only HTTP's. */\n readonly code?: string;\n readonly violations: readonly Violation[];\n /** The command's result, when the command had a ref. */\n readonly result?: CommandResult;\n /** What a client may do about it. */\n readonly retry: RetryHint;\n /** The error this one explains: the fetcher's, or the stream's. */\n readonly cause?: unknown;\n\n /**\n * The request id (`Wow-Request-Id`) of the command this answers: its\n * result's, else the one the client sent. Retry with it when\n * {@link RetryHint.sameRequestId} says so.\n */\n get requestId(): string | undefined {\n return this.result?.requestId ?? SENT_REQUEST_IDS.get(this);\n }\n\n /**\n * @param problem - The problem the server answered with\n * @param options - The response's `Retry-After` in milliseconds, and the\n * error this one explains\n */\n constructor(\n problem: Problem,\n options: { retryAfterMs?: number; cause?: unknown } = {},\n ) {\n super(\n problem.code\n ? `[${problem.code}] ${problem.detail ?? problem.title}`\n : `${problem.status} ${problem.detail ?? problem.title}`,\n );\n this.problem = withExtensions(problem);\n this.status = problem.status;\n if (problem.code !== undefined) this.code = problem.code;\n this.violations = problem.violations ?? [];\n if (problem.result !== undefined) this.result = problem.result;\n this.retry = retryHintOf(\n problem.code,\n problem.status,\n options.retryAfterMs,\n );\n if (options.cause !== undefined) this.cause = options.cause;\n }\n\n /** Whether the code is a framework one (`wow.*`) rather than the domain's. */\n get isFramework(): boolean {\n return this.code?.startsWith(FRAMEWORK_ERROR_PREFIX) ?? false;\n }\n}\n\n/** The request ids the client sent, by the errors the requests failed with. */\nconst SENT_REQUEST_IDS = new WeakMap<object, string>();\n\n/**\n * Remembers that the request that failed with `error` was sent with\n * `requestId` (internal): {@link requestIdOf} answers it.\n *\n * @param error - What the request failed with\n * @param requestId - The `Wow-Request-Id` it was sent with\n */\nexport function rememberRequestId(error: unknown, requestId: string): void {\n if (\n (typeof error === 'object' && error !== null) ||\n typeof error === 'function'\n ) {\n if (!SENT_REQUEST_IDS.has(error)) SENT_REQUEST_IDS.set(error, requestId);\n }\n}\n\n/**\n * The request id (`Wow-Request-Id`) a command that failed with `error` was\n * sent with: also after a failure no server answered (the network, a proxy,\n * an abort), so the command can be retried with the same id and the service\n * answers a commit that did happen as a duplicate (decision D223).\n * Undefined for an error of no command the client sent.\n *\n * @param error - What a command rejected with\n */\nexport function requestIdOf(error: unknown): string | undefined {\n if (error instanceof WowProblemError) return error.requestId;\n return (typeof error === 'object' && error !== null) ||\n typeof error === 'function'\n ? SENT_REQUEST_IDS.get(error)\n : undefined;\n}\n\n/** Whether `value` reads as a problem: an object with a numeric `status`. */\nexport function isProblem(value: unknown): value is Problem {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { status?: unknown }).status === 'number'\n );\n}\n\n/**\n * The milliseconds of a `Retry-After` header: delay seconds or an HTTP date.\n *\n * @param value - The header's value\n * @param now - The current time, in epoch milliseconds\n */\nexport function parseRetryAfter(\n value: string | null | undefined,\n now: number = Date.now(),\n): number | undefined {\n if (!value) return undefined;\n const trimmed = value.trim();\n if (/^\\d+$/.test(trimmed)) return Number(trimmed) * 1000;\n const date = Date.parse(trimmed);\n return Number.isNaN(date) ? undefined : Math.max(0, date - now);\n}\n\n/**\n * The problem a response that did not succeed carries: its body when it is\n * a problem (or a code the `type` names), else one made of its status.\n *\n * @param response - A response that is not 2xx\n */\nexport async function readProblem(response: Response): Promise<Problem> {\n let body: unknown;\n try {\n body = await response.clone().json();\n } catch {\n // Not JSON, or already read: the status is all there is.\n }\n if (isProblem(body)) {\n const code =\n body.code ??\n (body.type?.startsWith(PROBLEM_TYPE_PREFIX)\n ? body.type.slice(PROBLEM_TYPE_PREFIX.length)\n : undefined);\n return withExtensions({\n ...body,\n type: body.type ?? 'about:blank',\n title: body.title ?? response.statusText,\n ...(code === undefined ? {} : { code }),\n });\n }\n return {\n type: 'about:blank',\n title: response.statusText,\n status: response.status,\n };\n}\n\ninterface ExchangeLike {\n exchange?: { response?: Response };\n cause?: unknown;\n}\n\n/**\n * The {@link WowProblemError} of an error a request rejected with: the\n * fetcher's `ExchangeError` of a response that is not 2xx, read as a problem.\n * Undefined for a failure no server answered (a network error, an abort).\n *\n * @param error - What the request rejected with\n */\nexport async function toWowProblemError(\n error: unknown,\n): Promise<WowProblemError | undefined> {\n if (error instanceof WowProblemError) return error;\n if (typeof error !== 'object' || error === null) return undefined;\n const { exchange, cause } = error as ExchangeLike;\n if (cause instanceof WowProblemError) return cause;\n const response = exchange?.response;\n if (!response || response.ok) return undefined;\n const problem = await readProblem(response);\n const retryAfterMs = parseRetryAfter(response.headers.get('Retry-After'));\n return new WowProblemError(problem, {\n cause: error,\n ...(retryAfterMs === undefined ? {} : { retryAfterMs }),\n });\n}\n"],"mappings":"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"}
|