@mestra-dev/contract 0.0.173 → 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 +813 -117
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
27
27
  readonly info: {
28
28
  readonly title: "Auth Service API";
29
29
  readonly version: "1.5.12";
30
- readonly description: "OpenAPI specification for the Auth, Integrations, Workspace, Payments, Tasks, Templates, Tags, Comments, Assignees, Chat, Events, Billings, CInvoices, Customer History, Files, and Notifications endpoints exposed by the k3-core platform. Unhandled HTTPException and unexpected errors are normalized by the global error handler to `{ success: false, error: string }` (status preserved for HTTPException; 500 otherwise).";
30
+ readonly description: "OpenAPI specification for the Auth, Integrations, Workspace, Payments, Analytics, Tasks, Templates, Tags, Comments, Assignees, Chat, Events, Billings, CInvoices, Customer History, Files, and Notifications endpoints exposed by the k3-core platform. Unhandled HTTPException and unexpected errors are normalized by the global error handler to `{ success: false, error: string }` (status preserved for HTTPException; 500 otherwise).";
31
31
  };
32
32
  readonly servers: readonly [
33
33
  {
@@ -60,6 +60,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
60
60
  readonly name: "Payments";
61
61
  readonly description: "Workspace subscription invoices, YooKassa checkout, renewals, and upgrades.";
62
62
  },
63
+ {
64
+ readonly name: "Analytics";
65
+ readonly description: "Read-only CRM analytics for a workspace. Requires workspace access and crm::analytics read access.";
66
+ },
63
67
  {
64
68
  readonly name: "Tasks";
65
69
  readonly description: "Task management endpoints";
@@ -4126,6 +4130,12 @@ declare const routes: import("hono/hono-base").HonoBase<{
4126
4130
  "refunded"
4127
4131
  ];
4128
4132
  };
4133
+ readonly paidAt: {
4134
+ readonly type: "string";
4135
+ readonly format: "date-time";
4136
+ readonly nullable: true;
4137
+ readonly description: "Server-set timestamp when the invoice was marked paid.";
4138
+ };
4129
4139
  readonly buyerInn: {
4130
4140
  readonly type: "string";
4131
4141
  readonly nullable: true;
@@ -4255,6 +4265,212 @@ declare const routes: import("hono/hono-base").HonoBase<{
4255
4265
  };
4256
4266
  };
4257
4267
  };
4268
+ readonly RevenueTotal: {
4269
+ readonly type: "object";
4270
+ readonly required: readonly [
4271
+ "currency",
4272
+ "amountMinor",
4273
+ "invoiceCount"
4274
+ ];
4275
+ readonly properties: {
4276
+ readonly currency: {
4277
+ readonly type: "string";
4278
+ readonly description: "Invoice currency.";
4279
+ };
4280
+ readonly amountMinor: {
4281
+ readonly type: "integer";
4282
+ readonly description: "Revenue in the currency's minor units after discount, excluding VAT.";
4283
+ };
4284
+ readonly invoiceCount: {
4285
+ readonly type: "integer";
4286
+ readonly description: "Number of paid invoices included in the total.";
4287
+ };
4288
+ };
4289
+ };
4290
+ readonly PaidRevenueAnalysisSuccess: {
4291
+ readonly type: "object";
4292
+ readonly required: readonly [
4293
+ "success",
4294
+ "workspaceId",
4295
+ "category",
4296
+ "period",
4297
+ "totals"
4298
+ ];
4299
+ readonly properties: {
4300
+ readonly success: {
4301
+ readonly type: "boolean";
4302
+ readonly const: true;
4303
+ };
4304
+ readonly workspaceId: {
4305
+ readonly type: "string";
4306
+ readonly format: "uuid";
4307
+ };
4308
+ readonly category: {
4309
+ readonly type: "string";
4310
+ readonly description: "Workspace category.";
4311
+ };
4312
+ readonly period: {
4313
+ readonly type: "object";
4314
+ readonly required: readonly [
4315
+ "from",
4316
+ "to"
4317
+ ];
4318
+ readonly properties: {
4319
+ readonly from: {
4320
+ readonly type: "string";
4321
+ readonly format: "date-time";
4322
+ readonly nullable: true;
4323
+ };
4324
+ readonly to: {
4325
+ readonly type: "string";
4326
+ readonly format: "date-time";
4327
+ readonly nullable: true;
4328
+ };
4329
+ };
4330
+ };
4331
+ readonly totals: {
4332
+ readonly type: "array";
4333
+ readonly items: {
4334
+ readonly $ref: "#/components/schemas/RevenueTotal";
4335
+ };
4336
+ readonly description: "Totals grouped by invoice currency. Empty when there are no paid invoices.";
4337
+ };
4338
+ };
4339
+ };
4340
+ readonly LeadSourceTotal: {
4341
+ readonly type: "object";
4342
+ readonly required: readonly [
4343
+ "leadSource",
4344
+ "leadCount"
4345
+ ];
4346
+ readonly properties: {
4347
+ readonly leadSource: {
4348
+ readonly type: "string";
4349
+ readonly enum: readonly [
4350
+ "cian",
4351
+ "avito",
4352
+ "vk",
4353
+ "yandex",
4354
+ "website",
4355
+ "referral",
4356
+ "walk_in",
4357
+ "unattributed"
4358
+ ];
4359
+ readonly description: "Lead acquisition source, or unattributed when no source was recorded.";
4360
+ };
4361
+ readonly leadCount: {
4362
+ readonly type: "integer";
4363
+ readonly description: "Number of leads from this source.";
4364
+ };
4365
+ };
4366
+ };
4367
+ readonly LeadSourceAnalysisSuccess: {
4368
+ readonly type: "object";
4369
+ readonly required: readonly [
4370
+ "success",
4371
+ "workspaceId",
4372
+ "category",
4373
+ "period",
4374
+ "sources"
4375
+ ];
4376
+ readonly properties: {
4377
+ readonly success: {
4378
+ readonly type: "boolean";
4379
+ readonly const: true;
4380
+ };
4381
+ readonly workspaceId: {
4382
+ readonly type: "string";
4383
+ readonly format: "uuid";
4384
+ };
4385
+ readonly category: {
4386
+ readonly type: "string";
4387
+ readonly description: "Workspace category.";
4388
+ };
4389
+ readonly period: {
4390
+ readonly type: "object";
4391
+ readonly required: readonly [
4392
+ "from",
4393
+ "to"
4394
+ ];
4395
+ readonly properties: {
4396
+ readonly from: {
4397
+ readonly type: "string";
4398
+ readonly format: "date-time";
4399
+ readonly nullable: true;
4400
+ };
4401
+ readonly to: {
4402
+ readonly type: "string";
4403
+ readonly format: "date-time";
4404
+ readonly nullable: true;
4405
+ };
4406
+ };
4407
+ };
4408
+ readonly sources: {
4409
+ readonly type: "array";
4410
+ readonly items: {
4411
+ readonly $ref: "#/components/schemas/LeadSourceTotal";
4412
+ };
4413
+ readonly description: "Lead totals grouped by acquisition source. Empty when no leads match the period.";
4414
+ };
4415
+ };
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
+ };
4258
4474
  readonly CHistory: {
4259
4475
  readonly type: "object";
4260
4476
  readonly required: readonly [
@@ -12646,125 +12862,413 @@ declare const routes: import("hono/hono-base").HonoBase<{
12646
12862
  };
12647
12863
  };
12648
12864
  };
12649
- readonly "/cinvoices/create": {
12650
- readonly post: {
12865
+ readonly "/analytics/{workspace}/total-revenue": {
12866
+ readonly get: {
12651
12867
  readonly tags: readonly [
12652
- "CInvoices"
12868
+ "Analytics"
12653
12869
  ];
12654
- readonly summary: "Create a customer invoice";
12655
- readonly description: "Creates a customer invoice in the specified workspace. Real-estate workspaces require an existing seller billing, customer_real_estates lead, and service_real_estates listing in the same workspace. created_by is taken from the access token. Requires workspace access and write access to crm::customers. Other workspace categories return 400.";
12870
+ readonly summary: "Get total paid customer-invoice revenue";
12871
+ readonly description: "Returns paid CInvoice revenue for a real-estate workspace, grouped by currency. Optional from and to timestamps filter the server-set paidAt field (from inclusive, to exclusive). Each total is calculated as unitPrice \u00D7 unitQuantity \u2212 discount in minor units and excludes VAT. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
12656
12872
  readonly security: readonly [
12657
12873
  never
12658
12874
  ];
12659
- readonly requestBody: {
12660
- readonly required: true;
12661
- readonly content: {
12662
- readonly "application/json": {
12663
- readonly schema: {
12664
- readonly type: "object";
12665
- readonly required: readonly [
12666
- "workspace",
12667
- "invoiceId",
12668
- "serviceId",
12669
- "SellerBillingId",
12670
- "customerId",
12671
- "date",
12672
- "language",
12673
- "currency",
12674
- "vatOption",
12675
- "unitName",
12676
- "unitPrice",
12677
- "unitQuantity"
12678
- ];
12679
- readonly properties: {
12680
- readonly workspace: {
12681
- readonly type: "string";
12682
- readonly format: "uuid";
12683
- readonly description: "Workspace identifier where the invoice is created.";
12684
- };
12685
- readonly invoiceId: {
12686
- readonly type: "string";
12687
- readonly description: "User-facing invoice number.";
12688
- };
12689
- readonly serviceId: {
12690
- readonly type: "string";
12691
- readonly format: "uuid";
12692
- readonly description: "Real-estate service identifier.";
12693
- };
12694
- readonly SellerBillingId: {
12695
- readonly type: "string";
12696
- readonly format: "uuid";
12697
- readonly description: "Seller billing/requisites identifier.";
12698
- };
12699
- readonly customerId: {
12700
- readonly type: "string";
12701
- readonly format: "uuid";
12702
- readonly description: "Real-estate customer identifier.";
12703
- };
12704
- readonly date: {
12705
- readonly type: "string";
12706
- readonly format: "date-time";
12707
- readonly description: "Invoice date.";
12708
- };
12709
- readonly language: {
12710
- readonly type: "string";
12711
- readonly enum: readonly [
12712
- "ru",
12713
- "en"
12714
- ];
12715
- };
12716
- readonly currency: {
12717
- readonly type: "string";
12718
- readonly enum: readonly [
12719
- "RUB",
12720
- "USD",
12721
- "EUR"
12722
- ];
12723
- };
12724
- readonly vatOption: {
12725
- readonly type: "string";
12726
- readonly enum: readonly [
12727
- "vat_included",
12728
- "vat_excluded"
12729
- ];
12730
- };
12731
- readonly vatRate: {
12732
- readonly type: "integer";
12733
- readonly minimum: 0;
12734
- readonly maximum: 100;
12735
- readonly description: "VAT rate (0-100).";
12736
- };
12737
- readonly status: {
12738
- readonly type: "string";
12739
- readonly enum: readonly [
12740
- "pending",
12741
- "paid",
12742
- "canceled",
12743
- "refunded"
12744
- ];
12745
- readonly description: "Invoice payment status. Defaults to pending.";
12746
- };
12747
- readonly buyerInn: {
12748
- readonly type: "string";
12749
- readonly description: "Buyer INN (tax ID).";
12750
- };
12751
- readonly buyerKpp: {
12752
- readonly type: "string";
12753
- readonly description: "Buyer KPP.";
12754
- };
12755
- readonly unitName: {
12756
- readonly type: "string";
12757
- readonly description: "Line-item name.";
12758
- };
12759
- readonly unitPrice: {
12760
- readonly type: "integer";
12761
- readonly minimum: 0;
12762
- readonly description: "Unit price in the invoice currency's minor units.";
12763
- };
12764
- readonly unitQuantity: {
12765
- readonly type: "integer";
12766
- readonly minimum: 1;
12767
- };
12875
+ readonly parameters: readonly [
12876
+ {
12877
+ readonly name: "workspace";
12878
+ readonly in: "path";
12879
+ readonly required: true;
12880
+ readonly schema: {
12881
+ readonly type: "string";
12882
+ readonly format: "uuid";
12883
+ };
12884
+ readonly description: "Workspace identifier.";
12885
+ },
12886
+ {
12887
+ readonly name: "from";
12888
+ readonly in: "query";
12889
+ readonly required: false;
12890
+ readonly schema: {
12891
+ readonly type: "string";
12892
+ readonly format: "date-time";
12893
+ };
12894
+ readonly description: "Include invoices paid at or after this timestamp.";
12895
+ },
12896
+ {
12897
+ readonly name: "to";
12898
+ readonly in: "query";
12899
+ readonly required: false;
12900
+ readonly schema: {
12901
+ readonly type: "string";
12902
+ readonly format: "date-time";
12903
+ };
12904
+ readonly description: "Include invoices paid before this timestamp.";
12905
+ }
12906
+ ];
12907
+ readonly responses: {
12908
+ readonly 200: {
12909
+ readonly description: "Paid revenue totals fetched successfully.";
12910
+ readonly content: {
12911
+ readonly "application/json": {
12912
+ readonly schema: {
12913
+ readonly $ref: "#/components/schemas/PaidRevenueAnalysisSuccess";
12914
+ };
12915
+ };
12916
+ };
12917
+ };
12918
+ readonly 400: {
12919
+ readonly description: "Invalid workspace ID or unsupported workspace category.";
12920
+ readonly content: {
12921
+ readonly "application/json": {
12922
+ readonly schema: {
12923
+ readonly $ref: "#/components/schemas/ErrorResponse";
12924
+ };
12925
+ };
12926
+ };
12927
+ };
12928
+ readonly 401: {
12929
+ readonly description: "Unauthorized - Missing or invalid access token.";
12930
+ readonly content: {
12931
+ readonly "application/json": {
12932
+ readonly schema: {
12933
+ readonly $ref: "#/components/schemas/ErrorResponse";
12934
+ };
12935
+ };
12936
+ };
12937
+ };
12938
+ readonly 403: {
12939
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
12940
+ readonly content: {
12941
+ readonly "application/json": {
12942
+ readonly schema: {
12943
+ readonly $ref: "#/components/schemas/ErrorResponse";
12944
+ };
12945
+ };
12946
+ };
12947
+ };
12948
+ readonly 404: {
12949
+ readonly description: "Workspace not found.";
12950
+ readonly content: {
12951
+ readonly "application/json": {
12952
+ readonly schema: {
12953
+ readonly $ref: "#/components/schemas/ErrorResponse";
12954
+ };
12955
+ };
12956
+ };
12957
+ };
12958
+ };
12959
+ };
12960
+ };
12961
+ readonly "/analytics/{workspace}/leads-by-source": {
12962
+ readonly get: {
12963
+ readonly tags: readonly [
12964
+ "Analytics"
12965
+ ];
12966
+ readonly summary: "Get real-estate leads by acquisition source";
12967
+ readonly description: "Returns real-estate leads grouped by their recorded acquisition source. Optional from and to timestamps filter lead creation time (from inclusive, to exclusive). Leads with no recorded source are grouped as unattributed. Soft-deleted leads are excluded. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
12968
+ readonly security: readonly [
12969
+ never
12970
+ ];
12971
+ readonly parameters: readonly [
12972
+ {
12973
+ readonly name: "workspace";
12974
+ readonly in: "path";
12975
+ readonly required: true;
12976
+ readonly schema: {
12977
+ readonly type: "string";
12978
+ readonly format: "uuid";
12979
+ };
12980
+ readonly description: "Workspace identifier.";
12981
+ },
12982
+ {
12983
+ readonly name: "from";
12984
+ readonly in: "query";
12985
+ readonly required: false;
12986
+ readonly schema: {
12987
+ readonly type: "string";
12988
+ readonly format: "date-time";
12989
+ };
12990
+ readonly description: "Include leads created at or after this timestamp.";
12991
+ },
12992
+ {
12993
+ readonly name: "to";
12994
+ readonly in: "query";
12995
+ readonly required: false;
12996
+ readonly schema: {
12997
+ readonly type: "string";
12998
+ readonly format: "date-time";
12999
+ };
13000
+ readonly description: "Include leads created before this timestamp.";
13001
+ }
13002
+ ];
13003
+ readonly responses: {
13004
+ readonly 200: {
13005
+ readonly description: "Lead totals by source fetched successfully.";
13006
+ readonly content: {
13007
+ readonly "application/json": {
13008
+ readonly schema: {
13009
+ readonly $ref: "#/components/schemas/LeadSourceAnalysisSuccess";
13010
+ };
13011
+ };
13012
+ };
13013
+ };
13014
+ readonly 400: {
13015
+ readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category.";
13016
+ readonly content: {
13017
+ readonly "application/json": {
13018
+ readonly schema: {
13019
+ readonly $ref: "#/components/schemas/ErrorResponse";
13020
+ };
13021
+ };
13022
+ };
13023
+ };
13024
+ readonly 401: {
13025
+ readonly description: "Unauthorized - Missing or invalid access token.";
13026
+ readonly content: {
13027
+ readonly "application/json": {
13028
+ readonly schema: {
13029
+ readonly $ref: "#/components/schemas/ErrorResponse";
13030
+ };
13031
+ };
13032
+ };
13033
+ };
13034
+ readonly 403: {
13035
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
13036
+ readonly content: {
13037
+ readonly "application/json": {
13038
+ readonly schema: {
13039
+ readonly $ref: "#/components/schemas/ErrorResponse";
13040
+ };
13041
+ };
13042
+ };
13043
+ };
13044
+ readonly 404: {
13045
+ readonly description: "Workspace not found.";
13046
+ readonly content: {
13047
+ readonly "application/json": {
13048
+ readonly schema: {
13049
+ readonly $ref: "#/components/schemas/ErrorResponse";
13050
+ };
13051
+ };
13052
+ };
13053
+ };
13054
+ };
13055
+ };
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
+ };
13153
+ readonly "/cinvoices/create": {
13154
+ readonly post: {
13155
+ readonly tags: readonly [
13156
+ "CInvoices"
13157
+ ];
13158
+ readonly summary: "Create a customer invoice";
13159
+ readonly description: "Creates a customer invoice in the specified workspace. Real-estate workspaces require an existing seller billing, customer_real_estates lead, and service_real_estates listing in the same workspace. created_by is taken from the access token. Requires workspace access and write access to crm::customers. Other workspace categories return 400.";
13160
+ readonly security: readonly [
13161
+ never
13162
+ ];
13163
+ readonly requestBody: {
13164
+ readonly required: true;
13165
+ readonly content: {
13166
+ readonly "application/json": {
13167
+ readonly schema: {
13168
+ readonly type: "object";
13169
+ readonly required: readonly [
13170
+ "workspace",
13171
+ "invoiceId",
13172
+ "serviceId",
13173
+ "SellerBillingId",
13174
+ "customerId",
13175
+ "date",
13176
+ "language",
13177
+ "currency",
13178
+ "vatOption",
13179
+ "unitName",
13180
+ "unitPrice",
13181
+ "unitQuantity"
13182
+ ];
13183
+ readonly properties: {
13184
+ readonly workspace: {
13185
+ readonly type: "string";
13186
+ readonly format: "uuid";
13187
+ readonly description: "Workspace identifier where the invoice is created.";
13188
+ };
13189
+ readonly invoiceId: {
13190
+ readonly type: "string";
13191
+ readonly description: "User-facing invoice number.";
13192
+ };
13193
+ readonly serviceId: {
13194
+ readonly type: "string";
13195
+ readonly format: "uuid";
13196
+ readonly description: "Real-estate service identifier.";
13197
+ };
13198
+ readonly SellerBillingId: {
13199
+ readonly type: "string";
13200
+ readonly format: "uuid";
13201
+ readonly description: "Seller billing/requisites identifier.";
13202
+ };
13203
+ readonly customerId: {
13204
+ readonly type: "string";
13205
+ readonly format: "uuid";
13206
+ readonly description: "Real-estate customer identifier.";
13207
+ };
13208
+ readonly date: {
13209
+ readonly type: "string";
13210
+ readonly format: "date-time";
13211
+ readonly description: "Invoice date.";
13212
+ };
13213
+ readonly language: {
13214
+ readonly type: "string";
13215
+ readonly enum: readonly [
13216
+ "ru",
13217
+ "en"
13218
+ ];
13219
+ };
13220
+ readonly currency: {
13221
+ readonly type: "string";
13222
+ readonly enum: readonly [
13223
+ "RUB",
13224
+ "USD",
13225
+ "EUR"
13226
+ ];
13227
+ };
13228
+ readonly vatOption: {
13229
+ readonly type: "string";
13230
+ readonly enum: readonly [
13231
+ "vat_included",
13232
+ "vat_excluded"
13233
+ ];
13234
+ };
13235
+ readonly vatRate: {
13236
+ readonly type: "integer";
13237
+ readonly minimum: 0;
13238
+ readonly maximum: 100;
13239
+ readonly description: "VAT rate (0-100).";
13240
+ };
13241
+ readonly status: {
13242
+ readonly type: "string";
13243
+ readonly enum: readonly [
13244
+ "pending",
13245
+ "paid",
13246
+ "canceled",
13247
+ "refunded"
13248
+ ];
13249
+ readonly description: "Invoice payment status. Defaults to pending.";
13250
+ };
13251
+ readonly buyerInn: {
13252
+ readonly type: "string";
13253
+ readonly description: "Buyer INN (tax ID).";
13254
+ };
13255
+ readonly buyerKpp: {
13256
+ readonly type: "string";
13257
+ readonly description: "Buyer KPP.";
13258
+ };
13259
+ readonly unitName: {
13260
+ readonly type: "string";
13261
+ readonly description: "Line-item name.";
13262
+ };
13263
+ readonly unitPrice: {
13264
+ readonly type: "integer";
13265
+ readonly minimum: 0;
13266
+ readonly description: "Unit price in the invoice currency's minor units.";
13267
+ };
13268
+ readonly unitQuantity: {
13269
+ readonly type: "integer";
13270
+ readonly minimum: 1;
13271
+ };
12768
13272
  readonly notes: {
12769
13273
  readonly type: "string";
12770
13274
  };
@@ -18835,6 +19339,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
18835
19339
  workspaceId: string;
18836
19340
  created_by: string | null;
18837
19341
  companyName: string | null;
19342
+ leadSource: string | null;
18838
19343
  updated_at: string | null;
18839
19344
  deleted_at: string | null;
18840
19345
  verified_at: string | null;
@@ -18846,7 +19351,6 @@ declare const routes: import("hono/hono-base").HonoBase<{
18846
19351
  igSynapseId: string | null;
18847
19352
  waSynapseId: string | null;
18848
19353
  tgSynapseId: string | null;
18849
- leadSource: string | null;
18850
19354
  budgetMin: number | null;
18851
19355
  budgetMax: number | null;
18852
19356
  fullPayment: boolean | null;
@@ -19455,6 +19959,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
19455
19959
  deleted_at: string | null;
19456
19960
  verified_at: string | null;
19457
19961
  suspended_at: string | null;
19962
+ paidAt: string | null;
19458
19963
  fullPayment: boolean | null;
19459
19964
  notes: string | null;
19460
19965
  buyerInn: string | null;
@@ -19538,6 +20043,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
19538
20043
  subscriptionStartDate: string | null;
19539
20044
  subscriptionEndDate: string | null;
19540
20045
  status: string;
20046
+ paidAt: string | null;
19541
20047
  created_by: string;
19542
20048
  }[];
19543
20049
  };
@@ -19597,6 +20103,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
19597
20103
  subscriptionStartDate: string | null;
19598
20104
  subscriptionEndDate: string | null;
19599
20105
  status: string;
20106
+ paidAt: string | null;
19600
20107
  created_by: string;
19601
20108
  }[];
19602
20109
  };
@@ -24506,7 +25013,196 @@ declare const routes: import("hono/hono-base").HonoBase<{
24506
25013
  status: 400 | 404 | 409 | 502 | 503;
24507
25014
  };
24508
25015
  };
24509
- }, "/payments">, "/", "/">;
25016
+ }, "/payments"> | import("hono/types").MergeSchemaPath<{
25017
+ "/:workspace/total-revenue": {
25018
+ $get: {
25019
+ input: {
25020
+ param: {
25021
+ workspace: string;
25022
+ };
25023
+ };
25024
+ output: {
25025
+ success: false;
25026
+ error: {
25027
+ [x: string]: import("hono/utils/types").JSONValue;
25028
+ };
25029
+ };
25030
+ outputFormat: "json";
25031
+ status: 400;
25032
+ } | {
25033
+ input: {
25034
+ param: {
25035
+ workspace: string;
25036
+ };
25037
+ };
25038
+ output: {
25039
+ success: false;
25040
+ error: string;
25041
+ };
25042
+ outputFormat: "json";
25043
+ status: 400;
25044
+ } | {
25045
+ input: {
25046
+ param: {
25047
+ workspace: string;
25048
+ };
25049
+ };
25050
+ output: {
25051
+ success: false;
25052
+ error: string;
25053
+ };
25054
+ outputFormat: "json";
25055
+ status: 404;
25056
+ } | {
25057
+ input: {
25058
+ param: {
25059
+ workspace: string;
25060
+ };
25061
+ };
25062
+ output: {
25063
+ success: true;
25064
+ workspaceId: string;
25065
+ category: string;
25066
+ period: {
25067
+ from: string | null;
25068
+ to: string | null;
25069
+ };
25070
+ totals: {
25071
+ currency: string;
25072
+ amountMinor: number;
25073
+ invoiceCount: number;
25074
+ }[];
25075
+ };
25076
+ outputFormat: "json";
25077
+ status: 200;
25078
+ };
25079
+ };
25080
+ } & {
25081
+ "/:workspace/leads-by-source": {
25082
+ $get: {
25083
+ input: {
25084
+ param: {
25085
+ workspace: string;
25086
+ };
25087
+ };
25088
+ output: {
25089
+ success: false;
25090
+ error: {
25091
+ [x: string]: import("hono/utils/types").JSONValue;
25092
+ };
25093
+ };
25094
+ outputFormat: "json";
25095
+ status: 400;
25096
+ } | {
25097
+ input: {
25098
+ param: {
25099
+ workspace: string;
25100
+ };
25101
+ };
25102
+ output: {
25103
+ success: false;
25104
+ error: string;
25105
+ };
25106
+ outputFormat: "json";
25107
+ status: 400;
25108
+ } | {
25109
+ input: {
25110
+ param: {
25111
+ workspace: string;
25112
+ };
25113
+ };
25114
+ output: {
25115
+ success: false;
25116
+ error: string;
25117
+ };
25118
+ outputFormat: "json";
25119
+ status: 404;
25120
+ } | {
25121
+ input: {
25122
+ param: {
25123
+ workspace: string;
25124
+ };
25125
+ };
25126
+ output: {
25127
+ success: true;
25128
+ workspaceId: string;
25129
+ category: string;
25130
+ period: {
25131
+ from: string | null;
25132
+ to: string | null;
25133
+ };
25134
+ sources: {
25135
+ leadSource: string;
25136
+ leadCount: number;
25137
+ }[];
25138
+ };
25139
+ outputFormat: "json";
25140
+ status: 200;
25141
+ };
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
+ };
25205
+ }, "/analytics">, "/", "/">;
24510
25206
  type GlobalErrorResponses = {
24511
25207
  400: {
24512
25208
  json: ApiError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.173",
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,