@agenticmail/enterprise 0.5.17 → 0.5.18
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/chunk-5M2VVNE5.js +48 -0
- package/dist/chunk-76X3FKF5.js +898 -0
- package/dist/chunk-XNN7WCIP.js +1987 -0
- package/dist/cli-recover-UHALNDIN.js +97 -0
- package/dist/cli-verify-CN5WNXQI.js +98 -0
- package/dist/cli.js +3 -3
- package/dist/dashboard/app.js +2 -2
- package/dist/dashboard/components/utils.js +14 -7
- package/dist/dashboard/pages/settings.js +2 -2
- package/dist/factory-5C7EC3SE.js +9 -0
- package/dist/index.js +3 -3
- package/dist/postgres-KG3QMSFU.js +587 -0
- package/dist/server-E5KEUNLI.js +11 -0
- package/dist/setup-HAVYNSWT.js +20 -0
- package/package.json +1 -1
- package/src/dashboard/app.js +2 -2
- package/src/dashboard/components/utils.js +14 -7
- package/src/dashboard/pages/settings.js +2 -2
- package/src/db/adapter.ts +1 -0
- package/src/db/postgres.ts +6 -2
- package/src/setup/provision.ts +14 -3
package/src/db/adapter.ts
CHANGED
package/src/db/postgres.ts
CHANGED
|
@@ -97,6 +97,10 @@ export class PostgresAdapter extends DatabaseAdapter {
|
|
|
97
97
|
INSERT INTO retention_policy (id) VALUES ('default')
|
|
98
98
|
ON CONFLICT (id) DO NOTHING
|
|
99
99
|
`);
|
|
100
|
+
// Add org_id column if missing
|
|
101
|
+
await client.query(`
|
|
102
|
+
ALTER TABLE company_settings ADD COLUMN IF NOT EXISTS org_id TEXT
|
|
103
|
+
`).catch(() => {});
|
|
100
104
|
await client.query('COMMIT');
|
|
101
105
|
} catch (err) {
|
|
102
106
|
await client.query('ROLLBACK');
|
|
@@ -126,7 +130,7 @@ export class PostgresAdapter extends DatabaseAdapter {
|
|
|
126
130
|
const values: any[] = [];
|
|
127
131
|
let i = 1;
|
|
128
132
|
const map: Record<string, string> = {
|
|
129
|
-
name: 'name', domain: 'domain', subdomain: 'subdomain',
|
|
133
|
+
name: 'name', orgId: 'org_id', domain: 'domain', subdomain: 'subdomain',
|
|
130
134
|
smtpHost: 'smtp_host', smtpPort: 'smtp_port', smtpUser: 'smtp_user',
|
|
131
135
|
smtpPass: 'smtp_pass', dkimPrivateKey: 'dkim_private_key',
|
|
132
136
|
logoUrl: 'logo_url', primaryColor: 'primary_color', plan: 'plan',
|
|
@@ -526,7 +530,7 @@ export class PostgresAdapter extends DatabaseAdapter {
|
|
|
526
530
|
|
|
527
531
|
private mapSettings(r: any): CompanySettings {
|
|
528
532
|
return {
|
|
529
|
-
id: r.id, name: r.name, domain: r.domain, subdomain: r.subdomain,
|
|
533
|
+
id: r.id, orgId: r.org_id || undefined, name: r.name, domain: r.domain, subdomain: r.subdomain,
|
|
530
534
|
smtpHost: r.smtp_host, smtpPort: r.smtp_port, smtpUser: r.smtp_user, smtpPass: r.smtp_pass,
|
|
531
535
|
dkimPrivateKey: r.dkim_private_key, logoUrl: r.logo_url, primaryColor: r.primary_color,
|
|
532
536
|
ssoConfig: r.sso_config ? (typeof r.sso_config === 'string' ? JSON.parse(r.sso_config) : r.sso_config) : undefined,
|
package/src/setup/provision.ts
CHANGED
|
@@ -6,8 +6,17 @@
|
|
|
6
6
|
* after all prompts are collected.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { randomUUID } from 'crypto';
|
|
9
|
+
import { randomUUID, randomBytes } from 'crypto';
|
|
10
10
|
import type { DatabaseAdapter } from '../db/adapter.js';
|
|
11
|
+
|
|
12
|
+
/** Generate a unique 10-char org ID like "BKSID30HKS" */
|
|
13
|
+
function generateOrgId(): string {
|
|
14
|
+
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
|
15
|
+
const bytes = randomBytes(10);
|
|
16
|
+
let id = '';
|
|
17
|
+
for (let i = 0; i < 10; i++) id += chars[bytes[i] % chars.length];
|
|
18
|
+
return id;
|
|
19
|
+
}
|
|
11
20
|
import type { CompanyInfo } from './company.js';
|
|
12
21
|
import type { DatabaseSelection } from './database.js';
|
|
13
22
|
import type { DeployTarget } from './deployment.js';
|
|
@@ -72,12 +81,14 @@ export async function provision(
|
|
|
72
81
|
|
|
73
82
|
// ─── Company Settings ──────────────────────────
|
|
74
83
|
spinner.start('Creating company...');
|
|
84
|
+
const orgId = generateOrgId();
|
|
75
85
|
await db.updateSettings({
|
|
76
86
|
name: config.company.companyName,
|
|
77
87
|
subdomain: config.company.subdomain,
|
|
78
88
|
domain: config.domain.customDomain,
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
orgId,
|
|
90
|
+
} as any);
|
|
91
|
+
spinner.succeed(`Company created (org: ${orgId})`);
|
|
81
92
|
|
|
82
93
|
// ─── Domain Registration ─────────────────────────
|
|
83
94
|
if (config.registration?.registered) {
|