@vostride/agent-qa-ids 0.2.4 → 0.2.5
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.cjs +57 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -29
- package/dist/index.d.ts +28 -29
- package/dist/index.js +40 -54
- package/dist/index.js.map +1 -1
- package/package.json +16 -11
package/dist/index.cjs
CHANGED
|
@@ -1,133 +1,93 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
CANONICAL_ID_WORDS: () => CANONICAL_ID_WORDS,
|
|
24
|
-
ENTITY_ID_TYPES: () => ENTITY_ID_TYPES,
|
|
25
|
-
generateCanonicalId: () => generateCanonicalId,
|
|
26
|
-
generateHookId: () => generateHookId,
|
|
27
|
-
generateObservationId: () => generateObservationId,
|
|
28
|
-
generateRunId: () => generateRunId,
|
|
29
|
-
generateSuiteId: () => generateSuiteId,
|
|
30
|
-
generateTestId: () => generateTestId,
|
|
31
|
-
getEntityIdContract: () => getEntityIdContract,
|
|
32
|
-
getEntityIdContracts: () => getEntityIdContracts,
|
|
33
|
-
isCanonicalHookId: () => isCanonicalHookId,
|
|
34
|
-
isCanonicalId: () => isCanonicalId,
|
|
35
|
-
isCanonicalObservationId: () => isCanonicalObservationId,
|
|
36
|
-
isCanonicalRunId: () => isCanonicalRunId,
|
|
37
|
-
isCanonicalSuiteId: () => isCanonicalSuiteId,
|
|
38
|
-
isCanonicalTestId: () => isCanonicalTestId,
|
|
39
|
-
isObservationId: () => isObservationId
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(index_exports);
|
|
42
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let id_agent = require("id-agent");
|
|
43
3
|
// src/persistent-id.ts
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
run: "r"
|
|
4
|
+
const CANONICAL_ID_WORDS = 10;
|
|
5
|
+
const PREFIX = {
|
|
6
|
+
test: "t",
|
|
7
|
+
suite: "s",
|
|
8
|
+
hook: "h",
|
|
9
|
+
observation: "obs",
|
|
10
|
+
run: "r"
|
|
52
11
|
};
|
|
53
|
-
|
|
12
|
+
const ENTITY_ID_TYPES = Object.keys(PREFIX);
|
|
54
13
|
function hasPrefixAndWordCount(value, prefix, wordCount) {
|
|
55
|
-
|
|
56
|
-
|
|
14
|
+
const parsed = (0, id_agent.parse)(value);
|
|
15
|
+
return parsed?.prefix === prefix && parsed.wordCount === wordCount;
|
|
57
16
|
}
|
|
58
17
|
function generateId(prefix) {
|
|
59
|
-
|
|
18
|
+
return (0, id_agent.idAgent)({
|
|
19
|
+
prefix,
|
|
20
|
+
words: 10
|
|
21
|
+
});
|
|
60
22
|
}
|
|
61
23
|
function generateTestId() {
|
|
62
|
-
|
|
24
|
+
return generateId(PREFIX.test);
|
|
63
25
|
}
|
|
64
26
|
function generateSuiteId() {
|
|
65
|
-
|
|
27
|
+
return generateId(PREFIX.suite);
|
|
66
28
|
}
|
|
67
29
|
function generateObservationId() {
|
|
68
|
-
|
|
30
|
+
return generateId(PREFIX.observation);
|
|
69
31
|
}
|
|
70
32
|
function generateHookId() {
|
|
71
|
-
|
|
33
|
+
return generateId(PREFIX.hook);
|
|
72
34
|
}
|
|
73
35
|
function generateRunId() {
|
|
74
|
-
|
|
36
|
+
return generateId(PREFIX.run);
|
|
75
37
|
}
|
|
76
38
|
function generateCanonicalId(type) {
|
|
77
|
-
|
|
39
|
+
return generateId(PREFIX[type]);
|
|
78
40
|
}
|
|
79
41
|
function isCanonicalTestId(value) {
|
|
80
|
-
|
|
42
|
+
return hasPrefixAndWordCount(value, PREFIX.test, 10);
|
|
81
43
|
}
|
|
82
44
|
function isCanonicalSuiteId(value) {
|
|
83
|
-
|
|
45
|
+
return hasPrefixAndWordCount(value, PREFIX.suite, 10);
|
|
84
46
|
}
|
|
85
47
|
function isCanonicalHookId(value) {
|
|
86
|
-
|
|
48
|
+
return hasPrefixAndWordCount(value, PREFIX.hook, 10);
|
|
87
49
|
}
|
|
88
50
|
function isCanonicalObservationId(value) {
|
|
89
|
-
|
|
51
|
+
return hasPrefixAndWordCount(value, PREFIX.observation, 10);
|
|
90
52
|
}
|
|
91
53
|
function isCanonicalRunId(value) {
|
|
92
|
-
|
|
54
|
+
return hasPrefixAndWordCount(value, PREFIX.run, 10);
|
|
93
55
|
}
|
|
94
56
|
function isCanonicalId(type, value) {
|
|
95
|
-
|
|
57
|
+
return hasPrefixAndWordCount(value, PREFIX[type], 10);
|
|
96
58
|
}
|
|
97
59
|
function isObservationId(value) {
|
|
98
|
-
|
|
60
|
+
return isCanonicalObservationId(value);
|
|
99
61
|
}
|
|
100
62
|
function getEntityIdContract(type) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
63
|
+
const prefix = PREFIX[type];
|
|
64
|
+
return {
|
|
65
|
+
type,
|
|
66
|
+
prefix,
|
|
67
|
+
prefixWithSeparator: `${prefix}_`,
|
|
68
|
+
words: 10,
|
|
69
|
+
examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`
|
|
70
|
+
};
|
|
109
71
|
}
|
|
110
72
|
function getEntityIdContracts() {
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
isObservationId
|
|
132
|
-
});
|
|
73
|
+
return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
|
|
74
|
+
}
|
|
75
|
+
exports.CANONICAL_ID_WORDS = CANONICAL_ID_WORDS;
|
|
76
|
+
exports.ENTITY_ID_TYPES = ENTITY_ID_TYPES;
|
|
77
|
+
exports.generateCanonicalId = generateCanonicalId;
|
|
78
|
+
exports.generateHookId = generateHookId;
|
|
79
|
+
exports.generateObservationId = generateObservationId;
|
|
80
|
+
exports.generateRunId = generateRunId;
|
|
81
|
+
exports.generateSuiteId = generateSuiteId;
|
|
82
|
+
exports.generateTestId = generateTestId;
|
|
83
|
+
exports.getEntityIdContract = getEntityIdContract;
|
|
84
|
+
exports.getEntityIdContracts = getEntityIdContracts;
|
|
85
|
+
exports.isCanonicalHookId = isCanonicalHookId;
|
|
86
|
+
exports.isCanonicalId = isCanonicalId;
|
|
87
|
+
exports.isCanonicalObservationId = isCanonicalObservationId;
|
|
88
|
+
exports.isCanonicalRunId = isCanonicalRunId;
|
|
89
|
+
exports.isCanonicalSuiteId = isCanonicalSuiteId;
|
|
90
|
+
exports.isCanonicalTestId = isCanonicalTestId;
|
|
91
|
+
exports.isObservationId = isObservationId;
|
|
92
|
+
|
|
133
93
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["parse","idAgent"],"sources":["../src/persistent-id.ts"],"sourcesContent":["import { idAgent, parse } from 'id-agent'\n\nexport const CANONICAL_ID_WORDS = 10\n\nconst PREFIX = {\n test: 't',\n suite: 's',\n hook: 'h',\n observation: 'obs',\n run: 'r',\n} as const\n\ntype Prefix = (typeof PREFIX)[keyof typeof PREFIX]\nexport type EntityIdType = keyof typeof PREFIX\n\nexport const ENTITY_ID_TYPES = Object.keys(PREFIX) as EntityIdType[]\n\nexport interface EntityIdContract {\n type: EntityIdType\n prefix: Prefix\n prefixWithSeparator: `${Prefix}_`\n words: number\n examplePattern: string\n}\n\nfunction hasPrefixAndWordCount(value: string, prefix: Prefix, wordCount: number): boolean {\n const parsed = parse(value)\n return parsed?.prefix === prefix && parsed.wordCount === wordCount\n}\n\nfunction generateId(prefix: Prefix): string {\n return idAgent({ prefix, words: CANONICAL_ID_WORDS })\n}\n\nexport function generateTestId(): string {\n return generateId(PREFIX.test)\n}\n\nexport function generateSuiteId(): string {\n return generateId(PREFIX.suite)\n}\n\nexport function generateObservationId(): string {\n return generateId(PREFIX.observation)\n}\n\nexport function generateHookId(): string {\n return generateId(PREFIX.hook)\n}\n\nexport function generateRunId(): string {\n return generateId(PREFIX.run)\n}\n\nexport function generateCanonicalId(type: EntityIdType): string {\n return generateId(PREFIX[type])\n}\n\nexport function isCanonicalTestId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.test, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalSuiteId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.suite, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalHookId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.hook, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalObservationId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.observation, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalRunId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.run, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalId(type: EntityIdType, value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS)\n}\n\nexport function isObservationId(value: string): boolean {\n return isCanonicalObservationId(value)\n}\n\nexport function getEntityIdContract(type: EntityIdType): EntityIdContract {\n const prefix = PREFIX[type]\n return {\n type,\n prefix,\n prefixWithSeparator: `${prefix}_`,\n words: CANONICAL_ID_WORDS,\n examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`,\n }\n}\n\nexport function getEntityIdContracts(): EntityIdContract[] {\n return ENTITY_ID_TYPES.map(type => getEntityIdContract(type))\n}\n"],"mappings":";;;AAEA,MAAa,qBAAqB;AAElC,MAAM,SAAS;CACb,MAAM;CACN,OAAO;CACP,MAAM;CACN,aAAa;CACb,KAAK;AACP;AAKA,MAAa,kBAAkB,OAAO,KAAK,MAAM;AAUjD,SAAS,sBAAsB,OAAe,QAAgB,WAA4B;CACxF,MAAM,UAAA,GAASA,SAAAA,MAAAA,CAAM,KAAK;CAC1B,OAAO,QAAQ,WAAW,UAAU,OAAO,cAAc;AAC3D;AAEA,SAAS,WAAW,QAAwB;CAC1C,QAAA,GAAOC,SAAAA,QAAAA,CAAQ;EAAE;EAAQ,OAAA;CAA0B,CAAC;AACtD;AAEA,SAAgB,iBAAyB;CACvC,OAAO,WAAW,OAAO,IAAI;AAC/B;AAEA,SAAgB,kBAA0B;CACxC,OAAO,WAAW,OAAO,KAAK;AAChC;AAEA,SAAgB,wBAAgC;CAC9C,OAAO,WAAW,OAAO,WAAW;AACtC;AAEA,SAAgB,iBAAyB;CACvC,OAAO,WAAW,OAAO,IAAI;AAC/B;AAEA,SAAgB,gBAAwB;CACtC,OAAO,WAAW,OAAO,GAAG;AAC9B;AAEA,SAAgB,oBAAoB,MAA4B;CAC9D,OAAO,WAAW,OAAO,KAAK;AAChC;AAEA,SAAgB,kBAAkB,OAAwB;CACxD,OAAO,sBAAsB,OAAO,OAAO,MAAA,EAAwB;AACrE;AAEA,SAAgB,mBAAmB,OAAwB;CACzD,OAAO,sBAAsB,OAAO,OAAO,OAAA,EAAyB;AACtE;AAEA,SAAgB,kBAAkB,OAAwB;CACxD,OAAO,sBAAsB,OAAO,OAAO,MAAA,EAAwB;AACrE;AAEA,SAAgB,yBAAyB,OAAwB;CAC/D,OAAO,sBAAsB,OAAO,OAAO,aAAA,EAA+B;AAC5E;AAEA,SAAgB,iBAAiB,OAAwB;CACvD,OAAO,sBAAsB,OAAO,OAAO,KAAA,EAAuB;AACpE;AAEA,SAAgB,cAAc,MAAoB,OAAwB;CACxE,OAAO,sBAAsB,OAAO,OAAO,OAAA,EAAyB;AACtE;AAEA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,yBAAyB,KAAK;AACvC;AAEA,SAAgB,oBAAoB,MAAsC;CACxE,MAAM,SAAS,OAAO;CACtB,OAAO;EACL;EACA;EACA,qBAAqB,GAAG,OAAO;EAC/B,OAAA;EACA,gBAAgB,GAAG,OAAO;CAC5B;AACF;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,KAAI,SAAQ,oBAAoB,IAAI,CAAC;AAC9D"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
declare const CANONICAL_ID_WORDS = 10;
|
|
1
|
+
export declare const CANONICAL_ID_WORDS = 10;
|
|
2
2
|
declare const PREFIX: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
readonly test: 't';
|
|
4
|
+
readonly suite: 's';
|
|
5
|
+
readonly hook: 'h';
|
|
6
|
+
readonly observation: 'obs';
|
|
7
|
+
readonly run: 'r';
|
|
8
8
|
};
|
|
9
9
|
type Prefix = (typeof PREFIX)[keyof typeof PREFIX];
|
|
10
10
|
type EntityIdType = keyof typeof PREFIX;
|
|
11
|
-
declare const ENTITY_ID_TYPES: EntityIdType[];
|
|
11
|
+
export declare const ENTITY_ID_TYPES: EntityIdType[];
|
|
12
12
|
interface EntityIdContract {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type: EntityIdType;
|
|
14
|
+
prefix: Prefix;
|
|
15
|
+
prefixWithSeparator: `${Prefix}_`;
|
|
16
|
+
words: number;
|
|
17
|
+
examplePattern: string;
|
|
18
18
|
}
|
|
19
|
-
declare function generateTestId(): string;
|
|
20
|
-
declare function generateSuiteId(): string;
|
|
21
|
-
declare function generateObservationId(): string;
|
|
22
|
-
declare function generateHookId(): string;
|
|
23
|
-
declare function generateRunId(): string;
|
|
24
|
-
declare function generateCanonicalId(type: EntityIdType): string;
|
|
25
|
-
declare function isCanonicalTestId(value: string): boolean;
|
|
26
|
-
declare function isCanonicalSuiteId(value: string): boolean;
|
|
27
|
-
declare function isCanonicalHookId(value: string): boolean;
|
|
28
|
-
declare function isCanonicalObservationId(value: string): boolean;
|
|
29
|
-
declare function isCanonicalRunId(value: string): boolean;
|
|
30
|
-
declare function isCanonicalId(type: EntityIdType, value: string): boolean;
|
|
31
|
-
declare function isObservationId(value: string): boolean;
|
|
32
|
-
declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
33
|
-
declare function getEntityIdContracts(): EntityIdContract[];
|
|
34
|
-
|
|
35
|
-
export { CANONICAL_ID_WORDS, ENTITY_ID_TYPES, type EntityIdContract, type EntityIdType, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId };
|
|
19
|
+
export declare function generateTestId(): string;
|
|
20
|
+
export declare function generateSuiteId(): string;
|
|
21
|
+
export declare function generateObservationId(): string;
|
|
22
|
+
export declare function generateHookId(): string;
|
|
23
|
+
export declare function generateRunId(): string;
|
|
24
|
+
export declare function generateCanonicalId(type: EntityIdType): string;
|
|
25
|
+
export declare function isCanonicalTestId(value: string): boolean;
|
|
26
|
+
export declare function isCanonicalSuiteId(value: string): boolean;
|
|
27
|
+
export declare function isCanonicalHookId(value: string): boolean;
|
|
28
|
+
export declare function isCanonicalObservationId(value: string): boolean;
|
|
29
|
+
export declare function isCanonicalRunId(value: string): boolean;
|
|
30
|
+
export declare function isCanonicalId(type: EntityIdType, value: string): boolean;
|
|
31
|
+
export declare function isObservationId(value: string): boolean;
|
|
32
|
+
export declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
33
|
+
export declare function getEntityIdContracts(): EntityIdContract[];
|
|
34
|
+
export type { EntityIdContract, EntityIdType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
declare const CANONICAL_ID_WORDS = 10;
|
|
1
|
+
export declare const CANONICAL_ID_WORDS = 10;
|
|
2
2
|
declare const PREFIX: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
readonly test: 't';
|
|
4
|
+
readonly suite: 's';
|
|
5
|
+
readonly hook: 'h';
|
|
6
|
+
readonly observation: 'obs';
|
|
7
|
+
readonly run: 'r';
|
|
8
8
|
};
|
|
9
9
|
type Prefix = (typeof PREFIX)[keyof typeof PREFIX];
|
|
10
10
|
type EntityIdType = keyof typeof PREFIX;
|
|
11
|
-
declare const ENTITY_ID_TYPES: EntityIdType[];
|
|
11
|
+
export declare const ENTITY_ID_TYPES: EntityIdType[];
|
|
12
12
|
interface EntityIdContract {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type: EntityIdType;
|
|
14
|
+
prefix: Prefix;
|
|
15
|
+
prefixWithSeparator: `${Prefix}_`;
|
|
16
|
+
words: number;
|
|
17
|
+
examplePattern: string;
|
|
18
18
|
}
|
|
19
|
-
declare function generateTestId(): string;
|
|
20
|
-
declare function generateSuiteId(): string;
|
|
21
|
-
declare function generateObservationId(): string;
|
|
22
|
-
declare function generateHookId(): string;
|
|
23
|
-
declare function generateRunId(): string;
|
|
24
|
-
declare function generateCanonicalId(type: EntityIdType): string;
|
|
25
|
-
declare function isCanonicalTestId(value: string): boolean;
|
|
26
|
-
declare function isCanonicalSuiteId(value: string): boolean;
|
|
27
|
-
declare function isCanonicalHookId(value: string): boolean;
|
|
28
|
-
declare function isCanonicalObservationId(value: string): boolean;
|
|
29
|
-
declare function isCanonicalRunId(value: string): boolean;
|
|
30
|
-
declare function isCanonicalId(type: EntityIdType, value: string): boolean;
|
|
31
|
-
declare function isObservationId(value: string): boolean;
|
|
32
|
-
declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
33
|
-
declare function getEntityIdContracts(): EntityIdContract[];
|
|
34
|
-
|
|
35
|
-
export { CANONICAL_ID_WORDS, ENTITY_ID_TYPES, type EntityIdContract, type EntityIdType, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId };
|
|
19
|
+
export declare function generateTestId(): string;
|
|
20
|
+
export declare function generateSuiteId(): string;
|
|
21
|
+
export declare function generateObservationId(): string;
|
|
22
|
+
export declare function generateHookId(): string;
|
|
23
|
+
export declare function generateRunId(): string;
|
|
24
|
+
export declare function generateCanonicalId(type: EntityIdType): string;
|
|
25
|
+
export declare function isCanonicalTestId(value: string): boolean;
|
|
26
|
+
export declare function isCanonicalSuiteId(value: string): boolean;
|
|
27
|
+
export declare function isCanonicalHookId(value: string): boolean;
|
|
28
|
+
export declare function isCanonicalObservationId(value: string): boolean;
|
|
29
|
+
export declare function isCanonicalRunId(value: string): boolean;
|
|
30
|
+
export declare function isCanonicalId(type: EntityIdType, value: string): boolean;
|
|
31
|
+
export declare function isObservationId(value: string): boolean;
|
|
32
|
+
export declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
33
|
+
export declare function getEntityIdContracts(): EntityIdContract[];
|
|
34
|
+
export type { EntityIdContract, EntityIdType };
|
package/dist/index.js
CHANGED
|
@@ -1,90 +1,76 @@
|
|
|
1
|
-
// src/persistent-id.ts
|
|
2
1
|
import { idAgent, parse } from "id-agent";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
// src/persistent-id.ts
|
|
3
|
+
const CANONICAL_ID_WORDS = 10;
|
|
4
|
+
const PREFIX = {
|
|
5
|
+
test: "t",
|
|
6
|
+
suite: "s",
|
|
7
|
+
hook: "h",
|
|
8
|
+
observation: "obs",
|
|
9
|
+
run: "r"
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
const ENTITY_ID_TYPES = Object.keys(PREFIX);
|
|
12
12
|
function hasPrefixAndWordCount(value, prefix, wordCount) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const parsed = parse(value);
|
|
14
|
+
return parsed?.prefix === prefix && parsed.wordCount === wordCount;
|
|
15
15
|
}
|
|
16
16
|
function generateId(prefix) {
|
|
17
|
-
|
|
17
|
+
return idAgent({
|
|
18
|
+
prefix,
|
|
19
|
+
words: 10
|
|
20
|
+
});
|
|
18
21
|
}
|
|
19
22
|
function generateTestId() {
|
|
20
|
-
|
|
23
|
+
return generateId(PREFIX.test);
|
|
21
24
|
}
|
|
22
25
|
function generateSuiteId() {
|
|
23
|
-
|
|
26
|
+
return generateId(PREFIX.suite);
|
|
24
27
|
}
|
|
25
28
|
function generateObservationId() {
|
|
26
|
-
|
|
29
|
+
return generateId(PREFIX.observation);
|
|
27
30
|
}
|
|
28
31
|
function generateHookId() {
|
|
29
|
-
|
|
32
|
+
return generateId(PREFIX.hook);
|
|
30
33
|
}
|
|
31
34
|
function generateRunId() {
|
|
32
|
-
|
|
35
|
+
return generateId(PREFIX.run);
|
|
33
36
|
}
|
|
34
37
|
function generateCanonicalId(type) {
|
|
35
|
-
|
|
38
|
+
return generateId(PREFIX[type]);
|
|
36
39
|
}
|
|
37
40
|
function isCanonicalTestId(value) {
|
|
38
|
-
|
|
41
|
+
return hasPrefixAndWordCount(value, PREFIX.test, 10);
|
|
39
42
|
}
|
|
40
43
|
function isCanonicalSuiteId(value) {
|
|
41
|
-
|
|
44
|
+
return hasPrefixAndWordCount(value, PREFIX.suite, 10);
|
|
42
45
|
}
|
|
43
46
|
function isCanonicalHookId(value) {
|
|
44
|
-
|
|
47
|
+
return hasPrefixAndWordCount(value, PREFIX.hook, 10);
|
|
45
48
|
}
|
|
46
49
|
function isCanonicalObservationId(value) {
|
|
47
|
-
|
|
50
|
+
return hasPrefixAndWordCount(value, PREFIX.observation, 10);
|
|
48
51
|
}
|
|
49
52
|
function isCanonicalRunId(value) {
|
|
50
|
-
|
|
53
|
+
return hasPrefixAndWordCount(value, PREFIX.run, 10);
|
|
51
54
|
}
|
|
52
55
|
function isCanonicalId(type, value) {
|
|
53
|
-
|
|
56
|
+
return hasPrefixAndWordCount(value, PREFIX[type], 10);
|
|
54
57
|
}
|
|
55
58
|
function isObservationId(value) {
|
|
56
|
-
|
|
59
|
+
return isCanonicalObservationId(value);
|
|
57
60
|
}
|
|
58
61
|
function getEntityIdContract(type) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const prefix = PREFIX[type];
|
|
63
|
+
return {
|
|
64
|
+
type,
|
|
65
|
+
prefix,
|
|
66
|
+
prefixWithSeparator: `${prefix}_`,
|
|
67
|
+
words: 10,
|
|
68
|
+
examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`
|
|
69
|
+
};
|
|
67
70
|
}
|
|
68
71
|
function getEntityIdContracts() {
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
|
|
73
|
-
ENTITY_ID_TYPES,
|
|
74
|
-
generateCanonicalId,
|
|
75
|
-
generateHookId,
|
|
76
|
-
generateObservationId,
|
|
77
|
-
generateRunId,
|
|
78
|
-
generateSuiteId,
|
|
79
|
-
generateTestId,
|
|
80
|
-
getEntityIdContract,
|
|
81
|
-
getEntityIdContracts,
|
|
82
|
-
isCanonicalHookId,
|
|
83
|
-
isCanonicalId,
|
|
84
|
-
isCanonicalObservationId,
|
|
85
|
-
isCanonicalRunId,
|
|
86
|
-
isCanonicalSuiteId,
|
|
87
|
-
isCanonicalTestId,
|
|
88
|
-
isObservationId
|
|
89
|
-
};
|
|
72
|
+
return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
|
|
73
|
+
}
|
|
74
|
+
export { CANONICAL_ID_WORDS, ENTITY_ID_TYPES, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId };
|
|
75
|
+
|
|
90
76
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/persistent-id.ts"],"sourcesContent":["import { idAgent, parse } from 'id-agent'\n\nexport const CANONICAL_ID_WORDS = 10\n\nconst PREFIX = {\n test: 't',\n suite: 's',\n hook: 'h',\n observation: 'obs',\n run: 'r',\n} as const\n\ntype Prefix = (typeof PREFIX)[keyof typeof PREFIX]\nexport type EntityIdType = keyof typeof PREFIX\n\nexport const ENTITY_ID_TYPES = Object.keys(PREFIX) as EntityIdType[]\n\nexport interface EntityIdContract {\n type: EntityIdType\n prefix: Prefix\n prefixWithSeparator: `${Prefix}_`\n words: number\n examplePattern: string\n}\n\nfunction hasPrefixAndWordCount(value: string, prefix: Prefix, wordCount: number): boolean {\n const parsed = parse(value)\n return parsed?.prefix === prefix && parsed.wordCount === wordCount\n}\n\nfunction generateId(prefix: Prefix): string {\n return idAgent({ prefix, words: CANONICAL_ID_WORDS })\n}\n\nexport function generateTestId(): string {\n return generateId(PREFIX.test)\n}\n\nexport function generateSuiteId(): string {\n return generateId(PREFIX.suite)\n}\n\nexport function generateObservationId(): string {\n return generateId(PREFIX.observation)\n}\n\nexport function generateHookId(): string {\n return generateId(PREFIX.hook)\n}\n\nexport function generateRunId(): string {\n return generateId(PREFIX.run)\n}\n\nexport function generateCanonicalId(type: EntityIdType): string {\n return generateId(PREFIX[type])\n}\n\nexport function isCanonicalTestId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.test, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalSuiteId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.suite, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalHookId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.hook, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalObservationId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.observation, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalRunId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.run, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalId(type: EntityIdType, value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS)\n}\n\nexport function isObservationId(value: string): boolean {\n return isCanonicalObservationId(value)\n}\n\nexport function getEntityIdContract(type: EntityIdType): EntityIdContract {\n const prefix = PREFIX[type]\n return {\n type,\n prefix,\n prefixWithSeparator: `${prefix}_`,\n words: CANONICAL_ID_WORDS,\n examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`,\n }\n}\n\nexport function getEntityIdContracts(): EntityIdContract[] {\n return ENTITY_ID_TYPES.map(type => getEntityIdContract(type))\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/persistent-id.ts"],"sourcesContent":["import { idAgent, parse } from 'id-agent'\n\nexport const CANONICAL_ID_WORDS = 10\n\nconst PREFIX = {\n test: 't',\n suite: 's',\n hook: 'h',\n observation: 'obs',\n run: 'r',\n} as const\n\ntype Prefix = (typeof PREFIX)[keyof typeof PREFIX]\nexport type EntityIdType = keyof typeof PREFIX\n\nexport const ENTITY_ID_TYPES = Object.keys(PREFIX) as EntityIdType[]\n\nexport interface EntityIdContract {\n type: EntityIdType\n prefix: Prefix\n prefixWithSeparator: `${Prefix}_`\n words: number\n examplePattern: string\n}\n\nfunction hasPrefixAndWordCount(value: string, prefix: Prefix, wordCount: number): boolean {\n const parsed = parse(value)\n return parsed?.prefix === prefix && parsed.wordCount === wordCount\n}\n\nfunction generateId(prefix: Prefix): string {\n return idAgent({ prefix, words: CANONICAL_ID_WORDS })\n}\n\nexport function generateTestId(): string {\n return generateId(PREFIX.test)\n}\n\nexport function generateSuiteId(): string {\n return generateId(PREFIX.suite)\n}\n\nexport function generateObservationId(): string {\n return generateId(PREFIX.observation)\n}\n\nexport function generateHookId(): string {\n return generateId(PREFIX.hook)\n}\n\nexport function generateRunId(): string {\n return generateId(PREFIX.run)\n}\n\nexport function generateCanonicalId(type: EntityIdType): string {\n return generateId(PREFIX[type])\n}\n\nexport function isCanonicalTestId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.test, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalSuiteId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.suite, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalHookId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.hook, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalObservationId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.observation, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalRunId(value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX.run, CANONICAL_ID_WORDS)\n}\n\nexport function isCanonicalId(type: EntityIdType, value: string): boolean {\n return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS)\n}\n\nexport function isObservationId(value: string): boolean {\n return isCanonicalObservationId(value)\n}\n\nexport function getEntityIdContract(type: EntityIdType): EntityIdContract {\n const prefix = PREFIX[type]\n return {\n type,\n prefix,\n prefixWithSeparator: `${prefix}_`,\n words: CANONICAL_ID_WORDS,\n examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`,\n }\n}\n\nexport function getEntityIdContracts(): EntityIdContract[] {\n return ENTITY_ID_TYPES.map(type => getEntityIdContract(type))\n}\n"],"mappings":";;AAEA,MAAa,qBAAqB;AAElC,MAAM,SAAS;CACb,MAAM;CACN,OAAO;CACP,MAAM;CACN,aAAa;CACb,KAAK;AACP;AAKA,MAAa,kBAAkB,OAAO,KAAK,MAAM;AAUjD,SAAS,sBAAsB,OAAe,QAAgB,WAA4B;CACxF,MAAM,SAAS,MAAM,KAAK;CAC1B,OAAO,QAAQ,WAAW,UAAU,OAAO,cAAc;AAC3D;AAEA,SAAS,WAAW,QAAwB;CAC1C,OAAO,QAAQ;EAAE;EAAQ,OAAA;CAA0B,CAAC;AACtD;AAEA,SAAgB,iBAAyB;CACvC,OAAO,WAAW,OAAO,IAAI;AAC/B;AAEA,SAAgB,kBAA0B;CACxC,OAAO,WAAW,OAAO,KAAK;AAChC;AAEA,SAAgB,wBAAgC;CAC9C,OAAO,WAAW,OAAO,WAAW;AACtC;AAEA,SAAgB,iBAAyB;CACvC,OAAO,WAAW,OAAO,IAAI;AAC/B;AAEA,SAAgB,gBAAwB;CACtC,OAAO,WAAW,OAAO,GAAG;AAC9B;AAEA,SAAgB,oBAAoB,MAA4B;CAC9D,OAAO,WAAW,OAAO,KAAK;AAChC;AAEA,SAAgB,kBAAkB,OAAwB;CACxD,OAAO,sBAAsB,OAAO,OAAO,MAAA,EAAwB;AACrE;AAEA,SAAgB,mBAAmB,OAAwB;CACzD,OAAO,sBAAsB,OAAO,OAAO,OAAA,EAAyB;AACtE;AAEA,SAAgB,kBAAkB,OAAwB;CACxD,OAAO,sBAAsB,OAAO,OAAO,MAAA,EAAwB;AACrE;AAEA,SAAgB,yBAAyB,OAAwB;CAC/D,OAAO,sBAAsB,OAAO,OAAO,aAAA,EAA+B;AAC5E;AAEA,SAAgB,iBAAiB,OAAwB;CACvD,OAAO,sBAAsB,OAAO,OAAO,KAAA,EAAuB;AACpE;AAEA,SAAgB,cAAc,MAAoB,OAAwB;CACxE,OAAO,sBAAsB,OAAO,OAAO,OAAA,EAAyB;AACtE;AAEA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,yBAAyB,KAAK;AACvC;AAEA,SAAgB,oBAAoB,MAAsC;CACxE,MAAM,SAAS,OAAO;CACtB,OAAO;EACL;EACA;EACA,qBAAqB,GAAG,OAAO;EAC/B,OAAA;EACA,gBAAgB,GAAG,OAAO;CAC5B;AACF;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,KAAI,SAAQ,oBAAoB,IAAI,CAAC;AAC9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vostride/agent-qa-ids",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Canonical ID helpers for agent-qa tests, suites, hooks, and artifacts.",
|
|
6
6
|
"keywords": [
|
|
@@ -29,9 +29,14 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/index.d.cts",
|
|
38
|
+
"default": "./dist/index.cjs"
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
},
|
|
37
42
|
"files": [
|
|
@@ -40,8 +45,8 @@
|
|
|
40
45
|
"NOTICE.md"
|
|
41
46
|
],
|
|
42
47
|
"scripts": {
|
|
43
|
-
"build": "
|
|
44
|
-
"dev": "
|
|
48
|
+
"build": "tsdown",
|
|
49
|
+
"dev": "tsdown --watch",
|
|
45
50
|
"test": "vitest run",
|
|
46
51
|
"typecheck": "tsc --noEmit",
|
|
47
52
|
"clean": "rm -rf dist .turbo"
|
|
@@ -50,10 +55,10 @@
|
|
|
50
55
|
"id-agent": "1.0.3"
|
|
51
56
|
},
|
|
52
57
|
"devDependencies": {
|
|
53
|
-
"@types/node": "~24.
|
|
54
|
-
"@vostride/agent-qa-arch": "0.2.
|
|
55
|
-
"
|
|
56
|
-
"typescript": "~
|
|
57
|
-
"vitest": "~
|
|
58
|
+
"@types/node": "~24.19.2",
|
|
59
|
+
"@vostride/agent-qa-arch": "0.2.5",
|
|
60
|
+
"tsdown": "~0.23.4",
|
|
61
|
+
"typescript": "~7.0.2",
|
|
62
|
+
"vitest": "~5.0.5"
|
|
58
63
|
}
|
|
59
64
|
}
|