@fonoster/apiserver 0.40.0 → 0.44.0
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/applications/session/appModel.d.ts +50 -137
- package/dist/applications/session/appModel.js +10 -12
- package/dist/bin/owner.d.ts +2 -0
- package/dist/bin/owner.js +105 -0
- package/dist/config/schema.d.ts +158 -1777
- package/dist/config/schema.js +18 -18
- package/dist/envs.d.ts +45 -48
- package/dist/envs.js +12 -16
- package/dist/index.js +0 -9
- package/dist/regions/natsJwt.js +1 -1
- package/dist/usage/createGetUsage.d.ts +16 -0
- package/dist/usage/createGetUsage.js +6 -2
- package/dist/voice/stt/Deepgram.js +1 -1
- package/package.json +13 -12
package/dist/config/schema.js
CHANGED
|
@@ -32,10 +32,10 @@ const featuresSchema = zod_1.z
|
|
|
32
32
|
/** The billing service's Billing API (host:port); defaults to authz.host:50073. */
|
|
33
33
|
address: zod_1.z.string().min(1).optional()
|
|
34
34
|
})
|
|
35
|
-
.
|
|
35
|
+
.prefault({}),
|
|
36
36
|
costs: zod_1.z
|
|
37
37
|
.object({ display: zod_1.z.enum(["none", "usage", "prices"]).default("usage") })
|
|
38
|
-
.
|
|
38
|
+
.prefault({}),
|
|
39
39
|
calls: zod_1.z
|
|
40
40
|
.object({
|
|
41
41
|
transcripts: zod_1.z
|
|
@@ -43,10 +43,10 @@ const featuresSchema = zod_1.z
|
|
|
43
43
|
store: zod_1.z.boolean().default(true),
|
|
44
44
|
retentionDays: zod_1.z.number().int().positive().default(30)
|
|
45
45
|
})
|
|
46
|
-
.
|
|
47
|
-
recordings: zod_1.z.object({ store: zod_1.z.boolean().default(false) }).
|
|
46
|
+
.prefault({}),
|
|
47
|
+
recordings: zod_1.z.object({ store: zod_1.z.boolean().default(false) }).prefault({})
|
|
48
48
|
})
|
|
49
|
-
.
|
|
49
|
+
.prefault({}),
|
|
50
50
|
/**
|
|
51
51
|
* SIP names (trunk inbound URIs, domains): "domain" requires one DNS label
|
|
52
52
|
* under `sip.<domain>` (carriers and phones reach a wildcard `*.sip.<domain>`);
|
|
@@ -54,9 +54,9 @@ const featuresSchema = zod_1.z
|
|
|
54
54
|
*/
|
|
55
55
|
sip: zod_1.z
|
|
56
56
|
.object({ names: zod_1.z.enum(["domain", "any"]).default("domain") })
|
|
57
|
-
.
|
|
57
|
+
.prefault({})
|
|
58
58
|
})
|
|
59
|
-
.
|
|
59
|
+
.prefault({});
|
|
60
60
|
exports.featuresSchema = featuresSchema;
|
|
61
61
|
/** Where call records live (add-call-record): a directory, or S3-compatible storage. */
|
|
62
62
|
const recordStoreSchema = zod_1.z.union([
|
|
@@ -89,7 +89,7 @@ const callRecordsSchema = zod_1.z
|
|
|
89
89
|
retentionIntervalMinutes: zod_1.z.number().int().positive().default(60),
|
|
90
90
|
maintenanceTimeoutMs: zod_1.z.number().int().positive().default(30000)
|
|
91
91
|
})
|
|
92
|
-
.
|
|
92
|
+
.prefault({});
|
|
93
93
|
/**
|
|
94
94
|
* Session apps (voice-session G2): the hosted Autopilot that Autopilot apps point at, and the
|
|
95
95
|
* secret AppBridge signs their sessions with (the hosted Autopilot verifies one secret for every
|
|
@@ -107,7 +107,7 @@ const sessionAppsSchema = zod_1.z
|
|
|
107
107
|
*/
|
|
108
108
|
allowedDestinations: zod_1.z.array(zod_1.z.string().min(1)).optional()
|
|
109
109
|
})
|
|
110
|
-
.
|
|
110
|
+
.prefault({});
|
|
111
111
|
/**
|
|
112
112
|
* The provider catalog file (add-self-host-installer D7): applied to the registry tables on
|
|
113
113
|
* every start with `fonoster-registry apply --store database` semantics. Listed entries are added
|
|
@@ -127,8 +127,8 @@ const catalogSchema = zod_1.z
|
|
|
127
127
|
* workspace has no key of its own for the provider. Values take `secret://` references (D8).
|
|
128
128
|
*/
|
|
129
129
|
const evaluationsSchema = zod_1.z
|
|
130
|
-
.object({ credentials: zod_1.z.record(zod_1.z.string().min(1)).
|
|
131
|
-
.
|
|
130
|
+
.object({ credentials: zod_1.z.record(zod_1.z.string(), zod_1.z.string().min(1)).prefault({}) })
|
|
131
|
+
.prefault({});
|
|
132
132
|
/**
|
|
133
133
|
* Workspace webhooks fan-out (add-workspace-webhooks 2.2): events producers publish on the bus
|
|
134
134
|
* (`webhooks.events`) are delivered from here.
|
|
@@ -139,7 +139,7 @@ const webhooksSchema = zod_1.z
|
|
|
139
139
|
intervalMs: zod_1.z.number().int().positive().default(1000),
|
|
140
140
|
refreshMs: zod_1.z.number().int().positive().default(10000)
|
|
141
141
|
})
|
|
142
|
-
.
|
|
142
|
+
.prefault({});
|
|
143
143
|
/**
|
|
144
144
|
* Regions (add-private-regions). Public regions come from data (PR-10); private regions need the
|
|
145
145
|
* region-signing key (ES256 PEM) and the region hub (NATS in operator mode, RG-B2), both generated
|
|
@@ -213,12 +213,12 @@ const regionsSchema = zod_1.z
|
|
|
213
213
|
/** Relays in flight per region (HTTP 429 beyond). */
|
|
214
214
|
maxConcurrent: zod_1.z.number().int().positive().default(8)
|
|
215
215
|
})
|
|
216
|
-
.
|
|
216
|
+
.prefault({}),
|
|
217
217
|
/** The release cells are measured against (default: this apiserver's version). */
|
|
218
218
|
currentVersion: zod_1.z.string().optional(),
|
|
219
219
|
configDebounceMs: zod_1.z.number().int().nonnegative().default(500)
|
|
220
220
|
})
|
|
221
|
-
.
|
|
221
|
+
.prefault({});
|
|
222
222
|
/** fonoster.yaml: everything the API server (and embedded Identity) needs. */
|
|
223
223
|
const fonosterConfigSchema = zod_1.z
|
|
224
224
|
.object({
|
|
@@ -235,7 +235,7 @@ const fonosterConfigSchema = zod_1.z
|
|
|
235
235
|
/** How other services reach this one. */
|
|
236
236
|
host: zod_1.z.string().default("apiserver")
|
|
237
237
|
})
|
|
238
|
-
.
|
|
238
|
+
.prefault({}),
|
|
239
239
|
logs: common_1.logsSchema,
|
|
240
240
|
/** OTLP export (empty = off): `otlpEndpoint: "${OTEL_EXPORTER_OTLP_ENDPOINT:-}"`. */
|
|
241
241
|
telemetry: common_1.telemetrySchema,
|
|
@@ -251,7 +251,7 @@ const fonosterConfigSchema = zod_1.z
|
|
|
251
251
|
.array(zod_1.z.string().min(1))
|
|
252
252
|
.default(["/fonoster.calls.v1beta2.Calls/CreateCall"])
|
|
253
253
|
})
|
|
254
|
-
.
|
|
254
|
+
.prefault({}),
|
|
255
255
|
features: featuresSchema,
|
|
256
256
|
routr: zod_1.z
|
|
257
257
|
.object({
|
|
@@ -272,9 +272,9 @@ const fonosterConfigSchema = zod_1.z
|
|
|
272
272
|
username: zod_1.z.string().default("roomr"),
|
|
273
273
|
password: zod_1.z.string().optional()
|
|
274
274
|
})
|
|
275
|
-
.
|
|
275
|
+
.prefault({})
|
|
276
276
|
})
|
|
277
|
-
.
|
|
277
|
+
.prefault({}),
|
|
278
278
|
// user/password: the apiserver's NATS user when the server has per-service users
|
|
279
279
|
// (add-platform 4.1); password is usually a secret:// reference.
|
|
280
280
|
nats: zod_1.z.object({
|
package/dist/envs.d.ts
CHANGED
|
@@ -49,14 +49,14 @@ export declare const AUTHZ_SERVICE_HOST: string;
|
|
|
49
49
|
export declare const AUTHZ_SERVICE_PORT: number;
|
|
50
50
|
export declare const AUTHZ_SERVICE_METHODS: string[];
|
|
51
51
|
export declare const EVALUATIONS: {
|
|
52
|
-
credentials
|
|
52
|
+
credentials: Record<string, string>;
|
|
53
53
|
};
|
|
54
54
|
export declare const NATS_URL: string;
|
|
55
55
|
/** The `nats` setting itself (URL, user, password), for helpers that take a NatsTarget. */
|
|
56
56
|
export declare const NATS_CONNECTION: {
|
|
57
|
-
url
|
|
58
|
-
password?: string;
|
|
57
|
+
url: string;
|
|
59
58
|
user?: string;
|
|
59
|
+
password?: string;
|
|
60
60
|
};
|
|
61
61
|
/** nats.js connect options: the URL plus the apiserver's NATS user, when set (add-platform 4.1). */
|
|
62
62
|
export declare const NATS: {
|
|
@@ -65,14 +65,11 @@ export declare const NATS: {
|
|
|
65
65
|
pass?: string;
|
|
66
66
|
inboxPrefix?: string;
|
|
67
67
|
};
|
|
68
|
-
export declare const OWNER_EMAIL: string;
|
|
69
|
-
export declare const OWNER_NAME: string;
|
|
70
|
-
export declare const OWNER_PASSWORD: string;
|
|
71
68
|
export declare const ROUTR_API_ENDPOINT: string;
|
|
72
69
|
export declare const ROUTR_ROOMR_PEER: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
username
|
|
70
|
+
aor: string;
|
|
71
|
+
name: string;
|
|
72
|
+
username: string;
|
|
76
73
|
password?: string;
|
|
77
74
|
};
|
|
78
75
|
/** Routr's SIP address: API-originated calls are dialed through it (Roomr CreateCall). */
|
|
@@ -88,79 +85,79 @@ export declare const TWILIO_ACCOUNT_SID: string;
|
|
|
88
85
|
export declare const TWILIO_AUTH_TOKEN: string;
|
|
89
86
|
export declare const TWILIO_PHONE_NUMBER: string;
|
|
90
87
|
export declare const CALL_RECORDS: {
|
|
91
|
-
enabled
|
|
92
|
-
stores
|
|
93
|
-
dir
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
stores: ({
|
|
90
|
+
dir: string;
|
|
94
91
|
} | {
|
|
95
|
-
s3
|
|
96
|
-
bucket
|
|
92
|
+
s3: {
|
|
93
|
+
bucket: string;
|
|
97
94
|
prefix?: string;
|
|
98
95
|
region?: string;
|
|
99
96
|
endpoint?: string;
|
|
100
97
|
forcePathStyle?: boolean;
|
|
101
98
|
credentials?: {
|
|
102
|
-
accessKeyId
|
|
103
|
-
secretAccessKey
|
|
99
|
+
accessKeyId: string;
|
|
100
|
+
secretAccessKey: string;
|
|
104
101
|
};
|
|
105
102
|
};
|
|
106
103
|
})[];
|
|
107
|
-
retentionIntervalMinutes
|
|
108
|
-
maintenanceTimeoutMs
|
|
104
|
+
retentionIntervalMinutes: number;
|
|
105
|
+
maintenanceTimeoutMs: number;
|
|
109
106
|
};
|
|
110
107
|
export declare const SESSION_APPS: {
|
|
111
|
-
autopilotUrl
|
|
108
|
+
autopilotUrl: string;
|
|
109
|
+
allowInsecureWebhooks: boolean;
|
|
112
110
|
autopilotSigningSecret?: string;
|
|
113
|
-
allowInsecureWebhooks?: boolean;
|
|
114
111
|
allowedDestinations?: string[];
|
|
115
112
|
};
|
|
116
113
|
export declare const WEBHOOKS: {
|
|
117
|
-
fanout
|
|
118
|
-
intervalMs
|
|
119
|
-
refreshMs
|
|
114
|
+
fanout: boolean;
|
|
115
|
+
intervalMs: number;
|
|
116
|
+
refreshMs: number;
|
|
120
117
|
};
|
|
121
118
|
export declare const REGIONS: {
|
|
122
|
-
public
|
|
123
|
-
id
|
|
124
|
-
name
|
|
119
|
+
public: {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
125
122
|
default?: boolean;
|
|
126
123
|
endpoints?: {
|
|
127
|
-
sip
|
|
128
|
-
host
|
|
129
|
-
port
|
|
130
|
-
transport
|
|
124
|
+
sip: {
|
|
125
|
+
host: string;
|
|
126
|
+
port: number;
|
|
127
|
+
transport: "udp" | "tcp" | "tls" | "ws" | "wss";
|
|
131
128
|
}[];
|
|
132
|
-
signalingAddresses
|
|
133
|
-
mediaAddresses
|
|
129
|
+
signalingAddresses: string[];
|
|
130
|
+
mediaAddresses: string[];
|
|
134
131
|
rtpPorts?: {
|
|
135
|
-
min
|
|
136
|
-
max
|
|
132
|
+
min: number;
|
|
133
|
+
max: number;
|
|
137
134
|
};
|
|
138
135
|
};
|
|
139
136
|
}[];
|
|
137
|
+
allowInsecureLeaf: boolean;
|
|
138
|
+
relay: {
|
|
139
|
+
firstChunkTimeoutMs: number;
|
|
140
|
+
idleTimeoutMs: number;
|
|
141
|
+
maxBytes: number;
|
|
142
|
+
maxConcurrent: number;
|
|
143
|
+
};
|
|
144
|
+
configDebounceMs: number;
|
|
140
145
|
operatorKey?: string;
|
|
141
146
|
privateRegionMonthlyFeeCents?: number;
|
|
142
147
|
controlPlaneUrl?: string;
|
|
143
148
|
leafUrl?: string;
|
|
144
|
-
allowInsecureLeaf?: boolean;
|
|
145
149
|
signingKey?: {
|
|
146
|
-
file
|
|
150
|
+
file: string;
|
|
147
151
|
kid?: string;
|
|
148
152
|
};
|
|
149
153
|
hub?: {
|
|
150
|
-
url
|
|
151
|
-
credentialsFile
|
|
152
|
-
systemCredentialsFile
|
|
153
|
-
operatorSeedFile
|
|
154
|
-
accountSeedFile
|
|
155
|
-
};
|
|
156
|
-
relay?: {
|
|
157
|
-
firstChunkTimeoutMs?: number;
|
|
158
|
-
idleTimeoutMs?: number;
|
|
159
|
-
maxBytes?: number;
|
|
160
|
-
maxConcurrent?: number;
|
|
154
|
+
url: string;
|
|
155
|
+
credentialsFile: string;
|
|
156
|
+
systemCredentialsFile: string;
|
|
157
|
+
operatorSeedFile: string;
|
|
158
|
+
accountSeedFile: string;
|
|
161
159
|
};
|
|
162
160
|
currentVersion?: string;
|
|
163
|
-
configDebounceMs?: number;
|
|
164
161
|
};
|
|
165
162
|
export declare const DOMAIN: string;
|
|
166
163
|
/**
|
package/dist/envs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.DOMAIN_NAMES_ROOT = exports.TRUNK_NAMES_ROOT = exports.SIP_ROOT = exports.PSTN_ROOT = exports.DOMAIN = exports.REGIONS = exports.WEBHOOKS = exports.SESSION_APPS = exports.CALL_RECORDS = exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID =
|
|
4
|
+
exports.TEMPLATES_DIR = exports.SMTP_SENDER = exports.SMTP_SECURE = exports.SMTP_PORT = exports.SMTP_HOST = exports.SMTP_AUTH_USER = exports.SMTP_AUTH_PASS = exports.ROUTR_SIP_PROXY = exports.ROUTR_ROOMR_PEER = exports.ROUTR_API_ENDPOINT = exports.NATS = exports.NATS_CONNECTION = exports.NATS_URL = exports.EVALUATIONS = exports.AUTHZ_SERVICE_METHODS = exports.AUTHZ_SERVICE_PORT = exports.AUTHZ_SERVICE_HOST = exports.AUTHZ_SERVICE_ENABLED = exports.BILLING_ADDRESS = exports.BILLING_ENABLED = exports.IDENTITY_DATABASE_URL = exports.IDENTITY_WORKSPACE_INVITE_URL = exports.IDENTITY_WORKSPACE_INVITE_EXPIRATION = exports.IDENTITY_WORKSPACE_INVITE_FAIL_URL = exports.IDENTITY_REFRESH_TOKEN_EXPIRES_IN = exports.IDENTITY_PUBLIC_KEY = exports.IDENTITY_PRIVATE_KEY = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_ID = exports.IDENTITY_OAUTH2_GITHUB_ENABLED = exports.IDENTITY_TWO_FACTOR_AUTHENTICATION_REQUIRED = exports.IDENTITY_CONTACT_VERIFICATION_REQUIRED = exports.IDENTITY_ISSUER = exports.IDENTITY_ID_TOKEN_EXPIRES_IN = exports.IDENTITY_AUDIENCE = exports.IDENTITY_ACCESS_TOKEN_EXPIRES_IN = exports.HTTP_BRIDGE_PORT = exports.DEFAULT_NATS_QUEUE_GROUP = exports.DATABASE_URL = exports.CLOAK_ENCRYPTION_KEY = exports.NODE_HEARTBEAT_WILDCARD = exports.MEDIA_CALL_EVENTS_WILDCARD = exports.mediaCallEventsSubject = exports.CALL_EVENTS_WILDCARD = exports.callEventsSubject = exports.CALLS_CREATE_SUBJECT = exports.APP_URL = exports.APISERVER_SIGNALING_SERVER = exports.APISERVER_HOST = exports.APISERVER_BIND_ADDR = void 0;
|
|
5
|
+
exports.DOMAIN_NAMES_ROOT = exports.TRUNK_NAMES_ROOT = exports.SIP_ROOT = exports.PSTN_ROOT = exports.DOMAIN = exports.REGIONS = exports.WEBHOOKS = exports.SESSION_APPS = exports.CALL_RECORDS = exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
8
8
|
* http://github.com/fonoster/fonoster
|
|
@@ -93,28 +93,24 @@ exports.NATS_URL = config.nats.url;
|
|
|
93
93
|
exports.NATS_CONNECTION = config.nats;
|
|
94
94
|
/** nats.js connect options: the URL plus the apiserver's NATS user, when set (add-platform 4.1). */
|
|
95
95
|
exports.NATS = (0, common_1.natsConnectOptions)(config.nats);
|
|
96
|
-
// Default owner (if identity.owner is set, the system creates a user and a workspace)
|
|
97
|
-
exports.OWNER_EMAIL = (_d = config.identity.owner) === null || _d === void 0 ? void 0 : _d.email;
|
|
98
|
-
exports.OWNER_NAME = (_f = (_e = config.identity.owner) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : "Admin";
|
|
99
|
-
exports.OWNER_PASSWORD = (_g = config.identity.owner) === null || _g === void 0 ? void 0 : _g.password;
|
|
100
96
|
exports.ROUTR_API_ENDPOINT = config.routr.apiEndpoint;
|
|
101
97
|
// The roomr peer every app-linked number points at (add-roomr 4.1)
|
|
102
98
|
exports.ROUTR_ROOMR_PEER = config.routr.roomrPeer;
|
|
103
99
|
/** Routr's SIP address: API-originated calls are dialed through it (Roomr CreateCall). */
|
|
104
100
|
exports.ROUTR_SIP_PROXY = config.routr.sipProxy;
|
|
105
101
|
// SMTP configurations (optional; email features fail clearly without it)
|
|
106
|
-
exports.SMTP_AUTH_PASS = (
|
|
107
|
-
exports.SMTP_AUTH_USER = (
|
|
108
|
-
exports.SMTP_HOST = (
|
|
109
|
-
exports.SMTP_PORT = (
|
|
110
|
-
exports.SMTP_SECURE = (
|
|
111
|
-
exports.SMTP_SENDER = (
|
|
102
|
+
exports.SMTP_AUTH_PASS = (_d = config.smtp) === null || _d === void 0 ? void 0 : _d.password;
|
|
103
|
+
exports.SMTP_AUTH_USER = (_e = config.smtp) === null || _e === void 0 ? void 0 : _e.user;
|
|
104
|
+
exports.SMTP_HOST = (_f = config.smtp) === null || _f === void 0 ? void 0 : _f.host;
|
|
105
|
+
exports.SMTP_PORT = (_h = (_g = config.smtp) === null || _g === void 0 ? void 0 : _g.port) !== null && _h !== void 0 ? _h : 587;
|
|
106
|
+
exports.SMTP_SECURE = (_k = (_j = config.smtp) === null || _j === void 0 ? void 0 : _j.secure) !== null && _k !== void 0 ? _k : false;
|
|
107
|
+
exports.SMTP_SENDER = (_l = config.smtp) === null || _l === void 0 ? void 0 : _l.sender;
|
|
112
108
|
// Custom templates
|
|
113
109
|
exports.TEMPLATES_DIR = config.templatesDir;
|
|
114
110
|
// Twilio configurations
|
|
115
|
-
exports.TWILIO_ACCOUNT_SID = (
|
|
116
|
-
exports.TWILIO_AUTH_TOKEN = (
|
|
117
|
-
exports.TWILIO_PHONE_NUMBER = (
|
|
111
|
+
exports.TWILIO_ACCOUNT_SID = (_m = config.twilio) === null || _m === void 0 ? void 0 : _m.accountSid;
|
|
112
|
+
exports.TWILIO_AUTH_TOKEN = (_o = config.twilio) === null || _o === void 0 ? void 0 : _o.authToken;
|
|
113
|
+
exports.TWILIO_PHONE_NUMBER = (_p = config.twilio) === null || _p === void 0 ? void 0 : _p.phoneNumber;
|
|
118
114
|
// Call records (add-call-record): index, records API, retention, ListCalls from the index.
|
|
119
115
|
exports.CALL_RECORDS = config.callRecords;
|
|
120
116
|
// Session apps (rebuild: control): hosted Autopilot URL and signing secret, webhook URL policy
|
package/dist/index.js
CHANGED
|
@@ -54,7 +54,6 @@ const db_1 = require("./core/db");
|
|
|
54
54
|
const identityConfig_1 = require("./core/identityConfig");
|
|
55
55
|
const runServices_1 = __importDefault(require("./core/runServices"));
|
|
56
56
|
const upsertRoomrPeer_1 = require("./core/upsertRoomrPeer");
|
|
57
|
-
const envs_1 = require("./envs");
|
|
58
57
|
// Apply fonoster.yaml to the shared modules before serving. Loggers created
|
|
59
58
|
// while the imports above ran switch to the file's settings here.
|
|
60
59
|
const config = (0, config_1.getConfig)();
|
|
@@ -65,14 +64,6 @@ function main() {
|
|
|
65
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
65
|
var _a;
|
|
67
66
|
yield (0, identity_1.migratePasswordStorage)(identityConfig_1.identityConfig);
|
|
68
|
-
if (envs_1.OWNER_EMAIL) {
|
|
69
|
-
const user = {
|
|
70
|
-
name: envs_1.OWNER_NAME,
|
|
71
|
-
email: envs_1.OWNER_EMAIL,
|
|
72
|
-
password: envs_1.OWNER_PASSWORD
|
|
73
|
-
};
|
|
74
|
-
yield (0, identity_1.upsertDefaultUser)(identityConfig_1.identityConfig, user);
|
|
75
|
-
}
|
|
76
67
|
// The provider catalog (add-self-host-installer D7): applied on every start, idempotent. A
|
|
77
68
|
// configured file that can't be read or applied stops the server (IC-B2).
|
|
78
69
|
if (config.catalog) {
|
package/dist/regions/natsJwt.js
CHANGED
|
@@ -21,6 +21,6 @@ exports.createUser = exports.createOperator = exports.createAccount = exports.ge
|
|
|
21
21
|
*/
|
|
22
22
|
const common_1 = require("@fonoster/common");
|
|
23
23
|
// The NATS JWT helpers and generateRegionHub live in @fonoster/common (regions/hub) so the
|
|
24
|
-
//
|
|
24
|
+
// region hub setup (fonoster-region-hub-setup) can generate the region hub without the
|
|
25
25
|
// apiserver. Re-exported here so existing imports keep working.
|
|
26
26
|
exports.encodeNatsJwt = common_1.RegionHub.encodeNatsJwt, exports.decodeNatsJwt = common_1.RegionHub.decodeNatsJwt, exports.operatorJwt = common_1.RegionHub.operatorJwt, exports.accountJwt = common_1.RegionHub.accountJwt, exports.userJwt = common_1.RegionHub.userJwt, exports.formatCreds = common_1.RegionHub.formatCreds, exports.issueUserCreds = common_1.RegionHub.issueUserCreds, exports.seedOf = common_1.RegionHub.seedOf, exports.keyPairFromSeed = common_1.RegionHub.keyPairFromSeed, exports.REGIONS_ACCOUNT_NAME = common_1.RegionHub.REGIONS_ACCOUNT_NAME, exports.regionsAccountJwt = common_1.RegionHub.regionsAccountJwt, exports.generateRegionHub = common_1.RegionHub.generateRegionHub, exports.createAccount = common_1.RegionHub.createAccount, exports.createOperator = common_1.RegionHub.createOperator, exports.createUser = common_1.RegionHub.createUser;
|
|
@@ -17,7 +17,23 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { GrpcErrorMessage } from "@fonoster/common";
|
|
20
|
+
import { z } from "zod";
|
|
20
21
|
import { UsageSql } from "./types";
|
|
22
|
+
/** GetUsage's request; exported for the array-limit tests. */
|
|
23
|
+
export declare const getUsageRequestSchema: z.ZodObject<{
|
|
24
|
+
fromDay: z.ZodString;
|
|
25
|
+
toDay: z.ZodString;
|
|
26
|
+
groupBy: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
27
|
+
origin: "origin";
|
|
28
|
+
model: "model";
|
|
29
|
+
provider: "provider";
|
|
30
|
+
workspace: "workspace";
|
|
31
|
+
meter: "meter";
|
|
32
|
+
day: "day";
|
|
33
|
+
key_source: "key_source";
|
|
34
|
+
}>>>;
|
|
35
|
+
allOwned: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strip>;
|
|
21
37
|
/**
|
|
22
38
|
* Usage totals (usage-metering "Usage API"): quantities from usage_daily, never money. Each day is
|
|
23
39
|
* totalled first; across days counted meters add up and snapshot meters (storage) take the peak.
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getUsageRequestSchema = void 0;
|
|
12
13
|
exports.createGetUsage = createGetUsage;
|
|
13
14
|
/**
|
|
14
15
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
@@ -46,12 +47,15 @@ const COLUMNS = {
|
|
|
46
47
|
key_source: "key_source",
|
|
47
48
|
origin: "origin"
|
|
48
49
|
};
|
|
49
|
-
const
|
|
50
|
+
const DIMENSIONS = Object.keys(COLUMNS).length;
|
|
51
|
+
/** GetUsage's request; exported for the array-limit tests. */
|
|
52
|
+
exports.getUsageRequestSchema = zod_1.z
|
|
50
53
|
.object({
|
|
51
54
|
fromDay: zod_1.z.string().regex(DAY, "fromDay must be YYYY-MM-DD"),
|
|
52
55
|
toDay: zod_1.z.string().regex(DAY, "toDay must be YYYY-MM-DD"),
|
|
53
56
|
groupBy: zod_1.z
|
|
54
57
|
.array(zod_1.z.enum(Object.keys(COLUMNS)))
|
|
58
|
+
.max(DIMENSIONS, { message: `At most ${DIMENSIONS} dimensions` })
|
|
55
59
|
.optional(),
|
|
56
60
|
allOwned: zod_1.z.boolean().optional()
|
|
57
61
|
})
|
|
@@ -114,5 +118,5 @@ function createGetUsage(db) {
|
|
|
114
118
|
}))
|
|
115
119
|
});
|
|
116
120
|
});
|
|
117
|
-
return (0, common_1.withErrorHandlingAndValidation)(fn,
|
|
121
|
+
return (0, common_1.withErrorHandlingAndValidation)(fn, exports.getUsageRequestSchema);
|
|
118
122
|
}
|
|
@@ -30,7 +30,7 @@ class Deepgram {
|
|
|
30
30
|
smartFormat: zod_1.z.boolean().optional(),
|
|
31
31
|
noDelay: zod_1.z.boolean().optional(),
|
|
32
32
|
languageCode: zod_1.z
|
|
33
|
-
.union([zod_1.z.nativeEnum(common_1.VoiceLanguage), zod_1.z.literal(types_1.DEEPGRAM_MULTILINGUAL)], {
|
|
33
|
+
.union([zod_1.z.nativeEnum(common_1.VoiceLanguage), zod_1.z.literal(types_1.DEEPGRAM_MULTILINGUAL)], { error: common_1.Messages.VALID_LANGUAGE_CODE })
|
|
34
34
|
.optional(),
|
|
35
35
|
model: zod_1.z
|
|
36
36
|
.nativeEnum(types_1.DeepgramModel, { message: "Invalid Deepgram model" })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/apiserver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "APIServer for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -19,17 +19,18 @@
|
|
|
19
19
|
"bin": {
|
|
20
20
|
"fonoster": "./dist/index.js",
|
|
21
21
|
"fonoster-region-hub-setup": "./dist/bin/regionHubSetup.js",
|
|
22
|
-
"fonoster-usage": "./dist/bin/usage.js"
|
|
22
|
+
"fonoster-usage": "./dist/bin/usage.js",
|
|
23
|
+
"fonoster-owner": "./dist/bin/owner.js"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@fonoster/authz": "^0.
|
|
26
|
-
"@fonoster/autopilot": "^0.
|
|
27
|
-
"@fonoster/callrecord": "^0.
|
|
28
|
-
"@fonoster/common": "^0.
|
|
29
|
-
"@fonoster/identity": "^0.
|
|
30
|
-
"@fonoster/logger": "^0.
|
|
31
|
-
"@fonoster/sipnet": "^0.
|
|
32
|
-
"@fonoster/types": "^0.
|
|
26
|
+
"@fonoster/authz": "^0.44.0",
|
|
27
|
+
"@fonoster/autopilot": "^0.44.0",
|
|
28
|
+
"@fonoster/callrecord": "^0.44.0",
|
|
29
|
+
"@fonoster/common": "^0.44.0",
|
|
30
|
+
"@fonoster/identity": "^0.44.0",
|
|
31
|
+
"@fonoster/logger": "^0.44.0",
|
|
32
|
+
"@fonoster/sipnet": "^0.44.0",
|
|
33
|
+
"@fonoster/types": "^0.44.0",
|
|
33
34
|
"@grpc/grpc-js": "~1.14.6",
|
|
34
35
|
"@prisma/client": "^6.19.1",
|
|
35
36
|
"@routr/common": "^2.24.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"prisma-field-encryption": "^1.6.0",
|
|
46
47
|
"uuid": "^11.0.3",
|
|
47
48
|
"validator": "^13.12.0",
|
|
48
|
-
"zod": "^
|
|
49
|
+
"zod": "^4.6.7"
|
|
49
50
|
},
|
|
50
51
|
"files": [
|
|
51
52
|
"dist"
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"@types/uuid": "^10.0.0",
|
|
67
68
|
"@types/validator": "^13.15.10"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "2dbe93e2d836a33e58764f12081cd1e6bb654a3e",
|
|
70
71
|
"prisma": {
|
|
71
72
|
"seed": "tsx src/core/seed.ts"
|
|
72
73
|
}
|