@eventvisor/core 0.0.2
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/LICENSE +21 -0
- package/README.md +9 -0
- package/jest.config.js +4 -0
- package/lib/builder/buildProject.d.ts +21 -0
- package/lib/builder/buildProject.js +153 -0
- package/lib/builder/buildProject.js.map +1 -0
- package/lib/builder/hashes.d.ts +2 -0
- package/lib/builder/hashes.js +59 -0
- package/lib/builder/hashes.js.map +1 -0
- package/lib/builder/index.d.ts +1 -0
- package/lib/builder/index.js +18 -0
- package/lib/builder/index.js.map +1 -0
- package/lib/cli/cli.d.ts +26 -0
- package/lib/cli/cli.js +69 -0
- package/lib/cli/cli.js.map +1 -0
- package/lib/cli/index.d.ts +1 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/plugins.d.ts +4 -0
- package/lib/cli/plugins.js +12 -0
- package/lib/cli/plugins.js.map +1 -0
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.js +19 -0
- package/lib/config/index.js.map +1 -0
- package/lib/config/parsers.d.ts +15 -0
- package/lib/config/parsers.js +65 -0
- package/lib/config/parsers.js.map +1 -0
- package/lib/config/projectConfig.d.ts +42 -0
- package/lib/config/projectConfig.js +137 -0
- package/lib/config/projectConfig.js.map +1 -0
- package/lib/datasource/adapter.d.ts +16 -0
- package/lib/datasource/adapter.js +7 -0
- package/lib/datasource/adapter.js.map +1 -0
- package/lib/datasource/datasource.d.ts +48 -0
- package/lib/datasource/datasource.js +117 -0
- package/lib/datasource/datasource.js.map +1 -0
- package/lib/datasource/filesystemAdapter.d.ts +29 -0
- package/lib/datasource/filesystemAdapter.js +192 -0
- package/lib/datasource/filesystemAdapter.js.map +1 -0
- package/lib/datasource/index.d.ts +3 -0
- package/lib/datasource/index.js +20 -0
- package/lib/datasource/index.js.map +1 -0
- package/lib/dependencies.d.ts +11 -0
- package/lib/dependencies.js +3 -0
- package/lib/dependencies.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/index.spec.d.ts +0 -0
- package/lib/index.spec.js +6 -0
- package/lib/index.spec.js.map +1 -0
- package/lib/init/index.d.ts +8 -0
- package/lib/init/index.js +90 -0
- package/lib/init/index.js.map +1 -0
- package/lib/linter/attributeSchema.d.ts +5 -0
- package/lib/linter/attributeSchema.js +55 -0
- package/lib/linter/attributeSchema.js.map +1 -0
- package/lib/linter/conditionsSchema.d.ts +303 -0
- package/lib/linter/conditionsSchema.js +106 -0
- package/lib/linter/conditionsSchema.js.map +1 -0
- package/lib/linter/destinationSchema.d.ts +5 -0
- package/lib/linter/destinationSchema.js +57 -0
- package/lib/linter/destinationSchema.js.map +1 -0
- package/lib/linter/effectSchema.d.ts +1257 -0
- package/lib/linter/effectSchema.js +77 -0
- package/lib/linter/effectSchema.js.map +1 -0
- package/lib/linter/eventSchema.d.ts +5 -0
- package/lib/linter/eventSchema.js +70 -0
- package/lib/linter/eventSchema.js.map +1 -0
- package/lib/linter/index.d.ts +1 -0
- package/lib/linter/index.js +18 -0
- package/lib/linter/index.js.map +1 -0
- package/lib/linter/jsonSchema.d.ts +25 -0
- package/lib/linter/jsonSchema.js +487 -0
- package/lib/linter/jsonSchema.js.map +1 -0
- package/lib/linter/jsonSchema.spec.d.ts +1 -0
- package/lib/linter/jsonSchema.spec.js +875 -0
- package/lib/linter/jsonSchema.spec.js.map +1 -0
- package/lib/linter/lintProject.d.ts +2 -0
- package/lib/linter/lintProject.js +141 -0
- package/lib/linter/lintProject.js.map +1 -0
- package/lib/linter/persistSchema.d.ts +609 -0
- package/lib/linter/persistSchema.js +52 -0
- package/lib/linter/persistSchema.js.map +1 -0
- package/lib/linter/printError.d.ts +9 -0
- package/lib/linter/printError.js +75 -0
- package/lib/linter/printError.js.map +1 -0
- package/lib/linter/sampleSchema.d.ts +331 -0
- package/lib/linter/sampleSchema.js +70 -0
- package/lib/linter/sampleSchema.js.map +1 -0
- package/lib/linter/sourceSchema.d.ts +11 -0
- package/lib/linter/sourceSchema.js +73 -0
- package/lib/linter/sourceSchema.js.map +1 -0
- package/lib/linter/tagsSchema.d.ts +3 -0
- package/lib/linter/tagsSchema.js +44 -0
- package/lib/linter/tagsSchema.js.map +1 -0
- package/lib/linter/testSchema.d.ts +5 -0
- package/lib/linter/testSchema.js +44 -0
- package/lib/linter/testSchema.js.map +1 -0
- package/lib/linter/transformsSchema.d.ts +29 -0
- package/lib/linter/transformsSchema.js +66 -0
- package/lib/linter/transformsSchema.js.map +1 -0
- package/lib/tester/createTestInstance.d.ts +16 -0
- package/lib/tester/createTestInstance.js +158 -0
- package/lib/tester/createTestInstance.js.map +1 -0
- package/lib/tester/executeTest.d.ts +24 -0
- package/lib/tester/executeTest.js +305 -0
- package/lib/tester/executeTest.js.map +1 -0
- package/lib/tester/index.d.ts +1 -0
- package/lib/tester/index.js +18 -0
- package/lib/tester/index.js.map +1 -0
- package/lib/tester/printTestResult.d.ts +10 -0
- package/lib/tester/printTestResult.js +80 -0
- package/lib/tester/printTestResult.js.map +1 -0
- package/lib/tester/testProject.d.ts +12 -0
- package/lib/tester/testProject.js +93 -0
- package/lib/tester/testProject.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +18 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/prettyDuration.d.ts +1 -0
- package/lib/utils/prettyDuration.js +27 -0
- package/lib/utils/prettyDuration.js.map +1 -0
- package/package.json +42 -0
- package/src/builder/buildProject.ts +222 -0
- package/src/builder/hashes.ts +30 -0
- package/src/builder/index.ts +1 -0
- package/src/cli/cli.ts +110 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/plugins.ts +13 -0
- package/src/config/index.ts +2 -0
- package/src/config/parsers.ts +40 -0
- package/src/config/projectConfig.ts +158 -0
- package/src/datasource/adapter.ts +23 -0
- package/src/datasource/datasource.ts +164 -0
- package/src/datasource/filesystemAdapter.ts +206 -0
- package/src/datasource/index.ts +3 -0
- package/src/dependencies.ts +13 -0
- package/src/index.spec.ts +5 -0
- package/src/index.ts +4 -0
- package/src/init/index.ts +65 -0
- package/src/linter/attributeSchema.ts +23 -0
- package/src/linter/conditionsSchema.ts +89 -0
- package/src/linter/destinationSchema.ts +25 -0
- package/src/linter/effectSchema.ts +49 -0
- package/src/linter/eventSchema.ts +40 -0
- package/src/linter/index.ts +1 -0
- package/src/linter/jsonSchema.spec.ts +934 -0
- package/src/linter/jsonSchema.ts +533 -0
- package/src/linter/lintProject.ts +182 -0
- package/src/linter/persistSchema.ts +21 -0
- package/src/linter/printError.ts +50 -0
- package/src/linter/sampleSchema.ts +45 -0
- package/src/linter/sourceSchema.ts +42 -0
- package/src/linter/tagsSchema.ts +12 -0
- package/src/linter/testSchema.ts +9 -0
- package/src/linter/transformsSchema.ts +35 -0
- package/src/tester/createTestInstance.ts +209 -0
- package/src/tester/executeTest.ts +436 -0
- package/src/tester/index.ts +1 -0
- package/src/tester/printTestResult.ts +60 -0
- package/src/tester/testProject.ts +129 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/prettyDuration.ts +27 -0
- package/tsconfig.cjs.json +11 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ProjectConfig } from "../config";
|
|
3
|
+
export interface PrintErrorOptions {
|
|
4
|
+
entityType: string;
|
|
5
|
+
entityKey: string;
|
|
6
|
+
error: z.ZodError;
|
|
7
|
+
projectConfig: ProjectConfig;
|
|
8
|
+
}
|
|
9
|
+
export declare function printError(options: PrintErrorOptions): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.printError = printError;
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const z = __importStar(require("zod"));
|
|
42
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
+
function getFilePath(options) {
|
|
44
|
+
const { entityType, entityKey, projectConfig } = options;
|
|
45
|
+
const extension = projectConfig.parser.extension;
|
|
46
|
+
let directoryPath = "";
|
|
47
|
+
if (entityType === "event") {
|
|
48
|
+
directoryPath = projectConfig.eventsDirectoryPath;
|
|
49
|
+
}
|
|
50
|
+
else if (entityType === "attribute") {
|
|
51
|
+
directoryPath = projectConfig.attributesDirectoryPath;
|
|
52
|
+
}
|
|
53
|
+
else if (entityType === "destination") {
|
|
54
|
+
}
|
|
55
|
+
else if (entityType === "test") {
|
|
56
|
+
directoryPath = projectConfig.testsDirectoryPath;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new Error(`Unknown entity type: ${entityType}`);
|
|
60
|
+
}
|
|
61
|
+
return path.join(directoryPath, entityKey + "." + extension);
|
|
62
|
+
}
|
|
63
|
+
function prefixLines(str, prefix) {
|
|
64
|
+
return str
|
|
65
|
+
.split("\n")
|
|
66
|
+
.map((line) => prefix + line)
|
|
67
|
+
.join("\n");
|
|
68
|
+
}
|
|
69
|
+
function printError(options) {
|
|
70
|
+
const { error } = options;
|
|
71
|
+
console.log("\n");
|
|
72
|
+
console.log(chalk_1.default.bold.red.underline(getFilePath(options)));
|
|
73
|
+
console.log(prefixLines(z.prettifyError(error), " "));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=printError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printError.js","sourceRoot":"","sources":["../../src/linter/printError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,gCAQC;AAjDD,2CAA6B;AAE7B,uCAAyB;AACzB,kDAA0B;AAW1B,SAAS,WAAW,CAAC,OAA0B;IAC7C,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAEzD,MAAM,SAAS,GAAI,aAAa,CAAC,MAAuB,CAAC,SAAS,CAAC;IAEnE,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,aAAa,GAAG,aAAa,CAAC,mBAAmB,CAAC;IACpD,CAAC;SAAM,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QACtC,aAAa,GAAG,aAAa,CAAC,uBAAuB,CAAC;IACxD,CAAC;SAAM,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;IAC1C,CAAC;SAAM,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QACjC,aAAa,GAAG,aAAa,CAAC,kBAAkB,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,GAAG,GAAG,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,MAAc;IAC9C,OAAO,GAAG;SACP,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;SAC5B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAgB,UAAU,CAAC,OAA0B;IACnD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAElB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Dependencies } from "../dependencies";
|
|
3
|
+
export declare function getSampleSchema(deps: Dependencies): z.ZodObject<{
|
|
4
|
+
by: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
5
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
6
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
8
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
10
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
11
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
12
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
13
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
14
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
15
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
16
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
17
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
18
|
+
}, z.core.$strip>]>>, z.ZodObject<{
|
|
19
|
+
or: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
20
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
21
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
22
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
23
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
24
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
25
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
26
|
+
}, z.core.$strip>]>>;
|
|
27
|
+
}, z.core.$strip>]>;
|
|
28
|
+
conditions: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
29
|
+
operator: z.ZodEnum<{
|
|
30
|
+
includes: "includes";
|
|
31
|
+
endsWith: "endsWith";
|
|
32
|
+
startsWith: "startsWith";
|
|
33
|
+
matches: "matches";
|
|
34
|
+
contains: "contains";
|
|
35
|
+
after: "after";
|
|
36
|
+
before: "before";
|
|
37
|
+
equals: "equals";
|
|
38
|
+
notEquals: "notEquals";
|
|
39
|
+
exists: "exists";
|
|
40
|
+
notExists: "notExists";
|
|
41
|
+
greaterThan: "greaterThan";
|
|
42
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
43
|
+
lessThan: "lessThan";
|
|
44
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
45
|
+
notContains: "notContains";
|
|
46
|
+
semverEquals: "semverEquals";
|
|
47
|
+
semverNotEquals: "semverNotEquals";
|
|
48
|
+
semverGreaterThan: "semverGreaterThan";
|
|
49
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
50
|
+
semverLessThan: "semverLessThan";
|
|
51
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
52
|
+
notIncludes: "notIncludes";
|
|
53
|
+
notMatches: "notMatches";
|
|
54
|
+
in: "in";
|
|
55
|
+
notIn: "notIn";
|
|
56
|
+
}>;
|
|
57
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
58
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
59
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
60
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
61
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
62
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
63
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
and: z.ZodArray<z.ZodObject<{
|
|
66
|
+
operator: z.ZodEnum<{
|
|
67
|
+
includes: "includes";
|
|
68
|
+
endsWith: "endsWith";
|
|
69
|
+
startsWith: "startsWith";
|
|
70
|
+
matches: "matches";
|
|
71
|
+
contains: "contains";
|
|
72
|
+
after: "after";
|
|
73
|
+
before: "before";
|
|
74
|
+
equals: "equals";
|
|
75
|
+
notEquals: "notEquals";
|
|
76
|
+
exists: "exists";
|
|
77
|
+
notExists: "notExists";
|
|
78
|
+
greaterThan: "greaterThan";
|
|
79
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
80
|
+
lessThan: "lessThan";
|
|
81
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
82
|
+
notContains: "notContains";
|
|
83
|
+
semverEquals: "semverEquals";
|
|
84
|
+
semverNotEquals: "semverNotEquals";
|
|
85
|
+
semverGreaterThan: "semverGreaterThan";
|
|
86
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
87
|
+
semverLessThan: "semverLessThan";
|
|
88
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
89
|
+
notIncludes: "notIncludes";
|
|
90
|
+
notMatches: "notMatches";
|
|
91
|
+
in: "in";
|
|
92
|
+
notIn: "notIn";
|
|
93
|
+
}>;
|
|
94
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
95
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
96
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
97
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
98
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
99
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
100
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
or: z.ZodArray<z.ZodObject<{
|
|
104
|
+
operator: z.ZodEnum<{
|
|
105
|
+
includes: "includes";
|
|
106
|
+
endsWith: "endsWith";
|
|
107
|
+
startsWith: "startsWith";
|
|
108
|
+
matches: "matches";
|
|
109
|
+
contains: "contains";
|
|
110
|
+
after: "after";
|
|
111
|
+
before: "before";
|
|
112
|
+
equals: "equals";
|
|
113
|
+
notEquals: "notEquals";
|
|
114
|
+
exists: "exists";
|
|
115
|
+
notExists: "notExists";
|
|
116
|
+
greaterThan: "greaterThan";
|
|
117
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
118
|
+
lessThan: "lessThan";
|
|
119
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
120
|
+
notContains: "notContains";
|
|
121
|
+
semverEquals: "semverEquals";
|
|
122
|
+
semverNotEquals: "semverNotEquals";
|
|
123
|
+
semverGreaterThan: "semverGreaterThan";
|
|
124
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
125
|
+
semverLessThan: "semverLessThan";
|
|
126
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
127
|
+
notIncludes: "notIncludes";
|
|
128
|
+
notMatches: "notMatches";
|
|
129
|
+
in: "in";
|
|
130
|
+
notIn: "notIn";
|
|
131
|
+
}>;
|
|
132
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
133
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
134
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
135
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
136
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
137
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
138
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
139
|
+
}, z.core.$strip>>;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
not: z.ZodArray<z.ZodObject<{
|
|
142
|
+
operator: z.ZodEnum<{
|
|
143
|
+
includes: "includes";
|
|
144
|
+
endsWith: "endsWith";
|
|
145
|
+
startsWith: "startsWith";
|
|
146
|
+
matches: "matches";
|
|
147
|
+
contains: "contains";
|
|
148
|
+
after: "after";
|
|
149
|
+
before: "before";
|
|
150
|
+
equals: "equals";
|
|
151
|
+
notEquals: "notEquals";
|
|
152
|
+
exists: "exists";
|
|
153
|
+
notExists: "notExists";
|
|
154
|
+
greaterThan: "greaterThan";
|
|
155
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
156
|
+
lessThan: "lessThan";
|
|
157
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
158
|
+
notContains: "notContains";
|
|
159
|
+
semverEquals: "semverEquals";
|
|
160
|
+
semverNotEquals: "semverNotEquals";
|
|
161
|
+
semverGreaterThan: "semverGreaterThan";
|
|
162
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
163
|
+
semverLessThan: "semverLessThan";
|
|
164
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
165
|
+
notIncludes: "notIncludes";
|
|
166
|
+
notMatches: "notMatches";
|
|
167
|
+
in: "in";
|
|
168
|
+
notIn: "notIn";
|
|
169
|
+
}>;
|
|
170
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
171
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
172
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
173
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
174
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
175
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
176
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
179
|
+
operator: z.ZodEnum<{
|
|
180
|
+
includes: "includes";
|
|
181
|
+
endsWith: "endsWith";
|
|
182
|
+
startsWith: "startsWith";
|
|
183
|
+
matches: "matches";
|
|
184
|
+
contains: "contains";
|
|
185
|
+
after: "after";
|
|
186
|
+
before: "before";
|
|
187
|
+
equals: "equals";
|
|
188
|
+
notEquals: "notEquals";
|
|
189
|
+
exists: "exists";
|
|
190
|
+
notExists: "notExists";
|
|
191
|
+
greaterThan: "greaterThan";
|
|
192
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
193
|
+
lessThan: "lessThan";
|
|
194
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
195
|
+
notContains: "notContains";
|
|
196
|
+
semverEquals: "semverEquals";
|
|
197
|
+
semverNotEquals: "semverNotEquals";
|
|
198
|
+
semverGreaterThan: "semverGreaterThan";
|
|
199
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
200
|
+
semverLessThan: "semverLessThan";
|
|
201
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
202
|
+
notIncludes: "notIncludes";
|
|
203
|
+
notMatches: "notMatches";
|
|
204
|
+
in: "in";
|
|
205
|
+
notIn: "notIn";
|
|
206
|
+
}>;
|
|
207
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
208
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
209
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
210
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
211
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
212
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
213
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
and: z.ZodArray<z.ZodObject<{
|
|
216
|
+
operator: z.ZodEnum<{
|
|
217
|
+
includes: "includes";
|
|
218
|
+
endsWith: "endsWith";
|
|
219
|
+
startsWith: "startsWith";
|
|
220
|
+
matches: "matches";
|
|
221
|
+
contains: "contains";
|
|
222
|
+
after: "after";
|
|
223
|
+
before: "before";
|
|
224
|
+
equals: "equals";
|
|
225
|
+
notEquals: "notEquals";
|
|
226
|
+
exists: "exists";
|
|
227
|
+
notExists: "notExists";
|
|
228
|
+
greaterThan: "greaterThan";
|
|
229
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
230
|
+
lessThan: "lessThan";
|
|
231
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
232
|
+
notContains: "notContains";
|
|
233
|
+
semverEquals: "semverEquals";
|
|
234
|
+
semverNotEquals: "semverNotEquals";
|
|
235
|
+
semverGreaterThan: "semverGreaterThan";
|
|
236
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
237
|
+
semverLessThan: "semverLessThan";
|
|
238
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
239
|
+
notIncludes: "notIncludes";
|
|
240
|
+
notMatches: "notMatches";
|
|
241
|
+
in: "in";
|
|
242
|
+
notIn: "notIn";
|
|
243
|
+
}>;
|
|
244
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
245
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
246
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
247
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
248
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
249
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
250
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
+
or: z.ZodArray<z.ZodObject<{
|
|
254
|
+
operator: z.ZodEnum<{
|
|
255
|
+
includes: "includes";
|
|
256
|
+
endsWith: "endsWith";
|
|
257
|
+
startsWith: "startsWith";
|
|
258
|
+
matches: "matches";
|
|
259
|
+
contains: "contains";
|
|
260
|
+
after: "after";
|
|
261
|
+
before: "before";
|
|
262
|
+
equals: "equals";
|
|
263
|
+
notEquals: "notEquals";
|
|
264
|
+
exists: "exists";
|
|
265
|
+
notExists: "notExists";
|
|
266
|
+
greaterThan: "greaterThan";
|
|
267
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
268
|
+
lessThan: "lessThan";
|
|
269
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
270
|
+
notContains: "notContains";
|
|
271
|
+
semverEquals: "semverEquals";
|
|
272
|
+
semverNotEquals: "semverNotEquals";
|
|
273
|
+
semverGreaterThan: "semverGreaterThan";
|
|
274
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
275
|
+
semverLessThan: "semverLessThan";
|
|
276
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
277
|
+
notIncludes: "notIncludes";
|
|
278
|
+
notMatches: "notMatches";
|
|
279
|
+
in: "in";
|
|
280
|
+
notIn: "notIn";
|
|
281
|
+
}>;
|
|
282
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
283
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
284
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
285
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
286
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
287
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
288
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
289
|
+
}, z.core.$strip>>;
|
|
290
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
291
|
+
not: z.ZodArray<z.ZodObject<{
|
|
292
|
+
operator: z.ZodEnum<{
|
|
293
|
+
includes: "includes";
|
|
294
|
+
endsWith: "endsWith";
|
|
295
|
+
startsWith: "startsWith";
|
|
296
|
+
matches: "matches";
|
|
297
|
+
contains: "contains";
|
|
298
|
+
after: "after";
|
|
299
|
+
before: "before";
|
|
300
|
+
equals: "equals";
|
|
301
|
+
notEquals: "notEquals";
|
|
302
|
+
exists: "exists";
|
|
303
|
+
notExists: "notExists";
|
|
304
|
+
greaterThan: "greaterThan";
|
|
305
|
+
greaterThanOrEquals: "greaterThanOrEquals";
|
|
306
|
+
lessThan: "lessThan";
|
|
307
|
+
lessThanOrEquals: "lessThanOrEquals";
|
|
308
|
+
notContains: "notContains";
|
|
309
|
+
semverEquals: "semverEquals";
|
|
310
|
+
semverNotEquals: "semverNotEquals";
|
|
311
|
+
semverGreaterThan: "semverGreaterThan";
|
|
312
|
+
semverGreaterThanOrEquals: "semverGreaterThanOrEquals";
|
|
313
|
+
semverLessThan: "semverLessThan";
|
|
314
|
+
semverLessThanOrEquals: "semverLessThanOrEquals";
|
|
315
|
+
notIncludes: "notIncludes";
|
|
316
|
+
notMatches: "notMatches";
|
|
317
|
+
in: "in";
|
|
318
|
+
notIn: "notIn";
|
|
319
|
+
}>;
|
|
320
|
+
value: z.ZodOptional<z.ZodAny>;
|
|
321
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
322
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
323
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
324
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
325
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
326
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
327
|
+
}, z.core.$strip>>;
|
|
328
|
+
}, z.core.$strip>]>>]>>;
|
|
329
|
+
percentage: z.ZodOptional<z.ZodNumber>;
|
|
330
|
+
range: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
331
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getSampleSchema = getSampleSchema;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const sourceSchema_1 = require("./sourceSchema");
|
|
39
|
+
const conditionsSchema_1 = require("./conditionsSchema");
|
|
40
|
+
function getSampleSchema(deps) {
|
|
41
|
+
const sampleByString = z.string();
|
|
42
|
+
const sampleBySource = (0, sourceSchema_1.getSourceBaseSchema)(deps).refine(...(0, sourceSchema_1.getSourceBaseRefine)());
|
|
43
|
+
const sampleBySingle = z.union([sampleByString, sampleBySource]);
|
|
44
|
+
const sampleByMultiple = z.array(sampleBySingle);
|
|
45
|
+
const sampleByOr = z.object({ or: sampleByMultiple });
|
|
46
|
+
const sampleBy = z.union([sampleBySingle, sampleByMultiple, sampleByOr]);
|
|
47
|
+
return z
|
|
48
|
+
.object({
|
|
49
|
+
by: sampleBy,
|
|
50
|
+
conditions: (0, conditionsSchema_1.getConditionsSchema)(deps).optional(),
|
|
51
|
+
// one of them below is required
|
|
52
|
+
percentage: z.number().min(0).max(100).optional(),
|
|
53
|
+
range: z.array(z.number().min(0).max(100)).min(2).max(2).optional(),
|
|
54
|
+
})
|
|
55
|
+
.refine((data) => {
|
|
56
|
+
// both missing
|
|
57
|
+
if (data.percentage === undefined && data.range === undefined) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// both provided
|
|
61
|
+
if (data.percentage !== undefined && data.range !== undefined) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}, {
|
|
66
|
+
message: "Either `percentage` or `range` must be provided",
|
|
67
|
+
path: [],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=sampleSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleSchema.js","sourceRoot":"","sources":["../../src/linter/sampleSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,0CAsCC;AA5CD,uCAAyB;AAGzB,iDAA0E;AAC1E,yDAAyD;AAEzD,SAAgB,eAAe,CAAC,IAAkB;IAChD,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,MAAM,cAAc,GAAG,IAAA,kCAAmB,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAA,kCAAmB,GAAE,CAAC,CAAC;IAElF,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEzE,OAAO,CAAC;SACL,MAAM,CAAC;QACN,EAAE,EAAE,QAAQ;QACZ,UAAU,EAAE,IAAA,sCAAmB,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAEhD,gCAAgC;QAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;KACpE,CAAC;SACD,MAAM,CACL,CAAC,IAAI,EAAE,EAAE;QACP,eAAe;QACf,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,gBAAgB;QAChB,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EACD;QACE,OAAO,EAAE,iDAAiD;QAC1D,IAAI,EAAE,EAAE;KACT,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Dependencies } from "../dependencies";
|
|
3
|
+
export declare function getSourceBaseSchema(deps: Dependencies): z.ZodObject<{
|
|
4
|
+
source: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
5
|
+
attribute: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
6
|
+
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7
|
+
effect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
8
|
+
payload: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9
|
+
lookup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare function getSourceBaseRefine(): [any, any];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getSourceBaseSchema = getSourceBaseSchema;
|
|
37
|
+
exports.getSourceBaseRefine = getSourceBaseRefine;
|
|
38
|
+
const z = __importStar(require("zod"));
|
|
39
|
+
// eslint-disable-next-line
|
|
40
|
+
function getSourceBaseSchema(deps) {
|
|
41
|
+
const source = z.string();
|
|
42
|
+
const sourceUnion = z.union([source, z.array(source)]);
|
|
43
|
+
// need .shape API from Zod, so cannot do .union() here
|
|
44
|
+
return z.object({
|
|
45
|
+
// one of them is required
|
|
46
|
+
source: sourceUnion.optional(),
|
|
47
|
+
attribute: sourceUnion.optional(),
|
|
48
|
+
state: sourceUnion.optional(),
|
|
49
|
+
effect: sourceUnion.optional(),
|
|
50
|
+
payload: sourceUnion.optional(),
|
|
51
|
+
lookup: sourceUnion.optional(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const needOneOf = ["source", "attribute", "state", "effect", "payload", "lookup"];
|
|
55
|
+
// @TODO: make return type better
|
|
56
|
+
function getSourceBaseRefine() {
|
|
57
|
+
return [
|
|
58
|
+
(data) => {
|
|
59
|
+
const keys = Object.keys(data);
|
|
60
|
+
for (const key of keys) {
|
|
61
|
+
if (needOneOf.includes(key)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
message: "At least one source is required",
|
|
69
|
+
path: [],
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=sourceSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceSchema.js","sourceRoot":"","sources":["../../src/linter/sourceSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kDAcC;AAKD,kDAkBC;AAzCD,uCAAyB;AAGzB,2BAA2B;AAC3B,SAAgB,mBAAmB,CAAC,IAAkB;IACpD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvD,uDAAuD;IACvD,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,0BAA0B;QAC1B,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE;QAC9B,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE;QACjC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;QAC7B,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE;QAC9B,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE;QAC/B,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE;KAC/B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAElF,iCAAiC;AACjC,SAAgB,mBAAmB;IACjC,OAAO;QACL,CAAC,IAAI,EAAE,EAAE;YACP,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE/B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC5B,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QACD;YACE,OAAO,EAAE,iCAAiC;YAC1C,IAAI,EAAE,EAAE;SACT;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getTagsSchema = getTagsSchema;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
function getTagsSchema(deps) {
|
|
39
|
+
const { projectConfig } = deps;
|
|
40
|
+
return z.array(z.string().refine((tag) => projectConfig.tags.indexOf(tag) > -1, {
|
|
41
|
+
message: `Tag must be one of: ${projectConfig.tags.join(", ")}`,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=tagsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagsSchema.js","sourceRoot":"","sources":["../../src/linter/tagsSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sCAQC;AAXD,uCAAyB;AAGzB,SAAgB,aAAa,CAAC,IAAkB;IAC9C,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAE/B,OAAO,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;QAC/D,OAAO,EAAE,uBAAuB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAChE,CAAC,CACH,CAAC;AACJ,CAAC"}
|