@solidxai/core 0.1.8-beta.1 → 0.1.8-beta.11

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 (202) hide show
  1. package/README.md +197 -0
  2. package/dist/controllers/authentication.controller.d.ts +32 -2
  3. package/dist/controllers/authentication.controller.d.ts.map +1 -1
  4. package/dist/controllers/authentication.controller.js +80 -3
  5. package/dist/controllers/authentication.controller.js.map +1 -1
  6. package/dist/dtos/create-api-key.dto.d.ts +5 -0
  7. package/dist/dtos/create-api-key.dto.d.ts.map +1 -0
  8. package/dist/dtos/create-api-key.dto.js +34 -0
  9. package/dist/dtos/create-api-key.dto.js.map +1 -0
  10. package/dist/dtos/post-chatter-message.dto.d.ts +1 -0
  11. package/dist/dtos/post-chatter-message.dto.d.ts.map +1 -1
  12. package/dist/dtos/post-chatter-message.dto.js +6 -1
  13. package/dist/dtos/post-chatter-message.dto.js.map +1 -1
  14. package/dist/dtos/register-private.dto.d.ts +3 -5
  15. package/dist/dtos/register-private.dto.d.ts.map +1 -1
  16. package/dist/dtos/register-private.dto.js +6 -18
  17. package/dist/dtos/register-private.dto.js.map +1 -1
  18. package/dist/dtos/sso-exchange.dto.d.ts +4 -0
  19. package/dist/dtos/sso-exchange.dto.d.ts.map +1 -0
  20. package/dist/dtos/sso-exchange.dto.js +26 -0
  21. package/dist/dtos/sso-exchange.dto.js.map +1 -0
  22. package/dist/dtos/update-api-key.dto.d.ts +4 -0
  23. package/dist/dtos/update-api-key.dto.d.ts.map +1 -0
  24. package/dist/dtos/update-api-key.dto.js +28 -0
  25. package/dist/dtos/update-api-key.dto.js.map +1 -0
  26. package/dist/entities/agent-event.entity.d.ts +3 -12
  27. package/dist/entities/agent-event.entity.d.ts.map +1 -1
  28. package/dist/entities/agent-event.entity.js +21 -46
  29. package/dist/entities/agent-event.entity.js.map +1 -1
  30. package/dist/entities/agent-session.entity.d.ts +2 -11
  31. package/dist/entities/agent-session.entity.d.ts.map +1 -1
  32. package/dist/entities/agent-session.entity.js +15 -40
  33. package/dist/entities/agent-session.entity.js.map +1 -1
  34. package/dist/entities/field-metadata.entity.js +1 -1
  35. package/dist/entities/field-metadata.entity.js.map +1 -1
  36. package/dist/entities/legacy-common.entity.d.ts +9 -9
  37. package/dist/entities/legacy-common.entity.d.ts.map +1 -1
  38. package/dist/entities/legacy-common.entity.js +7 -7
  39. package/dist/entities/legacy-common.entity.js.map +1 -1
  40. package/dist/entities/setting.entity.d.ts +1 -0
  41. package/dist/entities/setting.entity.d.ts.map +1 -1
  42. package/dist/entities/setting.entity.js +5 -1
  43. package/dist/entities/setting.entity.js.map +1 -1
  44. package/dist/entities/sms-template.entity.d.ts.map +1 -1
  45. package/dist/entities/sms-template.entity.js +2 -1
  46. package/dist/entities/sms-template.entity.js.map +1 -1
  47. package/dist/entities/user-api-key.entity.d.ts +12 -0
  48. package/dist/entities/user-api-key.entity.d.ts.map +1 -0
  49. package/dist/entities/user-api-key.entity.js +62 -0
  50. package/dist/entities/user-api-key.entity.js.map +1 -0
  51. package/dist/entities/user.entity.d.ts +3 -0
  52. package/dist/entities/user.entity.d.ts.map +1 -1
  53. package/dist/entities/user.entity.js +12 -1
  54. package/dist/entities/user.entity.js.map +1 -1
  55. package/dist/enums/auth-type.enum.d.ts +2 -1
  56. package/dist/enums/auth-type.enum.d.ts.map +1 -1
  57. package/dist/enums/auth-type.enum.js +2 -1
  58. package/dist/enums/auth-type.enum.js.map +1 -1
  59. package/dist/guards/api-key.guard.d.ts +11 -0
  60. package/dist/guards/api-key.guard.d.ts.map +1 -0
  61. package/dist/guards/api-key.guard.js +43 -0
  62. package/dist/guards/api-key.guard.js.map +1 -0
  63. package/dist/guards/authentication.guard.d.ts +4 -2
  64. package/dist/guards/authentication.guard.d.ts.map +1 -1
  65. package/dist/guards/authentication.guard.js +7 -3
  66. package/dist/guards/authentication.guard.js.map +1 -1
  67. package/dist/helpers/bootstrap.helper.d.ts.map +1 -1
  68. package/dist/helpers/bootstrap.helper.js +12 -1
  69. package/dist/helpers/bootstrap.helper.js.map +1 -1
  70. package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.d.ts.map +1 -1
  71. package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.js +15 -6
  72. package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.js.map +1 -1
  73. package/dist/helpers/typeorm-db-helper.d.ts.map +1 -1
  74. package/dist/helpers/typeorm-db-helper.js +9 -0
  75. package/dist/helpers/typeorm-db-helper.js.map +1 -1
  76. package/dist/index.d.ts +2 -0
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +2 -0
  79. package/dist/index.js.map +1 -1
  80. package/dist/interfaces.d.ts +12 -0
  81. package/dist/interfaces.d.ts.map +1 -1
  82. package/dist/interfaces.js.map +1 -1
  83. package/dist/jobs/database/chatter-queue-publisher-database.service.d.ts +1 -1
  84. package/dist/jobs/database/chatter-queue-publisher-database.service.d.ts.map +1 -1
  85. package/dist/jobs/database/chatter-queue-publisher-database.service.js.map +1 -1
  86. package/dist/jobs/database/chatter-queue-subscriber-database.service.d.ts +1 -1
  87. package/dist/jobs/database/chatter-queue-subscriber-database.service.d.ts.map +1 -1
  88. package/dist/jobs/database/chatter-queue-subscriber-database.service.js.map +1 -1
  89. package/dist/jobs/rabbitmq/chatter-queue-publisher.service.d.ts +1 -12
  90. package/dist/jobs/rabbitmq/chatter-queue-publisher.service.d.ts.map +1 -1
  91. package/dist/jobs/rabbitmq/chatter-queue-publisher.service.js.map +1 -1
  92. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.d.ts +1 -1
  93. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.d.ts.map +1 -1
  94. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.js.map +1 -1
  95. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.d.ts +1 -1
  96. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.d.ts.map +1 -1
  97. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.js.map +1 -1
  98. package/dist/repository/user-api-key.repository.d.ts +12 -0
  99. package/dist/repository/user-api-key.repository.d.ts.map +1 -0
  100. package/dist/repository/user-api-key.repository.js +34 -0
  101. package/dist/repository/user-api-key.repository.js.map +1 -0
  102. package/dist/seeders/module-test-data.service.d.ts +5 -0
  103. package/dist/seeders/module-test-data.service.d.ts.map +1 -1
  104. package/dist/seeders/module-test-data.service.js +131 -4
  105. package/dist/seeders/module-test-data.service.js.map +1 -1
  106. package/dist/seeders/seed-data/solid-core-metadata.json +287 -197
  107. package/dist/services/api-key.service.d.ts +20 -0
  108. package/dist/services/api-key.service.d.ts.map +1 -0
  109. package/dist/services/api-key.service.js +98 -0
  110. package/dist/services/api-key.service.js.map +1 -0
  111. package/dist/services/authentication.service.d.ts +19 -1
  112. package/dist/services/authentication.service.d.ts.map +1 -1
  113. package/dist/services/authentication.service.js +31 -5
  114. package/dist/services/authentication.service.js.map +1 -1
  115. package/dist/services/chatter-message.service.d.ts.map +1 -1
  116. package/dist/services/chatter-message.service.js +6 -0
  117. package/dist/services/chatter-message.service.js.map +1 -1
  118. package/dist/services/encryption.service.d.ts +8 -0
  119. package/dist/services/encryption.service.d.ts.map +1 -0
  120. package/dist/services/encryption.service.js +75 -0
  121. package/dist/services/encryption.service.js.map +1 -0
  122. package/dist/services/export-transaction.service.d.ts.map +1 -1
  123. package/dist/services/export-transaction.service.js +0 -23
  124. package/dist/services/export-transaction.service.js.map +1 -1
  125. package/dist/services/field-metadata.service.d.ts +1 -3
  126. package/dist/services/field-metadata.service.d.ts.map +1 -1
  127. package/dist/services/field-metadata.service.js +6 -13
  128. package/dist/services/field-metadata.service.js.map +1 -1
  129. package/dist/services/file/disk-file.service.d.ts +1 -0
  130. package/dist/services/file/disk-file.service.d.ts.map +1 -1
  131. package/dist/services/file/disk-file.service.js +11 -3
  132. package/dist/services/file/disk-file.service.js.map +1 -1
  133. package/dist/services/media.service.d.ts +0 -1
  134. package/dist/services/media.service.d.ts.map +1 -1
  135. package/dist/services/media.service.js +10 -11
  136. package/dist/services/media.service.js.map +1 -1
  137. package/dist/services/setting.service.d.ts +1 -0
  138. package/dist/services/setting.service.d.ts.map +1 -1
  139. package/dist/services/setting.service.js +35 -7
  140. package/dist/services/setting.service.js.map +1 -1
  141. package/dist/services/settings/default-settings-provider.service.d.ts +12 -0
  142. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  143. package/dist/services/settings/default-settings-provider.service.js +7 -3
  144. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  145. package/dist/services/sso-code-storage.service.d.ts +15 -0
  146. package/dist/services/sso-code-storage.service.d.ts.map +1 -0
  147. package/dist/services/sso-code-storage.service.js +47 -0
  148. package/dist/services/sso-code-storage.service.js.map +1 -0
  149. package/dist/services/user.service.d.ts.map +1 -1
  150. package/dist/services/user.service.js +3 -2
  151. package/dist/services/user.service.js.map +1 -1
  152. package/dist/solid-core.module.d.ts.map +1 -1
  153. package/dist/solid-core.module.js +10 -0
  154. package/dist/solid-core.module.js.map +1 -1
  155. package/dist/subscribers/audit.subscriber.d.ts +1 -1
  156. package/dist/subscribers/audit.subscriber.d.ts.map +1 -1
  157. package/dist/subscribers/audit.subscriber.js.map +1 -1
  158. package/package.json +1 -1
  159. package/src/controllers/authentication.controller.ts +59 -3
  160. package/src/dtos/create-api-key.dto.ts +14 -0
  161. package/src/dtos/post-chatter-message.dto.ts +4 -0
  162. package/src/dtos/register-private.dto.ts +5 -14
  163. package/src/dtos/sso-exchange.dto.ts +7 -0
  164. package/src/dtos/update-api-key.dto.ts +9 -0
  165. package/src/entities/agent-event.entity.ts +21 -55
  166. package/src/entities/agent-session.entity.ts +15 -47
  167. package/src/entities/field-metadata.entity.ts +1 -1
  168. package/src/entities/legacy-common.entity.ts +15 -15
  169. package/src/entities/setting.entity.ts +3 -0
  170. package/src/entities/sms-template.entity.ts +3 -2
  171. package/src/entities/user-api-key.entity.ts +37 -0
  172. package/src/entities/user.entity.ts +8 -0
  173. package/src/enums/auth-type.enum.ts +1 -0
  174. package/src/guards/api-key.guard.ts +32 -0
  175. package/src/guards/authentication.guard.ts +6 -3
  176. package/src/helpers/bootstrap.helper.ts +16 -1
  177. package/src/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.ts +17 -6
  178. package/src/helpers/typeorm-db-helper.ts +11 -0
  179. package/src/index.ts +2 -0
  180. package/src/interfaces.ts +16 -0
  181. package/src/jobs/database/chatter-queue-publisher-database.service.ts +1 -1
  182. package/src/jobs/database/chatter-queue-subscriber-database.service.ts +1 -1
  183. package/src/jobs/rabbitmq/chatter-queue-publisher.service.ts +1 -15
  184. package/src/jobs/rabbitmq/chatter-queue-subscriber.service.ts +1 -1
  185. package/src/jobs/redis/chatter-queue-subscriber-redis.service.ts +1 -1
  186. package/src/repository/user-api-key.repository.ts +17 -0
  187. package/src/seeders/module-test-data.service.ts +165 -6
  188. package/src/seeders/seed-data/solid-core-metadata.json +287 -197
  189. package/src/services/api-key.service.ts +111 -0
  190. package/src/services/authentication.service.ts +35 -3
  191. package/src/services/chatter-message.service.ts +7 -0
  192. package/src/services/encryption.service.ts +43 -0
  193. package/src/services/export-transaction.service.ts +0 -26
  194. package/src/services/field-metadata.service.ts +5 -12
  195. package/src/services/file/disk-file.service.ts +15 -7
  196. package/src/services/media.service.ts +12 -51
  197. package/src/services/setting.service.ts +38 -9
  198. package/src/services/settings/default-settings-provider.service.ts +7 -3
  199. package/src/services/sso-code-storage.service.ts +36 -0
  200. package/src/services/user.service.ts +3 -2
  201. package/src/solid-core.module.ts +10 -0
  202. package/src/subscribers/audit.subscriber.ts +1 -1
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # @solidxai/core
2
+
3
+ > Turn your data models into production-grade enterprise applications — with auth, APIs, roles, and admin views — in minutes, not months.
4
+
5
+ `@solidxai/core` is the backend engine that powers every [SolidX](https://solidxai.com) application. It is a global NestJS module that wires up a complete, production-ready backend infrastructure — authentication, security, metadata-driven CRUD APIs, notifications, queues, storage providers, dashboards, and more — so you can focus on your business logic rather than rebuilding the same plumbing from scratch.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@solidxai/core)](https://www.npmjs.com/package/@solidxai/core)
8
+ [![License: BSL](https://img.shields.io/badge/License-BSL-blue.svg)](https://opensource.org/licenses/BSL-1.1)
9
+ [![Documentation](https://img.shields.io/badge/docs-solidxai.com-blue)](https://docs.solidxai.com/docs)
10
+
11
+
12
+ ## Why @solidxai/core?
13
+
14
+ Enterprise applications share a large common surface area — auth flows, role management, CRUD endpoints, file uploads, email and SMS delivery, audit logs, and more. Most teams end up rebuilding these from scratch on every project, or stitching together a dozen separate libraries and hoping they play well together.
15
+
16
+ `@solidxai/core` solves this by bundling all of that infrastructure into a single, cohesive NestJS module that is:
17
+
18
+ - **Open-source and standards-based** — built on NestJS, TypeORM, and TypeScript. No black box, no proprietary runtime.
19
+ - **Non-prescriptive** — The code it provides is yours to extend and modify, not locked behind a code generation layer. Use it as a foundation, not a constraint.
20
+ - **Batteries included** — covers the full stack of enterprise concerns so you are not left hunting for a compatible queue library, a storage abstraction, or a permissions guard.
21
+
22
+
23
+ ## Core Capabilities
24
+
25
+ ### Identity & Access Management (IAM)
26
+
27
+ A complete IAM system is registered automatically when you import the module.
28
+
29
+ - **Users** — full user lifecycle management including registration, email verification, password reset and built-in protections such as password hashing, account lockout, and JWT-based access/refresh tokens.
30
+ - **Roles & Permissions** — RBAC where every controller handler is automatically discoverable as a permission; assign permissions to roles and roles to users
31
+ - **Row-Level Security Rules** — define role-aware record access policies automatically enforced at the repository layer.
32
+
33
+ ### Authentication
34
+
35
+ Multiple authentication strategies available out of the box, all issuing standard JWT tokens:
36
+
37
+ - **Password-based** — bcrypt hashing, forgot/reset password flows
38
+ - **OTP / Passwordless** — one-time password login via SMS or email
39
+ - **Google OAuth2** — full Google OAuth2 flow, with redirect handling and JWT issuance
40
+ - **Token Management** — access/refresh token authentication with configurable expiry and Redis-backed refresh token storage (with in-memory fallback if Redis is not configured).
41
+
42
+ ### Metadata-driven CRUD Engine
43
+
44
+ The heart of the platform. Define your data model in metadata (modules → models → fields) and get a fully functional REST API immediately.
45
+
46
+ - **Generic CRUDService** — field-aware create, update, read, and delete that understands 20+ semantic field types (relations, media, computed fields, pseudo-foreign keys, and more)
47
+ - **Filtering, sorting & pagination** — every list endpoint supports rich filter expressions, multi-column sorting, group by functionality and pagination
48
+ - **Import & Export** — Excel (`.xlsx`) and CSV import/export for every resource, with async job tracking
49
+ - **Audit trail** — automatic `created_by`, `updated_by`, and change history, configurable per model
50
+ - **Soft delete** — configurable per model, with security-aware filter application
51
+ - **Saved filters** — users can persist named query configurations against any resource
52
+ - **Computed fields** — define fields whose values are derived at persistence time (concat, UUID external IDs, sequence numbers, and custom computation)
53
+
54
+ ### Notifications
55
+
56
+ A unified notification layer with provider abstractions so you can swap providers without touching application code.
57
+
58
+ - **Email** — SMTP support; Handlebars-based template management with attachment support
59
+ - **SMS** — Twilio and MSG91
60
+ - **WhatsApp** — MSG91 and 3Sixty
61
+ - **Queue-backed delivery** — all notifications are dispatched asynchronously; choose between RabbitMQ, or a database-backed queue depending on your infrastructure
62
+
63
+ ### Storage
64
+
65
+ - **Media management** — upload, store, retrieve, and serve files through a unified media entity
66
+ - **Provider abstraction** — local disk and AWS S3 are supported; switch providers via configuration with no code changes
67
+ - **AWS Textract** — built-in OCR service for document extraction use cases
68
+
69
+ ### Dashboards
70
+
71
+ A SQL-driven dashboard builder that lets you compose analytical views without a separate BI tool.
72
+
73
+ - **Dashboard → Questions → Variables** model for composing charts and data tables
74
+ - **SQL dataset configs** — write raw SQL, bind dynamic variables at query time
75
+ - **Security-aware aggregates** — `count`, `sum`, `avg`, `min`, `max` all respect the active user's security rules
76
+ - **Chart types** — bar, line, pie, doughnut, data table, meter group
77
+
78
+ ### Chatter
79
+
80
+ - Per-record messaging thread and activity feed
81
+ - Useful for collaboration workflows, approval chains, and record-level audit commentary
82
+
83
+ ### Scheduler
84
+
85
+ - Define and manage cron jobs at runtime via the admin API — no deployments required to add or modify scheduled tasks
86
+ - Jobs are stored in the database and executed by the built-in scheduler service, which can be run in a separate process if desired
87
+
88
+ ### CLI Tooling
89
+
90
+ The module ships a `solidctl` package that provides a suite of command-line tools for common development and maintenance tasks:
91
+
92
+ ```bash
93
+ npx @solidxai/solidctl seed # Seed application metadata i.e system modules, roles, and permissions, user accounts, and more
94
+ npx @solidxai/solidctl test-data # Load test data fixtures
95
+ npx @solidxai/solidctl run-tests # Execute metadata-driven test scenarios
96
+ npx @solidxai/solidctl generate module # Create/Update boilerplate for a specific module
97
+ npx @solidxai/solidctl generate model # Create/Update boilerplate for a specific model
98
+ npx @solidxai/solidctl fixtures-setup # Set up test fixtures before a test run
99
+ npx @solidxai/solidctl fixtures-tear-down # Tear down test fixtures after a test run
100
+ npx @solidxai/solidctl info # Display CLI and environment information
101
+ ```
102
+
103
+ ### Testing Framework
104
+
105
+ A metadata-driven end-to-end testing system built directly into the module. Define test scenarios in your module metadata JSON, then run them via the CLI.
106
+
107
+ - **API adapter** — executes scenarios against live REST endpoints using Axios
108
+ - **UI adapter** — drives a Playwright browser for full end-to-end UI tests
109
+ - **20+ built-in operations** — `api.request`, `ui.fill`, `assert.equals`, `assert.contains`, and more
110
+ - **Custom spec escape hatch** — drop into raw TypeScript for scenarios that need custom logic
111
+
112
+
113
+ ## Installation
114
+
115
+ ```bash
116
+ npm install @solidxai/core
117
+ ```
118
+
119
+ ### Peer dependencies
120
+
121
+ ```bash
122
+ npm install \
123
+ @nestjs/common @nestjs/core @nestjs/platform-express \
124
+ @nestjs/typeorm @nestjs/config @nestjs/jwt @nestjs/passport \
125
+ @nestjs/swagger @nestjs/axios @nestjs/cache-manager \
126
+ @nestjs/event-emitter @nestjs/mongoose @nestjs/serve-static \
127
+ nest-commander nest-winston nestjs-cls \
128
+ typeorm typeorm-naming-strategies \
129
+ reflect-metadata winston
130
+ ```
131
+
132
+ Playwright is optional and only required if you intend to use the UI test adapter:
133
+
134
+ ```bash
135
+ npm install --save-optional playwright
136
+ ```
137
+
138
+
139
+ ## Quick Setup
140
+
141
+ Import `SolidCoreModule` into your root application module. Because it is decorated with `@Global()`, all its exported services become available throughout your application without needing to re-import them.
142
+
143
+ ```typescript
144
+ import { Module } from '@nestjs/common';
145
+ import { TypeOrmModule } from '@nestjs/typeorm';
146
+ import { SolidCoreModule } from '@solidxai/core';
147
+
148
+ @Module({
149
+ imports: [
150
+ TypeOrmModule.forRoot({
151
+ type: 'postgres',
152
+ // ... your database config
153
+ }),
154
+ SolidCoreModule,
155
+ ],
156
+ })
157
+ export class AppModule {}
158
+ ```
159
+
160
+ For full configuration options — environment variables, storage providers, queue setup, and OAuth credentials — see the [Developer Documentation](https://docs.solidxai.com/docs).
161
+
162
+
163
+ ## Technology Stack
164
+
165
+ | Concern | Technology |
166
+ |---|---|
167
+ | Framework | NestJS 10 |
168
+ | ORM | TypeORM (PostgreSQL, MS SQL) |
169
+ | Authentication | Database Authentication supporting pasword and otp login, Google OAuth2 |
170
+ | Queues | RabbitMQ · Database-backed |
171
+ | Storage | AWS S3 · Local disk |
172
+ | Email | SMTP (Nodemailer) |
173
+ | SMS / WhatsApp | Twilio · MSG91 · 3Sixty |
174
+ | Caching | Redis · In-memory (cache-manager) |
175
+ | PDF generation | Puppeteer |
176
+ | CLI | nest-commander |
177
+ | Logging | Winston |
178
+
179
+ ---
180
+
181
+ ## Part of the SolidX Platform
182
+
183
+ `@solidxai/core` is the backend foundation of the [SolidX](https://solidxai.com) low-code development platform. SolidX takes a metadata-first approach — you describe your application's data models, and the platform generates fully open-source, standards-based NestJS + React code that your team owns outright.
184
+
185
+ The output is not locked into a proprietary runtime. It runs on the same stack your developers already know — NestJS, TypeORM, React — and can be extended, forked, and deployed independently.
186
+
187
+ | | |
188
+ |---|---|
189
+ | Website | [solidxai.com](https://solidxai.com) |
190
+ | Documentation | [docs.solidxai.com](https://docs.solidxai.com/docs) |
191
+ | Support | support@solidxai.com |
192
+
193
+ ---
194
+
195
+ ## License
196
+
197
+ BSL-1.1 © [Logicloop](https://logicloop.io)
@@ -1,18 +1,24 @@
1
1
  import { Response } from 'express';
2
2
  import { ChangePasswordDto } from "../dtos/change-password.dto";
3
3
  import { ConfirmForgotPasswordDto } from '../dtos/confirm-forgot-password.dto';
4
+ import { CreateApiKeyDto } from '../dtos/create-api-key.dto';
5
+ import { UpdateApiKeyDto } from '../dtos/update-api-key.dto';
4
6
  import { InitiateForgotPasswordDto } from '../dtos/initiate-forgot-password.dto';
5
7
  import { RefreshTokenDto } from '../dtos/refresh-token.dto';
8
+ import { SsoExchangeDto } from '../dtos/sso-exchange.dto';
6
9
  import { SignInDto } from '../dtos/sign-in.dto';
10
+ import { RegisterPrivateDto } from '../dtos/register-private.dto';
7
11
  import { SignUpDto } from '../dtos/sign-up.dto';
8
12
  import { ActiveUserData } from "../interfaces/active-user-data.interface";
13
+ import { ApiKeyService } from '../services/api-key.service';
9
14
  import { AuthenticationService } from '../services/authentication.service';
10
15
  export declare class AuthenticationController {
11
16
  private readonly authService;
17
+ private readonly apiKeyService;
12
18
  private readonly logger;
13
- constructor(authService: AuthenticationService);
19
+ constructor(authService: AuthenticationService, apiKeyService: ApiKeyService);
14
20
  signUp(signUpDto: SignUpDto): Promise<import("..").User>;
15
- signUpPrivate(signUpDto: SignUpDto, activeUser: ActiveUserData): Promise<import("..").User>;
21
+ signUpPrivate(signUpDto: RegisterPrivateDto, activeUser: ActiveUserData): Promise<import("..").User>;
16
22
  signIn(response: Response, signInDto: SignInDto): Promise<{
17
23
  accessToken: string;
18
24
  refreshToken: string;
@@ -61,5 +67,29 @@ export declare class AuthenticationController {
61
67
  logout(refreshToken: string): Promise<{
62
68
  message: string;
63
69
  }>;
70
+ generateApiKey(dto: CreateApiKeyDto, activeUser: ActiveUserData): Promise<{
71
+ apiKey: string;
72
+ record: import("..").UserApiKey;
73
+ }>;
74
+ generateApiKeyForUser(userId: number, dto: CreateApiKeyDto): Promise<{
75
+ apiKey: string;
76
+ record: import("..").UserApiKey;
77
+ }>;
78
+ updateApiKey(id: number, dto: UpdateApiKeyDto, activeUser: ActiveUserData): Promise<void>;
79
+ generateSsoCode(activeUser: ActiveUserData, authorization: string): Promise<{
80
+ ssoCode: string;
81
+ }>;
82
+ exchangeSsoCode(ssoExchangeDto: SsoExchangeDto): Promise<{
83
+ accessToken: string;
84
+ refreshToken: string;
85
+ user: {
86
+ id: number;
87
+ username: string;
88
+ email: string;
89
+ mobile: string;
90
+ lastLoginProvider: string;
91
+ roles: string[];
92
+ };
93
+ }>;
64
94
  }
65
95
  //# sourceMappingURL=authentication.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAI3E,qBAIa,wBAAwB;IAGrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAFxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAEvC,WAAW,EAAE,qBAAqB;IAK/D,MAAM,CAAS,SAAS,EAAE,SAAS;IAMnC,aAAa,CAAS,SAAS,EAAE,SAAS,EAAgB,UAAU,EAAE,cAAc;IAQ9E,MAAM,CACoB,QAAQ,EAAE,QAAQ,EACtC,SAAS,EAAE,SA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AAC,aAAa;IAJlC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAG/C,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,aAAa;IAMjD,MAAM,CAAS,SAAS,EAAE,SAAS;IAMnC,aAAa,CAAS,SAAS,EAAE,kBAAkB,EAAgB,UAAU,EAAE,cAAc;IAQvF,MAAM,CACoB,QAAQ,EAAE,QAAQ,EACtC,SAAS,EAAE,SAAS;;;;;;;;;;;;IAqBhC,aAAa,CAAS,eAAe,EAAE,eAAe;;;;IAOtD,sBAAsB,CAAS,yBAAyB,EAAE,yBAAyB;;;;;;;;;;;IAOnF,qBAAqB,CAAS,wBAAwB,EAAE,wBAAwB;;;;;;;IAMhF,cAAc,CAAS,iBAAiB,EAAE,iBAAiB,EAAgB,UAAU,EAAE,cAAc;IAMrG,EAAE,CACgB,UAAU,EAAE,cAAc;;;;;;;;;;IAStC,MAAM,CAAuB,YAAY,EAAE,MAAM;;;IAOvD,cAAc,CACF,GAAG,EAAE,eAAe,EACd,UAAU,EAAE,cAAc;;;;IAQ5C,qBAAqB,CACc,MAAM,EAAE,MAAM,EACrC,GAAG,EAAE,eAAe;;;;IAQhC,YAAY,CACmB,EAAE,EAAE,MAAM,EAC7B,GAAG,EAAE,eAAe,EACd,UAAU,EAAE,cAAc;IAO5C,eAAe,CACG,UAAU,EAAE,cAAc,EACd,aAAa,EAAE,MAAM;;;IASnD,eAAe,CAAS,cAAc,EAAE,cAAc;;;;;;;;;;;;CAGzD"}
@@ -21,14 +21,20 @@ const active_user_decorator_1 = require("../decorators/active-user.decorator");
21
21
  const public_decorator_1 = require("../decorators/public.decorator");
22
22
  const change_password_dto_1 = require("../dtos/change-password.dto");
23
23
  const confirm_forgot_password_dto_1 = require("../dtos/confirm-forgot-password.dto");
24
+ const create_api_key_dto_1 = require("../dtos/create-api-key.dto");
25
+ const update_api_key_dto_1 = require("../dtos/update-api-key.dto");
24
26
  const initiate_forgot_password_dto_1 = require("../dtos/initiate-forgot-password.dto");
25
27
  const refresh_token_dto_1 = require("../dtos/refresh-token.dto");
28
+ const sso_exchange_dto_1 = require("../dtos/sso-exchange.dto");
26
29
  const sign_in_dto_1 = require("../dtos/sign-in.dto");
30
+ const register_private_dto_1 = require("../dtos/register-private.dto");
27
31
  const sign_up_dto_1 = require("../dtos/sign-up.dto");
32
+ const api_key_service_1 = require("../services/api-key.service");
28
33
  const authentication_service_1 = require("../services/authentication.service");
29
34
  let AuthenticationController = AuthenticationController_1 = class AuthenticationController {
30
- constructor(authService) {
35
+ constructor(authService, apiKeyService) {
31
36
  this.authService = authService;
37
+ this.apiKeyService = apiKeyService;
32
38
  this.logger = new common_1.Logger(AuthenticationController_1.name);
33
39
  }
34
40
  signUp(signUpDto) {
@@ -58,6 +64,22 @@ let AuthenticationController = AuthenticationController_1 = class Authentication
58
64
  async logout(refreshToken) {
59
65
  return this.authService.logout(refreshToken);
60
66
  }
67
+ generateApiKey(dto, activeUser) {
68
+ return this.apiKeyService.generate(activeUser.sub, dto);
69
+ }
70
+ generateApiKeyForUser(userId, dto) {
71
+ return this.apiKeyService.generate(userId, dto);
72
+ }
73
+ updateApiKey(id, dto, activeUser) {
74
+ return this.apiKeyService.updateKey(id, activeUser.sub, dto);
75
+ }
76
+ generateSsoCode(activeUser, authorization) {
77
+ const rawAccessToken = authorization?.replace(/^Bearer\s+/i, '');
78
+ return this.authService.generateSsoCode(activeUser, rawAccessToken);
79
+ }
80
+ exchangeSsoCode(ssoExchangeDto) {
81
+ return this.authService.exchangeSsoCode(ssoExchangeDto.code);
82
+ }
61
83
  };
62
84
  exports.AuthenticationController = AuthenticationController;
63
85
  __decorate([
@@ -76,7 +98,7 @@ __decorate([
76
98
  __param(0, (0, common_1.Body)()),
77
99
  __param(1, (0, active_user_decorator_1.ActiveUser)()),
78
100
  __metadata("design:type", Function),
79
- __metadata("design:paramtypes", [sign_up_dto_1.SignUpDto, Object]),
101
+ __metadata("design:paramtypes", [register_private_dto_1.RegisterPrivateDto, Object]),
80
102
  __metadata("design:returntype", void 0)
81
103
  ], AuthenticationController.prototype, "signUpPrivate", null);
82
104
  __decorate([
@@ -148,9 +170,64 @@ __decorate([
148
170
  __metadata("design:paramtypes", [String]),
149
171
  __metadata("design:returntype", Promise)
150
172
  ], AuthenticationController.prototype, "logout", null);
173
+ __decorate([
174
+ (0, swagger_1.ApiBearerAuth)("jwt"),
175
+ (0, common_1.Post)('api-keys'),
176
+ (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
177
+ openapi.ApiResponse({ status: common_1.HttpStatus.CREATED }),
178
+ __param(0, (0, common_1.Body)()),
179
+ __param(1, (0, active_user_decorator_1.ActiveUser)()),
180
+ __metadata("design:type", Function),
181
+ __metadata("design:paramtypes", [create_api_key_dto_1.CreateApiKeyDto, Object]),
182
+ __metadata("design:returntype", void 0)
183
+ ], AuthenticationController.prototype, "generateApiKey", null);
184
+ __decorate([
185
+ (0, swagger_1.ApiBearerAuth)("jwt"),
186
+ (0, common_1.Post)('api-keys/users/:userId'),
187
+ (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
188
+ openapi.ApiResponse({ status: common_1.HttpStatus.CREATED }),
189
+ __param(0, (0, common_1.Param)('userId', common_1.ParseIntPipe)),
190
+ __param(1, (0, common_1.Body)()),
191
+ __metadata("design:type", Function),
192
+ __metadata("design:paramtypes", [Number, create_api_key_dto_1.CreateApiKeyDto]),
193
+ __metadata("design:returntype", void 0)
194
+ ], AuthenticationController.prototype, "generateApiKeyForUser", null);
195
+ __decorate([
196
+ (0, swagger_1.ApiBearerAuth)("jwt"),
197
+ (0, common_1.Patch)('api-keys/:id'),
198
+ (0, common_1.HttpCode)(common_1.HttpStatus.OK),
199
+ openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
200
+ __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
201
+ __param(1, (0, common_1.Body)()),
202
+ __param(2, (0, active_user_decorator_1.ActiveUser)()),
203
+ __metadata("design:type", Function),
204
+ __metadata("design:paramtypes", [Number, update_api_key_dto_1.UpdateApiKeyDto, Object]),
205
+ __metadata("design:returntype", void 0)
206
+ ], AuthenticationController.prototype, "updateApiKey", null);
207
+ __decorate([
208
+ (0, common_1.Post)('sso/code'),
209
+ (0, common_1.HttpCode)(common_1.HttpStatus.OK),
210
+ openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
211
+ __param(0, (0, active_user_decorator_1.ActiveUser)()),
212
+ __param(1, (0, common_1.Headers)('authorization')),
213
+ __metadata("design:type", Function),
214
+ __metadata("design:paramtypes", [Object, String]),
215
+ __metadata("design:returntype", void 0)
216
+ ], AuthenticationController.prototype, "generateSsoCode", null);
217
+ __decorate([
218
+ (0, public_decorator_1.Public)(),
219
+ (0, common_1.Post)('sso/exchange'),
220
+ (0, common_1.HttpCode)(common_1.HttpStatus.OK),
221
+ openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
222
+ __param(0, (0, common_1.Body)()),
223
+ __metadata("design:type", Function),
224
+ __metadata("design:paramtypes", [sso_exchange_dto_1.SsoExchangeDto]),
225
+ __metadata("design:returntype", void 0)
226
+ ], AuthenticationController.prototype, "exchangeSsoCode", null);
151
227
  exports.AuthenticationController = AuthenticationController = AuthenticationController_1 = __decorate([
152
228
  (0, common_1.Controller)('iam'),
153
229
  (0, swagger_1.ApiTags)("Solid Core"),
154
- __metadata("design:paramtypes", [authentication_service_1.AuthenticationService])
230
+ __metadata("design:paramtypes", [authentication_service_1.AuthenticationService,
231
+ api_key_service_1.ApiKeyService])
155
232
  ], AuthenticationController);
156
233
  //# sourceMappingURL=authentication.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAgG;AAChG,6CAAyD;AAEzD,+EAAiE;AACjE,qEAAwD;AACxD,qEAAgE;AAChE,qFAA+E;AAC/E,uFAAiF;AACjF,iEAA4D;AAC5D,qDAAgD;AAChD,q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,CAAA;IAAwC,WAAA,IAAA,kCAAU,GAAE,CAAA;;qCAAhC,uCAAiB;;8DAE1D;AAID;IAFC,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,YAAG,EAAC,IAAI,CAAC;;IAEL,WAAA,IAAA,kCAAU,GAAE,CAAA;;;;kDAGhB;AAMK;IAJL,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,yBAAM,GAAE;IACR,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;kCAAd,mBAAU,CAAC,EAAE;IACT,WAAA,IAAA,aAAI,EAAC,cAAc,CAAC,CAAA;;;;sDAEjC;mCAnFQ,wBAAwB;IAJpC,IAAA,mBAAU,EAAC,KAAK,CAAC;IACjB,IAAA,iBAAO,EAAC,YAAY,CAAC;qCAMwB,8CAAqB;GAHtD,wBAAwB,CAoFpC","sourcesContent":["import { Body, Controller, Get, HttpCode, HttpStatus, Logger, Post, Res } from '@nestjs/common';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { Response } from 'express';\nimport { ActiveUser } from \"../decorators/active-user.decorator\";\nimport { Public } from '../decorators/public.decorator';\nimport { ChangePasswordDto } from \"../dtos/change-password.dto\";\nimport { ConfirmForgotPasswordDto } from '../dtos/confirm-forgot-password.dto';\nimport { InitiateForgotPasswordDto } from '../dtos/initiate-forgot-password.dto';\nimport { RefreshTokenDto } from '../dtos/refresh-token.dto';\nimport { SignInDto } from '../dtos/sign-in.dto';\nimport { SignUpDto } from '../dtos/sign-up.dto';\nimport { ActiveUserData } from \"../interfaces/active-user-data.interface\";\nimport { AuthenticationService } from '../services/authentication.service';\n\n\n// @Auth(AuthType.None)\n@Controller('iam')\n@ApiTags(\"Solid Core\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({login: true, short: true, burst: true, sustained: true}) // disable all sets by default for this controller\nexport class AuthenticationController {\n private readonly logger = new Logger(AuthenticationController.name);\n\n constructor(private readonly authService: AuthenticationService) { }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('register')\n signUp(@Body() signUpDto: SignUpDto) {\n return this.authService.signUp(signUpDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('register-private')\n signUpPrivate(@Body() signUpDto: SignUpDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.signUp(signUpDto, activeUser);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // by default @Post does 201, we wanted 200 - hence using @HttpCode(HttpStatus.OK)\n @Post('authenticate')\n async signIn(\n @Res({ passthrough: true }) response: Response,\n @Body() signInDto: SignInDto\n ) {\n // This means that we are passing the token back in plain text. \n // This is less secure. \n // console.log(\"signInDto in Signin Controller\", signInDto);\n\n return this.authService.signIn(signInDto);\n\n // This means we are setting the token as a http only cookie.\n // const accessToken = await this.authService.signIn(signInDto);\n // response.cookie('accessToken', accessToken, {\n // secure: true,\n // httpOnly: true,\n // sameSite: true,\n // });\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // changed since the default is 201\n @Post('refresh-tokens')\n refreshTokens(@Body() refreshTokenDto: RefreshTokenDto) {\n return this.authService.refreshTokens(refreshTokenDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('initiate/forgot-password')\n initiateForgotPassword(@Body() initiateForgotPasswordDto: InitiateForgotPasswordDto) {\n return this.authService.initiateForgotPassword(initiateForgotPasswordDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('confirm/forgot-password')\n confirmForgotPassword(@Body() confirmForgotPasswordDto: ConfirmForgotPasswordDto) {\n return this.authService.confirmForgotPassword(confirmForgotPasswordDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('change-password')\n changePassword(@Body() changePasswordDto: ChangePasswordDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.changePassword(changePasswordDto, activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('me')\n me(\n @ActiveUser() activeUser: ActiveUserData\n ) {\n return this.authService.me(activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('logout')\n @Public()\n @HttpCode(HttpStatus.OK)\n async logout(@Body('refreshToken') refreshToken: string) {\n return this.authService.logout(refreshToken);\n }\n}\n"]}
1
+ {"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAqI;AACrI,6CAAyD;AAEzD,+EAAiE;AACjE,qEAAwD;AACxD,qEAAgE;AAChE,qFAA+E;AAC/E,mEAA6D;AAC7D,mEAA6D;AAC7D,uFAAiF;AACjF,iEAA4D;AAC5D,+DAA0D;AAC1D,qDAAgD;AAChD,uEAAkE;AAClE,qDAAgD;AAEhD,iEAA4D;AAC5D,+EAA2E;AAQpE,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGjC,YACqB,WAAkC,EAClC,aAA4B;QAD5B,gBAAW,GAAX,WAAW,CAAuB;QAClC,kBAAa,GAAb,aAAa,CAAe;QAJhC,WAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAKhE,CAAC;IAKL,MAAM,CAAS,SAAoB;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAID,aAAa,CAAS,SAA6B,EAAgB,UAA0B;QACzF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAMK,AAAN,KAAK,CAAC,MAAM,CACoB,QAAkB,EACtC,SAAoB;QAM5B,OAAO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G/B;AAKD;IAHC,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,cAAK,EAAC,cAAc,CAAC;IACrB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;kCAAd,mBAAU,CAAC,EAAE;IAElB,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IACzB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,kCAAU,GAAE,CAAA;;6CADA,oCAAe;;4DAI/B;AAID;IAFC,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;kCAAd,mBAAU,CAAC,EAAE;IAElB,WAAA,IAAA,kCAAU,GAAE,CAAA;IACZ,WAAA,IAAA,gBAAO,EAAC,eAAe,CAAC,CAAA;;;;+DAI5B;AAKD;IAHC,IAAA,yBAAM,GAAE;IACR,IAAA,aAAI,EAAC,cAAc,CAAC;IACpB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;kCAAd,mBAAU,CAAC,EAAE;IACN,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAiB,iCAAc;;+DAErD;mCAtIQ,wBAAwB;IAJpC,IAAA,mBAAU,EAAC,KAAK,CAAC;IACjB,IAAA,iBAAO,EAAC,YAAY,CAAC;qCAOgB,8CAAqB;QACnB,+BAAa;GALxC,wBAAwB,CAuIpC","sourcesContent":["import { Body, Controller, Get, HttpCode, HttpStatus, Logger, Param, ParseIntPipe, Patch, Post, Res, Headers } from '@nestjs/common';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { Response } from 'express';\nimport { ActiveUser } from \"../decorators/active-user.decorator\";\nimport { Public } from '../decorators/public.decorator';\nimport { ChangePasswordDto } from \"../dtos/change-password.dto\";\nimport { ConfirmForgotPasswordDto } from '../dtos/confirm-forgot-password.dto';\nimport { CreateApiKeyDto } from '../dtos/create-api-key.dto';\nimport { UpdateApiKeyDto } from '../dtos/update-api-key.dto';\nimport { InitiateForgotPasswordDto } from '../dtos/initiate-forgot-password.dto';\nimport { RefreshTokenDto } from '../dtos/refresh-token.dto';\nimport { SsoExchangeDto } from '../dtos/sso-exchange.dto';\nimport { SignInDto } from '../dtos/sign-in.dto';\nimport { RegisterPrivateDto } from '../dtos/register-private.dto';\nimport { SignUpDto } from '../dtos/sign-up.dto';\nimport { ActiveUserData } from \"../interfaces/active-user-data.interface\";\nimport { ApiKeyService } from '../services/api-key.service';\nimport { AuthenticationService } from '../services/authentication.service';\n\n\n// @Auth(AuthType.None)\n@Controller('iam')\n@ApiTags(\"Solid Core\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({login: true, short: true, burst: true, sustained: true}) // disable all sets by default for this controller\nexport class AuthenticationController {\n private readonly logger = new Logger(AuthenticationController.name);\n\n constructor(\n private readonly authService: AuthenticationService,\n private readonly apiKeyService: ApiKeyService,\n ) { }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('register')\n signUp(@Body() signUpDto: SignUpDto) {\n return this.authService.signUp(signUpDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('register-private')\n signUpPrivate(@Body() signUpDto: RegisterPrivateDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.signUp(signUpDto, activeUser);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // by default @Post does 201, we wanted 200 - hence using @HttpCode(HttpStatus.OK)\n @Post('authenticate')\n async signIn(\n @Res({ passthrough: true }) response: Response,\n @Body() signInDto: SignInDto\n ) {\n // This means that we are passing the token back in plain text. \n // This is less secure. \n // console.log(\"signInDto in Signin Controller\", signInDto);\n\n return this.authService.signIn(signInDto);\n\n // This means we are setting the token as a http only cookie.\n // const accessToken = await this.authService.signIn(signInDto);\n // response.cookie('accessToken', accessToken, {\n // secure: true,\n // httpOnly: true,\n // sameSite: true,\n // });\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // changed since the default is 201\n @Post('refresh-tokens')\n refreshTokens(@Body() refreshTokenDto: RefreshTokenDto) {\n return this.authService.refreshTokens(refreshTokenDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('initiate/forgot-password')\n initiateForgotPassword(@Body() initiateForgotPasswordDto: InitiateForgotPasswordDto) {\n return this.authService.initiateForgotPassword(initiateForgotPasswordDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('confirm/forgot-password')\n confirmForgotPassword(@Body() confirmForgotPasswordDto: ConfirmForgotPasswordDto) {\n return this.authService.confirmForgotPassword(confirmForgotPasswordDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('change-password')\n changePassword(@Body() changePasswordDto: ChangePasswordDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.changePassword(changePasswordDto, activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('me')\n me(\n @ActiveUser() activeUser: ActiveUserData\n ) {\n return this.authService.me(activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('logout')\n @Public()\n @HttpCode(HttpStatus.OK)\n async logout(@Body('refreshToken') refreshToken: string) {\n return this.authService.logout(refreshToken);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('api-keys')\n @HttpCode(HttpStatus.CREATED)\n generateApiKey(\n @Body() dto: CreateApiKeyDto,\n @ActiveUser() activeUser: ActiveUserData,\n ) {\n return this.apiKeyService.generate(activeUser.sub, dto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('api-keys/users/:userId')\n @HttpCode(HttpStatus.CREATED)\n generateApiKeyForUser(\n @Param('userId', ParseIntPipe) userId: number,\n @Body() dto: CreateApiKeyDto,\n ) {\n return this.apiKeyService.generate(userId, dto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Patch('api-keys/:id')\n @HttpCode(HttpStatus.OK)\n updateApiKey(\n @Param('id', ParseIntPipe) id: number,\n @Body() dto: UpdateApiKeyDto,\n @ActiveUser() activeUser: ActiveUserData,\n ) {\n return this.apiKeyService.updateKey(id, activeUser.sub, dto);\n }\n\n @Post('sso/code')\n @HttpCode(HttpStatus.OK)\n generateSsoCode(\n @ActiveUser() activeUser: ActiveUserData, \n @Headers('authorization') authorization: string,\n ) {\n const rawAccessToken = authorization?.replace(/^Bearer\\s+/i, '');\n return this.authService.generateSsoCode(activeUser, rawAccessToken);\n }\n\n @Public()\n @Post('sso/exchange')\n @HttpCode(HttpStatus.OK)\n exchangeSsoCode(@Body() ssoExchangeDto: SsoExchangeDto) {\n return this.authService.exchangeSsoCode(ssoExchangeDto.code);\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare class CreateApiKeyDto {
2
+ name: string;
3
+ expiresAt?: string;
4
+ }
5
+ //# sourceMappingURL=create-api-key.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-api-key.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-api-key.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAIxB,IAAI,EAAE,MAAM,CAAC;IAKb,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,34 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreateApiKeyDto = void 0;
13
+ const openapi = require("@nestjs/swagger");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const class_validator_1 = require("class-validator");
16
+ class CreateApiKeyDto {
17
+ static _OPENAPI_METADATA_FACTORY() {
18
+ return { name: { required: true, type: () => String }, expiresAt: { required: false, type: () => String } };
19
+ }
20
+ }
21
+ exports.CreateApiKeyDto = CreateApiKeyDto;
22
+ __decorate([
23
+ (0, swagger_1.ApiProperty)({ example: 'Production Server' }),
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsNotEmpty)(),
26
+ __metadata("design:type", String)
27
+ ], CreateApiKeyDto.prototype, "name", void 0);
28
+ __decorate([
29
+ (0, swagger_1.ApiPropertyOptional)({ example: '2027-01-01T00:00:00.000Z' }),
30
+ (0, class_validator_1.IsDateString)(),
31
+ (0, class_validator_1.IsOptional)(),
32
+ __metadata("design:type", String)
33
+ ], CreateApiKeyDto.prototype, "expiresAt", void 0);
34
+ //# sourceMappingURL=create-api-key.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-api-key.dto.js","sourceRoot":"","sources":["../../src/dtos/create-api-key.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAAiF;AAEjF,MAAa,eAAe;;;;CAU3B;AAVD,0CAUC;AANG;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC7C,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6CACA;AAKb;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IAC5D,IAAA,8BAAY,GAAE;IACd,IAAA,4BAAU,GAAE;;kDACM","sourcesContent":["import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';\nimport { IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';\n\nexport class CreateApiKeyDto {\n @ApiProperty({ example: 'Production Server' })\n @IsString()\n @IsNotEmpty()\n name: string;\n\n @ApiPropertyOptional({ example: '2027-01-01T00:00:00.000Z' })\n @IsDateString()\n @IsOptional()\n expiresAt?: string;\n}\n"]}
@@ -3,5 +3,6 @@ export declare class PostChatterMessageDto {
3
3
  coModelName: string;
4
4
  messageBody: string;
5
5
  messageSubType?: string;
6
+ modelUserKey?: string;
6
7
  }
7
8
  //# sourceMappingURL=post-chatter-message.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-chatter-message.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/post-chatter-message.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,qBAAqB;IAG9B,eAAe,EAAE,MAAM,CAAC;IAIxB,WAAW,EAAE,MAAM,CAAC;IAIpB,WAAW,EAAE,MAAM,CAAC;IAIpB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
1
+ {"version":3,"file":"post-chatter-message.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/post-chatter-message.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,qBAAqB;IAG9B,eAAe,EAAE,MAAM,CAAC;IAIxB,WAAW,EAAE,MAAM,CAAC;IAIpB,WAAW,EAAE,MAAM,CAAC;IAIpB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -14,7 +14,7 @@ const openapi = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
15
  class PostChatterMessageDto {
16
16
  static _OPENAPI_METADATA_FACTORY() {
17
- return { coModelEntityId: { required: true, type: () => Number }, coModelName: { required: true, type: () => String }, messageBody: { required: true, type: () => String }, messageSubType: { required: false, type: () => String } };
17
+ return { coModelEntityId: { required: true, type: () => Number }, coModelName: { required: true, type: () => String }, messageBody: { required: true, type: () => String }, messageSubType: { required: false, type: () => String }, modelUserKey: { required: false, type: () => String } };
18
18
  }
19
19
  }
20
20
  exports.PostChatterMessageDto = PostChatterMessageDto;
@@ -38,4 +38,9 @@ __decorate([
38
38
  (0, class_validator_1.IsOptional)(),
39
39
  __metadata("design:type", String)
40
40
  ], PostChatterMessageDto.prototype, "messageSubType", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsOptional)(),
44
+ __metadata("design:type", String)
45
+ ], PostChatterMessageDto.prototype, "modelUserKey", void 0);
41
46
  //# sourceMappingURL=post-chatter-message.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-chatter-message.dto.js","sourceRoot":"","sources":["../../src/dtos/post-chatter-message.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6E;AAE7E,MAAa,qBAAqB;;;;CAgBjC;AAhBD,sDAgBC;AAbG;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8DACW;AAIxB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACO;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACO;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6DACW","sourcesContent":["import { IsNotEmpty, IsNumber, IsString, IsOptional } from 'class-validator';\n\nexport class PostChatterMessageDto {\n @IsNumber()\n @IsNotEmpty()\n coModelEntityId: number;\n\n @IsString()\n @IsNotEmpty()\n coModelName: string;\n\n @IsString()\n @IsNotEmpty()\n messageBody: string;\n\n @IsString()\n @IsOptional()\n messageSubType?: string;\n}"]}
1
+ {"version":3,"file":"post-chatter-message.dto.js","sourceRoot":"","sources":["../../src/dtos/post-chatter-message.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6E;AAE7E,MAAa,qBAAqB;;;;CAoBjC;AApBD,sDAoBC;AAjBG;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8DACW;AAIxB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACO;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACO;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6DACW;AAIxB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;2DACS","sourcesContent":["import { IsNotEmpty, IsNumber, IsString, IsOptional } from 'class-validator';\n\nexport class PostChatterMessageDto {\n @IsNumber()\n @IsNotEmpty()\n coModelEntityId: number;\n\n @IsString()\n @IsNotEmpty()\n coModelName: string;\n\n @IsString()\n @IsNotEmpty()\n messageBody: string;\n\n @IsString()\n @IsOptional()\n messageSubType?: string;\n\n @IsString()\n @IsOptional()\n modelUserKey?: string;\n}"]}
@@ -1,7 +1,5 @@
1
- export declare class RegisterPrivateDto {
2
- username: string;
3
- email: string;
4
- mobile?: string;
5
- password?: string;
1
+ import { SignUpDto } from './sign-up.dto';
2
+ export declare class RegisterPrivateDto extends SignUpDto {
3
+ isAllowedToGenerateApiKeys?: boolean;
6
4
  }
7
5
  //# sourceMappingURL=register-private.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-private.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/register-private.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,kBAAkB;IAE3B,QAAQ,EAAE,MAAM,CAAC;IAIjB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"register-private.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/register-private.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,qBAAa,kBAAmB,SAAQ,SAAS;IAG7C,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACxC"}
@@ -12,28 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RegisterPrivateDto = void 0;
13
13
  const openapi = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
- class RegisterPrivateDto {
15
+ const sign_up_dto_1 = require("./sign-up.dto");
16
+ class RegisterPrivateDto extends sign_up_dto_1.SignUpDto {
16
17
  static _OPENAPI_METADATA_FACTORY() {
17
- return { username: { required: true, type: () => String }, email: { required: true, type: () => String }, mobile: { required: false, type: () => String }, password: { required: false, type: () => String, minLength: 10 } };
18
+ return { isAllowedToGenerateApiKeys: { required: false, type: () => Boolean } };
18
19
  }
19
20
  }
20
21
  exports.RegisterPrivateDto = RegisterPrivateDto;
21
22
  __decorate([
22
- (0, class_validator_1.IsNotEmpty)(),
23
- __metadata("design:type", String)
24
- ], RegisterPrivateDto.prototype, "username", void 0);
25
- __decorate([
26
- (0, class_validator_1.IsEmail)(),
27
- (0, class_validator_1.IsNotEmpty)(),
28
- __metadata("design:type", String)
29
- ], RegisterPrivateDto.prototype, "email", void 0);
30
- __decorate([
31
- (0, class_validator_1.IsOptional)(),
32
- __metadata("design:type", String)
33
- ], RegisterPrivateDto.prototype, "mobile", void 0);
34
- __decorate([
23
+ (0, class_validator_1.IsBoolean)(),
35
24
  (0, class_validator_1.IsOptional)(),
36
- (0, class_validator_1.MinLength)(10),
37
- __metadata("design:type", String)
38
- ], RegisterPrivateDto.prototype, "password", void 0);
25
+ __metadata("design:type", Boolean)
26
+ ], RegisterPrivateDto.prototype, "isAllowedToGenerateApiKeys", void 0);
39
27
  //# sourceMappingURL=register-private.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-private.dto.js","sourceRoot":"","sources":["../../src/dtos/register-private.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6E;AAE7E,MAAa,kBAAkB;;;;CAc9B;AAdD,gDAcC;AAZG;IADC,IAAA,4BAAU,GAAE;;oDACI;AAIjB;IAFC,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;;iDACC;AAGd;IADC,IAAA,4BAAU,GAAE;;kDACG;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,EAAE,CAAC;;oDACI","sourcesContent":["import { IsEmail, IsNotEmpty, IsOptional, MinLength } from 'class-validator';\n\nexport class RegisterPrivateDto {\n @IsNotEmpty()\n username: string;\n\n @IsEmail()\n @IsNotEmpty()\n email: string;\n\n @IsOptional()\n mobile?: string;\n\n @IsOptional()\n @MinLength(10)\n password?: string;\n}\n"]}
1
+ {"version":3,"file":"register-private.dto.js","sourceRoot":"","sources":["../../src/dtos/register-private.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAwD;AACxD,+CAA0C;AAE1C,MAAa,kBAAmB,SAAQ,uBAAS;;;;CAIhD;AAJD,gDAIC;AADG;IAFC,IAAA,2BAAS,GAAE;IACX,IAAA,4BAAU,GAAE;;sEACwB","sourcesContent":["import { IsBoolean, IsOptional } from 'class-validator';\nimport { SignUpDto } from './sign-up.dto';\n\nexport class RegisterPrivateDto extends SignUpDto {\n @IsBoolean()\n @IsOptional()\n isAllowedToGenerateApiKeys?: boolean;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare class SsoExchangeDto {
2
+ code: string;
3
+ }
4
+ //# sourceMappingURL=sso-exchange.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso-exchange.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/sso-exchange.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IAGvB,IAAI,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,26 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SsoExchangeDto = void 0;
13
+ const openapi = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ class SsoExchangeDto {
16
+ static _OPENAPI_METADATA_FACTORY() {
17
+ return { code: { required: true, type: () => String } };
18
+ }
19
+ }
20
+ exports.SsoExchangeDto = SsoExchangeDto;
21
+ __decorate([
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ (0, class_validator_1.IsString)(),
24
+ __metadata("design:type", String)
25
+ ], SsoExchangeDto.prototype, "code", void 0);
26
+ //# sourceMappingURL=sso-exchange.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso-exchange.dto.js","sourceRoot":"","sources":["../../src/dtos/sso-exchange.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,cAAc;;;;CAI1B;AAJD,wCAIC;AADG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;4CACE","sourcesContent":["import { IsNotEmpty, IsString } from 'class-validator';\n\nexport class SsoExchangeDto {\n @IsNotEmpty()\n @IsString()\n code: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare class UpdateApiKeyDto {
2
+ isActive: boolean;
3
+ }
4
+ //# sourceMappingURL=update-api-key.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-api-key.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-api-key.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAIxB,QAAQ,EAAE,OAAO,CAAC;CACrB"}