@talkpilot/core-db 1.3.34 → 1.3.35
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/README.md +0 -54
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/configuration/index.d.ts +7 -0
- package/dist/configuration/index.d.ts.map +1 -0
- package/dist/configuration/index.js +34 -0
- package/dist/configuration/index.js.map +1 -0
- package/dist/configuration/mongodb-client.d.ts +13 -0
- package/dist/configuration/mongodb-client.d.ts.map +1 -0
- package/dist/configuration/mongodb-client.js +57 -0
- package/dist/configuration/mongodb-client.js.map +1 -0
- package/dist/configuration/prompts/index.d.ts +3 -0
- package/dist/configuration/prompts/index.d.ts.map +1 -0
- package/dist/configuration/prompts/index.js +18 -0
- package/dist/configuration/prompts/index.js.map +1 -0
- package/dist/configuration/prompts/prompts.getters.d.ts +28 -0
- package/dist/configuration/prompts/prompts.getters.d.ts.map +1 -0
- package/dist/configuration/prompts/prompts.getters.js +44 -0
- package/dist/configuration/prompts/prompts.getters.js.map +1 -0
- package/dist/configuration/prompts/prompts.types.d.ts +11 -0
- package/dist/configuration/prompts/prompts.types.d.ts.map +1 -0
- package/dist/{talkpilot/clients/clients.quota.types.js → configuration/prompts/prompts.types.js} +1 -1
- package/dist/configuration/prompts/prompts.types.js.map +1 -0
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +12 -0
- package/dist/connection.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/municipal/departmentsSubjects/departmentsSubjects.setters.d.ts +10 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.setters.d.ts.map +1 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.setters.js +15 -0
- package/dist/municipal/departmentsSubjects/departmentsSubjects.setters.js.map +1 -0
- package/dist/municipal/streets/streets.setters.d.ts +10 -0
- package/dist/municipal/streets/streets.setters.d.ts.map +1 -0
- package/dist/municipal/streets/streets.setters.js +15 -0
- package/dist/municipal/streets/streets.setters.js.map +1 -0
- package/dist/reconcile/index.d.ts +5 -0
- package/dist/reconcile/index.d.ts.map +1 -0
- package/dist/reconcile/index.js +21 -0
- package/dist/reconcile/index.js.map +1 -0
- package/dist/reconcile/reconcile.diff.d.ts +4 -0
- package/dist/reconcile/reconcile.diff.d.ts.map +1 -0
- package/dist/reconcile/reconcile.diff.js +36 -0
- package/dist/reconcile/reconcile.diff.js.map +1 -0
- package/dist/reconcile/reconcile.execute.d.ts +7 -0
- package/dist/reconcile/reconcile.execute.d.ts.map +1 -0
- package/dist/reconcile/reconcile.execute.js +20 -0
- package/dist/reconcile/reconcile.execute.js.map +1 -0
- package/dist/reconcile/reconcile.ops.d.ts +12 -0
- package/dist/reconcile/reconcile.ops.d.ts.map +1 -0
- package/dist/reconcile/reconcile.ops.js +24 -0
- package/dist/reconcile/reconcile.ops.js.map +1 -0
- package/dist/reconcile/reconcile.types.d.ts +32 -0
- package/dist/reconcile/reconcile.types.d.ts.map +1 -0
- package/dist/reconcile/reconcile.types.js +3 -0
- package/dist/reconcile/reconcile.types.js.map +1 -0
- package/dist/talkpilot/clients/clients.types.d.ts +0 -3
- package/dist/talkpilot/clients/clients.types.d.ts.map +1 -1
- package/dist/talkpilot/clients/index.d.ts +0 -2
- package/dist/talkpilot/clients/index.d.ts.map +1 -1
- package/dist/talkpilot/clients/index.js +0 -2
- package/dist/talkpilot/clients/index.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +0 -5
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -37
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +3 -3
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.js.map +1 -1
- package/dist/test-utils/db-utils.d.ts.map +1 -1
- package/dist/test-utils/db-utils.js +2 -0
- package/dist/test-utils/db-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +9 -0
- package/src/configuration/index.ts +15 -0
- package/src/configuration/mongodb-client.ts +62 -0
- package/src/configuration/prompts/index.ts +2 -0
- package/src/configuration/prompts/prompts.getters.ts +49 -0
- package/src/configuration/prompts/prompts.types.ts +11 -0
- package/src/connection.ts +14 -0
- package/src/index.ts +7 -0
- package/src/talkpilot/clients/clients.types.ts +0 -4
- package/src/talkpilot/clients/index.ts +0 -2
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +0 -26
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +0 -54
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +3 -4
- package/src/test-utils/db-utils.ts +8 -1
- package/dist/talkpilot/clients/clients.quota.constants.d.ts +0 -2
- package/dist/talkpilot/clients/clients.quota.constants.d.ts.map +0 -1
- package/dist/talkpilot/clients/clients.quota.constants.js +0 -5
- package/dist/talkpilot/clients/clients.quota.constants.js.map +0 -1
- package/dist/talkpilot/clients/clients.quota.getters.d.ts +0 -7
- package/dist/talkpilot/clients/clients.quota.getters.d.ts.map +0 -1
- package/dist/talkpilot/clients/clients.quota.getters.js +0 -80
- package/dist/talkpilot/clients/clients.quota.getters.js.map +0 -1
- package/dist/talkpilot/clients/clients.quota.types.d.ts +0 -24
- package/dist/talkpilot/clients/clients.quota.types.d.ts.map +0 -1
- package/dist/talkpilot/clients/clients.quota.types.js.map +0 -1
- package/dist/talkpilot/clients/clients.quota.utils.d.ts +0 -8
- package/dist/talkpilot/clients/clients.quota.utils.d.ts.map +0 -1
- package/dist/talkpilot/clients/clients.quota.utils.js +0 -45
- package/dist/talkpilot/clients/clients.quota.utils.js.map +0 -1
- package/src/talkpilot/clients/__tests__/clients.quota.spec.ts +0 -123
- package/src/talkpilot/clients/clients.quota.getters.ts +0 -119
- package/src/talkpilot/clients/clients.quota.types.ts +0 -27
package/README.md
CHANGED
|
@@ -160,9 +160,6 @@ Refer to `DEVELOPMENT.md` for the full walkthrough, token instructions, and fact
|
|
|
160
160
|
| 1.3.24 | **Breaking:** removed `flowId` from `WebsiteTalkProduct` — flow source of truth is `phone_numbers.flow_id`. Added `getPrimaryPhoneFlowId(clientId)`. |
|
|
161
161
|
| 1.3.25 | Added `disconnectDb()` to close all MongoDB clients opened by `ensureDbConnected()` — for one-shot scripts that must exit cleanly. |
|
|
162
162
|
| 1.3.28 | Soft-delete (`isActive`) on Streets/DepartmentSubjects, new bulk-write getters, MongoDB type re-exports, and the generic `bulkWrite` op-builder module. |
|
|
163
|
-
| 1.3.29 | Added client call-quota module (CP-1500): `ClientConfig.quota` for usage limits (`totalQuota`, `usedQuota`, `expiresAt`), alert settings on `clients`, and getters for state, increment/reset, threshold alerts, and expiry notification tracking. |
|
|
164
|
-
| 1.3.32 | `clientDisplayName` lives on `clientsConfig.quota` (not top-level). `getClientDisplayName` returns `"-"` when unset; never exposes `clientId`. |
|
|
165
|
-
|
|
166
163
|
### 1.1.9
|
|
167
164
|
|
|
168
165
|
1. `npm run build`.
|
|
@@ -547,57 +544,6 @@ Adds an `isActive` soft-delete convention, bulk-write getters for Streets/Depart
|
|
|
547
544
|
|
|
548
545
|
No — purely additive.
|
|
549
546
|
|
|
550
|
-
### 1.3.29 — Client call quota (CP-1500)
|
|
551
|
-
|
|
552
|
-
Per-client call quota with usage counters, optional expiration, and configurable threshold/expiry email alerts. Usage lives on clientsConfig; alert config and send-tracking live on clients. TalkPilot Server consumes these getters to block calls when quota is exceeded or expired and to send notification emails.
|
|
553
|
-
|
|
554
|
-
**Data model**
|
|
555
|
-
|
|
556
|
-
| Location | Field | Purpose |
|
|
557
|
-
| --- | --- | --- |
|
|
558
|
-
| `clientsConfig.quota` | `totalQuota`, `usedQuota`, `expiresAt?` | Call allowance and consumption. `getClientQuotaState` returns `null` when `totalQuota` is unset (quota disabled for that client). |
|
|
559
|
-
| `clients.quota` | `alerts?`, `expiredSent?` | Up to 3 threshold alerts (each with up to 3 recipient emails) and a flag set after the expiry email is sent. |
|
|
560
|
-
|
|
561
|
-
**Added**
|
|
562
|
-
|
|
563
|
-
| Export | Purpose |
|
|
564
|
-
| --- | --- |
|
|
565
|
-
| `ClientQuotaUsage` | Usage shape: `totalQuota`, `usedQuota`, optional `expiresAt`. |
|
|
566
|
-
| `ClientQuotaSettings` | Alert settings on the `clients` doc: `alerts`, `expiredSent`. |
|
|
567
|
-
| `ClientQuotaState` | Merged view returned by `getClientQuotaState` (usage + settings). |
|
|
568
|
-
| `QuotaThresholdAlert` / `QuotaAlertInput` | Threshold alert with `thresholdPct`, `recipientEmails`, and optional `thresholdSent` send-tracking. |
|
|
569
|
-
| `getClientQuotaState(clientId)` | Read combined quota state; `null` when no quota is configured. |
|
|
570
|
-
| `incrementClientQuotaUsage(clientId, amount?)` | Atomically increment `clientsConfig.quota.usedQuota` (default `amount = 1`). No-op when `quota.totalQuota` is absent. |
|
|
571
|
-
| `resetClientQuotaUsage(clientId)` | Reset `usedQuota` to `0` and clear alert/expiry send flags via `resetClientQuotaSettings`. |
|
|
572
|
-
| `updateQuotaAlertsConfig(clientId, alerts)` | Replace threshold alert config; preserves `thresholdSent` for unchanged thresholds. |
|
|
573
|
-
| `markQuotaAlertSent(clientId, alertIndex)` | Idempotently mark a threshold alert as sent; returns whether the update applied. |
|
|
574
|
-
| `markQuotaExpiredSent(clientId)` | Idempotently mark the expiry notification as sent; returns whether the update applied. |
|
|
575
|
-
| `resetClientQuotaSettings(clientId)` | Clear `expiredSent` and strip `thresholdSent` from alerts (keeps alert definitions). |
|
|
576
|
-
|
|
577
|
-
**Do I need to update my app?**
|
|
578
|
-
|
|
579
|
-
No — purely additive. TalkPilot Server should upgrade to 1.3.29 (or later) to enforce quota on inbound/outbound calls and to drive threshold/expiry emails via the new getters.
|
|
580
|
-
|
|
581
|
-
### 1.3.32 — Quota `clientDisplayName`
|
|
582
|
-
|
|
583
|
-
Optional human-readable account label stored on `clientsConfig.quota` for quota notification emails. TalkPilot Server uses `getClientDisplayName` instead of exposing raw `clientId` in alert/expiry email copy.
|
|
584
|
-
|
|
585
|
-
**Changed**
|
|
586
|
-
|
|
587
|
-
| Area | What |
|
|
588
|
-
| --- | --- |
|
|
589
|
-
| `ClientQuotaUsage.clientDisplayName?` | Optional display name on `clientsConfig.quota` — e.g. `"Acme Corp"`. Included in `ClientQuotaState` via `getClientQuotaState`. |
|
|
590
|
-
|
|
591
|
-
**Added**
|
|
592
|
-
|
|
593
|
-
| Export | Purpose |
|
|
594
|
-
| --- | --- |
|
|
595
|
-
| `getClientDisplayName(clientId)` | Returns trimmed `quota.clientDisplayName`, or `"-"` when unset, missing, or blank. Never falls back to `clientId`. |
|
|
596
|
-
|
|
597
|
-
**Do I need to update my app?**
|
|
598
|
-
|
|
599
|
-
No — purely additive. Set `clientsConfig.quota.clientDisplayName` when provisioning quota for a client. **TalkPilot Server** should upgrade to **1.3.32** (or later) to use the label in quota emails.
|
|
600
|
-
|
|
601
547
|
## 🛠 CI/CD & deployment
|
|
602
548
|
|
|
603
549
|
- This package is consumed by Cloud Build-based services (TalkPilot Server, MIS, CIS) as a dependency when Docker images are built. Keep `dist/` in sync with your builds because the compiled artifact is what downstream services install.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized env var access. Add new fields here instead of reading
|
|
3
|
+
* process.env directly elsewhere, so each env var has exactly one source of truth in the code.
|
|
4
|
+
*/
|
|
5
|
+
export declare const configurationDbConfig: {
|
|
6
|
+
mongoUri: string | undefined;
|
|
7
|
+
configurationDbName: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Centralized env var access. Add new fields here instead of reading
|
|
4
|
+
* process.env directly elsewhere, so each env var has exactly one source of truth in the code.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.configurationDbConfig = void 0;
|
|
8
|
+
exports.configurationDbConfig = {
|
|
9
|
+
mongoUri: process.env.MONGO_URI || process.env.MONGODB_URI,
|
|
10
|
+
configurationDbName: process.env.CONFIGURATION_DB_NAME,
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,qBAAqB,GAAG;IACnC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW;IAC1D,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;CACvD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Db, ObjectId as MongoObjectId } from "mongodb";
|
|
2
|
+
export * from "./prompts";
|
|
3
|
+
export { configurationMongodbClient } from "./mongodb-client";
|
|
4
|
+
export declare const setDb: (d: Db) => void;
|
|
5
|
+
export declare const getDb: () => Db;
|
|
6
|
+
export declare const ObjectId: typeof MongoObjectId;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,eAAO,MAAM,KAAK,GAAI,GAAG,EAAE,SAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,QAAO,EAGxB,CAAC;AACF,eAAO,MAAM,QAAQ,sBAAgB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ObjectId = exports.getDb = exports.setDb = exports.configurationMongodbClient = void 0;
|
|
18
|
+
const mongodb_1 = require("mongodb");
|
|
19
|
+
__exportStar(require("./prompts"), exports);
|
|
20
|
+
var mongodb_client_1 = require("./mongodb-client");
|
|
21
|
+
Object.defineProperty(exports, "configurationMongodbClient", { enumerable: true, get: function () { return mongodb_client_1.configurationMongodbClient; } });
|
|
22
|
+
let db;
|
|
23
|
+
const setDb = (d) => {
|
|
24
|
+
db = d;
|
|
25
|
+
};
|
|
26
|
+
exports.setDb = setDb;
|
|
27
|
+
const getDb = () => {
|
|
28
|
+
if (!db)
|
|
29
|
+
throw new Error("Configuration DB not initialised");
|
|
30
|
+
return db;
|
|
31
|
+
};
|
|
32
|
+
exports.getDb = getDb;
|
|
33
|
+
exports.ObjectId = mongodb_1.ObjectId;
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAwD;AAExD,4CAA0B;AAC1B,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AAEnC,IAAI,EAAM,CAAC;AACJ,MAAM,KAAK,GAAG,CAAC,CAAK,EAAE,EAAE;IAC7B,EAAE,GAAG,CAAC,CAAC;AACT,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,KAAK,GAAG,GAAO,EAAE;IAC5B,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC7D,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,KAAK,SAGhB;AACW,QAAA,QAAQ,GAAG,kBAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Db } from "mongodb";
|
|
2
|
+
declare class ConfigurationMongoDBClient {
|
|
3
|
+
private client;
|
|
4
|
+
private db;
|
|
5
|
+
private readonly defaultDbName;
|
|
6
|
+
connect(uri?: string, dbName?: string): Promise<void>;
|
|
7
|
+
disconnect(): Promise<void>;
|
|
8
|
+
getDb(): Db;
|
|
9
|
+
isConnected(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const configurationMongodbClient: ConfigurationMongoDBClient;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=mongodb-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb-client.d.ts","sourceRoot":"","sources":["../../src/configuration/mongodb-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAE,MAAM,SAAS,CAAC;AAK1C,cAAM,0BAA0B;IAC9B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IAE3C,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBrD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC,KAAK,IAAI,EAAE;IASX,WAAW,IAAI,OAAO;CAGvB;AAED,eAAO,MAAM,0BAA0B,4BAAmC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configurationMongodbClient = void 0;
|
|
4
|
+
const mongodb_1 = require("mongodb");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const validation_1 = require("../utils/validation");
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
class ConfigurationMongoDBClient {
|
|
9
|
+
client = null;
|
|
10
|
+
db = null;
|
|
11
|
+
defaultDbName = "configuration";
|
|
12
|
+
async connect(uri, dbName) {
|
|
13
|
+
if (this.client) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const mongodbUri = uri || config_1.configurationDbConfig.mongoUri;
|
|
17
|
+
(0, validation_1.validateConfig)("MONGO_URI", mongodbUri);
|
|
18
|
+
(0, validation_1.validateMongoUri)(mongodbUri);
|
|
19
|
+
try {
|
|
20
|
+
this.client = new mongodb_1.MongoClient(mongodbUri);
|
|
21
|
+
await this.client.connect();
|
|
22
|
+
const targetDbName = dbName || config_1.configurationDbConfig.configurationDbName || this.defaultDbName;
|
|
23
|
+
this.db = this.client.db(targetDbName);
|
|
24
|
+
(0, index_1.setDb)(this.db);
|
|
25
|
+
console.info(`[core-db] Configuration MongoDB connected: ${targetDbName}`);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("[core-db] Configuration connection failed", error);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async disconnect() {
|
|
33
|
+
if (this.client) {
|
|
34
|
+
try {
|
|
35
|
+
await this.client.close();
|
|
36
|
+
this.client = null;
|
|
37
|
+
this.db = null;
|
|
38
|
+
console.info("Configuration MongoDB disconnected successfully");
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error("[core-db] Configuration disconnection failed", error);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getDb() {
|
|
47
|
+
if (!this.db) {
|
|
48
|
+
throw new Error("Configuration database not initialized. Call connect() first.");
|
|
49
|
+
}
|
|
50
|
+
return this.db;
|
|
51
|
+
}
|
|
52
|
+
isConnected() {
|
|
53
|
+
return this.client !== null && this.client !== undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.configurationMongodbClient = new ConfigurationMongoDBClient();
|
|
57
|
+
//# sourceMappingURL=mongodb-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb-client.js","sourceRoot":"","sources":["../../src/configuration/mongodb-client.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,mCAAgC;AAChC,oDAAuE;AACvE,sCAAkD;AAElD,MAAM,0BAA0B;IACtB,MAAM,GAAuB,IAAI,CAAC;IAClC,EAAE,GAAc,IAAI,CAAC;IACZ,aAAa,GAAG,eAAe,CAAC;IAEjD,KAAK,CAAC,OAAO,CAAC,GAAY,EAAE,MAAe;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,GAAG,IAAI,8BAAqB,CAAC,QAAQ,CAAC;QACzD,IAAA,2BAAc,EAAC,WAAW,EAAE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AC;IACjB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;IAC3D,CAAC;CACF;AAEY,QAAA,0BAA0B,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./prompts.getters"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/configuration/prompts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Collection, Filter } from "mongodb";
|
|
2
|
+
import { Prompt } from "./prompts.types";
|
|
3
|
+
import { KnownProductKey } from "../../talkpilot";
|
|
4
|
+
export declare const getPromptsCollection: () => Collection<Prompt>;
|
|
5
|
+
/**
|
|
6
|
+
* Get a prompt by its unique name.
|
|
7
|
+
* @param name prompt name
|
|
8
|
+
* @returns the prompt or null if not found
|
|
9
|
+
*/
|
|
10
|
+
export declare const getPromptByName: (name: string) => Promise<Prompt | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Find prompts by filter.
|
|
13
|
+
* @param filter filter to apply
|
|
14
|
+
* @returns array of matching prompts
|
|
15
|
+
*/
|
|
16
|
+
export declare const findPrompts: (filter?: Filter<Prompt>) => Promise<Prompt[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get all prompts.
|
|
19
|
+
* @returns array of all prompts
|
|
20
|
+
*/
|
|
21
|
+
export declare const getAllPrompts: () => Promise<Prompt[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all prompts for a given product.
|
|
24
|
+
* @param productName product key
|
|
25
|
+
* @returns array of matching prompts
|
|
26
|
+
*/
|
|
27
|
+
export declare const getPromptsByProduct: (productName: KnownProductKey) => Promise<Prompt[]>;
|
|
28
|
+
//# sourceMappingURL=prompts.getters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.getters.d.ts","sourceRoot":"","sources":["../../../src/configuration/prompts/prompts.getters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAO,MAAM,oBAAoB,QAAO,UAAU,CAAC,MAAM,CAExD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,IAAI,CAEvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,SAAQ,MAAM,CAAC,MAAM,CAAM,KAC1B,OAAO,CAAC,MAAM,EAAE,CAElB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,MAAM,EAAE,CAEtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,eAAe,KAC3B,OAAO,CAAC,MAAM,EAAE,CAElB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPromptsByProduct = exports.getAllPrompts = exports.findPrompts = exports.getPromptByName = exports.getPromptsCollection = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
const getPromptsCollection = () => {
|
|
6
|
+
return (0, index_1.getDb)().collection("prompts");
|
|
7
|
+
};
|
|
8
|
+
exports.getPromptsCollection = getPromptsCollection;
|
|
9
|
+
/**
|
|
10
|
+
* Get a prompt by its unique name.
|
|
11
|
+
* @param name prompt name
|
|
12
|
+
* @returns the prompt or null if not found
|
|
13
|
+
*/
|
|
14
|
+
const getPromptByName = async (name) => {
|
|
15
|
+
return await (0, exports.getPromptsCollection)().findOne({ name });
|
|
16
|
+
};
|
|
17
|
+
exports.getPromptByName = getPromptByName;
|
|
18
|
+
/**
|
|
19
|
+
* Find prompts by filter.
|
|
20
|
+
* @param filter filter to apply
|
|
21
|
+
* @returns array of matching prompts
|
|
22
|
+
*/
|
|
23
|
+
const findPrompts = async (filter = {}) => {
|
|
24
|
+
return await (0, exports.getPromptsCollection)().find(filter).toArray();
|
|
25
|
+
};
|
|
26
|
+
exports.findPrompts = findPrompts;
|
|
27
|
+
/**
|
|
28
|
+
* Get all prompts.
|
|
29
|
+
* @returns array of all prompts
|
|
30
|
+
*/
|
|
31
|
+
const getAllPrompts = async () => {
|
|
32
|
+
return await (0, exports.findPrompts)();
|
|
33
|
+
};
|
|
34
|
+
exports.getAllPrompts = getAllPrompts;
|
|
35
|
+
/**
|
|
36
|
+
* Get all prompts for a given product.
|
|
37
|
+
* @param productName product key
|
|
38
|
+
* @returns array of matching prompts
|
|
39
|
+
*/
|
|
40
|
+
const getPromptsByProduct = async (productName) => {
|
|
41
|
+
return await (0, exports.findPrompts)({ productName });
|
|
42
|
+
};
|
|
43
|
+
exports.getPromptsByProduct = getPromptsByProduct;
|
|
44
|
+
//# sourceMappingURL=prompts.getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.getters.js","sourceRoot":"","sources":["../../../src/configuration/prompts/prompts.getters.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAK1B,MAAM,oBAAoB,GAAG,GAAuB,EAAE;IAC3D,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAS,SAAS,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B;AAEF;;;;GAIG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,IAAY,EACY,EAAE;IAC1B,OAAO,MAAM,IAAA,4BAAoB,GAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAEF;;;;GAIG;AACI,MAAM,WAAW,GAAG,KAAK,EAC9B,SAAyB,EAAE,EACR,EAAE;IACrB,OAAO,MAAM,IAAA,4BAAoB,GAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;AAC7D,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,KAAK,IAAuB,EAAE;IACzD,OAAO,MAAM,IAAA,mBAAW,GAAE,CAAC;AAC7B,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AAEF;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,KAAK,EACtC,WAA4B,EACT,EAAE;IACrB,OAAO,MAAM,IAAA,mBAAW,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ObjectId } from "mongodb";
|
|
2
|
+
import { KnownProductKey } from "../../talkpilot";
|
|
3
|
+
export type Prompt = {
|
|
4
|
+
_id: ObjectId;
|
|
5
|
+
name: string;
|
|
6
|
+
content: string;
|
|
7
|
+
productName: KnownProductKey;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=prompts.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.types.d.ts","sourceRoot":"","sources":["../../../src/configuration/prompts/prompts.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,eAAe,CAAC;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.types.js","sourceRoot":"","sources":["../../../src/configuration/prompts/prompts.types.ts"],"names":[],"mappings":""}
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAsB,iBAAiB,kBAsDtC;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAYlD"}
|
package/dist/connection.js
CHANGED
|
@@ -5,6 +5,8 @@ exports.disconnectDb = disconnectDb;
|
|
|
5
5
|
const talkpilot_1 = require("./talkpilot");
|
|
6
6
|
const municipal_1 = require("./municipal");
|
|
7
7
|
const websitalk_1 = require("./websitalk");
|
|
8
|
+
const configuration_1 = require("./configuration");
|
|
9
|
+
const config_1 = require("./config");
|
|
8
10
|
let isConnected = false;
|
|
9
11
|
/**
|
|
10
12
|
* Ensures the database clients are initialized.
|
|
@@ -18,6 +20,7 @@ async function ensureDbConnected() {
|
|
|
18
20
|
const talkpilotUri = mongoUri;
|
|
19
21
|
const municipalUri = mongoUri;
|
|
20
22
|
const websiteTalkUri = mongoUri;
|
|
23
|
+
const configurationUri = mongoUri;
|
|
21
24
|
if (!talkpilotUri) {
|
|
22
25
|
console.warn("[core-db] MONGO_URI is not set");
|
|
23
26
|
}
|
|
@@ -44,6 +47,14 @@ async function ensureDbConnected() {
|
|
|
44
47
|
await websitalk_1.websitalkMongodbClient.connect(websiteTalkUri, dbName);
|
|
45
48
|
console.info(`[core-db] Connected to Website Talk MongoDB: ${dbName || "website-talk (default)"}`);
|
|
46
49
|
}
|
|
50
|
+
if (!configurationUri) {
|
|
51
|
+
console.warn("[core-db] MONGO_URI is not set");
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const dbName = config_1.configurationDbConfig.configurationDbName;
|
|
55
|
+
await configuration_1.configurationMongodbClient.connect(configurationUri, dbName);
|
|
56
|
+
console.info(`[core-db] Connected to Configuration MongoDB: ${dbName || "configuration (default)"}`);
|
|
57
|
+
}
|
|
47
58
|
isConnected = true;
|
|
48
59
|
}
|
|
49
60
|
async function disconnectDb() {
|
|
@@ -54,6 +65,7 @@ async function disconnectDb() {
|
|
|
54
65
|
talkpilot_1.mongodbClient.disconnect(),
|
|
55
66
|
municipal_1.municipalDataMongodbClient.disconnect(),
|
|
56
67
|
websitalk_1.websitalkMongodbClient.disconnect(),
|
|
68
|
+
configuration_1.configurationMongodbClient.disconnect(),
|
|
57
69
|
]);
|
|
58
70
|
isConnected = false;
|
|
59
71
|
}
|
package/dist/connection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;AAYA,8CAsDC;AAED,oCAYC;AAhFD,2CAA4C;AAC5C,2CAAyD;AACzD,2CAAqD;AACrD,mDAA6D;AAC7D,qCAAiD;AAEjD,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;GAGG;AACI,KAAK,UAAU,iBAAiB;IACrC,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAClE,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,MAAM,cAAc,GAAG,QAAQ,CAAC;IAChC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAElC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC9D,MAAM,yBAAa,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CACV,6CAA6C,MA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Y;IAChC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,yBAAa,CAAC,UAAU,EAAE;QAC1B,sCAA0B,CAAC,UAAU,EAAE;QACvC,kCAAsB,CAAC,UAAU,EAAE;QACnC,0CAA0B,CAAC,UAAU,EAAE;KACxC,CAAC,CAAC;IACH,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { websitalkMongodbClient, getDb as getWebsitalkDb, setDb as setWebsitalkD
|
|
|
13
13
|
export * from "./websitalk/scans/scans.getters";
|
|
14
14
|
export type * from "./websitalk/scans/scans.types";
|
|
15
15
|
export * from "./websitalk/websiteUrls";
|
|
16
|
+
export { configurationMongodbClient, getDb as getConfigurationDb, setDb as setConfigurationDb, } from "./configuration";
|
|
17
|
+
export * from "./configuration/prompts";
|
|
16
18
|
export { ObjectId } from "mongodb";
|
|
17
19
|
export type { Filter } from "mongodb";
|
|
18
20
|
export type { AnyBulkWriteOperation as BulkWriteOp } from "mongodb";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,KAAK,IAAI,kBAAkB,EAC3B,KAAK,IAAI,kBAAkB,EAC3B,QAAQ,IAAI,qBAAqB,GAClC,MAAM,aAAa,CAAC;AACrB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,OAAO,EACL,sB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,iBAAiB,CAAC;AACzB,cAAc,yBAAyB,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,qBAAqB,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAChE,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BulkWriteError = exports.ObjectId = exports.WebsitalkObjectId = exports.setWebsitalkDb = exports.getWebsitalkDb = exports.websitalkMongodbClient = exports.MunicipalDataObjectId = exports.setMunicipalDataDb = exports.getMunicipalDataDb = exports.municipalDataMongodbClient = void 0;
|
|
17
|
+
exports.BulkWriteError = exports.ObjectId = exports.setConfigurationDb = exports.getConfigurationDb = exports.configurationMongodbClient = exports.WebsitalkObjectId = exports.setWebsitalkDb = exports.getWebsitalkDb = exports.websitalkMongodbClient = exports.MunicipalDataObjectId = exports.setMunicipalDataDb = exports.getMunicipalDataDb = exports.municipalDataMongodbClient = void 0;
|
|
18
18
|
// TalkPilot DB exports
|
|
19
19
|
__exportStar(require("./talkpilot"), exports);
|
|
20
20
|
__exportStar(require("./connection"), exports);
|
|
@@ -38,6 +38,11 @@ Object.defineProperty(exports, "setWebsitalkDb", { enumerable: true, get: functi
|
|
|
38
38
|
Object.defineProperty(exports, "WebsitalkObjectId", { enumerable: true, get: function () { return websitalk_1.ObjectId; } });
|
|
39
39
|
__exportStar(require("./websitalk/scans/scans.getters"), exports);
|
|
40
40
|
__exportStar(require("./websitalk/websiteUrls"), exports);
|
|
41
|
+
var configuration_1 = require("./configuration");
|
|
42
|
+
Object.defineProperty(exports, "configurationMongodbClient", { enumerable: true, get: function () { return configuration_1.configurationMongodbClient; } });
|
|
43
|
+
Object.defineProperty(exports, "getConfigurationDb", { enumerable: true, get: function () { return configuration_1.getDb; } });
|
|
44
|
+
Object.defineProperty(exports, "setConfigurationDb", { enumerable: true, get: function () { return configuration_1.setDb; } });
|
|
45
|
+
__exportStar(require("./configuration/prompts"), exports);
|
|
41
46
|
var mongodb_1 = require("mongodb");
|
|
42
47
|
Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_1.ObjectId; } });
|
|
43
48
|
var mongodb_2 = require("mongodb");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAE5B,yCAKqB;AAJnB,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,KAAK,OAAsB;AAC3B,+GAAA,KAAK,OAAsB;AAC3B,kHAAA,QAAQ,OAAyB;AAEnC,qDAAmC;AACnC,sDAAoC;AACpC,kEAAgD;AAChD,sDAAoC;AACpC,iEAA+C;AAC/C,yDAAuC;AACvC,0DAAwC;AAExC,yCAKqB;AAJnB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,KAAK,OAAkB;AACvB,2GAAA,KAAK,OAAkB;AACvB,8GAAA,QAAQ,OAAqB;AAE/B,kEAAgD;AAEhD,0DAAwC;AAExC,mCAAmC;AAA1B,mGAAA,QAAQ,OAAA;AAGjB,mCAAgE;AAAvD,yGAAA,mBAAmB,OAAkB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAE5B,yCAKqB;AAJnB,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,KAAK,OAAsB;AAC3B,+GAAA,KAAK,OAAsB;AAC3B,kHAAA,QAAQ,OAAyB;AAEnC,qDAAmC;AACnC,sDAAoC;AACpC,kEAAgD;AAChD,sDAAoC;AACpC,iEAA+C;AAC/C,yDAAuC;AACvC,0DAAwC;AAExC,yCAKqB;AAJnB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,KAAK,OAAkB;AACvB,2GAAA,KAAK,OAAkB;AACvB,8GAAA,QAAQ,OAAqB;AAE/B,kEAAgD;AAEhD,0DAAwC;AAExC,iDAIyB;AAHvB,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,KAAK,OAAsB;AAC3B,mHAAA,KAAK,OAAsB;AAE7B,0DAAwC;AAExC,mCAAmC;AAA1B,mGAAA,QAAQ,OAAA;AAGjB,mCAAgE;AAAvD,yGAAA,mBAAmB,OAAkB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult } from "mongodb";
|
|
2
|
+
import { DepartmentSubject } from "./departmentsSubjects.types";
|
|
3
|
+
/**
|
|
4
|
+
* Generic batch write for the departmentsSubjects collection — a thin passthrough to the
|
|
5
|
+
* driver's bulkWrite, with no diffing/key-building/business logic. `operations` must be
|
|
6
|
+
* non-empty (the driver throws on an empty batch). Errors (including partial failures under
|
|
7
|
+
* `{ ordered: false }`) propagate unchanged, so callers can still catch `MongoBulkWriteError`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const bulkWriteDepartmentsSubjects: (operations: AnyBulkWriteOperation<DepartmentSubject>[], options?: BulkWriteOptions) => Promise<BulkWriteResult>;
|
|
10
|
+
//# sourceMappingURL=departmentsSubjects.setters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departmentsSubjects.setters.d.ts","sourceRoot":"","sources":["../../../src/municipal/departmentsSubjects/departmentsSubjects.setters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACvC,YAAY,qBAAqB,CAAC,iBAAiB,CAAC,EAAE,EACtD,UAAU,gBAAgB,KACzB,OAAO,CAAC,eAAe,CAEzB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bulkWriteDepartmentsSubjects = void 0;
|
|
4
|
+
const departmentsSubjects_getters_1 = require("./departmentsSubjects.getters");
|
|
5
|
+
/**
|
|
6
|
+
* Generic batch write for the departmentsSubjects collection — a thin passthrough to the
|
|
7
|
+
* driver's bulkWrite, with no diffing/key-building/business logic. `operations` must be
|
|
8
|
+
* non-empty (the driver throws on an empty batch). Errors (including partial failures under
|
|
9
|
+
* `{ ordered: false }`) propagate unchanged, so callers can still catch `MongoBulkWriteError`.
|
|
10
|
+
*/
|
|
11
|
+
const bulkWriteDepartmentsSubjects = async (operations, options) => {
|
|
12
|
+
return (0, departmentsSubjects_getters_1.getDepartmentsSubjectsCollection)().bulkWrite(operations, options);
|
|
13
|
+
};
|
|
14
|
+
exports.bulkWriteDepartmentsSubjects = bulkWriteDepartmentsSubjects;
|
|
15
|
+
//# sourceMappingURL=departmentsSubjects.setters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departmentsSubjects.setters.js","sourceRoot":"","sources":["../../../src/municipal/departmentsSubjects/departmentsSubjects.setters.ts"],"names":[],"mappings":";;;AAEA,+EAAiF;AAEjF;;;;;GAKG;AACI,MAAM,4BAA4B,GAAG,KAAK,EAC/C,UAAsD,EACtD,OAA0B,EACA,EAAE;IAC5B,OAAO,IAAA,8DAAgC,GAAE,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3E,CAAC,CAAC;AALW,QAAA,4BAA4B,gCAKvC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult } from "mongodb";
|
|
2
|
+
import { Street } from "./streets.types";
|
|
3
|
+
/**
|
|
4
|
+
* Generic batch write for the streets collection — a thin passthrough to the driver's
|
|
5
|
+
* bulkWrite, with no diffing/key-building/business logic. `operations` must be non-empty
|
|
6
|
+
* (the driver throws on an empty batch). Errors (including partial failures under
|
|
7
|
+
* `{ ordered: false }`) propagate unchanged, so callers can still catch `MongoBulkWriteError`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const bulkWriteStreets: (operations: AnyBulkWriteOperation<Street>[], options?: BulkWriteOptions) => Promise<BulkWriteResult>;
|
|
10
|
+
//# sourceMappingURL=streets.setters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streets.setters.d.ts","sourceRoot":"","sources":["../../../src/municipal/streets/streets.setters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAC3C,UAAU,gBAAgB,KACzB,OAAO,CAAC,eAAe,CAEzB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bulkWriteStreets = void 0;
|
|
4
|
+
const streets_getters_1 = require("./streets.getters");
|
|
5
|
+
/**
|
|
6
|
+
* Generic batch write for the streets collection — a thin passthrough to the driver's
|
|
7
|
+
* bulkWrite, with no diffing/key-building/business logic. `operations` must be non-empty
|
|
8
|
+
* (the driver throws on an empty batch). Errors (including partial failures under
|
|
9
|
+
* `{ ordered: false }`) propagate unchanged, so callers can still catch `MongoBulkWriteError`.
|
|
10
|
+
*/
|
|
11
|
+
const bulkWriteStreets = async (operations, options) => {
|
|
12
|
+
return (0, streets_getters_1.getStreetsCollection)().bulkWrite(operations, options);
|
|
13
|
+
};
|
|
14
|
+
exports.bulkWriteStreets = bulkWriteStreets;
|
|
15
|
+
//# sourceMappingURL=streets.setters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streets.setters.js","sourceRoot":"","sources":["../../../src/municipal/streets/streets.setters.ts"],"names":[],"mappings":";;;AAEA,uDAAyD;AAEzD;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACnC,UAA2C,EAC3C,OAA0B,EACA,EAAE;IAC5B,OAAO,IAAA,sCAAoB,GAAE,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reconcile/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reconcile.types"), exports);
|
|
18
|
+
__exportStar(require("./reconcile.ops"), exports);
|
|
19
|
+
__exportStar(require("./reconcile.diff"), exports);
|
|
20
|
+
__exportStar(require("./reconcile.execute"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reconcile/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,kDAAgC;AAChC,mDAAiC;AACjC,sDAAoC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Document } from "mongodb";
|
|
2
|
+
import { ReconcileConfig, ReconcileDiffResult } from "./reconcile.types";
|
|
3
|
+
export declare function computeReconcileDiff<TSource, TDb extends Document, TKey extends string | number>(config: ReconcileConfig<TSource, TDb, TKey>, now?: Date): ReconcileDiffResult<TDb>;
|
|
4
|
+
//# sourceMappingURL=reconcile.diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.diff.d.ts","sourceRoot":"","sources":["../../src/reconcile/reconcile.diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,GAAG,SAAS,QAAQ,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAC9F,MAAM,EAAE,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAC3C,GAAG,GAAE,IAAiB,GACrB,mBAAmB,CAAC,GAAG,CAAC,CA8C1B"}
|