nucleus-core-ts 0.9.830 → 0.9.831

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.
@@ -53,6 +53,13 @@ export function formatDuration(startedAt, finishedAt) {
53
53
  `${run.updatedCount} updated`,
54
54
  `${run.skippedCount} skipped`
55
55
  ];
56
+ // An import that also opened 877 logins did the largest thing it did that day
57
+ // and said nothing about it — the history read exactly like one that opened
58
+ // none, and the only way to tell was to go and count the users table.
59
+ if ((run.accountsCreatedCount ?? 0) > 0) parts.push(`${run.accountsCreatedCount} login(s)`);
60
+ if ((run.referencesCreatedCount ?? 0) > 0) {
61
+ parts.push(`${run.referencesCreatedCount} value(s) added elsewhere`);
62
+ }
56
63
  if (run.deletedCount > 0) parts.push(`${run.deletedCount} deleted`);
57
64
  if (run.deactivatedCount > 0) parts.push(`${run.deactivatedCount} deactivated`);
58
65
  if (run.errorCount > 0) parts.push(`${run.errorCount} failed`);
@@ -0,0 +1,47 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { countersLine } from './runFormat';
3
+ /**
4
+ * An import that also opened 877 logins did the largest thing it did that day.
5
+ * The history line read exactly like one that opened none, and the only way to
6
+ * tell them apart was to go and count the users table.
7
+ */ const run = (over)=>({
8
+ createdCount: 0,
9
+ updatedCount: 0,
10
+ skippedCount: 0,
11
+ deletedCount: 0,
12
+ deactivatedCount: 0,
13
+ errorCount: 0,
14
+ ...over
15
+ });
16
+ describe('the counts of a finished run', ()=>{
17
+ it('always says what it created, updated and skipped', ()=>{
18
+ expect(countersLine(run({
19
+ createdCount: 3,
20
+ updatedCount: 2,
21
+ skippedCount: 1
22
+ }))).toBe('3 created · 2 updated · 1 skipped');
23
+ });
24
+ it('says how many logins it opened', ()=>{
25
+ expect(countersLine(run({
26
+ createdCount: 880,
27
+ accountsCreatedCount: 877
28
+ }))).toContain('877 login(s)');
29
+ });
30
+ it('says what it added to other tables', ()=>{
31
+ expect(countersLine(run({
32
+ referencesCreatedCount: 2
33
+ }))).toContain('2 value(s) added elsewhere');
34
+ });
35
+ it('stays quiet about the kinds that did not happen', ()=>{
36
+ // A line of zeros is a line nobody reads.
37
+ const line = countersLine(run({
38
+ createdCount: 5
39
+ }));
40
+ expect(line).not.toContain('login');
41
+ expect(line).not.toContain('deleted');
42
+ expect(line).not.toContain('failed');
43
+ });
44
+ it('reads an older run that never recorded these at all', ()=>{
45
+ expect(()=>countersLine(run({}))).not.toThrow();
46
+ });
47
+ });
@@ -180,6 +180,10 @@ export type IntegrationRun = {
180
180
  totalFetched: number;
181
181
  sourceReportedTotal?: number | null;
182
182
  createdCount: number;
183
+ /** Logins this run opened so its records could be signed in to. */
184
+ accountsCreatedCount?: number;
185
+ /** Rows it added to OTHER tables so its records had something to point at. */
186
+ referencesCreatedCount?: number;
183
187
  updatedCount: number;
184
188
  skippedCount: number;
185
189
  deletedCount: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.9.830",
3
+ "version": "0.9.831",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",