deployai 0.1.0-beta.14 → 0.1.0-beta.15

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18997,8 +18997,8 @@ function currencyCode2(_params) {
18997
18997
  return _stringFormat(ZodCustomStringFormat, "currency_code", currencyCode, _params);
18998
18998
  }
18999
18999
  function hash(alg, params) {
19000
- const enc = params?.enc ?? "hex";
19001
- const format = `${alg}_${enc}`;
19000
+ const enc2 = params?.enc ?? "hex";
19001
+ const format = `${alg}_${enc2}`;
19002
19002
  const regex = regexes_exports[format];
19003
19003
  if (!regex)
19004
19004
  throw new Error(`Unrecognized hash format: ${format}`);
@@ -21811,6 +21811,7 @@ var ENV_KEYS = {
21811
21811
  TURNSTILE_SITE_KEY: { scope: "server", section: "tools", about: "Cloudflare Turnstile site key for the tool forms. Locally the Cloudflare test keys are built in." },
21812
21812
  TURNSTILE_SECRET: { scope: "server", section: "tools", about: "The Turnstile secret key of the same widget." },
21813
21813
  TOOLS_FETCH_SECRET: { scope: "same", section: "tools", about: "Shared secret between the app and the tools Worker, 32 random characters or more. pnpm tools:deploy uploads it." },
21814
+ APPS_SIGNING_SECRET: { scope: "own", section: "tools", about: 'Signs the 60 second tokens from the app to the Uptime app Worker, and the alert calls back from it (D-556); pnpm app-uptime:deploy uploads it. Unset: Apps answer "not set up". openssl rand -hex 32' },
21814
21815
  UPTIME_ALERT_TO: { scope: "own", section: "tools", about: "Who gets the down and back up emails of the uptime Worker, comma separated. Without it no email is sent." },
21815
21816
  UPTIME_ALERT_TOKEN: { scope: "own", section: "tools", about: "A Cloudflare token with Email Sending edit only, stored as the uptime Worker's secret. Default CF_API_TOKEN." },
21816
21817
  A11Y_RENDER: { scope: "same", section: "tools", about: "0 turns off Cloudflare Browser Rendering for the online accessibility check (D-191)." },
@@ -21837,10 +21838,12 @@ var CLOUDFLARE_SPACES = {
21837
21838
  "demosScript": "deployai-demos",
21838
21839
  "toolsScript": "deployai-tools",
21839
21840
  "uptimeScript": "deployai-uptime-dev",
21841
+ "appUptimeScript": "deployai-app-uptime-dev",
21840
21842
  "s3Endpoint": "https://e9c7bdb938b1c7c41496164fdea06f35.r2.cloudflarestorage.com",
21841
21843
  "bucket": "deployai-files-dev",
21842
21844
  "backupBucket": null,
21843
- "toolsWorkerUrl": "https://deployai-tools.deployai-co-il-e9c.workers.dev"
21845
+ "toolsWorkerUrl": "https://deployai-tools.deployai-co-il-e9c.workers.dev",
21846
+ "appUptimeUrl": "https://deployai-app-uptime-dev.deployai-co-il-e9c.workers.dev"
21844
21847
  },
21845
21848
  "prod": {
21846
21849
  "accountId": "e9c7bdb938b1c7c41496164fdea06f35",
@@ -21855,10 +21858,12 @@ var CLOUDFLARE_SPACES = {
21855
21858
  "demosScript": "deployai-demos",
21856
21859
  "toolsScript": "deployai-tools",
21857
21860
  "uptimeScript": "deployai-uptime",
21861
+ "appUptimeScript": "deployai-app-uptime",
21858
21862
  "s3Endpoint": "https://e9c7bdb938b1c7c41496164fdea06f35.r2.cloudflarestorage.com",
21859
21863
  "bucket": "deployai-files",
21860
21864
  "backupBucket": "deployai-db-backups",
21861
- "toolsWorkerUrl": "https://deployai-tools.deployai-co-il-e9c.workers.dev"
21865
+ "toolsWorkerUrl": "https://deployai-tools.deployai-co-il-e9c.workers.dev",
21866
+ "appUptimeUrl": "https://deployai-app-uptime.deployai-co-il-e9c.workers.dev"
21862
21867
  }
21863
21868
  };
21864
21869
  var BRAND = "https://deployai.co.il";
@@ -21897,7 +21902,7 @@ var SPACE_ADDRESSES = {
21897
21902
  var build = (name, cf, a) => ({ name, ...cf, ...a, brandDomain: new URL(a.brandUrl).hostname, s3Region: "auto" });
21898
21903
  var SPACES = {
21899
21904
  ...Object.fromEntries(Object.keys(CLOUDFLARE_SPACES).filter((n2) => SPACE_ADDRESSES[n2]).map((n2) => [n2, build(n2, CLOUDFLARE_SPACES[n2], SPACE_ADDRESSES[n2])])),
21900
- test: build("test", { ...CLOUDFLARE_SPACES.prod, kvNamespaceId: "", sitesZoneId: null, backupBucket: null, toolsWorkerUrl: "" }, { ...SPACE_ADDRESSES.prod, appUrl: "http://localhost:3000", siteUrl: "http://localhost:3000", trustedOrigins: [], storage: "local" })
21905
+ test: build("test", { ...CLOUDFLARE_SPACES.prod, kvNamespaceId: "", sitesZoneId: null, backupBucket: null, toolsWorkerUrl: "", appUptimeUrl: "" }, { ...SPACE_ADDRESSES.prod, appUrl: "http://localhost:3000", siteUrl: "http://localhost:3000", trustedOrigins: [], storage: "local" })
21901
21906
  };
21902
21907
 
21903
21908
  // ../shared/src/agent-rules.ts
@@ -22078,6 +22083,10 @@ var STAGE_NOTE_MAX = 300;
22078
22083
  var isAgentStage = (s) => AGENT_STAGES.includes(s);
22079
22084
  var stageNote = (s) => (s ?? "").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim().slice(0, STAGE_NOTE_MAX);
22080
22085
 
22086
+ // ../shared/src/uptime.ts
22087
+ var UPTIME_MAX_BYTES = 256 * 1024;
22088
+ var enc = new TextEncoder();
22089
+
22081
22090
  // src/config.ts
22082
22091
  import { randomUUID } from "crypto";
22083
22092
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -22659,7 +22668,7 @@ function messages(root) {
22659
22668
  }
22660
22669
 
22661
22670
  // src/version.ts
22662
- var CLI_VERSION = "0.1.0-beta.14";
22671
+ var CLI_VERSION = "0.1.0-beta.15";
22663
22672
 
22664
22673
  // src/api.ts
22665
22674
  function apiContext(apiFlag) {
@@ -22675,6 +22684,10 @@ function requireToken(ctx) {
22675
22684
  if (saved && saved !== ctx.apiUrl.replace(/\/+$/, "")) throw new CliError(messages(process.cwd())("tokenOtherApi", { saved, url: ctx.apiUrl }), 1, "auth");
22676
22685
  return ctx.config.token;
22677
22686
  }
22687
+ function tokenIfOwnApi(ctx) {
22688
+ const saved = ctx.config.tokenApiUrl?.replace(/\/+$/, "");
22689
+ return ctx.config.token && saved && saved === ctx.apiUrl.replace(/\/+$/, "") ? ctx.config.token : null;
22690
+ }
22678
22691
  async function apiRequest(ctx, path, schema, opts = {}) {
22679
22692
  const headers = { "User-Agent": userAgent(ctx.config), Accept: "application/json" };
22680
22693
  if (opts.auth !== false) headers.Authorization = `Bearer ${requireToken(ctx)}`;
@@ -22826,7 +22839,7 @@ var TELEMETRY_SENT = [
22826
22839
  "Linked project id, detected framework and version",
22827
22840
  "After each check: compatible or not, blocker and warning codes (for example fs_write)",
22828
22841
  "OS, architecture and Node version (in the request header)",
22829
- "Your user id, only after login (from the login token)",
22842
+ "Your user id, only after login (from the login token), and only to the API that issued the login (D-557)",
22830
22843
  "After a failed version, the one sentence you pass with deploy --fixed (what you changed, no code)"
22831
22844
  ];
22832
22845
  var TELEMETRY_NEVER_SENT = [
@@ -22850,7 +22863,8 @@ async function sendCheckReport(ctx, report) {
22850
22863
  if (!telemetryEnabled(ctx.config)) return;
22851
22864
  try {
22852
22865
  const headers = { "Content-Type": "application/json", "User-Agent": userAgent(ctx.config) };
22853
- if (ctx.config.token) headers.Authorization = `Bearer ${ctx.config.token}`;
22866
+ const token = tokenIfOwnApi(ctx);
22867
+ if (token) headers.Authorization = `Bearer ${token}`;
22854
22868
  const res = await fetch(`${ctx.apiUrl}/api/cli/check-results`, {
22855
22869
  method: "POST",
22856
22870
  headers,
@@ -22879,7 +22893,8 @@ async function sendTelemetryEvent(ctx, event) {
22879
22893
  if (!telemetryEnabled(ctx.config)) return;
22880
22894
  try {
22881
22895
  const headers = { "Content-Type": "application/json", "User-Agent": userAgent(ctx.config) };
22882
- if (ctx.config.token) headers.Authorization = `Bearer ${ctx.config.token}`;
22896
+ const token = tokenIfOwnApi(ctx);
22897
+ if (token) headers.Authorization = `Bearer ${token}`;
22883
22898
  const res = await fetch(`${ctx.apiUrl}/api/cli/telemetry`, {
22884
22899
  method: "POST",
22885
22900
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deployai",
3
- "version": "0.1.0-beta.14",
3
+ "version": "0.1.0-beta.15",
4
4
  "description": "Check a site built with an AI editor, see what has to change, and publish it to DeployAI. Hebrew first.",
5
5
  "keywords": [
6
6
  "deployai",