@talkpilot/core-db 1.3.44 → 1.3.46
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/AGENTS.md +49 -0
- package/README.md +41 -0
- package/dist/configuration/models/models.constants.d.ts +1 -1
- package/dist/configuration/models/models.constants.d.ts.map +1 -1
- package/dist/configuration/models/models.constants.js +1 -1
- package/dist/configuration/models/models.constants.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- 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/calls/calls.types.d.ts +15 -0
- package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +39 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +92 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +4 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/index.d.ts +1 -0
- package/dist/talkpilot/clientsConfig/index.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/index.js +1 -0
- package/dist/talkpilot/clientsConfig/index.js.map +1 -1
- package/dist/test-utils/factories/index.d.ts +1 -0
- package/dist/test-utils/factories/index.d.ts.map +1 -1
- package/dist/test-utils/factories/index.js +1 -0
- package/dist/test-utils/factories/index.js.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.d.ts.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.js +5 -0
- package/dist/test-utils/factories/websitalk/scans.js.map +1 -1
- package/dist/websitalk/index.d.ts +1 -0
- package/dist/websitalk/index.d.ts.map +1 -1
- package/dist/websitalk/index.js +1 -0
- package/dist/websitalk/index.js.map +1 -1
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.types.d.ts +2 -4
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.types.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.getters.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.getters.js +8 -2
- package/dist/websitalk/scans/scans.getters.js.map +1 -1
- package/dist/websitalk/scans/scans.types.d.ts +5 -0
- package/dist/websitalk/scans/scans.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/configuration/models/models.constants.ts +1 -1
- package/src/index.ts +1 -0
- package/src/talkpilot/calls/calls.types.ts +16 -0
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.getters.spec.ts +318 -0
- package/src/talkpilot/clientsConfig/clientsConfig.constants.ts +2 -0
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +116 -2
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +4 -0
- package/src/talkpilot/clientsConfig/index.ts +1 -0
- package/src/test-utils/factories/index.ts +1 -0
- package/src/test-utils/factories/websitalk/scanResources.ts +26 -0
- package/src/test-utils/factories/websitalk/scans.ts +5 -0
- package/src/websitalk/index.ts +1 -0
- package/src/websitalk/knowledgeDocuments/__tests__/knowledgeDocuments.spec.ts +0 -19
- package/src/websitalk/knowledgeDocuments/knowledgeDocuments.types.ts +2 -2
- package/src/websitalk/scanResources/__tests__/scanResources.spec.ts +136 -0
- package/src/websitalk/scanResources/index.ts +4 -0
- package/src/websitalk/scanResources/scanResources.constants.ts +47 -0
- package/src/websitalk/scanResources/scanResources.getters.ts +94 -0
- package/src/websitalk/scanResources/scanResources.types.ts +90 -0
- package/src/websitalk/scanResources/scanResources.utils.ts +28 -0
- package/src/websitalk/scans/scans.getters.ts +8 -2
- package/src/websitalk/scans/scans.types.ts +9 -0
- 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.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/AGENTS.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# AI Agent Guide for core-db
|
|
2
|
+
|
|
3
|
+
Ground truth for AI coding agents in this repository. This is `@talkpilot/core-db` — the only package that should talk to Mongo. `.cursor/rules/development.mdc` exists but may lag (TalkPilot + Municipal only); do not expand those rules in an unrelated ticket.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
Shared Mongo layer: typed getters, schemas, factories, indexes. Consumed by TalkPilot, municipal, WebsiteTalk, and clinic services. Publishing a version here is how other repos pick up schema/getter changes.
|
|
7
|
+
|
|
8
|
+
## Coding philosophy
|
|
9
|
+
- Strict TypeScript. No `any`; use `unknown` and narrow.
|
|
10
|
+
- No narrating comments.
|
|
11
|
+
- Split types, getters, and schemas into separate files.
|
|
12
|
+
|
|
13
|
+
## Project structure
|
|
14
|
+
- `src/talkpilot/` — calls, flows, sessions, clients, phone numbers, subscriptions, …
|
|
15
|
+
- `src/municipal/` — cities, streets, tickets, departmentsSubjects, …
|
|
16
|
+
- `src/websitalk/` — scans, scanResources, websiteUrls.
|
|
17
|
+
- `src/configuration/` — prompts, models.
|
|
18
|
+
- `src/test-utils/` — Fishery factories and test DB helpers.
|
|
19
|
+
- `src/utils/` — validation, pagination, shared types.
|
|
20
|
+
- `dist/` is what consumers import — generated, tests excluded from the build.
|
|
21
|
+
|
|
22
|
+
## Copy this
|
|
23
|
+
New getter: `src/<domain>/<entity>/<entity>.types.ts` + `<entity>.getter.ts` (or `*.getters.ts`) + optional `<entity>.schema.ts` + barrel `index.ts` + `__tests__/<entity>.spec.ts`.
|
|
24
|
+
Export it from `src/index.ts`.
|
|
25
|
+
Examples: `src/talkpilot/calls/calls.getters.ts`, `src/talkpilot/phone_numbers/phone_numbers.getter.ts`.
|
|
26
|
+
|
|
27
|
+
Naming: `find*` for many, `get*ById` (or equivalent single-doc) for one. Always use that domain’s `getDb()` / collection helper — never another domain’s client. Exception already on disk: `src/talkpilot/calls/calls.statistics.getters.ts` imports municipal `tickets.statistics.getters` — do not “clean that up.”
|
|
28
|
+
|
|
29
|
+
## Where data lives
|
|
30
|
+
This repo **owns** `mongodb`. Four isolated clients — connect each independently:
|
|
31
|
+
|
|
32
|
+
- `mongodbClient` — TalkPilot
|
|
33
|
+
- `municipalDataMongodbClient` — municipal
|
|
34
|
+
- `websitalkMongodbClient` — WebsiteTalk
|
|
35
|
+
- `configurationMongodbClient` — configuration
|
|
36
|
+
|
|
37
|
+
Do not cross-import getters across domains, except the talkpilot call-stats → municipal tickets exception above.
|
|
38
|
+
|
|
39
|
+
## Do / don't
|
|
40
|
+
- Do not put HTTP, Express, or business orchestration here.
|
|
41
|
+
- Validate `MONGO_URI` (and siblings) on demand in `connect()`, using `src/utils/validation`.
|
|
42
|
+
- After a getter/schema change: bump package version, build, publish; then bump the consumer. Downstream pins skew — do not assume they are on latest.
|
|
43
|
+
- `prepare` runs `build` on install.
|
|
44
|
+
|
|
45
|
+
## Siblings
|
|
46
|
+
Every Node service should call getters from here. If a service is about to `getDb().collection` or `import from 'mongodb'`, the getter belongs in this PR first.
|
|
47
|
+
|
|
48
|
+
## Tests
|
|
49
|
+
Jest + `mongodb-memory-server` (`src/__tests__/setup.ts`). Factories in `src/test-utils/factories/`. Colocate `__tests__/` under the domain.
|
package/README.md
CHANGED
|
@@ -172,6 +172,9 @@ Refer to `DEVELOPMENT.md` for the full walkthrough, token instructions, and fact
|
|
|
172
172
|
| 1.3.35 | Fixed the configuration collection name (`Prompts` → `prompts`, matches the lowercase convention used elsewhere). **Breaking** if you inserted documents into a collection literally named `Prompts`. Added `Prompt.productName` (required) + `getPromptsByProduct`. Centralized configuration-DB env var reads into `src/config.ts`. |
|
|
173
173
|
| 1.3.36 | Publish combining the 1.3.33/1.3.35 configuration-DB work with the latest `main` (client quota + `clientDisplayName` + bulk-write/streets/departmentSubjects updates — see 1.3.28/1.3.29/1.3.32). No new code of its own. |
|
|
174
174
|
| 1.3.37 | Added `models` and `internalModels` collections under `configuration` (CP-1624): realtime/stt model catalog (`ModelDoc`, `getModelByModelId`, `getModelsByProvider`, `getModelsByType`, `getAvailableModelsByType`) and a name-keyed settings store (`InternalModel`, `getInternalModelByName`) for cross-service config previously hardcoded in consuming repos (e.g. TalkPilot Server's realtime/STT catalogs and its live transcription model). Read-only, same as `prompts` — documents are seeded/managed manually. |
|
|
175
|
+
| 1.3.38 | Added optional `transcriptionComparison` field to `Call` (CP-1594): per-`{provider}-{model}` side-channel transcription comparison results, same segment shape as `Call.transcription`. |
|
|
176
|
+
| 1.3.39 | Multi-scan support for WebsiteTalk (CP-1628): `clientsConfig.activeScanIds` (up to `MAX_ACTIVE_SCANS`) and `primaryScanId` replace the single `activeScanId` for search; `addActiveScanId`/`removeActiveScanId`/`getActiveScanIds`, `setPrimaryScanId`/`clearPrimaryScanId`/`getPrimaryScanId`. `getActiveScanIds` falls back to the legacy singular field, so pre-migration clients keep working. |
|
|
177
|
+
| 1.3.40 | Live scan progress for WebsiteTalk (CP-1527): `scanResources` module with KPI counts, board pagination, and page detail; terminal snapshot fields on `Scan`. |
|
|
175
178
|
|
|
176
179
|
### 1.1.9
|
|
177
180
|
|
|
@@ -694,6 +697,44 @@ New `models` and `internalModels` collections under the `configuration` database
|
|
|
694
697
|
|
|
695
698
|
No — purely additive. Consumers opt in by importing the getters above.
|
|
696
699
|
|
|
700
|
+
### 1.3.38 — Transcription comparison field (CP-1594)
|
|
701
|
+
|
|
702
|
+
Added an optional `transcriptionComparison` field to `Call`, for consumers that run side-channel transcription comparisons across multiple providers/models alongside the real `transcription` field.
|
|
703
|
+
|
|
704
|
+
**Added**
|
|
705
|
+
|
|
706
|
+
| Export | Purpose |
|
|
707
|
+
| --- | --- |
|
|
708
|
+
| `Call.transcriptionComparison` | Optional `Record<string, TranscriptionSegment[]>` — one entry per `{provider}-{model}` key, each an array of `TranscriptionSegment` in the same shape as `Call.transcription`. |
|
|
709
|
+
|
|
710
|
+
**Do I need to update my app?**
|
|
711
|
+
|
|
712
|
+
No — purely additive. Existing documents and consumers continue to work unchanged.
|
|
713
|
+
|
|
714
|
+
### 1.3.39 — Multi-scan support for WebsiteTalk (CP-1628)
|
|
715
|
+
|
|
716
|
+
Adds support for multiple simultaneously active scans per client (up to `MAX_ACTIVE_SCANS`, currently 3), plus a `primaryScanId` that decouples "which scans back search" from "which scan seeds the call's opening line."
|
|
717
|
+
|
|
718
|
+
**Added**
|
|
719
|
+
|
|
720
|
+
| Export | Purpose |
|
|
721
|
+
| --- | --- |
|
|
722
|
+
| `MAX_ACTIVE_SCANS` | Max number of scans a client may have active at once. |
|
|
723
|
+
| `WebsiteTalkProduct.activeScanIds` | Optional scan id list backing search, alongside the legacy singular `activeScanId`. |
|
|
724
|
+
| `WebsiteTalkProduct.primaryScanId` | Optional single scan id whose content seeds the phone call's opening description. |
|
|
725
|
+
| `getActiveScanIds(clientId)` | Returns `activeScanIds`, falling back to wrapping the legacy `activeScanId` when the list is absent. |
|
|
726
|
+
| `addActiveScanId(clientId, scanId)` | Adds a scan to the active list; throws once `MAX_ACTIVE_SCANS` is reached. |
|
|
727
|
+
| `removeActiveScanId(clientId, scanId)` | Removes a scan from the active list; also clears the legacy singular field when it matches. |
|
|
728
|
+
| `getPrimaryScanId` / `setPrimaryScanId` / `clearPrimaryScanId` | Read/set/clear the primary scan id. |
|
|
729
|
+
|
|
730
|
+
**Do I need to update my app?**
|
|
731
|
+
|
|
732
|
+
No — purely additive, and `getActiveScanIds` keeps working for clients still on the legacy singular `activeScanId`. WTIS should upgrade to 1.3.39 to use the new multi-scan getters.
|
|
733
|
+
|
|
734
|
+
### 1.3.40 — Live scan progress (CP-1527)
|
|
735
|
+
|
|
736
|
+
Adds the `scanResources` module so WebsiteTalk can show live per-page scan progress. Use `getScanKpiCounts` for status totals while a scan is running (do not use `Scan.pagesCompleted` / related fields for live UI — those are a finalize-only snapshot), `getScanPages` for a cursor-paginated board column, and `getScanResourceById` for page detail. `Scan` also gains optional terminal fields (`startedAt`, `completedAt`, `pagesCompleted`, `pagesFailedPermanent`, `pagesDuplicate`) written once when the scan finishes.
|
|
737
|
+
|
|
697
738
|
## 🛠 CI/CD & deployment
|
|
698
739
|
|
|
699
740
|
- 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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MODELS_COLLECTION = "models";
|
|
2
2
|
export declare const MODEL_TYPES: readonly ["realtime", "stt"];
|
|
3
|
-
export declare const REALTIME_MODEL_PROVIDERS: readonly ["openai", "gemini"];
|
|
3
|
+
export declare const REALTIME_MODEL_PROVIDERS: readonly ["openai", "gemini", "xai"];
|
|
4
4
|
export declare const STT_MODEL_PROVIDERS: readonly ["openai-stt", "google-stt", "deepgram-stt", "deepgram-flux", "elevenlabs-scribe", "gladia-stt"];
|
|
5
5
|
//# sourceMappingURL=models.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.constants.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,WAAW,8BAA+B,CAAC;AAExD,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"models.constants.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,WAAW,8BAA+B,CAAC;AAExD,eAAO,MAAM,wBAAwB,sCAAuC,CAAC;AAC7E,eAAO,MAAM,mBAAmB,2GAOtB,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.STT_MODEL_PROVIDERS = exports.REALTIME_MODEL_PROVIDERS = exports.MODEL_TYPES = exports.MODELS_COLLECTION = void 0;
|
|
4
4
|
exports.MODELS_COLLECTION = "models";
|
|
5
5
|
exports.MODEL_TYPES = ["realtime", "stt"];
|
|
6
|
-
exports.REALTIME_MODEL_PROVIDERS = ["openai", "gemini"];
|
|
6
|
+
exports.REALTIME_MODEL_PROVIDERS = ["openai", "gemini", "xai"];
|
|
7
7
|
exports.STT_MODEL_PROVIDERS = [
|
|
8
8
|
"openai-stt",
|
|
9
9
|
"google-stt",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.constants.js","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE7B,QAAA,WAAW,GAAG,CAAC,UAAU,EAAE,KAAK,CAAU,CAAC;AAE3C,QAAA,wBAAwB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"models.constants.js","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE7B,QAAA,WAAW,GAAG,CAAC,UAAU,EAAE,KAAK,CAAU,CAAC;AAE3C,QAAA,wBAAwB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAChE,QAAA,mBAAmB,GAAG;IACjC,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,YAAY;CACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./municipal/utils/types";
|
|
|
12
12
|
export { websitalkMongodbClient, getDb as getWebsitalkDb, setDb as setWebsitalkDb, ObjectId as WebsitalkObjectId, } from "./websitalk";
|
|
13
13
|
export * from "./websitalk/scans/scans.getters";
|
|
14
14
|
export type * from "./websitalk/scans/scans.types";
|
|
15
|
+
export * from "./websitalk/scanResources";
|
|
15
16
|
export * from "./websitalk/websiteUrls";
|
|
16
17
|
export * from "./websitalk/knowledgeDocuments/knowledgeDocuments.constants";
|
|
17
18
|
export * from "./websitalk/knowledgeDocuments/knowledgeDocuments.getters";
|
package/dist/index.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,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "getWebsitalkDb", { enumerable: true, get: functi
|
|
|
37
37
|
Object.defineProperty(exports, "setWebsitalkDb", { enumerable: true, get: function () { return websitalk_1.setDb; } });
|
|
38
38
|
Object.defineProperty(exports, "WebsitalkObjectId", { enumerable: true, get: function () { return websitalk_1.ObjectId; } });
|
|
39
39
|
__exportStar(require("./websitalk/scans/scans.getters"), exports);
|
|
40
|
+
__exportStar(require("./websitalk/scanResources"), exports);
|
|
40
41
|
__exportStar(require("./websitalk/websiteUrls"), exports);
|
|
41
42
|
__exportStar(require("./websitalk/knowledgeDocuments/knowledgeDocuments.constants"), exports);
|
|
42
43
|
__exportStar(require("./websitalk/knowledgeDocuments/knowledgeDocuments.getters"), exports);
|
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;AACxC,8FAA4E;AAC5E,4FAA0E;AAG1E,iDAIyB;AAHvB,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,KAAK,OAAsB;AAC3B,mHAAA,KAAK,OAAsB;AAE7B,0DAAwC;AACxC,yDAAuC;AACvC,iEAA+C;AAE/C,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,4DAA0C;AAC1C,0DAAwC;AACxC,8FAA4E;AAC5E,4FAA0E;AAG1E,iDAIyB;AAHvB,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,KAAK,OAAsB;AAC3B,mHAAA,KAAK,OAAsB;AAE7B,0DAAwC;AACxC,yDAAuC;AACvC,iEAA+C;AAE/C,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeReconcileDiff = computeReconcileDiff;
|
|
4
|
+
function computeReconcileDiff(config, now = new Date()) {
|
|
5
|
+
const { source, dbRecords, getSourceKey, getDbKey, buildInsertOp, buildUpdateOp, buildDeactivateOp, shouldDeactivate = () => true, } = config;
|
|
6
|
+
const dbByKey = new Map(dbRecords.map((dbRecord) => [getDbKey(dbRecord), dbRecord]));
|
|
7
|
+
const sourceKeys = new Set();
|
|
8
|
+
const bulkOps = [];
|
|
9
|
+
const counts = { inserted: 0, updated: 0, deactivated: 0, exists: 0 };
|
|
10
|
+
for (const sourceRecord of source) {
|
|
11
|
+
const key = getSourceKey(sourceRecord);
|
|
12
|
+
sourceKeys.add(key);
|
|
13
|
+
const dbRecord = dbByKey.get(key);
|
|
14
|
+
if (!dbRecord) {
|
|
15
|
+
bulkOps.push(buildInsertOp(sourceRecord, now));
|
|
16
|
+
counts.inserted++;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const updateOp = buildUpdateOp(sourceRecord, dbRecord, now);
|
|
20
|
+
if (updateOp) {
|
|
21
|
+
bulkOps.push(updateOp);
|
|
22
|
+
counts.updated++;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
counts.exists++;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const dbRecord of dbRecords) {
|
|
29
|
+
if (!sourceKeys.has(getDbKey(dbRecord)) && shouldDeactivate(dbRecord)) {
|
|
30
|
+
bulkOps.push(buildDeactivateOp(dbRecord, now));
|
|
31
|
+
counts.deactivated++;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { bulkOps, counts };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=reconcile.diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.diff.js","sourceRoot":"","sources":["../../src/reconcile/reconcile.diff.ts"],"names":[],"mappings":";;AAGA,oDAiDC;AAjDD,SAAgB,oBAAoB,CAClC,MAA2C,EAC3C,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,EACJ,MAAM,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,GAC9B,GAAG,MAAM,CAAC;IAEX,MAAM,OAAO,GAAG,IAAI,GAAG,CAAY,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChG,MAAM,UAAU,GAAG,IAAI,GAAG,EAAQ,CAAC;IAEnC,MAAM,OAAO,GAAwC,EAAE,CAAC;IACxD,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAEtE,KAAK,MAAM,YAAY,IAAI,MAAM,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QACvC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,QAAQ,EAAE,CAAC;YAClB,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BulkWriteOptions, Collection, Document } from "mongodb";
|
|
2
|
+
import { BulkWriteOp } from "./reconcile.types";
|
|
3
|
+
export interface ExecuteReconcileBulkWriteResult {
|
|
4
|
+
errors: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function executeReconcileBulkWrite<TDb extends Document>(collection: Collection<TDb>, bulkOps: BulkWriteOp<TDb>[], options?: BulkWriteOptions): Promise<ExecuteReconcileBulkWriteResult>;
|
|
7
|
+
//# sourceMappingURL=reconcile.execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.execute.d.ts","sourceRoot":"","sources":["../../src/reconcile/reconcile.execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAuB,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAsB,yBAAyB,CAAC,GAAG,SAAS,QAAQ,EAClE,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,EAC3B,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,EAC3B,OAAO,GAAE,gBAAqC,GAC7C,OAAO,CAAC,+BAA+B,CAAC,CAa1C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeReconcileBulkWrite = executeReconcileBulkWrite;
|
|
4
|
+
const mongodb_1 = require("mongodb");
|
|
5
|
+
async function executeReconcileBulkWrite(collection, bulkOps, options = { ordered: false }) {
|
|
6
|
+
if (bulkOps.length === 0)
|
|
7
|
+
return { errors: [] };
|
|
8
|
+
try {
|
|
9
|
+
await collection.bulkWrite(bulkOps, options);
|
|
10
|
+
return { errors: [] };
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
if (err instanceof mongodb_1.MongoBulkWriteError) {
|
|
14
|
+
const writeErrors = [err.writeErrors].flat();
|
|
15
|
+
return { errors: writeErrors.map((writeError) => `Write error: ${writeError.errmsg}`) };
|
|
16
|
+
}
|
|
17
|
+
return { errors: [err instanceof Error ? err.message : String(err)] };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=reconcile.execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.execute.js","sourceRoot":"","sources":["../../src/reconcile/reconcile.execute.ts"],"names":[],"mappings":";;AAOA,8DAiBC;AAxBD,qCAAsF;AAO/E,KAAK,UAAU,yBAAyB,CAC7C,UAA2B,EAC3B,OAA2B,EAC3B,UAA4B,EAAE,OAAO,EAAE,KAAK,EAAE;IAE9C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAEhD,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,6BAAmB,EAAE,CAAC;YACvC,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7C,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,gBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC1F,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Document, Filter } from "mongodb";
|
|
2
|
+
import { BulkWriteOp } from "./reconcile.types";
|
|
3
|
+
/**
|
|
4
|
+
* updateOne with a plain $set — e.g. a deactivation:
|
|
5
|
+
* buildSetOp({ _id }, { isActive: false, updatedAt: now })
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildSetOp<T extends Document>(filter: Filter<T>, setFields: Partial<T>): BulkWriteOp<T>;
|
|
8
|
+
/**
|
|
9
|
+
* updateOne with $set + $setOnInsert + upsert:true.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildUpsertOp<T extends Document>(filter: Filter<T>, setFields: Partial<T>, setOnInsertFields?: Partial<T>): BulkWriteOp<T>;
|
|
12
|
+
//# sourceMappingURL=reconcile.ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.ops.d.ts","sourceRoot":"","sources":["../../src/reconcile/reconcile.ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAEvG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,QAAQ,EAC9C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EACrB,iBAAiB,GAAE,OAAO,CAAC,CAAC,CAAM,GACjC,WAAW,CAAC,CAAC,CAAC,CAQhB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSetOp = buildSetOp;
|
|
4
|
+
exports.buildUpsertOp = buildUpsertOp;
|
|
5
|
+
/**
|
|
6
|
+
* updateOne with a plain $set — e.g. a deactivation:
|
|
7
|
+
* buildSetOp({ _id }, { isActive: false, updatedAt: now })
|
|
8
|
+
*/
|
|
9
|
+
function buildSetOp(filter, setFields) {
|
|
10
|
+
return { updateOne: { filter, update: { $set: setFields } } };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* updateOne with $set + $setOnInsert + upsert:true.
|
|
14
|
+
*/
|
|
15
|
+
function buildUpsertOp(filter, setFields, setOnInsertFields = {}) {
|
|
16
|
+
return {
|
|
17
|
+
updateOne: {
|
|
18
|
+
filter,
|
|
19
|
+
update: { $set: setFields, $setOnInsert: setOnInsertFields },
|
|
20
|
+
upsert: true,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=reconcile.ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.ops.js","sourceRoot":"","sources":["../../src/reconcile/reconcile.ops.ts"],"names":[],"mappings":";;AAOA,gCAEC;AAKD,sCAYC;AAvBD;;;GAGG;AACH,SAAgB,UAAU,CAAqB,MAAiB,EAAE,SAAqB;IACrF,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAC3B,MAAiB,EACjB,SAAqB,EACrB,oBAAgC,EAAE;IAElC,OAAO;QACL,SAAS,EAAE;YACT,MAAM;YACN,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE;YAC5D,MAAM,EAAE,IAAI;SACb;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnyBulkWriteOperation, Document } from "mongodb";
|
|
2
|
+
export type BulkWriteOp<T extends Document> = AnyBulkWriteOperation<T>;
|
|
3
|
+
export interface ReconcileCounts {
|
|
4
|
+
inserted: number;
|
|
5
|
+
updated: number;
|
|
6
|
+
deactivated: number;
|
|
7
|
+
exists: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ReconcileDiffResult<TDb extends Document> {
|
|
10
|
+
bulkOps: BulkWriteOp<TDb>[];
|
|
11
|
+
counts: ReconcileCounts;
|
|
12
|
+
}
|
|
13
|
+
export interface ReconcileConfig<TSource, TDb extends Document, TKey extends string | number> {
|
|
14
|
+
source: TSource[];
|
|
15
|
+
dbRecords: TDb[];
|
|
16
|
+
getSourceKey: (source: TSource) => TKey;
|
|
17
|
+
getDbKey: (dbRecord: TDb) => TKey;
|
|
18
|
+
buildInsertOp: (source: TSource, now: Date) => BulkWriteOp<TDb>;
|
|
19
|
+
/** Return null when unchanged — counted as `exists`, no op emitted. */
|
|
20
|
+
buildUpdateOp: (source: TSource, existing: TDb, now: Date) => BulkWriteOp<TDb> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Called for every dbRecord missing from source (and passing shouldDeactivate).
|
|
23
|
+
* The caller decides the op shape entirely — typically via buildSetOp.
|
|
24
|
+
*/
|
|
25
|
+
buildDeactivateOp: (dbRecord: TDb, now: Date) => BulkWriteOp<TDb>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a missing dbRecord should even be considered for deactivation.
|
|
28
|
+
* Defaults to always true — core-db has no opinion on what "already inactive" means.
|
|
29
|
+
*/
|
|
30
|
+
shouldDeactivate?: (dbRecord: TDb) => boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=reconcile.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.types.d.ts","sourceRoot":"","sources":["../../src/reconcile/reconcile.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB,CAAC,GAAG,SAAS,QAAQ;IACvD,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,eAAe,CAAC,OAAO,EAAE,GAAG,SAAS,QAAQ,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;IAC1F,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;IAChE,uEAAuE;IACvE,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,KAAK,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACtF;;;OAGG;IACH,iBAAiB,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;IAClE;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.types.js","sourceRoot":"","sources":["../../src/reconcile/reconcile.types.ts"],"names":[],"mappings":""}
|
|
@@ -33,7 +33,22 @@ export type Call = {
|
|
|
33
33
|
isConferenceCall?: boolean;
|
|
34
34
|
conferenceRole?: ConferenceRole;
|
|
35
35
|
redirectedCall?: boolean;
|
|
36
|
+
/** Present only on redirected calls: what the dialled leg did. */
|
|
37
|
+
redirectCallLog?: RedirectCallLog;
|
|
36
38
|
toolExecutions?: ToolExecution[];
|
|
39
|
+
transcriptionComparison?: Record<string, TranscriptionSegment[]>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The outcome of the <Dial> that transferred a call, reported by Twilio when the
|
|
43
|
+
* dialled leg ends. `durationSeconds` is the bridged time, which is 0 when the
|
|
44
|
+
* destination never answered.
|
|
45
|
+
*/
|
|
46
|
+
export type RedirectCallLog = {
|
|
47
|
+
childCallSid?: string;
|
|
48
|
+
to?: string;
|
|
49
|
+
status: CallStatus;
|
|
50
|
+
durationSeconds: number;
|
|
51
|
+
endedAt: Date;
|
|
37
52
|
};
|
|
38
53
|
export type ToolExecution = {
|
|
39
54
|
toolName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calls.types.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/calls/calls.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,OAAO,wBAAwB,GAC/B,OAAO,0BAA0B,GACjC,IAAI,CAAC;AAET,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAElF,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB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;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,CAAC"}
|
|
@@ -7,8 +7,47 @@ export declare const getClientConfigByPhone: (phone: string) => Promise<import("
|
|
|
7
7
|
export declare const createClientConfigDoc: (clientConfig: ClientConfigDoc) => Promise<void>;
|
|
8
8
|
export declare function updateProductConfig<K extends KnownProductKey>(clientId: string, productKey: K, updates: Partial<Products[K]>): Promise<void>;
|
|
9
9
|
export declare const getActiveScanId: (clientId: string) => Promise<string | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the client's active scan ids as a list.
|
|
12
|
+
* Falls back to wrapping the legacy singular `activeScanId` field when
|
|
13
|
+
* `activeScanIds` is absent — lets clients on the old field keep working
|
|
14
|
+
* without a data migration.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getActiveScanIds: (clientId: string) => Promise<string[]>;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `addActiveScanId` instead — supports multiple simultaneously
|
|
19
|
+
* active scans. This function overwrites the entire single-value field.
|
|
20
|
+
*/
|
|
10
21
|
export declare const updateActiveScanId: (clientId: string, scanId: string) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Adds a scan id to the client's active list. Writes the full list back
|
|
24
|
+
* (rather than a bare array append) so a client still on the legacy
|
|
25
|
+
* singular field gets migrated instead of silently losing it.
|
|
26
|
+
*/
|
|
27
|
+
export declare const addActiveScanId: (clientId: string, scanId: string) => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `removeActiveScanId` instead — removes a single scan from
|
|
30
|
+
* the active list without clearing the others.
|
|
31
|
+
*/
|
|
11
32
|
export declare const clearActiveScanId: (clientId: string) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Removes a single scan id from the active list. Also clears the legacy
|
|
35
|
+
* singular field when it matches, so a not-yet-migrated client's removal
|
|
36
|
+
* actually takes effect instead of silently no-op'ing.
|
|
37
|
+
*/
|
|
38
|
+
export declare const removeActiveScanId: (clientId: string, scanId: string) => Promise<void>;
|
|
39
|
+
/** Returns the scan whose content seeds the phone call's opening description, if one is set. */
|
|
40
|
+
export declare const getPrimaryScanId: (clientId: string) => Promise<string | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the primary scan, replacing whatever was set before — exactly one
|
|
43
|
+
* primary scan at a time. Throws if the client doesn't exist.
|
|
44
|
+
*/
|
|
45
|
+
export declare const setPrimaryScanId: (clientId: string, scanId: string) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Clears the primary scan. Callers that need the opening description fall
|
|
48
|
+
* back to the first active scan. Throws if the client doesn't exist.
|
|
49
|
+
*/
|
|
50
|
+
export declare const clearPrimaryScanId: (clientId: string) => Promise<void>;
|
|
12
51
|
export declare function listClientIdsWithConfiguredQuota(): Promise<string[]>;
|
|
13
52
|
export declare function incrementClientQuotaUsage(clientId: string, amount?: number): Promise<void>;
|
|
14
53
|
export declare function resetClientQuotaUsage(clientId: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientsConfig.getters.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/clientsConfig/clientsConfig.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,QAAQ,EAER,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"clientsConfig.getters.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/clientsConfig/clientsConfig.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,QAAQ,EAER,eAA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