@taruvi/sdk 1.3.7 → 1.3.8

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.
@@ -0,0 +1,57 @@
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 }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taruvi/sdk",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Taruvi SDK",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -194,6 +194,22 @@ export class TokenClient {
194
194
  return parseInt(expiresAt) < Date.now()
195
195
  }
196
196
 
197
+ /**
198
+ * Set access token directly (e.g., from external storage)
199
+ */
200
+ setAccessToken(token: string): void {
201
+ if (this.browserRunTime) {
202
+ if (typeof window === 'undefined' || typeof localStorage === 'undefined') return
203
+ try {
204
+ localStorage.setItem(TokenClient.ACCESS_TOKEN_KEY, token)
205
+ } catch (err) {
206
+ console.error('Failed to set access token:', err)
207
+ }
208
+ } else {
209
+ this.serverToken = token
210
+ }
211
+ }
212
+
197
213
  /**
198
214
  * Update access token after refresh
199
215
  * ⚠️ IMPORTANT: Taruvi uses refresh token rotation