@intelligo-dev/core 1.0.0-beta.1 → 1.0.0-beta.14
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/NOTICE +6 -0
- package/README.md +102 -0
- package/dist/attachments/errors.d.ts +7 -0
- package/dist/attachments/errors.d.ts.map +1 -0
- package/dist/attachments/errors.js +11 -0
- package/dist/attachments/errors.js.map +1 -0
- package/dist/attachments/index.d.ts +8 -0
- package/dist/attachments/index.d.ts.map +1 -0
- package/dist/attachments/index.js +7 -0
- package/dist/attachments/index.js.map +1 -0
- package/dist/attachments/service.d.ts +45 -0
- package/dist/attachments/service.d.ts.map +1 -0
- package/dist/attachments/service.js +100 -0
- package/dist/attachments/service.js.map +1 -0
- package/dist/attachments/types.d.ts +6 -0
- package/dist/attachments/types.d.ts.map +1 -0
- package/dist/attachments/types.js +2 -0
- package/dist/attachments/types.js.map +1 -0
- package/dist/conversations/errors.d.ts +2 -8
- package/dist/conversations/errors.d.ts.map +1 -1
- package/dist/conversations/errors.js +2 -8
- package/dist/conversations/errors.js.map +1 -1
- package/dist/conversations/index.d.ts +4 -12
- package/dist/conversations/index.d.ts.map +1 -1
- package/dist/conversations/index.js +2 -11
- package/dist/conversations/index.js.map +1 -1
- package/dist/conversations/service.d.ts +49 -61
- package/dist/conversations/service.d.ts.map +1 -1
- package/dist/conversations/service.js +110 -83
- package/dist/conversations/service.js.map +1 -1
- package/dist/conversations/types.d.ts +1 -4
- package/dist/conversations/types.d.ts.map +1 -1
- package/dist/conversations/types.js +0 -3
- package/dist/conversations/types.js.map +1 -1
- package/dist/db/client.d.ts +21 -10
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +43 -18
- package/dist/db/client.js.map +1 -1
- package/dist/db/index.d.ts +3 -3
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +3 -7
- package/dist/db/index.js.map +1 -1
- package/dist/db/schema/agents.d.ts +14 -51
- package/dist/db/schema/agents.d.ts.map +1 -1
- package/dist/db/schema/agents.js +9 -21
- package/dist/db/schema/agents.js.map +1 -1
- package/dist/db/schema/ai.d.ts +86 -1556
- package/dist/db/schema/ai.d.ts.map +1 -1
- package/dist/db/schema/ai.js +32 -236
- package/dist/db/schema/ai.js.map +1 -1
- package/dist/db/schema/auth.d.ts +5 -34
- package/dist/db/schema/auth.d.ts.map +1 -1
- package/dist/db/schema/auth.js +25 -56
- package/dist/db/schema/auth.js.map +1 -1
- package/dist/db/schema/billing.d.ts +339 -105
- package/dist/db/schema/billing.d.ts.map +1 -1
- package/dist/db/schema/billing.js +99 -58
- package/dist/db/schema/billing.js.map +1 -1
- package/dist/db/schema/feature-flags.d.ts +3 -12
- package/dist/db/schema/feature-flags.d.ts.map +1 -1
- package/dist/db/schema/feature-flags.js +3 -12
- package/dist/db/schema/feature-flags.js.map +1 -1
- package/dist/db/schema/identity.d.ts +12 -274
- package/dist/db/schema/identity.d.ts.map +1 -1
- package/dist/db/schema/identity.js +19 -104
- package/dist/db/schema/identity.js.map +1 -1
- package/dist/db/schema/index.d.ts +8 -15
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/index.js +12 -42
- package/dist/db/schema/index.js.map +1 -1
- package/dist/db/schema/notifications.d.ts +3 -17
- package/dist/db/schema/notifications.d.ts.map +1 -1
- package/dist/db/schema/notifications.js +3 -17
- package/dist/db/schema/notifications.js.map +1 -1
- package/dist/db/schema/usage.d.ts +94 -77
- package/dist/db/schema/usage.d.ts.map +1 -1
- package/dist/db/schema/usage.js +59 -89
- package/dist/db/schema/usage.js.map +1 -1
- package/dist/db/validate.d.ts +2 -11
- package/dist/db/validate.d.ts.map +1 -1
- package/dist/db/validate.js +6 -17
- package/dist/db/validate.js.map +1 -1
- package/dist/db/workspace-queries.d.ts +5 -29
- package/dist/db/workspace-queries.d.ts.map +1 -1
- package/dist/db/workspace-queries.js +5 -29
- package/dist/db/workspace-queries.js.map +1 -1
- package/dist/documents/classifier.d.ts +5 -12
- package/dist/documents/classifier.d.ts.map +1 -1
- package/dist/documents/classifier.js +16 -16
- package/dist/documents/classifier.js.map +1 -1
- package/dist/documents/errors.d.ts +2 -10
- package/dist/documents/errors.d.ts.map +1 -1
- package/dist/documents/errors.js +2 -10
- package/dist/documents/errors.js.map +1 -1
- package/dist/documents/index.d.ts +4 -13
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/documents/index.js +3 -12
- package/dist/documents/index.js.map +1 -1
- package/dist/documents/service.d.ts +19 -26
- package/dist/documents/service.d.ts.map +1 -1
- package/dist/documents/service.js +44 -38
- package/dist/documents/service.js.map +1 -1
- package/dist/documents/types.d.ts +6 -10
- package/dist/documents/types.d.ts.map +1 -1
- package/dist/documents/types.js +0 -3
- package/dist/documents/types.js.map +1 -1
- package/dist/email/brand.d.ts +17 -0
- package/dist/email/brand.d.ts.map +1 -0
- package/dist/email/brand.js +9 -0
- package/dist/email/brand.js.map +1 -0
- package/dist/email/index.d.ts +4 -4
- package/dist/email/index.js +4 -4
- package/dist/email/provider.d.ts +1 -7
- package/dist/email/provider.d.ts.map +1 -1
- package/dist/email/provider.js +10 -19
- package/dist/email/provider.js.map +1 -1
- package/dist/email/send.d.ts +12 -12
- package/dist/email/send.d.ts.map +1 -1
- package/dist/email/send.js +5 -19
- package/dist/email/send.js.map +1 -1
- package/dist/email/senders.d.ts +17 -30
- package/dist/email/senders.d.ts.map +1 -1
- package/dist/email/senders.js +33 -47
- package/dist/email/senders.js.map +1 -1
- package/dist/email/templates/base-layout.d.ts +1 -1
- package/dist/email/templates/base-layout.d.ts.map +1 -1
- package/dist/email/templates/base-layout.js +4 -6
- package/dist/email/templates/base-layout.js.map +1 -1
- package/dist/email/templates/index.d.ts +10 -10
- package/dist/email/templates/index.d.ts.map +1 -1
- package/dist/email/templates/index.js +10 -16
- package/dist/email/templates/index.js.map +1 -1
- package/dist/email/templates/password-reset.d.ts +2 -2
- package/dist/email/templates/password-reset.d.ts.map +1 -1
- package/dist/email/templates/password-reset.js +10 -22
- package/dist/email/templates/password-reset.js.map +1 -1
- package/dist/email/templates/payment-failed.d.ts +2 -2
- package/dist/email/templates/payment-failed.d.ts.map +1 -1
- package/dist/email/templates/payment-failed.js +11 -24
- package/dist/email/templates/payment-failed.js.map +1 -1
- package/dist/email/templates/quota-warning.d.ts +4 -4
- package/dist/email/templates/quota-warning.d.ts.map +1 -1
- package/dist/email/templates/quota-warning.js +19 -39
- package/dist/email/templates/quota-warning.js.map +1 -1
- package/dist/email/templates/subscription-confirmed.d.ts +2 -2
- package/dist/email/templates/subscription-confirmed.d.ts.map +1 -1
- package/dist/email/templates/subscription-confirmed.js +13 -28
- package/dist/email/templates/subscription-confirmed.js.map +1 -1
- package/dist/email/templates/trial-expiry.d.ts +2 -2
- package/dist/email/templates/trial-expiry.d.ts.map +1 -1
- package/dist/email/templates/trial-expiry.js +12 -36
- package/dist/email/templates/trial-expiry.js.map +1 -1
- package/dist/email/templates/trial-warning.d.ts +2 -2
- package/dist/email/templates/trial-warning.d.ts.map +1 -1
- package/dist/email/templates/trial-warning.js +15 -32
- package/dist/email/templates/trial-warning.js.map +1 -1
- package/dist/email/templates/verify-email.d.ts +2 -2
- package/dist/email/templates/verify-email.d.ts.map +1 -1
- package/dist/email/templates/verify-email.js +10 -22
- package/dist/email/templates/verify-email.js.map +1 -1
- package/dist/email/templates/welcome.d.ts +2 -2
- package/dist/email/templates/welcome.d.ts.map +1 -1
- package/dist/email/templates/welcome.js +13 -20
- package/dist/email/templates/welcome.js.map +1 -1
- package/dist/email/templates/workspace-invitation.d.ts +2 -2
- package/dist/email/templates/workspace-invitation.d.ts.map +1 -1
- package/dist/email/templates/workspace-invitation.js +12 -26
- package/dist/email/templates/workspace-invitation.js.map +1 -1
- package/dist/env.d.ts +5 -10
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +41 -31
- package/dist/env.js.map +1 -1
- package/dist/identity/audit.d.ts +11 -24
- package/dist/identity/audit.d.ts.map +1 -1
- package/dist/identity/audit.js +13 -27
- package/dist/identity/audit.js.map +1 -1
- package/dist/identity/errors.d.ts +4 -12
- package/dist/identity/errors.d.ts.map +1 -1
- package/dist/identity/errors.js +2 -8
- package/dist/identity/errors.js.map +1 -1
- package/dist/identity/index.d.ts +6 -13
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +5 -12
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/service.d.ts +29 -47
- package/dist/identity/service.d.ts.map +1 -1
- package/dist/identity/service.js +107 -79
- package/dist/identity/service.js.map +1 -1
- package/dist/identity/types.d.ts +28 -4
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/identity/types.js +0 -3
- package/dist/identity/types.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -10
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +7 -18
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +45 -49
- package/dist/logger.js.map +1 -1
- package/dist/money.d.ts +95 -0
- package/dist/money.d.ts.map +1 -0
- package/dist/money.js +208 -0
- package/dist/money.js.map +1 -0
- package/dist/notifications/index.d.ts +9 -43
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +9 -49
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/triggers.d.ts +9 -32
- package/dist/notifications/triggers.d.ts.map +1 -1
- package/dist/notifications/triggers.js +21 -58
- package/dist/notifications/triggers.js.map +1 -1
- package/dist/notifications/types.d.ts +6 -8
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/notifications/types.js +0 -9
- package/dist/notifications/types.js.map +1 -1
- package/dist/prompt.d.ts +38 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +118 -0
- package/dist/prompt.js.map +1 -0
- package/dist/registry.d.ts +32 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +60 -0
- package/dist/registry.js.map +1 -0
- package/dist/request-context.d.ts +49 -0
- package/dist/request-context.d.ts.map +1 -0
- package/dist/request-context.js +100 -0
- package/dist/request-context.js.map +1 -0
- package/dist/storage/index.d.ts +65 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +109 -0
- package/dist/storage/index.js.map +1 -0
- package/package.json +74 -24
- package/src/attachments/errors.ts +18 -0
- package/src/attachments/index.ts +22 -0
- package/src/attachments/service.ts +178 -0
- package/src/attachments/types.ts +6 -0
- package/src/conversations/errors.ts +45 -0
- package/src/conversations/index.ts +39 -0
- package/src/conversations/service.ts +594 -0
- package/src/conversations/types.ts +15 -0
- package/src/db/client.ts +91 -0
- package/src/db/index.ts +3 -0
- package/src/db/migrations/0000_baseline.sql +652 -0
- package/src/db/migrations/0001_reconcile_chain_built_databases.sql +53 -0
- package/src/db/migrations/0002_webhook_claim_lease.sql +1 -0
- package/src/db/migrations/0003_local_payments.sql +18 -0
- package/src/db/migrations/README.md +103 -36
- package/src/db/migrations/legacy-chain.json +206 -0
- package/src/db/migrations/meta/0000_snapshot.json +4182 -157
- package/src/db/migrations/meta/0002_snapshot.json +2478 -368
- package/src/db/migrations/meta/0003_snapshot.json +2567 -554
- package/src/db/migrations/meta/_journal.json +8 -274
- package/src/db/schema/agents.ts +57 -0
- package/src/db/schema/ai.ts +174 -0
- package/src/db/schema/auth.ts +183 -0
- package/src/db/schema/billing.ts +245 -0
- package/src/db/schema/feature-flags.ts +20 -0
- package/src/db/schema/identity.ts +250 -0
- package/src/db/schema/index.ts +12 -0
- package/src/db/schema/notifications.ts +31 -0
- package/src/db/schema/usage.ts +269 -0
- package/src/db/validate.ts +63 -0
- package/src/db/workspace-queries.ts +64 -0
- package/src/documents/classifier.ts +61 -0
- package/src/documents/errors.ts +44 -0
- package/src/documents/index.ts +24 -0
- package/src/documents/service.ts +256 -0
- package/src/documents/types.ts +24 -0
- package/src/email/brand.ts +24 -0
- package/src/email/index.ts +19 -0
- package/src/email/provider.ts +278 -0
- package/src/email/send.ts +169 -0
- package/src/email/senders.ts +292 -0
- package/src/email/templates/base-layout.tsx +145 -0
- package/src/email/templates/index.ts +28 -0
- package/src/email/templates/password-reset.tsx +72 -0
- package/src/email/templates/payment-failed.tsx +77 -0
- package/src/email/templates/quota-warning.tsx +118 -0
- package/src/email/templates/subscription-confirmed.tsx +91 -0
- package/src/email/templates/trial-expiry.tsx +124 -0
- package/src/email/templates/trial-warning.tsx +104 -0
- package/src/email/templates/verify-email.tsx +72 -0
- package/src/email/templates/welcome.tsx +64 -0
- package/src/email/templates/workspace-invitation.tsx +105 -0
- package/src/env.ts +180 -0
- package/src/identity/audit.ts +65 -0
- package/src/identity/errors.ts +44 -0
- package/src/identity/index.ts +29 -0
- package/src/identity/service.ts +303 -0
- package/src/identity/types.ts +58 -0
- package/src/index.ts +4 -0
- package/src/logger.ts +198 -0
- package/src/money.ts +270 -0
- package/src/notifications/index.ts +112 -0
- package/src/notifications/triggers.ts +158 -0
- package/src/notifications/types.ts +26 -0
- package/src/prompt.ts +142 -0
- package/src/registry.ts +75 -0
- package/src/request-context.ts +137 -0
- package/src/storage/index.ts +153 -0
- package/dist/db/schema/rag.d.ts +0 -171
- package/dist/db/schema/rag.d.ts.map +0 -1
- package/dist/db/schema/rag.js +0 -42
- package/dist/db/schema/rag.js.map +0 -1
- package/src/db/migrations/0000_sharp_night_nurse.sql +0 -52
- package/src/db/migrations/0001_hesitant_vapor.sql +0 -40
- package/src/db/migrations/0002_numerous_lady_vermin.sql +0 -235
- package/src/db/migrations/0003_mighty_jean_grey.sql +0 -37
- package/src/db/migrations/0004_cynical_grandmaster.sql +0 -2
- package/src/db/migrations/0005_careful_switch.sql +0 -8
- package/src/db/migrations/0006_tense_blue_marvel.sql +0 -16
- package/src/db/migrations/0007_next_squadron_sinister.sql +0 -1
- package/src/db/migrations/0008_powerful_scream.sql +0 -39
- package/src/db/migrations/0009_sad_ink.sql +0 -1
- package/src/db/migrations/0010_shocking_omega_flight.sql +0 -2
- package/src/db/migrations/0011_ambiguous_otto_octavius.sql +0 -151
- package/src/db/migrations/0011_hnsw_vector_index.sql +0 -17
- package/src/db/migrations/0012_user_profiles.sql +0 -30
- package/src/db/migrations/0013_trending_seasonal_columns.sql +0 -9
- package/src/db/migrations/0014_add_product_type_to_agents.sql +0 -6
- package/src/db/migrations/0015_new_v1_tables.sql +0 -149
- package/src/db/migrations/0016_document_types.sql +0 -30
- package/src/db/migrations/0017_document_metadata.sql +0 -2
- package/src/db/migrations/0018_identity_graph.sql +0 -200
- package/src/db/migrations/0019_db_driven_prompts.sql +0 -20
- package/src/db/migrations/0020_pending_extractions.sql +0 -35
- package/src/db/migrations/0021_rag_documents.sql +0 -39
- package/src/db/migrations/0022_user_quotas_usage_jsonb.sql +0 -70
- package/src/db/migrations/0023_user_facts_user_scoped_unique.sql +0 -17
- package/src/db/migrations/0024_user_memories_hnsw.sql +0 -23
- package/src/db/migrations/0025_audit_trigger_errcode.sql +0 -21
- package/src/db/migrations/0026_user_profile_snapshots_composite_pk.sql +0 -17
- package/src/db/migrations/0027_billing_settings_mnt_columns.sql +0 -54
- package/src/db/migrations/0028_trial_credits_normalized_email.sql +0 -37
- package/src/db/migrations/0029_usage_records_conversation_idx.sql +0 -13
- package/src/db/migrations/0030_pending_extractions_composite_idx.sql +0 -11
- package/src/db/migrations/0031_rag_documents_hnsw.sql +0 -16
- package/src/db/migrations/0032_rate_limit_unique_idx.sql +0 -16
- package/src/db/migrations/0033_pending_extractions_partial_idx.sql +0 -18
- package/src/db/migrations/0034_rate_limit_count.sql +0 -9
- package/src/db/migrations/0035_credit_reservations.sql +0 -24
- package/src/db/migrations/0036_executions_audit_jobs.sql +0 -96
- package/src/db/migrations/0037_rate_limit_minute_bucket.sql +0 -46
- package/src/db/migrations/0038_user_quotas_generic_usage.sql +0 -25
- package/src/db/migrations/0039_platform_admin_impersonation.sql +0 -27
- package/src/db/migrations/0040_ee_audit_chain.sql +0 -23
- package/src/db/migrations/meta/0001_snapshot.json +0 -631
- package/src/db/migrations/meta/0004_snapshot.json +0 -2500
- package/src/db/migrations/meta/0005_snapshot.json +0 -2548
- package/src/db/migrations/meta/0006_snapshot.json +0 -2650
- package/src/db/migrations/meta/0007_snapshot.json +0 -2657
- package/src/db/migrations/meta/0008_snapshot.json +0 -2719
- package/src/db/migrations/meta/0009_snapshot.json +0 -2726
- package/src/db/migrations/meta/0010_snapshot.json +0 -2739
- package/src/db/migrations/meta/0011_snapshot.json +0 -3886
package/dist/identity/service.js
CHANGED
|
@@ -1,61 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Server-only reads and mutations over the user identity graph: fact
|
|
3
|
+
* listing and deletion, the profile snapshot's write, a full data export,
|
|
4
|
+
* and the memory-audit trail.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* memories, and synthesized profile snapshot. Ported from Ignite's
|
|
8
|
-
* `actions/identity.ts` (ADR-0008/ADR-0009 precedent — see
|
|
9
|
-
* `../documents/service.ts` and `../conversations/service.ts` for the
|
|
10
|
-
* same move): the tables (`user_facts`, `user_memories`,
|
|
11
|
-
* `user_profile_snapshots`, `user_memory_audit`) always lived in
|
|
12
|
-
* `@intelligo-dev/core`'s schema (`../db/schema/identity.ts`, documented
|
|
13
|
-
* there as "a platform-level memory primitive — separate from any
|
|
14
|
-
* single product"); only the service layer sat in the product
|
|
15
|
-
* application.
|
|
6
|
+
* `deleteFact` does not touch the cached profile snapshot; profile synthesis
|
|
7
|
+
* is the product's AI code, so a caller that owns it re-triggers it and
|
|
8
|
+
* stores the result with `saveProfileSnapshot`.
|
|
16
9
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `@intelligo-dev/agents`' concern (deprecated, dissolving under
|
|
21
|
-
* ADR-0008), and this package cannot depend on it. `deleteFact`
|
|
22
|
-
* below does not touch the cached snapshot; a caller that also
|
|
23
|
-
* owns a synthesis engine re-triggers it after calling this.
|
|
24
|
-
*
|
|
25
|
-
* Callers pass a resolved actor (workspaceId, userId) rather than this
|
|
26
|
-
* module resolving one itself — `@intelligo-dev/core` cannot depend on
|
|
27
|
-
* `@intelligo-dev/auth` (see tests/architecture/dependency-direction.test.ts).
|
|
28
|
-
* Every query filters by workspaceId AND userId internally; the actor
|
|
29
|
-
* is never trusted to have done that itself.
|
|
30
|
-
*
|
|
31
|
-
* Every mutation writes a `user_memory_audit` row via the internal
|
|
32
|
-
* `recordMemoryAudit` (./audit.ts). See that file's doc comment for
|
|
33
|
-
* why the writer lives here rather than in `@intelligo-dev/audit`, which
|
|
34
|
-
* is where ADR-0008 names its destination — the allowlist only grants
|
|
35
|
-
* audit -> core, never core -> audit
|
|
36
|
-
* (tests/architecture/dependency-direction.test.ts), so
|
|
37
|
-
* `@intelligo-dev/audit` exports the event *contract* only.
|
|
38
|
-
*
|
|
39
|
-
* Failure is reported by throwing `IdentityServiceError` rather than
|
|
40
|
-
* returning a `{ success, error }` envelope — see ./errors.ts.
|
|
41
|
-
*
|
|
42
|
-
* This module is SERVER-ONLY. Do not import from client components.
|
|
10
|
+
* Callers pass a resolved actor (workspaceId, userId); core cannot depend on
|
|
11
|
+
* `@intelligo-dev/auth`. Every query filters by both ids. Every mutation
|
|
12
|
+
* writes a `user_memory_audit` row. Failures throw `IdentityServiceError`.
|
|
43
13
|
*/
|
|
44
|
-
import { and, desc, eq } from "drizzle-orm";
|
|
45
|
-
import { db } from "../db";
|
|
46
|
-
import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema";
|
|
47
|
-
import { recordMemoryAudit } from "./audit";
|
|
48
|
-
import { IdentityServiceError } from "./errors";
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
// Internal helpers
|
|
51
|
-
// ---------------------------------------------------------------------------
|
|
14
|
+
import { and, desc, eq, sql } from "drizzle-orm";
|
|
15
|
+
import { db } from "../db/index.js";
|
|
16
|
+
import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema/index.js";
|
|
17
|
+
import { recordMemoryAudit } from "./audit.js";
|
|
18
|
+
import { IdentityServiceError } from "./errors.js";
|
|
52
19
|
/**
|
|
53
|
-
*
|
|
54
|
-
* IdentityServiceError("not_found")
|
|
55
|
-
*
|
|
56
|
-
* else should be indistinguishable from one that doesn't exist at all
|
|
57
|
-
* (same reasoning as `../conversations/service.ts`'s
|
|
58
|
-
* `verifyConversation`).
|
|
20
|
+
* Returns the fact if the actor owns it. Throws
|
|
21
|
+
* IdentityServiceError("not_found") otherwise — another user's fact is
|
|
22
|
+
* indistinguishable from a missing one.
|
|
59
23
|
*/
|
|
60
24
|
async function verifyFact(actor, factId) {
|
|
61
25
|
const [fact] = await db
|
|
@@ -70,9 +34,6 @@ async function verifyFact(actor, factId) {
|
|
|
70
34
|
}
|
|
71
35
|
return fact;
|
|
72
36
|
}
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
// Reads
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
37
|
/** List the actor's facts, most important and most confident first. */
|
|
77
38
|
export async function listFacts(actor) {
|
|
78
39
|
return db
|
|
@@ -98,41 +59,35 @@ export async function getAuditTrail(actor, options) {
|
|
|
98
59
|
.orderBy(desc(userMemoryAudit.createdAt))
|
|
99
60
|
.limit(limit);
|
|
100
61
|
}
|
|
101
|
-
// ---------------------------------------------------------------------------
|
|
102
|
-
// Mutations
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
62
|
/**
|
|
105
63
|
* Delete a fact and record the deletion in the audit trail. Throws
|
|
106
64
|
* `invalid_input` for an empty id and `not_found` for anything outside
|
|
107
|
-
* the actor's scope
|
|
108
|
-
* synthesis — see the module doc comment.
|
|
65
|
+
* the actor's scope. Does not re-trigger profile synthesis.
|
|
109
66
|
*/
|
|
110
67
|
export async function deleteFact(actor, factId) {
|
|
111
68
|
if (!factId || factId.trim().length === 0) {
|
|
112
69
|
throw new IdentityServiceError("invalid_input", "factId is required");
|
|
113
70
|
}
|
|
114
71
|
const existing = await verifyFact(actor, factId);
|
|
115
|
-
await db.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
72
|
+
await db.transaction(async (tx) => {
|
|
73
|
+
await tx.delete(userFacts).where(eq(userFacts.id, factId));
|
|
74
|
+
await recordMemoryAudit({
|
|
75
|
+
userId: actor.userId,
|
|
76
|
+
workspaceId: actor.workspaceId,
|
|
77
|
+
targetKind: "fact",
|
|
78
|
+
targetId: factId,
|
|
79
|
+
action: "delete",
|
|
80
|
+
actorKind: "user",
|
|
81
|
+
actorId: actor.userId,
|
|
82
|
+
beforeValue: existing,
|
|
83
|
+
reason: "user requested deletion",
|
|
84
|
+
}, tx);
|
|
126
85
|
});
|
|
127
86
|
}
|
|
128
|
-
// ---------------------------------------------------------------------------
|
|
129
|
-
// Export — full identity dump for GDPR / "download my data"
|
|
130
|
-
// ---------------------------------------------------------------------------
|
|
131
87
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* audits itself, same as the ported Ignite implementation.
|
|
88
|
+
* The actor's full identity graph — facts, memories, latest profile
|
|
89
|
+
* snapshot and audit trail — for a "download my data" flow. Records its own
|
|
90
|
+
* audit row (action "export").
|
|
136
91
|
*/
|
|
137
92
|
export async function exportIdentity(actor) {
|
|
138
93
|
// Recorded before the reads so the export's own audit row is part of
|
|
@@ -176,4 +131,77 @@ export async function exportIdentity(actor) {
|
|
|
176
131
|
audit,
|
|
177
132
|
};
|
|
178
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Store the actor's synthesized profile — one row per user per workspace,
|
|
136
|
+
* inserted on the first synthesis and replaced on every later one. The
|
|
137
|
+
* version is bumped in the same statement (`ON CONFLICT … version + 1`),
|
|
138
|
+
* so two syntheses racing each other get two versions rather than one
|
|
139
|
+
* overwriting the other's number; it starts at 1.
|
|
140
|
+
*
|
|
141
|
+
* A field left `undefined` keeps what the row holds (null on insert); an
|
|
142
|
+
* explicit `null` clears it. `synthesizedAt` defaults to now. Records an
|
|
143
|
+
* audit row (`snapshot`, `create` or `update`) in the same transaction,
|
|
144
|
+
* attributed to `input.actorKind` — `system_job` unless the caller says
|
|
145
|
+
* otherwise. Throws `invalid_input` for an empty summary.
|
|
146
|
+
*/
|
|
147
|
+
export async function saveProfileSnapshot(actor, input) {
|
|
148
|
+
if (!input.summary || input.summary.trim().length === 0) {
|
|
149
|
+
throw new IdentityServiceError("invalid_input", "summary is required");
|
|
150
|
+
}
|
|
151
|
+
if (input.factsDigest === undefined || input.factsDigest === null) {
|
|
152
|
+
throw new IdentityServiceError("invalid_input", "factsDigest is required");
|
|
153
|
+
}
|
|
154
|
+
const replaced = {
|
|
155
|
+
summary: input.summary,
|
|
156
|
+
factsDigest: input.factsDigest,
|
|
157
|
+
synthesizedAt: input.synthesizedAt ?? new Date(),
|
|
158
|
+
...definedOnly({
|
|
159
|
+
summaryEn: input.summaryEn,
|
|
160
|
+
summaryMn: input.summaryMn,
|
|
161
|
+
activeGoals: input.activeGoals,
|
|
162
|
+
personalitySignals: input.personalitySignals,
|
|
163
|
+
relationshipNotes: input.relationshipNotes,
|
|
164
|
+
synthesizedByModel: input.synthesizedByModel,
|
|
165
|
+
nextSynthesisAt: input.nextSynthesisAt,
|
|
166
|
+
triggerReason: input.triggerReason,
|
|
167
|
+
}),
|
|
168
|
+
};
|
|
169
|
+
return db.transaction(async (tx) => {
|
|
170
|
+
const [row] = await tx
|
|
171
|
+
.insert(userProfileSnapshots)
|
|
172
|
+
.values({
|
|
173
|
+
userId: actor.userId,
|
|
174
|
+
workspaceId: actor.workspaceId,
|
|
175
|
+
version: 1,
|
|
176
|
+
...replaced,
|
|
177
|
+
})
|
|
178
|
+
.onConflictDoUpdate({
|
|
179
|
+
target: [userProfileSnapshots.userId, userProfileSnapshots.workspaceId],
|
|
180
|
+
set: {
|
|
181
|
+
...replaced,
|
|
182
|
+
version: sql `${userProfileSnapshots.version} + 1`,
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
.returning();
|
|
186
|
+
if (!row) {
|
|
187
|
+
throw new IdentityServiceError("database_error", "Failed to save profile snapshot");
|
|
188
|
+
}
|
|
189
|
+
await recordMemoryAudit({
|
|
190
|
+
userId: actor.userId,
|
|
191
|
+
workspaceId: actor.workspaceId,
|
|
192
|
+
targetKind: "snapshot",
|
|
193
|
+
targetId: actor.userId,
|
|
194
|
+
action: row.version === 1 ? "create" : "update",
|
|
195
|
+
actorKind: input.actorKind ?? "system_job",
|
|
196
|
+
actorId: input.actorId,
|
|
197
|
+
afterValue: { version: row.version, triggerReason: row.triggerReason },
|
|
198
|
+
reason: input.reason,
|
|
199
|
+
}, tx);
|
|
200
|
+
return row;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/** The entries whose value is not `undefined` — `null` is kept, to clear. */
|
|
204
|
+
function definedOnly(fields) {
|
|
205
|
+
return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
|
|
206
|
+
}
|
|
179
207
|
//# sourceMappingURL=service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/identity/service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/identity/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOhD;;;;GAIG;AACH,KAAK,UAAU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;YAC/C,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,YAAY;YAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE;YACtE,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,EAAE,CACH,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,SAAS,WAAW,CAAoC,MAAS;IAC/D,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACpD,CAAC;AAClB,CAAC"}
|
package/dist/identity/types.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared types for the identity service.
|
|
3
|
-
*/
|
|
4
|
-
import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema";
|
|
1
|
+
import type { AuditActorKind, SynthesisTriggerReason, UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema/index.js";
|
|
5
2
|
export type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow };
|
|
6
3
|
/** Resolved actor identity — every query is scoped to this pair. */
|
|
7
4
|
export type IdentityActor = {
|
|
@@ -24,4 +21,31 @@ export type IdentityExport = {
|
|
|
24
21
|
snapshot: UserProfileSnapshot | null;
|
|
25
22
|
audit: UserMemoryAuditRow[];
|
|
26
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* A synthesized profile, as `saveProfileSnapshot` stores it. The actor
|
|
26
|
+
* supplies the tenancy; the version is the store's.
|
|
27
|
+
*/
|
|
28
|
+
export type SaveProfileSnapshotInput = {
|
|
29
|
+
/** The summary a prompt hydrates from, in the product's primary language. */
|
|
30
|
+
summary: string;
|
|
31
|
+
summaryEn?: string | null;
|
|
32
|
+
summaryMn?: string | null;
|
|
33
|
+
/** The structured digest the summary was written from. */
|
|
34
|
+
factsDigest: unknown;
|
|
35
|
+
activeGoals?: unknown;
|
|
36
|
+
personalitySignals?: unknown;
|
|
37
|
+
relationshipNotes?: unknown;
|
|
38
|
+
/** The model that wrote it, or a label for a deterministic synthesis. */
|
|
39
|
+
synthesizedByModel?: string | null;
|
|
40
|
+
/** Default: now. */
|
|
41
|
+
synthesizedAt?: Date;
|
|
42
|
+
/** When a scheduled re-synthesis may next pick this user up. */
|
|
43
|
+
nextSynthesisAt?: Date | null;
|
|
44
|
+
triggerReason?: SynthesisTriggerReason | null;
|
|
45
|
+
/** Who the audit row names. Default `"system_job"`. */
|
|
46
|
+
actorKind?: AuditActorKind;
|
|
47
|
+
actorId?: string;
|
|
48
|
+
/** Recorded on the audit row. */
|
|
49
|
+
reason?: string;
|
|
50
|
+
};
|
|
27
51
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAE9E,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,oBAAoB;IACpB,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,gEAAgE;IAChE,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,uDAAuD;IACvD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/dist/identity/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":""}
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
// Email module -- use subpath import: @intelligo-dev/core/email
|
|
5
|
-
// Notifications module -- use subpath import: @intelligo-dev/core/notifications
|
|
6
|
-
// Conversations module -- use subpath import: @intelligo-dev/core/conversations
|
|
7
|
-
// Documents module -- use subpath import: @intelligo-dev/core/documents
|
|
8
|
-
// Identity module -- use subpath import: @intelligo-dev/core/identity
|
|
9
|
-
// Logger -- use subpath import: @intelligo-dev/core/logger
|
|
10
|
-
// Env -- use subpath import: @intelligo-dev/core/env
|
|
1
|
+
export * from "./db/index.js";
|
|
2
|
+
// Everything else is a subpath import: @intelligo-dev/core/email,
|
|
3
|
+
// /notifications, /conversations, /documents, /identity, /logger, /env.
|
|
11
4
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AAErB,kEAAkE;AAClE,wEAAwE"}
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Structured
|
|
2
|
+
* Structured pino logger. Emails and ids are redacted in production and
|
|
3
|
+
* passed through in development; credential fields are always redacted.
|
|
3
4
|
*
|
|
4
|
-
* A structured logger that:
|
|
5
|
-
* - Uses pino for high-performance JSON logging in production
|
|
6
|
-
* - Redacts PII in production (emails, workspace IDs, UUIDs)
|
|
7
|
-
* - Passes through unredacted in development for debugging
|
|
8
|
-
* - Maintains the same API as the previous custom logger
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
5
|
* ```typescript
|
|
12
6
|
* import { createLogger } from "@intelligo-dev/core/logger";
|
|
13
7
|
* const log = createLogger("MyModule");
|
|
@@ -18,14 +12,9 @@
|
|
|
18
12
|
*/
|
|
19
13
|
import pino from "pino";
|
|
20
14
|
/**
|
|
21
|
-
* Field name fragments whose values are always replaced with [REDACTED]
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* separate concern (production-only PII protection).
|
|
25
|
-
*
|
|
26
|
-
* Exported so a consumer's Sentry PII scrubber
|
|
27
|
-
* shares the same field list — a secret name added here is stripped
|
|
28
|
-
* from both the log stream and the Sentry event in one move.
|
|
15
|
+
* Field name fragments whose values are always replaced with [REDACTED], in
|
|
16
|
+
* every environment. Exported so an error reporter's scrubber can share the
|
|
17
|
+
* list.
|
|
29
18
|
*/
|
|
30
19
|
export declare const CREDENTIAL_KEY_FRAGMENTS: readonly ["password", "passwd", "secret", "token", "apikey", "api_key", "authorization", "auth_header", "cookie", "session_token", "session_secret", "credit_card", "creditcard", "card_number", "cvv"];
|
|
31
20
|
/** True when `key` contains any credential fragment (case-insensitive substring). */
|
|
@@ -40,8 +29,8 @@ declare class Logger {
|
|
|
40
29
|
}
|
|
41
30
|
export declare function createLogger(context: string): Logger;
|
|
42
31
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
32
|
+
* A logger writing to a custom pino destination, for capturing output in
|
|
33
|
+
* tests.
|
|
45
34
|
* @internal
|
|
46
35
|
*/
|
|
47
36
|
export declare function _createLoggerWithStream(context: string, stream: pino.DestinationStream): Logger;
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AA0BxB;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,yMAgB3B,CAAC;AAEX,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AA4DD,cAAM,MAAM;IACV,OAAO,CAAC,IAAI,CAAc;gBAEd,OAAO,EAAE,MAAM;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOtD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,IAAI,CAAC,iBAAiB,GAC7B,MAAM,CAgBR;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,eAAO,MAAM,MAAM,QAAsB,CAAC"}
|
package/dist/logger.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Structured
|
|
2
|
+
* Structured pino logger. Emails and ids are redacted in production and
|
|
3
|
+
* passed through in development; credential fields are always redacted.
|
|
3
4
|
*
|
|
4
|
-
* A structured logger that:
|
|
5
|
-
* - Uses pino for high-performance JSON logging in production
|
|
6
|
-
* - Redacts PII in production (emails, workspace IDs, UUIDs)
|
|
7
|
-
* - Passes through unredacted in development for debugging
|
|
8
|
-
* - Maintains the same API as the previous custom logger
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
5
|
* ```typescript
|
|
12
6
|
* import { createLogger } from "@intelligo-dev/core/logger";
|
|
13
7
|
* const log = createLogger("MyModule");
|
|
@@ -43,14 +37,9 @@ function redactId(id) {
|
|
|
43
37
|
return `${id.slice(0, 4)}...${id.slice(-4)}`;
|
|
44
38
|
}
|
|
45
39
|
/**
|
|
46
|
-
* Field name fragments whose values are always replaced with [REDACTED]
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* separate concern (production-only PII protection).
|
|
50
|
-
*
|
|
51
|
-
* Exported so a consumer's Sentry PII scrubber
|
|
52
|
-
* shares the same field list — a secret name added here is stripped
|
|
53
|
-
* from both the log stream and the Sentry event in one move.
|
|
40
|
+
* Field name fragments whose values are always replaced with [REDACTED], in
|
|
41
|
+
* every environment. Exported so an error reporter's scrubber can share the
|
|
42
|
+
* list.
|
|
54
43
|
*/
|
|
55
44
|
export const CREDENTIAL_KEY_FRAGMENTS = [
|
|
56
45
|
"password",
|
|
@@ -74,41 +63,49 @@ export function isCredentialKey(key) {
|
|
|
74
63
|
const lower = key.toLowerCase();
|
|
75
64
|
return CREDENTIAL_KEY_FRAGMENTS.some((needle) => lower.includes(needle));
|
|
76
65
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (key.toLowerCase().includes("email")) {
|
|
95
|
-
redacted[key] = redactEmail(value);
|
|
96
|
-
}
|
|
97
|
-
else if (key.toLowerCase().includes("id") ||
|
|
98
|
-
key.toLowerCase().includes("workspace")) {
|
|
99
|
-
redacted[key] = redactId(value);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
redacted[key] = value;
|
|
103
|
-
}
|
|
66
|
+
/**
|
|
67
|
+
* An identifier's key: `id`, `userId`, `workspace_id`. Matched as a
|
|
68
|
+
* suffix, not a substring, so `provider` or `paid` keep their values.
|
|
69
|
+
*/
|
|
70
|
+
function isIdKey(key) {
|
|
71
|
+
return /^id$|[a-z0-9]Id$|[_-]id$/.test(key) || /workspace/i.test(key);
|
|
72
|
+
}
|
|
73
|
+
/** Nested objects and arrays are walked, to this depth, so a credential inside one is still found. */
|
|
74
|
+
const MAX_REDACT_DEPTH = 6;
|
|
75
|
+
function redactValue(key, value, depth) {
|
|
76
|
+
if (isCredentialKey(key))
|
|
77
|
+
return "[REDACTED]";
|
|
78
|
+
if (value !== null && typeof value === "object") {
|
|
79
|
+
if (depth >= MAX_REDACT_DEPTH)
|
|
80
|
+
return "[TRUNCATED]";
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
return value.map((item) => redactValue(key, item, depth + 1));
|
|
104
83
|
}
|
|
105
|
-
|
|
106
|
-
|
|
84
|
+
if (Object.getPrototypeOf(value) === Object.prototype) {
|
|
85
|
+
return redactObject(value, depth + 1);
|
|
107
86
|
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
// Email and id redaction is production-only, so development logs show
|
|
90
|
+
// real values.
|
|
91
|
+
if (!isProduction || typeof value !== "string")
|
|
92
|
+
return value;
|
|
93
|
+
if (key.toLowerCase().includes("email"))
|
|
94
|
+
return redactEmail(value);
|
|
95
|
+
if (isIdKey(key))
|
|
96
|
+
return redactId(value);
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
function redactObject(data, depth) {
|
|
100
|
+
const redacted = {};
|
|
101
|
+
for (const [key, value] of Object.entries(data)) {
|
|
102
|
+
redacted[key] = redactValue(key, value, depth);
|
|
108
103
|
}
|
|
109
104
|
return redacted;
|
|
110
105
|
}
|
|
111
|
-
|
|
106
|
+
function redactData(data) {
|
|
107
|
+
return redactObject(data, 0);
|
|
108
|
+
}
|
|
112
109
|
const baseLogger = pino({
|
|
113
110
|
level: isProduction ? "info" : "debug",
|
|
114
111
|
formatters: {
|
|
@@ -159,8 +156,8 @@ export function createLogger(context) {
|
|
|
159
156
|
return new Logger(context);
|
|
160
157
|
}
|
|
161
158
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
159
|
+
* A logger writing to a custom pino destination, for capturing output in
|
|
160
|
+
* tests.
|
|
164
161
|
* @internal
|
|
165
162
|
*/
|
|
166
163
|
export function _createLoggerWithStream(context, stream) {
|
|
@@ -174,7 +171,6 @@ export function _createLoggerWithStream(context, stream) {
|
|
|
174
171
|
timestamp: false,
|
|
175
172
|
}, stream);
|
|
176
173
|
const instance = new Logger(context);
|
|
177
|
-
// Override the internal pino child with one writing to custom stream
|
|
178
174
|
instance.pino = customBase.child({ module: context });
|
|
179
175
|
return instance;
|
|
180
176
|
}
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AAE3D;;;GAGG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,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