@dotbep/core 0.2.10 → 0.2.12

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.d.ts CHANGED
@@ -332,9 +332,15 @@ export declare const BEPSchema: z.ZodObject<{
332
332
  string: "string";
333
333
  number: "number";
334
334
  boolean: "boolean";
335
- url: "url";
336
335
  }>;
337
336
  required: z.ZodBoolean;
337
+ label: z.ZodOptional<z.ZodString>;
338
+ description: z.ZodOptional<z.ZodString>;
339
+ validation: z.ZodOptional<z.ZodObject<{
340
+ pattern: z.ZodString;
341
+ flags: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$strip>>;
343
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
338
344
  }, z.core.$strip>>>;
339
345
  }, z.core.$strip>>;
340
346
  effects: z.ZodArray<z.ZodObject<{
@@ -347,9 +353,15 @@ export declare const BEPSchema: z.ZodObject<{
347
353
  string: "string";
348
354
  number: "number";
349
355
  boolean: "boolean";
350
- url: "url";
351
356
  }>;
352
357
  required: z.ZodBoolean;
358
+ label: z.ZodOptional<z.ZodString>;
359
+ description: z.ZodOptional<z.ZodString>;
360
+ validation: z.ZodOptional<z.ZodObject<{
361
+ pattern: z.ZodString;
362
+ flags: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strip>>;
364
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
353
365
  }, z.core.$strip>>>;
354
366
  }, z.core.$strip>>;
355
367
  automations: z.ZodArray<z.ZodObject<{
@@ -362,9 +374,15 @@ export declare const BEPSchema: z.ZodObject<{
362
374
  string: "string";
363
375
  number: "number";
364
376
  boolean: "boolean";
365
- url: "url";
366
377
  }>;
367
378
  required: z.ZodBoolean;
379
+ label: z.ZodOptional<z.ZodString>;
380
+ description: z.ZodOptional<z.ZodString>;
381
+ validation: z.ZodOptional<z.ZodObject<{
382
+ pattern: z.ZodString;
383
+ flags: z.ZodOptional<z.ZodString>;
384
+ }, z.core.$strip>>;
385
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
368
386
  }, z.core.$strip>>>;
369
387
  output: z.ZodArray<z.ZodObject<{
370
388
  key: z.ZodString;
@@ -372,9 +390,15 @@ export declare const BEPSchema: z.ZodObject<{
372
390
  string: "string";
373
391
  number: "number";
374
392
  boolean: "boolean";
375
- url: "url";
376
393
  }>;
377
394
  required: z.ZodBoolean;
395
+ label: z.ZodOptional<z.ZodString>;
396
+ description: z.ZodOptional<z.ZodString>;
397
+ validation: z.ZodOptional<z.ZodObject<{
398
+ pattern: z.ZodString;
399
+ flags: z.ZodOptional<z.ZodString>;
400
+ }, z.core.$strip>>;
401
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
378
402
  }, z.core.$strip>>;
379
403
  }, z.core.$strip>>;
380
404
  env: z.ZodArray<z.ZodObject<{
@@ -1136,9 +1160,15 @@ export declare const FlowAutomationSchema: z.ZodObject<{
1136
1160
  string: "string";
1137
1161
  number: "number";
1138
1162
  boolean: "boolean";
1139
- url: "url";
1140
1163
  }>;
1141
1164
  required: z.ZodBoolean;
1165
+ label: z.ZodOptional<z.ZodString>;
1166
+ description: z.ZodOptional<z.ZodString>;
1167
+ validation: z.ZodOptional<z.ZodObject<{
1168
+ pattern: z.ZodString;
1169
+ flags: z.ZodOptional<z.ZodString>;
1170
+ }, z.core.$strip>>;
1171
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
1142
1172
  }, z.core.$strip>>>;
1143
1173
  output: z.ZodArray<z.ZodObject<{
1144
1174
  key: z.ZodString;
@@ -1146,9 +1176,15 @@ export declare const FlowAutomationSchema: z.ZodObject<{
1146
1176
  string: "string";
1147
1177
  number: "number";
1148
1178
  boolean: "boolean";
1149
- url: "url";
1150
1179
  }>;
1151
1180
  required: z.ZodBoolean;
1181
+ label: z.ZodOptional<z.ZodString>;
1182
+ description: z.ZodOptional<z.ZodString>;
1183
+ validation: z.ZodOptional<z.ZodObject<{
1184
+ pattern: z.ZodString;
1185
+ flags: z.ZodOptional<z.ZodString>;
1186
+ }, z.core.$strip>>;
1187
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
1152
1188
  }, z.core.$strip>>;
1153
1189
  }, z.core.$strip>;
1154
1190
 
@@ -1333,9 +1369,15 @@ export declare const FlowEffectSchema: z.ZodObject<{
1333
1369
  string: "string";
1334
1370
  number: "number";
1335
1371
  boolean: "boolean";
1336
- url: "url";
1337
1372
  }>;
1338
1373
  required: z.ZodBoolean;
1374
+ label: z.ZodOptional<z.ZodString>;
1375
+ description: z.ZodOptional<z.ZodString>;
1376
+ validation: z.ZodOptional<z.ZodObject<{
1377
+ pattern: z.ZodString;
1378
+ flags: z.ZodOptional<z.ZodString>;
1379
+ }, z.core.$strip>>;
1380
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
1339
1381
  }, z.core.$strip>>>;
1340
1382
  }, z.core.$strip>;
1341
1383
 
@@ -1356,9 +1398,15 @@ export declare const FlowEventSchema: z.ZodObject<{
1356
1398
  string: "string";
1357
1399
  number: "number";
1358
1400
  boolean: "boolean";
1359
- url: "url";
1360
1401
  }>;
1361
1402
  required: z.ZodBoolean;
1403
+ label: z.ZodOptional<z.ZodString>;
1404
+ description: z.ZodOptional<z.ZodString>;
1405
+ validation: z.ZodOptional<z.ZodObject<{
1406
+ pattern: z.ZodString;
1407
+ flags: z.ZodOptional<z.ZodString>;
1408
+ }, z.core.$strip>>;
1409
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
1362
1410
  }, z.core.$strip>>>;
1363
1411
  }, z.core.$strip>;
1364
1412
 
@@ -1423,9 +1471,15 @@ export declare const FlowPayloadFieldSchema: z.ZodObject<{
1423
1471
  string: "string";
1424
1472
  number: "number";
1425
1473
  boolean: "boolean";
1426
- url: "url";
1427
1474
  }>;
1428
1475
  required: z.ZodBoolean;
1476
+ label: z.ZodOptional<z.ZodString>;
1477
+ description: z.ZodOptional<z.ZodString>;
1478
+ validation: z.ZodOptional<z.ZodObject<{
1479
+ pattern: z.ZodString;
1480
+ flags: z.ZodOptional<z.ZodString>;
1481
+ }, z.core.$strip>>;
1482
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
1429
1483
  }, z.core.$strip>;
1430
1484
 
1431
1485
  export declare type FlowProcessNode = z.infer<typeof FlowProcessNodeSchema>;
@@ -2075,7 +2129,7 @@ export declare const ObjectiveSchema: z.ZodObject<{
2075
2129
 
2076
2130
  export declare interface PayloadFieldError {
2077
2131
  field: string;
2078
- reason: 'missing' | 'wrong_type' | 'unknown_field';
2132
+ reason: 'missing' | 'wrong_type' | 'unknown_field' | 'invalid_format';
2079
2133
  }
2080
2134
 
2081
2135
  export declare type Phase = z.infer<typeof PhaseSchema>;
package/dist/index.js CHANGED
@@ -125,8 +125,12 @@ const He = a.enum([
125
125
  guideIds: a.array(a.string()).optional().describe("ref Guide.id[]")
126
126
  }).describe("A human-performed activity referenced by workflow process nodes. Actions represent what a person in a given role does at a specific step."), L = a.object({
127
127
  key: a.string().min(1),
128
- type: a.enum(["string", "number", "boolean", "url"]),
129
- required: a.boolean()
128
+ type: a.enum(["string", "number", "boolean"]),
129
+ required: a.boolean(),
130
+ label: a.string().min(1).optional(),
131
+ description: a.string().optional(),
132
+ validation: a.object({ pattern: a.string().min(1), flags: a.string().optional() }).optional(),
133
+ options: a.array(a.string().min(1)).optional()
130
134
  }), $e = a.object({
131
135
  id: a.string().min(1).describe('Human-readable slug, e.g. "status-changed".'),
132
136
  name: a.string().min(1),
@@ -2499,7 +2503,13 @@ function As(s, e, t) {
2499
2503
  d.required && o.push({ field: d.key, reason: "missing" });
2500
2504
  else {
2501
2505
  const c = js[d.type];
2502
- c && typeof l !== c && o.push({ field: d.key, reason: "wrong_type" });
2506
+ if (c && typeof l !== c)
2507
+ o.push({ field: d.key, reason: "wrong_type" });
2508
+ else if (d.type === "string" && d.validation)
2509
+ try {
2510
+ new RegExp(d.validation.pattern, d.validation.flags).test(l) || o.push({ field: d.key, reason: "invalid_format" });
2511
+ } catch {
2512
+ }
2503
2513
  }
2504
2514
  }
2505
2515
  const r = new Set(n.payload.map((d) => d.key));
@@ -3176,7 +3186,7 @@ ${n.join(`
3176
3186
  * writeFileSync('bep.d.ts', bep.generateRuntimeTypes())
3177
3187
  */
3178
3188
  generateRuntimeTypes() {
3179
- const e = (f) => f === "url" ? "string" : f, t = (f) => ` /** ${f} */
3189
+ const e = (f) => f, t = (f) => ` /** ${f} */
3180
3190
  `, n = (f) => `{ ${f.map((m) => `${m.key}${m.required ? "" : "?"}: ${e(m.type)}`).join("; ")} }`, o = (f) => !f.payload || f.payload.length === 0 ? "() => void" : `(payload: ${n(f.payload)}) => void`, i = (f) => {
3181
3191
  const m = f.payload && f.payload.length > 0 ? `payload: ${n(f.payload)}` : "", p = f.output.length === 0 ? "{ eventId: string }" : `{ eventId: string; ${f.output.map((g) => `${g.key}${g.required ? "" : "?"}: ${e(g.type)}`).join("; ")} }`;
3182
3192
  return `(${m}) => ${p}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotbep/core",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",