@taruvi/sdk 1.5.0-beta.1 → 1.5.0-beta.2
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.
- package/README.md +58 -1295
- package/package.json +10 -2
- package/.claude/settings.local.json +0 -19
- package/.github/worflows/publish.yml +0 -57
- package/.github/workflows/publish.yml +0 -58
- package/.kiro/settings/lsp.json +0 -198
- package/MODULE_NAMING_CHANGES.md +0 -81
- package/PARAMETER_NAMING_CHANGES.md +0 -106
- package/USAGE_EXAMPLE.md +0 -86
- package/src/client.ts +0 -88
- package/src/index.ts +0 -51
- package/src/lib/analytics/AnalyticsClient.ts +0 -24
- package/src/lib/analytics/types.ts +0 -8
- package/src/lib/app/AppClient.ts +0 -54
- package/src/lib/app/types.ts +0 -50
- package/src/lib/auth/AuthClient.ts +0 -126
- package/src/lib/auth/types.ts +0 -123
- package/src/lib/database/DatabaseClient.ts +0 -306
- package/src/lib/database/types.ts +0 -156
- package/src/lib/functions/FunctionsClient.ts +0 -27
- package/src/lib/functions/types.ts +0 -27
- package/src/lib/policy/PolicyClient.ts +0 -79
- package/src/lib/policy/types.ts +0 -39
- package/src/lib/secrets/SecretsClient.ts +0 -75
- package/src/lib/secrets/types.ts +0 -59
- package/src/lib/settings/SettingsClient.ts +0 -22
- package/src/lib/settings/types.ts +0 -9
- package/src/lib/storage/StorageClient.ts +0 -131
- package/src/lib/storage/types.ts +0 -86
- package/src/lib/users/UserClient.ts +0 -63
- package/src/lib/users/types.ts +0 -123
- package/src/lib-internal/errors/ErrorClient.ts +0 -114
- package/src/lib-internal/errors/index.ts +0 -3
- package/src/lib-internal/errors/types.ts +0 -29
- package/src/lib-internal/http/HttpClient.ts +0 -116
- package/src/lib-internal/http/types.ts +0 -12
- package/src/lib-internal/routes/AnalyticsRoutes.ts +0 -3
- package/src/lib-internal/routes/AppRoutes.ts +0 -9
- package/src/lib-internal/routes/AuthRoutes.ts +0 -0
- package/src/lib-internal/routes/DatabaseRoutes.ts +0 -10
- package/src/lib-internal/routes/FunctionRoutes.ts +0 -3
- package/src/lib-internal/routes/PolicyRoutes.ts +0 -4
- package/src/lib-internal/routes/SecretsRoutes.ts +0 -5
- package/src/lib-internal/routes/SettingsRoutes.ts +0 -4
- package/src/lib-internal/routes/StorageRoutes.ts +0 -15
- package/src/lib-internal/routes/UserRoutes.ts +0 -12
- package/src/lib-internal/routes/index.ts +0 -0
- package/src/lib-internal/token/TokenClient.ts +0 -108
- package/src/lib-internal/token/types.ts +0 -0
- package/src/types.ts +0 -104
- package/src/utils/enums.ts +0 -24
- package/src/utils/utils.ts +0 -38
- package/tests/fixtures/mockClient.ts +0 -19
- package/tests/mocks/db.json +0 -1
- package/tests/unit/analytics/AnalyticsClient.test.ts +0 -84
- package/tests/unit/app/AppClient.test.ts +0 -114
- package/tests/unit/auth/AuthClient.test.ts +0 -91
- package/tests/unit/client/Client.test.ts +0 -87
- package/tests/unit/database/DatabaseClient.test.ts +0 -652
- package/tests/unit/edge-cases/robustness.test.ts +0 -258
- package/tests/unit/errors/errors.test.ts +0 -236
- package/tests/unit/functions/FunctionsClient.test.ts +0 -99
- package/tests/unit/policy/PolicyClient.test.ts +0 -180
- package/tests/unit/secrets/SecretsClient.test.ts +0 -146
- package/tests/unit/settings/SettingsClient.test.ts +0 -50
- package/tests/unit/storage/StorageClient.test.ts +0 -252
- package/tests/unit/users/UserClient.test.ts +0 -150
- package/tsconfig.json +0 -44
- package/vitest.config.ts +0 -7
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taruvi/sdk",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.2",
|
|
4
4
|
"description": "Taruvi SDK",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
7
8
|
"sideEffects": false,
|
|
8
9
|
"scripts": {
|
|
9
10
|
"build": "tsc",
|
|
10
11
|
"test": "vitest run",
|
|
11
12
|
"test:watch": "vitest"
|
|
12
13
|
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": ["dist", "README.md"],
|
|
13
21
|
"keywords": [
|
|
14
22
|
"taruvi",
|
|
15
23
|
"sdk",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(tree:*)",
|
|
5
|
-
"Bash(npm run build:*)",
|
|
6
|
-
"Bash(npm ls:*)",
|
|
7
|
-
"Bash(npm link:*)",
|
|
8
|
-
"Bash(npx --yes markdownlint-cli:*)",
|
|
9
|
-
"Bash(cat:*)",
|
|
10
|
-
"Bash(test:*)",
|
|
11
|
-
"Bash(ls:*)",
|
|
12
|
-
"WebFetch(domain:www.markdownpaste.com)",
|
|
13
|
-
"WebSearch",
|
|
14
|
-
"WebFetch(domain:supabase.com)"
|
|
15
|
-
],
|
|
16
|
-
"deny": [],
|
|
17
|
-
"ask": []
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main, beta]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
publish:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v4
|
|
12
|
-
with:
|
|
13
|
-
fetch-depth: 0
|
|
14
|
-
|
|
15
|
-
- uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: '20'
|
|
18
|
-
registry-url: 'https://registry.npmjs.org'
|
|
19
|
-
|
|
20
|
-
- name: Get secrets from Infisical
|
|
21
|
-
uses: Infisical/secrets-action@v1.0.7
|
|
22
|
-
with:
|
|
23
|
-
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
24
|
-
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
25
|
-
env-slug: taruvi-test
|
|
26
|
-
project-slug: taruvi-qmc-d
|
|
27
|
-
domain: "https://environment.eoxvantage.com"
|
|
28
|
-
|
|
29
|
-
- run: npm install
|
|
30
|
-
|
|
31
|
-
- run: npm test
|
|
32
|
-
|
|
33
|
-
- name: Check if version changed
|
|
34
|
-
id: version_check
|
|
35
|
-
run: |
|
|
36
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
37
|
-
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
38
|
-
|
|
39
|
-
if git tag | grep -q "^v${CURRENT_VERSION}$"; then
|
|
40
|
-
echo "changed=false" >> $GITHUB_OUTPUT
|
|
41
|
-
else
|
|
42
|
-
echo "changed=true" >> $GITHUB_OUTPUT
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
- name: Tag release
|
|
46
|
-
if: steps.version_check.outputs.changed == 'true'
|
|
47
|
-
run: |
|
|
48
|
-
git config user.name "github-actions[bot]"
|
|
49
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
50
|
-
git tag "v${{ steps.version_check.outputs.current_version }}"
|
|
51
|
-
git push origin "v${{ steps.version_check.outputs.current_version }}"
|
|
52
|
-
|
|
53
|
-
- name: Publish (main)
|
|
54
|
-
if: steps.version_check.outputs.changed == 'true'
|
|
55
|
-
run: npm publish --access public
|
|
56
|
-
env:
|
|
57
|
-
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main, beta]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: write
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
publish:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 0
|
|
17
|
-
|
|
18
|
-
- uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: '20'
|
|
21
|
-
registry-url: 'https://registry.npmjs.org'
|
|
22
|
-
|
|
23
|
-
- name: Get secrets from Infisical
|
|
24
|
-
uses: Infisical/secrets-action@v1.0.7
|
|
25
|
-
with:
|
|
26
|
-
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
27
|
-
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
28
|
-
env-slug: taruvi-test
|
|
29
|
-
project-slug: taruvi-qmc-d
|
|
30
|
-
domain: "https://environment.eoxvantage.com"
|
|
31
|
-
|
|
32
|
-
- run: npm install
|
|
33
|
-
|
|
34
|
-
- name: Check if version changed
|
|
35
|
-
id: version_check
|
|
36
|
-
run: |
|
|
37
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
38
|
-
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
39
|
-
|
|
40
|
-
if git tag | grep -q "^v${CURRENT_VERSION}$"; then
|
|
41
|
-
echo "changed=false" >> $GITHUB_OUTPUT
|
|
42
|
-
else
|
|
43
|
-
echo "changed=true" >> $GITHUB_OUTPUT
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
- name: Tag release
|
|
47
|
-
if: steps.version_check.outputs.changed == 'true'
|
|
48
|
-
run: |
|
|
49
|
-
git config user.name "github-actions[bot]"
|
|
50
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
51
|
-
git tag "v${{ steps.version_check.outputs.current_version }}"
|
|
52
|
-
git push origin "v${{ steps.version_check.outputs.current_version }}"
|
|
53
|
-
|
|
54
|
-
- name: Publish (beta)
|
|
55
|
-
if: steps.version_check.outputs.changed == 'true'
|
|
56
|
-
run: npm publish --access public --tag beta
|
|
57
|
-
env:
|
|
58
|
-
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
|
package/.kiro/settings/lsp.json
DELETED
|
@@ -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
|
-
}
|
package/MODULE_NAMING_CHANGES.md
DELETED
|
@@ -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
|
-
```
|