@shivaedev/server 0.43.0 → 0.44.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/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/dist/HostModels.d.ts +9 -0
- package/dist/HostModels.d.ts.map +1 -0
- package/dist/HostModels.js +27 -0
- package/dist/HostModels.js.map +1 -0
- package/dist/appDatabase.d.ts +1 -2
- package/dist/appDatabase.d.ts.map +1 -1
- package/dist/appDatabase.js +6 -9
- package/dist/appDatabase.js.map +1 -1
- package/dist/appDatabaseHttp.d.ts +68 -68
- package/dist/appDatabaseHttp.d.ts.map +1 -1
- package/dist/appDatabaseHttp.js +4 -2
- package/dist/appDatabaseHttp.js.map +1 -1
- package/dist/appHost.d.ts +34 -34
- package/dist/appHost.d.ts.map +1 -1
- package/dist/appHost.js +2 -1
- package/dist/appHost.js.map +1 -1
- package/dist/appHostHttp.d.ts +178 -34
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js +6 -2
- package/dist/appHostHttp.js.map +1 -1
- package/dist/defaultChangesChannel.d.ts +4 -0
- package/dist/defaultChangesChannel.d.ts.map +1 -0
- package/dist/defaultChangesChannel.js +8 -0
- package/dist/defaultChangesChannel.js.map +1 -0
- package/dist/hostPreflight.d.ts +3 -2
- package/dist/hostPreflight.d.ts.map +1 -1
- package/dist/hostPreflight.js.map +1 -1
- package/dist/hostSensitiveKeys.d.ts +8 -10
- package/dist/hostSensitiveKeys.d.ts.map +1 -1
- package/dist/hostSensitiveKeys.js +25 -18
- package/dist/hostSensitiveKeys.js.map +1 -1
- package/dist/nativeClientOrigins.d.ts.map +1 -1
- package/dist/nativeClientOrigins.js +3 -1
- package/dist/nativeClientOrigins.js.map +1 -1
- package/dist/redactedHost.d.ts +1 -1
- package/dist/redactedHost.d.ts.map +1 -1
- package/dist/redactedHost.js +3 -14
- package/dist/redactedHost.js.map +1 -1
- package/dist/workerHost.d.ts +1 -1
- package/dist/workerHost.d.ts.map +1 -1
- package/dist/workerHost.js +2 -1
- package/dist/workerHost.js.map +1 -1
- package/package.json +6 -6
- package/src/HostModels.ts +30 -0
- package/src/appDatabase.ts +6 -10
- package/src/appDatabaseHttp.ts +8 -2
- package/src/appHost.ts +6 -1
- package/src/appHostHttp.ts +55 -30
- package/src/defaultChangesChannel.ts +8 -0
- package/src/hostPreflight.ts +4 -3
- package/src/hostSensitiveKeys.ts +37 -22
- package/src/nativeClientOrigins.ts +4 -1
- package/src/redactedHost.ts +2 -18
- package/src/workerHost.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.44.1 - 2026-11-21
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- In the deferred `application` form, the spans of the database and of the `application` Effect, such as migrations, pool start-up and fibers they fork, are now exported through the host's OTLP pipeline, or recorded in the local trace store, as a host built from modules already did, so operators see spans they did not see before.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- A host with a deferred `application` Effect runs that Effect and its database inside the host's redaction policy. Logs written while it runs, by a fiber it forks or through a context a service captured there are now masked with the built-in credential-shaped name rules and the fields that the models of its repositories mark sensitive, as a served operation's logs are. Before, those lines went to the installed loggers in clear.
|
|
12
|
+
|
|
13
|
+
## 0.44.0 - 2026-11-21
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- A host built with a deferred `application` Effect that builds its services itself with `Layer.build`, as the starter and every generated app do, now collects the models of those repositories: an operation it serves finds their owned models through `(yield* RepositoryModels).owned`, so identity's account export, erase and coverage check see them, and the fields those models mark sensitive or server-only are now masked in the host's logs, including logged defects, and its exported traces. From server 0.36.0 until this release, such a host left those fields unmasked, so logs and traces it wrote in that time hold their values in clear.
|
|
18
|
+
- CORS on the auth routes allows the `x-platform-account-timezone` and `x-platform-account-locale` headers next to `Authorization` and `Content-Type`, so a bundled native shell with the preferences plugin installed passes the preflight and signs in; a declared sibling browser origin's preflight allows them too. The RPC path still allows only `Authorization` and `Content-Type`.
|
|
19
|
+
|
|
20
|
+
### Breaking
|
|
21
|
+
|
|
22
|
+
- Code that composes the host below `appHost` must provide the host's model collector: `hostSensitiveKeys`, `redactedHost`, `appHostHttp`, `migratedHost` and `deferredHost` now require `HostModels` from `@shivaedev/server/HostModels.ts`. Provide `hostModels()` from the same module once around everything the host builds, including a deferred `application` Effect, for example `host.pipe(Layer.provide(hostModels()))`. `hostPreflight` takes a fifth type parameter for the requirements of its policy Effect, so a call that passes its type arguments explicitly adds that one. `appHost` and `workerHost` provide the collector themselves, so their users change nothing.
|
|
23
|
+
|
|
3
24
|
## 0.43.0 - 2026-11-21
|
|
4
25
|
|
|
5
26
|
### Added
|
package/README.md
CHANGED
|
@@ -286,7 +286,7 @@ Supply `preflight: AppConfigLive` to `appHost` to build a native Layer before ch
|
|
|
286
286
|
|
|
287
287
|
Preflight logs pass through the host's redaction, including logged failure causes and annotations. The original typed failure remains available to callers. Direct hosts derive the policy from their RPC schemas and `config.sensitiveKeys`; deferred hosts use the default credential policy during preflight, before their application's schemas are available. Ordinary startup messages and annotations remain intact.
|
|
288
288
|
|
|
289
|
-
When construction itself touches the schema, use `appHost({ migrations, config, postgresSettings, application })`. `application` is a native Effect that returns the HTTP host options (`group`, handler and service Layers, session policy, and optional HTTP config). The host first builds `appDatabase`, then evaluates this Effect in the host scope with SQL, Reactivity
|
|
289
|
+
When construction itself touches the schema, use `appHost({ migrations, config, postgresSettings, application })`. `application` is a native Effect that returns the HTTP host options (`group`, handler and service Layers, session policy, and optional HTTP config). The host first builds `appDatabase`, then evaluates this Effect in the host scope with SQL, Reactivity, `LiveServer` from `@shivaedev/contract/live-server/service.ts` and the host's repository model collector available, so services the Effect builds itself with `Layer.build`, as the starter does, report their owned models and sensitive fields to the host that serves and masks them. The Effect and its database run inside the host's redaction policy, so the logs it writes are masked, and so are the logs of a fiber it forks or of a service that keeps the context it captured there, for the life of the process. Until it returns, the policy holds the built-in credential-shaped name rules and the field names of the models its repositories have declared so far; the RPC group's schema names and `config.sensitiveKeys` from the options it returns apply from then on. A failed migration or schema-current check prevents construction. Initialization requirements and errors stay in the returned Layer's types, and acquired resources close with the host scope.
|
|
290
290
|
|
|
291
291
|
```ts
|
|
292
292
|
const host = appHost({
|
|
@@ -414,7 +414,7 @@ Render inside the application's native registry provider. The query's `data` is
|
|
|
414
414
|
|
|
415
415
|
Tracing logs declared failures with `RPC failure` and their tag, and defects with `RPC defect`. Interrupt-only causes emit `RPC interrupted` at debug instead, with `rpc.method`, `requestId`, the `rpc.duration` log span and the same redacted payload. The RPC trace span carries `rpc.interrupted: true`; Effect exports interruption with an unset span status. Completed and failed RPCs receive no interruption marker. The diagnostic payload masks nested credential-shaped keys and Effect `Redacted` values. Credential-shaped strings, such as bearer tokens, URL passwords and sensitive `key=value` text, are masked too. Strings retain at most 2,048 characters before a truncation marker; collections retain at most 50 entries with a marker for the remainder, and binary values become size summaries.
|
|
416
416
|
|
|
417
|
-
`appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository the host
|
|
417
|
+
`appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository built while the host starts, through `makeRepository` or `makeOrderedChildren`, declares its model to that host, including one that a deferred `application` Effect builds itself with `Layer.build`, and the names of the model's sensitive fields apply to every RPC and every diagnostic like `config.sensitiveKeys`, before the host serves its first request. A repository made inside a handler declares its model only when it runs, after the RPC failure masks are compiled; build repositories in Layers. The host also collects each model whose field is marked with `owner` from `@shivaedev/sql/owner.ts`, through sql's `collectRepositoryModels`, from the same repositories, and an operation it serves reads them with their tables and owner columns through `(yield* RepositoryModels).owned`. Values no repository model describes, such as computed or third-party data, are covered only by the built-in name rules and `config.sensitiveKeys`. Application-wide keys configured below apply to every RPC. Add other exact, case-sensitive names once in `config.sensitiveKeys`:
|
|
418
418
|
|
|
419
419
|
```ts
|
|
420
420
|
import { Schema } from "effect";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
2
|
+
declare const HostModels_base: Context.ServiceClass<HostModels, "@shivaedev/server/HostModels", {
|
|
3
|
+
readonly fieldNames: ReadonlySet<string>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare class HostModels extends HostModels_base {
|
|
6
|
+
}
|
|
7
|
+
export declare function hostModels(): Layer.Layer<HostModels, never, never>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=HostModels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostModels.d.ts","sourceRoot":"","sources":["../src/HostModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;;yBAK2B,WAAW,CAAC,MAAM,CAAC;;AAAtG,qBAAa,UAAW,SAAQ,eAA2G;CAAG;AAY9I,wBAAgB,UAAU,0CAYzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
import { schemaFieldKeys } from "@shivaedev/errors/schemaFieldScope.ts";
|
|
3
|
+
import { collectRepositoryModels, RepositoryModels } from "@shivaedev/sql/RepositoryModels.ts";
|
|
4
|
+
// The field names of every model the host's repositories declare, which its redaction policy masks.
|
|
5
|
+
export class HostModels extends Context.Service()("@shivaedev/server/HostModels") {
|
|
6
|
+
}
|
|
7
|
+
function recordFields(fieldNames, { model }) {
|
|
8
|
+
return Effect.sync(() => {
|
|
9
|
+
for (const key of schemaFieldKeys(Schema.Struct(model.fields).ast, [])) {
|
|
10
|
+
fieldNames.add(key);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
// Each host provides its own collector around everything it builds, including a deferred application Effect, so a
|
|
15
|
+
// repository built there reports its owned models and sensitive fields to the same host that serves and masks them.
|
|
16
|
+
export function hostModels() {
|
|
17
|
+
return Layer.effectContext(Effect.gen(function* () {
|
|
18
|
+
const collected = yield* RepositoryModels;
|
|
19
|
+
const fieldNames = new Set();
|
|
20
|
+
const models = RepositoryModels.of({
|
|
21
|
+
declare: (declared) => Effect.andThen(recordFields(fieldNames, declared), collected.declare(declared)),
|
|
22
|
+
owned: collected.owned,
|
|
23
|
+
});
|
|
24
|
+
return Context.make(HostModels, { fieldNames }).pipe(Context.add(RepositoryModels, models));
|
|
25
|
+
})).pipe(Layer.provide(Layer.fresh(collectRepositoryModels)));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=HostModels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostModels.js","sourceRoot":"","sources":["../src/HostModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAwB,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAErH,oGAAoG;AACpG,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAA4D,CAAC,8BAA8B,CAAC;CAAG;AAE9I,SAAS,YAAY,CAAC,UAAuB,EAAE,EAAE,KAAK,EAAmB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACvB,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;YACxE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kHAAkH;AAClH,oHAAoH;AACpH,MAAM,UAAU,UAAU;IACzB,OAAO,KAAK,CAAC,aAAa,CACzB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;QACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACtG,KAAK,EAAE,SAAS,CAAC,KAAK;SACtB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/appDatabase.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as PgClient from "@effect/sql-pg/PgClient";
|
|
2
2
|
import { Clock, Config, Layer, Redacted } from "effect";
|
|
3
|
-
import { Digest } from "effect/crypto";
|
|
4
3
|
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
5
4
|
import { type PostgresChangesOptions } from "@shivaedev/sql/postgresChanges.ts";
|
|
6
5
|
import { type PostgresOptions } from "@shivaedev/sql/postgresLayer.ts";
|
|
@@ -18,6 +17,6 @@ export interface DatabaseConfig extends PostgresOptions {
|
|
|
18
17
|
readonly databaseUrl?: Redacted.Redacted<string>;
|
|
19
18
|
readonly listenDatabaseUrl?: Redacted.Redacted<string>;
|
|
20
19
|
}
|
|
21
|
-
export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Digest.Digest | Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
20
|
+
export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, import("effect/crypto/Digest").Digest | Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
22
21
|
export declare const appHost: AppHostFactory;
|
|
23
22
|
//# sourceMappingURL=appDatabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,8oBAqD1E;AAED,eAAO,MAAM,OAAO,EAAE,cAoDrB,CAAC"}
|
package/dist/appDatabase.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as PgClient from "@effect/sql-pg/PgClient";
|
|
2
2
|
import { Clock, Config, Context, Effect, Layer, Option, Redacted } from "effect";
|
|
3
|
-
import { Digest } from "effect/crypto";
|
|
4
3
|
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
5
4
|
import { liveServerLayer } from "@shivaedev/contract/live-server/layer.ts";
|
|
6
5
|
import { LiveServer } from "@shivaedev/contract/live-server/service.ts";
|
|
@@ -12,6 +11,8 @@ import { applyPostgresSettings } from "@shivaedev/sql/postgresSettings.ts";
|
|
|
12
11
|
import { WorkerRelease } from "@shivaedev/sql/worker-release/service.ts";
|
|
13
12
|
import { deferredHost, migratedHost } from "#appDatabaseHttp.ts";
|
|
14
13
|
import { appHostHttp } from "#appHostHttp.ts";
|
|
14
|
+
import { defaultChangesChannel } from "#defaultChangesChannel.ts";
|
|
15
|
+
import { hostModels } from "#HostModels.ts";
|
|
15
16
|
import { hostCrypto } from "#hostCrypto.ts";
|
|
16
17
|
import { hostPreflight } from "#hostPreflight.ts";
|
|
17
18
|
import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
|
|
@@ -59,18 +60,14 @@ export function appDatabase(options) {
|
|
|
59
60
|
const prepared = Layer.effectDiscard(prepareMigrations(migrations)).pipe(Layer.provideMerge(connected));
|
|
60
61
|
return worker.pipe(Layer.provideMerge(prepared));
|
|
61
62
|
}
|
|
62
|
-
const defaultChangesChannel = Effect.fnUntraced(function* (name) {
|
|
63
|
-
const digest = yield* Digest.Digest;
|
|
64
|
-
const hash = yield* digest.digestHex(Digest.sha256, new TextEncoder().encode(name));
|
|
65
|
-
return `changes_${hash.slice(0, 32)}`;
|
|
66
|
-
});
|
|
67
63
|
export const appHost = (options) => {
|
|
68
64
|
const preflight = hostPreflight(options.preflight, "application" in options ? Effect.succeed(isSensitiveKey) : hostSensitiveKeys(options));
|
|
65
|
+
const hosted = Layer.merge(hostCrypto, hostModels());
|
|
69
66
|
if ("application" in options) {
|
|
70
|
-
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(
|
|
67
|
+
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
71
68
|
}
|
|
72
69
|
return options.migrations === undefined
|
|
73
|
-
? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(
|
|
74
|
-
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(
|
|
70
|
+
? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted))
|
|
71
|
+
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
75
72
|
};
|
|
76
73
|
//# sourceMappingURL=appDatabase.js.map
|
package/dist/appDatabase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,E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