arky-sdk 0.3.157 → 0.3.159

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/dist/index.cjs CHANGED
@@ -260,6 +260,21 @@ var createAuthApi = (apiConfig) => {
260
260
  async session(options) {
261
261
  return apiConfig.httpClient.post("/v1/auth/session", {}, options);
262
262
  },
263
+ /**
264
+ * Sign in anonymously (creates guest session if not already authenticated)
265
+ * Following Firebase/Supabase pattern - idempotent, safe to call multiple times
266
+ */
267
+ async signInAnonymously(options) {
268
+ const tokens = await apiConfig.getToken();
269
+ if (tokens?.accessToken) {
270
+ return tokens;
271
+ }
272
+ const result = await apiConfig.httpClient.post("/v1/auth/session", {}, options);
273
+ if (result?.accessToken) {
274
+ apiConfig.setToken(result);
275
+ }
276
+ return result;
277
+ },
263
278
  // ==================== PLATFORM AUTH (Admin) ====================
264
279
  /**
265
280
  * Request platform auth code (Arky admin)
@@ -1938,7 +1953,7 @@ function nameToKey(name) {
1938
1953
  }
1939
1954
 
1940
1955
  // src/index.ts
1941
- var SDK_VERSION = "0.3.156";
1956
+ var SDK_VERSION = "0.3.158";
1942
1957
  var SUPPORTED_FRAMEWORKS = [
1943
1958
  "astro",
1944
1959
  "react",
@@ -1960,20 +1975,6 @@ async function createArkySDK(config) {
1960
1975
  };
1961
1976
  const accountApi = createAccountApi(apiConfig);
1962
1977
  const authApi = createAuthApi(apiConfig);
1963
- const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
1964
- if (autoGuest) {
1965
- try {
1966
- const tokens = await config.getToken();
1967
- if (!tokens.accessToken && !tokens.refreshToken) {
1968
- const result = await httpClient.post("/v1/auth/session", {});
1969
- const token = result.accessToken || result.token || "";
1970
- if (token) {
1971
- config.setToken(result);
1972
- }
1973
- }
1974
- } catch (error) {
1975
- }
1976
- }
1977
1978
  const sdk = {
1978
1979
  auth: authApi,
1979
1980
  account: accountApi,