@astram/identity 0.3.0 → 0.3.1
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { type ObjectTypeInput } from '@astram/engine';
|
|
2
3
|
/**
|
|
3
4
|
* IdentityFeatureModule — the framework-owned identity FEATURE surface (company/user/role CRUD;
|
|
4
5
|
* more in later phases) as thin controllers over the engine's RecordsService. The CONSUMER imports
|
|
@@ -18,9 +19,16 @@ export declare class IdentityFeatureModule {
|
|
|
18
19
|
* by the writer's own `decide()` (a route-allows/writer-denies split). Omitted ⇒
|
|
19
20
|
* `isRoot` is always false (a non-root consumer works; only a root offering
|
|
20
21
|
* cross-tenant grants needs it). See ADR-0026 + the template wiring.
|
|
22
|
+
* @param extraObjects the consumer's OWN registered object types — pass the SAME array
|
|
23
|
+
* given to `buildIdentityRecordAuthorization(pool, extraObjects)`. Without them, the
|
|
24
|
+
* guided rule-builder SCHEMA (Phase 5) and the OWNER-SHARE resolver (Phase 6) only know
|
|
25
|
+
* the framework identity types, so a consumer's own OWNED type (e.g. `note`) is NOT
|
|
26
|
+
* policy-authorable and NOT shareable ("type '…' is not registered — cannot share").
|
|
27
|
+
* Passing them here lets an owner share their own records + author policies over them.
|
|
21
28
|
*/
|
|
22
|
-
static forRoot({ rootIds }?: {
|
|
29
|
+
static forRoot({ rootIds, extraObjects, }?: {
|
|
23
30
|
rootIds?: readonly string[];
|
|
31
|
+
extraObjects?: readonly ObjectTypeInput[];
|
|
24
32
|
}): DynamicModule;
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=identity-feature.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-feature.module.d.ts","sourceRoot":"","sources":["../../src/features/identity-feature.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-feature.module.d.ts","sourceRoot":"","sources":["../../src/features/identity-feature.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAYL,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAsExB;;;;;;;;;;GAUG;AACH,qBACa,qBAAqB;IAChC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,OAAO,CAAC,EACb,OAAO,EACP,YAAiB,GAClB,GAAE;QAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;KAAO,GAAG,aAAa;CAwTnG"}
|
|
@@ -81,8 +81,14 @@ let IdentityFeatureModule = IdentityFeatureModule_1 = class IdentityFeatureModul
|
|
|
81
81
|
* by the writer's own `decide()` (a route-allows/writer-denies split). Omitted ⇒
|
|
82
82
|
* `isRoot` is always false (a non-root consumer works; only a root offering
|
|
83
83
|
* cross-tenant grants needs it). See ADR-0026 + the template wiring.
|
|
84
|
+
* @param extraObjects the consumer's OWN registered object types — pass the SAME array
|
|
85
|
+
* given to `buildIdentityRecordAuthorization(pool, extraObjects)`. Without them, the
|
|
86
|
+
* guided rule-builder SCHEMA (Phase 5) and the OWNER-SHARE resolver (Phase 6) only know
|
|
87
|
+
* the framework identity types, so a consumer's own OWNED type (e.g. `note`) is NOT
|
|
88
|
+
* policy-authorable and NOT shareable ("type '…' is not registered — cannot share").
|
|
89
|
+
* Passing them here lets an owner share their own records + author policies over them.
|
|
84
90
|
*/
|
|
85
|
-
static forRoot({ rootIds } = {}) {
|
|
91
|
+
static forRoot({ rootIds, extraObjects = [], } = {}) {
|
|
86
92
|
// ONE shared shield_authz pool for the whole grant-admin stack (ADR-0011): the
|
|
87
93
|
// permission-version bumper, the AccessBundleStore, the GrantAdminService, and the two
|
|
88
94
|
// reconcile jobs all run over this single pool (don't open several). Opened once at
|
|
@@ -212,7 +218,8 @@ let IdentityFeatureModule = IdentityFeatureModule_1 = class IdentityFeatureModul
|
|
|
212
218
|
// are meaningfully policy-authorable in v1; but we expose every registered type's fields and
|
|
213
219
|
// let the delegated-admin ceiling + validateGuidedPolicy gate what a caller may actually
|
|
214
220
|
// author. A consumer's own types (extraObjects) would extend this the same way (future).
|
|
215
|
-
|
|
221
|
+
// Include the consumer's `extraObjects` so their OWNED types are policy-authorable too.
|
|
222
|
+
const schemaSource = [...objects_js_1.identityObjects, ...extraObjects].map((input) => {
|
|
216
223
|
const reg = typeof input === 'function' ? (0, engine_1.reflectObjectType)(input) : input;
|
|
217
224
|
return {
|
|
218
225
|
typeKey: reg.typeKey,
|
|
@@ -235,8 +242,11 @@ let IdentityFeatureModule = IdentityFeatureModule_1 = class IdentityFeatureModul
|
|
|
235
242
|
// surfaces `owned`/table/schema/pk/owner/tenant columns via the engine helpers. The writer's
|
|
236
243
|
// audit reuses the SAME shield_audit sink pattern (best-effort). The ShareService adds
|
|
237
244
|
// name-resolution (no raw uuid) via the existing DirectoryLabelResolver (`auditLabels`).
|
|
245
|
+
// Include the consumer's `extraObjects` so their OWNED types are shareable (a `note` a user
|
|
246
|
+
// owns can be shared) — without them the resolver only knows the framework identity types
|
|
247
|
+
// and the writer rejects "type 'note' is not registered — cannot share." (Live-acceptance fix.)
|
|
238
248
|
const shareTypeInfoByKey = new Map();
|
|
239
|
-
for (const input of objects_js_1.identityObjects) {
|
|
249
|
+
for (const input of [...objects_js_1.identityObjects, ...extraObjects]) {
|
|
240
250
|
const reg = typeof input === 'function' ? (0, engine_1.reflectObjectType)(input) : input;
|
|
241
251
|
const owner = (0, engine_1.ownerColumn)(reg);
|
|
242
252
|
const pk = reg.primaryKey.kind === 'uuid' ? (0, engine_1.uuidPkColumn)(reg.primaryKey) : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astram/identity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Astram framework — the framework-owned identity + tenancy model. Hosts the identity @ObjectType classes (user, company, membership, posting), framework-authored identity migrations, and the identity resolver. Top of the dependency graph: depends on @astram/engine (for @ObjectType/@Field decorators) + @astram/guard / @astram/core (for the auth ports).",
|
|
6
6
|
"type": "commonjs",
|