@middlewr/contracts 0.0.52 → 0.0.54

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
@@ -387,9 +387,7 @@ var WebhookNodeSchema = import_zod6.z.object({
387
387
  id: import_zod6.z.string(),
388
388
  type: import_zod6.z.literal("webhook"),
389
389
  position: PositionSchema,
390
- url: import_zod6.z.string().url().refine((u) => u.startsWith("https://") || u.startsWith("http://"), {
391
- message: "Webhook URL must use http or https protocol"
392
- }),
390
+ url: import_zod6.z.string().url(),
393
391
  method: import_zod6.z.enum(["POST", "GET"]),
394
392
  headers: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string().regex(/^[^\r\n]*$/, "Header value must not contain newlines")).optional(),
395
393
  next: import_zod6.z.string().nullable()
@@ -399,10 +397,21 @@ var EntryNodeSchema = import_zod6.z.object({
399
397
  type: import_zod6.z.literal("entry"),
400
398
  position: PositionSchema,
401
399
  next: import_zod6.z.string().nullable(),
402
- starts_at: import_zod6.z.string().nullable(),
403
- expires_at: import_zod6.z.string().nullable(),
400
+ starts_at: import_zod6.z.string().datetime({ offset: true }).nullable(),
401
+ expires_at: import_zod6.z.string().datetime({ offset: true }).nullable(),
404
402
  fallback_url: import_zod6.z.string().nullable()
405
- });
403
+ }).refine(
404
+ (data) => {
405
+ if (data.starts_at && data.expires_at) {
406
+ return new Date(data.starts_at) < new Date(data.expires_at);
407
+ }
408
+ return true;
409
+ },
410
+ {
411
+ message: "starts_at must be before expires_at",
412
+ path: ["expires_at"]
413
+ }
414
+ );
406
415
  var RuleGraphNodeSchema = import_zod6.z.discriminatedUnion("type", [
407
416
  ConditionNodeSchema,
408
417
  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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@ var WebhookNodeSchema = z6.object({
286
286
  id: z6.string(),
287
287
  type: z6.literal("webhook"),
288
288
  position: PositionSchema,
289
- url: z6.string().url().refine((u) => u.startsWith("https://") || u.startsWith("http://"), {
290
- message: "Webhook URL must use http or https protocol"
291
- }),
289
+ url: z6.string().url(),
292
290
  method: z6.enum(["POST", "GET"]),
293
291
  headers: z6.record(z6.string(), z6.string().regex(/^[^\r\n]*$/, "Header value must not contain newlines")).optional(),
294
292
  next: z6.string().nullable()
@@ -298,10 +296,21 @@ var EntryNodeSchema = z6.object({
298
296
  type: z6.literal("entry"),
299
297
  position: PositionSchema,
300
298
  next: z6.string().nullable(),
301
- starts_at: z6.string().nullable(),
302
- expires_at: z6.string().nullable(),
299
+ starts_at: z6.string().datetime({ offset: true }).nullable(),
300
+ expires_at: z6.string().datetime({ offset: true }).nullable(),
303
301
  fallback_url: z6.string().nullable()
304
- });
302
+ }).refine(
303
+ (data) => {
304
+ if (data.starts_at && data.expires_at) {
305
+ return new Date(data.starts_at) < new Date(data.expires_at);
306
+ }
307
+ return true;
308
+ },
309
+ {
310
+ message: "starts_at must be before expires_at",
311
+ path: ["expires_at"]
312
+ }
313
+ );
305
314
  var RuleGraphNodeSchema = z6.discriminatedUnion("type", [
306
315
  ConditionNodeSchema,
307
316
  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;AAqIxB,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.54",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -102,26 +102,34 @@ const WebhookNodeSchema = z.object({
102
102
  id: z.string(),
103
103
  type: z.literal('webhook'),
104
104
  position: PositionSchema,
105
- url: z
106
- .string()
107
- .url()
108
- .refine((u) => u.startsWith('https://') || u.startsWith('http://'), {
109
- message: 'Webhook URL must use http or https protocol',
110
- }),
105
+ url: z.string().url(),
111
106
  method: z.enum(['POST', 'GET']),
112
107
  headers: z.record(z.string(), z.string().regex(/^[^\r\n]*$/, 'Header value must not contain newlines')).optional(),
113
108
  next: z.string().nullable(),
114
109
  });
115
110
 
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
- });
111
+ const EntryNodeSchema = z
112
+ .object({
113
+ id: z.string(),
114
+ type: z.literal('entry'),
115
+ position: PositionSchema,
116
+ next: z.string().nullable(),
117
+ starts_at: z.string().datetime({ offset: true }).nullable(),
118
+ expires_at: z.string().datetime({ offset: true }).nullable(),
119
+ fallback_url: z.string().nullable(),
120
+ })
121
+ .refine(
122
+ (data) => {
123
+ if (data.starts_at && data.expires_at) {
124
+ return new Date(data.starts_at) < new Date(data.expires_at);
125
+ }
126
+ return true;
127
+ },
128
+ {
129
+ message: 'starts_at must be before expires_at',
130
+ path: ['expires_at'],
131
+ },
132
+ );
125
133
 
126
134
  export const RuleGraphNodeSchema = z.discriminatedUnion('type', [
127
135
  ConditionNodeSchema,