@vostride/agent-qa-ids 0.2.3 → 0.2.4
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 +3 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -42
- package/dist/index.d.ts +1 -42
- package/dist/index.js +2 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -20,12 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
APPROVED_SAAS_PLACEHOLDERS: () => APPROVED_SAAS_PLACEHOLDERS,
|
|
24
|
-
APPROVED_SAAS_PLACEHOLDER_NAMES: () => APPROVED_SAAS_PLACEHOLDER_NAMES,
|
|
25
|
-
APPROVED_SAAS_PLACEHOLDER_SLUGS: () => APPROVED_SAAS_PLACEHOLDER_SLUGS,
|
|
26
23
|
CANONICAL_ID_WORDS: () => CANONICAL_ID_WORDS,
|
|
27
24
|
ENTITY_ID_TYPES: () => ENTITY_ID_TYPES,
|
|
28
|
-
LEGACY_OBSERVATION_ID_WORDS: () => LEGACY_OBSERVATION_ID_WORDS,
|
|
29
25
|
generateCanonicalId: () => generateCanonicalId,
|
|
30
26
|
generateHookId: () => generateHookId,
|
|
31
27
|
generateObservationId: () => generateObservationId,
|
|
@@ -40,16 +36,13 @@ __export(index_exports, {
|
|
|
40
36
|
isCanonicalRunId: () => isCanonicalRunId,
|
|
41
37
|
isCanonicalSuiteId: () => isCanonicalSuiteId,
|
|
42
38
|
isCanonicalTestId: () => isCanonicalTestId,
|
|
43
|
-
isObservationId: () => isObservationId
|
|
44
|
-
selectApprovedSaasPlaceholder: () => selectApprovedSaasPlaceholder,
|
|
45
|
-
selectApprovedSaasPlaceholderSlug: () => selectApprovedSaasPlaceholderSlug
|
|
39
|
+
isObservationId: () => isObservationId
|
|
46
40
|
});
|
|
47
41
|
module.exports = __toCommonJS(index_exports);
|
|
48
42
|
|
|
49
43
|
// src/persistent-id.ts
|
|
50
44
|
var import_id_agent = require("id-agent");
|
|
51
45
|
var CANONICAL_ID_WORDS = 10;
|
|
52
|
-
var LEGACY_OBSERVATION_ID_WORDS = 6;
|
|
53
46
|
var PREFIX = {
|
|
54
47
|
test: "t",
|
|
55
48
|
suite: "s",
|
|
@@ -102,7 +95,7 @@ function isCanonicalId(type, value) {
|
|
|
102
95
|
return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS);
|
|
103
96
|
}
|
|
104
97
|
function isObservationId(value) {
|
|
105
|
-
return isCanonicalObservationId(value)
|
|
98
|
+
return isCanonicalObservationId(value);
|
|
106
99
|
}
|
|
107
100
|
function getEntityIdContract(type) {
|
|
108
101
|
const prefix = PREFIX[type];
|
|
@@ -117,44 +110,10 @@ function getEntityIdContract(type) {
|
|
|
117
110
|
function getEntityIdContracts() {
|
|
118
111
|
return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
|
|
119
112
|
}
|
|
120
|
-
|
|
121
|
-
// src/product-placeholders.ts
|
|
122
|
-
var APPROVED_SAAS_PLACEHOLDERS = [
|
|
123
|
-
{ name: "Linear", slug: "linear" },
|
|
124
|
-
{ name: "Vercel", slug: "vercel" },
|
|
125
|
-
{ name: "Notion", slug: "notion" },
|
|
126
|
-
{ name: "Stripe", slug: "stripe" },
|
|
127
|
-
{ name: "GitHub", slug: "github" },
|
|
128
|
-
{ name: "Slack", slug: "slack" },
|
|
129
|
-
{ name: "Figma", slug: "figma" },
|
|
130
|
-
{ name: "Shopify", slug: "shopify" },
|
|
131
|
-
{ name: "Datadog", slug: "datadog" },
|
|
132
|
-
{ name: "Supabase", slug: "supabase" }
|
|
133
|
-
];
|
|
134
|
-
var APPROVED_SAAS_PLACEHOLDER_NAMES = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.name);
|
|
135
|
-
var APPROVED_SAAS_PLACEHOLDER_SLUGS = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.slug);
|
|
136
|
-
function hashSeed(seed) {
|
|
137
|
-
const input = String(seed);
|
|
138
|
-
let hash = 0;
|
|
139
|
-
for (let index = 0; index < input.length; index += 1) {
|
|
140
|
-
hash = hash * 31 + input.charCodeAt(index) >>> 0;
|
|
141
|
-
}
|
|
142
|
-
return hash;
|
|
143
|
-
}
|
|
144
|
-
function selectApprovedSaasPlaceholder(seed) {
|
|
145
|
-
return APPROVED_SAAS_PLACEHOLDERS[hashSeed(seed) % APPROVED_SAAS_PLACEHOLDERS.length];
|
|
146
|
-
}
|
|
147
|
-
function selectApprovedSaasPlaceholderSlug(seed) {
|
|
148
|
-
return selectApprovedSaasPlaceholder(seed).slug;
|
|
149
|
-
}
|
|
150
113
|
// Annotate the CommonJS export names for ESM import in node:
|
|
151
114
|
0 && (module.exports = {
|
|
152
|
-
APPROVED_SAAS_PLACEHOLDERS,
|
|
153
|
-
APPROVED_SAAS_PLACEHOLDER_NAMES,
|
|
154
|
-
APPROVED_SAAS_PLACEHOLDER_SLUGS,
|
|
155
115
|
CANONICAL_ID_WORDS,
|
|
156
116
|
ENTITY_ID_TYPES,
|
|
157
|
-
LEGACY_OBSERVATION_ID_WORDS,
|
|
158
117
|
generateCanonicalId,
|
|
159
118
|
generateHookId,
|
|
160
119
|
generateObservationId,
|
|
@@ -169,8 +128,6 @@ function selectApprovedSaasPlaceholderSlug(seed) {
|
|
|
169
128
|
isCanonicalRunId,
|
|
170
129
|
isCanonicalSuiteId,
|
|
171
130
|
isCanonicalTestId,
|
|
172
|
-
isObservationId
|
|
173
|
-
selectApprovedSaasPlaceholder,
|
|
174
|
-
selectApprovedSaasPlaceholderSlug
|
|
131
|
+
isObservationId
|
|
175
132
|
});
|
|
176
133
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/persistent-id.ts"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/persistent-id.ts"],"sourcesContent":["export {\n CANONICAL_ID_WORDS,\n ENTITY_ID_TYPES,\n generateCanonicalId,\n generateHookId,\n generateObservationId,\n generateRunId,\n generateSuiteId,\n generateTestId,\n getEntityIdContract,\n getEntityIdContracts,\n isCanonicalId,\n isCanonicalHookId,\n isCanonicalObservationId,\n isCanonicalRunId,\n isCanonicalSuiteId,\n isCanonicalTestId,\n isObservationId,\n type EntityIdContract,\n type EntityIdType,\n} from './persistent-id.js'\n","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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAA+B;AAExB,IAAM,qBAAqB;AAElC,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AAAA,EACb,KAAK;AACP;AAKO,IAAM,kBAAkB,OAAO,KAAK,MAAM;AAUjD,SAAS,sBAAsB,OAAe,QAAgB,WAA4B;AACxF,QAAM,aAAS,uBAAM,KAAK;AAC1B,SAAO,QAAQ,WAAW,UAAU,OAAO,cAAc;AAC3D;AAEA,SAAS,WAAW,QAAwB;AAC1C,aAAO,yBAAQ,EAAE,QAAQ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dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const CANONICAL_ID_WORDS = 10;
|
|
2
|
-
declare const LEGACY_OBSERVATION_ID_WORDS = 6;
|
|
3
2
|
declare const PREFIX: {
|
|
4
3
|
readonly test: "t";
|
|
5
4
|
readonly suite: "s";
|
|
@@ -33,44 +32,4 @@ declare function isObservationId(value: string): boolean;
|
|
|
33
32
|
declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
34
33
|
declare function getEntityIdContracts(): EntityIdContract[];
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
readonly name: string;
|
|
38
|
-
readonly slug: string;
|
|
39
|
-
}
|
|
40
|
-
declare const APPROVED_SAAS_PLACEHOLDERS: readonly [{
|
|
41
|
-
readonly name: "Linear";
|
|
42
|
-
readonly slug: "linear";
|
|
43
|
-
}, {
|
|
44
|
-
readonly name: "Vercel";
|
|
45
|
-
readonly slug: "vercel";
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "Notion";
|
|
48
|
-
readonly slug: "notion";
|
|
49
|
-
}, {
|
|
50
|
-
readonly name: "Stripe";
|
|
51
|
-
readonly slug: "stripe";
|
|
52
|
-
}, {
|
|
53
|
-
readonly name: "GitHub";
|
|
54
|
-
readonly slug: "github";
|
|
55
|
-
}, {
|
|
56
|
-
readonly name: "Slack";
|
|
57
|
-
readonly slug: "slack";
|
|
58
|
-
}, {
|
|
59
|
-
readonly name: "Figma";
|
|
60
|
-
readonly slug: "figma";
|
|
61
|
-
}, {
|
|
62
|
-
readonly name: "Shopify";
|
|
63
|
-
readonly slug: "shopify";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "Datadog";
|
|
66
|
-
readonly slug: "datadog";
|
|
67
|
-
}, {
|
|
68
|
-
readonly name: "Supabase";
|
|
69
|
-
readonly slug: "supabase";
|
|
70
|
-
}];
|
|
71
|
-
declare const APPROVED_SAAS_PLACEHOLDER_NAMES: ("Linear" | "Vercel" | "Notion" | "Stripe" | "GitHub" | "Slack" | "Figma" | "Shopify" | "Datadog" | "Supabase")[];
|
|
72
|
-
declare const APPROVED_SAAS_PLACEHOLDER_SLUGS: ("linear" | "vercel" | "notion" | "stripe" | "github" | "slack" | "figma" | "shopify" | "datadog" | "supabase")[];
|
|
73
|
-
declare function selectApprovedSaasPlaceholder(seed: string | number): ApprovedSaasPlaceholder;
|
|
74
|
-
declare function selectApprovedSaasPlaceholderSlug(seed: string | number): string;
|
|
75
|
-
|
|
76
|
-
export { APPROVED_SAAS_PLACEHOLDERS, APPROVED_SAAS_PLACEHOLDER_NAMES, APPROVED_SAAS_PLACEHOLDER_SLUGS, type ApprovedSaasPlaceholder, CANONICAL_ID_WORDS, ENTITY_ID_TYPES, type EntityIdContract, type EntityIdType, LEGACY_OBSERVATION_ID_WORDS, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId, selectApprovedSaasPlaceholder, selectApprovedSaasPlaceholderSlug };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const CANONICAL_ID_WORDS = 10;
|
|
2
|
-
declare const LEGACY_OBSERVATION_ID_WORDS = 6;
|
|
3
2
|
declare const PREFIX: {
|
|
4
3
|
readonly test: "t";
|
|
5
4
|
readonly suite: "s";
|
|
@@ -33,44 +32,4 @@ declare function isObservationId(value: string): boolean;
|
|
|
33
32
|
declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
|
|
34
33
|
declare function getEntityIdContracts(): EntityIdContract[];
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
readonly name: string;
|
|
38
|
-
readonly slug: string;
|
|
39
|
-
}
|
|
40
|
-
declare const APPROVED_SAAS_PLACEHOLDERS: readonly [{
|
|
41
|
-
readonly name: "Linear";
|
|
42
|
-
readonly slug: "linear";
|
|
43
|
-
}, {
|
|
44
|
-
readonly name: "Vercel";
|
|
45
|
-
readonly slug: "vercel";
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "Notion";
|
|
48
|
-
readonly slug: "notion";
|
|
49
|
-
}, {
|
|
50
|
-
readonly name: "Stripe";
|
|
51
|
-
readonly slug: "stripe";
|
|
52
|
-
}, {
|
|
53
|
-
readonly name: "GitHub";
|
|
54
|
-
readonly slug: "github";
|
|
55
|
-
}, {
|
|
56
|
-
readonly name: "Slack";
|
|
57
|
-
readonly slug: "slack";
|
|
58
|
-
}, {
|
|
59
|
-
readonly name: "Figma";
|
|
60
|
-
readonly slug: "figma";
|
|
61
|
-
}, {
|
|
62
|
-
readonly name: "Shopify";
|
|
63
|
-
readonly slug: "shopify";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "Datadog";
|
|
66
|
-
readonly slug: "datadog";
|
|
67
|
-
}, {
|
|
68
|
-
readonly name: "Supabase";
|
|
69
|
-
readonly slug: "supabase";
|
|
70
|
-
}];
|
|
71
|
-
declare const APPROVED_SAAS_PLACEHOLDER_NAMES: ("Linear" | "Vercel" | "Notion" | "Stripe" | "GitHub" | "Slack" | "Figma" | "Shopify" | "Datadog" | "Supabase")[];
|
|
72
|
-
declare const APPROVED_SAAS_PLACEHOLDER_SLUGS: ("linear" | "vercel" | "notion" | "stripe" | "github" | "slack" | "figma" | "shopify" | "datadog" | "supabase")[];
|
|
73
|
-
declare function selectApprovedSaasPlaceholder(seed: string | number): ApprovedSaasPlaceholder;
|
|
74
|
-
declare function selectApprovedSaasPlaceholderSlug(seed: string | number): string;
|
|
75
|
-
|
|
76
|
-
export { APPROVED_SAAS_PLACEHOLDERS, APPROVED_SAAS_PLACEHOLDER_NAMES, APPROVED_SAAS_PLACEHOLDER_SLUGS, type ApprovedSaasPlaceholder, CANONICAL_ID_WORDS, ENTITY_ID_TYPES, type EntityIdContract, type EntityIdType, LEGACY_OBSERVATION_ID_WORDS, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId, selectApprovedSaasPlaceholder, selectApprovedSaasPlaceholderSlug };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/persistent-id.ts
|
|
2
2
|
import { idAgent, parse } from "id-agent";
|
|
3
3
|
var CANONICAL_ID_WORDS = 10;
|
|
4
|
-
var LEGACY_OBSERVATION_ID_WORDS = 6;
|
|
5
4
|
var PREFIX = {
|
|
6
5
|
test: "t",
|
|
7
6
|
suite: "s",
|
|
@@ -54,7 +53,7 @@ function isCanonicalId(type, value) {
|
|
|
54
53
|
return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS);
|
|
55
54
|
}
|
|
56
55
|
function isObservationId(value) {
|
|
57
|
-
return isCanonicalObservationId(value)
|
|
56
|
+
return isCanonicalObservationId(value);
|
|
58
57
|
}
|
|
59
58
|
function getEntityIdContract(type) {
|
|
60
59
|
const prefix = PREFIX[type];
|
|
@@ -69,43 +68,9 @@ function getEntityIdContract(type) {
|
|
|
69
68
|
function getEntityIdContracts() {
|
|
70
69
|
return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
// src/product-placeholders.ts
|
|
74
|
-
var APPROVED_SAAS_PLACEHOLDERS = [
|
|
75
|
-
{ name: "Linear", slug: "linear" },
|
|
76
|
-
{ name: "Vercel", slug: "vercel" },
|
|
77
|
-
{ name: "Notion", slug: "notion" },
|
|
78
|
-
{ name: "Stripe", slug: "stripe" },
|
|
79
|
-
{ name: "GitHub", slug: "github" },
|
|
80
|
-
{ name: "Slack", slug: "slack" },
|
|
81
|
-
{ name: "Figma", slug: "figma" },
|
|
82
|
-
{ name: "Shopify", slug: "shopify" },
|
|
83
|
-
{ name: "Datadog", slug: "datadog" },
|
|
84
|
-
{ name: "Supabase", slug: "supabase" }
|
|
85
|
-
];
|
|
86
|
-
var APPROVED_SAAS_PLACEHOLDER_NAMES = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.name);
|
|
87
|
-
var APPROVED_SAAS_PLACEHOLDER_SLUGS = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.slug);
|
|
88
|
-
function hashSeed(seed) {
|
|
89
|
-
const input = String(seed);
|
|
90
|
-
let hash = 0;
|
|
91
|
-
for (let index = 0; index < input.length; index += 1) {
|
|
92
|
-
hash = hash * 31 + input.charCodeAt(index) >>> 0;
|
|
93
|
-
}
|
|
94
|
-
return hash;
|
|
95
|
-
}
|
|
96
|
-
function selectApprovedSaasPlaceholder(seed) {
|
|
97
|
-
return APPROVED_SAAS_PLACEHOLDERS[hashSeed(seed) % APPROVED_SAAS_PLACEHOLDERS.length];
|
|
98
|
-
}
|
|
99
|
-
function selectApprovedSaasPlaceholderSlug(seed) {
|
|
100
|
-
return selectApprovedSaasPlaceholder(seed).slug;
|
|
101
|
-
}
|
|
102
71
|
export {
|
|
103
|
-
APPROVED_SAAS_PLACEHOLDERS,
|
|
104
|
-
APPROVED_SAAS_PLACEHOLDER_NAMES,
|
|
105
|
-
APPROVED_SAAS_PLACEHOLDER_SLUGS,
|
|
106
72
|
CANONICAL_ID_WORDS,
|
|
107
73
|
ENTITY_ID_TYPES,
|
|
108
|
-
LEGACY_OBSERVATION_ID_WORDS,
|
|
109
74
|
generateCanonicalId,
|
|
110
75
|
generateHookId,
|
|
111
76
|
generateObservationId,
|
|
@@ -120,8 +85,6 @@ export {
|
|
|
120
85
|
isCanonicalRunId,
|
|
121
86
|
isCanonicalSuiteId,
|
|
122
87
|
isCanonicalTestId,
|
|
123
|
-
isObservationId
|
|
124
|
-
selectApprovedSaasPlaceholder,
|
|
125
|
-
selectApprovedSaasPlaceholderSlug
|
|
88
|
+
isObservationId
|
|
126
89
|
};
|
|
127
90
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/persistent-id.ts"
|
|
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":";AAAA,SAAS,SAAS,aAAa;AAExB,IAAM,qBAAqB;AAElC,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AAAA,EACb,KAAK;AACP;AAKO,IAAM,kBAAkB,OAAO,KAAK,MAAM;AAUjD,SAAS,sBAAsB,OAAe,QAAgB,WAA4B;AACxF,QAAM,SAAS,MAAM,KAAK;AAC1B,SAAO,QAAQ,WAAW,UAAU,OAAO,c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SAAO,gBAAgB,IAAI,UAAQ,oBAAoB,IAAI,CAAC;AAC9D;","names":[]}
|
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.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Canonical ID helpers for agent-qa tests, suites, hooks, and artifacts.",
|
|
6
6
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "~24.12.2",
|
|
54
|
-
"@vostride/agent-qa-arch": "0.2.
|
|
54
|
+
"@vostride/agent-qa-arch": "0.2.4",
|
|
55
55
|
"tsup": "~8.5.1",
|
|
56
56
|
"typescript": "~6.0.3",
|
|
57
57
|
"vitest": "~4.1.5"
|