@neopress/mcp 1.5.0 → 1.6.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/README.md +15 -2
- package/dist/bin.cjs +333 -10
- package/dist/http-bin.cjs +333 -10
- package/dist/index.d.ts +124 -0
- package/dist/index.js +333 -10
- package/package.json +1 -1
package/dist/http-bin.cjs
CHANGED
|
@@ -21054,6 +21054,10 @@ var EntriesEndpoint = class {
|
|
|
21054
21054
|
collectionId
|
|
21055
21055
|
})).data;
|
|
21056
21056
|
}
|
|
21057
|
+
/** Copy source content into a linked locale draft, or return its existing translation. */
|
|
21058
|
+
async createTranslation(entryId, locale) {
|
|
21059
|
+
return (await this.client.post(`${this.basePath}/${entryId}/translations`, { locale })).data;
|
|
21060
|
+
}
|
|
21057
21061
|
async update(entryId, data) {
|
|
21058
21062
|
const payload = {};
|
|
21059
21063
|
for (const key of UPDATE_PASSTHROUGH_FIELDS) if (key in data) payload[key] = data[key];
|
|
@@ -21331,8 +21335,12 @@ function appendCommonAnalyticsParams(qs, params) {
|
|
|
21331
21335
|
}
|
|
21332
21336
|
var AnalyticsEndpoint = class {
|
|
21333
21337
|
client;
|
|
21338
|
+
events;
|
|
21339
|
+
funnels;
|
|
21334
21340
|
constructor(client) {
|
|
21335
21341
|
this.client = client;
|
|
21342
|
+
this.events = new AnalyticsEventsEndpoint(client);
|
|
21343
|
+
this.funnels = new AnalyticsFunnelsEndpoint(client);
|
|
21336
21344
|
}
|
|
21337
21345
|
get basePath() {
|
|
21338
21346
|
return `${this.client.siteBasePath}/analytics`;
|
|
@@ -21389,6 +21397,58 @@ var AnalyticsEndpoint = class {
|
|
|
21389
21397
|
if (params.rowLimit) qs.set("row_limit", String(params.rowLimit));
|
|
21390
21398
|
return (await this.client.get(`${this.basePath}/search-console?${qs.toString()}`)).data;
|
|
21391
21399
|
}
|
|
21400
|
+
/** Page/form targets that can be referenced by an event definition. */
|
|
21401
|
+
async targets() {
|
|
21402
|
+
return (await this.client.get(`${this.basePath}/targets`)).data;
|
|
21403
|
+
}
|
|
21404
|
+
};
|
|
21405
|
+
var AnalyticsEventsEndpoint = class {
|
|
21406
|
+
client;
|
|
21407
|
+
constructor(client) {
|
|
21408
|
+
this.client = client;
|
|
21409
|
+
}
|
|
21410
|
+
get basePath() {
|
|
21411
|
+
return `${this.client.siteBasePath}/analytics/events`;
|
|
21412
|
+
}
|
|
21413
|
+
async list() {
|
|
21414
|
+
return (await this.client.get(this.basePath)).data;
|
|
21415
|
+
}
|
|
21416
|
+
async get(eventId) {
|
|
21417
|
+
return (await this.client.get(`${this.basePath}/${eventId}`)).data.event;
|
|
21418
|
+
}
|
|
21419
|
+
async create(data) {
|
|
21420
|
+
return (await this.client.post(this.basePath, data)).data.event;
|
|
21421
|
+
}
|
|
21422
|
+
async update(eventId, data) {
|
|
21423
|
+
return (await this.client.patch(`${this.basePath}/${eventId}`, data)).data.event;
|
|
21424
|
+
}
|
|
21425
|
+
async delete(eventId) {
|
|
21426
|
+
await this.client.delete(`${this.basePath}/${eventId}`);
|
|
21427
|
+
}
|
|
21428
|
+
};
|
|
21429
|
+
var AnalyticsFunnelsEndpoint = class {
|
|
21430
|
+
client;
|
|
21431
|
+
constructor(client) {
|
|
21432
|
+
this.client = client;
|
|
21433
|
+
}
|
|
21434
|
+
get basePath() {
|
|
21435
|
+
return `${this.client.siteBasePath}/analytics/funnels`;
|
|
21436
|
+
}
|
|
21437
|
+
async list() {
|
|
21438
|
+
return (await this.client.get(this.basePath)).data;
|
|
21439
|
+
}
|
|
21440
|
+
async get(funnelId) {
|
|
21441
|
+
return (await this.client.get(`${this.basePath}/${funnelId}`)).data.funnel;
|
|
21442
|
+
}
|
|
21443
|
+
async create(data) {
|
|
21444
|
+
return (await this.client.post(this.basePath, data)).data.funnel;
|
|
21445
|
+
}
|
|
21446
|
+
async update(funnelId, data) {
|
|
21447
|
+
return (await this.client.patch(`${this.basePath}/${funnelId}`, data)).data.funnel;
|
|
21448
|
+
}
|
|
21449
|
+
async delete(funnelId) {
|
|
21450
|
+
await this.client.delete(`${this.basePath}/${funnelId}`);
|
|
21451
|
+
}
|
|
21392
21452
|
};
|
|
21393
21453
|
//#endregion
|
|
21394
21454
|
//#region ../sdk/src/endpoints/templates.ts
|
|
@@ -22114,6 +22174,11 @@ const READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
|
22114
22174
|
"neopress_analytics_traffic_sources",
|
|
22115
22175
|
"neopress_analytics_forms",
|
|
22116
22176
|
"neopress_analytics_crawler_summary",
|
|
22177
|
+
"neopress_analytics_events_list",
|
|
22178
|
+
"neopress_analytics_event_get",
|
|
22179
|
+
"neopress_analytics_funnels_list",
|
|
22180
|
+
"neopress_analytics_funnel_get",
|
|
22181
|
+
"neopress_analytics_targets_list",
|
|
22117
22182
|
"neopress_search_console_query",
|
|
22118
22183
|
"neopress_assets_list",
|
|
22119
22184
|
"neopress_asset_get",
|
|
@@ -22137,7 +22202,13 @@ const DESTRUCTIVE_TOOLS = /* @__PURE__ */ new Set([
|
|
|
22137
22202
|
"neopress_form_delete",
|
|
22138
22203
|
"neopress_asset_delete",
|
|
22139
22204
|
"neopress_template_mark",
|
|
22140
|
-
"neopress_publish_site"
|
|
22205
|
+
"neopress_publish_site",
|
|
22206
|
+
"neopress_analytics_event_create",
|
|
22207
|
+
"neopress_analytics_event_update",
|
|
22208
|
+
"neopress_analytics_event_delete",
|
|
22209
|
+
"neopress_analytics_funnel_create",
|
|
22210
|
+
"neopress_analytics_funnel_update",
|
|
22211
|
+
"neopress_analytics_funnel_delete"
|
|
22141
22212
|
]);
|
|
22142
22213
|
const PUBLICATION_TOOLS = /* @__PURE__ */ new Set([
|
|
22143
22214
|
"neopress_entry_publish",
|
|
@@ -22178,6 +22249,12 @@ function asOptionalNumber(input, key) {
|
|
|
22178
22249
|
function asOptionalString(input, key) {
|
|
22179
22250
|
return input[key];
|
|
22180
22251
|
}
|
|
22252
|
+
function asOptionalBoolean(input, key) {
|
|
22253
|
+
return input[key];
|
|
22254
|
+
}
|
|
22255
|
+
function omitUndefined(value) {
|
|
22256
|
+
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
22257
|
+
}
|
|
22181
22258
|
function siteId(input) {
|
|
22182
22259
|
return asOptionalNumber(input, "siteId");
|
|
22183
22260
|
}
|
|
@@ -22404,10 +22481,11 @@ const toolDefinitions = [
|
|
|
22404
22481
|
title: string().optional(),
|
|
22405
22482
|
type: _enum(["static", "dynamic"]).optional(),
|
|
22406
22483
|
status: _enum(["draft", "published"]).optional(),
|
|
22484
|
+
visibility: _enum(["public", "hidden"]).optional(),
|
|
22407
22485
|
collectionId: number().int().positive().optional(),
|
|
22408
22486
|
draftTsx: string().optional(),
|
|
22409
22487
|
draftI18n: optionalJsonSchema,
|
|
22410
|
-
draftPublicLocales: array(string()).nullable().optional(),
|
|
22488
|
+
draftPublicLocales: array(string()).nullable().optional().describe("Draft public languages. null means default language only; [] means none. Publish to apply."),
|
|
22411
22489
|
draftMeta: optionalJsonSchema,
|
|
22412
22490
|
queryConfig: optionalJsonSchema,
|
|
22413
22491
|
metadata: optionalJsonSchema
|
|
@@ -22418,6 +22496,7 @@ const toolDefinitions = [
|
|
|
22418
22496
|
title: asOptionalString(input, "title"),
|
|
22419
22497
|
type: input.type,
|
|
22420
22498
|
status: input.status,
|
|
22499
|
+
visibility: input.visibility,
|
|
22421
22500
|
collectionId: asOptionalNumber(input, "collectionId"),
|
|
22422
22501
|
draftTsx: asOptionalString(input, "draftTsx"),
|
|
22423
22502
|
draftI18n: input.draftI18n,
|
|
@@ -22438,27 +22517,29 @@ const toolDefinitions = [
|
|
|
22438
22517
|
title: string().optional(),
|
|
22439
22518
|
type: _enum(["static", "dynamic"]).optional(),
|
|
22440
22519
|
status: string().optional(),
|
|
22520
|
+
visibility: _enum(["public", "hidden"]).optional(),
|
|
22441
22521
|
collectionId: number().int().positive().optional(),
|
|
22442
22522
|
draftTsx: string().optional(),
|
|
22443
22523
|
draftI18n: optionalJsonSchema,
|
|
22444
|
-
draftPublicLocales: array(string()).nullable().optional(),
|
|
22524
|
+
draftPublicLocales: array(string()).nullable().optional().describe("Draft public languages. null means default language only; [] means none. Publish to apply."),
|
|
22445
22525
|
draftMeta: optionalJsonSchema,
|
|
22446
22526
|
queryConfig: optionalJsonSchema,
|
|
22447
22527
|
metadata: optionalJsonSchema
|
|
22448
22528
|
},
|
|
22449
22529
|
handler: async (input, context, extra) => {
|
|
22450
|
-
return (await context.createClient({ siteId: siteId(input) }, extra)).pages.update(asNumber(input, "pageId"), {
|
|
22530
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).pages.update(asNumber(input, "pageId"), omitUndefined({
|
|
22451
22531
|
path: asOptionalString(input, "path"),
|
|
22452
22532
|
title: asOptionalString(input, "title"),
|
|
22453
22533
|
type: asOptionalString(input, "type"),
|
|
22454
22534
|
status: asOptionalString(input, "status"),
|
|
22535
|
+
visibility: input.visibility,
|
|
22455
22536
|
collectionId: asOptionalNumber(input, "collectionId"),
|
|
22456
22537
|
draftTsx: asOptionalString(input, "draftTsx"),
|
|
22457
22538
|
draftI18n: input.draftI18n,
|
|
22458
22539
|
draftPublicLocales: input.draftPublicLocales,
|
|
22459
22540
|
draftMeta: mergeDraftMeta(input.draftMeta, input.queryConfig),
|
|
22460
22541
|
metadata: input.metadata
|
|
22461
|
-
});
|
|
22542
|
+
}));
|
|
22462
22543
|
}
|
|
22463
22544
|
},
|
|
22464
22545
|
{
|
|
@@ -22614,6 +22695,19 @@ const toolDefinitions = [
|
|
|
22614
22695
|
return entry;
|
|
22615
22696
|
}
|
|
22616
22697
|
},
|
|
22698
|
+
{
|
|
22699
|
+
name: "neopress_entry_create_translation",
|
|
22700
|
+
title: "Create Entry Translation Draft",
|
|
22701
|
+
description: "Create or return a linked locale row in the source entry's translation group. New drafts copy source content; translate the returned entry with entry_update, then publish it. Existing translations are preserved.",
|
|
22702
|
+
inputSchema: {
|
|
22703
|
+
...siteIdShape,
|
|
22704
|
+
entryId: number().int().positive(),
|
|
22705
|
+
locale: string().min(1)
|
|
22706
|
+
},
|
|
22707
|
+
handler: async (input, context, extra) => {
|
|
22708
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).entries.createTranslation(asNumber(input, "entryId"), asString(input, "locale"));
|
|
22709
|
+
}
|
|
22710
|
+
},
|
|
22617
22711
|
{
|
|
22618
22712
|
name: "neopress_entry_update",
|
|
22619
22713
|
title: "Update Entry",
|
|
@@ -22630,14 +22724,14 @@ const toolDefinitions = [
|
|
|
22630
22724
|
},
|
|
22631
22725
|
handler: async (input, context, extra) => {
|
|
22632
22726
|
const client = await context.createClient({ siteId: siteId(input) }, extra);
|
|
22633
|
-
const entry = await client.entries.update(asNumber(input, "entryId"), {
|
|
22727
|
+
const entry = await client.entries.update(asNumber(input, "entryId"), omitUndefined({
|
|
22634
22728
|
slug: asOptionalString(input, "slug"),
|
|
22635
22729
|
title: asOptionalString(input, "title"),
|
|
22636
22730
|
locale: asOptionalString(input, "locale"),
|
|
22637
22731
|
data: input.data,
|
|
22638
22732
|
metadata: input.metadata,
|
|
22639
22733
|
status: asOptionalString(input, "status")
|
|
22640
|
-
});
|
|
22734
|
+
}));
|
|
22641
22735
|
await client.entries.revalidateReaderCache(asNumber(input, "entryId"));
|
|
22642
22736
|
return entry;
|
|
22643
22737
|
}
|
|
@@ -22802,14 +22896,14 @@ const toolDefinitions = [
|
|
|
22802
22896
|
settings: optionalJsonSchema
|
|
22803
22897
|
},
|
|
22804
22898
|
handler: async (input, context, extra) => {
|
|
22805
|
-
return (await context.createClient({ siteId: siteId(input) }, extra)).forms.update(asNumber(input, "formId"), {
|
|
22899
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).forms.update(asNumber(input, "formId"), omitUndefined({
|
|
22806
22900
|
name: asOptionalString(input, "name"),
|
|
22807
|
-
draftSchema: input.draftSchema
|
|
22901
|
+
draftSchema: input.draftSchema !== void 0 ? input.draftSchema : input.schema,
|
|
22808
22902
|
draftLayout: input.draftLayout,
|
|
22809
22903
|
draftStyle: input.draftStyle,
|
|
22810
22904
|
draftI18n: input.draftI18n,
|
|
22811
22905
|
settings: input.settings
|
|
22812
|
-
});
|
|
22906
|
+
}));
|
|
22813
22907
|
}
|
|
22814
22908
|
},
|
|
22815
22909
|
{
|
|
@@ -22853,6 +22947,235 @@ const toolDefinitions = [
|
|
|
22853
22947
|
});
|
|
22854
22948
|
}
|
|
22855
22949
|
},
|
|
22950
|
+
{
|
|
22951
|
+
name: "neopress_analytics_events_list",
|
|
22952
|
+
title: "List Analytics Events",
|
|
22953
|
+
description: "List saved analytics event definitions for the active site.",
|
|
22954
|
+
inputSchema: siteIdShape,
|
|
22955
|
+
handler: async (input, context, extra) => {
|
|
22956
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.events.list();
|
|
22957
|
+
}
|
|
22958
|
+
},
|
|
22959
|
+
{
|
|
22960
|
+
name: "neopress_analytics_event_get",
|
|
22961
|
+
title: "Get Analytics Event",
|
|
22962
|
+
description: "Get a saved analytics event definition by UUID.",
|
|
22963
|
+
inputSchema: {
|
|
22964
|
+
...siteIdShape,
|
|
22965
|
+
eventId: string().uuid()
|
|
22966
|
+
},
|
|
22967
|
+
handler: async (input, context, extra) => {
|
|
22968
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.events.get(asString(input, "eventId"));
|
|
22969
|
+
}
|
|
22970
|
+
},
|
|
22971
|
+
{
|
|
22972
|
+
name: "neopress_analytics_event_create",
|
|
22973
|
+
title: "Create Analytics Event",
|
|
22974
|
+
description: "Create a saved analytics event definition. Discover pages/forms with neopress_analytics_targets_list. Click/visibility require an existing stable [data-np-track=\"...\"] selector; page views reuse PAGE_VIEW. Optional id is a client UUID: reuse the same id and payload after an uncertain response.",
|
|
22975
|
+
inputSchema: {
|
|
22976
|
+
...siteIdShape,
|
|
22977
|
+
id: string().uuid().optional(),
|
|
22978
|
+
name: string(),
|
|
22979
|
+
eventType: _enum([
|
|
22980
|
+
"custom",
|
|
22981
|
+
"page",
|
|
22982
|
+
"click",
|
|
22983
|
+
"form",
|
|
22984
|
+
"scroll",
|
|
22985
|
+
"visibility",
|
|
22986
|
+
"dwell"
|
|
22987
|
+
]),
|
|
22988
|
+
eventName: string().optional(),
|
|
22989
|
+
path: string().optional(),
|
|
22990
|
+
selector: string().optional(),
|
|
22991
|
+
formId: string().optional(),
|
|
22992
|
+
scrollDepth: number().int().optional(),
|
|
22993
|
+
dwellSeconds: number().int().optional()
|
|
22994
|
+
},
|
|
22995
|
+
handler: async (input, context, extra) => {
|
|
22996
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.events.create({
|
|
22997
|
+
id: asOptionalString(input, "id"),
|
|
22998
|
+
name: asString(input, "name"),
|
|
22999
|
+
eventType: input.eventType,
|
|
23000
|
+
eventName: asOptionalString(input, "eventName"),
|
|
23001
|
+
path: asOptionalString(input, "path"),
|
|
23002
|
+
selector: asOptionalString(input, "selector"),
|
|
23003
|
+
formId: asOptionalString(input, "formId"),
|
|
23004
|
+
scrollDepth: asOptionalNumber(input, "scrollDepth"),
|
|
23005
|
+
dwellSeconds: asOptionalNumber(input, "dwellSeconds")
|
|
23006
|
+
});
|
|
23007
|
+
}
|
|
23008
|
+
},
|
|
23009
|
+
{
|
|
23010
|
+
name: "neopress_analytics_event_update",
|
|
23011
|
+
title: "Update Analytics Event",
|
|
23012
|
+
description: "Rename an analytics event with {name} while preserving tracking behavior, or update its display settings separately. Tracking identity cannot be changed after creation.",
|
|
23013
|
+
inputSchema: {
|
|
23014
|
+
...siteIdShape,
|
|
23015
|
+
eventId: string().uuid(),
|
|
23016
|
+
name: string().optional(),
|
|
23017
|
+
eventType: _enum([
|
|
23018
|
+
"custom",
|
|
23019
|
+
"page",
|
|
23020
|
+
"click",
|
|
23021
|
+
"form",
|
|
23022
|
+
"scroll",
|
|
23023
|
+
"visibility",
|
|
23024
|
+
"dwell"
|
|
23025
|
+
]).optional(),
|
|
23026
|
+
eventName: string().optional(),
|
|
23027
|
+
path: string().optional(),
|
|
23028
|
+
selector: string().optional(),
|
|
23029
|
+
formId: string().optional(),
|
|
23030
|
+
scrollDepth: number().int().optional(),
|
|
23031
|
+
dwellSeconds: number().int().optional(),
|
|
23032
|
+
chartVisible: boolean().optional(),
|
|
23033
|
+
pinned: boolean().optional(),
|
|
23034
|
+
chartColor: string().optional()
|
|
23035
|
+
},
|
|
23036
|
+
handler: async (input, context, extra) => {
|
|
23037
|
+
const client = await context.createClient({ siteId: siteId(input) }, extra);
|
|
23038
|
+
if ([
|
|
23039
|
+
"chartVisible",
|
|
23040
|
+
"pinned",
|
|
23041
|
+
"chartColor"
|
|
23042
|
+
].some((key) => key in input)) {
|
|
23043
|
+
if ([
|
|
23044
|
+
"name",
|
|
23045
|
+
"eventType",
|
|
23046
|
+
"eventName",
|
|
23047
|
+
"path",
|
|
23048
|
+
"selector",
|
|
23049
|
+
"formId",
|
|
23050
|
+
"scrollDepth",
|
|
23051
|
+
"dwellSeconds"
|
|
23052
|
+
].some((key) => input[key] !== void 0)) throw new Error("Update the definition and display settings in separate calls.");
|
|
23053
|
+
return client.analytics.events.update(asString(input, "eventId"), { display: {
|
|
23054
|
+
chartVisible: asOptionalBoolean(input, "chartVisible"),
|
|
23055
|
+
pinned: asOptionalBoolean(input, "pinned"),
|
|
23056
|
+
chartColor: asOptionalString(input, "chartColor")
|
|
23057
|
+
} });
|
|
23058
|
+
}
|
|
23059
|
+
const definition = {
|
|
23060
|
+
name: asString(input, "name"),
|
|
23061
|
+
...input.eventType !== void 0 ? { eventType: input.eventType } : {},
|
|
23062
|
+
eventName: asOptionalString(input, "eventName"),
|
|
23063
|
+
path: asOptionalString(input, "path"),
|
|
23064
|
+
selector: asOptionalString(input, "selector"),
|
|
23065
|
+
formId: asOptionalString(input, "formId"),
|
|
23066
|
+
scrollDepth: asOptionalNumber(input, "scrollDepth"),
|
|
23067
|
+
dwellSeconds: asOptionalNumber(input, "dwellSeconds")
|
|
23068
|
+
};
|
|
23069
|
+
return client.analytics.events.update(asString(input, "eventId"), definition);
|
|
23070
|
+
}
|
|
23071
|
+
},
|
|
23072
|
+
{
|
|
23073
|
+
name: "neopress_analytics_event_delete",
|
|
23074
|
+
title: "Delete Analytics Event",
|
|
23075
|
+
description: "Permanently delete a saved analytics event. Events referenced by a funnel cannot be deleted.",
|
|
23076
|
+
inputSchema: {
|
|
23077
|
+
...siteIdShape,
|
|
23078
|
+
eventId: string().uuid()
|
|
23079
|
+
},
|
|
23080
|
+
handler: async (input, context, extra) => {
|
|
23081
|
+
await (await context.createClient({ siteId: siteId(input) }, extra)).analytics.events.delete(asString(input, "eventId"));
|
|
23082
|
+
return { ok: true };
|
|
23083
|
+
}
|
|
23084
|
+
},
|
|
23085
|
+
{
|
|
23086
|
+
name: "neopress_analytics_funnels_list",
|
|
23087
|
+
title: "List Analytics Funnels",
|
|
23088
|
+
description: "List saved analytics funnel definitions for the active site.",
|
|
23089
|
+
inputSchema: siteIdShape,
|
|
23090
|
+
handler: async (input, context, extra) => {
|
|
23091
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.funnels.list();
|
|
23092
|
+
}
|
|
23093
|
+
},
|
|
23094
|
+
{
|
|
23095
|
+
name: "neopress_analytics_funnel_get",
|
|
23096
|
+
title: "Get Analytics Funnel",
|
|
23097
|
+
description: "Get a saved analytics funnel definition by UUID.",
|
|
23098
|
+
inputSchema: {
|
|
23099
|
+
...siteIdShape,
|
|
23100
|
+
funnelId: string().uuid()
|
|
23101
|
+
},
|
|
23102
|
+
handler: async (input, context, extra) => {
|
|
23103
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.funnels.get(asString(input, "funnelId"));
|
|
23104
|
+
}
|
|
23105
|
+
},
|
|
23106
|
+
{
|
|
23107
|
+
name: "neopress_analytics_funnel_create",
|
|
23108
|
+
title: "Create Analytics Funnel",
|
|
23109
|
+
description: "Create a funnel with 2 to 5 ordered saved event UUIDs. Optional id is a client UUID; reuse it and the same payload after an uncertain response. Step filter is {version:1,root:{kind:'group',op:'and'|'or',children:[groups or {kind:'condition',field,operator,value?,key?}]}}. Fields: event.path/url/referrer/referrer_source/property; session.referrer/referrer_source/traffic_category/utm_source/utm_medium/utm_campaign/utm_content/utm_term. event.property requires key. Operators: eq,neq,contains,not_contains,starts_with,ends_with,exists,not_exists; property also supports gt,gte,lt,lte. Server validates bounds and grouping.",
|
|
23110
|
+
inputSchema: {
|
|
23111
|
+
...siteIdShape,
|
|
23112
|
+
id: string().uuid().optional(),
|
|
23113
|
+
name: string(),
|
|
23114
|
+
steps: array(object$1({
|
|
23115
|
+
eventId: string().uuid(),
|
|
23116
|
+
path: string().optional(),
|
|
23117
|
+
filter: unknown().optional()
|
|
23118
|
+
})),
|
|
23119
|
+
windowMode: _enum(["session", "time"]),
|
|
23120
|
+
windowHours: number().int().nonnegative().optional()
|
|
23121
|
+
},
|
|
23122
|
+
handler: async (input, context, extra) => {
|
|
23123
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.funnels.create({
|
|
23124
|
+
id: asOptionalString(input, "id"),
|
|
23125
|
+
name: asString(input, "name"),
|
|
23126
|
+
steps: input.steps,
|
|
23127
|
+
windowMode: input.windowMode,
|
|
23128
|
+
windowHours: asOptionalNumber(input, "windowHours")
|
|
23129
|
+
});
|
|
23130
|
+
}
|
|
23131
|
+
},
|
|
23132
|
+
{
|
|
23133
|
+
name: "neopress_analytics_funnel_update",
|
|
23134
|
+
title: "Update Analytics Funnel",
|
|
23135
|
+
description: "Replace a saved funnel definition with its ordered event steps and window semantics.",
|
|
23136
|
+
inputSchema: {
|
|
23137
|
+
...siteIdShape,
|
|
23138
|
+
funnelId: string().uuid(),
|
|
23139
|
+
name: string(),
|
|
23140
|
+
steps: array(object$1({
|
|
23141
|
+
eventId: string().uuid(),
|
|
23142
|
+
path: string().optional(),
|
|
23143
|
+
filter: unknown().optional()
|
|
23144
|
+
})),
|
|
23145
|
+
windowMode: _enum(["session", "time"]),
|
|
23146
|
+
windowHours: number().int().nonnegative().optional()
|
|
23147
|
+
},
|
|
23148
|
+
handler: async (input, context, extra) => {
|
|
23149
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.funnels.update(asString(input, "funnelId"), {
|
|
23150
|
+
name: asString(input, "name"),
|
|
23151
|
+
steps: input.steps,
|
|
23152
|
+
windowMode: input.windowMode,
|
|
23153
|
+
windowHours: asOptionalNumber(input, "windowHours")
|
|
23154
|
+
});
|
|
23155
|
+
}
|
|
23156
|
+
},
|
|
23157
|
+
{
|
|
23158
|
+
name: "neopress_analytics_funnel_delete",
|
|
23159
|
+
title: "Delete Analytics Funnel",
|
|
23160
|
+
description: "Permanently delete a saved analytics funnel.",
|
|
23161
|
+
inputSchema: {
|
|
23162
|
+
...siteIdShape,
|
|
23163
|
+
funnelId: string().uuid()
|
|
23164
|
+
},
|
|
23165
|
+
handler: async (input, context, extra) => {
|
|
23166
|
+
await (await context.createClient({ siteId: siteId(input) }, extra)).analytics.funnels.delete(asString(input, "funnelId"));
|
|
23167
|
+
return { ok: true };
|
|
23168
|
+
}
|
|
23169
|
+
},
|
|
23170
|
+
{
|
|
23171
|
+
name: "neopress_analytics_targets_list",
|
|
23172
|
+
title: "List Analytics Event Targets",
|
|
23173
|
+
description: "List site pages and forms available as analytics event targets.",
|
|
23174
|
+
inputSchema: siteIdShape,
|
|
23175
|
+
handler: async (input, context, extra) => {
|
|
23176
|
+
return (await context.createClient({ siteId: siteId(input) }, extra)).analytics.targets();
|
|
23177
|
+
}
|
|
23178
|
+
},
|
|
22856
23179
|
{
|
|
22857
23180
|
name: "neopress_analytics_query",
|
|
22858
23181
|
title: "Query Analytics Pipe",
|
package/dist/index.d.ts
CHANGED
|
@@ -289,6 +289,102 @@ interface SearchConsoleQueryResult {
|
|
|
289
289
|
};
|
|
290
290
|
error?: string;
|
|
291
291
|
}
|
|
292
|
+
type AnalyticsEventType = "custom" | "page" | "click" | "form" | "scroll" | "visibility" | "dwell";
|
|
293
|
+
type FunnelFilterField = "event.path" | "event.url" | "event.referrer" | "event.referrer_source" | "event.property" | "session.referrer" | "session.referrer_source" | "session.traffic_category" | "session.utm_source" | "session.utm_medium" | "session.utm_campaign" | "session.utm_content" | "session.utm_term";
|
|
294
|
+
type FunnelFilterOperator = "eq" | "neq" | "contains" | "not_contains" | "starts_with" | "ends_with" | "exists" | "not_exists" | "gt" | "gte" | "lt" | "lte";
|
|
295
|
+
type AnalyticsFunnelFilterCondition = {
|
|
296
|
+
kind: "condition";
|
|
297
|
+
field: FunnelFilterField;
|
|
298
|
+
operator: FunnelFilterOperator;
|
|
299
|
+
key?: string;
|
|
300
|
+
value?: string | number;
|
|
301
|
+
};
|
|
302
|
+
type AnalyticsFunnelFilterGroup = {
|
|
303
|
+
kind: "group";
|
|
304
|
+
op: "and" | "or";
|
|
305
|
+
children: AnalyticsFunnelFilterNode[];
|
|
306
|
+
};
|
|
307
|
+
type AnalyticsFunnelFilterNode = AnalyticsFunnelFilterGroup | AnalyticsFunnelFilterCondition;
|
|
308
|
+
type AnalyticsFunnelFilter = {
|
|
309
|
+
version: 1;
|
|
310
|
+
root: AnalyticsFunnelFilterGroup;
|
|
311
|
+
};
|
|
312
|
+
interface AnalyticsEventDefinition {
|
|
313
|
+
id: string;
|
|
314
|
+
chart_color: string | null;
|
|
315
|
+
name: string;
|
|
316
|
+
chart_visible: boolean;
|
|
317
|
+
is_pinned: boolean;
|
|
318
|
+
event_type: AnalyticsEventType;
|
|
319
|
+
event_name: string;
|
|
320
|
+
path: string;
|
|
321
|
+
selector: string;
|
|
322
|
+
form_id: string;
|
|
323
|
+
scroll_depth: number;
|
|
324
|
+
dwell_seconds: number;
|
|
325
|
+
tracking_version: number;
|
|
326
|
+
created_at: string;
|
|
327
|
+
updated_at: string;
|
|
328
|
+
}
|
|
329
|
+
interface AnalyticsEventDefinitionInput {
|
|
330
|
+
/** Optional client UUID; reuse it with the same payload after an uncertain create response. */
|
|
331
|
+
id?: string;
|
|
332
|
+
name: string;
|
|
333
|
+
eventType: AnalyticsEventType;
|
|
334
|
+
eventName?: string;
|
|
335
|
+
path?: string;
|
|
336
|
+
selector?: string;
|
|
337
|
+
formId?: string;
|
|
338
|
+
scrollDepth?: number;
|
|
339
|
+
dwellSeconds?: number;
|
|
340
|
+
}
|
|
341
|
+
type AnalyticsEventDefinitionUpdate = AnalyticsEventDefinitionInput | {
|
|
342
|
+
name: string;
|
|
343
|
+
};
|
|
344
|
+
interface AnalyticsEventDisplayUpdate {
|
|
345
|
+
chartVisible?: boolean;
|
|
346
|
+
pinned?: boolean;
|
|
347
|
+
chartColor?: string;
|
|
348
|
+
}
|
|
349
|
+
interface AnalyticsFunnelStepInput {
|
|
350
|
+
eventId: string;
|
|
351
|
+
path?: string;
|
|
352
|
+
filter?: AnalyticsFunnelFilter;
|
|
353
|
+
}
|
|
354
|
+
interface AnalyticsFunnelStep {
|
|
355
|
+
event_id: string;
|
|
356
|
+
path?: string;
|
|
357
|
+
filter?: AnalyticsFunnelFilter;
|
|
358
|
+
}
|
|
359
|
+
interface AnalyticsFunnelDefinition {
|
|
360
|
+
invalid?: true;
|
|
361
|
+
id: string;
|
|
362
|
+
name: string;
|
|
363
|
+
steps: AnalyticsFunnelStep[];
|
|
364
|
+
session_only: boolean;
|
|
365
|
+
window_minutes: number;
|
|
366
|
+
created_at: string;
|
|
367
|
+
updated_at: string;
|
|
368
|
+
}
|
|
369
|
+
interface AnalyticsTargets {
|
|
370
|
+
pages: Array<{
|
|
371
|
+
id: number;
|
|
372
|
+
name: string;
|
|
373
|
+
path: string;
|
|
374
|
+
locale: string;
|
|
375
|
+
}>;
|
|
376
|
+
forms: Array<{
|
|
377
|
+
id: number;
|
|
378
|
+
name: string;
|
|
379
|
+
}>;
|
|
380
|
+
}
|
|
381
|
+
interface AnalyticsFunnelDefinitionInput {
|
|
382
|
+
id?: string;
|
|
383
|
+
name: string;
|
|
384
|
+
steps: AnalyticsFunnelStepInput[];
|
|
385
|
+
windowMode: "session" | "time";
|
|
386
|
+
windowHours?: number;
|
|
387
|
+
}
|
|
292
388
|
//#endregion
|
|
293
389
|
//#region ../sdk/src/endpoints/pages.d.ts
|
|
294
390
|
interface PageListParams {
|
|
@@ -407,6 +503,8 @@ declare class EntriesEndpoint {
|
|
|
407
503
|
list(collectionId: number, params?: EntryListParams): Promise<PaginatedResponse<Entry>>;
|
|
408
504
|
get(entryId: number): Promise<Entry>;
|
|
409
505
|
create(collectionId: number, data: EntryCreateParams): Promise<Entry>;
|
|
506
|
+
/** Copy source content into a linked locale draft, or return its existing translation. */
|
|
507
|
+
createTranslation(entryId: number, locale: string): Promise<Entry>;
|
|
410
508
|
update(entryId: number, data: EntryUpdateParams): Promise<Entry>;
|
|
411
509
|
delete(entryId: number): Promise<void>;
|
|
412
510
|
revalidateReaderCache(entryId: number): Promise<void>;
|
|
@@ -616,6 +714,8 @@ declare class EntryReferencesEndpoint {
|
|
|
616
714
|
//#region ../sdk/src/endpoints/analytics.d.ts
|
|
617
715
|
declare class AnalyticsEndpoint {
|
|
618
716
|
private readonly client;
|
|
717
|
+
readonly events: AnalyticsEventsEndpoint;
|
|
718
|
+
readonly funnels: AnalyticsFunnelsEndpoint;
|
|
619
719
|
constructor(client: NeopressClient);
|
|
620
720
|
private get basePath();
|
|
621
721
|
query(params: AnalyticsQueryParams): Promise<AnalyticsQueryResult>;
|
|
@@ -626,6 +726,30 @@ declare class AnalyticsEndpoint {
|
|
|
626
726
|
formAnalytics(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
|
|
627
727
|
crawlerSummary(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
|
|
628
728
|
searchConsole(params: SearchConsoleQueryParams): Promise<SearchConsoleQueryResult>;
|
|
729
|
+
/** Page/form targets that can be referenced by an event definition. */
|
|
730
|
+
targets(): Promise<AnalyticsTargets>;
|
|
731
|
+
}
|
|
732
|
+
declare class AnalyticsEventsEndpoint {
|
|
733
|
+
private readonly client;
|
|
734
|
+
constructor(client: NeopressClient);
|
|
735
|
+
private get basePath();
|
|
736
|
+
list(): Promise<AnalyticsEventDefinition[]>;
|
|
737
|
+
get(eventId: string): Promise<AnalyticsEventDefinition>;
|
|
738
|
+
create(data: AnalyticsEventDefinitionInput): Promise<AnalyticsEventDefinition>;
|
|
739
|
+
update(eventId: string, data: AnalyticsEventDefinitionUpdate | {
|
|
740
|
+
display: AnalyticsEventDisplayUpdate;
|
|
741
|
+
}): Promise<AnalyticsEventDefinition>;
|
|
742
|
+
delete(eventId: string): Promise<void>;
|
|
743
|
+
}
|
|
744
|
+
declare class AnalyticsFunnelsEndpoint {
|
|
745
|
+
private readonly client;
|
|
746
|
+
constructor(client: NeopressClient);
|
|
747
|
+
private get basePath();
|
|
748
|
+
list(): Promise<AnalyticsFunnelDefinition[]>;
|
|
749
|
+
get(funnelId: string): Promise<AnalyticsFunnelDefinition>;
|
|
750
|
+
create(data: AnalyticsFunnelDefinitionInput): Promise<AnalyticsFunnelDefinition>;
|
|
751
|
+
update(funnelId: string, data: AnalyticsFunnelDefinitionInput): Promise<AnalyticsFunnelDefinition>;
|
|
752
|
+
delete(funnelId: string): Promise<void>;
|
|
629
753
|
}
|
|
630
754
|
//#endregion
|
|
631
755
|
//#region ../sdk/src/endpoints/templates.d.ts
|