@ainyc/canonry 1.39.2 → 1.39.3
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/{chunk-MMWL2OYJ.js → chunk-DEVIW3O3.js} +36 -6
- package/dist/cli.js +12 -2
- package/dist/index.js +1 -1
- package/package.json +5 -5
|
@@ -2613,6 +2613,12 @@ async function runRoutes(app, opts) {
|
|
|
2613
2613
|
throw validationError(`Location "${request.body.location}" not found. Configure it first.`);
|
|
2614
2614
|
}
|
|
2615
2615
|
resolvedLocation = loc;
|
|
2616
|
+
} else if (project.defaultLocation) {
|
|
2617
|
+
const loc = projectLocations.find((l) => l.label === project.defaultLocation);
|
|
2618
|
+
if (!loc) {
|
|
2619
|
+
throw validationError(`Default location "${project.defaultLocation}" not found. Update the project configuration.`);
|
|
2620
|
+
}
|
|
2621
|
+
resolvedLocation = loc;
|
|
2616
2622
|
}
|
|
2617
2623
|
if (request.body?.allLocations) {
|
|
2618
2624
|
if (projectLocations.length === 0) {
|
|
@@ -2709,11 +2715,23 @@ async function runRoutes(app, opts) {
|
|
|
2709
2715
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2710
2716
|
const results = [];
|
|
2711
2717
|
for (const project of allProjects) {
|
|
2718
|
+
const projectLocations = parseJsonColumn(project.locations, []);
|
|
2719
|
+
let resolvedLocation;
|
|
2720
|
+
if (project.defaultLocation) {
|
|
2721
|
+
const loc = projectLocations.find((l) => l.label === project.defaultLocation);
|
|
2722
|
+
if (!loc) {
|
|
2723
|
+
results.push({ projectName: project.name, projectId: project.id, status: "error", error: `Default location "${project.defaultLocation}" not found` });
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
resolvedLocation = loc;
|
|
2727
|
+
}
|
|
2728
|
+
const locationLabel = resolvedLocation?.label ?? null;
|
|
2712
2729
|
const queueResult = queueRunIfProjectIdle(app.db, {
|
|
2713
2730
|
createdAt: now,
|
|
2714
2731
|
kind,
|
|
2715
2732
|
projectId: project.id,
|
|
2716
|
-
trigger: "manual"
|
|
2733
|
+
trigger: "manual",
|
|
2734
|
+
location: locationLabel
|
|
2717
2735
|
});
|
|
2718
2736
|
if (queueResult.conflict) {
|
|
2719
2737
|
results.push({ projectName: project.name, projectId: project.id, status: "conflict", error: "run_in_progress" });
|
|
@@ -2729,7 +2747,7 @@ async function runRoutes(app, opts) {
|
|
|
2729
2747
|
});
|
|
2730
2748
|
const run = app.db.select().from(runs).where(eq7(runs.id, runId)).get();
|
|
2731
2749
|
if (opts.onRunCreated) {
|
|
2732
|
-
opts.onRunCreated(runId, project.id, providers);
|
|
2750
|
+
opts.onRunCreated(runId, project.id, providers, resolvedLocation);
|
|
2733
2751
|
}
|
|
2734
2752
|
results.push({ ...formatRun(run), projectName: project.name });
|
|
2735
2753
|
}
|
|
@@ -14103,11 +14121,23 @@ var Scheduler = class {
|
|
|
14103
14121
|
this.remove(projectId);
|
|
14104
14122
|
return;
|
|
14105
14123
|
}
|
|
14124
|
+
const projectLocations = parseJsonColumn(project.locations, []);
|
|
14125
|
+
let resolvedLocation;
|
|
14126
|
+
if (project.defaultLocation) {
|
|
14127
|
+
const loc = projectLocations.find((l) => l.label === project.defaultLocation);
|
|
14128
|
+
if (!loc) {
|
|
14129
|
+
log4.warn("default-location.stale", { scheduleId, projectId, label: project.defaultLocation });
|
|
14130
|
+
return;
|
|
14131
|
+
}
|
|
14132
|
+
resolvedLocation = loc;
|
|
14133
|
+
}
|
|
14134
|
+
const locationLabel = resolvedLocation?.label ?? null;
|
|
14106
14135
|
const queueResult = queueRunIfProjectIdle(this.db, {
|
|
14107
14136
|
createdAt: now,
|
|
14108
14137
|
kind: "answer-visibility",
|
|
14109
14138
|
projectId,
|
|
14110
|
-
trigger: "scheduled"
|
|
14139
|
+
trigger: "scheduled",
|
|
14140
|
+
location: locationLabel
|
|
14111
14141
|
});
|
|
14112
14142
|
if (queueResult.conflict) {
|
|
14113
14143
|
log4.info("run.skipped-active", { projectName: project.name, activeRunId: queueResult.activeRunId });
|
|
@@ -14126,7 +14156,7 @@ var Scheduler = class {
|
|
|
14126
14156
|
const scheduleProviders = parseJsonColumn(currentSchedule.providers, []);
|
|
14127
14157
|
const providers = scheduleProviders.length > 0 ? scheduleProviders : void 0;
|
|
14128
14158
|
log4.info("run.triggered", { runId, projectName: project.name, providers: providers ?? "all" });
|
|
14129
|
-
this.callbacks.onRunCreated(runId, projectId, providers);
|
|
14159
|
+
this.callbacks.onRunCreated(runId, projectId, providers, resolvedLocation);
|
|
14130
14160
|
} catch (err) {
|
|
14131
14161
|
log4.error("trigger.error", { scheduleId, projectId, error: err instanceof Error ? err.message : String(err) });
|
|
14132
14162
|
}
|
|
@@ -15531,8 +15561,8 @@ async function createServer(opts) {
|
|
|
15531
15561
|
jobRunner.onRunCompleted = (runId, projectId) => runCoordinator.onRunCompleted(runId, projectId);
|
|
15532
15562
|
const snapshotService = new SnapshotService(registry);
|
|
15533
15563
|
const scheduler = new Scheduler(opts.db, {
|
|
15534
|
-
onRunCreated: (runId, projectId, providers2) => {
|
|
15535
|
-
jobRunner.executeRun(runId, projectId, providers2).catch((err) => {
|
|
15564
|
+
onRunCreated: (runId, projectId, providers2, location) => {
|
|
15565
|
+
jobRunner.executeRun(runId, projectId, providers2, location).catch((err) => {
|
|
15536
15566
|
app.log.error({ runId, err }, "Scheduled job runner failed");
|
|
15537
15567
|
});
|
|
15538
15568
|
}
|
package/dist/cli.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
setGoogleAuthConfig,
|
|
28
28
|
showFirstRunNotice,
|
|
29
29
|
trackEvent
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-DEVIW3O3.js";
|
|
31
31
|
|
|
32
32
|
// src/cli.ts
|
|
33
33
|
import { pathToFileURL } from "url";
|
|
@@ -3406,7 +3406,9 @@ async function showStatus(project, format) {
|
|
|
3406
3406
|
console.log(` Country: ${projectData.country}`);
|
|
3407
3407
|
console.log(` Language: ${projectData.language}`);
|
|
3408
3408
|
if (runs2.length > 0) {
|
|
3409
|
-
const latest = runs2
|
|
3409
|
+
const latest = runs2.reduce(
|
|
3410
|
+
(current, candidate) => candidate.createdAt > current.createdAt ? candidate : current
|
|
3411
|
+
);
|
|
3410
3412
|
console.log(`
|
|
3411
3413
|
Latest run:`);
|
|
3412
3414
|
console.log(` ID: ${latest.id}`);
|
|
@@ -3941,6 +3943,12 @@ async function triggerRunAll(opts) {
|
|
|
3941
3943
|
const resolved = providerInputs.flatMap((p) => resolveProviderInput(p));
|
|
3942
3944
|
body.providers = resolved.length > 0 ? resolved : providerInputs;
|
|
3943
3945
|
}
|
|
3946
|
+
if (opts?.allLocations) {
|
|
3947
|
+
body.allLocations = true;
|
|
3948
|
+
}
|
|
3949
|
+
if (opts?.noLocation) {
|
|
3950
|
+
body.noLocation = true;
|
|
3951
|
+
}
|
|
3944
3952
|
const results = [];
|
|
3945
3953
|
for (const p of projects2) {
|
|
3946
3954
|
try {
|
|
@@ -4120,6 +4128,8 @@ var RUN_CLI_COMMANDS = [
|
|
|
4120
4128
|
await triggerRunAll({
|
|
4121
4129
|
provider: getString(input.values, "provider"),
|
|
4122
4130
|
wait: getBoolean(input.values, "wait"),
|
|
4131
|
+
allLocations: getBoolean(input.values, "all-locations"),
|
|
4132
|
+
noLocation: getBoolean(input.values, "no-location"),
|
|
4123
4133
|
format: input.format
|
|
4124
4134
|
});
|
|
4125
4135
|
return;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainyc/canonry",
|
|
3
|
-
"version": "1.39.
|
|
3
|
+
"version": "1.39.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The ultimate open-source AEO monitoring tool - track how answer engines cite your domain",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"@types/node-cron": "^3.0.11",
|
|
55
55
|
"tsup": "^8.5.1",
|
|
56
56
|
"tsx": "^4.19.0",
|
|
57
|
-
"@ainyc/canonry-config": "0.0.0",
|
|
58
57
|
"@ainyc/canonry-contracts": "0.0.0",
|
|
58
|
+
"@ainyc/canonry-config": "0.0.0",
|
|
59
59
|
"@ainyc/canonry-db": "0.0.0",
|
|
60
|
-
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
61
60
|
"@ainyc/canonry-api-routes": "0.0.0",
|
|
62
|
-
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
63
61
|
"@ainyc/canonry-intelligence": "0.0.0",
|
|
64
62
|
"@ainyc/canonry-integration-google": "0.0.0",
|
|
65
|
-
"@ainyc/canonry-
|
|
63
|
+
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
64
|
+
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
66
65
|
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
67
66
|
"@ainyc/canonry-provider-local": "0.0.0",
|
|
68
67
|
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
68
|
+
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
69
69
|
"@ainyc/canonry-provider-openai": "0.0.0",
|
|
70
70
|
"@ainyc/canonry-provider-perplexity": "0.0.0"
|
|
71
71
|
},
|