@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.
- package/package.json +1 -1
- package/src/index.ts +7 -4
package/package.json
CHANGED
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
|
|
40
|
-
|
|
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(
|
|
93
|
-
extensions: z.array(
|
|
95
|
+
skills: z.array(packageRefString).optional(),
|
|
96
|
+
extensions: z.array(packageRefString).optional(),
|
|
94
97
|
}),
|
|
95
98
|
input: z
|
|
96
99
|
.object({
|