@ahoo-wang/wow-client 9.2.0-rc.0
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/LICENSE +201 -0
- package/README.md +291 -0
- package/README.zh-CN.md +267 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.cjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.es.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.cjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.es.js +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateParam.cjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateParam.es.js +8 -0
- package/dist/client/bindMethods.cjs +2 -0
- package/dist/client/bindMethods.cjs.map +1 -0
- package/dist/client/bindMethods.d.cts +13 -0
- package/dist/client/bindMethods.d.ts +13 -0
- package/dist/client/bindMethods.es.js +19 -0
- package/dist/client/bindMethods.es.js.map +1 -0
- package/dist/client/command/commandClient.cjs +2 -0
- package/dist/client/command/commandClient.cjs.map +1 -0
- package/dist/client/command/commandClient.d.cts +67 -0
- package/dist/client/command/commandClient.d.ts +67 -0
- package/dist/client/command/commandClient.es.js +38 -0
- package/dist/client/command/commandClient.es.js.map +1 -0
- package/dist/client/command/commandHeaders.cjs +2 -0
- package/dist/client/command/commandHeaders.cjs.map +1 -0
- package/dist/client/command/commandHeaders.d.cts +75 -0
- package/dist/client/command/commandHeaders.d.ts +75 -0
- package/dist/client/command/commandHeaders.es.js +31 -0
- package/dist/client/command/commandHeaders.es.js.map +1 -0
- package/dist/client/command/commandRequest.cjs +2 -0
- package/dist/client/command/commandRequest.cjs.map +1 -0
- package/dist/client/command/commandRequest.d.cts +180 -0
- package/dist/client/command/commandRequest.d.ts +180 -0
- package/dist/client/command/commandRequest.es.js +31 -0
- package/dist/client/command/commandRequest.es.js.map +1 -0
- package/dist/client/command/commandResult.d.cts +15 -0
- package/dist/client/command/commandResult.d.ts +15 -0
- package/dist/client/command/index.d.cts +5 -0
- package/dist/client/command/index.d.ts +5 -0
- package/dist/client/command/types.d.cts +71 -0
- package/dist/client/command/types.d.ts +71 -0
- package/dist/client/metadata/index.d.cts +2 -0
- package/dist/client/metadata/index.d.ts +2 -0
- package/dist/client/metadata/wowMetadata.d.cts +48 -0
- package/dist/client/metadata/wowMetadata.d.ts +48 -0
- package/dist/client/metadata/wowMetadataClient.cjs +2 -0
- package/dist/client/metadata/wowMetadataClient.cjs.map +1 -0
- package/dist/client/metadata/wowMetadataClient.d.cts +23 -0
- package/dist/client/metadata/wowMetadataClient.d.ts +23 -0
- package/dist/client/metadata/wowMetadataClient.es.js +25 -0
- package/dist/client/metadata/wowMetadataClient.es.js.map +1 -0
- package/dist/client/query/descriptor/descriptorEndpoints.cjs +2 -0
- package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +1 -0
- package/dist/client/query/descriptor/descriptorEndpoints.d.cts +29 -0
- package/dist/client/query/descriptor/descriptorEndpoints.d.ts +29 -0
- package/dist/client/query/descriptor/descriptorEndpoints.es.js +69 -0
- package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +1 -0
- package/dist/client/query/descriptor/endpointPaths.cjs +2 -0
- package/dist/client/query/descriptor/endpointPaths.cjs.map +1 -0
- package/dist/client/query/descriptor/endpointPaths.d.cts +4 -0
- package/dist/client/query/descriptor/endpointPaths.d.ts +4 -0
- package/dist/client/query/descriptor/endpointPaths.es.js +9 -0
- package/dist/client/query/descriptor/endpointPaths.es.js.map +1 -0
- package/dist/client/query/descriptor/index.d.cts +2 -0
- package/dist/client/query/descriptor/index.d.ts +2 -0
- package/dist/client/query/descriptor/queryDescriptorApi.d.cts +58 -0
- package/dist/client/query/descriptor/queryDescriptorApi.d.ts +58 -0
- package/dist/client/query/descriptor/queryDescriptorClient.cjs +2 -0
- package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +1 -0
- package/dist/client/query/descriptor/queryDescriptorClient.d.cts +61 -0
- package/dist/client/query/descriptor/queryDescriptorClient.d.ts +61 -0
- package/dist/client/query/descriptor/queryDescriptorClient.es.js +20 -0
- package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +1 -0
- package/dist/client/query/event/domainEventStream.cjs +2 -0
- package/dist/client/query/event/domainEventStream.cjs.map +1 -0
- package/dist/client/query/event/domainEventStream.d.cts +105 -0
- package/dist/client/query/event/domainEventStream.d.ts +105 -0
- package/dist/client/query/event/domainEventStream.es.js +23 -0
- package/dist/client/query/event/domainEventStream.es.js.map +1 -0
- package/dist/client/query/event/endpointPaths.cjs +2 -0
- package/dist/client/query/event/endpointPaths.cjs.map +1 -0
- package/dist/client/query/event/endpointPaths.d.cts +8 -0
- package/dist/client/query/event/endpointPaths.d.ts +8 -0
- package/dist/client/query/event/endpointPaths.es.js +13 -0
- package/dist/client/query/event/endpointPaths.es.js.map +1 -0
- package/dist/client/query/event/eventStreamQueryApi.d.cts +29 -0
- package/dist/client/query/event/eventStreamQueryApi.d.ts +29 -0
- package/dist/client/query/event/eventStreamQueryClient.cjs +2 -0
- package/dist/client/query/event/eventStreamQueryClient.cjs.map +1 -0
- package/dist/client/query/event/eventStreamQueryClient.d.cts +190 -0
- package/dist/client/query/event/eventStreamQueryClient.d.ts +190 -0
- package/dist/client/query/event/eventStreamQueryClient.es.js +160 -0
- package/dist/client/query/event/eventStreamQueryClient.es.js.map +1 -0
- package/dist/client/query/event/index.d.cts +3 -0
- package/dist/client/query/event/index.d.ts +3 -0
- package/dist/client/query/factory.cjs +2 -0
- package/dist/client/query/factory.cjs.map +1 -0
- package/dist/client/query/factory.d.cts +165 -0
- package/dist/client/query/factory.d.ts +165 -0
- package/dist/client/query/factory.es.js +45 -0
- package/dist/client/query/factory.es.js.map +1 -0
- package/dist/client/query/index.d.cts +6 -0
- package/dist/client/query/index.d.ts +6 -0
- package/dist/client/query/queryApi.d.cts +68 -0
- package/dist/client/query/queryApi.d.ts +68 -0
- package/dist/client/query/requests.d.cts +24 -0
- package/dist/client/query/requests.d.ts +24 -0
- package/dist/client/query/snapshot/endpointPaths.cjs +2 -0
- package/dist/client/query/snapshot/endpointPaths.cjs.map +1 -0
- package/dist/client/query/snapshot/endpointPaths.d.cts +12 -0
- package/dist/client/query/snapshot/endpointPaths.d.ts +12 -0
- package/dist/client/query/snapshot/endpointPaths.es.js +17 -0
- package/dist/client/query/snapshot/endpointPaths.es.js.map +1 -0
- package/dist/client/query/snapshot/index.d.cts +3 -0
- package/dist/client/query/snapshot/index.d.ts +3 -0
- package/dist/client/query/snapshot/snapshot.cjs +2 -0
- package/dist/client/query/snapshot/snapshot.cjs.map +1 -0
- package/dist/client/query/snapshot/snapshot.d.cts +51 -0
- package/dist/client/query/snapshot/snapshot.d.ts +51 -0
- package/dist/client/query/snapshot/snapshot.es.js +20 -0
- package/dist/client/query/snapshot/snapshot.es.js.map +1 -0
- package/dist/client/query/snapshot/snapshotQueryApi.d.cts +101 -0
- package/dist/client/query/snapshot/snapshotQueryApi.d.ts +101 -0
- package/dist/client/query/snapshot/snapshotQueryClient.cjs +2 -0
- package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +1 -0
- package/dist/client/query/snapshot/snapshotQueryClient.d.cts +369 -0
- package/dist/client/query/snapshot/snapshotQueryClient.d.ts +369 -0
- package/dist/client/query/snapshot/snapshotQueryClient.es.js +239 -0
- package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +1 -0
- package/dist/client/query/state/endpointPaths.cjs +2 -0
- package/dist/client/query/state/endpointPaths.cjs.map +1 -0
- package/dist/client/query/state/endpointPaths.d.cts +10 -0
- package/dist/client/query/state/endpointPaths.d.ts +10 -0
- package/dist/client/query/state/endpointPaths.es.js +14 -0
- package/dist/client/query/state/endpointPaths.es.js.map +1 -0
- package/dist/client/query/state/index.d.cts +4 -0
- package/dist/client/query/state/index.d.ts +4 -0
- package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +36 -0
- package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +36 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +2 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +1 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +58 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +58 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +56 -0
- package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +1 -0
- package/dist/client/query/state/loadStateAggregateApi.d.cts +37 -0
- package/dist/client/query/state/loadStateAggregateApi.d.ts +37 -0
- package/dist/client/query/state/loadStateAggregateClient.cjs +2 -0
- package/dist/client/query/state/loadStateAggregateClient.cjs.map +1 -0
- package/dist/client/query/state/loadStateAggregateClient.d.cts +62 -0
- package/dist/client/query/state/loadStateAggregateClient.d.ts +62 -0
- package/dist/client/query/state/loadStateAggregateClient.es.js +65 -0
- package/dist/client/query/state/loadStateAggregateClient.es.js.map +1 -0
- package/dist/client/routing.cjs +2 -0
- package/dist/client/routing.cjs.map +1 -0
- package/dist/client/routing.d.cts +47 -0
- package/dist/client/routing.d.ts +47 -0
- package/dist/client/routing.es.js +8 -0
- package/dist/client/routing.es.js.map +1 -0
- package/dist/dsl/aggregation/admit.cjs +2 -0
- package/dist/dsl/aggregation/admit.cjs.map +1 -0
- package/dist/dsl/aggregation/admit.d.cts +6 -0
- package/dist/dsl/aggregation/admit.d.ts +6 -0
- package/dist/dsl/aggregation/admit.es.js +142 -0
- package/dist/dsl/aggregation/admit.es.js.map +1 -0
- package/dist/dsl/aggregation/builders.cjs +2 -0
- package/dist/dsl/aggregation/builders.cjs.map +1 -0
- package/dist/dsl/aggregation/builders.d.cts +309 -0
- package/dist/dsl/aggregation/builders.d.ts +309 -0
- package/dist/dsl/aggregation/builders.es.js +188 -0
- package/dist/dsl/aggregation/builders.es.js.map +1 -0
- package/dist/dsl/aggregation/derived.cjs +2 -0
- package/dist/dsl/aggregation/derived.cjs.map +1 -0
- package/dist/dsl/aggregation/derived.d.cts +33 -0
- package/dist/dsl/aggregation/derived.d.ts +33 -0
- package/dist/dsl/aggregation/derived.es.js +31 -0
- package/dist/dsl/aggregation/derived.es.js.map +1 -0
- package/dist/dsl/aggregation/expressionTrees.cjs +2 -0
- package/dist/dsl/aggregation/expressionTrees.cjs.map +1 -0
- package/dist/dsl/aggregation/expressionTrees.d.cts +10 -0
- package/dist/dsl/aggregation/expressionTrees.d.ts +10 -0
- package/dist/dsl/aggregation/expressionTrees.es.js +44 -0
- package/dist/dsl/aggregation/expressionTrees.es.js.map +1 -0
- package/dist/dsl/aggregation/having.cjs +2 -0
- package/dist/dsl/aggregation/having.cjs.map +1 -0
- package/dist/dsl/aggregation/having.d.cts +94 -0
- package/dist/dsl/aggregation/having.d.ts +94 -0
- package/dist/dsl/aggregation/having.es.js +62 -0
- package/dist/dsl/aggregation/having.es.js.map +1 -0
- package/dist/dsl/aggregation/index.d.cts +4 -0
- package/dist/dsl/aggregation/index.d.ts +4 -0
- package/dist/dsl/aggregation/sort.cjs +2 -0
- package/dist/dsl/aggregation/sort.cjs.map +1 -0
- package/dist/dsl/aggregation/sort.d.cts +7 -0
- package/dist/dsl/aggregation/sort.d.ts +7 -0
- package/dist/dsl/aggregation/sort.es.js +10 -0
- package/dist/dsl/aggregation/sort.es.js.map +1 -0
- package/dist/dsl/aggregation/types.cjs +2 -0
- package/dist/dsl/aggregation/types.cjs.map +1 -0
- package/dist/dsl/aggregation/types.d.cts +608 -0
- package/dist/dsl/aggregation/types.d.ts +608 -0
- package/dist/dsl/aggregation/types.es.js +37 -0
- package/dist/dsl/aggregation/types.es.js.map +1 -0
- package/dist/dsl/cursorQuery.cjs +2 -0
- package/dist/dsl/cursorQuery.cjs.map +1 -0
- package/dist/dsl/cursorQuery.d.cts +69 -0
- package/dist/dsl/cursorQuery.d.ts +69 -0
- package/dist/dsl/cursorQuery.es.js +19 -0
- package/dist/dsl/cursorQuery.es.js.map +1 -0
- package/dist/dsl/deletionState.cjs +2 -0
- package/dist/dsl/deletionState.cjs.map +1 -0
- package/dist/dsl/deletionState.d.cts +19 -0
- package/dist/dsl/deletionState.d.ts +19 -0
- package/dist/dsl/deletionState.es.js +8 -0
- package/dist/dsl/deletionState.es.js.map +1 -0
- package/dist/dsl/descriptor.cjs +2 -0
- package/dist/dsl/descriptor.cjs.map +1 -0
- package/dist/dsl/descriptor.d.cts +629 -0
- package/dist/dsl/descriptor.d.ts +629 -0
- package/dist/dsl/descriptor.es.js +37 -0
- package/dist/dsl/descriptor.es.js.map +1 -0
- package/dist/dsl/documents.d.cts +8 -0
- package/dist/dsl/documents.d.ts +8 -0
- package/dist/dsl/field.cjs +2 -0
- package/dist/dsl/field.cjs.map +1 -0
- package/dist/dsl/field.d.cts +2 -0
- package/dist/dsl/field.d.ts +2 -0
- package/dist/dsl/field.es.js +10 -0
- package/dist/dsl/field.es.js.map +1 -0
- package/dist/dsl/filter/builders.cjs +2 -0
- package/dist/dsl/filter/builders.cjs.map +1 -0
- package/dist/dsl/filter/builders.d.cts +962 -0
- package/dist/dsl/filter/builders.d.ts +962 -0
- package/dist/dsl/filter/builders.es.js +289 -0
- package/dist/dsl/filter/builders.es.js.map +1 -0
- package/dist/dsl/filter/datePattern.cjs +2 -0
- package/dist/dsl/filter/datePattern.cjs.map +1 -0
- package/dist/dsl/filter/datePattern.d.cts +8 -0
- package/dist/dsl/filter/datePattern.d.ts +8 -0
- package/dist/dsl/filter/datePattern.es.js +100 -0
- package/dist/dsl/filter/datePattern.es.js.map +1 -0
- package/dist/dsl/filter/index.d.cts +3 -0
- package/dist/dsl/filter/index.d.ts +3 -0
- package/dist/dsl/filter/operator.cjs +2 -0
- package/dist/dsl/filter/operator.cjs.map +1 -0
- package/dist/dsl/filter/operator.d.cts +113 -0
- package/dist/dsl/filter/operator.d.ts +113 -0
- package/dist/dsl/filter/operator.es.js +14 -0
- package/dist/dsl/filter/operator.es.js.map +1 -0
- package/dist/dsl/filter/scope.cjs +2 -0
- package/dist/dsl/filter/scope.cjs.map +1 -0
- package/dist/dsl/filter/scope.d.cts +15 -0
- package/dist/dsl/filter/scope.d.ts +15 -0
- package/dist/dsl/filter/scope.es.js +32 -0
- package/dist/dsl/filter/scope.es.js.map +1 -0
- package/dist/dsl/filter/types.d.cts +274 -0
- package/dist/dsl/filter/types.d.ts +274 -0
- package/dist/dsl/filter/validate.cjs +2 -0
- package/dist/dsl/filter/validate.cjs.map +1 -0
- package/dist/dsl/filter/validate.d.cts +18 -0
- package/dist/dsl/filter/validate.d.ts +18 -0
- package/dist/dsl/filter/validate.es.js +56 -0
- package/dist/dsl/filter/validate.es.js.map +1 -0
- package/dist/dsl/pagination.cjs +2 -0
- package/dist/dsl/pagination.cjs.map +1 -0
- package/dist/dsl/pagination.d.cts +28 -0
- package/dist/dsl/pagination.d.ts +28 -0
- package/dist/dsl/pagination.es.js +15 -0
- package/dist/dsl/pagination.es.js.map +1 -0
- package/dist/dsl/projection.cjs +2 -0
- package/dist/dsl/projection.cjs.map +1 -0
- package/dist/dsl/projection.d.cts +27 -0
- package/dist/dsl/projection.d.ts +27 -0
- package/dist/dsl/projection.es.js +12 -0
- package/dist/dsl/projection.es.js.map +1 -0
- package/dist/dsl/queryable.cjs +2 -0
- package/dist/dsl/queryable.cjs.map +1 -0
- package/dist/dsl/queryable.d.cts +101 -0
- package/dist/dsl/queryable.d.ts +101 -0
- package/dist/dsl/queryable.es.js +40 -0
- package/dist/dsl/queryable.es.js.map +1 -0
- package/dist/dsl/sort.cjs +2 -0
- package/dist/dsl/sort.cjs.map +1 -0
- package/dist/dsl/sort.d.cts +33 -0
- package/dist/dsl/sort.d.ts +33 -0
- package/dist/dsl/sort.es.js +21 -0
- package/dist/dsl/sort.es.js.map +1 -0
- package/dist/dsl.cjs +1 -0
- package/dist/dsl.d.cts +23 -0
- package/dist/dsl.d.ts +23 -0
- package/dist/dsl.es.js +14 -0
- package/dist/error/errorInfo.cjs +2 -0
- package/dist/error/errorInfo.cjs.map +1 -0
- package/dist/error/errorInfo.d.cts +139 -0
- package/dist/error/errorInfo.d.ts +139 -0
- package/dist/error/errorInfo.es.js +32 -0
- package/dist/error/errorInfo.es.js.map +1 -0
- package/dist/error/headers.cjs +2 -0
- package/dist/error/headers.cjs.map +1 -0
- package/dist/error/headers.d.cts +38 -0
- package/dist/error/headers.d.ts +38 -0
- package/dist/error/headers.es.js +10 -0
- package/dist/error/headers.es.js.map +1 -0
- package/dist/error/index.d.cts +21 -0
- package/dist/error/index.d.ts +21 -0
- package/dist/error/queryErrorCodes.cjs +2 -0
- package/dist/error/queryErrorCodes.cjs.map +1 -0
- package/dist/error/queryErrorCodes.d.cts +199 -0
- package/dist/error/queryErrorCodes.d.ts +199 -0
- package/dist/error/queryErrorCodes.es.js +53 -0
- package/dist/error/queryErrorCodes.es.js.map +1 -0
- package/dist/error/wowError.cjs +2 -0
- package/dist/error/wowError.cjs.map +1 -0
- package/dist/error/wowError.d.cts +99 -0
- package/dist/error/wowError.d.ts +99 -0
- package/dist/error/wowError.es.js +53 -0
- package/dist/error/wowError.es.js.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.es.js +34 -0
- package/dist/legacy/condition.cjs +2 -0
- package/dist/legacy/condition.cjs.map +1 -0
- package/dist/legacy/condition.d.cts +517 -0
- package/dist/legacy/condition.d.ts +517 -0
- package/dist/legacy/condition.es.js +338 -0
- package/dist/legacy/condition.es.js.map +1 -0
- package/dist/legacy/index.d.cts +16 -0
- package/dist/legacy/index.d.ts +16 -0
- package/dist/legacy/locale/en_US.cjs +2 -0
- package/dist/legacy/locale/en_US.cjs.map +1 -0
- package/dist/legacy/locale/en_US.d.cts +7 -0
- package/dist/legacy/locale/en_US.d.ts +7 -0
- package/dist/legacy/locale/en_US.es.js +50 -0
- package/dist/legacy/locale/en_US.es.js.map +1 -0
- package/dist/legacy/locale/operatorLocale.d.cts +10 -0
- package/dist/legacy/locale/operatorLocale.d.ts +10 -0
- package/dist/legacy/locale/zh_CN.cjs +2 -0
- package/dist/legacy/locale/zh_CN.cjs.map +1 -0
- package/dist/legacy/locale/zh_CN.d.cts +7 -0
- package/dist/legacy/locale/zh_CN.d.ts +7 -0
- package/dist/legacy/locale/zh_CN.es.js +50 -0
- package/dist/legacy/locale/zh_CN.es.js.map +1 -0
- package/dist/legacy/operator.cjs +2 -0
- package/dist/legacy/operator.cjs.map +1 -0
- package/dist/legacy/operator.d.cts +218 -0
- package/dist/legacy/operator.d.ts +218 -0
- package/dist/legacy/operator.es.js +25 -0
- package/dist/legacy/operator.es.js.map +1 -0
- package/dist/legacy/queryable.cjs +2 -0
- package/dist/legacy/queryable.cjs.map +1 -0
- package/dist/legacy/queryable.d.cts +61 -0
- package/dist/legacy/queryable.d.ts +61 -0
- package/dist/legacy/queryable.es.js +34 -0
- package/dist/legacy/queryable.es.js.map +1 -0
- package/dist/legacy.cjs +1 -0
- package/dist/legacy.es.js +6 -0
- package/dist/model/abac.cjs +2 -0
- package/dist/model/abac.cjs.map +1 -0
- package/dist/model/abac.d.cts +33 -0
- package/dist/model/abac.d.ts +33 -0
- package/dist/model/abac.es.js +6 -0
- package/dist/model/abac.es.js.map +1 -0
- package/dist/model/bi.cjs +2 -0
- package/dist/model/bi.cjs.map +1 -0
- package/dist/model/bi.d.cts +12 -0
- package/dist/model/bi.d.ts +12 -0
- package/dist/model/bi.es.js +8 -0
- package/dist/model/bi.es.js.map +1 -0
- package/dist/model/command.cjs +2 -0
- package/dist/model/command.cjs.map +1 -0
- package/dist/model/command.d.cts +137 -0
- package/dist/model/command.d.ts +137 -0
- package/dist/model/command.es.js +8 -0
- package/dist/model/command.es.js.map +1 -0
- package/dist/model/common.d.cts +19 -0
- package/dist/model/common.d.ts +19 -0
- package/dist/model/function.cjs +2 -0
- package/dist/model/function.cjs.map +1 -0
- package/dist/model/function.d.cts +41 -0
- package/dist/model/function.d.ts +41 -0
- package/dist/model/function.es.js +8 -0
- package/dist/model/function.es.js.map +1 -0
- package/dist/model/index.d.cts +22 -0
- package/dist/model/index.d.ts +22 -0
- package/dist/model/messaging.d.cts +5 -0
- package/dist/model/messaging.d.ts +5 -0
- package/dist/model/modeling.d.cts +145 -0
- package/dist/model/modeling.d.ts +145 -0
- package/dist/model/naming.d.cts +27 -0
- package/dist/model/naming.d.ts +27 -0
- package/dist/transport/endpoints.cjs +2 -0
- package/dist/transport/endpoints.cjs.map +1 -0
- package/dist/transport/endpoints.d.cts +79 -0
- package/dist/transport/endpoints.d.ts +79 -0
- package/dist/transport/endpoints.es.js +14 -0
- package/dist/transport/endpoints.es.js.map +1 -0
- package/dist/transport/eventStreams.cjs +2 -0
- package/dist/transport/eventStreams.cjs.map +1 -0
- package/dist/transport/eventStreams.d.cts +23 -0
- package/dist/transport/eventStreams.d.ts +23 -0
- package/dist/transport/eventStreams.es.js +22 -0
- package/dist/transport/eventStreams.es.js.map +1 -0
- package/dist/transport/index.d.cts +1 -0
- package/dist/transport/index.d.ts +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The codes a rejected query carries as `BindingError.code`: which rule the
|
|
3
|
+
* request broke, stable where the human text (`errorMsg`) is not.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors `QueryErrorCodes` in
|
|
6
|
+
* `wow-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`, which the
|
|
7
|
+
* server also publishes as the `BindingError.code` enum of its OpenAPI
|
|
8
|
+
* document. The list is open: Wow adds codes and never renames or reuses one,
|
|
9
|
+
* so a client treats a code it does not know as a generic rejection and shows
|
|
10
|
+
* `errorMsg`. {@link QueryErrorCode} admits those codes too.
|
|
11
|
+
*
|
|
12
|
+
* Three groups, which `BindingError.name` locates differently:
|
|
13
|
+
* - decoding the request body (`errorCode` `IllegalArgument`): `name` is the
|
|
14
|
+
* JSON path of the offending value, such as `filter.state` or `metrics[0]`,
|
|
15
|
+
* or `body` for the body as a whole;
|
|
16
|
+
* - the entry's budget and gates (`errorCode` `IllegalArgument`): `name` is
|
|
17
|
+
* the part of the request the rule bounds, such as `limit` or `filter`;
|
|
18
|
+
* - admission against the query model (`errorCode` `QuerySchemaValidation`):
|
|
19
|
+
* `name` is the absolute logical field path, such as `state.items.sku`, or
|
|
20
|
+
* `''` when the rule is about the model rather than one field.
|
|
21
|
+
*
|
|
22
|
+
* Budget and gate rejections carry a code from Wow 9.2 on; an older server
|
|
23
|
+
* answers them with text alone (`HTTP list query limit[...] must be …`). A
|
|
24
|
+
* failure of the server itself is no rejection: it answers HTTP 500
|
|
25
|
+
* `InternalServerError` without a binding error.
|
|
26
|
+
*/
|
|
27
|
+
export declare const QueryErrorCodes: Readonly<{
|
|
28
|
+
/** The body is not valid JSON. */
|
|
29
|
+
readonly INVALID_JSON: "INVALID_JSON";
|
|
30
|
+
/** The body is JSON but not an object. */
|
|
31
|
+
readonly BODY_NOT_OBJECT: "BODY_NOT_OBJECT";
|
|
32
|
+
/** The body is empty. */
|
|
33
|
+
readonly EMPTY_BODY: "EMPTY_BODY";
|
|
34
|
+
/** The body has a property the query type does not declare. */
|
|
35
|
+
readonly UNKNOWN_PROPERTY: "UNKNOWN_PROPERTY";
|
|
36
|
+
/** An `op`, metric or other type discriminator names no known type. */
|
|
37
|
+
readonly UNKNOWN_TYPE: "UNKNOWN_TYPE";
|
|
38
|
+
/** An enum value is not one the server knows. */
|
|
39
|
+
readonly UNKNOWN_VALUE: "UNKNOWN_VALUE";
|
|
40
|
+
/** A value is missing or has the wrong JSON type. */
|
|
41
|
+
readonly INVALID_VALUE: "INVALID_VALUE";
|
|
42
|
+
/** Any other request rule; the message names it. */
|
|
43
|
+
readonly INVALID_REQUEST: "INVALID_REQUEST";
|
|
44
|
+
/** A cursor sort names a field twice; `path` is the repeated field. */
|
|
45
|
+
readonly CURSOR_SORT_DUPLICATE: "CURSOR_SORT_DUPLICATE";
|
|
46
|
+
/** A cursor sort has too many fields once the identity tie-breaker is appended. */
|
|
47
|
+
readonly CURSOR_SORT_TOO_MANY: "CURSOR_SORT_TOO_MANY";
|
|
48
|
+
/**
|
|
49
|
+
* The cursor token was not issued for this model and effective sort, or
|
|
50
|
+
* does not decode; `path` is `cursor`. Start again from the first page.
|
|
51
|
+
*/
|
|
52
|
+
readonly INVALID_CURSOR: "INVALID_CURSOR";
|
|
53
|
+
/**
|
|
54
|
+
* The entry's budget: a list or aggregation `limit`, a page's index, size,
|
|
55
|
+
* window or offset, or a cursor page's `size` is out of range; `path` names
|
|
56
|
+
* which (`limit`, `pagination.size`, `size`, …).
|
|
57
|
+
*/
|
|
58
|
+
readonly SIZE_OUT_OF_RANGE: "SIZE_OUT_OF_RANGE";
|
|
59
|
+
/**
|
|
60
|
+
* The entry's budget: the filter or `having` has too many nodes or values;
|
|
61
|
+
* `path` is `filter` or `having`.
|
|
62
|
+
*/
|
|
63
|
+
readonly FILTER_TOO_LARGE: "FILTER_TOO_LARGE";
|
|
64
|
+
/**
|
|
65
|
+
* The entry does not allow expensive operators, and the query uses one: an
|
|
66
|
+
* operator, an element expansion, a metric sort, an arithmetic or
|
|
67
|
+
* expression group, a date part, a dense fill or FIRST / LAST; `path` names
|
|
68
|
+
* the part (`filter`, `elements`, `sort`, `metrics`, `groupBy`).
|
|
69
|
+
*/
|
|
70
|
+
readonly EXPENSIVE_OPERATOR_DISABLED: "EXPENSIVE_OPERATOR_DISABLED";
|
|
71
|
+
/**
|
|
72
|
+
* A counting query (count, or a paged query's total) would match every
|
|
73
|
+
* record, which the entry refuses; `path` is `filter`.
|
|
74
|
+
*/
|
|
75
|
+
readonly COUNT_REQUIRES_FILTER: "COUNT_REQUIRES_FILTER";
|
|
76
|
+
/**
|
|
77
|
+
* A `having` or metric sort the storage evaluates after grouping read more
|
|
78
|
+
* groups than the server allows; `path` is `body`. It may end a stream
|
|
79
|
+
* partway through.
|
|
80
|
+
*/
|
|
81
|
+
readonly RESIDUAL_GROUPS_EXCEEDED: "RESIDUAL_GROUPS_EXCEEDED";
|
|
82
|
+
/**
|
|
83
|
+
* An in-process query named no entry where one is required. Never
|
|
84
|
+
* answered over HTTP; listed so the mirror stays complete.
|
|
85
|
+
*/
|
|
86
|
+
readonly EXPLICIT_ENTRY_REQUIRED: "EXPLICIT_ENTRY_REQUIRED";
|
|
87
|
+
/** The model has no such logical field. */
|
|
88
|
+
readonly UNKNOWN_FIELD: "UNKNOWN_FIELD";
|
|
89
|
+
/** The field does not offer the capability the query uses (sort, range, …). */
|
|
90
|
+
readonly UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY";
|
|
91
|
+
/** The field is an element field and must be queried inside its element scope. */
|
|
92
|
+
readonly ELEMENT_SCOPE_REQUIRED: "ELEMENT_SCOPE_REQUIRED";
|
|
93
|
+
/** A filter value falls outside the field's declared domain. */
|
|
94
|
+
readonly VALUE_MISMATCH: "VALUE_MISMATCH";
|
|
95
|
+
/** The field is not a known collection (for example under `isEmpty`). */
|
|
96
|
+
readonly NOT_COLLECTION: "NOT_COLLECTION";
|
|
97
|
+
/** The field is not a single string. */
|
|
98
|
+
readonly NOT_SINGLE_STRING: "NOT_SINGLE_STRING";
|
|
99
|
+
/** The model does not support search. */
|
|
100
|
+
readonly MODEL_SEARCH_UNSUPPORTED: "MODEL_SEARCH_UNSUPPORTED";
|
|
101
|
+
/** The field cannot be used for a cursor. */
|
|
102
|
+
readonly CURSOR_NOT_ALLOWED: "CURSOR_NOT_ALLOWED";
|
|
103
|
+
/** The field is protected and cannot be aggregated. */
|
|
104
|
+
readonly PROTECTED_AGGREGATION: "PROTECTED_AGGREGATION";
|
|
105
|
+
/**
|
|
106
|
+
* The field is protected and cannot be filtered or sorted: its descriptor
|
|
107
|
+
* says `sensitivity.comparable: false`. A search that names it is refused
|
|
108
|
+
* the same way.
|
|
109
|
+
*/
|
|
110
|
+
readonly PROTECTED_COMPARISON: "PROTECTED_COMPARISON";
|
|
111
|
+
/** A terms group's `missingKey` needs a single-valued string field. */
|
|
112
|
+
readonly MISSING_KEY_REQUIRES_STRING: "MISSING_KEY_REQUIRES_STRING";
|
|
113
|
+
/** `ANY` needs a single value. */
|
|
114
|
+
readonly ANY_REQUIRES_SINGLE_VALUE: "ANY_REQUIRES_SINGLE_VALUE";
|
|
115
|
+
/** The storage cannot deliver a complete projection; select fields explicitly. */
|
|
116
|
+
readonly INCOMPLETE_PROJECTION: "INCOMPLETE_PROJECTION";
|
|
117
|
+
/** A metric filter uses a search filter. */
|
|
118
|
+
readonly METRIC_FILTER_SEARCH: "METRIC_FILTER_SEARCH";
|
|
119
|
+
/** A metric filter uses `ELEMENT_MATCH`. */
|
|
120
|
+
readonly METRIC_FILTER_ELEMENT_MATCH: "METRIC_FILTER_ELEMENT_MATCH";
|
|
121
|
+
/** A metric filter names an array field; it must be scalar. */
|
|
122
|
+
readonly METRIC_FILTER_ARRAY_FIELD: "METRIC_FILTER_ARRAY_FIELD";
|
|
123
|
+
/** The field cannot be projected. */
|
|
124
|
+
readonly NOT_PROJECTABLE: "NOT_PROJECTABLE";
|
|
125
|
+
/** An event projection that keeps payloads must keep their `bodyType`. */
|
|
126
|
+
readonly EVENT_PROJECTION_TYPE_REQUIRED: "EVENT_PROJECTION_TYPE_REQUIRED";
|
|
127
|
+
/** A relative-time filter needs a field with a known temporal representation. */
|
|
128
|
+
readonly TEMPORAL_REPRESENTATION_REQUIRED: "TEMPORAL_REPRESENTATION_REQUIRED";
|
|
129
|
+
/** A relative-time filter's zone, pattern or unit conflicts with the field's definition. */
|
|
130
|
+
readonly TEMPORAL_CONFIGURATION_CONFLICT: "TEMPORAL_CONFIGURATION_CONFLICT";
|
|
131
|
+
/**
|
|
132
|
+
* A sort names two array fields on independent arrays, which the storage
|
|
133
|
+
* cannot order by together; `path` is the second of them. The descriptor
|
|
134
|
+
* lists such fields under a `PARALLEL_ARRAY_SORT` constraint.
|
|
135
|
+
*/
|
|
136
|
+
readonly PARALLEL_ARRAY_SORT: "PARALLEL_ARRAY_SORT";
|
|
137
|
+
/**
|
|
138
|
+
* An `EQ` or `NE` compares the field to an array, which the storage cannot
|
|
139
|
+
* do: it takes only a scalar operand. The descriptor says so with an
|
|
140
|
+
* `ARRAY_EQUALITY` constraint.
|
|
141
|
+
*/
|
|
142
|
+
readonly ARRAY_EQUALITY: "ARRAY_EQUALITY";
|
|
143
|
+
/**
|
|
144
|
+
* A `FIRST` or `LAST` metric names a field that may hold several values;
|
|
145
|
+
* it needs a single-valued one (`aggregate.firstLast` in the descriptor).
|
|
146
|
+
*/
|
|
147
|
+
readonly FIRST_LAST_REQUIRES_SINGLE_VALUE: "FIRST_LAST_REQUIRES_SINGLE_VALUE";
|
|
148
|
+
/**
|
|
149
|
+
* A `FIRST` or `LAST` metric names no `orderBy` where there is no event
|
|
150
|
+
* time to order by, such as inside an element or on a model whose
|
|
151
|
+
* descriptor has no `analysis.firstLastOrderBy`; `path` is its field.
|
|
152
|
+
*/
|
|
153
|
+
readonly FIRST_LAST_REQUIRES_ORDER_BY: "FIRST_LAST_REQUIRES_ORDER_BY";
|
|
154
|
+
/**
|
|
155
|
+
* A date group or date difference names a field that stores neither a
|
|
156
|
+
* date nor an epoch (a formatted string, say), so it cannot be aggregated
|
|
157
|
+
* by time.
|
|
158
|
+
*/
|
|
159
|
+
readonly TEMPORAL_AGGREGATION_UNSUPPORTED: "TEMPORAL_AGGREGATION_UNSUPPORTED";
|
|
160
|
+
/** The sort has more fields than the protocol allows; `path` is `''`. */
|
|
161
|
+
readonly SORT_TOO_MANY: "SORT_TOO_MANY";
|
|
162
|
+
/** Two sort fields name the same stored field; `path` is the second. */
|
|
163
|
+
readonly SORT_FIELD_DUPLICATE: "SORT_FIELD_DUPLICATE";
|
|
164
|
+
/**
|
|
165
|
+
* An identity filter or a cursor on a model that defines no record
|
|
166
|
+
* identity; `path` is `''`.
|
|
167
|
+
*/
|
|
168
|
+
readonly IDENTITY_UNDEFINED: "IDENTITY_UNDEFINED";
|
|
169
|
+
/**
|
|
170
|
+
* The storage does not support the feature the query uses, or its native
|
|
171
|
+
* query language cannot express it (a MongoDB PHRASE search with a quote,
|
|
172
|
+
* say); `path` is the field, or `''`.
|
|
173
|
+
*/
|
|
174
|
+
readonly STORAGE_UNSUPPORTED: "STORAGE_UNSUPPORTED";
|
|
175
|
+
}>;
|
|
176
|
+
/** One of the codes this package knows; see {@link QueryErrorCodes}. */
|
|
177
|
+
export type KnownQueryErrorCode = (typeof QueryErrorCodes)[keyof typeof QueryErrorCodes];
|
|
178
|
+
/**
|
|
179
|
+
* The code of a rejected query: one this package knows, which editors
|
|
180
|
+
* complete, or one a newer server added.
|
|
181
|
+
*/
|
|
182
|
+
export type QueryErrorCode = KnownQueryErrorCode | (string & {});
|
|
183
|
+
/**
|
|
184
|
+
* Why the server rejected a request, read from its first binding error that
|
|
185
|
+
* carries a code: which rule failed, where, and the server's words.
|
|
186
|
+
*/
|
|
187
|
+
export interface QueryViolation {
|
|
188
|
+
/** Which rule failed; switch on it against {@link QueryErrorCodes}. */
|
|
189
|
+
code: QueryErrorCode;
|
|
190
|
+
/**
|
|
191
|
+
* Where: the JSON path of the offending value for a decoding error
|
|
192
|
+
* (`filter.state`, `metrics[0]`, `body`), the absolute logical field path
|
|
193
|
+
* for an admission error (`state.items.sku`), or `''` when the rule is about
|
|
194
|
+
* the model rather than a field.
|
|
195
|
+
*/
|
|
196
|
+
path: string;
|
|
197
|
+
/** The server's words, the same as the error's `errorMsg`. */
|
|
198
|
+
message: string;
|
|
199
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/error/queryErrorCodes.ts
|
|
2
|
+
var e = Object.freeze({
|
|
3
|
+
INVALID_JSON: "INVALID_JSON",
|
|
4
|
+
BODY_NOT_OBJECT: "BODY_NOT_OBJECT",
|
|
5
|
+
EMPTY_BODY: "EMPTY_BODY",
|
|
6
|
+
UNKNOWN_PROPERTY: "UNKNOWN_PROPERTY",
|
|
7
|
+
UNKNOWN_TYPE: "UNKNOWN_TYPE",
|
|
8
|
+
UNKNOWN_VALUE: "UNKNOWN_VALUE",
|
|
9
|
+
INVALID_VALUE: "INVALID_VALUE",
|
|
10
|
+
INVALID_REQUEST: "INVALID_REQUEST",
|
|
11
|
+
CURSOR_SORT_DUPLICATE: "CURSOR_SORT_DUPLICATE",
|
|
12
|
+
CURSOR_SORT_TOO_MANY: "CURSOR_SORT_TOO_MANY",
|
|
13
|
+
INVALID_CURSOR: "INVALID_CURSOR",
|
|
14
|
+
SIZE_OUT_OF_RANGE: "SIZE_OUT_OF_RANGE",
|
|
15
|
+
FILTER_TOO_LARGE: "FILTER_TOO_LARGE",
|
|
16
|
+
EXPENSIVE_OPERATOR_DISABLED: "EXPENSIVE_OPERATOR_DISABLED",
|
|
17
|
+
COUNT_REQUIRES_FILTER: "COUNT_REQUIRES_FILTER",
|
|
18
|
+
RESIDUAL_GROUPS_EXCEEDED: "RESIDUAL_GROUPS_EXCEEDED",
|
|
19
|
+
EXPLICIT_ENTRY_REQUIRED: "EXPLICIT_ENTRY_REQUIRED",
|
|
20
|
+
UNKNOWN_FIELD: "UNKNOWN_FIELD",
|
|
21
|
+
UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY",
|
|
22
|
+
ELEMENT_SCOPE_REQUIRED: "ELEMENT_SCOPE_REQUIRED",
|
|
23
|
+
VALUE_MISMATCH: "VALUE_MISMATCH",
|
|
24
|
+
NOT_COLLECTION: "NOT_COLLECTION",
|
|
25
|
+
NOT_SINGLE_STRING: "NOT_SINGLE_STRING",
|
|
26
|
+
MODEL_SEARCH_UNSUPPORTED: "MODEL_SEARCH_UNSUPPORTED",
|
|
27
|
+
CURSOR_NOT_ALLOWED: "CURSOR_NOT_ALLOWED",
|
|
28
|
+
PROTECTED_AGGREGATION: "PROTECTED_AGGREGATION",
|
|
29
|
+
PROTECTED_COMPARISON: "PROTECTED_COMPARISON",
|
|
30
|
+
MISSING_KEY_REQUIRES_STRING: "MISSING_KEY_REQUIRES_STRING",
|
|
31
|
+
ANY_REQUIRES_SINGLE_VALUE: "ANY_REQUIRES_SINGLE_VALUE",
|
|
32
|
+
INCOMPLETE_PROJECTION: "INCOMPLETE_PROJECTION",
|
|
33
|
+
METRIC_FILTER_SEARCH: "METRIC_FILTER_SEARCH",
|
|
34
|
+
METRIC_FILTER_ELEMENT_MATCH: "METRIC_FILTER_ELEMENT_MATCH",
|
|
35
|
+
METRIC_FILTER_ARRAY_FIELD: "METRIC_FILTER_ARRAY_FIELD",
|
|
36
|
+
NOT_PROJECTABLE: "NOT_PROJECTABLE",
|
|
37
|
+
EVENT_PROJECTION_TYPE_REQUIRED: "EVENT_PROJECTION_TYPE_REQUIRED",
|
|
38
|
+
TEMPORAL_REPRESENTATION_REQUIRED: "TEMPORAL_REPRESENTATION_REQUIRED",
|
|
39
|
+
TEMPORAL_CONFIGURATION_CONFLICT: "TEMPORAL_CONFIGURATION_CONFLICT",
|
|
40
|
+
PARALLEL_ARRAY_SORT: "PARALLEL_ARRAY_SORT",
|
|
41
|
+
ARRAY_EQUALITY: "ARRAY_EQUALITY",
|
|
42
|
+
FIRST_LAST_REQUIRES_SINGLE_VALUE: "FIRST_LAST_REQUIRES_SINGLE_VALUE",
|
|
43
|
+
FIRST_LAST_REQUIRES_ORDER_BY: "FIRST_LAST_REQUIRES_ORDER_BY",
|
|
44
|
+
TEMPORAL_AGGREGATION_UNSUPPORTED: "TEMPORAL_AGGREGATION_UNSUPPORTED",
|
|
45
|
+
SORT_TOO_MANY: "SORT_TOO_MANY",
|
|
46
|
+
SORT_FIELD_DUPLICATE: "SORT_FIELD_DUPLICATE",
|
|
47
|
+
IDENTITY_UNDEFINED: "IDENTITY_UNDEFINED",
|
|
48
|
+
STORAGE_UNSUPPORTED: "STORAGE_UNSUPPORTED"
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { e as QueryErrorCodes };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=queryErrorCodes.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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} 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;AACvB,CAAU"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,99 @@
|
|
|
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>;
|
|
@@ -0,0 +1,99 @@
|
|
|
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>;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dsl/filter/operator.cjs"),t=require("./dsl/aggregation/types.cjs"),n=require("./dsl/deletionState.cjs"),r=require("./dsl/filter/builders.cjs"),i=require("./dsl/sort.cjs"),a=require("./dsl/aggregation/builders.cjs"),o=require("./dsl/projection.cjs"),s=require("./dsl/pagination.cjs"),c=require("./dsl/cursorQuery.cjs"),l=require("./dsl/queryable.cjs"),u=require("./dsl/descriptor.cjs"),d=require("./error/errorInfo.cjs"),f=require("./error/headers.cjs"),p=require("./error/wowError.cjs"),m=require("./model/command.cjs"),h=require("./transport/endpoints.cjs"),g=require("./client/command/commandClient.cjs"),_=require("./client/command/commandHeaders.cjs"),v=require("./model/abac.cjs"),y=require("./model/bi.cjs"),b=require("./model/function.cjs"),x=require("./client/command/commandRequest.cjs"),S=require("./client/metadata/wowMetadataClient.cjs"),C=require("./client/query/event/domainEventStream.cjs"),w=require("./client/query/event/eventStreamQueryClient.cjs"),T=require("./client/query/snapshot/snapshot.cjs"),E=require("./client/query/snapshot/snapshotQueryClient.cjs"),D=require("./client/query/state/loadStateAggregateClient.cjs"),O=require("./client/query/state/loadOwnerStateAggregateClient.cjs"),k=require("./client/query/descriptor/queryDescriptorClient.cjs"),A=require("./client/query/factory.cjs"),j=require("./client/routing.cjs"),M=require("./error/queryErrorCodes.cjs");exports.AGGREGATION_LIMITS=t.AGGREGATION_LIMITS,exports.AggregationDatePart=t.AggregationDatePart,exports.AggregationDateUnit=t.AggregationDateUnit,exports.AggregationExpressionOperator=t.AggregationExpressionOperator,exports.AggregationExpressionType=t.AggregationExpressionType,exports.AggregationFunction=t.AggregationFunction,exports.AggregationGroupType=t.AggregationGroupType,exports.AggregationMetricType=t.AggregationMetricType,exports.COMMAND_STREAM_ENDPOINT=h.COMMAND_STREAM_ENDPOINT,Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return g.CommandClient}}),exports.CommandHeaders=_.CommandHeaders,exports.CommandStage=m.CommandStage,exports.ComparisonOperator=t.ComparisonOperator,exports.DEFAULT_CURSOR_SIZE=c.DEFAULT_CURSOR_SIZE,exports.DEFAULT_PAGINATION=s.DEFAULT_PAGINATION,exports.DateDiffUnit=t.DateDiffUnit,exports.DeletionState=n.DeletionState,exports.DerivedExpressionType=t.DerivedExpressionType,exports.DomainEventStreamMetadataFields=C.DomainEventStreamMetadataFields,exports.EMPTY_ABAC_TAGS=v.EMPTY_ABAC_TAGS,exports.ErrorCodes=d.ErrorCodes,Object.defineProperty(exports,"EventStreamQueryClient",{enumerable:!0,get:function(){return w.EventStreamQueryClient}}),exports.FilterOperator=e.FilterOperator,exports.FunctionKind=b.FunctionKind,exports.HavingExpressionType=t.HavingExpressionType,Object.defineProperty(exports,"LoadOwnerStateAggregateClient",{enumerable:!0,get:function(){return O.LoadOwnerStateAggregateClient}}),Object.defineProperty(exports,"LoadStateAggregateClient",{enumerable:!0,get:function(){return D.LoadStateAggregateClient}}),exports.MAX_CURSOR_SIZE=c.MAX_CURSOR_SIZE,exports.MAX_CURSOR_SORT_FIELDS=c.MAX_CURSOR_SORT_FIELDS,exports.MessageHeaderSqlType=y.MessageHeaderSqlType,exports.PagingMode=u.PagingMode,exports.QUERY_STREAM_ENDPOINT=h.QUERY_STREAM_ENDPOINT,exports.QueryClientFactory=A.QueryClientFactory,exports.QueryConstraintTypes=u.QueryConstraintTypes,exports.QueryDescriptorClient=k.QueryDescriptorClient,exports.QueryErrorCodes=M.QueryErrorCodes,exports.QueryFieldRoles=u.QueryFieldRoles,exports.QueryModels=u.QueryModels,exports.QueryValueKind=u.QueryValueKind,exports.QueryValueTypes=u.QueryValueTypes,exports.RecoverableType=d.RecoverableType,exports.ResourceAttributionPathSpec=j.ResourceAttributionPathSpec,exports.SearchMode=e.SearchMode,exports.SensitivityLevel=u.SensitivityLevel,exports.SnapshotMetadataFields=T.SnapshotMetadataFields,Object.defineProperty(exports,"SnapshotQueryClient",{enumerable:!0,get:function(){return E.SnapshotQueryClient}}),exports.SortDirection=i.SortDirection,exports.StringComparison=e.StringComparison,exports.TimeUnit=e.TimeUnit,exports.WILDCARD_ABAC_TAG_VALUES=v.WILDCARD_ABAC_TAG_VALUES,exports.WowError=p.WowError,exports.WowHeaders=f.WowHeaders,Object.defineProperty(exports,"WowMetadataClient",{enumerable:!0,get:function(){return S.WowMetadataClient}}),exports.aggregation=a.aggregation,exports.asc=i.asc,exports.commandHeaders=x.commandHeaders,exports.cursorQuery=c.cursorQuery,exports.desc=i.desc,exports.filter=r.filter,exports.isErrorInfo=p.isErrorInfo,exports.listQuery=l.listQuery,exports.pagedList=l.pagedList,exports.pagedQuery=l.pagedQuery,exports.pagination=s.pagination,exports.projection=o.projection,exports.singleQuery=l.singleQuery,exports.toWowError=p.toWowError,exports.waitStrategy=x.waitStrategy;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './dsl/filter/index.cjs';
|
|
2
|
+
export * from './dsl/aggregation/index.cjs';
|
|
3
|
+
export * from './dsl/sort.cjs';
|
|
4
|
+
export * from './dsl/projection.cjs';
|
|
5
|
+
export * from './dsl/pagination.cjs';
|
|
6
|
+
export * from './dsl/cursorQuery.cjs';
|
|
7
|
+
export * from './dsl/queryable.cjs';
|
|
8
|
+
export * from './dsl/deletionState.cjs';
|
|
9
|
+
export * from './dsl/documents.cjs';
|
|
10
|
+
export * from './dsl/descriptor.cjs';
|
|
11
|
+
export * from './client/command/index.cjs';
|
|
12
|
+
export * from './client/metadata/index.cjs';
|
|
13
|
+
export * from './client/query/index.cjs';
|
|
14
|
+
export * from './client/routing.cjs';
|
|
15
|
+
export * from './transport/index.cjs';
|
|
16
|
+
export * from './model/index.cjs';
|
|
17
|
+
export * from './error/index.cjs';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './dsl/filter/index.js';
|
|
2
|
+
export * from './dsl/aggregation/index.js';
|
|
3
|
+
export * from './dsl/sort.js';
|
|
4
|
+
export * from './dsl/projection.js';
|
|
5
|
+
export * from './dsl/pagination.js';
|
|
6
|
+
export * from './dsl/cursorQuery.js';
|
|
7
|
+
export * from './dsl/queryable.js';
|
|
8
|
+
export * from './dsl/deletionState.js';
|
|
9
|
+
export * from './dsl/documents.js';
|
|
10
|
+
export * from './dsl/descriptor.js';
|
|
11
|
+
export * from './client/command/index.js';
|
|
12
|
+
export * from './client/metadata/index.js';
|
|
13
|
+
export * from './client/query/index.js';
|
|
14
|
+
export * from './client/routing.js';
|
|
15
|
+
export * from './transport/index.js';
|
|
16
|
+
export * from './model/index.js';
|
|
17
|
+
export * from './error/index.js';
|