@geonosis/policy 2.13.0 → 3.0.0
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/CHANGELOG.md +4 -0
- package/dist/conformance.cjs +169 -0
- package/dist/conformance.d.cts +35 -0
- package/dist/conformance.d.ts +35 -0
- package/dist/conformance.js +129 -0
- package/dist/define.cjs +118 -0
- package/dist/define.d.cts +34 -0
- package/dist/define.d.ts +34 -0
- package/dist/define.js +85 -0
- package/dist/drizzle/index.cjs +37 -32
- package/dist/drizzle/index.d.cts +20 -23
- package/dist/drizzle/index.d.ts +20 -23
- package/dist/drizzle/index.js +2 -5
- package/dist/index.cjs +79 -856
- package/dist/index.d.cts +19 -428
- package/dist/index.d.ts +19 -428
- package/dist/index.js +35 -797
- package/dist/journal-events.cjs +68 -0
- package/dist/journal-events.d.cts +26 -0
- package/dist/journal-events.d.ts +26 -0
- package/dist/journal-events.js +28 -0
- package/dist/lattice.cjs +150 -0
- package/dist/lattice.d.cts +48 -0
- package/dist/lattice.d.ts +48 -0
- package/dist/lattice.js +110 -0
- package/dist/learning.cjs +246 -0
- package/dist/learning.d.cts +121 -0
- package/dist/learning.d.ts +121 -0
- package/dist/learning.js +206 -0
- package/dist/markdown.cjs +118 -0
- package/dist/markdown.d.cts +35 -0
- package/dist/markdown.d.ts +35 -0
- package/dist/markdown.js +78 -0
- package/dist/medusa/index.cjs +39 -36
- package/dist/medusa/index.d.cts +14 -16
- package/dist/medusa/index.d.ts +14 -16
- package/dist/medusa/index.js +4 -9
- package/dist/permissions/index.cjs +49 -40
- package/dist/permissions/index.d.cts +18 -20
- package/dist/permissions/index.d.ts +18 -20
- package/dist/permissions/index.js +15 -25
- package/dist/read.cjs +111 -0
- package/dist/read.d.cts +51 -0
- package/dist/read.d.ts +51 -0
- package/dist/read.js +71 -0
- package/dist/rows.cjs +54 -0
- package/dist/rows.d.cts +11 -0
- package/dist/rows.d.ts +11 -0
- package/dist/{chunk-JICJ4XEX.js → rows.js} +0 -3
- package/dist/seed.cjs +53 -0
- package/dist/seed.d.cts +18 -0
- package/dist/seed.d.ts +18 -0
- package/dist/seed.js +13 -0
- package/dist/threshold.cjs +73 -0
- package/dist/threshold.d.cts +45 -0
- package/dist/threshold.d.ts +45 -0
- package/dist/threshold.js +33 -0
- package/dist/types.cjs +47 -0
- package/dist/{types-C-Q3r-In.d.cts → types.d.cts} +21 -23
- package/dist/{types-C-Q3r-In.d.ts → types.d.ts} +21 -23
- package/dist/types.js +7 -0
- package/package.json +3 -3
package/dist/drizzle/index.cjs
CHANGED
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
8
|
+
var __toCommonJS = (from) => {
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
+
if (entry)
|
|
11
|
+
return entry;
|
|
12
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
11
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (
|
|
13
|
-
if (!__hasOwnProp.call(
|
|
14
|
-
__defProp(
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
15
20
|
}
|
|
16
|
-
|
|
21
|
+
__moduleCache.set(from, entry);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
36
|
+
});
|
|
17
37
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
38
|
|
|
20
39
|
// src/drizzle/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
40
|
+
var exports_drizzle = {};
|
|
41
|
+
__export(exports_drizzle, {
|
|
23
42
|
createDrizzlePolicyAdapter: () => createDrizzlePolicyAdapter,
|
|
24
43
|
policyJournalColumns: () => policyJournalColumns,
|
|
25
44
|
policyRuleColumns: () => policyRuleColumns
|
|
26
45
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
28
|
-
|
|
29
|
-
// src/rows.ts
|
|
30
|
-
var toPolicyRule = (row) => ({
|
|
31
|
-
constraint: { kind: row.constraint_kind, value: row.constraint_value },
|
|
32
|
-
id: row.rule_key,
|
|
33
|
-
// Only `false` is worth carrying: `true` is the default a policy declares, and writing it back
|
|
34
|
-
// would make a rule that never said anything indistinguishable from one that agreed.
|
|
35
|
-
...row.overridable === false ? { overridable: false } : {},
|
|
36
|
-
reason: row.reason,
|
|
37
|
-
...row.scope ? { scope: row.scope } : {},
|
|
38
|
-
tier: row.tier
|
|
39
|
-
});
|
|
40
|
-
var toPolicyRules = (rows) => rows.filter((row) => (row.status ?? "active") === "active").map(toPolicyRule);
|
|
41
|
-
|
|
42
|
-
// src/drizzle/index.ts
|
|
46
|
+
module.exports = __toCommonJS(exports_drizzle);
|
|
47
|
+
var import_rows = require("../rows.cjs");
|
|
43
48
|
var policyRuleColumns = {
|
|
44
49
|
constraint_kind: "text",
|
|
45
50
|
constraint_value: "json",
|
|
@@ -63,7 +68,7 @@ var attempt = async (what) => {
|
|
|
63
68
|
try {
|
|
64
69
|
return await what();
|
|
65
70
|
} catch {
|
|
66
|
-
return
|
|
71
|
+
return;
|
|
67
72
|
}
|
|
68
73
|
};
|
|
69
74
|
var toRow = (entry) => ({
|
|
@@ -82,5 +87,5 @@ var createDrizzlePolicyAdapter = (options) => ({
|
|
|
82
87
|
}
|
|
83
88
|
} : {},
|
|
84
89
|
name: "drizzle",
|
|
85
|
-
rule: { rules: async () => toPolicyRules(await options.rules({ status: "active" }) ?? []) }
|
|
90
|
+
rule: { rules: async () => import_rows.toPolicyRules(await options.rules({ status: "active" }) ?? []) }
|
|
86
91
|
});
|
package/dist/drizzle/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Awaitable, PolicyAdapter, PolicyQuery, PolicyRuleRow } from '../types.cjs';
|
|
3
2
|
/**
|
|
4
3
|
* A drizzle table, behind the ports the kernel reads.
|
|
5
4
|
*
|
|
@@ -10,27 +9,27 @@ import { P as PolicyQuery, A as Awaitable, a as PolicyRuleRow, b as PolicyAdapte
|
|
|
10
9
|
* changes no decision.
|
|
11
10
|
*/
|
|
12
11
|
/** The columns the kernel reads. Declared once, so a table and a mapper cannot drift apart. */
|
|
13
|
-
declare const policyRuleColumns: {
|
|
14
|
-
readonly constraint_kind:
|
|
15
|
-
readonly constraint_value:
|
|
16
|
-
readonly overridable:
|
|
17
|
-
readonly reason:
|
|
18
|
-
readonly rule_key:
|
|
19
|
-
readonly scope:
|
|
20
|
-
readonly status:
|
|
21
|
-
readonly tier:
|
|
12
|
+
export declare const policyRuleColumns: {
|
|
13
|
+
readonly constraint_kind: 'text';
|
|
14
|
+
readonly constraint_value: 'json';
|
|
15
|
+
readonly overridable: 'boolean';
|
|
16
|
+
readonly reason: 'text';
|
|
17
|
+
readonly rule_key: 'text';
|
|
18
|
+
readonly scope: 'json';
|
|
19
|
+
readonly status: 'text';
|
|
20
|
+
readonly tier: 'text';
|
|
22
21
|
};
|
|
23
22
|
/** The journal's columns. There is no `rejected` one: a rejection is written into `error`. */
|
|
24
|
-
declare const policyJournalColumns: {
|
|
25
|
-
readonly actor_id:
|
|
26
|
-
readonly actor_kind:
|
|
27
|
-
readonly error:
|
|
28
|
-
readonly event_name:
|
|
29
|
-
readonly fell_back_to:
|
|
30
|
-
readonly op:
|
|
31
|
-
readonly subject:
|
|
23
|
+
export declare const policyJournalColumns: {
|
|
24
|
+
readonly actor_id: 'text';
|
|
25
|
+
readonly actor_kind: 'text';
|
|
26
|
+
readonly error: 'text';
|
|
27
|
+
readonly event_name: 'text';
|
|
28
|
+
readonly fell_back_to: 'json';
|
|
29
|
+
readonly op: 'text';
|
|
30
|
+
readonly subject: 'text';
|
|
32
31
|
};
|
|
33
|
-
type DrizzlePolicyAdapterOptions = {
|
|
32
|
+
export type DrizzlePolicyAdapterOptions = {
|
|
34
33
|
config?: (kind: string, query: PolicyQuery) => Awaitable<unknown>;
|
|
35
34
|
/** Absent when the store has no journal table. Half an adapter is honest; a silent drop is not. */
|
|
36
35
|
journal?: (row: Record<string, unknown>) => Awaitable<unknown>;
|
|
@@ -38,6 +37,4 @@ type DrizzlePolicyAdapterOptions = {
|
|
|
38
37
|
status: string;
|
|
39
38
|
}) => Awaitable<readonly PolicyRuleRow[]>;
|
|
40
39
|
};
|
|
41
|
-
declare const createDrizzlePolicyAdapter: (options: DrizzlePolicyAdapterOptions) => PolicyAdapter;
|
|
42
|
-
|
|
43
|
-
export { type DrizzlePolicyAdapterOptions, createDrizzlePolicyAdapter, policyJournalColumns, policyRuleColumns };
|
|
40
|
+
export declare const createDrizzlePolicyAdapter: (options: DrizzlePolicyAdapterOptions) => PolicyAdapter;
|
package/dist/drizzle/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Awaitable, PolicyAdapter, PolicyQuery, PolicyRuleRow } from '../types.js';
|
|
3
2
|
/**
|
|
4
3
|
* A drizzle table, behind the ports the kernel reads.
|
|
5
4
|
*
|
|
@@ -10,27 +9,27 @@ import { P as PolicyQuery, A as Awaitable, a as PolicyRuleRow, b as PolicyAdapte
|
|
|
10
9
|
* changes no decision.
|
|
11
10
|
*/
|
|
12
11
|
/** The columns the kernel reads. Declared once, so a table and a mapper cannot drift apart. */
|
|
13
|
-
declare const policyRuleColumns: {
|
|
14
|
-
readonly constraint_kind:
|
|
15
|
-
readonly constraint_value:
|
|
16
|
-
readonly overridable:
|
|
17
|
-
readonly reason:
|
|
18
|
-
readonly rule_key:
|
|
19
|
-
readonly scope:
|
|
20
|
-
readonly status:
|
|
21
|
-
readonly tier:
|
|
12
|
+
export declare const policyRuleColumns: {
|
|
13
|
+
readonly constraint_kind: 'text';
|
|
14
|
+
readonly constraint_value: 'json';
|
|
15
|
+
readonly overridable: 'boolean';
|
|
16
|
+
readonly reason: 'text';
|
|
17
|
+
readonly rule_key: 'text';
|
|
18
|
+
readonly scope: 'json';
|
|
19
|
+
readonly status: 'text';
|
|
20
|
+
readonly tier: 'text';
|
|
22
21
|
};
|
|
23
22
|
/** The journal's columns. There is no `rejected` one: a rejection is written into `error`. */
|
|
24
|
-
declare const policyJournalColumns: {
|
|
25
|
-
readonly actor_id:
|
|
26
|
-
readonly actor_kind:
|
|
27
|
-
readonly error:
|
|
28
|
-
readonly event_name:
|
|
29
|
-
readonly fell_back_to:
|
|
30
|
-
readonly op:
|
|
31
|
-
readonly subject:
|
|
23
|
+
export declare const policyJournalColumns: {
|
|
24
|
+
readonly actor_id: 'text';
|
|
25
|
+
readonly actor_kind: 'text';
|
|
26
|
+
readonly error: 'text';
|
|
27
|
+
readonly event_name: 'text';
|
|
28
|
+
readonly fell_back_to: 'json';
|
|
29
|
+
readonly op: 'text';
|
|
30
|
+
readonly subject: 'text';
|
|
32
31
|
};
|
|
33
|
-
type DrizzlePolicyAdapterOptions = {
|
|
32
|
+
export type DrizzlePolicyAdapterOptions = {
|
|
34
33
|
config?: (kind: string, query: PolicyQuery) => Awaitable<unknown>;
|
|
35
34
|
/** Absent when the store has no journal table. Half an adapter is honest; a silent drop is not. */
|
|
36
35
|
journal?: (row: Record<string, unknown>) => Awaitable<unknown>;
|
|
@@ -38,6 +37,4 @@ type DrizzlePolicyAdapterOptions = {
|
|
|
38
37
|
status: string;
|
|
39
38
|
}) => Awaitable<readonly PolicyRuleRow[]>;
|
|
40
39
|
};
|
|
41
|
-
declare const createDrizzlePolicyAdapter: (options: DrizzlePolicyAdapterOptions) => PolicyAdapter;
|
|
42
|
-
|
|
43
|
-
export { type DrizzlePolicyAdapterOptions, createDrizzlePolicyAdapter, policyJournalColumns, policyRuleColumns };
|
|
40
|
+
export declare const createDrizzlePolicyAdapter: (options: DrizzlePolicyAdapterOptions) => PolicyAdapter;
|
package/dist/drizzle/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toPolicyRules
|
|
3
|
-
} from "../chunk-JICJ4XEX.js";
|
|
4
|
-
|
|
5
1
|
// src/drizzle/index.ts
|
|
2
|
+
import { toPolicyRules } from "../rows.js";
|
|
6
3
|
var policyRuleColumns = {
|
|
7
4
|
constraint_kind: "text",
|
|
8
5
|
constraint_value: "json",
|
|
@@ -26,7 +23,7 @@ var attempt = async (what) => {
|
|
|
26
23
|
try {
|
|
27
24
|
return await what();
|
|
28
25
|
} catch {
|
|
29
|
-
return
|
|
26
|
+
return;
|
|
30
27
|
}
|
|
31
28
|
};
|
|
32
29
|
var toRow = (entry) => ({
|