kollab 0.1.27 → 0.1.28

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/index.js CHANGED
@@ -20066,7 +20066,7 @@ function registerUserCommands(program2) {
20066
20066
  }
20067
20067
 
20068
20068
  // src/commands/app.ts
20069
- var import_node_fs5 = require("fs");
20069
+ var import_node_fs6 = require("fs");
20070
20070
  var import_node_path4 = require("path");
20071
20071
 
20072
20072
  // src/auth/hosted-app-credentials.ts
@@ -20090,6 +20090,81 @@ async function requireHostedAppCredentials() {
20090
20090
  };
20091
20091
  }
20092
20092
 
20093
+ // src/commands/app-services.ts
20094
+ var import_node_fs5 = require("fs");
20095
+ function registerHostedSiteCommands(app) {
20096
+ const services = app.command("services").description("Configure shared forms and news for a static site (no function or compute slot)");
20097
+ for (const action of ["info", "enable", "disable", "delete-data"]) {
20098
+ services.command(action).requiredOption("--id <appId>", "Hosted App ID").action(async (options) => {
20099
+ try {
20100
+ const credentials = await requireHostedAppCredentials();
20101
+ const base = `/hosted-apps/${encodeURIComponent(options.id)}/services`;
20102
+ printResult(await api(
20103
+ credentials,
20104
+ action === "info" ? "GET" : action === "delete-data" ? "DELETE" : "PUT",
20105
+ action === "delete-data" ? `${base}/data` : base,
20106
+ ["enable", "disable"].includes(action) ? { enabled: action === "enable" } : void 0
20107
+ ));
20108
+ } catch (error) {
20109
+ emitError(error instanceof Error ? error.message : String(error));
20110
+ }
20111
+ });
20112
+ }
20113
+ services.command("restore").requiredOption("--id <appId>", "Empty destination App ID").requiredOption("--file <path>", "Exported site-services.json").action(async (options) => {
20114
+ try {
20115
+ const credentials = await requireHostedAppCredentials();
20116
+ printResult(await api(credentials, "POST", `/hosted-apps/${encodeURIComponent(options.id)}/services/restore`, JSON.parse((0, import_node_fs5.readFileSync)(options.file, "utf8"))));
20117
+ } catch (error) {
20118
+ emitError(error instanceof Error ? error.message : String(error));
20119
+ }
20120
+ });
20121
+ const form = app.command("form").description("Verify the website contact inbox before accepting messages");
20122
+ form.command("setup").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--to <email>", "Inbox you control").action(async (options) => {
20123
+ try {
20124
+ printResult(await api(await requireHostedAppCredentials(), "PUT", `/hosted-apps/${encodeURIComponent(options.id)}/services/forms/contact`, { email: options.to }));
20125
+ } catch (error) {
20126
+ emitError(error instanceof Error ? error.message : String(error));
20127
+ }
20128
+ });
20129
+ form.command("verify").requiredOption("--id <appId>", "Hosted App ID").description("Read the six digit code from stdin").action(async (options) => {
20130
+ try {
20131
+ if (process.stdin.isTTY) throw new Error("Pass the verification code through stdin");
20132
+ const code = (0, import_node_fs5.readFileSync)(0, "utf8").trim();
20133
+ printResult(await api(await requireHostedAppCredentials(), "POST", `/hosted-apps/${encodeURIComponent(options.id)}/services/forms/contact/verify`, { code }));
20134
+ } catch (error) {
20135
+ emitError(error instanceof Error ? error.message : String(error));
20136
+ }
20137
+ });
20138
+ for (const action of ["info", "disable"]) {
20139
+ form.command(action).requiredOption("--id <appId>", "Hosted App ID").action(async (options) => {
20140
+ try {
20141
+ printResult(await api(
20142
+ await requireHostedAppCredentials(),
20143
+ action === "info" ? "GET" : "DELETE",
20144
+ `/hosted-apps/${encodeURIComponent(options.id)}/services${action === "disable" ? "/forms/contact" : ""}`
20145
+ ));
20146
+ } catch (error) {
20147
+ emitError(error instanceof Error ? error.message : String(error));
20148
+ }
20149
+ });
20150
+ }
20151
+ const news = app.command("news").description("Manage the news collection; public reads show published records only");
20152
+ news.command("save").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--file <path>", "JSON: optional id, title, body, status (draft/published)").action(async (options) => {
20153
+ try {
20154
+ printResult(await api(await requireHostedAppCredentials(), "PUT", `/hosted-apps/${encodeURIComponent(options.id)}/services/collections/news/documents`, JSON.parse((0, import_node_fs5.readFileSync)(options.file, "utf8"))));
20155
+ } catch (error) {
20156
+ emitError(error instanceof Error ? error.message : String(error));
20157
+ }
20158
+ });
20159
+ news.command("delete").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--document-id <documentId>", "News ID").action(async (options) => {
20160
+ try {
20161
+ printResult(await api(await requireHostedAppCredentials(), "DELETE", `/hosted-apps/${encodeURIComponent(options.id)}/services/collections/news/documents/${encodeURIComponent(options.documentId)}`));
20162
+ } catch (error) {
20163
+ emitError(error instanceof Error ? error.message : String(error));
20164
+ }
20165
+ });
20166
+ }
20167
+
20093
20168
  // src/commands/app-domain.ts
20094
20169
  var import_node_url = require("url");
20095
20170
  function data(result) {
@@ -20277,12 +20352,12 @@ async function createBlankTask(creds, spaceId, projectId) {
20277
20352
  return readResourceId(requireApiData(result, "Create Hosted App task"), "task");
20278
20353
  }
20279
20354
  async function resolveHostedAppSource(creds, spaceId, options) {
20280
- const fileSize = (0, import_node_fs5.statSync)(options.file).size;
20355
+ const fileSize = (0, import_node_fs6.statSync)(options.file).size;
20281
20356
  const kind = validateHostedAppFile(options.file, fileSize);
20282
20357
  const conversationId = options.conversationId?.trim();
20283
20358
  if (conversationId && options.projectId?.trim()) throw new Error("--project-id cannot be used with --conversation-id");
20284
20359
  const resolvedConversationId = conversationId || await createBlankTask(creds, spaceId, options.projectId?.trim());
20285
- const content = (0, import_node_fs5.readFileSync)(options.file);
20360
+ const content = (0, import_node_fs6.readFileSync)(options.file);
20286
20361
  const upload = await uploadTaskAttachmentBytes(creds, {
20287
20362
  conversationId: resolvedConversationId,
20288
20363
  fileName: (0, import_node_path4.basename)(options.file),
@@ -20431,6 +20506,7 @@ A .zip needs app.manifest.json, or a plain static site with index.html at its ro
20431
20506
  }
20432
20507
  });
20433
20508
  registerHostedAppDomainCommands(app);
20509
+ registerHostedSiteCommands(app);
20434
20510
  app.command("ai").description("Pause, resume, or adjust a Hosted App AI budget").requiredOption("--id <appId>", "Hosted App ID (UUID)").option("--action <action>", "pause, resume, or budget").option("--daily-credit-limit <credits>", "Daily AI credit limit", (value) => parseIntegerOption(value, "--daily-credit-limit")).option("--monthly-credit-limit <credits>", "Monthly AI credit limit", (value) => parseIntegerOption(value, "--monthly-credit-limit")).action(async (options) => {
20435
20511
  try {
20436
20512
  if (!options.action && options.dailyCreditLimit === void 0 && options.monthlyCreditLimit === void 0) {
@@ -20669,8 +20745,8 @@ var fs6 = __toESM(require("fs"));
20669
20745
  var path6 = __toESM(require("path"));
20670
20746
  var UNKNOWN_VERSION = "0.0.0";
20671
20747
  function injectedVersion() {
20672
- if ("0.1.27".length > 0) {
20673
- return "0.1.27";
20748
+ if ("0.1.28".length > 0) {
20749
+ return "0.1.28";
20674
20750
  }
20675
20751
  return null;
20676
20752
  }
@@ -33050,7 +33050,7 @@ function registerUserCommands(program3) {
33050
33050
 
33051
33051
  // src/commands/app.ts
33052
33052
  init_cjs_shims();
33053
- var import_node_fs5 = require("fs");
33053
+ var import_node_fs6 = require("fs");
33054
33054
  var import_node_path4 = require("path");
33055
33055
 
33056
33056
  // src/auth/hosted-app-credentials.ts
@@ -33075,6 +33075,82 @@ async function requireHostedAppCredentials() {
33075
33075
  };
33076
33076
  }
33077
33077
 
33078
+ // src/commands/app-services.ts
33079
+ init_cjs_shims();
33080
+ var import_node_fs5 = require("fs");
33081
+ function registerHostedSiteCommands(app) {
33082
+ const services = app.command("services").description("Configure shared forms and news for a static site (no function or compute slot)");
33083
+ for (const action of ["info", "enable", "disable", "delete-data"]) {
33084
+ services.command(action).requiredOption("--id <appId>", "Hosted App ID").action(async (options) => {
33085
+ try {
33086
+ const credentials = await requireHostedAppCredentials();
33087
+ const base = `/hosted-apps/${encodeURIComponent(options.id)}/services`;
33088
+ printResult(await api(
33089
+ credentials,
33090
+ action === "info" ? "GET" : action === "delete-data" ? "DELETE" : "PUT",
33091
+ action === "delete-data" ? `${base}/data` : base,
33092
+ ["enable", "disable"].includes(action) ? { enabled: action === "enable" } : void 0
33093
+ ));
33094
+ } catch (error62) {
33095
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33096
+ }
33097
+ });
33098
+ }
33099
+ services.command("restore").requiredOption("--id <appId>", "Empty destination App ID").requiredOption("--file <path>", "Exported site-services.json").action(async (options) => {
33100
+ try {
33101
+ const credentials = await requireHostedAppCredentials();
33102
+ printResult(await api(credentials, "POST", `/hosted-apps/${encodeURIComponent(options.id)}/services/restore`, JSON.parse((0, import_node_fs5.readFileSync)(options.file, "utf8"))));
33103
+ } catch (error62) {
33104
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33105
+ }
33106
+ });
33107
+ const form = app.command("form").description("Verify the website contact inbox before accepting messages");
33108
+ form.command("setup").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--to <email>", "Inbox you control").action(async (options) => {
33109
+ try {
33110
+ printResult(await api(await requireHostedAppCredentials(), "PUT", `/hosted-apps/${encodeURIComponent(options.id)}/services/forms/contact`, { email: options.to }));
33111
+ } catch (error62) {
33112
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33113
+ }
33114
+ });
33115
+ form.command("verify").requiredOption("--id <appId>", "Hosted App ID").description("Read the six digit code from stdin").action(async (options) => {
33116
+ try {
33117
+ if (process.stdin.isTTY) throw new Error("Pass the verification code through stdin");
33118
+ const code = (0, import_node_fs5.readFileSync)(0, "utf8").trim();
33119
+ printResult(await api(await requireHostedAppCredentials(), "POST", `/hosted-apps/${encodeURIComponent(options.id)}/services/forms/contact/verify`, { code }));
33120
+ } catch (error62) {
33121
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33122
+ }
33123
+ });
33124
+ for (const action of ["info", "disable"]) {
33125
+ form.command(action).requiredOption("--id <appId>", "Hosted App ID").action(async (options) => {
33126
+ try {
33127
+ printResult(await api(
33128
+ await requireHostedAppCredentials(),
33129
+ action === "info" ? "GET" : "DELETE",
33130
+ `/hosted-apps/${encodeURIComponent(options.id)}/services${action === "disable" ? "/forms/contact" : ""}`
33131
+ ));
33132
+ } catch (error62) {
33133
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33134
+ }
33135
+ });
33136
+ }
33137
+ const news = app.command("news").description("Manage the news collection; public reads show published records only");
33138
+ news.command("save").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--file <path>", "JSON: optional id, title, body, status (draft/published)").action(async (options) => {
33139
+ try {
33140
+ printResult(await api(await requireHostedAppCredentials(), "PUT", `/hosted-apps/${encodeURIComponent(options.id)}/services/collections/news/documents`, JSON.parse((0, import_node_fs5.readFileSync)(options.file, "utf8"))));
33141
+ } catch (error62) {
33142
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33143
+ }
33144
+ });
33145
+ news.command("delete").requiredOption("--id <appId>", "Hosted App ID").requiredOption("--document-id <documentId>", "News ID").action(async (options) => {
33146
+ try {
33147
+ printResult(await api(await requireHostedAppCredentials(), "DELETE", `/hosted-apps/${encodeURIComponent(options.id)}/services/collections/news/documents/${encodeURIComponent(options.documentId)}`));
33148
+ } catch (error62) {
33149
+ emitError(error62 instanceof Error ? error62.message : String(error62));
33150
+ }
33151
+ });
33152
+ }
33153
+
33078
33154
  // src/commands/app-domain.ts
33079
33155
  init_cjs_shims();
33080
33156
  var import_node_url = require("url");
@@ -33263,12 +33339,12 @@ async function createBlankTask(creds, spaceId, projectId) {
33263
33339
  return readResourceId(requireApiData(result, "Create Hosted App task"), "task");
33264
33340
  }
33265
33341
  async function resolveHostedAppSource(creds, spaceId, options) {
33266
- const fileSize = (0, import_node_fs5.statSync)(options.file).size;
33342
+ const fileSize = (0, import_node_fs6.statSync)(options.file).size;
33267
33343
  const kind = validateHostedAppFile(options.file, fileSize);
33268
33344
  const conversationId = options.conversationId?.trim();
33269
33345
  if (conversationId && options.projectId?.trim()) throw new Error("--project-id cannot be used with --conversation-id");
33270
33346
  const resolvedConversationId = conversationId || await createBlankTask(creds, spaceId, options.projectId?.trim());
33271
- const content = (0, import_node_fs5.readFileSync)(options.file);
33347
+ const content = (0, import_node_fs6.readFileSync)(options.file);
33272
33348
  const upload = await uploadTaskAttachmentBytes(creds, {
33273
33349
  conversationId: resolvedConversationId,
33274
33350
  fileName: (0, import_node_path4.basename)(options.file),
@@ -33417,6 +33493,7 @@ A .zip needs app.manifest.json, or a plain static site with index.html at its ro
33417
33493
  }
33418
33494
  });
33419
33495
  registerHostedAppDomainCommands(app);
33496
+ registerHostedSiteCommands(app);
33420
33497
  app.command("ai").description("Pause, resume, or adjust a Hosted App AI budget").requiredOption("--id <appId>", "Hosted App ID (UUID)").option("--action <action>", "pause, resume, or budget").option("--daily-credit-limit <credits>", "Daily AI credit limit", (value2) => parseIntegerOption(value2, "--daily-credit-limit")).option("--monthly-credit-limit <credits>", "Monthly AI credit limit", (value2) => parseIntegerOption(value2, "--monthly-credit-limit")).action(async (options) => {
33421
33498
  try {
33422
33499
  if (!options.action && options.dailyCreditLimit === void 0 && options.monthlyCreditLimit === void 0) {
@@ -33663,8 +33740,8 @@ var fs6 = __toESM(require("fs"));
33663
33740
  var path6 = __toESM(require("path"));
33664
33741
  var UNKNOWN_VERSION = "0.0.0";
33665
33742
  function injectedVersion() {
33666
- if ("0.1.27".length > 0) {
33667
- return "0.1.27";
33743
+ if ("0.1.28".length > 0) {
33744
+ return "0.1.28";
33668
33745
  }
33669
33746
  return null;
33670
33747
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kollab",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Kollab workspace CLI",
5
5
  "bin": {
6
6
  "kollab": "dist/index.js"