@redaksjon/protokoll-engine 0.1.1-dev.0 → 0.1.3
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/index25.js +5 -5
- package/dist/index31.js +1 -1
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +2 -2
- package/dist/index33.js +4 -4
- package/dist/index34.js +1 -1
- package/dist/index36.js +0 -2
- package/dist/index36.js.map +1 -1
- package/dist/index42.js +43 -143
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +34 -221
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +233 -43
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +156 -38
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +75 -31
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +73 -46
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +5 -36
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +134 -222
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +201 -138
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +42 -74
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +40 -73
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +33 -18
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +2 -2
- package/dist/index55.js +2 -2
- package/dist/index56.js +147 -14
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +15 -2
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +2 -15
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +15 -2
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +2 -4
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +6 -0
- package/dist/index61.js.map +1 -0
- package/dist/out/index.d.ts +23 -0
- package/dist/out/index.d.ts.map +1 -0
- package/dist/out/manager.d.ts +21 -0
- package/dist/out/manager.d.ts.map +1 -0
- package/dist/out/types.d.ts +35 -0
- package/dist/out/types.d.ts.map +1 -0
- package/dist/pipeline/types.d.ts +2 -10
- package/dist/pipeline/types.d.ts.map +1 -1
- package/dist/transcript/operations.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/output/index.d.ts +0 -15
- package/dist/output/index.d.ts.map +0 -1
package/dist/index46.js
CHANGED
|
@@ -1,37 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { getLogger } from './index41.js';
|
|
2
|
+
|
|
3
|
+
const create = (config) => {
|
|
4
|
+
const logger = getLogger();
|
|
5
|
+
const createPattern = (soundsLike) => {
|
|
6
|
+
const escaped = soundsLike.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
const pattern = `\\b${escaped}\\b` ;
|
|
8
|
+
const flags = "gi" ;
|
|
9
|
+
return new RegExp(pattern, flags);
|
|
10
|
+
};
|
|
11
|
+
const applySingleReplacement = (text, mapping) => {
|
|
12
|
+
const pattern = createPattern(mapping.soundsLike);
|
|
13
|
+
const occurrences = [];
|
|
14
|
+
let count = 0;
|
|
15
|
+
const replacements = [];
|
|
16
|
+
let match;
|
|
17
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
18
|
+
const original = match[0];
|
|
19
|
+
let replacement = mapping.correctText;
|
|
20
|
+
replacements.push({
|
|
21
|
+
index: match.index,
|
|
22
|
+
length: original.length,
|
|
23
|
+
replacement
|
|
24
|
+
});
|
|
25
|
+
occurrences.push({
|
|
26
|
+
original,
|
|
27
|
+
replacement,
|
|
28
|
+
position: match.index,
|
|
29
|
+
mapping
|
|
30
|
+
});
|
|
31
|
+
count++;
|
|
32
|
+
}
|
|
33
|
+
let resultText = text;
|
|
34
|
+
for (let i = replacements.length - 1; i >= 0; i--) {
|
|
35
|
+
const { index, length, replacement } = replacements[i];
|
|
36
|
+
resultText = resultText.slice(0, index) + replacement + resultText.slice(index + length);
|
|
37
|
+
}
|
|
38
|
+
if (count > 0) {
|
|
39
|
+
logger.debug(
|
|
40
|
+
`Replaced "${mapping.soundsLike}" → "${mapping.correctText}" (${count} occurrence${count === 1 ? "" : "s"})`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
24
43
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
text: resultText,
|
|
45
|
+
count,
|
|
46
|
+
occurrences,
|
|
47
|
+
appliedMappings: count > 0 ? [mapping] : []
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const applyReplacements = (text, mappings) => {
|
|
51
|
+
let resultText = text;
|
|
52
|
+
let totalCount = 0;
|
|
53
|
+
const allOccurrences = [];
|
|
54
|
+
const appliedMappings = [];
|
|
55
|
+
for (const mapping of mappings) {
|
|
56
|
+
const result = applySingleReplacement(resultText, mapping);
|
|
57
|
+
if (result.count > 0) {
|
|
58
|
+
resultText = result.text;
|
|
59
|
+
totalCount += result.count;
|
|
60
|
+
allOccurrences.push(...result.occurrences);
|
|
61
|
+
appliedMappings.push(mapping);
|
|
31
62
|
}
|
|
63
|
+
}
|
|
64
|
+
logger.debug(
|
|
65
|
+
`Applied ${mappings.length} mappings, made ${totalCount} replacements (${appliedMappings.length} mappings had matches)`
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
text: resultText,
|
|
69
|
+
count: totalCount,
|
|
70
|
+
occurrences: allOccurrences,
|
|
71
|
+
appliedMappings
|
|
32
72
|
};
|
|
33
|
-
}
|
|
34
|
-
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
applyReplacements,
|
|
76
|
+
applySingleReplacement
|
|
77
|
+
};
|
|
78
|
+
};
|
|
35
79
|
|
|
36
80
|
export { create };
|
|
37
81
|
//# sourceMappingURL=index46.js.map
|
package/dist/index46.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index46.js","sources":["../src/agentic/tools/store-context.ts"],"sourcesContent":["/**\n * Store Context Tool\n * \n * Stores new context information for future use.\n */\n\nimport { TranscriptionTool, ToolContext, ToolResult } from '../types';\n\nexport const create = (_ctx: ToolContext): TranscriptionTool => ({\n name: 'store_context',\n description: 'Store new context information for future use. Use when you learn something new that should be remembered.',\n parameters: {\n type: 'object',\n properties: {\n entityType: {\n type: 'string',\n enum: ['person', 'project', 'company', 'term'],\n description: 'Type of entity to store',\n },\n name: {\n type: 'string',\n description: 'Name of the entity',\n },\n details: {\n type: 'object',\n description: 'Additional details about the entity',\n },\n },\n required: ['entityType', 'name'],\n },\n \n execute: async (args: { entityType: string; name: string; details?: any }): Promise<ToolResult> => {\n // This tool requires --self-update flag to actually persist\n // Otherwise it just acknowledges without saving\n \n return {\n success: true,\n data: {\n stored: false,\n message: 'Context storage requires --self-update flag. Information noted but not persisted.',\n entityType: args.entityType,\n name: args.name,\n },\n };\n },\n});\n\n"],"names":[],"mappings":"AAQO,MAAM,MAAA,GAAS,CAAC,IAAA,MAA0C;AAAA,EAC7D,IAAA,EAAM,eAAA;AAAA,EACN,WAAA,EAAa,2GAAA;AAAA,EACb,UAAA,EAAY;AAAA,IACR,IAAA,EAAM,QAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACR,UAAA,EAAY;AAAA,QACR,IAAA,EAAM,QAAA;AAAA,QACN,IAAA,EAAM,CAAC,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAAA,QAC7C,WAAA,EAAa;AAAA,OACjB;AAAA,MACA,IAAA,EAAM;AAAA,QACF,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA,OACjB;AAAA,MACA,OAAA,EAAS;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA;AACjB,KACJ;AAAA,IACA,QAAA,EAAU,CAAC,YAAA,EAAc,MAAM;AAAA,GACnC;AAAA,EAEA,OAAA,EAAS,OAAO,IAAA,KAAmF;AAI/F,IAAA,OAAO;AAAA,MACH,OAAA,EAAS,IAAA;AAAA,MACT,IAAA,EAAM;AAAA,QACF,MAAA,EAAQ,KAAA;AAAA,QACR,OAAA,EAAS,mFAAA;AAAA,QACT,YAAY,IAAA,CAAK,UAAA;AAAA,QACjB,MAAM,IAAA,CAAK;AAAA;AACf,KACJ;AAAA,EACJ;AACJ,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index46.js","sources":["../src/util/text-replacer.ts"],"sourcesContent":["/**\n * Text Replacer\n *\n * Performs intelligent text replacements with case preservation and word boundary matching.\n * Core utility for the simple-replace phase.\n *\n * Part of the simple-replace optimization (Phase 2).\n */\n\nimport * as Logging from '@/logging';\nimport { SoundsLikeMapping } from './sounds-like-database';\n\n/**\n * Replacement result for a single occurrence\n */\nexport interface ReplacementOccurrence {\n /** Original text that was replaced */\n original: string;\n\n /** Replacement text */\n replacement: string;\n\n /** Position in the text where replacement occurred */\n position: number;\n\n /** The mapping that was used */\n mapping: SoundsLikeMapping;\n}\n\n/**\n * Result of applying replacements to text\n */\nexport interface ReplacementResult {\n /** The text after replacements */\n text: string;\n\n /** Number of replacements made */\n count: number;\n\n /** Detailed information about each replacement */\n occurrences: ReplacementOccurrence[];\n\n /** Mappings that were applied */\n appliedMappings: SoundsLikeMapping[];\n}\n\n/**\n * Configuration for text replacer\n */\nexport interface TextReplacerConfig {\n /** Preserve case of original text when replacing (default: true) */\n preserveCase?: boolean;\n\n /** Use word boundaries for matching (default: true) */\n useWordBoundaries?: boolean;\n\n /** Case-insensitive matching (default: true) */\n caseInsensitive?: boolean;\n}\n\n/**\n * Instance interface for text replacer\n */\nexport interface Instance {\n /**\n * Apply a set of replacements to text\n */\n applyReplacements(text: string, mappings: SoundsLikeMapping[]): ReplacementResult;\n\n /**\n * Apply a single replacement to text\n */\n applySingleReplacement(text: string, mapping: SoundsLikeMapping): ReplacementResult;\n}\n\n/**\n * Create a text replacer instance\n */\nexport const create = (config?: TextReplacerConfig): Instance => {\n const logger = Logging.getLogger();\n\n const preserveCase = config?.preserveCase ?? true;\n const useWordBoundaries = config?.useWordBoundaries ?? true;\n const caseInsensitive = config?.caseInsensitive ?? true;\n\n /**\n * Determine the case style of a string\n */\n const getCaseStyle = (text: string): 'upper' | 'lower' | 'title' | 'mixed' => {\n // Check for all uppercase first (includes single chars)\n if (text.length > 0 && text === text.toUpperCase() && text.toUpperCase() !== text.toLowerCase()) {\n return 'upper';\n }\n // Check for all lowercase\n if (text === text.toLowerCase()) {\n return 'lower';\n }\n // Check for title case (first char upper, or mixed case starting with upper)\n if (text[0] === text[0].toUpperCase()) {\n return 'title';\n }\n return 'mixed';\n };\n\n /**\n * Apply case style from original to replacement\n *\n * Case preservation means: make the replacement match the case pattern of the original\n * - \"protocol\" (lowercase) → \"protokoll\" (lowercase)\n * - \"Protocol\" (title) → \"Protokoll\" (title)\n * - \"PROTOCOL\" (upper) → \"PROTOKOLL\" (upper)\n */\n const applyCaseStyle = (replacement: string, originalCase: 'upper' | 'lower' | 'title' | 'mixed'): string => {\n switch (originalCase) {\n case 'upper':\n // ALL CAPS in original → ALL CAPS in replacement\n return replacement.toUpperCase();\n case 'lower':\n // all lowercase in original → all lowercase in replacement\n return replacement.toLowerCase();\n case 'title':\n // Title Case in original → Title Case in replacement (first char upper, rest as-is)\n return replacement.charAt(0).toUpperCase() + replacement.slice(1);\n case 'mixed':\n default:\n // Mixed case → preserve replacement's original case\n return replacement;\n }\n };\n\n /**\n * Create a regex pattern for matching\n */\n const createPattern = (soundsLike: string): RegExp => {\n // Escape special regex characters\n const escaped = soundsLike.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n // Add word boundaries if enabled\n const pattern = useWordBoundaries ? `\\\\b${escaped}\\\\b` : escaped;\n\n // Create regex with appropriate flags\n const flags = caseInsensitive ? 'gi' : 'g';\n return new RegExp(pattern, flags);\n };\n\n /**\n * Apply a single replacement to text\n */\n const applySingleReplacement = (text: string, mapping: SoundsLikeMapping): ReplacementResult => {\n const pattern = createPattern(mapping.soundsLike);\n const occurrences: ReplacementOccurrence[] = [];\n let count = 0;\n\n // Track positions to avoid double-replacement issues\n const replacements: { index: number; length: number; replacement: string }[] = [];\n\n // Find all matches\n let match: RegExpExecArray | null;\n while ((match = pattern.exec(text)) !== null) {\n const original = match[0];\n let replacement = mapping.correctText;\n\n // Preserve case if enabled\n if (preserveCase) {\n const caseStyle = getCaseStyle(original);\n replacement = applyCaseStyle(replacement, caseStyle);\n }\n\n replacements.push({\n index: match.index,\n length: original.length,\n replacement,\n });\n\n occurrences.push({\n original,\n replacement,\n position: match.index,\n mapping,\n });\n\n count++;\n }\n\n // Apply replacements in reverse order to preserve positions\n let resultText = text;\n for (let i = replacements.length - 1; i >= 0; i--) {\n const { index, length, replacement } = replacements[i];\n resultText = resultText.slice(0, index) + replacement + resultText.slice(index + length);\n }\n\n if (count > 0) {\n logger.debug(\n `Replaced \"${mapping.soundsLike}\" → \"${mapping.correctText}\" ` +\n `(${count} occurrence${count === 1 ? '' : 's'})`\n );\n }\n\n return {\n text: resultText,\n count,\n occurrences,\n appliedMappings: count > 0 ? [mapping] : [],\n };\n };\n\n /**\n * Apply multiple replacements to text\n */\n const applyReplacements = (text: string, mappings: SoundsLikeMapping[]): ReplacementResult => {\n let resultText = text;\n let totalCount = 0;\n const allOccurrences: ReplacementOccurrence[] = [];\n const appliedMappings: SoundsLikeMapping[] = [];\n\n // Apply each mapping sequentially\n for (const mapping of mappings) {\n const result = applySingleReplacement(resultText, mapping);\n\n if (result.count > 0) {\n resultText = result.text;\n totalCount += result.count;\n allOccurrences.push(...result.occurrences);\n appliedMappings.push(mapping);\n }\n }\n\n logger.debug(\n `Applied ${mappings.length} mappings, made ${totalCount} replacements ` +\n `(${appliedMappings.length} mappings had matches)`\n );\n\n return {\n text: resultText,\n count: totalCount,\n occurrences: allOccurrences,\n appliedMappings,\n };\n };\n\n return {\n applyReplacements,\n applySingleReplacement,\n };\n};\n"],"names":["Logging.getLogger"],"mappings":";;AA8EO,MAAM,MAAA,GAAS,CAAC,MAAA,KAA0C;AAC7D,EAAA,MAAM,MAAA,GAASA,SAAQ,EAAU;AAsDjC,EAAA,MAAM,aAAA,GAAgB,CAAC,UAAA,KAA+B;AAElD,IAAA,MAAM,OAAA,GAAU,UAAA,CAAW,OAAA,CAAQ,qBAAA,EAAuB,MAAM,CAAA;AAGhE,IAAA,MAAM,OAAA,GAA8B,CAAA,GAAA,EAAM,OAAO,CAAA,GAAA,CAAA,CAAQ;AAGzD,IAAA,MAAM,KAAA,GAA0B,IAAA,CAAO;AACvC,IAAA,OAAO,IAAI,MAAA,CAAO,OAAA,EAAS,KAAK,CAAA;AAAA,EACpC,CAAA;AAKA,EAAA,MAAM,sBAAA,GAAyB,CAAC,IAAA,EAAc,OAAA,KAAkD;AAC5F,IAAA,MAAM,OAAA,GAAU,aAAA,CAAc,OAAA,CAAQ,UAAU,CAAA;AAChD,IAAA,MAAM,cAAuC,EAAC;AAC9C,IAAA,IAAI,KAAA,GAAQ,CAAA;AAGZ,IAAA,MAAM,eAAyE,EAAC;AAGhF,IAAA,IAAI,KAAA;AACJ,IAAA,OAAA,CAAQ,KAAA,GAAQ,OAAA,CAAQ,IAAA,CAAK,IAAI,OAAO,IAAA,EAAM;AAC1C,MAAA,MAAM,QAAA,GAAW,MAAM,CAAC,CAAA;AACxB,MAAA,IAAI,cAAc,OAAA,CAAQ,WAAA;AAQ1B,MAAA,YAAA,CAAa,IAAA,CAAK;AAAA,QACd,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,QAAQ,QAAA,CAAS,MAAA;AAAA,QACjB;AAAA,OACH,CAAA;AAED,MAAA,WAAA,CAAY,IAAA,CAAK;AAAA,QACb,QAAA;AAAA,QACA,WAAA;AAAA,QACA,UAAU,KAAA,CAAM,KAAA;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AAA,EAAG;AAClB,QAAA,UAAA,GAAa,MAAA,CAAO,IAAA;AACpB,QAAA,UAAA,IAAc,MAAA,CAAO,KAAA;AACrB,QAAA,cAAA,CAAe,IAAA,CAAK,GAAG,MAAA,CAAO,WAAW,CAAA;AACzC,QAAA,eAAA,CAAgB,KAAK,OAAO,CAAA;AAAA,MAChC;AAAA,IACJ;AAEA,IAAA,MAAA,CAAO,KAAA;AAAA,MACH,WAAW,QAAA,CAAS,MAAM,mBAAmB,UAAU,CAAA,eAAA,EACnD,gBAAgB,MAAM,CAAA,sBAAA;AAAA,KAC9B;AAEA,IAAA,OAAO;AAAA,MACH,IAAA,EAAM,UAAA;AAAA,MACN,KAAA,EAAO,UAAA;AAAA,MACP,WAAA,EAAa,cAAA;AAAA,MACb;AAAA,KACJ;AAAA,EACJ,CAAA;AAEA,EAAA,OAAO;AAAA,IACH,iBAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
|
package/dist/index47.js
CHANGED
|
@@ -1,51 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import timezone from './index54.js';
|
|
3
|
+
import utc from './index55.js';
|
|
4
|
+
import 'moment-timezone';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
dayjs.extend(utc);
|
|
7
|
+
dayjs.extend(timezone);
|
|
8
|
+
const create = (parameters) => {
|
|
9
|
+
const { timezone: timezone2 } = parameters;
|
|
10
|
+
const now = () => {
|
|
11
|
+
return date(void 0);
|
|
12
|
+
};
|
|
13
|
+
const date = (date2) => {
|
|
14
|
+
let value;
|
|
15
|
+
try {
|
|
16
|
+
if (date2) {
|
|
17
|
+
value = dayjs.tz(date2, timezone2);
|
|
18
|
+
} else {
|
|
19
|
+
value = dayjs().tz(timezone2);
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
throw new Error(`Invalid date: ${date2}, error: ${error.message}`);
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const transcription = await openai.audio.transcriptions.create({
|
|
29
|
-
model,
|
|
30
|
-
file: audioStream,
|
|
31
|
-
response_format: "json"
|
|
32
|
-
});
|
|
33
|
-
if (!transcription) {
|
|
34
|
-
throw new OpenAIError("No transcription received from OpenAI");
|
|
24
|
+
return value.toDate();
|
|
25
|
+
};
|
|
26
|
+
const parse = (date2, format2) => {
|
|
27
|
+
let value;
|
|
28
|
+
try {
|
|
29
|
+
value = dayjs.tz(date2, format2, timezone2);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
throw new Error(`Invalid date: ${date2}, expected format: ${format2}, error: ${error.message}`);
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
return value.toDate();
|
|
34
|
+
};
|
|
35
|
+
const addDays = (date2, days) => {
|
|
36
|
+
return dayjs.tz(date2, timezone2).add(days, "day").toDate();
|
|
37
|
+
};
|
|
38
|
+
const addMonths = (date2, months) => {
|
|
39
|
+
return dayjs.tz(date2, timezone2).add(months, "month").toDate();
|
|
40
|
+
};
|
|
41
|
+
const addYears = (date2, years) => {
|
|
42
|
+
return dayjs.tz(date2, timezone2).add(years, "year").toDate();
|
|
43
|
+
};
|
|
44
|
+
const format = (date2, format2) => {
|
|
45
|
+
return dayjs.tz(date2, timezone2).format(format2);
|
|
46
|
+
};
|
|
47
|
+
const subDays = (date2, days) => {
|
|
48
|
+
return dayjs.tz(date2, timezone2).subtract(days, "day").toDate();
|
|
49
|
+
};
|
|
50
|
+
const subMonths = (date2, months) => {
|
|
51
|
+
return dayjs.tz(date2, timezone2).subtract(months, "month").toDate();
|
|
52
|
+
};
|
|
53
|
+
const subYears = (date2, years) => {
|
|
54
|
+
return dayjs.tz(date2, timezone2).subtract(years, "year").toDate();
|
|
55
|
+
};
|
|
56
|
+
const startOfMonth = (date2) => {
|
|
57
|
+
return dayjs.tz(date2, timezone2).startOf("month").toDate();
|
|
58
|
+
};
|
|
59
|
+
const endOfMonth = (date2) => {
|
|
60
|
+
return dayjs.tz(date2, timezone2).endOf("month").toDate();
|
|
61
|
+
};
|
|
62
|
+
const startOfYear = (date2) => {
|
|
63
|
+
return dayjs.tz(date2, timezone2).startOf("year").toDate();
|
|
64
|
+
};
|
|
65
|
+
const endOfYear = (date2) => {
|
|
66
|
+
return dayjs.tz(date2, timezone2).endOf("year").toDate();
|
|
67
|
+
};
|
|
68
|
+
const isBefore = (date2, other) => {
|
|
69
|
+
return dayjs.tz(date2, timezone2).isBefore(dayjs.tz(other, timezone2));
|
|
70
|
+
};
|
|
71
|
+
const isAfter = (date2, other) => {
|
|
72
|
+
return dayjs.tz(date2, timezone2).isAfter(dayjs.tz(other, timezone2));
|
|
73
|
+
};
|
|
74
|
+
return { now, date, parse, addDays, addMonths, addYears, format, subDays, subMonths, subYears, startOfMonth, endOfMonth, startOfYear, endOfYear, isBefore, isAfter };
|
|
75
|
+
};
|
|
49
76
|
|
|
50
|
-
export {
|
|
77
|
+
export { create };
|
|
51
78
|
//# sourceMappingURL=index47.js.map
|
package/dist/index47.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index47.js","sources":["../src/util/
|
|
1
|
+
{"version":3,"file":"index47.js","sources":["../src/util/dates.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport dayjs from 'dayjs';\nimport timezone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n// eslint-disable-next-line no-restricted-imports\nimport moment from 'moment-timezone';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\n/**\n * Yes, wrapping dayjs is a bit annoying and might seem overly paranoid. However, I feel strongly\n * about not letting Dayjs instances leak into the rest of the codebase. Having Dayjs objects\n * floating around the application leads to inconsistent timezone handling, makes testing more\n * difficult, and creates subtle bugs that are hard to track down.\n * \n * By wrapping dayjs completely and only exposing plain JavaScript Date objects, we get several\n * key benefits:\n * 1. Consistent timezone handling through a single configuration point\n * 2. Simpler testing since we only need to mock this one library\n * 3. Type safety - the rest of the codebase only deals with standard Date objects\n * 4. No risk of dayjs method chains creating unexpected timezone shifts\n * \n * The Library interface gives us full control over all date operations while keeping the messy\n * details of timezone manipulation contained in one place. Yes it's more code, but the peace of\n * mind is worth it.\n */\nexport interface Utility {\n now: () => Date;\n date: (date: string | number | Date | null | undefined) => Date;\n parse: (date: string | number | Date | null | undefined, format: string) => Date;\n addDays: (date: Date, days: number) => Date;\n addMonths: (date: Date, months: number) => Date;\n addYears: (date: Date, years: number) => Date;\n format: (date: Date, format: string) => string;\n subDays: (date: Date, days: number) => Date;\n subMonths: (date: Date, months: number) => Date;\n subYears: (date: Date, years: number) => Date;\n startOfMonth: (date: Date) => Date;\n endOfMonth: (date: Date) => Date;\n startOfYear: (date: Date) => Date;\n endOfYear: (date: Date) => Date;\n isBefore: (date: Date, other: Date) => boolean;\n isAfter: (date: Date, other: Date) => boolean;\n}\n\nexport const create = (parameters: { timezone: string }) => {\n const { timezone } = parameters;\n const now = () => {\n return date(undefined);\n }\n\n const date = (date: string | number | Date | null | undefined) => {\n let value: dayjs.Dayjs;\n try {\n if (date) {\n value = dayjs.tz(date, timezone);\n } else {\n value = dayjs().tz(timezone);\n }\n } catch (error: any) {\n throw new Error(`Invalid date: ${date}, error: ${error.message}`);\n }\n\n return value.toDate();\n }\n\n const parse = (date: string | number | Date | null | undefined, format: string) => {\n let value: dayjs.Dayjs;\n try {\n value = dayjs.tz(date, format, timezone);\n } catch (error: any) {\n throw new Error(`Invalid date: ${date}, expected format: ${format}, error: ${error.message}`);\n }\n\n return value.toDate();\n }\n\n const addDays = (date: Date, days: number) => {\n return dayjs.tz(date, timezone).add(days, 'day').toDate();\n }\n\n const addMonths = (date: Date, months: number) => {\n return dayjs.tz(date, timezone).add(months, 'month').toDate();\n }\n\n const addYears = (date: Date, years: number) => {\n return dayjs.tz(date, timezone).add(years, 'year').toDate();\n }\n\n const format = (date: Date, format: string) => {\n return dayjs.tz(date, timezone).format(format);\n }\n\n const subDays = (date: Date, days: number) => {\n return dayjs.tz(date, timezone).subtract(days, 'day').toDate();\n }\n\n const subMonths = (date: Date, months: number) => {\n return dayjs.tz(date, timezone).subtract(months, 'month').toDate();\n }\n\n const subYears = (date: Date, years: number) => {\n return dayjs.tz(date, timezone).subtract(years, 'year').toDate();\n }\n\n const startOfMonth = (date: Date) => {\n return dayjs.tz(date, timezone).startOf('month').toDate();\n }\n\n const endOfMonth = (date: Date) => {\n return dayjs.tz(date, timezone).endOf('month').toDate();\n }\n\n const startOfYear = (date: Date) => {\n return dayjs.tz(date, timezone).startOf('year').toDate();\n }\n\n const endOfYear = (date: Date) => {\n return dayjs.tz(date, timezone).endOf('year').toDate();\n }\n\n const isBefore = (date: Date, other: Date) => {\n return dayjs.tz(date, timezone).isBefore(dayjs.tz(other, timezone));\n }\n\n const isAfter = (date: Date, other: Date) => {\n return dayjs.tz(date, timezone).isAfter(dayjs.tz(other, timezone));\n }\n\n return { now, date, parse, addDays, addMonths, addYears, format, subDays, subMonths, subYears, startOfMonth, endOfMonth, startOfYear, endOfYear, isBefore, isAfter };\n}\n\nexport const validTimezones = () => {\n return moment.tz.names();\n}\n"],"names":["timezone","date","format"],"mappings":";;;;;AAOA,KAAA,CAAM,OAAO,GAAG,CAAA;AAChB,KAAA,CAAM,OAAO,QAAQ,CAAA;AAsCd,MAAM,MAAA,GAAS,CAAC,UAAA,KAAqC;AACxD,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Q,OAAA,EAAS,SAAA,EAAW,UAAU,YAAA,EAAc,UAAA,EAAY,WAAA,EAAa,SAAA,EAAW,UAAU,OAAA,EAAQ;AACvK;;;;"}
|
package/dist/index48.js
CHANGED
|
@@ -1,39 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (typeof obj === "number" || typeof obj === "boolean" || obj === null)
|
|
6
|
-
return "" + obj;
|
|
7
|
-
else if (typeof obj === "string")
|
|
8
|
-
return '"' + obj + '"';
|
|
9
|
-
else if (Array.isArray(obj)) {
|
|
10
|
-
if (obj[0] === void 0)
|
|
11
|
-
return "[]";
|
|
12
|
-
else {
|
|
13
|
-
obj.forEach(function(el) {
|
|
14
|
-
arrVals.push(stringifyJSON(el));
|
|
15
|
-
});
|
|
16
|
-
return "[" + arrVals + "]";
|
|
17
|
-
}
|
|
18
|
-
} else if (obj instanceof Object) {
|
|
19
|
-
objKeys = Object.keys(obj);
|
|
20
|
-
objKeys.forEach(function(key) {
|
|
21
|
-
const keyOut = '"' + key + '":';
|
|
22
|
-
const keyValOut = obj[key];
|
|
23
|
-
if (keyValOut instanceof Function || keyValOut === void 0)
|
|
24
|
-
arrOfKeyVals.push("");
|
|
25
|
-
else if (typeof keyValOut === "string")
|
|
26
|
-
arrOfKeyVals.push(keyOut + '"' + keyValOut + '"');
|
|
27
|
-
else if (typeof keyValOut === "boolean" || typeof keyValOut === "number" || keyValOut === null)
|
|
28
|
-
arrOfKeyVals.push(keyOut + keyValOut);
|
|
29
|
-
else if (keyValOut instanceof Object) {
|
|
30
|
-
arrOfKeyVals.push(keyOut + stringifyJSON(keyValOut));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return "{" + arrOfKeyVals + "}";
|
|
34
|
-
}
|
|
35
|
-
return "";
|
|
1
|
+
import { create as create$1 } from './index56.js';
|
|
2
|
+
|
|
3
|
+
const create = (config) => {
|
|
4
|
+
return create$1(config);
|
|
36
5
|
};
|
|
37
6
|
|
|
38
|
-
export {
|
|
7
|
+
export { create };
|
|
39
8
|
//# sourceMappingURL=index48.js.map
|
package/dist/index48.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index48.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index48.js","sources":["../src/out/index.ts"],"sourcesContent":["/**\n * Output Management System\n *\n * Main entry point for the output management system. Handles intermediate\n * files and final output destinations.\n */\n\nimport { OutputConfig, OutputPaths, IntermediateFiles, RawTranscriptData } from './types';\nimport * as Manager from './manager';\nimport * as Metadata from '../util/metadata';\n\nexport interface OutputInstance {\n createOutputPaths(\n audioFile: string,\n routedDestination: string,\n hash: string,\n date: Date\n ): OutputPaths;\n ensureDirectories(paths: OutputPaths): Promise<void>;\n writeIntermediate(\n paths: OutputPaths,\n type: keyof IntermediateFiles,\n content: unknown\n ): Promise<string>;\n /**\n * Write the raw Whisper transcript to the .transcript/ directory alongside final output.\n * This enables compare and reanalyze workflows.\n */\n writeRawTranscript(paths: OutputPaths, data: RawTranscriptData): Promise<string>;\n writeTranscript(paths: OutputPaths, content: string, metadata?: Metadata.TranscriptMetadata): Promise<string>;\n /**\n * Read a previously stored raw transcript from the .transcript/ directory.\n * Returns null if no raw transcript exists.\n */\n readRawTranscript(finalOutputPath: string): Promise<RawTranscriptData | null>;\n cleanIntermediates(paths: OutputPaths): Promise<void>;\n}\n\nexport const create = (config: OutputConfig): OutputInstance => {\n return Manager.create(config);\n};\n\nexport const DEFAULT_OUTPUT_CONFIG: OutputConfig = {\n intermediateDir: './output/protokoll',\n keepIntermediates: true,\n timestampFormat: 'YYMMDD-HHmm',\n};\n\n// Re-export types\nexport * from './types';\n"],"names":["Manager.create"],"mappings":";;AAsCO,MAAM,MAAA,GAAS,CAAC,MAAA,KAAyC;AAC5D,EAAA,OAAOA,SAAe,MAAM,CAAA;AAChC;;;;"}
|