@middlewr/contracts 0.0.52 → 0.0.53

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/cjs/index.js CHANGED
@@ -399,10 +399,21 @@ var EntryNodeSchema = import_zod6.z.object({
399
399
  type: import_zod6.z.literal("entry"),
400
400
  position: PositionSchema,
401
401
  next: import_zod6.z.string().nullable(),
402
- starts_at: import_zod6.z.string().nullable(),
403
- expires_at: import_zod6.z.string().nullable(),
402
+ starts_at: import_zod6.z.string().datetime({ offset: true }).nullable(),
403
+ expires_at: import_zod6.z.string().datetime({ offset: true }).nullable(),
404
404
  fallback_url: import_zod6.z.string().nullable()
405
- });
405
+ }).refine(
406
+ (data) => {
407
+ if (data.starts_at && data.expires_at) {
408
+ return new Date(data.starts_at) < new Date(data.expires_at);
409
+ }
410
+ return true;
411
+ },
412
+ {
413
+ message: "starts_at must be before expires_at",
414
+ path: ["expires_at"]
415
+ }
416
+ );
406
417
  var RuleGraphNodeSchema = import_zod6.z.discriminatedUnion("type", [
407
418
  ConditionNodeSchema,
408
419
  SplitNodeSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../src/rules.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6HxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAS9B,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC"}
1
+ {"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../src/rules.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0IxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAS9B,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -298,10 +298,21 @@ var EntryNodeSchema = z6.object({
298
298
  type: z6.literal("entry"),
299
299
  position: PositionSchema,
300
300
  next: z6.string().nullable(),
301
- starts_at: z6.string().nullable(),
302
- expires_at: z6.string().nullable(),
301
+ starts_at: z6.string().datetime({ offset: true }).nullable(),
302
+ expires_at: z6.string().datetime({ offset: true }).nullable(),
303
303
  fallback_url: z6.string().nullable()
304
- });
304
+ }).refine(
305
+ (data) => {
306
+ if (data.starts_at && data.expires_at) {
307
+ return new Date(data.starts_at) < new Date(data.expires_at);
308
+ }
309
+ return true;
310
+ },
311
+ {
312
+ message: "starts_at must be before expires_at",
313
+ path: ["expires_at"]
314
+ }
315
+ );
305
316
  var RuleGraphNodeSchema = z6.discriminatedUnion("type", [
306
317
  ConditionNodeSchema,
307
318
  SplitNodeSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../src/rules.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6HxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAS9B,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC"}
1
+ {"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../src/rules.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0IxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAS9B,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middlewr/contracts",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -113,15 +113,28 @@ const WebhookNodeSchema = z.object({
113
113
  next: z.string().nullable(),
114
114
  });
115
115
 
116
- const EntryNodeSchema = z.object({
117
- id: z.string(),
118
- type: z.literal('entry'),
119
- position: PositionSchema,
120
- next: z.string().nullable(),
121
- starts_at: z.string().nullable(),
122
- expires_at: z.string().nullable(),
123
- fallback_url: z.string().nullable(),
124
- });
116
+ const EntryNodeSchema = z
117
+ .object({
118
+ id: z.string(),
119
+ type: z.literal('entry'),
120
+ position: PositionSchema,
121
+ next: z.string().nullable(),
122
+ starts_at: z.string().datetime({ offset: true }).nullable(),
123
+ expires_at: z.string().datetime({ offset: true }).nullable(),
124
+ fallback_url: z.string().nullable(),
125
+ })
126
+ .refine(
127
+ (data) => {
128
+ if (data.starts_at && data.expires_at) {
129
+ return new Date(data.starts_at) < new Date(data.expires_at);
130
+ }
131
+ return true;
132
+ },
133
+ {
134
+ message: 'starts_at must be before expires_at',
135
+ path: ['expires_at'],
136
+ },
137
+ );
125
138
 
126
139
  export const RuleGraphNodeSchema = z.discriminatedUnion('type', [
127
140
  ConditionNodeSchema,