@diister/quick-permission 0.9.0-beta.6 → 0.9.0-beta.7
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 +46 -5
- package/dist/mod.d.ts +2 -2
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +1 -1
- package/dist/system.d.ts +45 -70
- package/dist/system.d.ts.map +1 -1
- package/dist/system.js +264 -245
- package/dist/system.js.map +1 -1
- package/mod.ts +9 -1
- package/package.json +1 -1
- package/system.ts +349 -325
package/README.md
CHANGED
|
@@ -127,15 +127,44 @@ the caller deserves to know why.
|
|
|
127
127
|
### Providers
|
|
128
128
|
|
|
129
129
|
A provider turns a subject into grants. Several may be combined, and a subject
|
|
130
|
-
is allowed when any single grant satisfies the permission's rules.
|
|
130
|
+
is allowed when any single grant satisfies the permission's rules. A grant names
|
|
131
|
+
one permission key; there is no wildcard key, so an administrator is granted the
|
|
132
|
+
intermediate keys that expand to everything they hold.
|
|
131
133
|
|
|
132
134
|
```ts
|
|
133
135
|
providers: [
|
|
134
136
|
(subject) => db.grants.find({ userId: subject.id }).toArray(),
|
|
135
|
-
(subject) =>
|
|
137
|
+
(subject) =>
|
|
138
|
+
subject.isAdmin ? [{ key: "posts.manage", target: ["post:*"] }] : [],
|
|
136
139
|
]
|
|
137
140
|
```
|
|
138
141
|
|
|
142
|
+
A provider can also be an object, which lets the engine skip it and cache it:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
{
|
|
146
|
+
name: "memberships",
|
|
147
|
+
keys: ["posts.manage"],
|
|
148
|
+
targetType: "post",
|
|
149
|
+
cacheKey: (subject) => subject.id,
|
|
150
|
+
fetch: (subject, key, target) => membershipGrants(subject.id, target?.[0]),
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| Field | Effect |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `name` | how the provider is named in hooks and in the reasons of a deny |
|
|
157
|
+
| `keys`, `matches` | the keys the provider emits; it is consulted for those and for every key they expand to |
|
|
158
|
+
| `targetType` | consulted only when `target[0]` is one concrete id of that type (`"post:1"`, never `"post:*"`) |
|
|
159
|
+
| `cacheKey` | grants are reused within a `context()` for the same key; return `undefined` to skip the cache |
|
|
160
|
+
| `fetch` | returns the grants |
|
|
161
|
+
|
|
162
|
+
A provider that throws, or whose `cacheKey` throws, contributes no grant. The
|
|
163
|
+
check goes on with the others, so a failure can only narrow what a subject may
|
|
164
|
+
do. The failure reaches `hooks.onError` and, when the check is denied, its
|
|
165
|
+
`reasons`. A resource or rule that throws rejects only the grant that needed it,
|
|
166
|
+
the same way.
|
|
167
|
+
|
|
139
168
|
## Filtering lists, not just single documents
|
|
140
169
|
|
|
141
170
|
This is what the library is really for. `can()` hands back the query fragments
|
|
@@ -177,10 +206,17 @@ const visible = applyFilter(post, result.data as FilterSpec);
|
|
|
177
206
|
|
|
178
207
|
## API reference
|
|
179
208
|
|
|
180
|
-
### `createSystem({ schema, providers })`
|
|
209
|
+
### `createSystem({ schema, providers, hooks })`
|
|
181
210
|
|
|
182
211
|
Builds the engine. `schema` maps permission keys to `permission(...)`
|
|
183
|
-
declarations; `providers` lists the grant sources
|
|
212
|
+
declarations; `providers` lists the grant sources; `hooks` observes them:
|
|
213
|
+
|
|
214
|
+
| Hook | Called with |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| `onProviderFetch` | provider name, key, target, `durationMs`, `grantCount`, for every fetch that was not served from the cache |
|
|
217
|
+
| `onError` | `{ source: "provider", provider, error, … }` or `{ source: "rule", grantId, error, … }` |
|
|
218
|
+
|
|
219
|
+
A hook that throws never changes a decision. `createSystem` returns a `System`:
|
|
184
220
|
|
|
185
221
|
| Member | Purpose |
|
|
186
222
|
| --- | --- |
|
|
@@ -225,11 +261,16 @@ type CanResult =
|
|
|
225
261
|
`applyFilter`, `inputMatch`, `intermediate`, `matchPath`, `pickFields`,
|
|
226
262
|
`requireSelf`, and the types they use.
|
|
227
263
|
|
|
264
|
+
`isCapabilityQuery(target)`, `isWildcardSegment(segment)` and
|
|
265
|
+
`refType(segment)` expose how the engine reads a target: a query with any
|
|
266
|
+
wildcard segment (`"*"` or `"post:*"`) is a capability query, and `refType`
|
|
267
|
+
returns the type of a `"type:id"` segment.
|
|
268
|
+
|
|
228
269
|
## Development
|
|
229
270
|
|
|
230
271
|
```bash
|
|
231
272
|
bun install
|
|
232
|
-
bun test #
|
|
273
|
+
bun test # 198 tests
|
|
233
274
|
bun run check # tsc
|
|
234
275
|
bun run lint # biome
|
|
235
276
|
bun run build # dist/ for npm
|
package/dist/mod.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export { defineRule, inputMatch, matchPath, requireSelf } from "./rules.ts";
|
|
|
18
18
|
export type { DefineRuleOpts } from "./rules.ts";
|
|
19
19
|
export { intermediate, permission } from "./permission.ts";
|
|
20
20
|
export type { IntermediateBuilder, IntermediateConfig, PermissionBuilder, PermissionConfig, } from "./permission.ts";
|
|
21
|
-
export { createSystem } from "./system.ts";
|
|
22
|
-
export type { CanContext, Provider, ProviderFn, ProviderObject, System, } from "./system.ts";
|
|
21
|
+
export { createSystem, isCapabilityQuery, isWildcardSegment, refType, } from "./system.ts";
|
|
22
|
+
export type { CanContext, PermissionErrorEvent, Provider, ProviderFetchEvent, ProviderFn, ProviderObject, System, SystemHooks, } from "./system.ts";
|
|
23
23
|
export { applyFilter, pickFields } from "./core/filtering.ts";
|
|
24
24
|
export type { FilterSpec } from "./core/merging.ts";
|
|
25
25
|
//# sourceMappingURL=mod.d.ts.map
|
package/dist/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,YAAY,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,Q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,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACd,QAAQ,GACT,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EACV,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,MAAM,EACN,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/mod.js
CHANGED
|
@@ -19,7 +19,7 @@ export { defineRule, inputMatch, matchPath, requireSelf } from "./rules.js";
|
|
|
19
19
|
// ─── Permission builders ─────────────────────────────────────────────────
|
|
20
20
|
export { intermediate, permission } from "./permission.js";
|
|
21
21
|
// ─── System ──────────────────────────────────────────────────────────────
|
|
22
|
-
export { createSystem } from "./system.js";
|
|
22
|
+
export { createSystem, isCapabilityQuery, isWildcardSegment, refType, } from "./system.js";
|
|
23
23
|
// ─── Field-projection helpers (used outside permission checks too) ───────
|
|
24
24
|
export { applyFilter, pickFields } from "./core/filtering.js";
|
|
25
25
|
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgC1C,4EAA4E;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,4EAA4E;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO1D,4EAA4E;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG5E,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ3D,4EAA4E;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgC1C,4EAA4E;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,4EAA4E;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO1D,4EAA4E;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG5E,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ3D,4EAA4E;AAC5E,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,GACR,MAAM,aAAa,CAAC;AAYrB,4EAA4E;AAC5E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/system.d.ts
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Moteur d'orchestration resource-pipe.
|
|
3
|
-
*
|
|
4
|
-
* Responsabilités :
|
|
5
|
-
* - Maintenir un cache `(resource.id, dedupKey) → Promise<T>` par context()
|
|
6
|
-
* - Filtrer les rules actives (activeWhen) avant de fetcher leurs needs
|
|
7
|
-
* - Lancer les fetches en parallèle (Promise.all) avec dedup
|
|
8
|
-
* - Évaluer les rules d'un grant en série (préserve l'ordre des reasons)
|
|
9
|
-
* - OR sémantique entre grants : un grant qui passe = `ok: true`
|
|
10
|
-
* - Validation d'arity du target au boot et au check
|
|
11
|
-
*
|
|
12
|
-
* Cf. RFC §"Sémantique d'exécution".
|
|
13
|
-
*/
|
|
14
1
|
import type { CanResult, Grant, IndirectResourceInfo, ListEntry, Permission, Resource, Subject, TreeNode } from "./types.ts";
|
|
15
2
|
import { type IndirectResource } from "./indirect-resource.ts";
|
|
16
3
|
export type ProviderFn = (subject: Subject, key: string, target?: readonly unknown[]) => readonly Grant[] | Promise<readonly Grant[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Provider sous forme objet : permet d'opt-in à la dedup de grants
|
|
19
|
-
* (cacheKey) et au filtrage par préfixe de key (keys/matches).
|
|
20
|
-
*
|
|
21
|
-
* - `keys`/`matches` : le provider est skip si la key demandée ne match pas
|
|
22
|
-
* - `cacheKey` : grants memoizés par (subject, key, target) au sein d'un context
|
|
23
|
-
*/
|
|
24
4
|
export type ProviderObject = {
|
|
5
|
+
readonly name?: string;
|
|
25
6
|
readonly keys?: readonly string[];
|
|
26
7
|
readonly matches?: (key: string) => boolean;
|
|
27
|
-
readonly
|
|
8
|
+
readonly targetType?: string | readonly string[];
|
|
9
|
+
readonly cacheKey?: (subject: Subject, key: string, target?: readonly unknown[]) => string | undefined;
|
|
28
10
|
readonly fetch: ProviderFn;
|
|
29
11
|
};
|
|
30
12
|
export type Provider = ProviderFn | ProviderObject;
|
|
13
|
+
export type ProviderFetchEvent = {
|
|
14
|
+
readonly provider: string;
|
|
15
|
+
readonly subject: Subject;
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly target: readonly unknown[] | undefined;
|
|
18
|
+
readonly durationMs: number;
|
|
19
|
+
readonly grantCount: number;
|
|
20
|
+
};
|
|
21
|
+
export type PermissionErrorEvent = {
|
|
22
|
+
readonly source: "provider";
|
|
23
|
+
readonly provider: string;
|
|
24
|
+
readonly subject: Subject;
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly target: readonly unknown[] | undefined;
|
|
27
|
+
readonly error: unknown;
|
|
28
|
+
} | {
|
|
29
|
+
readonly source: "rule";
|
|
30
|
+
readonly grantId: string | undefined;
|
|
31
|
+
readonly subject: Subject;
|
|
32
|
+
readonly key: string;
|
|
33
|
+
readonly target: readonly unknown[] | undefined;
|
|
34
|
+
readonly error: unknown;
|
|
35
|
+
};
|
|
36
|
+
export type SystemHooks = {
|
|
37
|
+
readonly onProviderFetch?: (event: ProviderFetchEvent) => void;
|
|
38
|
+
readonly onError?: (event: PermissionErrorEvent) => void;
|
|
39
|
+
};
|
|
40
|
+
export declare function refType(segment: unknown): string | undefined;
|
|
31
41
|
export type CanContext = {
|
|
32
42
|
readonly checkDate?: Date;
|
|
33
43
|
readonly checkIp?: string;
|
|
34
|
-
/**
|
|
35
|
-
readonly broadMatch?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Check-time payload exposed to rules as `ctx.input`. Distinct from
|
|
38
|
-
* `grant.payload` (static, seed-time). Consumed by `inputMatch()` to
|
|
39
|
-
* validate a CREATE body against `grant.with`.
|
|
40
|
-
*/
|
|
44
|
+
/** Check-time payload read by `inputMatch()`, as opposed to the grant's static `payload`. */
|
|
41
45
|
readonly input?: unknown;
|
|
42
46
|
};
|
|
43
47
|
export type System<TMeta = unknown> = {
|
|
@@ -46,68 +50,39 @@ export type System<TMeta = unknown> = {
|
|
|
46
50
|
readonly children: Readonly<Record<string, TreeNode<TMeta>>>;
|
|
47
51
|
};
|
|
48
52
|
schema(key: string): Permission<TMeta> | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Every distinct indirect resource referenced by the schema's rules,
|
|
51
|
-
* deduped by id. Returned in declaration-walk order (first-occurrence
|
|
52
|
-
* wins for dedup). Function fields are stripped — see
|
|
53
|
-
* `IndirectResourceInfo`. Empty if no permission uses `.match()` on an
|
|
54
|
-
* `indirectResource`.
|
|
55
|
-
*/
|
|
53
|
+
/** Deduplicated by id, in declaration order, without their functions. */
|
|
56
54
|
indirectResources(): readonly IndirectResourceInfo[];
|
|
57
|
-
/**
|
|
58
|
-
* Indirect resources referenced by a single permission's rules.
|
|
59
|
-
* `[]` if `key` is unknown or has no `indirect-match` rule. Useful so
|
|
60
|
-
* matrix UIs only render the indirect-match editor on permissions where
|
|
61
|
-
* it has a semantic.
|
|
62
|
-
*/
|
|
63
55
|
indirectsUsedBy(key: string): readonly IndirectResourceInfo[];
|
|
64
|
-
/**
|
|
56
|
+
/** Nothing is cached across calls; prefer `context()` for a request. */
|
|
65
57
|
can(subject: Subject, key: string, target?: readonly unknown[], context?: CanContext): Promise<CanResult>;
|
|
66
|
-
/**
|
|
67
|
-
* Crée un context request-scoped avec cache de fetches partagé entre
|
|
68
|
-
* tous les `can()` qui en découlent.
|
|
69
|
-
*/
|
|
58
|
+
/** Resources and provider grants are cached across every `can()` of the context. */
|
|
70
59
|
context(bound: {
|
|
71
60
|
readonly subject: Subject;
|
|
72
61
|
} & CanContext): {
|
|
73
|
-
/**
|
|
74
|
-
* `perCall` overrides the bound `CanContext` for this single check.
|
|
75
|
-
* Canonical use : passing `input` for a CREATE while keeping the
|
|
76
|
-
* shared (per-request) context. Other fields stay bound — override
|
|
77
|
-
* only when truly per-call.
|
|
78
|
-
*/
|
|
62
|
+
/** `perCall` overrides the bound context for this check only, typically `input` on a create. */
|
|
79
63
|
can(key: string, target?: readonly unknown[], perCall?: CanContext): Promise<CanResult>;
|
|
80
64
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* per-doc projection check doesn't hit the DB again.
|
|
85
|
-
*
|
|
86
|
-
* `dedupKey(doc)` MUST return the same target segments the resource's
|
|
87
|
-
* `dedupKey` would compute at fetch time — otherwise the cache key
|
|
88
|
-
* won't match and the preseed is silently ineffective. For most
|
|
89
|
-
* resources whose dedupKey is `target[i]`, just return `[doc._id]`
|
|
90
|
-
* (or the relevant segments).
|
|
91
|
-
*
|
|
92
|
-
* `value(doc)` is optional. Defaults to identity (the doc itself,
|
|
93
|
-
* used for direct resources). Provide it for indirect resources
|
|
94
|
-
* where the cached value is an array of joined docs nested under
|
|
95
|
-
* an alias (e.g. `d => d._memberships_of_participant`).
|
|
65
|
+
* `dedupKey(doc)` must return the segments the resource's own `dedupKey`
|
|
66
|
+
* computes at fetch time, or the seeded value is never found. `value(doc)`
|
|
67
|
+
* defaults to the doc; an indirect resource caches its joined docs instead.
|
|
96
68
|
*/
|
|
97
69
|
preseed<T, V = T>(resource: Resource<unknown> | IndirectResource | string, docs: ReadonlyArray<T>, opts: {
|
|
98
70
|
dedupKey: (doc: T) => readonly unknown[];
|
|
99
71
|
value?: (doc: T) => V;
|
|
100
72
|
}): void;
|
|
101
|
-
/** Compteurs de fetches par resource.id (debug / observabilité). */
|
|
102
73
|
getFetchCounters(): Readonly<Record<string, number>>;
|
|
103
|
-
/**
|
|
74
|
+
/** Resets the counters, never the cache. */
|
|
104
75
|
clearCounters(): void;
|
|
105
|
-
/**
|
|
76
|
+
/** Only the grants of cached providers already consulted in this context. */
|
|
106
77
|
dumpGrants(): Promise<readonly Grant[]>;
|
|
107
78
|
};
|
|
108
79
|
};
|
|
80
|
+
/** A query with any wildcard segment asks "could this subject, on some target"; rules that need a concrete document pass silently. */
|
|
81
|
+
export declare function isCapabilityQuery(target: readonly unknown[] | undefined): boolean;
|
|
82
|
+
export declare function isWildcardSegment(seg: unknown): boolean;
|
|
109
83
|
export declare function createSystem<TMeta = unknown>(opts: {
|
|
110
84
|
readonly schema: Readonly<Record<string, Permission<TMeta>>>;
|
|
111
85
|
readonly providers?: readonly Provider[];
|
|
86
|
+
readonly hooks?: SystemHooks;
|
|
112
87
|
}): System<TMeta>;
|
|
113
88
|
//# sourceMappingURL=system.d.ts.map
|
package/dist/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EAGT,KAAK,EACL,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,QAAQ,EAGR,OAAO,EACP,QAAQ,EACT,MAAM,YAAY,CAAC;AASpB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG,CACvB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,KACxB,SAAS,KAAK,EAAE,GAAG,OAAO,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,OAAO,EAAE,OAAO,EAChB,GAA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