@erxes/core-contract 0.1.0-v2.2 → 0.1.0-v2.4

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.
@@ -1773,13 +1773,11 @@ export declare const automationsContract: {
1773
1773
  }>, Record<never, never>>;
1774
1774
  test: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1775
1775
  id: z.ZodString;
1776
- subject: z.ZodOptional<z.ZodObject<{
1777
- type: z.ZodEnum<{
1778
- company: "company";
1779
- customer: "customer";
1780
- }>;
1781
- id: z.ZodString;
1782
- }, z.core.$strip>>;
1776
+ subjectType: z.ZodOptional<z.ZodEnum<{
1777
+ company: "company";
1778
+ customer: "customer";
1779
+ }>>;
1780
+ subjectId: z.ZodOptional<z.ZodString>;
1783
1781
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1784
1782
  assumeEventHappens: z.ZodDefault<z.ZodBoolean>;
1785
1783
  }, z.core.$strip>, z.ZodObject<{
@@ -145,14 +145,16 @@ const automationsContract = {
145
145
  summary: "Dry run of the working copy: what each step would do for a record (nothing is changed)"
146
146
  }).input(z.object({
147
147
  id: Id,
148
- subject: z.object({
149
- type: z.enum(CONTENT_TYPES),
150
- id: Id
151
- }).optional(),
148
+ /** The record to run for: send both, or neither for a run without one. */
149
+ subjectType: z.enum(CONTENT_TYPES).optional(),
150
+ subjectId: Id.optional(),
152
151
  /** Event fields for the trigger (type, payload); defaults to the trigger's event. */
153
152
  payload: z.record(z.string(), z.unknown()).optional(),
154
153
  /** Pretend waits for events end with the event happening. */
155
154
  assumeEventHappens: z.boolean().default(false)
155
+ }).refine((input) => input.subjectType === void 0 === (input.subjectId === void 0), {
156
+ message: "Send subjectType and subjectId together",
157
+ path: ["subjectId"]
156
158
  })).output(z.object({
157
159
  triggerMatches: z.boolean(),
158
160
  goalMetAtStart: z.boolean(),
package/dist/client.d.ts CHANGED
@@ -3038,10 +3038,8 @@ export declare const orpc: {
3038
3038
  }>;
3039
3039
  test: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
3040
3040
  id: string;
3041
- subject?: {
3042
- type: "company" | "customer";
3043
- id: string;
3044
- } | undefined;
3041
+ subjectType?: "company" | "customer" | undefined;
3042
+ subjectId?: string | undefined;
3045
3043
  payload?: Record<string, unknown> | undefined;
3046
3044
  assumeEventHappens?: boolean | undefined;
3047
3045
  }, {
@@ -3182,10 +3180,8 @@ export declare const orpc: {
3182
3180
  };
3183
3181
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
3184
3182
  id: string;
3185
- subject?: {
3186
- type: "company" | "customer";
3187
- id: string;
3188
- } | undefined;
3183
+ subjectType?: "company" | "customer" | undefined;
3184
+ subjectId?: string | undefined;
3189
3185
  payload?: Record<string, unknown> | undefined;
3190
3186
  assumeEventHappens?: boolean | undefined;
3191
3187
  }>;
@@ -13920,6 +13916,107 @@ export declare const orpc: {
13920
13916
  refreshToken: string;
13921
13917
  }>;
13922
13918
  } & import("@orpc/tanstack-query").GeneralUtils<unknown>;
13919
+ emails: {
13920
+ send: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
13921
+ to: string[];
13922
+ subject: string;
13923
+ body: string;
13924
+ replyTo?: string | undefined;
13925
+ button?: {
13926
+ label: string;
13927
+ link: string;
13928
+ } | undefined;
13929
+ }, {
13930
+ queued: number;
13931
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
13932
+ UNAUTHORIZED: {
13933
+ status: number;
13934
+ };
13935
+ NOT_ALLOWED: {
13936
+ status: number;
13937
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
13938
+ permission: import("zod").ZodString;
13939
+ }, import("zod/v4/core").$strip>>;
13940
+ };
13941
+ PLUGIN_ONLY: {
13942
+ status: number;
13943
+ };
13944
+ MEMBERS_ONLY: {
13945
+ status: number;
13946
+ };
13947
+ ORG_REQUIRED: {
13948
+ status: number;
13949
+ };
13950
+ SCOPE_REQUIRED: {
13951
+ status: number;
13952
+ };
13953
+ SERVICE_TOKEN_REQUIRED: {
13954
+ status: number;
13955
+ };
13956
+ ORGANIZATION_DISABLED: {
13957
+ status: number;
13958
+ data: import("zod").ZodObject<{
13959
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
13960
+ }, import("zod/v4/core").$strip>;
13961
+ };
13962
+ NOT_IN_PLAN: {
13963
+ status: number;
13964
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
13965
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
13966
+ }, import("zod/v4/core").$strip>>;
13967
+ };
13968
+ READ_ONLY: {
13969
+ status: number;
13970
+ };
13971
+ TOO_MANY_REQUESTS: {
13972
+ status: number;
13973
+ };
13974
+ INVALID_INPUT: {
13975
+ status: number;
13976
+ data: import("zod").ZodObject<{
13977
+ issues: import("zod").ZodArray<import("zod").ZodObject<{
13978
+ path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
13979
+ message: import("zod").ZodString;
13980
+ }, import("zod/v4/core").$strip>>;
13981
+ }, import("zod/v4/core").$strip>;
13982
+ };
13983
+ NOT_FOUND: {
13984
+ status: number;
13985
+ };
13986
+ TAKEN: {
13987
+ status: number;
13988
+ data: import("zod").ZodObject<{
13989
+ field: import("zod").ZodString;
13990
+ id: import("zod").ZodOptional<import("zod").ZodString>;
13991
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
13992
+ }, import("zod/v4/core").$strip>;
13993
+ };
13994
+ INVALID_CURSOR: {
13995
+ status: number;
13996
+ };
13997
+ INVALID_REFERENCE: {
13998
+ status: number;
13999
+ data: import("zod").ZodObject<{
14000
+ field: import("zod").ZodString;
14001
+ }, import("zod/v4/core").$strip>;
14002
+ };
14003
+ INVALID_FILTER: {
14004
+ status: number;
14005
+ };
14006
+ FILTER_TOO_SLOW: {
14007
+ status: number;
14008
+ };
14009
+ }>>> & import("@orpc/tanstack-query").GeneralUtils<{
14010
+ to: string[];
14011
+ subject: string;
14012
+ body: string;
14013
+ replyTo?: string | undefined;
14014
+ button?: {
14015
+ label: string;
14016
+ link: string;
14017
+ } | undefined;
14018
+ }>;
14019
+ } & import("@orpc/tanstack-query").GeneralUtils<unknown>;
13923
14020
  events: {
13924
14021
  publish: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
13925
14022
  events: {
@@ -21683,6 +21780,9 @@ export declare const orpc: {
21683
21780
  CROSS_SITE: {
21684
21781
  status: number;
21685
21782
  };
21783
+ DUPLICATE_PERMISSION_SET: {
21784
+ status: number;
21785
+ };
21686
21786
  INVALID_CLIENT: {
21687
21787
  status: number;
21688
21788
  };
@@ -21698,6 +21798,12 @@ export declare const orpc: {
21698
21798
  PLUGIN_NOT_FOUND: {
21699
21799
  status: number;
21700
21800
  };
21801
+ UNKNOWN_PERMISSION: {
21802
+ status: number;
21803
+ data: import("zod").ZodObject<{
21804
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
21805
+ }, import("zod/v4/core").$strip>;
21806
+ };
21701
21807
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
21702
21808
  grant_type: "client_credentials";
21703
21809
  client_id: string;
@@ -21722,13 +21828,19 @@ export declare const orpc: {
21722
21828
  customerApp?: {
21723
21829
  origins: string[];
21724
21830
  } | undefined;
21725
- scopes?: ("activities:write" | "audit:write" | "customers:read" | "customers:write" | "events:read" | "events:write" | "files:read" | "files:write" | "live:write" | "notifications:write" | "payments:read" | "payments:write" | "products:read" | "products:write")[] | undefined;
21831
+ scopes?: ("activities:write" | "audit:write" | "customers:read" | "customers:write" | "emails:write" | "events:read" | "events:write" | "files:read" | "files:write" | "live:write" | "notifications:write" | "payments:read" | "payments:write" | "products:read" | "products:write" | "users:read")[] | undefined;
21726
21832
  permissions?: {
21727
21833
  action: string;
21728
21834
  label: string;
21729
21835
  description?: string | undefined;
21730
21836
  group?: string | undefined;
21731
21837
  }[] | undefined;
21838
+ permissionSets?: {
21839
+ key: string;
21840
+ label: string;
21841
+ description?: string | undefined;
21842
+ permissions: string[];
21843
+ }[] | undefined;
21732
21844
  notificationKinds?: {
21733
21845
  kind: string;
21734
21846
  label: string;
@@ -21854,6 +21966,9 @@ export declare const orpc: {
21854
21966
  CROSS_SITE: {
21855
21967
  status: number;
21856
21968
  };
21969
+ DUPLICATE_PERMISSION_SET: {
21970
+ status: number;
21971
+ };
21857
21972
  INVALID_CLIENT: {
21858
21973
  status: number;
21859
21974
  };
@@ -21869,6 +21984,12 @@ export declare const orpc: {
21869
21984
  PLUGIN_NOT_FOUND: {
21870
21985
  status: number;
21871
21986
  };
21987
+ UNKNOWN_PERMISSION: {
21988
+ status: number;
21989
+ data: import("zod").ZodObject<{
21990
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
21991
+ }, import("zod/v4/core").$strip>;
21992
+ };
21872
21993
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
21873
21994
  title: string;
21874
21995
  version: string;
@@ -21887,13 +22008,19 @@ export declare const orpc: {
21887
22008
  customerApp?: {
21888
22009
  origins: string[];
21889
22010
  } | undefined;
21890
- scopes?: ("activities:write" | "audit:write" | "customers:read" | "customers:write" | "events:read" | "events:write" | "files:read" | "files:write" | "live:write" | "notifications:write" | "payments:read" | "payments:write" | "products:read" | "products:write")[] | undefined;
22011
+ scopes?: ("activities:write" | "audit:write" | "customers:read" | "customers:write" | "emails:write" | "events:read" | "events:write" | "files:read" | "files:write" | "live:write" | "notifications:write" | "payments:read" | "payments:write" | "products:read" | "products:write" | "users:read")[] | undefined;
21891
22012
  permissions?: {
21892
22013
  action: string;
21893
22014
  label: string;
21894
22015
  description?: string | undefined;
21895
22016
  group?: string | undefined;
21896
22017
  }[] | undefined;
22018
+ permissionSets?: {
22019
+ key: string;
22020
+ label: string;
22021
+ description?: string | undefined;
22022
+ permissions: string[];
22023
+ }[] | undefined;
21897
22024
  notificationKinds?: {
21898
22025
  kind: string;
21899
22026
  label: string;
@@ -22043,6 +22170,9 @@ export declare const orpc: {
22043
22170
  CROSS_SITE: {
22044
22171
  status: number;
22045
22172
  };
22173
+ DUPLICATE_PERMISSION_SET: {
22174
+ status: number;
22175
+ };
22046
22176
  INVALID_CLIENT: {
22047
22177
  status: number;
22048
22178
  };
@@ -22058,6 +22188,12 @@ export declare const orpc: {
22058
22188
  PLUGIN_NOT_FOUND: {
22059
22189
  status: number;
22060
22190
  };
22191
+ UNKNOWN_PERMISSION: {
22192
+ status: number;
22193
+ data: import("zod").ZodObject<{
22194
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
22195
+ }, import("zod/v4/core").$strip>;
22196
+ };
22061
22197
  }>>> & import("@orpc/tanstack-query").GeneralUtils<unknown>;
22062
22198
  install: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
22063
22199
  name: string;
@@ -22165,6 +22301,9 @@ export declare const orpc: {
22165
22301
  CROSS_SITE: {
22166
22302
  status: number;
22167
22303
  };
22304
+ DUPLICATE_PERMISSION_SET: {
22305
+ status: number;
22306
+ };
22168
22307
  INVALID_CLIENT: {
22169
22308
  status: number;
22170
22309
  };
@@ -22180,6 +22319,12 @@ export declare const orpc: {
22180
22319
  PLUGIN_NOT_FOUND: {
22181
22320
  status: number;
22182
22321
  };
22322
+ UNKNOWN_PERMISSION: {
22323
+ status: number;
22324
+ data: import("zod").ZodObject<{
22325
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
22326
+ }, import("zod/v4/core").$strip>;
22327
+ };
22183
22328
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
22184
22329
  name: string;
22185
22330
  }>;
@@ -22289,6 +22434,9 @@ export declare const orpc: {
22289
22434
  CROSS_SITE: {
22290
22435
  status: number;
22291
22436
  };
22437
+ DUPLICATE_PERMISSION_SET: {
22438
+ status: number;
22439
+ };
22292
22440
  INVALID_CLIENT: {
22293
22441
  status: number;
22294
22442
  };
@@ -22304,6 +22452,12 @@ export declare const orpc: {
22304
22452
  PLUGIN_NOT_FOUND: {
22305
22453
  status: number;
22306
22454
  };
22455
+ UNKNOWN_PERMISSION: {
22456
+ status: number;
22457
+ data: import("zod").ZodObject<{
22458
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
22459
+ }, import("zod/v4/core").$strip>;
22460
+ };
22307
22461
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
22308
22462
  name: string;
22309
22463
  }>;
@@ -22394,6 +22548,9 @@ export declare const orpc: {
22394
22548
  CROSS_SITE: {
22395
22549
  status: number;
22396
22550
  };
22551
+ DUPLICATE_PERMISSION_SET: {
22552
+ status: number;
22553
+ };
22397
22554
  INVALID_CLIENT: {
22398
22555
  status: number;
22399
22556
  };
@@ -22409,6 +22566,12 @@ export declare const orpc: {
22409
22566
  PLUGIN_NOT_FOUND: {
22410
22567
  status: number;
22411
22568
  };
22569
+ UNKNOWN_PERMISSION: {
22570
+ status: number;
22571
+ data: import("zod").ZodObject<{
22572
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
22573
+ }, import("zod/v4/core").$strip>;
22574
+ };
22412
22575
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
22413
22576
  name: string;
22414
22577
  }>;
@@ -22498,6 +22661,9 @@ export declare const orpc: {
22498
22661
  CROSS_SITE: {
22499
22662
  status: number;
22500
22663
  };
22664
+ DUPLICATE_PERMISSION_SET: {
22665
+ status: number;
22666
+ };
22501
22667
  INVALID_CLIENT: {
22502
22668
  status: number;
22503
22669
  };
@@ -22513,6 +22679,12 @@ export declare const orpc: {
22513
22679
  PLUGIN_NOT_FOUND: {
22514
22680
  status: number;
22515
22681
  };
22682
+ UNKNOWN_PERMISSION: {
22683
+ status: number;
22684
+ data: import("zod").ZodObject<{
22685
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
22686
+ }, import("zod/v4/core").$strip>;
22687
+ };
22516
22688
  }>>> & import("@orpc/tanstack-query").GeneralUtils<{
22517
22689
  topics: string[];
22518
22690
  userIds?: string[] | undefined;
@@ -24489,6 +24661,126 @@ export declare const orpc: {
24489
24661
  }, import("zod/v4/core").$strip>;
24490
24662
  };
24491
24663
  }>>> & import("@orpc/tanstack-query").GeneralUtils<unknown>;
24664
+ permissionSets: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, unknown, {
24665
+ data: {
24666
+ source: string;
24667
+ key: string;
24668
+ label: string;
24669
+ description: string | null;
24670
+ permissions: string[];
24671
+ }[];
24672
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
24673
+ UNAUTHORIZED: {
24674
+ status: number;
24675
+ };
24676
+ NOT_ALLOWED: {
24677
+ status: number;
24678
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
24679
+ permission: import("zod").ZodString;
24680
+ }, import("zod/v4/core").$strip>>;
24681
+ };
24682
+ PLUGIN_ONLY: {
24683
+ status: number;
24684
+ };
24685
+ MEMBERS_ONLY: {
24686
+ status: number;
24687
+ };
24688
+ ORG_REQUIRED: {
24689
+ status: number;
24690
+ };
24691
+ SCOPE_REQUIRED: {
24692
+ status: number;
24693
+ };
24694
+ SERVICE_TOKEN_REQUIRED: {
24695
+ status: number;
24696
+ };
24697
+ ORGANIZATION_DISABLED: {
24698
+ status: number;
24699
+ data: import("zod").ZodObject<{
24700
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
24701
+ }, import("zod/v4/core").$strip>;
24702
+ };
24703
+ NOT_IN_PLAN: {
24704
+ status: number;
24705
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
24706
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
24707
+ }, import("zod/v4/core").$strip>>;
24708
+ };
24709
+ READ_ONLY: {
24710
+ status: number;
24711
+ };
24712
+ TOO_MANY_REQUESTS: {
24713
+ status: number;
24714
+ };
24715
+ INVALID_INPUT: {
24716
+ status: number;
24717
+ data: import("zod").ZodObject<{
24718
+ issues: import("zod").ZodArray<import("zod").ZodObject<{
24719
+ path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
24720
+ message: import("zod").ZodString;
24721
+ }, import("zod/v4/core").$strip>>;
24722
+ }, import("zod/v4/core").$strip>;
24723
+ };
24724
+ NOT_FOUND: {
24725
+ status: number;
24726
+ };
24727
+ TAKEN: {
24728
+ status: number;
24729
+ data: import("zod").ZodObject<{
24730
+ field: import("zod").ZodString;
24731
+ id: import("zod").ZodOptional<import("zod").ZodString>;
24732
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
24733
+ }, import("zod/v4/core").$strip>;
24734
+ };
24735
+ INVALID_CURSOR: {
24736
+ status: number;
24737
+ };
24738
+ INVALID_REFERENCE: {
24739
+ status: number;
24740
+ data: import("zod").ZodObject<{
24741
+ field: import("zod").ZodString;
24742
+ }, import("zod/v4/core").$strip>;
24743
+ };
24744
+ INVALID_FILTER: {
24745
+ status: number;
24746
+ };
24747
+ FILTER_TOO_SLOW: {
24748
+ status: number;
24749
+ };
24750
+ BEYOND_OWN_PERMISSIONS: {
24751
+ status: number;
24752
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
24753
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
24754
+ }, import("zod/v4/core").$strip>>;
24755
+ };
24756
+ BUILTIN_ROLE: {
24757
+ status: number;
24758
+ };
24759
+ FIXED_ROLE: {
24760
+ status: number;
24761
+ };
24762
+ LIMIT_EXCEEDED: {
24763
+ status: number;
24764
+ };
24765
+ OWNER_ONLY_PERMISSION: {
24766
+ status: number;
24767
+ data: import("zod").ZodObject<{
24768
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
24769
+ }, import("zod/v4/core").$strip>;
24770
+ };
24771
+ ROLE_IN_USE: {
24772
+ status: number;
24773
+ };
24774
+ ROLE_NOT_FOUND: {
24775
+ status: number;
24776
+ };
24777
+ UNKNOWN_PERMISSION: {
24778
+ status: number;
24779
+ data: import("zod").ZodObject<{
24780
+ permissions: import("zod").ZodArray<import("zod").ZodString>;
24781
+ }, import("zod/v4/core").$strip>;
24782
+ };
24783
+ }>>> & import("@orpc/tanstack-query").GeneralUtils<unknown>;
24492
24784
  create: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
24493
24785
  name: string;
24494
24786
  description?: string | null | undefined;
@@ -760,6 +760,14 @@ var routes_default = {
760
760
  }
761
761
  } }
762
762
  },
763
+ emails: { "send": { "~orpc": {
764
+ "errorMap": {},
765
+ "meta": {},
766
+ "route": {
767
+ "method": "POST",
768
+ "path": "/emails"
769
+ }
770
+ } } },
763
771
  events: {
764
772
  "publish": { "~orpc": {
765
773
  "errorMap": {},
@@ -1423,6 +1431,14 @@ var routes_default = {
1423
1431
  "path": "/permissions"
1424
1432
  }
1425
1433
  } },
1434
+ "permissionSets": { "~orpc": {
1435
+ "errorMap": {},
1436
+ "meta": {},
1437
+ "route": {
1438
+ "method": "GET",
1439
+ "path": "/permission-sets"
1440
+ }
1441
+ } },
1426
1442
  "create": { "~orpc": {
1427
1443
  "errorMap": {},
1428
1444
  "meta": {},
@@ -0,0 +1,105 @@
1
+ import { z } from "zod";
2
+ /** A plain message erxes emails for a plugin: a subject, paragraphs and an optional button. */
3
+ export declare const EmailMessage: z.ZodObject<{
4
+ to: z.ZodArray<z.ZodString>;
5
+ subject: z.ZodString;
6
+ body: z.ZodString;
7
+ replyTo: z.ZodOptional<z.ZodString>;
8
+ button: z.ZodOptional<z.ZodObject<{
9
+ label: z.ZodString;
10
+ link: z.ZodURL;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>;
13
+ export type EmailMessage = z.infer<typeof EmailMessage>;
14
+ export declare const emailsContract: {
15
+ send: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
16
+ to: z.ZodArray<z.ZodString>;
17
+ subject: z.ZodString;
18
+ body: z.ZodString;
19
+ replyTo: z.ZodOptional<z.ZodString>;
20
+ button: z.ZodOptional<z.ZodObject<{
21
+ label: z.ZodString;
22
+ link: z.ZodURL;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ queued: z.ZodInt;
26
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
27
+ UNAUTHORIZED: {
28
+ status: number;
29
+ };
30
+ NOT_ALLOWED: {
31
+ status: number;
32
+ data: z.ZodOptional<z.ZodObject<{
33
+ permission: z.ZodString;
34
+ }, z.core.$strip>>;
35
+ };
36
+ PLUGIN_ONLY: {
37
+ status: number;
38
+ };
39
+ MEMBERS_ONLY: {
40
+ status: number;
41
+ };
42
+ ORG_REQUIRED: {
43
+ status: number;
44
+ };
45
+ SCOPE_REQUIRED: {
46
+ status: number;
47
+ };
48
+ SERVICE_TOKEN_REQUIRED: {
49
+ status: number;
50
+ };
51
+ ORGANIZATION_DISABLED: {
52
+ status: number;
53
+ data: z.ZodObject<{
54
+ manageUrl: z.ZodNullable<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ };
57
+ NOT_IN_PLAN: {
58
+ status: number;
59
+ data: z.ZodOptional<z.ZodObject<{
60
+ manageUrl: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strip>>;
62
+ };
63
+ READ_ONLY: {
64
+ status: number;
65
+ };
66
+ TOO_MANY_REQUESTS: {
67
+ status: number;
68
+ };
69
+ INVALID_INPUT: {
70
+ status: number;
71
+ data: z.ZodObject<{
72
+ issues: z.ZodArray<z.ZodObject<{
73
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
74
+ message: z.ZodString;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>;
77
+ };
78
+ NOT_FOUND: {
79
+ status: number;
80
+ };
81
+ TAKEN: {
82
+ status: number;
83
+ data: z.ZodObject<{
84
+ field: z.ZodString;
85
+ id: z.ZodOptional<z.ZodString>;
86
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ }, z.core.$strip>;
88
+ };
89
+ INVALID_CURSOR: {
90
+ status: number;
91
+ };
92
+ INVALID_REFERENCE: {
93
+ status: number;
94
+ data: z.ZodObject<{
95
+ field: z.ZodString;
96
+ }, z.core.$strip>;
97
+ };
98
+ INVALID_FILTER: {
99
+ status: number;
100
+ };
101
+ FILTER_TOO_SLOW: {
102
+ status: number;
103
+ };
104
+ }>, Record<never, never>>;
105
+ };
package/dist/emails.js ADDED
@@ -0,0 +1,25 @@
1
+ import { COMMON_ERRORS } from "./errors.js";
2
+ import { oc } from "@orpc/contract";
3
+ import { z } from "zod";
4
+ // src/emails.ts
5
+ const Address = z.string().trim().check(z.email()).max(254);
6
+ /** A plain message erxes emails for a plugin: a subject, paragraphs and an optional button. */
7
+ const EmailMessage = z.object({
8
+ to: z.array(Address).min(1).max(50),
9
+ subject: z.string().trim().min(1).max(200),
10
+ /** Text; a blank line starts a new paragraph. */
11
+ body: z.string().trim().min(1).max(2e4),
12
+ /** Where replies go, such as the organisation's support inbox. */
13
+ replyTo: Address.optional(),
14
+ button: z.object({
15
+ label: z.string().trim().min(1).max(60),
16
+ link: z.url({ protocol: /^https$/ }).max(2e3)
17
+ }).optional()
18
+ });
19
+ const emailsContract = { send: oc.errors(COMMON_ERRORS).route({
20
+ method: "POST",
21
+ path: "/emails",
22
+ successStatus: 202,
23
+ summary: "Email up to 50 addresses from erxes's address (plugins with emails:write). Queued and retried; an address that fails doesn't stop the others"
24
+ }).input(EmailMessage).output(z.object({ queued: z.int() })) };
25
+ export { EmailMessage, emailsContract };
package/dist/errors.d.ts CHANGED
@@ -390,6 +390,9 @@ export declare const ERRORS: {
390
390
  permissions: z.ZodArray<z.ZodString>;
391
391
  }, z.core.$strip>;
392
392
  };
393
+ DUPLICATE_PERMISSION_SET: {
394
+ status: number;
395
+ };
393
396
  OWNER_ONLY_PERMISSION: {
394
397
  status: number;
395
398
  data: z.ZodObject<{
package/dist/errors.js CHANGED
@@ -174,6 +174,7 @@ const ERRORS = {
174
174
  status: 400,
175
175
  data: Permissions
176
176
  },
177
+ DUPLICATE_PERMISSION_SET: { status: 400 },
177
178
  OWNER_ONLY_PERMISSION: {
178
179
  status: 400,
179
180
  data: Permissions