@afora/core 0.0.8 → 0.0.9

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.
Files changed (74) hide show
  1. package/README.md +127 -23
  2. package/dist/adapters.d.ts +25 -0
  3. package/dist/adapters.js +56 -0
  4. package/dist/core/application/exceptions.d.ts +17 -0
  5. package/dist/core/application/migrate.d.ts +19 -0
  6. package/dist/core/application/schema.d.ts +30 -0
  7. package/dist/core/application/types/application.interface.d.ts +37 -0
  8. package/dist/core/auth/jwt.d.ts +30 -0
  9. package/dist/core/auth/types/jwt.interface.d.ts +66 -0
  10. package/dist/core/blueprint/exceptions.d.ts +5 -0
  11. package/dist/core/blueprint/optional.d.ts +3 -1
  12. package/dist/core/blueprint/types/blueprint.interface.d.ts +79 -5
  13. package/dist/core/blueprint/variant.d.ts +32 -0
  14. package/dist/core/entity/abstract-entity.d.ts +5 -0
  15. package/dist/core/entity/entity.d.ts +1 -1
  16. package/dist/core/entity/exceptions.d.ts +9 -0
  17. package/dist/core/entity/trust.d.ts +24 -0
  18. package/dist/core/entity/types/entity.interface.d.ts +30 -0
  19. package/dist/core/output/access.d.ts +16 -0
  20. package/dist/core/output/exceptions.d.ts +16 -0
  21. package/dist/core/output/http.d.ts +36 -0
  22. package/dist/core/output/openapi-sink.d.ts +23 -2
  23. package/dist/core/output/stage.d.ts +7 -2
  24. package/dist/core/output/status.d.ts +1 -1
  25. package/dist/core/output/types/http.interface.d.ts +130 -0
  26. package/dist/core/output/types/output.interface.d.ts +25 -5
  27. package/dist/core/parse/issue.d.ts +28 -3
  28. package/dist/core/parse/parse.d.ts +9 -0
  29. package/dist/core/property/abstract-property.d.ts +9 -0
  30. package/dist/core/property/define-property.d.ts +34 -6
  31. package/dist/core/property/types/property-options.interface.d.ts +10 -0
  32. package/dist/core/property/types/property-type.interface.d.ts +4 -0
  33. package/dist/core/record/abstract-record.d.ts +7 -0
  34. package/dist/core/record/types/record.interface.d.ts +12 -1
  35. package/dist/core/repository/exceptions.d.ts +13 -0
  36. package/dist/core/repository/in-memory.d.ts +2 -2
  37. package/dist/core/repository/migrate.d.ts +20 -0
  38. package/dist/core/repository/state.d.ts +2 -0
  39. package/dist/core/repository/types/repository.interface.d.ts +33 -0
  40. package/dist/core/repository/types/schema.interface.d.ts +126 -0
  41. package/dist/core/repository/upcast.d.ts +64 -0
  42. package/dist/core/schema/schema.d.ts +28 -0
  43. package/dist/core/symbols/kind.d.ts +1 -1
  44. package/dist/core/use-case/access.d.ts +12 -0
  45. package/dist/core/use-case/decorators.d.ts +40 -0
  46. package/dist/core/use-case/route.d.ts +18 -0
  47. package/dist/core/use-case/steps/types/check.interface.d.ts +214 -0
  48. package/dist/core/use-case/types/access.interface.d.ts +39 -0
  49. package/dist/core/use-case/types/route.interface.d.ts +66 -0
  50. package/dist/core/use-case/use-case.d.ts +52 -2
  51. package/dist/experimental.d.ts +13 -1
  52. package/dist/experimental.js +63 -25
  53. package/dist/index-3aae5jfq.js +2997 -0
  54. package/dist/index-hg1z2s2v.js +1055 -0
  55. package/dist/index-ny3as79r.js +4567 -0
  56. package/dist/index-xegv6a1p.js +4291 -0
  57. package/dist/index-y280ew0k.js +396 -0
  58. package/dist/index.d.ts +45 -49
  59. package/dist/index.js +110 -186
  60. package/dist/std/properties/password.d.ts +0 -2
  61. package/dist/std/record-plugins.d.ts +2 -2
  62. package/dist/std/resource.d.ts +31 -0
  63. package/dist/std/runtime.d.ts +6 -0
  64. package/dist/std/use-cases/auth.d.ts +5 -1
  65. package/dist/std/use-cases/index.d.ts +1 -1
  66. package/dist/std/use-cases/shared.d.ts +2 -2
  67. package/dist/std/use-cases/types.d.ts +97 -1
  68. package/dist/testing/http-provider-contract.d.ts +32 -0
  69. package/dist/testing/index.d.ts +2 -0
  70. package/dist/testing/index.js +495 -4
  71. package/dist/testing/provider-contract.d.ts +17 -1
  72. package/package.json +16 -3
  73. package/dist/index-qxfkyd6k.js +0 -1721
  74. package/dist/index-t5qwtyj5.js +0 -8194
package/dist/index.js CHANGED
@@ -1,81 +1,4 @@
1
1
  import {
2
- InvalidEnvironment2,
3
- environmentOf2,
4
- isEnvironment2,
5
- InvalidApplicationDeclaration2,
6
- DuplicateApplicationDeclaration2,
7
- ApplicationConflict2,
8
- UnregisteredApplicationReference2,
9
- UnregisteredRepositoryDependency2,
10
- UnregisteredUseCaseDependency2,
11
- ApplicationNotStarted2,
12
- ProviderNotBound2,
13
- ApplicationAlreadyStarted2,
14
- InvalidApplicationEnvironment2,
15
- useApplication2,
16
- resetApplication2,
17
- InvalidEventPolicy2,
18
- PublisherNotBound2,
19
- guard2,
20
- InvalidLogDeclaration2,
21
- LogLevels2,
22
- logProviderOf2,
23
- consoleLogProvider2,
24
- jsonLogProvider2,
25
- memoryLogProvider2,
26
- Logger2,
27
- ReservedEntityKey2,
28
- ImmutableEntityKey2,
29
- DeletedEntity2,
30
- InvalidEntityExpiry2,
31
- EntityVersion2,
32
- entityBuilderOf2,
33
- isEntityClass2,
34
- isEntity2,
35
- eventOf2,
36
- ENTITY_IDENTITY_KEYS2,
37
- RESERVED_ENTITY_KEYS2,
38
- EntityUniqueKeys2,
39
- EntitySettings2,
40
- AbstractEntity2,
41
- InvalidRepositoryQuery2,
42
- InvalidRepositoryCursor2,
43
- InvalidRepositoryDeclaration2,
44
- InvalidRepositoryEntity2,
45
- InvalidRepositoryData2,
46
- RepositoryUniqueViolation2,
47
- RepositoryUsedOutsideApplication2,
48
- RepositoryEntityNotFound2,
49
- RepositoryConcurrencyConflict2,
50
- InvalidRepositoryIncrement2,
51
- providerOf2,
52
- providerDescriptionOf2,
53
- inMemoryProvider2,
54
- AbstractRepository2,
55
- repositoryOf2,
56
- RepositoryOf2,
57
- isRepository2,
58
- InvalidUseCaseStep2,
59
- InvalidUseCasePlugin2,
60
- UnknownUseCasePlugin2,
61
- IncompatibleUseCasePlugin2,
62
- UseCaseUnavailable2,
63
- UseCaseEntityNotFound2,
64
- UseCaseEntityConflict2,
65
- UseCaseInvalidCredentials2,
66
- PropertyInput2,
67
- propertyInputOf2,
68
- useCaseTargetOf2,
69
- InvalidUseCaseDeclaration2,
70
- UseCaseAlreadyExecuted2,
71
- InvalidUseCaseDependencies2,
72
- AbstractUseCase2,
73
- useCaseOf2,
74
- isUseCaseClass2,
75
- isUseCase2,
76
- isUseCasePlugin2,
77
- useCaseOriginOf2,
78
- useCasePluginOf2,
79
2
  isUseCaseCatalog2,
80
3
  useCaseCatalogOf2,
81
4
  InvalidCommandDeclaration2,
@@ -85,45 +8,21 @@ import {
85
8
  CommandEventFailed2,
86
9
  commandBuilderOf2,
87
10
  isCommand2,
88
- eventPolicyOf2,
89
- eventPolicyDescriptionOf2,
90
- eventPolicyCatalogOf2,
91
- InvalidOpenAPIModel2,
92
- InvalidOutputStage2,
93
- DuplicateOperation2,
94
- toOpenAPI2,
95
- transformOf2,
96
- sinkOf2,
97
- stageDescriptionOf2,
98
- stageKindOf2,
99
- stageCatalogOf2,
100
11
  operationOf2,
101
12
  outputOf2,
102
13
  isOutput2,
103
14
  providerFrom2,
104
15
  logFrom2,
105
- isLogFactory2,
106
16
  isProviderFactory2,
107
17
  providersOf2,
108
- isProviderSlot2,
109
- isProviderStorage2,
110
- isApplication2,
111
18
  applicationOf2,
112
19
  blueprintPluginOf2,
113
20
  publishEvents2,
114
- coerceTextValues2,
115
- statusOf2,
116
- PROBLEM_MEDIA_TYPE2,
117
- problemOf2,
118
- outputValueOf2,
119
- ROUTE_OPTION_KEYS2,
120
- routeOptionsIssue2,
121
- requestIdHeaderOf2,
122
- operationRoutes2,
123
- openapi2,
124
21
  select2,
125
22
  stripUndeclared2,
126
23
  recordPluginCatalogOf2,
24
+ Route2,
25
+ Access2,
127
26
  Email2,
128
27
  Phone2,
129
28
  Url2,
@@ -142,11 +41,6 @@ import {
142
41
  checkJsonSchema2,
143
42
  JsonProperty2,
144
43
  jsonOf2,
145
- PASSWORD_MIN_LENGTH2,
146
- PASSWORD_MAX_LENGTH2,
147
- PASSWORD_SPECIAL_CHARACTERS2,
148
- isPasswordHash2,
149
- passwordIssues2,
150
44
  PlainPassword2,
151
45
  Password2,
152
46
  StringProperty2,
@@ -173,25 +67,76 @@ import {
173
67
  entityOf2,
174
68
  StdEventPolicies2,
175
69
  recordOf2,
70
+ resourceOf2,
176
71
  StdStages2
177
- } from "./index-t5qwtyj5.js";
72
+ } from "./index-ny3as79r.js";
73
+ import {
74
+ openapi2
75
+ } from "./index-hg1z2s2v.js";
76
+ import {
77
+ InvalidEventPolicy2,
78
+ PublisherNotBound2,
79
+ guard2,
80
+ providerOf2,
81
+ inMemoryProvider2,
82
+ repositoryOf2,
83
+ RepositoryOf2,
84
+ InvalidUseCaseStep2,
85
+ InvalidUseCasePlugin2,
86
+ UnknownUseCasePlugin2,
87
+ IncompatibleUseCasePlugin2,
88
+ UseCaseUnavailable2,
89
+ UseCaseEntityNotFound2,
90
+ UseCaseEntityConflict2,
91
+ UseCaseInvalidCredentials2,
92
+ PropertyInput2,
93
+ propertyInputOf2,
94
+ InvalidUseCaseDeclaration2,
95
+ UseCaseAlreadyExecuted2,
96
+ InvalidUseCaseDependencies2,
97
+ useCaseOf2,
98
+ isUseCaseClass2,
99
+ isUseCase2,
100
+ isUseCasePlugin2,
101
+ useCasePluginOf2,
102
+ eventPolicyOf2
103
+ } from "./index-3aae5jfq.js";
178
104
  import {
179
- isProperty2,
180
- schemaOf2,
181
- Demo2,
182
- propertyLineageOf2,
183
- Kind2,
184
- isBlueprint2,
185
- isRecordClass2,
186
- isOptionalRecord2,
187
- recordFieldOf2,
188
- recordNameOf2,
189
- listOf2,
190
- isBlueprintList2,
191
105
  ExceptionLayers2,
192
- UNEXPECTED_ERROR2,
193
106
  Exception2,
194
107
  exceptionOf2,
108
+ ReservedBlueprintKey2,
109
+ InvalidBlueprintVariant2,
110
+ UndeclaredBlueprintProperty2,
111
+ variantOf2,
112
+ State2,
113
+ PropertyRequired2,
114
+ InvalidPropertyValue2,
115
+ recordNameOf2,
116
+ listOf2,
117
+ InvalidEnvironment2,
118
+ environmentOf2,
119
+ InvalidApplicationDeclaration2,
120
+ DuplicateApplicationDeclaration2,
121
+ ApplicationConflict2,
122
+ UnregisteredApplicationReference2,
123
+ UnregisteredRepositoryDependency2,
124
+ UnregisteredUseCaseDependency2,
125
+ ApplicationNotStarted2,
126
+ ProviderNotBound2,
127
+ ApplicationAlreadyStarted2,
128
+ SchemaLockMismatch2,
129
+ InvalidSchemaMigration2,
130
+ InvalidApplicationEnvironment2,
131
+ useApplication2,
132
+ resetApplication2,
133
+ InvalidLogDeclaration2,
134
+ LogLevels2,
135
+ logProviderOf2,
136
+ consoleLogProvider2,
137
+ jsonLogProvider2,
138
+ memoryLogProvider2,
139
+ Logger2,
195
140
  Meta2,
196
141
  InvalidRecordValue2,
197
142
  InvalidRecordDeclaration2,
@@ -202,32 +147,46 @@ import {
202
147
  UnknownRecordPlugin2,
203
148
  IncompatibleRecordPlugin2,
204
149
  MASK2,
205
- RESERVED_RECORD_KEYS2,
206
- AbstractRecord2,
207
- State2,
208
- AbstractProperty2,
209
- PropertyStates2,
210
- PropertyRequired2,
211
- InvalidPropertyValue2,
212
- AbstractDefineProperty2,
213
150
  propertyOf2,
214
- ReservedBlueprintKey2,
215
- UndeclaredBlueprintProperty2,
216
151
  optionalOf2,
217
152
  blueprintBuilderOf2,
218
153
  pluginsOf2,
219
- isRecordPlugin2,
220
154
  hasPlugin2,
221
155
  recordPluginOf2,
222
- recordBuilderOf2
223
- } from "./index-qxfkyd6k.js";
156
+ recordBuilderOf2,
157
+ ReservedEntityKey2,
158
+ ImmutableEntityKey2,
159
+ DeletedEntity2,
160
+ InvalidEntityExpiry2,
161
+ InvalidEntitySchemaVersion2,
162
+ EntityVersion2,
163
+ entityBuilderOf2,
164
+ isEntityClass2,
165
+ isEntity2,
166
+ eventOf2,
167
+ EntityUniqueKeys2,
168
+ EntitySettings2,
169
+ InvalidRepositoryQuery2,
170
+ InvalidRepositoryCursor2,
171
+ InvalidRepositoryDeclaration2,
172
+ InvalidRepositoryEntity2,
173
+ InvalidStoredSchemaVersion2,
174
+ InvalidRepositoryData2,
175
+ RepositoryUniqueViolation2,
176
+ RepositoryUsedOutsideApplication2,
177
+ RepositoryEntityNotFound2,
178
+ RepositoryConcurrencyConflict2,
179
+ InvalidRepositoryIncrement2,
180
+ InvalidOpenAPIModel2,
181
+ toOpenAPI2,
182
+ InvalidOutputStage2,
183
+ DuplicateOperation2,
184
+ Unauthenticated2,
185
+ Forbidden2,
186
+ transformOf2
187
+ } from "./index-xegv6a1p.js";
224
188
  export {
225
- AbstractDefineProperty2 as AbstractDefineProperty,
226
- AbstractEntity2 as AbstractEntity,
227
- AbstractProperty2 as AbstractProperty,
228
- AbstractRecord2 as AbstractRecord,
229
- AbstractRepository2 as AbstractRepository,
230
- AbstractUseCase2 as AbstractUseCase,
189
+ Access2 as Access,
231
190
  ApplicationAlreadyStarted2 as ApplicationAlreadyStarted,
232
191
  ApplicationConflict2 as ApplicationConflict,
233
192
  ApplicationNotStarted2 as ApplicationNotStarted,
@@ -240,10 +199,8 @@ export {
240
199
  DateTime2 as DateTime,
241
200
  DeletedAt2 as DeletedAt,
242
201
  DeletedEntity2 as DeletedEntity,
243
- Demo2 as Demo,
244
202
  DuplicateApplicationDeclaration2 as DuplicateApplicationDeclaration,
245
203
  DuplicateOperation2 as DuplicateOperation,
246
- ENTITY_IDENTITY_KEYS2 as ENTITY_IDENTITY_KEYS,
247
204
  Email2 as Email,
248
205
  EntitySettings2 as EntitySettings,
249
206
  EntityUniqueKeys2 as EntityUniqueKeys,
@@ -251,6 +208,7 @@ export {
251
208
  Exception2 as Exception,
252
209
  ExceptionLayers2 as ExceptionLayers,
253
210
  ExpiresAt2 as ExpiresAt,
211
+ Forbidden2 as Forbidden,
254
212
  Id2 as Id,
255
213
  ImmutableEntityKey2 as ImmutableEntityKey,
256
214
  IncompatibleRecordPlugin2 as IncompatibleRecordPlugin,
@@ -258,10 +216,12 @@ export {
258
216
  Integer2 as Integer,
259
217
  InvalidApplicationDeclaration2 as InvalidApplicationDeclaration,
260
218
  InvalidApplicationEnvironment2 as InvalidApplicationEnvironment,
219
+ InvalidBlueprintVariant2 as InvalidBlueprintVariant,
261
220
  InvalidCommandContext2 as InvalidCommandContext,
262
221
  InvalidCommandDeclaration2 as InvalidCommandDeclaration,
263
222
  InvalidCommandEnvironment2 as InvalidCommandEnvironment,
264
223
  InvalidEntityExpiry2 as InvalidEntityExpiry,
224
+ InvalidEntitySchemaVersion2 as InvalidEntitySchemaVersion,
265
225
  InvalidEnvironment2 as InvalidEnvironment,
266
226
  InvalidEventPolicy2 as InvalidEventPolicy,
267
227
  InvalidJsonData2 as InvalidJsonData,
@@ -279,36 +239,29 @@ export {
279
239
  InvalidRepositoryEntity2 as InvalidRepositoryEntity,
280
240
  InvalidRepositoryIncrement2 as InvalidRepositoryIncrement,
281
241
  InvalidRepositoryQuery2 as InvalidRepositoryQuery,
242
+ InvalidSchemaMigration2 as InvalidSchemaMigration,
243
+ InvalidStoredSchemaVersion2 as InvalidStoredSchemaVersion,
282
244
  InvalidUseCaseDeclaration2 as InvalidUseCaseDeclaration,
283
245
  InvalidUseCaseDependencies2 as InvalidUseCaseDependencies,
284
246
  InvalidUseCasePlugin2 as InvalidUseCasePlugin,
285
247
  InvalidUseCaseStep2 as InvalidUseCaseStep,
286
248
  Ip2 as Ip,
287
249
  JsonProperty2 as JsonProperty,
288
- Kind2 as Kind,
289
250
  LogLevels2 as LogLevels,
290
251
  Logger2 as Logger,
291
252
  MASK2 as MASK,
292
253
  Meta2 as Meta,
293
254
  NumberProperty2 as NumberProperty,
294
255
  Ownable2 as Ownable,
295
- PASSWORD_MAX_LENGTH2 as PASSWORD_MAX_LENGTH,
296
- PASSWORD_MIN_LENGTH2 as PASSWORD_MIN_LENGTH,
297
- PASSWORD_SPECIAL_CHARACTERS2 as PASSWORD_SPECIAL_CHARACTERS,
298
- PROBLEM_MEDIA_TYPE2 as PROBLEM_MEDIA_TYPE,
299
256
  Password2 as Password,
300
257
  PasswordHasherRequired2 as PasswordHasherRequired,
301
258
  Phone2 as Phone,
302
259
  PlainPassword2 as PlainPassword,
303
260
  PropertyInput2 as PropertyInput,
304
261
  PropertyRequired2 as PropertyRequired,
305
- PropertyStates2 as PropertyStates,
306
262
  ProviderNotBound2 as ProviderNotBound,
307
263
  Publishable2 as Publishable,
308
264
  PublisherNotBound2 as PublisherNotBound,
309
- RESERVED_ENTITY_KEYS2 as RESERVED_ENTITY_KEYS,
310
- RESERVED_RECORD_KEYS2 as RESERVED_RECORD_KEYS,
311
- ROUTE_OPTION_KEYS2 as ROUTE_OPTION_KEYS,
312
265
  RecordPluginConflict2 as RecordPluginConflict,
313
266
  RepositoryConcurrencyConflict2 as RepositoryConcurrencyConflict,
314
267
  RepositoryEntityNotFound2 as RepositoryEntityNotFound,
@@ -318,6 +271,8 @@ export {
318
271
  ReservedBlueprintKey2 as ReservedBlueprintKey,
319
272
  ReservedEntityKey2 as ReservedEntityKey,
320
273
  ReservedRecordKey2 as ReservedRecordKey,
274
+ Route2 as Route,
275
+ SchemaLockMismatch2 as SchemaLockMismatch,
321
276
  SchemaProperty2 as SchemaProperty,
322
277
  Slug2 as Slug,
323
278
  State2 as State,
@@ -330,7 +285,7 @@ export {
330
285
  SyncVerifyUnsupported2 as SyncVerifyUnsupported,
331
286
  Taggable2 as Taggable,
332
287
  Text2 as Text,
333
- UNEXPECTED_ERROR2 as UNEXPECTED_ERROR,
288
+ Unauthenticated2 as Unauthenticated,
334
289
  UndeclaredBlueprintProperty2 as UndeclaredBlueprintProperty,
335
290
  UndeclaredRecordProperty2 as UndeclaredRecordProperty,
336
291
  UnknownCommandOperation2 as UnknownCommandOperation,
@@ -351,7 +306,6 @@ export {
351
306
  blueprintOf2 as blueprintOf,
352
307
  blueprintPluginOf2 as blueprintPluginOf,
353
308
  checkJsonSchema2 as checkJsonSchema,
354
- coerceTextValues2 as coerceTextValues,
355
309
  commandBuilderOf2 as commandBuilderOf,
356
310
  commandOf2 as commandOf,
357
311
  configure2 as configure,
@@ -361,31 +315,16 @@ export {
361
315
  enumOf2 as enumOf,
362
316
  environmentOf2 as environmentOf,
363
317
  eventOf2 as eventOf,
364
- eventPolicyCatalogOf2 as eventPolicyCatalogOf,
365
- eventPolicyDescriptionOf2 as eventPolicyDescriptionOf,
366
318
  eventPolicyOf2 as eventPolicyOf,
367
319
  exceptionOf2 as exceptionOf,
368
320
  guard2 as guard,
369
321
  hasPlugin2 as hasPlugin,
370
322
  inMemoryProvider2 as inMemoryProvider,
371
- isApplication2 as isApplication,
372
- isBlueprint2 as isBlueprint,
373
- isBlueprintList2 as isBlueprintList,
374
323
  isCommand2 as isCommand,
375
324
  isEntity2 as isEntity,
376
325
  isEntityClass2 as isEntityClass,
377
- isEnvironment2 as isEnvironment,
378
- isLogFactory2 as isLogFactory,
379
- isOptionalRecord2 as isOptionalRecord,
380
326
  isOutput2 as isOutput,
381
- isPasswordHash2 as isPasswordHash,
382
- isProperty2 as isProperty,
383
327
  isProviderFactory2 as isProviderFactory,
384
- isProviderSlot2 as isProviderSlot,
385
- isProviderStorage2 as isProviderStorage,
386
- isRecordClass2 as isRecordClass,
387
- isRecordPlugin2 as isRecordPlugin,
388
- isRepository2 as isRepository,
389
328
  isUseCase2 as isUseCase,
390
329
  isUseCaseCatalog2 as isUseCaseCatalog,
391
330
  isUseCaseClass2 as isUseCaseClass,
@@ -399,46 +338,31 @@ export {
399
338
  memoryLogProvider2 as memoryLogProvider,
400
339
  openapi2 as openapi,
401
340
  operationOf2 as operationOf,
402
- operationRoutes2 as operationRoutes,
403
341
  optionalOf2 as optionalOf,
404
342
  outputOf2 as outputOf,
405
- outputValueOf2 as outputValueOf,
406
- passwordIssues2 as passwordIssues,
407
343
  pluginsOf2 as pluginsOf,
408
- problemOf2 as problemOf,
409
344
  propertyInputOf2 as propertyInputOf,
410
- propertyLineageOf2 as propertyLineageOf,
411
345
  propertyOf2 as propertyOf,
412
- providerDescriptionOf2 as providerDescriptionOf,
413
346
  providerFrom2 as providerFrom,
414
347
  providerOf2 as providerOf,
415
348
  providersOf2 as providersOf,
416
349
  publishEvents2 as publishEvents,
417
350
  recordBuilderOf2 as recordBuilderOf,
418
- recordFieldOf2 as recordFieldOf,
419
351
  recordNameOf2 as recordNameOf,
420
352
  recordOf2 as recordOf,
421
353
  recordPluginCatalogOf2 as recordPluginCatalogOf,
422
354
  recordPluginOf2 as recordPluginOf,
423
355
  repositoryOf2 as repositoryOf,
424
- requestIdHeaderOf2 as requestIdHeaderOf,
425
356
  resetApplication2 as resetApplication,
426
357
  resetRuntime2 as resetRuntime,
427
- routeOptionsIssue2 as routeOptionsIssue,
428
- schemaOf2 as schemaOf,
358
+ resourceOf2 as resourceOf,
429
359
  select2 as select,
430
- sinkOf2 as sinkOf,
431
- stageCatalogOf2 as stageCatalogOf,
432
- stageDescriptionOf2 as stageDescriptionOf,
433
- stageKindOf2 as stageKindOf,
434
- statusOf2 as statusOf,
435
360
  stripUndeclared2 as stripUndeclared,
436
361
  toOpenAPI2 as toOpenAPI,
437
362
  transformOf2 as transformOf,
438
363
  useApplication2 as useApplication,
439
364
  useCaseCatalogOf2 as useCaseCatalogOf,
440
365
  useCaseOf2 as useCaseOf,
441
- useCaseOriginOf2 as useCaseOriginOf,
442
366
  useCasePluginOf2 as useCasePluginOf,
443
- useCaseTargetOf2 as useCaseTargetOf
367
+ variantOf2 as variantOf
444
368
  };
@@ -1,8 +1,6 @@
1
1
  import { Type } from "typebox";
2
2
  import { type IPropertyInput, PropertyInput } from "../../core/property/input.js";
3
- export declare const PASSWORD_MIN_LENGTH = 7;
4
3
  export declare const PASSWORD_MAX_LENGTH = 128;
5
- export declare const PASSWORD_SPECIAL_CHARACTERS = "!@#$%^&*()-_=+[]{}|\\;:'\",.<>/?`~";
6
4
  export declare function isPasswordHash(value: string): boolean;
7
5
  /** The rules a plain password breaks; empty when it is strong enough. */
8
6
  export declare function passwordIssues(value: string): string[];
@@ -1,7 +1,7 @@
1
1
  import { Password } from "./properties/password.js";
2
2
  declare const PublishableRecord_base: import("../index.js").RecordConstructor<import("../core/property/types/property-options.interface.js").StoredFields<{
3
3
  publishedAt: import("../index.js").CallableProperty<Omit<typeof import("../index.js").DateTime, "prototype" | "safeParse" | "type" | "~standard" | typeof import("../core/property/types/property-options.interface.js").Callable> & {
4
- new (value: string | undefined): import("../index.js").AbstractProperty<import("typebox").TOptional<import("typebox").TString>, string> & Omit<import("../index.js").DateTime, keyof import("../index.js").AbstractProperty<import("typebox").TSchema, unknown>>;
4
+ new (value: string | undefined): import("../core/property/abstract-property.js").AbstractProperty<import("typebox").TOptional<import("typebox").TString>, string> & Omit<import("../index.js").DateTime, keyof import("../core/property/abstract-property.js").AbstractProperty<import("typebox").TSchema, unknown>>;
5
5
  readonly type: import("../index.js").IPropertyType<import("typebox").TOptional<import("typebox").TString>, string>;
6
6
  safeParse(value: unknown): import("../index.js").ParseResult<string | undefined>;
7
7
  readonly "~standard": import("../index.js").StandardSchemaV1.Props<string | undefined, string | undefined>;
@@ -25,7 +25,7 @@ export declare class PublishableRecord extends PublishableRecord_base {
25
25
  export declare const Publishable: import("../index.js").IRecordPlugin<typeof PublishableRecord, "publishable">;
26
26
  declare const ArchivableRecord_base: import("../index.js").RecordConstructor<import("../core/property/types/property-options.interface.js").StoredFields<{
27
27
  archivedAt: import("../index.js").CallableProperty<Omit<typeof import("../index.js").DateTime, "prototype" | "safeParse" | "type" | "~standard" | typeof import("../core/property/types/property-options.interface.js").Callable> & {
28
- new (value: string | undefined): import("../index.js").AbstractProperty<import("typebox").TOptional<import("typebox").TString>, string> & Omit<import("../index.js").DateTime, keyof import("../index.js").AbstractProperty<import("typebox").TSchema, unknown>>;
28
+ new (value: string | undefined): import("../core/property/abstract-property.js").AbstractProperty<import("typebox").TOptional<import("typebox").TString>, string> & Omit<import("../index.js").DateTime, keyof import("../core/property/abstract-property.js").AbstractProperty<import("typebox").TSchema, unknown>>;
29
29
  readonly type: import("../index.js").IPropertyType<import("typebox").TOptional<import("typebox").TString>, string>;
30
30
  safeParse(value: unknown): import("../index.js").ParseResult<string | undefined>;
31
31
  readonly "~standard": import("../index.js").StandardSchemaV1.Props<string | undefined, string | undefined>;
@@ -0,0 +1,31 @@
1
+ import type { AnyRepository } from "../core/repository/types/repository.interface.js";
2
+ import type { ResourceAction, ResourceOptions, ResourceUseCases, StdUseCaseContext } from "./use-cases/types.js";
3
+ /**
4
+ * The use cases of a CRUD resource over `repository`, for the `useCases` of
5
+ * `commandOf`: the standard `create`, `get`, `list`, `update` and `delete`,
6
+ * each with the route of a REST resource at `path`.
7
+ *
8
+ * ```ts
9
+ * const Blog = commandOf({
10
+ * name: "Blog",
11
+ * useCases: resourceOf(Posts, { path: "/posts" }),
12
+ * });
13
+ * // POST /posts (201), GET /posts, GET /posts/{id}, PATCH /posts/{id}, DELETE /posts/{id}
14
+ * ```
15
+ *
16
+ * It is only a shortcut for
17
+ * `(ctx) => ({ create: ctx.create(Posts, { route }), ... })`: the command it
18
+ * goes into is an ordinary one, and `describe()` shows the same standard use
19
+ * cases. `actions` picks some of the operations, and `access` says who may
20
+ * call them. A repository that lacks the action of an operation throws
21
+ * `UseCaseUnavailable` when the command is declared. For anything else an
22
+ * operation needs (`omit`, `owner`, hooks), write that one with `ctx` and
23
+ * spread the rest: `(ctx) => ({ ...resourceOf(Posts, options)(ctx), create: ctx.create(Posts, { ... }) })`.
24
+ */
25
+ export declare function resourceOf<Repository extends AnyRepository, const Actions extends readonly ResourceAction[] = readonly [
26
+ "create",
27
+ "get",
28
+ "list",
29
+ "update",
30
+ "delete"
31
+ ]>(repository: Repository, options: ResourceOptions<Actions>): (ctx: StdUseCaseContext) => Pick<ResourceUseCases<Repository>, Actions[number]>;
@@ -78,6 +78,12 @@ export declare function configure(services: RuntimeServices): void;
78
78
  export declare function resetRuntime(): void;
79
79
  /** The hasher in use; the default is chosen on first call, not at import. */
80
80
  export declare function currentHasher(): PasswordHasher;
81
+ /**
82
+ * Whether the generator in use is the default one, whose ids `Id` accepts as
83
+ * they are; one that `configure` put in its place is checked as any value.
84
+ * @internal
85
+ */
86
+ export declare function makesDefaultIds(): boolean;
81
87
  /** Makes an id with the generator in use. */
82
88
  export declare function generateId(): string;
83
89
  /** `verifySync` of the hasher in use, or throws `SyncVerifyUnsupported`. */
@@ -1,5 +1,9 @@
1
- import type { LoginMaker, RegisterMaker } from "./types.js";
1
+ import type { LoginMaker, LogoutMaker, RefreshMaker, RegisterMaker } from "./types.js";
2
2
  /** Stores an authenticatable entity, unless its email is taken. */
3
3
  export declare const register: import("../../index.js").IUseCasePlugin<"register", RegisterMaker>;
4
4
  /** Gives the authenticatable entity of an email, when the password matches. */
5
5
  export declare const login: import("../../index.js").IUseCasePlugin<"login", LoginMaker>;
6
+ /** Exchanges a refresh token for new tokens. */
7
+ export declare const refresh: import("../../index.js").IUseCasePlugin<"refresh", RefreshMaker>;
8
+ /** Gives empty tokens, for a route that keeps them in cookies to remove them. */
9
+ export declare const logout: import("../../index.js").IUseCasePlugin<"logout", LogoutMaker>;
@@ -6,6 +6,6 @@ import type { StdUseCasePlugins } from "./types.js";
6
6
  * `list`, `update`, `delete` and `restore` for any entity; `publish`,
7
7
  * `unpublish`, `archive`, `unarchive`, `tag` and `untag` for the entities
8
8
  * with those record plugins; `register` and `login` for the
9
- * authenticatable ones. `StdUseCases.context` is that `ctx`.
9
+ * authenticatable ones, and `refresh` and `logout` for the tokens of `login`. `StdUseCases.context` is that `ctx`.
10
10
  */
11
11
  export declare const StdUseCases: IUseCaseCatalog<StdUseCasePlugins>;
@@ -12,8 +12,8 @@ export declare function literal(value: unknown): unknown;
12
12
  export declare function checkOptions(target: UseCaseTargetInfo, options: Options, allowed: readonly string[]): void;
13
13
  /** The options of the use cases that write: `before`, `after`, `dependencies`, `throws`. */
14
14
  export declare const HOOKS: readonly ["before", "after", "dependencies", "throws"];
15
- /** The name, description, tags and `deprecated` of the use case. */
16
- export declare function metaOf(target: UseCaseTargetInfo, options: Options, verb: string): Pick<UseCaseCompilation, "name" | "description" | "tags" | "deprecated">;
15
+ /** The name, description, tags, `deprecated`, route and access of the use case. */
16
+ export declare function metaOf(target: UseCaseTargetInfo, options: Options, verb: string): Pick<UseCaseCompilation, "name" | "description" | "tags" | "deprecated" | "route" | "access">;
17
17
  /** The key of the response that holds the entity: the option `as`, `item` by default. */
18
18
  export declare function asOf(target: UseCaseTargetInfo, options: Options): string;
19
19
  /** The error of `kind` the options give, else `fallback`. */