@tstdl/base 0.81.35 → 0.82.1
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/api/client/client.d.ts +3 -3
- package/api/default-error-handlers.d.ts +1 -1
- package/api/response.d.ts +8 -8
- package/api/server/api-controller.d.ts +1 -1
- package/api/server/gateway.d.ts +9 -9
- package/api/server/middlewares/cors.middleware.d.ts +1 -1
- package/api/server/module.d.ts +1 -1
- package/api/types.d.ts +30 -30
- package/api/utils.d.ts +1 -1
- package/api/utils.js +3 -1
- package/api/utils.js.map +1 -1
- package/authentication/authentication-credentials.service.d.ts +6 -0
- package/authentication/authentication-credentials.service.js +17 -0
- package/authentication/authentication-credentials.service.js.map +1 -0
- package/authentication/authentication-session.repository.d.ts +6 -0
- package/authentication/authentication-session.repository.js +18 -0
- package/authentication/authentication-session.repository.js.map +1 -0
- package/authentication/authentication-token-payload.provider.d.ts +3 -0
- package/authentication/authentication-token-payload.provider.js +17 -0
- package/authentication/authentication-token-payload.provider.js.map +1 -0
- package/authentication/authentication.service.d.ts +42 -0
- package/authentication/authentication.service.js +133 -0
- package/authentication/authentication.service.js.map +1 -0
- package/authentication/models/authentication-credentials.model.d.ts +11 -0
- package/authentication/models/authentication-credentials.model.js +44 -0
- package/authentication/models/authentication-credentials.model.js.map +1 -0
- package/authentication/models/authentication-session.model.d.ts +14 -0
- package/authentication/models/authentication-session.model.js +59 -0
- package/authentication/models/authentication-session.model.js.map +1 -0
- package/authentication/models/index.d.ts +2 -0
- package/authentication/models/index.js +19 -0
- package/authentication/models/index.js.map +1 -0
- package/authentication/tokens.d.ts +2 -0
- package/authentication/tokens.js +6 -0
- package/authentication/tokens.js.map +1 -0
- package/collections/keyed-set.d.ts +1 -1
- package/collections/observable/observable-collection.d.ts +1 -1
- package/collections/observable/observable-list.d.ts +2 -2
- package/container/container.d.ts +3 -3
- package/container/container.js +3 -3
- package/container/container.js.map +1 -1
- package/container/decorators.d.ts +3 -3
- package/container/decorators.js +0 -1
- package/container/decorators.js.map +1 -1
- package/container/interfaces.d.ts +1 -1
- package/container/provider.d.ts +6 -6
- package/container/resolve-chain.d.ts +2 -2
- package/container/resolve-chain.js +1 -1
- package/container/resolve-chain.js.map +1 -1
- package/container/token.d.ts +3 -3
- package/container/type-info.d.ts +1 -1
- package/container/types.d.ts +4 -4
- package/core.d.ts +1 -1
- package/data-structures/linked-list.d.ts +1 -1
- package/data-structures/multi-key-map.d.ts +2 -2
- package/data-structures/sorted-array-list.d.ts +1 -1
- package/database/entity-repository.d.ts +2 -2
- package/database/entity.d.ts +3 -3
- package/database/module.d.ts +1 -1
- package/database/mongo/classes.d.ts +3 -3
- package/database/mongo/model/document.d.ts +3 -3
- package/database/mongo/module.d.ts +1 -1
- package/database/mongo/mongo-base.repository.d.ts +11 -11
- package/database/mongo/mongo-bulk.d.ts +1 -1
- package/database/mongo/mongo-entity-repository.d.ts +7 -7
- package/database/mongo/types.d.ts +16 -16
- package/database/query.d.ts +38 -38
- package/disposable/async-disposer.d.ts +3 -3
- package/distributed-loop/distributed-loop.d.ts +2 -2
- package/error/custom.error.d.ts +1 -1
- package/http/client/adapters/undici-http-client.adapter.d.ts +1 -1
- package/http/client/http-client-request.d.ts +5 -5
- package/http/client/http-client-response.d.ts +2 -2
- package/http/client/http-client.d.ts +5 -5
- package/http/http-body.d.ts +3 -1
- package/http/http-body.js +18 -12
- package/http/http-body.js.map +1 -1
- package/http/http-form.d.ts +2 -2
- package/http/http-headers.d.ts +3 -3
- package/http/http-query.d.ts +2 -2
- package/http/http-url-parameters.d.ts +2 -2
- package/http/http-value-map.d.ts +1 -1
- package/http/server/http-server-request.d.ts +1 -1
- package/http/server/http-server-response.d.ts +1 -1
- package/http/server/http-server.d.ts +1 -1
- package/http/server/node/node-http-server.d.ts +1 -1
- package/http/types.d.ts +5 -5
- package/http/utils.d.ts +3 -3
- package/image-service/imgproxy/imgproxy-image-service.d.ts +1 -1
- package/json-path/json-path.d.ts +4 -4
- package/key-value-store/key-value.store.d.ts +1 -1
- package/key-value-store/mongo/module.d.ts +1 -1
- package/key-value-store/mongo/mongo-key-value.model.d.ts +1 -1
- package/lock/lock.d.ts +4 -4
- package/lock/mongo/model.d.ts +1 -1
- package/lock/mongo/module.d.ts +1 -1
- package/lock/provider.d.ts +1 -1
- package/logger/logger.d.ts +6 -6
- package/mail/mail.client.d.ts +1 -1
- package/mail/mail.service.d.ts +3 -1
- package/mail/mail.service.js +11 -6
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-address.model.d.ts +1 -1
- package/mail/models/mail-content.model.d.ts +1 -1
- package/mail/models/mail-data.model.d.ts +2 -1
- package/mail/models/mail-log.model.d.ts +2 -2
- package/mail/models/mail-send-result.model.d.ts +1 -1
- package/mail/models/mail-template.model.d.ts +1 -1
- package/mail/module.d.ts +4 -2
- package/mail/module.js +6 -2
- package/mail/module.js.map +1 -1
- package/mail/repositories/mongo-mail-log.repository.d.ts +2 -2
- package/mail/tokens.d.ts +1 -0
- package/mail/tokens.js +2 -1
- package/mail/tokens.js.map +1 -1
- package/message-bus/local/types.d.ts +1 -1
- package/message-bus/message-bus.d.ts +1 -1
- package/migration/migration-state.d.ts +2 -2
- package/migration/migrator.d.ts +4 -4
- package/migration/mongo/module.d.ts +1 -1
- package/module/module-metric-reporter.d.ts +2 -2
- package/module/module.d.ts +1 -1
- package/module/modules/function.module.d.ts +1 -1
- package/module/modules/web-server.module.d.ts +1 -1
- package/notification/api.d.ts +3 -6
- package/notification/api.js +2 -5
- package/notification/api.js.map +1 -1
- package/notification/models/index.d.ts +2 -0
- package/notification/models/index.js +19 -0
- package/notification/models/index.js.map +1 -0
- package/notification/models/notification-channel-job.model.d.ts +3 -0
- package/notification/models/notification-channel-job.model.js +3 -0
- package/notification/models/notification-channel-job.model.js.map +1 -0
- package/notification/models/notification.model.d.ts +27 -0
- package/notification/{model.js → models/notification.model.js} +28 -16
- package/notification/models/notification.model.js.map +1 -0
- package/notification/module.d.ts +1 -1
- package/notification/notification-channel.service.d.ts +5 -0
- package/notification/notification-channel.service.js +7 -0
- package/notification/notification-channel.service.js.map +1 -0
- package/notification/notification.service.d.ts +8 -0
- package/notification/notification.service.js +40 -0
- package/notification/notification.service.js.map +1 -0
- package/object-storage/object-storage.d.ts +2 -2
- package/object-storage/object.d.ts +1 -1
- package/object-storage/s3/s3.object-storage-provider.d.ts +1 -1
- package/openid-connect/mongo-oidc-state.repository.d.ts +1 -1
- package/openid-connect/oidc-configuration.service.d.ts +1 -1
- package/openid-connect/oidc-state.model.d.ts +2 -2
- package/openid-connect/oidc.service-model.d.ts +8 -8
- package/orm/decorators.d.ts +26 -0
- package/orm/decorators.js +170 -0
- package/orm/decorators.js.map +1 -1
- package/orm/entity-definition.model.d.ts +51 -0
- package/orm/entity-definition.model.js +27 -0
- package/orm/entity-definition.model.js.map +1 -0
- package/orm/index.d.ts +1 -0
- package/orm/index.js +18 -0
- package/orm/index.js.map +1 -0
- package/orm/models/entity.d.ts +22 -0
- package/orm/models/entity.js +87 -0
- package/orm/models/entity.js.map +1 -0
- package/orm/models/index.d.ts +1 -0
- package/orm/models/index.js +18 -0
- package/orm/models/index.js.map +1 -0
- package/orm/repository/mongo/classes.d.ts +25 -0
- package/orm/repository/mongo/classes.js +33 -0
- package/orm/repository/mongo/classes.js.map +1 -0
- package/orm/repository/mongo/module.d.ts +8 -0
- package/orm/repository/mongo/module.js +88 -0
- package/orm/repository/mongo/module.js.map +1 -0
- package/orm/repository/mongo/mongo-repository.d.ts +11 -0
- package/orm/repository/mongo/mongo-repository.js +55 -0
- package/orm/repository/mongo/mongo-repository.js.map +1 -0
- package/orm/repository/mongo/mongo-transaction.d.ts +10 -0
- package/orm/repository/mongo/mongo-transaction.js +28 -0
- package/orm/repository/mongo/mongo-transaction.js.map +1 -0
- package/orm/repository/repository.d.ts +75 -0
- package/orm/repository/repository.js +182 -0
- package/orm/repository/repository.js.map +1 -0
- package/orm/repository/transaction.d.ts +26 -0
- package/orm/repository/transaction.js +65 -0
- package/orm/repository/transaction.js.map +1 -0
- package/orm/{types.d.ts → types/definition.d.ts} +5 -5
- package/orm/{types.js → types/definition.js} +8 -8
- package/orm/types/definition.js.map +1 -0
- package/orm/types/index.d.ts +3 -0
- package/orm/types/index.js +20 -0
- package/orm/types/index.js.map +1 -0
- package/orm/types/options.d.ts +36 -0
- package/orm/types/options.js +5 -0
- package/orm/types/options.js.map +1 -0
- package/orm/types/query.d.ts +110 -0
- package/orm/types/query.js +10 -0
- package/orm/types/query.js.map +1 -0
- package/package.json +5 -5
- package/pdf/pdf.service.d.ts +3 -3
- package/pool/pool.d.ts +4 -4
- package/promise/cancelable-promise.d.ts +1 -1
- package/promise/lazy-promise.d.ts +1 -1
- package/queue/mongo/job.d.ts +2 -2
- package/queue/mongo/queue.js +2 -2
- package/queue/mongo/queue.js.map +1 -1
- package/queue/queue.d.ts +11 -6
- package/queue/queue.js +2 -1
- package/queue/queue.js.map +1 -1
- package/reflection/decorator-data.js +2 -1
- package/reflection/decorator-data.js.map +1 -1
- package/reflection/registry.d.ts +18 -17
- package/reflection/registry.js +25 -10
- package/reflection/registry.js.map +1 -1
- package/reflection/types.d.ts +34 -34
- package/reflection/utils.d.ts +8 -8
- package/reflection/utils.js +6 -6
- package/reflection/utils.js.map +1 -1
- package/rpc/endpoints/message-port.rpc-endpoint.d.ts +3 -3
- package/rpc/model.d.ts +22 -22
- package/rpc/rpc.d.ts +1 -1
- package/rxjs/intersection-observer.d.ts +1 -1
- package/rxjs/mutation-observer.d.ts +1 -1
- package/rxjs/performance-observer.d.ts +1 -1
- package/rxjs/resize-observer.d.ts +1 -1
- package/rxjs/slow-array.d.ts +1 -1
- package/rxjs/touch.d.ts +1 -1
- package/schema/array-constraints/maximum-length.d.ts +2 -2
- package/schema/array-constraints/maximum-length.js +2 -2
- package/schema/array-constraints/maximum-length.js.map +1 -1
- package/schema/array-constraints/minimum-length.d.ts +2 -2
- package/schema/array-constraints/minimum-length.js +2 -2
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/constraints/enumeration.d.ts +4 -4
- package/schema/constraints/enumeration.js +5 -5
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.d.ts +4 -4
- package/schema/constraints/generic.js +2 -2
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.d.ts +2 -2
- package/schema/constraints/integer.js +3 -2
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/length.d.ts +1 -1
- package/schema/constraints/literal.d.ts +2 -2
- package/schema/constraints/literal.js +2 -2
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.d.ts +2 -2
- package/schema/constraints/maximum-date.js +3 -2
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.d.ts +2 -2
- package/schema/constraints/maximum-length.js +2 -2
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.d.ts +2 -2
- package/schema/constraints/maximum.js +3 -2
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.d.ts +2 -2
- package/schema/constraints/minimum-date.js +3 -2
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.d.ts +2 -2
- package/schema/constraints/minimum-length.js +2 -2
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.d.ts +2 -2
- package/schema/constraints/minimum.js +3 -2
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.d.ts +2 -2
- package/schema/constraints/pattern.js +3 -2
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/types.d.ts +3 -3
- package/schema/decorators/utils.d.ts +4 -1
- package/schema/decorators/utils.js +1 -1
- package/schema/decorators/utils.js.map +1 -1
- package/schema/schema.d.ts +4 -4
- package/schema/schema.error.d.ts +1 -1
- package/schema/schema.js +10 -13
- package/schema/schema.js.map +1 -1
- package/schema/schemas/any.d.ts +1 -1
- package/schema/schemas/array.d.ts +2 -2
- package/schema/schemas/array.js +2 -2
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/boolean.d.ts +1 -1
- package/schema/schemas/date.d.ts +2 -2
- package/schema/schemas/date.js +2 -2
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/enumeration.d.ts +2 -2
- package/schema/schemas/enumeration.js +2 -2
- package/schema/schemas/enumeration.js.map +1 -1
- package/schema/schemas/instance.d.ts +1 -1
- package/schema/schemas/literal.d.ts +2 -2
- package/schema/schemas/literal.js +2 -2
- package/schema/schemas/literal.js.map +1 -1
- package/schema/schemas/nullable.d.ts +1 -1
- package/schema/schemas/number.d.ts +2 -2
- package/schema/schemas/number.js +2 -2
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/object.d.ts +1 -1
- package/schema/schemas/omit.d.ts +2 -2
- package/schema/schemas/omit.js.map +1 -1
- package/schema/schemas/one-or-many.d.ts +2 -2
- package/schema/schemas/optional.d.ts +1 -1
- package/schema/schemas/readable-stream.d.ts +1 -1
- package/schema/schemas/record.d.ts +1 -1
- package/schema/schemas/regexp.d.ts +1 -1
- package/schema/schemas/string.d.ts +2 -2
- package/schema/schemas/string.js +3 -3
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +2 -2
- package/schema/schemas/uint8-array.js +3 -3
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/schemas/union.d.ts +1 -1
- package/schema/schemas/unknown.d.ts +1 -1
- package/schema/transformers/generic.d.ts +1 -1
- package/schema/types/index.d.ts +5 -0
- package/schema/types/index.js +22 -0
- package/schema/types/index.js.map +1 -0
- package/schema/types/schema-array-constraint.d.ts +5 -0
- package/schema/types/schema-array-constraint.js +7 -0
- package/schema/types/schema-array-constraint.js.map +1 -0
- package/schema/types/schema-value-coercer.d.ts +8 -0
- package/schema/types/schema-value-coercer.js +7 -0
- package/schema/types/schema-value-coercer.js.map +1 -0
- package/schema/types/schema-value-constraint.d.ts +8 -0
- package/schema/types/schema-value-constraint.js +7 -0
- package/schema/types/schema-value-constraint.js.map +1 -0
- package/schema/types/schema-value-transformer.d.ts +7 -0
- package/schema/types/schema-value-transformer.js +7 -0
- package/schema/types/schema-value-transformer.js.map +1 -0
- package/schema/{types.d.ts → types/types.d.ts} +47 -57
- package/schema/types/types.js +174 -0
- package/schema/types/types.js.map +1 -0
- package/schema/utils/schema.js +1 -1
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +1 -1
- package/schema/utils/value-type.js +1 -1
- package/schema/utils/value-type.js.map +1 -1
- package/search-index/elastic/config.d.ts +1 -1
- package/search-index/elastic/model/elastic-query.d.ts +15 -15
- package/search-index/elastic/model/index-mapping.d.ts +14 -14
- package/search-index/elastic/model/sort.d.ts +3 -3
- package/search-index/elastic/module.d.ts +1 -1
- package/search-index/search-index.d.ts +1 -1
- package/search-index/search-result.d.ts +2 -2
- package/serializer/handlers/error.d.ts +1 -1
- package/serializer/handlers/map.d.ts +1 -1
- package/serializer/handlers/regex.d.ts +1 -1
- package/serializer/handlers/set.d.ts +1 -1
- package/serializer/serializable.d.ts +6 -6
- package/serializer/serializer.d.ts +1 -1
- package/serializer/types.d.ts +15 -15
- package/sse/server-sent-events.d.ts +3 -3
- package/tailwind/theme-adapter.d.ts +1 -1
- package/templates/module.d.ts +1 -1
- package/templates/providers/file.provider-template.d.ts +2 -2
- package/templates/providers/file.provider-template.js +2 -1
- package/templates/providers/file.provider-template.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.d.ts +9 -9
- package/templates/renderers/mjml.template-renderer.d.ts +3 -3
- package/templates/renderers/string.template-renderer.d.ts +1 -1
- package/templates/resolvers/file.template-resolver.d.ts +2 -2
- package/templates/template.model.d.ts +1 -1
- package/templates/template.renderer.d.ts +4 -4
- package/templates/template.service.d.ts +1 -1
- package/text/dynamic-text.model.d.ts +1 -1
- package/text/localizable-text.model.d.ts +1 -1
- package/text/localization.service.d.ts +11 -11
- package/theme/theme-service.d.ts +6 -6
- package/threading/thread-pool.d.ts +1 -1
- package/threading/thread-worker.d.ts +1 -1
- package/types/geo-json.d.ts +12 -12
- package/types.d.ts +91 -91
- package/utils/any-iterable-iterator.d.ts +3 -3
- package/utils/array/array.d.ts +14 -1
- package/utils/array/array.js +16 -2
- package/utils/array/array.js.map +1 -1
- package/utils/async-iterable-helpers/parallel/types.d.ts +2 -2
- package/utils/async-iterable-helpers/types.d.ts +7 -7
- package/utils/backoff.d.ts +5 -5
- package/utils/benchmark.d.ts +1 -1
- package/utils/binary-search.d.ts +1 -1
- package/utils/binary.js.map +1 -1
- package/utils/cancellation-token.d.ts +1 -1
- package/utils/compression.d.ts +1 -1
- package/utils/cryptography.d.ts +11 -11
- package/utils/date-time.d.ts +8 -7
- package/utils/date-time.js +6 -2
- package/utils/date-time.js.map +1 -1
- package/utils/equals.d.ts +3 -3
- package/utils/factory-map.d.ts +1 -1
- package/utils/format-error.d.ts +1 -1
- package/utils/function/memoize.d.ts +1 -1
- package/utils/helpers.d.ts +1 -1
- package/utils/iterable-helpers/types.d.ts +6 -6
- package/utils/jwt.d.ts +4 -4
- package/utils/math.d.ts +1 -1
- package/utils/merge.d.ts +1 -1
- package/utils/middleware.d.ts +9 -9
- package/utils/moving-metric.d.ts +1 -1
- package/utils/object/decycle.d.ts +1 -1
- package/utils/object/dereference.d.ts +1 -1
- package/utils/object/forward-ref.d.ts +2 -2
- package/utils/object/lazy-property.d.ts +5 -5
- package/utils/object/merge.d.ts +1 -1
- package/utils/object/object.js +1 -2
- package/utils/object/object.js.map +1 -1
- package/utils/object/property-name.d.ts +5 -5
- package/utils/patch-worker.d.ts +1 -1
- package/utils/periodic-sampler.d.ts +1 -1
- package/utils/provider-function-iterable.d.ts +2 -2
- package/utils/proxy.d.ts +1 -1
- package/utils/singleton.d.ts +2 -2
- package/utils/sort.d.ts +2 -2
- package/utils/stream/stream-helper-types.d.ts +5 -5
- package/utils/type-guards.d.ts +3 -3
- package/utils/url-builder.d.ts +4 -4
- package/web-types.d.ts +4 -4
- package/notification/model.d.ts +0 -18
- package/notification/model.js.map +0 -1
- package/orm/mongo/mongo-repository.d.ts +0 -2
- package/orm/mongo/mongo-repository.js +0 -7
- package/orm/mongo/mongo-repository.js.map +0 -1
- package/orm/types.js.map +0 -1
- package/schema/types.js +0 -102
- package/schema/types.js.map +0 -1
|
@@ -8,41 +8,41 @@ export declare const enum ProjectionMode {
|
|
|
8
8
|
Include = 0,
|
|
9
9
|
Exclude = 1
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type Projection<T, M extends ProjectionMode> = {
|
|
12
12
|
[P in keyof T]?: M extends ProjectionMode.Include ? true : false;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ProjectedEntity<T, M extends ProjectionMode, P extends Projection<T, M>> = M extends ProjectionMode.Include ? {
|
|
15
15
|
[K in keyof T]: P[K] extends true ? T[K] : undefined;
|
|
16
16
|
} : {
|
|
17
17
|
[K in keyof T]: P[K] extends false ? undefined : T[K];
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ReplaceOptions = {
|
|
20
20
|
upsert?: boolean;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type UpdateOptions = {
|
|
23
23
|
upsert?: boolean;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type UpdateResult = {
|
|
26
26
|
matchedCount: number;
|
|
27
27
|
modifiedCount: number;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type LoadOptions<T extends Entity> = {
|
|
30
30
|
limit?: number;
|
|
31
31
|
skip?: number;
|
|
32
32
|
sort?: Sort<T>;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
34
|
+
export type LoadAndDeleteOptions<T extends Entity> = LoadOptions<T>;
|
|
35
|
+
export type LoadManyOptions<T extends Entity> = LoadOptions<T>;
|
|
36
|
+
export type LoadAndUpdateOptions<T extends Entity> = LoadOptions<T> & {
|
|
37
37
|
upsert?: boolean;
|
|
38
38
|
returnDocument?: FindOneAndUpdateOptions['returnDocument'];
|
|
39
39
|
sort?: Sort<T>;
|
|
40
40
|
};
|
|
41
|
-
export
|
|
41
|
+
export type CountOptions = {
|
|
42
42
|
limit?: number;
|
|
43
43
|
skip?: number;
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type InsertIfNotExistsByFilterItem<T extends Entity> = {
|
|
46
46
|
filter: Filter<T>;
|
|
47
47
|
entity: MaybeNewEntity<T>;
|
|
48
48
|
};
|
|
@@ -3,7 +3,7 @@ import type { BulkWriteResult } from 'mongodb';
|
|
|
3
3
|
import type { Collection } from './classes';
|
|
4
4
|
import type { ReplaceOptions, UpdateOptions } from './mongo-base.repository';
|
|
5
5
|
import type { Filter, UpdateFilter } from './types';
|
|
6
|
-
export
|
|
6
|
+
export type BulkResult = {
|
|
7
7
|
insertedCount: number;
|
|
8
8
|
matchedCount: number;
|
|
9
9
|
modifiedCount: number;
|
|
@@ -6,21 +6,21 @@ import type { Logger } from "../../logger";
|
|
|
6
6
|
import type { Collection } from './classes';
|
|
7
7
|
import { MongoBaseRepository } from './mongo-base.repository';
|
|
8
8
|
import type { TypedIndexDescription } from './types';
|
|
9
|
-
export
|
|
9
|
+
export type MongoEntityRepositoryOptions<T extends Entity<any>> = {
|
|
10
10
|
logger: Logger;
|
|
11
11
|
indexes?: TypedIndexDescription<T>[];
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type MappingItemTransformer<T extends Entity<any> = any, TKey extends keyof T = any> = (value: T[TKey]) => any;
|
|
14
|
+
export type MappingItem<T extends Entity<any>, TDb extends Entity<any>, TKey extends keyof T = keyof T, TDbKey extends keyof TDb = keyof TDb> = {
|
|
15
15
|
key: TDbKey;
|
|
16
16
|
transform: MappingItemTransformer<T, TKey>;
|
|
17
17
|
};
|
|
18
18
|
export declare function mapTo<T extends Entity<any>, TDb extends Entity<any>, TKey extends keyof T, TDbKey extends keyof TDb>(key: TDbKey, transform: (value: T[TKey]) => TDb[TDbKey]): MappingItem<T, TDb, TKey, TDbKey>;
|
|
19
|
-
export
|
|
19
|
+
export type TransformerMapping<T extends Entity<any>, TDb extends Entity<any>> = {
|
|
20
20
|
[P in keyof T]?: MappingItem<T, TDb, P>;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
23
|
-
export
|
|
22
|
+
export type TransformerMappingMap<T extends Entity<any> = any, TDb extends Entity<any> = any> = Map<keyof T, MappingItem<T, TDb>>;
|
|
23
|
+
export type EntityTransformer<T extends Entity<any>, TDb extends Entity<any>> = {
|
|
24
24
|
/**
|
|
25
25
|
* function to transform the base entity to the mongo entity
|
|
26
26
|
*/
|
|
@@ -34,7 +34,7 @@ export declare type EntityTransformer<T extends Entity<any>, TDb extends Entity<
|
|
|
34
34
|
*/
|
|
35
35
|
mapping?: TransformerMapping<T, TDb>;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type InsertIfNotExistsByQueryItem<T extends Entity<any>> = {
|
|
38
38
|
query: Query<T>;
|
|
39
39
|
entity: MaybeNewEntity<T>;
|
|
40
40
|
};
|
|
@@ -2,10 +2,10 @@ import type { Entity } from "..";
|
|
|
2
2
|
import type { Paths, TypedOmit } from "../../types";
|
|
3
3
|
import type * as Mongo from 'mongodb';
|
|
4
4
|
import type { MongoDocument } from './model';
|
|
5
|
-
export
|
|
5
|
+
export type MongoConnection = {
|
|
6
6
|
url: string;
|
|
7
7
|
} & Mongo.MongoClientOptions;
|
|
8
|
-
export
|
|
8
|
+
export type MongoRepositoryConfig<T extends Entity, TDb extends Entity = T> = {
|
|
9
9
|
connection?: MongoConnection;
|
|
10
10
|
database?: string;
|
|
11
11
|
collection: string;
|
|
@@ -14,34 +14,34 @@ export declare type MongoRepositoryConfig<T extends Entity, TDb extends Entity =
|
|
|
14
14
|
database: TDb;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
17
|
+
export type Filter<T extends Entity = Entity> = Mongo.Filter<MongoDocument<T>>;
|
|
18
|
+
export type UpdateFilter<T extends Entity = Entity> = Mongo.UpdateFilter<MongoDocument<T>>;
|
|
19
|
+
export type BulkOperation<T extends Entity = Entity> = InsertOneOperation<T> | ReplaceOneOperation<T> | UpdateOneOperation<T> | UpdateManyOperation<T> | DeleteOneOperation<T> | DeleteManyOperation<T>;
|
|
20
|
+
export type InsertOneOperation<T extends Entity = Entity> = {
|
|
21
21
|
insertOne: Mongo.InsertOneModel<MongoDocument<T>>;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type ReplaceOneOperation<T extends Entity = Entity> = {
|
|
24
24
|
replaceOne: Mongo.ReplaceOneModel<MongoDocument<T>>;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type UpdateOneOperation<T extends Entity = Entity> = {
|
|
27
27
|
updateOne: Mongo.UpdateOneModel<MongoDocument<T>>;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type UpdateManyOperation<T extends Entity = Entity> = {
|
|
30
30
|
updateMany: Mongo.UpdateManyModel<MongoDocument<T>>;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type DeleteOneOperation<T extends Entity = Entity> = {
|
|
33
33
|
deleteOne: Mongo.DeleteOneModel<MongoDocument<T>>;
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type DeleteManyOperation<T extends Entity = Entity> = {
|
|
36
36
|
deleteMany: Mongo.DeleteManyModel<MongoDocument<T>>;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type SortObject<T extends Entity = Entity> = {
|
|
39
39
|
[P in keyof MongoDocument<T>]?: 1 | -1;
|
|
40
40
|
};
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
41
|
+
export type SortArrayItem<T extends Entity = Entity> = [keyof MongoDocument<T> & string, 1 | -1];
|
|
42
|
+
export type SortArray<T extends Entity = Entity> = SortArrayItem<T>[];
|
|
43
|
+
export type Sort<T extends Entity = Entity> = SortArray<T> | SortObject<T>;
|
|
44
|
+
export type TypedIndexDescription<T extends Entity = Entity> = Omit<Mongo.IndexDescription, 'key' | 'partialFilterExpression'> & {
|
|
45
45
|
key: {
|
|
46
46
|
[P in Paths<T>]?: Mongo.IndexDirection;
|
|
47
47
|
};
|
package/database/query.d.ts
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
1
|
import type { Flatten, StringMap } from "../types";
|
|
2
2
|
import type { Geometry } from "../types/geo-json";
|
|
3
|
-
export
|
|
3
|
+
export type QueryOptions<T = any> = {
|
|
4
4
|
sort?: Sort<T>[];
|
|
5
5
|
skip?: number;
|
|
6
6
|
limit?: number;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type LogicalQuery<T = any> = LogicalAndQuery<T> | LogicalOrQuery<T> | LogicalNorQuery<T>;
|
|
9
|
+
export type LogicalQueryTypes = keyof (LogicalAndQuery & LogicalOrQuery & LogicalNorQuery);
|
|
10
10
|
export declare const allLogicalQueryTypes: LogicalQueryTypes[];
|
|
11
|
-
export
|
|
11
|
+
export type ComparisonQueryBody<T = any> = {
|
|
12
12
|
[P in keyof T]?: ComparisonQueryOrValue<T[P]>;
|
|
13
13
|
} & StringMap<ComparisonQueryOrValue>;
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
14
|
+
export type ComparisonQueryOrValue<T = any> = ComparisonQuery<T> | T | Flatten<T>;
|
|
15
|
+
export type ComparisonQuery<T = any> = Partial<ComparisonNotQuery<T> & ComparisonEqualsQuery<T> & ComparisonNotEqualsQuery<T> & ComparisonExistsQuery & ComparisonItemQuery<T> & ComparisonInQuery<T> & ComparisonNotInQuery<T> & ComparisonAllQuery<T> & ComparisonGreaterThanQuery<T> & ComparisonGreaterThanOrEqualsQuery<T> & ComparisonLessThanQuery<T> & ComparisonLessThanOrEqualsQuery<T> & ComparisonRegexQuery & ComparisonTextQuery & ComparisonGeoShapeQuery & ComparisonGeoDistanceQuery>;
|
|
16
|
+
export type ComparisonQueryTypes = keyof ComparisonQuery;
|
|
17
17
|
export declare const allComparisonQueryTypes: ComparisonQueryTypes[];
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export type SpecialQuery<T = any> = Partial<TextSpanQuery<T>>;
|
|
19
|
+
export type SpecialQueryTypes = keyof SpecialQuery;
|
|
20
20
|
export declare const allSpecialQueryTypes: SpecialQueryTypes[];
|
|
21
|
-
export
|
|
22
|
-
export
|
|
21
|
+
export type Query<T = any> = LogicalQuery<T> | (ComparisonQueryBody<T> & SpecialQuery<T>);
|
|
22
|
+
export type QueryTypes = LogicalQueryTypes | ComparisonQueryTypes | SpecialQueryTypes;
|
|
23
23
|
export declare const allQueryTypes: ("$and" | "$or" | "$nor" | "$not" | "$eq" | "$neq" | "$exists" | "$item" | "$in" | "$nin" | "$all" | "$gt" | "$gte" | "$lt" | "$lte" | "$regex" | "$text" | "$geoShape" | "$geoDistance" | "$textSpan")[];
|
|
24
|
-
export
|
|
24
|
+
export type Order = 'asc' | 'desc';
|
|
25
25
|
export declare const allOrders: Order[];
|
|
26
|
-
export
|
|
26
|
+
export type Operator = 'and' | 'or';
|
|
27
27
|
export declare const allOperators: Operator[];
|
|
28
|
-
export
|
|
28
|
+
export type Sort<T = any> = {
|
|
29
29
|
field: (Extract<keyof T, string> | '$score');
|
|
30
30
|
order?: Order;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type LogicalAndQuery<T = any> = {
|
|
33
33
|
$and: Query<T>[];
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type LogicalOrQuery<T = any> = {
|
|
36
36
|
$or: Query<T>[];
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type LogicalNorQuery<T = any> = {
|
|
39
39
|
$nor: Query<T>[];
|
|
40
40
|
};
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
41
|
+
export type ComparisonValue<T> = T | Flatten<T>;
|
|
42
|
+
export type ComparisonValueWithRegex<T> = T extends string ? ComparisonValue<T | RegExp> : T extends string[] ? ComparisonValue<(Flatten<T> | RegExp)[]> : (T | Flatten<T>);
|
|
43
|
+
export type ComparisonNotQuery<T = any> = {
|
|
44
44
|
$not: ComparisonQuery<T>;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export type ComparisonEqualsQuery<T = any> = {
|
|
47
47
|
$eq: ComparisonValueWithRegex<T>;
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export type ComparisonNotEqualsQuery<T = any> = {
|
|
50
50
|
$neq: ComparisonValueWithRegex<T>;
|
|
51
51
|
};
|
|
52
|
-
export
|
|
52
|
+
export type ComparisonExistsQuery = {
|
|
53
53
|
$exists: ComparisonValue<boolean>;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type ComparisonItemQuery<T = any> = {
|
|
56
56
|
$item: T extends (infer U)[] ? U extends Record<any, any> ? Query<U> : ComparisonQuery<U> : never;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type ComparisonInQuery<T = any> = {
|
|
59
59
|
$in: ComparisonValueWithRegex<T>[];
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type ComparisonNotInQuery<T = any> = {
|
|
62
62
|
$nin: ComparisonValueWithRegex<T>[];
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type ComparisonAllQuery<T = any> = {
|
|
65
65
|
$all: ComparisonValueWithRegex<T>[];
|
|
66
66
|
};
|
|
67
|
-
export
|
|
67
|
+
export type ComparisonGreaterThanQuery<T = any> = {
|
|
68
68
|
$gt: ComparisonValue<T>;
|
|
69
69
|
};
|
|
70
|
-
export
|
|
70
|
+
export type ComparisonGreaterThanOrEqualsQuery<T = any> = {
|
|
71
71
|
$gte: ComparisonValue<T>;
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export type ComparisonLessThanQuery<T = any> = {
|
|
74
74
|
$lt: ComparisonValue<T>;
|
|
75
75
|
};
|
|
76
|
-
export
|
|
76
|
+
export type ComparisonLessThanOrEqualsQuery<T = any> = {
|
|
77
77
|
$lte: ComparisonValue<T>;
|
|
78
78
|
};
|
|
79
|
-
export
|
|
79
|
+
export type ComparisonRegexQuery = {
|
|
80
80
|
$regex: string | RegExp | {
|
|
81
81
|
pattern: string;
|
|
82
82
|
flags: string;
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export
|
|
85
|
+
export type ComparisonTextQuery = {
|
|
86
86
|
$text: string | {
|
|
87
87
|
text: string;
|
|
88
88
|
operator?: Operator;
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
export
|
|
92
|
-
export
|
|
91
|
+
export type GeoShapeRelation = 'intersects' | 'within' | 'disjoint' | 'contains';
|
|
92
|
+
export type ComparisonGeoShapeQuery = {
|
|
93
93
|
$geoShape: {
|
|
94
94
|
geometry: Geometry;
|
|
95
95
|
relation: GeoShapeRelation;
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
|
-
export
|
|
98
|
+
export type ComparisonGeoDistanceQuery = {
|
|
99
99
|
$geoDistance: {
|
|
100
100
|
longitude: number;
|
|
101
101
|
latitude: number;
|
|
@@ -109,9 +109,9 @@ export declare type ComparisonGeoDistanceQuery = {
|
|
|
109
109
|
minDistance?: number;
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
|
-
export
|
|
112
|
+
export type TextSpanQueryMode = 'best' | 'most' | 'cross';
|
|
113
113
|
export declare const allTextSpanQueryModes: TextSpanQueryMode[];
|
|
114
|
-
export
|
|
114
|
+
export type TextSpanQuery<T = any> = {
|
|
115
115
|
$textSpan: {
|
|
116
116
|
fields: (Extract<keyof T, string>)[];
|
|
117
117
|
text: string;
|
|
@@ -3,12 +3,12 @@ import { CancellationToken } from '../utils/cancellation-token';
|
|
|
3
3
|
import type { AsyncDisposable, Disposable } from './disposable';
|
|
4
4
|
import { disposeAsync } from './disposable';
|
|
5
5
|
declare const deferrerToken: unique symbol;
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type TaskFunction = () => any;
|
|
7
|
+
export type Task = {
|
|
8
8
|
priority: number;
|
|
9
9
|
taskFunction: TaskFunction;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Deferrer = {
|
|
12
12
|
[deferrerToken]: CancellationToken;
|
|
13
13
|
yield(): void;
|
|
14
14
|
};
|
|
@@ -3,9 +3,9 @@ import { resolveArgumentType } from "../container";
|
|
|
3
3
|
import { LockProvider } from "../lock";
|
|
4
4
|
import type { ReadonlyCancellationToken } from "../utils/cancellation-token";
|
|
5
5
|
import type { LoopController } from './controller';
|
|
6
|
-
export
|
|
6
|
+
export type LoopFunction = (controller: LoopController) => any | Promise<any>;
|
|
7
7
|
/** loop key */
|
|
8
|
-
export
|
|
8
|
+
export type DistributedLoopArgument = string;
|
|
9
9
|
export declare class DistributedLoop implements Injectable<DistributedLoopArgument> {
|
|
10
10
|
private readonly key;
|
|
11
11
|
private readonly lockProvider;
|
package/error/custom.error.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Dispatcher } from 'undici';
|
|
|
2
2
|
import type { HttpClientRequest } from '../http-client-request';
|
|
3
3
|
import { HttpClientResponse } from '../http-client-response';
|
|
4
4
|
import { HttpClientAdapter } from '../http-client.adapter';
|
|
5
|
-
export
|
|
5
|
+
export type UndiciHttpClientAdapterOptions = {
|
|
6
6
|
dispatcher?: Dispatcher;
|
|
7
7
|
};
|
|
8
8
|
export declare class UndiciHttpClientAdapter extends HttpClientAdapter {
|
|
@@ -12,7 +12,7 @@ import type { HttpUrlParametersObject } from '../http-url-parameters';
|
|
|
12
12
|
import { HttpUrlParameters } from '../http-url-parameters';
|
|
13
13
|
import type { HttpMethod } from '../types';
|
|
14
14
|
/** only one type at a time is supported. If multiple are set, behaviour is undefined */
|
|
15
|
-
export
|
|
15
|
+
export type HttpRequestBody = {
|
|
16
16
|
text?: string;
|
|
17
17
|
json?: UndefinableJson;
|
|
18
18
|
form?: HttpForm;
|
|
@@ -20,7 +20,7 @@ export declare type HttpRequestBody = {
|
|
|
20
20
|
blob?: Blob;
|
|
21
21
|
stream?: ReadableStream<Uint8Array>;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type HttpRequestAuthorization = {
|
|
24
24
|
basic?: {
|
|
25
25
|
username: string;
|
|
26
26
|
password: string;
|
|
@@ -28,7 +28,7 @@ export declare type HttpRequestAuthorization = {
|
|
|
28
28
|
bearer?: string;
|
|
29
29
|
token?: string;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type HttpClientRequestOptions = Partial<TypedOmit<HttpClientRequest, 'url' | 'method' | 'abortToken' | 'abort' | 'headers' | 'query' | 'body'>> & {
|
|
32
32
|
urlParameter?: HttpUrlParametersObject | HttpUrlParameters;
|
|
33
33
|
headers?: HttpHeadersObject | HttpHeaders;
|
|
34
34
|
query?: HttpQueryObject | HttpQuery;
|
|
@@ -42,11 +42,11 @@ export declare type HttpClientRequestOptions = Partial<TypedOmit<HttpClientReque
|
|
|
42
42
|
};
|
|
43
43
|
abortToken?: ReadonlyCancellationToken;
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type HttpClientRequestObject = HttpClientRequestOptions & {
|
|
46
46
|
url: string;
|
|
47
47
|
method?: HttpMethod;
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export type CredentialsOptions = 'omit' | 'same-origin' | 'include';
|
|
50
50
|
export declare class HttpClientRequest implements Disposable {
|
|
51
51
|
private readonly _abortToken;
|
|
52
52
|
url: string;
|
|
@@ -4,11 +4,11 @@ import { HttpBody } from '../http-body';
|
|
|
4
4
|
import type { HttpHeadersObject } from '../http-headers';
|
|
5
5
|
import { HttpHeaders } from '../http-headers';
|
|
6
6
|
import type { HttpClientRequest, HttpClientRequestObject } from './http-client-request';
|
|
7
|
-
export
|
|
7
|
+
export type HttpClientResponseObject = TypedOmit<HttpClientResponse, 'hasBody' | 'request' | 'headers' | 'close' | 'asObject'> & {
|
|
8
8
|
request: HttpClientRequestObject;
|
|
9
9
|
headers: HttpHeadersObject;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type HttpClientResponseOptions = {
|
|
12
12
|
request: HttpClientRequest;
|
|
13
13
|
statusCode: number;
|
|
14
14
|
statusMessage: string;
|
|
@@ -7,7 +7,7 @@ import type { HttpClientRequestOptions } from './http-client-request';
|
|
|
7
7
|
import { HttpClientRequest } from './http-client-request';
|
|
8
8
|
import type { HttpClientResponse } from './http-client-response';
|
|
9
9
|
import { HttpClientAdapter } from './http-client.adapter';
|
|
10
|
-
export
|
|
10
|
+
export type HttpClientOptions = {
|
|
11
11
|
/**
|
|
12
12
|
* base url for requests when only path is provided
|
|
13
13
|
*/
|
|
@@ -22,11 +22,11 @@ export declare type HttpClientOptions = {
|
|
|
22
22
|
*/
|
|
23
23
|
enableErrorHandling?: boolean;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
25
|
+
export type HttpClientHandler = AsyncMiddlewareHandler<HttpClientRequest, HttpClientResponse>;
|
|
26
|
+
export type HttpClientMiddleware = AsyncMiddleware<HttpClientRequest, HttpClientResponse>;
|
|
27
|
+
export type HttpClientMiddlewareNext = AsyncMiddlewareNext<HttpClientRequest, HttpClientResponse>;
|
|
28
28
|
export declare const HTTP_CLIENT_OPTIONS: import("../../container").InjectionToken<HttpClientOptions, any>;
|
|
29
|
-
export
|
|
29
|
+
export type HttpClientArgument = HttpClientOptions;
|
|
30
30
|
export declare class HttpClient implements Injectable<HttpClientArgument> {
|
|
31
31
|
private readonly adapter;
|
|
32
32
|
private readonly options;
|
package/http/http-body.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import type { UndefinableJson } from "../types";
|
|
|
2
2
|
import type { AnyIterable } from "../utils/any-iterable-iterator";
|
|
3
3
|
import type { HttpHeaders } from './http-headers';
|
|
4
4
|
import type { ReadBodyOptions } from './utils';
|
|
5
|
-
export
|
|
5
|
+
export type HttpBodySource = undefined | Uint8Array | Blob | AnyIterable<Uint8Array> | ReadableStream<Uint8Array>;
|
|
6
6
|
export declare class HttpBody {
|
|
7
7
|
private readonly body;
|
|
8
8
|
private readonly headers;
|
|
9
|
+
private bodyAlreadyRead;
|
|
9
10
|
get available(): boolean;
|
|
10
11
|
get byteLength(): number | undefined;
|
|
11
12
|
constructor(body: HttpBodySource, headers: HttpHeaders);
|
|
@@ -16,4 +17,5 @@ export declare class HttpBody {
|
|
|
16
17
|
readAsBinaryStream(options?: ReadBodyOptions): ReadableStream<Uint8Array>;
|
|
17
18
|
readAsTextStream(options?: ReadBodyOptions): ReadableStream<string>;
|
|
18
19
|
readAsStream(options?: ReadBodyOptions): ReadableStream<string> | ReadableStream<Uint8Array>;
|
|
20
|
+
private prepareBodyRead;
|
|
19
21
|
}
|
package/http/http-body.js
CHANGED
|
@@ -6,6 +6,7 @@ const utils_1 = require("./utils");
|
|
|
6
6
|
class HttpBody {
|
|
7
7
|
body;
|
|
8
8
|
headers;
|
|
9
|
+
bodyAlreadyRead;
|
|
9
10
|
get available() {
|
|
10
11
|
return (0, type_guards_1.isNotNullOrUndefined)(this.body);
|
|
11
12
|
}
|
|
@@ -15,40 +16,45 @@ class HttpBody {
|
|
|
15
16
|
constructor(body, headers) {
|
|
16
17
|
this.body = body;
|
|
17
18
|
this.headers = headers;
|
|
19
|
+
this.bodyAlreadyRead = false;
|
|
18
20
|
}
|
|
19
21
|
async readAsBuffer(options) {
|
|
20
|
-
|
|
22
|
+
this.prepareBodyRead();
|
|
21
23
|
return (0, utils_1.readBodyAsBuffer)(this.body, this.headers, options);
|
|
22
24
|
}
|
|
23
25
|
async readAsText(options) {
|
|
24
|
-
|
|
26
|
+
this.prepareBodyRead();
|
|
25
27
|
return (0, utils_1.readBodyAsText)(this.body, this.headers, options);
|
|
26
28
|
}
|
|
27
29
|
async readAsJson(options) {
|
|
28
|
-
|
|
30
|
+
this.prepareBodyRead();
|
|
29
31
|
return (0, utils_1.readBodyAsJson)(this.body, this.headers, options);
|
|
30
32
|
}
|
|
31
33
|
async read(options) {
|
|
32
|
-
|
|
34
|
+
this.prepareBodyRead();
|
|
33
35
|
return (0, utils_1.readBody)(this.body, this.headers, options);
|
|
34
36
|
}
|
|
35
37
|
readAsBinaryStream(options) {
|
|
36
|
-
|
|
38
|
+
this.prepareBodyRead();
|
|
37
39
|
return (0, utils_1.readBodyAsBinaryStream)(this.body, this.headers, options);
|
|
38
40
|
}
|
|
39
41
|
readAsTextStream(options) {
|
|
40
|
-
|
|
42
|
+
this.prepareBodyRead();
|
|
41
43
|
return (0, utils_1.readBodyAsTextStream)(this.body, this.headers, options);
|
|
42
44
|
}
|
|
43
45
|
readAsStream(options) {
|
|
44
|
-
|
|
46
|
+
this.prepareBodyRead();
|
|
45
47
|
return (0, utils_1.readBodyAsStream)(this.body, this.headers, options);
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
prepareBodyRead() {
|
|
50
|
+
if ((0, type_guards_1.isNullOrUndefined)(this.body)) {
|
|
51
|
+
throw new Error('Body not available.');
|
|
52
|
+
}
|
|
53
|
+
if (this.bodyAlreadyRead) {
|
|
54
|
+
throw new Error('Body was already read.');
|
|
55
|
+
}
|
|
56
|
+
this.bodyAlreadyRead = true;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
59
|
+
exports.HttpBody = HttpBody;
|
|
54
60
|
//# sourceMappingURL=http-body.js.map
|
package/http/http-body.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-body.js","sourceRoot":"","sources":["../../source/http/http-body.ts"],"names":[],"mappings":";;;AAEA,sDAA8E;AAG9E,mCAAqJ;AAIrJ,MAAa,QAAQ;IACF,IAAI,CAAiB;IACrB,OAAO,CAAc;
|
|
1
|
+
{"version":3,"file":"http-body.js","sourceRoot":"","sources":["../../source/http/http-body.ts"],"names":[],"mappings":";;;AAEA,sDAA8E;AAG9E,mCAAqJ;AAIrJ,MAAa,QAAQ;IACF,IAAI,CAAiB;IACrB,OAAO,CAAc;IAE9B,eAAe,CAAU;IAEjC,IAAI,SAAS;QACX,OAAO,IAAA,kCAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACpC,CAAC;IAED,YAAY,IAAoB,EAAE,OAAoB;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAyB;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,wBAAgB,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAyB;QACxC,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU,CAAsB,OAAyB;QAC7D,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAe,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAyB;QAClC,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,kBAAkB,CAAC,OAAyB;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,8BAAsB,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,gBAAgB,CAAC,OAAyB;QACxC,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,4BAAoB,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,YAAY,CAAC,OAAyB;QACpC,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAA,wBAAgB,EAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAEO,eAAe;QACrB,IAAI,IAAA,+BAAiB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AAnED,4BAmEC"}
|
package/http/http-form.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HttpValueMapInput } from './http-value-map';
|
|
2
2
|
import { HttpValueMap } from './http-value-map';
|
|
3
3
|
import type { HttpValueObject, NormalizedHttpValueObject } from './types';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type HttpFormObject = HttpValueObject;
|
|
5
|
+
export type NormalizedHttpFormObject = NormalizedHttpValueObject;
|
|
6
6
|
export declare class HttpForm extends HttpValueMap<HttpForm> {
|
|
7
7
|
constructor(input?: HttpValueMapInput);
|
|
8
8
|
static fromURLSearchParams(urlSearchParams: URLSearchParams): HttpForm;
|
package/http/http-headers.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HttpValueMapInput } from './http-value-map';
|
|
2
2
|
import { HttpValueMap } from './http-value-map';
|
|
3
3
|
import type { HttpValueObject, NormalizedHttpValueObject } from './types';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
export type HttpHeadersObject = HttpValueObject;
|
|
5
|
+
export type HttpHeadersInput = HttpValueMapInput;
|
|
6
|
+
export type NormalizedHttpHeadersObject = NormalizedHttpValueObject;
|
|
7
7
|
export declare class HttpHeaders extends HttpValueMap<HttpHeaders> {
|
|
8
8
|
get accept(): string | undefined;
|
|
9
9
|
set accept(value: string | undefined);
|
package/http/http-query.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HttpValueMapInput } from './http-value-map';
|
|
2
2
|
import { HttpValueMap } from './http-value-map';
|
|
3
3
|
import type { HttpValueObject, NormalizedHttpValueObject } from './types';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type HttpQueryObject = HttpValueObject;
|
|
5
|
+
export type NormalizedHttpQueryObject = NormalizedHttpValueObject;
|
|
6
6
|
export declare class HttpQuery extends HttpValueMap<HttpQuery> {
|
|
7
7
|
constructor(input?: HttpValueMapInput);
|
|
8
8
|
static fromURLSearchParams(urlSearchParams: URLSearchParams): HttpQuery;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HttpValueMapInput } from './http-value-map';
|
|
2
2
|
import { HttpValueMap } from './http-value-map';
|
|
3
3
|
import type { HttpValueObject, NormalizedHttpValueObject } from './types';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type HttpUrlParametersObject = HttpValueObject;
|
|
5
|
+
export type NormalizedHttpUrlParametersObject = NormalizedHttpValueObject;
|
|
6
6
|
export declare class HttpUrlParameters extends HttpValueMap<HttpUrlParameters> {
|
|
7
7
|
constructor(input?: HttpValueMapInput);
|
|
8
8
|
clone(): HttpUrlParameters;
|
package/http/http-value-map.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OneOrMany, Record } from "../types";
|
|
2
2
|
import type { HttpValue, NormalizedHttpValue, NormalizedHttpValueObject } from './types';
|
|
3
|
-
export
|
|
3
|
+
export type HttpValueMapInput = Record<string, OneOrMany<HttpValue> | undefined> | Iterable<[string, OneOrMany<HttpValue> | undefined]>;
|
|
4
4
|
export declare abstract class HttpValueMap<TThis extends HttpValueMap<any>> implements Iterable<[string, OneOrMany<HttpValue>]> {
|
|
5
5
|
private readonly valueType;
|
|
6
6
|
private readonly caseInsensitive;
|
|
@@ -5,7 +5,7 @@ import { HttpBody } from '../http-body';
|
|
|
5
5
|
import type { HttpHeaders } from '../http-headers';
|
|
6
6
|
import type { HttpQuery } from '../http-query';
|
|
7
7
|
import type { HttpMethod } from '../types';
|
|
8
|
-
export
|
|
8
|
+
export type HttpServerRequestObject = Pick<HttpServerRequest, 'url' | 'method' | 'headers' | 'query' | 'ip'> & {
|
|
9
9
|
body: HttpBody | HttpBodySource;
|
|
10
10
|
context?: StringMap;
|
|
11
11
|
};
|
|
@@ -2,7 +2,7 @@ import type { SeverSentEvents } from "../../sse";
|
|
|
2
2
|
import type { UndefinableJson } from "../../types";
|
|
3
3
|
import type { HttpHeadersInput } from '../http-headers';
|
|
4
4
|
import { HttpHeaders } from '../http-headers';
|
|
5
|
-
export
|
|
5
|
+
export type HttpServerResponseOptions = {
|
|
6
6
|
statusCode?: number | undefined;
|
|
7
7
|
statusMessage?: string | undefined;
|
|
8
8
|
headers?: HttpHeadersInput | HttpHeaders;
|