@mestra-dev/contract 0.0.174 → 0.0.175

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 +215 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4414,6 +4414,63 @@ declare const routes: import("hono/hono-base").HonoBase<{
4414
4414
  };
4415
4415
  };
4416
4416
  };
4417
+ readonly ConversionRateAnalysisSuccess: {
4418
+ readonly type: "object";
4419
+ readonly required: readonly [
4420
+ "success",
4421
+ "workspaceId",
4422
+ "category",
4423
+ "period",
4424
+ "paidInvoiceCount",
4425
+ "customerCount",
4426
+ "conversionRate"
4427
+ ];
4428
+ readonly properties: {
4429
+ readonly success: {
4430
+ readonly type: "boolean";
4431
+ readonly const: true;
4432
+ };
4433
+ readonly workspaceId: {
4434
+ readonly type: "string";
4435
+ readonly format: "uuid";
4436
+ };
4437
+ readonly category: {
4438
+ readonly type: "string";
4439
+ readonly description: "Workspace category.";
4440
+ };
4441
+ readonly period: {
4442
+ readonly type: "object";
4443
+ readonly required: readonly [
4444
+ "from",
4445
+ "to"
4446
+ ];
4447
+ readonly properties: {
4448
+ readonly from: {
4449
+ readonly type: "string";
4450
+ readonly format: "date-time";
4451
+ readonly nullable: true;
4452
+ };
4453
+ readonly to: {
4454
+ readonly type: "string";
4455
+ readonly format: "date-time";
4456
+ readonly nullable: true;
4457
+ };
4458
+ };
4459
+ };
4460
+ readonly paidInvoiceCount: {
4461
+ readonly type: "integer";
4462
+ readonly description: "Paid CInvoices included in the period.";
4463
+ };
4464
+ readonly customerCount: {
4465
+ readonly type: "integer";
4466
+ readonly description: "Non-deleted real-estate customers created in the period.";
4467
+ };
4468
+ readonly conversionRate: {
4469
+ readonly type: "number";
4470
+ readonly description: "Paid CInvoices divided by real-estate customers, expressed as a percentage. Zero when no customers match the period.";
4471
+ };
4472
+ };
4473
+ };
4417
4474
  readonly CHistory: {
4418
4475
  readonly type: "object";
4419
4476
  readonly required: readonly [
@@ -12997,6 +13054,102 @@ declare const routes: import("hono/hono-base").HonoBase<{
12997
13054
  };
12998
13055
  };
12999
13056
  };
13057
+ readonly "/analytics/{workspace}/conversion-rate": {
13058
+ readonly get: {
13059
+ readonly tags: readonly [
13060
+ "Analytics"
13061
+ ];
13062
+ readonly summary: "Get real-estate conversion rate";
13063
+ readonly description: "Returns the conversion rate for a real-estate workspace: paid CInvoices divided by non-deleted real-estate customers, multiplied by 100. Optional from and to timestamps filter invoices by paidAt and customers by created_at (from inclusive, to exclusive). The rate is zero when no customers match. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
13064
+ readonly security: readonly [
13065
+ never
13066
+ ];
13067
+ readonly parameters: readonly [
13068
+ {
13069
+ readonly name: "workspace";
13070
+ readonly in: "path";
13071
+ readonly required: true;
13072
+ readonly schema: {
13073
+ readonly type: "string";
13074
+ readonly format: "uuid";
13075
+ };
13076
+ readonly description: "Workspace identifier.";
13077
+ },
13078
+ {
13079
+ readonly name: "from";
13080
+ readonly in: "query";
13081
+ readonly required: false;
13082
+ readonly schema: {
13083
+ readonly type: "string";
13084
+ readonly format: "date-time";
13085
+ };
13086
+ readonly description: "Include invoices paid and customers created at or after this timestamp.";
13087
+ },
13088
+ {
13089
+ readonly name: "to";
13090
+ readonly in: "query";
13091
+ readonly required: false;
13092
+ readonly schema: {
13093
+ readonly type: "string";
13094
+ readonly format: "date-time";
13095
+ };
13096
+ readonly description: "Include invoices paid and customers created before this timestamp.";
13097
+ }
13098
+ ];
13099
+ readonly responses: {
13100
+ readonly 200: {
13101
+ readonly description: "Conversion rate fetched successfully.";
13102
+ readonly content: {
13103
+ readonly "application/json": {
13104
+ readonly schema: {
13105
+ readonly $ref: "#/components/schemas/ConversionRateAnalysisSuccess";
13106
+ };
13107
+ };
13108
+ };
13109
+ };
13110
+ readonly 400: {
13111
+ readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category.";
13112
+ readonly content: {
13113
+ readonly "application/json": {
13114
+ readonly schema: {
13115
+ readonly $ref: "#/components/schemas/ErrorResponse";
13116
+ };
13117
+ };
13118
+ };
13119
+ };
13120
+ readonly 401: {
13121
+ readonly description: "Unauthorized - Missing or invalid access token.";
13122
+ readonly content: {
13123
+ readonly "application/json": {
13124
+ readonly schema: {
13125
+ readonly $ref: "#/components/schemas/ErrorResponse";
13126
+ };
13127
+ };
13128
+ };
13129
+ };
13130
+ readonly 403: {
13131
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
13132
+ readonly content: {
13133
+ readonly "application/json": {
13134
+ readonly schema: {
13135
+ readonly $ref: "#/components/schemas/ErrorResponse";
13136
+ };
13137
+ };
13138
+ };
13139
+ };
13140
+ readonly 404: {
13141
+ readonly description: "Workspace not found.";
13142
+ readonly content: {
13143
+ readonly "application/json": {
13144
+ readonly schema: {
13145
+ readonly $ref: "#/components/schemas/ErrorResponse";
13146
+ };
13147
+ };
13148
+ };
13149
+ };
13150
+ };
13151
+ };
13152
+ };
13000
13153
  readonly "/cinvoices/create": {
13001
13154
  readonly post: {
13002
13155
  readonly tags: readonly [
@@ -24987,6 +25140,68 @@ declare const routes: import("hono/hono-base").HonoBase<{
24987
25140
  status: 200;
24988
25141
  };
24989
25142
  };
25143
+ } & {
25144
+ "/:workspace/conversion-rate": {
25145
+ $get: {
25146
+ input: {
25147
+ param: {
25148
+ workspace: string;
25149
+ };
25150
+ };
25151
+ output: {
25152
+ success: false;
25153
+ error: {
25154
+ [x: string]: import("hono/utils/types").JSONValue;
25155
+ };
25156
+ };
25157
+ outputFormat: "json";
25158
+ status: 400;
25159
+ } | {
25160
+ input: {
25161
+ param: {
25162
+ workspace: string;
25163
+ };
25164
+ };
25165
+ output: {
25166
+ success: false;
25167
+ error: string;
25168
+ };
25169
+ outputFormat: "json";
25170
+ status: 400;
25171
+ } | {
25172
+ input: {
25173
+ param: {
25174
+ workspace: string;
25175
+ };
25176
+ };
25177
+ output: {
25178
+ success: false;
25179
+ error: string;
25180
+ };
25181
+ outputFormat: "json";
25182
+ status: 404;
25183
+ } | {
25184
+ input: {
25185
+ param: {
25186
+ workspace: string;
25187
+ };
25188
+ };
25189
+ output: {
25190
+ success: true;
25191
+ workspaceId: string;
25192
+ category: string;
25193
+ period: {
25194
+ from: string | null;
25195
+ to: string | null;
25196
+ };
25197
+ paidInvoiceCount: number;
25198
+ customerCount: number;
25199
+ conversionRate: number;
25200
+ };
25201
+ outputFormat: "json";
25202
+ status: 200;
25203
+ };
25204
+ };
24990
25205
  }, "/analytics">, "/", "/">;
24991
25206
  type GlobalErrorResponses = {
24992
25207
  400: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.174",
3
+ "version": "0.0.175",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,