lecodes-cli 2.2.13 → 2.2.14

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.
@@ -3,7 +3,8 @@ import { join, relative } from "node:path"
3
3
  import { createChannelHub, fileResponse, isMultipart, receiveUploads, UploadError, type Upload } from "lecodes-sdk/server"
4
4
  import { compileServer, hasServerFiles, type CompileEntry } from "../compile/projectCompile"
5
5
  import { loadPeer } from "../hosts/peerInstall"
6
- import { LECODES_DIR } from "../project/manifest"
6
+ import { LECODES_DIR, readManifest } from "../project/manifest"
7
+ import { session } from "../commands/shared"
7
8
  import { readAppConfigAt } from "../commands/app/shared"
8
9
  import { filesDirOf, startLocalBackend, type LocalBackend } from "./localBackend"
9
10
  import { serve, type Served, type Socket, type SocketHandlers } from "./serve"
@@ -73,7 +74,12 @@ export const createProjectBackend = (options: ProjectBackendOptions): ProjectBac
73
74
  : Promise.resolve({ ok: false as const, status: 404, message: "The project has no server files" }),
74
75
  })
75
76
  const sockets = new Set<Socket>()
76
- const start = () => startLocalBackend({ root, dbDir, log, onPublish: (ch, group, data) => hub.publish("", ch, group, data) })
77
+ // `pushChannel.send` reaches the platform's sender through the developer's own login when the checkout is linked —
78
+ // the way `lecodes pn send` sends; a project standing alone, or no login, sends nothing (said once in the console)
79
+ const push = (() => {
80
+ try { const { apiUrl, token } = session(); return { apiUrl, token, uuid: readManifest(root).uuid } } catch { return null }
81
+ })()
82
+ const start = () => startLocalBackend({ root, dbDir, log, push, onPublish: (ch, group, data) => hub.publish("", ch, group, data) })
77
83
 
78
84
  const envelope = (body: unknown) => new Response(JSON.stringify(body), { status: 200, headers: { "content-type": "application/json", "cache-control": "no-store", ...CORS } })
79
85
 
@@ -353,6 +353,8 @@ export const deleteDesignCommentMessage = (
353
353
  export type PushSendPayload = {
354
354
  to?: string[]
355
355
  users?: string[]
356
+ /** The server's push channel the notification is of (`<path>#<export>`): the app's side hears each channel's own. */
357
+ channel?: string
356
358
  title: string
357
359
  body?: string
358
360
  url?: string