@intelligo-dev/core 1.0.0-beta.1 → 1.0.0-beta.3
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/conversations/index.d.ts +3 -3
- package/dist/conversations/index.js +2 -2
- package/dist/conversations/service.d.ts +1 -1
- package/dist/conversations/service.js +3 -3
- package/dist/conversations/types.d.ts +1 -1
- package/dist/db/client.d.ts +27 -4
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +49 -12
- package/dist/db/client.js.map +1 -1
- package/dist/db/index.d.ts +3 -3
- package/dist/db/index.js +3 -3
- package/dist/db/schema/ai.d.ts +1 -1
- package/dist/db/schema/ai.js +1 -1
- package/dist/db/schema/billing.js +2 -2
- package/dist/db/schema/billing.js.map +1 -1
- package/dist/db/schema/identity.d.ts +4 -6
- package/dist/db/schema/identity.d.ts.map +1 -1
- package/dist/db/schema/identity.js +5 -7
- package/dist/db/schema/identity.js.map +1 -1
- package/dist/db/schema/index.d.ts +9 -9
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/index.js +16 -22
- package/dist/db/schema/index.js.map +1 -1
- package/dist/db/schema/usage.js +1 -1
- package/dist/db/validate.js +4 -4
- package/dist/db/validate.js.map +1 -1
- package/dist/db/workspace-queries.d.ts +3 -1
- package/dist/db/workspace-queries.d.ts.map +1 -1
- package/dist/db/workspace-queries.js +3 -1
- package/dist/db/workspace-queries.js.map +1 -1
- package/dist/documents/index.d.ts +4 -4
- package/dist/documents/index.js +3 -3
- package/dist/documents/service.d.ts +1 -1
- package/dist/documents/service.js +4 -4
- package/dist/email/index.d.ts +4 -4
- package/dist/email/index.js +4 -4
- package/dist/email/send.d.ts +1 -1
- package/dist/email/send.js +1 -1
- package/dist/email/senders.d.ts +1 -1
- package/dist/email/senders.js +2 -2
- package/dist/email/templates/index.d.ts +10 -10
- package/dist/email/templates/index.js +10 -10
- package/dist/email/templates/password-reset.js +1 -1
- package/dist/email/templates/payment-failed.js +1 -1
- package/dist/email/templates/quota-warning.js +1 -1
- package/dist/email/templates/subscription-confirmed.js +1 -1
- package/dist/email/templates/trial-expiry.js +1 -1
- package/dist/email/templates/trial-warning.js +1 -1
- package/dist/email/templates/verify-email.js +1 -1
- package/dist/email/templates/welcome.js +1 -1
- package/dist/email/templates/workspace-invitation.js +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +17 -7
- package/dist/env.js.map +1 -1
- package/dist/identity/audit.d.ts +1 -1
- package/dist/identity/audit.js +3 -3
- package/dist/identity/index.d.ts +3 -3
- package/dist/identity/index.js +2 -2
- package/dist/identity/service.d.ts +2 -2
- package/dist/identity/service.js +4 -4
- package/dist/identity/types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +3 -3
- package/dist/notifications/triggers.js +2 -2
- package/package.json +2 -2
- package/src/db/migrations/0041_audit_events_append_only.sql +55 -0
- package/src/db/migrations/0042_sessions_active_organization_id.sql +10 -0
- package/src/db/migrations/README.md +31 -0
- package/src/db/migrations/meta/_journal.json +14 -0
package/dist/documents/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Use via subpath import: @intelligo-dev/core/documents
|
|
9
9
|
*/
|
|
10
|
-
export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service";
|
|
11
|
-
export { DocumentServiceError, isDocumentServiceError, } from "./errors";
|
|
12
|
-
export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, } from "./classifier";
|
|
10
|
+
export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service.js";
|
|
11
|
+
export { DocumentServiceError, isDocumentServiceError, } from "./errors.js";
|
|
12
|
+
export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, } from "./classifier.js";
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This module is SERVER-ONLY. Do not import from client components.
|
|
24
24
|
*/
|
|
25
|
-
import type { DocumentActor, DocumentFilter, DocumentListItem } from "./types";
|
|
25
|
+
import type { DocumentActor, DocumentFilter, DocumentListItem } from "./types.js";
|
|
26
26
|
/**
|
|
27
27
|
* Get all documents for the actor. Ordered by most recently created
|
|
28
28
|
* first. Uses DISTINCT ON to get the latest version of each document.
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
* This module is SERVER-ONLY. Do not import from client components.
|
|
24
24
|
*/
|
|
25
25
|
import { and, desc, eq, gt } from "drizzle-orm";
|
|
26
|
-
import { db } from "../db";
|
|
27
|
-
import { documents } from "../db/schema";
|
|
28
|
-
import { classifyDocumentTitle, isProductDocument } from "./classifier";
|
|
29
|
-
import { DocumentServiceError } from "./errors";
|
|
26
|
+
import { db } from "../db/index.js";
|
|
27
|
+
import { documents } from "../db/schema/index.js";
|
|
28
|
+
import { classifyDocumentTitle, isProductDocument } from "./classifier.js";
|
|
29
|
+
import { DocumentServiceError } from "./errors.js";
|
|
30
30
|
function toListItem(doc) {
|
|
31
31
|
return {
|
|
32
32
|
id: doc.id,
|
package/dist/email/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { sendEmail, type SendEmailParams, type SendEmailWithComponentParams, type SendEmailResult, } from "./send";
|
|
2
|
-
export { getEmailProvider, resetEmailProviderCache, type EmailProvider, type EmailProviderName, type EmailSendParams, type EmailTemplateRef, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider";
|
|
3
|
-
export * from "./templates";
|
|
4
|
-
export * from "./senders";
|
|
1
|
+
export { sendEmail, type SendEmailParams, type SendEmailWithComponentParams, type SendEmailResult, } from "./send.js";
|
|
2
|
+
export { getEmailProvider, resetEmailProviderCache, type EmailProvider, type EmailProviderName, type EmailSendParams, type EmailTemplateRef, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider.js";
|
|
3
|
+
export * from "./templates/index.js";
|
|
4
|
+
export * from "./senders.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/email/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { sendEmail, } from "./send";
|
|
2
|
-
export { getEmailProvider, resetEmailProviderCache, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider";
|
|
3
|
-
export * from "./templates";
|
|
4
|
-
export * from "./senders";
|
|
1
|
+
export { sendEmail, } from "./send.js";
|
|
2
|
+
export { getEmailProvider, resetEmailProviderCache, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider.js";
|
|
3
|
+
export * from "./templates/index.js";
|
|
4
|
+
export * from "./senders.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/email/send.d.ts
CHANGED
package/dist/email/send.js
CHANGED
package/dist/email/senders.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* (quota-warning / quota-exceeded, trial-warning / trial-depleted) because
|
|
20
20
|
* template providers branch per template, not per variable.
|
|
21
21
|
*/
|
|
22
|
-
import { type SendEmailResult } from "./send";
|
|
22
|
+
import { type SendEmailResult } from "./send.js";
|
|
23
23
|
/** Send welcome email after signup (EMAIL-03) */
|
|
24
24
|
export declare function sendWelcomeEmail(params: {
|
|
25
25
|
to: string;
|
package/dist/email/senders.js
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* template providers branch per template, not per variable.
|
|
21
21
|
*/
|
|
22
22
|
import * as React from "react";
|
|
23
|
-
import { sendEmail } from "./send";
|
|
24
|
-
import { WelcomeEmail, VerifyEmailEmail, PasswordResetEmail, WorkspaceInvitationEmail, QuotaWarningEmail, TrialWarningEmail, TrialExpiryEmail, PaymentFailedEmail, SubscriptionConfirmedEmail, } from "./templates";
|
|
23
|
+
import { sendEmail } from "./send.js";
|
|
24
|
+
import { WelcomeEmail, VerifyEmailEmail, PasswordResetEmail, WorkspaceInvitationEmail, QuotaWarningEmail, TrialWarningEmail, TrialExpiryEmail, PaymentFailedEmail, SubscriptionConfirmedEmail, } from "./templates/index.js";
|
|
25
25
|
// ---------------------------------------------------------------------------
|
|
26
26
|
// Auth Emails
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { BaseLayout, type BaseLayoutProps } from "./base-layout";
|
|
2
|
-
export { WelcomeEmail, type WelcomeEmailProps } from "./welcome";
|
|
3
|
-
export { VerifyEmailEmail, type VerifyEmailEmailProps } from "./verify-email";
|
|
4
|
-
export { PasswordResetEmail, type PasswordResetEmailProps, } from "./password-reset";
|
|
5
|
-
export { WorkspaceInvitationEmail, type WorkspaceInvitationEmailProps, } from "./workspace-invitation";
|
|
6
|
-
export { QuotaWarningEmail, type QuotaWarningEmailProps, } from "./quota-warning";
|
|
7
|
-
export { TrialWarningEmail, type TrialWarningEmailProps, } from "./trial-warning";
|
|
8
|
-
export { PaymentFailedEmail, type PaymentFailedEmailProps, } from "./payment-failed";
|
|
9
|
-
export { SubscriptionConfirmedEmail, type SubscriptionConfirmedEmailProps, } from "./subscription-confirmed";
|
|
10
|
-
export { TrialExpiryEmail, type TrialExpiryEmailProps } from "./trial-expiry";
|
|
1
|
+
export { BaseLayout, type BaseLayoutProps } from "./base-layout.js";
|
|
2
|
+
export { WelcomeEmail, type WelcomeEmailProps } from "./welcome.js";
|
|
3
|
+
export { VerifyEmailEmail, type VerifyEmailEmailProps } from "./verify-email.js";
|
|
4
|
+
export { PasswordResetEmail, type PasswordResetEmailProps, } from "./password-reset.js";
|
|
5
|
+
export { WorkspaceInvitationEmail, type WorkspaceInvitationEmailProps, } from "./workspace-invitation.js";
|
|
6
|
+
export { QuotaWarningEmail, type QuotaWarningEmailProps, } from "./quota-warning.js";
|
|
7
|
+
export { TrialWarningEmail, type TrialWarningEmailProps, } from "./trial-warning.js";
|
|
8
|
+
export { PaymentFailedEmail, type PaymentFailedEmailProps, } from "./payment-failed.js";
|
|
9
|
+
export { SubscriptionConfirmedEmail, type SubscriptionConfirmedEmailProps, } from "./subscription-confirmed.js";
|
|
10
|
+
export { TrialExpiryEmail, type TrialExpiryEmailProps } from "./trial-expiry.js";
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
// All React Email templates with Intelligo branding. Each template wraps
|
|
5
5
|
// content in BaseLayout for consistent styling.
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
|
-
export { BaseLayout } from "./base-layout";
|
|
8
|
-
export { WelcomeEmail } from "./welcome";
|
|
9
|
-
export { VerifyEmailEmail } from "./verify-email";
|
|
10
|
-
export { PasswordResetEmail, } from "./password-reset";
|
|
11
|
-
export { WorkspaceInvitationEmail, } from "./workspace-invitation";
|
|
12
|
-
export { QuotaWarningEmail, } from "./quota-warning";
|
|
13
|
-
export { TrialWarningEmail, } from "./trial-warning";
|
|
14
|
-
export { PaymentFailedEmail, } from "./payment-failed";
|
|
15
|
-
export { SubscriptionConfirmedEmail, } from "./subscription-confirmed";
|
|
16
|
-
export { TrialExpiryEmail } from "./trial-expiry";
|
|
7
|
+
export { BaseLayout } from "./base-layout.js";
|
|
8
|
+
export { WelcomeEmail } from "./welcome.js";
|
|
9
|
+
export { VerifyEmailEmail } from "./verify-email.js";
|
|
10
|
+
export { PasswordResetEmail, } from "./password-reset.js";
|
|
11
|
+
export { WorkspaceInvitationEmail, } from "./workspace-invitation.js";
|
|
12
|
+
export { QuotaWarningEmail, } from "./quota-warning.js";
|
|
13
|
+
export { TrialWarningEmail, } from "./trial-warning.js";
|
|
14
|
+
export { PaymentFailedEmail, } from "./payment-failed.js";
|
|
15
|
+
export { SubscriptionConfirmedEmail, } from "./subscription-confirmed.js";
|
|
16
|
+
export { TrialExpiryEmail } from "./trial-expiry.js";
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function PasswordResetEmail({ userName, resetUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function PaymentFailedEmail({ workspaceName, amount, updatePaymentUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function QuotaWarningEmail({ workspaceName, percentageUsed, tokensUsed, tokensLimit, upgradeUrl, isExceeded, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function SubscriptionConfirmedEmail({ workspaceName, planName, amount, dashboardUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function TrialExpiryEmail({ workspaceName, expiryDate, daysRemaining, upgradeUrl, locale = "en", }) {
|
|
5
5
|
const isExpired = daysRemaining <= 0;
|
|
6
6
|
const isUrgent = daysRemaining <= 1 && daysRemaining > 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function TrialWarningEmail({ workspaceName, creditsRemaining, totalCredits, percentageRemaining, upgradeUrl, isDepleted, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function VerifyEmailEmail({ userName, verificationUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function WelcomeEmail({ userName, dashboardUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Section, Text } from "@react-email/components";
|
|
3
|
-
import { BaseLayout } from "./base-layout";
|
|
3
|
+
import { BaseLayout } from "./base-layout.js";
|
|
4
4
|
export function WorkspaceInvitationEmail({ inviterName, workspaceName, role, acceptUrl, declineUrl, locale = "en", }) {
|
|
5
5
|
const text = locale === "mn"
|
|
6
6
|
? {
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA4EH,wBAAgB,WAAW,IAAI;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CA4DA;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAgBhC"}
|
package/dist/env.js
CHANGED
|
@@ -15,9 +15,9 @@ const ENV_VARS = [
|
|
|
15
15
|
description: "PostgreSQL connection string",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
name: "
|
|
18
|
+
name: "BETTER_AUTH_SECRET",
|
|
19
19
|
required: true,
|
|
20
|
-
description: "Better-Auth session encryption key",
|
|
20
|
+
description: "Better-Auth session encryption key (AUTH_SECRET is accepted as a legacy alias)",
|
|
21
21
|
minLength: 32,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -75,7 +75,16 @@ export function validateEnv() {
|
|
|
75
75
|
const errors = [];
|
|
76
76
|
const warnings = [];
|
|
77
77
|
for (const envVar of ENV_VARS) {
|
|
78
|
-
|
|
78
|
+
let value = process.env[envVar.name];
|
|
79
|
+
// One canonical name for the auth secret. Better-Auth itself reads
|
|
80
|
+
// BETTER_AUTH_SECRET then AUTH_SECRET; the CLI's doctor, the
|
|
81
|
+
// scaffold and this validator agree on the former.
|
|
82
|
+
if (envVar.name === "BETTER_AUTH_SECRET" &&
|
|
83
|
+
!value &&
|
|
84
|
+
process.env.AUTH_SECRET) {
|
|
85
|
+
value = process.env.AUTH_SECRET;
|
|
86
|
+
warnings.push("AUTH_SECRET is set but BETTER_AUTH_SECRET is not — rename it; AUTH_SECRET is a legacy alias");
|
|
87
|
+
}
|
|
79
88
|
if (!value || value.trim() === "") {
|
|
80
89
|
if (envVar.required) {
|
|
81
90
|
errors.push(`Missing required env var: ${envVar.name} — ${envVar.description}`);
|
|
@@ -101,10 +110,11 @@ export function validateEnv() {
|
|
|
101
110
|
warnings.push("STRIPE_SECRET_KEY is a test key in production environment");
|
|
102
111
|
}
|
|
103
112
|
if (!process.env.CRON_SECRET || process.env.CRON_SECRET.length < 32) {
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
|
|
113
|
+
// A warning, not an error: the framework ships no cron route of
|
|
114
|
+
// its own, so a deployment without one has nothing to protect.
|
|
115
|
+
// The maintenance route (`intelligo add maintenance`) refuses to
|
|
116
|
+
// serve without it.
|
|
117
|
+
warnings.push("CRON_SECRET unset or shorter than 32 chars — required by any /api/cron/* route you mount");
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
return { valid: errors.length === 0, errors, warnings };
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,MAAM,QAAQ,GAAa;IACzB;QACE,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,8BAA8B;KAC5C;IACD;QACE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"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"}
|
package/dist/identity/audit.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Not re-exported from `./index.ts`: it is this module's own
|
|
23
23
|
* implementation detail, not identity's public API.
|
|
24
24
|
*/
|
|
25
|
-
import type { AuditTargetKind, AuditAction, AuditActorKind, UserMemoryAuditRow } from "../db/schema";
|
|
25
|
+
import type { AuditTargetKind, AuditAction, AuditActorKind, UserMemoryAuditRow } from "../db/schema/index.js";
|
|
26
26
|
export type RecordMemoryAuditInput = {
|
|
27
27
|
userId: string;
|
|
28
28
|
workspaceId: string;
|
package/dist/identity/audit.js
CHANGED
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
* Not re-exported from `./index.ts`: it is this module's own
|
|
23
23
|
* implementation detail, not identity's public API.
|
|
24
24
|
*/
|
|
25
|
-
import { db } from "../db";
|
|
26
|
-
import { userMemoryAudit } from "../db/schema";
|
|
27
|
-
import { IdentityServiceError } from "./errors";
|
|
25
|
+
import { db } from "../db/index.js";
|
|
26
|
+
import { userMemoryAudit } from "../db/schema/index.js";
|
|
27
|
+
import { IdentityServiceError } from "./errors.js";
|
|
28
28
|
export async function recordMemoryAudit(input) {
|
|
29
29
|
const [row] = await db
|
|
30
30
|
.insert(userMemoryAudit)
|
package/dist/identity/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Use via subpath import: @intelligo-dev/core/identity
|
|
12
12
|
*/
|
|
13
|
-
export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service";
|
|
14
|
-
export { IdentityServiceError, isIdentityServiceError, type IdentityServiceErrorCode, } from "./errors";
|
|
15
|
-
export type { IdentityActor, IdentityExport, UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow, } from "./types";
|
|
13
|
+
export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service.js";
|
|
14
|
+
export { IdentityServiceError, isIdentityServiceError, type IdentityServiceErrorCode, } from "./errors.js";
|
|
15
|
+
export type { IdentityActor, IdentityExport, UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow, } from "./types.js";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/identity/index.js
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Use via subpath import: @intelligo-dev/core/identity
|
|
12
12
|
*/
|
|
13
|
-
export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service";
|
|
14
|
-
export { IdentityServiceError, isIdentityServiceError, } from "./errors";
|
|
13
|
+
export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service.js";
|
|
14
|
+
export { IdentityServiceError, isIdentityServiceError, } from "./errors.js";
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
*
|
|
42
42
|
* This module is SERVER-ONLY. Do not import from client components.
|
|
43
43
|
*/
|
|
44
|
-
import type { UserFact, UserMemoryAuditRow } from "../db/schema";
|
|
45
|
-
import type { IdentityActor, IdentityExport } from "./types";
|
|
44
|
+
import type { UserFact, UserMemoryAuditRow } from "../db/schema/index.js";
|
|
45
|
+
import type { IdentityActor, IdentityExport } from "./types.js";
|
|
46
46
|
/** List the actor's facts, most important and most confident first. */
|
|
47
47
|
export declare function listFacts(actor: IdentityActor): Promise<UserFact[]>;
|
|
48
48
|
/**
|
package/dist/identity/service.js
CHANGED
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
* This module is SERVER-ONLY. Do not import from client components.
|
|
43
43
|
*/
|
|
44
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";
|
|
45
|
+
import { db } from "../db/index.js";
|
|
46
|
+
import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema/index.js";
|
|
47
|
+
import { recordMemoryAudit } from "./audit.js";
|
|
48
|
+
import { IdentityServiceError } from "./errors.js";
|
|
49
49
|
// ---------------------------------------------------------------------------
|
|
50
50
|
// Internal helpers
|
|
51
51
|
// ---------------------------------------------------------------------------
|
package/dist/identity/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared types for the identity service.
|
|
3
3
|
*/
|
|
4
|
-
import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema";
|
|
4
|
+
import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema/index.js";
|
|
5
5
|
export type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow };
|
|
6
6
|
/** Resolved actor identity — every query is scoped to this pair. */
|
|
7
7
|
export type IdentityActor = {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const version = "0.0.0";
|
|
2
2
|
// Re-export database client
|
|
3
|
-
export * from "./db";
|
|
3
|
+
export * from "./db/index.js";
|
|
4
4
|
// Email module -- use subpath import: @intelligo-dev/core/email
|
|
5
5
|
// Notifications module -- use subpath import: @intelligo-dev/core/notifications
|
|
6
6
|
// Conversations module -- use subpath import: @intelligo-dev/core/conversations
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* Notifications are user-scoped (not workspace-scoped) so a user can see
|
|
9
9
|
* all their notifications across workspaces.
|
|
10
10
|
*/
|
|
11
|
-
import type { CreateNotificationParams } from "./types";
|
|
12
|
-
export type { NotificationType, CreateNotificationParams } from "./types";
|
|
13
|
-
export { triggerQuotaNotification, triggerTrialNotification, triggerPaymentFailedNotification, triggerTeamMemberJoinedNotification, } from "./triggers";
|
|
11
|
+
import type { CreateNotificationParams } from "./types.js";
|
|
12
|
+
export type { NotificationType, CreateNotificationParams } from "./types.js";
|
|
13
|
+
export { triggerQuotaNotification, triggerTrialNotification, triggerPaymentFailedNotification, triggerTeamMemberJoinedNotification, } from "./triggers.js";
|
|
14
14
|
/**
|
|
15
15
|
* Create a new notification for a user
|
|
16
16
|
*
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* Notifications are user-scoped (not workspace-scoped) so a user can see
|
|
9
9
|
* all their notifications across workspaces.
|
|
10
10
|
*/
|
|
11
|
-
import { db } from "../db";
|
|
12
|
-
import { notifications } from "../db/schema";
|
|
11
|
+
import { db } from "../db/index.js";
|
|
12
|
+
import { notifications } from "../db/schema/index.js";
|
|
13
13
|
import { eq, and, desc, count } from "drizzle-orm";
|
|
14
14
|
// Re-export trigger functions
|
|
15
|
-
export { triggerQuotaNotification, triggerTrialNotification, triggerPaymentFailedNotification, triggerTeamMemberJoinedNotification, } from "./triggers";
|
|
15
|
+
export { triggerQuotaNotification, triggerTrialNotification, triggerPaymentFailedNotification, triggerTeamMemberJoinedNotification, } from "./triggers.js";
|
|
16
16
|
/**
|
|
17
17
|
* Create a new notification for a user
|
|
18
18
|
*
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* - Payment failed trigger is called by billing email triggers
|
|
17
17
|
* - Team member joined trigger is called by server actions
|
|
18
18
|
*/
|
|
19
|
-
import { createNotification } from "./index";
|
|
20
|
-
import { sendQuotaWarningEmail, sendTrialWarningEmail, sendPaymentFailedEmail, } from "../email/senders";
|
|
19
|
+
import { createNotification } from "./index.js";
|
|
20
|
+
import { sendQuotaWarningEmail, sendTrialWarningEmail, sendPaymentFailedEmail, } from "../email/senders.js";
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
22
22
|
// Quota Notifications (QUOTA-08, QUOTA-09)
|
|
23
23
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intelligo-dev/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -96,6 +96,6 @@
|
|
|
96
96
|
"db:studio": "drizzle-kit studio",
|
|
97
97
|
"db:push": "drizzle-kit push",
|
|
98
98
|
"db:check": "tsx scripts/check-db.ts",
|
|
99
|
-
"build": "tsc -p tsconfig.build.json"
|
|
99
|
+
"build": "tsc -p tsconfig.build.json && node ../../scripts/fix-esm-extensions.mjs dist"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
-- audit_events becomes what its package name promises.
|
|
2
|
+
--
|
|
3
|
+
-- Two gaps between the contract ("append-only who-did-what") and the
|
|
4
|
+
-- table 0036 created:
|
|
5
|
+
-- 1. Nothing at the database level stopped UPDATE/DELETE. The guard
|
|
6
|
+
-- user_memory_audit has had since 0018 (P0001 raise_exception,
|
|
7
|
+
-- PII-free message) is applied here too.
|
|
8
|
+
-- 2. workspace_id cascaded on organization delete, erasing a
|
|
9
|
+
-- workspace's whole trail with the workspace. It is now SET NULL:
|
|
10
|
+
-- the row survives with its actor, action and resource intact.
|
|
11
|
+
|
|
12
|
+
-- The one UPDATE that must pass is the database's own: ON DELETE SET
|
|
13
|
+
-- NULL on workspace_id / actor_id is executed as an UPDATE of this row,
|
|
14
|
+
-- so a trigger that refuses every UPDATE would make a workspace (or a
|
|
15
|
+
-- user) with any audit history undeletable. An update that only clears
|
|
16
|
+
-- one or both of those references, and touches nothing else, is
|
|
17
|
+
-- allowed; every other UPDATE, and every DELETE, is refused.
|
|
18
|
+
CREATE OR REPLACE FUNCTION public.audit_events_block_mutation()
|
|
19
|
+
RETURNS trigger AS $$
|
|
20
|
+
BEGIN
|
|
21
|
+
IF TG_OP = 'UPDATE'
|
|
22
|
+
AND (NEW.workspace_id IS NULL OR NEW.workspace_id = OLD.workspace_id)
|
|
23
|
+
AND (NEW.actor_id IS NULL OR NEW.actor_id = OLD.actor_id)
|
|
24
|
+
AND (NEW.workspace_id IS DISTINCT FROM OLD.workspace_id OR NEW.actor_id IS DISTINCT FROM OLD.actor_id)
|
|
25
|
+
AND NEW.id = OLD.id
|
|
26
|
+
AND NEW.actor_kind = OLD.actor_kind
|
|
27
|
+
AND NEW.action = OLD.action
|
|
28
|
+
AND NEW.resource_kind = OLD.resource_kind
|
|
29
|
+
AND NEW.resource_id IS NOT DISTINCT FROM OLD.resource_id
|
|
30
|
+
AND NEW.outcome = OLD.outcome
|
|
31
|
+
AND NEW.metadata IS NOT DISTINCT FROM OLD.metadata
|
|
32
|
+
AND NEW.created_at = OLD.created_at
|
|
33
|
+
THEN
|
|
34
|
+
RETURN NEW;
|
|
35
|
+
END IF;
|
|
36
|
+
RAISE EXCEPTION 'audit_events is append-only'
|
|
37
|
+
USING ERRCODE = 'P0001', HINT = 'INSERT new audit rows; do not UPDATE or DELETE existing ones.';
|
|
38
|
+
END;
|
|
39
|
+
$$ LANGUAGE plpgsql;
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
DROP TRIGGER IF EXISTS audit_events_no_update ON "audit_events";
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
CREATE TRIGGER audit_events_no_update
|
|
44
|
+
BEFORE UPDATE ON "audit_events"
|
|
45
|
+
FOR EACH ROW EXECUTE FUNCTION public.audit_events_block_mutation();
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
DROP TRIGGER IF EXISTS audit_events_no_delete ON "audit_events";
|
|
48
|
+
--> statement-breakpoint
|
|
49
|
+
CREATE TRIGGER audit_events_no_delete
|
|
50
|
+
BEFORE DELETE ON "audit_events"
|
|
51
|
+
FOR EACH ROW EXECUTE FUNCTION public.audit_events_block_mutation();
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
ALTER TABLE "audit_events" DROP CONSTRAINT IF EXISTS "audit_events_workspace_id_organization_id_fk";
|
|
54
|
+
--> statement-breakpoint
|
|
55
|
+
ALTER TABLE "audit_events" ADD CONSTRAINT "audit_events_workspace_id_organization_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."organization"("id") ON DELETE set null ON UPDATE no action;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- sessions.active_organization_id — the workspace a session last
|
|
2
|
+
-- switched to (Better-Auth's organization plugin; @intelligo-dev/auth
|
|
3
|
+
-- reads it for workspace switching). schema/auth.ts has carried the
|
|
4
|
+
-- column for months, but no migration ever created it: every
|
|
5
|
+
-- environment was provisioned by `db:push`, so the gap surfaced only
|
|
6
|
+
-- when a database was built from this chain and the first sign-in
|
|
7
|
+
-- failed inserting a session.
|
|
8
|
+
--
|
|
9
|
+
-- IF NOT EXISTS, because every pushed database already has it.
|
|
10
|
+
ALTER TABLE "sessions" ADD COLUMN IF NOT EXISTS "active_organization_id" text;
|
|
@@ -13,6 +13,37 @@ That is how `0032` shipped documenting a unique constraint on a
|
|
|
13
13
|
files. `0037` repairs it, and `intelligo doctor` now fails CI if the
|
|
14
14
|
journal and the directory drift apart again.
|
|
15
15
|
|
|
16
|
+
## In a consumer application
|
|
17
|
+
|
|
18
|
+
This directory ships inside the published package (it is in `files`,
|
|
19
|
+
next to `dist`), and `intelligo migrate` applies it: it resolves the
|
|
20
|
+
chain from `node_modules/@intelligo-dev/core/src/db/migrations`, runs
|
|
21
|
+
drizzle's migrator over it in journal order, and records what it applied
|
|
22
|
+
in the default `drizzle.__drizzle_migrations` table — the same table
|
|
23
|
+
`intelligo migrate --check` reads. On a database that already has the
|
|
24
|
+
framework's tables but no records (one provisioned with `db:push`) it
|
|
25
|
+
refuses and points here; baseline first, below.
|
|
26
|
+
|
|
27
|
+
The tables an application owns are a second chain, kept apart on
|
|
28
|
+
purpose: drizzle-kit applies by timestamp, so a framework migration
|
|
29
|
+
published after the consumer generated one of theirs would be skipped
|
|
30
|
+
silently if the two shared a journal. `intelligo create` scaffolds a
|
|
31
|
+
`drizzle.config.ts` whose `schema` lists only the consumer's files,
|
|
32
|
+
whose `out` is the app's own `./drizzle`, and whose `migrations.table`
|
|
33
|
+
is `__app_migrations`. A consumer schema file may `references()` a
|
|
34
|
+
framework table — drizzle-kit emits the foreign key by name and does
|
|
35
|
+
not try to create the referenced table. The scaffold's scripts:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
pnpm db:generate # drizzle-kit generate — your chain
|
|
39
|
+
pnpm db:migrate # intelligo migrate && drizzle-kit migrate
|
|
40
|
+
pnpm db:check # intelligo migrate --check — deploy gate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`drizzle-kit push` has no place in this layout: it diffs the whole
|
|
44
|
+
database against the schema it can see, and the consumer config sees
|
|
45
|
+
only the consumer's tables.
|
|
46
|
+
|
|
16
47
|
## Adding a migration
|
|
17
48
|
|
|
18
49
|
Prefer `pnpm --filter @intelligo-dev/core db:generate`, which writes both
|
|
@@ -295,6 +295,20 @@
|
|
|
295
295
|
"when": 1700000041000,
|
|
296
296
|
"tag": "0040_ee_audit_chain",
|
|
297
297
|
"breakpoints": true
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"idx": 42,
|
|
301
|
+
"version": "7",
|
|
302
|
+
"when": 1788096433043,
|
|
303
|
+
"tag": "0041_audit_events_append_only",
|
|
304
|
+
"breakpoints": true
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"idx": 43,
|
|
308
|
+
"version": "7",
|
|
309
|
+
"when": 1788180862360,
|
|
310
|
+
"tag": "0042_sessions_active_organization_id",
|
|
311
|
+
"breakpoints": true
|
|
298
312
|
}
|
|
299
313
|
]
|
|
300
314
|
}
|