@taruvi/sdk 1.5.0 → 1.5.1-beta.4

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 (231) hide show
  1. package/README.md +60 -1289
  2. package/dist/client.d.ts +27 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/{src/client.ts → dist/client.js} +30 -48
  5. package/dist/client.js.map +1 -0
  6. package/dist/index.d.ts +28 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +20 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/lib/analytics/AnalyticsClient.d.ts +9 -0
  11. package/dist/lib/analytics/AnalyticsClient.d.ts.map +1 -0
  12. package/dist/lib/analytics/AnalyticsClient.js +17 -0
  13. package/dist/lib/analytics/AnalyticsClient.js.map +1 -0
  14. package/dist/lib/analytics/types.d.ts +6 -0
  15. package/dist/lib/analytics/types.d.ts.map +1 -0
  16. package/dist/lib/analytics/types.js +2 -0
  17. package/dist/lib/analytics/types.js.map +1 -0
  18. package/dist/lib/app/AppClient.d.ts +15 -0
  19. package/dist/lib/app/AppClient.d.ts.map +1 -0
  20. package/dist/lib/app/AppClient.js +41 -0
  21. package/dist/lib/app/AppClient.js.map +1 -0
  22. package/dist/lib/app/types.d.ts +41 -0
  23. package/dist/lib/app/types.d.ts.map +1 -0
  24. package/dist/lib/app/types.js +2 -0
  25. package/dist/lib/app/types.js.map +1 -0
  26. package/dist/lib/auth/AuthClient.d.ts +38 -0
  27. package/dist/lib/auth/AuthClient.d.ts.map +1 -0
  28. package/dist/lib/auth/AuthClient.js +105 -0
  29. package/dist/lib/auth/AuthClient.js.map +1 -0
  30. package/dist/lib/database/DatabaseClient.d.ts +76 -0
  31. package/dist/lib/database/DatabaseClient.d.ts.map +1 -0
  32. package/dist/lib/database/DatabaseClient.js +250 -0
  33. package/dist/lib/database/DatabaseClient.js.map +1 -0
  34. package/dist/lib/database/types.d.ts +66 -0
  35. package/dist/lib/database/types.d.ts.map +1 -0
  36. package/dist/lib/database/types.js +20 -0
  37. package/dist/lib/database/types.js.map +1 -0
  38. package/dist/lib/functions/FunctionsClient.d.ts +9 -0
  39. package/dist/lib/functions/FunctionsClient.d.ts.map +1 -0
  40. package/dist/lib/functions/FunctionsClient.js +20 -0
  41. package/dist/lib/functions/FunctionsClient.js.map +1 -0
  42. package/dist/lib/functions/types.d.ts +25 -0
  43. package/dist/lib/functions/types.d.ts.map +1 -0
  44. package/dist/lib/functions/types.js +2 -0
  45. package/dist/lib/functions/types.js.map +1 -0
  46. package/dist/lib/policy/PolicyClient.d.ts +25 -0
  47. package/dist/lib/policy/PolicyClient.d.ts.map +1 -0
  48. package/{src/lib/policy/PolicyClient.ts → dist/lib/policy/PolicyClient.js} +26 -40
  49. package/dist/lib/policy/PolicyClient.js.map +1 -0
  50. package/dist/lib/policy/types.d.ts +32 -0
  51. package/dist/lib/policy/types.d.ts.map +1 -0
  52. package/dist/lib/policy/types.js +2 -0
  53. package/dist/lib/policy/types.js.map +1 -0
  54. package/dist/lib/secrets/SecretsClient.d.ts +29 -0
  55. package/dist/lib/secrets/SecretsClient.d.ts.map +1 -0
  56. package/dist/lib/secrets/SecretsClient.js +66 -0
  57. package/dist/lib/secrets/SecretsClient.js.map +1 -0
  58. package/dist/lib/secrets/types.d.ts +43 -0
  59. package/dist/lib/secrets/types.d.ts.map +1 -0
  60. package/dist/lib/secrets/types.js +2 -0
  61. package/dist/lib/secrets/types.js.map +1 -0
  62. package/dist/lib/settings/SettingsClient.d.ts +9 -0
  63. package/dist/lib/settings/SettingsClient.d.ts.map +1 -0
  64. package/dist/lib/settings/SettingsClient.js +17 -0
  65. package/dist/lib/settings/SettingsClient.js.map +1 -0
  66. package/dist/lib/settings/types.d.ts +6 -0
  67. package/dist/lib/settings/types.d.ts.map +1 -0
  68. package/dist/lib/settings/types.js +2 -0
  69. package/dist/lib/settings/types.js.map +1 -0
  70. package/dist/lib/storage/StorageClient.d.ts +38 -0
  71. package/dist/lib/storage/StorageClient.d.ts.map +1 -0
  72. package/dist/lib/storage/StorageClient.js +102 -0
  73. package/dist/lib/storage/StorageClient.js.map +1 -0
  74. package/dist/lib/storage/types.d.ts +73 -0
  75. package/dist/lib/storage/types.d.ts.map +1 -0
  76. package/dist/lib/storage/types.js +2 -0
  77. package/dist/lib/storage/types.js.map +1 -0
  78. package/dist/lib/users/UserClient.d.ts +17 -0
  79. package/dist/lib/users/UserClient.d.ts.map +1 -0
  80. package/dist/lib/users/UserClient.js +40 -0
  81. package/dist/lib/users/UserClient.js.map +1 -0
  82. package/dist/lib/users/types.d.ts +108 -0
  83. package/dist/lib/users/types.d.ts.map +1 -0
  84. package/dist/lib/users/types.js +2 -0
  85. package/dist/lib/users/types.js.map +1 -0
  86. package/dist/lib-internal/errors/ErrorClient.d.ts +42 -0
  87. package/dist/lib-internal/errors/ErrorClient.d.ts.map +1 -0
  88. package/dist/lib-internal/errors/ErrorClient.js +102 -0
  89. package/dist/lib-internal/errors/ErrorClient.js.map +1 -0
  90. package/dist/lib-internal/errors/index.d.ts +4 -0
  91. package/dist/lib-internal/errors/index.d.ts.map +1 -0
  92. package/dist/lib-internal/errors/index.js +3 -0
  93. package/dist/lib-internal/errors/index.js.map +1 -0
  94. package/dist/lib-internal/errors/types.d.ts +29 -0
  95. package/dist/lib-internal/errors/types.d.ts.map +1 -0
  96. package/dist/lib-internal/errors/types.js +18 -0
  97. package/dist/lib-internal/errors/types.js.map +1 -0
  98. package/dist/lib-internal/http/HttpClient.d.ts +24 -0
  99. package/dist/lib-internal/http/HttpClient.d.ts.map +1 -0
  100. package/dist/lib-internal/http/HttpClient.js +103 -0
  101. package/dist/lib-internal/http/HttpClient.js.map +1 -0
  102. package/dist/lib-internal/http/types.d.ts +12 -0
  103. package/dist/lib-internal/http/types.d.ts.map +1 -0
  104. package/{src/lib-internal/http/types.ts → dist/lib-internal/http/types.js} +2 -3
  105. package/dist/lib-internal/http/types.js.map +1 -0
  106. package/dist/lib-internal/routes/AnalyticsRoutes.d.ts +4 -0
  107. package/dist/lib-internal/routes/AnalyticsRoutes.d.ts.map +1 -0
  108. package/dist/lib-internal/routes/AnalyticsRoutes.js +4 -0
  109. package/dist/lib-internal/routes/AnalyticsRoutes.js.map +1 -0
  110. package/dist/lib-internal/routes/AppRoutes.d.ts +10 -0
  111. package/dist/lib-internal/routes/AppRoutes.d.ts.map +1 -0
  112. package/dist/lib-internal/routes/AppRoutes.js +6 -0
  113. package/dist/lib-internal/routes/AppRoutes.js.map +1 -0
  114. package/dist/lib-internal/routes/AuthRoutes.d.ts +2 -0
  115. package/dist/lib-internal/routes/AuthRoutes.d.ts.map +1 -0
  116. package/dist/lib-internal/routes/AuthRoutes.js +2 -0
  117. package/dist/lib-internal/routes/AuthRoutes.js.map +1 -0
  118. package/dist/lib-internal/routes/DatabaseRoutes.d.ts +11 -0
  119. package/dist/lib-internal/routes/DatabaseRoutes.d.ts.map +1 -0
  120. package/dist/lib-internal/routes/DatabaseRoutes.js +7 -0
  121. package/dist/lib-internal/routes/DatabaseRoutes.js.map +1 -0
  122. package/dist/lib-internal/routes/FunctionRoutes.d.ts +4 -0
  123. package/dist/lib-internal/routes/FunctionRoutes.d.ts.map +1 -0
  124. package/dist/lib-internal/routes/FunctionRoutes.js +4 -0
  125. package/dist/lib-internal/routes/FunctionRoutes.js.map +1 -0
  126. package/dist/lib-internal/routes/PolicyRoutes.d.ts +5 -0
  127. package/dist/lib-internal/routes/PolicyRoutes.d.ts.map +1 -0
  128. package/dist/lib-internal/routes/PolicyRoutes.js +5 -0
  129. package/dist/lib-internal/routes/PolicyRoutes.js.map +1 -0
  130. package/dist/lib-internal/routes/SecretsRoutes.d.ts +6 -0
  131. package/dist/lib-internal/routes/SecretsRoutes.d.ts.map +1 -0
  132. package/dist/lib-internal/routes/SecretsRoutes.js +6 -0
  133. package/dist/lib-internal/routes/SecretsRoutes.js.map +1 -0
  134. package/dist/lib-internal/routes/SettingsRoutes.d.ts +5 -0
  135. package/dist/lib-internal/routes/SettingsRoutes.d.ts.map +1 -0
  136. package/{src/lib-internal/routes/SettingsRoutes.ts → dist/lib-internal/routes/SettingsRoutes.js} +2 -1
  137. package/dist/lib-internal/routes/SettingsRoutes.js.map +1 -0
  138. package/dist/lib-internal/routes/StorageRoutes.d.ts +11 -0
  139. package/dist/lib-internal/routes/StorageRoutes.d.ts.map +1 -0
  140. package/dist/lib-internal/routes/StorageRoutes.js +8 -0
  141. package/dist/lib-internal/routes/StorageRoutes.js.map +1 -0
  142. package/dist/lib-internal/routes/UserRoutes.d.ts +13 -0
  143. package/dist/lib-internal/routes/UserRoutes.d.ts.map +1 -0
  144. package/dist/lib-internal/routes/UserRoutes.js +13 -0
  145. package/dist/lib-internal/routes/UserRoutes.js.map +1 -0
  146. package/dist/lib-internal/routes/index.d.ts +2 -0
  147. package/dist/lib-internal/routes/index.d.ts.map +1 -0
  148. package/dist/lib-internal/routes/index.js +2 -0
  149. package/dist/lib-internal/routes/index.js.map +1 -0
  150. package/dist/lib-internal/token/TokenClient.d.ts +38 -0
  151. package/dist/lib-internal/token/TokenClient.d.ts.map +1 -0
  152. package/{src/lib-internal/token/TokenClient.ts → dist/lib-internal/token/TokenClient.js} +44 -59
  153. package/dist/lib-internal/token/TokenClient.js.map +1 -0
  154. package/dist/lib-internal/token/types.d.ts +2 -0
  155. package/dist/lib-internal/token/types.d.ts.map +1 -0
  156. package/dist/lib-internal/token/types.js +2 -0
  157. package/dist/lib-internal/token/types.js.map +1 -0
  158. package/dist/types.d.ts +74 -0
  159. package/dist/types.d.ts.map +1 -0
  160. package/dist/types.js +2 -0
  161. package/dist/types.js.map +1 -0
  162. package/dist/utils/enums.d.ts +31 -0
  163. package/dist/utils/enums.d.ts.map +1 -0
  164. package/dist/utils/enums.js +26 -0
  165. package/dist/utils/enums.js.map +1 -0
  166. package/dist/utils/utils.d.ts +6 -0
  167. package/dist/utils/utils.d.ts.map +1 -0
  168. package/dist/utils/utils.js +38 -0
  169. package/dist/utils/utils.js.map +1 -0
  170. package/package.json +11 -2
  171. package/.github/worflows/publish.yml +0 -57
  172. package/.github/workflows/publish.yml +0 -58
  173. package/.kiro/settings/lsp.json +0 -198
  174. package/MODULE_NAMING_CHANGES.md +0 -81
  175. package/PARAMETER_NAMING_CHANGES.md +0 -106
  176. package/USAGE_EXAMPLE.md +0 -86
  177. package/src/index.ts +0 -50
  178. package/src/lib/analytics/AnalyticsClient.ts +0 -24
  179. package/src/lib/analytics/types.ts +0 -8
  180. package/src/lib/app/AppClient.ts +0 -54
  181. package/src/lib/app/types.ts +0 -50
  182. package/src/lib/auth/AuthClient.ts +0 -148
  183. package/src/lib/auth/types.ts +0 -123
  184. package/src/lib/database/DatabaseClient.ts +0 -244
  185. package/src/lib/database/types.ts +0 -90
  186. package/src/lib/functions/FunctionsClient.ts +0 -27
  187. package/src/lib/functions/types.ts +0 -27
  188. package/src/lib/policy/types.ts +0 -39
  189. package/src/lib/secrets/SecretsClient.ts +0 -75
  190. package/src/lib/secrets/types.ts +0 -59
  191. package/src/lib/settings/SettingsClient.ts +0 -22
  192. package/src/lib/settings/types.ts +0 -9
  193. package/src/lib/storage/StorageClient.ts +0 -131
  194. package/src/lib/storage/types.ts +0 -86
  195. package/src/lib/users/UserClient.ts +0 -63
  196. package/src/lib/users/types.ts +0 -123
  197. package/src/lib-internal/errors/ErrorClient.ts +0 -114
  198. package/src/lib-internal/errors/index.ts +0 -3
  199. package/src/lib-internal/errors/types.ts +0 -29
  200. package/src/lib-internal/http/HttpClient.ts +0 -117
  201. package/src/lib-internal/routes/AnalyticsRoutes.ts +0 -3
  202. package/src/lib-internal/routes/AppRoutes.ts +0 -9
  203. package/src/lib-internal/routes/AuthRoutes.ts +0 -3
  204. package/src/lib-internal/routes/DatabaseRoutes.ts +0 -10
  205. package/src/lib-internal/routes/FunctionRoutes.ts +0 -3
  206. package/src/lib-internal/routes/PolicyRoutes.ts +0 -4
  207. package/src/lib-internal/routes/SecretsRoutes.ts +0 -5
  208. package/src/lib-internal/routes/StorageRoutes.ts +0 -15
  209. package/src/lib-internal/routes/UserRoutes.ts +0 -12
  210. package/src/lib-internal/routes/index.ts +0 -0
  211. package/src/lib-internal/token/types.ts +0 -0
  212. package/src/types.ts +0 -98
  213. package/src/utils/enums.ts +0 -24
  214. package/src/utils/utils.ts +0 -37
  215. package/tests/fixtures/mockClient.ts +0 -19
  216. package/tests/mocks/db.json +0 -1
  217. package/tests/unit/analytics/AnalyticsClient.test.ts +0 -84
  218. package/tests/unit/app/AppClient.test.ts +0 -114
  219. package/tests/unit/auth/AuthClient.test.ts +0 -91
  220. package/tests/unit/client/Client.test.ts +0 -87
  221. package/tests/unit/database/DatabaseClient.test.ts +0 -565
  222. package/tests/unit/edge-cases/robustness.test.ts +0 -258
  223. package/tests/unit/errors/errors.test.ts +0 -236
  224. package/tests/unit/functions/FunctionsClient.test.ts +0 -99
  225. package/tests/unit/policy/PolicyClient.test.ts +0 -180
  226. package/tests/unit/secrets/SecretsClient.test.ts +0 -146
  227. package/tests/unit/settings/SettingsClient.test.ts +0 -50
  228. package/tests/unit/storage/StorageClient.test.ts +0 -252
  229. package/tests/unit/users/UserClient.test.ts +0 -150
  230. package/tsconfig.json +0 -44
  231. package/vitest.config.ts +0 -7
@@ -1,198 +0,0 @@
1
- {
2
- "languages": {
3
- "java": {
4
- "name": "jdtls",
5
- "command": "jdtls",
6
- "args": [],
7
- "file_extensions": [
8
- "java"
9
- ],
10
- "project_patterns": [
11
- "pom.xml",
12
- "build.gradle",
13
- "build.gradle.kts",
14
- ".project"
15
- ],
16
- "exclude_patterns": [
17
- "**/target/**",
18
- "**/build/**",
19
- "**/.gradle/**"
20
- ],
21
- "multi_workspace": false,
22
- "initialization_options": {
23
- "settings": {
24
- "java": {
25
- "compile": {
26
- "nullAnalysis": {
27
- "mode": "automatic"
28
- }
29
- },
30
- "configuration": {
31
- "annotationProcessing": {
32
- "enabled": true
33
- }
34
- }
35
- }
36
- }
37
- },
38
- "request_timeout_secs": 60
39
- },
40
- "cpp": {
41
- "name": "clangd",
42
- "command": "clangd",
43
- "args": [
44
- "--background-index"
45
- ],
46
- "file_extensions": [
47
- "cpp",
48
- "cc",
49
- "cxx",
50
- "c",
51
- "h",
52
- "hpp",
53
- "hxx"
54
- ],
55
- "project_patterns": [
56
- "CMakeLists.txt",
57
- "compile_commands.json",
58
- "Makefile"
59
- ],
60
- "exclude_patterns": [
61
- "**/build/**",
62
- "**/cmake-build-**/**"
63
- ],
64
- "multi_workspace": false,
65
- "initialization_options": {},
66
- "request_timeout_secs": 60
67
- },
68
- "go": {
69
- "name": "gopls",
70
- "command": "gopls",
71
- "args": [],
72
- "file_extensions": [
73
- "go"
74
- ],
75
- "project_patterns": [
76
- "go.mod",
77
- "go.sum"
78
- ],
79
- "exclude_patterns": [
80
- "**/vendor/**"
81
- ],
82
- "multi_workspace": false,
83
- "initialization_options": {
84
- "usePlaceholders": true,
85
- "completeUnimported": true
86
- },
87
- "request_timeout_secs": 60
88
- },
89
- "python": {
90
- "name": "pyright",
91
- "command": "pyright-langserver",
92
- "args": [
93
- "--stdio"
94
- ],
95
- "file_extensions": [
96
- "py"
97
- ],
98
- "project_patterns": [
99
- "pyproject.toml",
100
- "setup.py",
101
- "requirements.txt",
102
- "pyrightconfig.json"
103
- ],
104
- "exclude_patterns": [
105
- "**/__pycache__/**",
106
- "**/venv/**",
107
- "**/.venv/**",
108
- "**/.pytest_cache/**"
109
- ],
110
- "multi_workspace": false,
111
- "initialization_options": {},
112
- "request_timeout_secs": 60
113
- },
114
- "rust": {
115
- "name": "rust-analyzer",
116
- "command": "rust-analyzer",
117
- "args": [],
118
- "file_extensions": [
119
- "rs"
120
- ],
121
- "project_patterns": [
122
- "Cargo.toml"
123
- ],
124
- "exclude_patterns": [
125
- "**/target/**"
126
- ],
127
- "multi_workspace": false,
128
- "initialization_options": {
129
- "cargo": {
130
- "buildScripts": {
131
- "enable": true
132
- }
133
- },
134
- "diagnostics": {
135
- "enable": true,
136
- "enableExperimental": true
137
- },
138
- "workspace": {
139
- "symbol": {
140
- "search": {
141
- "scope": "workspace"
142
- }
143
- }
144
- }
145
- },
146
- "request_timeout_secs": 60
147
- },
148
- "typescript": {
149
- "name": "typescript-language-server",
150
- "command": "typescript-language-server",
151
- "args": [
152
- "--stdio"
153
- ],
154
- "file_extensions": [
155
- "ts",
156
- "js",
157
- "tsx",
158
- "jsx"
159
- ],
160
- "project_patterns": [
161
- "package.json",
162
- "tsconfig.json"
163
- ],
164
- "exclude_patterns": [
165
- "**/node_modules/**",
166
- "**/dist/**"
167
- ],
168
- "multi_workspace": false,
169
- "initialization_options": {
170
- "preferences": {
171
- "disableSuggestions": false
172
- }
173
- },
174
- "request_timeout_secs": 60
175
- },
176
- "ruby": {
177
- "name": "solargraph",
178
- "command": "solargraph",
179
- "args": [
180
- "stdio"
181
- ],
182
- "file_extensions": [
183
- "rb"
184
- ],
185
- "project_patterns": [
186
- "Gemfile",
187
- "Rakefile"
188
- ],
189
- "exclude_patterns": [
190
- "**/vendor/**",
191
- "**/tmp/**"
192
- ],
193
- "multi_workspace": false,
194
- "initialization_options": {},
195
- "request_timeout_secs": 60
196
- }
197
- }
198
- }
@@ -1,81 +0,0 @@
1
- # Module Naming Convention Changes - Completed
2
-
3
- **Date**: 2026-01-22
4
- **Status**: ✅ Completed
5
-
6
- ## Changes Made
7
-
8
- ### Folder Renaming
9
-
10
- All module folders in `src/lib/` have been renamed to lowercase and pluralized where appropriate:
11
-
12
- | Old Name | New Name | Change Type |
13
- |----------|----------|-------------|
14
- | `Analytics/` | `analytics/` | Lowercase |
15
- | `App/` | `app/` | Lowercase |
16
- | `auth/` | `auth/` | ✓ Already correct |
17
- | `Database/` | `database/` | Lowercase |
18
- | `Function/` | `functions/` | Lowercase + Plural |
19
- | `Policy/` | `policy/` | Lowercase |
20
- | `Secrets/` | `secrets/` | Lowercase |
21
- | `Settings/` | `settings/` | Lowercase |
22
- | `Storage/` | `storage/` | Lowercase |
23
- | `user/` | `users/` | Plural |
24
-
25
- ### Files Updated
26
-
27
- 1. **src/index.ts** - Updated all import paths to reflect new folder names
28
-
29
- ### Build Status
30
-
31
- ✅ TypeScript compilation successful
32
- ✅ No errors or warnings
33
-
34
- ## Benefits
35
-
36
- 1. **Consistency** - All module folders now follow lowercase naming
37
- 2. **Alignment** - Matches Python SDK naming conventions
38
- 3. **Clarity** - Plural names (`users`, `functions`) match REST conventions
39
- 4. **Maintainability** - Easier to navigate and understand structure
40
-
41
- ## Next Steps
42
-
43
- As per the SDK Alignment Analysis, the next priorities are:
44
-
45
- 1. ✅ **Module naming** - COMPLETED
46
- 2. ⏭️ Add direct CRUD methods to Database module
47
- 3. ⏭️ Remove `.execute()` requirement from Storage
48
- 4. ⏭️ Add missing methods to Functions module
49
- 5. ⏭️ Implement AuthManager pattern
50
-
51
- ## Breaking Changes
52
-
53
- ⚠️ **This is a breaking change for existing users**
54
-
55
- Users will need to update their imports:
56
-
57
- ```typescript
58
- // Old imports (will break)
59
- import { User } from '@taruvi/sdk'
60
- import { Functions } from '@taruvi/sdk'
61
-
62
- // New imports (correct)
63
- import { User } from '@taruvi/sdk' // Still works - export name unchanged
64
- import { Functions } from '@taruvi/sdk' // Still works - export name unchanged
65
- ```
66
-
67
- **Note**: The exported class names remain unchanged (`User`, `Functions`, etc.), only the internal folder structure changed. This means existing code will continue to work without modifications.
68
-
69
- ## Verification
70
-
71
- ```bash
72
- # Build successful
73
- npm run build
74
- # ✓ No errors
75
-
76
- # Folder structure
77
- ls src/lib/
78
- # analytics app auth database functions policy secrets settings storage users
79
- ```
80
-
81
- All folders now follow consistent lowercase naming conventions! 🎉
@@ -1,106 +0,0 @@
1
- # Parameter Naming Change: baseUrl → apiUrl
2
-
3
- **Date**: 2026-01-22
4
- **Status**: ✅ Completed
5
-
6
- ## Changes Made
7
-
8
- ### Type Definitions
9
-
10
- **File**: `src/types.ts`
11
- - Changed `baseUrl: string` → `apiUrl: string`
12
- - Updated comment: "Base API URL"
13
-
14
- ### Client Constructor
15
-
16
- **File**: `src/client.ts`
17
- - Updated validation: `config.baseUrl` → `config.apiUrl`
18
- - Updated error message: "Base URL is required" → "API URL is required"
19
-
20
- ### HTTP Client
21
-
22
- **File**: `src/lib-internal/http/HttpClient.ts`
23
- - Updated all HTTP methods to use `config.apiUrl` instead of `config.baseUrl`:
24
- - `get()` method
25
- - `post()` method
26
- - `put()` method
27
- - `delete()` method
28
- - `patch()` method
29
-
30
- ### Auth Client
31
-
32
- **File**: `src/lib/auth/AuthClient.ts`
33
- - Updated `login()`: `config.deskUrl || config.baseUrl` → `config.deskUrl || config.apiUrl`
34
- - Updated `signup()`: `config.baseUrl` → `config.apiUrl`
35
- - Updated `logout()`: `config.deskUrl || config.baseUrl` → `config.deskUrl || config.apiUrl`
36
- - Updated `refreshAccessToken()`: `config.baseUrl` → `config.apiUrl`
37
-
38
- ### Documentation
39
-
40
- **File**: `README.md`
41
- - Updated all examples: `baseUrl:` → `apiUrl:`
42
- - Updated environment variable: `VITE_TARUVI_BASE_URL` → `VITE_TARUVI_API_URL`
43
-
44
- ## Build Status
45
-
46
- ✅ TypeScript compilation successful
47
- ✅ No errors or warnings
48
-
49
- ## Alignment with Python SDK
50
-
51
- This change aligns the JavaScript SDK with the Python SDK naming convention:
52
-
53
- **Python SDK**:
54
- ```python
55
- client = Client(
56
- api_url="https://api.taruvi.cloud",
57
- app_slug="my-app"
58
- )
59
- ```
60
-
61
- **JavaScript SDK** (now aligned):
62
- ```typescript
63
- const client = new Client({
64
- apiUrl: "https://api.taruvi.cloud",
65
- appSlug: "my-app",
66
- apiKey: "your-api-key"
67
- })
68
- ```
69
-
70
- ## Breaking Change
71
-
72
- ⚠️ **This is a breaking change**
73
-
74
- Users must update their configuration:
75
-
76
- ```typescript
77
- // ❌ Old (will break)
78
- const client = new Client({
79
- baseUrl: "https://api.taruvi.cloud",
80
- appSlug: "my-app",
81
- apiKey: "key"
82
- })
83
-
84
- // ✅ New (correct)
85
- const client = new Client({
86
- apiUrl: "https://api.taruvi.cloud",
87
- appSlug: "my-app",
88
- apiKey: "key"
89
- })
90
- ```
91
-
92
- ## Migration Guide
93
-
94
- 1. Find all `baseUrl` references in your code
95
- 2. Replace with `apiUrl`
96
- 3. Update environment variables: `VITE_TARUVI_BASE_URL` → `VITE_TARUVI_API_URL`
97
-
98
- ## Next Steps
99
-
100
- As per the SDK Alignment Analysis:
101
-
102
- 1. ✅ Module naming - COMPLETED
103
- 2. ✅ Parameter naming (baseUrl → apiUrl) - COMPLETED
104
- 3. ⏭️ Add direct CRUD methods to Database module
105
- 4. ⏭️ Remove `.execute()` requirement from Storage
106
- 5. ⏭️ Add missing methods to Functions module
package/USAGE_EXAMPLE.md DELETED
@@ -1,86 +0,0 @@
1
- # Taruvi SDK - Usage Example
2
-
3
- ## New Pattern: Dependency Injection (No Singleton)
4
-
5
- ### Basic Usage
6
-
7
- ```typescript
8
- import { Client, Auth, User, Database } from '@taruvi/sdk'
9
-
10
- // 1. Create the main client (can create multiple instances)
11
- const client = new Client({
12
- apiKey: 'your-site-key',
13
- appSlug: 'my-app',
14
- baseUrl: 'https://api.taruvi.com',
15
- token: 'optional-initial-token' // optional
16
- })
17
-
18
- // 2. Create only the clients you need (lazy initialization)
19
- const auth = new Auth(client)
20
- const user = new User(client)
21
- const database = new Database(client)
22
-
23
- // 3. Use the clients
24
- if (auth.isUserAuthenticated()) {
25
- console.log('User is authenticated')
26
- }
27
-
28
- const token = auth.signInWithSSO()
29
- console.log('Token:', token)
30
-
31
- const userDetails = user.getUser()
32
- console.log('User:', userDetails)
33
-
34
- // Access token via User
35
- console.log('Current token:', user.token)
36
- ```
37
-
38
- ### Multiple Instances
39
-
40
- You can now create multiple instances for different environments or configs:
41
-
42
- ```typescript
43
- const prodClient = new Client({
44
- apiKey: 'prod-key',
45
- appSlug: 'main-app',
46
- baseUrl: 'https://api.taruvi.com'
47
- })
48
-
49
- const devClient = new Client({
50
- apiKey: 'dev-key',
51
- appSlug: 'dev-app',
52
- baseUrl: 'https://dev-api.taruvi.com'
53
- })
54
-
55
- const prodAuth = new Auth(prodClient)
56
- const devAuth = new Auth(devClient)
57
- ```
58
-
59
- ### Benefits
60
-
61
- ✅ **No singleton** - Multiple instances possible
62
- ✅ **Lazy initialization** - Only create clients you need
63
- ✅ **Better testability** - Easy to mock and test
64
- ✅ **Explicit dependencies** - Clear what each client needs
65
- ✅ **No global state** - No hidden global `taruvi` variable
66
- ✅ **Tree-shakable** - Only bundle what you use
67
-
68
- ### Internal Architecture
69
-
70
- The `taruvi` variable is no longer exported. Internal clients like `httpClient` and `tokenClient` are accessible only within the SDK through the `Client` instance passed to each client.
71
-
72
- ```typescript
73
- // Inside Auth
74
- export class Auth {
75
- private client: Client
76
-
77
- constructor(client: Client) {
78
- this.client = client
79
- }
80
-
81
- isUserAuthenticated(): boolean {
82
- // Access internal tokenClient through the client instance
83
- return !!this.client.tokenClient.getToken()
84
- }
85
- }
86
- ```
package/src/index.ts DELETED
@@ -1,50 +0,0 @@
1
- // Export main client
2
- export { Client } from "./client.js"
3
-
4
- // Export error classes
5
- export { TaruviError, ValidationError, AuthError, ForbiddenError, NotFoundError, ConflictError, TimeoutError, NetworkError, RateLimitError } from "./lib-internal/errors/index.js"
6
- export { ErrorCode } from "./lib-internal/errors/index.js"
7
- export type { ErrorResponseBody } from "./lib-internal/errors/index.js"
8
-
9
- // Export public client classes
10
- export { Auth } from "./lib/auth/AuthClient.js"
11
- export { User } from "./lib/users/UserClient.js"
12
- export { Storage } from "./lib/storage/StorageClient.js"
13
- export { Database } from "./lib/database/DatabaseClient.js"
14
- export { Settings } from "./lib/settings/SettingsClient.js"
15
- export { Functions } from "./lib/functions/FunctionsClient.js"
16
- export { Secrets } from "./lib/secrets/SecretsClient.js"
17
- export { Policy } from "./lib/policy/PolicyClient.js"
18
- export { App } from "./lib/app/AppClient.js"
19
- export { Analytics } from "./lib/analytics/AnalyticsClient.js"
20
-
21
- // Export core types
22
- export type { TaruviConfig, TaruviResponse, PaginationInfo, StorageFilters, DatabaseFilters } from "./types.js"
23
- export type { AuthTokens } from "./lib-internal/token/TokenClient.js"
24
-
25
- // User types
26
- export type { UserCreateRequest, UserData, UserUpdateRequest, UserListFilters, UserApp, UserResponse, UserListResponse, UserAppsResponse, AssignRolesRequest, RevokeRolesRequest, RolesResponse, UserGroup, UserPermission, UserRole, UserPreferences, UserPreferencesUpdate, UserPreferencesResponse } from "./lib/users/types.js"
27
-
28
- // Policy types
29
- export type { Principal, Resource, Resources, PolicyCheckResult, PolicyCheckBatchResult, ResourceCheckResponse, GetAllowedActionsOptions } from "./lib/policy/types.js"
30
-
31
- // App types
32
- export type { RoleData, AppSettingsData, RoleResponse, RolesListResponse, AppSettingsResponse } from "./lib/app/types.js"
33
-
34
- // Function types
35
- export type { FunctionRequest, FunctionResponse, FunctionInvocation } from "./lib/functions/types.js"
36
-
37
- // Database types
38
- export type { DatabaseRequest, DatabaseResponse, DatabaseSingleResponse, FilterOperator, SortOrder, GraphInclude, GraphFormat, EdgeRequest, EdgeResponse, EdgeDeleteRequest } from "./lib/database/types.js"
39
-
40
- // Storage types
41
- export type { StorageRequest, StorageUpdateRequest, StorageObject, StorageResponse, StorageListResponse, StorageUploadBatchResponse, StorageDeleteBatchResponse } from "./lib/storage/types.js"
42
-
43
- // Settings types
44
- export type { SiteSettingsData, SettingsResponse } from "./lib/settings/types.js"
45
-
46
- // Secrets types
47
- export type { SecretCreateRequest, SecretUpdateRequest, SecretData, SecretResponse, SecretsListResponse, SecretsBatchResponse, SecretsBatchMetadataResponse, GetSecretOptions, GetSecretsOptions } from "./lib/secrets/types.js"
48
-
49
- // Analytics types
50
- export type { AnalyticsRequest, AnalyticsResponse } from "./lib/analytics/types.js"
@@ -1,24 +0,0 @@
1
- import type { Client } from "../../client.js";
2
- import type { TaruviConfig } from "../../types.js";
3
- import type { AnalyticsRequest, AnalyticsResponse } from "./types.js";
4
- import { AnalyticsRoutes } from "../../lib-internal/routes/AnalyticsRoutes.js";
5
-
6
- export class Analytics {
7
- private client: Client
8
- private config: TaruviConfig
9
-
10
- constructor(client: Client) {
11
- this.client = client
12
- this.config = this.client.getConfig()
13
- }
14
-
15
- async execute<T = unknown>(querySlug: string, options: AnalyticsRequest = {}): Promise<AnalyticsResponse<T>> {
16
- const url = AnalyticsRoutes.baseUrl(this.config.appSlug, querySlug)
17
-
18
- const body = {
19
- params: options.params || {}
20
- }
21
-
22
- return await this.client.httpClient.post<AnalyticsResponse<T>>(url, body)
23
- }
24
- }
@@ -1,8 +0,0 @@
1
- import type { TaruviResponse } from "../../types.js"
2
-
3
- export interface AnalyticsRequest {
4
- params?: Record<string, unknown>
5
- }
6
-
7
- // Response type - uses standard wrapper
8
- export type AnalyticsResponse<T = unknown> = TaruviResponse<T>
@@ -1,54 +0,0 @@
1
- import type { Client } from "../../client.js";
2
- import { AppRoutes, type AppRouteKey } from "../../lib-internal/routes/AppRoutes.js";
3
- import { HttpMethod } from "../../lib-internal/http/types.js";
4
- import type { TaruviConfig } from "../../types.js";
5
- import type { UrlParams } from "./types.js";
6
-
7
- export class App {
8
- private client: Client
9
- private urlParams: UrlParams
10
- private config: TaruviConfig
11
- private operation: HttpMethod | undefined
12
-
13
- constructor(client: Client, urlParams: UrlParams = {}, operation?: HttpMethod | undefined) {
14
- this.client = client
15
- this.urlParams = urlParams
16
- this.operation = operation
17
- this.config = this.client.getConfig()
18
- }
19
-
20
- roles() {
21
- return new App(this.client, { ...this.urlParams, roles: "roles" }, HttpMethod.GET)
22
- }
23
-
24
- settings() {
25
- return new App(this.client, {...this.urlParams, settings: "settings"}, HttpMethod.GET)
26
- }
27
-
28
- private buildRoute(): string {
29
- return (
30
- AppRoutes.baseUrl(this.config.appSlug) +
31
- (Object.keys(this.urlParams) as AppRouteKey[]).reduce((acc, key) => {
32
- const value = this.urlParams[key]
33
- const routeBuilder = AppRoutes[key]
34
-
35
- if (value && routeBuilder) {
36
- acc += routeBuilder()
37
- }
38
-
39
- return acc
40
- }, "")
41
- )
42
- }
43
-
44
- async execute() {
45
- const url = this.buildRoute()
46
- const operation = this.operation || HttpMethod.GET
47
-
48
- switch (operation) {
49
- case HttpMethod.GET:
50
- default:
51
- return await this.client.httpClient.get(url)
52
- }
53
- }
54
- }
@@ -1,50 +0,0 @@
1
- import type { Client } from "../../client.js"
2
- import { HttpMethod } from "../../lib-internal/http/types.js"
3
- import type { TaruviResponse } from "../../types.js"
4
-
5
- export type AppOperation = HttpMethod
6
-
7
- // Internal types
8
- export interface UrlParams {
9
- appSlug?: string
10
- roles?: string
11
- settings?: string
12
- }
13
-
14
- export interface AppClientInterface {
15
- client: Client
16
- urlParams?: UrlParams
17
- }
18
-
19
- // Role data
20
- export interface RoleData {
21
- id: string | number
22
- name: string
23
- slug: string
24
- description?: string
25
- permissions?: string[]
26
- created_at?: string
27
- updated_at?: string
28
- }
29
-
30
- // App settings data
31
- export interface AppSettingsData {
32
- display_name: string
33
- icon: string | null
34
- icon_url: string | null
35
- primary_color: string
36
- secondary_color: string
37
- banner_image: string | null
38
- banner_image_url: string | null
39
- category: string
40
- documentation_url: string | null
41
- support_email: string | null
42
- default_frontend_worker_url: string | null
43
- created_at: string
44
- updated_at: string
45
- }
46
-
47
- // Response types - uses standard wrapper
48
- export type RoleResponse = TaruviResponse<RoleData>
49
- export type RolesListResponse = TaruviResponse<RoleData[]>
50
- export type AppSettingsResponse = TaruviResponse<AppSettingsData>