@madewithremy/admin 0.1.54 → 0.1.56
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/CHANGELOG.md +19 -0
- package/dist/index.d.ts +158 -16
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/prod.js +137 -19
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -698,6 +698,22 @@ function batch(ctx, queries) {
|
|
|
698
698
|
{ queries }
|
|
699
699
|
);
|
|
700
700
|
}
|
|
701
|
+
function funnel(ctx, body) {
|
|
702
|
+
return call(
|
|
703
|
+
ctx,
|
|
704
|
+
"POST",
|
|
705
|
+
`/_internal/v2/apps/${ctx.appId}/insights/funnel`,
|
|
706
|
+
body
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
function paths(ctx, body) {
|
|
710
|
+
return call(
|
|
711
|
+
ctx,
|
|
712
|
+
"POST",
|
|
713
|
+
`/_internal/v2/apps/${ctx.appId}/insights/paths`,
|
|
714
|
+
body
|
|
715
|
+
);
|
|
716
|
+
}
|
|
701
717
|
function sources(ctx, params = {}) {
|
|
702
718
|
return call(
|
|
703
719
|
ctx,
|
|
@@ -763,6 +779,14 @@ var analyticsSpecs = {
|
|
|
763
779
|
usage: `Usage: remy-admin analytics batch '<json array of query bodies>'`,
|
|
764
780
|
positionals: [{ name: "body", required: true }]
|
|
765
781
|
},
|
|
782
|
+
"analytics funnel": {
|
|
783
|
+
usage: `Usage: remy-admin analytics funnel '<json>'`,
|
|
784
|
+
positionals: [{ name: "body", required: true }]
|
|
785
|
+
},
|
|
786
|
+
"analytics paths": {
|
|
787
|
+
usage: `Usage: remy-admin analytics paths ['<json>']`,
|
|
788
|
+
positionals: [{ name: "body" }]
|
|
789
|
+
},
|
|
766
790
|
"analytics sources": {
|
|
767
791
|
usage: "Usage: remy-admin analytics sources [--limit 25] [--offset 0] [scope + filters]",
|
|
768
792
|
flags: {
|
|
@@ -837,6 +861,34 @@ async function analyticsBatch(ctx, a) {
|
|
|
837
861
|
const queries = Array.isArray(body) ? body : body?.queries;
|
|
838
862
|
out(await batch(ctx, queries));
|
|
839
863
|
}
|
|
864
|
+
function visitReadBody(raw, command) {
|
|
865
|
+
if (raw === void 0) {
|
|
866
|
+
return {};
|
|
867
|
+
}
|
|
868
|
+
let body;
|
|
869
|
+
try {
|
|
870
|
+
body = JSON.parse(raw);
|
|
871
|
+
} catch (err) {
|
|
872
|
+
throw new UsageError(
|
|
873
|
+
`${command} body is not valid JSON (${err.message}). Run 'remy-admin analytics --help' for its fields.`,
|
|
874
|
+
analyticsSpecs[command].usage
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
return body;
|
|
878
|
+
}
|
|
879
|
+
async function analyticsFunnel(ctx, a) {
|
|
880
|
+
out(
|
|
881
|
+
await funnel(
|
|
882
|
+
ctx,
|
|
883
|
+
visitReadBody(a.req("body"), "analytics funnel")
|
|
884
|
+
)
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
async function analyticsPaths(ctx, a) {
|
|
888
|
+
out(
|
|
889
|
+
await paths(ctx, visitReadBody(a.str("body"), "analytics paths"))
|
|
890
|
+
);
|
|
891
|
+
}
|
|
840
892
|
async function analyticsSources(ctx, a) {
|
|
841
893
|
out(
|
|
842
894
|
await sources(ctx, {
|
|
@@ -910,6 +962,8 @@ async function analyticsCrawlers(ctx, a) {
|
|
|
910
962
|
var analyticsHandlers = {
|
|
911
963
|
"analytics query": analyticsQuery,
|
|
912
964
|
"analytics batch": analyticsBatch,
|
|
965
|
+
"analytics funnel": analyticsFunnel,
|
|
966
|
+
"analytics paths": analyticsPaths,
|
|
913
967
|
"analytics sources": analyticsSources,
|
|
914
968
|
"analytics map": analyticsMap,
|
|
915
969
|
"analytics live": analyticsLive,
|
|
@@ -924,6 +978,10 @@ Subcommands:
|
|
|
924
978
|
top-N, and event stats are all query shapes)
|
|
925
979
|
batch '<json array>' Up to 10 query bodies in one round trip;
|
|
926
980
|
results in request order
|
|
981
|
+
funnel '<json>' Visits through ordered steps, and where they
|
|
982
|
+
dropped off
|
|
983
|
+
paths ['<json>'] Where visits went after a page, and their
|
|
984
|
+
commonest opening routes
|
|
927
985
|
sources Ranked traffic sources (per-session first
|
|
928
986
|
source: UTM > referrer > direct, classified)
|
|
929
987
|
map City lat/lon points for geo rendering
|
|
@@ -933,30 +991,63 @@ Subcommands:
|
|
|
933
991
|
AI-crawler / bot ingestion views
|
|
934
992
|
|
|
935
993
|
The query JSON body:
|
|
936
|
-
metrics required:
|
|
994
|
+
metrics required, counts: "pageviews" | "visitors" | "visits" | "events"
|
|
995
|
+
averages (null with nothing to average): "timeOnPage" (seconds
|
|
996
|
+
actively read per page) | "scrollDepth" (% of the page) |
|
|
997
|
+
"visitDuration" (seconds per visit) | "bounceRate" (% of
|
|
998
|
+
visits: one pageview, no custom event, under 10s active)
|
|
937
999
|
dimensions at most ONE entity dimension OR "time" (not both):
|
|
938
1000
|
path referrerHost sourceCategory country city deviceType
|
|
939
1001
|
browser os language visitorType utmSource utmMedium
|
|
940
1002
|
utmCampaign utmTerm utmContent eventName
|
|
1003
|
+
the visit's own: entryPath exitPath visitReferrerHost
|
|
1004
|
+
visitSourceCategory visitUtmSource ... visitUtmContent
|
|
1005
|
+
a custom event's property: prop:<key>
|
|
941
1006
|
granularity required with "time": "5m" | "hour" | "day" | "week" | "month"
|
|
942
1007
|
timezone IANA zone for day/week/month boundaries (default UTC)
|
|
943
1008
|
filters [[op, dimension, [values...]], ...]
|
|
944
1009
|
ops: "is" (any of) | "is_not" (none of; missing still matches)
|
|
945
1010
|
| "contains" (case-insensitive substring)
|
|
1011
|
+
"visitEvent" is a filter only: the visit fired the event
|
|
946
1012
|
dateRange "1h" | "24h" | "7d" | "30d" | "90d" | "all"
|
|
947
1013
|
or ["<startISO>", "<endISO>"] (default "24h")
|
|
948
1014
|
with "all", granularity is a minimum (server coarsens as
|
|
949
1015
|
history grows); city filter values are plain city names
|
|
950
|
-
orderBy grouped only: [["pageviews" | "events", "asc" | "desc"]]
|
|
1016
|
+
orderBy grouped only: [["pageviews" | "events" | "visits", "asc" | "desc"]]
|
|
951
1017
|
limit grouped only, default 25, max 1000; offset for paging
|
|
952
1018
|
releaseId optional release scope
|
|
953
1019
|
|
|
954
1020
|
How far back a query can look depends on its shape: all-"is" filters touching
|
|
955
|
-
at most ONE dimension read a rollup kept forever (full lifetime history
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1021
|
+
at most ONE dimension read a rollup kept forever (full lifetime history, and
|
|
1022
|
+
time on page and scroll depth app-wide or per page); cross-dimension,
|
|
1023
|
+
"is_not", "contains", property and visit queries (visit dimensions,
|
|
1024
|
+
visitDuration, bounceRate) scan raw events retained 90 days \u2014 the server
|
|
1025
|
+
clamps the window, and for visits to when the app's visits were first
|
|
1026
|
+
recorded. The response meta says what happened: source ("rollup" |
|
|
1027
|
+
"events"), window.served, clamped, metricsOmitted (metrics this shape can't
|
|
1028
|
+
carry \u2014 e.g. visits on grouped reads that aren't about visits, bounceRate by
|
|
1029
|
+
path), total (group count).
|
|
1030
|
+
|
|
1031
|
+
The funnel JSON body:
|
|
1032
|
+
steps required, 2-8: {"page": "/pricing", "match"?: "is"|"contains"}
|
|
1033
|
+
or {"event": "signup_start", "props"?: {"plan": "pro"}}, each
|
|
1034
|
+
reached after the one before it within one visit
|
|
1035
|
+
breakdown optional: entryPath exitPath visitReferrerHost
|
|
1036
|
+
visitSourceCategory visitUtm* visitorType deviceType country
|
|
1037
|
+
browser os (its 25 largest values)
|
|
1038
|
+
filters pick visits: a visit is in when any of its rows matches them all
|
|
1039
|
+
dateRange as for query; releaseId optional
|
|
1040
|
+
|
|
1041
|
+
The paths JSON body (all optional):
|
|
1042
|
+
from a path: the pages opened next after it (null path = left)
|
|
1043
|
+
depth opening pages per route, 1-5 (default 3)
|
|
1044
|
+
limit rows per list, 1-100 (default 10)
|
|
1045
|
+
filters, dateRange, releaseId as for funnel
|
|
1046
|
+
|
|
1047
|
+
funnel and paths follow a visitor across the apps sharing this app's host
|
|
1048
|
+
(the apps it mounts, the app it's mounted under); meta.apps lists them. Both
|
|
1049
|
+
answer invalid_query_field (400) for an unknown field; funnel answers
|
|
1050
|
+
invalid_step (400) for a malformed step.
|
|
960
1051
|
|
|
961
1052
|
Shared flags on sources/map/ai-sources/crawlers:
|
|
962
1053
|
--release <id>, --start <ISO>, --end <ISO>, --limit <n>
|
|
@@ -984,6 +1075,21 @@ Examples:
|
|
|
984
1075
|
# Mobile traffic by country (cross-dimension -> 90-day window)
|
|
985
1076
|
remy-admin analytics query '{"metrics":["pageviews"],"dimensions":["country"],"filters":[["is","deviceType",["mobile"]]],"dateRange":"30d"}'
|
|
986
1077
|
|
|
1078
|
+
# Bounce rate and visit duration by entry page
|
|
1079
|
+
remy-admin analytics query '{"metrics":["visits","bounceRate","visitDuration"],"dimensions":["entryPath"],"orderBy":[["visits","desc"]],"dateRange":"30d"}'
|
|
1080
|
+
|
|
1081
|
+
# Lifetime time on page and scroll depth per page
|
|
1082
|
+
remy-admin analytics query '{"metrics":["pageviews","timeOnPage","scrollDepth"],"dimensions":["path"],"dateRange":"all"}'
|
|
1083
|
+
|
|
1084
|
+
# Pages read in visits that went on to sign up
|
|
1085
|
+
remy-admin analytics query '{"metrics":["visits"],"dimensions":["path"],"filters":[["is","visitEvent",["signup_start"]]],"orderBy":[["visits","desc"]],"dateRange":"30d"}'
|
|
1086
|
+
|
|
1087
|
+
# Blog post to signup, split by first source
|
|
1088
|
+
remy-admin analytics funnel '{"steps":[{"page":"/blog/","match":"contains"},{"event":"signup_start"}],"breakdown":"visitSourceCategory","dateRange":"30d"}'
|
|
1089
|
+
|
|
1090
|
+
# Where visits go after the pricing page
|
|
1091
|
+
remy-admin analytics paths '{"from":"/pricing","dateRange":"7d"}'
|
|
1092
|
+
|
|
987
1093
|
remy-admin analytics sources --limit 10
|
|
988
1094
|
remy-admin analytics live
|
|
989
1095
|
remy-admin analytics crawlers recent`;
|
|
@@ -3294,7 +3400,7 @@ function view(ctx, params) {
|
|
|
3294
3400
|
return call(
|
|
3295
3401
|
ctx,
|
|
3296
3402
|
"GET",
|
|
3297
|
-
`/_internal/v2/apps/${ctx.appId}/prerender/pages/view${qs({ path: params.path })}`
|
|
3403
|
+
`/_internal/v2/apps/${ctx.appId}/prerender/pages/view${qs({ path: params.path, host: params.host })}`
|
|
3298
3404
|
);
|
|
3299
3405
|
}
|
|
3300
3406
|
function invalidate(ctx, params = {}) {
|
|
@@ -3313,7 +3419,7 @@ function invalidate(ctx, params = {}) {
|
|
|
3313
3419
|
// src/commands/prerender.ts
|
|
3314
3420
|
var prerenderSpecs = {
|
|
3315
3421
|
"prerender invalidate": {
|
|
3316
|
-
usage: "Usage: remy-admin prerender invalidate <path...> (or --all to purge every snapshot)",
|
|
3422
|
+
usage: "Usage: remy-admin prerender invalidate <path-or-url...> (or --all to purge every snapshot)",
|
|
3317
3423
|
positionals: [{ name: "path", variadic: true }],
|
|
3318
3424
|
flags: { all: { type: "boolean" } },
|
|
3319
3425
|
requireAnyOf: {
|
|
@@ -3332,8 +3438,9 @@ var prerenderSpecs = {
|
|
|
3332
3438
|
flags: { cursor: { type: "string" } }
|
|
3333
3439
|
},
|
|
3334
3440
|
"prerender view": {
|
|
3335
|
-
usage: "Usage: remy-admin prerender view <path>",
|
|
3336
|
-
positionals: [{ name: "path", required: true }]
|
|
3441
|
+
usage: "Usage: remy-admin prerender view <path> [--host <hostname>]",
|
|
3442
|
+
positionals: [{ name: "path", required: true }],
|
|
3443
|
+
flags: { host: { type: "string" } }
|
|
3337
3444
|
}
|
|
3338
3445
|
};
|
|
3339
3446
|
async function prerenderInvalidate(ctx, a) {
|
|
@@ -3369,7 +3476,8 @@ async function prerenderPages(ctx, a) {
|
|
|
3369
3476
|
async function prerenderView(ctx, a) {
|
|
3370
3477
|
const rawPath = a.req("path");
|
|
3371
3478
|
const normalized = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
3372
|
-
|
|
3479
|
+
const host = a.str("host")?.replace(/^https?:\/\//, "").replace(/\/+$/, "");
|
|
3480
|
+
out(await view(ctx, { path: normalized, host }));
|
|
3373
3481
|
}
|
|
3374
3482
|
var prerenderHandlers = {
|
|
3375
3483
|
"prerender invalidate": prerenderInvalidate,
|
|
@@ -3380,26 +3488,33 @@ var prerenderHandlers = {
|
|
|
3380
3488
|
var prerenderHelp = `remy-admin prerender \u2014 Manage prerendered snapshots served to bots/crawlers.
|
|
3381
3489
|
|
|
3382
3490
|
Subcommands:
|
|
3383
|
-
pages List the live release's stored snapshots (path, renderedAt, bytes)
|
|
3384
|
-
view Print one stored snapshot as { path, html }
|
|
3491
|
+
pages List the live release's stored snapshots (host, path, renderedAt, bytes)
|
|
3492
|
+
view Print one stored snapshot as { host, path, html, status }
|
|
3385
3493
|
invalidate Purge cached snapshot(s) so crawlers get a fresh render next visit
|
|
3386
3494
|
get Fetch a path as a crawler (bot UA) to verify end-to-end
|
|
3387
3495
|
|
|
3388
3496
|
Usage:
|
|
3389
3497
|
remy-admin prerender pages [--cursor <c>] Paginated snapshot list
|
|
3390
|
-
remy-admin prerender view <path> The stored HTML for one path
|
|
3391
|
-
remy-admin prerender
|
|
3498
|
+
remy-admin prerender view <path> The stored HTML for one path, on the app's own URL
|
|
3499
|
+
remy-admin prerender view <path> --host <h> Same, on a specific hostname
|
|
3500
|
+
remy-admin prerender invalidate <path...> Purge specific paths, on every host
|
|
3501
|
+
remy-admin prerender invalidate <url...> Purge pages on one host only (https://h/path)
|
|
3392
3502
|
remy-admin prerender invalidate --all Purge every snapshot for the app
|
|
3393
3503
|
remy-admin prerender get <path> Print { url, status, html } as a crawler sees it
|
|
3394
3504
|
remy-admin prerender get <path> --host <h> Same, against a specific hostname
|
|
3395
3505
|
|
|
3396
3506
|
Notes:
|
|
3507
|
+
- Snapshots are kept per host: an app serving several sites has each site's own page
|
|
3508
|
+
at a path. 'pages' lists each with its host (null for one stored before snapshots
|
|
3509
|
+
were kept per host).
|
|
3397
3510
|
- 'pages'/'view' read what's stored for the LIVE release; 'get' exercises the real
|
|
3398
3511
|
serve path with a bot User-Agent. A warm path returns the snapshot; a cold path
|
|
3399
3512
|
returns the live SPA and triggers a render \u2014 re-run to see it.
|
|
3400
|
-
- 'get'
|
|
3513
|
+
- 'get' and 'view' use the app's own URL (its custom domain, else its subdomain) unless
|
|
3401
3514
|
--host names another.
|
|
3402
|
-
- 'view' errors with snapshot_not_found when the path has no snapshot yet.
|
|
3515
|
+
- 'view' errors with snapshot_not_found when the path has no snapshot yet on that host.
|
|
3516
|
+
'status' is what crawlers get: 200, or the 4xx the page declared with
|
|
3517
|
+
<meta name="prerender-status-code">.
|
|
3403
3518
|
- Invalidation targets the current LIVE release; a deploy already invalidates on its own.
|
|
3404
3519
|
- Mounted pages: when another app mounts this one, 'pages' lists paths carrying that
|
|
3405
3520
|
app's mount prefix, and those pages exist only on that app's host \u2014 pass --host to
|
|
@@ -3409,6 +3524,8 @@ Notes:
|
|
|
3409
3524
|
Examples:
|
|
3410
3525
|
remy-admin prerender pages
|
|
3411
3526
|
remy-admin prerender view /u/abc123
|
|
3527
|
+
remy-admin prerender view /about --host site-b.com
|
|
3528
|
+
remy-admin prerender invalidate https://site-a.com/blog/launch
|
|
3412
3529
|
remy-admin prerender invalidate --all
|
|
3413
3530
|
remy-admin prerender get /u/abc123
|
|
3414
3531
|
remy-admin prerender get /demos/vector-search/blog/x --host example.com`;
|
|
@@ -7850,7 +7967,8 @@ Usage:
|
|
|
7850
7967
|
remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]
|
|
7851
7968
|
|
|
7852
7969
|
Notes:
|
|
7853
|
-
Costs are in dollars.
|
|
7970
|
+
Costs are in dollars. Your own work on the app isn't counted: building it,
|
|
7971
|
+
testing it in the sandbox, and its security assessments.
|
|
7854
7972
|
--by method (the default) is the spend each method drove, model the models'
|
|
7855
7973
|
share, step the whole spend by action, models and everything else. The window
|
|
7856
7974
|
defaults to the 30 days before --end, and --end to now. An app's own method
|