@neetru/sdk 3.1.13 → 3.1.14

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 (67) hide show
  1. package/dist/ai.cjs.map +1 -1
  2. package/dist/ai.d.cts +1 -1
  3. package/dist/ai.d.ts +1 -1
  4. package/dist/ai.mjs.map +1 -1
  5. package/dist/auth.cjs +106 -9
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +1 -1
  8. package/dist/auth.d.ts +1 -1
  9. package/dist/auth.mjs +106 -9
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/catalog.cjs.map +1 -1
  12. package/dist/catalog.d.cts +1 -1
  13. package/dist/catalog.d.ts +1 -1
  14. package/dist/catalog.mjs.map +1 -1
  15. package/dist/checkout.cjs.map +1 -1
  16. package/dist/checkout.d.cts +1 -1
  17. package/dist/checkout.d.ts +1 -1
  18. package/dist/checkout.mjs.map +1 -1
  19. package/dist/db-react.d.cts +1 -1
  20. package/dist/db-react.d.ts +1 -1
  21. package/dist/db.cjs.map +1 -1
  22. package/dist/db.d.cts +1 -1
  23. package/dist/db.d.ts +1 -1
  24. package/dist/db.mjs.map +1 -1
  25. package/dist/entitlements.cjs.map +1 -1
  26. package/dist/entitlements.d.cts +1 -1
  27. package/dist/entitlements.d.ts +1 -1
  28. package/dist/entitlements.mjs.map +1 -1
  29. package/dist/errors.cjs.map +1 -1
  30. package/dist/errors.mjs.map +1 -1
  31. package/dist/firestore-compat.d.cts +1 -1
  32. package/dist/firestore-compat.d.ts +1 -1
  33. package/dist/index.cjs +107 -10
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +2 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.mjs +107 -10
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/mocks.cjs.map +1 -1
  40. package/dist/mocks.d.cts +1 -1
  41. package/dist/mocks.d.ts +1 -1
  42. package/dist/mocks.mjs.map +1 -1
  43. package/dist/notifications.cjs.map +1 -1
  44. package/dist/notifications.d.cts +1 -1
  45. package/dist/notifications.d.ts +1 -1
  46. package/dist/notifications.mjs.map +1 -1
  47. package/dist/react.d.cts +1 -1
  48. package/dist/react.d.ts +1 -1
  49. package/dist/support.cjs.map +1 -1
  50. package/dist/support.d.cts +1 -1
  51. package/dist/support.d.ts +1 -1
  52. package/dist/support.mjs.map +1 -1
  53. package/dist/telemetry.cjs.map +1 -1
  54. package/dist/telemetry.d.cts +1 -1
  55. package/dist/telemetry.d.ts +1 -1
  56. package/dist/telemetry.mjs.map +1 -1
  57. package/dist/{types-DJAGWjf0.d.cts → types-PzHvWMbV.d.cts} +6 -3
  58. package/dist/{types-BtQv-s0m.d.ts → types-iLDjiqqk.d.ts} +6 -3
  59. package/dist/usage.cjs.map +1 -1
  60. package/dist/usage.d.cts +1 -1
  61. package/dist/usage.d.ts +1 -1
  62. package/dist/usage.mjs.map +1 -1
  63. package/dist/webhooks.cjs.map +1 -1
  64. package/dist/webhooks.d.cts +1 -1
  65. package/dist/webhooks.d.ts +1 -1
  66. package/dist/webhooks.mjs.map +1 -1
  67. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createNeetruClient } from './auth.cjs';
2
2
  export { NeetruError, NeetruErrorCode } from './errors.cjs';
3
- export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiNamespace, f as AiStreamHandle, g as AiStreamMeta, h as AuthNamespace, i as AuthStateListener, C as CatalogListOptions, j as CatalogListResponse, l as CheckoutIntentInfo, m as CheckoutIntentStatus, n as CheckoutNamespace, o as CheckoutStartInput, p as CheckoutStartResult, q as CheckoutTenantType, r as CompleteSignInResult, u as CreateTicketInput, D as DEFAULT_BASE_URL, v as DbBatchOp, w as DbChangeType, x as DbCollectionRef, y as DbDoc, z as DbDocRef, B as DbGetResult, E as DbListResult, F as DbNamespace, G as DbQuery, H as DbSqlLease, I as DbWhereFilter, K as EntitlementCheck, L as FieldSentinel, M as IncrementSentinel, N as ListNotificationsOptions, O as MockCheckout, P as MockNotifications, Q as MockWebhooks, R as NEETRU_SENTINEL_KEY, S as NeetruClient, T as NeetruClientConfig, U as NeetruDb, W as NeetruDbEngine, X as NeetruDbError, Y as NeetruDbErrorCode, Z as NeetruDbOptions, _ as NeetruDbTransport, $ as NeetruEnv, a0 as NeetruSqlClient, a1 as NeetruUser, a2 as NotificationScopeOptions, a3 as NotificationsNamespace, a4 as Product, a5 as ProductNotification, a6 as ProductNotificationSeverity, a7 as ProductPlan, a8 as ProductStatus, aa as RedirectCallbackResult, ab as RegisterWebhookInput, ac as ResolvedConfig, ad as SendNotificationInput, ae as ServerTimestampSentinel, af as SignInOptions, ah as SupportNamespace, ai as SupportSeverity, aj as SupportStatus, ak as SupportTicket, am as TelemetryEventAck, an as TelemetryEventInput, ar as UsageEventInput, as as UsageNamespace, at as UsageQuota, au as VerifyTokenOptions, av as VerifyWebhookRequestOptions, aw as VerifyWebhookRequestResult, ax as WebhookEndpoint, ay as WebhookEvent, az as WebhookScopeOptions, aA as WebhookTestResult, aB as WebhooksNamespace, aC as WithFieldSentinels, aD as createAiNamespace, aE as createCheckoutNamespace, aF as createNeetruDb, aG as createNotificationsNamespace, aI as createWebhooksNamespace, aK as increment, aL as isFieldSentinel, aM as isIncrementSentinel, aN as isServerTimestampSentinel, aO as serverTimestamp, aP as verifyWebhookRequest, aQ as verifyWebhookSignature } from './types-DJAGWjf0.cjs';
3
+ export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiNamespace, f as AiStreamHandle, g as AiStreamMeta, h as AuthNamespace, i as AuthStateListener, C as CatalogListOptions, j as CatalogListResponse, l as CheckoutIntentInfo, m as CheckoutIntentStatus, n as CheckoutNamespace, o as CheckoutStartInput, p as CheckoutStartResult, q as CheckoutTenantType, r as CompleteSignInResult, u as CreateTicketInput, D as DEFAULT_BASE_URL, v as DbBatchOp, w as DbChangeType, x as DbCollectionRef, y as DbDoc, z as DbDocRef, B as DbGetResult, E as DbListResult, F as DbNamespace, G as DbQuery, H as DbSqlLease, I as DbWhereFilter, K as EntitlementCheck, L as FieldSentinel, M as IncrementSentinel, N as ListNotificationsOptions, O as MockCheckout, P as MockNotifications, Q as MockWebhooks, R as NEETRU_SENTINEL_KEY, S as NeetruClient, T as NeetruClientConfig, U as NeetruDb, W as NeetruDbEngine, X as NeetruDbError, Y as NeetruDbErrorCode, Z as NeetruDbOptions, _ as NeetruDbTransport, $ as NeetruEnv, a0 as NeetruSqlClient, a1 as NeetruUser, a2 as NotificationScopeOptions, a3 as NotificationsNamespace, a4 as Product, a5 as ProductNotification, a6 as ProductNotificationSeverity, a7 as ProductPlan, a8 as ProductStatus, aa as RedirectCallbackResult, ab as RegisterWebhookInput, ac as ResolvedConfig, ad as SendNotificationInput, ae as ServerTimestampSentinel, af as SignInOptions, ah as SupportNamespace, ai as SupportSeverity, aj as SupportStatus, ak as SupportTicket, am as TelemetryEventAck, an as TelemetryEventInput, ar as UsageEventInput, as as UsageNamespace, at as UsageQuota, au as VerifyTokenOptions, av as VerifyWebhookRequestOptions, aw as VerifyWebhookRequestResult, ax as WebhookEndpoint, ay as WebhookEvent, az as WebhookScopeOptions, aA as WebhookTestResult, aB as WebhooksNamespace, aC as WithFieldSentinels, aD as createAiNamespace, aE as createCheckoutNamespace, aF as createNeetruDb, aG as createNotificationsNamespace, aI as createWebhooksNamespace, aK as increment, aL as isFieldSentinel, aM as isIncrementSentinel, aN as isServerTimestampSentinel, aO as serverTimestamp, aP as verifyWebhookRequest, aQ as verifyWebhookSignature } from './types-PzHvWMbV.cjs';
4
4
  export { DEV_FIXTURE_USER, MockAi, MockAuth, MockAuthOptions, MockDb, MockEntitlements, MockSupport, MockUsage } from './mocks.cjs';
5
5
  import 'drizzle-orm/node-postgres';
6
6
 
@@ -42,6 +42,6 @@ declare function checkCoreVersionCompat(coreVersion: string): void;
42
42
  */
43
43
 
44
44
  /** Versão do SDK — exportada explicitamente pra detecção em runtime. */
45
- declare const VERSION: "3.1.12";
45
+ declare const VERSION: "3.1.13";
46
46
 
47
47
  export { VERSION, checkCoreVersionCompat };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createNeetruClient } from './auth.js';
2
2
  export { NeetruError, NeetruErrorCode } from './errors.js';
3
- export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiNamespace, f as AiStreamHandle, g as AiStreamMeta, h as AuthNamespace, i as AuthStateListener, C as CatalogListOptions, j as CatalogListResponse, l as CheckoutIntentInfo, m as CheckoutIntentStatus, n as CheckoutNamespace, o as CheckoutStartInput, p as CheckoutStartResult, q as CheckoutTenantType, r as CompleteSignInResult, u as CreateTicketInput, D as DEFAULT_BASE_URL, v as DbBatchOp, w as DbChangeType, x as DbCollectionRef, y as DbDoc, z as DbDocRef, B as DbGetResult, E as DbListResult, F as DbNamespace, G as DbQuery, H as DbSqlLease, I as DbWhereFilter, K as EntitlementCheck, L as FieldSentinel, M as IncrementSentinel, N as ListNotificationsOptions, O as MockCheckout, P as MockNotifications, Q as MockWebhooks, R as NEETRU_SENTINEL_KEY, S as NeetruClient, T as NeetruClientConfig, U as NeetruDb, W as NeetruDbEngine, X as NeetruDbError, Y as NeetruDbErrorCode, Z as NeetruDbOptions, _ as NeetruDbTransport, $ as NeetruEnv, a0 as NeetruSqlClient, a1 as NeetruUser, a2 as NotificationScopeOptions, a3 as NotificationsNamespace, a4 as Product, a5 as ProductNotification, a6 as ProductNotificationSeverity, a7 as ProductPlan, a8 as ProductStatus, aa as RedirectCallbackResult, ab as RegisterWebhookInput, ac as ResolvedConfig, ad as SendNotificationInput, ae as ServerTimestampSentinel, af as SignInOptions, ah as SupportNamespace, ai as SupportSeverity, aj as SupportStatus, ak as SupportTicket, am as TelemetryEventAck, an as TelemetryEventInput, ar as UsageEventInput, as as UsageNamespace, at as UsageQuota, au as VerifyTokenOptions, av as VerifyWebhookRequestOptions, aw as VerifyWebhookRequestResult, ax as WebhookEndpoint, ay as WebhookEvent, az as WebhookScopeOptions, aA as WebhookTestResult, aB as WebhooksNamespace, aC as WithFieldSentinels, aD as createAiNamespace, aE as createCheckoutNamespace, aF as createNeetruDb, aG as createNotificationsNamespace, aI as createWebhooksNamespace, aK as increment, aL as isFieldSentinel, aM as isIncrementSentinel, aN as isServerTimestampSentinel, aO as serverTimestamp, aP as verifyWebhookRequest, aQ as verifyWebhookSignature } from './types-BtQv-s0m.js';
3
+ export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiNamespace, f as AiStreamHandle, g as AiStreamMeta, h as AuthNamespace, i as AuthStateListener, C as CatalogListOptions, j as CatalogListResponse, l as CheckoutIntentInfo, m as CheckoutIntentStatus, n as CheckoutNamespace, o as CheckoutStartInput, p as CheckoutStartResult, q as CheckoutTenantType, r as CompleteSignInResult, u as CreateTicketInput, D as DEFAULT_BASE_URL, v as DbBatchOp, w as DbChangeType, x as DbCollectionRef, y as DbDoc, z as DbDocRef, B as DbGetResult, E as DbListResult, F as DbNamespace, G as DbQuery, H as DbSqlLease, I as DbWhereFilter, K as EntitlementCheck, L as FieldSentinel, M as IncrementSentinel, N as ListNotificationsOptions, O as MockCheckout, P as MockNotifications, Q as MockWebhooks, R as NEETRU_SENTINEL_KEY, S as NeetruClient, T as NeetruClientConfig, U as NeetruDb, W as NeetruDbEngine, X as NeetruDbError, Y as NeetruDbErrorCode, Z as NeetruDbOptions, _ as NeetruDbTransport, $ as NeetruEnv, a0 as NeetruSqlClient, a1 as NeetruUser, a2 as NotificationScopeOptions, a3 as NotificationsNamespace, a4 as Product, a5 as ProductNotification, a6 as ProductNotificationSeverity, a7 as ProductPlan, a8 as ProductStatus, aa as RedirectCallbackResult, ab as RegisterWebhookInput, ac as ResolvedConfig, ad as SendNotificationInput, ae as ServerTimestampSentinel, af as SignInOptions, ah as SupportNamespace, ai as SupportSeverity, aj as SupportStatus, ak as SupportTicket, am as TelemetryEventAck, an as TelemetryEventInput, ar as UsageEventInput, as as UsageNamespace, at as UsageQuota, au as VerifyTokenOptions, av as VerifyWebhookRequestOptions, aw as VerifyWebhookRequestResult, ax as WebhookEndpoint, ay as WebhookEvent, az as WebhookScopeOptions, aA as WebhookTestResult, aB as WebhooksNamespace, aC as WithFieldSentinels, aD as createAiNamespace, aE as createCheckoutNamespace, aF as createNeetruDb, aG as createNotificationsNamespace, aI as createWebhooksNamespace, aK as increment, aL as isFieldSentinel, aM as isIncrementSentinel, aN as isServerTimestampSentinel, aO as serverTimestamp, aP as verifyWebhookRequest, aQ as verifyWebhookSignature } from './types-iLDjiqqk.js';
4
4
  export { DEV_FIXTURE_USER, MockAi, MockAuth, MockAuthOptions, MockDb, MockEntitlements, MockSupport, MockUsage } from './mocks.js';
5
5
  import 'drizzle-orm/node-postgres';
6
6
 
@@ -42,6 +42,6 @@ declare function checkCoreVersionCompat(coreVersion: string): void;
42
42
  */
43
43
 
44
44
  /** Versão do SDK — exportada explicitamente pra detecção em runtime. */
45
- declare const VERSION: "3.1.12";
45
+ declare const VERSION: "3.1.13";
46
46
 
47
47
  export { VERSION, checkCoreVersionCompat };
package/dist/index.mjs CHANGED
@@ -753,6 +753,7 @@ function isInsecureBypassActive() {
753
753
 
754
754
  // src/types.ts
755
755
  var DEFAULT_BASE_URL = "https://api.neetru.com";
756
+ var DEV_LOCAL_BASE_URL = "http://localhost:9003";
756
757
 
757
758
  // src/catalog.ts
758
759
  init_errors();
@@ -6499,7 +6500,7 @@ function resolveEnv(configEnv) {
6499
6500
  try {
6500
6501
  const proc = globalThis.process;
6501
6502
  const val = proc?.env?.NEETRU_ENV;
6502
- if (val === "dev" || val === "workspace" || val === "prod") return val;
6503
+ if (val === "dev" || val === "workspace" || val === "prod" || val === "dev-local") return val;
6503
6504
  } catch {
6504
6505
  }
6505
6506
  try {
@@ -6582,9 +6583,11 @@ function cleanCallbackUrl(parsed) {
6582
6583
  }
6583
6584
  function createOidcAuthNamespace(config) {
6584
6585
  const STORAGE_KEY = "neetru_id_token";
6586
+ const REFRESH_STORAGE_KEY = "neetru_refresh_token";
6585
6587
  const listeners = /* @__PURE__ */ new Set();
6586
6588
  let cachedUser = null;
6587
6589
  let _expiryTimerId = null;
6590
+ let _refreshInFlight = null;
6588
6591
  function getStorage() {
6589
6592
  try {
6590
6593
  return typeof globalThis.localStorage !== "undefined" ? globalThis.localStorage : null;
@@ -6637,6 +6640,7 @@ function createOidcAuthNamespace(config) {
6637
6640
  const storage2 = getStorage();
6638
6641
  storage2?.removeItem(STORAGE_KEY);
6639
6642
  notify();
6643
+ attemptSilentRefresh();
6640
6644
  return null;
6641
6645
  }
6642
6646
  return cachedUser;
@@ -6644,14 +6648,18 @@ function createOidcAuthNamespace(config) {
6644
6648
  const storage = getStorage();
6645
6649
  if (!storage) return null;
6646
6650
  const token = storage.getItem(STORAGE_KEY);
6647
- if (!token) return null;
6651
+ if (!token) {
6652
+ attemptSilentRefresh();
6653
+ return null;
6654
+ }
6648
6655
  const user = tokenToUser(token);
6649
6656
  if (!user) {
6650
6657
  storage.removeItem(STORAGE_KEY);
6658
+ attemptSilentRefresh();
6651
6659
  return null;
6652
6660
  }
6653
6661
  cachedUser = user;
6654
- scheduleExpiryTimer(user);
6662
+ scheduleTokenRefresh(user);
6655
6663
  return cachedUser;
6656
6664
  }
6657
6665
  function notify() {
@@ -6668,12 +6676,93 @@ function createOidcAuthNamespace(config) {
6668
6676
  _expiryTimerId = null;
6669
6677
  }
6670
6678
  }
6671
- function scheduleExpiryTimer(user) {
6679
+ function getRefreshToken() {
6680
+ return getStorage()?.getItem(REFRESH_STORAGE_KEY) ?? null;
6681
+ }
6682
+ function clearSession() {
6683
+ cachedUser = null;
6684
+ const storage = getStorage();
6685
+ storage?.removeItem(STORAGE_KEY);
6686
+ storage?.removeItem(REFRESH_STORAGE_KEY);
6687
+ notify();
6688
+ }
6689
+ function refreshTokens() {
6690
+ if (_refreshInFlight) return _refreshInFlight;
6691
+ _refreshInFlight = (async () => {
6692
+ const refreshToken = getRefreshToken();
6693
+ if (!refreshToken) return false;
6694
+ let clientId;
6695
+ try {
6696
+ clientId = resolveClientId();
6697
+ } catch {
6698
+ return false;
6699
+ }
6700
+ const idpOrigin = resolveIdpOrigin(config.baseUrl);
6701
+ const tokenUrl = `${idpOrigin}/api/v1/oauth/token`;
6702
+ const form = new URLSearchParams({
6703
+ grant_type: "refresh_token",
6704
+ refresh_token: refreshToken,
6705
+ client_id: clientId
6706
+ });
6707
+ let res;
6708
+ try {
6709
+ res = await config.fetch(tokenUrl, {
6710
+ method: "POST",
6711
+ headers: { "content-type": "application/x-www-form-urlencoded" },
6712
+ body: form.toString()
6713
+ });
6714
+ } catch {
6715
+ return false;
6716
+ }
6717
+ let payload = null;
6718
+ try {
6719
+ payload = await res.json();
6720
+ } catch {
6721
+ payload = null;
6722
+ }
6723
+ if (!res.ok || typeof payload?.error === "string") return false;
6724
+ const idToken = payload?.id_token;
6725
+ if (typeof idToken !== "string" || idToken.length === 0) return false;
6726
+ const user = tokenToUser(idToken);
6727
+ if (!user) return false;
6728
+ const storage = getStorage();
6729
+ storage?.setItem(STORAGE_KEY, idToken);
6730
+ const rotated = payload?.refresh_token;
6731
+ if (typeof rotated === "string" && rotated.length > 0) {
6732
+ storage?.setItem(REFRESH_STORAGE_KEY, rotated);
6733
+ }
6734
+ cachedUser = user;
6735
+ scheduleTokenRefresh(user);
6736
+ notify();
6737
+ return true;
6738
+ })().finally(() => {
6739
+ _refreshInFlight = null;
6740
+ });
6741
+ return _refreshInFlight;
6742
+ }
6743
+ function attemptSilentRefresh() {
6744
+ if (!getRefreshToken()) return;
6745
+ void refreshTokens().then((ok) => {
6746
+ if (!ok) clearSession();
6747
+ });
6748
+ }
6749
+ function scheduleTokenRefresh(user) {
6672
6750
  cancelExpiryTimer();
6673
6751
  const exp = user.exp;
6674
6752
  if (typeof exp !== "number") return;
6675
6753
  const msUntilExpiry = exp * 1e3 - Date.now();
6676
6754
  if (msUntilExpiry <= 0) return;
6755
+ if (getRefreshToken()) {
6756
+ const lead = Math.min(msUntilExpiry, Math.max(3e4, msUntilExpiry * 0.2));
6757
+ const delay = Math.max(1, msUntilExpiry - lead);
6758
+ _expiryTimerId = setTimeout(() => {
6759
+ _expiryTimerId = null;
6760
+ void refreshTokens().then((ok) => {
6761
+ if (!ok) clearSession();
6762
+ });
6763
+ }, delay);
6764
+ return;
6765
+ }
6677
6766
  _expiryTimerId = setTimeout(() => {
6678
6767
  _expiryTimerId = null;
6679
6768
  loadCachedUser();
@@ -6815,9 +6904,14 @@ function createOidcAuthNamespace(config) {
6815
6904
  "id_token retornado pelo /token n\xE3o tem `sub` ou j\xE1 est\xE1 expirado."
6816
6905
  );
6817
6906
  }
6818
- getStorage()?.setItem(STORAGE_KEY, idToken);
6907
+ const storage = getStorage();
6908
+ storage?.setItem(STORAGE_KEY, idToken);
6909
+ const refreshToken = payload?.refresh_token;
6910
+ if (typeof refreshToken === "string" && refreshToken.length > 0) {
6911
+ storage?.setItem(REFRESH_STORAGE_KEY, refreshToken);
6912
+ }
6819
6913
  cachedUser = user;
6820
- scheduleExpiryTimer(user);
6914
+ scheduleTokenRefresh(user);
6821
6915
  notify();
6822
6916
  return { user, postLoginRedirect: tx.postLoginRedirect };
6823
6917
  }
@@ -6876,7 +6970,10 @@ function createOidcAuthNamespace(config) {
6876
6970
  async signOut() {
6877
6971
  const storage = getStorage();
6878
6972
  const storedToken = storage?.getItem(STORAGE_KEY) ?? null;
6879
- if (storage) storage.removeItem(STORAGE_KEY);
6973
+ if (storage) {
6974
+ storage.removeItem(STORAGE_KEY);
6975
+ storage.removeItem(REFRESH_STORAGE_KEY);
6976
+ }
6880
6977
  cancelExpiryTimer();
6881
6978
  cachedUser = null;
6882
6979
  const overrideAuthUrl = typeof globalThis.NEETRU_AUTH_URL === "string" ? globalThis.NEETRU_AUTH_URL : null;
@@ -6980,10 +7077,10 @@ function createNeetruClient(config = {}) {
6980
7077
  "fetch is not available in this runtime. Pass `fetch` explicitly to createNeetruClient."
6981
7078
  );
6982
7079
  }
6983
- const rawBaseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
6984
- const baseUrl = validateBaseUrl(rawBaseUrl, config.allowedHosts ?? []);
6985
7080
  const apiKey = config.apiKey ?? readEnvApiKey();
6986
7081
  const env = resolveEnv(config.env);
7082
+ const rawBaseUrl = config.baseUrl ?? (env === "dev-local" ? DEV_LOCAL_BASE_URL : DEFAULT_BASE_URL);
7083
+ const baseUrl = validateBaseUrl(rawBaseUrl, config.allowedHosts ?? []);
6987
7084
  const resolved = Object.freeze({
6988
7085
  apiKey,
6989
7086
  oidcClientId: config.oidcClientId,
@@ -7023,7 +7120,7 @@ function createNeetruClient(config = {}) {
7023
7120
  init_errors();
7024
7121
  init_db_errors();
7025
7122
  init_http();
7026
- var VERSION = "3.1.12";
7123
+ var VERSION = "3.1.13";
7027
7124
 
7028
7125
  export { DEFAULT_BASE_URL, DEV_FIXTURE_USER, MockAi, MockAuth, MockCheckout, MockDb, MockEntitlements, MockNotifications, MockSupport, MockUsage, MockWebhooks, NEETRU_SENTINEL_KEY, NeetruDbError, NeetruError, VERSION, checkCoreVersionCompat, createAiNamespace, createCheckoutNamespace, createNeetruClient, createNeetruDb, createNotificationsNamespace, createWebhooksNamespace, increment, isFieldSentinel, isIncrementSentinel, isServerTimestampSentinel, serverTimestamp, verifyWebhookRequest, verifyWebhookSignature };
7029
7126
  //# sourceMappingURL=index.mjs.map