@redaksjon/protokoll 1.0.28 → 1.0.29-dev.20260317145425.87346ec

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.
@@ -208,7 +208,7 @@ function isProtokolUri(uri) {
208
208
  return uri.startsWith(`${SCHEME}://`);
209
209
  }
210
210
 
211
- const VERSION = "1.0.28 (HEAD/9b68dd0 T:v1.0.28 2026-03-15 23:18:55 -0700) linux arm64 v24.14.0";
211
+ const VERSION = "1.0.29-dev.20260317145425.87346ec (working/87346ec 2026-03-17 07:53:28 -0700) linux arm64 v24.14.0";
212
212
  const PROGRAM_NAME = "protokoll";
213
213
  const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS = "YYYY-M-D-HHmmss";
214
214
  const DEFAULT_AUDIO_EXTENSIONS = ["mp3", "mp4", "mpeg", "mpga", "m4a", "wav", "webm", "qta"];
@@ -4937,6 +4937,19 @@ function isValidUUID(str) {
4937
4937
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4938
4938
  return uuidRegex.test(str);
4939
4939
  }
4940
+ function resolveCanonicalEntityId(providedId) {
4941
+ if (providedId === void 0) {
4942
+ return randomUUID();
4943
+ }
4944
+ const normalized = providedId.trim();
4945
+ if (!normalized) {
4946
+ return randomUUID();
4947
+ }
4948
+ if (!isValidUUID(normalized)) {
4949
+ throw new Error(`Invalid id "${providedId}". Entity IDs must be UUIDs.`);
4950
+ }
4951
+ return normalized;
4952
+ }
4940
4953
  async function assertContextAvailableForEntityEdit(context) {
4941
4954
  if (context.hasContext()) {
4942
4955
  return;
@@ -5584,7 +5597,7 @@ async function handleAddPerson(args) {
5584
5597
  if (!context.hasContext()) {
5585
5598
  throw new Error("No .protokoll directory found. Initialize context first.");
5586
5599
  }
5587
- const id = args.id && isValidUUID(args.id) ? args.id : randomUUID();
5600
+ const id = resolveCanonicalEntityId(args.id);
5588
5601
  const slug = slugify(args.name);
5589
5602
  if (context.getPerson(id)) {
5590
5603
  throw new Error(`Person with ID "${id}" already exists`);
@@ -5658,7 +5671,7 @@ async function handleAddProject(args) {
5658
5671
  if (!context.hasContext()) {
5659
5672
  throw new Error("No .protokoll directory found. Initialize context first.");
5660
5673
  }
5661
- const id = args.id && isValidUUID(args.id) ? args.id : randomUUID();
5674
+ const id = resolveCanonicalEntityId(args.id);
5662
5675
  const slug = slugify(args.name);
5663
5676
  if (context.getProject(id)) {
5664
5677
  throw new Error(`Project with ID "${id}" already exists`);
@@ -5896,7 +5909,7 @@ async function handleAddTerm(args) {
5896
5909
  if (!context.hasContext()) {
5897
5910
  throw new Error("No .protokoll directory found. Initialize context first.");
5898
5911
  }
5899
- const id = args.id && isValidUUID(args.id) ? args.id : randomUUID();
5912
+ const id = resolveCanonicalEntityId(args.id);
5900
5913
  const slug = slugify(args.term);
5901
5914
  if (context.getTerm(id)) {
5902
5915
  throw new Error(`Term with ID "${id}" already exists`);
@@ -6054,7 +6067,7 @@ async function handleAddCompany(args) {
6054
6067
  if (!context.hasContext()) {
6055
6068
  throw new Error("No .protokoll directory found. Initialize context first.");
6056
6069
  }
6057
- const id = args.id && isValidUUID(args.id) ? args.id : randomUUID();
6070
+ const id = resolveCanonicalEntityId(args.id);
6058
6071
  const slug = slugify(args.name);
6059
6072
  if (context.getCompany(id)) {
6060
6073
  throw new Error(`Company with ID "${id}" already exists`);