@neetru/sdk 3.1.10 → 3.1.12
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/CHANGELOG.md +23 -0
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.mjs.map +1 -1
- package/dist/auth.cjs +154 -65
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.mjs +154 -65
- package/dist/auth.mjs.map +1 -1
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.mjs.map +1 -1
- package/dist/checkout.cjs.map +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/checkout.mjs.map +1 -1
- package/dist/db-react.d.cts +1 -1
- package/dist/db-react.d.ts +1 -1
- package/dist/db.cjs.map +1 -1
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/db.mjs.map +1 -1
- package/dist/entitlements.cjs.map +1 -1
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/entitlements.mjs.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +12 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.mjs.map +1 -1
- package/dist/firestore-compat.d.cts +1 -1
- package/dist/firestore-compat.d.ts +1 -1
- package/dist/index.cjs +155 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +155 -66
- package/dist/index.mjs.map +1 -1
- package/dist/mocks.cjs +9 -0
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +8 -1
- package/dist/mocks.d.ts +8 -1
- package/dist/mocks.mjs +9 -0
- package/dist/mocks.mjs.map +1 -1
- package/dist/notifications.cjs.map +1 -1
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.mjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/support.cjs.map +1 -1
- package/dist/support.d.cts +1 -1
- package/dist/support.d.ts +1 -1
- package/dist/support.mjs.map +1 -1
- package/dist/telemetry.cjs.map +1 -1
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.mjs.map +1 -1
- package/dist/{types-dagUxKYz.d.ts → types-BtQv-s0m.d.ts} +40 -3
- package/dist/{types-Cog9S-tC.d.cts → types-DJAGWjf0.d.cts} +40 -3
- package/dist/usage.cjs.map +1 -1
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/usage.mjs.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/dist/webhooks.mjs.map +1 -1
- 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,
|
|
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';
|
|
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.
|
|
45
|
+
declare const VERSION: "3.1.12";
|
|
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,
|
|
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';
|
|
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.
|
|
45
|
+
declare const VERSION: "3.1.12";
|
|
46
46
|
|
|
47
47
|
export { VERSION, checkCoreVersionCompat };
|
package/dist/index.mjs
CHANGED
|
@@ -5931,6 +5931,15 @@ var MockAuth = class {
|
|
|
5931
5931
|
async handleRedirectCallback(_currentUrl) {
|
|
5932
5932
|
return this._pendingCallback;
|
|
5933
5933
|
}
|
|
5934
|
+
/**
|
|
5935
|
+
* Mock de `completeSignIn` (3.1.12) — em dev não há redirect real pro IdP,
|
|
5936
|
+
* então não existe callback a completar: retorna `null` sempre (mesmo
|
|
5937
|
+
* contrato "no-op seguro em todo page load" da implementação real). O login
|
|
5938
|
+
* mock acontece direto via `signIn()`.
|
|
5939
|
+
*/
|
|
5940
|
+
async completeSignIn(_currentUrl) {
|
|
5941
|
+
return null;
|
|
5942
|
+
}
|
|
5934
5943
|
/**
|
|
5935
5944
|
* Mock de `getIdToken` (Bug 2 / 3.1.3). Retorna `null` por default; use
|
|
5936
5945
|
* `__setIdToken(token)` pra injetar um token cru em testes.
|
|
@@ -6670,22 +6679,155 @@ function createOidcAuthNamespace(config) {
|
|
|
6670
6679
|
loadCachedUser();
|
|
6671
6680
|
}, msUntilExpiry + 1);
|
|
6672
6681
|
}
|
|
6682
|
+
function resolveClientId() {
|
|
6683
|
+
let clientId = config.oidcClientId;
|
|
6684
|
+
if (!clientId && config.apiKey) {
|
|
6685
|
+
clientId = parseApiKey(config.apiKey).keyId;
|
|
6686
|
+
}
|
|
6687
|
+
if (!clientId) {
|
|
6688
|
+
throw new NeetruError(
|
|
6689
|
+
"invalid_config",
|
|
6690
|
+
"auth OIDC requer `oidcClientId` (ou `apiKey`) configurado para montar o client_id."
|
|
6691
|
+
);
|
|
6692
|
+
}
|
|
6693
|
+
return clientId;
|
|
6694
|
+
}
|
|
6695
|
+
async function handleRedirectCallback(currentUrl) {
|
|
6696
|
+
const href = currentUrl ?? (typeof globalThis.location !== "undefined" ? globalThis.location.href : void 0);
|
|
6697
|
+
if (!href) return null;
|
|
6698
|
+
let parsed;
|
|
6699
|
+
try {
|
|
6700
|
+
parsed = new URL(href);
|
|
6701
|
+
} catch {
|
|
6702
|
+
return null;
|
|
6703
|
+
}
|
|
6704
|
+
const params = parsed.searchParams;
|
|
6705
|
+
const idpError = params.get("error");
|
|
6706
|
+
if (idpError) {
|
|
6707
|
+
const desc = params.get("error_description") ?? idpError;
|
|
6708
|
+
getSessionStorage()?.removeItem(OIDC_TX_KEY);
|
|
6709
|
+
cleanCallbackUrl(parsed);
|
|
6710
|
+
throw new NeetruError(idpError, `OIDC authorize falhou: ${desc}`);
|
|
6711
|
+
}
|
|
6712
|
+
const code = params.get("code");
|
|
6713
|
+
if (!code) return null;
|
|
6714
|
+
const returnedState = params.get("state");
|
|
6715
|
+
const session = getSessionStorage();
|
|
6716
|
+
const txRaw = session?.getItem(OIDC_TX_KEY) ?? null;
|
|
6717
|
+
let tx = null;
|
|
6718
|
+
if (txRaw) {
|
|
6719
|
+
try {
|
|
6720
|
+
tx = JSON.parse(txRaw);
|
|
6721
|
+
} catch {
|
|
6722
|
+
tx = null;
|
|
6723
|
+
}
|
|
6724
|
+
}
|
|
6725
|
+
if (!tx) {
|
|
6726
|
+
throw new NeetruError(
|
|
6727
|
+
"oidc_state_mismatch",
|
|
6728
|
+
"Callback OIDC sem transa\xE7\xE3o pendente \u2014 `signIn` n\xE3o foi iniciado nesta sess\xE3o (ou j\xE1 consumido)."
|
|
6729
|
+
);
|
|
6730
|
+
}
|
|
6731
|
+
if (!returnedState || returnedState !== tx.state) {
|
|
6732
|
+
session?.removeItem(OIDC_TX_KEY);
|
|
6733
|
+
cleanCallbackUrl(parsed);
|
|
6734
|
+
throw new NeetruError(
|
|
6735
|
+
"oidc_state_mismatch",
|
|
6736
|
+
"state do callback OIDC n\xE3o confere com o da transa\xE7\xE3o (poss\xEDvel CSRF)."
|
|
6737
|
+
);
|
|
6738
|
+
}
|
|
6739
|
+
session?.removeItem(OIDC_TX_KEY);
|
|
6740
|
+
cleanCallbackUrl(parsed);
|
|
6741
|
+
return {
|
|
6742
|
+
code,
|
|
6743
|
+
codeVerifier: tx.codeVerifier,
|
|
6744
|
+
redirectUri: tx.redirectUri,
|
|
6745
|
+
nonce: tx.nonce,
|
|
6746
|
+
state: tx.state,
|
|
6747
|
+
postLoginRedirect: tx.postLoginRedirect
|
|
6748
|
+
};
|
|
6749
|
+
}
|
|
6750
|
+
async function completeSignIn(currentUrl) {
|
|
6751
|
+
const tx = await handleRedirectCallback(currentUrl);
|
|
6752
|
+
if (!tx) return null;
|
|
6753
|
+
const clientId = resolveClientId();
|
|
6754
|
+
const idpOrigin = resolveIdpOrigin(config.baseUrl);
|
|
6755
|
+
const tokenUrl = `${idpOrigin}/api/v1/oauth/token`;
|
|
6756
|
+
const form = new URLSearchParams({
|
|
6757
|
+
grant_type: "authorization_code",
|
|
6758
|
+
code: tx.code,
|
|
6759
|
+
redirect_uri: tx.redirectUri,
|
|
6760
|
+
client_id: clientId,
|
|
6761
|
+
code_verifier: tx.codeVerifier
|
|
6762
|
+
});
|
|
6763
|
+
let res;
|
|
6764
|
+
try {
|
|
6765
|
+
res = await config.fetch(tokenUrl, {
|
|
6766
|
+
method: "POST",
|
|
6767
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
6768
|
+
body: form.toString()
|
|
6769
|
+
});
|
|
6770
|
+
} catch (err) {
|
|
6771
|
+
throw new NeetruError(
|
|
6772
|
+
"network_error",
|
|
6773
|
+
`POST ${tokenUrl} falhou (network): ${err?.message ?? String(err)}`
|
|
6774
|
+
);
|
|
6775
|
+
}
|
|
6776
|
+
let payload = null;
|
|
6777
|
+
try {
|
|
6778
|
+
payload = await res.json();
|
|
6779
|
+
} catch {
|
|
6780
|
+
payload = null;
|
|
6781
|
+
}
|
|
6782
|
+
if (!res.ok || typeof payload?.error === "string") {
|
|
6783
|
+
const desc = typeof payload?.error_description === "string" && payload.error_description || typeof payload?.error === "string" && payload.error || `HTTP ${res.status}`;
|
|
6784
|
+
throw new NeetruError(
|
|
6785
|
+
"token_exchange_failed",
|
|
6786
|
+
`Troca do authorization_code por tokens falhou no /token: ${desc}`,
|
|
6787
|
+
res.status
|
|
6788
|
+
);
|
|
6789
|
+
}
|
|
6790
|
+
const idToken = payload?.id_token;
|
|
6791
|
+
if (typeof idToken !== "string" || idToken.length === 0) {
|
|
6792
|
+
throw new NeetruError(
|
|
6793
|
+
"token_exchange_failed",
|
|
6794
|
+
"Resposta do /token sem `id_token` \u2014 o login n\xE3o pode ser completado.",
|
|
6795
|
+
res.status
|
|
6796
|
+
);
|
|
6797
|
+
}
|
|
6798
|
+
const claims = decodeJwtPayload(idToken);
|
|
6799
|
+
if (!claims) {
|
|
6800
|
+
throw new NeetruError(
|
|
6801
|
+
"token_exchange_failed",
|
|
6802
|
+
"id_token retornado pelo /token \xE9 malformado (payload indecodific\xE1vel)."
|
|
6803
|
+
);
|
|
6804
|
+
}
|
|
6805
|
+
if (claims.nonce !== tx.nonce) {
|
|
6806
|
+
throw new NeetruError(
|
|
6807
|
+
"oidc_nonce_mismatch",
|
|
6808
|
+
"nonce do id_token n\xE3o confere com o da transa\xE7\xE3o OIDC (poss\xEDvel replay). Token descartado."
|
|
6809
|
+
);
|
|
6810
|
+
}
|
|
6811
|
+
const user = tokenToUser(idToken);
|
|
6812
|
+
if (!user) {
|
|
6813
|
+
throw new NeetruError(
|
|
6814
|
+
"token_exchange_failed",
|
|
6815
|
+
"id_token retornado pelo /token n\xE3o tem `sub` ou j\xE1 est\xE1 expirado."
|
|
6816
|
+
);
|
|
6817
|
+
}
|
|
6818
|
+
getStorage()?.setItem(STORAGE_KEY, idToken);
|
|
6819
|
+
cachedUser = user;
|
|
6820
|
+
scheduleExpiryTimer(user);
|
|
6821
|
+
notify();
|
|
6822
|
+
return { user, postLoginRedirect: tx.postLoginRedirect };
|
|
6823
|
+
}
|
|
6673
6824
|
return {
|
|
6674
6825
|
async signIn(options) {
|
|
6675
6826
|
if (typeof globalThis.location !== "undefined" && typeof globalThis.location.assign === "function") {
|
|
6676
6827
|
const crypto2 = getWebCrypto();
|
|
6677
6828
|
const redirectUri = options?.redirectUri ?? globalThis.location.origin;
|
|
6678
6829
|
const scope = options?.scope ?? "openid profile email";
|
|
6679
|
-
|
|
6680
|
-
if (!clientId && config.apiKey) {
|
|
6681
|
-
clientId = parseApiKey(config.apiKey).keyId;
|
|
6682
|
-
}
|
|
6683
|
-
if (!clientId) {
|
|
6684
|
-
throw new NeetruError(
|
|
6685
|
-
"invalid_config",
|
|
6686
|
-
"auth.signIn requer `oidcClientId` (ou `apiKey`) configurado para montar o client_id."
|
|
6687
|
-
);
|
|
6688
|
-
}
|
|
6830
|
+
const clientId = resolveClientId();
|
|
6689
6831
|
const state = randomUrlSafe(crypto2, 16);
|
|
6690
6832
|
const nonce = randomUrlSafe(crypto2, 16);
|
|
6691
6833
|
const codeVerifier = randomUrlSafe(crypto2, 32);
|
|
@@ -6723,61 +6865,8 @@ function createOidcAuthNamespace(config) {
|
|
|
6723
6865
|
"auth.signIn requires a browser context or mocks. Use NEETRU_ENV=dev or pass mocks.auth."
|
|
6724
6866
|
);
|
|
6725
6867
|
},
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
if (!href) return null;
|
|
6729
|
-
let parsed;
|
|
6730
|
-
try {
|
|
6731
|
-
parsed = new URL(href);
|
|
6732
|
-
} catch {
|
|
6733
|
-
return null;
|
|
6734
|
-
}
|
|
6735
|
-
const params = parsed.searchParams;
|
|
6736
|
-
const idpError = params.get("error");
|
|
6737
|
-
if (idpError) {
|
|
6738
|
-
const desc = params.get("error_description") ?? idpError;
|
|
6739
|
-
getSessionStorage()?.removeItem(OIDC_TX_KEY);
|
|
6740
|
-
cleanCallbackUrl(parsed);
|
|
6741
|
-
throw new NeetruError(idpError, `OIDC authorize falhou: ${desc}`);
|
|
6742
|
-
}
|
|
6743
|
-
const code = params.get("code");
|
|
6744
|
-
if (!code) return null;
|
|
6745
|
-
const returnedState = params.get("state");
|
|
6746
|
-
const session = getSessionStorage();
|
|
6747
|
-
const txRaw = session?.getItem(OIDC_TX_KEY) ?? null;
|
|
6748
|
-
let tx = null;
|
|
6749
|
-
if (txRaw) {
|
|
6750
|
-
try {
|
|
6751
|
-
tx = JSON.parse(txRaw);
|
|
6752
|
-
} catch {
|
|
6753
|
-
tx = null;
|
|
6754
|
-
}
|
|
6755
|
-
}
|
|
6756
|
-
if (!tx) {
|
|
6757
|
-
throw new NeetruError(
|
|
6758
|
-
"oidc_state_mismatch",
|
|
6759
|
-
"Callback OIDC sem transa\xE7\xE3o pendente \u2014 `signIn` n\xE3o foi iniciado nesta sess\xE3o (ou j\xE1 consumido)."
|
|
6760
|
-
);
|
|
6761
|
-
}
|
|
6762
|
-
if (!returnedState || returnedState !== tx.state) {
|
|
6763
|
-
session?.removeItem(OIDC_TX_KEY);
|
|
6764
|
-
cleanCallbackUrl(parsed);
|
|
6765
|
-
throw new NeetruError(
|
|
6766
|
-
"oidc_state_mismatch",
|
|
6767
|
-
"state do callback OIDC n\xE3o confere com o da transa\xE7\xE3o (poss\xEDvel CSRF)."
|
|
6768
|
-
);
|
|
6769
|
-
}
|
|
6770
|
-
session?.removeItem(OIDC_TX_KEY);
|
|
6771
|
-
cleanCallbackUrl(parsed);
|
|
6772
|
-
return {
|
|
6773
|
-
code,
|
|
6774
|
-
codeVerifier: tx.codeVerifier,
|
|
6775
|
-
redirectUri: tx.redirectUri,
|
|
6776
|
-
nonce: tx.nonce,
|
|
6777
|
-
state: tx.state,
|
|
6778
|
-
postLoginRedirect: tx.postLoginRedirect
|
|
6779
|
-
};
|
|
6780
|
-
},
|
|
6868
|
+
handleRedirectCallback,
|
|
6869
|
+
completeSignIn,
|
|
6781
6870
|
getIdToken() {
|
|
6782
6871
|
const storage = getStorage();
|
|
6783
6872
|
const token = storage?.getItem(STORAGE_KEY) ?? null;
|
|
@@ -6934,7 +7023,7 @@ function createNeetruClient(config = {}) {
|
|
|
6934
7023
|
init_errors();
|
|
6935
7024
|
init_db_errors();
|
|
6936
7025
|
init_http();
|
|
6937
|
-
var VERSION = "3.1.
|
|
7026
|
+
var VERSION = "3.1.12";
|
|
6938
7027
|
|
|
6939
7028
|
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 };
|
|
6940
7029
|
//# sourceMappingURL=index.mjs.map
|