spec-box-tms-sync 0.3.0

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 (103) hide show
  1. package/README.md +284 -0
  2. package/bin/spec-box +8 -0
  3. package/dist/api/index.d.ts +3 -0
  4. package/dist/api/index.d.ts.map +1 -0
  5. package/dist/api/index.js +8 -0
  6. package/dist/api/index.js.map +1 -0
  7. package/dist/api/models/index.d.ts +187 -0
  8. package/dist/api/models/index.d.ts.map +1 -0
  9. package/dist/api/models/index.js +3 -0
  10. package/dist/api/models/index.js.map +1 -0
  11. package/dist/api/models/mappers.d.ts +24 -0
  12. package/dist/api/models/mappers.d.ts.map +1 -0
  13. package/dist/api/models/mappers.js +850 -0
  14. package/dist/api/models/mappers.js.map +1 -0
  15. package/dist/api/models/parameters.d.ts +14 -0
  16. package/dist/api/models/parameters.d.ts.map +1 -0
  17. package/dist/api/models/parameters.js +112 -0
  18. package/dist/api/models/parameters.js.map +1 -0
  19. package/dist/api/specBoxWebApi.d.ts +47 -0
  20. package/dist/api/specBoxWebApi.d.ts.map +1 -0
  21. package/dist/api/specBoxWebApi.js +242 -0
  22. package/dist/api/specBoxWebApi.js.map +1 -0
  23. package/dist/cli.d.ts +2 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +24 -0
  26. package/dist/cli.js.map +1 -0
  27. package/dist/commands/sync.d.ts +4 -0
  28. package/dist/commands/sync.d.ts.map +1 -0
  29. package/dist/commands/sync.js +39 -0
  30. package/dist/commands/sync.js.map +1 -0
  31. package/dist/commands/upload-stat.d.ts +4 -0
  32. package/dist/commands/upload-stat.d.ts.map +1 -0
  33. package/dist/commands/upload-stat.js +21 -0
  34. package/dist/commands/upload-stat.js.map +1 -0
  35. package/dist/commands/validate-only.d.ts +4 -0
  36. package/dist/commands/validate-only.d.ts.map +1 -0
  37. package/dist/commands/validate-only.js +30 -0
  38. package/dist/commands/validate-only.js.map +1 -0
  39. package/dist/lib/config/index.d.ts +11 -0
  40. package/dist/lib/config/index.d.ts.map +1 -0
  41. package/dist/lib/config/index.js +34 -0
  42. package/dist/lib/config/index.js.map +1 -0
  43. package/dist/lib/config/models.d.ts +77 -0
  44. package/dist/lib/config/models.d.ts.map +1 -0
  45. package/dist/lib/config/models.js +57 -0
  46. package/dist/lib/config/models.js.map +1 -0
  47. package/dist/lib/domain/index.d.ts +11 -0
  48. package/dist/lib/domain/index.d.ts.map +1 -0
  49. package/dist/lib/domain/index.js +47 -0
  50. package/dist/lib/domain/index.js.map +1 -0
  51. package/dist/lib/domain/keys.d.ts +17 -0
  52. package/dist/lib/domain/keys.d.ts.map +1 -0
  53. package/dist/lib/domain/keys.js +63 -0
  54. package/dist/lib/domain/keys.js.map +1 -0
  55. package/dist/lib/domain/models.d.ts +45 -0
  56. package/dist/lib/domain/models.d.ts.map +1 -0
  57. package/dist/lib/domain/models.js +3 -0
  58. package/dist/lib/domain/models.js.map +1 -0
  59. package/dist/lib/jest/index.d.ts +24 -0
  60. package/dist/lib/jest/index.d.ts.map +1 -0
  61. package/dist/lib/jest/index.js +57 -0
  62. package/dist/lib/jest/index.js.map +1 -0
  63. package/dist/lib/jest/models.d.ts +42 -0
  64. package/dist/lib/jest/models.d.ts.map +1 -0
  65. package/dist/lib/jest/models.js +27 -0
  66. package/dist/lib/jest/models.js.map +1 -0
  67. package/dist/lib/upload/upload-entities.d.ts +4 -0
  68. package/dist/lib/upload/upload-entities.d.ts.map +1 -0
  69. package/dist/lib/upload/upload-entities.js +52 -0
  70. package/dist/lib/upload/upload-entities.js.map +1 -0
  71. package/dist/lib/upload/upload-jest-stat.d.ts +4 -0
  72. package/dist/lib/upload/upload-jest-stat.d.ts.map +1 -0
  73. package/dist/lib/upload/upload-jest-stat.js +21 -0
  74. package/dist/lib/upload/upload-jest-stat.js.map +1 -0
  75. package/dist/lib/utils.d.ts +16 -0
  76. package/dist/lib/utils.d.ts.map +1 -0
  77. package/dist/lib/utils.js +50 -0
  78. package/dist/lib/utils.js.map +1 -0
  79. package/dist/lib/validators/index.d.ts +4 -0
  80. package/dist/lib/validators/index.d.ts.map +1 -0
  81. package/dist/lib/validators/index.js +8 -0
  82. package/dist/lib/validators/index.js.map +1 -0
  83. package/dist/lib/validators/models.d.ts +92 -0
  84. package/dist/lib/validators/models.d.ts.map +1 -0
  85. package/dist/lib/validators/models.js +20 -0
  86. package/dist/lib/validators/models.js.map +1 -0
  87. package/dist/lib/validators/renderer.d.ts +4 -0
  88. package/dist/lib/validators/renderer.d.ts.map +1 -0
  89. package/dist/lib/validators/renderer.js +83 -0
  90. package/dist/lib/validators/renderer.js.map +1 -0
  91. package/dist/lib/validators/validator.d.ts +25 -0
  92. package/dist/lib/validators/validator.d.ts.map +1 -0
  93. package/dist/lib/validators/validator.js +288 -0
  94. package/dist/lib/validators/validator.js.map +1 -0
  95. package/dist/lib/yaml/index.d.ts +10 -0
  96. package/dist/lib/yaml/index.d.ts.map +1 -0
  97. package/dist/lib/yaml/index.js +29 -0
  98. package/dist/lib/yaml/index.js.map +1 -0
  99. package/dist/lib/yaml/models.d.ts +21 -0
  100. package/dist/lib/yaml/models.d.ts.map +1 -0
  101. package/dist/lib/yaml/models.js +19 -0
  102. package/dist/lib/yaml/models.js.map +1 -0
  103. package/package.json +42 -0
@@ -0,0 +1,11 @@
1
+ import { Validator } from '../validators';
2
+ import { Meta, RootConfig } from './models';
3
+ export type { YmlConfig, Attribute, AttributeValue, Tree } from './models';
4
+ export declare const DEFAULT_CONFIG_PATH = ".tms.json";
5
+ export declare const DEFAULT_META_PATH = ".spec-box-meta.yml";
6
+ export declare const loadConfig: (path?: string) => Promise<RootConfig>;
7
+ export declare const loadMeta: (validationContext: Validator, path?: string, basePath?: string) => Promise<{
8
+ filePath: string;
9
+ meta: Meta;
10
+ }>;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,UAAU,EAA8B,MAAM,UAAU,CAAC;AAExE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE3E,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,UAAU,qBAEpB,QAAQ,UAAU,CAOpB,CAAC;AAEF,eAAO,MAAM,QAAQ,sBACA,SAAS,SACrB,MAAM,aACH,MAAM;cACK,MAAM;UAAQ,IAAI;EAexC,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadMeta = exports.loadConfig = exports.DEFAULT_META_PATH = exports.DEFAULT_CONFIG_PATH = void 0;
4
+ const utils_1 = require("../utils");
5
+ const validators_1 = require("../validators");
6
+ const validator_1 = require("../validators/validator");
7
+ const models_1 = require("./models");
8
+ exports.DEFAULT_CONFIG_PATH = '.tms.json';
9
+ exports.DEFAULT_META_PATH = '.spec-box-meta.yml';
10
+ const loadConfig = async (path = exports.DEFAULT_CONFIG_PATH) => {
11
+ const json = await (0, utils_1.readTextFile)(path);
12
+ const data = JSON.parse(json);
13
+ const config = (0, utils_1.parseObject)(data, models_1.configDecoder);
14
+ return config;
15
+ };
16
+ exports.loadConfig = loadConfig;
17
+ const loadMeta = async (validationContext, path, basePath = utils_1.CWD // TODO: перенести в resolvePath
18
+ ) => {
19
+ const filePath = path || exports.DEFAULT_META_PATH;
20
+ let fileReader = path
21
+ ? (0, utils_1.readYaml)(models_1.metaDecoder, filePath, basePath)
22
+ : (0, utils_1.readYamlIfExists)(models_1.metaDecoder, filePath, basePath);
23
+ try {
24
+ const content = await fileReader;
25
+ const meta = content || {};
26
+ return { filePath, meta };
27
+ }
28
+ catch (error) {
29
+ (0, validators_1.printError)((0, validator_1.getLoaderError)(error, filePath, 'config'));
30
+ throw Error('Ошибка загрузки файла конфигурации');
31
+ }
32
+ };
33
+ exports.loadMeta = loadMeta;
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":";;;AAAA,oCAMkB;AAClB,8CAAsD;AACtD,uDAAyD;AACzD,qCAAwE;AAI3D,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAClC,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,MAAM,UAAU,GAAG,KAAK,EAC7B,IAAI,GAAG,2BAAmB,EACL,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC,IAAI,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9B,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,IAAI,EAAE,sBAAa,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AATW,QAAA,UAAU,cASrB;AAEK,MAAM,QAAQ,GAAG,KAAK,EAC3B,iBAA4B,EAC5B,IAAa,EACb,WAAmB,WAAG,CAAC,gCAAgC;EACZ,EAAE;IAC7C,MAAM,QAAQ,GAAG,IAAI,IAAI,yBAAiB,CAAC;IAC3C,IAAI,UAAU,GAAG,IAAI;QACnB,CAAC,CAAC,IAAA,gBAAQ,EAAC,oBAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC3C,CAAC,CAAC,IAAA,wBAAgB,EAAC,oBAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEtD,IAAI;QACF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAC;QAE3B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC3B;IAAC,OAAO,KAAK,EAAE;QACd,IAAA,uBAAU,EAAC,IAAA,0BAAc,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtD,MAAM,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACnD;AACH,CAAC,CAAC;AAnBW,QAAA,QAAQ,YAmBnB"}
@@ -0,0 +1,77 @@
1
+ import * as d from "io-ts/Decoder";
2
+ export declare const attributeValueDecoder: d.Decoder<unknown, {
3
+ code: string;
4
+ title: string;
5
+ }>;
6
+ export declare const attributeDecoder: d.Decoder<unknown, {
7
+ code: string;
8
+ title: string;
9
+ values: {
10
+ code: string;
11
+ title: string;
12
+ }[];
13
+ }>;
14
+ export declare const treeDecoder: d.Decoder<unknown, {
15
+ code: string;
16
+ title: string;
17
+ "group-by": string[];
18
+ }>;
19
+ export declare const metaDecoder: d.Decoder<unknown, Partial<{
20
+ title: string;
21
+ description: string;
22
+ repository: string;
23
+ attributes: {
24
+ code: string;
25
+ title: string;
26
+ values: {
27
+ code: string;
28
+ title: string;
29
+ }[];
30
+ }[];
31
+ trees: {
32
+ code: string;
33
+ title: string;
34
+ "group-by": string[];
35
+ }[];
36
+ }>>;
37
+ export declare const apiConfigDecoder: d.Decoder<unknown, {
38
+ host: string;
39
+ project: string;
40
+ }>;
41
+ export declare const ymlConfigDecoder: d.Decoder<unknown, Partial<{
42
+ metaPath: string;
43
+ }> & {
44
+ files: string[];
45
+ }>;
46
+ export declare const literalKeyPartDecoder: d.Decoder<unknown, "filePath" | "featureCode" | "featureTitle" | "groupTitle" | "assertionTitle" | "fileName">;
47
+ export declare const attributeKeyPartDecoder: d.Decoder<unknown, string>;
48
+ export declare const jestConfigDecoder: d.Decoder<unknown, {
49
+ reportPath: string;
50
+ keys: string[];
51
+ }>;
52
+ export declare const configDecoder: d.Decoder<unknown, Partial<{
53
+ projectPath: string;
54
+ jest: {
55
+ reportPath: string;
56
+ keys: string[];
57
+ };
58
+ }> & {
59
+ api: {
60
+ host: string;
61
+ project: string;
62
+ };
63
+ yml: Partial<{
64
+ metaPath: string;
65
+ }> & {
66
+ files: string[];
67
+ };
68
+ }>;
69
+ export type RootConfig = d.TypeOf<typeof configDecoder>;
70
+ export type ApiConfig = d.TypeOf<typeof apiConfigDecoder>;
71
+ export type YmlConfig = d.TypeOf<typeof ymlConfigDecoder>;
72
+ export type JestConfig = d.TypeOf<typeof jestConfigDecoder>;
73
+ export type Meta = d.TypeOf<typeof metaDecoder>;
74
+ export type Tree = d.TypeOf<typeof treeDecoder>;
75
+ export type Attribute = d.TypeOf<typeof attributeDecoder>;
76
+ export type AttributeValue = d.TypeOf<typeof attributeValueDecoder>;
77
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/lib/config/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAGnC,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;EAItB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;GAMtB,CAAC;AAGH,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;EAQ5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,gHAOjC,CAAC;AAEF,eAAO,MAAM,uBAAuB,4BASnC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;EAG5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;EAUzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configDecoder = exports.jestConfigDecoder = exports.attributeKeyPartDecoder = exports.literalKeyPartDecoder = exports.ymlConfigDecoder = exports.apiConfigDecoder = exports.metaDecoder = exports.treeDecoder = exports.attributeDecoder = exports.attributeValueDecoder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const function_1 = require("fp-ts/lib/function");
6
+ const d = tslib_1.__importStar(require("io-ts/Decoder"));
7
+ // meta
8
+ exports.attributeValueDecoder = d.struct({
9
+ code: d.string,
10
+ title: d.string,
11
+ });
12
+ exports.attributeDecoder = d.struct({
13
+ code: d.string,
14
+ title: d.string,
15
+ values: d.array(exports.attributeValueDecoder),
16
+ });
17
+ exports.treeDecoder = d.struct({
18
+ code: d.string,
19
+ title: d.string,
20
+ "group-by": d.array(d.string),
21
+ });
22
+ exports.metaDecoder = d.partial({
23
+ title: d.string,
24
+ description: d.string,
25
+ repository: d.string,
26
+ attributes: d.array(exports.attributeDecoder),
27
+ trees: d.array(exports.treeDecoder),
28
+ });
29
+ // config
30
+ exports.apiConfigDecoder = d.struct({
31
+ host: d.string,
32
+ project: d.string,
33
+ });
34
+ exports.ymlConfigDecoder = d.intersect(d.struct({
35
+ files: d.array(d.string),
36
+ }))(d.partial({
37
+ metaPath: d.string,
38
+ }));
39
+ exports.literalKeyPartDecoder = d.literal("featureTitle", "featureCode", "groupTitle", "assertionTitle", "fileName", "filePath");
40
+ exports.attributeKeyPartDecoder = (0, function_1.pipe)(d.string, d.parse((str) => {
41
+ if (/^[@$]/.test(str)) {
42
+ return d.success(str.trim());
43
+ }
44
+ return d.failure(str, "starts with @ or $ symbol");
45
+ }));
46
+ exports.jestConfigDecoder = d.struct({
47
+ reportPath: d.string,
48
+ keys: d.array(d.union(exports.literalKeyPartDecoder, exports.attributeKeyPartDecoder)),
49
+ });
50
+ exports.configDecoder = d.intersect(d.struct({
51
+ api: exports.apiConfigDecoder,
52
+ yml: exports.ymlConfigDecoder,
53
+ }))(d.partial({
54
+ projectPath: d.string,
55
+ jest: exports.jestConfigDecoder,
56
+ }));
57
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/lib/config/models.ts"],"names":[],"mappings":";;;;AAAA,iDAA0C;AAC1C,yDAAmC;AAEnC,OAAO;AACM,QAAA,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,KAAK,EAAE,CAAC,CAAC,MAAM;CAChB,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,6BAAqB,CAAC;CACvC,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;CAC9B,CAAC,CAAC;AAEU,QAAA,WAAW,G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EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,6BAAqB,EAAE,+BAAuB,CAAC,CAAC;CACvE,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,CAAC,CAAC,SAAS,CACtC,CAAC,CAAC,MAAM,CAAC;IACP,GAAG,EAAE,wBAAgB;IACrB,GAAG,EAAE,wBAAgB;CACtB,CAAC,CACH,CACC,CAAC,CAAC,OAAO,CAAC;IACR,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,IAAI,EAAE,yBAAiB;CACxB,CAAC,CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Meta } from '../config/models';
2
+ import { YamlFile } from '../yaml';
3
+ import { ProjectData } from './models';
4
+ export { getAttributesContext, getKey } from './keys';
5
+ export type { AssertionContext, AttributesContext } from './keys';
6
+ export type { Assertion, AssertionGroup, Attribute, AttributeValue, Feature, ProjectData, Tree, } from './models';
7
+ export declare const processYamlFiles: (files: YamlFile[], config: {
8
+ filePath: string;
9
+ meta: Meta;
10
+ }) => ProjectData;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/domain/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAA6B,MAAM,SAAS,CAAC;AAC9D,OAAO,EAML,WAAW,EAEZ,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAClE,YAAY,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,EACd,OAAO,EACP,WAAW,EACX,IAAI,GACL,MAAM,UAAU,CAAC;AAoDlB,eAAO,MAAM,gBAAgB,UACpB,QAAQ,EAAE,UACT;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,KACvC,WAUF,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processYamlFiles = exports.getKey = exports.getAttributesContext = void 0;
4
+ var keys_1 = require("./keys");
5
+ Object.defineProperty(exports, "getAttributesContext", { enumerable: true, get: function () { return keys_1.getAttributesContext; } });
6
+ Object.defineProperty(exports, "getKey", { enumerable: true, get: function () { return keys_1.getKey; } });
7
+ const mapAssertion = ({ assert: title, description, }) => ({
8
+ title,
9
+ description,
10
+ isAutomated: false,
11
+ });
12
+ const mapGroup = ([title, list]) => {
13
+ const assertions = list.map(mapAssertion);
14
+ return { title, assertions };
15
+ };
16
+ const mapFeature = ({ content, fileName, filePath }) => {
17
+ const { code, feature: title, description, definitions: attributes, 'specs-unit': specs = {}, } = content;
18
+ const groups = Object.entries(specs).map(mapGroup);
19
+ return { code, title, description, groups, attributes, fileName, filePath };
20
+ };
21
+ const mapAttributeValue = ({ code, title, }) => ({ code, title });
22
+ const mapAttribute = ({ code, title, values }) => {
23
+ return {
24
+ title,
25
+ code,
26
+ values: values.map(mapAttributeValue),
27
+ };
28
+ };
29
+ const mapTree = ({ code, title, 'group-by': attributes }) => {
30
+ return {
31
+ title,
32
+ code,
33
+ attributes,
34
+ };
35
+ };
36
+ const processYamlFiles = (files, config) => {
37
+ var _a, _b;
38
+ const { title, description, repository } = config.meta;
39
+ const project = { title, description, repository };
40
+ const features = files.map(mapFeature);
41
+ const attributes = (_a = config.meta.attributes) === null || _a === void 0 ? void 0 : _a.map(mapAttribute);
42
+ const trees = (_b = config.meta.trees) === null || _b === void 0 ? void 0 : _b.map(mapTree);
43
+ const metaFilePath = config.filePath;
44
+ return { features, project, attributes, trees, metaFilePath };
45
+ };
46
+ exports.processYamlFiles = processYamlFiles;
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sour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G,CAAC,iBAAiB,CAAC;KACtC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAW,EAAQ,EAAE;IACzE,OAAO;QACL,KAAK;QACL,IAAI;QACJ,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAC9B,KAAiB,EACjB,MAAwC,EAC3B,EAAE;;IACf,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IAEvD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,UAAU,0CAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,KAAK,0CAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC;IAErC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AAChE,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
@@ -0,0 +1,17 @@
1
+ import { Attribute } from "./models";
2
+ export declare const UNDEFINED = "UNDEFINED";
3
+ export declare const AMBIGUOUS = "AMBIGUOUS";
4
+ export type AttributesContext = Record<string, Record<string, string>>;
5
+ export interface AssertionContext {
6
+ featureTitle: string;
7
+ featureCode: string;
8
+ groupTitle: string;
9
+ assertionTitle: string;
10
+ fileName: string;
11
+ filePath: string;
12
+ attributes: Record<string, string[]>;
13
+ }
14
+ export declare const getAttributesContext: (alLAttributes?: Attribute[]) => AttributesContext;
15
+ export declare const getKeyPart: (value: string, assertion: AssertionContext, attributes: AttributesContext) => string;
16
+ export declare const getKey: (parts: string[], assertion: AssertionContext, attributes: AttributesContext) => string[];
17
+ //# sourceMappingURL=keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/lib/domain/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,oBAAoB,mBAChB,SAAS,EAAE,KACzB,iBAaF,CAAC;AAsBF,eAAO,MAAM,UAAU,UACd,MAAM,aACF,gBAAgB,cACf,iBAAiB,KAC5B,MA8BF,CAAC;AAEF,eAAO,MAAM,MAAM,UACV,MAAM,EAAE,aACJ,gBAAgB,cACf,iBAAiB,aACgC,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getKey = exports.getKeyPart = exports.getAttributesContext = exports.AMBIGUOUS = exports.UNDEFINED = void 0;
4
+ exports.UNDEFINED = "UNDEFINED";
5
+ exports.AMBIGUOUS = "AMBIGUOUS";
6
+ const getAttributesContext = (alLAttributes = []) => {
7
+ const obj = {};
8
+ for (let { code, values } of alLAttributes) {
9
+ // TODO: валидация дубликатов
10
+ const attr = (obj[code] = {});
11
+ for (let { code, title } of values) {
12
+ attr[code] = title;
13
+ }
14
+ }
15
+ return obj;
16
+ };
17
+ exports.getAttributesContext = getAttributesContext;
18
+ const getAttributeValue = (attributeCode, { attributes }, allAttributes) => {
19
+ var _a;
20
+ const values = attributes[attributeCode] || [];
21
+ switch (values.length) {
22
+ case 0:
23
+ return undefined;
24
+ case 1:
25
+ const [code] = values;
26
+ const title = ((_a = allAttributes[attributeCode]) === null || _a === void 0 ? void 0 : _a[code]) || code;
27
+ return { code, title };
28
+ default:
29
+ return { code: exports.AMBIGUOUS, title: exports.AMBIGUOUS };
30
+ }
31
+ };
32
+ const getKeyPart = (value, assertion, attributes) => {
33
+ var _a, _b;
34
+ if (value.startsWith("$")) {
35
+ const attributeCode = value.replace(/^[$]/, "");
36
+ return (((_a = getAttributeValue(attributeCode, assertion, attributes)) === null || _a === void 0 ? void 0 : _a.title) ||
37
+ exports.UNDEFINED);
38
+ }
39
+ else if (value.startsWith("@")) {
40
+ const attributeCode = value.replace(/^@/, "");
41
+ return (((_b = getAttributeValue(attributeCode, assertion, attributes)) === null || _b === void 0 ? void 0 : _b.code) || exports.UNDEFINED);
42
+ }
43
+ switch (value) {
44
+ case "featureTitle":
45
+ return assertion.featureTitle;
46
+ case "featureCode":
47
+ return assertion.featureCode;
48
+ case "groupTitle":
49
+ return assertion.groupTitle;
50
+ case "assertionTitle":
51
+ return assertion.assertionTitle;
52
+ case "fileName":
53
+ return assertion.fileName;
54
+ case "filePath":
55
+ return assertion.filePath;
56
+ default:
57
+ return exports.UNDEFINED;
58
+ }
59
+ };
60
+ exports.getKeyPart = getKeyPart;
61
+ const getKey = (parts, assertion, attributes) => parts.map((str) => (0, exports.getKeyPart)(str, assertion, attributes));
62
+ exports.getKey = getKey;
63
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/lib/dom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
+ title: string;
8
+ assertions: Assertion[];
9
+ }
10
+ export interface Feature {
11
+ code: string;
12
+ title: string;
13
+ description?: string;
14
+ groups: AssertionGroup[];
15
+ attributes?: Record<string, string[]>;
16
+ fileName: string;
17
+ filePath: string;
18
+ }
19
+ export interface AttributeValue {
20
+ code: string;
21
+ title: string;
22
+ }
23
+ export interface Attribute {
24
+ code: string;
25
+ title: string;
26
+ values: AttributeValue[];
27
+ }
28
+ export interface Tree {
29
+ title: string;
30
+ code: string;
31
+ attributes: string[];
32
+ }
33
+ export interface ProjectInfo {
34
+ title?: string;
35
+ description?: string;
36
+ repository?: string;
37
+ }
38
+ export interface ProjectData {
39
+ features: Feature[];
40
+ project: ProjectInfo;
41
+ attributes?: Attribute[];
42
+ trees?: Tree[];
43
+ metaFilePath: string;
44
+ }
45
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/lib/domain/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IAErB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/lib/domain/models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { ProjectData } from '../domain';
2
+ import { Validator } from '../validators';
3
+ import { JestReport } from './models';
4
+ export declare const getFullName: (...parts: string[]) => string;
5
+ export declare const ignoredStatuses: Set<"todo" | "passed" | "failed" | "pending" | "skipped">;
6
+ export declare const applyJestReport: (validationContext: Validator, { features, attributes }: ProjectData, report: JestReport, keyParts: string[]) => void;
7
+ export declare const loadJestReport: (path: string, basePath?: string) => Promise<{
8
+ startTime: number;
9
+ numTotalTests: number;
10
+ testResults: {
11
+ name: string;
12
+ status: "passed" | "failed" | "pending" | "focused" | "skipped";
13
+ message: string;
14
+ startTime: number;
15
+ endTime: number;
16
+ assertionResults: {
17
+ title: string;
18
+ fullName: string;
19
+ ancestorTitles: string[];
20
+ status: "todo" | "passed" | "failed" | "pending" | "skipped";
21
+ }[];
22
+ }[];
23
+ }>;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/jest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAuB,UAAU,EAAqB,MAAM,UAAU,CAAC;AAE9E,eAAO,MAAM,WAAW,aAAc,MAAM,EAAE,WAAsB,CAAC;AAErE,eAAO,MAAM,eAAe,2DAA+D,CAAC;AAE5F,eAAO,MAAM,eAAe,sBACP,SAAS,4BACF,WAAW,UAC7B,UAAU,YACR,MAAM,EAAE,SAuDnB,CAAC;AAEF,eAAO,MAAM,cAAc,SAAgB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;EAOnE,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadJestReport = exports.applyJestReport = exports.ignoredStatuses = exports.getFullName = void 0;
4
+ const domain_1 = require("../domain");
5
+ const utils_1 = require("../utils");
6
+ const models_1 = require("./models");
7
+ const getFullName = (...parts) => parts.join(' / ');
8
+ exports.getFullName = getFullName;
9
+ exports.ignoredStatuses = new Set(['pending', 'todo', 'skipped']);
10
+ const applyJestReport = (validationContext, { features, attributes }, report, keyParts) => {
11
+ const names = new Map();
12
+ // формируем список ключей тест-кейсов из отчета jest
13
+ for (let { assertionResults, name: path } of report.testResults) {
14
+ const assertions = assertionResults.filter(a => !exports.ignoredStatuses.has(a.status));
15
+ for (let { title, ancestorTitles } of assertions) {
16
+ const name = (0, exports.getFullName)(...ancestorTitles, title);
17
+ const pathes = names.get(name) || [];
18
+ pathes.push(path);
19
+ names.set(name, pathes);
20
+ }
21
+ }
22
+ const attributesCtx = (0, domain_1.getAttributesContext)(attributes);
23
+ // заполняем поле isAutomated
24
+ for (let { title: featureTitle, code: featureCode, groups, fileName, filePath, attributes = {}, } of features) {
25
+ for (let { title: groupTitle, assertions } of groups || []) {
26
+ for (let assertion of assertions || []) {
27
+ // TODO: перенести в domain?
28
+ const assertionCtx = {
29
+ featureTitle,
30
+ featureCode,
31
+ groupTitle,
32
+ assertionTitle: assertion.title,
33
+ attributes,
34
+ fileName,
35
+ filePath,
36
+ };
37
+ const parts = (0, domain_1.getKey)(keyParts, assertionCtx, attributesCtx);
38
+ const fullName = (0, exports.getFullName)(...parts);
39
+ assertion.isAutomated = names.has(fullName);
40
+ names.delete(fullName);
41
+ }
42
+ }
43
+ }
44
+ Array.from(names.keys()).forEach((name) => {
45
+ const pathes = names.get(name);
46
+ pathes === null || pathes === void 0 ? void 0 : pathes.forEach((path) => validationContext.registerJestUnusedTests(name, path));
47
+ });
48
+ };
49
+ exports.applyJestReport = applyJestReport;
50
+ const loadJestReport = async (path, basePath) => {
51
+ const json = await (0, utils_1.readTextFile)(path, basePath);
52
+ const data = JSON.parse(json);
53
+ const entity = (0, utils_1.parseObject)(data, models_1.jestReportDecoder);
54
+ return entity;
55
+ };
56
+ exports.loadJestReport = loadJestReport;
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/jest/index.ts"],"names":[],"mappings":";;;AAAA,sCAKmB;AACnB,oCAAqD;AAErD,qCAA8E;AAEvE,MAAM,WAAW,GAAG,CAAC,GAAG,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAAxD,QAAA,WAAW,eAA6C;AAExD,QAAA,eAAe,GAAG,IAAI,GAAG,CAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAErF,MAAM,eAAe,GAAG,CAC7B,iBAA4B,EAC5B,EAAE,QAAQ,EAAE,UAAU,EAAe,E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AAM,KAAK,GAAG,IAAA,eAAM,EAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;gBAC5D,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,GAAG,KAAK,CAAC,CAAC;gBAEvC,SAAS,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAE5C,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aACxB;SACF;KACF;IACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACvB,iBAAiB,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,CACtD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA3DW,QAAA,eAAe,mBA2D1B;AAEK,MAAM,cAAc,GAAG,KAAK,EAAE,IAAY,EAAE,QAAiB,EAAE,EAAE;IACtE,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChD,MAAM,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,IAAI,EAAE,0BAAiB,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
@@ -0,0 +1,42 @@
1
+ import * as d from "io-ts/Decoder";
2
+ export declare const jestSuiteStatusDecoder: d.Decoder<unknown, "passed" | "failed" | "pending" | "focused" | "skipped">;
3
+ export declare const jestAssertionStatusDecoder: d.Decoder<unknown, "todo" | "passed" | "failed" | "pending" | "skipped">;
4
+ export declare const jestAssertionResultDecoder: d.Decoder<unknown, {
5
+ title: string;
6
+ fullName: string;
7
+ ancestorTitles: string[];
8
+ status: "todo" | "passed" | "failed" | "pending" | "skipped";
9
+ }>;
10
+ export declare const jestTestResultDecoder: d.Decoder<unknown, {
11
+ name: string;
12
+ status: "passed" | "failed" | "pending" | "focused" | "skipped";
13
+ message: string;
14
+ startTime: number;
15
+ endTime: number;
16
+ assertionResults: {
17
+ title: string;
18
+ fullName: string;
19
+ ancestorTitles: string[];
20
+ status: "todo" | "passed" | "failed" | "pending" | "skipped";
21
+ }[];
22
+ }>;
23
+ export declare const jestReportDecoder: d.Decoder<unknown, {
24
+ startTime: number;
25
+ numTotalTests: number;
26
+ testResults: {
27
+ name: string;
28
+ status: "passed" | "failed" | "pending" | "focused" | "skipped";
29
+ message: string;
30
+ startTime: number;
31
+ endTime: number;
32
+ assertionResults: {
33
+ title: string;
34
+ fullName: string;
35
+ ancestorTitles: string[];
36
+ status: "todo" | "passed" | "failed" | "pending" | "skipped";
37
+ }[];
38
+ }[];
39
+ }>;
40
+ export type JestReport = d.TypeOf<typeof jestReportDecoder>;
41
+ export type JestAssertionStatus = d.TypeOf<typeof jestAssertionStatusDecoder>;
42
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/lib/jest/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAEnC,eAAO,MAAM,sBAAsB,6EAMlC,CAAC;AAEF,eAAO,MAAM,0BAA0B,0EAMtC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;EAKrC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAOhC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;EAI5B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jestReportDecoder = exports.jestTestResultDecoder = exports.jestAssertionResultDecoder = exports.jestAssertionStatusDecoder = exports.jestSuiteStatusDecoder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const d = tslib_1.__importStar(require("io-ts/Decoder"));
6
+ exports.jestSuiteStatusDecoder = d.literal("passed", "failed", "pending", "focused", "skipped");
7
+ exports.jestAssertionStatusDecoder = d.literal("passed", "failed", "pending", "todo", "skipped");
8
+ exports.jestAssertionResultDecoder = d.struct({
9
+ title: d.string,
10
+ fullName: d.string,
11
+ ancestorTitles: d.array(d.string),
12
+ status: exports.jestAssertionStatusDecoder,
13
+ });
14
+ exports.jestTestResultDecoder = d.struct({
15
+ name: d.string,
16
+ status: exports.jestSuiteStatusDecoder,
17
+ message: d.string,
18
+ startTime: d.number,
19
+ endTime: d.number,
20
+ assertionResults: d.array(exports.jestAssertionResultDecoder),
21
+ });
22
+ exports.jestReportDecoder = d.struct({
23
+ startTime: d.number,
24
+ numTotalTests: d.number,
25
+ testResults: d.array(exports.jestTestResultDecoder),
26
+ });
27
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/lib/jest/models.ts"],"names":[],"mappings":";;;;AAAA,yDAAmC;AAEtB,QAAA,sBAAsB,GAAG,CAAC,CAAC,OAAO,CAC7C,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,CACV,CAAC;AAEW,QAAA,0BAA0B,GAAG,CAAC,CAAC,OAAO,CACjD,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,CACV,CAAC;AAEW,QAAA,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM;IAClB,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,kCAA0B;CACnC,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,MAAM,EAAE,8BAAsB;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,kCAA0B,CAAC;CACtD,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,aAAa,EAAE,CAAC,CAAC,MAAM;IACvB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,6BAAqB,CAAC;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ApiConfig } from '../config/models';
2
+ import { ProjectData } from '../domain';
3
+ export declare const uploadEntities: ({ features, attributes, trees, project: { title, description, repository: repositoryUrl }, }: ProjectData, config: ApiConfig, version?: string) => Promise<void>;
4
+ //# sourceMappingURL=upload-entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-entities.d.ts","sourceRoot":"","sources":["../../../src/lib/upload/upload-entities.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAA6B,WAAW,EAAE,MAAM,WAAW,CAAC;AAsEnE,eAAO,MAAM,cAAc,iGAMtB,WAAW,UACN,SAAS,YACP,MAAM,kBAcjB,CAAC"}