@curless/hotel-storefront 0.90.0 → 0.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/usage/bookings-import.d.ts.map +1 -1
- package/dist/usage/bookings-import.js +1 -2
- package/dist/usage/bookings-import.js.map +1 -1
- package/dist/usage/boot.d.ts +1 -1
- package/dist/usage/boot.d.ts.map +1 -1
- package/dist/usage/boot.js +17 -68
- package/dist/usage/boot.js.map +1 -1
- package/dist/usage/platform.d.ts +1 -1
- package/dist/usage/platform.d.ts.map +1 -1
- package/dist/usage/platform.js.map +1 -1
- package/dist/usage/recorder.d.ts +1 -3
- package/dist/usage/recorder.d.ts.map +1 -1
- package/dist/usage/recorder.js.map +1 -1
- package/dist/usage/shadow-import.d.ts +1 -1
- package/dist/usage/shadow-import.d.ts.map +1 -1
- package/dist/usage/shadow-import.js +1 -1
- package/dist/usage/shadow-import.js.map +1 -1
- package/dist/usage-cli.js +7 -8
- package/dist/usage-cli.js.map +1 -1
- package/package.json +3 -2
- package/dist/usage/geo.d.ts +0 -88
- package/dist/usage/geo.d.ts.map +0 -1
- package/dist/usage/geo.js +0 -396
- package/dist/usage/geo.js.map +0 -1
- package/dist/usage/maintain.d.ts +0 -26
- package/dist/usage/maintain.d.ts.map +0 -1
- package/dist/usage/maintain.js +0 -177
- package/dist/usage/maintain.js.map +0 -1
- package/dist/usage/pseudonym.d.ts +0 -28
- package/dist/usage/pseudonym.d.ts.map +0 -1
- package/dist/usage/pseudonym.js +0 -73
- package/dist/usage/pseudonym.js.map +0 -1
- package/dist/usage/range.d.ts +0 -18
- package/dist/usage/range.d.ts.map +0 -1
- package/dist/usage/range.js +0 -97
- package/dist/usage/range.js.map +0 -1
- package/dist/usage/report.d.ts +0 -258
- package/dist/usage/report.d.ts.map +0 -1
- package/dist/usage/report.js +0 -862
- package/dist/usage/report.js.map +0 -1
- package/dist/usage/store.d.ts +0 -258
- package/dist/usage/store.d.ts.map +0 -1
- package/dist/usage/store.js +0 -475
- package/dist/usage/store.js.map +0 -1
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/** Hex characters kept: 64 bits - no collision worth counting at our volume. */
|
|
2
|
-
export declare const PSEUDONYM_HEX = 16;
|
|
3
|
-
/**
|
|
4
|
-
* The shortest key taken: 32 characters (`openssl rand -hex 32` gives 64). A
|
|
5
|
-
* short key is one a guess can find, and with it every pseudonym can be tested
|
|
6
|
-
* against a candidate id (security review of 0.77.0, P3).
|
|
7
|
-
*/
|
|
8
|
-
export declare const MIN_KEY_CHARS = 32;
|
|
9
|
-
export type ConversationSource =
|
|
10
|
-
/** ChatGPT's `X-OpenAI-Session`, as sent. */
|
|
11
|
-
'oai'
|
|
12
|
-
/** An `Mcp-Session-Id` - ours, or a conversation's own key from the cart binding. */
|
|
13
|
-
| 'mcp';
|
|
14
|
-
export declare class Pseudonyms {
|
|
15
|
-
private readonly key;
|
|
16
|
-
/** `secret` is the deployment's own; the MAC key is derived from it, labelled - the label shopify's, so both write one format. */
|
|
17
|
-
constructor(secret: string);
|
|
18
|
-
private mac;
|
|
19
|
-
/** A platform's own user id - today only ChatGPT's `X-OpenAI-Subject`. */
|
|
20
|
-
user(platformUserId: unknown): string | undefined;
|
|
21
|
-
/** A conversation. Never an address-keyed one (`ip:…`): see the top. */
|
|
22
|
-
conversation(source: ConversationSource, id: unknown): string | undefined;
|
|
23
|
-
/** A guest signed in to the deployment's own account: their Otaless member id (`memberUserId`) - nothing else of theirs. */
|
|
24
|
-
shopper(customerId: unknown): string | undefined;
|
|
25
|
-
/** One of our booking ids - never the hotel's confirmation code. */
|
|
26
|
-
ref(curlessRef: unknown): string | undefined;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=pseudonym.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pseudonym.d.ts","sourceRoot":"","sources":["../../src/usage/pseudonym.ts"],"names":[],"mappings":"AAmBA,gFAAgF;AAChF,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAWhC,MAAM,MAAM,kBAAkB;AAC5B,6CAA6C;AAC3C,KAAK;AACP,qFAAqF;GACnF,KAAK,CAAC;AAEV,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAE7B,kIAAkI;gBACtH,MAAM,EAAE,MAAM;IAO1B,OAAO,CAAC,GAAG;IAOX,0EAA0E;IAC1E,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAKjD,wEAAwE;IACxE,YAAY,CAAC,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAMzE,4HAA4H;IAC5H,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAKhD,oEAAoE;IACpE,GAAG,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;CAI7C"}
|
package/dist/usage/pseudonym.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Copied from @curless/shopify-storefront src/usage/pseudonym.ts (0.77.2), the
|
|
2
|
-
// derivation unchanged (docs/usage-events.md §6) - only the key's variable is
|
|
3
|
-
// this package's: HOTEL_USAGE_KEY.
|
|
4
|
-
//
|
|
5
|
-
// Pseudonyms for the usage statistics: a keyed MAC of an identifier a platform
|
|
6
|
-
// or the account backend gave us, never the identifier itself.
|
|
7
|
-
//
|
|
8
|
-
// ⚠️ KEYED PER DEPLOYMENT (`HOTEL_USAGE_KEY`). Two deployments see the same
|
|
9
|
-
// ChatGPT user under different names, so one deployment's records cannot be joined to
|
|
10
|
-
// another's; and without the key nobody can test a guess against them - an
|
|
11
|
-
// unkeyed hash of an OpenAI subject or an Otaless member id could be.
|
|
12
|
-
//
|
|
13
|
-
// ⚠️ ONLY WHAT A PLATFORM OR THE SHOP HANDED US. A request with no platform user
|
|
14
|
-
// id gets no user pseudonym at all - never one made from its address or anything
|
|
15
|
-
// else to stand in (robin, 2026-11-12). An address-keyed conversation (`ip:…`)
|
|
16
|
-
// gets no conversation pseudonym for the same reason: an address MAC'd is still
|
|
17
|
-
// an address to whoever holds the key, and IPv4 is small enough to walk.
|
|
18
|
-
import { createHmac } from 'node:crypto';
|
|
19
|
-
/** Hex characters kept: 64 bits - no collision worth counting at our volume. */
|
|
20
|
-
export const PSEUDONYM_HEX = 16;
|
|
21
|
-
/**
|
|
22
|
-
* The shortest key taken: 32 characters (`openssl rand -hex 32` gives 64). A
|
|
23
|
-
* short key is one a guess can find, and with it every pseudonym can be tested
|
|
24
|
-
* against a candidate id (security review of 0.77.0, P3).
|
|
25
|
-
*/
|
|
26
|
-
export const MIN_KEY_CHARS = 32;
|
|
27
|
-
/** The longest identifier taken - anything longer is not a platform's id. */
|
|
28
|
-
const MAX_ID = 256;
|
|
29
|
-
const clean = (raw) => {
|
|
30
|
-
if (typeof raw !== 'string')
|
|
31
|
-
return undefined;
|
|
32
|
-
const v = raw.trim();
|
|
33
|
-
return v && v.length <= MAX_ID ? v : undefined;
|
|
34
|
-
};
|
|
35
|
-
export class Pseudonyms {
|
|
36
|
-
key;
|
|
37
|
-
/** `secret` is the deployment's own; the MAC key is derived from it, labelled - the label shopify's, so both write one format. */
|
|
38
|
-
constructor(secret) {
|
|
39
|
-
if (!secret || secret.length < MIN_KEY_CHARS) {
|
|
40
|
-
throw new Error(`the pseudonym key must be at least ${MIN_KEY_CHARS} characters`);
|
|
41
|
-
}
|
|
42
|
-
this.key = createHmac('sha256', secret).update('storefront-usage-pseudonyms-v1').digest();
|
|
43
|
-
}
|
|
44
|
-
mac(kind, value) {
|
|
45
|
-
return createHmac('sha256', this.key)
|
|
46
|
-
.update(`${kind}|${value}`)
|
|
47
|
-
.digest('hex')
|
|
48
|
-
.slice(0, PSEUDONYM_HEX);
|
|
49
|
-
}
|
|
50
|
-
/** A platform's own user id - today only ChatGPT's `X-OpenAI-Subject`. */
|
|
51
|
-
user(platformUserId) {
|
|
52
|
-
const v = clean(platformUserId);
|
|
53
|
-
return v ? this.mac('user', v) : undefined;
|
|
54
|
-
}
|
|
55
|
-
/** A conversation. Never an address-keyed one (`ip:…`): see the top. */
|
|
56
|
-
conversation(source, id) {
|
|
57
|
-
const v = clean(id);
|
|
58
|
-
if (!v || v.startsWith('ip:'))
|
|
59
|
-
return undefined;
|
|
60
|
-
return this.mac(`conversation:${source}`, v);
|
|
61
|
-
}
|
|
62
|
-
/** A guest signed in to the deployment's own account: their Otaless member id (`memberUserId`) - nothing else of theirs. */
|
|
63
|
-
shopper(customerId) {
|
|
64
|
-
const v = typeof customerId === 'number' ? String(customerId) : clean(customerId);
|
|
65
|
-
return v ? this.mac('shopper', v) : undefined;
|
|
66
|
-
}
|
|
67
|
-
/** One of our booking ids - never the hotel's confirmation code. */
|
|
68
|
-
ref(curlessRef) {
|
|
69
|
-
const v = clean(curlessRef);
|
|
70
|
-
return v ? this.mac('ref', v) : undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=pseudonym.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pseudonym.js","sourceRoot":"","sources":["../../src/usage/pseudonym.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,+DAA+D;AAC/D,EAAE;AACF,4EAA4E;AAC5E,sFAAsF;AACtF,2EAA2E;AAC3E,sEAAsE;AACtE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,gFAAgF;AAChF,yEAAyE;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CA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,CAAC;IAED,wEAAwE;IACxE,YAAY,CAAC,MAA0B,EAAE,EAAW;QAClD,MAAM,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;QACpB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAChD,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,4HAA4H;IAC5H,OAAO,CAAC,UAAmB;QACzB,MAAM,CAAC,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClF,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,oEAAoE;IACpE,GAAG,CAAC,UAAmB;QACrB,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;CACF"}
|
package/dist/usage/range.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type Report, type Tz } from './report.js';
|
|
2
|
-
import { type UsageStore } from './store.js';
|
|
3
|
-
export declare const RANGES: readonly ["today", "yesterday", "7d", "30d", "90d", "all"];
|
|
4
|
-
export type Range = (typeof RANGES)[number];
|
|
5
|
-
export declare const isRange: (s: unknown) => s is Range;
|
|
6
|
-
export declare const windowOf: (store: UsageStore, range: Range, now: number, tz: Tz) => Promise<{
|
|
7
|
-
from: string;
|
|
8
|
-
to: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare const reportFor: (store: UsageStore, deployment: string, window: {
|
|
11
|
-
from: string;
|
|
12
|
-
to: string;
|
|
13
|
-
}, opts?: {
|
|
14
|
-
now?: number;
|
|
15
|
-
tz?: Tz;
|
|
16
|
-
maxHeld?: number;
|
|
17
|
-
}) => Promise<Report>;
|
|
18
|
-
//# sourceMappingURL=range.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/usage/range.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,MAAM,EAEX,KAAK,EAAE,EAKR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,YAAY,CAAC;AAElE,eAAO,MAAM,MAAM,4DAA6D,CAAC;AACjF,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,OAAO,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,KAAoC,CAAC;AAc/E,eAAO,MAAM,QAAQ,GACnB,OAAO,UAAU,EACjB,OAAO,KAAK,EACZ,KAAK,MAAM,EACX,IAAI,EAAE,KACL,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAgBtC,CAAC;AAIF,eAAO,MAAM,SAAS,GACpB,OAAO,UAAU,EACjB,YAAY,MAAM,EAClB,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EACpC,OAAM;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,KACrD,OAAO,CAAC,MAAM,CAgDhB,CAAC"}
|
package/dist/usage/range.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// The six windows robin asked for (11-13): today, yesterday, 7, 30 and 90
|
|
2
|
-
// days, and everything - in Beijing days unless asked for UTC. Inside the 13
|
|
3
|
-
// months of event lines a window is counted exactly; one that reaches past them
|
|
4
|
-
// is the sum of the kept daily totals (report.ts sumDays), with the days not
|
|
5
|
-
// yet summed (today, say) summed from their lines.
|
|
6
|
-
import { Seen, readDaily } from './maintain.js';
|
|
7
|
-
import { BEIJING, MAX_HELD, ReportBuilder, addDays, dailyTotals, dayIn, sumDays, } from './report.js';
|
|
8
|
-
import { dayOf, firstKeptDay } from './store.js';
|
|
9
|
-
export const RANGES = ['today', 'yesterday', '7d', '30d', '90d', 'all'];
|
|
10
|
-
export const isRange = (s) => RANGES.includes(s);
|
|
11
|
-
/** The first local day anything is known for: the oldest totals or line. */
|
|
12
|
-
const earliestDay = async (store, tz) => {
|
|
13
|
-
const daily = await readDaily(store, '0000-00-00', '9999-99-99');
|
|
14
|
-
const firstTotals = daily[0]?.day ?? null;
|
|
15
|
-
let firstLine = null;
|
|
16
|
-
for await (const e of store.read()) {
|
|
17
|
-
firstLine = dayIn(e.t, tz);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
return [firstTotals, firstLine].filter((d) => !!d).sort()[0] ?? null;
|
|
21
|
-
};
|
|
22
|
-
export const windowOf = async (store, range, now, tz) => {
|
|
23
|
-
const today = dayIn(now, tz);
|
|
24
|
-
switch (range) {
|
|
25
|
-
case 'today':
|
|
26
|
-
return { from: today, to: today };
|
|
27
|
-
case 'yesterday':
|
|
28
|
-
return { from: addDays(today, -1), to: addDays(today, -1) };
|
|
29
|
-
case '7d':
|
|
30
|
-
return { from: addDays(today, -6), to: today };
|
|
31
|
-
case '30d':
|
|
32
|
-
return { from: addDays(today, -29), to: today };
|
|
33
|
-
case '90d':
|
|
34
|
-
return { from: addDays(today, -89), to: today };
|
|
35
|
-
case 'all':
|
|
36
|
-
return { from: (await earliestDay(store, tz)) ?? today, to: today };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
class TooMany extends Error {
|
|
40
|
-
}
|
|
41
|
-
export const reportFor = async (store, deployment, window, opts = {}) => {
|
|
42
|
-
const now = opts.now ?? Date.now();
|
|
43
|
-
const tz = opts.tz ?? BEIJING;
|
|
44
|
-
const max = opts.maxHeld ?? MAX_HELD;
|
|
45
|
-
const { from, to } = window;
|
|
46
|
-
const firstKept = firstKeptDay(dayOf(now));
|
|
47
|
-
// The first local day whose lines are all still here.
|
|
48
|
-
const whole = addDays(firstKept, 1);
|
|
49
|
-
// Who is new: the maintenance's index when there is one - then only the
|
|
50
|
-
// window's own files are read; without it, every kept line before the window.
|
|
51
|
-
const seen = (await Seen.load(store)) ?? undefined;
|
|
52
|
-
// ⚠️ BOUNDED BOTH WAYS (总线程 11-13, shopify 0.77.3 P3 carried over). The
|
|
53
|
-
// builder holds no more than `max` ids, every copy counted (report.ts Held).
|
|
54
|
-
// An exact window gives up the moment it is full - checked every line, not
|
|
55
|
-
// every ten thousand - and sums the days; a day summed alone stops at the
|
|
56
|
-
// ceiling too, and the report names it (`capped`) rather than running out of
|
|
57
|
-
// memory.
|
|
58
|
-
const sum = async (a, b, exact) => {
|
|
59
|
-
const r = new ReportBuilder(a, b, deployment, tz, seen, max);
|
|
60
|
-
for await (const e of store.read(addDays(a, -1), addDays(b, 1))) {
|
|
61
|
-
r.place(e);
|
|
62
|
-
if (exact && r.full)
|
|
63
|
-
throw new TooMany();
|
|
64
|
-
}
|
|
65
|
-
for await (const e of store.read(seen ? addDays(a, -1) : firstKept, addDays(b, 1))) {
|
|
66
|
-
r.add(e);
|
|
67
|
-
if (exact && r.full)
|
|
68
|
-
throw new TooMany();
|
|
69
|
-
}
|
|
70
|
-
return r.build();
|
|
71
|
-
};
|
|
72
|
-
const byDays = async (reason) => {
|
|
73
|
-
const kept = await readDaily(store, from, to);
|
|
74
|
-
const have = new Set(kept.map((d) => d.day));
|
|
75
|
-
const fill = [];
|
|
76
|
-
for (let d = whole > from ? whole : from; d <= to; d = addDays(d, 1)) {
|
|
77
|
-
if (have.has(d))
|
|
78
|
-
continue;
|
|
79
|
-
// One day at a time, held to the same ceiling.
|
|
80
|
-
const one = dailyTotals(await sum(d, d, false), d);
|
|
81
|
-
if (one)
|
|
82
|
-
fill.push(one);
|
|
83
|
-
}
|
|
84
|
-
return sumDays([...kept, ...fill], from, to, deployment, tz, reason);
|
|
85
|
-
};
|
|
86
|
-
if (from < whole)
|
|
87
|
-
return byDays('past-13-months');
|
|
88
|
-
try {
|
|
89
|
-
return await sum(from, to, true);
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
if (err instanceof TooMany)
|
|
93
|
-
return byDays('too-many');
|
|
94
|
-
throw err;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=range.js.map
|
package/dist/usage/range.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/usage/range.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,gFAAgF;AAChF,6EAA6E;AAC7E,mDAAmD;AACnD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,OAAO,EAEP,QAAQ,EAER,aAAa,EAEb,OAAO,EACP,WAAW,EACX,KAAK,EACL,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAmB,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAGjF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAU,EAAc,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAU,CAAC,CAAC;AAE/E,4EAA4E;AAC5E,MAAM,WAAW,GAAG,KAAK,EAAE,KAAiB,EAAE,EAAM,EAA0B,EAAE;IAC9E,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,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,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACrE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,SAAS;YAC1B,+CAA+C;YAC/C,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;YACnD,IAAI,GAAG;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC,CAAC;IACF,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,OAAO;YAAE,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC;QACtD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
package/dist/usage/report.d.ts
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { type Platform } from './platform.js';
|
|
2
|
-
import { type UsageEvent } from './store.js';
|
|
3
|
-
export declare const PLATFORM_LABEL: Record<Platform, string>;
|
|
4
|
-
export declare const geoLabel: (g: string) => string;
|
|
5
|
-
/** A fixed offset: China has no daylight saving. */
|
|
6
|
-
export type Tz = {
|
|
7
|
-
name: string;
|
|
8
|
-
offsetMin: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const BEIJING: Tz;
|
|
11
|
-
export declare const UTC_TZ: Tz;
|
|
12
|
-
export declare const dayIn: (t: string | number, tz: Tz) => string;
|
|
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
|
-
}
|
|
52
|
-
export type Row = {
|
|
53
|
-
users: number;
|
|
54
|
-
newUsers: number;
|
|
55
|
-
convs: number;
|
|
56
|
-
conns: number;
|
|
57
|
-
inits: number;
|
|
58
|
-
calls: number;
|
|
59
|
-
failed: number;
|
|
60
|
-
reqs: number;
|
|
61
|
-
cartAdds: number;
|
|
62
|
-
checkouts: number;
|
|
63
|
-
signIns: number;
|
|
64
|
-
shoppers: number;
|
|
65
|
-
};
|
|
66
|
-
export type GeoRow = Row & {
|
|
67
|
-
isp: number;
|
|
68
|
-
hosting: number;
|
|
69
|
-
};
|
|
70
|
-
export type Funnel = {
|
|
71
|
-
/** Conversations seen at all - on recorded days (imported ones carry no tool). */
|
|
72
|
-
connected: number;
|
|
73
|
-
/** …that looked at products (a browse or product tool). */
|
|
74
|
-
viewed: number;
|
|
75
|
-
/** …that put something in the cart. */
|
|
76
|
-
added: number;
|
|
77
|
-
/** …that were handed a checkout link. */
|
|
78
|
-
checkout: number;
|
|
79
|
-
};
|
|
80
|
-
export type AccountSummary = {
|
|
81
|
-
/** Sign-ins begun: a link handed out in words, or started in the card. */
|
|
82
|
-
begun: number;
|
|
83
|
-
links: number;
|
|
84
|
-
starts: number;
|
|
85
|
-
ok: number;
|
|
86
|
-
failed: number;
|
|
87
|
-
/** Failures by category. */
|
|
88
|
-
why: Record<string, number>;
|
|
89
|
-
signOuts: number;
|
|
90
|
-
orderReads: number;
|
|
91
|
-
/** Sign-ins that made the account first (注册). */
|
|
92
|
-
signUps: number;
|
|
93
|
-
/** Distinct shoppers signed in, and of those, first seen in this window. */
|
|
94
|
-
shoppers: number;
|
|
95
|
-
newShoppers: number;
|
|
96
|
-
returningShoppers: number;
|
|
97
|
-
/** Conversations signed in, of all conversations. */
|
|
98
|
-
signedInConvs: number;
|
|
99
|
-
allConvs: number;
|
|
100
|
-
/** Signed-in conversations later handed a checkout link. */
|
|
101
|
-
signedInCheckoutConvs: number;
|
|
102
|
-
};
|
|
103
|
-
/** Bookings asked for, by outcome - counts only, never an amount (robin 11-13). */
|
|
104
|
-
export type BookingSummary = {
|
|
105
|
-
ok: number;
|
|
106
|
-
fail: number;
|
|
107
|
-
checking: number;
|
|
108
|
-
/** Not made, by category. */
|
|
109
|
-
why: Record<string, number>;
|
|
110
|
-
};
|
|
111
|
-
type MemberCounts = {
|
|
112
|
-
links: number;
|
|
113
|
-
ok: number;
|
|
114
|
-
failed: number;
|
|
115
|
-
out: number;
|
|
116
|
-
};
|
|
117
|
-
/** Hotel groups' memberships linked to the account (Otaless), by step and group. */
|
|
118
|
-
export type MemberSummary = MemberCounts & {
|
|
119
|
-
/** Linked by making a new membership. */
|
|
120
|
-
signUps: number;
|
|
121
|
-
why: Record<string, number>;
|
|
122
|
-
byGroup: Record<string, MemberCounts>;
|
|
123
|
-
};
|
|
124
|
-
export type DayTotals = {
|
|
125
|
-
day: string;
|
|
126
|
-
total: Row;
|
|
127
|
-
byPlatform: Record<string, Row>;
|
|
128
|
-
byGeo: Record<string, GeoRow>;
|
|
129
|
-
/** `platform|geo` → row. */
|
|
130
|
-
rows: Record<string, Row>;
|
|
131
|
-
/** By group, in a deployment serving several (`shop`): Otaless. Empty elsewhere. */
|
|
132
|
-
byShop: Record<string, Row>;
|
|
133
|
-
account: AccountSummary;
|
|
134
|
-
booking: BookingSummary;
|
|
135
|
-
member: MemberSummary;
|
|
136
|
-
imported: boolean;
|
|
137
|
-
/** Users, conversations and connections stopped at the ceiling (Held): at least these. */
|
|
138
|
-
capped?: true;
|
|
139
|
-
};
|
|
140
|
-
export type ToolRow = {
|
|
141
|
-
tool: string;
|
|
142
|
-
calls: number;
|
|
143
|
-
failed: number;
|
|
144
|
-
p50ms: number | null;
|
|
145
|
-
};
|
|
146
|
-
export type Report = {
|
|
147
|
-
v: 1;
|
|
148
|
-
deployment: string | null;
|
|
149
|
-
tz: string;
|
|
150
|
-
from: string;
|
|
151
|
-
to: string;
|
|
152
|
-
/** `exact`: from the event lines. `daily-sum`: from the days' totals - users summed per day. */
|
|
153
|
-
mode: 'exact' | 'daily-sum';
|
|
154
|
-
/** Why the days were summed: the window reaches past the kept lines, or holds too many to de-duplicate. */
|
|
155
|
-
reason?: 'past-13-months' | 'too-many';
|
|
156
|
-
days: DayTotals[];
|
|
157
|
-
total: Row & {
|
|
158
|
-
returningUsers: number;
|
|
159
|
-
};
|
|
160
|
-
byPlatform: Record<string, Row>;
|
|
161
|
-
byGeo: Record<string, GeoRow>;
|
|
162
|
-
byShop: Record<string, Row>;
|
|
163
|
-
tools: ToolRow[];
|
|
164
|
-
funnel: Funnel;
|
|
165
|
-
account: AccountSummary;
|
|
166
|
-
booking: BookingSummary;
|
|
167
|
-
member: MemberSummary;
|
|
168
|
-
/** Days with imported requests (no tool names) in the window. */
|
|
169
|
-
importedDays: string[];
|
|
170
|
-
/** Days whose users, conversations and connections stopped at the ceiling - at least these. */
|
|
171
|
-
capped?: string[];
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* When a pseudonym was first seen - the maintenance's index (maintain.ts), so
|
|
175
|
-
* a day's totals can say who is new without reading every earlier day again.
|
|
176
|
-
*/
|
|
177
|
-
export type SeenIndex = {
|
|
178
|
-
userFirst(u: string): string | undefined;
|
|
179
|
-
shopperFirst(s: string): string | undefined;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Sums events fed one at a time - so neither the maintenance nor the CLI ever
|
|
183
|
-
* holds a window's lines in memory, only its counts and distinct pseudonyms.
|
|
184
|
-
*
|
|
185
|
-
* Two passes over the same lines: `place` (who was where - see knownPlaces),
|
|
186
|
-
* then `add`. Lines before `from` only say who was seen before (new versus
|
|
187
|
-
* returning) - unless a `seen` index answers that instead.
|
|
188
|
-
*/
|
|
189
|
-
export declare class ReportBuilder {
|
|
190
|
-
private readonly from;
|
|
191
|
-
private readonly to;
|
|
192
|
-
private readonly deployment;
|
|
193
|
-
private readonly tz;
|
|
194
|
-
private readonly seen?;
|
|
195
|
-
private readonly tally;
|
|
196
|
-
private places;
|
|
197
|
-
private readonly seenUsers;
|
|
198
|
-
private readonly shoppersBefore;
|
|
199
|
-
private readonly days;
|
|
200
|
-
private readonly total;
|
|
201
|
-
private readonly byPlatform;
|
|
202
|
-
private readonly byGeo;
|
|
203
|
-
private readonly byShop;
|
|
204
|
-
private readonly booking;
|
|
205
|
-
private readonly member;
|
|
206
|
-
private readonly tools;
|
|
207
|
-
private readonly held;
|
|
208
|
-
private readonly account;
|
|
209
|
-
private readonly imported;
|
|
210
|
-
private readonly funnel;
|
|
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;
|
|
216
|
-
private mine;
|
|
217
|
-
/**
|
|
218
|
-
* First pass: where each user and conversation was seen, within the window.
|
|
219
|
-
* A request that said nothing of where is then counted where its user (or,
|
|
220
|
-
* with no user, its conversation) most often was - one request without an
|
|
221
|
-
* address does not put them in 「未知」 too (总线程 11-13: 5 ChatGPT users
|
|
222
|
-
* were in both).
|
|
223
|
-
*/
|
|
224
|
-
place(e: UsageEvent): void;
|
|
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;
|
|
232
|
-
/** Second pass: count it. */
|
|
233
|
-
add(raw: UsageEvent): void;
|
|
234
|
-
build(): Report;
|
|
235
|
-
}
|
|
236
|
-
/** The whole report from events in hand - tests, and small windows. */
|
|
237
|
-
export declare const buildReport: (events: Iterable<UsageEvent>, from: string, to: string, deployment?: string | null, tz?: Tz) => Report;
|
|
238
|
-
/** One day's totals as kept in daily/<day>.json - counts and tool names only. */
|
|
239
|
-
export type DailyTotals = DayTotals & {
|
|
240
|
-
v: 1;
|
|
241
|
-
deployment: string | null;
|
|
242
|
-
tz: string;
|
|
243
|
-
tools: ToolRow[];
|
|
244
|
-
funnel: Funnel;
|
|
245
|
-
};
|
|
246
|
-
export declare const dailyTotals: (r: Report, day: string) => DailyTotals | null;
|
|
247
|
-
/**
|
|
248
|
-
* The days' totals summed - for a window reaching past the 13 months of lines.
|
|
249
|
-
* Users are 「每天活跃之和」 and newUsers 「新用户累计」; conversations, the
|
|
250
|
-
* funnel and shoppers are per-day sums too.
|
|
251
|
-
*/
|
|
252
|
-
export declare const sumDays: (daily: DailyTotals[], from: string, to: string, deployment: string | null, tz: Tz, reason?: Report["reason"]) => Report;
|
|
253
|
-
/** The one line the daily check prints. */
|
|
254
|
-
export declare const summaryLine: (r: Report, name: string) => string;
|
|
255
|
-
/** The report as text, for a person at a terminal. */
|
|
256
|
-
export declare const reportText: (r: Report, name: string) => string;
|
|
257
|
-
export {};
|
|
258
|
-
//# sourceMappingURL=report.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,KAAK,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,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;AAC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