@medicine-wheel/community-identity 0.14.0 → 0.14.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.
- package/dist/audit.d.ts +59 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +93 -0
- package/dist/audit.js.map +1 -0
- package/dist/circles.d.ts +72 -0
- package/dist/circles.d.ts.map +1 -1
- package/dist/circles.js +64 -1
- package/dist/circles.js.map +1 -1
- package/dist/config.d.ts +45 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +116 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/people.d.ts +7 -0
- package/dist/people.d.ts.map +1 -1
- package/dist/people.js +12 -0
- package/dist/people.js.map +1 -1
- package/package.json +2 -2
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audit log: who did what to whom, kept by the consumer.
|
|
3
|
+
*
|
|
4
|
+
* STPB keeps `audit_logs` (actor, action, entity, metadata, ip) and reads it in
|
|
5
|
+
* the admin's Audit tab. Here the same record, append-only jsonl, with the
|
|
6
|
+
* action names spelled once so every writer and the admin agree.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AUDIT_ACTIONS: readonly ["session.signed_in", "session.signed_out", "person.registered", "person.created", "person.updated", "person.role_changed", "person.deactivated", "person.reactivated", "token.issued", "token.revoked", "circle.created", "circle.updated", "circle.deactivated", "circle.reactivated", "circle.deleted", "circle.member_added", "circle.member_removed", "circle.joined", "invitation.created", "invitation.accepted", "invitation.revoked", "ceremony.opened", "ceremony.closed", "turn.spoken", "turn.witnessed", "diary.written", "config.updated"];
|
|
9
|
+
export type AuditAction = (typeof AUDIT_ACTIONS)[number];
|
|
10
|
+
export type AuditEntityType = 'person' | 'token' | 'circle' | 'invitation' | 'ceremony' | 'beat' | 'diary' | 'config';
|
|
11
|
+
export interface AuditRecord {
|
|
12
|
+
id: string;
|
|
13
|
+
at: string;
|
|
14
|
+
actor_id: string;
|
|
15
|
+
actor_name?: string;
|
|
16
|
+
action: AuditAction;
|
|
17
|
+
entity_type?: AuditEntityType;
|
|
18
|
+
entity_id?: string;
|
|
19
|
+
/** Free facts about the change: old and new values, names, counts. Never secrets. */
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
/** Where the request came from, when the consumer knows. */
|
|
22
|
+
origin?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AuditQuery {
|
|
25
|
+
actor_id?: string;
|
|
26
|
+
action?: AuditAction | AuditAction[];
|
|
27
|
+
entity_type?: AuditEntityType;
|
|
28
|
+
entity_id?: string;
|
|
29
|
+
/** ISO timestamps, inclusive. */
|
|
30
|
+
since?: string;
|
|
31
|
+
until?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
offset?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface AuditPage {
|
|
36
|
+
records: AuditRecord[];
|
|
37
|
+
total: number;
|
|
38
|
+
truncated: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface AuditStore {
|
|
41
|
+
log(record: Omit<AuditRecord, 'id' | 'at'> & {
|
|
42
|
+
at?: string;
|
|
43
|
+
}): Promise<AuditRecord>;
|
|
44
|
+
/** Newest first. */
|
|
45
|
+
query(q?: AuditQuery): Promise<AuditPage>;
|
|
46
|
+
/** Counts per action since a moment; the admin's "last 7 days" panel. */
|
|
47
|
+
countSince(since: string): Promise<Record<string, number>>;
|
|
48
|
+
}
|
|
49
|
+
export declare class JsonlAuditStore implements AuditStore {
|
|
50
|
+
private readonly file;
|
|
51
|
+
constructor(file: string);
|
|
52
|
+
private readAll;
|
|
53
|
+
log(input: Omit<AuditRecord, 'id' | 'at'> & {
|
|
54
|
+
at?: string;
|
|
55
|
+
}): Promise<AuditRecord>;
|
|
56
|
+
query(q?: AuditQuery): Promise<AuditPage>;
|
|
57
|
+
countSince(since: string): Promise<Record<string, number>>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,aAAa,miBA4BhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpF,oBAAoB;IACpB,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,yEAAyE;IACzE,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5D;AAMD,qBAAa,eAAgB,YAAW,UAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM;IAEzC,OAAO,CAAC,OAAO;IAQT,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAOlF,KAAK,CAAC,CAAC,GAAE,UAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAkB7C,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAQjE"}
|
package/dist/audit.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The audit log: who did what to whom, kept by the consumer.
|
|
4
|
+
*
|
|
5
|
+
* STPB keeps `audit_logs` (actor, action, entity, metadata, ip) and reads it in
|
|
6
|
+
* the admin's Audit tab. Here the same record, append-only jsonl, with the
|
|
7
|
+
* action names spelled once so every writer and the admin agree.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.JsonlAuditStore = exports.AUDIT_ACTIONS = void 0;
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
exports.AUDIT_ACTIONS = [
|
|
15
|
+
'session.signed_in',
|
|
16
|
+
'session.signed_out',
|
|
17
|
+
'person.registered',
|
|
18
|
+
'person.created',
|
|
19
|
+
'person.updated',
|
|
20
|
+
'person.role_changed',
|
|
21
|
+
'person.deactivated',
|
|
22
|
+
'person.reactivated',
|
|
23
|
+
'token.issued',
|
|
24
|
+
'token.revoked',
|
|
25
|
+
'circle.created',
|
|
26
|
+
'circle.updated',
|
|
27
|
+
'circle.deactivated',
|
|
28
|
+
'circle.reactivated',
|
|
29
|
+
'circle.deleted',
|
|
30
|
+
'circle.member_added',
|
|
31
|
+
'circle.member_removed',
|
|
32
|
+
'circle.joined',
|
|
33
|
+
'invitation.created',
|
|
34
|
+
'invitation.accepted',
|
|
35
|
+
'invitation.revoked',
|
|
36
|
+
'ceremony.opened',
|
|
37
|
+
'ceremony.closed',
|
|
38
|
+
'turn.spoken',
|
|
39
|
+
'turn.witnessed',
|
|
40
|
+
'diary.written',
|
|
41
|
+
'config.updated',
|
|
42
|
+
];
|
|
43
|
+
function auditId() {
|
|
44
|
+
return `audit:${Date.now()}:${(0, node_crypto_1.randomBytes)(3).toString('hex')}`;
|
|
45
|
+
}
|
|
46
|
+
class JsonlAuditStore {
|
|
47
|
+
file;
|
|
48
|
+
constructor(file) {
|
|
49
|
+
this.file = file;
|
|
50
|
+
}
|
|
51
|
+
readAll() {
|
|
52
|
+
if (!(0, node_fs_1.existsSync)(this.file))
|
|
53
|
+
return [];
|
|
54
|
+
return (0, node_fs_1.readFileSync)(this.file, 'utf8')
|
|
55
|
+
.split('\n')
|
|
56
|
+
.filter((line) => line.trim())
|
|
57
|
+
.map((line) => JSON.parse(line));
|
|
58
|
+
}
|
|
59
|
+
async log(input) {
|
|
60
|
+
const record = { id: auditId(), at: input.at ?? new Date().toISOString(), ...input };
|
|
61
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(this.file), { recursive: true });
|
|
62
|
+
(0, node_fs_1.appendFileSync)(this.file, JSON.stringify(record) + '\n');
|
|
63
|
+
return record;
|
|
64
|
+
}
|
|
65
|
+
async query(q = {}) {
|
|
66
|
+
const actions = q.action === undefined ? null : Array.isArray(q.action) ? q.action : [q.action];
|
|
67
|
+
const since = q.since ? Date.parse(q.since) : null;
|
|
68
|
+
const until = q.until ? Date.parse(q.until) : null;
|
|
69
|
+
const matched = this.readAll()
|
|
70
|
+
.filter((r) => (q.actor_id ? r.actor_id === q.actor_id : true))
|
|
71
|
+
.filter((r) => (actions ? actions.includes(r.action) : true))
|
|
72
|
+
.filter((r) => (q.entity_type ? r.entity_type === q.entity_type : true))
|
|
73
|
+
.filter((r) => (q.entity_id ? r.entity_id === q.entity_id : true))
|
|
74
|
+
.filter((r) => (since !== null ? Date.parse(r.at) >= since : true))
|
|
75
|
+
.filter((r) => (until !== null ? Date.parse(r.at) <= until : true))
|
|
76
|
+
.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
77
|
+
const offset = q.offset && q.offset > 0 ? q.offset : 0;
|
|
78
|
+
const limit = q.limit && q.limit > 0 ? q.limit : 50;
|
|
79
|
+
const records = matched.slice(offset, offset + limit);
|
|
80
|
+
return { records, total: matched.length, truncated: offset + records.length < matched.length };
|
|
81
|
+
}
|
|
82
|
+
async countSince(since) {
|
|
83
|
+
const t = Date.parse(since);
|
|
84
|
+
const counts = {};
|
|
85
|
+
for (const r of this.readAll()) {
|
|
86
|
+
if (Date.parse(r.at) >= t)
|
|
87
|
+
counts[r.action] = (counts[r.action] ?? 0) + 1;
|
|
88
|
+
}
|
|
89
|
+
return counts;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.JsonlAuditStore = JsonlAuditStore;
|
|
93
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAA0C;AAC1C,qCAA8E;AAC9E,yCAAoC;AAEvB,QAAA,aAAa,GAAG;IAC3B,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,uBAAuB;IACvB,eAAe;IACf,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,gBAAgB;CACR,CAAC;AA8CX,SAAS,OAAO;IACd,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAA,yBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACjE,CAAC;AAED,MAAa,eAAe;IACG;IAA7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAErC,OAAO;QACb,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QACtC,OAAO,IAAA,sBAAY,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;aACnC,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB,CAAC,CAAC;IACpD,CAAC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,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IACjG,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5CD,0CA4CC"}
|
package/dist/circles.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export interface CircleContainer {
|
|
|
22
22
|
hide_engagement_metrics: boolean;
|
|
23
23
|
}
|
|
24
24
|
export declare const DEFAULT_CONTAINER: CircleContainer;
|
|
25
|
+
/** STPB's circle kinds: an ongoing circle, a seasonal one, one held once. */
|
|
26
|
+
export type CircleType = 'ongoing' | 'seasonal' | 'one_time';
|
|
27
|
+
export declare const CIRCLE_TYPES: readonly CircleType[];
|
|
25
28
|
export interface Circle {
|
|
26
29
|
/** The node id on the wheel. */
|
|
27
30
|
id: string;
|
|
@@ -30,6 +33,11 @@ export interface Circle {
|
|
|
30
33
|
facilitator_id: string;
|
|
31
34
|
direction?: DirectionName;
|
|
32
35
|
capacity?: number;
|
|
36
|
+
circle_type: CircleType;
|
|
37
|
+
/** A public circle is visible to everyone on the wheel; a private one to its members and admins. */
|
|
38
|
+
is_public: boolean;
|
|
39
|
+
/** An inactive circle keeps its members and history; no ceremony is opened in it. */
|
|
40
|
+
active: boolean;
|
|
33
41
|
container: CircleContainer;
|
|
34
42
|
created_at: string;
|
|
35
43
|
updated_at: string;
|
|
@@ -41,6 +49,8 @@ export declare const NewCircleSchema: z.ZodObject<{
|
|
|
41
49
|
facilitator_id: z.ZodString;
|
|
42
50
|
direction: z.ZodOptional<z.ZodEnum<["east", "south", "west", "north"]>>;
|
|
43
51
|
capacity: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
circle_type: z.ZodOptional<z.ZodEnum<["ongoing", "seasonal", "one_time"]>>;
|
|
53
|
+
is_public: z.ZodOptional<z.ZodBoolean>;
|
|
44
54
|
container: z.ZodOptional<z.ZodObject<{
|
|
45
55
|
private_by_default: z.ZodOptional<z.ZodBoolean>;
|
|
46
56
|
explicit_sharing_consent: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -61,6 +71,8 @@ export declare const NewCircleSchema: z.ZodObject<{
|
|
|
61
71
|
id?: string | undefined;
|
|
62
72
|
direction?: "east" | "south" | "west" | "north" | undefined;
|
|
63
73
|
capacity?: number | undefined;
|
|
74
|
+
circle_type?: "ongoing" | "seasonal" | "one_time" | undefined;
|
|
75
|
+
is_public?: boolean | undefined;
|
|
64
76
|
container?: {
|
|
65
77
|
private_by_default?: boolean | undefined;
|
|
66
78
|
explicit_sharing_consent?: boolean | undefined;
|
|
@@ -73,6 +85,8 @@ export declare const NewCircleSchema: z.ZodObject<{
|
|
|
73
85
|
id?: string | undefined;
|
|
74
86
|
direction?: "east" | "south" | "west" | "north" | undefined;
|
|
75
87
|
capacity?: number | undefined;
|
|
88
|
+
circle_type?: "ongoing" | "seasonal" | "one_time" | undefined;
|
|
89
|
+
is_public?: boolean | undefined;
|
|
76
90
|
container?: {
|
|
77
91
|
private_by_default?: boolean | undefined;
|
|
78
92
|
explicit_sharing_consent?: boolean | undefined;
|
|
@@ -97,4 +111,62 @@ export declare function membershipFromEdge(edge: RelationalEdge | Omit<Relationa
|
|
|
97
111
|
export declare function membersOf(circle_id: string, edges: readonly (RelationalEdge | Omit<RelationalEdge, 'id'>)[]): Membership[];
|
|
98
112
|
/** Circles one person belongs to, from the edges that leave them. */
|
|
99
113
|
export declare function circlesOf(person_id: string, edges: readonly (RelationalEdge | Omit<RelationalEdge, 'id'>)[]): Membership[];
|
|
114
|
+
export declare const CirclePatchSchema: z.ZodObject<{
|
|
115
|
+
name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
intention: z.ZodOptional<z.ZodString>;
|
|
117
|
+
facilitator_id: z.ZodOptional<z.ZodString>;
|
|
118
|
+
direction: z.ZodOptional<z.ZodNullable<z.ZodEnum<["east", "south", "west", "north"]>>>;
|
|
119
|
+
capacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
120
|
+
circle_type: z.ZodOptional<z.ZodEnum<["ongoing", "seasonal", "one_time"]>>;
|
|
121
|
+
is_public: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
container: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
private_by_default: z.ZodOptional<z.ZodBoolean>;
|
|
125
|
+
explicit_sharing_consent: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
+
hide_engagement_metrics: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
private_by_default?: boolean | undefined;
|
|
129
|
+
explicit_sharing_consent?: boolean | undefined;
|
|
130
|
+
hide_engagement_metrics?: boolean | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
private_by_default?: boolean | undefined;
|
|
133
|
+
explicit_sharing_consent?: boolean | undefined;
|
|
134
|
+
hide_engagement_metrics?: boolean | undefined;
|
|
135
|
+
}>>;
|
|
136
|
+
}, "strict", z.ZodTypeAny, {
|
|
137
|
+
name?: string | undefined;
|
|
138
|
+
intention?: string | undefined;
|
|
139
|
+
facilitator_id?: string | undefined;
|
|
140
|
+
direction?: "east" | "south" | "west" | "north" | null | undefined;
|
|
141
|
+
capacity?: number | null | undefined;
|
|
142
|
+
circle_type?: "ongoing" | "seasonal" | "one_time" | undefined;
|
|
143
|
+
is_public?: boolean | undefined;
|
|
144
|
+
container?: {
|
|
145
|
+
private_by_default?: boolean | undefined;
|
|
146
|
+
explicit_sharing_consent?: boolean | undefined;
|
|
147
|
+
hide_engagement_metrics?: boolean | undefined;
|
|
148
|
+
} | undefined;
|
|
149
|
+
active?: boolean | undefined;
|
|
150
|
+
}, {
|
|
151
|
+
name?: string | undefined;
|
|
152
|
+
intention?: string | undefined;
|
|
153
|
+
facilitator_id?: string | undefined;
|
|
154
|
+
direction?: "east" | "south" | "west" | "north" | null | undefined;
|
|
155
|
+
capacity?: number | null | undefined;
|
|
156
|
+
circle_type?: "ongoing" | "seasonal" | "one_time" | undefined;
|
|
157
|
+
is_public?: boolean | undefined;
|
|
158
|
+
container?: {
|
|
159
|
+
private_by_default?: boolean | undefined;
|
|
160
|
+
explicit_sharing_consent?: boolean | undefined;
|
|
161
|
+
hide_engagement_metrics?: boolean | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
active?: boolean | undefined;
|
|
164
|
+
}>;
|
|
165
|
+
export type CirclePatch = z.infer<typeof CirclePatchSchema>;
|
|
166
|
+
/** The node patch (name, direction, metadata) that applies a circle change to the existing node. */
|
|
167
|
+
export declare function circleNodePatch(node: RelationalNode, patch: CirclePatch): {
|
|
168
|
+
name?: string;
|
|
169
|
+
direction?: DirectionName | null;
|
|
170
|
+
metadata: Record<string, unknown>;
|
|
171
|
+
};
|
|
100
172
|
//# sourceMappingURL=circles.d.ts.map
|
package/dist/circles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circles.d.ts","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW,EAAG,QAAiB,CAAC;AAC7C,eAAO,MAAM,SAAS,EAAG,WAAoB,CAAC;AAE9C,sGAAsG;AACtG,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uEAAuE;IACvE,wBAAwB,EAAE,OAAO,CAAC;IAClC,+CAA+C;IAC/C,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,iBAAiB,EAAE,eAI/B,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"circles.d.ts","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW,EAAG,QAAiB,CAAC;AAC7C,eAAO,MAAM,SAAS,EAAG,WAAoB,CAAC;AAE9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AAC,CAAA;CAAE,CAwBhK"}
|
package/dist/circles.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* in `circle_id` (ontology-core 0.14.0).
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.NewCircleSchema = exports.DEFAULT_CONTAINER = exports.MEMBER_OF = exports.CIRCLE_KIND = void 0;
|
|
13
|
+
exports.CirclePatchSchema = exports.NewCircleSchema = exports.CIRCLE_TYPES = exports.DEFAULT_CONTAINER = exports.MEMBER_OF = exports.CIRCLE_KIND = void 0;
|
|
14
14
|
exports.circleNodeId = circleNodeId;
|
|
15
15
|
exports.circleNode = circleNode;
|
|
16
16
|
exports.circleFromNode = circleFromNode;
|
|
@@ -18,6 +18,7 @@ exports.membershipEdge = membershipEdge;
|
|
|
18
18
|
exports.membershipFromEdge = membershipFromEdge;
|
|
19
19
|
exports.membersOf = membersOf;
|
|
20
20
|
exports.circlesOf = circlesOf;
|
|
21
|
+
exports.circleNodePatch = circleNodePatch;
|
|
21
22
|
const zod_1 = require("zod");
|
|
22
23
|
exports.CIRCLE_KIND = 'circle';
|
|
23
24
|
exports.MEMBER_OF = 'member_of';
|
|
@@ -26,6 +27,7 @@ exports.DEFAULT_CONTAINER = {
|
|
|
26
27
|
explicit_sharing_consent: true,
|
|
27
28
|
hide_engagement_metrics: true,
|
|
28
29
|
};
|
|
30
|
+
exports.CIRCLE_TYPES = ['ongoing', 'seasonal', 'one_time'];
|
|
29
31
|
exports.NewCircleSchema = zod_1.z.object({
|
|
30
32
|
id: zod_1.z.string().trim().min(1).optional(),
|
|
31
33
|
name: zod_1.z.string().trim().min(1),
|
|
@@ -33,6 +35,8 @@ exports.NewCircleSchema = zod_1.z.object({
|
|
|
33
35
|
facilitator_id: zod_1.z.string().trim().min(1),
|
|
34
36
|
direction: zod_1.z.enum(['east', 'south', 'west', 'north']).optional(),
|
|
35
37
|
capacity: zod_1.z.number().int().positive().optional(),
|
|
38
|
+
circle_type: zod_1.z.enum(['ongoing', 'seasonal', 'one_time']).optional(),
|
|
39
|
+
is_public: zod_1.z.boolean().optional(),
|
|
36
40
|
container: zod_1.z
|
|
37
41
|
.object({
|
|
38
42
|
private_by_default: zod_1.z.boolean().optional(),
|
|
@@ -55,6 +59,9 @@ function circleNode(input, now = new Date().toISOString()) {
|
|
|
55
59
|
intention: input.intention,
|
|
56
60
|
facilitator_id: input.facilitator_id,
|
|
57
61
|
...(input.capacity !== undefined ? { capacity: input.capacity } : {}),
|
|
62
|
+
circle_type: input.circle_type ?? 'ongoing',
|
|
63
|
+
is_public: input.is_public ?? false,
|
|
64
|
+
active: true,
|
|
58
65
|
container: { ...exports.DEFAULT_CONTAINER, ...(input.container ?? {}) },
|
|
59
66
|
},
|
|
60
67
|
created_at: now,
|
|
@@ -75,6 +82,9 @@ function circleFromNode(node) {
|
|
|
75
82
|
facilitator_id: meta.facilitator_id,
|
|
76
83
|
...(node.direction ? { direction: node.direction } : {}),
|
|
77
84
|
...(typeof meta.capacity === 'number' ? { capacity: meta.capacity } : {}),
|
|
85
|
+
circle_type: exports.CIRCLE_TYPES.includes(String(meta.circle_type)) ? meta.circle_type : 'ongoing',
|
|
86
|
+
is_public: meta.is_public === true,
|
|
87
|
+
active: meta.active !== false,
|
|
78
88
|
container: { ...exports.DEFAULT_CONTAINER, ...container },
|
|
79
89
|
created_at: node.created_at,
|
|
80
90
|
updated_at: node.updated_at,
|
|
@@ -116,4 +126,57 @@ function circlesOf(person_id, edges) {
|
|
|
116
126
|
.map(membershipFromEdge)
|
|
117
127
|
.filter((m) => m !== null);
|
|
118
128
|
}
|
|
129
|
+
exports.CirclePatchSchema = zod_1.z
|
|
130
|
+
.object({
|
|
131
|
+
name: zod_1.z.string().trim().min(1).optional(),
|
|
132
|
+
intention: zod_1.z.string().trim().min(1).optional(),
|
|
133
|
+
facilitator_id: zod_1.z.string().trim().min(1).optional(),
|
|
134
|
+
direction: zod_1.z.enum(['east', 'south', 'west', 'north']).nullable().optional(),
|
|
135
|
+
capacity: zod_1.z.number().int().positive().nullable().optional(),
|
|
136
|
+
circle_type: zod_1.z.enum(['ongoing', 'seasonal', 'one_time']).optional(),
|
|
137
|
+
is_public: zod_1.z.boolean().optional(),
|
|
138
|
+
active: zod_1.z.boolean().optional(),
|
|
139
|
+
container: zod_1.z
|
|
140
|
+
.object({
|
|
141
|
+
private_by_default: zod_1.z.boolean().optional(),
|
|
142
|
+
explicit_sharing_consent: zod_1.z.boolean().optional(),
|
|
143
|
+
hide_engagement_metrics: zod_1.z.boolean().optional(),
|
|
144
|
+
})
|
|
145
|
+
.optional(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
/** The node patch (name, direction, metadata) that applies a circle change to the existing node. */
|
|
149
|
+
function circleNodePatch(node, patch) {
|
|
150
|
+
const meta = { ...(node.metadata ?? {}) };
|
|
151
|
+
if (patch.intention !== undefined)
|
|
152
|
+
meta.intention = patch.intention;
|
|
153
|
+
if (patch.facilitator_id !== undefined)
|
|
154
|
+
meta.facilitator_id = patch.facilitator_id;
|
|
155
|
+
if (patch.capacity !== undefined) {
|
|
156
|
+
if (patch.capacity === null)
|
|
157
|
+
delete meta.capacity;
|
|
158
|
+
else
|
|
159
|
+
meta.capacity = patch.capacity;
|
|
160
|
+
}
|
|
161
|
+
if (patch.circle_type !== undefined)
|
|
162
|
+
meta.circle_type = patch.circle_type;
|
|
163
|
+
if (patch.is_public !== undefined)
|
|
164
|
+
meta.is_public = patch.is_public;
|
|
165
|
+
if (patch.active !== undefined) {
|
|
166
|
+
meta.active = patch.active;
|
|
167
|
+
if (!patch.active)
|
|
168
|
+
meta.deactivated_at = new Date().toISOString();
|
|
169
|
+
else
|
|
170
|
+
delete meta.deactivated_at;
|
|
171
|
+
}
|
|
172
|
+
if (patch.container) {
|
|
173
|
+
const current = (meta.container && typeof meta.container === 'object' ? meta.container : {});
|
|
174
|
+
meta.container = { ...exports.DEFAULT_CONTAINER, ...current, ...patch.container };
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
...(patch.name !== undefined ? { name: patch.name } : {}),
|
|
178
|
+
...(patch.direction !== undefined ? { direction: patch.direction } : {}),
|
|
179
|
+
metadata: meta,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
119
182
|
//# sourceMappingURL=circles.js.map
|
package/dist/circles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circles.js","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;
|
|
1
|
+
{"version":3,"file":"circles.js","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAkEH,oCAEC;AAED,gCAmBC;AAED,wCAmBC;AAYD,wCAUC;AAED,gDAQC;AAGD,8BAKC;AAGD,8BAKC;AAyBD,0CAwBC;AA5MD,6BAAwB;AAEX,QAAA,WAAW,GAAG,QAAiB,CAAC;AAChC,QAAA,SAAS,GAAG,WAAoB,CAAC;AAYjC,QAAA,iBAAiB,GAAoB;IAChD,kBAAkB,EAAE,IAAI;IACxB,wBAAwB,EAAE,IAAI;IAC9B,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAIW,QAAA,YAAY,GAA0B,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAoBnF,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE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|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Community configuration: what an admin sets for the whole platform.
|
|
3
|
+
*
|
|
4
|
+
* STPB keeps `platform_config` (key, value, updated_by) behind its Config tab:
|
|
5
|
+
* open registration, ceremony registration, limits. Here the fields a wheel
|
|
6
|
+
* community needs, one JSON file kept by the consumer, plus the one thing STPB
|
|
7
|
+
* cannot do: grant a role a permission it does not carry by default (so a
|
|
8
|
+
* community may decide that its participants witness).
|
|
9
|
+
*/
|
|
10
|
+
import { type Permission, type Role } from './roles.js';
|
|
11
|
+
export type RegistrationMode = 'invite_only' | 'open' | 'closed';
|
|
12
|
+
export interface CommunityConfig {
|
|
13
|
+
/** `invite_only`: a code from a circle is needed (default). `open`: anyone may register, unseated. `closed`: nobody. */
|
|
14
|
+
registration: RegistrationMode;
|
|
15
|
+
/** The role a newcomer receives. */
|
|
16
|
+
default_role: Role;
|
|
17
|
+
/** Permissions granted beyond the role's default map, per role. */
|
|
18
|
+
role_grants: Partial<Record<Role, Permission[]>>;
|
|
19
|
+
/** Shown to everyone signed in, when set. */
|
|
20
|
+
site_notice?: string;
|
|
21
|
+
updated_at?: string;
|
|
22
|
+
updated_by?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const DEFAULT_CONFIG: CommunityConfig;
|
|
25
|
+
export declare function isRegistrationMode(v: unknown): v is RegistrationMode;
|
|
26
|
+
/** Validate a partial config from the outside; returns the fields that are valid and the reasons for the rest. */
|
|
27
|
+
export declare function validateConfigPatch(input: unknown): {
|
|
28
|
+
patch: Partial<CommunityConfig>;
|
|
29
|
+
errors: string[];
|
|
30
|
+
};
|
|
31
|
+
/** The role's permissions with the community's grants applied. */
|
|
32
|
+
export declare function permissionsFor(role: Role, config?: Pick<CommunityConfig, 'role_grants'>): readonly (Permission | '*')[];
|
|
33
|
+
export declare function mayDo(role: Role, permission: Permission, config?: Pick<CommunityConfig, 'role_grants'>): boolean;
|
|
34
|
+
export interface ConfigStore {
|
|
35
|
+
get(): Promise<CommunityConfig>;
|
|
36
|
+
set(patch: Partial<CommunityConfig>, updated_by: string): Promise<CommunityConfig>;
|
|
37
|
+
}
|
|
38
|
+
/** One JSON file, whole config, rewritten on change. */
|
|
39
|
+
export declare class JsonConfigStore implements ConfigStore {
|
|
40
|
+
private readonly file;
|
|
41
|
+
constructor(file: string);
|
|
42
|
+
get(): Promise<CommunityConfig>;
|
|
43
|
+
set(patch: Partial<CommunityConfig>, updated_by: string): Promise<CommunityConfig>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAwD,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9G,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,wHAAwH;IACxH,YAAY,EAAE,gBAAgB,CAAC;IAC/B,oCAAoC;IACpC,YAAY,EAAE,IAAI,CAAC;IACnB,mEAAmE;IACnE,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACjD,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,eAI5B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,gBAAgB,CAEpE;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA+BzG;AAED,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAkB,GAAG,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,EAAE,CAKvI;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAkB,GAAG,OAAO,CAEhI;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IAChC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACpF;AAED,wDAAwD;AACxD,qBAAa,eAAgB,YAAW,WAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM;IAEnC,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;IAW/B,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAQzF"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Community configuration: what an admin sets for the whole platform.
|
|
4
|
+
*
|
|
5
|
+
* STPB keeps `platform_config` (key, value, updated_by) behind its Config tab:
|
|
6
|
+
* open registration, ceremony registration, limits. Here the fields a wheel
|
|
7
|
+
* community needs, one JSON file kept by the consumer, plus the one thing STPB
|
|
8
|
+
* cannot do: grant a role a permission it does not carry by default (so a
|
|
9
|
+
* community may decide that its participants witness).
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.JsonConfigStore = exports.DEFAULT_CONFIG = void 0;
|
|
13
|
+
exports.isRegistrationMode = isRegistrationMode;
|
|
14
|
+
exports.validateConfigPatch = validateConfigPatch;
|
|
15
|
+
exports.permissionsFor = permissionsFor;
|
|
16
|
+
exports.mayDo = mayDo;
|
|
17
|
+
const node_fs_1 = require("node:fs");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
19
|
+
const roles_js_1 = require("./roles.js");
|
|
20
|
+
exports.DEFAULT_CONFIG = {
|
|
21
|
+
registration: 'invite_only',
|
|
22
|
+
default_role: 'participant',
|
|
23
|
+
role_grants: {},
|
|
24
|
+
};
|
|
25
|
+
function isRegistrationMode(v) {
|
|
26
|
+
return v === 'invite_only' || v === 'open' || v === 'closed';
|
|
27
|
+
}
|
|
28
|
+
/** Validate a partial config from the outside; returns the fields that are valid and the reasons for the rest. */
|
|
29
|
+
function validateConfigPatch(input) {
|
|
30
|
+
const errors = [];
|
|
31
|
+
const patch = {};
|
|
32
|
+
if (!input || typeof input !== 'object')
|
|
33
|
+
return { patch, errors: ['config must be an object'] };
|
|
34
|
+
const o = input;
|
|
35
|
+
if (o.registration !== undefined) {
|
|
36
|
+
if (isRegistrationMode(o.registration))
|
|
37
|
+
patch.registration = o.registration;
|
|
38
|
+
else
|
|
39
|
+
errors.push('registration must be invite_only, open or closed');
|
|
40
|
+
}
|
|
41
|
+
if (o.default_role !== undefined) {
|
|
42
|
+
if ((0, roles_js_1.isRole)(o.default_role))
|
|
43
|
+
patch.default_role = o.default_role;
|
|
44
|
+
else
|
|
45
|
+
errors.push('default_role is not a role');
|
|
46
|
+
}
|
|
47
|
+
if (o.role_grants !== undefined) {
|
|
48
|
+
if (!o.role_grants || typeof o.role_grants !== 'object')
|
|
49
|
+
errors.push('role_grants must be an object');
|
|
50
|
+
else {
|
|
51
|
+
const grants = {};
|
|
52
|
+
for (const [role, perms] of Object.entries(o.role_grants)) {
|
|
53
|
+
if (!(0, roles_js_1.isRole)(role)) {
|
|
54
|
+
errors.push(`role_grants: ${role} is not a role`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!Array.isArray(perms) || !perms.every((p) => roles_js_1.PERMISSIONS.includes(String(p)))) {
|
|
58
|
+
errors.push(`role_grants.${role}: unknown permission`);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
grants[role] = perms;
|
|
62
|
+
}
|
|
63
|
+
patch.role_grants = grants;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (o.site_notice !== undefined) {
|
|
67
|
+
if (o.site_notice === null || o.site_notice === '')
|
|
68
|
+
patch.site_notice = undefined;
|
|
69
|
+
else if (typeof o.site_notice === 'string')
|
|
70
|
+
patch.site_notice = o.site_notice.slice(0, 500);
|
|
71
|
+
else
|
|
72
|
+
errors.push('site_notice must be text');
|
|
73
|
+
}
|
|
74
|
+
return { patch, errors };
|
|
75
|
+
}
|
|
76
|
+
/** The role's permissions with the community's grants applied. */
|
|
77
|
+
function permissionsFor(role, config = exports.DEFAULT_CONFIG) {
|
|
78
|
+
const base = roles_js_1.ROLE_PERMISSIONS[role];
|
|
79
|
+
if (base.includes('*'))
|
|
80
|
+
return base;
|
|
81
|
+
const extra = config.role_grants?.[role] ?? [];
|
|
82
|
+
return [...new Set([...base, ...extra])];
|
|
83
|
+
}
|
|
84
|
+
function mayDo(role, permission, config = exports.DEFAULT_CONFIG) {
|
|
85
|
+
return (0, roles_js_1.hasPermission)(role, permission) || (config.role_grants?.[role] ?? []).includes(permission);
|
|
86
|
+
}
|
|
87
|
+
/** One JSON file, whole config, rewritten on change. */
|
|
88
|
+
class JsonConfigStore {
|
|
89
|
+
file;
|
|
90
|
+
constructor(file) {
|
|
91
|
+
this.file = file;
|
|
92
|
+
}
|
|
93
|
+
async get() {
|
|
94
|
+
if (!(0, node_fs_1.existsSync)(this.file))
|
|
95
|
+
return { ...exports.DEFAULT_CONFIG };
|
|
96
|
+
try {
|
|
97
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(this.file, 'utf8'));
|
|
98
|
+
const { patch } = validateConfigPatch(parsed);
|
|
99
|
+
return { ...exports.DEFAULT_CONFIG, ...patch, ...(parsed.updated_at ? { updated_at: parsed.updated_at } : {}), ...(parsed.updated_by ? { updated_by: parsed.updated_by } : {}) };
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return { ...exports.DEFAULT_CONFIG };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async set(patch, updated_by) {
|
|
106
|
+
const current = await this.get();
|
|
107
|
+
const next = { ...current, ...patch, updated_at: new Date().toISOString(), updated_by };
|
|
108
|
+
if (patch.site_notice === undefined && 'site_notice' in patch)
|
|
109
|
+
delete next.site_notice;
|
|
110
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(this.file), { recursive: true });
|
|
111
|
+
(0, node_fs_1.writeFileSync)(this.file, JSON.stringify(next, null, 2) + '\n');
|
|
112
|
+
return next;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.JsonConfigStore = JsonConfigStore;
|
|
116
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA2BH,gDAEC;AAGD,kDA+BC;AAGD,wCAKC;AAED,sBAEC;AAzED,qCAA6E;AAC7E,yCAAoC;AACpC,yCAA8G;AAiBjG,QAAA,cAAc,GAAoB;IAC7C,YAAY,EAAE,aAAa;IAC3B,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,SAAgB,kBAAkB,CAAC,CAAU;IAC3C,OAAO,CAAC,KAAK,aAAa,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,QAAQ,CAAC;AAC/D,CAAC;AAED,kHAAkH;AAClH,SAAgB,mBAAmB,CAAC,KAAc;IAChD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,KAAK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CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;QACzG,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,IAAI,KAAK;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC;QACvF,IAAA,mBAAS,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,IAAA,uBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtBD,0CAsBC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,4 +33,6 @@ __exportStar(require("./people.js"), exports);
|
|
|
33
33
|
__exportStar(require("./circles.js"), exports);
|
|
34
34
|
__exportStar(require("./credentials.js"), exports);
|
|
35
35
|
__exportStar(require("./invitations.js"), exports);
|
|
36
|
+
__exportStar(require("./audit.js"), exports);
|
|
37
|
+
__exportStar(require("./config.js"), exports);
|
|
36
38
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,mDAAiC;AACjC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,mDAAiC;AACjC,mDAAiC;AACjC,6CAA2B;AAC3B,8CAA4B"}
|
package/dist/people.d.ts
CHANGED
|
@@ -12,11 +12,14 @@ import type { DirectionName, RelationalNode } from '@medicine-wheel/ontology-cor
|
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import { type Role } from './roles.js';
|
|
14
14
|
export declare const PERSON_KIND: "person";
|
|
15
|
+
export type PersonStatus = 'active' | 'deactivated';
|
|
15
16
|
export interface Person {
|
|
16
17
|
/** The node id on the wheel. */
|
|
17
18
|
id: string;
|
|
18
19
|
name: string;
|
|
19
20
|
role: Role;
|
|
21
|
+
/** A deactivated person keeps their node and history but cannot sign in. Default `active`. */
|
|
22
|
+
status: PersonStatus;
|
|
20
23
|
email?: string;
|
|
21
24
|
direction?: DirectionName;
|
|
22
25
|
created_at: string;
|
|
@@ -49,4 +52,8 @@ export declare function personNode(input: NewPerson, now?: string): RelationalNo
|
|
|
49
52
|
export declare function personFromNode(node: RelationalNode | null | undefined): Person | null;
|
|
50
53
|
/** The metadata patch that grants (or changes) a person's role. */
|
|
51
54
|
export declare function roleGrant(role: Role, current?: Record<string, unknown>): Record<string, unknown>;
|
|
55
|
+
/** The metadata patch that deactivates a person: they stay on the wheel, they cannot sign in. */
|
|
56
|
+
export declare function deactivatePatch(current?: Record<string, unknown>): Record<string, unknown>;
|
|
57
|
+
/** The metadata patch that lets a deactivated person back in. */
|
|
58
|
+
export declare function reactivatePatch(current?: Record<string, unknown>): Record<string, unknown>;
|
|
52
59
|
//# sourceMappingURL=people.d.ts.map
|
package/dist/people.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,WAAW,EAAG,QAAiB,CAAC;AAE7C,MAAM,WAAW,MAAM;IACrB,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAA2B,GAAG,cAAc,CAc3F;AAED,uGAAuG;AACvG,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"people.d.ts","sourceRo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MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9F;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG9F"}
|
package/dist/people.js
CHANGED
|
@@ -15,6 +15,8 @@ exports.personNodeId = personNodeId;
|
|
|
15
15
|
exports.personNode = personNode;
|
|
16
16
|
exports.personFromNode = personFromNode;
|
|
17
17
|
exports.roleGrant = roleGrant;
|
|
18
|
+
exports.deactivatePatch = deactivatePatch;
|
|
19
|
+
exports.reactivatePatch = reactivatePatch;
|
|
18
20
|
const zod_1 = require("zod");
|
|
19
21
|
const roles_js_1 = require("./roles.js");
|
|
20
22
|
exports.PERSON_KIND = 'person';
|
|
@@ -55,6 +57,7 @@ function personFromNode(node) {
|
|
|
55
57
|
id: node.id,
|
|
56
58
|
name: node.name,
|
|
57
59
|
role: meta.role,
|
|
60
|
+
status: meta.status === 'deactivated' ? 'deactivated' : 'active',
|
|
58
61
|
...(typeof meta.email === 'string' ? { email: meta.email } : {}),
|
|
59
62
|
...(node.direction ? { direction: node.direction } : {}),
|
|
60
63
|
created_at: node.created_at,
|
|
@@ -65,4 +68,13 @@ function personFromNode(node) {
|
|
|
65
68
|
function roleGrant(role, current = {}) {
|
|
66
69
|
return { ...current, kind: exports.PERSON_KIND, role };
|
|
67
70
|
}
|
|
71
|
+
/** The metadata patch that deactivates a person: they stay on the wheel, they cannot sign in. */
|
|
72
|
+
function deactivatePatch(current = {}) {
|
|
73
|
+
return { ...current, status: 'deactivated', deactivated_at: new Date().toISOString() };
|
|
74
|
+
}
|
|
75
|
+
/** The metadata patch that lets a deactivated person back in. */
|
|
76
|
+
function reactivatePatch(current = {}) {
|
|
77
|
+
const { deactivated_at: _gone, ...rest } = current;
|
|
78
|
+
return { ...rest, status: 'active' };
|
|
79
|
+
}
|
|
68
80
|
//# sourceMappingURL=people.js.map
|
package/dist/people.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.js","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;
|
|
1
|
+
{"version":3,"file":"people.js","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAiCH,oCAEC;AAGD,gCAcC;AAGD,wCAcC;AAGD,8BAEC;AAGD,0CAEC;AAGD,0CAGC;AAlFD,6BAAwB;AACxB,yCAA+C;AAElC,QAAA,WAAW,GAAG,QAAiB,CAAC;AAiBhC,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAM,EAAE,cAAc,CAAC;IAC/C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;CACjE,CAAC,CAAC;AAIH,SAAgB,YAAY;IAC1B,OAAO,cAAc,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC;AAED,wDAAwD;AACxD,SAAgB,UAAU,CAAC,KAAgB,EAAE,GAA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C,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,SAAgB,SAAS,CAAC,IAAU,EAAE,UAAmC,EAAE;IACzE,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,mBAAW,EAAE,IAAI,EAAE,CAAC;AACjD,CAAC;AAED,iGAAiG;AACjG,SAAgB,eAAe,CAAC,UAAmC,EAAE;IACnE,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;AACzF,CAAC;AAED,iEAAiE;AACjE,SAAgB,eAAe,CAAC,UAAmC,EAAE;IACnE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACnD,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medicine-wheel/community-identity",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Who is in the circle: people as wheel nodes, roles with a permission map, circles and memberships as relations, invitations and self-issued credentials kept by the consumer — so a Medicine Wheel can tell two people apart.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"directory": "src/community-identity"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@medicine-wheel/ontology-core": "^0.14.
|
|
44
|
+
"@medicine-wheel/ontology-core": "^0.14.1",
|
|
45
45
|
"zod": "^3.23.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|