@afora/core 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -7
- package/dist/core/application/start.d.ts +7 -0
- package/dist/core/application/types/application.interface.d.ts +47 -2
- package/dist/core/command/command.d.ts +11 -4
- package/dist/core/command/types/command.interface.d.ts +26 -0
- package/dist/core/entity/abstract-entity.d.ts +28 -1
- package/dist/core/entity/entity.d.ts +1 -1
- package/dist/core/entity/event.d.ts +13 -2
- package/dist/core/entity/exceptions.d.ts +8 -0
- package/dist/core/entity/types/entity.interface.d.ts +66 -2
- package/dist/core/entity/version.d.ts +13 -0
- package/dist/core/event-policy/event-policy.d.ts +25 -0
- package/dist/core/event-policy/exceptions.d.ts +11 -0
- package/dist/core/event-policy/publish.d.ts +17 -0
- package/dist/core/event-policy/publishers.d.ts +18 -0
- package/dist/core/event-policy/types/event-policy.interface.d.ts +72 -0
- package/dist/core/output/coerce.d.ts +9 -0
- package/dist/core/output/openapi-sink.d.ts +138 -38
- package/dist/core/output/status.d.ts +2 -1
- package/dist/core/parse/parse.d.ts +10 -0
- package/dist/core/parse/strip.d.ts +13 -0
- package/dist/core/property/input.d.ts +20 -0
- package/dist/core/record/plugin.d.ts +6 -2
- package/dist/core/repository/exceptions.d.ts +30 -0
- package/dist/core/repository/in-memory.d.ts +14 -1
- package/dist/core/repository/plan.d.ts +20 -0
- package/dist/core/repository/provider.d.ts +1 -1
- package/dist/core/repository/query.d.ts +9 -2
- package/dist/core/repository/repository.d.ts +40 -8
- package/dist/core/repository/state.d.ts +39 -2
- package/dist/core/repository/types/query.interface.d.ts +106 -5
- package/dist/core/repository/types/repository.interface.d.ts +113 -7
- package/dist/core/use-case/exceptions.d.ts +36 -0
- package/dist/core/use-case/plugin-catalog.d.ts +11 -0
- package/dist/core/use-case/plugin.d.ts +25 -0
- package/dist/core/use-case/steps/types/steps.interface.d.ts +23 -6
- package/dist/core/use-case/target.d.ts +9 -0
- package/dist/core/use-case/types/plugin.interface.d.ts +185 -0
- package/dist/experimental.js +3 -3
- package/dist/{index-3nd9bjnc.js → index-qxfkyd6k.js} +646 -635
- package/dist/{index-gbgc40xe.js → index-t5qwtyj5.js} +2798 -295
- package/dist/index.d.ts +35 -15
- package/dist/index.js +99 -15
- package/dist/std/blueprint-plugin.d.ts +6 -2
- package/dist/std/blueprint.d.ts +3 -0
- package/dist/std/command.d.ts +11 -0
- package/dist/std/entity.d.ts +2 -1
- package/dist/std/event-policies.d.ts +2 -0
- package/dist/std/properties/exceptions.d.ts +11 -0
- package/dist/std/properties/json.d.ts +54 -0
- package/dist/std/properties/password.d.ts +16 -1
- package/dist/std/properties/time.d.ts +4 -0
- package/dist/std/use-cases/auth.d.ts +5 -0
- package/dist/std/use-cases/crud.d.ts +25 -0
- package/dist/std/use-cases/index.d.ts +11 -0
- package/dist/std/use-cases/lifecycle.d.ts +13 -0
- package/dist/std/use-cases/shared.d.ts +88 -0
- package/dist/std/use-cases/types.d.ts +291 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +355 -2
- package/dist/testing/memory-publisher.d.ts +16 -0
- package/dist/testing/provider-contract.d.ts +14 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -13,17 +13,22 @@ export { optionalOf } from "./core/blueprint/optional.js";
|
|
|
13
13
|
export { isOptionalRecord, isRecordClass, recordFieldOf, } from "./core/blueprint/record-field.js";
|
|
14
14
|
export type { AnyBlueprint, AnyBlueprintList, AnyOptionalRecord, AnyRecordClass, BlueprintBuilder, BlueprintContext, BlueprintData, BlueprintDefinition, BlueprintField, BlueprintHelpers, BlueprintInput, BlueprintListOptions, BlueprintPluginContext, BlueprintSchema, BlueprintSource, BlueprintValue, IBlueprint, IBlueprintCollection, IBlueprintList, OptionalBlueprint, OptionalBlueprintList, OptionalRecord, } from "./core/blueprint/types/blueprint.interface.js";
|
|
15
15
|
export type { BlueprintFactory, IBlueprintFactories, IBlueprintPlugin, } from "./core/blueprint/types/blueprint-plugin.interface.js";
|
|
16
|
-
export {
|
|
16
|
+
export { commandBuilderOf, isCommand } from "./core/command/command.js";
|
|
17
17
|
export { CommandEventFailed, InvalidCommandContext, InvalidCommandDeclaration, InvalidCommandEnvironment, UnknownCommandOperation, } from "./core/command/exceptions.js";
|
|
18
|
-
export type { AnyCommand, CommandEnvOption, CommandEventErrorHandler, CommandEventHandler, CommandEventInfo, CommandEvents, CommandExecution, CommandInput, CommandOf, CommandOperation, CommandOptions, CommandResponse, CommandSettings, CommandUseCases, } from "./core/command/types/command.interface.js";
|
|
19
|
-
export { AbstractEntity, ENTITY_IDENTITY_KEYS, EntityUniqueKeys, RESERVED_ENTITY_KEYS, } from "./core/entity/abstract-entity.js";
|
|
18
|
+
export type { AnyCommand, CommandBuilder, CommandBuilderSettings, CommandEnvOption, CommandEventErrorHandler, CommandEventHandler, CommandEventInfo, CommandEvents, CommandExecution, CommandInput, CommandOf, CommandOperation, CommandOptions, CommandResponse, CommandSettings, CommandUseCases, CommandUseCasesOption, } from "./core/command/types/command.interface.js";
|
|
19
|
+
export { AbstractEntity, ENTITY_IDENTITY_KEYS, EntitySettings, EntityUniqueKeys, RESERVED_ENTITY_KEYS, } from "./core/entity/abstract-entity.js";
|
|
20
20
|
export { entityBuilderOf, isEntity, isEntityClass } from "./core/entity/entity.js";
|
|
21
21
|
export type { AnyEntityClass, EntityEvent, EntityEventReference, EntityEvents, EventDefinition, EventHandlerContext, } from "./core/entity/event.js";
|
|
22
22
|
export { eventOf } from "./core/entity/event.js";
|
|
23
|
-
export { DeletedEntity, ImmutableEntityKey, ReservedEntityKey, } from "./core/entity/exceptions.js";
|
|
24
|
-
export type { DeclaredEntityInstance, EntityBuilder, EntityBuilderSettings, EntityConstructor, EntityIdentityKey, EntityInput, EntityOptions, EntityProperties, EntityUniqueKey, IEntityIdentity, } from "./core/entity/types/entity.interface.js";
|
|
23
|
+
export { DeletedEntity, ImmutableEntityKey, InvalidEntityExpiry, ReservedEntityKey, } from "./core/entity/exceptions.js";
|
|
24
|
+
export type { DeclaredEntityInstance, EntityBuilder, EntityBuilderSettings, EntityConstructor, EntityDuration, EntityExpires, EntityIdentityKey, EntityInput, EntityOptions, EntityProperties, EntityStorageOptions, EntityStorageSettings, EntityUniqueKey, ExpiresAtField, ExpiringIdentity, IEntityIdentity, IEntityVersion, VersionedIdentity, } from "./core/entity/types/entity.interface.js";
|
|
25
|
+
export { EntityVersion } from "./core/entity/version.js";
|
|
25
26
|
export type { AnyEnvironment, EnvironmentDependencies, EnvironmentOptions, EnvironmentSource, EnvironmentValue, IEnvironment, } from "./core/environment/environment.js";
|
|
26
27
|
export { environmentOf, InvalidEnvironment, isEnvironment, } from "./core/environment/environment.js";
|
|
28
|
+
export { eventPolicyCatalogOf, eventPolicyDescriptionOf, eventPolicyOf, } from "./core/event-policy/event-policy.js";
|
|
29
|
+
export { InvalidEventPolicy, PublisherNotBound, } from "./core/event-policy/exceptions.js";
|
|
30
|
+
export { publishEvents } from "./core/event-policy/publish.js";
|
|
31
|
+
export type { EventPolicyDescription, EventPolicyFactory, EventPolicyOptions, EventPolicySettings, IEventPolicyCatalog, IEventPublisher, PublishEventsOptions, PublishedEvent, } from "./core/event-policy/types/event-policy.interface.js";
|
|
27
32
|
export { ExceptionLayers } from "./core/exception/enums/exception-layers.js";
|
|
28
33
|
export type { DeclaredExceptionClass } from "./core/exception/exception.js";
|
|
29
34
|
export { Exception, exceptionOf, UNEXPECTED_ERROR, } from "./core/exception/exception.js";
|
|
@@ -35,9 +40,10 @@ export { consoleLogProvider, jsonLogProvider, Logger, LogLevels, logProviderOf,
|
|
|
35
40
|
export { InvalidOpenAPIModel } from "./core/openapi/exceptions.js";
|
|
36
41
|
export { toOpenAPI } from "./core/openapi/openapi.js";
|
|
37
42
|
export type { OpenAPIComponents, OpenAPIOptions, OpenAPISchema, } from "./core/openapi/types/openapi.interface.js";
|
|
43
|
+
export { coerceTextValues } from "./core/output/coerce.js";
|
|
38
44
|
export { DuplicateOperation, InvalidOutputStage, } from "./core/output/exceptions.js";
|
|
39
|
-
export type { OpenAPIDocument, OpenAPIMethod, OpenAPISinkOptions, OperationRoute, RouteOptions, } from "./core/output/openapi-sink.js";
|
|
40
|
-
export { openapi, operationRoutes, routeOptionsIssue, } from "./core/output/openapi-sink.js";
|
|
45
|
+
export type { OpenAPIDocument, OpenAPIMethod, OpenAPISecurityScheme, OpenAPISinkOptions, OperationRoute, RouteOptions, RouteStatus, SecurityRequirement, } from "./core/output/openapi-sink.js";
|
|
46
|
+
export { openapi, operationRoutes, ROUTE_OPTION_KEYS, requestIdHeaderOf, routeOptionsIssue, } from "./core/output/openapi-sink.js";
|
|
41
47
|
export { isOutput, operationOf, outputOf } from "./core/output/output.js";
|
|
42
48
|
export { outputValueOf, PROBLEM_MEDIA_TYPE, problemOf, } from "./core/output/problem.js";
|
|
43
49
|
export type { SelectOptions } from "./core/output/select.js";
|
|
@@ -45,11 +51,14 @@ export { select } from "./core/output/select.js";
|
|
|
45
51
|
export { sinkOf, stageCatalogOf, stageDescriptionOf, stageKindOf, transformOf, } from "./core/output/stage.js";
|
|
46
52
|
export { statusOf } from "./core/output/status.js";
|
|
47
53
|
export type { AnyOutput, IStageCatalog, OperationCallOptions, OperationDescriptor, OperationPatch, OutputApplication, OutputOf, OutputSettings, OutputSource, OutputStatuses, PipeResult, Problem, ProblemOptions, SinkFactory, SinkSettings, SinkStage, Stage, StageContext, StageDescription, StageFactory, StageOptions, TransformFactory, TransformSettings, TransformStage, } from "./core/output/types/output.interface.js";
|
|
54
|
+
export { stripUndeclared } from "./core/parse/strip.js";
|
|
48
55
|
export type { Issue, IssueCode, ParseResult, } from "./core/parse/types/parse.interface.js";
|
|
49
56
|
export { AbstractProperty } from "./core/property/abstract-property.js";
|
|
50
57
|
export { AbstractDefineProperty } from "./core/property/define-property.js";
|
|
51
58
|
export { PropertyStates } from "./core/property/enums/property-states.js";
|
|
52
59
|
export { InvalidPropertyValue, PropertyRequired, } from "./core/property/exceptions.js";
|
|
60
|
+
export type { IPropertyInput } from "./core/property/input.js";
|
|
61
|
+
export { PropertyInput, propertyInputOf } from "./core/property/input.js";
|
|
53
62
|
export { isProperty } from "./core/property/is-property.js";
|
|
54
63
|
export type { PropertyLineage } from "./core/property/lineage.js";
|
|
55
64
|
export { propertyLineageOf } from "./core/property/lineage.js";
|
|
@@ -73,13 +82,13 @@ export type { RecordBuilder } from "./core/record/record.js";
|
|
|
73
82
|
export { recordBuilderOf } from "./core/record/record.js";
|
|
74
83
|
export type { AnyRecordPlugin, IRecordPlugin, IRecordPluginCatalog, PluginUniqueKey, RecordPluginDescriptor, RecordPluginOptions, RecordPluginReference, RecordPluginRequirement, RecordPluginsOption, } from "./core/record/types/plugin.interface.js";
|
|
75
84
|
export type { DeclaredRecordInstance, IRecord, MarkedUniqueKey, Masked, RecordChange, RecordChanges, RecordConstructor, RecordEffect, RecordEffects, RecordJson, RecordKey, RecordOptions, RecordSettings, RecordValue, } from "./core/record/types/record.interface.js";
|
|
76
|
-
export { InvalidRepositoryCursor, InvalidRepositoryData, InvalidRepositoryDeclaration, InvalidRepositoryEntity, InvalidRepositoryQuery, RepositoryEntityNotFound, RepositoryUniqueViolation, } from "./core/repository/exceptions.js";
|
|
77
|
-
export { inMemoryProvider } from "./core/repository/in-memory.js";
|
|
85
|
+
export { InvalidRepositoryCursor, InvalidRepositoryData, InvalidRepositoryDeclaration, InvalidRepositoryEntity, InvalidRepositoryIncrement, InvalidRepositoryQuery, RepositoryConcurrencyConflict, RepositoryEntityNotFound, RepositoryUniqueViolation, RepositoryUsedOutsideApplication, } from "./core/repository/exceptions.js";
|
|
86
|
+
export { type InMemoryProvider, inMemoryProvider, } from "./core/repository/in-memory.js";
|
|
78
87
|
export { providerDescriptionOf, providerOf } from "./core/repository/provider.js";
|
|
79
88
|
export type { RepositorySettings } from "./core/repository/repository.js";
|
|
80
89
|
export { AbstractRepository, isRepository, RepositoryOf, repositoryOf, } from "./core/repository/repository.js";
|
|
81
|
-
export type { ProviderCapabilities, ProviderDescription, ProviderOption, ProviderOptions, ProviderQuery, ProviderSettings, RepositoryCursorPage, RepositoryCursorQuery, RepositoryExists, RepositoryFindCursor, RepositoryFindMany, RepositoryFindPage, RepositoryOrder, RepositoryPage, RepositoryQuery, RepositoryWhere, } from "./core/repository/types/query.interface.js";
|
|
82
|
-
export type { AnyRepository, AnyRepositoryEntity, EntityInstanceOf, EntityKeyOf, EntityNonUniqueKeyOf, EntityUniqueKeyOf, EntityValueOf, IRepositoryProvider, QueryValueOf, RepositoryAction, RepositoryContext, RepositoryCount, RepositoryCreate, RepositoryCreateInput, RepositoryData, RepositoryDelete, RepositoryFindBy, RepositoryFindManyBy, RepositoryUpdate, } from "./core/repository/types/repository.interface.js";
|
|
90
|
+
export type { ProviderCapabilities, ProviderDescription, ProviderOption, ProviderOptions, ProviderQuery, ProviderSettings, RepositoryCursorPage, RepositoryCursorQuery, RepositoryExists, RepositoryExplain, RepositoryFindCursor, RepositoryFindMany, RepositoryFindPage, RepositoryForEachPage, RepositoryIndex, RepositoryOrder, RepositoryPage, RepositoryPlan, RepositoryQuery, RepositoryScans, RepositoryWalkOptions, RepositoryWalkPage, RepositoryWalkResult, RepositoryWhere, } from "./core/repository/types/query.interface.js";
|
|
91
|
+
export type { AnyRepository, AnyRepositoryEntity, EntityIncrementKeyOf, EntityInstanceOf, EntityKeyOf, EntityNonUniqueKeyOf, EntityUniqueKeyOf, EntityValueOf, IRepositoryProvider, ProviderIncrementOptions, ProviderKeyset, ProviderUpdateOptions, QueryValueOf, RepositoryAction, RepositoryContext, RepositoryCount, RepositoryCreate, RepositoryCreateInput, RepositoryData, RepositoryDelete, RepositoryFindBy, RepositoryFindManyBy, RepositoryIncrement, RepositoryIncrementDeltas, RepositoryIncrementOptions, RepositoryRestore, RepositoryUpdate, } from "./core/repository/types/repository.interface.js";
|
|
83
92
|
export type { SchemaClass } from "./core/schema/schema.js";
|
|
84
93
|
export { schemaOf } from "./core/schema/schema.js";
|
|
85
94
|
export type { ISchema, ISchemaType, } from "./core/schema/types/schema.interface.js";
|
|
@@ -88,23 +97,34 @@ export { Demo } from "./core/symbols/demo.js";
|
|
|
88
97
|
export { Kind } from "./core/symbols/kind.js";
|
|
89
98
|
export { Meta } from "./core/symbols/meta.js";
|
|
90
99
|
export { State } from "./core/symbols/state.js";
|
|
91
|
-
export { InvalidUseCaseStep } from "./core/use-case/exceptions.js";
|
|
92
|
-
export
|
|
100
|
+
export { IncompatibleUseCasePlugin, InvalidUseCasePlugin, InvalidUseCaseStep, UnknownUseCasePlugin, UseCaseEntityConflict, UseCaseEntityNotFound, UseCaseInvalidCredentials, UseCaseUnavailable, } from "./core/use-case/exceptions.js";
|
|
101
|
+
export { isUseCasePlugin, useCaseOriginOf, useCasePluginOf, } from "./core/use-case/plugin.js";
|
|
102
|
+
export { isUseCaseCatalog, useCaseCatalogOf, } from "./core/use-case/plugin-catalog.js";
|
|
103
|
+
export type { StepArgs, StepEnsureKind, StepErrorDescription, StepFindTarget, StepReadAction, StepReference, StepRepositoryWith, StepValue, UseCaseStep, UseCaseStepDescription, } from "./core/use-case/steps/types/steps.interface.js";
|
|
104
|
+
export { useCaseTargetOf } from "./core/use-case/target.js";
|
|
105
|
+
export type { AnyUseCasePlugin, EntityOfRepository, IUseCaseCatalog, IUseCasePlugin, MissingRecordPlugin, MissingRepositoryAction, UseCaseCompilation, UseCaseContextOf, UseCaseFieldPlan, UseCaseMaker, UseCaseOriginInfo, UseCasePluginContext, UseCasePluginDescriptor, UseCasePluginRequirements, UseCasePluginSettings, UseCasePluginsByName, UseCaseTarget, UseCaseTargetInfo, } from "./core/use-case/types/plugin.interface.js";
|
|
93
106
|
export type { AnyExceptionClass, AnyUseCaseClass, DependencyFunctions, DependencyOf, DependencyOverrides, StepsUseCaseConstructor, UseCaseCollection, UseCaseConstructor, UseCaseContext, UseCaseDependencies, UseCaseDependency, UseCaseInput, UseCaseOptions, UseCaseResponse, UseCaseSettings, UseCaseStepsSettings, } from "./core/use-case/use-case.js";
|
|
94
107
|
export { AbstractUseCase, InvalidUseCaseDeclaration, InvalidUseCaseDependencies, isUseCase, isUseCaseClass, UseCaseAlreadyExecuted, useCaseOf, } from "./core/use-case/use-case.js";
|
|
95
108
|
export { blueprintOf } from "./std/blueprint.js";
|
|
96
109
|
export { Std } from "./std/blueprint-plugin.js";
|
|
110
|
+
export { commandOf } from "./std/command.js";
|
|
97
111
|
export { entityOf } from "./std/entity.js";
|
|
112
|
+
export { StdEventPolicies } from "./std/event-policies.js";
|
|
98
113
|
export { Email, Ip, Phone, Url } from "./std/properties/contact.js";
|
|
99
114
|
export type { EnumClass } from "./std/properties/enum.js";
|
|
100
115
|
export { enumOf } from "./std/properties/enum.js";
|
|
116
|
+
export { InvalidJsonData, InvalidJsonSchema, } from "./std/properties/exceptions.js";
|
|
101
117
|
export { SchemaProperty } from "./std/properties/headless.js";
|
|
102
118
|
export { Id, Slug } from "./std/properties/identity.js";
|
|
103
|
-
export {
|
|
119
|
+
export type { JsonClass, JsonValue } from "./std/properties/json.js";
|
|
120
|
+
export { checkJsonSchema, JsonProperty, jsonOf, jsonSchemaIssues, } from "./std/properties/json.js";
|
|
121
|
+
export { isPasswordHash, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PASSWORD_SPECIAL_CHARACTERS, Password, PlainPassword, passwordIssues, } from "./std/properties/password.js";
|
|
104
122
|
export { BooleanProperty, Integer, NumberProperty, StringProperty, Text, } from "./std/properties/primitives.js";
|
|
105
|
-
export { CreatedAt, DateProperty, DateTime, DeletedAt, UpdatedAt, } from "./std/properties/time.js";
|
|
123
|
+
export { CreatedAt, DateProperty, DateTime, DeletedAt, ExpiresAt, UpdatedAt, } from "./std/properties/time.js";
|
|
106
124
|
export { recordOf } from "./std/record.js";
|
|
107
125
|
export { Archivable, Authenticatable, Ownable, Publishable, StdRecordPlugins, Taggable, } from "./std/record-plugins.js";
|
|
108
126
|
export type { IdGenerator, PasswordHasher, RuntimeServices, } from "./std/runtime.js";
|
|
109
127
|
export { configure, PasswordHasherRequired, resetRuntime, SyncVerifyUnsupported, } from "./std/runtime.js";
|
|
110
128
|
export { StdStages } from "./std/stages.js";
|
|
129
|
+
export { StdUseCases } from "./std/use-cases/index.js";
|
|
130
|
+
export type { ArchiveMaker, CreateMaker, DeleteMaker, GetMaker, ListMaker, LoginMaker, PublishMaker, RegisterMaker, RestoreMaker, StdCreateOptions, StdEntityOptions, StdHookArgs, StdHookOptions, StdLifecycleOptions, StdListOptions, StdNoHookOptions, StdOwnerOption, StdUseCaseContext, StdUseCaseErrors, StdUseCaseOptions, StdUseCasePlugins, TagMaker, UpdateMaker, } from "./std/use-cases/types.js";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
InvalidEnvironment2,
|
|
3
3
|
environmentOf2,
|
|
4
4
|
isEnvironment2,
|
|
5
|
-
guard2,
|
|
6
5
|
InvalidApplicationDeclaration2,
|
|
7
6
|
DuplicateApplicationDeclaration2,
|
|
8
7
|
ApplicationConflict2,
|
|
@@ -15,6 +14,9 @@ import {
|
|
|
15
14
|
InvalidApplicationEnvironment2,
|
|
16
15
|
useApplication2,
|
|
17
16
|
resetApplication2,
|
|
17
|
+
InvalidEventPolicy2,
|
|
18
|
+
PublisherNotBound2,
|
|
19
|
+
guard2,
|
|
18
20
|
InvalidLogDeclaration2,
|
|
19
21
|
LogLevels2,
|
|
20
22
|
logProviderOf2,
|
|
@@ -25,6 +27,8 @@ import {
|
|
|
25
27
|
ReservedEntityKey2,
|
|
26
28
|
ImmutableEntityKey2,
|
|
27
29
|
DeletedEntity2,
|
|
30
|
+
InvalidEntityExpiry2,
|
|
31
|
+
EntityVersion2,
|
|
28
32
|
entityBuilderOf2,
|
|
29
33
|
isEntityClass2,
|
|
30
34
|
isEntity2,
|
|
@@ -32,6 +36,7 @@ import {
|
|
|
32
36
|
ENTITY_IDENTITY_KEYS2,
|
|
33
37
|
RESERVED_ENTITY_KEYS2,
|
|
34
38
|
EntityUniqueKeys2,
|
|
39
|
+
EntitySettings2,
|
|
35
40
|
AbstractEntity2,
|
|
36
41
|
InvalidRepositoryQuery2,
|
|
37
42
|
InvalidRepositoryCursor2,
|
|
@@ -39,7 +44,10 @@ import {
|
|
|
39
44
|
InvalidRepositoryEntity2,
|
|
40
45
|
InvalidRepositoryData2,
|
|
41
46
|
RepositoryUniqueViolation2,
|
|
47
|
+
RepositoryUsedOutsideApplication2,
|
|
42
48
|
RepositoryEntityNotFound2,
|
|
49
|
+
RepositoryConcurrencyConflict2,
|
|
50
|
+
InvalidRepositoryIncrement2,
|
|
43
51
|
providerOf2,
|
|
44
52
|
providerDescriptionOf2,
|
|
45
53
|
inMemoryProvider2,
|
|
@@ -48,6 +56,16 @@ import {
|
|
|
48
56
|
RepositoryOf2,
|
|
49
57
|
isRepository2,
|
|
50
58
|
InvalidUseCaseStep2,
|
|
59
|
+
InvalidUseCasePlugin2,
|
|
60
|
+
UnknownUseCasePlugin2,
|
|
61
|
+
IncompatibleUseCasePlugin2,
|
|
62
|
+
UseCaseUnavailable2,
|
|
63
|
+
UseCaseEntityNotFound2,
|
|
64
|
+
UseCaseEntityConflict2,
|
|
65
|
+
UseCaseInvalidCredentials2,
|
|
66
|
+
PropertyInput2,
|
|
67
|
+
propertyInputOf2,
|
|
68
|
+
useCaseTargetOf2,
|
|
51
69
|
InvalidUseCaseDeclaration2,
|
|
52
70
|
UseCaseAlreadyExecuted2,
|
|
53
71
|
InvalidUseCaseDependencies2,
|
|
@@ -55,13 +73,21 @@ import {
|
|
|
55
73
|
useCaseOf2,
|
|
56
74
|
isUseCaseClass2,
|
|
57
75
|
isUseCase2,
|
|
76
|
+
isUseCasePlugin2,
|
|
77
|
+
useCaseOriginOf2,
|
|
78
|
+
useCasePluginOf2,
|
|
79
|
+
isUseCaseCatalog2,
|
|
80
|
+
useCaseCatalogOf2,
|
|
58
81
|
InvalidCommandDeclaration2,
|
|
59
82
|
UnknownCommandOperation2,
|
|
60
83
|
InvalidCommandContext2,
|
|
61
84
|
InvalidCommandEnvironment2,
|
|
62
85
|
CommandEventFailed2,
|
|
63
|
-
|
|
86
|
+
commandBuilderOf2,
|
|
64
87
|
isCommand2,
|
|
88
|
+
eventPolicyOf2,
|
|
89
|
+
eventPolicyDescriptionOf2,
|
|
90
|
+
eventPolicyCatalogOf2,
|
|
65
91
|
InvalidOpenAPIModel2,
|
|
66
92
|
InvalidOutputStage2,
|
|
67
93
|
DuplicateOperation2,
|
|
@@ -84,14 +110,19 @@ import {
|
|
|
84
110
|
isApplication2,
|
|
85
111
|
applicationOf2,
|
|
86
112
|
blueprintPluginOf2,
|
|
113
|
+
publishEvents2,
|
|
114
|
+
coerceTextValues2,
|
|
87
115
|
statusOf2,
|
|
88
116
|
PROBLEM_MEDIA_TYPE2,
|
|
89
117
|
problemOf2,
|
|
90
118
|
outputValueOf2,
|
|
119
|
+
ROUTE_OPTION_KEYS2,
|
|
91
120
|
routeOptionsIssue2,
|
|
121
|
+
requestIdHeaderOf2,
|
|
92
122
|
operationRoutes2,
|
|
93
123
|
openapi2,
|
|
94
124
|
select2,
|
|
125
|
+
stripUndeclared2,
|
|
95
126
|
recordPluginCatalogOf2,
|
|
96
127
|
Email2,
|
|
97
128
|
Phone2,
|
|
@@ -105,11 +136,18 @@ import {
|
|
|
105
136
|
resetRuntime2,
|
|
106
137
|
Id2,
|
|
107
138
|
Slug2,
|
|
139
|
+
InvalidJsonData2,
|
|
140
|
+
InvalidJsonSchema2,
|
|
141
|
+
jsonSchemaIssues2,
|
|
142
|
+
checkJsonSchema2,
|
|
143
|
+
JsonProperty2,
|
|
144
|
+
jsonOf2,
|
|
108
145
|
PASSWORD_MIN_LENGTH2,
|
|
109
146
|
PASSWORD_MAX_LENGTH2,
|
|
110
147
|
PASSWORD_SPECIAL_CHARACTERS2,
|
|
111
148
|
isPasswordHash2,
|
|
112
149
|
passwordIssues2,
|
|
150
|
+
PlainPassword2,
|
|
113
151
|
Password2,
|
|
114
152
|
StringProperty2,
|
|
115
153
|
Text2,
|
|
@@ -121,8 +159,11 @@ import {
|
|
|
121
159
|
CreatedAt2,
|
|
122
160
|
UpdatedAt2,
|
|
123
161
|
DeletedAt2,
|
|
162
|
+
ExpiresAt2,
|
|
124
163
|
Std2,
|
|
125
164
|
blueprintOf2,
|
|
165
|
+
StdUseCases2,
|
|
166
|
+
commandOf2,
|
|
126
167
|
Publishable2,
|
|
127
168
|
Archivable2,
|
|
128
169
|
Taggable2,
|
|
@@ -130,9 +171,10 @@ import {
|
|
|
130
171
|
Authenticatable2,
|
|
131
172
|
StdRecordPlugins2,
|
|
132
173
|
entityOf2,
|
|
174
|
+
StdEventPolicies2,
|
|
133
175
|
recordOf2,
|
|
134
176
|
StdStages2
|
|
135
|
-
} from "./index-
|
|
177
|
+
} from "./index-t5qwtyj5.js";
|
|
136
178
|
import {
|
|
137
179
|
isProperty2,
|
|
138
180
|
schemaOf2,
|
|
@@ -162,23 +204,23 @@ import {
|
|
|
162
204
|
MASK2,
|
|
163
205
|
RESERVED_RECORD_KEYS2,
|
|
164
206
|
AbstractRecord2,
|
|
165
|
-
pluginsOf2,
|
|
166
|
-
isRecordPlugin2,
|
|
167
|
-
hasPlugin2,
|
|
168
|
-
recordPluginOf2,
|
|
169
|
-
recordBuilderOf2,
|
|
170
|
-
ReservedBlueprintKey2,
|
|
171
|
-
UndeclaredBlueprintProperty2,
|
|
172
|
-
PropertyRequired2,
|
|
173
|
-
InvalidPropertyValue2,
|
|
174
207
|
State2,
|
|
175
208
|
AbstractProperty2,
|
|
176
209
|
PropertyStates2,
|
|
210
|
+
PropertyRequired2,
|
|
211
|
+
InvalidPropertyValue2,
|
|
177
212
|
AbstractDefineProperty2,
|
|
178
213
|
propertyOf2,
|
|
214
|
+
ReservedBlueprintKey2,
|
|
215
|
+
UndeclaredBlueprintProperty2,
|
|
179
216
|
optionalOf2,
|
|
180
|
-
blueprintBuilderOf2
|
|
181
|
-
|
|
217
|
+
blueprintBuilderOf2,
|
|
218
|
+
pluginsOf2,
|
|
219
|
+
isRecordPlugin2,
|
|
220
|
+
hasPlugin2,
|
|
221
|
+
recordPluginOf2,
|
|
222
|
+
recordBuilderOf2
|
|
223
|
+
} from "./index-qxfkyd6k.js";
|
|
182
224
|
export {
|
|
183
225
|
AbstractDefineProperty2 as AbstractDefineProperty,
|
|
184
226
|
AbstractEntity2 as AbstractEntity,
|
|
@@ -203,19 +245,27 @@ export {
|
|
|
203
245
|
DuplicateOperation2 as DuplicateOperation,
|
|
204
246
|
ENTITY_IDENTITY_KEYS2 as ENTITY_IDENTITY_KEYS,
|
|
205
247
|
Email2 as Email,
|
|
248
|
+
EntitySettings2 as EntitySettings,
|
|
206
249
|
EntityUniqueKeys2 as EntityUniqueKeys,
|
|
250
|
+
EntityVersion2 as EntityVersion,
|
|
207
251
|
Exception2 as Exception,
|
|
208
252
|
ExceptionLayers2 as ExceptionLayers,
|
|
253
|
+
ExpiresAt2 as ExpiresAt,
|
|
209
254
|
Id2 as Id,
|
|
210
255
|
ImmutableEntityKey2 as ImmutableEntityKey,
|
|
211
256
|
IncompatibleRecordPlugin2 as IncompatibleRecordPlugin,
|
|
257
|
+
IncompatibleUseCasePlugin2 as IncompatibleUseCasePlugin,
|
|
212
258
|
Integer2 as Integer,
|
|
213
259
|
InvalidApplicationDeclaration2 as InvalidApplicationDeclaration,
|
|
214
260
|
InvalidApplicationEnvironment2 as InvalidApplicationEnvironment,
|
|
215
261
|
InvalidCommandContext2 as InvalidCommandContext,
|
|
216
262
|
InvalidCommandDeclaration2 as InvalidCommandDeclaration,
|
|
217
263
|
InvalidCommandEnvironment2 as InvalidCommandEnvironment,
|
|
264
|
+
InvalidEntityExpiry2 as InvalidEntityExpiry,
|
|
218
265
|
InvalidEnvironment2 as InvalidEnvironment,
|
|
266
|
+
InvalidEventPolicy2 as InvalidEventPolicy,
|
|
267
|
+
InvalidJsonData2 as InvalidJsonData,
|
|
268
|
+
InvalidJsonSchema2 as InvalidJsonSchema,
|
|
219
269
|
InvalidLogDeclaration2 as InvalidLogDeclaration,
|
|
220
270
|
InvalidOpenAPIModel2 as InvalidOpenAPIModel,
|
|
221
271
|
InvalidOutputStage2 as InvalidOutputStage,
|
|
@@ -227,11 +277,14 @@ export {
|
|
|
227
277
|
InvalidRepositoryData2 as InvalidRepositoryData,
|
|
228
278
|
InvalidRepositoryDeclaration2 as InvalidRepositoryDeclaration,
|
|
229
279
|
InvalidRepositoryEntity2 as InvalidRepositoryEntity,
|
|
280
|
+
InvalidRepositoryIncrement2 as InvalidRepositoryIncrement,
|
|
230
281
|
InvalidRepositoryQuery2 as InvalidRepositoryQuery,
|
|
231
282
|
InvalidUseCaseDeclaration2 as InvalidUseCaseDeclaration,
|
|
232
283
|
InvalidUseCaseDependencies2 as InvalidUseCaseDependencies,
|
|
284
|
+
InvalidUseCasePlugin2 as InvalidUseCasePlugin,
|
|
233
285
|
InvalidUseCaseStep2 as InvalidUseCaseStep,
|
|
234
286
|
Ip2 as Ip,
|
|
287
|
+
JsonProperty2 as JsonProperty,
|
|
235
288
|
Kind2 as Kind,
|
|
236
289
|
LogLevels2 as LogLevels,
|
|
237
290
|
Logger2 as Logger,
|
|
@@ -246,16 +299,22 @@ export {
|
|
|
246
299
|
Password2 as Password,
|
|
247
300
|
PasswordHasherRequired2 as PasswordHasherRequired,
|
|
248
301
|
Phone2 as Phone,
|
|
302
|
+
PlainPassword2 as PlainPassword,
|
|
303
|
+
PropertyInput2 as PropertyInput,
|
|
249
304
|
PropertyRequired2 as PropertyRequired,
|
|
250
305
|
PropertyStates2 as PropertyStates,
|
|
251
306
|
ProviderNotBound2 as ProviderNotBound,
|
|
252
307
|
Publishable2 as Publishable,
|
|
308
|
+
PublisherNotBound2 as PublisherNotBound,
|
|
253
309
|
RESERVED_ENTITY_KEYS2 as RESERVED_ENTITY_KEYS,
|
|
254
310
|
RESERVED_RECORD_KEYS2 as RESERVED_RECORD_KEYS,
|
|
311
|
+
ROUTE_OPTION_KEYS2 as ROUTE_OPTION_KEYS,
|
|
255
312
|
RecordPluginConflict2 as RecordPluginConflict,
|
|
313
|
+
RepositoryConcurrencyConflict2 as RepositoryConcurrencyConflict,
|
|
256
314
|
RepositoryEntityNotFound2 as RepositoryEntityNotFound,
|
|
257
315
|
RepositoryOf2 as RepositoryOf,
|
|
258
316
|
RepositoryUniqueViolation2 as RepositoryUniqueViolation,
|
|
317
|
+
RepositoryUsedOutsideApplication2 as RepositoryUsedOutsideApplication,
|
|
259
318
|
ReservedBlueprintKey2 as ReservedBlueprintKey,
|
|
260
319
|
ReservedEntityKey2 as ReservedEntityKey,
|
|
261
320
|
ReservedRecordKey2 as ReservedRecordKey,
|
|
@@ -263,8 +322,10 @@ export {
|
|
|
263
322
|
Slug2 as Slug,
|
|
264
323
|
State2 as State,
|
|
265
324
|
Std2 as Std,
|
|
325
|
+
StdEventPolicies2 as StdEventPolicies,
|
|
266
326
|
StdRecordPlugins2 as StdRecordPlugins,
|
|
267
327
|
StdStages2 as StdStages,
|
|
328
|
+
StdUseCases2 as StdUseCases,
|
|
268
329
|
StringProperty2 as StringProperty,
|
|
269
330
|
SyncVerifyUnsupported2 as SyncVerifyUnsupported,
|
|
270
331
|
Taggable2 as Taggable,
|
|
@@ -274,16 +335,24 @@ export {
|
|
|
274
335
|
UndeclaredRecordProperty2 as UndeclaredRecordProperty,
|
|
275
336
|
UnknownCommandOperation2 as UnknownCommandOperation,
|
|
276
337
|
UnknownRecordPlugin2 as UnknownRecordPlugin,
|
|
338
|
+
UnknownUseCasePlugin2 as UnknownUseCasePlugin,
|
|
277
339
|
UnregisteredApplicationReference2 as UnregisteredApplicationReference,
|
|
278
340
|
UnregisteredRepositoryDependency2 as UnregisteredRepositoryDependency,
|
|
279
341
|
UnregisteredUseCaseDependency2 as UnregisteredUseCaseDependency,
|
|
280
342
|
UpdatedAt2 as UpdatedAt,
|
|
281
343
|
Url2 as Url,
|
|
282
344
|
UseCaseAlreadyExecuted2 as UseCaseAlreadyExecuted,
|
|
345
|
+
UseCaseEntityConflict2 as UseCaseEntityConflict,
|
|
346
|
+
UseCaseEntityNotFound2 as UseCaseEntityNotFound,
|
|
347
|
+
UseCaseInvalidCredentials2 as UseCaseInvalidCredentials,
|
|
348
|
+
UseCaseUnavailable2 as UseCaseUnavailable,
|
|
283
349
|
applicationOf2 as applicationOf,
|
|
284
350
|
blueprintBuilderOf2 as blueprintBuilderOf,
|
|
285
351
|
blueprintOf2 as blueprintOf,
|
|
286
352
|
blueprintPluginOf2 as blueprintPluginOf,
|
|
353
|
+
checkJsonSchema2 as checkJsonSchema,
|
|
354
|
+
coerceTextValues2 as coerceTextValues,
|
|
355
|
+
commandBuilderOf2 as commandBuilderOf,
|
|
287
356
|
commandOf2 as commandOf,
|
|
288
357
|
configure2 as configure,
|
|
289
358
|
consoleLogProvider2 as consoleLogProvider,
|
|
@@ -292,6 +361,9 @@ export {
|
|
|
292
361
|
enumOf2 as enumOf,
|
|
293
362
|
environmentOf2 as environmentOf,
|
|
294
363
|
eventOf2 as eventOf,
|
|
364
|
+
eventPolicyCatalogOf2 as eventPolicyCatalogOf,
|
|
365
|
+
eventPolicyDescriptionOf2 as eventPolicyDescriptionOf,
|
|
366
|
+
eventPolicyOf2 as eventPolicyOf,
|
|
295
367
|
exceptionOf2 as exceptionOf,
|
|
296
368
|
guard2 as guard,
|
|
297
369
|
hasPlugin2 as hasPlugin,
|
|
@@ -315,8 +387,12 @@ export {
|
|
|
315
387
|
isRecordPlugin2 as isRecordPlugin,
|
|
316
388
|
isRepository2 as isRepository,
|
|
317
389
|
isUseCase2 as isUseCase,
|
|
390
|
+
isUseCaseCatalog2 as isUseCaseCatalog,
|
|
318
391
|
isUseCaseClass2 as isUseCaseClass,
|
|
392
|
+
isUseCasePlugin2 as isUseCasePlugin,
|
|
319
393
|
jsonLogProvider2 as jsonLogProvider,
|
|
394
|
+
jsonOf2 as jsonOf,
|
|
395
|
+
jsonSchemaIssues2 as jsonSchemaIssues,
|
|
320
396
|
listOf2 as listOf,
|
|
321
397
|
logFrom2 as logFrom,
|
|
322
398
|
logProviderOf2 as logProviderOf,
|
|
@@ -330,12 +406,14 @@ export {
|
|
|
330
406
|
passwordIssues2 as passwordIssues,
|
|
331
407
|
pluginsOf2 as pluginsOf,
|
|
332
408
|
problemOf2 as problemOf,
|
|
409
|
+
propertyInputOf2 as propertyInputOf,
|
|
333
410
|
propertyLineageOf2 as propertyLineageOf,
|
|
334
411
|
propertyOf2 as propertyOf,
|
|
335
412
|
providerDescriptionOf2 as providerDescriptionOf,
|
|
336
413
|
providerFrom2 as providerFrom,
|
|
337
414
|
providerOf2 as providerOf,
|
|
338
415
|
providersOf2 as providersOf,
|
|
416
|
+
publishEvents2 as publishEvents,
|
|
339
417
|
recordBuilderOf2 as recordBuilderOf,
|
|
340
418
|
recordFieldOf2 as recordFieldOf,
|
|
341
419
|
recordNameOf2 as recordNameOf,
|
|
@@ -343,6 +421,7 @@ export {
|
|
|
343
421
|
recordPluginCatalogOf2 as recordPluginCatalogOf,
|
|
344
422
|
recordPluginOf2 as recordPluginOf,
|
|
345
423
|
repositoryOf2 as repositoryOf,
|
|
424
|
+
requestIdHeaderOf2 as requestIdHeaderOf,
|
|
346
425
|
resetApplication2 as resetApplication,
|
|
347
426
|
resetRuntime2 as resetRuntime,
|
|
348
427
|
routeOptionsIssue2 as routeOptionsIssue,
|
|
@@ -353,8 +432,13 @@ export {
|
|
|
353
432
|
stageDescriptionOf2 as stageDescriptionOf,
|
|
354
433
|
stageKindOf2 as stageKindOf,
|
|
355
434
|
statusOf2 as statusOf,
|
|
435
|
+
stripUndeclared2 as stripUndeclared,
|
|
356
436
|
toOpenAPI2 as toOpenAPI,
|
|
357
437
|
transformOf2 as transformOf,
|
|
358
438
|
useApplication2 as useApplication,
|
|
359
|
-
|
|
439
|
+
useCaseCatalogOf2 as useCaseCatalogOf,
|
|
440
|
+
useCaseOf2 as useCaseOf,
|
|
441
|
+
useCaseOriginOf2 as useCaseOriginOf,
|
|
442
|
+
useCasePluginOf2 as useCasePluginOf,
|
|
443
|
+
useCaseTargetOf2 as useCaseTargetOf
|
|
360
444
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { enumOf } from "./properties/enum.js";
|
|
2
2
|
import { SchemaProperty } from "./properties/headless.js";
|
|
3
3
|
import { Id, Slug } from "./properties/identity.js";
|
|
4
|
+
import { jsonOf } from "./properties/json.js";
|
|
4
5
|
import { Password } from "./properties/password.js";
|
|
5
6
|
import { CreatedAt, DateTime, DeletedAt, UpdatedAt } from "./properties/time.js";
|
|
6
7
|
/**
|
|
7
|
-
* The standard properties, for blueprints to pick from, and
|
|
8
|
-
* `ctx.enumOf(["draft", "published"])`.
|
|
8
|
+
* The standard properties, for blueprints to pick from, and the factories
|
|
9
|
+
* `enumOf` and `jsonOf`, as `ctx.enumOf(["draft", "published"])`.
|
|
9
10
|
*/
|
|
10
11
|
export declare const Std: import("../index.js").IBlueprintPlugin<{
|
|
11
12
|
id: typeof Id;
|
|
@@ -26,10 +27,13 @@ export declare const Std: import("../index.js").IBlueprintPlugin<{
|
|
|
26
27
|
updatedAt: typeof UpdatedAt;
|
|
27
28
|
deletedAt: typeof DeletedAt;
|
|
28
29
|
schema: typeof SchemaProperty;
|
|
30
|
+
json: import("../index.js").PropertyClass<import("typebox").TUnsafe<import("../index.js").JsonValue>, import("../index.js").JsonValue>;
|
|
29
31
|
}, {
|
|
30
32
|
enumOf: typeof enumOf;
|
|
33
|
+
jsonOf: typeof jsonOf;
|
|
31
34
|
}> & {
|
|
32
35
|
readonly factories: {
|
|
33
36
|
enumOf: typeof enumOf;
|
|
37
|
+
jsonOf: typeof jsonOf;
|
|
34
38
|
};
|
|
35
39
|
};
|
package/dist/std/blueprint.d.ts
CHANGED
|
@@ -22,10 +22,13 @@ export declare const blueprintOf: import("../index.js").BlueprintBuilder<readonl
|
|
|
22
22
|
updatedAt: typeof import("../index.js").UpdatedAt;
|
|
23
23
|
deletedAt: typeof import("../index.js").DeletedAt;
|
|
24
24
|
schema: typeof import("../index.js").SchemaProperty;
|
|
25
|
+
json: import("../index.js").PropertyClass<import("typebox").TUnsafe<import("../index.js").JsonValue>, import("../index.js").JsonValue>;
|
|
25
26
|
}, {
|
|
26
27
|
enumOf: typeof import("../index.js").enumOf;
|
|
28
|
+
jsonOf: typeof import("../index.js").jsonOf;
|
|
27
29
|
}> & {
|
|
28
30
|
readonly factories: {
|
|
29
31
|
enumOf: typeof import("../index.js").enumOf;
|
|
32
|
+
jsonOf: typeof import("../index.js").jsonOf;
|
|
30
33
|
};
|
|
31
34
|
}]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandBuilder } from "../core/command/types/command.interface.js";
|
|
2
|
+
import type { StdUseCaseContext } from "./use-cases/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Groups use cases under operation names and is the boundary of a call: the
|
|
5
|
+
* context is validated once, a transaction can wrap the use case, and the
|
|
6
|
+
* events it raised are handled by a policy once it succeeded. `useCases` is
|
|
7
|
+
* an object of use case classes, or a function of the standard use cases
|
|
8
|
+
* (`StdUseCases`) that gives one:
|
|
9
|
+
* `(ctx) => ({ create: ctx.create(Posts), custom: MyUseCase })`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const commandOf: CommandBuilder<StdUseCaseContext>;
|
package/dist/std/entity.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { CreatedAt, DeletedAt, UpdatedAt } from "./properties/time.js";
|
|
|
4
4
|
* An entity of `blueprint`: a record with an `id` (a UUID v7, in
|
|
5
5
|
* `options.unique`) and a `createdAt`, both made when missing from its value,
|
|
6
6
|
* an `updatedAt` set by each change, and a `deletedAt` set by `destroy`, after
|
|
7
|
-
* which it no longer changes
|
|
7
|
+
* which it no longer changes; with `expires: { after }`, an `expiresAt` too.
|
|
8
|
+
* E.g.
|
|
8
9
|
* `class User extends entityOf(blueprintOf((ctx) => ({ name: ctx.string }))) {}`.
|
|
9
10
|
* As a record, the class can be a field of another blueprint, e.g.
|
|
10
11
|
* `{ author: User }`, with `optionalOf` and `listOf`. `options.plugins` picks
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Issue } from "../../core/parse/types/parse.interface.js";
|
|
2
|
+
/**
|
|
3
|
+
* JSON data that its JSON Schema rejects, or that is not JSON at all, as
|
|
4
|
+
* `checkJsonSchema` finds it; `details.issues` says where and why (so
|
|
5
|
+
* `statusOf` gives 400).
|
|
6
|
+
*/
|
|
7
|
+
export declare const InvalidJsonData: import("../../index.js").DeclaredExceptionClass<{
|
|
8
|
+
readonly issues: readonly Issue[];
|
|
9
|
+
}>;
|
|
10
|
+
/** A schema given to `jsonOf` or `checkJsonSchema` that is not a JSON Schema (draft 2020-12). */
|
|
11
|
+
export declare const InvalidJsonSchema: import("../../index.js").DeclaredExceptionClass<undefined>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Static, type TOptional, type TSchema, Type } from "typebox";
|
|
2
|
+
import type { Issue } from "../../core/parse/types/parse.interface.js";
|
|
3
|
+
import { type PropertyClass } from "../../core/property/property.js";
|
|
4
|
+
/** A value JSON can hold, as `JSON.parse` gives it. */
|
|
5
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
6
|
+
readonly [key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Every issue that keeps `value` from being JSON valid for `schema` (a JSON
|
|
10
|
+
* Schema, draft 2020-12, or a TypeBox type), as afora issues: empty when
|
|
11
|
+
* there is none. For schemas known at runtime only, e.g. loaded from a
|
|
12
|
+
* database: TypeBox checks the value by walking the schema, compiling
|
|
13
|
+
* nothing. Throws `InvalidJsonSchema` when `schema` is not a JSON Schema.
|
|
14
|
+
*/
|
|
15
|
+
export declare function jsonSchemaIssues(schema: unknown, value: unknown, { source }?: {
|
|
16
|
+
readonly source?: string;
|
|
17
|
+
}): readonly Issue[];
|
|
18
|
+
/**
|
|
19
|
+
* `value`, when it is JSON valid for `schema`; else throws `InvalidJsonData`
|
|
20
|
+
* with every issue in `details.issues` (a 400 for `statusOf`). `source` names
|
|
21
|
+
* what is checked in the issues and the exception, e.g. the content type.
|
|
22
|
+
* The value is typed by a schema whose type is known (`Static`), else as
|
|
23
|
+
* `JsonValue`, as for a schema loaded at runtime. See `jsonSchemaIssues`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkJsonSchema<const Schema extends TSchema>(schema: Schema, value: unknown, options?: {
|
|
26
|
+
readonly source?: string;
|
|
27
|
+
}): Static<Schema>;
|
|
28
|
+
export declare function checkJsonSchema(schema: unknown, value: unknown, options?: {
|
|
29
|
+
readonly source?: string;
|
|
30
|
+
}): JsonValue;
|
|
31
|
+
/**
|
|
32
|
+
* Any JSON value: `null`, a boolean, a finite number, a string, or a list or
|
|
33
|
+
* plain object of them, at any depth. Rejects `undefined` (in a list or an
|
|
34
|
+
* object too), functions, `NaN`, class instances such as `Date`, and cycles.
|
|
35
|
+
* For JSON of a known shape, `jsonOf({ schema })`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const JsonProperty: PropertyClass<Type.TUnsafe<JsonValue>, JsonValue>;
|
|
38
|
+
/** A class declared with `jsonOf`. */
|
|
39
|
+
export type JsonClass<Schema extends TSchema, Optional extends boolean = false> = PropertyClass<Optional extends true ? TOptional<Schema> : Schema, Static<Schema>>;
|
|
40
|
+
/**
|
|
41
|
+
* JSON checked by a JSON Schema (draft 2020-12) known when the property is
|
|
42
|
+
* declared, written as JSON (`{ type: "object", properties: {...} }`, typed
|
|
43
|
+
* as `Static` gives it) or with TypeBox (`Type.Object({...})`). Its issues
|
|
44
|
+
* are at the path of the data that breaks the schema. Throws
|
|
45
|
+
* `InvalidJsonSchema` for a schema that is not a JSON Schema. For a schema
|
|
46
|
+
* known only at runtime, `checkJsonSchema`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function jsonOf<const Schema extends TSchema, Optional extends boolean = false>({ schema, name, optional, default: _default, }: {
|
|
49
|
+
readonly schema: Schema;
|
|
50
|
+
readonly name?: string;
|
|
51
|
+
readonly optional?: Optional;
|
|
52
|
+
/** The demo value; one TypeBox makes from the schema, when it can, by default. */
|
|
53
|
+
readonly default?: Static<Schema>;
|
|
54
|
+
}): JsonClass<Schema, Optional>;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import { type IPropertyInput, PropertyInput } from "../../core/property/input.js";
|
|
2
3
|
export declare const PASSWORD_MIN_LENGTH = 7;
|
|
3
4
|
export declare const PASSWORD_MAX_LENGTH = 128;
|
|
4
5
|
export declare const PASSWORD_SPECIAL_CHARACTERS = "!@#$%^&*()-_=+[]{}|\\;:'\",.<>/?`~";
|
|
5
6
|
export declare function isPasswordHash(value: string): boolean;
|
|
6
7
|
/** The rules a plain password breaks; empty when it is strong enough. */
|
|
7
8
|
export declare function passwordIssues(value: string): string[];
|
|
9
|
+
declare const PlainPassword_base: import("../../index.js").PropertyClass<Type.TString, string> & {
|
|
10
|
+
readonly type: {
|
|
11
|
+
readonly sensitive: true;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A password as a person types it, checked against the password rules
|
|
16
|
+
* (`passwordIssues`); sensitive. It is what an input takes for a `Password`,
|
|
17
|
+
* which stores the hash.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PlainPassword extends PlainPassword_base {
|
|
20
|
+
}
|
|
8
21
|
declare const Password_base: import("../../index.js").PropertyClass<Type.TString, string> & {
|
|
9
22
|
readonly type: {
|
|
10
23
|
readonly sensitive: true;
|
|
@@ -13,9 +26,11 @@ declare const Password_base: import("../../index.js").PropertyClass<Type.TString
|
|
|
13
26
|
/**
|
|
14
27
|
* A password stored as an Argon2 hash. The constructor only accepts a hash,
|
|
15
28
|
* e.g. one read from the database; `Password.hash` turns a plain password
|
|
16
|
-
* into one.
|
|
29
|
+
* into one. Under `PropertyInput` it says so to what derives inputs: they
|
|
30
|
+
* take a `PlainPassword` and hash it.
|
|
17
31
|
*/
|
|
18
32
|
export declare class Password extends Password_base {
|
|
33
|
+
static readonly [PropertyInput]: IPropertyInput<string>;
|
|
19
34
|
/** Validates `plain` against the password rules and hashes it with the configured hasher (argon2id by default). */
|
|
20
35
|
static hash(plain: string): Promise<Password>;
|
|
21
36
|
/** Whether `input` is the password this hash was made from. */
|
|
@@ -23,4 +23,8 @@ declare const DeletedAt_base: DateTimeClass<true>;
|
|
|
23
23
|
/** When a record was soft-deleted; absent while it is not. */
|
|
24
24
|
export declare class DeletedAt extends DeletedAt_base {
|
|
25
25
|
}
|
|
26
|
+
declare const ExpiresAt_base: DateTimeClass<false>;
|
|
27
|
+
/** When a record expires, for entities declared with `expires: { after }`. */
|
|
28
|
+
export declare class ExpiresAt extends ExpiresAt_base {
|
|
29
|
+
}
|
|
26
30
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LoginMaker, RegisterMaker } from "./types.js";
|
|
2
|
+
/** Stores an authenticatable entity, unless its email is taken. */
|
|
3
|
+
export declare const register: import("../../index.js").IUseCasePlugin<"register", RegisterMaker>;
|
|
4
|
+
/** Gives the authenticatable entity of an email, when the password matches. */
|
|
5
|
+
export declare const login: import("../../index.js").IUseCasePlugin<"login", LoginMaker>;
|