@deepintel-ltd/farmpro-contracts 1.24.3 → 1.25.0

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.
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const farmEnterprisesRouter: {
3
- getEffectiveWorkspacePacks: {
3
+ getAvailableWorkspaces: {
4
4
  pathParams: z.ZodObject<{
5
5
  farmId: z.ZodString;
6
6
  }, "strip", z.ZodTypeAny, {
@@ -8,32 +8,14 @@ export declare const farmEnterprisesRouter: {
8
8
  }, {
9
9
  farmId: string;
10
10
  }>;
11
- summary: "Effective packs the current user may switch into for this farm";
12
- description: "Intersection of farm-enabled enterprises and user grants, plus Commodity Trade when org-enabled and granted.";
11
+ summary: "Workspaces the current user may switch into for this farm";
12
+ description: "Farm packs the user is granted (enabled ∩ grants) plus Commodity Trade when org-enabled and granted.";
13
13
  method: "GET";
14
14
  path: "/farms/:farmId/effective-workspace";
15
15
  responses: {
16
16
  200: z.ZodObject<{
17
17
  data: z.ZodObject<{
18
- farmId: z.ZodString;
19
- organizationId: z.ZodNullable<z.ZodString>;
20
- enabledFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
21
- grantedFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
22
- effectiveFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
23
- trade: z.ZodObject<{
24
- enabled: z.ZodBoolean;
25
- granted: z.ZodBoolean;
26
- effective: z.ZodBoolean;
27
- }, "strip", z.ZodTypeAny, {
28
- enabled: boolean;
29
- granted: boolean;
30
- effective: boolean;
31
- }, {
32
- enabled: boolean;
33
- granted: boolean;
34
- effective: boolean;
35
- }>;
36
- effectiveWorkspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
18
+ workspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
37
19
  kind: z.ZodLiteral<"farm">;
38
20
  pack: z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>;
39
21
  }, "strip", z.ZodTypeAny, {
@@ -50,34 +32,14 @@ export declare const farmEnterprisesRouter: {
50
32
  kind: "trade";
51
33
  }>]>, "many">;
52
34
  }, "strip", z.ZodTypeAny, {
53
- organizationId: string | null;
54
- farmId: string;
55
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
56
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
57
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
58
- trade: {
59
- enabled: boolean;
60
- granted: boolean;
61
- effective: boolean;
62
- };
63
- effectiveWorkspaces: ({
35
+ workspaces: ({
64
36
  kind: "farm";
65
37
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
66
38
  } | {
67
39
  kind: "trade";
68
40
  })[];
69
41
  }, {
70
- organizationId: string | null;
71
- farmId: string;
72
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
73
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
74
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
75
- trade: {
76
- enabled: boolean;
77
- granted: boolean;
78
- effective: boolean;
79
- };
80
- effectiveWorkspaces: ({
42
+ workspaces: ({
81
43
  kind: "farm";
82
44
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
83
45
  } | {
@@ -86,17 +48,7 @@ export declare const farmEnterprisesRouter: {
86
48
  }>;
87
49
  }, "strip", z.ZodTypeAny, {
88
50
  data: {
89
- organizationId: string | null;
90
- farmId: string;
91
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
92
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
93
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
94
- trade: {
95
- enabled: boolean;
96
- granted: boolean;
97
- effective: boolean;
98
- };
99
- effectiveWorkspaces: ({
51
+ workspaces: ({
100
52
  kind: "farm";
101
53
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
102
54
  } | {
@@ -105,17 +57,7 @@ export declare const farmEnterprisesRouter: {
105
57
  };
106
58
  }, {
107
59
  data: {
108
- organizationId: string | null;
109
- farmId: string;
110
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
111
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
112
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
113
- trade: {
114
- enabled: boolean;
115
- granted: boolean;
116
- effective: boolean;
117
- };
118
- effectiveWorkspaces: ({
60
+ workspaces: ({
119
61
  kind: "farm";
120
62
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
121
63
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"farm-enterprises.routes.d.ts","sourceRoot":"","sources":["../../src/routes/farm-enterprises.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEhC,CAAC"}
@@ -1,24 +1,24 @@
1
1
  import { initContract } from '@ts-rest/core';
2
2
  import { z } from 'zod';
3
- import { createFarmEnterpriseSchema, effectiveWorkspacePacksResponseSchema, farmEnterpriseListResponseSchema, farmEnterpriseResponseSchema, replaceFarmEnterprisesSchema, } from '../schemas/farm-enterprises.schemas';
3
+ import { availableWorkspacesResponseSchema, createFarmEnterpriseSchema, farmEnterpriseListResponseSchema, farmEnterpriseResponseSchema, replaceFarmEnterprisesSchema, } from '../schemas/farm-enterprises.schemas';
4
4
  import { jsonApiErrorResponseSchema, idParamSchema, } from '../schemas/common.schemas';
5
5
  const c = initContract();
6
6
  const farmIdParamSchema = z.object({
7
7
  farmId: z.string().uuid(),
8
8
  });
9
9
  export const farmEnterprisesRouter = c.router({
10
- getEffectiveWorkspacePacks: {
10
+ getAvailableWorkspaces: {
11
11
  method: 'GET',
12
12
  path: '/farms/:farmId/effective-workspace',
13
13
  pathParams: farmIdParamSchema,
14
14
  responses: {
15
- 200: effectiveWorkspacePacksResponseSchema,
15
+ 200: availableWorkspacesResponseSchema,
16
16
  401: jsonApiErrorResponseSchema,
17
17
  403: jsonApiErrorResponseSchema,
18
18
  404: jsonApiErrorResponseSchema,
19
19
  },
20
- summary: 'Effective packs the current user may switch into for this farm',
21
- description: 'Intersection of farm-enabled enterprises and user grants, plus Commodity Trade when org-enabled and granted.',
20
+ summary: 'Workspaces the current user may switch into for this farm',
21
+ description: 'Farm packs the user is granted (enabled ∩ grants) plus Commodity Trade when org-enabled and granted.',
22
22
  },
23
23
  listFarmEnterprises: {
24
24
  method: 'GET',
@@ -103,9 +103,9 @@ export declare const enhancedAlertConfigSchema: z.ZodObject<{
103
103
  enabled: z.ZodDefault<z.ZodBoolean>;
104
104
  }, "strip", z.ZodTypeAny, {
105
105
  message: string;
106
- enabled: boolean;
107
106
  condition: string;
108
107
  actions: string[];
108
+ enabled: boolean;
109
109
  severity?: "critical" | "warning" | "info" | undefined;
110
110
  durationDays?: number | undefined;
111
111
  conditionType?: "below_critical" | "below_warning" | "rapid_decline" | "sustained_stress" | "above_excessive" | undefined;
@@ -113,10 +113,10 @@ export declare const enhancedAlertConfigSchema: z.ZodObject<{
113
113
  message: string;
114
114
  condition: string;
115
115
  actions: string[];
116
- enabled?: boolean | undefined;
117
116
  severity?: "critical" | "warning" | "info" | undefined;
118
117
  durationDays?: number | undefined;
119
118
  conditionType?: "below_critical" | "below_warning" | "rapid_decline" | "sustained_stress" | "above_excessive" | undefined;
119
+ enabled?: boolean | undefined;
120
120
  }>;
121
121
  export declare const cropProfileSchema: z.ZodObject<{
122
122
  id: z.ZodString;
@@ -429,28 +429,26 @@ export declare const replaceFarmEnterprisesSchema: z.ZodObject<{
429
429
  }[];
430
430
  };
431
431
  }>;
432
- /** Effective workspace packs for the current user on a farm (+ org Trade). */
433
- export declare const effectiveWorkspacePacksSchema: z.ZodObject<{
434
- farmId: z.ZodString;
435
- organizationId: z.ZodNullable<z.ZodString>;
436
- enabledFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
437
- grantedFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
438
- effectiveFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
439
- trade: z.ZodObject<{
440
- enabled: z.ZodBoolean;
441
- granted: z.ZodBoolean;
442
- effective: z.ZodBoolean;
443
- }, "strip", z.ZodTypeAny, {
444
- enabled: boolean;
445
- granted: boolean;
446
- effective: boolean;
447
- }, {
448
- enabled: boolean;
449
- granted: boolean;
450
- effective: boolean;
451
- }>;
452
- /** Packs the user may switch into (farm packs + trade when effective). */
453
- effectiveWorkspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
432
+ /** Workspace the current user may select for a farm (farm packs + Trade). */
433
+ export declare const workspaceSelectionSchema: z.ZodUnion<[z.ZodObject<{
434
+ kind: z.ZodLiteral<"farm">;
435
+ pack: z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>;
436
+ }, "strip", z.ZodTypeAny, {
437
+ kind: "farm";
438
+ pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
439
+ }, {
440
+ kind: "farm";
441
+ pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
442
+ }>, z.ZodObject<{
443
+ kind: z.ZodLiteral<"trade">;
444
+ }, "strip", z.ZodTypeAny, {
445
+ kind: "trade";
446
+ }, {
447
+ kind: "trade";
448
+ }>]>;
449
+ /** Available workspaces for the current user on a farm. */
450
+ export declare const availableWorkspacesSchema: z.ZodObject<{
451
+ workspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
454
452
  kind: z.ZodLiteral<"farm">;
455
453
  pack: z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>;
456
454
  }, "strip", z.ZodTypeAny, {
@@ -467,62 +465,23 @@ export declare const effectiveWorkspacePacksSchema: z.ZodObject<{
467
465
  kind: "trade";
468
466
  }>]>, "many">;
469
467
  }, "strip", z.ZodTypeAny, {
470
- organizationId: string | null;
471
- farmId: string;
472
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
473
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
474
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
475
- trade: {
476
- enabled: boolean;
477
- granted: boolean;
478
- effective: boolean;
479
- };
480
- effectiveWorkspaces: ({
468
+ workspaces: ({
481
469
  kind: "farm";
482
470
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
483
471
  } | {
484
472
  kind: "trade";
485
473
  })[];
486
474
  }, {
487
- organizationId: string | null;
488
- farmId: string;
489
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
490
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
491
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
492
- trade: {
493
- enabled: boolean;
494
- granted: boolean;
495
- effective: boolean;
496
- };
497
- effectiveWorkspaces: ({
475
+ workspaces: ({
498
476
  kind: "farm";
499
477
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
500
478
  } | {
501
479
  kind: "trade";
502
480
  })[];
503
481
  }>;
504
- export declare const effectiveWorkspacePacksResponseSchema: z.ZodObject<{
482
+ export declare const availableWorkspacesResponseSchema: z.ZodObject<{
505
483
  data: z.ZodObject<{
506
- farmId: z.ZodString;
507
- organizationId: z.ZodNullable<z.ZodString>;
508
- enabledFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
509
- grantedFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
510
- effectiveFarmPacks: z.ZodArray<z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>, "many">;
511
- trade: z.ZodObject<{
512
- enabled: z.ZodBoolean;
513
- granted: z.ZodBoolean;
514
- effective: z.ZodBoolean;
515
- }, "strip", z.ZodTypeAny, {
516
- enabled: boolean;
517
- granted: boolean;
518
- effective: boolean;
519
- }, {
520
- enabled: boolean;
521
- granted: boolean;
522
- effective: boolean;
523
- }>;
524
- /** Packs the user may switch into (farm packs + trade when effective). */
525
- effectiveWorkspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
484
+ workspaces: z.ZodArray<z.ZodUnion<[z.ZodObject<{
526
485
  kind: z.ZodLiteral<"farm">;
527
486
  pack: z.ZodEnum<["CROPS", "POULTRY", "AQUACULTURE", "CATTLE", "GOAT"]>;
528
487
  }, "strip", z.ZodTypeAny, {
@@ -539,34 +498,14 @@ export declare const effectiveWorkspacePacksResponseSchema: z.ZodObject<{
539
498
  kind: "trade";
540
499
  }>]>, "many">;
541
500
  }, "strip", z.ZodTypeAny, {
542
- organizationId: string | null;
543
- farmId: string;
544
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
545
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
546
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
547
- trade: {
548
- enabled: boolean;
549
- granted: boolean;
550
- effective: boolean;
551
- };
552
- effectiveWorkspaces: ({
501
+ workspaces: ({
553
502
  kind: "farm";
554
503
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
555
504
  } | {
556
505
  kind: "trade";
557
506
  })[];
558
507
  }, {
559
- organizationId: string | null;
560
- farmId: string;
561
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
562
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
563
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
564
- trade: {
565
- enabled: boolean;
566
- granted: boolean;
567
- effective: boolean;
568
- };
569
- effectiveWorkspaces: ({
508
+ workspaces: ({
570
509
  kind: "farm";
571
510
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
572
511
  } | {
@@ -575,17 +514,7 @@ export declare const effectiveWorkspacePacksResponseSchema: z.ZodObject<{
575
514
  }>;
576
515
  }, "strip", z.ZodTypeAny, {
577
516
  data: {
578
- organizationId: string | null;
579
- farmId: string;
580
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
581
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
582
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
583
- trade: {
584
- enabled: boolean;
585
- granted: boolean;
586
- effective: boolean;
587
- };
588
- effectiveWorkspaces: ({
517
+ workspaces: ({
589
518
  kind: "farm";
590
519
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
591
520
  } | {
@@ -594,17 +523,7 @@ export declare const effectiveWorkspacePacksResponseSchema: z.ZodObject<{
594
523
  };
595
524
  }, {
596
525
  data: {
597
- organizationId: string | null;
598
- farmId: string;
599
- enabledFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
600
- grantedFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
601
- effectiveFarmPacks: ("CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT")[];
602
- trade: {
603
- enabled: boolean;
604
- granted: boolean;
605
- effective: boolean;
606
- };
607
- effectiveWorkspaces: ({
526
+ workspaces: ({
608
527
  kind: "farm";
609
528
  pack: "CROPS" | "POULTRY" | "AQUACULTURE" | "CATTLE" | "GOAT";
610
529
  } | {
@@ -615,6 +534,11 @@ export declare const effectiveWorkspacePacksResponseSchema: z.ZodObject<{
615
534
  export type FarmEnterpriseType = z.infer<typeof farmEnterpriseTypeSchema>;
616
535
  export type FarmEnterpriseAttributes = z.infer<typeof farmEnterpriseAttributesSchema>;
617
536
  export type CreateFarmEnterpriseAttributes = z.infer<typeof createFarmEnterpriseAttributesSchema>;
618
- export type EffectiveWorkspacePacks = z.infer<typeof effectiveWorkspacePacksSchema>;
619
- export type EffectiveWorkspacePacksResponse = z.infer<typeof effectiveWorkspacePacksResponseSchema>;
537
+ export type WorkspaceSelectionDto = z.infer<typeof workspaceSelectionSchema>;
538
+ export type AvailableWorkspaces = z.infer<typeof availableWorkspacesSchema>;
539
+ export type AvailableWorkspacesResponse = z.infer<typeof availableWorkspacesResponseSchema>;
540
+ /** @deprecated Use AvailableWorkspaces */
541
+ export type EffectiveWorkspacePacks = AvailableWorkspaces;
542
+ /** @deprecated Use AvailableWorkspacesResponse */
543
+ export type EffectiveWorkspacePacksResponse = AvailableWorkspacesResponse;
620
544
  //# sourceMappingURL=farm-enterprises.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"farm-enterprises.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/farm-enterprises.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB,kEAMnC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;EAMjB,CAAC;AAE3B,eAAO,MAAM,oCAAoC;;;;;;;;;EAG/C,CAAC;AAEH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;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;;;IAGnC,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5C,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F,0CAA0C;AAC1C,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAC1D,kDAAkD;AAClD,MAAM,MAAM,+BAA+B,GAAG,2BAA2B,CAAC"}
@@ -37,24 +37,15 @@ export const replaceFarmEnterprisesSchema = z.object({
37
37
  type: z.literal('farm-enterprises'),
38
38
  attributes: replaceFarmEnterprisesAttributesSchema,
39
39
  });
40
- /** Effective workspace packs for the current user on a farm (+ org Trade). */
41
- export const effectiveWorkspacePacksSchema = z.object({
42
- farmId: z.string().uuid(),
43
- organizationId: z.string().uuid().nullable(),
44
- enabledFarmPacks: z.array(farmEnterpriseTypeSchema),
45
- grantedFarmPacks: z.array(farmEnterpriseTypeSchema),
46
- effectiveFarmPacks: z.array(farmEnterpriseTypeSchema),
47
- trade: z.object({
48
- enabled: z.boolean(),
49
- granted: z.boolean(),
50
- effective: z.boolean(),
51
- }),
52
- /** Packs the user may switch into (farm packs + trade when effective). */
53
- effectiveWorkspaces: z.array(z.union([
54
- z.object({ kind: z.literal('farm'), pack: farmEnterpriseTypeSchema }),
55
- z.object({ kind: z.literal('trade') }),
56
- ])),
40
+ /** Workspace the current user may select for a farm (farm packs + Trade). */
41
+ export const workspaceSelectionSchema = z.union([
42
+ z.object({ kind: z.literal('farm'), pack: farmEnterpriseTypeSchema }),
43
+ z.object({ kind: z.literal('trade') }),
44
+ ]);
45
+ /** Available workspaces for the current user on a farm. */
46
+ export const availableWorkspacesSchema = z.object({
47
+ workspaces: z.array(workspaceSelectionSchema),
57
48
  });
58
- export const effectiveWorkspacePacksResponseSchema = z.object({
59
- data: effectiveWorkspacePacksSchema,
49
+ export const availableWorkspacesResponseSchema = z.object({
50
+ data: availableWorkspacesSchema,
60
51
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.24.3",
3
+ "version": "1.25.0",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",