@curless/hotel-storefront 0.71.0 → 0.71.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/fake-ota.d.ts.map +1 -1
- package/dist/account/fake-ota.js +4 -0
- package/dist/account/fake-ota.js.map +1 -1
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +17 -15
- package/dist/account/index.js.map +1 -1
- package/dist/account/ota-member.d.ts +3 -3
- package/dist/account/ota-member.d.ts.map +1 -1
- package/dist/account/ota-member.js +7 -5
- package/dist/account/ota-member.js.map +1 -1
- package/dist/account/pages.d.ts +5 -7
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +11 -15
- package/dist/account/pages.js.map +1 -1
- package/dist/account/store.d.ts +6 -6
- package/dist/account/store.d.ts.map +1 -1
- package/dist/account/store.js +8 -6
- package/dist/account/store.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/legal.js +1 -1
- package/dist/legal.js.map +1 -1
- package/dist/otaless/backend.d.ts +9 -0
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +57 -5
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/booking.d.ts +23 -0
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +82 -22
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +17 -0
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +19 -3
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +14 -0
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +9 -3
- package/dist/otaless/fake.js.map +1 -1
- package/dist/otaless/make.d.ts +7 -0
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +28 -0
- package/dist/otaless/make.js.map +1 -1
- package/dist/present.d.ts +6 -0
- package/dist/present.d.ts.map +1 -1
- package/dist/present.js +15 -0
- package/dist/present.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +43 -5
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usage/geo.d.ts +42 -2
- package/dist/usage/geo.d.ts.map +1 -1
- package/dist/usage/geo.js +81 -32
- package/dist/usage/geo.js.map +1 -1
- package/dist/usage/range.d.ts +1 -7
- package/dist/usage/range.d.ts.map +1 -1
- package/dist/usage/range.js +15 -20
- package/dist/usage/range.js.map +1 -1
- package/dist/usage/report.d.ts +54 -3
- package/dist/usage/report.d.ts.map +1 -1
- package/dist/usage/report.js +190 -59
- package/dist/usage/report.js.map +1 -1
- package/dist/usage/store.d.ts +10 -2
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +41 -2
- package/dist/usage/store.js.map +1 -1
- package/package.json +1 -1
package/dist/usage/report.d.ts
CHANGED
|
@@ -11,6 +11,44 @@ export declare const BEIJING: Tz;
|
|
|
11
11
|
export declare const UTC_TZ: Tz;
|
|
12
12
|
export declare const dayIn: (t: string | number, tz: Tz) => string;
|
|
13
13
|
export declare const addDays: (day: string, n: number) => string;
|
|
14
|
+
/**
|
|
15
|
+
* The most ids one report holds - every copy of every id, in every set and map
|
|
16
|
+
* it keeps (Held). Taken from @curless/shopify-storefront 0.77.3, which
|
|
17
|
+
* measured it on a 64 MB day shaped like a ChatGPT flood (311,000 lines, each
|
|
18
|
+
* a new user, conversation and connection, with a country): 45 units a line,
|
|
19
|
+
* 40 bytes a unit kept and 57 at the peak. At this ceiling the same day peaks
|
|
20
|
+
* at 150 MB, and at 380 MB beside a full `seen.json` - under the CLI's 512 MB
|
|
21
|
+
* heap. The hotels add the groups' buckets (`byShop`), a few more units a line.
|
|
22
|
+
*/
|
|
23
|
+
export declare const MAX_HELD = 3000000;
|
|
24
|
+
/**
|
|
25
|
+
* ⚠️ EVERY COPY COUNTS (总线程 11-13, review of the shopify 0.77.2 copy: the
|
|
26
|
+
* hotel usage code still had the same P3). A conversation sits in the window's
|
|
27
|
+
* sets and its day's, its platform's, its country's, its platform × country's
|
|
28
|
+
* and its group's, the funnel's and the account's; a user in those and in who
|
|
29
|
+
* was seen before. Counting the window's ids once each missed the rest.
|
|
30
|
+
*
|
|
31
|
+
* At the ceiling nothing more goes in: counts that need no id (calls, bookings
|
|
32
|
+
* by outcome, sign-ins, linked memberships, cart adds, checkouts) stay exact,
|
|
33
|
+
* the distinct ones stop where they were, and the report names the days
|
|
34
|
+
* (`capped`).
|
|
35
|
+
*/
|
|
36
|
+
export declare class Held {
|
|
37
|
+
readonly max: number;
|
|
38
|
+
n: number;
|
|
39
|
+
full: boolean;
|
|
40
|
+
constructor(max?: number);
|
|
41
|
+
/** An id into a set - refused at the ceiling, so the set stops growing there. */
|
|
42
|
+
add(s: Set<string>, v: string): void;
|
|
43
|
+
/** Room for something bigger than one id - false at the ceiling (or at `upTo`, a part of it). */
|
|
44
|
+
room(cost: number, upTo?: number): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Something held whatever the ceiling: a bucket. There are only so many
|
|
47
|
+
* (days × platforms × countries × groups) - but a long window's are counted,
|
|
48
|
+
* so an exact report over too many of them gives up like one over too many ids.
|
|
49
|
+
*/
|
|
50
|
+
must(cost: number): void;
|
|
51
|
+
}
|
|
14
52
|
export type Row = {
|
|
15
53
|
users: number;
|
|
16
54
|
newUsers: number;
|
|
@@ -96,6 +134,8 @@ export type DayTotals = {
|
|
|
96
134
|
booking: BookingSummary;
|
|
97
135
|
member: MemberSummary;
|
|
98
136
|
imported: boolean;
|
|
137
|
+
/** Users, conversations and connections stopped at the ceiling (Held): at least these. */
|
|
138
|
+
capped?: true;
|
|
99
139
|
};
|
|
100
140
|
export type ToolRow = {
|
|
101
141
|
tool: string;
|
|
@@ -127,6 +167,8 @@ export type Report = {
|
|
|
127
167
|
member: MemberSummary;
|
|
128
168
|
/** Days with imported requests (no tool names) in the window. */
|
|
129
169
|
importedDays: string[];
|
|
170
|
+
/** Days whose users, conversations and connections stopped at the ceiling - at least these. */
|
|
171
|
+
capped?: string[];
|
|
130
172
|
};
|
|
131
173
|
/**
|
|
132
174
|
* When a pseudonym was first seen - the maintenance's index (maintain.ts), so
|
|
@@ -162,12 +204,15 @@ export declare class ReportBuilder {
|
|
|
162
204
|
private readonly booking;
|
|
163
205
|
private readonly member;
|
|
164
206
|
private readonly tools;
|
|
207
|
+
private readonly held;
|
|
165
208
|
private readonly account;
|
|
166
209
|
private readonly imported;
|
|
167
210
|
private readonly funnel;
|
|
168
|
-
constructor(from: string, to: string, deployment?: string | null, tz?: Tz, seen?: SeenIndex | undefined);
|
|
169
|
-
/**
|
|
170
|
-
|
|
211
|
+
constructor(from: string, to: string, deployment?: string | null, tz?: Tz, seen?: SeenIndex | undefined, maxHeld?: number);
|
|
212
|
+
/** What it holds, in ids (Held) - every copy counted. */
|
|
213
|
+
get size(): number;
|
|
214
|
+
/** At the ceiling: its distinct counts stopped growing - an exact report is no longer one. */
|
|
215
|
+
get full(): boolean;
|
|
171
216
|
private mine;
|
|
172
217
|
/**
|
|
173
218
|
* First pass: where each user and conversation was seen, within the window.
|
|
@@ -178,6 +223,12 @@ export declare class ReportBuilder {
|
|
|
178
223
|
*/
|
|
179
224
|
place(e: UsageEvent): void;
|
|
180
225
|
private placeOf;
|
|
226
|
+
/**
|
|
227
|
+
* A user seen - true if seen before. Held like every other id: with no
|
|
228
|
+
* `seen.json` that is every user of the 13 months before the window.
|
|
229
|
+
*/
|
|
230
|
+
private userSeen;
|
|
231
|
+
private shopperSeen;
|
|
181
232
|
/** Second pass: count it. */
|
|
182
233
|
add(raw: UsageEvent): void;
|
|
183
234
|
build(): Report;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/usage/report.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAMnD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MACmB,CAAC;AAEzD,oDAAoD;AACpD,MAAM,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACrD,eAAO,MAAM,OAAO,EAAE,EAA8C,CAAC;AACrE,eAAO,MAAM,MAAM,EAAE,EAAkC,CAAC;AAExD,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,KAAG,MAGlC,CAAC;AAElB,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,GAAG,MAAM,KAAG,MAIhD,CAAC;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/usage/report.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAMnD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MACmB,CAAC;AAEzD,oDAAoD;AACpD,MAAM,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACrD,eAAO,MAAM,OAAO,EAAE,EAA8C,CAAC;AACrE,eAAO,MAAM,MAAM,EAAE,EAAkC,CAAC;AAExD,eAAO,MAAM,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AAG,IAAI,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,EAAE,KAAK,MAAM,KAAG,WAAW,GAAG,IAKlE,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,WAAW,EAAE,EACpB,MAAM,MAAM,EACZ,IAAI,MAAM,EACV,YAAY,MAAM,GAAG,IAAI,EACzB,IAAI,EAAE,EACN,SAAQ,MAAM,CAAC,QAAQ,CAAoB,KAC1C,MA2FF,CAAC;AASF,2CAA2C;AAC3C,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,EAAE,MAAM,MAAM,KAAG,MA8BrD,CAAC;AAKF,sDAAsD;AACtD,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,EAAE,MAAM,MAAM,KAAG,MA0GpD,CAAC"}
|
package/dist/usage/report.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copied from @curless/shopify-storefront src/usage/report.ts (0.77.2): the same
|
|
1
|
+
// Copied from @curless/shopify-storefront src/usage/report.ts (0.77.2, memory ceiling 0.77.3): the same
|
|
2
2
|
// counts and the same daily totals (docs/usage-events.md §8), so the dashboard
|
|
3
3
|
// reads both alike. What the hotels add - booking outcomes, linked memberships,
|
|
4
4
|
// the groups (`byShop`) - rides beside them as keys of their own.
|
|
@@ -49,15 +49,84 @@ const bucket = () => ({
|
|
|
49
49
|
signIns: 0,
|
|
50
50
|
shoppers: new Set(),
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* The most ids one report holds - every copy of every id, in every set and map
|
|
54
|
+
* it keeps (Held). Taken from @curless/shopify-storefront 0.77.3, which
|
|
55
|
+
* measured it on a 64 MB day shaped like a ChatGPT flood (311,000 lines, each
|
|
56
|
+
* a new user, conversation and connection, with a country): 45 units a line,
|
|
57
|
+
* 40 bytes a unit kept and 57 at the peak. At this ceiling the same day peaks
|
|
58
|
+
* at 150 MB, and at 380 MB beside a full `seen.json` - under the CLI's 512 MB
|
|
59
|
+
* heap. The hotels add the groups' buckets (`byShop`), a few more units a line.
|
|
60
|
+
*/
|
|
61
|
+
export const MAX_HELD = 3_000_000;
|
|
62
|
+
/** What holding something costs, in units of one id in one set. */
|
|
63
|
+
const COST = {
|
|
64
|
+
/** A day, platform, country, platform × country or group: five sets and an object. */
|
|
65
|
+
bucket: 8,
|
|
66
|
+
/** A user or conversation's places (ReportBuilder.place): a map of its own. */
|
|
67
|
+
who: 4,
|
|
68
|
+
/** A tool's row. */
|
|
69
|
+
tool: 4,
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* ⚠️ EVERY COPY COUNTS (总线程 11-13, review of the shopify 0.77.2 copy: the
|
|
73
|
+
* hotel usage code still had the same P3). A conversation sits in the window's
|
|
74
|
+
* sets and its day's, its platform's, its country's, its platform × country's
|
|
75
|
+
* and its group's, the funnel's and the account's; a user in those and in who
|
|
76
|
+
* was seen before. Counting the window's ids once each missed the rest.
|
|
77
|
+
*
|
|
78
|
+
* At the ceiling nothing more goes in: counts that need no id (calls, bookings
|
|
79
|
+
* by outcome, sign-ins, linked memberships, cart adds, checkouts) stay exact,
|
|
80
|
+
* the distinct ones stop where they were, and the report names the days
|
|
81
|
+
* (`capped`).
|
|
82
|
+
*/
|
|
83
|
+
export class Held {
|
|
84
|
+
max;
|
|
85
|
+
n = 0;
|
|
86
|
+
full = false;
|
|
87
|
+
constructor(max = MAX_HELD) {
|
|
88
|
+
this.max = max;
|
|
89
|
+
}
|
|
90
|
+
/** An id into a set - refused at the ceiling, so the set stops growing there. */
|
|
91
|
+
add(s, v) {
|
|
92
|
+
if (s.has(v))
|
|
93
|
+
return;
|
|
94
|
+
if (this.n >= this.max) {
|
|
95
|
+
this.full = true;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
s.add(v);
|
|
99
|
+
this.n++;
|
|
100
|
+
}
|
|
101
|
+
/** Room for something bigger than one id - false at the ceiling (or at `upTo`, a part of it). */
|
|
102
|
+
room(cost, upTo = this.max) {
|
|
103
|
+
if (this.n + cost > upTo) {
|
|
104
|
+
this.full = true;
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
this.n += cost;
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Something held whatever the ceiling: a bucket. There are only so many
|
|
112
|
+
* (days × platforms × countries × groups) - but a long window's are counted,
|
|
113
|
+
* so an exact report over too many of them gives up like one over too many ids.
|
|
114
|
+
*/
|
|
115
|
+
must(cost) {
|
|
116
|
+
this.n += cost;
|
|
117
|
+
if (this.n > this.max)
|
|
118
|
+
this.full = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const put = (b, e, isNew, h) => {
|
|
53
122
|
if (e.u)
|
|
54
|
-
b.users
|
|
123
|
+
h.add(b.users, e.u);
|
|
55
124
|
if (e.u && isNew)
|
|
56
|
-
b.fresh
|
|
125
|
+
h.add(b.fresh, e.u);
|
|
57
126
|
if (e.c)
|
|
58
|
-
b.convs
|
|
127
|
+
h.add(b.convs, e.c);
|
|
59
128
|
if (e.k)
|
|
60
|
-
b.conns
|
|
129
|
+
h.add(b.conns, e.k);
|
|
61
130
|
if (e.e === 'init')
|
|
62
131
|
b.inits++;
|
|
63
132
|
if (e.e === 'call') {
|
|
@@ -74,7 +143,7 @@ const put = (b, e, isNew) => {
|
|
|
74
143
|
if (e.e === 'account' && e.step === 'ok')
|
|
75
144
|
b.signIns++;
|
|
76
145
|
if (e.e === 'account' && e.s && (e.step === 'ok' || e.step === 'orders'))
|
|
77
|
-
b.shoppers
|
|
146
|
+
h.add(b.shoppers, e.s);
|
|
78
147
|
};
|
|
79
148
|
const ROW_KEYS = [
|
|
80
149
|
'users',
|
|
@@ -181,6 +250,10 @@ const median = (xs) => {
|
|
|
181
250
|
return s[Math.floor(s.length / 2)] ?? null;
|
|
182
251
|
};
|
|
183
252
|
class AccountTally {
|
|
253
|
+
h;
|
|
254
|
+
constructor(h) {
|
|
255
|
+
this.h = h;
|
|
256
|
+
}
|
|
184
257
|
links = 0;
|
|
185
258
|
starts = 0;
|
|
186
259
|
ok = 0;
|
|
@@ -194,10 +267,11 @@ class AccountTally {
|
|
|
194
267
|
signedInCheckout = new Set();
|
|
195
268
|
convs = new Set();
|
|
196
269
|
put(e) {
|
|
270
|
+
const h = this.h;
|
|
197
271
|
if (e.c)
|
|
198
|
-
this.convs
|
|
272
|
+
h.add(this.convs, e.c);
|
|
199
273
|
if (e.e === 'checkout' && e.c && (e.signedIn || this.signedIn.has(e.c))) {
|
|
200
|
-
this.signedInCheckout
|
|
274
|
+
h.add(this.signedInCheckout, e.c);
|
|
201
275
|
}
|
|
202
276
|
if (e.e !== 'account')
|
|
203
277
|
return;
|
|
@@ -210,7 +284,7 @@ class AccountTally {
|
|
|
210
284
|
if (e.signUp)
|
|
211
285
|
this.signUps++;
|
|
212
286
|
if (e.c)
|
|
213
|
-
this.signedIn
|
|
287
|
+
h.add(this.signedIn, e.c);
|
|
214
288
|
}
|
|
215
289
|
if (e.step === 'fail') {
|
|
216
290
|
this.failed++;
|
|
@@ -222,10 +296,10 @@ class AccountTally {
|
|
|
222
296
|
if (e.step === 'orders') {
|
|
223
297
|
this.orderReads++;
|
|
224
298
|
if (e.c)
|
|
225
|
-
this.signedIn
|
|
299
|
+
h.add(this.signedIn, e.c);
|
|
226
300
|
}
|
|
227
301
|
if (e.s && (e.step === 'ok' || e.step === 'orders'))
|
|
228
|
-
this.shoppers
|
|
302
|
+
h.add(this.shoppers, e.s);
|
|
229
303
|
}
|
|
230
304
|
summary(seenBefore) {
|
|
231
305
|
const newShoppers = [...this.shoppers].filter((s) => !seenBefore.has(s)).length;
|
|
@@ -253,20 +327,28 @@ const geoRow = (v) => ({
|
|
|
253
327
|
isp: v.isp.size,
|
|
254
328
|
hosting: v.hosting.size,
|
|
255
329
|
});
|
|
256
|
-
const putGeo = (m, e, isNew) => {
|
|
257
|
-
|
|
258
|
-
|
|
330
|
+
const putGeo = (m, e, isNew, h) => {
|
|
331
|
+
let gb = m.get(e.g);
|
|
332
|
+
if (!gb) {
|
|
333
|
+
h.must(COST.bucket);
|
|
334
|
+
gb = { b: bucket(), isp: new Set(), hosting: new Set() };
|
|
335
|
+
m.set(e.g, gb);
|
|
336
|
+
}
|
|
337
|
+
put(gb.b, e, isNew, h);
|
|
259
338
|
const who = e.u ?? e.c;
|
|
260
339
|
if (who && e.n === 'isp')
|
|
261
|
-
gb.isp
|
|
340
|
+
h.add(gb.isp, who);
|
|
262
341
|
if (who && e.n === 'hosting')
|
|
263
|
-
gb.hosting
|
|
264
|
-
m.set(e.g, gb);
|
|
342
|
+
h.add(gb.hosting, who);
|
|
265
343
|
};
|
|
266
|
-
const putIn = (m, key, e, isNew) => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
344
|
+
const putIn = (m, key, e, isNew, h) => {
|
|
345
|
+
let b = m.get(key);
|
|
346
|
+
if (!b) {
|
|
347
|
+
h.must(COST.bucket);
|
|
348
|
+
b = bucket();
|
|
349
|
+
m.set(key, b);
|
|
350
|
+
}
|
|
351
|
+
put(b, e, isNew, h);
|
|
270
352
|
};
|
|
271
353
|
const sortedRows = (m) => Object.fromEntries([...m.entries()].sort(([a], [b]) => (a < b ? -1 : 1)).map(([k, b]) => [k, row(b)]));
|
|
272
354
|
const platformRows = (m) => Object.fromEntries([
|
|
@@ -302,7 +384,8 @@ export class ReportBuilder {
|
|
|
302
384
|
booking = new BookingTally();
|
|
303
385
|
member = new MemberTally();
|
|
304
386
|
tools = new Map();
|
|
305
|
-
|
|
387
|
+
held;
|
|
388
|
+
account;
|
|
306
389
|
imported = new Set();
|
|
307
390
|
funnel = {
|
|
308
391
|
connected: new Set(),
|
|
@@ -310,16 +393,22 @@ export class ReportBuilder {
|
|
|
310
393
|
added: new Set(),
|
|
311
394
|
checkout: new Set(),
|
|
312
395
|
};
|
|
313
|
-
constructor(from, to, deployment = null, tz = BEIJING, seen) {
|
|
396
|
+
constructor(from, to, deployment = null, tz = BEIJING, seen, maxHeld = MAX_HELD) {
|
|
314
397
|
this.from = from;
|
|
315
398
|
this.to = to;
|
|
316
399
|
this.deployment = deployment;
|
|
317
400
|
this.tz = tz;
|
|
318
401
|
this.seen = seen;
|
|
402
|
+
this.held = new Held(maxHeld);
|
|
403
|
+
this.account = new AccountTally(this.held);
|
|
404
|
+
}
|
|
405
|
+
/** What it holds, in ids (Held) - every copy counted. */
|
|
406
|
+
get size() {
|
|
407
|
+
return this.held.n;
|
|
319
408
|
}
|
|
320
|
-
/**
|
|
321
|
-
|
|
322
|
-
return this.
|
|
409
|
+
/** At the ceiling: its distinct counts stopped growing - an exact report is no longer one. */
|
|
410
|
+
get full() {
|
|
411
|
+
return this.held.full;
|
|
323
412
|
}
|
|
324
413
|
mine(e) {
|
|
325
414
|
return !this.deployment || e.d === this.deployment;
|
|
@@ -340,27 +429,53 @@ export class ReportBuilder {
|
|
|
340
429
|
for (const who of [e.u && `u:${e.u}`, e.c && `c:${e.c}`]) {
|
|
341
430
|
if (!who)
|
|
342
431
|
continue;
|
|
343
|
-
|
|
344
|
-
|
|
432
|
+
let m = this.tally.get(who);
|
|
433
|
+
if (!m) {
|
|
434
|
+
// A third of the ceiling at most: the counting pass needs the rest,
|
|
435
|
+
// or a flooded day would come out as no one at all.
|
|
436
|
+
if (!this.held.room(COST.who, this.held.max / 3))
|
|
437
|
+
continue;
|
|
438
|
+
m = new Map();
|
|
439
|
+
this.tally.set(who, m);
|
|
440
|
+
}
|
|
441
|
+
let hit = m.get(e.g);
|
|
442
|
+
if (!hit) {
|
|
443
|
+
if (!this.held.room(1, this.held.max / 3))
|
|
444
|
+
continue;
|
|
445
|
+
hit = { count: 0, ...(e.n ? { n: e.n } : {}) };
|
|
446
|
+
m.set(e.g, hit);
|
|
447
|
+
}
|
|
345
448
|
hit.count++;
|
|
346
|
-
m.set(e.g, hit);
|
|
347
|
-
this.tally.set(who, m);
|
|
348
449
|
}
|
|
349
450
|
}
|
|
350
451
|
placeOf(e) {
|
|
351
452
|
if (e.g !== 'unknown')
|
|
352
453
|
return e;
|
|
353
454
|
if (!this.places) {
|
|
455
|
+
// Takes the tally's place (and its count in Held): each entry leaves
|
|
456
|
+
// the tally as it goes into the places.
|
|
354
457
|
this.places = new Map();
|
|
355
458
|
for (const [who, m] of this.tally) {
|
|
356
459
|
const [g, best] = [...m.entries()].sort((a, b) => b[1].count - a[1].count)[0];
|
|
357
460
|
this.places.set(who, { g, ...(best.n ? { n: best.n } : {}) });
|
|
461
|
+
this.tally.delete(who);
|
|
358
462
|
}
|
|
359
|
-
this.tally.clear();
|
|
360
463
|
}
|
|
361
464
|
const hit = (e.u && this.places.get(`u:${e.u}`)) || (e.c && this.places.get(`c:${e.c}`));
|
|
362
465
|
return hit ? { ...e, g: hit.g, ...(hit.n ? { n: hit.n } : {}) } : e;
|
|
363
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* A user seen - true if seen before. Held like every other id: with no
|
|
469
|
+
* `seen.json` that is every user of the 13 months before the window.
|
|
470
|
+
*/
|
|
471
|
+
userSeen(u) {
|
|
472
|
+
const before = this.seenUsers.has(u);
|
|
473
|
+
this.held.add(this.seenUsers, u);
|
|
474
|
+
return before;
|
|
475
|
+
}
|
|
476
|
+
shopperSeen(s) {
|
|
477
|
+
this.held.add(this.shoppersBefore, s);
|
|
478
|
+
}
|
|
364
479
|
/** Second pass: count it. */
|
|
365
480
|
add(raw) {
|
|
366
481
|
if (!this.mine(raw))
|
|
@@ -371,22 +486,24 @@ export class ReportBuilder {
|
|
|
371
486
|
if (day < this.from) {
|
|
372
487
|
if (!this.seen) {
|
|
373
488
|
if (raw.u)
|
|
374
|
-
this.
|
|
489
|
+
this.userSeen(raw.u);
|
|
375
490
|
if (raw.s)
|
|
376
|
-
this.
|
|
491
|
+
this.shopperSeen(raw.s);
|
|
377
492
|
}
|
|
378
493
|
return;
|
|
379
494
|
}
|
|
380
495
|
const e = this.placeOf(raw);
|
|
496
|
+
const h = this.held;
|
|
381
497
|
let d = this.days.get(day);
|
|
382
498
|
if (!d) {
|
|
499
|
+
h.must(COST.bucket);
|
|
383
500
|
d = {
|
|
384
501
|
total: bucket(),
|
|
385
502
|
byPlatform: new Map(),
|
|
386
503
|
byGeo: new Map(),
|
|
387
504
|
rows: new Map(),
|
|
388
505
|
byShop: new Map(),
|
|
389
|
-
account: new AccountTally(),
|
|
506
|
+
account: new AccountTally(h),
|
|
390
507
|
booking: new BookingTally(),
|
|
391
508
|
member: new MemberTally(),
|
|
392
509
|
imported: false,
|
|
@@ -404,52 +521,57 @@ export class ReportBuilder {
|
|
|
404
521
|
isNew = !first || first >= day;
|
|
405
522
|
}
|
|
406
523
|
else {
|
|
407
|
-
isNew = !this.
|
|
408
|
-
this.seenUsers.add(e.u);
|
|
524
|
+
isNew = !this.userSeen(e.u);
|
|
409
525
|
}
|
|
410
526
|
}
|
|
411
527
|
if (e.s && this.seen) {
|
|
412
528
|
const first = this.seen.shopperFirst(e.s);
|
|
413
529
|
if (first && first < this.from)
|
|
414
|
-
this.
|
|
530
|
+
this.shopperSeen(e.s);
|
|
415
531
|
}
|
|
416
|
-
put(d.total, e, isNew);
|
|
417
|
-
putIn(d.byPlatform, e.p, e, isNew);
|
|
418
|
-
putGeo(d.byGeo, e, isNew);
|
|
419
|
-
putIn(d.rows, `${e.p}|${e.g}`, e, isNew);
|
|
532
|
+
put(d.total, e, isNew, h);
|
|
533
|
+
putIn(d.byPlatform, e.p, e, isNew, h);
|
|
534
|
+
putGeo(d.byGeo, e, isNew, h);
|
|
535
|
+
putIn(d.rows, `${e.p}|${e.g}`, e, isNew, h);
|
|
420
536
|
d.account.put(e);
|
|
421
537
|
d.booking.put(e);
|
|
422
538
|
d.member.put(e);
|
|
423
539
|
if (e.shop)
|
|
424
|
-
putIn(d.byShop, e.shop, e, isNew);
|
|
425
|
-
put(this.total, e, isNew);
|
|
426
|
-
putIn(this.byPlatform, e.p, e, isNew);
|
|
427
|
-
putGeo(this.byGeo, e, isNew);
|
|
540
|
+
putIn(d.byShop, e.shop, e, isNew, h);
|
|
541
|
+
put(this.total, e, isNew, h);
|
|
542
|
+
putIn(this.byPlatform, e.p, e, isNew, h);
|
|
543
|
+
putGeo(this.byGeo, e, isNew, h);
|
|
428
544
|
if (e.shop)
|
|
429
|
-
putIn(this.byShop, e.shop, e, isNew);
|
|
545
|
+
putIn(this.byShop, e.shop, e, isNew, h);
|
|
430
546
|
this.account.put(e);
|
|
431
547
|
this.booking.put(e);
|
|
432
548
|
this.member.put(e);
|
|
433
549
|
if (e.e === 'call' && e.tool) {
|
|
434
|
-
|
|
435
|
-
t.
|
|
436
|
-
|
|
437
|
-
t
|
|
438
|
-
|
|
439
|
-
if (
|
|
440
|
-
t.
|
|
441
|
-
|
|
550
|
+
let t = this.tools.get(e.tool);
|
|
551
|
+
if (!t && h.room(COST.tool)) {
|
|
552
|
+
t = { calls: 0, failed: 0, ms: [] };
|
|
553
|
+
this.tools.set(e.tool, t);
|
|
554
|
+
}
|
|
555
|
+
if (t) {
|
|
556
|
+
t.calls++;
|
|
557
|
+
if (e.ok === false)
|
|
558
|
+
t.failed++;
|
|
559
|
+
// A median from at most the first 10,000 timings: enough, and bounded.
|
|
560
|
+
if (typeof e.ms === 'number' && t.ms.length < 10_000 && h.room(1))
|
|
561
|
+
t.ms.push(e.ms);
|
|
562
|
+
}
|
|
442
563
|
}
|
|
443
564
|
// Recorded days only: an imported request has no tool, so its conversation
|
|
444
565
|
// could never reach the later steps and would only thin the rates.
|
|
445
566
|
if (e.c && !e.src) {
|
|
446
|
-
this.funnel
|
|
567
|
+
const f = this.funnel;
|
|
568
|
+
h.add(f.connected, e.c);
|
|
447
569
|
if (e.e === 'call' && (e.r === 'browse' || e.r === 'product'))
|
|
448
|
-
|
|
570
|
+
h.add(f.viewed, e.c);
|
|
449
571
|
if (e.e === 'cart_add')
|
|
450
|
-
|
|
572
|
+
h.add(f.added, e.c);
|
|
451
573
|
if (e.e === 'checkout')
|
|
452
|
-
|
|
574
|
+
h.add(f.checkout, e.c);
|
|
453
575
|
}
|
|
454
576
|
}
|
|
455
577
|
build() {
|
|
@@ -474,6 +596,7 @@ export class ReportBuilder {
|
|
|
474
596
|
booking: d.booking.summary(),
|
|
475
597
|
member: d.member.summary(),
|
|
476
598
|
imported: d.imported,
|
|
599
|
+
...(this.held.full ? { capped: true } : {}),
|
|
477
600
|
})),
|
|
478
601
|
total: { ...t, returningUsers: t.users - t.newUsers },
|
|
479
602
|
byPlatform: platformRows(this.byPlatform),
|
|
@@ -492,6 +615,7 @@ export class ReportBuilder {
|
|
|
492
615
|
booking: this.booking.summary(),
|
|
493
616
|
member: this.member.summary(),
|
|
494
617
|
importedDays: [...this.imported].sort(),
|
|
618
|
+
...(this.held.full ? { capped: [...this.days.keys()].sort() } : {}),
|
|
495
619
|
};
|
|
496
620
|
}
|
|
497
621
|
}
|
|
@@ -621,6 +745,9 @@ export const sumDays = (daily, from, to, deployment, tz, reason = 'past-13-month
|
|
|
621
745
|
booking,
|
|
622
746
|
member,
|
|
623
747
|
importedDays: days.filter((d) => d.imported).map((d) => d.day),
|
|
748
|
+
...(days.some((d) => d.capped)
|
|
749
|
+
? { capped: days.filter((d) => d.capped).map((d) => d.day) }
|
|
750
|
+
: {}),
|
|
624
751
|
};
|
|
625
752
|
};
|
|
626
753
|
const pct = (a, b) => (b ? `${Math.round((a / b) * 100)}%` : '—');
|
|
@@ -655,6 +782,7 @@ export const summaryLine = (r, name) => {
|
|
|
655
782
|
: []),
|
|
656
783
|
...(a.begun || a.ok ? [`登录 ${a.shoppers} 人(成功 ${a.ok} / 发起 ${a.begun})`] : []),
|
|
657
784
|
...(r.member.links || r.member.ok ? [`关联集团会员 ${r.member.ok}`] : []),
|
|
785
|
+
...(r.capped?.length ? [`⚠️ ${r.capped.join('、')} 人数只数到上限`] : []),
|
|
658
786
|
];
|
|
659
787
|
return `[usage] ${name} ${span}(${r.tz === 'UTC' ? 'UTC' : '北京时间'}): ${parts.join(' · ')}`;
|
|
660
788
|
};
|
|
@@ -667,6 +795,9 @@ export const reportText = (r, name) => {
|
|
|
667
795
|
if (r.mode === 'daily-sum') {
|
|
668
796
|
out.push(`⚠️ ${r.reason === 'too-many' ? '这个范围里的对话和连接太多,逐条去重会占太多内存' : '这个范围超出逐条记录的 13 个月'},按每天的汇总相加:用户是「每天活跃之和」(同一个人来了几天算几次)和「新用户累计」;对话、漏斗、登录购物者也是每天相加。`);
|
|
669
797
|
}
|
|
798
|
+
if (r.capped?.length) {
|
|
799
|
+
out.push(`⚠️ ${r.capped.join('、')} 的对话和连接太多:用户、对话、连接只数到上限为止,实际更多;工具调用、提交预订、加入行程、下单结果、登录、关联会员这些次数照常是全数。`);
|
|
800
|
+
}
|
|
670
801
|
out.push(`合计:${usersText(r)} · 对话 ${t.convs} · 连接 ${t.conns}(新开 ${t.inits}) · 调用 ${t.calls}(失败 ${t.failed})${t.reqs ? ` · 导入请求 ${t.reqs}` : ''}`);
|
|
671
802
|
out.push('口径:用户只数平台给了用户编号的(现在只有 ChatGPT,按 X-OpenAI-Subject);对话 = ChatGPT 按 X-OpenAI-Session,别的平台没有对话编号,按 MCP 会话(模型那条连接,卡片的调用算进它所在的对话);连接 = MCP 会话(Mcp-Session-Id),含 ChatGPT 每天扫工具开的会话。', '国家:同一个用户 / 对话只要有一次查到国家,就都算那个国家;只有 ChatGPT 能查(其他平台是平台机房)。');
|
|
672
803
|
if (r.importedDays.length) {
|