@mestra-dev/contract 0.0.184 → 0.0.186

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 +534 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4612,6 +4612,210 @@ declare const routes: import("hono/hono-base").HonoBase<{
4612
4612
  };
4613
4613
  };
4614
4614
  };
4615
+ readonly EmployeeConversionRate: {
4616
+ readonly type: "object";
4617
+ readonly required: readonly [
4618
+ "collaboratorId",
4619
+ "userId",
4620
+ "firstName",
4621
+ "lastName",
4622
+ "profilePicture",
4623
+ "status",
4624
+ "assignedCustomerCount",
4625
+ "convertedCustomerCount",
4626
+ "conversionRate"
4627
+ ];
4628
+ readonly properties: {
4629
+ readonly collaboratorId: {
4630
+ readonly type: "string";
4631
+ readonly format: "uuid";
4632
+ readonly description: "Workspace collaborator identifier.";
4633
+ };
4634
+ readonly userId: {
4635
+ readonly type: "string";
4636
+ readonly format: "uuid";
4637
+ readonly description: "Underlying user identifier.";
4638
+ };
4639
+ readonly firstName: {
4640
+ readonly type: "string";
4641
+ readonly nullable: true;
4642
+ readonly description: "Collaborator first name.";
4643
+ };
4644
+ readonly lastName: {
4645
+ readonly type: "string";
4646
+ readonly nullable: true;
4647
+ readonly description: "Collaborator last name.";
4648
+ };
4649
+ readonly profilePicture: {
4650
+ readonly type: "string";
4651
+ readonly nullable: true;
4652
+ readonly description: "Collaborator profile image URL.";
4653
+ };
4654
+ readonly status: {
4655
+ readonly type: "string";
4656
+ readonly description: "Collaborator status, including active or inactive states.";
4657
+ };
4658
+ readonly assignedCustomerCount: {
4659
+ readonly type: "integer";
4660
+ readonly description: "Distinct non-deleted customers linked to this collaborator's qualifying tasks.";
4661
+ };
4662
+ readonly convertedCustomerCount: {
4663
+ readonly type: "integer";
4664
+ readonly description: "Assigned customers with at least one qualifying paid CInvoice.";
4665
+ };
4666
+ readonly conversionRate: {
4667
+ readonly type: "number";
4668
+ readonly description: "Converted customers divided by assigned customers, expressed as a percentage.";
4669
+ };
4670
+ };
4671
+ };
4672
+ readonly EmployeeConversionRateAnalysisSuccess: {
4673
+ readonly type: "object";
4674
+ readonly required: readonly [
4675
+ "success",
4676
+ "workspaceId",
4677
+ "category",
4678
+ "period",
4679
+ "employees"
4680
+ ];
4681
+ readonly properties: {
4682
+ readonly success: {
4683
+ readonly type: "boolean";
4684
+ readonly const: true;
4685
+ };
4686
+ readonly workspaceId: {
4687
+ readonly type: "string";
4688
+ readonly format: "uuid";
4689
+ };
4690
+ readonly category: {
4691
+ readonly type: "string";
4692
+ readonly description: "Workspace category.";
4693
+ };
4694
+ readonly period: {
4695
+ readonly type: "object";
4696
+ readonly required: readonly [
4697
+ "from",
4698
+ "to"
4699
+ ];
4700
+ readonly properties: {
4701
+ readonly from: {
4702
+ readonly type: "string";
4703
+ readonly format: "date-time";
4704
+ readonly nullable: true;
4705
+ };
4706
+ readonly to: {
4707
+ readonly type: "string";
4708
+ readonly format: "date-time";
4709
+ readonly nullable: true;
4710
+ };
4711
+ };
4712
+ };
4713
+ readonly employees: {
4714
+ readonly type: "array";
4715
+ readonly items: {
4716
+ readonly $ref: "#/components/schemas/EmployeeConversionRate";
4717
+ };
4718
+ readonly description: "Active and inactive collaborators with at least one task linked to a customer.";
4719
+ };
4720
+ };
4721
+ };
4722
+ readonly WorkloadDistributionEmployee: {
4723
+ readonly type: "object";
4724
+ readonly required: readonly [
4725
+ "collaboratorId",
4726
+ "userId",
4727
+ "firstName",
4728
+ "lastName",
4729
+ "profilePicture",
4730
+ "status",
4731
+ "taskCount"
4732
+ ];
4733
+ readonly properties: {
4734
+ readonly collaboratorId: {
4735
+ readonly type: "string";
4736
+ readonly format: "uuid";
4737
+ readonly description: "Workspace collaborator identifier.";
4738
+ };
4739
+ readonly userId: {
4740
+ readonly type: "string";
4741
+ readonly format: "uuid";
4742
+ readonly description: "Underlying user identifier.";
4743
+ };
4744
+ readonly firstName: {
4745
+ readonly type: "string";
4746
+ readonly nullable: true;
4747
+ readonly description: "Collaborator first name.";
4748
+ };
4749
+ readonly lastName: {
4750
+ readonly type: "string";
4751
+ readonly nullable: true;
4752
+ readonly description: "Collaborator last name.";
4753
+ };
4754
+ readonly profilePicture: {
4755
+ readonly type: "string";
4756
+ readonly nullable: true;
4757
+ readonly description: "Collaborator profile image URL.";
4758
+ };
4759
+ readonly status: {
4760
+ readonly type: "string";
4761
+ readonly description: "Collaborator status, including active or inactive states.";
4762
+ };
4763
+ readonly taskCount: {
4764
+ readonly type: "integer";
4765
+ readonly description: "Distinct tasks assigned to this collaborator in the reporting period.";
4766
+ };
4767
+ };
4768
+ };
4769
+ readonly WorkloadDistributionAnalysisSuccess: {
4770
+ readonly type: "object";
4771
+ readonly required: readonly [
4772
+ "success",
4773
+ "workspaceId",
4774
+ "category",
4775
+ "period",
4776
+ "employees"
4777
+ ];
4778
+ readonly properties: {
4779
+ readonly success: {
4780
+ readonly type: "boolean";
4781
+ readonly const: true;
4782
+ };
4783
+ readonly workspaceId: {
4784
+ readonly type: "string";
4785
+ readonly format: "uuid";
4786
+ };
4787
+ readonly category: {
4788
+ readonly type: "string";
4789
+ readonly description: "Workspace category.";
4790
+ };
4791
+ readonly period: {
4792
+ readonly type: "object";
4793
+ readonly required: readonly [
4794
+ "from",
4795
+ "to"
4796
+ ];
4797
+ readonly properties: {
4798
+ readonly from: {
4799
+ readonly type: "string";
4800
+ readonly format: "date-time";
4801
+ readonly nullable: true;
4802
+ };
4803
+ readonly to: {
4804
+ readonly type: "string";
4805
+ readonly format: "date-time";
4806
+ readonly nullable: true;
4807
+ };
4808
+ };
4809
+ };
4810
+ readonly employees: {
4811
+ readonly type: "array";
4812
+ readonly items: {
4813
+ readonly $ref: "#/components/schemas/WorkloadDistributionEmployee";
4814
+ };
4815
+ readonly description: "All workspace collaborators, ordered by assigned task count descending.";
4816
+ };
4817
+ };
4818
+ };
4615
4819
  readonly ForecastRevenueTotal: {
4616
4820
  readonly type: "object";
4617
4821
  readonly required: readonly [
@@ -14103,6 +14307,198 @@ declare const routes: import("hono/hono-base").HonoBase<{
14103
14307
  };
14104
14308
  };
14105
14309
  };
14310
+ readonly "/analytics/{workspace}/employee-conversion-rate": {
14311
+ readonly get: {
14312
+ readonly tags: readonly [
14313
+ "Analytics"
14314
+ ];
14315
+ readonly summary: "Get real-estate employee conversion rates";
14316
+ readonly description: "Returns a customer-level conversion rate for each active or inactive collaborator with at least one qualifying task linked to a non-deleted real-estate customer. Assigned customers are distinct customers on the collaborator's tasks created within the optional period. A converted customer has at least one non-deleted paid CInvoice in the period. When several collaborators worked on the same customer, each receives full credit; multiple tasks or invoices for that customer do not increase counts. The rate is zero when a returned collaborator has no assigned customers after filtering. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
14317
+ readonly security: readonly [
14318
+ never
14319
+ ];
14320
+ readonly parameters: readonly [
14321
+ {
14322
+ readonly name: "workspace";
14323
+ readonly in: "path";
14324
+ readonly required: true;
14325
+ readonly schema: {
14326
+ readonly type: "string";
14327
+ readonly format: "uuid";
14328
+ };
14329
+ readonly description: "Workspace identifier.";
14330
+ },
14331
+ {
14332
+ readonly name: "from";
14333
+ readonly in: "query";
14334
+ readonly required: false;
14335
+ readonly schema: {
14336
+ readonly type: "string";
14337
+ readonly format: "date-time";
14338
+ };
14339
+ readonly description: "Include tasks created and CInvoices paid at or after this timestamp.";
14340
+ },
14341
+ {
14342
+ readonly name: "to";
14343
+ readonly in: "query";
14344
+ readonly required: false;
14345
+ readonly schema: {
14346
+ readonly type: "string";
14347
+ readonly format: "date-time";
14348
+ };
14349
+ readonly description: "Include tasks created and CInvoices paid before this timestamp.";
14350
+ }
14351
+ ];
14352
+ readonly responses: {
14353
+ readonly 200: {
14354
+ readonly description: "Employee conversion rates fetched successfully.";
14355
+ readonly content: {
14356
+ readonly "application/json": {
14357
+ readonly schema: {
14358
+ readonly $ref: "#/components/schemas/EmployeeConversionRateAnalysisSuccess";
14359
+ };
14360
+ };
14361
+ };
14362
+ };
14363
+ readonly 400: {
14364
+ readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category.";
14365
+ readonly content: {
14366
+ readonly "application/json": {
14367
+ readonly schema: {
14368
+ readonly $ref: "#/components/schemas/ErrorResponse";
14369
+ };
14370
+ };
14371
+ };
14372
+ };
14373
+ readonly 401: {
14374
+ readonly description: "Unauthorized - Missing or invalid access token.";
14375
+ readonly content: {
14376
+ readonly "application/json": {
14377
+ readonly schema: {
14378
+ readonly $ref: "#/components/schemas/ErrorResponse";
14379
+ };
14380
+ };
14381
+ };
14382
+ };
14383
+ readonly 403: {
14384
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
14385
+ readonly content: {
14386
+ readonly "application/json": {
14387
+ readonly schema: {
14388
+ readonly $ref: "#/components/schemas/ErrorResponse";
14389
+ };
14390
+ };
14391
+ };
14392
+ };
14393
+ readonly 404: {
14394
+ readonly description: "Workspace not found.";
14395
+ readonly content: {
14396
+ readonly "application/json": {
14397
+ readonly schema: {
14398
+ readonly $ref: "#/components/schemas/ErrorResponse";
14399
+ };
14400
+ };
14401
+ };
14402
+ };
14403
+ };
14404
+ };
14405
+ };
14406
+ readonly "/analytics/{workspace}/workload-distribution": {
14407
+ readonly get: {
14408
+ readonly tags: readonly [
14409
+ "Analytics"
14410
+ ];
14411
+ readonly summary: "Get real-estate workload distribution";
14412
+ readonly description: "Returns every workspace collaborator with their distinct assigned-task count, ordered from highest to lowest workload. Tasks are filtered by creation time when a reporting period is supplied (from inclusive, to exclusive). A task assigned to several collaborators contributes once to each assignee's workload. Requires workspace access and read access to crm::analytics. Other workspace categories return 400.";
14413
+ readonly security: readonly [
14414
+ never
14415
+ ];
14416
+ readonly parameters: readonly [
14417
+ {
14418
+ readonly name: "workspace";
14419
+ readonly in: "path";
14420
+ readonly required: true;
14421
+ readonly schema: {
14422
+ readonly type: "string";
14423
+ readonly format: "uuid";
14424
+ };
14425
+ readonly description: "Workspace identifier.";
14426
+ },
14427
+ {
14428
+ readonly name: "from";
14429
+ readonly in: "query";
14430
+ readonly required: false;
14431
+ readonly schema: {
14432
+ readonly type: "string";
14433
+ readonly format: "date-time";
14434
+ };
14435
+ readonly description: "Include tasks created at or after this timestamp.";
14436
+ },
14437
+ {
14438
+ readonly name: "to";
14439
+ readonly in: "query";
14440
+ readonly required: false;
14441
+ readonly schema: {
14442
+ readonly type: "string";
14443
+ readonly format: "date-time";
14444
+ };
14445
+ readonly description: "Include tasks created before this timestamp.";
14446
+ }
14447
+ ];
14448
+ readonly responses: {
14449
+ readonly 200: {
14450
+ readonly description: "Workload distribution fetched successfully.";
14451
+ readonly content: {
14452
+ readonly "application/json": {
14453
+ readonly schema: {
14454
+ readonly $ref: "#/components/schemas/WorkloadDistributionAnalysisSuccess";
14455
+ };
14456
+ };
14457
+ };
14458
+ };
14459
+ readonly 400: {
14460
+ readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category.";
14461
+ readonly content: {
14462
+ readonly "application/json": {
14463
+ readonly schema: {
14464
+ readonly $ref: "#/components/schemas/ErrorResponse";
14465
+ };
14466
+ };
14467
+ };
14468
+ };
14469
+ readonly 401: {
14470
+ readonly description: "Unauthorized - Missing or invalid access token.";
14471
+ readonly content: {
14472
+ readonly "application/json": {
14473
+ readonly schema: {
14474
+ readonly $ref: "#/components/schemas/ErrorResponse";
14475
+ };
14476
+ };
14477
+ };
14478
+ };
14479
+ readonly 403: {
14480
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::analytics resource.";
14481
+ readonly content: {
14482
+ readonly "application/json": {
14483
+ readonly schema: {
14484
+ readonly $ref: "#/components/schemas/ErrorResponse";
14485
+ };
14486
+ };
14487
+ };
14488
+ };
14489
+ readonly 404: {
14490
+ readonly description: "Workspace not found.";
14491
+ readonly content: {
14492
+ readonly "application/json": {
14493
+ readonly schema: {
14494
+ readonly $ref: "#/components/schemas/ErrorResponse";
14495
+ };
14496
+ };
14497
+ };
14498
+ };
14499
+ };
14500
+ };
14501
+ };
14106
14502
  readonly "/analytics/{workspace}/forecast-revenue": {
14107
14503
  readonly get: {
14108
14504
  readonly tags: readonly [
@@ -26564,6 +26960,144 @@ declare const routes: import("hono/hono-base").HonoBase<{
26564
26960
  status: 200;
26565
26961
  };
26566
26962
  };
26963
+ } & {
26964
+ "/:workspace/employee-conversion-rate": {
26965
+ $get: {
26966
+ input: {
26967
+ param: {
26968
+ workspace: string;
26969
+ };
26970
+ };
26971
+ output: {
26972
+ success: false;
26973
+ error: {
26974
+ [x: string]: import("hono/utils/types").JSONValue;
26975
+ };
26976
+ };
26977
+ outputFormat: "json";
26978
+ status: 400;
26979
+ } | {
26980
+ input: {
26981
+ param: {
26982
+ workspace: string;
26983
+ };
26984
+ };
26985
+ output: {
26986
+ success: false;
26987
+ error: string;
26988
+ };
26989
+ outputFormat: "json";
26990
+ status: 400;
26991
+ } | {
26992
+ input: {
26993
+ param: {
26994
+ workspace: string;
26995
+ };
26996
+ };
26997
+ output: {
26998
+ success: false;
26999
+ error: string;
27000
+ };
27001
+ outputFormat: "json";
27002
+ status: 404;
27003
+ } | {
27004
+ input: {
27005
+ param: {
27006
+ workspace: string;
27007
+ };
27008
+ };
27009
+ output: {
27010
+ success: true;
27011
+ workspaceId: string;
27012
+ category: string;
27013
+ period: {
27014
+ from: string | null;
27015
+ to: string | null;
27016
+ };
27017
+ employees: {
27018
+ collaboratorId: string;
27019
+ userId: string;
27020
+ firstName: string | null;
27021
+ lastName: string | null;
27022
+ profilePicture: string | null;
27023
+ status: string;
27024
+ assignedCustomerCount: number;
27025
+ convertedCustomerCount: number;
27026
+ conversionRate: number;
27027
+ }[];
27028
+ };
27029
+ outputFormat: "json";
27030
+ status: 200;
27031
+ };
27032
+ };
27033
+ } & {
27034
+ "/:workspace/workload-distribution": {
27035
+ $get: {
27036
+ input: {
27037
+ param: {
27038
+ workspace: string;
27039
+ };
27040
+ };
27041
+ output: {
27042
+ success: false;
27043
+ error: {
27044
+ [x: string]: import("hono/utils/types").JSONValue;
27045
+ };
27046
+ };
27047
+ outputFormat: "json";
27048
+ status: 400;
27049
+ } | {
27050
+ input: {
27051
+ param: {
27052
+ workspace: string;
27053
+ };
27054
+ };
27055
+ output: {
27056
+ success: false;
27057
+ error: string;
27058
+ };
27059
+ outputFormat: "json";
27060
+ status: 400;
27061
+ } | {
27062
+ input: {
27063
+ param: {
27064
+ workspace: string;
27065
+ };
27066
+ };
27067
+ output: {
27068
+ success: false;
27069
+ error: string;
27070
+ };
27071
+ outputFormat: "json";
27072
+ status: 404;
27073
+ } | {
27074
+ input: {
27075
+ param: {
27076
+ workspace: string;
27077
+ };
27078
+ };
27079
+ output: {
27080
+ success: true;
27081
+ workspaceId: string;
27082
+ category: string;
27083
+ period: {
27084
+ from: string | null;
27085
+ to: string | null;
27086
+ };
27087
+ employees: {
27088
+ taskCount: number;
27089
+ collaboratorId: string;
27090
+ userId: string;
27091
+ firstName: string | null;
27092
+ lastName: string | null;
27093
+ profilePicture: string | null;
27094
+ status: string;
27095
+ }[];
27096
+ };
27097
+ outputFormat: "json";
27098
+ status: 200;
27099
+ };
27100
+ };
26567
27101
  } & {
26568
27102
  "/:workspace/channel-performance": {
26569
27103
  $get: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.184",
3
+ "version": "0.0.186",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,