@c9up/warden 0.2.4 → 0.2.6
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 +70 -3
- package/dist/AccessToken.d.ts +257 -0
- package/dist/AccessToken.d.ts.map +1 -0
- package/dist/AccessToken.js +370 -0
- package/dist/AccessToken.js.map +1 -0
- package/dist/AttemptStore.d.ts +16 -2
- package/dist/AttemptStore.d.ts.map +1 -1
- package/dist/AttemptStore.js +26 -12
- package/dist/AttemptStore.js.map +1 -1
- package/dist/AuthManager.d.ts +33 -2
- package/dist/AuthManager.d.ts.map +1 -1
- package/dist/AuthManager.js +23 -2
- package/dist/AuthManager.js.map +1 -1
- package/dist/Authenticator.d.ts +19 -1
- package/dist/Authenticator.d.ts.map +1 -1
- package/dist/Authenticator.js +37 -3
- package/dist/Authenticator.js.map +1 -1
- package/dist/Guard.d.ts.map +1 -1
- package/dist/Guard.js +17 -5
- package/dist/Guard.js.map +1 -1
- package/dist/ResilientBlacklistDriver.d.ts +23 -6
- package/dist/ResilientBlacklistDriver.d.ts.map +1 -1
- package/dist/ResilientBlacklistDriver.js +24 -8
- package/dist/ResilientBlacklistDriver.js.map +1 -1
- package/dist/WardenProvider.d.ts +2 -0
- package/dist/WardenProvider.d.ts.map +1 -1
- package/dist/WardenProvider.js +4 -58
- package/dist/WardenProvider.js.map +1 -1
- package/dist/config.d.ts +8 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mfa/MfaManager.d.ts +16 -4
- package/dist/mfa/MfaManager.d.ts.map +1 -1
- package/dist/mfa/MfaManager.js +32 -6
- package/dist/mfa/MfaManager.js.map +1 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +27 -5
- package/dist/middleware.js.map +1 -1
- package/dist/native.d.ts +6 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +19 -2
- package/dist/native.js.map +1 -1
- package/dist/quasar.d.ts.map +1 -1
- package/dist/quasar.js +8 -1
- package/dist/quasar.js.map +1 -1
- package/dist/standalone.d.ts +24 -3
- package/dist/standalone.d.ts.map +1 -1
- package/dist/standalone.js +21 -29
- package/dist/standalone.js.map +1 -1
- package/dist/strategies/ApiKeyStrategy.d.ts +45 -12
- package/dist/strategies/ApiKeyStrategy.d.ts.map +1 -1
- package/dist/strategies/ApiKeyStrategy.js +71 -37
- package/dist/strategies/ApiKeyStrategy.js.map +1 -1
- package/dist/strategies/JwtStrategy.d.ts.map +1 -1
- package/dist/strategies/JwtStrategy.js +3 -3
- package/dist/strategies/JwtStrategy.js.map +1 -1
- package/dist/strategies/SessionStrategy.d.ts +48 -1
- package/dist/strategies/SessionStrategy.d.ts.map +1 -1
- package/dist/strategies/SessionStrategy.js +70 -4
- package/dist/strategies/SessionStrategy.js.map +1 -1
- package/dist/templateTags.d.ts +42 -0
- package/dist/templateTags.d.ts.map +1 -0
- package/dist/templateTags.js +82 -0
- package/dist/templateTags.js.map +1 -0
- package/dist/vendor/nativeBinary.d.ts +26 -2
- package/dist/vendor/nativeBinary.d.ts.map +1 -1
- package/dist/vendor/nativeBinary.js +63 -6
- package/dist/vendor/nativeBinary.js.map +1 -1
- package/dist/vendor/quasarConnection.d.ts +26 -3
- package/dist/vendor/quasarConnection.d.ts.map +1 -1
- package/dist/vendor/quasarConnection.js +44 -23
- package/dist/vendor/quasarConnection.js.map +1 -1
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +8 -3
- package/src/AccessToken.ts +550 -0
- package/src/AttemptStore.ts +29 -13
- package/src/AuthManager.ts +40 -2
- package/src/Authenticator.ts +39 -3
- package/src/Guard.ts +18 -5
- package/src/ResilientBlacklistDriver.ts +28 -8
- package/src/WardenProvider.ts +6 -83
- package/src/config.ts +8 -4
- package/src/index.ts +18 -0
- package/src/mfa/MfaManager.ts +39 -6
- package/src/middleware.ts +36 -5
- package/src/native.ts +20 -4
- package/src/quasar.ts +13 -2
- package/src/standalone.ts +74 -33
- package/src/strategies/ApiKeyStrategy.ts +112 -42
- package/src/strategies/JwtStrategy.ts +3 -1
- package/src/strategies/SessionStrategy.ts +121 -4
- package/src/templateTags.ts +117 -0
- package/src/vendor/nativeBinary.ts +82 -6
- package/src/vendor/quasarConnection.ts +84 -22
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { WardenError } from "./errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* Register `@can` / `@cannot`, as AdonisJS's bouncer publishes them. A
|
|
4
|
+
* migrated template keeps `@can('PostPolicy.edit', post) … @endcan` unchanged.
|
|
5
|
+
*
|
|
6
|
+
* Both are BLOCK tags and both AWAIT — the check returns a promise — so they
|
|
7
|
+
* render on the async path and raise on a synchronous one, matching upstream
|
|
8
|
+
* (which emits `await bouncer.can(...)`). The checks themselves come from
|
|
9
|
+
* `ctx.bouncer.templateHelpers`, shared into the view per request.
|
|
10
|
+
*/
|
|
11
|
+
export function registerBouncerTemplateTags(engine) {
|
|
12
|
+
for (const tagName of ["can", "cannot"]) {
|
|
13
|
+
engine.registerTag({
|
|
14
|
+
tagName,
|
|
15
|
+
block: true,
|
|
16
|
+
seekable: true,
|
|
17
|
+
async compile(_parser, buffer, token) {
|
|
18
|
+
// The shared bag lives in the render scope under `bouncer`.
|
|
19
|
+
const bouncer = token.evaluate("typeof bouncer === 'undefined' ? undefined : bouncer");
|
|
20
|
+
const check = Reflect.get(Object(bouncer), tagName);
|
|
21
|
+
if (typeof check !== "function") {
|
|
22
|
+
// No bouncer on this request: deny rather than render an
|
|
23
|
+
// unguarded body.
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const args = token.evaluate(`[${token.properties.jsArg}]`);
|
|
27
|
+
const allowed = await check.apply(bouncer, Array.isArray(args) ? args : []);
|
|
28
|
+
if (allowed === true)
|
|
29
|
+
buffer.writeRaw(await token.renderBody());
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const loadInker = () => {
|
|
35
|
+
// Built rather than written inline: inker is an OPTIONAL peer, and a
|
|
36
|
+
// literal `import("@c9up/inker")` makes a bundler resolve it at build time
|
|
37
|
+
// for an application that never installed it. Computed, it only runs
|
|
38
|
+
// behind the `usingInker` flag.
|
|
39
|
+
const specifier = "@c9up/inker";
|
|
40
|
+
return import(/* @vite-ignore */ specifier);
|
|
41
|
+
};
|
|
42
|
+
function unusable(detail) {
|
|
43
|
+
return new WardenError("E_WARDEN_TEMPLATE_ENGINE_UNUSABLE", `The template engine is installed but @can / @cannot cannot be registered: ${detail}`, {
|
|
44
|
+
hint: "`@c9up/inker` must default-export its plugin registrar (`inker.use(plugin)`), whose plugins receive an engine with `registerTag()`.",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Publish the bouncer tags the way AdonisJS's bouncer does with Edge: through
|
|
49
|
+
* the engine package's MODULE SINGLETON (`inker.use(plugin)`), guarded by the
|
|
50
|
+
* host's `usingInker` flag — never by resolving a container binding. `use()`
|
|
51
|
+
* queues the plugin and the engine runs it before its next render, whenever
|
|
52
|
+
* the engine was built.
|
|
53
|
+
*
|
|
54
|
+
* Returns whether the tags were handed over. A registrar or an engine of the
|
|
55
|
+
* wrong shape is an error, not a skip: an unregistered `@can` would render as
|
|
56
|
+
* plain text and show the guarded body's markup to everyone.
|
|
57
|
+
*/
|
|
58
|
+
export async function installBouncerTemplateTags(usingInker, load = loadInker) {
|
|
59
|
+
if (!usingInker)
|
|
60
|
+
return false;
|
|
61
|
+
const module = await load();
|
|
62
|
+
const registrar = typeof module === "object" && module !== null
|
|
63
|
+
? Reflect.get(module, "default")
|
|
64
|
+
: undefined;
|
|
65
|
+
const use = Reflect.get(Object(registrar), "use");
|
|
66
|
+
if (typeof use !== "function") {
|
|
67
|
+
throw unusable("its default export has no use()");
|
|
68
|
+
}
|
|
69
|
+
use.call(registrar, (engine) => {
|
|
70
|
+
const register = Reflect.get(Object(engine), "registerTag");
|
|
71
|
+
if (typeof register !== "function") {
|
|
72
|
+
throw unusable("the engine has no registerTag()");
|
|
73
|
+
}
|
|
74
|
+
registerBouncerTemplateTags({
|
|
75
|
+
registerTag: (tag) => {
|
|
76
|
+
register.call(engine, tag);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=templateTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateTags.js","sourceRoot":"","sources":["../src/templateTags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoB1C;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA0B;IACrE,KAAK,MAAM,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAU,EAAE,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC;YAClB,OAAO;YACP,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK;gBACnC,4DAA4D;gBAC5D,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAC7B,sDAAsD,CACtD,CAAC;gBACF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;oBACjC,yDAAyD;oBACzD,kBAAkB;oBAClB,OAAO;gBACR,CAAC;gBACD,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,UAAU,CAA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AAQ,CAAC,iCAAiC,CAAC,CAAC;IACnD,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,MAAe,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5D,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,QAAQ,CAAC,iCAAiC,CAAC,CAAC;QACnD,CAAC;QACD,2BAA2B,CAAC;YAC3B,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;gBACpB,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC5B,CAAC;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -33,11 +33,35 @@ export type NativeBinaryResult<T> = {
|
|
|
33
33
|
cause?: unknown;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* The names among `names` that `value` does not carry as functions.
|
|
37
|
+
*
|
|
38
|
+
* Classes count, being functions, and so does a class's static member: `value`
|
|
39
|
+
* may itself be a function. What a guard rejects is only useful named, so the
|
|
40
|
+
* loader reports this list rather than a bare "no".
|
|
41
|
+
*/
|
|
42
|
+
export declare function missingFunctions(value: unknown, names: readonly string[]): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Whether `value` carries every one of `names` as a function.
|
|
45
|
+
*
|
|
46
|
+
* The building block of the guard a package hands to `loadNativeBinary`, over
|
|
47
|
+
* the list of what it actually calls on its binary — the same list it passes
|
|
48
|
+
* as `expects`, so the message can name what is missing.
|
|
49
|
+
*/
|
|
50
|
+
export declare function hasFunctions(value: unknown, names: readonly string[]): value is object;
|
|
51
|
+
/**
|
|
52
|
+
* Load `<package root>/index.<suffix>.node`, and check it is the binary the
|
|
53
|
+
* package calls.
|
|
37
54
|
*
|
|
38
55
|
* The path is fixed rather than passed: this file is generated into
|
|
39
56
|
* `<package>/src/vendor/`, so the package root is always two levels up, from
|
|
40
57
|
* `src` and from `dist` alike.
|
|
58
|
+
*
|
|
59
|
+
* `isBinary` is the package's own check of what it calls. A declaration only
|
|
60
|
+
* says what the Rust promises: a stale build, or one from another version,
|
|
61
|
+
* loads just as well and then fails on the first missing call, far from here.
|
|
62
|
+
* A rejected module is reported as a failed load, so the package's policy
|
|
63
|
+
* (degrade or refuse) applies to it unchanged. `expects`, the list the guard is
|
|
64
|
+
* built from, lets that report name the missing calls.
|
|
41
65
|
*/
|
|
42
|
-
export declare function loadNativeBinary<T>(): NativeBinaryResult<T>;
|
|
66
|
+
export declare function loadNativeBinary<T>(isBinary: (value: unknown) => value is T, expects?: readonly string[]): NativeBinaryResult<T>;
|
|
43
67
|
//# sourceMappingURL=nativeBinary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeBinary.d.ts","sourceRoot":"","sources":["../../src/vendor/nativeBinary.ts"],"names":[],"mappings":"AAoCA;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,MAAM,EAAE,CAEpD;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAErE;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAQzD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAIjC;AAED,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC7B;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,GAC3B;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAA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27 +73,84 @@ export function muslHint() {
|
|
|
73
73
|
? " On Alpine/musl, the gnu binary will not load — build the musl target."
|
|
74
74
|
: "";
|
|
75
75
|
}
|
|
76
|
+
/** Whether `value` carries a function under `name` (a napi class is one too). */
|
|
77
|
+
function hasFunction(value, name) {
|
|
78
|
+
const member = Reflect.get(value, name);
|
|
79
|
+
return typeof member === "function";
|
|
80
|
+
}
|
|
76
81
|
/**
|
|
77
|
-
*
|
|
82
|
+
* The names among `names` that `value` does not carry as functions.
|
|
83
|
+
*
|
|
84
|
+
* Classes count, being functions, and so does a class's static member: `value`
|
|
85
|
+
* may itself be a function. What a guard rejects is only useful named, so the
|
|
86
|
+
* loader reports this list rather than a bare "no".
|
|
87
|
+
*/
|
|
88
|
+
export function missingFunctions(value, names) {
|
|
89
|
+
if (value === null ||
|
|
90
|
+
(typeof value !== "object" && typeof value !== "function")) {
|
|
91
|
+
return [...names];
|
|
92
|
+
}
|
|
93
|
+
return names.filter((name) => !hasFunction(value, name));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether `value` carries every one of `names` as a function.
|
|
97
|
+
*
|
|
98
|
+
* The building block of the guard a package hands to `loadNativeBinary`, over
|
|
99
|
+
* the list of what it actually calls on its binary — the same list it passes
|
|
100
|
+
* as `expects`, so the message can name what is missing.
|
|
101
|
+
*/
|
|
102
|
+
export function hasFunctions(value, names) {
|
|
103
|
+
if (value === null ||
|
|
104
|
+
(typeof value !== "object" && typeof value !== "function")) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return missingFunctions(value, names).length === 0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Load `<package root>/index.<suffix>.node`, and check it is the binary the
|
|
111
|
+
* package calls.
|
|
78
112
|
*
|
|
79
113
|
* The path is fixed rather than passed: this file is generated into
|
|
80
114
|
* `<package>/src/vendor/`, so the package root is always two levels up, from
|
|
81
115
|
* `src` and from `dist` alike.
|
|
116
|
+
*
|
|
117
|
+
* `isBinary` is the package's own check of what it calls. A declaration only
|
|
118
|
+
* says what the Rust promises: a stale build, or one from another version,
|
|
119
|
+
* loads just as well and then fails on the first missing call, far from here.
|
|
120
|
+
* A rejected module is reported as a failed load, so the package's policy
|
|
121
|
+
* (degrade or refuse) applies to it unchanged. `expects`, the list the guard is
|
|
122
|
+
* built from, lets that report name the missing calls.
|
|
82
123
|
*/
|
|
83
|
-
export function loadNativeBinary() {
|
|
124
|
+
export function loadNativeBinary(isBinary, expects) {
|
|
84
125
|
const suffix = nativeBinarySuffix();
|
|
85
126
|
if (suffix === undefined)
|
|
86
127
|
return { loaded: false, suffix };
|
|
87
128
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
129
|
+
let loaded;
|
|
88
130
|
try {
|
|
89
131
|
const nodeRequire = createRequire(import.meta.url);
|
|
90
|
-
|
|
91
|
-
loaded: true,
|
|
92
|
-
binary: nodeRequire(join(here, `../../index.${suffix}.node`)),
|
|
93
|
-
};
|
|
132
|
+
loaded = nodeRequire(join(here, `../../index.${suffix}.node`));
|
|
94
133
|
}
|
|
95
134
|
catch (cause) {
|
|
96
135
|
return { loaded: false, suffix, cause };
|
|
97
136
|
}
|
|
137
|
+
if (isBinary(loaded))
|
|
138
|
+
return { loaded: true, binary: loaded };
|
|
139
|
+
return {
|
|
140
|
+
loaded: false,
|
|
141
|
+
suffix,
|
|
142
|
+
cause: new Error(`index.${suffix}.node loaded, but ${rejection(loaded, expects)}. ` +
|
|
143
|
+
"The binary is stale or from another version: rebuild it."),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/** What a rejected binary lacks, or, without a list to check, what it has. */
|
|
147
|
+
function rejection(loaded, expects) {
|
|
148
|
+
const missing = expects === undefined ? [] : missingFunctions(loaded, expects);
|
|
149
|
+
if (missing.length > 0)
|
|
150
|
+
return `it lacks ${missing.join(", ")}`;
|
|
151
|
+
const exported = typeof loaded === "object" && loaded !== null
|
|
152
|
+
? Object.keys(loaded).filter((name) => hasFunction(loaded, name))
|
|
153
|
+
: [];
|
|
154
|
+
return `it is not the binary this package calls (it exports: ${exported.length > 0 ? exported.join(", ") : "none"})`;
|
|
98
155
|
}
|
|
99
156
|
//# sourceMappingURL=nativeBinary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeBinary.js","sourceRoot":"","sources":["../../src/vendor/nativeBinary.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAE5E;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,gEAAgE;AAChE,MAAM,OAAO,GAA2B;IACvC,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,YAAY;IAC1B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,gBAAgB;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAChD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,kBAAkB;IACjC,OAAO,kBAAkB,CAAC,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAe;IAChD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,mBAAmB,KAAK,YAAY,KAAK,CAAC,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SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;YACjE,0DAA0D,CAC3D;KACD,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,SAAS,SAAS,CAAC,MAAe,EAAE,OAA2B;IAC9D,MAAM,OAAO,GACZ,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,YAAY,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAChE,MAAM,QAAQ,GACb,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAC5C,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjE,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,wDAAwD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;AACtH,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The commands among `commands` that `value` does not carry as functions.
|
|
3
|
+
*
|
|
4
|
+
* Reads go through the same catch as above, so a command whose read throws
|
|
5
|
+
* counts as missing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function missingCommands(value: unknown, commands: readonly string[]): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Whether `value` carries every one of `commands` as a function.
|
|
10
|
+
*
|
|
11
|
+
* The building block of the guard a caller passes as `isConnection`, over the
|
|
12
|
+
* same list it passes as `required` — which is what names the gap when the
|
|
13
|
+
* guard says no.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasCommands(value: unknown, commands: readonly string[]): value is object;
|
|
16
|
+
export interface QuasarConnectionRequest<T> {
|
|
2
17
|
/** The package asking. It prefixes every message this can raise. */
|
|
3
18
|
pkg: string;
|
|
4
19
|
/**
|
|
@@ -12,8 +27,16 @@ export interface QuasarConnectionRequest {
|
|
|
12
27
|
raise: (reason: "quasar-missing" | "incomplete-connection", message: string, cause?: unknown) => Error;
|
|
13
28
|
/** Connection name, or `undefined` for quasar's default. */
|
|
14
29
|
name?: string;
|
|
15
|
-
/** The commands the caller will actually issue. */
|
|
30
|
+
/** The commands the caller will actually issue, named in the message. */
|
|
16
31
|
required: readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* The caller's check that the connection is the client it needs.
|
|
34
|
+
*
|
|
35
|
+
* Written by the caller over the commands it issues (`hasCommands` with
|
|
36
|
+
* `required` does it), because only the caller knows its client type. The
|
|
37
|
+
* connection is handed over only once this has said yes.
|
|
38
|
+
*/
|
|
39
|
+
isConnection: (value: unknown) => value is T;
|
|
17
40
|
/** What the caller does with them, for the message that names a gap. */
|
|
18
41
|
what: string;
|
|
19
42
|
/**
|
|
@@ -31,5 +54,5 @@ export interface QuasarConnectionRequest {
|
|
|
31
54
|
* handed over — a connection missing one would otherwise fail on the first
|
|
32
55
|
* command, far from the line that asked for it.
|
|
33
56
|
*/
|
|
34
|
-
export declare function quasarConnection<T>(request: QuasarConnectionRequest): Promise<T>;
|
|
57
|
+
export declare function quasarConnection<T>(request: QuasarConnectionRequest<T>): Promise<T>;
|
|
35
58
|
//# sourceMappingURL=quasarConnection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quasarConnection.d.ts","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quasarConnection.d.ts","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AA0DA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,EAAE,CAIV;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,KAAK,IAAI,MAAM,CAGjB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACzC,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,CACN,MAAM,EAAE,gBAAgB,GAAG,uBAAuB,EAClD,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,KACX,KAAK,CAAC;IACX,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;IAC7C,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACvC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAsDZ"}
|
|
@@ -3,29 +3,42 @@
|
|
|
3
3
|
// This package is published and built from its own repository, so the file
|
|
4
4
|
// has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
|
|
5
5
|
// and `pnpm vendor:check` fails if this copy has drifted from the original.
|
|
6
|
-
/**
|
|
7
|
-
* Read a member without assuming how the object answers.
|
|
8
|
-
*
|
|
9
|
-
* Two shapes have to work, and they disagree about `in`. Quasar's accessor is
|
|
10
|
-
* a Proxy over an empty null-prototype object with only a `get` trap, so
|
|
11
|
-
* `"connection" in manager` is FALSE while reading it returns the function —
|
|
12
|
-
* gating on `in` rejected the real manager. And a module namespace under a
|
|
13
|
-
* test double RAISES for an export it does not have, rather than answering
|
|
14
|
-
* undefined, so a bare read fails on the mock. Reading through a catch is what
|
|
15
|
-
* satisfies both.
|
|
16
|
-
*/
|
|
17
6
|
function readMember(value, name) {
|
|
18
7
|
if (typeof value !== "object" || value === null)
|
|
19
|
-
return undefined;
|
|
8
|
+
return { value: undefined };
|
|
20
9
|
try {
|
|
21
|
-
return Reflect.get(value, name);
|
|
10
|
+
return { value: Reflect.get(value, name) };
|
|
22
11
|
}
|
|
23
|
-
catch {
|
|
24
|
-
return
|
|
12
|
+
catch (threw) {
|
|
13
|
+
return { threw };
|
|
25
14
|
}
|
|
26
15
|
}
|
|
16
|
+
function memberValue(read) {
|
|
17
|
+
return "value" in read ? read.value : undefined;
|
|
18
|
+
}
|
|
27
19
|
function isConnectionSource(value) {
|
|
28
|
-
return typeof readMember(value, "connection") === "function";
|
|
20
|
+
return typeof memberValue(readMember(value, "connection")) === "function";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The commands among `commands` that `value` does not carry as functions.
|
|
24
|
+
*
|
|
25
|
+
* Reads go through the same catch as above, so a command whose read throws
|
|
26
|
+
* counts as missing.
|
|
27
|
+
*/
|
|
28
|
+
export function missingCommands(value, commands) {
|
|
29
|
+
return commands.filter((command) => typeof memberValue(readMember(value, command)) !== "function");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether `value` carries every one of `commands` as a function.
|
|
33
|
+
*
|
|
34
|
+
* The building block of the guard a caller passes as `isConnection`, over the
|
|
35
|
+
* same list it passes as `required` — which is what names the gap when the
|
|
36
|
+
* guard says no.
|
|
37
|
+
*/
|
|
38
|
+
export function hasCommands(value, commands) {
|
|
39
|
+
if (typeof value !== "object" || value === null)
|
|
40
|
+
return false;
|
|
41
|
+
return missingCommands(value, commands).length === 0;
|
|
29
42
|
}
|
|
30
43
|
/**
|
|
31
44
|
* The named connection, checked for the commands the caller needs BEFORE it is
|
|
@@ -33,7 +46,7 @@ function isConnectionSource(value) {
|
|
|
33
46
|
* command, far from the line that asked for it.
|
|
34
47
|
*/
|
|
35
48
|
export async function quasarConnection(request) {
|
|
36
|
-
const { pkg, name, required, what, raise, alternative } = request;
|
|
49
|
+
const { pkg, name, required, what, raise, alternative, isConnection } = request;
|
|
37
50
|
const specifier = "@c9up/quasar/services/main";
|
|
38
51
|
let loaded;
|
|
39
52
|
try {
|
|
@@ -43,20 +56,28 @@ export async function quasarConnection(request) {
|
|
|
43
56
|
throw raise("quasar-missing", `[${pkg}] ${what} asks for the quasar connection "${name ?? "default"}", but @c9up/quasar is not installed.\n` +
|
|
44
57
|
` pnpm add @c9up/quasar${alternative ? `, ${alternative}` : ""}`, cause);
|
|
45
58
|
}
|
|
46
|
-
|
|
59
|
+
// The namespace itself may be the manager (a test double); a throw there is
|
|
60
|
+
// the mock refusing an export it lacks, not an answer.
|
|
61
|
+
const direct = memberValue(readMember(loaded, "connection"));
|
|
62
|
+
const manager = typeof direct === "function"
|
|
47
63
|
? loaded
|
|
48
|
-
:
|
|
64
|
+
: memberValue(readMember(Object(loaded), "default"));
|
|
65
|
+
const read = readMember(manager, "connection");
|
|
66
|
+
if ("threw" in read) {
|
|
67
|
+
throw raise("quasar-missing", `[${pkg}] ${what} asks for the quasar connection "${name ?? "default"}", but @c9up/quasar's manager is not available yet: ` +
|
|
68
|
+
"its provider has not booted, or is not registered in this application's providers.", read.threw);
|
|
69
|
+
}
|
|
49
70
|
if (!isConnectionSource(manager)) {
|
|
50
71
|
throw raise("quasar-missing", `[${pkg}] @c9up/quasar/services/main did not expose a connection() manager`);
|
|
51
72
|
}
|
|
52
73
|
const connection = manager.connection(name);
|
|
53
|
-
const missing =
|
|
74
|
+
const missing = missingCommands(connection, required);
|
|
54
75
|
if (missing.length > 0) {
|
|
55
76
|
throw raise("incomplete-connection", `[${pkg}] the quasar connection${name ? ` '${name}'` : ""} is missing ${missing.join(", ")}, which ${what} issues`);
|
|
56
77
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
78
|
+
if (!isConnection(connection)) {
|
|
79
|
+
throw raise("incomplete-connection", `[${pkg}] the quasar connection${name ? ` '${name}'` : ""} is not the client ${what} needs`);
|
|
80
|
+
}
|
|
60
81
|
return connection;
|
|
61
82
|
}
|
|
62
83
|
//# sourceMappingURL=quasarConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quasarConnection.js","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;
|
|
1
|
+
{"version":3,"file":"quasarConnection.js","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAqC5E,SAAS,UAAU,CAAC,KAAc,EAAE,IAAY;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC7E,IAAI,CAAC;QACJ,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,EAAE,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,IAAgB;IACpC,OAAO,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACzC,OAAO,OAAO,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,KAAK,UAAU,CAAC;AAC3E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,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ux-x64-gnu.node
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/warden",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Warden — Authentication & authorization for the Ream framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -50,19 +50,24 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
+
"@c9up/inker": "^0.1.20",
|
|
53
54
|
"@c9up/quasar": "^0.1.0 || ^0.2.0",
|
|
54
|
-
"@c9up/ream": "^0.2.
|
|
55
|
+
"@c9up/ream": "^0.2.28"
|
|
55
56
|
},
|
|
56
57
|
"peerDependenciesMeta": {
|
|
57
|
-
"@c9up/
|
|
58
|
+
"@c9up/inker": {
|
|
58
59
|
"optional": true
|
|
59
60
|
},
|
|
60
61
|
"@c9up/quasar": {
|
|
61
62
|
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"@c9up/ream": {
|
|
65
|
+
"optional": true
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
65
69
|
"@biomejs/biome": "^2.5.12",
|
|
70
|
+
"@c9up/inker": "^0.1.20",
|
|
66
71
|
"@c9up/quasar": "^0.1.0 || ^0.2.0",
|
|
67
72
|
"@c9up/ream": "^0.2.25",
|
|
68
73
|
"@types/node": "^22.20.1",
|