@vostride/agent-qa-ids 0.2.3 → 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 CHANGED
@@ -1,176 +1,93 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
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
- 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
- CANONICAL_ID_WORDS: () => CANONICAL_ID_WORDS,
27
- ENTITY_ID_TYPES: () => ENTITY_ID_TYPES,
28
- LEGACY_OBSERVATION_ID_WORDS: () => LEGACY_OBSERVATION_ID_WORDS,
29
- generateCanonicalId: () => generateCanonicalId,
30
- generateHookId: () => generateHookId,
31
- generateObservationId: () => generateObservationId,
32
- generateRunId: () => generateRunId,
33
- generateSuiteId: () => generateSuiteId,
34
- generateTestId: () => generateTestId,
35
- getEntityIdContract: () => getEntityIdContract,
36
- getEntityIdContracts: () => getEntityIdContracts,
37
- isCanonicalHookId: () => isCanonicalHookId,
38
- isCanonicalId: () => isCanonicalId,
39
- isCanonicalObservationId: () => isCanonicalObservationId,
40
- isCanonicalRunId: () => isCanonicalRunId,
41
- isCanonicalSuiteId: () => isCanonicalSuiteId,
42
- isCanonicalTestId: () => isCanonicalTestId,
43
- isObservationId: () => isObservationId,
44
- selectApprovedSaasPlaceholder: () => selectApprovedSaasPlaceholder,
45
- selectApprovedSaasPlaceholderSlug: () => selectApprovedSaasPlaceholderSlug
46
- });
47
- module.exports = __toCommonJS(index_exports);
48
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let id_agent = require("id-agent");
49
3
  // src/persistent-id.ts
50
- var import_id_agent = require("id-agent");
51
- var CANONICAL_ID_WORDS = 10;
52
- var LEGACY_OBSERVATION_ID_WORDS = 6;
53
- var PREFIX = {
54
- test: "t",
55
- suite: "s",
56
- hook: "h",
57
- observation: "obs",
58
- 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"
59
11
  };
60
- var ENTITY_ID_TYPES = Object.keys(PREFIX);
12
+ const ENTITY_ID_TYPES = Object.keys(PREFIX);
61
13
  function hasPrefixAndWordCount(value, prefix, wordCount) {
62
- const parsed = (0, import_id_agent.parse)(value);
63
- return parsed?.prefix === prefix && parsed.wordCount === wordCount;
14
+ const parsed = (0, id_agent.parse)(value);
15
+ return parsed?.prefix === prefix && parsed.wordCount === wordCount;
64
16
  }
65
17
  function generateId(prefix) {
66
- return (0, import_id_agent.idAgent)({ prefix, words: CANONICAL_ID_WORDS });
18
+ return (0, id_agent.idAgent)({
19
+ prefix,
20
+ words: 10
21
+ });
67
22
  }
68
23
  function generateTestId() {
69
- return generateId(PREFIX.test);
24
+ return generateId(PREFIX.test);
70
25
  }
71
26
  function generateSuiteId() {
72
- return generateId(PREFIX.suite);
27
+ return generateId(PREFIX.suite);
73
28
  }
74
29
  function generateObservationId() {
75
- return generateId(PREFIX.observation);
30
+ return generateId(PREFIX.observation);
76
31
  }
77
32
  function generateHookId() {
78
- return generateId(PREFIX.hook);
33
+ return generateId(PREFIX.hook);
79
34
  }
80
35
  function generateRunId() {
81
- return generateId(PREFIX.run);
36
+ return generateId(PREFIX.run);
82
37
  }
83
38
  function generateCanonicalId(type) {
84
- return generateId(PREFIX[type]);
39
+ return generateId(PREFIX[type]);
85
40
  }
86
41
  function isCanonicalTestId(value) {
87
- return hasPrefixAndWordCount(value, PREFIX.test, CANONICAL_ID_WORDS);
42
+ return hasPrefixAndWordCount(value, PREFIX.test, 10);
88
43
  }
89
44
  function isCanonicalSuiteId(value) {
90
- return hasPrefixAndWordCount(value, PREFIX.suite, CANONICAL_ID_WORDS);
45
+ return hasPrefixAndWordCount(value, PREFIX.suite, 10);
91
46
  }
92
47
  function isCanonicalHookId(value) {
93
- return hasPrefixAndWordCount(value, PREFIX.hook, CANONICAL_ID_WORDS);
48
+ return hasPrefixAndWordCount(value, PREFIX.hook, 10);
94
49
  }
95
50
  function isCanonicalObservationId(value) {
96
- return hasPrefixAndWordCount(value, PREFIX.observation, CANONICAL_ID_WORDS);
51
+ return hasPrefixAndWordCount(value, PREFIX.observation, 10);
97
52
  }
98
53
  function isCanonicalRunId(value) {
99
- return hasPrefixAndWordCount(value, PREFIX.run, CANONICAL_ID_WORDS);
54
+ return hasPrefixAndWordCount(value, PREFIX.run, 10);
100
55
  }
101
56
  function isCanonicalId(type, value) {
102
- return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS);
57
+ return hasPrefixAndWordCount(value, PREFIX[type], 10);
103
58
  }
104
59
  function isObservationId(value) {
105
- return isCanonicalObservationId(value) || hasPrefixAndWordCount(value, PREFIX.observation, LEGACY_OBSERVATION_ID_WORDS);
60
+ return isCanonicalObservationId(value);
106
61
  }
107
62
  function getEntityIdContract(type) {
108
- const prefix = PREFIX[type];
109
- return {
110
- type,
111
- prefix,
112
- prefixWithSeparator: `${prefix}_`,
113
- words: CANONICAL_ID_WORDS,
114
- examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`
115
- };
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
+ };
116
71
  }
117
72
  function getEntityIdContracts() {
118
- return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
119
- }
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;
120
92
 
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
- // Annotate the CommonJS export names for ESM import in node:
151
- 0 && (module.exports = {
152
- APPROVED_SAAS_PLACEHOLDERS,
153
- APPROVED_SAAS_PLACEHOLDER_NAMES,
154
- APPROVED_SAAS_PLACEHOLDER_SLUGS,
155
- CANONICAL_ID_WORDS,
156
- ENTITY_ID_TYPES,
157
- LEGACY_OBSERVATION_ID_WORDS,
158
- generateCanonicalId,
159
- generateHookId,
160
- generateObservationId,
161
- generateRunId,
162
- generateSuiteId,
163
- generateTestId,
164
- getEntityIdContract,
165
- getEntityIdContracts,
166
- isCanonicalHookId,
167
- isCanonicalId,
168
- isCanonicalObservationId,
169
- isCanonicalRunId,
170
- isCanonicalSuiteId,
171
- isCanonicalTestId,
172
- isObservationId,
173
- selectApprovedSaasPlaceholder,
174
- selectApprovedSaasPlaceholderSlug
175
- });
176
93
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/persistent-id.ts","../src/product-placeholders.ts"],"sourcesContent":["export {\n CANONICAL_ID_WORDS,\n ENTITY_ID_TYPES,\n LEGACY_OBSERVATION_ID_WORDS,\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\nexport {\n type ApprovedSaasPlaceholder,\n APPROVED_SAAS_PLACEHOLDERS,\n APPROVED_SAAS_PLACEHOLDER_NAMES,\n APPROVED_SAAS_PLACEHOLDER_SLUGS,\n selectApprovedSaasPlaceholder,\n selectApprovedSaasPlaceholderSlug,\n} from './product-placeholders.js'\n","import { idAgent, parse } from 'id-agent'\n\nexport const CANONICAL_ID_WORDS = 10\nexport const LEGACY_OBSERVATION_ID_WORDS = 6\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 || hasPrefixAndWordCount(value, PREFIX.observation, LEGACY_OBSERVATION_ID_WORDS)\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","export interface ApprovedSaasPlaceholder {\n readonly name: string\n readonly slug: string\n}\n\nexport const APPROVED_SAAS_PLACEHOLDERS = [\n { name: 'Linear', slug: 'linear' },\n { name: 'Vercel', slug: 'vercel' },\n { name: 'Notion', slug: 'notion' },\n { name: 'Stripe', slug: 'stripe' },\n { name: 'GitHub', slug: 'github' },\n { name: 'Slack', slug: 'slack' },\n { name: 'Figma', slug: 'figma' },\n { name: 'Shopify', slug: 'shopify' },\n { name: 'Datadog', slug: 'datadog' },\n { name: 'Supabase', slug: 'supabase' },\n] as const satisfies readonly ApprovedSaasPlaceholder[]\n\nexport const APPROVED_SAAS_PLACEHOLDER_NAMES = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.name)\nexport const APPROVED_SAAS_PLACEHOLDER_SLUGS = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.slug)\n\nfunction hashSeed(seed: string | number): number {\n const input = String(seed)\n let hash = 0\n\n for (let index = 0; index < input.length; index += 1) {\n hash = (hash * 31 + input.charCodeAt(index)) >>> 0\n }\n\n return hash\n}\n\nexport function selectApprovedSaasPlaceholder(seed: string | number): ApprovedSaasPlaceholder {\n return APPROVED_SAAS_PLACEHOLDERS[hashSeed(seed) % APPROVED_SAAS_PLACEHOLDERS.length]\n}\n\nexport function selectApprovedSaasPlaceholderSlug(seed: string | number): string {\n return selectApprovedSaasPlaceholder(seed).slug\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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;AAC3B,IAAM,8BAA8B;AAE3C,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,OAAO,mBAAmB,CAAC;AACtD;AAEO,SAAS,iBAAyB;AACvC,SAAO,WAAW,OAAO,IAAI;AAC/B;AAEO,SAAS,kBAA0B;AACxC,SAAO,WAAW,OAAO,KAAK;AAChC;AAEO,SAAS,wBAAgC;AAC9C,SAAO,WAAW,OAAO,WAAW;AACtC;AAEO,SAAS,iB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AS;AAAA,EACjC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,EACjC,EAAE,MAAM,SAAS,MAAM,QAAQ;AAAA,EAC/B,EAAE,MAAM,SAAS,MAAM,QAAQ;AAAA,EAC/B,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,EACnC,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,EACnC,EAAE,MAAM,YAAY,MAAM,WAAW;AACvC;AAEO,IAAM,kCAAkC,2BAA2B,IAAI,CAAC,SAAS,KAAK,IAAI;AAC1F,IAAM,kCAAkC,2BAA2B,IAAI,CAAC,SAAS,KAAK,IAAI;AAEjG,SAAS,SAAS,MAA+B;AAC/C,QAAM,QAAQ,OAAO,IAAI;AACzB,MAAI,OAAO;AAEX,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,WAAQ,OAAO,KAAK,MAAM,WAAW,KAAK,MAAO;AAAA,EACnD;AAEA,SAAO;AACT;AAEO,SAAS,8BAA8B,MAAgD;AAC5F,SAAO,2BAA2B,SAAS,IAAI,IAAI,2BAA2B,MAAM;AACtF;AAEO,SAAS,kCAAkC,MAA+B;AAC/E,SAAO,8BAA8B,IAAI,EAAE;AAC7C;","names":[]}
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,SA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ACtD,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,76 +1,34 @@
1
- declare const CANONICAL_ID_WORDS = 10;
2
- declare const LEGACY_OBSERVATION_ID_WORDS = 6;
1
+ export declare const CANONICAL_ID_WORDS = 10;
3
2
  declare const PREFIX: {
4
- readonly test: "t";
5
- readonly suite: "s";
6
- readonly hook: "h";
7
- readonly observation: "obs";
8
- readonly run: "r";
3
+ readonly test: 't';
4
+ readonly suite: 's';
5
+ readonly hook: 'h';
6
+ readonly observation: 'obs';
7
+ readonly run: 'r';
9
8
  };
10
9
  type Prefix = (typeof PREFIX)[keyof typeof PREFIX];
11
10
  type EntityIdType = keyof typeof PREFIX;
12
- declare const ENTITY_ID_TYPES: EntityIdType[];
11
+ export declare const ENTITY_ID_TYPES: EntityIdType[];
13
12
  interface EntityIdContract {
14
- type: EntityIdType;
15
- prefix: Prefix;
16
- prefixWithSeparator: `${Prefix}_`;
17
- words: number;
18
- examplePattern: string;
13
+ type: EntityIdType;
14
+ prefix: Prefix;
15
+ prefixWithSeparator: `${Prefix}_`;
16
+ words: number;
17
+ examplePattern: string;
19
18
  }
20
- declare function generateTestId(): string;
21
- declare function generateSuiteId(): string;
22
- declare function generateObservationId(): string;
23
- declare function generateHookId(): string;
24
- declare function generateRunId(): string;
25
- declare function generateCanonicalId(type: EntityIdType): string;
26
- declare function isCanonicalTestId(value: string): boolean;
27
- declare function isCanonicalSuiteId(value: string): boolean;
28
- declare function isCanonicalHookId(value: string): boolean;
29
- declare function isCanonicalObservationId(value: string): boolean;
30
- declare function isCanonicalRunId(value: string): boolean;
31
- declare function isCanonicalId(type: EntityIdType, value: string): boolean;
32
- declare function isObservationId(value: string): boolean;
33
- declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
34
- declare function getEntityIdContracts(): EntityIdContract[];
35
-
36
- interface ApprovedSaasPlaceholder {
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 };
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,76 +1,34 @@
1
- declare const CANONICAL_ID_WORDS = 10;
2
- declare const LEGACY_OBSERVATION_ID_WORDS = 6;
1
+ export declare const CANONICAL_ID_WORDS = 10;
3
2
  declare const PREFIX: {
4
- readonly test: "t";
5
- readonly suite: "s";
6
- readonly hook: "h";
7
- readonly observation: "obs";
8
- readonly run: "r";
3
+ readonly test: 't';
4
+ readonly suite: 's';
5
+ readonly hook: 'h';
6
+ readonly observation: 'obs';
7
+ readonly run: 'r';
9
8
  };
10
9
  type Prefix = (typeof PREFIX)[keyof typeof PREFIX];
11
10
  type EntityIdType = keyof typeof PREFIX;
12
- declare const ENTITY_ID_TYPES: EntityIdType[];
11
+ export declare const ENTITY_ID_TYPES: EntityIdType[];
13
12
  interface EntityIdContract {
14
- type: EntityIdType;
15
- prefix: Prefix;
16
- prefixWithSeparator: `${Prefix}_`;
17
- words: number;
18
- examplePattern: string;
13
+ type: EntityIdType;
14
+ prefix: Prefix;
15
+ prefixWithSeparator: `${Prefix}_`;
16
+ words: number;
17
+ examplePattern: string;
19
18
  }
20
- declare function generateTestId(): string;
21
- declare function generateSuiteId(): string;
22
- declare function generateObservationId(): string;
23
- declare function generateHookId(): string;
24
- declare function generateRunId(): string;
25
- declare function generateCanonicalId(type: EntityIdType): string;
26
- declare function isCanonicalTestId(value: string): boolean;
27
- declare function isCanonicalSuiteId(value: string): boolean;
28
- declare function isCanonicalHookId(value: string): boolean;
29
- declare function isCanonicalObservationId(value: string): boolean;
30
- declare function isCanonicalRunId(value: string): boolean;
31
- declare function isCanonicalId(type: EntityIdType, value: string): boolean;
32
- declare function isObservationId(value: string): boolean;
33
- declare function getEntityIdContract(type: EntityIdType): EntityIdContract;
34
- declare function getEntityIdContracts(): EntityIdContract[];
35
-
36
- interface ApprovedSaasPlaceholder {
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 };
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,127 +1,76 @@
1
- // src/persistent-id.ts
2
1
  import { idAgent, parse } from "id-agent";
3
- var CANONICAL_ID_WORDS = 10;
4
- var LEGACY_OBSERVATION_ID_WORDS = 6;
5
- var PREFIX = {
6
- test: "t",
7
- suite: "s",
8
- hook: "h",
9
- observation: "obs",
10
- run: "r"
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"
11
10
  };
12
- var ENTITY_ID_TYPES = Object.keys(PREFIX);
11
+ const ENTITY_ID_TYPES = Object.keys(PREFIX);
13
12
  function hasPrefixAndWordCount(value, prefix, wordCount) {
14
- const parsed = parse(value);
15
- return parsed?.prefix === prefix && parsed.wordCount === wordCount;
13
+ const parsed = parse(value);
14
+ return parsed?.prefix === prefix && parsed.wordCount === wordCount;
16
15
  }
17
16
  function generateId(prefix) {
18
- return idAgent({ prefix, words: CANONICAL_ID_WORDS });
17
+ return idAgent({
18
+ prefix,
19
+ words: 10
20
+ });
19
21
  }
20
22
  function generateTestId() {
21
- return generateId(PREFIX.test);
23
+ return generateId(PREFIX.test);
22
24
  }
23
25
  function generateSuiteId() {
24
- return generateId(PREFIX.suite);
26
+ return generateId(PREFIX.suite);
25
27
  }
26
28
  function generateObservationId() {
27
- return generateId(PREFIX.observation);
29
+ return generateId(PREFIX.observation);
28
30
  }
29
31
  function generateHookId() {
30
- return generateId(PREFIX.hook);
32
+ return generateId(PREFIX.hook);
31
33
  }
32
34
  function generateRunId() {
33
- return generateId(PREFIX.run);
35
+ return generateId(PREFIX.run);
34
36
  }
35
37
  function generateCanonicalId(type) {
36
- return generateId(PREFIX[type]);
38
+ return generateId(PREFIX[type]);
37
39
  }
38
40
  function isCanonicalTestId(value) {
39
- return hasPrefixAndWordCount(value, PREFIX.test, CANONICAL_ID_WORDS);
41
+ return hasPrefixAndWordCount(value, PREFIX.test, 10);
40
42
  }
41
43
  function isCanonicalSuiteId(value) {
42
- return hasPrefixAndWordCount(value, PREFIX.suite, CANONICAL_ID_WORDS);
44
+ return hasPrefixAndWordCount(value, PREFIX.suite, 10);
43
45
  }
44
46
  function isCanonicalHookId(value) {
45
- return hasPrefixAndWordCount(value, PREFIX.hook, CANONICAL_ID_WORDS);
47
+ return hasPrefixAndWordCount(value, PREFIX.hook, 10);
46
48
  }
47
49
  function isCanonicalObservationId(value) {
48
- return hasPrefixAndWordCount(value, PREFIX.observation, CANONICAL_ID_WORDS);
50
+ return hasPrefixAndWordCount(value, PREFIX.observation, 10);
49
51
  }
50
52
  function isCanonicalRunId(value) {
51
- return hasPrefixAndWordCount(value, PREFIX.run, CANONICAL_ID_WORDS);
53
+ return hasPrefixAndWordCount(value, PREFIX.run, 10);
52
54
  }
53
55
  function isCanonicalId(type, value) {
54
- return hasPrefixAndWordCount(value, PREFIX[type], CANONICAL_ID_WORDS);
56
+ return hasPrefixAndWordCount(value, PREFIX[type], 10);
55
57
  }
56
58
  function isObservationId(value) {
57
- return isCanonicalObservationId(value) || hasPrefixAndWordCount(value, PREFIX.observation, LEGACY_OBSERVATION_ID_WORDS);
59
+ return isCanonicalObservationId(value);
58
60
  }
59
61
  function getEntityIdContract(type) {
60
- const prefix = PREFIX[type];
61
- return {
62
- type,
63
- prefix,
64
- prefixWithSeparator: `${prefix}_`,
65
- words: CANONICAL_ID_WORDS,
66
- examplePattern: `${prefix}_word-word-word-word-word-word-word-word-word-word`
67
- };
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
+ };
68
70
  }
69
71
  function getEntityIdContracts() {
70
- return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
72
+ return ENTITY_ID_TYPES.map((type) => getEntityIdContract(type));
71
73
  }
74
+ export { CANONICAL_ID_WORDS, ENTITY_ID_TYPES, generateCanonicalId, generateHookId, generateObservationId, generateRunId, generateSuiteId, generateTestId, getEntityIdContract, getEntityIdContracts, isCanonicalHookId, isCanonicalId, isCanonicalObservationId, isCanonicalRunId, isCanonicalSuiteId, isCanonicalTestId, isObservationId };
72
75
 
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
- export {
103
- APPROVED_SAAS_PLACEHOLDERS,
104
- APPROVED_SAAS_PLACEHOLDER_NAMES,
105
- APPROVED_SAAS_PLACEHOLDER_SLUGS,
106
- CANONICAL_ID_WORDS,
107
- ENTITY_ID_TYPES,
108
- LEGACY_OBSERVATION_ID_WORDS,
109
- generateCanonicalId,
110
- generateHookId,
111
- generateObservationId,
112
- generateRunId,
113
- generateSuiteId,
114
- generateTestId,
115
- getEntityIdContract,
116
- getEntityIdContracts,
117
- isCanonicalHookId,
118
- isCanonicalId,
119
- isCanonicalObservationId,
120
- isCanonicalRunId,
121
- isCanonicalSuiteId,
122
- isCanonicalTestId,
123
- isObservationId,
124
- selectApprovedSaasPlaceholder,
125
- selectApprovedSaasPlaceholderSlug
126
- };
127
76
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/persistent-id.ts","../src/product-placeholders.ts"],"sourcesContent":["import { idAgent, parse } from 'id-agent'\n\nexport const CANONICAL_ID_WORDS = 10\nexport const LEGACY_OBSERVATION_ID_WORDS = 6\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 || hasPrefixAndWordCount(value, PREFIX.observation, LEGACY_OBSERVATION_ID_WORDS)\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","export interface ApprovedSaasPlaceholder {\n readonly name: string\n readonly slug: string\n}\n\nexport const APPROVED_SAAS_PLACEHOLDERS = [\n { name: 'Linear', slug: 'linear' },\n { name: 'Vercel', slug: 'vercel' },\n { name: 'Notion', slug: 'notion' },\n { name: 'Stripe', slug: 'stripe' },\n { name: 'GitHub', slug: 'github' },\n { name: 'Slack', slug: 'slack' },\n { name: 'Figma', slug: 'figma' },\n { name: 'Shopify', slug: 'shopify' },\n { name: 'Datadog', slug: 'datadog' },\n { name: 'Supabase', slug: 'supabase' },\n] as const satisfies readonly ApprovedSaasPlaceholder[]\n\nexport const APPROVED_SAAS_PLACEHOLDER_NAMES = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.name)\nexport const APPROVED_SAAS_PLACEHOLDER_SLUGS = APPROVED_SAAS_PLACEHOLDERS.map((item) => item.slug)\n\nfunction hashSeed(seed: string | number): number {\n const input = String(seed)\n let hash = 0\n\n for (let index = 0; index < input.length; index += 1) {\n hash = (hash * 31 + input.charCodeAt(index)) >>> 0\n }\n\n return hash\n}\n\nexport function selectApprovedSaasPlaceholder(seed: string | number): ApprovedSaasPlaceholder {\n return APPROVED_SAAS_PLACEHOLDERS[hashSeed(seed) % APPROVED_SAAS_PLACEHOLDERS.length]\n}\n\nexport function selectApprovedSaasPlaceholderSlug(seed: string | number): string {\n return selectApprovedSaasPlaceholder(seed).slug\n}\n"],"mappings":";AAAA,SAAS,SAAS,aAAa;AAExB,IAAM,qBAAqB;AAC3B,IAAM,8BAA8B;AAE3C,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,cAAc;AAC3D;AAEA,SAAS,WAAW,QAAwB;AAC1C,SAAO,QAAQ,EAAE,QAAQ,OAAO,mBAAmB,CAAC;AACtD;AAEO,SAAS,iBAAyB;AACvC,SAAO,WAAW,OAAO,IAAI;AAC/B;AAEO,SAAS,kBAA0B;AACxC,SAAO,WAAW,OAAO,KAAK;AAChC;AAEO,SAAS,wBAAgC;AAC9C,SAAO,WAAW,OAAO,WAAW;AACtC;AAEO,SAAS,iBAAyB;AACvC,SAAO,WAAW,OAAO,IAAI;AAC/B;AAEO,SAAS,gBAAwB;AACtC,SAAO,WAAW,OAAO,GAAG;AAC9B;AAEO,SAAS,oBAAoB,MAA4B;AAC9D,SAAO,WAAW,OAAO,IAAI,CAAC;AAChC;AAEO,SAAS,kBAAkB,OAAwB;AACxD,SAAO,sBAAsB,OAAO,OAAO,MAAM,kBAAkB;AACrE;AAEO,SAAS,mBAAmB,OAAwB;AACzD,SAAO,sBAAsB,OAAO,OAAO,OAAO,kBAAkB;AACtE;AAEO,SAAS,kBAAkB,OAAwB;AACxD,SAAO,sBAAsB,OAAO,OAAO,MAAM,kBAAkB;AACrE;AAEO,S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AAM,QAAQ,OAAO,IAAI;AACzB,MAAI,OAAO;AAEX,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,WAAQ,OAAO,KAAK,MAAM,WAAW,KAAK,MAAO;AAAA,EACnD;AAEA,SAAO;AACT;AAEO,SAAS,8BAA8B,MAAgD;AAC5F,SAAO,2BAA2B,SAAS,IAAI,IAAI,2BAA2B,MAAM;AACtF;AAEO,SAAS,kCAAkC,MAA+B;AAC/E,SAAO,8BAA8B,IAAI,EAAE;AAC7C;","names":[]}
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",
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
- "types": "./dist/index.d.ts",
33
- "import": "./dist/index.js",
34
- "require": "./dist/index.cjs"
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": "tsup",
44
- "dev": "tsup --watch",
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.12.2",
54
- "@vostride/agent-qa-arch": "0.2.3",
55
- "tsup": "~8.5.1",
56
- "typescript": "~6.0.3",
57
- "vitest": "~4.1.5"
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
  }