@ahoo-wang/wow-client 10.0.0-alpha.3 → 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/{v10/commands.d.cts → commands.d.cts} +21 -3
- package/dist/{v10/commands.d.ts → commands.d.ts} +21 -3
- 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 +1 -1
- package/dist/dsl/descriptor.d.ts +1 -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/{v10/http.d.cts → http.d.cts} +16 -7
- package/dist/{v10/http.d.ts → http.d.ts} +16 -7
- 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.map +1 -0
- package/dist/{v10/manifest.es.js → manifest.es.js} +1 -1
- package/dist/manifest.es.js.map +1 -0
- package/dist/problem.cjs +2 -0
- package/dist/problem.cjs.map +1 -0
- package/dist/{v10/problem.d.cts → problem.d.cts} +51 -4
- package/dist/{v10/problem.d.ts → problem.d.ts} +51 -4
- package/dist/{v10/problem.es.js → problem.es.js} +30 -11
- package/dist/problem.es.js.map +1 -0
- package/dist/queries.cjs +2 -0
- package/dist/queries.cjs.map +1 -0
- package/dist/{v10/queries.d.cts → queries.d.cts} +63 -17
- package/dist/{v10/queries.d.ts → queries.d.ts} +63 -17
- 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/{v10/state.d.cts → state.d.cts} +26 -4
- package/dist/{v10/state.d.ts → state.d.ts} +26 -4
- 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.map +1 -0
- package/dist/{v10/wait.es.js → wait.es.js} +1 -1
- package/dist/wait.es.js.map +1 -0
- package/dist/wire.cjs.map +1 -0
- package/dist/{v10/wire.d.cts → wire.d.cts} +32 -7
- package/dist/{v10/wire.d.ts → wire.d.ts} +32 -7
- package/dist/{v10/wire.es.js → wire.es.js} +1 -1
- package/dist/wire.es.js.map +1 -0
- package/package.json +4 -26
- 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/v10/commands.cjs +0 -2
- package/dist/v10/commands.cjs.map +0 -1
- package/dist/v10/commands.es.js +0 -68
- package/dist/v10/commands.es.js.map +0 -1
- package/dist/v10/http.cjs +0 -2
- package/dist/v10/http.cjs.map +0 -1
- package/dist/v10/http.es.js +0 -73
- package/dist/v10/http.es.js.map +0 -1
- package/dist/v10/index.d.cts +0 -19
- package/dist/v10/index.d.ts +0 -19
- package/dist/v10/manifest.cjs.map +0 -1
- package/dist/v10/manifest.es.js.map +0 -1
- package/dist/v10/problem.cjs +0 -2
- package/dist/v10/problem.cjs.map +0 -1
- package/dist/v10/problem.es.js.map +0 -1
- package/dist/v10/queries.cjs +0 -2
- package/dist/v10/queries.cjs.map +0 -1
- package/dist/v10/queries.es.js +0 -88
- package/dist/v10/queries.es.js.map +0 -1
- package/dist/v10/state.cjs +0 -2
- package/dist/v10/state.cjs.map +0 -1
- package/dist/v10/state.es.js +0 -51
- package/dist/v10/state.es.js.map +0 -1
- package/dist/v10/streams.cjs +0 -2
- package/dist/v10/streams.cjs.map +0 -1
- package/dist/v10/streams.d.cts +0 -14
- package/dist/v10/streams.d.ts +0 -14
- package/dist/v10/streams.es.js +0 -22
- package/dist/v10/streams.es.js.map +0 -1
- package/dist/v10/wait.cjs.map +0 -1
- package/dist/v10/wait.es.js.map +0 -1
- package/dist/v10/wire.cjs.map +0 -1
- package/dist/v10/wire.es.js.map +0 -1
- package/dist/v10.cjs +0 -1
- package/dist/v10.es.js +0 -9
- /package/dist/{v10/manifest.cjs → manifest.cjs} +0 -0
- /package/dist/{v10/manifest.d.cts → manifest.d.cts} +0 -0
- /package/dist/{v10/manifest.d.ts → manifest.d.ts} +0 -0
- /package/dist/{v10/wait.cjs → wait.cjs} +0 -0
- /package/dist/{v10/wait.d.cts → wait.d.cts} +0 -0
- /package/dist/{v10/wait.d.ts → wait.d.ts} +0 -0
- /package/dist/{v10/wire.cjs → wire.cjs} +0 -0
package/dist/error/headers.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP headers the Wow server shares across commands and queries.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `WowHeaders` in
|
|
5
|
-
* `wow-rest-contract/src/main/kotlin/me/ahoo/wow/rest/WowHeaders.kt`.
|
|
6
|
-
* These headers carry the `Wow-` prefix, not the `Command-` prefix of
|
|
7
|
-
* {@link CommandHeaders}. Each value is a string literal type, so a header
|
|
8
|
-
* object keyed by it is checked like one keyed by the literal.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* // Send a command into a space
|
|
13
|
-
* await commandClient.send({
|
|
14
|
-
* path: 'owner/{ownerId}/cart/add_cart_item',
|
|
15
|
-
* method: 'POST',
|
|
16
|
-
* headers: { [WowHeaders.SPACE_ID]: 'store-1' },
|
|
17
|
-
* body: { productId: 'p-1', quantity: 1 },
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const WowHeaders: Readonly<{
|
|
22
|
-
/**
|
|
23
|
-
* Prefix of the headers shared across commands and queries
|
|
24
|
-
*/
|
|
25
|
-
readonly WOW_HEADERS_PREFIX: "Wow-";
|
|
26
|
-
/**
|
|
27
|
-
* Space identifier request header.
|
|
28
|
-
*
|
|
29
|
-
* On a command route it sets the command's space; on a query route it adds
|
|
30
|
-
* a space filter. It is routing data, not proof that the caller may use
|
|
31
|
-
* that space. The server ignores a blank value.
|
|
32
|
-
*/
|
|
33
|
-
readonly SPACE_ID: "Wow-Space-Id";
|
|
34
|
-
/**
|
|
35
|
-
* Error code response header, `Ok` when the request succeeded. A failed
|
|
36
|
-
* request carries the `errorCode` of its `ErrorInfo` body here too.
|
|
37
|
-
*/
|
|
38
|
-
readonly ERROR_CODE: "Wow-Error-Code";
|
|
39
|
-
}>;
|
package/dist/error/headers.es.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.es.js","names":["WowHeaders"],"sources":["../../src/error/headers.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\n/**\n * HTTP headers the Wow server shares across commands and queries.\n *\n * Mirrors `WowHeaders` in\n * `wow-rest-contract/src/main/kotlin/me/ahoo/wow/rest/WowHeaders.kt`.\n * These headers carry the `Wow-` prefix, not the `Command-` prefix of\n * {@link CommandHeaders}. Each value is a string literal type, so a header\n * object keyed by it is checked like one keyed by the literal.\n *\n * @example\n * ```typescript\n * // Send a command into a space\n * await commandClient.send({\n * path: 'owner/{ownerId}/cart/add_cart_item',\n * method: 'POST',\n * headers: { [WowHeaders.SPACE_ID]: 'store-1' },\n * body: { productId: 'p-1', quantity: 1 },\n * });\n * ```\n */\nexport const WowHeaders = Object.freeze({\n /**\n * Prefix of the headers shared across commands and queries\n */\n WOW_HEADERS_PREFIX: 'Wow-',\n\n /**\n * Space identifier request header.\n *\n * On a command route it sets the command's space; on a query route it adds\n * a space filter. It is routing data, not proof that the caller may use\n * that space. The server ignores a blank value.\n */\n SPACE_ID: 'Wow-Space-Id',\n\n /**\n * Error code response header, `Ok` when the request succeeded. A failed\n * request carries the `errorCode` of its `ErrorInfo` body here too.\n */\n ERROR_CODE: 'Wow-Error-Code',\n} as const);\n"],"mappings":";AAiCA,IAAaA,IAAa,OAAO,OAAO;CAItC,oBAAoB;CASpB,UAAU;CAMV,YAAY;AACd,CAAU"}
|
package/dist/error/index.d.cts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The one shape a Wow server's error takes in an application: `WowError`,
|
|
3
|
-
* carrying the server's `ErrorInfo` (`errorCode`, `errorMsg`,
|
|
4
|
-
* `bindingErrors`) and the HTTP status.
|
|
5
|
-
*
|
|
6
|
-
* It arrives two ways, which meet in `toWowError`:
|
|
7
|
-
* - a server-sent event stream errors with a `WowError` itself when the
|
|
8
|
-
* server sends an error event midway (the extractors of `transport/`);
|
|
9
|
-
* - any other failed request rejects with the fetcher's `ExchangeError`,
|
|
10
|
-
* because the fetcher validates the status before a result extractor runs;
|
|
11
|
-
* `toWowError(error)` reads the `ErrorInfo` body, or the `Wow-Error-Code`
|
|
12
|
-
* header, from a clone of its response.
|
|
13
|
-
*
|
|
14
|
-
* `toWowError` accepts both, so an application handles every server error
|
|
15
|
-
* after one `await toWowError(error)`. Nothing here imports a fetcher
|
|
16
|
-
* package: `toWowError` reads the fetcher error by its shape.
|
|
17
|
-
*/
|
|
18
|
-
export * from './errorInfo.cjs';
|
|
19
|
-
export * from './queryErrorCodes.cjs';
|
|
20
|
-
export * from './wowError.cjs';
|
|
21
|
-
export * from './headers.cjs';
|
package/dist/error/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The one shape a Wow server's error takes in an application: `WowError`,
|
|
3
|
-
* carrying the server's `ErrorInfo` (`errorCode`, `errorMsg`,
|
|
4
|
-
* `bindingErrors`) and the HTTP status.
|
|
5
|
-
*
|
|
6
|
-
* It arrives two ways, which meet in `toWowError`:
|
|
7
|
-
* - a server-sent event stream errors with a `WowError` itself when the
|
|
8
|
-
* server sends an error event midway (the extractors of `transport/`);
|
|
9
|
-
* - any other failed request rejects with the fetcher's `ExchangeError`,
|
|
10
|
-
* because the fetcher validates the status before a result extractor runs;
|
|
11
|
-
* `toWowError(error)` reads the `ErrorInfo` body, or the `Wow-Error-Code`
|
|
12
|
-
* header, from a clone of its response.
|
|
13
|
-
*
|
|
14
|
-
* `toWowError` accepts both, so an application handles every server error
|
|
15
|
-
* after one `await toWowError(error)`. Nothing here imports a fetcher
|
|
16
|
-
* package: `toWowError` reads the fetcher error by its shape.
|
|
17
|
-
*/
|
|
18
|
-
export * from './errorInfo.js';
|
|
19
|
-
export * from './queryErrorCodes.js';
|
|
20
|
-
export * from './wowError.js';
|
|
21
|
-
export * from './headers.js';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=Object.freeze({INVALID_JSON:`INVALID_JSON`,BODY_NOT_OBJECT:`BODY_NOT_OBJECT`,EMPTY_BODY:`EMPTY_BODY`,UNKNOWN_PROPERTY:`UNKNOWN_PROPERTY`,UNKNOWN_TYPE:`UNKNOWN_TYPE`,UNKNOWN_VALUE:`UNKNOWN_VALUE`,INVALID_VALUE:`INVALID_VALUE`,INVALID_REQUEST:`INVALID_REQUEST`,CURSOR_SORT_DUPLICATE:`CURSOR_SORT_DUPLICATE`,CURSOR_SORT_TOO_MANY:`CURSOR_SORT_TOO_MANY`,INVALID_CURSOR:`INVALID_CURSOR`,SIZE_OUT_OF_RANGE:`SIZE_OUT_OF_RANGE`,FILTER_TOO_LARGE:`FILTER_TOO_LARGE`,EXPENSIVE_OPERATOR_DISABLED:`EXPENSIVE_OPERATOR_DISABLED`,COUNT_REQUIRES_FILTER:`COUNT_REQUIRES_FILTER`,RESIDUAL_GROUPS_EXCEEDED:`RESIDUAL_GROUPS_EXCEEDED`,EXPLICIT_ENTRY_REQUIRED:`EXPLICIT_ENTRY_REQUIRED`,UNKNOWN_FIELD:`UNKNOWN_FIELD`,UNSUPPORTED_CAPABILITY:`UNSUPPORTED_CAPABILITY`,ELEMENT_SCOPE_REQUIRED:`ELEMENT_SCOPE_REQUIRED`,VALUE_MISMATCH:`VALUE_MISMATCH`,NOT_COLLECTION:`NOT_COLLECTION`,NOT_SINGLE_STRING:`NOT_SINGLE_STRING`,MODEL_SEARCH_UNSUPPORTED:`MODEL_SEARCH_UNSUPPORTED`,CURSOR_NOT_ALLOWED:`CURSOR_NOT_ALLOWED`,PROTECTED_AGGREGATION:`PROTECTED_AGGREGATION`,PROTECTED_COMPARISON:`PROTECTED_COMPARISON`,MISSING_KEY_REQUIRES_STRING:`MISSING_KEY_REQUIRES_STRING`,ANY_REQUIRES_SINGLE_VALUE:`ANY_REQUIRES_SINGLE_VALUE`,INCOMPLETE_PROJECTION:`INCOMPLETE_PROJECTION`,METRIC_FILTER_SEARCH:`METRIC_FILTER_SEARCH`,METRIC_FILTER_ELEMENT_MATCH:`METRIC_FILTER_ELEMENT_MATCH`,METRIC_FILTER_ARRAY_FIELD:`METRIC_FILTER_ARRAY_FIELD`,NOT_PROJECTABLE:`NOT_PROJECTABLE`,EVENT_PROJECTION_TYPE_REQUIRED:`EVENT_PROJECTION_TYPE_REQUIRED`,TEMPORAL_REPRESENTATION_REQUIRED:`TEMPORAL_REPRESENTATION_REQUIRED`,TEMPORAL_CONFIGURATION_CONFLICT:`TEMPORAL_CONFIGURATION_CONFLICT`,PARALLEL_ARRAY_SORT:`PARALLEL_ARRAY_SORT`,ARRAY_EQUALITY:`ARRAY_EQUALITY`,FIRST_LAST_REQUIRES_SINGLE_VALUE:`FIRST_LAST_REQUIRES_SINGLE_VALUE`,FIRST_LAST_REQUIRES_ORDER_BY:`FIRST_LAST_REQUIRES_ORDER_BY`,TEMPORAL_AGGREGATION_UNSUPPORTED:`TEMPORAL_AGGREGATION_UNSUPPORTED`,SORT_TOO_MANY:`SORT_TOO_MANY`,SORT_FIELD_DUPLICATE:`SORT_FIELD_DUPLICATE`,IDENTITY_UNDEFINED:`IDENTITY_UNDEFINED`,STORAGE_UNSUPPORTED:`STORAGE_UNSUPPORTED`,PREVIOUS_UNSHIFTABLE:`PREVIOUS_UNSHIFTABLE`});exports.QueryErrorCodes=e;
|
|
2
|
-
//# sourceMappingURL=queryErrorCodes.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryErrorCodes.es.js","names":["QueryErrorCodes"],"sources":["../../src/error/queryErrorCodes.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\n/**\n * The codes a rejected query carries as `BindingError.code`: which rule the\n * request broke, stable where the human text (`errorMsg`) is not.\n *\n * Mirrors `QueryErrorCodes` in\n * `wow-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`, which the\n * server also publishes as the `BindingError.code` enum of its OpenAPI\n * document. The list is open: Wow adds codes and never renames or reuses one,\n * so a client treats a code it does not know as a generic rejection and shows\n * `errorMsg`. {@link QueryErrorCode} admits those codes too.\n *\n * Three groups, which `BindingError.name` locates differently:\n * - decoding the request body (`errorCode` `IllegalArgument`): `name` is the\n * JSON path of the offending value, such as `filter.state` or `metrics[0]`,\n * or `body` for the body as a whole;\n * - the entry's budget and gates (`errorCode` `IllegalArgument`): `name` is\n * the part of the request the rule bounds, such as `limit` or `filter`;\n * - admission against the query model (`errorCode` `QuerySchemaValidation`):\n * `name` is the absolute logical field path, such as `state.items.sku`, or\n * `''` when the rule is about the model rather than one field.\n *\n * Budget and gate rejections carry a code from Wow 9.2 on; an older server\n * answers them with text alone (`HTTP list query limit[...] must be …`). A\n * failure of the server itself is no rejection: it answers HTTP 500\n * `InternalServerError` without a binding error.\n */\nexport const QueryErrorCodes = Object.freeze({\n /** The body is not valid JSON. */\n INVALID_JSON: 'INVALID_JSON',\n /** The body is JSON but not an object. */\n BODY_NOT_OBJECT: 'BODY_NOT_OBJECT',\n /** The body is empty. */\n EMPTY_BODY: 'EMPTY_BODY',\n /** The body has a property the query type does not declare. */\n UNKNOWN_PROPERTY: 'UNKNOWN_PROPERTY',\n /** An `op`, metric or other type discriminator names no known type. */\n UNKNOWN_TYPE: 'UNKNOWN_TYPE',\n /** An enum value is not one the server knows. */\n UNKNOWN_VALUE: 'UNKNOWN_VALUE',\n /** A value is missing or has the wrong JSON type. */\n INVALID_VALUE: 'INVALID_VALUE',\n /** Any other request rule; the message names it. */\n INVALID_REQUEST: 'INVALID_REQUEST',\n /** A cursor sort names a field twice; `path` is the repeated field. */\n CURSOR_SORT_DUPLICATE: 'CURSOR_SORT_DUPLICATE',\n /** A cursor sort has too many fields once the identity tie-breaker is appended. */\n CURSOR_SORT_TOO_MANY: 'CURSOR_SORT_TOO_MANY',\n /**\n * The cursor token was not issued for this model and effective sort, or\n * does not decode; `path` is `cursor`. Start again from the first page.\n */\n INVALID_CURSOR: 'INVALID_CURSOR',\n /**\n * The entry's budget: a list or aggregation `limit`, a page's index, size,\n * window or offset, or a cursor page's `size` is out of range; `path` names\n * which (`limit`, `pagination.size`, `size`, …).\n */\n SIZE_OUT_OF_RANGE: 'SIZE_OUT_OF_RANGE',\n /**\n * The entry's budget: the filter or `having` has too many nodes or values;\n * `path` is `filter` or `having`.\n */\n FILTER_TOO_LARGE: 'FILTER_TOO_LARGE',\n /**\n * The entry does not allow expensive operators, and the query uses one: an\n * operator, an element expansion, a metric sort, an arithmetic or\n * expression group, a date part, a dense fill or FIRST / LAST; `path` names\n * the part (`filter`, `elements`, `sort`, `metrics`, `groupBy`).\n */\n EXPENSIVE_OPERATOR_DISABLED: 'EXPENSIVE_OPERATOR_DISABLED',\n /**\n * A counting query (count, or a paged query's total) would match every\n * record, which the entry refuses; `path` is `filter`.\n */\n COUNT_REQUIRES_FILTER: 'COUNT_REQUIRES_FILTER',\n /**\n * A `having` or metric sort the storage evaluates after grouping read more\n * groups than the server allows; `path` is `body`. It may end a stream\n * partway through.\n */\n RESIDUAL_GROUPS_EXCEEDED: 'RESIDUAL_GROUPS_EXCEEDED',\n /**\n * An in-process query named no entry where one is required. Never\n * answered over HTTP; listed so the mirror stays complete.\n */\n EXPLICIT_ENTRY_REQUIRED: 'EXPLICIT_ENTRY_REQUIRED',\n /** The model has no such logical field. */\n UNKNOWN_FIELD: 'UNKNOWN_FIELD',\n /** The field does not offer the capability the query uses (sort, range, …). */\n UNSUPPORTED_CAPABILITY: 'UNSUPPORTED_CAPABILITY',\n /** The field is an element field and must be queried inside its element scope. */\n ELEMENT_SCOPE_REQUIRED: 'ELEMENT_SCOPE_REQUIRED',\n /** A filter value falls outside the field's declared domain. */\n VALUE_MISMATCH: 'VALUE_MISMATCH',\n /** The field is not a known collection (for example under `isEmpty`). */\n NOT_COLLECTION: 'NOT_COLLECTION',\n /** The field is not a single string. */\n NOT_SINGLE_STRING: 'NOT_SINGLE_STRING',\n /** The model does not support search. */\n MODEL_SEARCH_UNSUPPORTED: 'MODEL_SEARCH_UNSUPPORTED',\n /** The field cannot be used for a cursor. */\n CURSOR_NOT_ALLOWED: 'CURSOR_NOT_ALLOWED',\n /** The field is protected and cannot be aggregated. */\n PROTECTED_AGGREGATION: 'PROTECTED_AGGREGATION',\n /**\n * The field is protected and cannot be filtered or sorted: its descriptor\n * says `sensitivity.comparable: false`. A search that names it is refused\n * the same way.\n */\n PROTECTED_COMPARISON: 'PROTECTED_COMPARISON',\n /** A terms group's `missingKey` needs a single-valued string field. */\n MISSING_KEY_REQUIRES_STRING: 'MISSING_KEY_REQUIRES_STRING',\n /** `ANY` needs a single value. */\n ANY_REQUIRES_SINGLE_VALUE: 'ANY_REQUIRES_SINGLE_VALUE',\n /** The storage cannot deliver a complete projection; select fields explicitly. */\n INCOMPLETE_PROJECTION: 'INCOMPLETE_PROJECTION',\n /** A metric filter uses a search filter. */\n METRIC_FILTER_SEARCH: 'METRIC_FILTER_SEARCH',\n /** A metric filter uses `ELEMENT_MATCH`. */\n METRIC_FILTER_ELEMENT_MATCH: 'METRIC_FILTER_ELEMENT_MATCH',\n /** A metric filter names an array field; it must be scalar. */\n METRIC_FILTER_ARRAY_FIELD: 'METRIC_FILTER_ARRAY_FIELD',\n /** The field cannot be projected. */\n NOT_PROJECTABLE: 'NOT_PROJECTABLE',\n /** An event projection that keeps payloads must keep their `bodyType`. */\n EVENT_PROJECTION_TYPE_REQUIRED: 'EVENT_PROJECTION_TYPE_REQUIRED',\n /** A relative-time filter needs a field with a known temporal representation. */\n TEMPORAL_REPRESENTATION_REQUIRED: 'TEMPORAL_REPRESENTATION_REQUIRED',\n /** A relative-time filter's zone, pattern or unit conflicts with the field's definition. */\n TEMPORAL_CONFIGURATION_CONFLICT: 'TEMPORAL_CONFIGURATION_CONFLICT',\n /**\n * A sort names two array fields on independent arrays, which the storage\n * cannot order by together; `path` is the second of them. The descriptor\n * lists such fields under a `PARALLEL_ARRAY_SORT` constraint.\n */\n PARALLEL_ARRAY_SORT: 'PARALLEL_ARRAY_SORT',\n /**\n * An `EQ` or `NE` compares the field to an array, which the storage cannot\n * do: it takes only a scalar operand. The descriptor says so with an\n * `ARRAY_EQUALITY` constraint.\n */\n ARRAY_EQUALITY: 'ARRAY_EQUALITY',\n /**\n * A `FIRST` or `LAST` metric names a field that may hold several values;\n * it needs a single-valued one (`aggregate.firstLast` in the descriptor).\n */\n FIRST_LAST_REQUIRES_SINGLE_VALUE: 'FIRST_LAST_REQUIRES_SINGLE_VALUE',\n /**\n * A `FIRST` or `LAST` metric names no `orderBy` where there is no event\n * time to order by, such as inside an element or on a model whose\n * descriptor has no `analysis.firstLastOrderBy`; `path` is its field.\n */\n FIRST_LAST_REQUIRES_ORDER_BY: 'FIRST_LAST_REQUIRES_ORDER_BY',\n /**\n * A date group or date difference names a field that stores neither a\n * date nor an epoch (a formatted string, say), so it cannot be aggregated\n * by time.\n */\n TEMPORAL_AGGREGATION_UNSUPPORTED: 'TEMPORAL_AGGREGATION_UNSUPPORTED',\n /** The sort has more fields than the protocol allows; `path` is `''`. */\n SORT_TOO_MANY: 'SORT_TOO_MANY',\n /** Two sort fields name the same stored field; `path` is the second. */\n SORT_FIELD_DUPLICATE: 'SORT_FIELD_DUPLICATE',\n /**\n * An identity filter or a cursor on a model that defines no record\n * identity; `path` is `''`.\n */\n IDENTITY_UNDEFINED: 'IDENTITY_UNDEFINED',\n /**\n * The storage does not support the feature the query uses, or its native\n * query language cannot express it (a MongoDB PHRASE search with a quote,\n * say); `path` is the field, or `''`.\n */\n STORAGE_UNSUPPORTED: 'STORAGE_UNSUPPORTED',\n /**\n * A `PREVIOUS` window steps along a date group whose field the filter\n * conditions where its range cannot be shifted to the earlier period:\n * outside the top-level `AND`, or with a value that is not an instant;\n * `path` is the field.\n */\n PREVIOUS_UNSHIFTABLE: 'PREVIOUS_UNSHIFTABLE',\n} as const);\n\n/** One of the codes this package knows; see {@link QueryErrorCodes}. */\nexport type KnownQueryErrorCode =\n (typeof QueryErrorCodes)[keyof typeof QueryErrorCodes];\n\n/**\n * The code of a rejected query: one this package knows, which editors\n * complete, or one a newer server added.\n */\nexport type QueryErrorCode = KnownQueryErrorCode | (string & {});\n\n/**\n * Why the server rejected a request, read from its first binding error that\n * carries a code: which rule failed, where, and the server's words.\n */\nexport interface QueryViolation {\n /** Which rule failed; switch on it against {@link QueryErrorCodes}. */\n code: QueryErrorCode;\n /**\n * Where: the JSON path of the offending value for a decoding error\n * (`filter.state`, `metrics[0]`, `body`), the absolute logical field path\n * for an admission error (`state.items.sku`), or `''` when the rule is about\n * the model rather than a field.\n */\n path: string;\n /** The server's words, the same as the error's `errorMsg`. */\n message: string;\n}\n"],"mappings":";AAuCA,IAAaA,IAAkB,OAAO,OAAO;CAE3C,cAAc;CAEd,iBAAiB;CAEjB,YAAY;CAEZ,kBAAkB;CAElB,cAAc;CAEd,eAAe;CAEf,eAAe;CAEf,iBAAiB;CAEjB,uBAAuB;CAEvB,sBAAsB;CAKtB,gBAAgB;CAMhB,mBAAmB;CAKnB,kBAAkB;CAOlB,6BAA6B;CAK7B,uBAAuB;CAMvB,0BAA0B;CAK1B,yBAAyB;CAEzB,eAAe;CAEf,wBAAwB;CAExB,wBAAwB;CAExB,gBAAgB;CAEhB,gBAAgB;CAEhB,mBAAmB;CAEnB,0BAA0B;CAE1B,oBAAoB;CAEpB,uBAAuB;CAMvB,sBAAsB;CAEtB,6BAA6B;CAE7B,2BAA2B;CAE3B,uBAAuB;CAEvB,sBAAsB;CAEtB,6BAA6B;CAE7B,2BAA2B;CAE3B,iBAAiB;CAEjB,gCAAgC;CAEhC,kCAAkC;CAElC,iCAAiC;CAMjC,qBAAqB;CAMrB,gBAAgB;CAKhB,kCAAkC;CAMlC,8BAA8B;CAM9B,kCAAkC;CAElC,eAAe;CAEf,sBAAsB;CAKtB,oBAAoB;CAMpB,qBAAqB;CAOrB,sBAAsB;AACxB,CAAU"}
|
package/dist/error/wowError.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./errorInfo.cjs"),t=require("./headers.cjs");var n=/\blist query limit\[0\] must be between /;function r({errorCode:t,errorMsg:r,bindingErrors:i}){return(t===e.ErrorCodes.ILLEGAL_ARGUMENT||(i??[]).some(e=>e?.code===`SIZE_OUT_OF_RANGE`))&&r!==void 0&&n.test(r)?` The query has no limit: omitting it needs Wow 9.1.5 or later, so pass one, for example listQuery({ limit: 100 }).`:``}var i=class extends Error{constructor(e,t={}){super((e.errorMsg?`[${e.errorCode}] ${e.errorMsg}`:e.errorCode)+r(e)),this.name=`WowError`,t.cause!==void 0&&(this.cause=t.cause),this.errorCode=e.errorCode,this.errorMsg=e.errorMsg??``,this.bindingErrors=e.bindingErrors??[],t.status!==void 0&&(this.status=t.status);for(let{name:e,msg:t,code:n}of this.bindingErrors)if(typeof n==`string`){this.violation={code:n,path:e??``,message:t??this.errorMsg};break}}};function a(e){if(typeof e!=`object`||!e)return!1;let{errorCode:t,errorMsg:n}=e;return typeof t==`string`&&(n===void 0||typeof n==`string`)}async function o(e){let n=e.headers.get(t.WowHeaders.ERROR_CODE),r;try{r=await e.clone().json()}catch{}if(a(r))return r;if(n)return{errorCode:n,errorMsg:e.statusText}}async function s(e){if(e instanceof i)return e;if(typeof e!=`object`||!e)return;let{exchange:t,cause:n}=e;if(n instanceof i)return n;let r=t?.response;if(!r||r.ok)return;let a=await o(r);return a?new i(a,{status:r.status,cause:e}):void 0}exports.WowError=i,exports.isErrorInfo=a,exports.toWowError=s;
|
|
2
|
-
//# sourceMappingURL=wowError.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wowError.cjs","names":["ErrorCodes","WowHeaders","require_errorInfo","require_headers","MISSING_LIST_LIMIT","hintFor","errorCode","bindingErrors","error","errorMsg","WowError","errorInfo","options","code","name","msg","isErrorInfo","value","readErrorInfo","header","response","body","toWowError","cause","exchange"],"sources":["../../src/error/wowError.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 ErrorCodes,\n type BindingError,\n type ErrorCode,\n type ErrorInfo,\n} from './errorInfo.js';\nimport { WowHeaders } from './headers.js';\nimport type { QueryViolation } from './queryErrorCodes.js';\n\n/** Where a {@link WowError} came from, besides its `ErrorInfo`. */\nexport interface WowErrorOptions {\n /** The HTTP status of the response that carried the error, if any. */\n status?: number;\n /** The error this one explains: the fetcher's, or the stream's. */\n cause?: unknown;\n}\n\n/**\n * Wow 8.11 to 9.1.3 answer a list query without a `limit` with this message;\n * 9.1.5 applies its default list size instead.\n */\nconst MISSING_LIST_LIMIT = /\\blist query limit\\[0\\] must be between /;\n\n/**\n * What to do about an error whose cause the client knows, appended to the\n * message only: `errorMsg` stays the server's own words.\n */\nfunction hintFor({ errorCode, errorMsg, bindingErrors }: ErrorInfo): string {\n // An older server says it with `IllegalArgument` alone; one that codes its\n // budget rejections (Wow 9.2) says `SIZE_OUT_OF_RANGE` too. The words are\n // what tell a missing limit from a limit out of range.\n const outOfRange =\n errorCode === ErrorCodes.ILLEGAL_ARGUMENT ||\n (bindingErrors ?? []).some(\n // `QueryErrorCodes.SIZE_OUT_OF_RANGE`, spelled out to keep this module\n // free of the catalogue.\n error => error?.code === 'SIZE_OUT_OF_RANGE',\n );\n if (\n outOfRange &&\n errorMsg !== undefined &&\n MISSING_LIST_LIMIT.test(errorMsg)\n ) {\n return (\n ' The query has no limit: omitting it needs Wow 9.1.5 or later, so ' +\n 'pass one, for example listQuery({ limit: 100 }).'\n );\n }\n return '';\n}\n\n/**\n * An error the Wow server answered with.\n *\n * Its `message` is `[errorCode] errorMsg`. When the client knows what causes\n * an error it adds what to do to the message, never to `errorMsg`: a list\n * query without a `limit`, which Wow 8.11 to 9.1.3 refuse with\n * `IllegalArgument`, says to pass one.\n *\n * It carries the server's `ErrorInfo` — `errorCode`, `errorMsg`,\n * `bindingErrors` — and, when a response carried it, the HTTP status. Switch\n * on `errorCode` against {@link ErrorCodes}; a rejected query also says which\n * rule it broke and where as {@link WowError.violation}.\n *\n * Two paths produce one:\n * - a server-sent event stream of this package (query streams and\n * `sendAndWaitStream`) errors with a `WowError` when the server sends an\n * error event in the middle of it; a `for await` over the stream throws it;\n * - {@link toWowError} turns what a failed request threw into one.\n *\n * @example\n * ```typescript\n * async function findState(id: string) {\n * try {\n * return await snapshotClient.getStateById(id);\n * } catch (error) {\n * const wowError = await toWowError(error);\n * if (wowError?.errorCode === ErrorCodes.NOT_FOUND) return undefined;\n * throw wowError ?? error;\n * }\n * }\n * ```\n */\nexport class WowError extends Error implements ErrorInfo {\n override readonly name = 'WowError';\n readonly errorCode: ErrorCode;\n readonly errorMsg: string;\n readonly bindingErrors: BindingError[];\n /** The HTTP status of the response that carried the error, if any. */\n readonly status?: number;\n /** The error this one explains: the fetcher's, or the stream's. */\n readonly cause?: unknown;\n /**\n * Which rule a rejected request broke, and where, read from the first of\n * `bindingErrors` that carries a `code`; `undefined` when none does.\n *\n * Wow answers a query it rejects while decoding (`IllegalArgument`) or\n * admitting it against the query model (`QuerySchemaValidation`) with one\n * such binding error, whose message is `errorMsg`. Switch on its `code`\n * against {@link QueryErrorCodes}, and fall back to `errorMsg` for a code\n * this package does not know: the list only grows. From Wow 9.2 the\n * entry's budget and gates say their rule too (`SIZE_OUT_OF_RANGE`,\n * `EXPENSIVE_OPERATOR_DISABLED`, …); an older server answers them with\n * text alone (`HTTP list query limit[...]`). A command's validation error\n * carries no code, and neither does a failure of the server itself (HTTP\n * 500 `InternalServerError`).\n *\n * @example\n * ```typescript\n * async function fieldInError(error: unknown): Promise<string | undefined> {\n * const violation = (await toWowError(error))?.violation;\n * if (violation?.code === QueryErrorCodes.UNKNOWN_FIELD) {\n * return violation.path; // e.g. 'state.items.sku'\n * }\n * return undefined;\n * }\n * ```\n */\n readonly violation?: QueryViolation;\n\n constructor(errorInfo: ErrorInfo, options: WowErrorOptions = {}) {\n super(\n (errorInfo.errorMsg\n ? `[${errorInfo.errorCode}] ${errorInfo.errorMsg}`\n : errorInfo.errorCode) + hintFor(errorInfo),\n );\n if (options.cause !== undefined) this.cause = options.cause;\n this.errorCode = errorInfo.errorCode;\n this.errorMsg = errorInfo.errorMsg ?? '';\n this.bindingErrors = errorInfo.bindingErrors ?? [];\n if (options.status !== undefined) this.status = options.status;\n for (const { name, msg, code } of this.bindingErrors) {\n if (typeof code !== 'string') continue;\n this.violation = {\n code,\n path: name ?? '',\n message: msg ?? this.errorMsg,\n };\n break;\n }\n }\n}\n\n/**\n * Whether a value has the shape of the server's `ErrorInfo`: an object with a\n * string `errorCode`, and `errorMsg` a string when present.\n */\nexport function isErrorInfo(value: unknown): value is ErrorInfo {\n if (typeof value !== 'object' || value === null) return false;\n const { errorCode, errorMsg } = value as Partial<Record<string, unknown>>;\n return (\n typeof errorCode === 'string' &&\n (errorMsg === undefined || typeof errorMsg === 'string')\n );\n}\n\n/** The part of a fetcher error this module reads, without importing fetcher. */\ninterface ExchangeLike {\n exchange?: { response?: Response };\n cause?: unknown;\n}\n\nasync function readErrorInfo(\n response: Response,\n): Promise<ErrorInfo | undefined> {\n const header = response.headers.get(WowHeaders.ERROR_CODE);\n let body: unknown;\n try {\n body = await response.clone().json();\n } catch {\n // Not JSON, or already read: the header is all there is.\n }\n if (isErrorInfo(body)) return body;\n if (header) return { errorCode: header, errorMsg: response.statusText };\n return undefined;\n}\n\n/**\n * Turns what a failed request threw into a {@link WowError}, or `undefined`\n * when it is not an error the Wow server answered with (a network failure, a\n * timeout, an abort, a proxy's own error page).\n *\n * It reads, in order: a `WowError` itself or as the `cause`; otherwise the\n * failed response of a fetcher error (`ExchangeError`,\n * `HttpStatusValidationError`), whose body is the server's `ErrorInfo`, or\n * failing that its `Wow-Error-Code` header. The response is cloned, so its\n * body stays readable.\n *\n * It is asynchronous because the error body has to be read; a thrown fetcher\n * error has not read it.\n */\nexport async function toWowError(\n error: unknown,\n): Promise<WowError | undefined> {\n if (error instanceof WowError) return error;\n if (typeof error !== 'object' || error === null) return undefined;\n const { exchange, cause } = error as ExchangeLike;\n if (cause instanceof WowError) return cause;\n const response = exchange?.response;\n if (!response || response.ok) return undefined;\n const errorInfo = await readErrorInfo(response);\n return errorInfo\n ? new WowError(errorInfo, { status: response.status, cause: error })\n : undefined;\n}\n"],"mappings":"8DAkCA,IAAMI,EAAqB,2CAM3B,SAASC,EAAQ,CAAE,YAAW,WAAU,iBAAoC,CAqB1E,OAhBEC,IAAcN,EAAAA,WAAW,mBACxBO,GAAiB,CAAC,EAAA,CAAG,KAGpB,GAASC,GAAO,OAAS,mBAC3B,IAGAC,IAAa,IAAA,IACbL,EAAmB,KAAKK,CAAQ,EAG9B,qHAIG,EACT,CAkCA,IAAaC,EAAb,cAA8B,KAA2B,CAqCvD,YAAY,EAAsB,EAA2B,CAAC,EAAG,CAC/D,OACGC,EAAU,SACP,IAAIA,EAAU,UAAU,IAAIA,EAAU,WACtCA,EAAU,WAAaN,EAAQM,CAAS,CAC9C,EAzCuB,KAAA,KAAA,WA0CnBC,EAAQ,QAAU,IAAA,KAAW,KAAK,MAAQA,EAAQ,OACtD,KAAK,UAAYD,EAAU,UAC3B,KAAK,SAAWA,EAAU,UAAY,GACtC,KAAK,cAAgBA,EAAU,eAAiB,CAAC,EAC7CC,EAAQ,SAAW,IAAA,KAAW,KAAK,OAASA,EAAQ,QACxD,IAAK,GAAM,CAAE,OAAM,MAAK,UAAU,KAAK,cACrC,GAAI,OAAOC,GAAS,SACpB,MAAK,UAAY,CACf,OACA,KAAMC,GAAQ,GACd,QAASC,GAAO,KAAK,QACvB,EACA,KADA,CAGJ,CACF,EAMA,SAAgBC,EAAY,EAAoC,CAC9D,GAAI,OAAOC,GAAU,WAAYA,EAAgB,MAAO,GACxD,GAAM,CAAE,YAAW,YAAaA,EAChC,OACE,OAAOX,GAAc,WACpBG,IAAa,IAAA,IAAa,OAAOA,GAAa,SAEnD,CAQA,eAAeS,EACb,EACgC,CAChC,IAAMC,EAASC,EAAS,QAAQ,IAAInB,EAAAA,WAAW,UAAU,EACrDoB,EACJ,GAAI,CACF,EAAO,MAAMD,EAAS,MAAM,CAAC,CAAC,KAAK,CACrC,MAAQ,CAER,CACA,GAAIJ,EAAYK,CAAI,EAAG,OAAOA,EAC9B,GAAIF,EAAQ,MAAO,CAAE,UAAWA,EAAQ,SAAUC,EAAS,UAAW,CAExE,CAgBA,eAAsBE,EACpB,EAC+B,CAC/B,GAAId,aAAiBE,EAAU,OAAOF,EACtC,GAAI,OAAOA,GAAU,WAAYA,EAAgB,OACjD,GAAM,CAAE,WAAU,SAAUA,EAC5B,GAAIe,aAAiBb,EAAU,OAAOa,EACtC,IAAMH,EAAWI,GAAU,SAC3B,GAAI,CAACJ,GAAYA,EAAS,GAAI,OAC9B,IAAMT,EAAY,MAAMO,EAAcE,CAAQ,EAC9C,OAAOT,EACH,IAAID,EAASC,EAAW,CAAE,OAAQS,EAAS,OAAQ,MAAOZ,CAAM,CAAC,EACjE,IAAA,EACN"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { BindingError, ErrorCode, ErrorInfo } from './errorInfo.cjs';
|
|
2
|
-
import { QueryViolation } from './queryErrorCodes.cjs';
|
|
3
|
-
/** Where a {@link WowError} came from, besides its `ErrorInfo`. */
|
|
4
|
-
export interface WowErrorOptions {
|
|
5
|
-
/** The HTTP status of the response that carried the error, if any. */
|
|
6
|
-
status?: number;
|
|
7
|
-
/** The error this one explains: the fetcher's, or the stream's. */
|
|
8
|
-
cause?: unknown;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* An error the Wow server answered with.
|
|
12
|
-
*
|
|
13
|
-
* Its `message` is `[errorCode] errorMsg`. When the client knows what causes
|
|
14
|
-
* an error it adds what to do to the message, never to `errorMsg`: a list
|
|
15
|
-
* query without a `limit`, which Wow 8.11 to 9.1.3 refuse with
|
|
16
|
-
* `IllegalArgument`, says to pass one.
|
|
17
|
-
*
|
|
18
|
-
* It carries the server's `ErrorInfo` — `errorCode`, `errorMsg`,
|
|
19
|
-
* `bindingErrors` — and, when a response carried it, the HTTP status. Switch
|
|
20
|
-
* on `errorCode` against {@link ErrorCodes}; a rejected query also says which
|
|
21
|
-
* rule it broke and where as {@link WowError.violation}.
|
|
22
|
-
*
|
|
23
|
-
* Two paths produce one:
|
|
24
|
-
* - a server-sent event stream of this package (query streams and
|
|
25
|
-
* `sendAndWaitStream`) errors with a `WowError` when the server sends an
|
|
26
|
-
* error event in the middle of it; a `for await` over the stream throws it;
|
|
27
|
-
* - {@link toWowError} turns what a failed request threw into one.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* async function findState(id: string) {
|
|
32
|
-
* try {
|
|
33
|
-
* return await snapshotClient.getStateById(id);
|
|
34
|
-
* } catch (error) {
|
|
35
|
-
* const wowError = await toWowError(error);
|
|
36
|
-
* if (wowError?.errorCode === ErrorCodes.NOT_FOUND) return undefined;
|
|
37
|
-
* throw wowError ?? error;
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare class WowError extends Error implements ErrorInfo {
|
|
43
|
-
readonly name = "WowError";
|
|
44
|
-
readonly errorCode: ErrorCode;
|
|
45
|
-
readonly errorMsg: string;
|
|
46
|
-
readonly bindingErrors: BindingError[];
|
|
47
|
-
/** The HTTP status of the response that carried the error, if any. */
|
|
48
|
-
readonly status?: number;
|
|
49
|
-
/** The error this one explains: the fetcher's, or the stream's. */
|
|
50
|
-
readonly cause?: unknown;
|
|
51
|
-
/**
|
|
52
|
-
* Which rule a rejected request broke, and where, read from the first of
|
|
53
|
-
* `bindingErrors` that carries a `code`; `undefined` when none does.
|
|
54
|
-
*
|
|
55
|
-
* Wow answers a query it rejects while decoding (`IllegalArgument`) or
|
|
56
|
-
* admitting it against the query model (`QuerySchemaValidation`) with one
|
|
57
|
-
* such binding error, whose message is `errorMsg`. Switch on its `code`
|
|
58
|
-
* against {@link QueryErrorCodes}, and fall back to `errorMsg` for a code
|
|
59
|
-
* this package does not know: the list only grows. From Wow 9.2 the
|
|
60
|
-
* entry's budget and gates say their rule too (`SIZE_OUT_OF_RANGE`,
|
|
61
|
-
* `EXPENSIVE_OPERATOR_DISABLED`, …); an older server answers them with
|
|
62
|
-
* text alone (`HTTP list query limit[...]`). A command's validation error
|
|
63
|
-
* carries no code, and neither does a failure of the server itself (HTTP
|
|
64
|
-
* 500 `InternalServerError`).
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* async function fieldInError(error: unknown): Promise<string | undefined> {
|
|
69
|
-
* const violation = (await toWowError(error))?.violation;
|
|
70
|
-
* if (violation?.code === QueryErrorCodes.UNKNOWN_FIELD) {
|
|
71
|
-
* return violation.path; // e.g. 'state.items.sku'
|
|
72
|
-
* }
|
|
73
|
-
* return undefined;
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
readonly violation?: QueryViolation;
|
|
78
|
-
constructor(errorInfo: ErrorInfo, options?: WowErrorOptions);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Whether a value has the shape of the server's `ErrorInfo`: an object with a
|
|
82
|
-
* string `errorCode`, and `errorMsg` a string when present.
|
|
83
|
-
*/
|
|
84
|
-
export declare function isErrorInfo(value: unknown): value is ErrorInfo;
|
|
85
|
-
/**
|
|
86
|
-
* Turns what a failed request threw into a {@link WowError}, or `undefined`
|
|
87
|
-
* when it is not an error the Wow server answered with (a network failure, a
|
|
88
|
-
* timeout, an abort, a proxy's own error page).
|
|
89
|
-
*
|
|
90
|
-
* It reads, in order: a `WowError` itself or as the `cause`; otherwise the
|
|
91
|
-
* failed response of a fetcher error (`ExchangeError`,
|
|
92
|
-
* `HttpStatusValidationError`), whose body is the server's `ErrorInfo`, or
|
|
93
|
-
* failing that its `Wow-Error-Code` header. The response is cloned, so its
|
|
94
|
-
* body stays readable.
|
|
95
|
-
*
|
|
96
|
-
* It is asynchronous because the error body has to be read; a thrown fetcher
|
|
97
|
-
* error has not read it.
|
|
98
|
-
*/
|
|
99
|
-
export declare function toWowError(error: unknown): Promise<WowError | undefined>;
|
package/dist/error/wowError.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { BindingError, ErrorCode, ErrorInfo } from './errorInfo.js';
|
|
2
|
-
import { QueryViolation } from './queryErrorCodes.js';
|
|
3
|
-
/** Where a {@link WowError} came from, besides its `ErrorInfo`. */
|
|
4
|
-
export interface WowErrorOptions {
|
|
5
|
-
/** The HTTP status of the response that carried the error, if any. */
|
|
6
|
-
status?: number;
|
|
7
|
-
/** The error this one explains: the fetcher's, or the stream's. */
|
|
8
|
-
cause?: unknown;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* An error the Wow server answered with.
|
|
12
|
-
*
|
|
13
|
-
* Its `message` is `[errorCode] errorMsg`. When the client knows what causes
|
|
14
|
-
* an error it adds what to do to the message, never to `errorMsg`: a list
|
|
15
|
-
* query without a `limit`, which Wow 8.11 to 9.1.3 refuse with
|
|
16
|
-
* `IllegalArgument`, says to pass one.
|
|
17
|
-
*
|
|
18
|
-
* It carries the server's `ErrorInfo` — `errorCode`, `errorMsg`,
|
|
19
|
-
* `bindingErrors` — and, when a response carried it, the HTTP status. Switch
|
|
20
|
-
* on `errorCode` against {@link ErrorCodes}; a rejected query also says which
|
|
21
|
-
* rule it broke and where as {@link WowError.violation}.
|
|
22
|
-
*
|
|
23
|
-
* Two paths produce one:
|
|
24
|
-
* - a server-sent event stream of this package (query streams and
|
|
25
|
-
* `sendAndWaitStream`) errors with a `WowError` when the server sends an
|
|
26
|
-
* error event in the middle of it; a `for await` over the stream throws it;
|
|
27
|
-
* - {@link toWowError} turns what a failed request threw into one.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* async function findState(id: string) {
|
|
32
|
-
* try {
|
|
33
|
-
* return await snapshotClient.getStateById(id);
|
|
34
|
-
* } catch (error) {
|
|
35
|
-
* const wowError = await toWowError(error);
|
|
36
|
-
* if (wowError?.errorCode === ErrorCodes.NOT_FOUND) return undefined;
|
|
37
|
-
* throw wowError ?? error;
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare class WowError extends Error implements ErrorInfo {
|
|
43
|
-
readonly name = "WowError";
|
|
44
|
-
readonly errorCode: ErrorCode;
|
|
45
|
-
readonly errorMsg: string;
|
|
46
|
-
readonly bindingErrors: BindingError[];
|
|
47
|
-
/** The HTTP status of the response that carried the error, if any. */
|
|
48
|
-
readonly status?: number;
|
|
49
|
-
/** The error this one explains: the fetcher's, or the stream's. */
|
|
50
|
-
readonly cause?: unknown;
|
|
51
|
-
/**
|
|
52
|
-
* Which rule a rejected request broke, and where, read from the first of
|
|
53
|
-
* `bindingErrors` that carries a `code`; `undefined` when none does.
|
|
54
|
-
*
|
|
55
|
-
* Wow answers a query it rejects while decoding (`IllegalArgument`) or
|
|
56
|
-
* admitting it against the query model (`QuerySchemaValidation`) with one
|
|
57
|
-
* such binding error, whose message is `errorMsg`. Switch on its `code`
|
|
58
|
-
* against {@link QueryErrorCodes}, and fall back to `errorMsg` for a code
|
|
59
|
-
* this package does not know: the list only grows. From Wow 9.2 the
|
|
60
|
-
* entry's budget and gates say their rule too (`SIZE_OUT_OF_RANGE`,
|
|
61
|
-
* `EXPENSIVE_OPERATOR_DISABLED`, …); an older server answers them with
|
|
62
|
-
* text alone (`HTTP list query limit[...]`). A command's validation error
|
|
63
|
-
* carries no code, and neither does a failure of the server itself (HTTP
|
|
64
|
-
* 500 `InternalServerError`).
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* async function fieldInError(error: unknown): Promise<string | undefined> {
|
|
69
|
-
* const violation = (await toWowError(error))?.violation;
|
|
70
|
-
* if (violation?.code === QueryErrorCodes.UNKNOWN_FIELD) {
|
|
71
|
-
* return violation.path; // e.g. 'state.items.sku'
|
|
72
|
-
* }
|
|
73
|
-
* return undefined;
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
readonly violation?: QueryViolation;
|
|
78
|
-
constructor(errorInfo: ErrorInfo, options?: WowErrorOptions);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Whether a value has the shape of the server's `ErrorInfo`: an object with a
|
|
82
|
-
* string `errorCode`, and `errorMsg` a string when present.
|
|
83
|
-
*/
|
|
84
|
-
export declare function isErrorInfo(value: unknown): value is ErrorInfo;
|
|
85
|
-
/**
|
|
86
|
-
* Turns what a failed request threw into a {@link WowError}, or `undefined`
|
|
87
|
-
* when it is not an error the Wow server answered with (a network failure, a
|
|
88
|
-
* timeout, an abort, a proxy's own error page).
|
|
89
|
-
*
|
|
90
|
-
* It reads, in order: a `WowError` itself or as the `cause`; otherwise the
|
|
91
|
-
* failed response of a fetcher error (`ExchangeError`,
|
|
92
|
-
* `HttpStatusValidationError`), whose body is the server's `ErrorInfo`, or
|
|
93
|
-
* failing that its `Wow-Error-Code` header. The response is cloned, so its
|
|
94
|
-
* body stays readable.
|
|
95
|
-
*
|
|
96
|
-
* It is asynchronous because the error body has to be read; a thrown fetcher
|
|
97
|
-
* error has not read it.
|
|
98
|
-
*/
|
|
99
|
-
export declare function toWowError(error: unknown): Promise<WowError | undefined>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ErrorCodes as e } from "./errorInfo.es.js";
|
|
2
|
-
import { WowHeaders as t } from "./headers.es.js";
|
|
3
|
-
//#region src/error/wowError.ts
|
|
4
|
-
var n = /\blist query limit\[0\] must be between /;
|
|
5
|
-
function r({ errorCode: t, errorMsg: r, bindingErrors: i }) {
|
|
6
|
-
return (t === e.ILLEGAL_ARGUMENT || (i ?? []).some((e) => e?.code === "SIZE_OUT_OF_RANGE")) && r !== void 0 && n.test(r) ? " The query has no limit: omitting it needs Wow 9.1.5 or later, so pass one, for example listQuery({ limit: 100 })." : "";
|
|
7
|
-
}
|
|
8
|
-
var i = class extends Error {
|
|
9
|
-
constructor(e, t = {}) {
|
|
10
|
-
super((e.errorMsg ? `[${e.errorCode}] ${e.errorMsg}` : e.errorCode) + r(e)), this.name = "WowError", t.cause !== void 0 && (this.cause = t.cause), this.errorCode = e.errorCode, this.errorMsg = e.errorMsg ?? "", this.bindingErrors = e.bindingErrors ?? [], t.status !== void 0 && (this.status = t.status);
|
|
11
|
-
for (let { name: e, msg: t, code: n } of this.bindingErrors) if (typeof n == "string") {
|
|
12
|
-
this.violation = {
|
|
13
|
-
code: n,
|
|
14
|
-
path: e ?? "",
|
|
15
|
-
message: t ?? this.errorMsg
|
|
16
|
-
};
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
function a(e) {
|
|
22
|
-
if (typeof e != "object" || !e) return !1;
|
|
23
|
-
let { errorCode: t, errorMsg: n } = e;
|
|
24
|
-
return typeof t == "string" && (n === void 0 || typeof n == "string");
|
|
25
|
-
}
|
|
26
|
-
async function o(e) {
|
|
27
|
-
let n = e.headers.get(t.ERROR_CODE), r;
|
|
28
|
-
try {
|
|
29
|
-
r = await e.clone().json();
|
|
30
|
-
} catch {}
|
|
31
|
-
if (a(r)) return r;
|
|
32
|
-
if (n) return {
|
|
33
|
-
errorCode: n,
|
|
34
|
-
errorMsg: e.statusText
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
async function s(e) {
|
|
38
|
-
if (e instanceof i) return e;
|
|
39
|
-
if (typeof e != "object" || !e) return;
|
|
40
|
-
let { exchange: t, cause: n } = e;
|
|
41
|
-
if (n instanceof i) return n;
|
|
42
|
-
let r = t?.response;
|
|
43
|
-
if (!r || r.ok) return;
|
|
44
|
-
let a = await o(r);
|
|
45
|
-
return a ? new i(a, {
|
|
46
|
-
status: r.status,
|
|
47
|
-
cause: e
|
|
48
|
-
}) : void 0;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
export { i as WowError, a as isErrorInfo, s as toWowError };
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=wowError.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wowError.es.js","names":["MISSING_LIST_LIMIT","hintFor","errorCode","ErrorCodes","bindingErrors","error","errorMsg","WowError","errorInfo","options","code","name","msg","isErrorInfo","value","readErrorInfo","header","response","WowHeaders","body","toWowError","cause","exchange"],"sources":["../../src/error/wowError.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 ErrorCodes,\n type BindingError,\n type ErrorCode,\n type ErrorInfo,\n} from './errorInfo.js';\nimport { WowHeaders } from './headers.js';\nimport type { QueryViolation } from './queryErrorCodes.js';\n\n/** Where a {@link WowError} came from, besides its `ErrorInfo`. */\nexport interface WowErrorOptions {\n /** The HTTP status of the response that carried the error, if any. */\n status?: number;\n /** The error this one explains: the fetcher's, or the stream's. */\n cause?: unknown;\n}\n\n/**\n * Wow 8.11 to 9.1.3 answer a list query without a `limit` with this message;\n * 9.1.5 applies its default list size instead.\n */\nconst MISSING_LIST_LIMIT = /\\blist query limit\\[0\\] must be between /;\n\n/**\n * What to do about an error whose cause the client knows, appended to the\n * message only: `errorMsg` stays the server's own words.\n */\nfunction hintFor({ errorCode, errorMsg, bindingErrors }: ErrorInfo): string {\n // An older server says it with `IllegalArgument` alone; one that codes its\n // budget rejections (Wow 9.2) says `SIZE_OUT_OF_RANGE` too. The words are\n // what tell a missing limit from a limit out of range.\n const outOfRange =\n errorCode === ErrorCodes.ILLEGAL_ARGUMENT ||\n (bindingErrors ?? []).some(\n // `QueryErrorCodes.SIZE_OUT_OF_RANGE`, spelled out to keep this module\n // free of the catalogue.\n error => error?.code === 'SIZE_OUT_OF_RANGE',\n );\n if (\n outOfRange &&\n errorMsg !== undefined &&\n MISSING_LIST_LIMIT.test(errorMsg)\n ) {\n return (\n ' The query has no limit: omitting it needs Wow 9.1.5 or later, so ' +\n 'pass one, for example listQuery({ limit: 100 }).'\n );\n }\n return '';\n}\n\n/**\n * An error the Wow server answered with.\n *\n * Its `message` is `[errorCode] errorMsg`. When the client knows what causes\n * an error it adds what to do to the message, never to `errorMsg`: a list\n * query without a `limit`, which Wow 8.11 to 9.1.3 refuse with\n * `IllegalArgument`, says to pass one.\n *\n * It carries the server's `ErrorInfo` — `errorCode`, `errorMsg`,\n * `bindingErrors` — and, when a response carried it, the HTTP status. Switch\n * on `errorCode` against {@link ErrorCodes}; a rejected query also says which\n * rule it broke and where as {@link WowError.violation}.\n *\n * Two paths produce one:\n * - a server-sent event stream of this package (query streams and\n * `sendAndWaitStream`) errors with a `WowError` when the server sends an\n * error event in the middle of it; a `for await` over the stream throws it;\n * - {@link toWowError} turns what a failed request threw into one.\n *\n * @example\n * ```typescript\n * async function findState(id: string) {\n * try {\n * return await snapshotClient.getStateById(id);\n * } catch (error) {\n * const wowError = await toWowError(error);\n * if (wowError?.errorCode === ErrorCodes.NOT_FOUND) return undefined;\n * throw wowError ?? error;\n * }\n * }\n * ```\n */\nexport class WowError extends Error implements ErrorInfo {\n override readonly name = 'WowError';\n readonly errorCode: ErrorCode;\n readonly errorMsg: string;\n readonly bindingErrors: BindingError[];\n /** The HTTP status of the response that carried the error, if any. */\n readonly status?: number;\n /** The error this one explains: the fetcher's, or the stream's. */\n readonly cause?: unknown;\n /**\n * Which rule a rejected request broke, and where, read from the first of\n * `bindingErrors` that carries a `code`; `undefined` when none does.\n *\n * Wow answers a query it rejects while decoding (`IllegalArgument`) or\n * admitting it against the query model (`QuerySchemaValidation`) with one\n * such binding error, whose message is `errorMsg`. Switch on its `code`\n * against {@link QueryErrorCodes}, and fall back to `errorMsg` for a code\n * this package does not know: the list only grows. From Wow 9.2 the\n * entry's budget and gates say their rule too (`SIZE_OUT_OF_RANGE`,\n * `EXPENSIVE_OPERATOR_DISABLED`, …); an older server answers them with\n * text alone (`HTTP list query limit[...]`). A command's validation error\n * carries no code, and neither does a failure of the server itself (HTTP\n * 500 `InternalServerError`).\n *\n * @example\n * ```typescript\n * async function fieldInError(error: unknown): Promise<string | undefined> {\n * const violation = (await toWowError(error))?.violation;\n * if (violation?.code === QueryErrorCodes.UNKNOWN_FIELD) {\n * return violation.path; // e.g. 'state.items.sku'\n * }\n * return undefined;\n * }\n * ```\n */\n readonly violation?: QueryViolation;\n\n constructor(errorInfo: ErrorInfo, options: WowErrorOptions = {}) {\n super(\n (errorInfo.errorMsg\n ? `[${errorInfo.errorCode}] ${errorInfo.errorMsg}`\n : errorInfo.errorCode) + hintFor(errorInfo),\n );\n if (options.cause !== undefined) this.cause = options.cause;\n this.errorCode = errorInfo.errorCode;\n this.errorMsg = errorInfo.errorMsg ?? '';\n this.bindingErrors = errorInfo.bindingErrors ?? [];\n if (options.status !== undefined) this.status = options.status;\n for (const { name, msg, code } of this.bindingErrors) {\n if (typeof code !== 'string') continue;\n this.violation = {\n code,\n path: name ?? '',\n message: msg ?? this.errorMsg,\n };\n break;\n }\n }\n}\n\n/**\n * Whether a value has the shape of the server's `ErrorInfo`: an object with a\n * string `errorCode`, and `errorMsg` a string when present.\n */\nexport function isErrorInfo(value: unknown): value is ErrorInfo {\n if (typeof value !== 'object' || value === null) return false;\n const { errorCode, errorMsg } = value as Partial<Record<string, unknown>>;\n return (\n typeof errorCode === 'string' &&\n (errorMsg === undefined || typeof errorMsg === 'string')\n );\n}\n\n/** The part of a fetcher error this module reads, without importing fetcher. */\ninterface ExchangeLike {\n exchange?: { response?: Response };\n cause?: unknown;\n}\n\nasync function readErrorInfo(\n response: Response,\n): Promise<ErrorInfo | undefined> {\n const header = response.headers.get(WowHeaders.ERROR_CODE);\n let body: unknown;\n try {\n body = await response.clone().json();\n } catch {\n // Not JSON, or already read: the header is all there is.\n }\n if (isErrorInfo(body)) return body;\n if (header) return { errorCode: header, errorMsg: response.statusText };\n return undefined;\n}\n\n/**\n * Turns what a failed request threw into a {@link WowError}, or `undefined`\n * when it is not an error the Wow server answered with (a network failure, a\n * timeout, an abort, a proxy's own error page).\n *\n * It reads, in order: a `WowError` itself or as the `cause`; otherwise the\n * failed response of a fetcher error (`ExchangeError`,\n * `HttpStatusValidationError`), whose body is the server's `ErrorInfo`, or\n * failing that its `Wow-Error-Code` header. The response is cloned, so its\n * body stays readable.\n *\n * It is asynchronous because the error body has to be read; a thrown fetcher\n * error has not read it.\n */\nexport async function toWowError(\n error: unknown,\n): Promise<WowError | undefined> {\n if (error instanceof WowError) return error;\n if (typeof error !== 'object' || error === null) return undefined;\n const { exchange, cause } = error as ExchangeLike;\n if (cause instanceof WowError) return cause;\n const response = exchange?.response;\n if (!response || response.ok) return undefined;\n const errorInfo = await readErrorInfo(response);\n return errorInfo\n ? new WowError(errorInfo, { status: response.status, cause: error })\n : undefined;\n}\n"],"mappings":";;;AAkCA,IAAMA,IAAqB;AAM3B,SAASC,EAAQ,EAAE,cAAW,aAAU,oBAAoC;CAqB1E,QAhBEC,MAAcC,EAAW,qBACxBC,KAAiB,CAAC,EAAA,CAAG,MAGpB,MAASC,GAAO,SAAS,mBAC3B,MAGAC,MAAa,KAAA,KACbN,EAAmB,KAAKM,CAAQ,IAG9B,uHAIG;AACT;AAkCA,IAAaC,IAAb,cAA8B,MAA2B;CAqCvD,YAAY,GAAsB,IAA2B,CAAC,GAAG;EAU/D,AATA,OACGC,EAAU,WACP,IAAIA,EAAU,UAAU,IAAIA,EAAU,aACtCA,EAAU,aAAaP,EAAQO,CAAS,CAC9C,GAzCuB,KAAA,OAAA,YA0CnBC,EAAQ,UAAU,KAAA,MAAW,KAAK,QAAQA,EAAQ,QACtD,KAAK,YAAYD,EAAU,WAC3B,KAAK,WAAWA,EAAU,YAAY,IACtC,KAAK,gBAAgBA,EAAU,iBAAiB,CAAC,GAC7CC,EAAQ,WAAW,KAAA,MAAW,KAAK,SAASA,EAAQ;EACxD,KAAK,IAAM,EAAE,SAAM,QAAK,aAAU,KAAK,eACrC,IAAI,OAAOC,KAAS,UACpB;QAAK,YAAY;IACf;IACA,MAAMC,KAAQ;IACd,SAASC,KAAO,KAAK;GACvB;GACA;EADA;CAGJ;AACF;AAMA,SAAgBC,EAAY,GAAoC;CAC9D,IAAI,OAAOC,KAAU,aAAYA,GAAgB,OAAO;CACxD,IAAM,EAAE,cAAW,gBAAaA;CAChC,OACE,OAAOZ,KAAc,aACpBI,MAAa,KAAA,KAAa,OAAOA,KAAa;AAEnD;AAQA,eAAeS,EACb,GACgC;CAChC,IAAMC,IAASC,EAAS,QAAQ,IAAIC,EAAW,UAAU,GACrDC;CACJ,IAAI;EACF,IAAO,MAAMF,EAAS,MAAM,CAAC,CAAC,KAAK;CACrC,QAAQ,CAER;CACA,IAAIJ,EAAYM,CAAI,GAAG,OAAOA;CAC9B,IAAIH,GAAQ,OAAO;EAAE,WAAWA;EAAQ,UAAUC,EAAS;CAAW;AAExE;AAgBA,eAAsBG,EACpB,GAC+B;CAC/B,IAAIf,aAAiBE,GAAU,OAAOF;CACtC,IAAI,OAAOA,KAAU,aAAYA,GAAgB;CACjD,IAAM,EAAE,aAAU,aAAUA;CAC5B,IAAIgB,aAAiBd,GAAU,OAAOc;CACtC,IAAMJ,IAAWK,GAAU;CAC3B,IAAI,CAACL,KAAYA,EAAS,IAAI;CAC9B,IAAMT,IAAY,MAAMO,EAAcE,CAAQ;CAC9C,OAAOT,IACH,IAAID,EAASC,GAAW;EAAE,QAAQS,EAAS;EAAQ,OAAOZ;CAAM,CAAC,IACjE,KAAA;AACN"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("../dsl/deletionState.cjs"),t=require("./operator.cjs");function n(e){return!!e}var r=class{static{this.IGNORE_CASE_OPTION_KEY=`ignoreCase`}static{this.ZONE_ID_OPTION_KEY=`zoneId`}static{this.DATE_PATTERN_OPTION_KEY=`datePattern`}};function i(e){if(e!==void 0)return{ignoreCase:e}}function a(e,t){if(e===void 0&&t===void 0)return;let n={};return e!==void 0&&(n.datePattern=e),t!==void 0&&(n.zoneId=t),n}function o(...e){if(e.length===0)return v();if(e.length===1)return n(e[0])?e[0]:v();let r=[];return e.forEach(e=>{e?.operator!==t.Operator.ALL&&n(e)&&(e.operator===t.Operator.AND&&e.children?r.push(...e.children):r.push(e))}),r.length===0?v():{operator:t.Operator.AND,children:r}}function s(...e){let r=e?.filter(e=>n(e));return r.length===0?v():{operator:t.Operator.OR,children:r}}function c(...e){return e.length===0?v():{operator:t.Operator.NOR,children:e}}function l(e){return{operator:t.Operator.ID,value:e}}function u(e){return{operator:t.Operator.IDS,value:e}}function d(e){return{operator:t.Operator.AGGREGATE_ID,value:e}}function f(e){return{operator:t.Operator.AGGREGATE_IDS,value:e}}function p(e){return{operator:t.Operator.TENANT_ID,value:e}}function m(e){return{operator:t.Operator.OWNER_ID,value:e}}function h(e){return{operator:t.Operator.SPACE_ID,value:e}}function g(e){return{operator:t.Operator.DELETED,value:e}}function _(){return g(e.DeletionState.ACTIVE)}function v(){return{operator:t.Operator.ALL}}function y(e,n){return{field:e,operator:t.Operator.EQ,value:n}}function b(e,n){return{field:e,operator:t.Operator.NE,value:n}}function x(e,n){return{field:e,operator:t.Operator.GT,value:n}}function S(e,n){return{field:e,operator:t.Operator.LT,value:n}}function C(e,n){return{field:e,operator:t.Operator.GTE,value:n}}function w(e,n){return{field:e,operator:t.Operator.LTE,value:n}}function T(e,n,r){let a=i(r);return{field:e,operator:t.Operator.CONTAINS,value:n,options:a}}function E(e,...n){return{field:e,operator:t.Operator.IN,value:n}}function D(e,...n){return{field:e,operator:t.Operator.NOT_IN,value:n}}function O(e,n,r){return{field:e,operator:t.Operator.BETWEEN,value:[n,r]}}function k(e,...n){return{field:e,operator:t.Operator.ALL_IN,value:n}}function A(e,n,r){let a=i(r);return{field:e,operator:t.Operator.STARTS_WITH,value:n,options:a}}function j(e,n){return{field:e,operator:t.Operator.MATCH,value:n}}function M(e,n,r){let a=i(r);return{field:e,operator:t.Operator.ENDS_WITH,value:n,options:a}}function N(e,n){return{field:e,operator:t.Operator.ELEM_MATCH,children:[n]}}function P(e){return{field:e,operator:t.Operator.NULL}}function F(e){return{field:e,operator:t.Operator.NOT_NULL}}function I(e){return{field:e,operator:t.Operator.TRUE}}function L(e){return{field:e,operator:t.Operator.FALSE}}function R(e,n=!0){return{field:e,operator:t.Operator.EXISTS,value:n}}function z(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.TODAY,options:i}}function B(e,n,r,i){let o=a(r,i);return{field:e,operator:t.Operator.BEFORE_TODAY,value:n,options:o}}function V(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.TOMORROW,options:i}}function H(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.THIS_WEEK,options:i}}function U(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.NEXT_WEEK,options:i}}function W(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.LAST_WEEK,options:i}}function G(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.THIS_MONTH,options:i}}function K(e,n,r){let i=a(n,r);return{field:e,operator:t.Operator.LAST_MONTH,options:i}}function q(e,n,r,i){let o=a(r,i);return{field:e,operator:t.Operator.RECENT_DAYS,value:n,options:o}}function J(e,n,r,i){let o=a(r,i);return{field:e,operator:t.Operator.EARLIER_DAYS,value:n,options:o}}function Y(e){return{operator:t.Operator.RAW,value:e}}exports.ConditionOptionKey=r,exports.active=_,exports.aggregateId=d,exports.aggregateIds=f,exports.all=v,exports.allIn=k,exports.and=o,exports.beforeToday=B,exports.between=O,exports.contains=T,exports.dateOptions=a,exports.deleted=g,exports.earlierDays=J,exports.elemMatch=N,exports.endsWith=M,exports.eq=y,exports.exists=R,exports.gt=x,exports.gte=C,exports.id=l,exports.ids=u,exports.ignoreCaseOptions=i,exports.isFalse=L,exports.isIn=E,exports.isNull=P,exports.isTrue=I,exports.isValidateCondition=n,exports.lastMonth=K,exports.lastWeek=W,exports.lt=S,exports.lte=w,exports.match=j,exports.ne=b,exports.nextWeek=U,exports.nor=c,exports.notIn=D,exports.notNull=F,exports.or=s,exports.ownerId=m,exports.raw=Y,exports.recentDays=q,exports.spaceId=h,exports.startsWith=A,exports.tenantId=p,exports.thisMonth=G,exports.thisWeek=H,exports.today=z,exports.tomorrow=V;
|
|
2
|
-
//# sourceMappingURL=condition.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.cjs","names":["Operator","DeletionState","require_deletionState","require_operator","isValidateCondition","condition","ConditionOptionKey","ignoreCaseOptions","ignoreCase","dateOptions","datePattern","zoneId","options","and","conditions","all","andChildren","or","validateConditions","nor","id","ids","aggregateId","aggregateIds","tenantId","ownerId","spaceId","deleted","active","eq","ne","gt","lt","gte","lte","contains","isIn","value","notIn","between","start","end","allIn","startsWith","match","endsWith","elemMatch","isNull","notNull","isTrue","isFalse","exists","today","beforeToday","time","tomorrow","thisWeek","nextWeek","lastWeek","thisMonth","lastMonth","recentDays","days","earlierDays","raw"],"sources":["../../src/legacy/condition.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 { DeletionState } from '../dsl/deletionState.js';\nimport { Operator } from './operator.js';\n\n/**\n * Helper function to detect condition is validate or not\n *\n * @param condition - Condition\n * @returns If condition is validate return true, otherwise return false\n * @deprecated Use FilterExpression and filter.* instead. Removed in v10.\n */\nexport function isValidateCondition(\n condition: Condition | undefined | null,\n): condition is Condition {\n return !!condition;\n}\n\n/**\n * Condition option keys enumeration\n *\n * Defines standard option keys used in query conditions for special handling.\n *\n * @deprecated Use FilterExpression and filter.* instead. Removed in v10.\n */\nexport class ConditionOptionKey {\n /**\n * Ignore case option key for string comparisons\n */\n static readonly IGNORE_CASE_OPTION_KEY = 'ignoreCase';\n\n /**\n * Time zone ID option key for date operations\n */\n static readonly ZONE_ID_OPTION_KEY = 'zoneId';\n\n /**\n * Date pattern option key for date formatting\n */\n static readonly DATE_PATTERN_OPTION_KEY = 'datePattern';\n}\n\n/**\n * Condition options interface\n *\n * Represents additional options that can be applied to query conditions,\n * such as case sensitivity, date patterns, and time zones.\n *\n * @deprecated Use FilterExpression and filter.* instead. Removed in v10.\n */\nexport interface ConditionOptions {\n /**\n * Whether to ignore case in string comparisons\n */\n ignoreCase?: boolean;\n\n /**\n * Date pattern for date formatting\n */\n datePattern?: string;\n\n /**\n * Time zone ID for date operations\n */\n zoneId?: string;\n\n /**\n * Additional custom options\n */\n [key: string]: any;\n}\n\n/**\n * Helper function to create condition options with ignoreCase flag.\n *\n * @param ignoreCase - Whether to ignore case\n * @returns Condition options or undefined if ignoreCase is undefined\n * @deprecated Use StringComparison with filter.* instead. Removed in v10.\n */\nexport function ignoreCaseOptions(\n ignoreCase?: boolean,\n): ConditionOptions | undefined {\n if (typeof ignoreCase === 'undefined') {\n return undefined;\n }\n return { ignoreCase };\n}\n\n/**\n * Helper function to create condition options with date pattern and zone ID.\n *\n * @param datePattern - Date pattern\n * @param zoneId - Time zone ID\n * @returns Condition options or undefined if both parameters are undefined\n * @deprecated Pass RelativeTimeFilterOptions to filter.* instead.\n * Removed in v10.\n */\nexport function dateOptions(\n datePattern?: string,\n zoneId?: string,\n): ConditionOptions | undefined {\n if (typeof datePattern === 'undefined' && typeof zoneId === 'undefined') {\n return undefined;\n }\n const options: ConditionOptions = {};\n if (typeof datePattern !== 'undefined') {\n options.datePattern = datePattern;\n }\n if (typeof zoneId !== 'undefined') {\n options.zoneId = zoneId;\n }\n return options;\n}\n\n/**\n * Interface for query conditions.\n *\n * When `operator` is `AND` or `OR` or `NOR`, `children` cannot be empty.\n *\n * @deprecated Use FilterExpression instead. Removed in v10.\n */\nexport interface Condition<FIELDS extends string = string> {\n /**\n * Field name for the condition\n */\n field?: FIELDS;\n\n /**\n * Operator for the condition\n */\n operator?: Operator;\n\n /**\n * Value for the condition\n */\n value?: any;\n\n /**\n * Child conditions for logical operators (AND, OR, NOR)\n */\n children?: Condition<FIELDS>[];\n\n /**\n * Additional options for the condition\n */\n options?: ConditionOptions;\n}\n\n/**\n * Interface for objects that have a condition.\n *\n * @deprecated Use FilterCapable instead. Removed in v10.\n */\nexport interface ConditionCapable<FIELDS extends string = string> {\n /** @deprecated Use filter instead. Removed in v10. */\n condition: Condition<FIELDS>;\n}\n\n/**\n * Creates an AND condition with the specified conditions.\n *\n * This function combines multiple conditions using the logical AND operator.\n * It provides optimizations such as returning the condition directly when\n * only one is provided, and flattening nested AND conditions.\n *\n * @param conditions - Conditions to combine with AND. If empty, returns an ALL condition.\n * If exactly one, returns that condition directly.\n * If multiple, combines them into an AND condition with flattening optimization.\n * @returns A condition with AND operator or an optimized condition based on the input\n * @deprecated Use filter.and instead. Removed in v10.\n */\nexport function and<FIELDS extends string = string>(\n ...conditions: Array<Condition<FIELDS> | undefined | null>\n): Condition<FIELDS> {\n if (conditions.length === 0) {\n return all();\n }\n if (conditions.length === 1) {\n return isValidateCondition(conditions[0]) ? conditions[0] : all();\n }\n const andChildren: Condition<FIELDS>[] = [];\n conditions.forEach(condition => {\n if (\n condition?.operator === Operator.ALL ||\n !isValidateCondition(condition)\n ) {\n return;\n }\n if (condition.operator === Operator.AND && condition.children) {\n andChildren.push(...condition.children);\n } else {\n andChildren.push(condition);\n }\n });\n if (andChildren.length === 0) {\n return all();\n }\n return { operator: Operator.AND, children: andChildren };\n}\n\n/**\n * Creates an OR condition with the specified conditions.\n *\n * @param conditions - Conditions to combine with OR\n * @returns A condition with OR operator\n * @deprecated Use filter.or instead. Removed in v10.\n */\nexport function or<FIELDS extends string = string>(\n ...conditions: Array<Condition<FIELDS> | undefined | null>\n): Condition<FIELDS> {\n const validateConditions = conditions?.filter(condition =>\n isValidateCondition(condition),\n );\n if (validateConditions.length === 0) {\n return all();\n }\n return { operator: Operator.OR, children: validateConditions };\n}\n\n/**\n * Creates a NOR condition with the specified conditions.\n *\n * @param conditions - Conditions to combine with NOR\n * @returns A condition with NOR operator\n * @deprecated Use filter.nor instead. Removed in v10.\n */\nexport function nor<FIELDS extends string = string>(\n ...conditions: Condition<FIELDS>[]\n): Condition<FIELDS> {\n if (conditions.length === 0) {\n return all();\n }\n return { operator: Operator.NOR, children: conditions };\n}\n\n/**\n * Creates an ID condition with the specified value.\n *\n * @param value - The ID value to match\n * @returns A condition with ID operator\n * @deprecated Use filter.id instead. Removed in v10.\n */\nexport function id<FIELDS extends string = string>(\n value: string,\n): Condition<FIELDS> {\n return { operator: Operator.ID, value: value };\n}\n\n/**\n * Creates an IDS condition with the specified values.\n *\n * @param value - The ID values to match\n * @returns A condition with IDS operator\n * @deprecated Use filter.ids instead. Removed in v10.\n */\nexport function ids<FIELDS extends string = string>(\n value: string[],\n): Condition<FIELDS> {\n return { operator: Operator.IDS, value: value };\n}\n\n/**\n * Creates an AGGREGATE_ID condition with the specified value.\n *\n * @param value - The aggregate ID value to match\n * @returns A condition with AGGREGATE_ID operator\n * @deprecated Use filter.aggregateId instead. Removed in v10.\n */\nexport function aggregateId<FIELDS extends string = string>(\n value: string,\n): Condition<FIELDS> {\n return { operator: Operator.AGGREGATE_ID, value: value };\n}\n\n/**\n * Creates an AGGREGATE_IDS condition with the specified values.\n *\n * @param value - The aggregate ID values to match\n * @returns A condition with AGGREGATE_IDS operator\n * @deprecated Use filter.aggregateIds instead. Removed in v10.\n */\nexport function aggregateIds<FIELDS extends string = string>(\n value: string[],\n): Condition<FIELDS> {\n return { operator: Operator.AGGREGATE_IDS, value: value };\n}\n\n/**\n * Creates a TENANT_ID condition with the specified value.\n *\n * @param value - The tenant ID value to match\n * @returns A condition with TENANT_ID operator\n * @deprecated Use filter.tenantId instead. Removed in v10.\n */\nexport function tenantId<FIELDS extends string = string>(\n value: string,\n): Condition<FIELDS> {\n return { operator: Operator.TENANT_ID, value: value };\n}\n\n/**\n * Creates an OWNER_ID condition with the specified value.\n *\n * @param value - The owner ID value to match\n * @returns A condition with OWNER_ID operator\n * @deprecated Use filter.ownerId instead. Removed in v10.\n */\nexport function ownerId<FIELDS extends string = string>(\n value: string,\n): Condition<FIELDS> {\n return { operator: Operator.OWNER_ID, value: value };\n}\n\n/**\n * Creates a SPACE_ID condition with the specified value.\n *\n * @param value - The space ID value to match\n * @returns A condition with SPACE_ID operator\n * @deprecated Use filter.spaceId instead. Removed in v10.\n */\nexport function spaceId<FIELDS extends string = string>(\n value: string,\n): Condition<FIELDS> {\n return { operator: Operator.SPACE_ID, value: value };\n}\n\n/**\n * Creates a DELETED condition with the specified value.\n *\n * @param value - The deletion state value to match\n * @returns A condition with DELETED operator\n * @deprecated Use filter.deletion instead. Removed in v10.\n */\nexport function deleted<FIELDS extends string = string>(\n value: DeletionState,\n): Condition<FIELDS> {\n return { operator: Operator.DELETED, value: value };\n}\n\n/**\n * Creates an ACTIVE deletion state condition.\n *\n * @returns A condition with DELETED operator set to ACTIVE\n * @deprecated Use filter.deletion(DeletionState.ACTIVE) instead.\n * Removed in v10.\n */\nexport function active<FIELDS extends string = string>(): Condition<FIELDS> {\n return deleted(DeletionState.ACTIVE);\n}\n\n/**\n * Creates an ALL condition.\n *\n * @returns A condition with ALL operator\n * @deprecated Use filter.matchAll instead. Removed in v10.\n */\nexport function all<FIELDS extends string = string>(): Condition<FIELDS> {\n return {\n operator: Operator.ALL,\n };\n}\n\n/**\n * Creates an EQ (equals) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with EQ operator\n * @deprecated Use filter.eq instead. Removed in v10.\n */\nexport function eq<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.EQ, value };\n}\n\n/**\n * Creates a NE (not equals) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with NE operator\n * @deprecated Use filter.ne instead. Removed in v10.\n */\nexport function ne<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.NE, value };\n}\n\n/**\n * Creates a GT (greater than) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with GT operator\n * @deprecated Use filter.gt instead. Removed in v10.\n */\nexport function gt<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.GT, value };\n}\n\n/**\n * Creates a LT (less than) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with LT operator\n * @deprecated Use filter.lt instead. Removed in v10.\n */\nexport function lt<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.LT, value };\n}\n\n/**\n * Creates a GTE (greater than or equal) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with GTE operator\n * @deprecated Use filter.gte instead. Removed in v10.\n */\nexport function gte<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.GTE, value };\n}\n\n/**\n * Creates a LTE (less than or equal) condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @returns A condition with LTE operator\n * @deprecated Use filter.lte instead. Removed in v10.\n */\nexport function lte<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.LTE, value };\n}\n\n/**\n * Creates a CONTAINS condition with the specified field and value.\n *\n * @param field - The field name to search in\n * @param value - The value to search for\n * @param ignoreCase - Whether to ignore case in the search\n * @returns A condition with CONTAINS operator\n * @deprecated Use filter.contains instead. Removed in v10.\n */\nexport function contains<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n ignoreCase?: boolean,\n): Condition<FIELDS> {\n const options: Record<string, any> | undefined =\n ignoreCaseOptions(ignoreCase);\n return { field, operator: Operator.CONTAINS, value, options };\n}\n\n/**\n * Creates an IN condition with the specified field and values.\n *\n * @param field - The field name to compare\n * @param value - The values to compare against\n * @returns A condition with IN operator\n * @deprecated Use filter.isIn instead. Removed in v10.\n */\nexport function isIn<FIELDS extends string = string>(\n field: FIELDS,\n ...value: any[]\n): Condition<FIELDS> {\n return { field, operator: Operator.IN, value };\n}\n\n/**\n * Creates a NOT_IN condition with the specified field and values.\n *\n * @param field - The field name to compare\n * @param value - The values to compare against\n * @returns A condition with NOT_IN operator\n * @deprecated Use filter.notIn instead. Removed in v10.\n */\nexport function notIn<FIELDS extends string = string>(\n field: FIELDS,\n ...value: any[]\n): Condition<FIELDS> {\n return { field, operator: Operator.NOT_IN, value };\n}\n\n/**\n * Creates a BETWEEN condition with the specified field and range.\n *\n * @param field - The field name to compare\n * @param start - The start value of the range\n * @param end - The end value of the range\n * @returns A condition with BETWEEN operator\n * @deprecated Use filter.between instead. Removed in v10.\n */\nexport function between<FIELDS extends string = string>(\n field: FIELDS,\n start: any,\n end: any,\n): Condition<FIELDS> {\n return { field, operator: Operator.BETWEEN, value: [start, end] };\n}\n\n/**\n * Creates an ALL_IN condition with the specified field and values.\n *\n * @param field - The field name to compare\n * @param value - The values to compare against\n * @returns A condition with ALL_IN operator\n * @deprecated Use filter.containsAll instead. Removed in v10.\n */\nexport function allIn<FIELDS extends string = string>(\n field: FIELDS,\n ...value: any[]\n): Condition<FIELDS> {\n return { field, operator: Operator.ALL_IN, value };\n}\n\n/**\n * Creates a STARTS_WITH condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @param ignoreCase - Whether to ignore case in the comparison\n * @returns A condition with STARTS_WITH operator\n * @deprecated Use filter.startsWith instead. Removed in v10.\n */\nexport function startsWith<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n ignoreCase?: boolean,\n): Condition<FIELDS> {\n const options: Record<string, any> | undefined =\n ignoreCaseOptions(ignoreCase);\n return { field, operator: Operator.STARTS_WITH, value, options };\n}\n\n/**\n * Creates a MATCH condition for full-text search.\n *\n * @param field - The field name to search\n * @param value - The search keywords\n * @returns A condition with MATCH operator\n * @deprecated Use filter.search instead. Removed in v10.\n */\nexport function match<FIELDS extends string = string>(\n field: FIELDS,\n value: string,\n): Condition<FIELDS> {\n return { field, operator: Operator.MATCH, value };\n}\n\n/**\n * Creates an ENDS_WITH condition with the specified field and value.\n *\n * @param field - The field name to compare\n * @param value - The value to compare against\n * @param ignoreCase - Whether to ignore case in the comparison\n * @returns A condition with ENDS_WITH operator\n * @deprecated Use filter.endsWith instead. Removed in v10.\n */\nexport function endsWith<FIELDS extends string = string>(\n field: FIELDS,\n value: any,\n ignoreCase?: boolean,\n): Condition<FIELDS> {\n const options: Record<string, any> | undefined =\n ignoreCaseOptions(ignoreCase);\n return { field, operator: Operator.ENDS_WITH, value, options };\n}\n\n/**\n * Creates an ELEM_MATCH condition with the specified field and child condition.\n *\n * @param field - The field name to match elements in\n * @param value - The condition to match elements against\n * @returns A condition with ELEM_MATCH operator\n * @deprecated Use filter.elementMatch instead. Removed in v10.\n */\nexport function elemMatch<FIELDS extends string = string>(\n field: FIELDS,\n value: Condition<FIELDS>,\n): Condition<FIELDS> {\n return { field, operator: Operator.ELEM_MATCH, children: [value] };\n}\n\n/**\n * Creates a NULL condition with the specified field.\n *\n * @param field - The field name to check\n * @returns A condition with NULL operator\n * @deprecated Use filter.isNull instead. Removed in v10.\n */\nexport function isNull<FIELDS extends string = string>(\n field: FIELDS,\n): Condition<FIELDS> {\n return { field, operator: Operator.NULL };\n}\n\n/**\n * Creates a NOT_NULL condition with the specified field.\n *\n * @param field - The field name to check\n * @returns A condition with NOT_NULL operator\n * @deprecated Use filter.isNotNull instead. Removed in v10.\n */\nexport function notNull<FIELDS extends string = string>(\n field: FIELDS,\n): Condition<FIELDS> {\n return { field, operator: Operator.NOT_NULL };\n}\n\n/**\n * Creates a TRUE condition with the specified field.\n *\n * @param field - The field name to check\n * @returns A condition with TRUE operator\n * @deprecated Use filter.eq(field, true) instead. Removed in v10.\n */\nexport function isTrue<FIELDS extends string = string>(\n field: FIELDS,\n): Condition<FIELDS> {\n return { field, operator: Operator.TRUE };\n}\n\n/**\n * Creates a FALSE condition with the specified field.\n *\n * @param field - The field name to check\n * @returns A condition with FALSE operator\n * @deprecated Use filter.eq(field, false) instead. Removed in v10.\n */\nexport function isFalse<FIELDS extends string = string>(\n field: FIELDS,\n): Condition<FIELDS> {\n return { field, operator: Operator.FALSE };\n}\n\n/**\n * Creates an EXISTS condition with the specified field and existence flag.\n *\n * @param field - The field name to check\n * @param exists - Whether the field should exist (default: true)\n * @returns A condition with EXISTS operator\n * @deprecated Use filter.exists or filter.notExists instead. Removed in v10.\n */\nexport function exists<FIELDS extends string = string>(\n field: FIELDS,\n exists: boolean = true,\n): Condition<FIELDS> {\n return { field, operator: Operator.EXISTS, value: exists };\n}\n\n/**\n * Creates a TODAY condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with TODAY operator\n * @deprecated Use filter.today instead. Removed in v10.\n */\nexport function today<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.TODAY, options };\n}\n\n/**\n * Creates a BEFORE_TODAY condition with the specified field and time.\n *\n * @param field - The field name to check\n * @param time - The time to compare against\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with BEFORE_TODAY operator\n * @deprecated Use filter.beforeToday instead. Removed in v10.\n */\nexport function beforeToday<FIELDS extends string = string>(\n field: FIELDS,\n time: any,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.BEFORE_TODAY, value: time, options };\n}\n\n/**\n * Creates a TOMORROW condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with TOMORROW operator\n * @deprecated Use filter.tomorrow instead. Removed in v10.\n */\nexport function tomorrow<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.TOMORROW, options };\n}\n\n/**\n * Creates a THIS_WEEK condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with THIS_WEEK operator\n * @deprecated Use filter.thisWeek instead. Removed in v10.\n */\nexport function thisWeek<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.THIS_WEEK, options };\n}\n\n/**\n * Creates a NEXT_WEEK condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with NEXT_WEEK operator\n * @deprecated Use filter.nextWeek instead. Removed in v10.\n */\nexport function nextWeek<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.NEXT_WEEK, options };\n}\n\n/**\n * Creates a LAST_WEEK condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with LAST_WEEK operator\n * @deprecated Use filter.lastWeek instead. Removed in v10.\n */\nexport function lastWeek<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.LAST_WEEK, options };\n}\n\n/**\n * Creates a THIS_MONTH condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with THIS_MONTH operator\n * @deprecated Use filter.thisMonth instead. Removed in v10.\n */\nexport function thisMonth<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.THIS_MONTH, options };\n}\n\n/**\n * Creates a LAST_MONTH condition with the specified field.\n *\n * @param field - The field name to check\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with LAST_MONTH operator\n * @deprecated Use filter.lastMonth instead. Removed in v10.\n */\nexport function lastMonth<FIELDS extends string = string>(\n field: FIELDS,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.LAST_MONTH, options };\n}\n\n/**\n * Creates a RECENT_DAYS condition with the specified field and number of days.\n *\n * @param field - The field name to check\n * @param days - The number of recent days to include\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with RECENT_DAYS operator\n * @deprecated Use filter.recentDays instead. Removed in v10.\n */\nexport function recentDays<FIELDS extends string = string>(\n field: FIELDS,\n days: number,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.RECENT_DAYS, value: days, options };\n}\n\n/**\n * Creates an EARLIER_DAYS condition with the specified field and number of days.\n *\n * @param field - The field name to check\n * @param days - The number of days to look back\n * @param datePattern - The date pattern to use\n * @param zoneId - The time zone ID to use\n * @returns A condition with EARLIER_DAYS operator\n * @deprecated Use filter.earlierDays instead. Removed in v10.\n */\nexport function earlierDays<FIELDS extends string = string>(\n field: FIELDS,\n days: number,\n datePattern?: string,\n zoneId?: string,\n): Condition<FIELDS> {\n const options = dateOptions(datePattern, zoneId);\n return { field, operator: Operator.EARLIER_DAYS, value: days, options };\n}\n\n/**\n * Creates a RAW condition with the specified raw value.\n *\n * @param raw - The raw condition value\n * @returns A condition with RAW operator\n * @deprecated RAW has no FilterExpression replacement, and current Wow refuses\n * it: the operator was removed in Wow #2999. It is kept for servers older than\n * that, which the Condition API exists to reach and which still accept it.\n * Against a current server this condition is answered with a 400.\n * Removed in v10.\n */\nexport function raw<FIELDS extends string = string>(\n raw: any,\n): Condition<FIELDS> {\n return { operator: Operator.RAW, value: raw };\n}\n"],"mappings":"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"}
|