@almadar/server 1.2.1 → 1.3.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/LICENSE +72 -0
- package/dist/deepagent/memory.js +15 -88
- package/dist/deepagent/memory.js.map +1 -1
- package/dist/deepagent/session.js +15 -88
- package/dist/deepagent/session.js.map +1 -1
- package/dist/deepagent/skill-agent.js +15 -88
- package/dist/deepagent/skill-agent.js.map +1 -1
- package/dist/{index-BGC2yptv.d.ts → index-B64ll_cY.d.ts} +24 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +16 -60
- package/dist/lib/index.js.map +1 -1
- package/dist/middleware/index.js +16 -60
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/multi-user.js +16 -90
- package/dist/middleware/multi-user.js.map +1 -1
- package/dist/services/index.js +15 -58
- package/dist/services/index.js.map +1 -1
- package/dist/stores/index.js +14 -89
- package/dist/stores/index.js.map +1 -1
- package/dist/websocket/state-sync.js +16 -90
- package/dist/websocket/state-sync.js.map +1 -1
- package/package.json +13 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EventBus, a as EventLogEntry, c as closeWebSocketServer, d as db, e as emitEntityEvent, b as env, g as getAuth, f as getConnectedClientCount, h as getFirestore, i as getWebSocketServer, l as logger, s as serverEventBus,
|
|
1
|
+
export { E as EventBus, a as EventLogEntry, c as closeWebSocketServer, d as db, e as emitEntityEvent, b as env, g as getAuth, f as getConnectedClientCount, h as getFirestore, i as getWebSocketServer, j as initializeFirebase, l as logger, s as serverEventBus, k as setupEventBroadcast } from './index-B64ll_cY.js';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
export { AppError, ConflictError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError, asyncHandler, authenticateFirebase, errorHandler, notFoundHandler, validateBody, validateParams, validateQuery } from './middleware/index.js';
|
|
4
4
|
export { D as DataService, E as EntitySchema, a as EntitySeedConfig, F as FieldSchema, M as MockDataService, P as PaginatedResult, b as PaginationOptions, d as dataService, m as mockDataService, s as seedMockData } from './index-D8fohXsO.js';
|
package/dist/index.js
CHANGED
|
@@ -197,66 +197,70 @@ function debugEventsRouter() {
|
|
|
197
197
|
});
|
|
198
198
|
return router2;
|
|
199
199
|
}
|
|
200
|
-
var firebaseApp = null;
|
|
201
200
|
function initializeFirebase() {
|
|
202
|
-
if (firebaseApp) {
|
|
203
|
-
return firebaseApp;
|
|
204
|
-
}
|
|
205
201
|
if (admin.apps.length > 0) {
|
|
206
|
-
|
|
207
|
-
return firebaseApp;
|
|
202
|
+
return admin.app();
|
|
208
203
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
204
|
+
const projectId = process.env.FIREBASE_PROJECT_ID;
|
|
205
|
+
const emulatorHost = process.env.FIRESTORE_EMULATOR_HOST;
|
|
206
|
+
if (emulatorHost) {
|
|
207
|
+
const app = admin.initializeApp({
|
|
208
|
+
projectId: projectId || "demo-project"
|
|
212
209
|
});
|
|
213
|
-
console.log(
|
|
214
|
-
return
|
|
210
|
+
console.log(`Firebase Admin initialized for emulator: ${emulatorHost}`);
|
|
211
|
+
return app;
|
|
215
212
|
}
|
|
216
|
-
const serviceAccountPath = env.FIREBASE_SERVICE_ACCOUNT_PATH;
|
|
213
|
+
const serviceAccountPath = process.env.FIREBASE_SERVICE_ACCOUNT_PATH;
|
|
217
214
|
if (serviceAccountPath) {
|
|
218
215
|
const serviceAccount = __require(serviceAccountPath);
|
|
219
|
-
|
|
216
|
+
return admin.initializeApp({
|
|
220
217
|
credential: admin.credential.cert(serviceAccount),
|
|
221
|
-
projectId
|
|
218
|
+
projectId
|
|
222
219
|
});
|
|
223
|
-
}
|
|
224
|
-
|
|
220
|
+
}
|
|
221
|
+
const clientEmail = process.env.FIREBASE_CLIENT_EMAIL;
|
|
222
|
+
const privateKey = process.env.FIREBASE_PRIVATE_KEY;
|
|
223
|
+
if (projectId && clientEmail && privateKey) {
|
|
224
|
+
return admin.initializeApp({
|
|
225
225
|
credential: admin.credential.cert({
|
|
226
|
-
projectId
|
|
227
|
-
clientEmail
|
|
228
|
-
privateKey:
|
|
226
|
+
projectId,
|
|
227
|
+
clientEmail,
|
|
228
|
+
privateKey: privateKey.replace(/\\n/g, "\n")
|
|
229
229
|
}),
|
|
230
|
-
projectId
|
|
230
|
+
projectId
|
|
231
231
|
});
|
|
232
|
-
}
|
|
233
|
-
|
|
232
|
+
}
|
|
233
|
+
if (projectId) {
|
|
234
|
+
return admin.initializeApp({
|
|
234
235
|
credential: admin.credential.applicationDefault(),
|
|
235
|
-
projectId
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
firebaseApp = admin.initializeApp({
|
|
239
|
-
projectId: "demo-project"
|
|
236
|
+
projectId
|
|
240
237
|
});
|
|
241
238
|
}
|
|
242
|
-
|
|
239
|
+
throw new Error(
|
|
240
|
+
"@almadar/server: Cannot initialize Firebase \u2014 no credentials found. Set FIREBASE_PROJECT_ID + FIREBASE_CLIENT_EMAIL + FIREBASE_PRIVATE_KEY, or FIREBASE_SERVICE_ACCOUNT_PATH, or FIRESTORE_EMULATOR_HOST."
|
|
241
|
+
);
|
|
243
242
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
host: env.FIRESTORE_EMULATOR_HOST,
|
|
250
|
-
ssl: false
|
|
251
|
-
});
|
|
243
|
+
function getApp() {
|
|
244
|
+
if (admin.apps.length === 0) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"@almadar/server: Firebase Admin SDK is not initialized. Call initializeFirebase() or admin.initializeApp() before using @almadar/server."
|
|
247
|
+
);
|
|
252
248
|
}
|
|
253
|
-
return
|
|
249
|
+
return admin.app();
|
|
250
|
+
}
|
|
251
|
+
function getFirestore() {
|
|
252
|
+
return getApp().firestore();
|
|
254
253
|
}
|
|
255
254
|
function getAuth() {
|
|
256
|
-
|
|
257
|
-
return app.auth();
|
|
255
|
+
return getApp().auth();
|
|
258
256
|
}
|
|
259
|
-
var db =
|
|
257
|
+
var db = new Proxy({}, {
|
|
258
|
+
get(_target, prop, receiver) {
|
|
259
|
+
const firestore = getFirestore();
|
|
260
|
+
const value = Reflect.get(firestore, prop, receiver);
|
|
261
|
+
return typeof value === "function" ? value.bind(firestore) : value;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
260
264
|
var wss = null;
|
|
261
265
|
function setupEventBroadcast(server, path = "/ws/events") {
|
|
262
266
|
if (wss) {
|
|
@@ -1819,6 +1823,6 @@ router.get("/active-sessions", async (req, res) => {
|
|
|
1819
1823
|
});
|
|
1820
1824
|
var observability_default = router;
|
|
1821
1825
|
|
|
1822
|
-
export { AppError, ChangeSetStore, ConflictError, EventBus, ForbiddenError, MockDataService, NotFoundError, SchemaProtectionService, SchemaStore, SnapshotStore, UnauthorizedError, ValidationError, ValidationStore, applyFiltersToQuery, asyncHandler, authenticateFirebase, closeWebSocketServer, createServerSkillAgent, dataService, db, debugEventsRouter, emitEntityEvent, env, errorHandler, extractPaginationParams, fromFirestoreFormat, getMemoryManager as getAgentMemoryManager, getSessionManager as getAgentSessionManager, getAuth, getConnectedClientCount, getFirestore, getMemoryManager, getSessionManager, getWebSocketServer, logger, mockDataService, multiUserMiddleware, notFoundHandler, observability_default as observabilityRouter, parseQueryFilters, resetMemoryManager, resetSessionManager, seedMockData, serverEventBus, setupEventBroadcast, setupStateSyncWebSocket, toFirestoreFormat, validateBody, validateParams, validateQuery, verifyFirebaseAuth };
|
|
1826
|
+
export { AppError, ChangeSetStore, ConflictError, EventBus, ForbiddenError, MockDataService, NotFoundError, SchemaProtectionService, SchemaStore, SnapshotStore, UnauthorizedError, ValidationError, ValidationStore, applyFiltersToQuery, asyncHandler, authenticateFirebase, closeWebSocketServer, createServerSkillAgent, dataService, db, debugEventsRouter, emitEntityEvent, env, errorHandler, extractPaginationParams, fromFirestoreFormat, getMemoryManager as getAgentMemoryManager, getSessionManager as getAgentSessionManager, getAuth, getConnectedClientCount, getFirestore, getMemoryManager, getSessionManager, getWebSocketServer, initializeFirebase, logger, mockDataService, multiUserMiddleware, notFoundHandler, observability_default as observabilityRouter, parseQueryFilters, resetMemoryManager, resetSessionManager, seedMockData, serverEventBus, setupEventBroadcast, setupStateSyncWebSocket, toFirestoreFormat, validateBody, validateParams, validateQuery, verifyFirebaseAuth };
|
|
1823
1827
|
//# sourceMappingURL=index.js.map
|
|
1824
1828
|
//# sourceMappingURL=index.js.map
|