@mestra-dev/contract 0.0.175 → 0.0.176

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.d.ts +275 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4471,6 +4471,114 @@ declare const routes: import("hono/hono-base").HonoBase<{
4471
4471
  };
4472
4472
  };
4473
4473
  };
4474
+ readonly ForecastRevenueTotal: {
4475
+ readonly type: "object";
4476
+ readonly required: readonly [
4477
+ "currency",
4478
+ "pendingRevenueMinor",
4479
+ "pendingInvoiceCount",
4480
+ "averageDealSizeMinor",
4481
+ "projectedPipelineMinor",
4482
+ "forecastRevenueMinor"
4483
+ ];
4484
+ readonly properties: {
4485
+ readonly currency: {
4486
+ readonly type: "string";
4487
+ readonly description: "Invoice currency. Forecasts are not combined across currencies.";
4488
+ };
4489
+ readonly pendingRevenueMinor: {
4490
+ readonly type: "integer";
4491
+ readonly description: "Pending invoice value due in the period, after discount and excluding VAT.";
4492
+ };
4493
+ readonly pendingInvoiceCount: {
4494
+ readonly type: "integer";
4495
+ readonly description: "Number of pending invoices due in the period.";
4496
+ };
4497
+ readonly averageDealSizeMinor: {
4498
+ readonly type: "number";
4499
+ readonly description: "Average paid invoice value in the period, after discount and excluding VAT.";
4500
+ };
4501
+ readonly projectedPipelineMinor: {
4502
+ readonly type: "integer";
4503
+ readonly description: "Projected revenue: period leads \u00D7 conversion rate \u00D7 average deal size.";
4504
+ };
4505
+ readonly forecastRevenueMinor: {
4506
+ readonly type: "integer";
4507
+ readonly description: "Pending revenue plus projected pipeline revenue.";
4508
+ };
4509
+ };
4510
+ };
4511
+ readonly ForecastRevenueAnalysisSuccess: {
4512
+ readonly type: "object";
4513
+ readonly required: readonly [
4514
+ "success",
4515
+ "workspaceId",
4516
+ "category",
4517
+ "period",
4518
+ "leadCount",
4519
+ "averageDailyLeads",
4520
+ "paidInvoiceCount",
4521
+ "conversionRate",
4522
+ "forecasts"
4523
+ ];
4524
+ readonly properties: {
4525
+ readonly success: {
4526
+ readonly type: "boolean";
4527
+ readonly const: true;
4528
+ };
4529
+ readonly workspaceId: {
4530
+ readonly type: "string";
4531
+ readonly format: "uuid";
4532
+ };
4533
+ readonly category: {
4534
+ readonly type: "string";
4535
+ readonly description: "Workspace category.";
4536
+ };
4537
+ readonly period: {
4538
+ readonly type: "object";
4539
+ readonly required: readonly [
4540
+ "from",
4541
+ "to"
4542
+ ];
4543
+ readonly properties: {
4544
+ readonly from: {
4545
+ readonly type: "string";
4546
+ readonly format: "date-time";
4547
+ readonly nullable: true;
4548
+ };
4549
+ readonly to: {
4550
+ readonly type: "string";
4551
+ readonly format: "date-time";
4552
+ readonly nullable: true;
4553
+ };
4554
+ };
4555
+ };
4556
+ readonly leadCount: {
4557
+ readonly type: "integer";
4558
+ readonly description: "Non-deleted real-estate leads created in the period.";
4559
+ };
4560
+ readonly averageDailyLeads: {
4561
+ readonly type: "number";
4562
+ readonly nullable: true;
4563
+ readonly description: "Lead count divided by the reporting period duration in days; null without both period bounds.";
4564
+ };
4565
+ readonly paidInvoiceCount: {
4566
+ readonly type: "integer";
4567
+ readonly description: "Paid CInvoices included in the period.";
4568
+ };
4569
+ readonly conversionRate: {
4570
+ readonly type: "number";
4571
+ readonly description: "Paid CInvoices divided by real-estate leads, expressed as a percentage.";
4572
+ };
4573
+ readonly forecasts: {
4574
+ readonly type: "array";
4575
+ readonly items: {
4576
+ readonly $ref: "#/components/schemas/ForecastRevenueTotal";
4577
+ };
4578
+ readonly description: "Forecast totals grouped by currency. Empty when the period has neither pending nor paid invoices.";
4579
+ };
4580
+ };
4581
+ };
4474
4582
  readonly CHistory: {
4475
4583
  readonly type: "object";
4476
4584
  readonly required: readonly [
@@ -13150,6 +13258,102 @@ declare const routes: import("hono/hono-base").HonoBase<{
13150
13258
  };
13151
13259
  };
13152
13260
  };
13261
+ readonly "/analytics/{workspace}/forecast-revenue": {
13262
+ readonly get: {
13263
+ readonly tags: readonly [
13264
+ "Analytics"
13265
+ ];
13266
+ readonly summary: "Get real-estate forecast revenue";
13267
+ readonly description: "Returns forecast revenue for a real-estate workspace, grouped by currency. Pending CInvoices are filtered by their invoice date; paid invoices are filtered by paidAt; and leads are filtered by creation time (from inclusive, to exclusive). Projected pipeline revenue is leads in the period \u00D7 (paid invoices \u00F7 leads) \u00D7 average paid invoice size. Forecast revenue is pending revenue plus projected pipeline revenue. Amounts are post-discount minor units and exclude VAT. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
13268
+ readonly security: readonly [
13269
+ never
13270
+ ];
13271
+ readonly parameters: readonly [
13272
+ {
13273
+ readonly name: "workspace";
13274
+ readonly in: "path";
13275
+ readonly required: true;
13276
+ readonly schema: {
13277
+ readonly type: "string";
13278
+ readonly format: "uuid";
13279
+ };
13280
+ readonly description: "Workspace identifier.";
13281
+ },
13282
+ {
13283
+ readonly name: "from";
13284
+ readonly in: "query";
13285
+ readonly required: false;
13286
+ readonly schema: {
13287
+ readonly type: "string";
13288
+ readonly format: "date-time";
13289
+ };
13290
+ readonly description: "Include pending invoices dated, paid invoices paid, and leads created at or after this timestamp.";
13291
+ },
13292
+ {
13293
+ readonly name: "to";
13294
+ readonly in: "query";
13295
+ readonly required: false;
13296
+ readonly schema: {
13297
+ readonly type: "string";
13298
+ readonly format: "date-time";
13299
+ };
13300
+ readonly description: "Include pending invoices dated, paid invoices paid, and leads created before this timestamp.";
13301
+ }
13302
+ ];
13303
+ readonly responses: {
13304
+ readonly 200: {
13305
+ readonly description: "Forecast revenue fetched successfully.";
13306
+ readonly content: {
13307
+ readonly "application/json": {
13308
+ readonly schema: {
13309
+ readonly $ref: "#/components/schemas/ForecastRevenueAnalysisSuccess";
13310
+ };
13311
+ };
13312
+ };
13313
+ };
13314
+ readonly 400: {
13315
+ readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category.";
13316
+ readonly content: {
13317
+ readonly "application/json": {
13318
+ readonly schema: {
13319
+ readonly $ref: "#/components/schemas/ErrorResponse";
13320
+ };
13321
+ };
13322
+ };
13323
+ };
13324
+ readonly 401: {
13325
+ readonly description: "Unauthorized - Missing or invalid access token.";
13326
+ readonly content: {
13327
+ readonly "application/json": {
13328
+ readonly schema: {
13329
+ readonly $ref: "#/components/schemas/ErrorResponse";
13330
+ };
13331
+ };
13332
+ };
13333
+ };
13334
+ readonly 403: {
13335
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
13336
+ readonly content: {
13337
+ readonly "application/json": {
13338
+ readonly schema: {
13339
+ readonly $ref: "#/components/schemas/ErrorResponse";
13340
+ };
13341
+ };
13342
+ };
13343
+ };
13344
+ readonly 404: {
13345
+ readonly description: "Workspace not found.";
13346
+ readonly content: {
13347
+ readonly "application/json": {
13348
+ readonly schema: {
13349
+ readonly $ref: "#/components/schemas/ErrorResponse";
13350
+ };
13351
+ };
13352
+ };
13353
+ };
13354
+ };
13355
+ };
13356
+ };
13153
13357
  readonly "/cinvoices/create": {
13154
13358
  readonly post: {
13155
13359
  readonly tags: readonly [
@@ -25202,6 +25406,77 @@ declare const routes: import("hono/hono-base").HonoBase<{
25202
25406
  status: 200;
25203
25407
  };
25204
25408
  };
25409
+ } & {
25410
+ "/:workspace/forecast-revenue": {
25411
+ $get: {
25412
+ input: {
25413
+ param: {
25414
+ workspace: string;
25415
+ };
25416
+ };
25417
+ output: {
25418
+ success: false;
25419
+ error: {
25420
+ [x: string]: import("hono/utils/types").JSONValue;
25421
+ };
25422
+ };
25423
+ outputFormat: "json";
25424
+ status: 400;
25425
+ } | {
25426
+ input: {
25427
+ param: {
25428
+ workspace: string;
25429
+ };
25430
+ };
25431
+ output: {
25432
+ success: false;
25433
+ error: string;
25434
+ };
25435
+ outputFormat: "json";
25436
+ status: 400;
25437
+ } | {
25438
+ input: {
25439
+ param: {
25440
+ workspace: string;
25441
+ };
25442
+ };
25443
+ output: {
25444
+ success: false;
25445
+ error: string;
25446
+ };
25447
+ outputFormat: "json";
25448
+ status: 404;
25449
+ } | {
25450
+ input: {
25451
+ param: {
25452
+ workspace: string;
25453
+ };
25454
+ };
25455
+ output: {
25456
+ success: true;
25457
+ workspaceId: string;
25458
+ category: string;
25459
+ period: {
25460
+ from: string | null;
25461
+ to: string | null;
25462
+ };
25463
+ leadCount: number;
25464
+ averageDailyLeads: number | null;
25465
+ paidInvoiceCount: number;
25466
+ conversionRate: number;
25467
+ forecasts: {
25468
+ currency: string;
25469
+ pendingRevenueMinor: number;
25470
+ pendingInvoiceCount: number;
25471
+ averageDealSizeMinor: number;
25472
+ projectedPipelineMinor: number;
25473
+ forecastRevenueMinor: number;
25474
+ }[];
25475
+ };
25476
+ outputFormat: "json";
25477
+ status: 200;
25478
+ };
25479
+ };
25205
25480
  }, "/analytics">, "/", "/">;
25206
25481
  type GlobalErrorResponses = {
25207
25482
  400: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.175",
3
+ "version": "0.0.176",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,