@lssm/example.content-generation 0.0.0-canary-20251217062943 → 0.0.0-canary-20251217072406

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.
Files changed (53) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +73 -69
  2. package/.turbo/turbo-build.log +74 -18
  3. package/CHANGELOG.md +5 -4
  4. package/dist/docs/content-generation.docblock.js +27 -14
  5. package/dist/docs/index.js +1 -1
  6. package/dist/example.js +38 -1
  7. package/dist/generate.js +52 -1
  8. package/dist/index.js +5 -1
  9. package/dist/libs/content-gen/dist/generators/blog.js +68 -1
  10. package/dist/libs/content-gen/dist/generators/email.js +96 -9
  11. package/dist/libs/content-gen/dist/generators/landing-page.js +76 -2
  12. package/dist/libs/content-gen/dist/generators/social.js +73 -1
  13. package/dist/libs/content-gen/dist/seo/optimizer.js +48 -1
  14. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  15. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  16. package/dist/libs/contracts/dist/docs/index.js +29 -1
  17. package/dist/libs/contracts/dist/docs/presentations.js +71 -1
  18. package/dist/libs/contracts/dist/docs/registry.js +44 -1
  19. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  20. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  21. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  22. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  23. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  24. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  25. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  26. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  27. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  28. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  29. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  30. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  31. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  32. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  33. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  34. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  35. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  36. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  37. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  38. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  39. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  40. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  41. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  42. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  43. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  44. package/dist/libs/logger/dist/context.node.js +78 -1
  45. package/dist/libs/logger/dist/elysia-plugin.js +3 -1
  46. package/dist/libs/logger/dist/formatters.js +163 -9
  47. package/dist/libs/logger/dist/index.js +7 -1
  48. package/dist/libs/logger/dist/logger.node.js +189 -1
  49. package/dist/libs/logger/dist/timer.js +126 -1
  50. package/dist/libs/logger/dist/tracer.node.js +115 -1
  51. package/dist/libs/logger/dist/types.js +13 -1
  52. package/package.json +7 -6
  53. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1,189 @@
1
- import{t as e}from"./context.node.js";import{e as t}from"./types.js";import{t as n}from"./timer.js";import{n as r}from"./tracer.node.js";import{i,r as a}from"./formatters.js";var o=class o{config;formatter;context;tracer;timerManager;constructor(o){this.config={level:t.INFO,environment:process.env.NODE_ENV||`development`,enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!0,maxContextDepth:10,timestampFormat:`iso`,...o},this.context=e.getInstance(),this.tracer=new r,this.timerManager=new n,this.formatter=this.config.environment===`production`?new i:new a(this.config.enableColors)}traceLog(e,n){this.log(t.TRACE,e,n)}debug(e,n){this.log(t.DEBUG,e,n)}info(e,n){this.log(t.INFO,e,n)}warn(e,n){this.log(t.WARN,e,n)}error(e,n,r){this.log(t.ERROR,e,n,r)}fatal(e,n,r){this.log(t.FATAL,e,n,r)}withContext(e,t){return this.context.run(e,t)}extendContext(e,t){return this.context.extend(e,t)}setContext(e,t){this.context.set(e,t)}getContext(){return this.context.getContext()}trace=async(e,t)=>this.config.enableTracing?this.tracer.trace(e,t):await t();getTraceId(){return this.tracer.getCurrentTrace()?.traceId}startSpan(e){return this.config.enableTracing?this.tracer.startSpan(e):null}finishSpan(e){if(this.config.enableTracing)return this.tracer.finishSpan(e)}addTraceMetadata(e,t){this.config.enableTracing&&this.tracer.addMetadata(e,t)}addTraceTags(...e){this.config.enableTracing&&this.tracer.addTags(...e)}startTimer(e){return this.config.enableTiming?this.timerManager.start(e):null}stopTimer(e){if(this.config.enableTiming)return this.timerManager.stop(e)}getTimer(e){return this.timerManager.get(e)}child(e){let t=new o(this.config);return Object.entries(e).forEach(([e,n])=>{t.setContext(e,n)}),t}setLevel(e){this.config.level=e}setFormatter(e){this.formatter=e}async profile(e,n,r){let i=this.startTimer(`profile-${e}`),a=performance.now();try{let o=await this.tracer.trace({operationType:`custom`,operationName:`profile:${e}`,autoTiming:!0},n),s=performance.now()-a;i?.stop();let c=r?.logLevel||t.DEBUG;return this.log(c,`Profile: ${e} completed`,{operation:e,duration:`${s.toFixed(2)}ms`,result:r?.logResult?o:`[result hidden]`}),o}catch(t){let n=performance.now()-a;throw i?.stop(),this.error(`Profile: ${e} failed`,{operation:e,duration:`${n.toFixed(2)}ms`,error:t.message},t),t}}logRequest(e,t,n,r){let i=this.getHttpLogLevel(n),a=`${e.toUpperCase()} ${t}${n?` ${n}`:``}`;this.log(i,a,{method:e,url:t,statusCode:n,duration:r?`${r.toFixed(2)}ms`:void 0,type:`http_request`})}async flush(){this.timerManager.clear()}getStats(){return{activeTimers:this.timerManager.getActive().length,activeSpans:this.tracer.getActiveSpans().length,config:{...this.config}}}output(e,n){n>=t.ERROR?console.error(e):console.log(e)}log(e,t,n,r){if(e<this.config.level)return;let i=this.config.enableTracing?this.tracer.getCurrentTrace():void 0,a=this.config.enableContext?this.context.getContext():void 0,o={level:e,message:t,timestamp:new Date,traceId:i?.traceId,parentId:i?.parentId,spanId:i?.spanId,context:a,metadata:n,error:r,tags:i?.tags};i?.metadata?.duration&&(o.duration=i.metadata.duration);let s=this.formatter.format(o);this.output(s,e)}getHttpLogLevel(e){return e?e>=500?t.ERROR:e>=400?t.WARN:t.INFO:t.INFO}};export{o};
1
+ import { LogContext } from "./context.node.js";
2
+ import { LogLevel } from "./types.js";
3
+ import { TimerManager } from "./timer.js";
4
+ import { Tracer } from "./tracer.node.js";
5
+ import { DevFormatter, ProductionFormatter } from "./formatters.js";
6
+
7
+ //#region ../../libs/logger/dist/logger.node.mjs
8
+ var Logger = class Logger$1 {
9
+ config;
10
+ formatter;
11
+ context;
12
+ tracer;
13
+ timerManager;
14
+ constructor(config) {
15
+ this.config = {
16
+ level: LogLevel.INFO,
17
+ environment: process.env.NODE_ENV || "development",
18
+ enableTracing: true,
19
+ enableTiming: true,
20
+ enableContext: true,
21
+ enableColors: true,
22
+ maxContextDepth: 10,
23
+ timestampFormat: "iso",
24
+ ...config
25
+ };
26
+ this.context = LogContext.getInstance();
27
+ this.tracer = new Tracer();
28
+ this.timerManager = new TimerManager();
29
+ this.formatter = this.config.environment === "production" ? new ProductionFormatter() : new DevFormatter(this.config.enableColors);
30
+ }
31
+ traceLog(message, metadata) {
32
+ this.log(LogLevel.TRACE, message, metadata);
33
+ }
34
+ debug(message, metadata) {
35
+ this.log(LogLevel.DEBUG, message, metadata);
36
+ }
37
+ info(message, metadata) {
38
+ this.log(LogLevel.INFO, message, metadata);
39
+ }
40
+ warn(message, metadata) {
41
+ this.log(LogLevel.WARN, message, metadata);
42
+ }
43
+ error(message, metadata, error) {
44
+ this.log(LogLevel.ERROR, message, metadata, error);
45
+ }
46
+ fatal(message, metadata, error) {
47
+ this.log(LogLevel.FATAL, message, metadata, error);
48
+ }
49
+ withContext(context, fn) {
50
+ return this.context.run(context, fn);
51
+ }
52
+ extendContext(additionalContext, fn) {
53
+ return this.context.extend(additionalContext, fn);
54
+ }
55
+ setContext(key, value) {
56
+ this.context.set(key, value);
57
+ }
58
+ getContext() {
59
+ return this.context.getContext();
60
+ }
61
+ trace = async (options, fn) => {
62
+ if (!this.config.enableTracing) return await fn();
63
+ return this.tracer.trace(options, fn);
64
+ };
65
+ getTraceId() {
66
+ return this.tracer.getCurrentTrace()?.traceId;
67
+ }
68
+ startSpan(options) {
69
+ if (!this.config.enableTracing) return null;
70
+ return this.tracer.startSpan(options);
71
+ }
72
+ finishSpan(spanId) {
73
+ if (!this.config.enableTracing) return;
74
+ return this.tracer.finishSpan(spanId);
75
+ }
76
+ addTraceMetadata(key, value) {
77
+ if (this.config.enableTracing) this.tracer.addMetadata(key, value);
78
+ }
79
+ addTraceTags(...tags) {
80
+ if (this.config.enableTracing) this.tracer.addTags(...tags);
81
+ }
82
+ startTimer(id) {
83
+ if (!this.config.enableTiming) return null;
84
+ return this.timerManager.start(id);
85
+ }
86
+ stopTimer(id) {
87
+ if (!this.config.enableTiming) return;
88
+ return this.timerManager.stop(id);
89
+ }
90
+ getTimer(id) {
91
+ return this.timerManager.get(id);
92
+ }
93
+ child(context) {
94
+ const childLogger = new Logger$1(this.config);
95
+ Object.entries(context).forEach(([key, value]) => {
96
+ childLogger.setContext(key, value);
97
+ });
98
+ return childLogger;
99
+ }
100
+ setLevel(level) {
101
+ this.config.level = level;
102
+ }
103
+ setFormatter(formatter) {
104
+ this.formatter = formatter;
105
+ }
106
+ async profile(operationName, fn, options) {
107
+ const timer = this.startTimer(`profile-${operationName}`);
108
+ const startTime = performance.now();
109
+ try {
110
+ const result = await this.tracer.trace({
111
+ operationType: "custom",
112
+ operationName: `profile:${operationName}`,
113
+ autoTiming: true
114
+ }, fn);
115
+ const duration = performance.now() - startTime;
116
+ timer?.stop();
117
+ const logLevel = options?.logLevel || LogLevel.DEBUG;
118
+ this.log(logLevel, `Profile: ${operationName} completed`, {
119
+ operation: operationName,
120
+ duration: `${duration.toFixed(2)}ms`,
121
+ result: options?.logResult ? result : "[result hidden]"
122
+ });
123
+ return result;
124
+ } catch (error) {
125
+ const duration = performance.now() - startTime;
126
+ timer?.stop();
127
+ this.error(`Profile: ${operationName} failed`, {
128
+ operation: operationName,
129
+ duration: `${duration.toFixed(2)}ms`,
130
+ error: error.message
131
+ }, error);
132
+ throw error;
133
+ }
134
+ }
135
+ logRequest(method, url, statusCode, duration) {
136
+ const level = this.getHttpLogLevel(statusCode);
137
+ const message = `${method.toUpperCase()} ${url}${statusCode ? ` ${statusCode}` : ""}`;
138
+ this.log(level, message, {
139
+ method,
140
+ url,
141
+ statusCode,
142
+ duration: duration ? `${duration.toFixed(2)}ms` : void 0,
143
+ type: "http_request"
144
+ });
145
+ }
146
+ async flush() {
147
+ this.timerManager.clear();
148
+ }
149
+ getStats() {
150
+ return {
151
+ activeTimers: this.timerManager.getActive().length,
152
+ activeSpans: this.tracer.getActiveSpans().length,
153
+ config: { ...this.config }
154
+ };
155
+ }
156
+ output(message, level) {
157
+ if (level >= LogLevel.ERROR) console.error(message);
158
+ else console.log(message);
159
+ }
160
+ log(level, message, metadata, error) {
161
+ if (level < this.config.level) return;
162
+ const currentTrace = this.config.enableTracing ? this.tracer.getCurrentTrace() : void 0;
163
+ const contextData = this.config.enableContext ? this.context.getContext() : void 0;
164
+ const entry = {
165
+ level,
166
+ message,
167
+ timestamp: /* @__PURE__ */ new Date(),
168
+ traceId: currentTrace?.traceId,
169
+ parentId: currentTrace?.parentId,
170
+ spanId: currentTrace?.spanId,
171
+ context: contextData,
172
+ metadata,
173
+ error,
174
+ tags: currentTrace?.tags
175
+ };
176
+ if (currentTrace?.metadata?.duration) entry.duration = currentTrace.metadata.duration;
177
+ const formatted = this.formatter.format(entry);
178
+ this.output(formatted, level);
179
+ }
180
+ getHttpLogLevel(statusCode) {
181
+ if (!statusCode) return LogLevel.INFO;
182
+ if (statusCode >= 500) return LogLevel.ERROR;
183
+ if (statusCode >= 400) return LogLevel.WARN;
184
+ return LogLevel.INFO;
185
+ }
186
+ };
187
+
188
+ //#endregion
189
+ export { Logger };
@@ -1 +1,126 @@
1
- var e=class{id;startTime;laps=[];stopped=!1;stopTime;constructor(e){this.id=e||crypto.randomUUID(),this.startTime=performance.now()}stop(){if(this.stopped)return this.getElapsed();this.stopTime=performance.now(),this.stopped=!0;let e=this.stopTime-this.startTime;return this.laps.push({label:`stop`,time:this.stopTime,elapsed:e}),e}lap(e){if(this.stopped)return this.getElapsed();let t=performance.now(),n=t-this.startTime;return this.laps.push({label:e||`lap-${this.laps.length+1}`,time:t,elapsed:n}),n}getElapsed(){return this.stopped&&this.stopTime?this.stopTime-this.startTime:performance.now()-this.startTime}getLaps(){return[...this.laps]}getSummary(){return{id:this.id,totalTime:this.getElapsed(),isRunning:!this.stopped,laps:this.getLaps()}}reset(){this.startTime=performance.now(),this.laps=[],this.stopped=!1,this.stopTime=void 0}},t=class{timers=new Map;start(t){let n=new e(t);return this.timers.set(n.id,n),n}get(e){return this.timers.get(e)}stop(e){let t=this.timers.get(e);if(t){let n=t.stop();return this.timers.delete(e),n}}getActive(){return Array.from(this.timers.values()).filter(e=>!!e.getSummary().isRunning)}clear(){this.timers.clear()}getSummary(){return Array.from(this.timers.values()).map(e=>e.getSummary())}};export{e,t};
1
+ //#region ../../libs/logger/dist/timer.mjs
2
+ var Timer = class {
3
+ id;
4
+ startTime;
5
+ laps = [];
6
+ stopped = false;
7
+ stopTime;
8
+ constructor(id) {
9
+ this.id = id || crypto.randomUUID();
10
+ this.startTime = performance.now();
11
+ }
12
+ /**
13
+ * Stop the timer and return elapsed time in milliseconds
14
+ */
15
+ stop() {
16
+ if (this.stopped) return this.getElapsed();
17
+ this.stopTime = performance.now();
18
+ this.stopped = true;
19
+ const elapsed = this.stopTime - this.startTime;
20
+ this.laps.push({
21
+ label: "stop",
22
+ time: this.stopTime,
23
+ elapsed
24
+ });
25
+ return elapsed;
26
+ }
27
+ /**
28
+ * Record a lap time and return elapsed time since start
29
+ */
30
+ lap(label) {
31
+ if (this.stopped) return this.getElapsed();
32
+ const now = performance.now();
33
+ const elapsed = now - this.startTime;
34
+ this.laps.push({
35
+ label: label || `lap-${this.laps.length + 1}`,
36
+ time: now,
37
+ elapsed
38
+ });
39
+ return elapsed;
40
+ }
41
+ /**
42
+ * Get elapsed time without stopping the timer
43
+ */
44
+ getElapsed() {
45
+ if (this.stopped && this.stopTime) return this.stopTime - this.startTime;
46
+ return performance.now() - this.startTime;
47
+ }
48
+ /**
49
+ * Get all recorded laps
50
+ */
51
+ getLaps() {
52
+ return [...this.laps];
53
+ }
54
+ /**
55
+ * Get timer summary with total time and laps
56
+ */
57
+ getSummary() {
58
+ return {
59
+ id: this.id,
60
+ totalTime: this.getElapsed(),
61
+ isRunning: !this.stopped,
62
+ laps: this.getLaps()
63
+ };
64
+ }
65
+ /**
66
+ * Reset the timer (starts a new timing session)
67
+ */
68
+ reset() {
69
+ this.startTime = performance.now();
70
+ this.laps = [];
71
+ this.stopped = false;
72
+ this.stopTime = void 0;
73
+ }
74
+ };
75
+ /**
76
+ * Utility class for managing multiple timers
77
+ */
78
+ var TimerManager = class {
79
+ timers = /* @__PURE__ */ new Map();
80
+ /**
81
+ * Start a new timer
82
+ */
83
+ start(id) {
84
+ const timer = new Timer(id);
85
+ this.timers.set(timer.id, timer);
86
+ return timer;
87
+ }
88
+ /**
89
+ * Get an existing timer
90
+ */
91
+ get(id) {
92
+ return this.timers.get(id);
93
+ }
94
+ /**
95
+ * Stop and remove a timer
96
+ */
97
+ stop(id) {
98
+ const timer = this.timers.get(id);
99
+ if (timer) {
100
+ const elapsed = timer.stop();
101
+ this.timers.delete(id);
102
+ return elapsed;
103
+ }
104
+ }
105
+ /**
106
+ * Get all active timers
107
+ */
108
+ getActive() {
109
+ return Array.from(this.timers.values()).filter((timer) => !timer.getSummary().isRunning === false);
110
+ }
111
+ /**
112
+ * Clear all timers
113
+ */
114
+ clear() {
115
+ this.timers.clear();
116
+ }
117
+ /**
118
+ * Get summary of all timers
119
+ */
120
+ getSummary() {
121
+ return Array.from(this.timers.values()).map((timer) => timer.getSummary());
122
+ }
123
+ };
124
+
125
+ //#endregion
126
+ export { Timer, TimerManager };
@@ -1 +1,115 @@
1
- import{t as e}from"./context.node.js";import{e as t}from"./timer.js";var n=class{context;activeSpans=new Map;constructor(){this.context=e.getInstance()}startSpan(e){let t=this.context.getCurrentTrace(),n={traceId:t?.traceId||this.generateTraceId(),parentId:t?.spanId,spanId:this.generateSpanId(),operationType:e.operationType,operationName:e.operationName,startTime:performance.now(),metadata:{...e.metadata},tags:[...e.tags||[]]};return this.activeSpans.set(n.spanId,n),this.context.setTrace(n),n}finishSpan(e){let t=this.activeSpans.get(e);if(!t)return;let n=performance.now()-t.startTime;if(this.activeSpans.delete(e),this.context.getCurrentTrace()?.spanId===e&&t.parentId){let e=this.findSpanById(t.parentId);e&&this.context.setTrace(e)}return n}async trace(e,n){let r=this.startSpan(e),i=e.autoTiming===!1?void 0:new t(`trace-${r.spanId}`);try{let e=await n(),t=this.finishSpan(r.spanId);return i&&i.stop(),t!==void 0&&(r.metadata.duration=t),e}catch(e){r.metadata.error={name:e.name||`Unknown`,message:e.message||`Unknown error`,stack:e.stack};let t=this.finishSpan(r.spanId);throw r.metadata.duration=t,i&&i.stop(),e}}addMetadata(e,t){let n=this.context.getCurrentTrace();n&&(n.metadata[e]=t)}addTags(...e){let t=this.context.getCurrentTrace();t&&t.tags.push(...e)}getCurrentTrace(){return this.context.getCurrentTrace()}getActiveSpans(){return Array.from(this.activeSpans.values())}findSpanById(e){return this.activeSpans.get(e)}generateTraceId(){return crypto.randomUUID().replace(/-/g,``)}generateSpanId(){return crypto.randomUUID().replace(/-/g,``).substring(0,16)}};export{n};
1
+ import { LogContext } from "./context.node.js";
2
+ import { Timer } from "./timer.js";
3
+
4
+ //#region ../../libs/logger/dist/tracer.node.mjs
5
+ var Tracer = class {
6
+ context;
7
+ activeSpans = /* @__PURE__ */ new Map();
8
+ constructor() {
9
+ this.context = LogContext.getInstance();
10
+ }
11
+ /**
12
+ * Start a new trace span
13
+ */
14
+ startSpan(options) {
15
+ const parentTrace = this.context.getCurrentTrace();
16
+ const span = {
17
+ traceId: parentTrace?.traceId || this.generateTraceId(),
18
+ parentId: parentTrace?.spanId,
19
+ spanId: this.generateSpanId(),
20
+ operationType: options.operationType,
21
+ operationName: options.operationName,
22
+ startTime: performance.now(),
23
+ metadata: { ...options.metadata },
24
+ tags: [...options.tags || []]
25
+ };
26
+ this.activeSpans.set(span.spanId, span);
27
+ this.context.setTrace(span);
28
+ return span;
29
+ }
30
+ /**
31
+ * Finish a trace span
32
+ */
33
+ finishSpan(spanId) {
34
+ const span = this.activeSpans.get(spanId);
35
+ if (!span) return;
36
+ const duration = performance.now() - span.startTime;
37
+ this.activeSpans.delete(spanId);
38
+ if (this.context.getCurrentTrace()?.spanId === spanId && span.parentId) {
39
+ const parentSpan = this.findSpanById(span.parentId);
40
+ if (parentSpan) this.context.setTrace(parentSpan);
41
+ }
42
+ return duration;
43
+ }
44
+ /**
45
+ * Execute a function within a trace span
46
+ */
47
+ async trace(options, fn) {
48
+ const span = this.startSpan(options);
49
+ const timer = options.autoTiming !== false ? new Timer(`trace-${span.spanId}`) : void 0;
50
+ try {
51
+ const result = await fn();
52
+ const duration = this.finishSpan(span.spanId);
53
+ if (timer) timer.stop();
54
+ if (duration !== void 0) span.metadata.duration = duration;
55
+ return result;
56
+ } catch (error) {
57
+ span.metadata.error = {
58
+ name: error.name || "Unknown",
59
+ message: error.message || "Unknown error",
60
+ stack: error.stack
61
+ };
62
+ const duration = this.finishSpan(span.spanId);
63
+ span.metadata.duration = duration;
64
+ if (timer) timer.stop();
65
+ throw error;
66
+ }
67
+ }
68
+ /**
69
+ * Add metadata to current span
70
+ */
71
+ addMetadata(key, value) {
72
+ const currentTrace = this.context.getCurrentTrace();
73
+ if (currentTrace) currentTrace.metadata[key] = value;
74
+ }
75
+ /**
76
+ * Add tags to current span
77
+ */
78
+ addTags(...tags) {
79
+ const currentTrace = this.context.getCurrentTrace();
80
+ if (currentTrace) currentTrace.tags.push(...tags);
81
+ }
82
+ /**
83
+ * Get current trace context
84
+ */
85
+ getCurrentTrace() {
86
+ return this.context.getCurrentTrace();
87
+ }
88
+ /**
89
+ * Get all active spans
90
+ */
91
+ getActiveSpans() {
92
+ return Array.from(this.activeSpans.values());
93
+ }
94
+ /**
95
+ * Find a span by ID
96
+ */
97
+ findSpanById(spanId) {
98
+ return this.activeSpans.get(spanId);
99
+ }
100
+ /**
101
+ * Generate a unique trace ID
102
+ */
103
+ generateTraceId() {
104
+ return crypto.randomUUID().replace(/-/g, "");
105
+ }
106
+ /**
107
+ * Generate a unique span ID
108
+ */
109
+ generateSpanId() {
110
+ return crypto.randomUUID().replace(/-/g, "").substring(0, 16);
111
+ }
112
+ };
113
+
114
+ //#endregion
115
+ export { Tracer };
@@ -1 +1,13 @@
1
- let e=function(e){return e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.FATAL=5]=`FATAL`,e}({});export{e};
1
+ //#region ../../libs/logger/dist/types.mjs
2
+ let LogLevel = /* @__PURE__ */ function(LogLevel$1) {
3
+ LogLevel$1[LogLevel$1["TRACE"] = 0] = "TRACE";
4
+ LogLevel$1[LogLevel$1["DEBUG"] = 1] = "DEBUG";
5
+ LogLevel$1[LogLevel$1["INFO"] = 2] = "INFO";
6
+ LogLevel$1[LogLevel$1["WARN"] = 3] = "WARN";
7
+ LogLevel$1[LogLevel$1["ERROR"] = 4] = "ERROR";
8
+ LogLevel$1[LogLevel$1["FATAL"] = 5] = "FATAL";
9
+ return LogLevel$1;
10
+ }({});
11
+
12
+ //#endregion
13
+ export { LogLevel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/example.content-generation",
3
- "version": "0.0.0-canary-20251217062943",
3
+ "version": "0.0.0-canary-20251217072406",
4
4
  "description": "Content generation example using @lssm/lib.content-gen.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,13 +27,14 @@
27
27
  "test": "bun test"
28
28
  },
29
29
  "dependencies": {
30
- "@lssm/lib.content-gen": "0.0.0-canary-20251217062943",
31
- "@lssm/lib.contracts": "0.0.0-canary-20251217062943",
32
- "@lssm/lib.logger": "0.0.0-canary-20251217062943"
30
+ "@lssm/lib.schema": "0.0.0-canary-20251217072406",
31
+ "@lssm/lib.contracts": "0.0.0-canary-20251217072406",
32
+ "@lssm/lib.content-gen": "0.0.0-canary-20251217072406",
33
+ "@lssm/lib.logger": "0.0.0-canary-20251217072406"
33
34
  },
34
35
  "devDependencies": {
35
- "@lssm/tool.tsdown": "0.0.0-canary-20251217062943",
36
- "@lssm/tool.typescript": "0.0.0-canary-20251217062943",
36
+ "@lssm/tool.tsdown": "0.0.0-canary-20251217072406",
37
+ "@lssm/tool.typescript": "0.0.0-canary-20251217072406",
37
38
  "tsdown": "^0.17.4",
38
39
  "typescript": "^5.9.3"
39
40
  },