@thejob/schema 2.4.0 → 2.5.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.
package/dist/index.cjs CHANGED
@@ -3655,6 +3655,14 @@ var CampaignSchema = (0, import_yup33.object)({
3655
3655
  * state transition, so it belongs in the state.
3656
3656
  */
3657
3657
  dryRun: (0, import_yup33.boolean)().optional().default(true).label("Dry Run"),
3658
+ /**
3659
+ * Re-eligibility: when someone this campaign already mailed may get it again.
3660
+ *
3661
+ * Absent: on every run they match (job alerts, digests). `0`: once per
3662
+ * person. `N`: again only after N days. Opt-in, because most recurring
3663
+ * campaigns exist to mail the same people repeatedly.
3664
+ */
3665
+ resendAfterDays: (0, import_yup33.number)().integer().min(0).max(365).nullable().optional().default(void 0).label("Resend After (days)"),
3658
3666
  maxRecipients: (0, import_yup33.number)().integer().min(1).max(CAMPAIGN_MAX_RECIPIENTS_CEILING).optional().default(void 0).label("Max Recipients"),
3659
3667
  utm: (0, import_yup33.object)({
3660
3668
  campaign: (0, import_yup33.string)().optional().max(120).label("utm_campaign"),
@@ -4028,6 +4036,13 @@ var BillingSubscriptionSchema = (0, import_yup40.object)({
4028
4036
  currentPeriodEnd: (0, import_yup40.number)().optional().label("Current Period End"),
4029
4037
  /** Set when a cancellation is scheduled; access continues until the period ends. */
4030
4038
  canceledAt: (0, import_yup40.number)().optional().label("Canceled At"),
4039
+ /**
4040
+ * A downgrade booked for the end of the current period: the plan key it moves
4041
+ * to at renewal. Upgrades never set this; they apply immediately. Mirrored
4042
+ * from the Paddle subscription's own `customData`, so Paddle stays the source
4043
+ * of truth.
4044
+ */
4045
+ pendingPlanKey: (0, import_yup40.string)().optional().label("Pending Plan Key"),
4031
4046
  /** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
4032
4047
  lastEventAt: (0, import_yup40.number)().required().default(0).label("Last Event At"),
4033
4048
  createdAt: (0, import_yup40.number)().optional().label("Created At"),
package/dist/index.d.cts CHANGED
@@ -2859,6 +2859,7 @@ declare const CampaignSchema: yup.ObjectSchema<{
2859
2859
  };
2860
2860
  };
2861
2861
  dryRun: boolean;
2862
+ resendAfterDays: number | null | undefined;
2862
2863
  maxRecipients: number | undefined;
2863
2864
  utm: {
2864
2865
  campaign?: string | undefined;
@@ -2888,6 +2889,7 @@ declare const CampaignSchema: yup.ObjectSchema<{
2888
2889
  };
2889
2890
  };
2890
2891
  dryRun: true;
2892
+ resendAfterDays: undefined;
2891
2893
  maxRecipients: undefined;
2892
2894
  utm: undefined;
2893
2895
  }, "">;
@@ -3546,6 +3548,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
3546
3548
  currentPeriodStart: number | undefined;
3547
3549
  currentPeriodEnd: number | undefined;
3548
3550
  canceledAt: number | undefined;
3551
+ pendingPlanKey: string | undefined;
3549
3552
  lastEventAt: number;
3550
3553
  createdAt: number | undefined;
3551
3554
  updatedAt: number | undefined;
@@ -3559,6 +3562,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
3559
3562
  currentPeriodStart: undefined;
3560
3563
  currentPeriodEnd: undefined;
3561
3564
  canceledAt: undefined;
3565
+ pendingPlanKey: undefined;
3562
3566
  lastEventAt: 0;
3563
3567
  createdAt: undefined;
3564
3568
  updatedAt: undefined;
package/dist/index.d.ts CHANGED
@@ -2859,6 +2859,7 @@ declare const CampaignSchema: yup.ObjectSchema<{
2859
2859
  };
2860
2860
  };
2861
2861
  dryRun: boolean;
2862
+ resendAfterDays: number | null | undefined;
2862
2863
  maxRecipients: number | undefined;
2863
2864
  utm: {
2864
2865
  campaign?: string | undefined;
@@ -2888,6 +2889,7 @@ declare const CampaignSchema: yup.ObjectSchema<{
2888
2889
  };
2889
2890
  };
2890
2891
  dryRun: true;
2892
+ resendAfterDays: undefined;
2891
2893
  maxRecipients: undefined;
2892
2894
  utm: undefined;
2893
2895
  }, "">;
@@ -3546,6 +3548,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
3546
3548
  currentPeriodStart: number | undefined;
3547
3549
  currentPeriodEnd: number | undefined;
3548
3550
  canceledAt: number | undefined;
3551
+ pendingPlanKey: string | undefined;
3549
3552
  lastEventAt: number;
3550
3553
  createdAt: number | undefined;
3551
3554
  updatedAt: number | undefined;
@@ -3559,6 +3562,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
3559
3562
  currentPeriodStart: undefined;
3560
3563
  currentPeriodEnd: undefined;
3561
3564
  canceledAt: undefined;
3565
+ pendingPlanKey: undefined;
3562
3566
  lastEventAt: 0;
3563
3567
  createdAt: undefined;
3564
3568
  updatedAt: undefined;
package/dist/index.js CHANGED
@@ -3385,6 +3385,14 @@ var CampaignSchema = object31({
3385
3385
  * state transition, so it belongs in the state.
3386
3386
  */
3387
3387
  dryRun: boolean17().optional().default(true).label("Dry Run"),
3388
+ /**
3389
+ * Re-eligibility: when someone this campaign already mailed may get it again.
3390
+ *
3391
+ * Absent: on every run they match (job alerts, digests). `0`: once per
3392
+ * person. `N`: again only after N days. Opt-in, because most recurring
3393
+ * campaigns exist to mail the same people repeatedly.
3394
+ */
3395
+ resendAfterDays: number14().integer().min(0).max(365).nullable().optional().default(void 0).label("Resend After (days)"),
3388
3396
  maxRecipients: number14().integer().min(1).max(CAMPAIGN_MAX_RECIPIENTS_CEILING).optional().default(void 0).label("Max Recipients"),
3389
3397
  utm: object31({
3390
3398
  campaign: string22().optional().max(120).label("utm_campaign"),
@@ -3758,6 +3766,13 @@ var BillingSubscriptionSchema = object38({
3758
3766
  currentPeriodEnd: number17().optional().label("Current Period End"),
3759
3767
  /** Set when a cancellation is scheduled; access continues until the period ends. */
3760
3768
  canceledAt: number17().optional().label("Canceled At"),
3769
+ /**
3770
+ * A downgrade booked for the end of the current period: the plan key it moves
3771
+ * to at renewal. Upgrades never set this; they apply immediately. Mirrored
3772
+ * from the Paddle subscription's own `customData`, so Paddle stays the source
3773
+ * of truth.
3774
+ */
3775
+ pendingPlanKey: string27().optional().label("Pending Plan Key"),
3761
3776
  /** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
3762
3777
  lastEventAt: number17().required().default(0).label("Last Event At"),
3763
3778
  createdAt: number17().optional().label("Created At"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thejob/schema",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -207,6 +207,13 @@ export const BillingSubscriptionSchema = object({
207
207
  currentPeriodEnd: number().optional().label("Current Period End"),
208
208
  /** Set when a cancellation is scheduled; access continues until the period ends. */
209
209
  canceledAt: number().optional().label("Canceled At"),
210
+ /**
211
+ * A downgrade booked for the end of the current period: the plan key it moves
212
+ * to at renewal. Upgrades never set this; they apply immediately. Mirrored
213
+ * from the Paddle subscription's own `customData`, so Paddle stays the source
214
+ * of truth.
215
+ */
216
+ pendingPlanKey: string().optional().label("Pending Plan Key"),
210
217
  /** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
211
218
  lastEventAt: number().required().default(0).label("Last Event At"),
212
219
  createdAt: number().optional().label("Created At"),
@@ -300,6 +300,23 @@ export const CampaignSchema = object({
300
300
  * state transition, so it belongs in the state.
301
301
  */
302
302
  dryRun: boolean().optional().default(true).label("Dry Run"),
303
+ /**
304
+ * Re-eligibility: when someone this campaign already mailed may get it again.
305
+ *
306
+ * Absent: on every run they match (job alerts, digests). `0`: once per
307
+ * person. `N`: again only after N days. Opt-in, because most recurring
308
+ * campaigns exist to mail the same people repeatedly.
309
+ */
310
+ resendAfterDays: number()
311
+ .integer()
312
+ .min(0)
313
+ .max(365)
314
+ // `null` clears it back to "every run": a PATCH can only `$set`, and JSON
315
+ // has no `undefined` to send.
316
+ .nullable()
317
+ .optional()
318
+ .default(undefined)
319
+ .label("Resend After (days)"),
303
320
  maxRecipients: number()
304
321
  .integer()
305
322
  .min(1)