@erxes/core-contract 0.1.0-v2.3 → 0.1.0-v2.5

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(),