@astram/guard 0.34.2 → 0.35.2
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/identity/permission-facts.adapter.d.ts +10 -0
- package/dist/identity/permission-facts.adapter.d.ts.map +1 -1
- package/dist/identity/permission-facts.adapter.js +38 -16
- package/dist/internal.d.ts +5 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +8 -1
- package/dist/storage/s3-object-store.d.ts +15 -1
- package/dist/storage/s3-object-store.d.ts.map +1 -1
- package/dist/storage/s3-object-store.js +38 -0
- package/package.json +5 -5
|
@@ -72,4 +72,14 @@ export declare class MariaDbPermissionFactsAdapter {
|
|
|
72
72
|
*/
|
|
73
73
|
private expandGrantKeys;
|
|
74
74
|
}
|
|
75
|
+
export declare const isExplicitOnlyPermissionKey: (key: string) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Expand wildcard grant keys against the registry's declared actions:
|
|
78
|
+
* 'identity' / 'identity:*' → every 'identity:' action
|
|
79
|
+
* 'identity:company:*' → every 'identity:company:<action>'
|
|
80
|
+
* Exact keys pass through. Bounded to `all` so a wildcard can never grant an action that does not
|
|
81
|
+
* exist, and an explicit-only key ({@link isExplicitOnlyPermissionKey}) is reached only by an
|
|
82
|
+
* exact grant.
|
|
83
|
+
*/
|
|
84
|
+
export declare function expandPermissionGrantKeys(grantKeys: readonly string[], all: readonly string[]): string[];
|
|
75
85
|
//# sourceMappingURL=permission-facts.adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-facts.adapter.d.ts","sourceRoot":"","sources":["../../src/identity/permission-facts.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAA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AAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGZ,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,EACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,GAAG,GAAE,MAAM,MAAiB;IAC7C,yFAAyF;IACzF,OAAO,CAAC,EAAE,oBAAoB;IAO1B,UAAU,CACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,kBAAkB,CAAC;IAmB9B,sFAAsF;IAChF,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YASlE,oBAAoB;YAepB,aAAa;YASb,WAAW;IAQzB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;CAGxB;AAWD,eAAO,MAAM,2BAA2B,GAAI,KAAK,MAAM,KAAG,OAAsC,CAAC;AAEjG;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,GAAG,EAAE,SAAS,MAAM,EAAE,GACrB,MAAM,EAAE,CAWV"}
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* never a fabricated empty projection (that would silently read as "you have no grants").
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MariaDbPermissionFactsAdapter = exports.AuthorizationUnavailableError = void 0;
|
|
12
|
+
exports.isExplicitOnlyPermissionKey = exports.MariaDbPermissionFactsAdapter = exports.AuthorizationUnavailableError = void 0;
|
|
13
13
|
exports.authFactsVersion = authFactsVersion;
|
|
14
|
+
exports.expandPermissionGrantKeys = expandPermissionGrantKeys;
|
|
14
15
|
const framework_schema_names_js_1 = require("../config/framework-schema-names.js");
|
|
15
16
|
/**
|
|
16
17
|
* The freshness token `GET /identity/auth-facts` (`permissionsVersion`) and
|
|
@@ -121,21 +122,42 @@ class MariaDbPermissionFactsAdapter {
|
|
|
121
122
|
* action that does not exist.
|
|
122
123
|
*/
|
|
123
124
|
expandGrantKeys(grantKeys) {
|
|
124
|
-
|
|
125
|
-
const out = new Set();
|
|
126
|
-
for (const key of grantKeys) {
|
|
127
|
-
if (key.endsWith(':*') || key.indexOf(':') === -1) {
|
|
128
|
-
const prefix = key.endsWith(':*') ? key.slice(0, -1) : `${key}:`; // 'identity:*'→'identity:' ; 'identity'→'identity:'
|
|
129
|
-
for (const a of all)
|
|
130
|
-
if (a.startsWith(prefix))
|
|
131
|
-
out.add(a);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
if (all.includes(key))
|
|
135
|
-
out.add(key);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return [...out];
|
|
125
|
+
return expandPermissionGrantKeys(grantKeys, this.listActions());
|
|
139
126
|
}
|
|
140
127
|
}
|
|
141
128
|
exports.MariaDbPermissionFactsAdapter = MariaDbPermissionFactsAdapter;
|
|
129
|
+
/**
|
|
130
|
+
* Keys no wildcard ever reaches (they need an exact grant): the `identity:schema_change:*` keys
|
|
131
|
+
* (they change the database structure), the keys of an admin-defined table type
|
|
132
|
+
* `identity:xt_<16 hex>:<action>` (SPEC v13: the registry derives them under the identity module,
|
|
133
|
+
* so they are NOT `custom:`-prefixed) and any `custom:` key (reserved for the same purpose). The
|
|
134
|
+
* identity package keeps an identical copy (`features/authz/explicit-only-keys.ts`); a parity test
|
|
135
|
+
* proves the two expanders agree.
|
|
136
|
+
*/
|
|
137
|
+
const EXPLICIT_ONLY_KEY = /^(?:identity:schema_change:|identity:xt_[0-9a-f]{16}:|custom:)/;
|
|
138
|
+
const isExplicitOnlyPermissionKey = (key) => EXPLICIT_ONLY_KEY.test(key);
|
|
139
|
+
exports.isExplicitOnlyPermissionKey = isExplicitOnlyPermissionKey;
|
|
140
|
+
/**
|
|
141
|
+
* Expand wildcard grant keys against the registry's declared actions:
|
|
142
|
+
* 'identity' / 'identity:*' → every 'identity:' action
|
|
143
|
+
* 'identity:company:*' → every 'identity:company:<action>'
|
|
144
|
+
* Exact keys pass through. Bounded to `all` so a wildcard can never grant an action that does not
|
|
145
|
+
* exist, and an explicit-only key ({@link isExplicitOnlyPermissionKey}) is reached only by an
|
|
146
|
+
* exact grant.
|
|
147
|
+
*/
|
|
148
|
+
function expandPermissionGrantKeys(grantKeys, all) {
|
|
149
|
+
const out = new Set();
|
|
150
|
+
for (const key of grantKeys) {
|
|
151
|
+
if (key.endsWith(':*') || key.indexOf(':') === -1) {
|
|
152
|
+
const prefix = key.endsWith(':*') ? key.slice(0, -1) : `${key}:`; // 'identity:*'→'identity:' ; 'identity'→'identity:'
|
|
153
|
+
for (const a of all)
|
|
154
|
+
if (a.startsWith(prefix) && !(0, exports.isExplicitOnlyPermissionKey)(a))
|
|
155
|
+
out.add(a);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
if (all.includes(key))
|
|
159
|
+
out.add(key);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return [...out];
|
|
163
|
+
}
|
package/dist/internal.d.ts
CHANGED
|
@@ -82,6 +82,11 @@ export { insideRequest } from './request-auth/request-principal-als.js';
|
|
|
82
82
|
* refuses `origin: 'agent'` unless the provenance is the minted object (`forbidden`).
|
|
83
83
|
*/
|
|
84
84
|
export { AGENT_PROVENANCE_ID_MAX, isMintedAgentProvenance, mintAgentProvenance, type AgentProvenance, } from './agent/agent-provenance.js';
|
|
85
|
+
/**
|
|
86
|
+
* For `@astram/identity` only (schema-change registration SPEC v13 §5): guard's grant-key expander
|
|
87
|
+
* and its explicit-only predicate, so identity's parity test can prove both expanders agree.
|
|
88
|
+
*/
|
|
89
|
+
export { expandPermissionGrantKeys, isExplicitOnlyPermissionKey, } from './identity/permission-facts.adapter.js';
|
|
85
90
|
/** For `@astram/agent` only (SPEC §5 `AgentModule` env): the runtime URL rule's loopback check. */
|
|
86
91
|
export { isLoopbackHost } from './config/loopback-host.js';
|
|
87
92
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD;;;;GAIG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE;;;GAGG;AACH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE;;;GAGG;AACH,OAAO,EAAE,qCAAqC,EAAE,MAAM,kBAAkB,CAAC;AACzE;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,sGAAsG;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D;;;;GAIG;AACH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB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2BAA2B,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLoopbackHost = exports.mintAgentProvenance = exports.isMintedAgentProvenance = exports.AGENT_PROVENANCE_ID_MAX = exports.insideRequest = exports.requestFactsVersion = exports.RedisSessionLiveness = exports.SHIELD_SESSION_LIVENESS = exports.MariaDbMfaResetter = exports.accountUnlockKeys = exports.AdminControlUnavailableError = exports.SHIELD_ACCOUNT_UNLOCKER = exports.SHIELD_ADMIN_STEP_UP = exports.SHIELD_MFA_REQUIREMENT_SOURCE = exports.SHIELD_MFA_REQUIREMENT = exports.SHIELD_MFA_POLICY_FEATURE = exports.SHIELD_DEFAULT_SCOPE_SUBTREE_RESOLVER = exports.SHIELD_DEFAULT_AUTH_AUDIT_SINK = exports.SHIELD_ATTEMPT_LIMITER_FACTORY = exports.SHIELD_REDIS = exports.AttemptLimiter = exports.MariaDbCredentialProvisioner = exports.SHIELD_AUDIT_SEALER_POOL = exports.SHIELD_DB_POOL = exports.PersistenceModule = void 0;
|
|
3
|
+
exports.isLoopbackHost = exports.isExplicitOnlyPermissionKey = exports.expandPermissionGrantKeys = exports.mintAgentProvenance = exports.isMintedAgentProvenance = exports.AGENT_PROVENANCE_ID_MAX = exports.insideRequest = exports.requestFactsVersion = exports.RedisSessionLiveness = exports.SHIELD_SESSION_LIVENESS = exports.MariaDbMfaResetter = exports.accountUnlockKeys = exports.AdminControlUnavailableError = exports.SHIELD_ACCOUNT_UNLOCKER = exports.SHIELD_ADMIN_STEP_UP = exports.SHIELD_MFA_REQUIREMENT_SOURCE = exports.SHIELD_MFA_REQUIREMENT = exports.SHIELD_MFA_POLICY_FEATURE = exports.SHIELD_DEFAULT_SCOPE_SUBTREE_RESOLVER = exports.SHIELD_DEFAULT_AUTH_AUDIT_SINK = exports.SHIELD_ATTEMPT_LIMITER_FACTORY = exports.SHIELD_REDIS = exports.AttemptLimiter = exports.MariaDbCredentialProvisioner = exports.SHIELD_AUDIT_SEALER_POOL = exports.SHIELD_DB_POOL = exports.PersistenceModule = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @astram/guard/internal — framework-composition and test surface (Phase 8 #5).
|
|
6
6
|
*
|
|
@@ -107,6 +107,13 @@ var agent_provenance_js_1 = require("./agent/agent-provenance.js");
|
|
|
107
107
|
Object.defineProperty(exports, "AGENT_PROVENANCE_ID_MAX", { enumerable: true, get: function () { return agent_provenance_js_1.AGENT_PROVENANCE_ID_MAX; } });
|
|
108
108
|
Object.defineProperty(exports, "isMintedAgentProvenance", { enumerable: true, get: function () { return agent_provenance_js_1.isMintedAgentProvenance; } });
|
|
109
109
|
Object.defineProperty(exports, "mintAgentProvenance", { enumerable: true, get: function () { return agent_provenance_js_1.mintAgentProvenance; } });
|
|
110
|
+
/**
|
|
111
|
+
* For `@astram/identity` only (schema-change registration SPEC v13 §5): guard's grant-key expander
|
|
112
|
+
* and its explicit-only predicate, so identity's parity test can prove both expanders agree.
|
|
113
|
+
*/
|
|
114
|
+
var permission_facts_adapter_js_1 = require("./identity/permission-facts.adapter.js");
|
|
115
|
+
Object.defineProperty(exports, "expandPermissionGrantKeys", { enumerable: true, get: function () { return permission_facts_adapter_js_1.expandPermissionGrantKeys; } });
|
|
116
|
+
Object.defineProperty(exports, "isExplicitOnlyPermissionKey", { enumerable: true, get: function () { return permission_facts_adapter_js_1.isExplicitOnlyPermissionKey; } });
|
|
110
117
|
/** For `@astram/agent` only (SPEC §5 `AgentModule` env): the runtime URL rule's loopback check. */
|
|
111
118
|
var loopback_host_js_1 = require("./config/loopback-host.js");
|
|
112
119
|
Object.defineProperty(exports, "isLoopbackHost", { enumerable: true, get: function () { return loopback_host_js_1.isLoopbackHost; } });
|
|
@@ -13,8 +13,10 @@ export interface S3ObjectStoreOptions {
|
|
|
13
13
|
* (`If-None-Match: *`), atomic on the server. `'head-first'`: for a backend that does not
|
|
14
14
|
* support conditional PUT (SPEC §5 E assumption) — `head` first, refuse when the key exists,
|
|
15
15
|
* then a plain PUT; not atomic, so it relies on the server-built uuid key for uniqueness.
|
|
16
|
+
* `'none'` (ai-debug-trace SPEC §5 B): a plain PUT that REPLACES the object. Only for a store
|
|
17
|
+
* whose objects are rewritten by design (the agent trace); never for uploads.
|
|
16
18
|
*/
|
|
17
|
-
readonly noOverwrite?: 'if-none-match' | 'head-first';
|
|
19
|
+
readonly noOverwrite?: 'if-none-match' | 'head-first' | 'none';
|
|
18
20
|
}
|
|
19
21
|
export declare class S3ObjectStore implements ObjectStore {
|
|
20
22
|
private readonly config;
|
|
@@ -31,5 +33,17 @@ export declare class S3ObjectStore implements ObjectStore {
|
|
|
31
33
|
head(key: string): Promise<StoredObjectHead | null>;
|
|
32
34
|
delete(key: string): Promise<void>;
|
|
33
35
|
ping(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* A write-only boot check (ai-debug-trace SPEC §5 A, §8): `HeadBucket`, then one small probe
|
|
38
|
+
* object under `_probe/` that is NOT read back or deleted (the trace credential is put-only;
|
|
39
|
+
* the bucket's lifecycle rule expires the probe). Fixed error, no cause.
|
|
40
|
+
*/
|
|
41
|
+
pingWriteOnly(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the bucket has a lifecycle (expiry) rule: `'rules'`, `'none'` (the backend says no
|
|
44
|
+
* configuration exists) or `'unknown'` (not readable with this credential, or an error). Never
|
|
45
|
+
* throws and never carries a cause (ai-debug-trace SPEC §5 A.5).
|
|
46
|
+
*/
|
|
47
|
+
lifecycle(): Promise<'rules' | 'none' | 'unknown'>;
|
|
34
48
|
}
|
|
35
49
|
//# sourceMappingURL=s3-object-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-object-store.d.ts","sourceRoot":"","sources":["../../src/storage/s3-object-store.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB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IACrC,OAAO,CAAC,UAAU,CAAkC;gBAExC,MAAM,EAAE,mBAAmB,EAAE,OAAO,GAAE,oBAAyB;IAc3E,kDAAkD;IAClD,OAAO,CAAC,OAAO;IAmBT,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBvE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA2BvC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAcnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAcpC;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CAezD"}
|
|
@@ -210,6 +210,44 @@ class S3ObjectStore {
|
|
|
210
210
|
await this.delete(key).catch(() => undefined);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* A write-only boot check (ai-debug-trace SPEC §5 A, §8): `HeadBucket`, then one small probe
|
|
215
|
+
* object under `_probe/` that is NOT read back or deleted (the trace credential is put-only;
|
|
216
|
+
* the bucket's lifecycle rule expires the probe). Fixed error, no cause.
|
|
217
|
+
*/
|
|
218
|
+
async pingWriteOnly() {
|
|
219
|
+
const { sdk, client } = await this.connect();
|
|
220
|
+
try {
|
|
221
|
+
await client.send(new sdk.HeadBucketCommand({ Bucket: this.bucket }));
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
throw new core_1.ObjectStoreUnavailableError();
|
|
225
|
+
}
|
|
226
|
+
const sha256 = (0, node_crypto_1.createHash)('sha256').update(PROBE_BYTES).digest('hex');
|
|
227
|
+
await this.put(`_probe/${(0, node_crypto_1.randomUUID)()}`, PROBE_BYTES, {
|
|
228
|
+
contentType: PROBE_CONTENT_TYPE,
|
|
229
|
+
sha256,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Whether the bucket has a lifecycle (expiry) rule: `'rules'`, `'none'` (the backend says no
|
|
234
|
+
* configuration exists) or `'unknown'` (not readable with this credential, or an error). Never
|
|
235
|
+
* throws and never carries a cause (ai-debug-trace SPEC §5 A.5).
|
|
236
|
+
*/
|
|
237
|
+
async lifecycle() {
|
|
238
|
+
try {
|
|
239
|
+
const { sdk, client } = await this.connect();
|
|
240
|
+
const out = await client.send(new sdk.GetBucketLifecycleConfigurationCommand({ Bucket: this.bucket }));
|
|
241
|
+
return (out.Rules?.length ?? 0) > 0 ? 'rules' : 'none';
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
const name = e?.name;
|
|
245
|
+
const code = e?.Code;
|
|
246
|
+
return name === 'NoSuchLifecycleConfiguration' || code === 'NoSuchLifecycleConfiguration'
|
|
247
|
+
? 'none'
|
|
248
|
+
: 'unknown';
|
|
249
|
+
}
|
|
250
|
+
}
|
|
213
251
|
}
|
|
214
252
|
exports.S3ObjectStore = S3ObjectStore;
|
|
215
253
|
/** Best-effort release of an unread response body (a Node stream in the SDK's Node runtime). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astram/guard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Astram framework — the enforcement guard + real-world adapters (the 'hands'). One global deny-by-default gate every request passes through (ADR-0002), classification decorators, boot-pool assertion (ADR-0018), the forRoot() registration seam, and the DB/Redis/crypto adapters that connect the sealed core to a real backend. Depends on @astram/core (ADR-0003, ADR-0023).",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"argon2": "^0.41.1",
|
|
37
37
|
"ioredis": "^5.4.1",
|
|
38
38
|
"mariadb": "^3.5.4",
|
|
39
|
-
"@astram/
|
|
40
|
-
"@astram/
|
|
39
|
+
"@astram/core": "1.20.0",
|
|
40
|
+
"@astram/engine": "0.22.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@nestjs/common": "^11",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nestjs/platform-express": "^11",
|
|
46
46
|
"reflect-metadata": "^0.2",
|
|
47
47
|
"rxjs": "^7",
|
|
48
|
-
"@astram/messaging": "^0.1.
|
|
48
|
+
"@astram/messaging": "^0.1.26"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@astram/messaging": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript": "^5.7.0",
|
|
69
69
|
"unplugin-swc": "^1.5.1",
|
|
70
70
|
"vitest": "^2.1.8",
|
|
71
|
-
"@astram/messaging": "0.1.
|
|
71
|
+
"@astram/messaging": "0.1.26"
|
|
72
72
|
},
|
|
73
73
|
"repository": {
|
|
74
74
|
"type": "git",
|