@docyrus/docyrus 0.2.0 → 0.2.1

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 (3) hide show
  1. package/main.js +126 -1
  2. package/main.js.map +4 -4
  3. package/package.json +1 -1
package/main.js CHANGED
@@ -139453,7 +139453,7 @@ function buildInputSchema(args2, env2, options2) {
139453
139453
  // package.json
139454
139454
  var package_default = {
139455
139455
  name: "@docyrus/docyrus",
139456
- version: "0.2.0",
139456
+ version: "0.2.1",
139457
139457
  private: false,
139458
139458
  description: "Docyrus API CLI",
139459
139459
  main: "./main.js",
@@ -152423,6 +152423,124 @@ function createKnowledgeCli(dependencies) {
152423
152423
  return knowledgeCli;
152424
152424
  }
152425
152425
 
152426
+ // src/commands/messagingCommands.ts
152427
+ function parseCsvFlag2(raw) {
152428
+ if (raw === void 0) {
152429
+ return void 0;
152430
+ }
152431
+ const items = raw.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
152432
+ return items.length > 0 ? items : void 0;
152433
+ }
152434
+ function requireCsvFlag(raw, flag) {
152435
+ const items = parseCsvFlag2(raw);
152436
+ if (!items || items.length === 0) {
152437
+ throw new UserInputError(`Provide ${flag}.`);
152438
+ }
152439
+ return items;
152440
+ }
152441
+ function createMessagingCli(dependencies) {
152442
+ const messagingCli = Cli_exports.create("messaging", {
152443
+ description: "Messaging commands",
152444
+ env: EnvSchema
152445
+ });
152446
+ messagingCli.command("accounts", {
152447
+ description: "List tenant email accounts (non-credential info)",
152448
+ run: async () => {
152449
+ const apiBaseUrl = await dependencies.environmentConfigService.getActiveApiBaseUrl();
152450
+ const apiClient = dependencies.createApiClient(apiBaseUrl);
152451
+ const response = await apiClient.request({
152452
+ method: "GET",
152453
+ path: "/messaging/email/accounts"
152454
+ });
152455
+ return await injectContext({
152456
+ apiBaseUrl,
152457
+ authStore: dependencies.authStore,
152458
+ payload: response.data
152459
+ });
152460
+ }
152461
+ });
152462
+ const emailCli = Cli_exports.create("email", {
152463
+ description: "Email commands",
152464
+ env: EnvSchema
152465
+ });
152466
+ emailCli.command("send", {
152467
+ description: "Send an email through a tenant email account",
152468
+ options: external_exports.object({
152469
+ accountId: external_exports.string().min(1).describe("Tenant email account UUID"),
152470
+ to: external_exports.string().optional().describe("Comma-separated recipient addresses"),
152471
+ cc: external_exports.string().optional().describe("Comma-separated CC addresses"),
152472
+ bcc: external_exports.string().optional().describe("Comma-separated BCC addresses"),
152473
+ replyTo: external_exports.string().optional().describe("Comma-separated reply-to addresses"),
152474
+ subject: external_exports.string().optional().describe("Email subject"),
152475
+ body: external_exports.string().optional().describe("Email body (HTML or text)"),
152476
+ sendAsUser: external_exports.boolean().optional().describe("Send using the authenticated user's identity when allowed"),
152477
+ data: external_exports.string().optional().describe("Full JSON payload; overrides individual flags when set"),
152478
+ fromFile: external_exports.string().optional().describe("Read full JSON payload from a file")
152479
+ }),
152480
+ run: async (context) => {
152481
+ const apiBaseUrl = await dependencies.environmentConfigService.getActiveApiBaseUrl();
152482
+ const apiClient = dependencies.createApiClient(apiBaseUrl);
152483
+ const accountId = context.options.accountId.trim();
152484
+ if (!accountId) {
152485
+ throw new UserInputError("Provide --accountId.");
152486
+ }
152487
+ let body2;
152488
+ if (context.options.data || context.options.fromFile) {
152489
+ const parsed = await readDataInput({
152490
+ data: context.options.data,
152491
+ fromFile: context.options.fromFile
152492
+ });
152493
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
152494
+ throw new UserInputError("Send email payload must be a JSON object.");
152495
+ }
152496
+ body2 = parsed;
152497
+ } else {
152498
+ const to = requireCsvFlag(context.options.to, "--to");
152499
+ const subject = context.options.subject?.trim();
152500
+ const emailBody = context.options.body;
152501
+ if (!subject) {
152502
+ throw new UserInputError("Provide --subject.");
152503
+ }
152504
+ if (emailBody === void 0 || emailBody.length === 0) {
152505
+ throw new UserInputError("Provide --body.");
152506
+ }
152507
+ body2 = {
152508
+ to,
152509
+ subject,
152510
+ body: emailBody
152511
+ };
152512
+ const cc = parseCsvFlag2(context.options.cc);
152513
+ if (cc) {
152514
+ body2.cc = cc;
152515
+ }
152516
+ const bcc = parseCsvFlag2(context.options.bcc);
152517
+ if (bcc) {
152518
+ body2.bcc = bcc;
152519
+ }
152520
+ const replyTo = parseCsvFlag2(context.options.replyTo);
152521
+ if (replyTo) {
152522
+ body2.replyTo = replyTo;
152523
+ }
152524
+ if (context.options.sendAsUser !== void 0) {
152525
+ body2.sendAsUser = context.options.sendAsUser;
152526
+ }
152527
+ }
152528
+ const response = await apiClient.request({
152529
+ method: "POST",
152530
+ path: `/messaging/email/accounts/${encodeURIComponent(accountId)}/send`,
152531
+ body: body2
152532
+ });
152533
+ return await injectContext({
152534
+ apiBaseUrl,
152535
+ authStore: dependencies.authStore,
152536
+ payload: response.data
152537
+ });
152538
+ }
152539
+ });
152540
+ messagingCli.command(emailCli);
152541
+ return messagingCli;
152542
+ }
152543
+
152426
152544
  // src/commands/projectPlanCommands.ts
152427
152545
  init_graph2();
152428
152546
  init_localTodos();
@@ -158186,6 +158304,8 @@ var ROOT_HELP_COMMANDS = [
158186
158304
  { command: "studio list-data-sources --appSlug <slug>", description: "List studio data sources" },
158187
158305
  { command: "automation list --appSlug <slug>", description: "List automations for an app" },
158188
158306
  { command: "automation create-trigger --automationId <id> --type <type>", description: "Add a typed trigger to an automation" },
158307
+ { command: "messaging accounts", description: "List tenant email accounts (non-credential info)" },
158308
+ { command: "messaging email send --accountId <id>", description: "Send an email through a tenant email account" },
158189
158309
  { command: "tui", description: "Launch terminal UI (OpenTUI, requires Bun)" },
158190
158310
  { command: "curl <path>", description: "Send arbitrary API requests" }
158191
158311
  ];
@@ -158321,6 +158441,11 @@ function createDocyrusCli(params) {
158321
158441
  environmentConfigService,
158322
158442
  authStore
158323
158443
  }));
158444
+ cli2.command(createMessagingCli({
158445
+ createApiClient,
158446
+ environmentConfigService,
158447
+ authStore
158448
+ }));
158324
158449
  if (includeTui) {
158325
158450
  cli2.command(createTuiCli({
158326
158451
  version: package_default.version