@appstrate/validation 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appstrate/validation",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
package/src/index.ts CHANGED
@@ -36,8 +36,11 @@ export const serviceRequirementSchema = z.looseObject({
36
36
  connectionMode: z.enum(["user", "admin"]).optional(),
37
37
  });
38
38
 
39
- const slugString = z.string().min(1).regex(SLUG_REGEX, {
40
- error: "Must be a valid slug (a-z, 0-9, hyphens, no leading/trailing hyphen)",
39
+ export const PACKAGE_REF_REGEX =
40
+ /^(?:@[a-z0-9]([a-z0-9-]*[a-z0-9])?\/)?[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
41
+
42
+ const packageRefString = z.string().min(1).regex(PACKAGE_REF_REGEX, {
43
+ error: "Must be a valid slug or scoped name (@scope/name)",
41
44
  });
42
45
 
43
46
  const semverRangeString = z.string().refine((val) => semver.validRange(val) !== null, {
@@ -89,8 +92,8 @@ export type FlowJsonSchemaObject = z.infer<typeof jsonSchemaObjectSchema>;
89
92
  const flowSharedFields = {
90
93
  requires: z.looseObject({
91
94
  services: z.array(serviceRequirementSchema),
92
- skills: z.array(slugString).optional(),
93
- extensions: z.array(slugString).optional(),
95
+ skills: z.array(packageRefString).optional(),
96
+ extensions: z.array(packageRefString).optional(),
94
97
  }),
95
98
  input: z
96
99
  .object({