@neetru/sdk 3.4.2 → 3.4.4

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 (58) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/ai.d.cts +1 -1
  3. package/dist/ai.d.ts +1 -1
  4. package/dist/auth.cjs +17 -7
  5. package/dist/auth.cjs.map +1 -1
  6. package/dist/auth.d.cts +1 -1
  7. package/dist/auth.d.ts +1 -1
  8. package/dist/auth.mjs +17 -7
  9. package/dist/auth.mjs.map +1 -1
  10. package/dist/build-guard.cjs +98 -0
  11. package/dist/build-guard.cjs.map +1 -1
  12. package/dist/build-guard.d.cts +63 -1
  13. package/dist/build-guard.d.ts +63 -1
  14. package/dist/build-guard.mjs +93 -1
  15. package/dist/build-guard.mjs.map +1 -1
  16. package/dist/catalog.d.cts +1 -1
  17. package/dist/catalog.d.ts +1 -1
  18. package/dist/checkout.cjs +17 -7
  19. package/dist/checkout.cjs.map +1 -1
  20. package/dist/checkout.d.cts +1 -1
  21. package/dist/checkout.d.ts +1 -1
  22. package/dist/checkout.mjs +17 -7
  23. package/dist/checkout.mjs.map +1 -1
  24. package/dist/db-react.d.cts +1 -1
  25. package/dist/db-react.d.ts +1 -1
  26. package/dist/db.d.cts +1 -1
  27. package/dist/db.d.ts +1 -1
  28. package/dist/entitlements.d.cts +1 -1
  29. package/dist/entitlements.d.ts +1 -1
  30. package/dist/firestore-compat.d.cts +1 -1
  31. package/dist/firestore-compat.d.ts +1 -1
  32. package/dist/index.cjs +18 -8
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.mjs +18 -8
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/mocks.d.cts +1 -1
  39. package/dist/mocks.d.ts +1 -1
  40. package/dist/notifications.d.cts +1 -1
  41. package/dist/notifications.d.ts +1 -1
  42. package/dist/react.cjs +62 -3
  43. package/dist/react.cjs.map +1 -1
  44. package/dist/react.d.cts +38 -7
  45. package/dist/react.d.ts +38 -7
  46. package/dist/react.mjs +62 -3
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/support.d.cts +1 -1
  49. package/dist/support.d.ts +1 -1
  50. package/dist/telemetry.d.cts +1 -1
  51. package/dist/telemetry.d.ts +1 -1
  52. package/dist/{types-BlOLDMR0.d.ts → types-Bzxb5rlF.d.ts} +26 -8
  53. package/dist/{types-D-QdG502.d.cts → types-Dw0fqhHm.d.cts} +26 -8
  54. package/dist/usage.d.cts +1 -1
  55. package/dist/usage.d.ts +1 -1
  56. package/dist/webhooks.d.cts +1 -1
  57. package/dist/webhooks.d.ts +1 -1
  58. package/package.json +1 -1
package/dist/auth.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { X as NeetruClientConfig, W as NeetruClient } from './types-D-QdG502.cjs';
1
+ import { X as NeetruClientConfig, W as NeetruClient } from './types-Dw0fqhHm.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { X as NeetruClientConfig, W as NeetruClient } from './types-BlOLDMR0.js';
1
+ import { X as NeetruClientConfig, W as NeetruClient } from './types-Bzxb5rlF.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
package/dist/auth.mjs CHANGED
@@ -5574,14 +5574,15 @@ function createLazyCollectionRef(name, getDocsPromise) {
5574
5574
  // src/checkout.ts
5575
5575
  init_errors();
5576
5576
  init_http();
5577
- function checkoutAuth(accessToken, method) {
5578
- if (!accessToken || typeof accessToken !== "string") {
5577
+ function checkoutAuth(auth, method) {
5578
+ const token = auth?.accessToken || auth?.idToken;
5579
+ if (!token || typeof token !== "string") {
5579
5580
  throw new NeetruError(
5580
5581
  "validation_failed",
5581
- `checkout.${method} requer o access_token OIDC do usu\xE1rio final (passe \`accessToken\`). A chave de API do SDK (nrt_*) N\xC3O \xE9 aceita pelo endpoint de checkout \u2014 ele autentica a identidade do cliente que est\xE1 assinando (Bearer access_token OIDC ou cookie de sess\xE3o).`
5582
+ `checkout.${method} requer o access_token OU o id_token OIDC do usu\xE1rio final (passe \`accessToken\` ou \`idToken\`). A chave de API do SDK (nrt_*) N\xC3O \xE9 aceita pelo endpoint de checkout \u2014 ele autentica a identidade do cliente que est\xE1 assinando (Bearer access_token/id_token OIDC ou cookie de sess\xE3o). No padr\xE3o BFF/cookie, passe o \`idToken\` que seu servidor guardou no cookie httpOnly.`
5582
5583
  );
5583
5584
  }
5584
- return { requireAuth: false, headers: { authorization: `Bearer ${accessToken}` } };
5585
+ return { requireAuth: false, headers: { authorization: `Bearer ${token}` } };
5585
5586
  }
5586
5587
  function parseStartResponse(raw) {
5587
5588
  if (!raw || typeof raw !== "object") {
@@ -5660,7 +5661,10 @@ function createHttpCheckoutNamespace(config) {
5660
5661
  };
5661
5662
  if (input.tenantType) body.targetTenantType = input.tenantType;
5662
5663
  if (input.tenantId) body.targetTenantId = input.tenantId;
5663
- const { requireAuth, headers } = checkoutAuth(input.accessToken, "start");
5664
+ const { requireAuth, headers } = checkoutAuth(
5665
+ { accessToken: input.accessToken, idToken: input.idToken },
5666
+ "start"
5667
+ );
5664
5668
  const raw = await httpRequest(config, {
5665
5669
  method: "POST",
5666
5670
  path: "/api/v1/checkout/intents",
@@ -5680,7 +5684,10 @@ function createHttpCheckoutNamespace(config) {
5680
5684
  if (!intentId || typeof intentId !== "string") {
5681
5685
  throw new NeetruError("validation_failed", "checkout.get: intentId is required");
5682
5686
  }
5683
- const { requireAuth, headers } = checkoutAuth(opts?.accessToken, "get");
5687
+ const { requireAuth, headers } = checkoutAuth(
5688
+ { accessToken: opts?.accessToken, idToken: opts?.idToken },
5689
+ "get"
5690
+ );
5684
5691
  const raw = await httpRequest(config, {
5685
5692
  method: "GET",
5686
5693
  path: `/api/v1/checkout/intents/${encodeURIComponent(intentId)}`,
@@ -5693,7 +5700,10 @@ function createHttpCheckoutNamespace(config) {
5693
5700
  if (!intentId || typeof intentId !== "string") {
5694
5701
  throw new NeetruError("validation_failed", "checkout.cancel: intentId is required");
5695
5702
  }
5696
- const { requireAuth, headers } = checkoutAuth(opts?.accessToken, "cancel");
5703
+ const { requireAuth, headers } = checkoutAuth(
5704
+ { accessToken: opts?.accessToken, idToken: opts?.idToken },
5705
+ "cancel"
5706
+ );
5697
5707
  const raw = await httpRequest(config, {
5698
5708
  method: "DELETE",
5699
5709
  path: `/api/v1/checkout/intents/${encodeURIComponent(intentId)}`,