@lssm/example.content-generation 0.0.0-canary-20251217080011 → 0.0.0-canary-20251219202229

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 (95) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +110 -74
  2. package/.turbo/turbo-build.log +111 -18
  3. package/CHANGELOG.md +5 -5
  4. package/LICENSE +21 -0
  5. package/dist/docs/content-generation.docblock.js +2 -1
  6. package/dist/docs/content-generation.docblock.js.map +1 -0
  7. package/dist/example.d.ts +2 -1
  8. package/dist/example.d.ts.map +1 -0
  9. package/dist/example.js +2 -1
  10. package/dist/example.js.map +1 -0
  11. package/dist/generate.d.ts +2 -1
  12. package/dist/generate.d.ts.map +1 -0
  13. package/dist/generate.js +2 -1
  14. package/dist/generate.js.map +1 -0
  15. package/dist/libs/content-gen/dist/generators/blog.js +2 -1
  16. package/dist/libs/content-gen/dist/generators/blog.js.map +1 -0
  17. package/dist/libs/content-gen/dist/generators/email.js +2 -1
  18. package/dist/libs/content-gen/dist/generators/email.js.map +1 -0
  19. package/dist/libs/content-gen/dist/generators/landing-page.js +2 -1
  20. package/dist/libs/content-gen/dist/generators/landing-page.js.map +1 -0
  21. package/dist/libs/content-gen/dist/generators/social.js +2 -1
  22. package/dist/libs/content-gen/dist/generators/social.js.map +1 -0
  23. package/dist/libs/content-gen/dist/seo/optimizer.js +2 -1
  24. package/dist/libs/content-gen/dist/seo/optimizer.js.map +1 -0
  25. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +2 -1
  26. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js.map +1 -0
  27. package/dist/libs/contracts/dist/docs/index.js +2 -6
  28. package/dist/libs/contracts/dist/docs/meta.docs.js +30 -0
  29. package/dist/libs/contracts/dist/docs/meta.docs.js.map +1 -0
  30. package/dist/libs/contracts/dist/docs/presentations.js +2 -1
  31. package/dist/libs/contracts/dist/docs/presentations.js.map +1 -0
  32. package/dist/libs/contracts/dist/docs/registry.js +2 -1
  33. package/dist/libs/contracts/dist/docs/registry.js.map +1 -0
  34. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +2 -1
  35. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js.map +1 -0
  36. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +2 -1
  37. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +1 -0
  38. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +2 -1
  39. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js.map +1 -0
  40. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +2 -1
  41. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js.map +1 -0
  42. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +2 -1
  43. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js.map +1 -0
  44. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +2 -1
  45. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js.map +1 -0
  46. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +2 -1
  47. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js.map +1 -0
  48. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +2 -1
  49. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js.map +1 -0
  50. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +2 -1
  51. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js.map +1 -0
  52. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +2 -1
  53. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js.map +1 -0
  54. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +2 -1
  55. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js.map +1 -0
  56. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +2 -1
  57. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js.map +1 -0
  58. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +2 -1
  59. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js.map +1 -0
  60. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +2 -1
  61. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js.map +1 -0
  62. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +2 -1
  63. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js.map +1 -0
  64. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +2 -1
  65. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js.map +1 -0
  66. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +2 -1
  67. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js.map +1 -0
  68. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +2 -1
  69. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js.map +1 -0
  70. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +2 -1
  71. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js.map +1 -0
  72. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +2 -1
  73. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js.map +1 -0
  74. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js +97 -0
  75. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js.map +1 -0
  76. package/dist/libs/logger/dist/context.node.js +2 -1
  77. package/dist/libs/logger/dist/context.node.js.map +1 -0
  78. package/dist/libs/logger/dist/formatters.js +2 -1
  79. package/dist/libs/logger/dist/formatters.js.map +1 -0
  80. package/dist/libs/logger/dist/logger.node.js +2 -1
  81. package/dist/libs/logger/dist/logger.node.js.map +1 -0
  82. package/dist/libs/logger/dist/timer.js +2 -1
  83. package/dist/libs/logger/dist/timer.js.map +1 -0
  84. package/dist/libs/logger/dist/tracer.node.js +2 -1
  85. package/dist/libs/logger/dist/tracer.node.js.map +1 -0
  86. package/dist/libs/logger/dist/types.js +2 -1
  87. package/dist/libs/logger/dist/types.js.map +1 -0
  88. package/package.json +10 -9
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  91. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  92. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  93. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  94. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  95. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vscode-extension.docblock.js","names":[],"sources":["../../../../../../../../libs/contracts/dist/docs/tech/vscode-extension.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../registry.js\";\n\n//#region src/docs/tech/vscode-extension.docblock.ts\nconst tech_vscode_extension_DocBlocks = [{\n\tid: \"docs.tech.vscode.extension\",\n\ttitle: \"ContractSpec VS Code Extension\",\n\tsummary: \"VS Code extension for spec-first development with validation, scaffolding, and MCP integration.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/vscode/extension\",\n\ttags: [\n\t\t\"vscode\",\n\t\t\"extension\",\n\t\t\"tooling\",\n\t\t\"dx\"\n\t],\n\tbody: `# ContractSpec VS Code Extension\n\nThe ContractSpec VS Code extension provides spec-first development tooling directly in your editor.\n\n## Features\n\n- **Real-time Validation**: Get instant feedback on spec errors and warnings as you save files\n- **Build/Scaffold**: Generate handler and component skeletons from specs (no AI required)\n- **Spec Explorer**: List and navigate all specs in your workspace\n- **Dependency Analysis**: Visualize spec dependencies and detect cycles\n- **MCP Integration**: Search ContractSpec documentation via Model Context Protocol\n- **Snippets**: Code snippets for common ContractSpec patterns\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| \\`ContractSpec: Validate Current Spec\\` | Validate the currently open spec file |\n| \\`ContractSpec: Validate All Specs\\` | Validate all spec files in the workspace |\n| \\`ContractSpec: Build/Scaffold\\` | Generate handler/component from the current spec |\n| \\`ContractSpec: List All Specs\\` | Show all specs in the workspace |\n| \\`ContractSpec: Analyze Dependencies\\` | Analyze and visualize spec dependencies |\n| \\`ContractSpec: Search Docs (MCP)\\` | Search documentation via MCP |\n\n## Configuration\n\n| Setting | Description | Default |\n|---------|-------------|---------|\n| \\`contractspec.api.baseUrl\\` | Base URL for ContractSpec API (enables MCP + remote telemetry) | \\`\"\"\\` |\n| \\`contractspec.telemetry.posthogHost\\` | PostHog host URL for direct telemetry | \\`\"https://eu.posthog.com\"\\` |\n| \\`contractspec.telemetry.posthogProjectKey\\` | PostHog project key for direct telemetry | \\`\"\"\\` |\n| \\`contractspec.validation.onSave\\` | Run validation on save | \\`true\\` |\n| \\`contractspec.validation.onOpen\\` | Run validation on open | \\`true\\` |\n\n## Architecture\n\nThe extension uses:\n- \\`@lssm/module.contractspec-workspace\\` for pure analysis + templates\n- \\`@lssm/bundle.contractspec-workspace\\` for workspace services + adapters\n\nThis allows the extension to work without requiring the CLI to be installed.\n\n## Telemetry\n\nThe extension uses a hybrid telemetry approach:\n1. If \\`contractspec.api.baseUrl\\` is configured → send to API \\`/api/telemetry/ingest\\`\n2. Otherwise → send directly to PostHog (if project key configured)\n\nTelemetry respects VS Code's telemetry settings. No file paths, source code, or PII is collected.\n`\n}, {\n\tid: \"docs.tech.vscode.snippets\",\n\ttitle: \"ContractSpec Snippets\",\n\tsummary: \"Code snippets for common ContractSpec patterns in VS Code.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/vscode/snippets\",\n\ttags: [\n\t\t\"vscode\",\n\t\t\"snippets\",\n\t\t\"dx\"\n\t],\n\tbody: `# ContractSpec Snippets\n\nThe VS Code extension includes snippets for common ContractSpec patterns.\n\n## Available Snippets\n\n| Prefix | Description |\n|--------|-------------|\n| \\`contractspec-command\\` | Create a new command (write operation) |\n| \\`contractspec-query\\` | Create a new query (read-only operation) |\n| \\`contractspec-event\\` | Create a new event |\n| \\`contractspec-docblock\\` | Create a new DocBlock |\n| \\`contractspec-telemetry\\` | Create a new TelemetrySpec |\n| \\`contractspec-presentation\\` | Create a new Presentation |\n\n## Usage\n\nType the prefix in a TypeScript file and press Tab to expand the snippet. Tab through the placeholders to fill in your values.\n`\n}];\nregisterDocBlocks(tech_vscode_extension_DocBlocks);\n\n//#endregion\nexport { tech_vscode_extension_DocBlocks };\n//# sourceMappingURL=vscode-extension.docblock.js.map"],"mappings":";;;AAGA,MAAM,kCAAkC,CAAC;CACxC,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDN,EAAE;CACF,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;CAmBN,CAAC;AACF,kBAAkB,gCAAgC"}
@@ -17,4 +17,5 @@ const tech_workflows_overview_DocBlocks = [{
17
17
  }];
18
18
  registerDocBlocks(tech_workflows_overview_DocBlocks);
19
19
 
20
- //#endregion
20
+ //#endregion
21
+ //# sourceMappingURL=overview.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overview.docblock.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/docs/tech/workflows/overview.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../../registry.js\";\n\n//#region src/docs/tech/workflows/overview.docblock.ts\nconst tech_workflows_overview_DocBlocks = [{\n\tid: \"docs.tech.workflows.overview\",\n\ttitle: \"WorkflowSpec Overview\",\n\tsummary: \"WorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@lssm/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/workflows/overview\",\n\ttags: [\n\t\t\"tech\",\n\t\t\"workflows\",\n\t\t\"overview\"\n\t],\n\tbody: \"# WorkflowSpec Overview\\n\\n## Purpose\\n\\nWorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@lssm/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.\\n\\n## Core Types\\n\\n- `WorkflowMeta`: ownership metadata (`title`, `domain`, `owners`, `tags`, `stability`) plus `name` and `version`.\\n- `WorkflowDefinition`:\\n - `entryStepId?`: optional explicit entry point (defaults to first step).\\n - `steps[]`: ordered list of `Step` descriptors.\\n - `transitions[]`: directed edges between steps with optional expressions.\\n - `sla?`: aggregated timing hints for the overall flow or per-step budgets.\\n - `compensation?`: fallback operations executed when a workflow is rolled back or fails.\\n- `Step`:\\n - `type`: `human`, `automation`, or `decision`.\\n - `action`: references either a `ContractSpec` (`operation`) or `FormSpec` (`form`).\\n - Optional `guard`, `timeoutMs`, and retry policy (`maxAttempts`, `backoff`, `delayMs`, `maxDelayMs?`).\\n - `requiredIntegrations?`: integration slot ids that must be bound before the step may execute.\\n - `requiredCapabilities?`: `CapabilityRef[]` that must be enabled in the resolved app config.\\n- `Transition`: `from` → `to` with optional `condition` string (simple data expressions).\\n\\n## Registry & Validation\\n\\n- `WorkflowRegistry` (`src/workflow/spec.ts`) stores specs by key `<name>.v<version>` and exposes `register`, `list`, and `get`.\\n- `validateWorkflowSpec()` (`src/workflow/validation.ts`) checks:\\n - Duplicate step IDs.\\n - Unknown `from`/`to` transitions.\\n - Empty guards/conditions.\\n - Reachability from the entry step.\\n - Cycles in the graph.\\n - Operation/Form references against provided registries.\\n- `assertWorkflowSpecValid()` wraps validation and throws `WorkflowValidationError` when errors remain.\\n\\n## Runtime\\n\\n- `WorkflowRunner` (`src/workflow/runner.ts`) executes workflows and coordinates steps.\\n - `start(name, version?, initialData?)` returns a `workflowId`.\\n - `executeStep(workflowId, input?)` runs the current step (automation or human).\\n - `getState(workflowId)` retrieves the latest state snapshot.\\n - `cancel(workflowId)` marks the workflow as cancelled.\\n - `preFlightCheck(name, version?, resolvedConfig?)` evaluates integration/capability requirements before the workflow starts.\\n - Throws `WorkflowPreFlightError` if required integration slots are unbound or required capabilities are disabled.\\n- `StateStore` (`src/workflow/state.ts`) abstracts persistence. V1 ships with:\\n - `InMemoryStateStore` (`src/workflow/adapters/memory-store.ts`) for tests/dev.\\n - Placeholder factories for file/database adapters (`adapters/file-adapter.ts`, `adapters/db-adapter.ts`).\\n- Guard evaluation: expression guards run through `evaluateExpression()` (`src/workflow/expression.ts`); custom policy guards can be provided via `guardEvaluator`.\\n- Events: the runner emits `workflow.started`, `workflow.step_completed`, `workflow.step_failed`, and `workflow.cancelled` through the optional `eventEmitter`.\\n- React bindings (`@lssm/lib.presentation-runtime-react`):\\n - `useWorkflow` hook (polls state, exposes `executeStep`, `cancel`, `refresh`).\\n - `WorkflowStepper` progress indicator using design-system Stepper.\\n - `WorkflowStepRenderer` helper to render human/automation/decision steps with sensible fallbacks.\\n\\n## Authoring Checklist\\n\\n1. Reuse existing operations/forms; create new specs when missing.\\n2. Prefer explicit `entryStepId` for clarity (especially with decision branches).\\n3. Give automation steps an `operation` and human steps a `form` (warnings surface otherwise).\\n4. Use short, meaningful step IDs (`submit`, `review`, `finalize`) to simplify analytics.\\n5. Keep guard expressions deterministic; complex policy logic should move to PolicySpec (Phase 2).\\n\\n## Testing\\n\\n- Add unit tests for new workflows via `assertWorkflowSpecValid`.\\n- Use the new Vitest suites (`validation.test.ts`, `expression.test.ts`, `runner.test.ts`) as examples.\\n- CLI support will arrive in Phase 1 PR 3 (`contractspec create --type workflow`).\\n\\n## Tooling\\n\\n- `contractspec create --type workflow` scaffolds a WorkflowSpec with interactive prompts.\\n- `contractspec build <spec.workflow.ts>` generates a runner scaffold (`.runner.ts`) wired to `WorkflowRunner` and the in-memory store.\\n- `contractspec validate` understands `.workflow.ts` files and checks core structure (meta, steps, transitions).\\n\\n## Next Steps (Non-MVP)\\n\\n- Persistence adapters (database/file) for workflow state (Phase 2).\\n- React bindings (`useWorkflow`, `WorkflowStepper`) and presentation-runtime integration (PR 3).\\n- Policy engine integration (`guard.type === 'policy'` validated against PolicySpec).\\n- Telemetry hooks for step execution metrics.\\n\\n\"\n}];\nregisterDocBlocks(tech_workflows_overview_DocBlocks);\n\n//#endregion\nexport { tech_workflows_overview_DocBlocks };\n//# sourceMappingURL=overview.docblock.js.map"],"mappings":";;;AAGA,MAAM,oCAAoC,CAAC;CAC1C,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;CACD,MAAM;CACN,CAAC;AACF,kBAAkB,kCAAkC"}
@@ -0,0 +1,97 @@
1
+ import { registerDocBlocks } from "./registry.js";
2
+
3
+ //#region ../../libs/contracts/dist/docs/tech-contracts.docs.js
4
+ const techContractsDocs = [{
5
+ id: "docs.tech.contracts.presentations-v2",
6
+ title: "Presentations V2 — Unified Descriptor & Transform Engine",
7
+ summary: "How PresentationDescriptorV2 and TransformEngine keep docs/renderers consistent.",
8
+ visibility: "public",
9
+ route: "/docs/tech/contracts/presentations-v2",
10
+ kind: "reference",
11
+ tags: [
12
+ "presentations",
13
+ "docs",
14
+ "mcp"
15
+ ],
16
+ body: `## Presentations V2 — Unified Descriptor & Transform Engine
17
+
18
+ ### Purpose
19
+
20
+ Unify presentations into one descriptor (\`PresentationDescriptorV2\`) that declares a single source (React component key or BlockNote doc) and a list of output targets (react, markdown, application/json, application/xml). A pluggable \`TransformEngine\` renders any target and applies PII redaction.
21
+
22
+ ### Types
23
+
24
+ \`\`\`ts
25
+ type PresentationTarget =
26
+ | 'react'
27
+ | 'markdown'
28
+ | 'application/json'
29
+ | 'application/xml';
30
+
31
+ type PresentationSource =
32
+ | {
33
+ type: 'component';
34
+ framework: 'react';
35
+ componentKey: string;
36
+ props?: AnySchemaModel;
37
+ }
38
+ | { type: 'blocknotejs'; docJson: unknown; blockConfig?: unknown };
39
+
40
+ interface PresentationDescriptorV2 {
41
+ meta: PresentationV2Meta; // includes partial OwnerShipMeta + description
42
+ policy?: { flags?: string[]; pii?: string[] };
43
+ source: PresentationSource;
44
+ targets: PresentationTarget[];
45
+ }
46
+
47
+ // Shared ownership schema (source of truth in @lssm/lib.contracts/src/ownership.ts)
48
+ interface OwnerShipMeta {
49
+ title: string;
50
+ description: string;
51
+ domain: string;
52
+ owners: Owner[];
53
+ tags: Tag[];
54
+ stability: Stability;
55
+ }
56
+
57
+ type Stability = 'experimental' | 'beta' | 'stable' | 'deprecated';
58
+ type Owner = string; // curated list available in code (e.g., '@sigil-team', 'team-strit')
59
+ type Tag = string; // curated list available in code (e.g., 'auth', 'spots')
60
+
61
+ // For V2 presentations, meta is a Partial<OwnerShipMeta> plus description, name, version
62
+ interface PresentationV2Meta extends Partial<OwnerShipMeta> {
63
+ name: string;
64
+ version: number;
65
+ description?: string;
66
+ }
67
+ \`\`\`
68
+
69
+ ### Engine
70
+
71
+ Use \`createDefaultTransformEngine()\` and register custom renderers as needed (e.g., high-fidelity BlockNote → Markdown). The default engine supports markdown/json/xml; a React renderer returns a serializable descriptor the host app renders via a \`componentMap\` or a BlockNote renderer. The canonical source type string is \`blocknotejs\` (not \`blocknote\`).
72
+
73
+ PII paths (JSON-like) are redacted from rendered outputs.
74
+
75
+ ### MCP Integration
76
+
77
+ \`createMcpServer\` accepts \`presentationsV2\`. Each descriptor is exposed under \`presentation://<name>/v<version>\` and negotiated variants (\`.md/.json/.xml\`) are rendered by the engine.
78
+
79
+ ### Migration
80
+
81
+ - V1 \`PresentationSpec\` remains supported; a back-compat helper converts V1 → V2 when convenient.
82
+ - Prefer V2 for new work.
83
+
84
+ ### Examples (Sigil)
85
+
86
+ - \`sigil.auth.webauth_tabs_v2\`: component source (\`componentKey: 'sigil.webauth.tabs'\`), targets \`react/json/xml\`.
87
+ - \`sigil.signup.guide_v2\`: BlockNote doc source, targets \`react/markdown/json/xml\`.
88
+
89
+ ### React Rendering
90
+
91
+ Host apps use a \`componentMap\` (e.g., \`'sigil.webauth.tabs' → WebAuthTabs\`) and a BlockNote renderer to turn the React render descriptor into elements.`
92
+ }];
93
+ registerDocBlocks(techContractsDocs);
94
+
95
+ //#endregion
96
+ export { techContractsDocs };
97
+ //# sourceMappingURL=tech-contracts.docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tech-contracts.docs.js","names":[],"sources":["../../../../../../../libs/contracts/dist/docs/tech-contracts.docs.js"],"sourcesContent":["import { registerDocBlocks } from \"./registry.js\";\n\n//#region src/docs/tech-contracts.docs.ts\nconst techContractsDocs = [{\n\tid: \"docs.tech.contracts.presentations-v2\",\n\ttitle: \"Presentations V2 — Unified Descriptor & Transform Engine\",\n\tsummary: \"How PresentationDescriptorV2 and TransformEngine keep docs/renderers consistent.\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/contracts/presentations-v2\",\n\tkind: \"reference\",\n\ttags: [\n\t\t\"presentations\",\n\t\t\"docs\",\n\t\t\"mcp\"\n\t],\n\tbody: `## Presentations V2 — Unified Descriptor & Transform Engine\n\n### Purpose\n\nUnify presentations into one descriptor (\\`PresentationDescriptorV2\\`) that declares a single source (React component key or BlockNote doc) and a list of output targets (react, markdown, application/json, application/xml). A pluggable \\`TransformEngine\\` renders any target and applies PII redaction.\n\n### Types\n\n\\`\\`\\`ts\ntype PresentationTarget =\n | 'react'\n | 'markdown'\n | 'application/json'\n | 'application/xml';\n\ntype PresentationSource =\n | {\n type: 'component';\n framework: 'react';\n componentKey: string;\n props?: AnySchemaModel;\n }\n | { type: 'blocknotejs'; docJson: unknown; blockConfig?: unknown };\n\ninterface PresentationDescriptorV2 {\n meta: PresentationV2Meta; // includes partial OwnerShipMeta + description\n policy?: { flags?: string[]; pii?: string[] };\n source: PresentationSource;\n targets: PresentationTarget[];\n}\n\n// Shared ownership schema (source of truth in @lssm/lib.contracts/src/ownership.ts)\ninterface OwnerShipMeta {\n title: string;\n description: string;\n domain: string;\n owners: Owner[];\n tags: Tag[];\n stability: Stability;\n}\n\ntype Stability = 'experimental' | 'beta' | 'stable' | 'deprecated';\ntype Owner = string; // curated list available in code (e.g., '@sigil-team', 'team-strit')\ntype Tag = string; // curated list available in code (e.g., 'auth', 'spots')\n\n// For V2 presentations, meta is a Partial<OwnerShipMeta> plus description, name, version\ninterface PresentationV2Meta extends Partial<OwnerShipMeta> {\n name: string;\n version: number;\n description?: string;\n}\n\\`\\`\\`\n\n### Engine\n\nUse \\`createDefaultTransformEngine()\\` and register custom renderers as needed (e.g., high-fidelity BlockNote → Markdown). The default engine supports markdown/json/xml; a React renderer returns a serializable descriptor the host app renders via a \\`componentMap\\` or a BlockNote renderer. The canonical source type string is \\`blocknotejs\\` (not \\`blocknote\\`).\n\nPII paths (JSON-like) are redacted from rendered outputs.\n\n### MCP Integration\n\n\\`createMcpServer\\` accepts \\`presentationsV2\\`. Each descriptor is exposed under \\`presentation://<name>/v<version>\\` and negotiated variants (\\`.md/.json/.xml\\`) are rendered by the engine.\n\n### Migration\n\n- V1 \\`PresentationSpec\\` remains supported; a back-compat helper converts V1 → V2 when convenient.\n- Prefer V2 for new work.\n\n### Examples (Sigil)\n\n- \\`sigil.auth.webauth_tabs_v2\\`: component source (\\`componentKey: 'sigil.webauth.tabs'\\`), targets \\`react/json/xml\\`.\n- \\`sigil.signup.guide_v2\\`: BlockNote doc source, targets \\`react/markdown/json/xml\\`.\n\n### React Rendering\n\nHost apps use a \\`componentMap\\` (e.g., \\`'sigil.webauth.tabs' → WebAuthTabs\\`) and a BlockNote renderer to turn the React render descriptor into elements.`\n}];\nregisterDocBlocks(techContractsDocs);\n\n//#endregion\nexport { techContractsDocs };\n//# sourceMappingURL=tech-contracts.docs.js.map"],"mappings":";;;AAGA,MAAM,oBAAoB,CAAC;CAC1B,IAAI;CACJ,OAAO;CACP,SAAS;CACT,YAAY;CACZ,OAAO;CACP,MAAM;CACN,MAAM;EACL;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EN,CAAC;AACF,kBAAkB,kBAAkB"}
@@ -75,4 +75,5 @@ var LogContext = class LogContext$1 {
75
75
  };
76
76
 
77
77
  //#endregion
78
- export { LogContext };
78
+ export { LogContext };
79
+ //# sourceMappingURL=context.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.node.js","names":["LogContext"],"sources":["../../../../../../libs/logger/dist/context.node.mjs"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\n\n//#region src/context.node.ts\n/**\n* Node.js implementation of LogContext using AsyncLocalStorage.\n*/\nvar LogContext = class LogContext {\n\tstatic instance;\n\tstorage;\n\tconstructor() {\n\t\tthis.storage = new AsyncLocalStorage();\n\t}\n\tstatic getInstance() {\n\t\tif (!LogContext.instance) LogContext.instance = new LogContext();\n\t\treturn LogContext.instance;\n\t}\n\t/**\n\t* Run a function with a new context\n\t*/\n\trun(context, fn) {\n\t\tconst contextData = {\n\t\t\tcontext: { ...context },\n\t\t\ttrace: this.getCurrentTrace()\n\t\t};\n\t\treturn this.storage.run(contextData, fn);\n\t}\n\t/**\n\t* Run a function with an extended context (merges with current)\n\t*/\n\textend(additionalContext, fn) {\n\t\tconst mergedContext = {\n\t\t\t...this.getContext(),\n\t\t\t...additionalContext\n\t\t};\n\t\treturn this.run(mergedContext, fn);\n\t}\n\t/**\n\t* Set context data for the current execution context\n\t*/\n\tset(key, value) {\n\t\tconst current = this.storage.getStore();\n\t\tif (current) current.context[key] = value;\n\t}\n\t/**\n\t* Get a specific context value\n\t*/\n\tget(key) {\n\t\treturn this.storage.getStore()?.context?.[key];\n\t}\n\t/**\n\t* Get all context data\n\t*/\n\tgetContext() {\n\t\treturn this.storage.getStore()?.context || {};\n\t}\n\t/**\n\t* Set trace context\n\t*/\n\tsetTrace(trace) {\n\t\tconst current = this.storage.getStore();\n\t\tif (current) current.trace = trace;\n\t}\n\t/**\n\t* Get current trace context\n\t*/\n\tgetCurrentTrace() {\n\t\treturn this.storage.getStore()?.trace;\n\t}\n\t/**\n\t* Generate a unique ID for requests/operations\n\t*/\n\tgenerateId() {\n\t\treturn crypto.randomUUID();\n\t}\n};\n\n//#endregion\nexport { LogContext };\n//# sourceMappingURL=context.node.mjs.map"],"mappings":";;;;;;AAMA,IAAI,aAAa,MAAMA,aAAW;CACjC,OAAO;CACP;CACA,cAAc;AACb,OAAK,UAAU,IAAI,mBAAmB;;CAEvC,OAAO,cAAc;AACpB,MAAI,CAACA,aAAW,SAAU,cAAW,WAAW,IAAIA,cAAY;AAChE,SAAOA,aAAW;;;;;CAKnB,IAAI,SAAS,IAAI;EAChB,MAAM,cAAc;GACnB,SAAS,EAAE,GAAG,SAAS;GACvB,OAAO,KAAK,iBAAiB;GAC7B;AACD,SAAO,KAAK,QAAQ,IAAI,aAAa,GAAG;;;;;CAKzC,OAAO,mBAAmB,IAAI;EAC7B,MAAM,gBAAgB;GACrB,GAAG,KAAK,YAAY;GACpB,GAAG;GACH;AACD,SAAO,KAAK,IAAI,eAAe,GAAG;;;;;CAKnC,IAAI,KAAK,OAAO;EACf,MAAM,UAAU,KAAK,QAAQ,UAAU;AACvC,MAAI,QAAS,SAAQ,QAAQ,OAAO;;;;;CAKrC,IAAI,KAAK;AACR,SAAO,KAAK,QAAQ,UAAU,EAAE,UAAU;;;;;CAK3C,aAAa;AACZ,SAAO,KAAK,QAAQ,UAAU,EAAE,WAAW,EAAE;;;;;CAK9C,SAAS,OAAO;EACf,MAAM,UAAU,KAAK,QAAQ,UAAU;AACvC,MAAI,QAAS,SAAQ,QAAQ;;;;;CAK9B,kBAAkB;AACjB,SAAO,KAAK,QAAQ,UAAU,EAAE;;;;;CAKjC,aAAa;AACZ,SAAO,OAAO,YAAY"}
@@ -160,4 +160,5 @@ var ProductionFormatter = class {
160
160
  };
161
161
 
162
162
  //#endregion
163
- export { DevFormatter, ProductionFormatter };
163
+ export { DevFormatter, ProductionFormatter };
164
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","names":[],"sources":["../../../../../../libs/logger/dist/formatters.mjs"],"sourcesContent":["import { LogLevel } from \"./types.mjs\";\n\n//#region src/formatters.ts\nconst colors = {\n\treset: \"\\x1B[0m\",\n\tbright: \"\\x1B[1m\",\n\tdim: \"\\x1B[2m\",\n\tred: \"\\x1B[31m\",\n\tgreen: \"\\x1B[32m\",\n\tyellow: \"\\x1B[33m\",\n\tblue: \"\\x1B[34m\",\n\tmagenta: \"\\x1B[35m\",\n\tcyan: \"\\x1B[36m\",\n\twhite: \"\\x1B[37m\",\n\tgray: \"\\x1B[90m\",\n\tbgRed: \"\\x1B[41m\",\n\tbgYellow: \"\\x1B[43m\"\n};\nconst levelConfig = {\n\t[LogLevel.TRACE]: {\n\t\tcolor: colors.gray,\n\t\tsymbol: \"○\",\n\t\tname: \"TRACE\"\n\t},\n\t[LogLevel.DEBUG]: {\n\t\tcolor: colors.blue,\n\t\tsymbol: \"●\",\n\t\tname: \"DEBUG\"\n\t},\n\t[LogLevel.INFO]: {\n\t\tcolor: colors.green,\n\t\tsymbol: \"●\",\n\t\tname: \"INFO \"\n\t},\n\t[LogLevel.WARN]: {\n\t\tcolor: colors.yellow,\n\t\tsymbol: \"▲\",\n\t\tname: \"WARN \"\n\t},\n\t[LogLevel.ERROR]: {\n\t\tcolor: colors.red,\n\t\tsymbol: \"✖\",\n\t\tname: \"ERROR\"\n\t},\n\t[LogLevel.FATAL]: {\n\t\tcolor: colors.bgRed + colors.white,\n\t\tsymbol: \"💀\",\n\t\tname: \"FATAL\"\n\t}\n};\nvar DevFormatter = class {\n\tenableColors;\n\tconstructor(enableColors = true) {\n\t\tthis.enableColors = enableColors;\n\t}\n\tformat(entry) {\n\t\tconst parts = [];\n\t\tconst config = levelConfig[entry.level];\n\t\tconst timestamp = this.formatTimestamp(entry.timestamp);\n\t\tparts.push(this.colorize(timestamp, colors.gray));\n\t\tconst levelText = `${config.symbol} ${config.name}`;\n\t\tparts.push(this.colorize(levelText, config.color));\n\t\tif (entry.traceId) {\n\t\t\tconst traceInfo = this.formatTraceInfo(entry);\n\t\t\tparts.push(this.colorize(traceInfo, colors.cyan));\n\t\t}\n\t\tparts.push(this.colorize(entry.message, colors.white));\n\t\tif (entry.duration !== void 0) {\n\t\t\tconst durationText = `(${this.formatDuration(entry.duration)})`;\n\t\t\tparts.push(this.colorize(durationText, colors.magenta));\n\t\t}\n\t\tlet output = parts.join(\" \");\n\t\tif (entry.context && Object.keys(entry.context).length > 0) output += \"\\n\" + this.formatContext(entry.context);\n\t\tif (entry.metadata && Object.keys(entry.metadata).length > 0) output += \"\\n\" + this.formatMetadata(entry.metadata);\n\t\tif (entry.error) output += \"\\n\" + this.formatError(entry.error);\n\t\tif (entry.tags && entry.tags.length > 0) {\n\t\t\tconst tagsText = entry.tags.map((tag) => `#${tag}`).join(\" \");\n\t\t\toutput += \"\\n\" + this.colorize(`Tags: ${tagsText}`, colors.blue);\n\t\t}\n\t\treturn output;\n\t}\n\tformatTimestamp(timestamp) {\n\t\treturn timestamp.toISOString().substring(11, 23);\n\t}\n\tformatTraceInfo(entry) {\n\t\tconst parts = [`trace:${entry.traceId?.substring(0, 8) || \"unknown\"}`];\n\t\tif (entry.spanId && entry.spanId.length >= 8) parts.push(`span:${entry.spanId.substring(0, 8)}`);\n\t\tif (entry.parentId && entry.parentId.length >= 8) parts.push(`parent:${entry.parentId.substring(0, 8)}`);\n\t\treturn `[${parts.join(\"|\")}]`;\n\t}\n\tformatDuration(duration) {\n\t\tif (duration < 1) return `${(duration * 1e3).toFixed(0)}μs`;\n\t\telse if (duration < 1e3) return `${duration.toFixed(2)}ms`;\n\t\telse return `${(duration / 1e3).toFixed(2)}s`;\n\t}\n\tformatContext(context) {\n\t\tconst formatted = this.formatObject(context, 2);\n\t\treturn this.colorize(`Context: ${formatted}`, colors.cyan);\n\t}\n\tformatMetadata(metadata) {\n\t\tconst formatted = this.formatObject(metadata, 2);\n\t\treturn this.colorize(`Metadata: ${formatted}`, colors.blue);\n\t}\n\tformatError(error) {\n\t\tlet output = this.colorize(`Error: ${error.name}: ${error.message}`, colors.red);\n\t\tif (error.stack) {\n\t\t\tconst indentedStack = error.stack.split(\"\\n\").slice(1, 6).map((line) => ` ${line}`).join(\"\\n\");\n\t\t\toutput += \"\\n\" + this.colorize(indentedStack, colors.gray);\n\t\t}\n\t\treturn output;\n\t}\n\tformatObject(obj, indent = 0) {\n\t\tconst spaces = \" \".repeat(indent);\n\t\tconst entries = Object.entries(obj);\n\t\tif (entries.length === 0) return \"{}\";\n\t\tif (entries[0] && typeof entries[0][1] !== \"object\") return `{ ${entries[0][0]}: ${this.formatValue(entries[0][1])} }`;\n\t\treturn `{\\n${entries.map(([key, value]) => {\n\t\t\treturn `${spaces} ${key}: ${this.formatValue(value, indent + 2)}`;\n\t\t}).join(\"\\n\")}\\n${spaces}}`;\n\t}\n\tformatValue(value, indent = 0) {\n\t\tif (value === null) return \"null\";\n\t\tif (value === void 0) return \"undefined\";\n\t\tif (typeof value === \"string\") return `\"${value}\"`;\n\t\tif (typeof value === \"boolean\" || typeof value === \"number\") return String(value);\n\t\tif (value instanceof Date) return value.toISOString();\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 0) return \"[]\";\n\t\t\treturn `[${value.map((v) => this.formatValue(v)).join(\", \")}]`;\n\t\t}\n\t\tif (typeof value === \"object\") return this.formatObject(value, indent);\n\t\treturn String(value);\n\t}\n\tcolorize(text, color) {\n\t\tif (!this.enableColors) return text;\n\t\treturn `${color}${text}${colors.reset}`;\n\t}\n};\nvar ProductionFormatter = class {\n\tformat(entry) {\n\t\tconst logObject = {\n\t\t\ttimestamp: entry.timestamp,\n\t\t\tlevel: entry.level,\n\t\t\tmessage: entry.message\n\t\t};\n\t\tif (entry.traceId) logObject.traceId = entry.traceId;\n\t\tif (entry.spanId) logObject.spanId = entry.spanId;\n\t\tif (entry.parentId) logObject.parentId = entry.parentId;\n\t\tif (entry.duration !== void 0) logObject.duration = entry.duration;\n\t\tif (entry.context && Object.keys(entry.context).length > 0) logObject.context = entry.context;\n\t\tif (entry.metadata && Object.keys(entry.metadata).length > 0) logObject.metadata = entry.metadata;\n\t\tif (entry.error) logObject.error = {\n\t\t\tname: entry.error.name,\n\t\t\tmessage: entry.error.message,\n\t\t\tstack: entry.error.stack\n\t\t};\n\t\tif (entry.tags && entry.tags.length > 0) logObject.tags = entry.tags;\n\t\treturn JSON.stringify(logObject);\n\t}\n};\nvar CustomFormatter = class {\n\ttemplate;\n\tdateFormat;\n\tconstructor(template = \"{timestamp} [{level}] {message}\", dateFormat) {\n\t\tthis.template = template;\n\t\tthis.dateFormat = dateFormat || ((date) => date.toISOString());\n\t}\n\tformat(entry) {\n\t\tconst levelName = LogLevel[entry.level];\n\t\tconst timestamp = this.dateFormat(entry.timestamp);\n\t\tlet formatted = this.template.replace(\"{timestamp}\", timestamp).replace(\"{level}\", levelName).replace(\"{message}\", entry.message).replace(\"{traceId}\", entry.traceId || \"\").replace(\"{spanId}\", entry.spanId || \"\").replace(\"{duration}\", entry.duration?.toString() || \"\");\n\t\tif (entry.context) formatted = formatted.replace(\"{context}\", JSON.stringify(entry.context));\n\t\tif (entry.metadata) formatted = formatted.replace(\"{metadata}\", JSON.stringify(entry.metadata));\n\t\treturn formatted;\n\t}\n};\n\n//#endregion\nexport { CustomFormatter, DevFormatter, ProductionFormatter };\n//# sourceMappingURL=formatters.mjs.map"],"mappings":";;;AAGA,MAAM,SAAS;CACd,OAAO;CACP,QAAQ;CACR,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV;AACD,MAAM,cAAc;EAClB,SAAS,QAAQ;EACjB,OAAO,OAAO;EACd,QAAQ;EACR,MAAM;EACN;EACA,SAAS,QAAQ;EACjB,OAAO,OAAO;EACd,QAAQ;EACR,MAAM;EACN;EACA,SAAS,OAAO;EAChB,OAAO,OAAO;EACd,QAAQ;EACR,MAAM;EACN;EACA,SAAS,OAAO;EAChB,OAAO,OAAO;EACd,QAAQ;EACR,MAAM;EACN;EACA,SAAS,QAAQ;EACjB,OAAO,OAAO;EACd,QAAQ;EACR,MAAM;EACN;EACA,SAAS,QAAQ;EACjB,OAAO,OAAO,QAAQ,OAAO;EAC7B,QAAQ;EACR,MAAM;EACN;CACD;AACD,IAAI,eAAe,MAAM;CACxB;CACA,YAAY,eAAe,MAAM;AAChC,OAAK,eAAe;;CAErB,OAAO,OAAO;EACb,MAAM,QAAQ,EAAE;EAChB,MAAM,SAAS,YAAY,MAAM;EACjC,MAAM,YAAY,KAAK,gBAAgB,MAAM,UAAU;AACvD,QAAM,KAAK,KAAK,SAAS,WAAW,OAAO,KAAK,CAAC;EACjD,MAAM,YAAY,GAAG,OAAO,OAAO,GAAG,OAAO;AAC7C,QAAM,KAAK,KAAK,SAAS,WAAW,OAAO,MAAM,CAAC;AAClD,MAAI,MAAM,SAAS;GAClB,MAAM,YAAY,KAAK,gBAAgB,MAAM;AAC7C,SAAM,KAAK,KAAK,SAAS,WAAW,OAAO,KAAK,CAAC;;AAElD,QAAM,KAAK,KAAK,SAAS,MAAM,SAAS,OAAO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BAAiB,KAAM,QAAO,MAAM,aAAa;AACrD,MAAI,MAAM,QAAQ,MAAM,EAAE;AACzB,OAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,UAAO,IAAI,MAAM,KAAK,MAAM,KAAK,YAAY,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;;AAE7D,MAAI,OAAO,UAAU,SAAU,QAAO,KAAK,aAAa,OAAO,OAAO;AACtE,SAAO,OAAO,MAAM;;CAErB,SAAS,MAAM,OAAO;AACrB,MAAI,CAAC,KAAK,aAAc,QAAO;AAC/B,SAAO,GAAG,QAAQ,OAAO,OAAO;;;AAGlC,IAAI,sBAAsB,MAAM;CAC/B,OAAO,OAAO;EACb,MAAM,YAAY;GACjB,WAAW,MAAM;GACjB,OAAO,MAAM;GACb,SAAS,MAAM;GACf;AACD,MAAI,MAAM,QAAS,WAAU,UAAU,MAAM;AAC7C,MAAI,MAAM,OAAQ,WAAU,SAAS,MAAM;AAC3C,MAAI,MAAM,SAAU,WAAU,WAAW,MAAM;AAC/C,MAAI,MAAM,aAAa,KAAK,EAAG,WAAU,WAAW,MAAM;AAC1D,MAAI,MAAM,WAAW,OAAO,KAAK,MAAM,QAAQ,CAAC,SAAS,EAAG,WAAU,UAAU,MAAM;AACtF,MAAI,MAAM,YAAY,OAAO,KAAK,MAAM,SAAS,CAAC,SAAS,EAAG,WAAU,WAAW,MAAM;AACzF,MAAI,MAAM,MAAO,WAAU,QAAQ;GAClC,MAAM,MAAM,MAAM;GAClB,SAAS,MAAM,MAAM;GACrB,OAAO,MAAM,MAAM;GACnB;AACD,MAAI,MAAM,QAAQ,MAAM,KAAK,SAAS,EAAG,WAAU,OAAO,MAAM;AAChE,SAAO,KAAK,UAAU,UAAU"}
@@ -186,4 +186,5 @@ var Logger = class Logger$1 {
186
186
  };
187
187
 
188
188
  //#endregion
189
- export { Logger };
189
+ export { Logger };
190
+ //# sourceMappingURL=logger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.node.js","names":["Logger"],"sources":["../../../../../../libs/logger/dist/logger.node.mjs"],"sourcesContent":["import { LogContext } from \"./context.node.mjs\";\nimport { LogLevel } from \"./types.mjs\";\nimport { TimerManager } from \"./timer.mjs\";\nimport { Tracer } from \"./tracer.node.mjs\";\nimport { DevFormatter, ProductionFormatter } from \"./formatters.mjs\";\n\n//#region src/logger.node.ts\nvar Logger = class Logger {\n\tconfig;\n\tformatter;\n\tcontext;\n\ttracer;\n\ttimerManager;\n\tconstructor(config) {\n\t\tthis.config = {\n\t\t\tlevel: LogLevel.INFO,\n\t\t\tenvironment: process.env.NODE_ENV || \"development\",\n\t\t\tenableTracing: true,\n\t\t\tenableTiming: true,\n\t\t\tenableContext: true,\n\t\t\tenableColors: true,\n\t\t\tmaxContextDepth: 10,\n\t\t\ttimestampFormat: \"iso\",\n\t\t\t...config\n\t\t};\n\t\tthis.context = LogContext.getInstance();\n\t\tthis.tracer = new Tracer();\n\t\tthis.timerManager = new TimerManager();\n\t\tthis.formatter = this.config.environment === \"production\" ? new ProductionFormatter() : new DevFormatter(this.config.enableColors);\n\t}\n\ttraceLog(message, metadata) {\n\t\tthis.log(LogLevel.TRACE, message, metadata);\n\t}\n\tdebug(message, metadata) {\n\t\tthis.log(LogLevel.DEBUG, message, metadata);\n\t}\n\tinfo(message, metadata) {\n\t\tthis.log(LogLevel.INFO, message, metadata);\n\t}\n\twarn(message, metadata) {\n\t\tthis.log(LogLevel.WARN, message, metadata);\n\t}\n\terror(message, metadata, error) {\n\t\tthis.log(LogLevel.ERROR, message, metadata, error);\n\t}\n\tfatal(message, metadata, error) {\n\t\tthis.log(LogLevel.FATAL, message, metadata, error);\n\t}\n\twithContext(context, fn) {\n\t\treturn this.context.run(context, fn);\n\t}\n\textendContext(additionalContext, fn) {\n\t\treturn this.context.extend(additionalContext, fn);\n\t}\n\tsetContext(key, value) {\n\t\tthis.context.set(key, value);\n\t}\n\tgetContext() {\n\t\treturn this.context.getContext();\n\t}\n\ttrace = async (options, fn) => {\n\t\tif (!this.config.enableTracing) return await fn();\n\t\treturn this.tracer.trace(options, fn);\n\t};\n\tgetTraceId() {\n\t\treturn this.tracer.getCurrentTrace()?.traceId;\n\t}\n\tstartSpan(options) {\n\t\tif (!this.config.enableTracing) return null;\n\t\treturn this.tracer.startSpan(options);\n\t}\n\tfinishSpan(spanId) {\n\t\tif (!this.config.enableTracing) return;\n\t\treturn this.tracer.finishSpan(spanId);\n\t}\n\taddTraceMetadata(key, value) {\n\t\tif (this.config.enableTracing) this.tracer.addMetadata(key, value);\n\t}\n\taddTraceTags(...tags) {\n\t\tif (this.config.enableTracing) this.tracer.addTags(...tags);\n\t}\n\tstartTimer(id) {\n\t\tif (!this.config.enableTiming) return null;\n\t\treturn this.timerManager.start(id);\n\t}\n\tstopTimer(id) {\n\t\tif (!this.config.enableTiming) return;\n\t\treturn this.timerManager.stop(id);\n\t}\n\tgetTimer(id) {\n\t\treturn this.timerManager.get(id);\n\t}\n\tchild(context) {\n\t\tconst childLogger = new Logger(this.config);\n\t\tObject.entries(context).forEach(([key, value]) => {\n\t\t\tchildLogger.setContext(key, value);\n\t\t});\n\t\treturn childLogger;\n\t}\n\tsetLevel(level) {\n\t\tthis.config.level = level;\n\t}\n\tsetFormatter(formatter) {\n\t\tthis.formatter = formatter;\n\t}\n\tasync profile(operationName, fn, options) {\n\t\tconst timer = this.startTimer(`profile-${operationName}`);\n\t\tconst startTime = performance.now();\n\t\ttry {\n\t\t\tconst result = await this.tracer.trace({\n\t\t\t\toperationType: \"custom\",\n\t\t\t\toperationName: `profile:${operationName}`,\n\t\t\t\tautoTiming: true\n\t\t\t}, fn);\n\t\t\tconst duration = performance.now() - startTime;\n\t\t\ttimer?.stop();\n\t\t\tconst logLevel = options?.logLevel || LogLevel.DEBUG;\n\t\t\tthis.log(logLevel, `Profile: ${operationName} completed`, {\n\t\t\t\toperation: operationName,\n\t\t\t\tduration: `${duration.toFixed(2)}ms`,\n\t\t\t\tresult: options?.logResult ? result : \"[result hidden]\"\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tconst duration = performance.now() - startTime;\n\t\t\ttimer?.stop();\n\t\t\tthis.error(`Profile: ${operationName} failed`, {\n\t\t\t\toperation: operationName,\n\t\t\t\tduration: `${duration.toFixed(2)}ms`,\n\t\t\t\terror: error.message\n\t\t\t}, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\tlogRequest(method, url, statusCode, duration) {\n\t\tconst level = this.getHttpLogLevel(statusCode);\n\t\tconst message = `${method.toUpperCase()} ${url}${statusCode ? ` ${statusCode}` : \"\"}`;\n\t\tthis.log(level, message, {\n\t\t\tmethod,\n\t\t\turl,\n\t\t\tstatusCode,\n\t\t\tduration: duration ? `${duration.toFixed(2)}ms` : void 0,\n\t\t\ttype: \"http_request\"\n\t\t});\n\t}\n\tasync flush() {\n\t\tthis.timerManager.clear();\n\t}\n\tgetStats() {\n\t\treturn {\n\t\t\tactiveTimers: this.timerManager.getActive().length,\n\t\t\tactiveSpans: this.tracer.getActiveSpans().length,\n\t\t\tconfig: { ...this.config }\n\t\t};\n\t}\n\toutput(message, level) {\n\t\tif (level >= LogLevel.ERROR) console.error(message);\n\t\telse console.log(message);\n\t}\n\tlog(level, message, metadata, error) {\n\t\tif (level < this.config.level) return;\n\t\tconst currentTrace = this.config.enableTracing ? this.tracer.getCurrentTrace() : void 0;\n\t\tconst contextData = this.config.enableContext ? this.context.getContext() : void 0;\n\t\tconst entry = {\n\t\t\tlevel,\n\t\t\tmessage,\n\t\t\ttimestamp: /* @__PURE__ */ new Date(),\n\t\t\ttraceId: currentTrace?.traceId,\n\t\t\tparentId: currentTrace?.parentId,\n\t\t\tspanId: currentTrace?.spanId,\n\t\t\tcontext: contextData,\n\t\t\tmetadata,\n\t\t\terror,\n\t\t\ttags: currentTrace?.tags\n\t\t};\n\t\tif (currentTrace?.metadata?.duration) entry.duration = currentTrace.metadata.duration;\n\t\tconst formatted = this.formatter.format(entry);\n\t\tthis.output(formatted, level);\n\t}\n\tgetHttpLogLevel(statusCode) {\n\t\tif (!statusCode) return LogLevel.INFO;\n\t\tif (statusCode >= 500) return LogLevel.ERROR;\n\t\tif (statusCode >= 400) return LogLevel.WARN;\n\t\treturn LogLevel.INFO;\n\t}\n};\n\n//#endregion\nexport { Logger };\n//# sourceMappingURL=logger.node.mjs.map"],"mappings":";;;;;;;AAOA,IAAI,SAAS,MAAMA,SAAO;CACzB;CACA;CACA;CACA;CACA;CACA,YAAY,QAAQ;AACnB,OAAK,SAAS;GACb,OAAO,SAAS;GAChB,aAAa,QAAQ,IAAI,YAAY;GACrC,eAAe;GACf,cAAc;GACd,eAAe;GACf,cAAc;GACd,iBAAiB;GACjB,iBAAiB;GACjB,GAAG;GACH;AACD,OAAK,UAAU,WAAW,aAAa;AACvC,OAAK,SAAS,IAAI,QAAQ;AAC1B,OAAK,eAAe,IAAI,cAAc;AACtC,OAAK,YAAY,KAAK,OAAO,gBAAgB,eAAe,IAAI,qBAAqB,GAAG,IAAI,aAAa,KAAK,OAAO,aAAa;;CAEnI,SAAS,SAAS,UAAU;AAC3B,OAAK,IAAI,SAAS,OAAO,SAAS,SAAS;;CAE5C,MAAM,SAAS,UAAU;AACxB,OAAK,IAAI,SAAS,OAAO,SAAS,SAAS;;CAE5C,KAAK,SAAS,UAAU;AACvB,OAAK,IAAI,SAAS,MAAM,SAAS,SAAS;;CAE3C,KAAK,SAAS,UAAU;AACvB,OAAK,IAAI,SAAS,MAAM,SAAS,SAAS;;CAE3C,MAAM,SAAS,UAAU,OAAO;AAC/B,OAAK,IAAI,SAAS,OAAO,SAAS,UAAU,MAAM;;CAEnD,MAAM,SAAS,UAAU,OAAO;AAC/B,OAAK,IAAI,SAAS,OAAO,SAAS,UAAU,MAAM;;CAEnD,YAAY,SAAS,IAAI;AACxB,SAAO,KAAK,QAAQ,IAAI,SAAS,GAAG;;CAErC,cAAc,mBAAmB,IAAI;AACpC,SAAO,KAAK,QAAQ,OAAO,mBAAmB,GAAG;;CAElD,WAAW,K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/B,MAAM,eAAe,KAAK,OAAO,gBAAgB,KAAK,OAAO,iBAAiB,GAAG,KAAK;EACtF,MAAM,cAAc,KAAK,OAAO,gBAAgB,KAAK,QAAQ,YAAY,GAAG,KAAK;EACjF,MAAM,QAAQ;GACb;GACA;GACA,2BAA2B,IAAI,MAAM;GACrC,SAAS,cAAc;GACvB,UAAU,cAAc;GACxB,QAAQ,cAAc;GACtB,SAAS;GACT;GACA;GACA,MAAM,cAAc;GACpB;AACD,MAAI,cAAc,UAAU,SAAU,OAAM,WAAW,aAAa,SAAS;EAC7E,MAAM,YAAY,KAAK,UAAU,OAAO,MAAM;AAC9C,OAAK,OAAO,WAAW,MAAM;;CAE9B,gBAAgB,YAAY;AAC3B,MAAI,CAAC,WAAY,QAAO,SAAS;AACjC,MAAI,cAAc,IAAK,QAAO,SAAS;AACvC,MAAI,cAAc,IAAK,QAAO,SAAS;AACvC,SAAO,SAAS"}
@@ -123,4 +123,5 @@ var TimerManager = class {
123
123
  };
124
124
 
125
125
  //#endregion
126
- export { Timer, TimerManager };
126
+ export { Timer, TimerManager };
127
+ //# sourceMappingURL=timer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.js","names":[],"sources":["../../../../../../libs/logger/dist/timer.mjs"],"sourcesContent":["//#region src/timer.ts\nvar Timer = class {\n\tid;\n\tstartTime;\n\tlaps = [];\n\tstopped = false;\n\tstopTime;\n\tconstructor(id) {\n\t\tthis.id = id || crypto.randomUUID();\n\t\tthis.startTime = performance.now();\n\t}\n\t/**\n\t* Stop the timer and return elapsed time in milliseconds\n\t*/\n\tstop() {\n\t\tif (this.stopped) return this.getElapsed();\n\t\tthis.stopTime = performance.now();\n\t\tthis.stopped = true;\n\t\tconst elapsed = this.stopTime - this.startTime;\n\t\tthis.laps.push({\n\t\t\tlabel: \"stop\",\n\t\t\ttime: this.stopTime,\n\t\t\telapsed\n\t\t});\n\t\treturn elapsed;\n\t}\n\t/**\n\t* Record a lap time and return elapsed time since start\n\t*/\n\tlap(label) {\n\t\tif (this.stopped) return this.getElapsed();\n\t\tconst now = performance.now();\n\t\tconst elapsed = now - this.startTime;\n\t\tthis.laps.push({\n\t\t\tlabel: label || `lap-${this.laps.length + 1}`,\n\t\t\ttime: now,\n\t\t\telapsed\n\t\t});\n\t\treturn elapsed;\n\t}\n\t/**\n\t* Get elapsed time without stopping the timer\n\t*/\n\tgetElapsed() {\n\t\tif (this.stopped && this.stopTime) return this.stopTime - this.startTime;\n\t\treturn performance.now() - this.startTime;\n\t}\n\t/**\n\t* Get all recorded laps\n\t*/\n\tgetLaps() {\n\t\treturn [...this.laps];\n\t}\n\t/**\n\t* Get timer summary with total time and laps\n\t*/\n\tgetSummary() {\n\t\treturn {\n\t\t\tid: this.id,\n\t\t\ttotalTime: this.getElapsed(),\n\t\t\tisRunning: !this.stopped,\n\t\t\tlaps: this.getLaps()\n\t\t};\n\t}\n\t/**\n\t* Reset the timer (starts a new timing session)\n\t*/\n\treset() {\n\t\tthis.startTime = performance.now();\n\t\tthis.laps = [];\n\t\tthis.stopped = false;\n\t\tthis.stopTime = void 0;\n\t}\n};\n/**\n* Utility class for managing multiple timers\n*/\nvar TimerManager = class {\n\ttimers = /* @__PURE__ */ new Map();\n\t/**\n\t* Start a new timer\n\t*/\n\tstart(id) {\n\t\tconst timer = new Timer(id);\n\t\tthis.timers.set(timer.id, timer);\n\t\treturn timer;\n\t}\n\t/**\n\t* Get an existing timer\n\t*/\n\tget(id) {\n\t\treturn this.timers.get(id);\n\t}\n\t/**\n\t* Stop and remove a timer\n\t*/\n\tstop(id) {\n\t\tconst timer = this.timers.get(id);\n\t\tif (timer) {\n\t\t\tconst elapsed = timer.stop();\n\t\t\tthis.timers.delete(id);\n\t\t\treturn elapsed;\n\t\t}\n\t}\n\t/**\n\t* Get all active timers\n\t*/\n\tgetActive() {\n\t\treturn Array.from(this.timers.values()).filter((timer) => !timer.getSummary().isRunning === false);\n\t}\n\t/**\n\t* Clear all timers\n\t*/\n\tclear() {\n\t\tthis.timers.clear();\n\t}\n\t/**\n\t* Get summary of all timers\n\t*/\n\tgetSummary() {\n\t\treturn Array.from(this.timers.values()).map((timer) => timer.getSummary());\n\t}\n};\n/**\n* Decorator/wrapper function to time async operations\n*/\nasync function timed(operation, options) {\n\tconst timer = new Timer(options?.id);\n\ttry {\n\t\tconst result = await operation();\n\t\tconst elapsed = timer.stop();\n\t\toptions?.onComplete?.(elapsed);\n\t\treturn {\n\t\t\tresult,\n\t\t\telapsed,\n\t\t\ttimer\n\t\t};\n\t} catch (error) {\n\t\ttimer.stop();\n\t\tthrow error;\n\t}\n}\n/**\n* Decorator/wrapper function to time synchronous operations\n*/\nfunction timedSync(operation, options) {\n\tconst timer = new Timer(options?.id);\n\ttry {\n\t\tconst result = operation();\n\t\tconst elapsed = timer.stop();\n\t\toptions?.onComplete?.(elapsed);\n\t\treturn {\n\t\t\tresult,\n\t\t\telapsed,\n\t\t\ttimer\n\t\t};\n\t} catch (error) {\n\t\ttimer.stop();\n\t\tthrow error;\n\t}\n}\n\n//#endregion\nexport { Timer, TimerManager, timed, timedSync };\n//# sourceMappingURL=timer.mjs.map"],"mappings":";AACA,IAAI,QAAQ,MAAM;CACjB;CACA;CACA,OAAO,EAAE;CACT,UAAU;CACV;CACA,YAAY,IAAI;AACf,OAAK,KAAK,MAAM,OAAO,YAAY;AACnC,OAAK,YAAY,YAAY,KAAK;;;;;CAKnC,OAAO;AACN,MAAI,KAAK,QAAS,QAAO,KAAK,YAAY;AAC1C,OAAK,WAAW,YAAY,KAAK;AACjC,OAAK,UAAU;EACf,MAAM,UAAU,KAAK,WAAW,KAAK;AACrC,OAAK,KAAK,KAAK;GACd,OAAO;GACP,MAAM,KAAK;GACX;GACA,CAAC;AACF,SAAO;;;;;CAKR,IAAI,OAAO;AACV,MAAI,KAAK,QAAS,QAAO,KAAK,YAAY;EAC1C,MAAM,MAAM,YAAY,KAAK;EAC7B,MAAM,UAAU,MAAM,KAAK;AAC3B,OAAK,KAAK,KAAK;GACd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ceMappingURL=tracer.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.node.js","names":[],"sources":["../../../../../../libs/logger/dist/tracer.node.mjs"],"sourcesContent":["import { LogContext } from \"./context.node.mjs\";\nimport { Timer } from \"./timer.mjs\";\n\n//#region src/tracer.node.ts\nvar Tracer = class {\n\tcontext;\n\tactiveSpans = /* @__PURE__ */ new Map();\n\tconstructor() {\n\t\tthis.context = LogContext.getInstance();\n\t}\n\t/**\n\t* Start a new trace span\n\t*/\n\tstartSpan(options) {\n\t\tconst parentTrace = this.context.getCurrentTrace();\n\t\tconst span = {\n\t\t\ttraceId: parentTrace?.traceId || this.generateTraceId(),\n\t\t\tparentId: parentTrace?.spanId,\n\t\t\tspanId: this.generateSpanId(),\n\t\t\toperationType: options.operationType,\n\t\t\toperationName: options.operationName,\n\t\t\tstartTime: performance.now(),\n\t\t\tmetadata: { ...options.metadata },\n\t\t\ttags: [...options.tags || []]\n\t\t};\n\t\tthis.activeSpans.set(span.spanId, span);\n\t\tthis.context.setTrace(span);\n\t\treturn span;\n\t}\n\t/**\n\t* Finish a trace span\n\t*/\n\tfinishSpan(spanId) {\n\t\tconst span = this.activeSpans.get(spanId);\n\t\tif (!span) return;\n\t\tconst duration = performance.now() - span.startTime;\n\t\tthis.activeSpans.delete(spanId);\n\t\tif (this.context.getCurrentTrace()?.spanId === spanId && span.parentId) {\n\t\t\tconst parentSpan = this.findSpanById(span.parentId);\n\t\t\tif (parentSpan) this.context.setTrace(parentSpan);\n\t\t}\n\t\treturn duration;\n\t}\n\t/**\n\t* Execute a function within a trace span\n\t*/\n\tasync trace(options, fn) {\n\t\tconst span = this.startSpan(options);\n\t\tconst timer = options.autoTiming !== false ? new Timer(`trace-${span.spanId}`) : void 0;\n\t\ttry {\n\t\t\tconst result = await fn();\n\t\t\tconst duration = this.finishSpan(span.spanId);\n\t\t\tif (timer) timer.stop();\n\t\t\tif (duration !== void 0) span.metadata.duration = duration;\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tspan.metadata.error = {\n\t\t\t\tname: error.name || \"Unknown\",\n\t\t\t\tmessage: error.message || \"Unknown error\",\n\t\t\t\tstack: error.stack\n\t\t\t};\n\t\t\tconst duration = this.finishSpan(span.spanId);\n\t\t\tspan.metadata.duration = duration;\n\t\t\tif (timer) timer.stop();\n\t\t\tthrow error;\n\t\t}\n\t}\n\t/**\n\t* Add metadata to current span\n\t*/\n\taddMetadata(key, value) {\n\t\tconst currentTrace = this.context.getCurrentTrace();\n\t\tif (currentTrace) currentTrace.metadata[key] = value;\n\t}\n\t/**\n\t* Add tags to current span\n\t*/\n\taddTags(...tags) {\n\t\tconst currentTrace = this.context.getCurrentTrace();\n\t\tif (currentTrace) currentTrace.tags.push(...tags);\n\t}\n\t/**\n\t* Get current trace context\n\t*/\n\tgetCurrentTrace() {\n\t\treturn this.context.getCurrentTrace();\n\t}\n\t/**\n\t* Get all active spans\n\t*/\n\tgetActiveSpans() {\n\t\treturn Array.from(this.activeSpans.values());\n\t}\n\t/**\n\t* Find a span by ID\n\t*/\n\tfindSpanById(spanId) {\n\t\treturn this.activeSpans.get(spanId);\n\t}\n\t/**\n\t* Generate a unique trace ID\n\t*/\n\tgenerateTraceId() {\n\t\treturn crypto.randomUUID().replace(/-/g, \"\");\n\t}\n\t/**\n\t* Generate a unique span ID\n\t*/\n\tgenerateSpanId() {\n\t\treturn crypto.randomUUID().replace(/-/g, \"\").substring(0, 16);\n\t}\n};\n\n//#endregion\nexport { Tracer };\n//# sourceMappingURL=tracer.node.mjs.map"],"mappings":";;;;AAIA,IAAI,SAAS,MAAM;CAClB;CACA,8BAA8B,IAAI,KAAK;CACvC,cAAc;AACb,OAAK,UAAU,WAAW,aAAa;;;;;CAKxC,UAAU,SAAS;EAClB,MAAM,cAAc,KAAK,QAAQ,iBAAiB;EAClD,MAAM,OAAO;GACZ,SAAS,aAAa,WAAW,KAAK,iBAAiB;GACvD,UAAU,aAAa;GACvB,QAAQ,KAAK,gBAAgB;GAC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QAAQ,GAAG,MAAM;EAChB,MAAM,eAAe,KAAK,QAAQ,iBAAiB;AACnD,MAAI,aAAc,cAAa,KAAK,KAAK,GAAG,KAAK;;;;;CAKlD,kBAAkB;AACjB,SAAO,KAAK,QAAQ,iBAAiB;;;;;CAKtC,iBAAiB;AAChB,SAAO,MAAM,KAAK,KAAK,YAAY,QAAQ,CAAC;;;;;CAK7C,aAAa,QAAQ;AACpB,SAAO,KAAK,YAAY,IAAI,OAAO;;;;;CAKpC,kBAAkB;AACjB,SAAO,OAAO,YAAY,CAAC,QAAQ,MAAM,GAAG;;;;;CAK7C,iBAAiB;AAChB,SAAO,OAAO,YAAY,CAAC,QAAQ,MAAM,GAAG,CAAC,UAAU,GAAG,GAAG"}
@@ -10,4 +10,5 @@ let LogLevel = /* @__PURE__ */ function(LogLevel$1) {
10
10
  }({});
11
11
 
12
12
  //#endregion
13
- export { LogLevel };
13
+ export { LogLevel };
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../../libs/logger/dist/types.mjs"],"sourcesContent":["//#region src/types.ts\nlet LogLevel = /* @__PURE__ */ function(LogLevel$1) {\n\tLogLevel$1[LogLevel$1[\"TRACE\"] = 0] = \"TRACE\";\n\tLogLevel$1[LogLevel$1[\"DEBUG\"] = 1] = \"DEBUG\";\n\tLogLevel$1[LogLevel$1[\"INFO\"] = 2] = \"INFO\";\n\tLogLevel$1[LogLevel$1[\"WARN\"] = 3] = \"WARN\";\n\tLogLevel$1[LogLevel$1[\"ERROR\"] = 4] = \"ERROR\";\n\tLogLevel$1[LogLevel$1[\"FATAL\"] = 5] = \"FATAL\";\n\treturn LogLevel$1;\n}({});\n\n//#endregion\nexport { LogLevel };\n//# sourceMappingURL=types.mjs.map"],"mappings":";AACA,IAAI,WAA2B,yBAAS,YAAY;AACnD,YAAW,WAAW,WAAW,KAAK;AACtC,YAAW,WAAW,WAAW,KAAK;AACtC,YAAW,WAAW,UAAU,KAAK;AACrC,YAAW,WAAW,UAAU,KAAK;AACrC,YAAW,WAAW,WAAW,KAAK;AACtC,YAAW,WAAW,WAAW,KAAK;AACtC,QAAO;EACN,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/example.content-generation",
3
- "version": "0.0.0-canary-20251217080011",
3
+ "version": "0.0.0-canary-20251219202229",
4
4
  "description": "Content generation example using @lssm/lib.content-gen.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,15 +27,15 @@
27
27
  "test": "bun test"
28
28
  },
29
29
  "dependencies": {
30
- "@lssm/lib.schema": "0.0.0-canary-20251217080011",
31
- "@lssm/lib.contracts": "0.0.0-canary-20251217080011",
32
- "@lssm/lib.content-gen": "0.0.0-canary-20251217080011",
33
- "@lssm/lib.logger": "0.0.0-canary-20251217080011"
30
+ "@lssm/lib.schema": "0.0.0-canary-20251219202229",
31
+ "@lssm/lib.contracts": "0.0.0-canary-20251219202229",
32
+ "@lssm/lib.content-gen": "0.0.0-canary-20251219202229",
33
+ "@lssm/lib.logger": "0.0.0-canary-20251219202229"
34
34
  },
35
35
  "devDependencies": {
36
- "@lssm/tool.tsdown": "0.0.0-canary-20251217080011",
37
- "@lssm/tool.typescript": "0.0.0-canary-20251217080011",
38
- "tsdown": "^0.17.4",
36
+ "@lssm/tool.tsdown": "0.0.0-canary-20251219202229",
37
+ "@lssm/tool.typescript": "0.0.0-canary-20251219202229",
38
+ "tsdown": "^0.18.1",
39
39
  "typescript": "^5.9.3"
40
40
  },
41
41
  "publishConfig": {
@@ -49,5 +49,6 @@
49
49
  "./*": "./*"
50
50
  }
51
51
  },
52
- "module": "./dist/index.js"
52
+ "module": "./dist/index.js",
53
+ "license": "MIT"
53
54
  }