@lumerahq/cli 0.19.23 → 0.19.24-dev.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.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createApiClient,
6
6
  isApiErrorStatus
7
- } from "./chunk-JMRD5WIY.js";
7
+ } from "./chunk-HTPNRY3F.js";
8
8
  import {
9
9
  findProjectRoot,
10
10
  getAppName
@@ -2,7 +2,7 @@ import {
2
2
  userContextHeaders,
3
3
  validateProjectExternalId,
4
4
  validateProjectNameLength
5
- } from "./chunk-JMRD5WIY.js";
5
+ } from "./chunk-HTPNRY3F.js";
6
6
  import {
7
7
  fetchWithRetry
8
8
  } from "./chunk-FJFIWC7G.js";
@@ -69,29 +69,12 @@ async function ensureAppRecord(apiBase, token, appName, appTitle) {
69
69
  if (appIdError) throw new Error(appIdError);
70
70
  const appNameError = validateProjectNameLength(appTitle, "App name");
71
71
  if (appNameError) throw new Error(appNameError);
72
- const filterParam = encodeURIComponent(JSON.stringify({ external_id: appName }));
73
- const searchRes = await fetchWithRetry(
74
- `${apiBase}/pb/collections/lm_custom_apps/records?filter=${filterParam}`,
75
- {
76
- headers: {
77
- Authorization: `Bearer ${token}`,
78
- "X-Lumera-Client": "lumera-cli",
79
- ...userContextHeaders()
80
- }
81
- }
82
- );
83
- if (!searchRes.ok) {
84
- throw new Error(`Failed to check app record: ${await searchRes.text()}`);
85
- }
86
- const existing = (await searchRes.json()).items?.[0];
87
72
  const appData = {
88
- external_id: appName,
89
73
  name: appTitle,
90
74
  hosting_type: "s3"
91
75
  };
92
- const endpoint = existing ? `${apiBase}/pb/collections/lm_custom_apps/records/${existing.id}` : `${apiBase}/pb/collections/lm_custom_apps/records`;
93
- const res = await fetchWithRetry(endpoint, {
94
- method: existing ? "PATCH" : "POST",
76
+ const res = await fetchWithRetry(`${apiBase}/custom-apps/${encodeURIComponent(appName)}/registration`, {
77
+ method: "PUT",
95
78
  headers: {
96
79
  Authorization: `Bearer ${token}`,
97
80
  "Content-Type": "application/json",
@@ -145,6 +128,29 @@ async function deploy(options) {
145
128
  Deployed! ${launchUrl}`));
146
129
  return { launchUrl, version };
147
130
  }
131
+ async function registerDevApp(apiBase, token, appName, appTitle, appUrl) {
132
+ const appIdError = validateProjectExternalId(appName);
133
+ if (appIdError) throw new Error(appIdError);
134
+ const appNameError = validateProjectNameLength(appTitle, "App name");
135
+ if (appNameError) throw new Error(appNameError);
136
+ const appData = {
137
+ name: appTitle,
138
+ dev_iframe_url: appUrl
139
+ };
140
+ const res = await fetchWithRetry(`${apiBase}/custom-apps/${encodeURIComponent(appName)}/registration`, {
141
+ method: "PUT",
142
+ headers: {
143
+ Authorization: `Bearer ${token}`,
144
+ "Content-Type": "application/json",
145
+ "X-Lumera-Client": "lumera-cli",
146
+ ...userContextHeaders()
147
+ },
148
+ body: JSON.stringify(appData)
149
+ });
150
+ if (!res.ok) {
151
+ throw new Error(`Failed to register app: ${await res.text()}`);
152
+ }
153
+ }
148
154
  function isPortInUse(port, host = "127.0.0.1") {
149
155
  return new Promise((resolve2) => {
150
156
  const socket = createConnection({ port, host });
@@ -236,6 +242,8 @@ async function dev(options) {
236
242
  console.log(pc.yellow(` Dev server already running on port ${port}, skipping start.`));
237
243
  return;
238
244
  }
245
+ console.log(pc.dim(" Registering dev preview URL..."));
246
+ await registerDevApp(apiUrl, token, appName, appTitle, appUrl);
239
247
  console.log();
240
248
  console.log(pc.cyan(pc.bold(` ${appTitle} - Dev Server`)));
241
249
  console.log();
@@ -328,42 +328,30 @@ var ApiClient = class {
328
328
  body: JSON.stringify(body)
329
329
  });
330
330
  }
331
- // Projects — register/lookup via PocketBase records API
331
+ // Projects — register through typed project API; lookup can still use PB reads.
332
332
  async registerProject(name, externalId) {
333
333
  const extId = externalId || name;
334
334
  const nameError = validateProjectNameLength(name, "App name");
335
335
  if (nameError) throw new Error(nameError);
336
336
  const externalIdError = validateProjectExternalId(extId);
337
337
  if (externalIdError) throw new Error(externalIdError);
338
- const existing = await this.getProjectByExternalId(extId);
339
- if (existing) {
340
- return existing;
341
- }
342
- try {
343
- const rec = await this.request(
344
- "/api/pb/collections/lm_projects/records",
345
- {
346
- method: "POST",
347
- body: JSON.stringify({ name, external_id: extId })
348
- }
349
- );
350
- return {
351
- id: rec.id,
352
- name: rec.name,
353
- external_id: rec.external_id,
354
- template: rec.template,
355
- status: rec.status,
356
- owner_id: rec.owner_id,
357
- created: rec.created,
358
- updated: rec.updated
359
- };
360
- } catch (error) {
361
- const created = await this.getProjectByExternalId(extId);
362
- if (created) {
363
- return created;
338
+ const res = await this.request(
339
+ "/api/projects/register",
340
+ {
341
+ method: "POST",
342
+ body: JSON.stringify({ name, external_id: extId })
364
343
  }
365
- throw error;
366
- }
344
+ );
345
+ return {
346
+ id: res.project.id,
347
+ name: res.project.name,
348
+ external_id: res.project.external_id,
349
+ template: res.project.template,
350
+ status: res.project.status,
351
+ owner_id: res.project.owner_id,
352
+ created: res.project.created,
353
+ updated: res.project.updated
354
+ };
367
355
  }
368
356
  async getProjectByExternalId(externalId) {
369
357
  const filterParam = encodeURIComponent(JSON.stringify({ external_id: externalId }));
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  deps,
3
3
  syncDeps
4
- } from "./chunk-RH4FQF6O.js";
4
+ } from "./chunk-3ESHIPZH.js";
5
5
  import "./chunk-2CR762KB.js";
6
- import "./chunk-JMRD5WIY.js";
6
+ import "./chunk-HTPNRY3F.js";
7
7
  import "./chunk-ZH3NVYEQ.js";
8
8
  import "./chunk-FJFIWC7G.js";
9
9
  import "./chunk-PNKVD2UK.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  dev
3
- } from "./chunk-XT4EGGK7.js";
3
+ } from "./chunk-HEUXW7SQ.js";
4
4
  import {
5
5
  syncDeps
6
- } from "./chunk-RH4FQF6O.js";
6
+ } from "./chunk-3ESHIPZH.js";
7
7
  import {
8
8
  loadEnv
9
9
  } from "./chunk-2CR762KB.js";
10
10
  import {
11
11
  createApiClient
12
- } from "./chunk-JMRD5WIY.js";
12
+ } from "./chunk-HTPNRY3F.js";
13
13
  import {
14
14
  findProjectRoot,
15
15
  getApiUrl,
package/dist/index.js CHANGED
@@ -219,39 +219,39 @@ async function main() {
219
219
  switch (command) {
220
220
  // Resource commands
221
221
  case "plan":
222
- await import("./resources-Z5ZMPWTK.js").then((m) => m.plan(args.slice(1)));
222
+ await import("./resources-33YKJE7P.js").then((m) => m.plan(args.slice(1)));
223
223
  break;
224
224
  case "apply":
225
- await import("./resources-Z5ZMPWTK.js").then((m) => m.apply(args.slice(1)));
225
+ await import("./resources-33YKJE7P.js").then((m) => m.apply(args.slice(1)));
226
226
  break;
227
227
  case "pull":
228
- await import("./resources-Z5ZMPWTK.js").then((m) => m.pull(args.slice(1)));
228
+ await import("./resources-33YKJE7P.js").then((m) => m.pull(args.slice(1)));
229
229
  break;
230
230
  case "destroy":
231
- await import("./resources-Z5ZMPWTK.js").then((m) => m.destroy(args.slice(1)));
231
+ await import("./resources-33YKJE7P.js").then((m) => m.destroy(args.slice(1)));
232
232
  break;
233
233
  case "list":
234
- await import("./resources-Z5ZMPWTK.js").then((m) => m.list(args.slice(1)));
234
+ await import("./resources-33YKJE7P.js").then((m) => m.list(args.slice(1)));
235
235
  break;
236
236
  case "show":
237
- await import("./resources-Z5ZMPWTK.js").then((m) => m.show(args.slice(1)));
237
+ await import("./resources-33YKJE7P.js").then((m) => m.show(args.slice(1)));
238
238
  break;
239
239
  case "diff":
240
- await import("./resources-Z5ZMPWTK.js").then((m) => m.diff(args.slice(1)));
240
+ await import("./resources-33YKJE7P.js").then((m) => m.diff(args.slice(1)));
241
241
  break;
242
242
  // Development
243
243
  case "dev":
244
- await import("./dev-EQK27BUM.js").then((m) => m.dev(args.slice(1)));
244
+ await import("./dev-AZ6APGU3.js").then((m) => m.dev(args.slice(1)));
245
245
  break;
246
246
  case "run":
247
- await import("./run-LHHX7UBN.js").then((m) => m.run(args.slice(1)));
247
+ await import("./run-DJXAXDD2.js").then((m) => m.run(args.slice(1)));
248
248
  break;
249
249
  // Project
250
250
  case "init":
251
- await import("./init-FTDMPFR3.js").then((m) => m.init(args.slice(1)));
251
+ await import("./init-FXG2BFGT.js").then((m) => m.init(args.slice(1)));
252
252
  break;
253
253
  case "register":
254
- await import("./register-BQCVUPWS.js").then((m) => m.register(args.slice(1)));
254
+ await import("./register-ZCNHHGZH.js").then((m) => m.register(args.slice(1)));
255
255
  break;
256
256
  case "templates":
257
257
  await import("./templates-LNUOTNLN.js").then((m) => m.templates(subcommand, args.slice(2)));
@@ -268,7 +268,7 @@ async function main() {
268
268
  break;
269
269
  // Dependencies
270
270
  case "deps":
271
- await import("./deps-VTLXKCQ7.js").then((m) => m.deps(args.slice(1)));
271
+ await import("./deps-HWO6X5WM.js").then((m) => m.deps(args.slice(1)));
272
272
  break;
273
273
  // Auth
274
274
  case "login":
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  createApiClient,
10
10
  validateProjectNameLength
11
- } from "./chunk-JMRD5WIY.js";
11
+ } from "./chunk-HTPNRY3F.js";
12
12
  import {
13
13
  getToken,
14
14
  init_auth,
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  createApiClient,
9
9
  validateProjectExternalId
10
- } from "./chunk-JMRD5WIY.js";
10
+ } from "./chunk-HTPNRY3F.js";
11
11
  import {
12
12
  findProjectRoot,
13
13
  getAppName,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  deploy
3
- } from "./chunk-XT4EGGK7.js";
3
+ } from "./chunk-HEUXW7SQ.js";
4
4
  import {
5
5
  syncDeps
6
- } from "./chunk-RH4FQF6O.js";
6
+ } from "./chunk-3ESHIPZH.js";
7
7
  import {
8
8
  loadEnv
9
9
  } from "./chunk-2CR762KB.js";
@@ -11,7 +11,7 @@ import {
11
11
  ApiError,
12
12
  createApiClient,
13
13
  validateCollectionNameLength
14
- } from "./chunk-JMRD5WIY.js";
14
+ } from "./chunk-HTPNRY3F.js";
15
15
  import {
16
16
  findProjectRoot,
17
17
  getApiUrl,
@@ -2872,7 +2872,7 @@ async function destroyApp(skipConfirm) {
2872
2872
  }
2873
2873
  }
2874
2874
  const deleteRes = await fetchWithRetry(
2875
- `${apiUrl}/api/pb/collections/lm_custom_apps/records/${appRecord.id}`,
2875
+ `${apiUrl}/api/custom-apps/${encodeURIComponent(appRecord.external_id)}`,
2876
2876
  {
2877
2877
  method: "DELETE",
2878
2878
  headers: {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2CR762KB.js";
4
4
  import {
5
5
  createApiClient
6
- } from "./chunk-JMRD5WIY.js";
6
+ } from "./chunk-HTPNRY3F.js";
7
7
  import {
8
8
  findProjectRoot,
9
9
  getApiUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/cli",
3
- "version": "0.19.23",
3
+ "version": "0.19.24-dev.0",
4
4
  "description": "CLI for building and deploying Lumera apps",
5
5
  "type": "module",
6
6
  "engines": {