@solidxai/core 0.1.20-beta.1 → 0.1.20-beta.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.
Files changed (128) hide show
  1. package/.agents/skills/agenthub-agent-configuration/SKILL.md +41 -0
  2. package/.agents/skills/agenthub-agent-configuration/references/data-model.md +34 -0
  3. package/.agents/skills/agenthub-agent-configuration/references/runtime.md +28 -0
  4. package/CHANGELOG.md +27 -0
  5. package/dist/controllers/chatter-message-archive.controller.d.ts +22 -0
  6. package/dist/controllers/chatter-message-archive.controller.d.ts.map +1 -0
  7. package/dist/controllers/chatter-message-archive.controller.js +69 -0
  8. package/dist/controllers/chatter-message-archive.controller.js.map +1 -0
  9. package/dist/controllers/module-package.controller.d.ts +493 -1
  10. package/dist/controllers/module-package.controller.d.ts.map +1 -1
  11. package/dist/controllers/module-package.controller.js +47 -3
  12. package/dist/controllers/module-package.controller.js.map +1 -1
  13. package/dist/decorators/chatter-message-archive-provider.decorator.d.ts +3 -0
  14. package/dist/decorators/chatter-message-archive-provider.decorator.d.ts.map +1 -0
  15. package/dist/decorators/chatter-message-archive-provider.decorator.js +8 -0
  16. package/dist/decorators/chatter-message-archive-provider.decorator.js.map +1 -0
  17. package/dist/dtos/confirm-module-package-import.dto.d.ts +2 -0
  18. package/dist/dtos/confirm-module-package-import.dto.d.ts.map +1 -1
  19. package/dist/dtos/confirm-module-package-import.dto.js +20 -1
  20. package/dist/dtos/confirm-module-package-import.dto.js.map +1 -1
  21. package/dist/dtos/create-module-metadata.dto.d.ts +1 -0
  22. package/dist/dtos/create-module-metadata.dto.d.ts.map +1 -1
  23. package/dist/dtos/create-module-metadata.dto.js +7 -1
  24. package/dist/dtos/create-module-metadata.dto.js.map +1 -1
  25. package/dist/dtos/export-module-package.dto.d.ts +7 -0
  26. package/dist/dtos/export-module-package.dto.d.ts.map +1 -0
  27. package/dist/dtos/export-module-package.dto.js +44 -0
  28. package/dist/dtos/export-module-package.dto.js.map +1 -0
  29. package/dist/dtos/run-module-package-seed.dto.d.ts +1 -0
  30. package/dist/dtos/run-module-package-seed.dto.d.ts.map +1 -1
  31. package/dist/dtos/run-module-package-seed.dto.js +11 -1
  32. package/dist/dtos/run-module-package-seed.dto.js.map +1 -1
  33. package/dist/dtos/validate-module-package-import.dto.d.ts +4 -0
  34. package/dist/dtos/validate-module-package-import.dto.d.ts.map +1 -0
  35. package/dist/dtos/validate-module-package-import.dto.js +30 -0
  36. package/dist/dtos/validate-module-package-import.dto.js.map +1 -0
  37. package/dist/entities/agent-registry.entity.js.map +1 -1
  38. package/dist/entities/module-metadata.entity.d.ts +1 -0
  39. package/dist/entities/module-metadata.entity.d.ts.map +1 -1
  40. package/dist/entities/module-metadata.entity.js +5 -1
  41. package/dist/entities/module-metadata.entity.js.map +1 -1
  42. package/dist/helpers/agent-required-inputs.d.ts.map +1 -1
  43. package/dist/helpers/agent-required-inputs.js +25 -1
  44. package/dist/helpers/agent-required-inputs.js.map +1 -1
  45. package/dist/helpers/bootstrap.helper.d.ts +1 -1
  46. package/dist/helpers/bootstrap.helper.d.ts.map +1 -1
  47. package/dist/helpers/bootstrap.helper.js +9 -3
  48. package/dist/helpers/bootstrap.helper.js.map +1 -1
  49. package/dist/helpers/solid-registry.d.ts +4 -0
  50. package/dist/helpers/solid-registry.d.ts.map +1 -1
  51. package/dist/helpers/solid-registry.js +11 -0
  52. package/dist/helpers/solid-registry.js.map +1 -1
  53. package/dist/index.d.ts +3 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +3 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/interfaces/chatter-message-archive.interface.d.ts +22 -0
  58. package/dist/interfaces/chatter-message-archive.interface.d.ts.map +1 -0
  59. package/dist/interfaces/chatter-message-archive.interface.js +3 -0
  60. package/dist/interfaces/chatter-message-archive.interface.js.map +1 -0
  61. package/dist/seeders/module-metadata-seeder.service.js +1 -1
  62. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  63. package/dist/seeders/seed-data/solid-core-metadata.json +110 -18
  64. package/dist/services/agent-tool-registry.service.d.ts.map +1 -1
  65. package/dist/services/agent-tool-registry.service.js +10 -6
  66. package/dist/services/agent-tool-registry.service.js.map +1 -1
  67. package/dist/services/chatter-message-archive.service.d.ts +17 -0
  68. package/dist/services/chatter-message-archive.service.d.ts.map +1 -0
  69. package/dist/services/chatter-message-archive.service.js +82 -0
  70. package/dist/services/chatter-message-archive.service.js.map +1 -0
  71. package/dist/services/model-metadata.service.js +1 -1
  72. package/dist/services/model-metadata.service.js.map +1 -1
  73. package/dist/services/module-package.service.d.ts +162 -3
  74. package/dist/services/module-package.service.d.ts.map +1 -1
  75. package/dist/services/module-package.service.js +465 -18
  76. package/dist/services/module-package.service.js.map +1 -1
  77. package/dist/services/settings/default-settings-provider.service.d.ts +20 -0
  78. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  79. package/dist/services/settings/default-settings-provider.service.js +11 -0
  80. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  81. package/dist/services/solid-introspect.service.d.ts.map +1 -1
  82. package/dist/services/solid-introspect.service.js +5 -0
  83. package/dist/services/solid-introspect.service.js.map +1 -1
  84. package/dist/solid-core.module.d.ts.map +1 -1
  85. package/dist/solid-core.module.js +4 -0
  86. package/dist/solid-core.module.js.map +1 -1
  87. package/dist/testing/adapters/ui/playwright-adapter.d.ts +4 -0
  88. package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
  89. package/dist/testing/adapters/ui/playwright-adapter.js +35 -0
  90. package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
  91. package/dist/testing/core/interpolation.d.ts.map +1 -1
  92. package/dist/testing/core/interpolation.js +38 -2
  93. package/dist/testing/core/interpolation.js.map +1 -1
  94. package/dist/testing/steps/ui/actions.step.d.ts.map +1 -1
  95. package/dist/testing/steps/ui/actions.step.js +40 -3
  96. package/dist/testing/steps/ui/actions.step.js.map +1 -1
  97. package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -1
  98. package/dist/testing/steps/ui/navigation.step.js +39 -0
  99. package/dist/testing/steps/ui/navigation.step.js.map +1 -1
  100. package/package.json +4 -2
  101. package/src/controllers/chatter-message-archive.controller.ts +32 -0
  102. package/src/controllers/module-package.controller.ts +33 -1
  103. package/src/decorators/chatter-message-archive-provider.decorator.ts +4 -0
  104. package/src/dtos/confirm-module-package-import.dto.ts +17 -1
  105. package/src/dtos/create-module-metadata.dto.ts +5 -0
  106. package/src/dtos/export-module-package.dto.ts +23 -0
  107. package/src/dtos/run-module-package-seed.dto.ts +8 -0
  108. package/src/dtos/validate-module-package-import.dto.ts +11 -0
  109. package/src/entities/agent-registry.entity.ts +1 -1
  110. package/src/entities/module-metadata.entity.ts +3 -0
  111. package/src/helpers/agent-required-inputs.ts +18 -1
  112. package/src/helpers/bootstrap.helper.ts +15 -6
  113. package/src/helpers/solid-registry.ts +14 -0
  114. package/src/index.ts +3 -0
  115. package/src/interfaces/chatter-message-archive.interface.ts +22 -0
  116. package/src/seeders/module-metadata-seeder.service.ts +2 -2
  117. package/src/seeders/seed-data/solid-core-metadata.json +110 -18
  118. package/src/services/agent-tool-registry.service.ts +10 -6
  119. package/src/services/chatter-message-archive.service.ts +72 -0
  120. package/src/services/model-metadata.service.ts +1 -1
  121. package/src/services/module-package.service.ts +597 -14
  122. package/src/services/settings/default-settings-provider.service.ts +11 -0
  123. package/src/services/solid-introspect.service.ts +6 -0
  124. package/src/solid-core.module.ts +4 -0
  125. package/src/testing/adapters/ui/playwright-adapter.ts +44 -0
  126. package/src/testing/core/interpolation.ts +42 -2
  127. package/src/testing/steps/ui/actions.step.ts +52 -4
  128. package/src/testing/steps/ui/navigation.step.ts +56 -0
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: agenthub-agent-configuration
3
+ description: Design, configure, and review bespoke domain agents in SolidX AgentHub using AgentRegistry, linked skill/tool catalogs, roles, secrets, and runtime validation. Use for AgentHub agent setup in solid-core-module, solid-core-ui, and consuming projects; not for standalone Codex skills or the separate SolidX agent runtime.
4
+ ---
5
+
6
+ # Configure a SolidX AgentHub agent
7
+
8
+ Treat an AgentHub agent as a **configured, runnable `AgentRegistry` row** whose behavior comes from its system prompt, linked skills, linked tools, model selections, access roles, required inputs, and limits. The registry and link tables are the source of truth. A Markdown skill in this repository is guidance for the builder; an `AgentSkillRegistry.body` is guidance loaded by a *running AgentHub agent*. Do not confuse them.
9
+
10
+ Before editing a real agent, read [references/data-model.md](references/data-model.md). For execution, activation, and verification, read [references/runtime.md](references/runtime.md). The references name the implementation files to recheck when code has changed.
11
+
12
+ ## Work with the human
13
+
14
+ Translate the domain request into a small configuration brief:
15
+
16
+ - **Job and boundary:** who will invoke it, what outcome it owns, what it must escalate, and what evidence it must cite or return.
17
+ - **Inputs:** initial facts the caller must supply, with names, descriptions, and data types. Keep optional conversational context out of `requiredInputs`.
18
+ - **Knowledge and actions:** reusable instructions belong in skills; executable capabilities belong in tools. Identify the exact data source or API behind any requested capability. A tag only aids discovery; it does not grant a capability.
19
+ - **Authority:** select caller roles, per-tool approval gates, and only the secrets actually needed. A system prompt is behavioral guidance, not an access control boundary.
20
+ - **Operation:** choose enabled reasoning and fast models, initial step/cost budgets, and a few representative success and failure scenarios.
21
+
22
+ Ask only for genuinely missing domain decisions. When live workspace access is available, inspect existing agents, catalog entries, roles, settings, and secrets before proposing duplicates or identifiers. Do not invent IDs, provider keys, secret names, working integrations, or runtime results.
23
+
24
+ ## Configuration sequence
25
+
26
+ 1. Reuse suitable catalog skills and tools; create `custom` or `thirdparty` catalog rows only when necessary. Keep a skill focused on a repeatable method and a tool focused on one callable operation. A tool needs Python source conforming to the AgentHub SDK; a URL, model instruction, or tag alone is not executable.
27
+ 2. Draft `AgentRegistry`: stable unique `name`, human `title` and `description`, specific `systemPrompt`, JSON `requiredInputs`, configured `reasoningModelKey` and `fastModelKey`, positive `stepLimit` and `turnStepLimit`, nonnegative `costLimit`, and initially `draft` status. Use the current UI/API contract for field names and payload shape.
28
+ 3. Create separate `AgentSkill`, `AgentTool`, `AgentRole`, and `AgentSecret` links. Set `alwaysInclude`, `requiresApproval`, and `envVarName` on the links. A catalog row without a link is unavailable to that agent. Avoid broad roles, unnecessary secrets, and action tools with approval off unless the domain case justifies them.
29
+ 4. For custom or third-party tools, save the source, run configuration and initialization checks, then activate. Resolve required secrets and load errors. The source checksum and status matter; linking an inactive tool is insufficient.
30
+ 5. Save and inspect all links, then activate the agent. The editor saves the registry and links in separate calls, so a partial save can leave missing associations. Test through the embedded AgentHub chat as an allowed user, with realistic `requiredInputs`; exercise success, missing/invalid input, denied access, tool failure, and approval paths relevant to the agent. Inspect process load reports, sessions, and events when a run disagrees with the design. Report observed behavior separately from configuration intent.
31
+ 6. After changing the agent or a linked catalog item, check `configVersion` and process freshness. Restart or allow a new process where needed, then retest the updated configuration. Do not infer that an already running session adopted new instructions.
32
+
33
+ ## Prompt and resource design
34
+
35
+ Write the `systemPrompt` as a concise contract: role, supported tasks, decision rules, evidence standard, tool-use criteria, escalation conditions, and completion criteria. Put long reusable domain procedures in linked skills. `alwaysInclude=true` injects the full skill body into the initial prompt; `false` leaves it indexed for on-demand loading through a linked `load_skill` tool. If on-demand skills are desired, ensure `load_skill` is linked and test retrieval. Do not duplicate the runtime's mandatory widget/JSON response instructions in the persona prompt.
36
+
37
+ Describe each tool in operational terms: what it reads or changes, arguments, expected result, required credentials, and whether a human must approve calls. For tools that mutate external state, explicitly define when the agent should ask for approval or stop. Link `AgentSecret` to an existing SolidX `Secret` with a valid, unique environment variable name; never place credential values in a prompt, skill body, or tool source.
38
+
39
+ ## Handoff
40
+
41
+ Leave the human with a configuration map: registry fields; linked skills/tools and their link settings; roles; secret *names* and environment bindings; model keys; status; and tests performed. Mark any unverified runtime dependency or missing integration explicitly. If asked only to design, provide this map without creating or activating live records.
@@ -0,0 +1,34 @@
1
+ # AgentHub configuration data model
2
+
3
+ Use this when creating or reviewing records. Recheck `solid-core-module/src/entities/agent-*.entity.ts`, create/update DTOs, and `src/seeders/seed-data/solid-core-metadata.json` before relying on a field in a changed checkout.
4
+
5
+ ## Definition and associations
6
+
7
+ | Model / table | Configuration meaning | Important fields |
8
+ | --- | --- | --- |
9
+ | `AgentRegistry` / `ss_agent_registry` | One runnable agent definition | unique `name`, `title`, `description`, `iconName`, `systemPrompt`, `requiredInputs`, `reasoningModelKey`, `fastModelKey`, `status`, `stepLimit`, `turnStepLimit`, `costLimit`, `configVersion` |
10
+ | `AgentSkillRegistry` / `ss_agent_skill_registry` | Shared Markdown skill catalog | unique `name`, `type`, `description`, `body`, tags |
11
+ | `AgentToolRegistry` / `ss_agent_tool_registry` | Shared Python tool catalog | unique `name`, `type`, `description`, `sourceCode`, `checksum`, `status`, `lastLoadError`, tags |
12
+ | `AgentSkill` / `ss_agent_skill` | Agent-to-skill link | required agent and catalog relations; `alwaysInclude` (default true) |
13
+ | `AgentTool` / `ss_agent_tool` | Agent-to-tool link | required agent and catalog relations; `requiresApproval` (default false) |
14
+ | `AgentRole` / `ss_agent_role` | Agent-to-`RoleMetadata` link | allowed caller role |
15
+ | `AgentSecret` / `ss_agent_secret` | Agent-to-`Secret` link | `envVarName` in worker environment |
16
+ | `AgentHubTag` / `ss_agent_hub_tag` | Discovery label on agents, skill catalog, tool catalog | unique `name` |
17
+
18
+ `AgentProcess`, `AgentSession`, `AgentJob`, `AgentEvent`, `AgentSessionCheckpoint`, and `AgentHumanRequest` are runtime/observability records. They are not resources to precreate as part of an agent definition. `AgentRegistry` exposes one-to-many relations to several of them because the generic CRUD metadata represents all entity relations; do not fill runtime collections when creating an agent. The current implementation has no separate AgentHub knowledge-base, policy, or output-schema entity. Those ideas appear in older vision notes, but should not be promised as live configuration fields.
19
+
20
+ ## Exact contracts that affect decisions
21
+
22
+ - `status` is a string at the entity/DTO layer. The editor presents `draft`, `active`, `disabled`; the DB runtime loads only `active` agents. Start in `draft`, validate, then activate.
23
+ - `requiredInputs` is stored as a JSON **string**. Core normalizes an array of `{name, description, dataType}` (and accepts historical name-keyed objects and `variableName`/`type` aliases). Types are `string`, `number`, `integer`, `boolean`, `date`, `datetime`, `object`, `array`; names must be nonempty, case-insensitively unique, and cannot be `__proto__`, `constructor`, or `prototype`. See `src/helpers/agent-required-inputs.ts` and runtime `src/agenthub/inputs.py`.
24
+ - Both model keys use `<provider-id>:<provider-model-id>`, resolved from the SolidX AI setting `solidXGenAiCodeBuilderConfig` by the runtime. The editor lists enabled provider/model pairs. A syntactically plausible key without configured credentials can leave the runtime model unavailable.
25
+ - `configVersion` is set to 1 on registry create and bumped on registry edits and linked skill/tool/role/secret edits. Changes to a shared skill/tool catalog bump linked agents. Treat version as a process freshness signal, not a user-controlled version field. See `src/services/agent-config-version.service.ts`.
26
+ - `type='solidx'` skill/tool catalog rows are runtime-seeded and Core blocks their update/delete. Use a new `custom` or `thirdparty` entry for domain-specific resources; do not overwrite a built-in.
27
+ - Catalog `name` is globally unique. Link rows also have computed unique keys for each agent/resource pair in seeded metadata; avoid duplicate links.
28
+ - Delete behavior: definition links cascade with deleted agent/catalog records; process/session/job references to an agent may be set null. Deleting a definition is not a safe way to clear runtime history.
29
+
30
+ ## Where configuration is edited
31
+
32
+ The Solid UI custom editors are `solid-core-ui/src/routes/pages/admin/core/AgentRegistryEditorPage.tsx`, `AgentSkillRegistryEditorPage.tsx`, and `AgentToolRegistryEditorPage.tsx`. The agent editor has Basics, Persona, Skills, Tools, Policies, Secrets, Processes, Sessions, and test/embedding affordances. It saves the agent scalar record first and then synchronizes link rows through the entity APIs. Check the saved result for partial link failures. Core controllers expose corresponding CRUD routes under `agent-registry`, `agent-skill-registry`, `agent-tool-registry`, `agent-skill`, `agent-tool`, `agent-role`, and `agent-secret`; tool checks use `agent-tool-registry/:id/check`.
33
+
34
+ The consuming `agent-hub-core` project currently wires the shared Core API/UI packages. Most behavior lives in `solid-core-module`, `solid-core-ui`, and the separate `agent-hub-runtime` repository. Read deployed package versions before assuming local source changes are present in the running app.
@@ -0,0 +1,28 @@
1
+ # AgentHub runtime and verification
2
+
3
+ Use this when choosing links, activating tools, diagnosing access, or testing a configured agent. Implementation: `agent-hub-runtime/src/agenthub/` plus Core's `src/services/agent-tool-registry.service.ts` and `src/services/agent-hub-process-manager.service.ts`.
4
+
5
+ ## What the runtime actually loads
6
+
7
+ `config/source_db.py` reads an active, nondeleted `AgentRegistry` row and builds `AgentSpec`. It reads linked skills, linked roles, and linked tools whose catalog status is `active` or `load_failed`. A `load_failed` tool is retried when a new process loads; an `inactive` tool is omitted. Secret links are read separately by the manager when it spawns a worker. The manager resolves secret values and injects them under each link's `envVarName`; it rejects invalid or reserved names. Do not confuse a tool's declared `required_secrets` with an agent's `AgentSecret` link: custom tool lifecycle checks verify active SolidX secrets, while process links determine which values the worker receives.
8
+
9
+ The manager admits callers by intersection of their SolidX role IDs and the agent's `AgentRole` IDs (`identity.authorized`). An agent with no role links does not grant ordinary users access. AgentHub administrator checks are separate. A tool's `requiresApproval` causes a pending human approval request before execution. The agent's system prompt cannot override either control.
10
+
11
+ `skills/__init__.py` places every linked skill name and description in the prompt; bodies with `alwaysInclude=true` are also inserted. `load_skill` can fetch another linked body on demand **only if the `load_skill` tool is linked and loaded**. Tags are exposed in the skill index but are not a retrieval or authorization mechanism.
12
+
13
+ The runtime appends its own prompt for widget choice and JSON reply envelope. It enforces `stepLimit`, `turnStepLimit`, and `costLimit` in the loop. The fast model supports auxiliary tasks; both selected models should resolve. Required inputs are validated by type at session start. Interactive tests pass them through the embedded chat; jobs accept them in the job payload.
14
+
15
+ ## Tool lifecycle
16
+
17
+ `AgentToolRegistry.sourceCode` must contain one matching `@tool(name=...)` declaration with a Pydantic argument model and `(args, ctx) -> ToolResponse` behavior. The source is checksum verified. Custom and third-party source passes the import guard; SolidX built-ins are bundled and seeded by the manager. Custom/third-party activation also requires exactly one `@tool_config` and one `@tool_init` hook: the first declares required secret names, the second performs a bounded, non-destructive functional check. The UI saves these tools inactive, runs `config` and `init` checks against the saved checksum, then activates only after both pass. Source/name/type changes reset them to inactive. A linked tool can still fail at process load; inspect `lastLoadError` and the process `loadReport`.
18
+
19
+ Current built-ins are listed in `agent-hub-runtime/src/agenthub/builtin_catalog.json`; examples include `load_skill`, `request_human_input`, `web_search`, `filesystem`, `bash`, and read-only PostgreSQL/MSSQL tools. Their availability still requires a link to the agent and any environment dependencies. Do not infer database write ability from a read-only query tool.
20
+
21
+ ## Practical verification
22
+
23
+ 1. Read back the agent and its links; confirm statuses, model keys, required-input JSON, role IDs, secret environment names, and tool catalog state.
24
+ 2. Activate the agent and use **Test Agent** in the Solid UI (embedded `agentHub` chat) as a user in an allowed role. Provide typed required inputs. Run a representative happy path and one important failure/approval path.
25
+ 3. Inspect process readiness and `loadReport`; inspect session/event and human-request records when needed. A saved configuration or a successful tool check alone does not prove a working run.
26
+ 4. After edits, compare process and agent `configVersion`. The manager uses a ready process with matching version or spawns a fresh one for new sessions; existing sessions may remain on their current process. The UI also offers process restart. Retest with a fresh session when validating changed instructions or tools.
27
+
28
+ For API jobs, `AgentJob` and `AgentSession` hold execution state; `AgentEvent` is the detailed trace and `AgentHumanRequest` holds pending input/approval. Treat these as diagnostics and audit data, not definition fields.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.20-beta.3] - 2026-10-13
4
+
5
+ ### Added
6
+
7
+ - add Chatter Message Archive functionality with controller, service, and metadata updates
8
+ - disable Swagger in production environments (#168)
9
+
10
+ ### Changed
11
+
12
+ - enhance requiredInputs structure and validation in AgentHub integration
13
+
14
+ ### Other
15
+
16
+ - Update solidx modules (#190)
17
+ - New tab op changes
18
+ - menuItemMetaData edit:true and default icon added for menu (#184)
19
+
20
+ ## [0.1.20-beta.2] - 2026-10-09
21
+
22
+ ### Added
23
+
24
+ - add documentation for AgentHub agent configuration, data model, and runtime verification
25
+
26
+ ### Fixed
27
+
28
+ - update defaultValue type from integer to string for consistency (#187)
29
+
3
30
  ## [0.1.20-beta.1] - 2026-10-08
4
31
 
5
32
  ### Added
@@ -0,0 +1,22 @@
1
+ import { ActiveUserData } from '../interfaces/active-user-data.interface';
2
+ import { ChatterMessageArchiveService } from '../services/chatter-message-archive.service';
3
+ export declare class ChatterMessageArchiveController {
4
+ private readonly service;
5
+ constructor(service: ChatterMessageArchiveService);
6
+ private ensureAdmin;
7
+ getMany(query: any, activeUser: ActiveUserData): Promise<{
8
+ records: import("..").ChatterMessage[];
9
+ meta?: {
10
+ totalRecords?: number;
11
+ currentPage?: number;
12
+ totalPages?: number;
13
+ perPage?: number;
14
+ };
15
+ available: boolean;
16
+ }>;
17
+ getOne(id: string, activeUser: ActiveUserData): Promise<{
18
+ available: boolean;
19
+ record: import("..").ChatterMessage;
20
+ }>;
21
+ }
22
+ //# sourceMappingURL=chatter-message-archive.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatter-message-archive.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/chatter-message-archive.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,qBAGa,+BAA+B;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,4BAA4B;IAElE,OAAO,CAAC,WAAW;IAKb,OAAO,CAAU,KAAK,EAAE,GAAG,EAAgB,UAAU,EAAE,cAAc;;;wBAX7E,CAAA;uBAAqB,CAAC;sBACH,CAAC;mBACL,CAAC;;;;IAiBR,MAAM,CAAc,EAAE,EAAE,MAAM,EAAgB,UAAU,EAAE,cAAc;;;;CAM/E"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ChatterMessageArchiveController = void 0;
16
+ const openapi = require("@nestjs/swagger");
17
+ const common_1 = require("@nestjs/common");
18
+ const swagger_1 = require("@nestjs/swagger");
19
+ const active_user_decorator_1 = require("../decorators/active-user.decorator");
20
+ const chatter_message_archive_service_1 = require("../services/chatter-message-archive.service");
21
+ let ChatterMessageArchiveController = class ChatterMessageArchiveController {
22
+ constructor(service) {
23
+ this.service = service;
24
+ }
25
+ ensureAdmin(activeUser) {
26
+ if (!activeUser?.roles?.includes('Admin'))
27
+ throw new common_1.ForbiddenException();
28
+ }
29
+ async getMany(query, activeUser) {
30
+ this.ensureAdmin(activeUser);
31
+ const result = await this.service.getArchivedMessages(query);
32
+ if (result === null)
33
+ return { available: false, records: [], meta: { totalRecords: 0 } };
34
+ return { available: true, ...result };
35
+ }
36
+ async getOne(id, activeUser) {
37
+ this.ensureAdmin(activeUser);
38
+ const result = await this.service.getArchivedMessage(Number(id));
39
+ if (result === null)
40
+ throw new common_1.NotFoundException('Archived chatter message not found');
41
+ return { available: true, record: result };
42
+ }
43
+ };
44
+ exports.ChatterMessageArchiveController = ChatterMessageArchiveController;
45
+ __decorate([
46
+ (0, common_1.Get)(),
47
+ openapi.ApiResponse({ status: 200 }),
48
+ __param(0, (0, common_1.Query)()),
49
+ __param(1, (0, active_user_decorator_1.ActiveUser)()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [Object, Object]),
52
+ __metadata("design:returntype", Promise)
53
+ ], ChatterMessageArchiveController.prototype, "getMany", null);
54
+ __decorate([
55
+ (0, common_1.Get)(':id'),
56
+ openapi.ApiResponse({ status: 200 }),
57
+ __param(0, (0, common_1.Param)('id')),
58
+ __param(1, (0, active_user_decorator_1.ActiveUser)()),
59
+ __metadata("design:type", Function),
60
+ __metadata("design:paramtypes", [String, Object]),
61
+ __metadata("design:returntype", Promise)
62
+ ], ChatterMessageArchiveController.prototype, "getOne", null);
63
+ exports.ChatterMessageArchiveController = ChatterMessageArchiveController = __decorate([
64
+ (0, swagger_1.ApiTags)('Solid Core'),
65
+ (0, swagger_1.ApiBearerAuth)('jwt'),
66
+ (0, common_1.Controller)('chatter-message-archive'),
67
+ __metadata("design:paramtypes", [chatter_message_archive_service_1.ChatterMessageArchiveService])
68
+ ], ChatterMessageArchiveController);
69
+ //# sourceMappingURL=chatter-message-archive.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatter-message-archive.controller.js","sourceRoot":"","sources":["../../src/controllers/chatter-message-archive.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAsG;AACtG,6CAAyD;AACzD,+EAAkE;AAElE,iGAA4F;AAKrF,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAC1C,YAA6B,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;IAAG,CAAC;IAE9D,WAAW,CAAC,UAA0B;QAC5C,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,2BAAkB,EAAE,CAAC;IAC5E,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CAAU,KAAU,EAAgB,UAA0B;QACzE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;QACzF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IACxC,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAc,EAAU,EAAgB,UAA0B;QAC5E,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,0BAAiB,CAAC,oCAAoC,CAAC,CAAC;QACvF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC7C,CAAC;CACF,CAAA;AAtBY,0EAA+B;AAQpC;IADL,IAAA,YAAG,GAAE;;IACS,WAAA,IAAA,cAAK,GAAE,CAAA;IAAc,WAAA,IAAA,kCAAU,GAAE,CAAA;;;;8DAK/C;AAGK;IADL,IAAA,YAAG,EAAC,KAAK,CAAC;;IACG,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,kCAAU,GAAE,CAAA;;;;6DAKlD;0CArBU,+BAA+B;IAH3C,IAAA,iBAAO,EAAC,YAAY,CAAC;IACrB,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,mBAAU,EAAC,yBAAyB,CAAC;qCAEE,8DAA4B;GADvD,+BAA+B,CAsB3C","sourcesContent":["import { Controller, ForbiddenException, Get, NotFoundException, Param, Query } from '@nestjs/common';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { ActiveUser } from 'src/decorators/active-user.decorator';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport { ChatterMessageArchiveService } from 'src/services/chatter-message-archive.service';\n\n@ApiTags('Solid Core')\n@ApiBearerAuth('jwt')\n@Controller('chatter-message-archive')\nexport class ChatterMessageArchiveController {\n constructor(private readonly service: ChatterMessageArchiveService) {}\n\n private ensureAdmin(activeUser: ActiveUserData) {\n if (!activeUser?.roles?.includes('Admin')) throw new ForbiddenException();\n }\n\n @Get()\n async getMany(@Query() query: any, @ActiveUser() activeUser: ActiveUserData) {\n this.ensureAdmin(activeUser);\n const result = await this.service.getArchivedMessages(query);\n if (result === null) return { available: false, records: [], meta: { totalRecords: 0 } };\n return { available: true, ...result };\n }\n\n @Get(':id')\n async getOne(@Param('id') id: string, @ActiveUser() activeUser: ActiveUserData) {\n this.ensureAdmin(activeUser);\n const result = await this.service.getArchivedMessage(Number(id));\n if (result === null) throw new NotFoundException('Archived chatter message not found');\n return { available: true, record: result };\n }\n}\n"]}