@de-otio/trellis 0.10.0 → 0.10.2
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/lambda/delete-account-worker.d.ts.map +1 -1
- package/dist/lambda/delete-account-worker.js +1 -16
- package/dist/lambda/delete-account-worker.js.map +1 -1
- package/dist/lambda/hourly-cron.d.ts.map +1 -1
- package/dist/lambda/hourly-cron.js +1 -17
- package/dist/lambda/hourly-cron.js.map +1 -1
- package/dist/lambda/maintenance-cron.d.ts.map +1 -1
- package/dist/lambda/maintenance-cron.js +1 -16
- package/dist/lambda/maintenance-cron.js.map +1 -1
- package/dist/lambda/media-processing-worker.js +1 -1
- package/dist/lambda/media-processing-worker.js.map +1 -1
- package/dist/lambda/nightly-cron.d.ts.map +1 -1
- package/dist/lambda/nightly-cron.js +2 -18
- package/dist/lambda/nightly-cron.js.map +1 -1
- package/dist/lambda/post-confirmation.d.ts.map +1 -1
- package/dist/lambda/post-confirmation.js +9 -17
- package/dist/lambda/post-confirmation.js.map +1 -1
- package/dist/lambda/pre-token-generation.d.ts.map +1 -1
- package/dist/lambda/pre-token-generation.js +6 -17
- package/dist/lambda/pre-token-generation.js.map +1 -1
- package/dist/lib/compliance/baseline.d.ts.map +1 -1
- package/dist/lib/compliance/baseline.js +1 -9
- package/dist/lib/compliance/baseline.js.map +1 -1
- package/dist/lib/graph/graph-service.d.ts +7 -12
- package/dist/lib/graph/graph-service.d.ts.map +1 -1
- package/dist/lib/graph/graph-service.js +6 -11
- package/dist/lib/graph/graph-service.js.map +1 -1
- package/dist/lib/graph/scoring-engine.d.ts +0 -3
- package/dist/lib/graph/scoring-engine.d.ts.map +1 -1
- package/dist/lib/graph/scoring-engine.js +0 -3
- package/dist/lib/graph/scoring-engine.js.map +1 -1
- package/dist/lib/lambda-prisma.d.ts +16 -0
- package/dist/lib/lambda-prisma.d.ts.map +1 -0
- package/dist/lib/lambda-prisma.js +29 -0
- package/dist/lib/lambda-prisma.js.map +1 -0
- package/dist/lib/services/media-upload-service.js +2 -2
- package/dist/lib/services/media-upload-service.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +10 -11
- package/src/lambda/delete-account-worker.ts +1 -16
- package/src/lambda/hourly-cron.ts +1 -28
- package/src/lambda/maintenance-cron.ts +1 -21
- package/src/lambda/media-processing-worker.ts +1 -1
- package/src/lambda/nightly-cron.ts +2 -24
- package/src/lambda/post-confirmation.ts +8 -25
- package/src/lambda/pre-token-generation.ts +6 -25
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GraphService Interface
|
|
3
3
|
*
|
|
4
|
-
* The abstraction layer between API handlers and the graph
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* exposes high-level operations — implementations translate them to
|
|
11
|
-
* Cypher queries internally.
|
|
4
|
+
* The abstraction layer between API handlers and the social graph.
|
|
5
|
+
* The only shipped implementation is PostgresGraphService, which serves the
|
|
6
|
+
* graph from relational edge tables in the same PostgreSQL database using SQL
|
|
7
|
+
* joins and recursive CTEs. (An earlier dedicated graph backend was removed;
|
|
8
|
+
* GRAPH_BACKEND=neo4j now throws "no longer supported". The interface is kept
|
|
9
|
+
* so a dedicated backend could be reintroduced behind it.)
|
|
12
10
|
*
|
|
13
11
|
* Handlers never execute raw graph queries. They call GraphService methods
|
|
14
12
|
* that return IDs, which are then used to fetch content from Postgres via Prisma.
|
|
15
|
-
*
|
|
16
|
-
* @see /analysis/redesign/07-graph-database/02-hybrid-architecture.md
|
|
17
|
-
* @see /analysis/redesign/07-graph-database/04-graph-schema.md
|
|
18
13
|
*/
|
|
19
14
|
import type { CircleEntityStatus, CircleMember, CircleTier, CircleTierStatus, CreateEntityRelationshipInput, CreateRelationshipInput, DiscoveryFilters, DiscoveryResult, EntityRelationship, EntityRelationshipStatus, GlanceItem, GraphConnectionConfig, GraphData, GraphHealthStatus, GraphNodeType, NearbyFilters, PaginatedResult, PaginationInput, Recommendation, RecordInteractionInput, Relationship, ScoreUpdate, SyncEntityInput, SyncOwnershipInput, SyncPostInput, SyncPostSubjectsInput, SyncUserInput, UpdateRelationshipScoreInput, VisiblePostResult } from "./types.js";
|
|
20
15
|
/**
|
|
@@ -51,7 +46,7 @@ export interface GraphConnection {
|
|
|
51
46
|
* All methods throw GraphError subclasses on failure.
|
|
52
47
|
*
|
|
53
48
|
* Handlers consume this interface — they never know which backend
|
|
54
|
-
* (
|
|
49
|
+
* implementation (currently Postgres) is being used.
|
|
55
50
|
*/
|
|
56
51
|
export interface GraphService {
|
|
57
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-service.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/graph-service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"graph-service.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/graph-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,UAAU,EACV,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAMpB;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,C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AM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAMnD;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;;;;;OAOG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;;;;;OAQG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;;;;;OAOG;IACH,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;;;;OASG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GraphService Interface
|
|
3
3
|
*
|
|
4
|
-
* The abstraction layer between API handlers and the graph
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* exposes high-level operations — implementations translate them to
|
|
11
|
-
* Cypher queries internally.
|
|
4
|
+
* The abstraction layer between API handlers and the social graph.
|
|
5
|
+
* The only shipped implementation is PostgresGraphService, which serves the
|
|
6
|
+
* graph from relational edge tables in the same PostgreSQL database using SQL
|
|
7
|
+
* joins and recursive CTEs. (An earlier dedicated graph backend was removed;
|
|
8
|
+
* GRAPH_BACKEND=neo4j now throws "no longer supported". The interface is kept
|
|
9
|
+
* so a dedicated backend could be reintroduced behind it.)
|
|
12
10
|
*
|
|
13
11
|
* Handlers never execute raw graph queries. They call GraphService methods
|
|
14
12
|
* that return IDs, which are then used to fetch content from Postgres via Prisma.
|
|
15
|
-
*
|
|
16
|
-
* @see /analysis/redesign/07-graph-database/02-hybrid-architecture.md
|
|
17
|
-
* @see /analysis/redesign/07-graph-database/04-graph-schema.md
|
|
18
13
|
*/
|
|
19
14
|
export {};
|
|
20
15
|
//# sourceMappingURL=graph-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-service.js","sourceRoot":"","sources":["../../../src/lib/graph/graph-service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"graph-service.js","sourceRoot":"","sources":["../../../src/lib/graph/graph-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
* w_frequency=0.25, w_owner=0.15, w_creation=0.10, w_connection=0.10,
|
|
12
12
|
* w_decay=0.05). Owned entities auto-pin at 1.0.
|
|
13
13
|
*
|
|
14
|
-
* @see /analysis/redesign/06-entities-over-people/09-scoring-without-reciprocity.md
|
|
15
|
-
* @see /analysis/redesign/02-new-core-primitives.md
|
|
16
|
-
*
|
|
17
14
|
* CODEBOOK: Every constant in this file (weights, decay half-lives, engagement
|
|
18
15
|
* scores, connection bonuses, tier thresholds) is documented with rationale in
|
|
19
16
|
* the sibling file SCORING-CODEBOOK.md. The codebook and this file are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring-engine.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/scoring-engine.ts"],"names":[],"mappings":"AAAA
|
|
1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,MAAM,CAIvE"}
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
* w_frequency=0.25, w_owner=0.15, w_creation=0.10, w_connection=0.10,
|
|
12
12
|
* w_decay=0.05). Owned entities auto-pin at 1.0.
|
|
13
13
|
*
|
|
14
|
-
* @see /analysis/redesign/06-entities-over-people/09-scoring-without-reciprocity.md
|
|
15
|
-
* @see /analysis/redesign/02-new-core-primitives.md
|
|
16
|
-
*
|
|
17
14
|
* CODEBOOK: Every constant in this file (weights, decay half-lives, engagement
|
|
18
15
|
* scores, connection bonuses, tier thresholds) is documented with rationale in
|
|
19
16
|
* the sibling file SCORING-CODEBOOK.md. The codebook and this file are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring-engine.js","sourceRoot":"","sources":["../../../src/lib/graph/scoring-engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scoring-engine.js","sourceRoot":"","sources":["../../../src/lib/graph/scoring-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAUH,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,CAAC,EAAE,yBAAyB;IACxC,cAAc,EAAE,CAAC,EAAE,yBAAyB;IAC5C,eAAe,EAAE,CAAC,EAAE,yBAAyB;IAC7C,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,IAAI;IACrB,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,CAAC,EAAE,8BAA8B;CAC/C,CAAC;AAEF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,CAAC;IAEF,MAAM,GAAG,GACP,CAAC,CAAC,UAAU,GAAG,eAAe;QAC9B,CAAC,CAAC,SAAS,GAAG,eAAe;QAC7B,CAAC,CAAC,cAAc,GAAG,SAAS;QAC5B,CAAC,CAAC,eAAe,GAAG,cAAc;QAClC,CAAC,CAAC,UAAU,GAAG,SAAS;QACxB,CAAC,CAAC,KAAK,GAAG,YAAY,CAAC;IAEzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,8BAA8B;AAC9B,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PrismaClient } from "@prisma/client";
|
|
2
|
+
/**
|
|
3
|
+
* Build (and cache) a PrismaClient for standalone Lambda handlers.
|
|
4
|
+
*
|
|
5
|
+
* RDS enforces `force_ssl`, so the connection MUST negotiate TLS — otherwise
|
|
6
|
+
* Postgres rejects it with `28000 / no pg_hba.conf entry … no encryption`
|
|
7
|
+
* (surfaced by Prisma as P1010). The request-path client gets this via
|
|
8
|
+
* `DatabaseConnectionManager` (`ssl: { rejectUnauthorized: false }`); Lambda
|
|
9
|
+
* handlers must do the same. Prisma 7 supplies the connection through a pg
|
|
10
|
+
* driver adapter (the old `datasources` constructor option is gone), so the
|
|
11
|
+
* `ssl` option goes on the adapter's pool config.
|
|
12
|
+
*
|
|
13
|
+
* Cached at module scope so warm invocations reuse the client.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getLambdaPrisma(): Promise<PrismaClient>;
|
|
16
|
+
//# sourceMappingURL=lambda-prisma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda-prisma.d.ts","sourceRoot":"","sources":["../../src/lib/lambda-prisma.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAY9C;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAY7D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getSecret } from "@aws-lambda-powertools/parameters/secrets";
|
|
2
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
3
|
+
import { PrismaClient } from "@prisma/client";
|
|
4
|
+
let prisma = null;
|
|
5
|
+
/**
|
|
6
|
+
* Build (and cache) a PrismaClient for standalone Lambda handlers.
|
|
7
|
+
*
|
|
8
|
+
* RDS enforces `force_ssl`, so the connection MUST negotiate TLS — otherwise
|
|
9
|
+
* Postgres rejects it with `28000 / no pg_hba.conf entry … no encryption`
|
|
10
|
+
* (surfaced by Prisma as P1010). The request-path client gets this via
|
|
11
|
+
* `DatabaseConnectionManager` (`ssl: { rejectUnauthorized: false }`); Lambda
|
|
12
|
+
* handlers must do the same. Prisma 7 supplies the connection through a pg
|
|
13
|
+
* driver adapter (the old `datasources` constructor option is gone), so the
|
|
14
|
+
* `ssl` option goes on the adapter's pool config.
|
|
15
|
+
*
|
|
16
|
+
* Cached at module scope so warm invocations reuse the client.
|
|
17
|
+
*/
|
|
18
|
+
export async function getLambdaPrisma() {
|
|
19
|
+
if (prisma)
|
|
20
|
+
return prisma;
|
|
21
|
+
const { username, password, host, port, dbname } = (await getSecret(process.env.DB_SECRET_ARN, { transform: "json" }));
|
|
22
|
+
const adapter = new PrismaPg({
|
|
23
|
+
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
24
|
+
ssl: { rejectUnauthorized: false },
|
|
25
|
+
});
|
|
26
|
+
prisma = new PrismaClient({ adapter });
|
|
27
|
+
return prisma;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=lambda-prisma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda-prisma.js","sourceRoot":"","sources":["../../src/lib/lambda-prisma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,IAAI,MAAM,GAAwB,IAAI,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,SAAS,CACjE,OAAO,CAAC,GAAG,CAAC,aAAc,EAC1B,EAAE,SAAS,EAAE,MAAM,EAAE,CACtB,CAAwB,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC;QAC3B,gBAAgB,EAAE,gBAAgB,QAAQ,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,qBAAqB;QACzH,GAAG,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE;KACnC,CAAC,CAAC;IACH,MAAM,GAAG,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -67,7 +67,7 @@ export class MediaUploadService {
|
|
|
67
67
|
const fileBuffer = preReadBuffer ?? await file.arrayBuffer();
|
|
68
68
|
const contentHash = await generateContentHash(fileBuffer);
|
|
69
69
|
const ext = getExtensionFromMimeType(file.type);
|
|
70
|
-
const originalKey = `
|
|
70
|
+
const originalKey = `originals/user-${userId}/${contentHash}.${ext}`;
|
|
71
71
|
logger.info("[MediaUpload] Starting upload", {
|
|
72
72
|
contentHash,
|
|
73
73
|
mimeType: file.type,
|
|
@@ -155,7 +155,7 @@ export class MediaUploadService {
|
|
|
155
155
|
const fileBuffer = await file.arrayBuffer();
|
|
156
156
|
const contentHash = await generateContentHash(fileBuffer);
|
|
157
157
|
const ext = getExtensionFromMimeType(file.type);
|
|
158
|
-
const originalKey = `
|
|
158
|
+
const originalKey = `originals/user-${userId}/${contentHash}.${ext}`;
|
|
159
159
|
const metadata = metadataArray?.[index];
|
|
160
160
|
const r2Metadata = {
|
|
161
161
|
contentHash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-upload-service.js","sourceRoot":"","sources":["../../../src/lib/services/media-upload-service.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAU,MAAM,cAAc,CAAC;AAOjD;;GAEG;AACH,SAAS,eAAe;IACtB,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,IAAiB;IAClD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAAC,QAAgB;IAChD,MAAM,OAAO,GAA2B;QACtC,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,MAAM;QACpB,YAAY,EAAE,MAAM;QACpB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,MAAM;QACpB,iBAAiB,EAAE,KAAK;KACzB,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;AACpC,CAAC;AAED,MAAM,OAAO,kBAAkB;IACrB,QAAQ,CAAW;IACnB,KAAK,CAAoC;IACzC,SAAS,CAAS;IAClB,GAAG,CAAM;IAEjB,YAAY,GAAQ;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,eAAe,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,0BAA0B,CAAC;QAC5C,IAAI,CAAC,SAAS;YACZ,GAAG,CAAC,WAAW,KAAK,MAAM;gBACxB,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,qBAAqB,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAChB,IAAU,EACV,MAAc,EACd,QAAiE,EACjE,aAA2B;QAE3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAElC,IAAI,CAAC;YACH,2BAA2B;YAC3B,yEAAyE;YACzE,wEAAwE;YACxE,MAAM,UAAU,GAAG,aAAa,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7D,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC1D,MAAM,GAAG,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChD,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"media-upload-service.js","sourceRoot":"","sources":["../../../src/lib/services/media-upload-service.ts"],"names":[],"mappings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AAW,EAAE;oBAC9D,MAAM,EAAE,UAAmB;iBAC5B,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,EAAE;oBACf,GAAG,EAAE,EAAE;oBACP,MAAM,EAAE,UAAmB;oBAC3B,OAAO,EAAE,kBAAkB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;iBACnD,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -43,7 +43,7 @@ model Entity {
|
|
|
43
43
|
|
|
44
44
|
// Co-ownership (replaces single ownerId)
|
|
45
45
|
owners EntityOwnership[]
|
|
46
|
-
// Relationships and follower counts live in the graph
|
|
46
|
+
// Relationships and follower counts live in the graph edge tables (served via graph-service.ts), not on this model
|
|
47
47
|
|
|
48
48
|
subjectPosts PostSubject[]
|
|
49
49
|
primaryPosts Post[] @relation("PrimaryEntityPosts")
|
|
@@ -93,10 +93,9 @@ model PostGeoIndex {
|
|
|
93
93
|
@@map("post_geo_index")
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/// Entity geo-location for proximity discovery (C7).
|
|
97
|
-
///
|
|
98
|
-
///
|
|
99
|
-
/// dual-write (syncEntity). Location is sensitive → own tenant_id for direct RLS
|
|
96
|
+
/// Entity geo-location for proximity discovery (C7). Geo-proximity is queried
|
|
97
|
+
/// with PostGIS (ST_DWithin / KNN over a GiST index) via $queryRaw. Populated from
|
|
98
|
+
/// syncEntity. Location is sensitive → own tenant_id for direct RLS
|
|
100
99
|
/// (mirrors post_geo_index). See plans/redesign/entity-location-subsystem.md.
|
|
101
100
|
model EntityLocation {
|
|
102
101
|
entityId String @id @map("entity_id")
|
|
@@ -276,7 +275,7 @@ model User {
|
|
|
276
275
|
ownedEntities EntityOwnership[] @relation("EntityOwners")
|
|
277
276
|
addedOwnerships EntityOwnership[] @relation("OwnershipAddedBy")
|
|
278
277
|
|
|
279
|
-
// Relationships and follower counts live in the graph
|
|
278
|
+
// Relationships and follower counts live in the graph edge tables (served via graph-service.ts), not on this model
|
|
280
279
|
|
|
281
280
|
// Direct messages
|
|
282
281
|
sentMessages DirectMessage[] @relation("SentMessages")
|
|
@@ -1133,8 +1132,8 @@ model ProductTaxonomyTag {
|
|
|
1133
1132
|
}
|
|
1134
1133
|
|
|
1135
1134
|
// ============================================================================
|
|
1136
|
-
// Relationships (scored edges
|
|
1137
|
-
// Follow and Friendship models removed — replaced by
|
|
1135
|
+
// Relationships (scored edges; served via graph-service.ts over these tables)
|
|
1136
|
+
// Follow and Friendship models removed — replaced by the relationship edge tables below
|
|
1138
1137
|
// ============================================================================
|
|
1139
1138
|
|
|
1140
1139
|
// ============================================================================
|
|
@@ -1666,7 +1665,7 @@ model NotificationPreference {
|
|
|
1666
1665
|
}
|
|
1667
1666
|
|
|
1668
1667
|
// Out-of-band invite codes — users share codes privately; redemption establishes
|
|
1669
|
-
// a relationship
|
|
1668
|
+
// a relationship edge. Entity-scoped codes can be created by entity owners.
|
|
1670
1669
|
model ConnectionCode {
|
|
1671
1670
|
id String @id @default(cuid())
|
|
1672
1671
|
// Multi-tenancy (v0.7) — code's owning tenant (creator's active tenant at create time).
|
|
@@ -1934,8 +1933,8 @@ model TenantInvitation {
|
|
|
1934
1933
|
// Graph edges in Postgres (graph-db revisit 2026-06: see
|
|
1935
1934
|
// plans/redesign/graph-backend-contract.md)
|
|
1936
1935
|
//
|
|
1937
|
-
// These two tables hold the edges
|
|
1938
|
-
//
|
|
1936
|
+
// These two tables hold the relationship edges (user↔user and typed
|
|
1937
|
+
// entity-to-entity). OWNS (entity_ownerships) and
|
|
1939
1938
|
// ABOUT (post_subjects) already existed in Postgres. Modeled as standalone
|
|
1940
1939
|
// tables (no Prisma @relation) so the migration is self-contained and
|
|
1941
1940
|
// non-breaking; targetId is polymorphic (user|entity) so it cannot carry a
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { SQSHandler } from "aws-lambda";
|
|
2
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
3
2
|
import { PrismaClient } from "@prisma/client";
|
|
4
3
|
import { S3Client, DeleteObjectsCommand, ListObjectsV2Command } from "@aws-sdk/client-s3";
|
|
5
4
|
import { CognitoIdentityProviderClient, AdminDeleteUserCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
6
5
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
7
|
-
import {
|
|
6
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
8
7
|
|
|
9
8
|
const logger = new Logger({ serviceName: "delete-account-worker" });
|
|
10
9
|
|
|
@@ -12,20 +11,6 @@ const s3 = new S3Client({ region: process.env.AWS_REGION });
|
|
|
12
11
|
|
|
13
12
|
const MAX_PAGES = 100;
|
|
14
13
|
|
|
15
|
-
let prisma: PrismaClient | null = null;
|
|
16
|
-
|
|
17
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
18
|
-
if (prisma) return prisma;
|
|
19
|
-
const { username, password, host, port, dbname } = (await getSecret(process.env.DB_SECRET_ARN!, { transform: "json" })) as unknown as { username: string; password: string; host: string; port: string | number; dbname: string };
|
|
20
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
21
|
-
// is now supplied via a driver adapter.
|
|
22
|
-
const adapter = new PrismaPg({
|
|
23
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
24
|
-
});
|
|
25
|
-
prisma = new PrismaClient({ adapter });
|
|
26
|
-
return prisma;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
14
|
async function deleteUserMedia(userId: string, mediaBucket: string): Promise<void> {
|
|
30
15
|
const prefix = `originals/user-${userId}/`;
|
|
31
16
|
let continuationToken: string | undefined;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
2
2
|
import { Metrics, MetricUnit } from "@aws-lambda-powertools/metrics";
|
|
3
|
-
import { getSecret } from "@aws-lambda-powertools/parameters/secrets";
|
|
4
3
|
import { DynamoDBClient, PutItemCommand } from "@aws-sdk/client-dynamodb";
|
|
5
4
|
import { marshall } from "@aws-sdk/util-dynamodb";
|
|
6
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
7
5
|
import { PrismaClient } from "@prisma/client";
|
|
6
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
8
7
|
import {
|
|
9
8
|
batchedPruneExpired,
|
|
10
9
|
resolveInteractionEventConfig,
|
|
@@ -23,32 +22,6 @@ const metrics = new Metrics({
|
|
|
23
22
|
const dynamo = new DynamoDBClient({ region: process.env.AWS_REGION });
|
|
24
23
|
const TABLE = process.env.DYNAMODB_TABLE!;
|
|
25
24
|
|
|
26
|
-
let prisma: PrismaClient | null = null;
|
|
27
|
-
|
|
28
|
-
interface DbSecret {
|
|
29
|
-
username: string;
|
|
30
|
-
password: string;
|
|
31
|
-
host: string;
|
|
32
|
-
port: string | number;
|
|
33
|
-
dbname: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
37
|
-
if (prisma) return prisma;
|
|
38
|
-
// getSecret caches + KMS-decrypts; transform:"json" parses the secret value.
|
|
39
|
-
const { username, password, host, port, dbname } = (await getSecret(
|
|
40
|
-
process.env.DB_SECRET_ARN!,
|
|
41
|
-
{ transform: "json" },
|
|
42
|
-
)) as unknown as DbSecret;
|
|
43
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
44
|
-
// is now supplied via a driver adapter.
|
|
45
|
-
const adapter = new PrismaPg({
|
|
46
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
47
|
-
});
|
|
48
|
-
prisma = new PrismaClient({ adapter });
|
|
49
|
-
return prisma;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
25
|
export const handler = async (): Promise<void> => {
|
|
53
26
|
const now = Math.floor(Date.now() / 1000);
|
|
54
27
|
|
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
import { DynamoDBClient, PutItemCommand } from "@aws-sdk/client-dynamodb";
|
|
2
2
|
import { marshall } from "@aws-sdk/util-dynamodb";
|
|
3
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
4
3
|
import { PrismaClient } from "@prisma/client";
|
|
5
4
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
6
|
-
import {
|
|
5
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
7
6
|
|
|
8
7
|
const logger = new Logger({ serviceName: "maintenance-cron" });
|
|
9
8
|
|
|
10
9
|
const dynamo = new DynamoDBClient({ region: process.env.AWS_REGION });
|
|
11
10
|
const TABLE = process.env.DYNAMODB_TABLE!;
|
|
12
11
|
|
|
13
|
-
let prisma: PrismaClient | null = null;
|
|
14
|
-
|
|
15
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
16
|
-
if (prisma) return prisma;
|
|
17
|
-
const { username, password, host, port, dbname } = (await getSecret(process.env.DB_SECRET_ARN!, { transform: "json" })) as unknown as {
|
|
18
|
-
username: string;
|
|
19
|
-
password: string;
|
|
20
|
-
host: string;
|
|
21
|
-
port: string | number;
|
|
22
|
-
dbname: string;
|
|
23
|
-
};
|
|
24
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
25
|
-
// is now supplied via a driver adapter.
|
|
26
|
-
const adapter = new PrismaPg({
|
|
27
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
28
|
-
});
|
|
29
|
-
prisma = new PrismaClient({ adapter });
|
|
30
|
-
return prisma;
|
|
31
|
-
}
|
|
32
12
|
|
|
33
13
|
export const handler = async (): Promise<void> => {
|
|
34
14
|
const now = Math.floor(Date.now() / 1000);
|
|
@@ -32,7 +32,7 @@ export const handler: SQSHandler = async (event) => {
|
|
|
32
32
|
// Process with Sharp (must be installed as ARM64 binary)
|
|
33
33
|
// dynamic import to avoid bundling issues
|
|
34
34
|
const sharp = (await import("sharp")).default;
|
|
35
|
-
const hash = key.
|
|
35
|
+
const hash = key.split("/").pop()!.replace(/\.[^.]+$/, "");
|
|
36
36
|
|
|
37
37
|
// Thumbnail: 300px WebP
|
|
38
38
|
const thumbnail = await sharp(buffer)
|
|
@@ -3,11 +3,10 @@ import { S3Client, DeleteObjectsCommand, ListObjectsV2Command } from "@aws-sdk/c
|
|
|
3
3
|
import { CognitoIdentityProviderClient, AdminDeleteUserCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
4
4
|
import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";
|
|
5
5
|
import { marshall } from "@aws-sdk/util-dynamodb";
|
|
6
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
7
6
|
import { PrismaClient } from "@prisma/client";
|
|
8
7
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
9
8
|
import { Metrics, MetricUnit } from "@aws-lambda-powertools/metrics";
|
|
10
|
-
import {
|
|
9
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
11
10
|
|
|
12
11
|
const logger = new Logger({ serviceName: "nightly-cron" });
|
|
13
12
|
const metrics = new Metrics({ namespace: "Trellis/Deletion", serviceName: "nightly-cron" });
|
|
@@ -17,26 +16,6 @@ const s3 = new S3Client({ region: process.env.AWS_REGION });
|
|
|
17
16
|
const TABLE = process.env.DYNAMODB_TABLE!;
|
|
18
17
|
const MEDIA_BUCKET = process.env.MEDIA_BUCKET_NAME!;
|
|
19
18
|
|
|
20
|
-
let prisma: PrismaClient | null = null;
|
|
21
|
-
|
|
22
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
23
|
-
if (prisma) return prisma;
|
|
24
|
-
const { username, password, host, port, dbname } = (await getSecret(process.env.DB_SECRET_ARN!, { transform: "json" })) as unknown as {
|
|
25
|
-
username: string;
|
|
26
|
-
password: string;
|
|
27
|
-
host: string;
|
|
28
|
-
port: string | number;
|
|
29
|
-
dbname: string;
|
|
30
|
-
};
|
|
31
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
32
|
-
// is now supplied via a driver adapter.
|
|
33
|
-
const adapter = new PrismaPg({
|
|
34
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
35
|
-
});
|
|
36
|
-
prisma = new PrismaClient({ adapter });
|
|
37
|
-
return prisma;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
19
|
export const handler = async (): Promise<void> => {
|
|
41
20
|
const now = Math.floor(Date.now() / 1000);
|
|
42
21
|
|
|
@@ -117,8 +96,7 @@ export const handler = async (): Promise<void> => {
|
|
|
117
96
|
logger.error("Invitation cleanup failed", { error: err });
|
|
118
97
|
}
|
|
119
98
|
|
|
120
|
-
// 3. Follower counts removed — relationships now live in graph
|
|
121
|
-
// TODO: Add graph-side consistency check when reconciliation service is wired up
|
|
99
|
+
// 3. Follower counts removed — relationships now live in graph edge tables (see graph-service.ts)
|
|
122
100
|
|
|
123
101
|
// 4. Process scheduled account deletions (GDPR Article 17 compliance)
|
|
124
102
|
try {
|
|
@@ -34,8 +34,7 @@ import type {
|
|
|
34
34
|
PostConfirmationTriggerHandler,
|
|
35
35
|
} from "aws-lambda";
|
|
36
36
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
37
|
-
import {
|
|
38
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
37
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
39
38
|
import {
|
|
40
39
|
PrismaClient,
|
|
41
40
|
Prisma,
|
|
@@ -55,30 +54,8 @@ import {
|
|
|
55
54
|
import type { SignupMethod } from "@prisma/client";
|
|
56
55
|
|
|
57
56
|
const logger = new Logger({ serviceName: "post-confirmation" });
|
|
58
|
-
let prisma: PrismaClient | null = null;
|
|
59
57
|
let cache: ClaimsCache | null = null;
|
|
60
58
|
|
|
61
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
62
|
-
if (prisma) return prisma;
|
|
63
|
-
const { username, password, host, port, dbname } = (await getSecret(
|
|
64
|
-
process.env.DB_SECRET_ARN!,
|
|
65
|
-
{ transform: "json" },
|
|
66
|
-
)) as unknown as {
|
|
67
|
-
username: string;
|
|
68
|
-
password: string;
|
|
69
|
-
host: string;
|
|
70
|
-
port: string | number;
|
|
71
|
-
dbname: string;
|
|
72
|
-
};
|
|
73
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
74
|
-
// is now supplied via a driver adapter.
|
|
75
|
-
const adapter = new PrismaPg({
|
|
76
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
77
|
-
});
|
|
78
|
-
prisma = new PrismaClient({ adapter });
|
|
79
|
-
return prisma;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
59
|
function getCache(): ClaimsCache {
|
|
83
60
|
if (!cache) cache = createClaimsCacheFromEnv();
|
|
84
61
|
return cache;
|
|
@@ -164,8 +141,14 @@ const SUPPORTED_TRIGGERS = new Set([
|
|
|
164
141
|
export const handler: PostConfirmationTriggerHandler = async (event) => {
|
|
165
142
|
if (!SUPPORTED_TRIGGERS.has(event.triggerSource)) return event;
|
|
166
143
|
|
|
167
|
-
const cognitoSub = event.userName;
|
|
168
144
|
const attrs = event.request.userAttributes;
|
|
145
|
+
// Identify the user by the immutable Cognito `sub` (the value carried in the
|
|
146
|
+
// issued ID/access tokens), NOT `event.userName`. `userName` is not stable
|
|
147
|
+
// across trigger contexts — PostConfirmation sees the sign-up username while
|
|
148
|
+
// PreTokenGeneration on alias (email) sign-in receives the `sub` — so keying
|
|
149
|
+
// the User row and the claims cache on it silently breaks the cache lookup
|
|
150
|
+
// (the claim is written under one key and read under another → 401s).
|
|
151
|
+
const cognitoSub = attrs.sub;
|
|
169
152
|
const email = attrs.email?.toLowerCase();
|
|
170
153
|
if (!email) {
|
|
171
154
|
logger.warn("postconfirm.no_email", { cognitoSub });
|
|
@@ -24,9 +24,8 @@ import type {
|
|
|
24
24
|
PreTokenGenerationV2TriggerHandler,
|
|
25
25
|
} from "aws-lambda";
|
|
26
26
|
import { Logger } from "@aws-lambda-powertools/logger";
|
|
27
|
-
import { getSecret } from "@aws-lambda-powertools/parameters/secrets";
|
|
28
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
29
27
|
import { PrismaClient, type TenantRole } from "@prisma/client";
|
|
28
|
+
import { getLambdaPrisma as getPrisma } from "../lib/lambda-prisma.js";
|
|
30
29
|
import {
|
|
31
30
|
ClaimsCache,
|
|
32
31
|
createClaimsCacheFromEnv,
|
|
@@ -36,30 +35,8 @@ import {
|
|
|
36
35
|
import { resolveTenantRole, type RoleMappingInput } from "../lib/tenant/resolve-role.js";
|
|
37
36
|
|
|
38
37
|
const logger = new Logger({ serviceName: "pre-token-generation" });
|
|
39
|
-
let prisma: PrismaClient | null = null;
|
|
40
38
|
let cache: ClaimsCache | null = null;
|
|
41
39
|
|
|
42
|
-
async function getPrisma(): Promise<PrismaClient> {
|
|
43
|
-
if (prisma) return prisma;
|
|
44
|
-
const { username, password, host, port, dbname } = (await getSecret(
|
|
45
|
-
process.env.DB_SECRET_ARN!,
|
|
46
|
-
{ transform: "json" },
|
|
47
|
-
)) as unknown as {
|
|
48
|
-
username: string;
|
|
49
|
-
password: string;
|
|
50
|
-
host: string;
|
|
51
|
-
port: string | number;
|
|
52
|
-
dbname: string;
|
|
53
|
-
};
|
|
54
|
-
// Prisma 7 removed the `datasources` constructor option; the connection URL
|
|
55
|
-
// is now supplied via a driver adapter.
|
|
56
|
-
const adapter = new PrismaPg({
|
|
57
|
-
connectionString: `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbname}?connection_limit=1`,
|
|
58
|
-
});
|
|
59
|
-
prisma = new PrismaClient({ adapter });
|
|
60
|
-
return prisma;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
40
|
function getCache(): ClaimsCache {
|
|
64
41
|
if (!cache) cache = createClaimsCacheFromEnv();
|
|
65
42
|
return cache;
|
|
@@ -198,7 +175,11 @@ async function maybeRefreshFederatedRole(
|
|
|
198
175
|
}
|
|
199
176
|
|
|
200
177
|
export const handler: PreTokenGenerationV2TriggerHandler = async (event) => {
|
|
201
|
-
|
|
178
|
+
// Read the claims cache + RDS fallback by the immutable Cognito `sub` — the
|
|
179
|
+
// same key PostConfirmation writes and the value carried in the token's `sub`
|
|
180
|
+
// claim. `event.userName` is NOT stable across triggers (it can be the
|
|
181
|
+
// sign-up username here vs the sub there), which caused every lookup to miss.
|
|
182
|
+
const cognitoSub = event.request.userAttributes.sub;
|
|
202
183
|
const claimsCache = getCache();
|
|
203
184
|
const federated = isFederatedEvent(event);
|
|
204
185
|
const idpGroups = parseIdpGroups(event.request.userAttributes["custom:idpGroups"]);
|