@c9up/ream 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container/Container.d.ts +18 -0
- package/dist/container/Container.d.ts.map +1 -1
- package/dist/container/Container.js +29 -0
- package/dist/container/Container.js.map +1 -1
- package/dist/env/Env.d.ts +11 -0
- package/dist/env/Env.d.ts.map +1 -1
- package/dist/env/Env.js +33 -17
- package/dist/env/Env.js.map +1 -1
- package/dist/env/Secret.d.ts +17 -0
- package/dist/env/Secret.d.ts.map +1 -1
- package/dist/env/Secret.js +23 -0
- package/dist/env/Secret.js.map +1 -1
- package/dist/errors/aggregate.d.ts +3 -0
- package/dist/errors/aggregate.d.ts.map +1 -1
- package/dist/errors/aggregate.js +3 -0
- package/dist/errors/aggregate.js.map +1 -1
- package/dist/events/Emitter.d.ts +20 -1
- package/dist/events/Emitter.d.ts.map +1 -1
- package/dist/events/Emitter.js +28 -6
- package/dist/events/Emitter.js.map +1 -1
- package/dist/helpers/MessageBuilder.d.ts +29 -0
- package/dist/helpers/MessageBuilder.d.ts.map +1 -0
- package/dist/helpers/MessageBuilder.js +63 -0
- package/dist/helpers/MessageBuilder.js.map +1 -0
- package/dist/helpers/VerificationToken.d.ts +56 -0
- package/dist/helpers/VerificationToken.d.ts.map +1 -0
- package/dist/helpers/VerificationToken.js +70 -0
- package/dist/helpers/VerificationToken.js.map +1 -0
- package/dist/helpers/defineStaticProperty.d.ts +15 -0
- package/dist/helpers/defineStaticProperty.d.ts.map +1 -0
- package/dist/helpers/defineStaticProperty.js +47 -0
- package/dist/helpers/defineStaticProperty.js.map +1 -0
- package/dist/helpers/duration.d.ts +20 -0
- package/dist/helpers/duration.d.ts.map +1 -1
- package/dist/helpers/duration.js +71 -0
- package/dist/helpers/duration.js.map +1 -1
- package/dist/helpers/fs.d.ts +39 -0
- package/dist/helpers/fs.d.ts.map +1 -0
- package/dist/helpers/fs.js +70 -0
- package/dist/helpers/fs.js.map +1 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +7 -0
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/safeTiming.d.ts +14 -0
- package/dist/helpers/safeTiming.d.ts.map +1 -0
- package/dist/helpers/safeTiming.js +42 -0
- package/dist/helpers/safeTiming.js.map +1 -0
- package/dist/helpers/string.d.ts +85 -0
- package/dist/helpers/string.d.ts.map +1 -1
- package/dist/helpers/string.js +127 -1
- package/dist/helpers/string.js.map +1 -1
- package/dist/http/HttpContext.d.ts +14 -1
- package/dist/http/HttpContext.d.ts.map +1 -1
- package/dist/http/HttpContext.js.map +1 -1
- package/dist/http/RedirectBuilder.d.ts +16 -0
- package/dist/http/RedirectBuilder.d.ts.map +1 -1
- package/dist/http/RedirectBuilder.js +34 -9
- package/dist/http/RedirectBuilder.js.map +1 -1
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js +5 -30
- package/dist/http/Request.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/router/Router.d.ts +54 -0
- package/dist/router/Router.d.ts.map +1 -1
- package/dist/router/Router.js +72 -3
- package/dist/router/Router.js.map +1 -1
- package/dist/session/ReadOnlyValuesStore.d.ts +11 -0
- package/dist/session/ReadOnlyValuesStore.d.ts.map +1 -1
- package/dist/session/ReadOnlyValuesStore.js +17 -0
- package/dist/session/ReadOnlyValuesStore.js.map +1 -1
- package/dist/session/Session.d.ts +11 -3
- package/dist/session/Session.d.ts.map +1 -1
- package/dist/session/Session.js +15 -6
- package/dist/session/Session.js.map +1 -1
- package/dist/session/SessionMiddleware.js +2 -1
- package/dist/session/SessionMiddleware.js.map +1 -1
- package/dist/session/errors.d.ts +25 -0
- package/dist/session/errors.d.ts.map +1 -0
- package/dist/session/errors.js +32 -0
- package/dist/session/errors.js.map +1 -0
- package/dist/types/{container.d.ts → index.d.ts} +47 -18
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/index.js.map +1 -0
- package/events.darwin-arm64.node +0 -0
- package/events.darwin-x64.node +0 -0
- package/events.linux-arm64-gnu.node +0 -0
- package/events.linux-x64-gnu.node +0 -0
- package/events.win32-x64-msvc.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +7 -3
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/container/Container.ts +31 -0
- package/src/env/Env.ts +34 -15
- package/src/env/Secret.ts +26 -0
- package/src/errors/aggregate.ts +3 -0
- package/src/events/Emitter.ts +33 -5
- package/src/helpers/MessageBuilder.ts +69 -0
- package/src/helpers/VerificationToken.ts +93 -0
- package/src/helpers/defineStaticProperty.ts +51 -0
- package/src/helpers/duration.ts +75 -0
- package/src/helpers/fs.ts +104 -0
- package/src/helpers/index.ts +8 -0
- package/src/helpers/safeTiming.ts +45 -0
- package/src/helpers/string.ts +145 -1
- package/src/http/HttpContext.ts +14 -1
- package/src/http/RedirectBuilder.ts +38 -8
- package/src/http/Request.ts +5 -29
- package/src/index.ts +11 -2
- package/src/router/Router.ts +86 -3
- package/src/session/ReadOnlyValuesStore.ts +20 -0
- package/src/session/Session.ts +16 -11
- package/src/session/SessionMiddleware.ts +2 -1
- package/src/session/errors.ts +39 -0
- package/src/types/{container.ts → index.ts} +48 -17
- package/dist/types/container.d.ts.map +0 -1
- package/dist/types/container.js +0 -23
- package/dist/types/container.js.map +0 -1
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The interfaces an application or a package augments — `@c9up/ream/types`.
|
|
3
3
|
*
|
|
4
|
-
* Resolving from the container
|
|
5
|
-
*
|
|
6
|
-
* casts. AdonisJS solves it with an augmentable `ContainerBindings`, and every
|
|
7
|
-
* package in its ecosystem adds its own token to it:
|
|
4
|
+
* Resolving from the container and picking an auth guard are both string
|
|
5
|
+
* lookups; without a shared interface to augment, every call site casts.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* Ream core registers the entries below; anything else — `auth` (warden),
|
|
18
|
-
* `logger` (spectrum), `db` (atlas) — reaches this interface by augmentation
|
|
19
|
-
* from the package that owns it, which is why the interface is open rather
|
|
20
|
-
* than a closed union.
|
|
7
|
+
* The augmentable interfaces are DECLARED here rather than re-exported from a
|
|
8
|
+
* neighbouring file, and that is load-bearing: TypeScript augments the module
|
|
9
|
+
* that declares an interface, so a re-export makes
|
|
10
|
+
* `declare module '@c9up/ream/types' { interface Authenticators { … } }` a
|
|
11
|
+
* duplicate declaration instead of an augmentation. warden hit exactly that.
|
|
21
12
|
*/
|
|
22
13
|
|
|
23
14
|
import type { Application } from '../Application.js'
|
|
@@ -33,6 +24,46 @@ import type { CookieSigner } from '../security/CookieSigner.js'
|
|
|
33
24
|
import type { SignedUrl } from '../security/SignedUrl.js'
|
|
34
25
|
import type { Server } from '../server/Server.js'
|
|
35
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Guard name → what `auth.use(name)` hands back.
|
|
29
|
+
*
|
|
30
|
+
* Empty here, and deliberately: ream owns no auth package, so it cannot know
|
|
31
|
+
* the guards an app configured. The auth package fills it in:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* declare module '@c9up/ream/types' {
|
|
35
|
+
* interface Authenticators {
|
|
36
|
+
* session: SessionGuard
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* Until something augments it, `keyof Authenticators` is `never` and `use()`
|
|
42
|
+
* falls through to its `unknown` signature — the previous behaviour kept as
|
|
43
|
+
* the floor rather than the ceiling.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* An EMPTY INTERFACE is the whole mechanism here, not an oversight. Rewritten
|
|
47
|
+
* as `type Authenticators = {}` the declaration stops being augmentable:
|
|
48
|
+
* `declare module '@c9up/ream/types' { interface Authenticators { … } }`
|
|
49
|
+
* becomes a duplicate identifier instead of a merge, and warden cannot type
|
|
50
|
+
* `ctx.auth.use()`. That is exactly what shipped in 0.2.3, where the formatter
|
|
51
|
+
* had rewritten it.
|
|
52
|
+
*/
|
|
53
|
+
// biome-ignore lint/suspicious/noEmptyInterface: it must stay an interface to be augmentable — see above
|
|
54
|
+
export interface Authenticators {}
|
|
55
|
+
|
|
56
|
+
/** A guard name this application knows about. */
|
|
57
|
+
export type AuthenticatorName = keyof Authenticators
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The container's known bindings.
|
|
61
|
+
*
|
|
62
|
+
* Ream core registers the entries below; anything else — `auth` (warden),
|
|
63
|
+
* `logger` (spectrum), `db` (atlas) — reaches this interface by augmentation
|
|
64
|
+
* from the package that owns it, which is why it is open rather than a closed
|
|
65
|
+
* union.
|
|
66
|
+
*/
|
|
36
67
|
export interface ContainerBindings {
|
|
37
68
|
/** The application instance. */
|
|
38
69
|
app: Application
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/types/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,GAAG,EAAE,WAAW,CAAA;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,MAAM,EAAE,WAAW,CAAA;IACnB,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAA;IAChB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,UAAU,EAAE,YAAY,CAAA;IACxB,mFAAmF;IACnF,WAAW,EAAE,OAAO,WAAW,CAAA;IAC/B,qDAAqD;IACrD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,wEAAwE;IACxE,UAAU,EAAE,iBAAiB,CAAA;IAC7B,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,MAAM,iBAAiB,CAAA"}
|
package/dist/types/container.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The container's known bindings, as a type.
|
|
3
|
-
*
|
|
4
|
-
* Resolving from the container is a string lookup, so without a shared
|
|
5
|
-
* interface every `container.make('router')` returns `unknown` and every app
|
|
6
|
-
* casts. AdonisJS solves it with an augmentable `ContainerBindings`, and every
|
|
7
|
-
* package in its ecosystem adds its own token to it:
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* declare module '@c9up/ream/types' {
|
|
11
|
-
* interface ContainerBindings {
|
|
12
|
-
* auth: AuthManager
|
|
13
|
-
* }
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* Ream core registers the entries below; anything else — `auth` (warden),
|
|
18
|
-
* `logger` (spectrum), `db` (atlas) — reaches this interface by augmentation
|
|
19
|
-
* from the package that owns it, which is why the interface is open rather
|
|
20
|
-
* than a closed union.
|
|
21
|
-
*/
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/types/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|