@burdenoff/be-sdk 2026.510.79

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 (220) hide show
  1. package/README.md +173 -0
  2. package/configs/eslint/index.js +492 -0
  3. package/configs/tsconfig/tsconfig.json +53 -0
  4. package/dist/EventQueueFactory-6NMSGECR.js +8 -0
  5. package/dist/EventQueueFactory-6NMSGECR.js.map +1 -0
  6. package/dist/auth/index.d.ts +66 -0
  7. package/dist/auth/index.js +8 -0
  8. package/dist/auth/index.js.map +1 -0
  9. package/dist/cache/index.d.ts +2 -0
  10. package/dist/cache/index.js +6 -0
  11. package/dist/cache/index.js.map +1 -0
  12. package/dist/captcha/index.d.ts +1 -0
  13. package/dist/captcha/index.js +4 -0
  14. package/dist/captcha/index.js.map +1 -0
  15. package/dist/chunk-2HANKZZM.js +245 -0
  16. package/dist/chunk-2HANKZZM.js.map +1 -0
  17. package/dist/chunk-2SD5L2F2.js +816 -0
  18. package/dist/chunk-2SD5L2F2.js.map +1 -0
  19. package/dist/chunk-3O2RQOPV.js +1068 -0
  20. package/dist/chunk-3O2RQOPV.js.map +1 -0
  21. package/dist/chunk-4B43DZIS.js +560 -0
  22. package/dist/chunk-4B43DZIS.js.map +1 -0
  23. package/dist/chunk-4XAEES25.js +2444 -0
  24. package/dist/chunk-4XAEES25.js.map +1 -0
  25. package/dist/chunk-4XGGWW36.js +1405 -0
  26. package/dist/chunk-4XGGWW36.js.map +1 -0
  27. package/dist/chunk-5LXDPGDH.js +245 -0
  28. package/dist/chunk-5LXDPGDH.js.map +1 -0
  29. package/dist/chunk-AI7L22ZJ.js +472 -0
  30. package/dist/chunk-AI7L22ZJ.js.map +1 -0
  31. package/dist/chunk-CBZNP6RF.js +286 -0
  32. package/dist/chunk-CBZNP6RF.js.map +1 -0
  33. package/dist/chunk-ELLX3K54.js +613 -0
  34. package/dist/chunk-ELLX3K54.js.map +1 -0
  35. package/dist/chunk-F5XEAGHQ.js +1875 -0
  36. package/dist/chunk-F5XEAGHQ.js.map +1 -0
  37. package/dist/chunk-FNZEQOJY.js +628 -0
  38. package/dist/chunk-FNZEQOJY.js.map +1 -0
  39. package/dist/chunk-GTEMQXCA.js +516 -0
  40. package/dist/chunk-GTEMQXCA.js.map +1 -0
  41. package/dist/chunk-HIWTWIGQ.js +226 -0
  42. package/dist/chunk-HIWTWIGQ.js.map +1 -0
  43. package/dist/chunk-IYE2NTRX.js +764 -0
  44. package/dist/chunk-IYE2NTRX.js.map +1 -0
  45. package/dist/chunk-J26YGR2U.js +1484 -0
  46. package/dist/chunk-J26YGR2U.js.map +1 -0
  47. package/dist/chunk-JG2FTZPI.js +509 -0
  48. package/dist/chunk-JG2FTZPI.js.map +1 -0
  49. package/dist/chunk-JVBTNSPG.js +1551 -0
  50. package/dist/chunk-JVBTNSPG.js.map +1 -0
  51. package/dist/chunk-L7ZMN2FJ.js +12 -0
  52. package/dist/chunk-L7ZMN2FJ.js.map +1 -0
  53. package/dist/chunk-M5IMU3US.js +473 -0
  54. package/dist/chunk-M5IMU3US.js.map +1 -0
  55. package/dist/chunk-MLW2HPS5.js +1267 -0
  56. package/dist/chunk-MLW2HPS5.js.map +1 -0
  57. package/dist/chunk-MNCGUYLJ.js +269 -0
  58. package/dist/chunk-MNCGUYLJ.js.map +1 -0
  59. package/dist/chunk-MOCUBSTW.js +373 -0
  60. package/dist/chunk-MOCUBSTW.js.map +1 -0
  61. package/dist/chunk-NGMEI42S.js +103 -0
  62. package/dist/chunk-NGMEI42S.js.map +1 -0
  63. package/dist/chunk-NUB5GQTU.js +270 -0
  64. package/dist/chunk-NUB5GQTU.js.map +1 -0
  65. package/dist/chunk-OVSYMNCI.js +145 -0
  66. package/dist/chunk-OVSYMNCI.js.map +1 -0
  67. package/dist/chunk-QLVKMWFA.js +94 -0
  68. package/dist/chunk-QLVKMWFA.js.map +1 -0
  69. package/dist/chunk-SAG6ZYWQ.js +89 -0
  70. package/dist/chunk-SAG6ZYWQ.js.map +1 -0
  71. package/dist/chunk-SAK2JCA7.js +198 -0
  72. package/dist/chunk-SAK2JCA7.js.map +1 -0
  73. package/dist/chunk-SBS4S2PJ.js +100 -0
  74. package/dist/chunk-SBS4S2PJ.js.map +1 -0
  75. package/dist/chunk-SNEOLWXT.js +148 -0
  76. package/dist/chunk-SNEOLWXT.js.map +1 -0
  77. package/dist/chunk-TKBD2ONF.js +564 -0
  78. package/dist/chunk-TKBD2ONF.js.map +1 -0
  79. package/dist/chunk-UBXFIIAW.js +127 -0
  80. package/dist/chunk-UBXFIIAW.js.map +1 -0
  81. package/dist/chunk-VI4VSNTI.js +57 -0
  82. package/dist/chunk-VI4VSNTI.js.map +1 -0
  83. package/dist/chunk-VWCN5PMD.js +268 -0
  84. package/dist/chunk-VWCN5PMD.js.map +1 -0
  85. package/dist/chunk-XC2YD6CF.js +913 -0
  86. package/dist/chunk-XC2YD6CF.js.map +1 -0
  87. package/dist/chunk-XE4OXN2W.js +10 -0
  88. package/dist/chunk-XE4OXN2W.js.map +1 -0
  89. package/dist/chunk-YMZEUTD2.js +110 -0
  90. package/dist/chunk-YMZEUTD2.js.map +1 -0
  91. package/dist/chunk-Z4IRLBWO.js +758 -0
  92. package/dist/chunk-Z4IRLBWO.js.map +1 -0
  93. package/dist/client/internal-client.d.ts +7 -0
  94. package/dist/client/internal-client.js +5 -0
  95. package/dist/client/internal-client.js.map +1 -0
  96. package/dist/client-CSjIrYKS.d.ts +77 -0
  97. package/dist/config-UKE2E3BW.js +4 -0
  98. package/dist/config-UKE2E3BW.js.map +1 -0
  99. package/dist/crypto/index.d.ts +1 -0
  100. package/dist/crypto/index.js +4 -0
  101. package/dist/crypto/index.js.map +1 -0
  102. package/dist/database/index.d.ts +117 -0
  103. package/dist/database/index.js +7 -0
  104. package/dist/database/index.js.map +1 -0
  105. package/dist/dataloader/index.d.ts +1 -0
  106. package/dist/dataloader/index.js +4 -0
  107. package/dist/dataloader/index.js.map +1 -0
  108. package/dist/esm-K6H7EIWK.js +1450 -0
  109. package/dist/esm-K6H7EIWK.js.map +1 -0
  110. package/dist/event-queue/index.d.ts +6 -0
  111. package/dist/event-queue/index.js +10 -0
  112. package/dist/event-queue/index.js.map +1 -0
  113. package/dist/export/index.d.ts +2 -0
  114. package/dist/export/index.js +9 -0
  115. package/dist/export/index.js.map +1 -0
  116. package/dist/feature-flags/index.d.ts +1 -0
  117. package/dist/feature-flags/index.js +4 -0
  118. package/dist/feature-flags/index.js.map +1 -0
  119. package/dist/gateway/index.d.ts +4 -0
  120. package/dist/gateway/index.js +8 -0
  121. package/dist/gateway/index.js.map +1 -0
  122. package/dist/gateway/security/index.d.ts +2 -0
  123. package/dist/gateway/security/index.js +5 -0
  124. package/dist/gateway/security/index.js.map +1 -0
  125. package/dist/graph/index.d.ts +9 -0
  126. package/dist/graph/index.js +13 -0
  127. package/dist/graph/index.js.map +1 -0
  128. package/dist/graph-emitter-Bk0FqD53.d.ts +47 -0
  129. package/dist/graphql/index.d.ts +2 -0
  130. package/dist/graphql/index.js +7 -0
  131. package/dist/graphql/index.js.map +1 -0
  132. package/dist/graphql/services/index.d.ts +24 -0
  133. package/dist/graphql/services/index.js +5 -0
  134. package/dist/graphql/services/index.js.map +1 -0
  135. package/dist/graphql-BAVrUgBF.d.ts +22 -0
  136. package/dist/i18n/index.d.ts +2 -0
  137. package/dist/i18n/index.js +5 -0
  138. package/dist/i18n/index.js.map +1 -0
  139. package/dist/i18n-DA6IPnYy.d.ts +101 -0
  140. package/dist/index-4gKQKZ2B.d.ts +71 -0
  141. package/dist/index-B18rrFru.d.ts +42 -0
  142. package/dist/index-B70b5mYS.d.ts +33 -0
  143. package/dist/index-BMq3lFjj.d.ts +247 -0
  144. package/dist/index-BODgvRtL.d.ts +316 -0
  145. package/dist/index-BS2idbnr.d.ts +874 -0
  146. package/dist/index-BV3G48cH.d.ts +124 -0
  147. package/dist/index-CHbVw5M7.d.ts +73 -0
  148. package/dist/index-Cq_xNjcv.d.ts +602 -0
  149. package/dist/index-CrQgidpx.d.ts +77 -0
  150. package/dist/index-CyVEg86m.d.ts +309 -0
  151. package/dist/index-DOcBnmMe.d.ts +166 -0
  152. package/dist/index-DSOpj8DI.d.ts +17 -0
  153. package/dist/index-DW9q22GH.d.ts +75 -0
  154. package/dist/index-DlFDFyWD.d.ts +55 -0
  155. package/dist/index-DoK0bjhH.d.ts +607 -0
  156. package/dist/index-Dtf6FBaD.d.ts +199 -0
  157. package/dist/index-KVWGHMbS.d.ts +415 -0
  158. package/dist/index-PaojfSdd.d.ts +71 -0
  159. package/dist/index-RU_M5c74.d.ts +163 -0
  160. package/dist/index-UhkH2eaB.d.ts +192 -0
  161. package/dist/index-e_18DzAg.d.ts +18 -0
  162. package/dist/index-jOuh_TKn.d.ts +59 -0
  163. package/dist/index.d.ts +584 -0
  164. package/dist/index.js +2626 -0
  165. package/dist/index.js.map +1 -0
  166. package/dist/init/index.d.ts +2 -0
  167. package/dist/init/index.js +12 -0
  168. package/dist/init/index.js.map +1 -0
  169. package/dist/instrumentation/index.d.ts +3 -0
  170. package/dist/instrumentation/index.js +5 -0
  171. package/dist/instrumentation/index.js.map +1 -0
  172. package/dist/layer/index.d.ts +2 -0
  173. package/dist/layer/index.js +6 -0
  174. package/dist/layer/index.js.map +1 -0
  175. package/dist/layer-DDip18KY.d.ts +67 -0
  176. package/dist/logger/index.d.ts +2 -0
  177. package/dist/logger/index.js +4 -0
  178. package/dist/logger/index.js.map +1 -0
  179. package/dist/middleware/index.d.ts +3 -0
  180. package/dist/middleware/index.js +5 -0
  181. package/dist/middleware/index.js.map +1 -0
  182. package/dist/notifications/index.d.ts +4 -0
  183. package/dist/notifications/index.js +7 -0
  184. package/dist/notifications/index.js.map +1 -0
  185. package/dist/observability/index.d.ts +3 -0
  186. package/dist/observability/index.js +5 -0
  187. package/dist/observability/index.js.map +1 -0
  188. package/dist/pino-logger-RYLGXPHZ.js +5 -0
  189. package/dist/pino-logger-RYLGXPHZ.js.map +1 -0
  190. package/dist/prisma/generator/index.d.ts +1 -0
  191. package/dist/prisma/generator/index.js +228 -0
  192. package/dist/prisma/generator/index.js.map +1 -0
  193. package/dist/prisma/index.d.ts +5 -0
  194. package/dist/prisma/index.js +12 -0
  195. package/dist/prisma/index.js.map +1 -0
  196. package/dist/prisma-extension-krXnYnrN.d.ts +30 -0
  197. package/dist/rbac/index.d.ts +116 -0
  198. package/dist/rbac/index.js +7 -0
  199. package/dist/rbac/index.js.map +1 -0
  200. package/dist/sdk-THO3IWEE.js +136 -0
  201. package/dist/sdk-THO3IWEE.js.map +1 -0
  202. package/dist/server/index.d.ts +359 -0
  203. package/dist/server/index.js +884 -0
  204. package/dist/server/index.js.map +1 -0
  205. package/dist/telemetry/index.d.ts +83 -0
  206. package/dist/telemetry/index.js +209 -0
  207. package/dist/telemetry/index.js.map +1 -0
  208. package/dist/temporal/index.d.ts +148 -0
  209. package/dist/temporal/index.js +6 -0
  210. package/dist/temporal/index.js.map +1 -0
  211. package/dist/tracker/index.d.ts +5 -0
  212. package/dist/tracker/index.js +9 -0
  213. package/dist/tracker/index.js.map +1 -0
  214. package/dist/types-Bo2wkjSP.d.ts +35 -0
  215. package/dist/utils/index.d.ts +1 -0
  216. package/dist/utils/index.js +4 -0
  217. package/dist/utils/index.js.map +1 -0
  218. package/dist/workspace-guard-LHBNK4TG.js +5 -0
  219. package/dist/workspace-guard-LHBNK4TG.js.map +1 -0
  220. package/package.json +241 -0
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # @burdenoff/be-sdk
2
+
3
+ Backend SDK for Burdenoff products providing unified access to notifications, RBAC, activity tracking, usage monitoring, and more.
4
+
5
+ > Published automatically using npm trusted publishers (OIDC) - no long-lived tokens needed!
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @burdenoff/be-sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { BurdenoffSDK } from '@burdenoff/be-sdk';
17
+
18
+ // Initialize SDK
19
+ const sdk = new BurdenoffSDK({
20
+ workspacesApiUrl: 'https://api.burdenoff.com/graphql',
21
+ tenantApiUrl: 'https://tenant.burdenoff.com/graphql',
22
+ context: {
23
+ userId: 'user-123',
24
+ workspaceId: 'workspace-456',
25
+ token: 'your-jwt-token',
26
+ },
27
+ });
28
+
29
+ // Send notification
30
+ await sdk.notifications.send({
31
+ title: 'Welcome',
32
+ message: 'Hello from Burdenoff!',
33
+ userIds: ['user-123'],
34
+ type: 'info',
35
+ });
36
+
37
+ // Track operation with RBAC + Activity + Usage
38
+ await sdk.tracker.trackOperation({
39
+ operationName: 'createProject',
40
+ userId: 'user-123',
41
+ rbacCheck: { workspaceId: 'workspace-456' },
42
+ activityOptions: {
43
+ description: 'Created new project',
44
+ metadata: { projectName: 'My Project' },
45
+ },
46
+ usageOptions: {
47
+ billingAccountId: 'billing-123',
48
+ },
49
+ });
50
+
51
+ // Check permissions
52
+ await sdk.rbac.requirePermission({
53
+ userId: 'user-123',
54
+ action: 'create:project',
55
+ resourceType: 'project',
56
+ workspaceId: 'workspace-456',
57
+ });
58
+
59
+ // Record activity
60
+ await sdk.activity.record({
61
+ userId: 'user-123',
62
+ action: 'PROJECT_CREATED',
63
+ description: 'Created new project',
64
+ productId: 'WORKSPACE',
65
+ workspaceId: 'workspace-456',
66
+ });
67
+
68
+ // Add usage
69
+ await sdk.usage.add({
70
+ billingAccountId: 'billing-123',
71
+ quotaName: 'api_calls',
72
+ value: 1,
73
+ description: 'API call for project creation',
74
+ });
75
+
76
+ // Export product translations from i18n service
77
+ const hiDictionary = await sdk.translation.exportProductTranslations({
78
+ productName: 'vibecontrols',
79
+ languageCode: 'hi',
80
+ format: 'JSON',
81
+ decodeJson: true,
82
+ });
83
+
84
+ // Upsert product translations (creates missing keys/translations, publishes)
85
+ await sdk.translation.upsertProductTranslations({
86
+ productName: 'vibecontrols',
87
+ languageCode: 'ta',
88
+ translations: {
89
+ 'overviewPage.title': 'VibeControls மேலோட்டம்',
90
+ },
91
+ });
92
+ ```
93
+
94
+ ## Features
95
+
96
+ - **Unified Tracking**: Single function for RBAC + Activity + Usage + Quota checking
97
+ - **Notifications**: Send in-app, email, SMS, and push notifications
98
+ - **RBAC**: Role-based access control and permission management
99
+ - **Activity Logging**: Comprehensive audit trail for all operations
100
+ - **Usage Tracking**: Track resource consumption for billing
101
+ - **Graph Integration**: Global search across all products
102
+ - **Context Management**: Automatic context propagation
103
+ - **Event Queue**: NATS integration for event-driven architecture
104
+ - **Database Helpers**: Prisma utilities and transaction management
105
+ - **Authentication**: JWT verification and token management
106
+ - **Payments**: Payment processing and webhook handling
107
+ - **Translation**: Backend i18n support
108
+ - **Search**: Advanced search utilities
109
+ - **Logger**: Structured logging compatible with console
110
+
111
+ ## Modules
112
+
113
+ ### Core Modules
114
+
115
+ - **tracker**: Unified operation tracking (RBAC + Activity + Usage + Notifications)
116
+ - **logger**: Structured logging system
117
+ - **context**: Request context management
118
+ - **client**: GraphQL client with retry logic
119
+
120
+ ### Integration Modules
121
+
122
+ - **notifications**: Notification management
123
+ - **rbac**: Permission and access control
124
+ - **activity**: Activity logging
125
+ - **usage**: Usage and quota tracking
126
+ - **graph**: Knowledge graph integration
127
+ - **events**: Event queue (NATS) integration
128
+ - **auth**: Authentication and JWT handling
129
+
130
+ ### Utility Modules
131
+
132
+ - **database**: Prisma helpers
133
+ - **search**: Search utilities
134
+ - **translation**: i18n support
135
+ - **payments**: Payment processing
136
+ - **bootstrap**: Server initialization
137
+
138
+ ## Documentation
139
+
140
+ For detailed documentation, see:
141
+
142
+ - [API Reference](./docs/api.md)
143
+ - [Integration Guide](./docs/integration.md)
144
+ - [Examples](./docs/examples.md)
145
+ - [Migration Guide](./docs/migration.md)
146
+ - [Internal Client Architecture](./src/client/README.md) - Service-to-service communication and header transformation
147
+
148
+ ## Development
149
+
150
+ ```bash
151
+ # Install dependencies
152
+ npm install
153
+
154
+ # Run tests
155
+ npm test
156
+
157
+ # Build
158
+ npm run build
159
+
160
+ # Lint
161
+ npm run lint
162
+
163
+ # Format
164
+ npm run format
165
+ ```
166
+
167
+ ## License
168
+
169
+ PROPRIETARY - Copyright Burdenoff Consultancy Services Pvt. Ltd.
170
+
171
+ ## Support
172
+
173
+ For support, email contact@burdenoff.com or visit [https://burdenoff.com/support](https://burdenoff.com/support).
@@ -0,0 +1,492 @@
1
+ import pluginJs from '@eslint/js';
2
+ import eslintComments from 'eslint-plugin-eslint-comments';
3
+ import importPlugin from 'eslint-plugin-import';
4
+ import security from 'eslint-plugin-security';
5
+ import sonarjs from 'eslint-plugin-sonarjs';
6
+ import globals from 'globals';
7
+ import tseslint from 'typescript-eslint';
8
+
9
+ /**
10
+ * Burdenoff TypeScript Backend ESLint Configuration v1.2.0
11
+ *
12
+ * Factory function that creates a complete ESLint configuration with TypeScript
13
+ * type-aware rules, eliminating the need for consuming projects to provide
14
+ * parserOptions manually.
15
+ *
16
+ * CHANGELOG v1.2.0:
17
+ * - **BREAKING CHANGE**: Now exports a factory function instead of array
18
+ * - Automatically configures TypeScript parser options with provided dirname
19
+ * - Eliminates need for manual languageOptions configuration in consuming projects
20
+ * - Backwards compatible: see migration guide below
21
+ *
22
+ * MIGRATION FROM v1.1.0 to v1.2.0:
23
+ * Before:
24
+ * import burdenoffConfig from '@burdenoff/be-ts-lint';
25
+ * export default [...burdenoffConfig, { languageOptions: { ... } }];
26
+ *
27
+ * After:
28
+ * import createConfig from '@burdenoff/be-ts-lint';
29
+ * export default createConfig(import.meta.dirname);
30
+ *
31
+ * @param {string} dirname - The directory of the consuming project (use import.meta.dirname)
32
+ * @param {object} options - Optional configuration
33
+ * @param {string} options.project - Path to tsconfig file (default: './tsconfig.eslint.json')
34
+ * @returns {import('eslint').Linter.FlatConfig[]}
35
+ */
36
+ export default function createBurdenoffConfig(dirname, options = {}) {
37
+ const { project = './tsconfig.eslint.json' } = options;
38
+
39
+ if (!dirname) {
40
+ throw new Error(
41
+ '@burdenoff/be-ts-lint: dirname is required. Use createConfig(import.meta.dirname)',
42
+ );
43
+ }
44
+
45
+ return [
46
+ {
47
+ files: ['**/*.{js,mjs,cjs,ts}'],
48
+ },
49
+ {
50
+ ignores: [
51
+ '**/generated/**',
52
+ '**/generated/*.ts',
53
+ '**/temp/**',
54
+ '**/dist/**',
55
+ '**/coverage/**',
56
+ '**/node_modules/**',
57
+ '*.d.ts',
58
+ '*.config.js',
59
+ '*.config.mjs',
60
+ ],
61
+ },
62
+ {
63
+ languageOptions: {
64
+ globals: {
65
+ ...globals.node,
66
+ ...globals.es2022,
67
+ },
68
+ parserOptions: {
69
+ // Automatically configured from factory function parameters
70
+ project,
71
+ tsconfigRootDir: dirname,
72
+ ecmaVersion: 'latest',
73
+ sourceType: 'module',
74
+ },
75
+ },
76
+ },
77
+ // ============================================================================
78
+ // Base Recommended Configurations
79
+ // ============================================================================
80
+ pluginJs.configs.recommended,
81
+ ...tseslint.configs.recommended,
82
+ security.configs.recommended,
83
+ sonarjs.configs.recommended,
84
+ {
85
+ plugins: {
86
+ import: importPlugin,
87
+ 'eslint-comments': eslintComments,
88
+ },
89
+ rules: {
90
+ // ============================================================================
91
+ // ESLint Comments - Control inline ESLint directives
92
+ // ============================================================================
93
+ 'eslint-comments/no-use': 'error', // Require description for eslint-disable comments
94
+ 'eslint-comments/no-unlimited-disable': 'error', // Disallow unlimited eslint-disable
95
+ 'eslint-comments/no-restricted-disable': 'error', // Disallow disabling specific rules without justification
96
+ 'eslint-comments/no-duplicate-disable': 'error', // Disallow duplicate eslint-disable comments
97
+ 'eslint-comments/no-unused-disable': 'error', // Disallow unused eslint-disable comments
98
+ 'eslint-comments/no-unused-enable': 'error', // Disallow unused eslint-enable comments
99
+
100
+ // ============================================================================
101
+ // TypeScript Core Rules
102
+ // ============================================================================
103
+ '@typescript-eslint/ban-ts-ignore': 'off', // Allow @ts-ignore when needed
104
+ '@typescript-eslint/ban-ts-comment': 'off', // Allow @ts-expect-error with description
105
+
106
+ // Type Safety - Gradual adoption approach
107
+ '@typescript-eslint/no-explicit-any': 'warn', // Warn on 'any' usage (gradual improvement)
108
+ // Unused vars/imports - ERROR level since TypeScript's noUnusedLocals is disabled
109
+ // (TypeScript doesn't support per-file overrides, so ESLint handles this)
110
+ // Generated files are excluded via the ignores pattern and override section
111
+ '@typescript-eslint/no-unused-vars': [
112
+ 'error',
113
+ {
114
+ argsIgnorePattern: '^_',
115
+ varsIgnorePattern: '^_',
116
+ destructuredArrayIgnorePattern: '^_',
117
+ caughtErrorsIgnorePattern: '^_',
118
+ ignoreRestSiblings: true,
119
+ },
120
+ ],
121
+ '@typescript-eslint/explicit-function-return-type': [
122
+ 'warn',
123
+ {
124
+ allowExpressions: true,
125
+ allowTypedFunctionExpressions: true,
126
+ allowHigherOrderFunctions: true,
127
+ },
128
+ ],
129
+
130
+ // ============================================================================
131
+ // Async/Promise Handling - CRITICAL for backend reliability
132
+ // ============================================================================
133
+ '@typescript-eslint/no-floating-promises': 'error', // Prevent unhandled promises
134
+ '@typescript-eslint/no-misused-promises': 'error', // Prevent promises used in wrong contexts
135
+ '@typescript-eslint/await-thenable': 'error', // Ensure await is only used with promises
136
+ // Disable require-await - async functions without await are allowed for interface consistency,
137
+ // promise return types, and future async operations
138
+ '@typescript-eslint/require-await': 'off',
139
+ // Disable promise-function-async - produces numerous false positives on arrow functions
140
+ // in array methods that don't return promises (e.g., .map((x) => x.id), .filter((a) => a.tag))
141
+ // The rule incorrectly flags simple property access and synchronous operations as promise-returning
142
+ '@typescript-eslint/promise-function-async': 'off',
143
+ 'no-return-await': 'off', // Turned off in favor of @typescript-eslint version
144
+ '@typescript-eslint/return-await': 'error', // Enforce proper return await for try/catch
145
+
146
+ // ============================================================================
147
+ // Type Imports/Exports - Tree-shaking and performance
148
+ // ============================================================================
149
+ '@typescript-eslint/consistent-type-imports': [
150
+ 'error',
151
+ {
152
+ prefer: 'type-imports',
153
+ disallowTypeAnnotations: false, // Allow type imports in annotations
154
+ fixStyle: 'separate-type-imports',
155
+ },
156
+ ],
157
+ '@typescript-eslint/consistent-type-exports': 'error',
158
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
159
+
160
+ // Type safety rules with too many false positives - disabled for now
161
+ '@typescript-eslint/no-unsafe-assignment': 'off',
162
+ '@typescript-eslint/no-unsafe-call': 'off',
163
+ '@typescript-eslint/no-unsafe-member-access': 'off',
164
+ '@typescript-eslint/no-unsafe-return': 'off',
165
+ '@typescript-eslint/no-namespace': 'warn', // Warn on namespaces (occasionally needed for type augmentation)
166
+
167
+ // ============================================================================
168
+ // Import Organization - Code organization and circular dependency prevention
169
+ // ============================================================================
170
+ 'import/order': 'off', // Disabled in favor of Prettier plugin (@trivago/prettier-plugin-sort-imports)
171
+ 'import/no-duplicates': 'error', // Prevent duplicate imports
172
+ 'import/no-cycle': ['error', { maxDepth: 3 }], // Prevent circular dependencies
173
+ 'import/no-self-import': 'error', // Prevent self imports
174
+ 'import/first': 'error', // Imports should be at top of file
175
+ 'import/newline-after-import': 'error', // Blank line after imports
176
+
177
+ // ============================================================================
178
+ // Code Quality - General best practices
179
+ // ============================================================================
180
+ 'no-console': ['warn', { allow: ['warn', 'error', 'info'] }], // Warn on console.log
181
+ 'no-debugger': 'error', // Disallow debugger statements
182
+ 'prefer-const': 'error', // Prefer const over let
183
+ 'no-var': 'error', // Disallow var
184
+ eqeqeq: ['error', 'always', { null: 'ignore' }], // Require === and !==
185
+ 'no-throw-literal': 'error', // Disallow throwing literals
186
+ 'prefer-promise-reject-errors': 'error', // Reject with Error objects
187
+
188
+ // ============================================================================
189
+ // Error Handling - Production reliability (NEW in v1.1.0)
190
+ // ============================================================================
191
+ 'no-ex-assign': 'error', // Disallow reassigning exceptions
192
+ 'no-unsafe-finally': 'error', // Disallow unsafe returns in finally blocks
193
+ 'no-unreachable': 'error', // Disallow unreachable code
194
+ 'no-loss-of-precision': 'error', // Disallow number precision loss
195
+
196
+ // ============================================================================
197
+ // Performance - Backend optimization (NEW in v1.1.0)
198
+ // ============================================================================
199
+ // Disable no-await-in-loop globally - many sequential operations (transactions, batch processing)
200
+ // are intentionally using await in loops for data integrity and ordering
201
+ 'no-await-in-loop': 'off',
202
+ 'no-constant-condition': 'error', // Disallow constant conditions
203
+ 'no-dupe-else-if': 'error', // Disallow duplicate else-if conditions
204
+ 'no-duplicate-case': 'error', // Disallow duplicate case labels
205
+ 'no-empty': ['error', { allowEmptyCatch: false }], // Disallow empty blocks
206
+ 'no-extra-boolean-cast': 'error', // Disallow unnecessary boolean casts
207
+
208
+ // ============================================================================
209
+ // SonarJS Rules - Code complexity and quality
210
+ // ============================================================================
211
+ 'sonarjs/cognitive-complexity': ['warn', 25], // Warn on high complexity (25 is pragmatic)
212
+ 'sonarjs/no-dead-store': 'error', // Error on unused assignments (TypeScript noUnusedLocals disabled)
213
+ 'sonarjs/no-unused-vars': 'error', // Error on unused variables (TypeScript noUnusedLocals disabled)
214
+ 'sonarjs/unused-import': 'error', // Error on unused imports (TypeScript noUnusedLocals disabled)
215
+ 'sonarjs/no-duplicate-string': 'off', // Off for GraphQL/config strings
216
+ 'sonarjs/todo-tag': 'warn', // Warn on TODO comments
217
+ 'sonarjs/fixme-tag': 'off', // Allow FIXME for documented blockers
218
+ 'sonarjs/slow-regex': 'warn', // Warn on slow regex
219
+ 'sonarjs/pseudo-random': 'warn', // Warn on Math.random() for security
220
+ 'sonarjs/no-commented-code': 'warn', // Warn on commented code
221
+ 'sonarjs/redundant-type-aliases': 'off', // Too many false positives with generated types
222
+ 'sonarjs/no-invariant-returns': 'warn', // Warn on invariant returns
223
+ // Disable function-return-type - union return types and conditional returns are intentional
224
+ // design patterns (e.g., returning different types based on runtime conditions)
225
+ 'sonarjs/function-return-type': 'off',
226
+ 'sonarjs/different-types-comparison': 'warn', // Warn on comparing different types
227
+ 'sonarjs/deprecation': 'warn', // Warn on deprecated APIs
228
+ 'sonarjs/no-nested-conditional': 'warn', // Warn on nested conditionals
229
+ 'sonarjs/no-ignored-exceptions': 'warn', // Warn on ignored exceptions
230
+ 'sonarjs/no-small-switch': 'warn', // Warn on small switch statements
231
+ 'sonarjs/no-async-constructor': 'warn', // Warn on async constructors
232
+ 'sonarjs/no-control-regex': 'off', // Allow control characters in regex
233
+ 'no-control-regex': 'off', // Allow control characters in regex
234
+ 'sonarjs/class-name': 'off', // Allow underscores in generated types
235
+ // Disable sonarjs/encryption-secure-mode - false positive on cipher algorithm selection
236
+ 'sonarjs/encryption-secure-mode': 'off',
237
+ 'sonarjs/no-hardcoded-ip': 'off', // Allow hardcoded IPs for config
238
+ 'sonarjs/updated-loop-counter': 'warn', // Warn on loop counter updates
239
+ 'sonarjs/anchor-precedence': 'warn', // Warn on anchor precedence
240
+ 'sonarjs/void-use': 'off', // Allow void for ignoring promises
241
+
242
+ // ============================================================================
243
+ // Security Rules - Production security
244
+ // ============================================================================
245
+ 'security/detect-object-injection': 'off', // Too many false positives
246
+ // Other security rules are enabled via security.configs.recommended
247
+ },
248
+ },
249
+
250
+ // ============================================================================
251
+ // Override Rules for Test Files
252
+ // ============================================================================
253
+ {
254
+ files: [
255
+ '**/__tests__/**/*.ts',
256
+ '**/*.test.ts',
257
+ '**/*.spec.ts',
258
+ '**/*.integration.test.ts',
259
+ ],
260
+ rules: {
261
+ 'sonarjs/no-hardcoded-ip': 'off', // Test files can have hardcoded IPs
262
+ 'sonarjs/no-hardcoded-passwords': 'off', // Test files can have test passwords
263
+ 'no-control-regex': 'off', // Test files can have control chars in regex
264
+ 'sonarjs/no-control-regex': 'off', // Test files can have control chars
265
+ '@typescript-eslint/no-explicit-any': 'off', // Test files can use any
266
+ '@typescript-eslint/require-await': 'off', // Test setup functions often don't need await
267
+ '@typescript-eslint/no-misused-promises': 'off', // Test mocks properly handle async
268
+ 'sonarjs/no-nested-functions': 'off', // Test mocks often require nested functions
269
+ 'sonarjs/pseudo-random': 'off', // Test data generation can use Math.random()
270
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable in test files
271
+ 'no-await-in-loop': 'off', // Tests often need sequential async operations
272
+ },
273
+ },
274
+
275
+ // ============================================================================
276
+ // Override Rules for Cache/Storage Services
277
+ // ============================================================================
278
+ {
279
+ files: [
280
+ '**/cache/**/*.ts',
281
+ '**/storage/**/*.ts',
282
+ '**/services/cache/**/*.ts',
283
+ '**/services/storage/**/*.ts',
284
+ ],
285
+ rules: {
286
+ 'sonarjs/hashing': 'off', // MD5 for checksums/ETags is acceptable
287
+ 'sonarjs/publicly-writable-directories': 'off', // Temp directories are acceptable
288
+ 'security/detect-non-literal-fs-filename': 'off', // Storage services use dynamic paths
289
+ 'sonarjs/no-invariant-returns': 'off', // Interface implementations may require specific returns
290
+ 'sonarjs/cognitive-complexity': ['warn', 40], // Storage operations naturally complex
291
+ },
292
+ },
293
+
294
+ // ============================================================================
295
+ // Override Rules for Generated Type Files
296
+ // Generated files (codegen, prisma) have unused imports we cannot control
297
+ // ============================================================================
298
+ {
299
+ files: [
300
+ '**/types/**/*.ts',
301
+ '**/*.types.ts',
302
+ '**/generated/**/*.ts',
303
+ '**/*.generated.ts',
304
+ '**/mapper-models.ts', // Imports from generated Prisma types
305
+ '**/scalar-types.ts', // Scalar type definitions for codegen
306
+ ],
307
+ rules: {
308
+ 'sonarjs/class-name': 'off', // Generated types can have _ prefix
309
+ '@typescript-eslint/no-explicit-any': 'off', // Generated types can use any
310
+ '@typescript-eslint/explicit-function-return-type': 'off', // Generated types don't need explicit returns
311
+ // Disable unused vars/imports checks for generated files
312
+ '@typescript-eslint/no-unused-vars': 'off',
313
+ 'sonarjs/no-unused-vars': 'off',
314
+ 'sonarjs/unused-import': 'off',
315
+ 'sonarjs/no-dead-store': 'off',
316
+ },
317
+ },
318
+
319
+ // ============================================================================
320
+ // Override Rules for Adapter Files
321
+ // ============================================================================
322
+ {
323
+ files: ['**/adapters/**/*.ts', '**/*Adapter.ts'],
324
+ rules: {
325
+ 'sonarjs/function-return-type': 'off', // Adapters implement external API contracts
326
+ },
327
+ },
328
+
329
+ // ============================================================================
330
+ // Override Rules for Resolver Files (GraphQL)
331
+ // ============================================================================
332
+ {
333
+ files: ['**/resolvers/**/*.ts', '**/*.resolvers.ts'],
334
+ rules: {
335
+ 'sonarjs/function-return-type': 'off', // Resolvers implement GraphQL schema contracts
336
+ },
337
+ },
338
+
339
+ // ============================================================================
340
+ // Override Rules for Logger Transports (NEW in v1.1.0)
341
+ // Validated file paths from config, not user input
342
+ // ============================================================================
343
+ {
344
+ files: ['**/logger/**/transports.ts', '**/utils/logger/transports.ts'],
345
+ rules: {
346
+ 'security/detect-non-literal-fs-filename': 'off', // File paths validated in constructor
347
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe fs operations
348
+ },
349
+ },
350
+
351
+ // ============================================================================
352
+ // Override Rules for Export Services (NEW in v1.1.0)
353
+ // Validated export paths with security checks
354
+ // ============================================================================
355
+ {
356
+ files: [
357
+ '**/export/**/ExportFormatService.ts',
358
+ '**/modules/export/services/ExportFormatService.ts',
359
+ ],
360
+ rules: {
361
+ 'security/detect-non-literal-fs-filename': 'off', // Export paths validated before fs operations
362
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe export operations
363
+ },
364
+ },
365
+
366
+ // ============================================================================
367
+ // Override Rules for Services with Validated Dynamic RegExp (NEW in v1.1.0)
368
+ // RegExp patterns from validated application config, not user input
369
+ // ============================================================================
370
+ {
371
+ files: [
372
+ '**/TemplateService.ts',
373
+ '**/numberGenerator.ts',
374
+ '**/tags/services/validation.ts',
375
+ ],
376
+ rules: {
377
+ 'security/detect-non-literal-regexp': 'off', // RegExp from validated config with error handling
378
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe regex usage
379
+ },
380
+ },
381
+
382
+ // ============================================================================
383
+ // Override Rules for Report Generators (NEW in v1.1.0)
384
+ // Naturally high complexity due to Excel/PDF formatting
385
+ // ============================================================================
386
+ {
387
+ files: ['**/ExcelReportGenerator.ts', '**/PDFReportGenerator.ts', '**/ReportService.ts'],
388
+ rules: {
389
+ 'sonarjs/cognitive-complexity': ['warn', 35], // Allow higher complexity for report generation
390
+ },
391
+ },
392
+
393
+ // ============================================================================
394
+ // Override Rules for GraphQL Modules Namespace Augmentation (NEW in v1.1.0)
395
+ // Required by @graphql-modules for context type augmentation
396
+ // ============================================================================
397
+ {
398
+ files: ['**/modules/*/index.ts', '**/modules/*/declarations.ts'],
399
+ rules: {
400
+ '@typescript-eslint/no-namespace': 'off', // Namespace augmentation required for GraphQL Modules
401
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented namespace usage
402
+ },
403
+ },
404
+
405
+ // ============================================================================
406
+ // Override Rules for Prisma JSON Type Handling (NEW in v1.1.0)
407
+ // Prisma.JsonValue is a union type by design
408
+ // ============================================================================
409
+ {
410
+ files: ['**/inputValidators.ts', '**/*Validator.ts'],
411
+ rules: {
412
+ 'sonarjs/function-return-type': 'off', // Prisma.JsonValue is a union type by design
413
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented Prisma type usage
414
+ },
415
+ },
416
+
417
+ // ============================================================================
418
+ // Override Rules for SDK Core Implementation Files
419
+ // Allow eslint-disable for documented design decisions
420
+ // ============================================================================
421
+ {
422
+ files: [
423
+ '**/database/index.ts',
424
+ '**/middleware/security.ts',
425
+ '**/event-queue/implementations/**/*.ts',
426
+ '**/instrumentation/metrics-collector.ts',
427
+ ],
428
+ rules: {
429
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented design patterns
430
+ },
431
+ },
432
+
433
+ // ============================================================================
434
+ // Override Rules for I18n Translation Loader
435
+ // Validated file paths from config, not user input
436
+ // ============================================================================
437
+ {
438
+ files: ['**/i18n/loader.ts', '**/i18n/**/loader.ts'],
439
+ rules: {
440
+ 'security/detect-non-literal-fs-filename': 'off', // File paths validated before fs operations
441
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe fs operations
442
+ },
443
+ },
444
+
445
+ // ============================================================================
446
+ // Override Rules for Prisma Generator
447
+ // Validated output paths with security checks
448
+ // ============================================================================
449
+ {
450
+ files: ['**/prisma/generator/**/*.ts', '**/generator/index.ts'],
451
+ rules: {
452
+ 'security/detect-non-literal-fs-filename': 'off', // Output paths validated before fs operations
453
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe fs operations
454
+ },
455
+ },
456
+
457
+ // ============================================================================
458
+ // Override Rules for Translation Service with Dynamic RegExp
459
+ // RegExp patterns from validated translation config, not user input
460
+ // ============================================================================
461
+ {
462
+ files: ['**/translation/index.ts', '**/translation/**/index.ts'],
463
+ rules: {
464
+ 'security/detect-non-literal-regexp': 'off', // RegExp from validated translation patterns
465
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe regex usage
466
+ },
467
+ },
468
+
469
+ // ============================================================================
470
+ // Override Rules for Validation Utilities with Dynamic RegExp
471
+ // RegExp patterns from validated validation rules, not user input
472
+ // ============================================================================
473
+ {
474
+ files: ['**/utils/validation.ts', '**/utils/**/validation.ts'],
475
+ rules: {
476
+ 'security/detect-non-literal-regexp': 'off', // RegExp from validated validation rules
477
+ 'eslint-comments/no-use': 'off', // Allow eslint-disable for documented safe regex usage
478
+ },
479
+ },
480
+
481
+ // ============================================================================
482
+ // Override Rules for Server Backwards Compatibility
483
+ // IUser is deprecated in favor of IActor, but SDK maintains backwards compat
484
+ // ============================================================================
485
+ {
486
+ files: ['**/server/context.ts', '**/server/types.ts'],
487
+ rules: {
488
+ 'sonarjs/deprecation': 'off', // Intentional use of deprecated IUser for backwards compatibility
489
+ },
490
+ },
491
+ ];
492
+ }