@neetru/sdk 3.4.4 → 3.4.6

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 (76) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/ai.cjs +1 -1
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.d.cts +1 -1
  5. package/dist/ai.d.ts +1 -1
  6. package/dist/ai.mjs +1 -1
  7. package/dist/ai.mjs.map +1 -1
  8. package/dist/auth.cjs +47 -74
  9. package/dist/auth.cjs.map +1 -1
  10. package/dist/auth.d.cts +53 -2
  11. package/dist/auth.d.ts +53 -2
  12. package/dist/auth.mjs +46 -75
  13. package/dist/auth.mjs.map +1 -1
  14. package/dist/catalog.d.cts +1 -1
  15. package/dist/catalog.d.ts +1 -1
  16. package/dist/checkout.d.cts +1 -1
  17. package/dist/checkout.d.ts +1 -1
  18. package/dist/db-react.d.cts +1 -1
  19. package/dist/db-react.d.ts +1 -1
  20. package/dist/db.d.cts +1 -1
  21. package/dist/db.d.ts +1 -1
  22. package/dist/entitlements.cjs +16 -263
  23. package/dist/entitlements.cjs.map +1 -1
  24. package/dist/entitlements.d.cts +12 -10
  25. package/dist/entitlements.d.ts +12 -10
  26. package/dist/entitlements.mjs +16 -263
  27. package/dist/entitlements.mjs.map +1 -1
  28. package/dist/firestore-compat.d.cts +1 -1
  29. package/dist/firestore-compat.d.ts +1 -1
  30. package/dist/index.cjs +44 -75
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +3 -3
  33. package/dist/index.d.ts +3 -3
  34. package/dist/index.mjs +44 -76
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/mocks.d.cts +1 -1
  37. package/dist/mocks.d.ts +1 -1
  38. package/dist/notifications.cjs +1 -1
  39. package/dist/notifications.cjs.map +1 -1
  40. package/dist/notifications.d.cts +1 -1
  41. package/dist/notifications.d.ts +1 -1
  42. package/dist/notifications.mjs +1 -1
  43. package/dist/notifications.mjs.map +1 -1
  44. package/dist/react.cjs +6 -2
  45. package/dist/react.cjs.map +1 -1
  46. package/dist/react.d.cts +1 -1
  47. package/dist/react.d.ts +1 -1
  48. package/dist/react.mjs +6 -2
  49. package/dist/react.mjs.map +1 -1
  50. package/dist/support.cjs +1 -1
  51. package/dist/support.cjs.map +1 -1
  52. package/dist/support.d.cts +1 -1
  53. package/dist/support.d.ts +1 -1
  54. package/dist/support.mjs +1 -1
  55. package/dist/support.mjs.map +1 -1
  56. package/dist/telemetry.cjs +16 -4
  57. package/dist/telemetry.cjs.map +1 -1
  58. package/dist/telemetry.d.cts +1 -1
  59. package/dist/telemetry.d.ts +1 -1
  60. package/dist/telemetry.mjs +16 -4
  61. package/dist/telemetry.mjs.map +1 -1
  62. package/dist/{types-Dw0fqhHm.d.cts → types-DIVZl7nO.d.cts} +3 -0
  63. package/dist/{types-Bzxb5rlF.d.ts → types-nnztVk7G.d.ts} +3 -0
  64. package/dist/usage.cjs +1 -1
  65. package/dist/usage.cjs.map +1 -1
  66. package/dist/usage.d.cts +1 -1
  67. package/dist/usage.d.ts +1 -1
  68. package/dist/usage.mjs +1 -1
  69. package/dist/usage.mjs.map +1 -1
  70. package/dist/webhooks.cjs +1 -1
  71. package/dist/webhooks.cjs.map +1 -1
  72. package/dist/webhooks.d.cts +1 -1
  73. package/dist/webhooks.d.ts +1 -1
  74. package/dist/webhooks.mjs +1 -1
  75. package/dist/webhooks.mjs.map +1 -1
  76. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { createNeetruClient } from './auth.cjs';
1
+ export { createNeetruClient, getServerNeetruClient } 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 AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, l as AuthNamespace, m as AuthStateListener, C as CatalogListOptions, n as CatalogListResponse, p as CheckoutIntentInfo, q as CheckoutIntentStatus, r as CheckoutNamespace, s as CheckoutStartInput, t as CheckoutStartResult, u as CheckoutTenantType, v as CompleteSignInResult, y as CreateTicketInput, D as DEFAULT_BASE_URL, z as DbBatchOp, B as DbChangeType, E as DbCollectionRef, F as DbDoc, G as DbDocRef, H as DbGetResult, I as DbListResult, J as DbNamespace, K as DbQuery, L as DbSqlLease, M as DbWhereFilter, O as EntitlementCheck, P as FieldSentinel, Q as IncrementSentinel, R as ListNotificationsOptions, S as MockCheckout, T as MockNotifications, U as MockWebhooks, V as NEETRU_SENTINEL_KEY, W as NeetruClient, X as NeetruClientConfig, Y as NeetruDb, _ as NeetruDbEngine, $ as NeetruDbError, a0 as NeetruDbErrorCode, a1 as NeetruDbOptions, a2 as NeetruDbTransport, a3 as NeetruEnv, a4 as NeetruSqlClient, a5 as NeetruUser, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a8 as Product, a9 as ProductNotification, aa as ProductNotificationSeverity, ab as ProductPlan, ac as ProductStatus, ae as RedirectCallbackResult, af as RegisterWebhookInput, ag as ResolvedConfig, ah as SendNotificationInput, ai as ServerTimestampSentinel, aj as SignInOptions, al as SupportNamespace, am as SupportSeverity, an as SupportStatus, ao as SupportTicket, ar as TelemetryEventAck, as as TelemetryEventInput, aw as UsageEventInput, ax as UsageNamespace, ay as UsageQuota, az as VerifyTokenOptions, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aH as WithFieldSentinels, aJ as createAiNamespace, aK as createCheckoutNamespace, aL as createNeetruDb, aM as createNotificationsNamespace, aO as createWebhooksNamespace, aQ as increment, aR as isFieldSentinel, aS as isIncrementSentinel, aT as isServerTimestampSentinel, aU as serverTimestamp, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-Dw0fqhHm.cjs';
3
+ export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, l as AuthNamespace, m as AuthStateListener, C as CatalogListOptions, n as CatalogListResponse, p as CheckoutIntentInfo, q as CheckoutIntentStatus, r as CheckoutNamespace, s as CheckoutStartInput, t as CheckoutStartResult, u as CheckoutTenantType, v as CompleteSignInResult, y as CreateTicketInput, D as DEFAULT_BASE_URL, z as DbBatchOp, B as DbChangeType, E as DbCollectionRef, F as DbDoc, G as DbDocRef, H as DbGetResult, I as DbListResult, J as DbNamespace, K as DbQuery, L as DbSqlLease, M as DbWhereFilter, O as EntitlementCheck, P as FieldSentinel, Q as IncrementSentinel, R as ListNotificationsOptions, S as MockCheckout, T as MockNotifications, U as MockWebhooks, V as NEETRU_SENTINEL_KEY, W as NeetruClient, X as NeetruClientConfig, Y as NeetruDb, _ as NeetruDbEngine, $ as NeetruDbError, a0 as NeetruDbErrorCode, a1 as NeetruDbOptions, a2 as NeetruDbTransport, a3 as NeetruEnv, a4 as NeetruSqlClient, a5 as NeetruUser, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a8 as Product, a9 as ProductNotification, aa as ProductNotificationSeverity, ab as ProductPlan, ac as ProductStatus, ae as RedirectCallbackResult, af as RegisterWebhookInput, ag as ResolvedConfig, ah as SendNotificationInput, ai as ServerTimestampSentinel, aj as SignInOptions, al as SupportNamespace, am as SupportSeverity, an as SupportStatus, ao as SupportTicket, ar as TelemetryEventAck, as as TelemetryEventInput, aw as UsageEventInput, ax as UsageNamespace, ay as UsageQuota, az as VerifyTokenOptions, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aH as WithFieldSentinels, aJ as createAiNamespace, aK as createCheckoutNamespace, aL as createNeetruDb, aM as createNotificationsNamespace, aO as createWebhooksNamespace, aQ as increment, aR as isFieldSentinel, aS as isIncrementSentinel, aT as isServerTimestampSentinel, aU as serverTimestamp, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-DIVZl7nO.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.4.4";
45
+ declare const VERSION: "3.4.6";
46
46
 
47
47
  export { VERSION, checkCoreVersionCompat };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { createNeetruClient } from './auth.js';
1
+ export { createNeetruClient, getServerNeetruClient } 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 AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, l as AuthNamespace, m as AuthStateListener, C as CatalogListOptions, n as CatalogListResponse, p as CheckoutIntentInfo, q as CheckoutIntentStatus, r as CheckoutNamespace, s as CheckoutStartInput, t as CheckoutStartResult, u as CheckoutTenantType, v as CompleteSignInResult, y as CreateTicketInput, D as DEFAULT_BASE_URL, z as DbBatchOp, B as DbChangeType, E as DbCollectionRef, F as DbDoc, G as DbDocRef, H as DbGetResult, I as DbListResult, J as DbNamespace, K as DbQuery, L as DbSqlLease, M as DbWhereFilter, O as EntitlementCheck, P as FieldSentinel, Q as IncrementSentinel, R as ListNotificationsOptions, S as MockCheckout, T as MockNotifications, U as MockWebhooks, V as NEETRU_SENTINEL_KEY, W as NeetruClient, X as NeetruClientConfig, Y as NeetruDb, _ as NeetruDbEngine, $ as NeetruDbError, a0 as NeetruDbErrorCode, a1 as NeetruDbOptions, a2 as NeetruDbTransport, a3 as NeetruEnv, a4 as NeetruSqlClient, a5 as NeetruUser, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a8 as Product, a9 as ProductNotification, aa as ProductNotificationSeverity, ab as ProductPlan, ac as ProductStatus, ae as RedirectCallbackResult, af as RegisterWebhookInput, ag as ResolvedConfig, ah as SendNotificationInput, ai as ServerTimestampSentinel, aj as SignInOptions, al as SupportNamespace, am as SupportSeverity, an as SupportStatus, ao as SupportTicket, ar as TelemetryEventAck, as as TelemetryEventInput, aw as UsageEventInput, ax as UsageNamespace, ay as UsageQuota, az as VerifyTokenOptions, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aH as WithFieldSentinels, aJ as createAiNamespace, aK as createCheckoutNamespace, aL as createNeetruDb, aM as createNotificationsNamespace, aO as createWebhooksNamespace, aQ as increment, aR as isFieldSentinel, aS as isIncrementSentinel, aT as isServerTimestampSentinel, aU as serverTimestamp, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-Bzxb5rlF.js';
3
+ export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, l as AuthNamespace, m as AuthStateListener, C as CatalogListOptions, n as CatalogListResponse, p as CheckoutIntentInfo, q as CheckoutIntentStatus, r as CheckoutNamespace, s as CheckoutStartInput, t as CheckoutStartResult, u as CheckoutTenantType, v as CompleteSignInResult, y as CreateTicketInput, D as DEFAULT_BASE_URL, z as DbBatchOp, B as DbChangeType, E as DbCollectionRef, F as DbDoc, G as DbDocRef, H as DbGetResult, I as DbListResult, J as DbNamespace, K as DbQuery, L as DbSqlLease, M as DbWhereFilter, O as EntitlementCheck, P as FieldSentinel, Q as IncrementSentinel, R as ListNotificationsOptions, S as MockCheckout, T as MockNotifications, U as MockWebhooks, V as NEETRU_SENTINEL_KEY, W as NeetruClient, X as NeetruClientConfig, Y as NeetruDb, _ as NeetruDbEngine, $ as NeetruDbError, a0 as NeetruDbErrorCode, a1 as NeetruDbOptions, a2 as NeetruDbTransport, a3 as NeetruEnv, a4 as NeetruSqlClient, a5 as NeetruUser, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a8 as Product, a9 as ProductNotification, aa as ProductNotificationSeverity, ab as ProductPlan, ac as ProductStatus, ae as RedirectCallbackResult, af as RegisterWebhookInput, ag as ResolvedConfig, ah as SendNotificationInput, ai as ServerTimestampSentinel, aj as SignInOptions, al as SupportNamespace, am as SupportSeverity, an as SupportStatus, ao as SupportTicket, ar as TelemetryEventAck, as as TelemetryEventInput, aw as UsageEventInput, ax as UsageNamespace, ay as UsageQuota, az as VerifyTokenOptions, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aH as WithFieldSentinels, aJ as createAiNamespace, aK as createCheckoutNamespace, aL as createNeetruDb, aM as createNotificationsNamespace, aO as createWebhooksNamespace, aQ as increment, aR as isFieldSentinel, aS as isIncrementSentinel, aT as isServerTimestampSentinel, aU as serverTimestamp, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-nnztVk7G.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.4.4";
45
+ declare const VERSION: "3.4.6";
46
46
 
47
47
  export { VERSION, checkCoreVersionCompat };
package/dist/index.mjs CHANGED
@@ -1189,80 +1189,28 @@ function createCatalogNamespace(config) {
1189
1189
 
1190
1190
  // src/entitlements.ts
1191
1191
  init_errors();
1192
- init_http();
1193
- function toEntitlementCheck(raw) {
1194
- if (!raw || typeof raw !== "object") {
1195
- throw new NeetruError("invalid_response", "Entitlement response is not an object");
1196
- }
1197
- const r = raw;
1198
- if (typeof r.allowed !== "boolean") {
1199
- throw new NeetruError("invalid_response", "Entitlement response missing `allowed` boolean");
1200
- }
1201
- return {
1202
- allowed: r.allowed,
1203
- productSlug: typeof r.productSlug === "string" ? r.productSlug : "",
1204
- feature: typeof r.feature === "string" ? r.feature : "",
1205
- reason: typeof r.reason === "string" ? r.reason : void 0
1206
- };
1192
+ var DEPRECATION_MESSAGE = "client.entitlements.check()/checkDetailed() est\xE3o DEPRECADOS \u2014 apontavam para GET /api/v1/sdk/entitlements/check, um endpoint que o Core nunca escreve (sempre retornava not_subscribed). Use client.usage.check(resource, { productId, tenantId }) no lugar \u2014 mesmo resultado (allowed/reason/remaining/limit/behavior), endpoint real.";
1193
+ function throwDeprecated() {
1194
+ throw new NeetruError("validation_failed", DEPRECATION_MESSAGE);
1207
1195
  }
1208
- var CACHE_TTL_MS = 6e4;
1209
- var CACHE_MAX = 100;
1210
- function createEntitlementsNamespace(config) {
1211
- const cache = /* @__PURE__ */ new Map();
1212
- function cacheKey(productSlug, feature) {
1213
- return `${productSlug}::${feature}`;
1214
- }
1215
- function readCache(key) {
1216
- const entry = cache.get(key);
1217
- if (!entry) return null;
1218
- if (entry.expiresAt < Date.now()) {
1219
- cache.delete(key);
1220
- return null;
1221
- }
1222
- cache.delete(key);
1223
- cache.set(key, entry);
1224
- return entry.value;
1225
- }
1226
- function writeCache(key, value) {
1227
- if (cache.size >= CACHE_MAX) {
1228
- const oldest = cache.keys().next().value;
1229
- if (oldest !== void 0) cache.delete(oldest);
1230
- }
1231
- cache.set(key, { value, expiresAt: Date.now() + CACHE_TTL_MS });
1232
- }
1233
- async function checkDetailed(productSlug, feature, opts = {}) {
1234
- if (!productSlug) throw new NeetruError("validation_failed", "productSlug is required");
1235
- if (!feature) throw new NeetruError("validation_failed", "feature is required");
1236
- const key = cacheKey(productSlug, feature);
1237
- if (!opts.cacheBust) {
1238
- const cached = readCache(key);
1239
- if (cached) return cached;
1240
- }
1241
- const raw = await httpRequest(config, {
1242
- method: "GET",
1243
- path: "/api/v1/sdk/entitlements/check",
1244
- query: { slug: productSlug, feature },
1245
- requireAuth: true
1246
- });
1247
- const result = toEntitlementCheck(raw);
1248
- writeCache(key, result);
1249
- return result;
1250
- }
1196
+ function createEntitlementsNamespace(_config) {
1251
1197
  return {
1252
1198
  /**
1253
- * Verifica se o caller pode usar `feature` no produto `productSlug`.
1254
- * Retorno simples: `true` libera, `false` bloqueia. Cache 60s automático.
1255
- *
1256
- * Use `checkDetailed` se precisar do `reason` pra mensagem de upgrade.
1199
+ * @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
1200
+ * Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
1257
1201
  */
1258
- async check(productSlug, feature, opts) {
1259
- const result = await checkDetailed(productSlug, feature, opts);
1260
- return result.allowed;
1202
+ async check(_productSlug, _feature, _opts) {
1203
+ throwDeprecated();
1261
1204
  },
1262
- checkDetailed,
1263
- /** Test helper: limpa o cache LRU. */
1205
+ /**
1206
+ * @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
1207
+ * Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
1208
+ */
1209
+ async checkDetailed(_productSlug, _feature, _opts) {
1210
+ throwDeprecated();
1211
+ },
1212
+ /** Test helper legado — no-op (não há mais cache). Mantido por compat. */
1264
1213
  __resetCache() {
1265
- cache.clear();
1266
1214
  }
1267
1215
  };
1268
1216
  }
@@ -1271,6 +1219,12 @@ function createEntitlementsNamespace(config) {
1271
1219
  init_errors();
1272
1220
  init_http();
1273
1221
  var VALID_LOG_LEVELS = ["debug", "info", "warn", "error", "fatal"];
1222
+ function isBrowserContext() {
1223
+ return typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
1224
+ }
1225
+ function resolveEventTransport() {
1226
+ return isBrowserContext() ? { path: "/api/sdk/v1/telemetry/event/public", requireAuth: false } : { path: "/api/sdk/v1/telemetry/event", requireAuth: true };
1227
+ }
1274
1228
  function consoleFor(level) {
1275
1229
  switch (level) {
1276
1230
  case "debug":
@@ -1300,15 +1254,18 @@ function createTelemetryNamespace(config) {
1300
1254
  batch.map(async (ev) => {
1301
1255
  try {
1302
1256
  const body = { name: ev.name };
1257
+ const productSlug = ev.productSlug ?? config.productId;
1258
+ if (productSlug) body.productSlug = productSlug;
1303
1259
  if (ev.properties && typeof ev.properties === "object") {
1304
1260
  body.properties = ev.properties;
1305
1261
  }
1306
1262
  if (ev.timestamp) body.timestamp = ev.timestamp;
1263
+ const transport = resolveEventTransport();
1307
1264
  await httpRequest(config, {
1308
1265
  method: "POST",
1309
- path: "/api/sdk/v1/telemetry/event",
1266
+ path: transport.path,
1310
1267
  body,
1311
- requireAuth: true,
1268
+ requireAuth: transport.requireAuth,
1312
1269
  retries: 1,
1313
1270
  // caça-bruxas: retry sem Idempotency-Key duplicava o evento se o
1314
1271
  // servidor já tinha persistido antes da falha transiente. Mesmo
@@ -1361,15 +1318,18 @@ function createTelemetryNamespace(config) {
1361
1318
  throw new NeetruError("validation_failed", "event.name max 128 chars");
1362
1319
  }
1363
1320
  const body = { name: input.name };
1321
+ const productSlug = input.productSlug ?? config.productId;
1322
+ if (productSlug) body.productSlug = productSlug;
1364
1323
  if (input.properties && typeof input.properties === "object") {
1365
1324
  body.properties = input.properties;
1366
1325
  }
1367
1326
  if (input.timestamp) body.timestamp = input.timestamp;
1327
+ const transport = resolveEventTransport();
1368
1328
  const raw = await httpRequest(config, {
1369
1329
  method: "POST",
1370
- path: "/api/sdk/v1/telemetry/event",
1330
+ path: transport.path,
1371
1331
  body,
1372
- requireAuth: true
1332
+ requireAuth: transport.requireAuth
1373
1333
  });
1374
1334
  if (!raw || raw.ok !== true || typeof raw.eventId !== "string") {
1375
1335
  throw new NeetruError("invalid_response", "Telemetry response missing eventId");
@@ -1488,7 +1448,7 @@ init_http();
1488
1448
 
1489
1449
  // src/validators.ts
1490
1450
  init_errors();
1491
- var SDK_ID_RE = /^[a-z0-9][a-z0-9_-]{0,62}$/;
1451
+ var SDK_ID_RE = /^[a-z0-9][a-z0-9_-]{0,62}$/i;
1492
1452
  function assertValidSdkId(field, value) {
1493
1453
  if (typeof value !== "string" || !SDK_ID_RE.test(value)) {
1494
1454
  throw new NeetruError(
@@ -8015,7 +7975,7 @@ function createNeetruClient(config = {}) {
8015
7975
  const auth = config.mocks?.auth ?? (isDev ? new MockAuth({ ...DEV_FIXTURE_USER }) : createOidcAuthNamespace(resolved));
8016
7976
  const usage = config.mocks?.usage ?? (isDev ? new MockUsage() : createUsageNamespace(resolved));
8017
7977
  const support = config.mocks?.support ?? (isDev ? new MockSupport() : createSupportNamespace(resolved));
8018
- const entitlements = config.mocks?.entitlements ?? (isDev ? new MockEntitlements() : createEntitlementsNamespace(resolved));
7978
+ const entitlements = config.mocks?.entitlements ?? (isDev ? new MockEntitlements() : createEntitlementsNamespace());
8019
7979
  const db = config.mocks?.db ?? createNeetruDb(resolved, config.db);
8020
7980
  const webhooks = config.mocks?.webhooks ?? (isDev ? new MockWebhooks() : createWebhooksNamespace(resolved));
8021
7981
  const notifications = config.mocks?.notifications ?? (isDev ? new MockNotifications() : createNotificationsNamespace(resolved));
@@ -8036,13 +7996,21 @@ function createNeetruClient(config = {}) {
8036
7996
  });
8037
7997
  return client;
8038
7998
  }
7999
+ var NEETRU_SERVER_CLIENT_KEY = /* @__PURE__ */ Symbol.for("@neetru/sdk:serverClient");
8000
+ function getServerNeetruClient(config = {}) {
8001
+ const g = globalThis;
8002
+ if (!g[NEETRU_SERVER_CLIENT_KEY]) {
8003
+ g[NEETRU_SERVER_CLIENT_KEY] = createNeetruClient(config);
8004
+ }
8005
+ return g[NEETRU_SERVER_CLIENT_KEY];
8006
+ }
8039
8007
 
8040
8008
  // src/index.ts
8041
8009
  init_errors();
8042
8010
  init_db_errors();
8043
8011
  init_http();
8044
- var VERSION = "3.4.4";
8012
+ var VERSION = "3.4.6";
8045
8013
 
8046
- 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 };
8014
+ 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, getServerNeetruClient, increment, isFieldSentinel, isIncrementSentinel, isServerTimestampSentinel, serverTimestamp, verifyWebhookRequest, verifyWebhookSignature };
8047
8015
  //# sourceMappingURL=index.mjs.map
8048
8016
  //# sourceMappingURL=index.mjs.map