@koda-sl/baker-cli 0.324.0-dev.593ae2dfd → 0.324.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 +2 -1
- package/dist/{chunk-FOWT5AS4.js → chunk-6BD32M7K.js} +2 -2
- package/dist/{chunk-63Q73JIN.js → chunk-BIQH2QBE.js} +3 -3
- package/dist/{chunk-UIQJZGBG.js → chunk-GJVXXYCX.js} +2 -1
- package/dist/{chunk-UIQJZGBG.js.map → chunk-GJVXXYCX.js.map} +1 -1
- package/dist/{chunk-BD4GLBWV.js → chunk-HPRKO6P2.js} +6 -6
- package/dist/chunk-HPRKO6P2.js.map +1 -0
- package/dist/{chunk-G7CQBZVF.js → chunk-OY3N2KHF.js} +4 -4
- package/dist/{chunk-OMUDHFUY.js → chunk-VEF7YWWM.js} +3 -3
- package/dist/chunk-VEF7YWWM.js.map +1 -0
- package/dist/cli.js +26 -32
- package/dist/cli.js.map +1 -1
- package/dist/{client-7TD3X4CY.js → client-DGQVUFLK.js} +4 -4
- package/dist/engine/index.js +3 -3
- package/dist/{env-PJSBLG56.js → env-VIA5U56G.js} +2 -2
- package/dist/{output-HLNLGRIT.js → output-6ER7S4BM.js} +5 -5
- package/dist/{shared-S5OCQHPP.js → shared-6Z32L7SG.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-BD4GLBWV.js.map +0 -1
- package/dist/chunk-OMUDHFUY.js.map +0 -1
- /package/dist/{chunk-FOWT5AS4.js.map → chunk-6BD32M7K.js.map} +0 -0
- /package/dist/{chunk-63Q73JIN.js.map → chunk-BIQH2QBE.js.map} +0 -0
- /package/dist/{chunk-G7CQBZVF.js.map → chunk-OY3N2KHF.js.map} +0 -0
- /package/dist/{client-7TD3X4CY.js.map → client-DGQVUFLK.js.map} +0 -0
- /package/dist/{env-PJSBLG56.js.map → env-VIA5U56G.js.map} +0 -0
- /package/dist/{output-HLNLGRIT.js.map → output-6ER7S4BM.js.map} +0 -0
- /package/dist/{shared-S5OCQHPP.js.map → shared-6Z32L7SG.js.map} +0 -0
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
handleConnectionError,
|
|
3
3
|
needsConnectionFix,
|
|
4
4
|
writeAdsJson
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BIQH2QBE.js";
|
|
6
6
|
import {
|
|
7
7
|
ApiError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VEF7YWWM.js";
|
|
9
9
|
import {
|
|
10
10
|
getEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GJVXXYCX.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/ads/meta/shared.ts
|
|
14
14
|
var DAY_MS = 864e5;
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
csvOrJson,
|
|
109
109
|
resolveEffectiveStatus
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-OY3N2KHF.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
debugLogHttp,
|
|
3
3
|
readBodyForLog
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6BD32M7K.js";
|
|
5
5
|
import {
|
|
6
6
|
getEnv
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GJVXXYCX.js";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
10
10
|
var MAX_RATE_LIMIT_RETRIES = 3;
|
|
@@ -205,4 +205,4 @@ export {
|
|
|
205
205
|
apiGet,
|
|
206
206
|
apiPost
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-VEF7YWWM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import { debugLogHttp, readBodyForLog } from \"./debugLog.ts\";\nimport { getEnv } from \"./env.ts\";\n\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst MAX_TOTAL_WAIT_MS = 2 * 60 * 1000;\n\nasync function fetchWithRateLimitRetry(url: string, init: RequestInit): Promise<Response> {\n let totalWaited = 0;\n\n for (let attempt = 0; attempt <= MAX_RATE_LIMIT_RETRIES; attempt++) {\n const response = await fetch(url, init);\n\n if (response.status !== 429 || attempt >= MAX_RATE_LIMIT_RETRIES) {\n return response;\n }\n\n const retryAfterHeader = response.headers.get(\"Retry-After\");\n const waitMs = retryAfterHeader ? Number(retryAfterHeader) * 1000 : 2000 * 2 ** attempt;\n\n if (totalWaited + waitMs > MAX_TOTAL_WAIT_MS) {\n return response;\n }\n\n totalWaited += waitMs;\n await new Promise((resolve) => setTimeout(resolve, waitMs));\n }\n\n return fetch(url, init);\n}\n\ntype ErrorCode =\n | \"UNAUTHORIZED\"\n | \"FORBIDDEN\"\n | \"NOT_FOUND\"\n | \"CONFLICT\"\n | \"VALIDATION_ERROR\"\n | \"RATE_LIMITED\"\n | \"INTERNAL_ERROR\"\n | \"NETWORK_ERROR\"\n | \"TIMEOUT\"\n | \"IMAGE_PROCESSING_ERROR\";\n\nexport class ApiError extends Error {\n code: ErrorCode;\n\n constructor(code: ErrorCode, message: string) {\n super(message);\n this.name = \"ApiError\";\n this.code = code;\n }\n}\n\nconst CONVEX_ID_RE = /^[a-zA-Z0-9_]+$/;\n\nfunction hasControlCharacters(value: string): boolean {\n for (let i = 0; i < value.length; i++) {\n const code = value.charCodeAt(i);\n // Allow tab (9), newline (10), carriage return (13)\n if (code < 32 && code !== 9 && code !== 10 && code !== 13) {\n return true;\n }\n }\n return false;\n}\n\nfunction validateStringValue(value: string): void {\n if (hasControlCharacters(value)) {\n throw new ApiError(\"VALIDATION_ERROR\", \"String value contains invalid control characters\");\n }\n}\n\nexport function validateConvexId(id: string): void {\n if (!CONVEX_ID_RE.test(id)) {\n throw new ApiError(\"VALIDATION_ERROR\", `Invalid ID format: \"${id}\". Expected alphanumeric string.`);\n }\n}\n\nfunction sanitizeParams(params: Record<string, string>): Record<string, string> {\n const sanitized: Record<string, string> = {};\n for (const [key, value] of Object.entries(params)) {\n validateStringValue(value);\n sanitized[key] = value;\n }\n return sanitized;\n}\n\n/**\n * Sent on every call so the backend can attribute immediately-applied writes\n * (library images and videos, followed advertisers) to the Session they were\n * made from. Absent outside a chat-attached environment.\n */\nfunction chatHeader(): Record<string, string> {\n const chatId = getEnv().BAKER_CHAT_ID;\n return chatId ? { \"x-baker-chat-id\": chatId } : {};\n}\n\nfunction mapHttpError(status: number): ErrorCode {\n if (status === 401) {\n return \"UNAUTHORIZED\";\n }\n // 403 is never \"not connected\" — every backend `FORBIDDEN` means connected but\n // not allowed (an asset outside the granted scope, a capability the account\n // lacks). Folding it into UNAUTHORIZED sent agents down the reconnect path,\n // which cannot fix a permission gap and wastes the user's time.\n if (status === 403) {\n return \"FORBIDDEN\";\n }\n if (status === 404) {\n return \"NOT_FOUND\";\n }\n if (status === 422 || status === 400) {\n return \"VALIDATION_ERROR\";\n }\n // 409 is a state the caller has to change, never a fault to sit out. It is\n // what the backend returns for \"this workspace has not switched analytics on\n // yet\" and its siblings — folded into INTERNAL_ERROR, that reaches an agent\n // as a transient failure worth retrying, which it never is.\n if (status === 409) {\n return \"CONFLICT\";\n }\n if (status === 429) {\n return \"RATE_LIMITED\";\n }\n return \"INTERNAL_ERROR\";\n}\n\nasync function handleResponse<T>(response: Response): Promise<T> {\n const body = await response.text();\n\n if (!response.ok) {\n let message = `HTTP ${response.status}: ${response.statusText}`;\n try {\n const parsed = JSON.parse(body) as { error?: string | { message?: string }; message?: string };\n if (typeof parsed.error === \"string\") {\n message = parsed.error;\n } else if (parsed.error?.message) {\n message = parsed.error.message;\n } else if (parsed.message) {\n message = parsed.message;\n }\n } catch {\n // Use default message\n }\n throw new ApiError(mapHttpError(response.status), message);\n }\n\n try {\n return JSON.parse(body) as T;\n } catch {\n throw new ApiError(\"INTERNAL_ERROR\", \"Failed to parse API response as JSON\");\n }\n}\n\n/**\n * A GET that also hands back the response headers.\n *\n * Some endpoints have to say something *about* the answer that the answer has\n * no room for — `GET /api/testimonials` returns a bare array and sets\n * `X-Baker-Next-Cursor` when rows past this page remain unexamined, so the rows\n * alone cannot tell one page of a library from the whole of it.\n */\nexport async function apiGetWithHeaders<T>(\n path: string,\n params?: Record<string, string>,\n): Promise<{ data: T; headers: Headers }> {\n const env = getEnv();\n const url = new URL(path, env.BAKER_API_URL);\n if (params) {\n const clean = sanitizeParams(params);\n for (const [key, value] of Object.entries(clean)) {\n url.searchParams.set(key, value);\n }\n }\n\n const urlStr = url.toString();\n const startedAt = Date.now();\n let response: Response;\n try {\n response = await fetchWithRateLimitRetry(urlStr, {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${env.BAKER_API_KEY}`,\n Accept: \"application/json\",\n ...chatHeader(),\n },\n signal: AbortSignal.timeout(60_000),\n });\n } catch (err) {\n debugLogHttp({ source: \"cli\", method: \"GET\", url: urlStr, durationMs: Date.now() - startedAt, error: err });\n if (err instanceof Error && (err.name === \"TimeoutError\" || err.name === \"AbortError\")) {\n throw new ApiError(\"TIMEOUT\", \"Request timed out after 60 seconds\");\n }\n throw new ApiError(\"NETWORK_ERROR\", `Request failed: ${err instanceof Error ? err.message : \"Unknown error\"}`);\n }\n\n debugLogHttp({\n source: \"cli\",\n method: \"GET\",\n url: urlStr,\n status: response.status,\n ok: response.ok,\n responseBody: await readBodyForLog(response),\n durationMs: Date.now() - startedAt,\n });\n return { data: await handleResponse<T>(response), headers: response.headers };\n}\n\nexport async function apiGet<T>(path: string, params?: Record<string, string>): Promise<T> {\n return (await apiGetWithHeaders<T>(path, params)).data;\n}\n\nexport async function apiPost<T>(path: string, body: unknown, opts?: { timeoutMs?: number }): Promise<T> {\n const env = getEnv();\n const timeoutMs = opts?.timeoutMs ?? 60_000;\n const urlStr = new URL(path, env.BAKER_API_URL).toString();\n const startedAt = Date.now();\n let response: Response;\n try {\n response = await fetchWithRateLimitRetry(urlStr, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${env.BAKER_API_KEY}`,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...chatHeader(),\n },\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(timeoutMs),\n });\n } catch (err) {\n debugLogHttp({\n source: \"cli\",\n method: \"POST\",\n url: urlStr,\n requestBody: body,\n durationMs: Date.now() - startedAt,\n error: err,\n });\n if (err instanceof Error && (err.name === \"TimeoutError\" || err.name === \"AbortError\")) {\n throw new ApiError(\"TIMEOUT\", `Request timed out after ${Math.round(timeoutMs / 1000)} seconds`);\n }\n throw new ApiError(\"NETWORK_ERROR\", `Request failed: ${err instanceof Error ? err.message : \"Unknown error\"}`);\n }\n\n debugLogHttp({\n source: \"cli\",\n method: \"POST\",\n url: urlStr,\n requestBody: body,\n status: response.status,\n ok: response.ok,\n responseBody: await readBodyForLog(response),\n durationMs: Date.now() - startedAt,\n });\n return handleResponse<T>(response);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAM,yBAAyB;AAC/B,IAAM,oBAAoB,IAAI,KAAK;AAEnC,eAAe,wBAAwB,KAAa,MAAsC;AACxF,MAAI,cAAc;AAElB,WAAS,UAAU,GAAG,WAAW,wBAAwB,WAAW;AAClE,UAAM,WAAW,MAAM,MAAM,KAAK,IAAI;AAEtC,QAAI,SAAS,WAAW,OAAO,WAAW,wBAAwB;AAChE,aAAO;AAAA,IACT;AAEA,UAAM,mBAAmB,SAAS,QAAQ,IAAI,aAAa;AAC3D,UAAM,SAAS,mBAAmB,OAAO,gBAAgB,IAAI,MAAO,MAAO,KAAK;AAEhF,QAAI,cAAc,SAAS,mBAAmB;AAC5C,aAAO;AAAA,IACT;AAEA,mBAAe;AACf,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,MAAM,CAAC;AAAA,EAC5D;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAcO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC;AAA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AY,KAAK,IAAI,IAAI;AAAA,MACzB,OAAO;AAAA,IACT,CAAC;AACD,QAAI,eAAe,UAAU,IAAI,SAAS,kBAAkB,IAAI,SAAS,eAAe;AACtF,YAAM,IAAI,SAAS,WAAW,2BAA2B,KAAK,MAAM,YAAY,GAAI,CAAC,UAAU;AAAA,IACjG;AACA,UAAM,IAAI,SAAS,iBAAiB,mBAAmB,eAAe,QAAQ,IAAI,UAAU,eAAe,EAAE;AAAA,EAC/G;AAEA,eAAa;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,aAAa;AAAA,IACb,QAAQ,SAAS;AAAA,IACjB,IAAI,SAAS;AAAA,IACb,cAAc,MAAM,eAAe,QAAQ;AAAA,IAC3C,YAAY,KAAK,IAAI,IAAI;AAAA,EAC3B,CAAC;AACD,SAAO,eAAkB,QAAQ;AACnC;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
validateCanvasDeep,
|
|
68
68
|
withoutCastName,
|
|
69
69
|
ytDlpBlockSignal
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-HPRKO6P2.js";
|
|
71
71
|
import {
|
|
72
72
|
csvOrJson,
|
|
73
73
|
daysAgoIso,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
resolveAccountIdArg,
|
|
77
77
|
resolveEffectiveStatus,
|
|
78
78
|
todayIso
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-OY3N2KHF.js";
|
|
80
80
|
import {
|
|
81
81
|
buildQueryCacheKey,
|
|
82
82
|
cacheGet,
|
|
@@ -92,18 +92,18 @@ import {
|
|
|
92
92
|
writeAdsJson,
|
|
93
93
|
writeAdsOutput,
|
|
94
94
|
writeJsonEnvelope
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-BIQH2QBE.js";
|
|
96
96
|
import {
|
|
97
97
|
ApiError,
|
|
98
98
|
apiGet,
|
|
99
99
|
apiGetWithHeaders,
|
|
100
100
|
apiPost,
|
|
101
101
|
validateConvexId
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-VEF7YWWM.js";
|
|
103
103
|
import {
|
|
104
104
|
installStreamTaps,
|
|
105
105
|
logInvocation
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-6BD32M7K.js";
|
|
107
107
|
import {
|
|
108
108
|
captureBudgetMs,
|
|
109
109
|
captureProxyCredentials,
|
|
@@ -117,7 +117,7 @@ import {
|
|
|
117
117
|
requireChatId,
|
|
118
118
|
resolveChatId,
|
|
119
119
|
shouldEscalate
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-GJVXXYCX.js";
|
|
121
121
|
|
|
122
122
|
// src/cli.ts
|
|
123
123
|
import { defineCommand as defineCommand244, runMain } from "citty";
|
|
@@ -13233,13 +13233,6 @@ var CAPTURED_WITHOUT_ROLE = [
|
|
|
13233
13233
|
"targetid"
|
|
13234
13234
|
].sort();
|
|
13235
13235
|
|
|
13236
|
-
// ../api/src/analytics/busy.ts
|
|
13237
|
-
var ANALYTICS_BUSY_MESSAGE = "Analytics is busy right now. The numbers will be there in a moment \u2014 try again shortly.";
|
|
13238
|
-
function isAnalyticsBusy(message) {
|
|
13239
|
-
return typeof message === "string" && message.includes(ANALYTICS_BUSY_MESSAGE);
|
|
13240
|
-
}
|
|
13241
|
-
var ANALYTICS_BUSY_FIX = "Nothing went wrong and nothing was lost \u2014 the analytics store was briefly at capacity. Wait a few seconds and ask for the same report again. If you were in the middle of a larger job, carry on with the rest of it and come back to this read; do not abandon the job.";
|
|
13242
|
-
|
|
13243
13236
|
// ../api/src/analytics/conversionNames.ts
|
|
13244
13237
|
function normalizeConversionName(name) {
|
|
13245
13238
|
return name.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(" ").filter((word) => word !== "").map((word) => word.length > 3 && word.endsWith("s") ? word.slice(0, -1) : word).join(" ");
|
|
@@ -24823,10 +24816,10 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
24823
24816
|
}
|
|
24824
24817
|
},
|
|
24825
24818
|
run: async ({ args: args4 }) => {
|
|
24826
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
24827
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
24828
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
24829
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
24819
|
+
const { apiPost: apiPost2 } = await import("./client-DGQVUFLK.js");
|
|
24820
|
+
const { requireChatId: requireChatId2 } = await import("./env-VIA5U56G.js");
|
|
24821
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-6ER7S4BM.js");
|
|
24822
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-6Z32L7SG.js");
|
|
24830
24823
|
try {
|
|
24831
24824
|
const accountId = bareAccountId2(args4);
|
|
24832
24825
|
const urlTags = typeof args4["url-tags"] === "string" ? args4["url-tags"] : void 0;
|
|
@@ -24971,10 +24964,10 @@ function duplicateCommand2(entity, label) {
|
|
|
24971
24964
|
replace: { type: "boolean", description: "Pause the original once the copy publishes" }
|
|
24972
24965
|
},
|
|
24973
24966
|
run: async ({ args: args4 }) => {
|
|
24974
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
24975
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
24976
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
24977
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
24967
|
+
const { apiPost: apiPost2 } = await import("./client-DGQVUFLK.js");
|
|
24968
|
+
const { requireChatId: requireChatId2 } = await import("./env-VIA5U56G.js");
|
|
24969
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-6ER7S4BM.js");
|
|
24970
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-6Z32L7SG.js");
|
|
24978
24971
|
try {
|
|
24979
24972
|
const accountId = bareAccountId2(args4);
|
|
24980
24973
|
const chatId = requireChatId2();
|
|
@@ -30388,14 +30381,6 @@ function mergeStoredWithCounts(stored, reported) {
|
|
|
30388
30381
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
30389
30382
|
}
|
|
30390
30383
|
|
|
30391
|
-
// src/commands/analytics/errorEnvelope.ts
|
|
30392
|
-
function analyticsErrorEnvelope(err) {
|
|
30393
|
-
if (err instanceof ApiError) {
|
|
30394
|
-
return isAnalyticsBusy(err.message) ? { code: err.code, message: err.message, fix: ANALYTICS_BUSY_FIX } : { code: err.code, message: err.message };
|
|
30395
|
-
}
|
|
30396
|
-
return { code: "NETWORK_ERROR", message: err instanceof Error ? err.message : "Unexpected error" };
|
|
30397
|
-
}
|
|
30398
|
-
|
|
30399
30384
|
// src/commands/analytics/feedRows.ts
|
|
30400
30385
|
function isStreamRow(value) {
|
|
30401
30386
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -32084,7 +32069,14 @@ var SHARED_ARGS = {
|
|
|
32084
32069
|
}
|
|
32085
32070
|
};
|
|
32086
32071
|
function handleError3(err) {
|
|
32087
|
-
|
|
32072
|
+
if (err instanceof ApiError) {
|
|
32073
|
+
writeJsonEnvelope({ ok: false, error: { code: err.code, message: err.message } });
|
|
32074
|
+
process.exit(1);
|
|
32075
|
+
}
|
|
32076
|
+
writeJsonEnvelope({
|
|
32077
|
+
ok: false,
|
|
32078
|
+
error: { code: "NETWORK_ERROR", message: err instanceof Error ? err.message : "Unexpected error" }
|
|
32079
|
+
});
|
|
32088
32080
|
process.exit(1);
|
|
32089
32081
|
}
|
|
32090
32082
|
function pageOf(args4) {
|
|
@@ -32818,6 +32810,9 @@ Examples:
|
|
|
32818
32810
|
}
|
|
32819
32811
|
});
|
|
32820
32812
|
})();
|
|
32813
|
+
function sendingEventsAddress(env) {
|
|
32814
|
+
return eventIngestUrl(env.BAKER_PUBLIC_API_URL, env.BAKER_API_URL);
|
|
32815
|
+
}
|
|
32821
32816
|
var sendingEventsCommand = (() => {
|
|
32822
32817
|
registerSchema({
|
|
32823
32818
|
command: "analytics.sending-events",
|
|
@@ -32839,8 +32834,7 @@ Examples:
|
|
|
32839
32834
|
},
|
|
32840
32835
|
args: {},
|
|
32841
32836
|
run: () => {
|
|
32842
|
-
|
|
32843
|
-
process.stdout.write(`${ingestBrief(eventIngestUrl(apiUrl, apiUrl))}
|
|
32837
|
+
process.stdout.write(`${ingestBrief(sendingEventsAddress(getEnv()))}
|
|
32844
32838
|
`);
|
|
32845
32839
|
}
|
|
32846
32840
|
});
|