@neetru/sdk 3.1.15 → 3.2.2
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 +72 -0
- package/README.md +62 -0
- package/dist/auth.cjs +16 -10
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +16 -10
- package/dist/auth.mjs.map +1 -1
- package/dist/db.cjs +16 -10
- package/dist/db.cjs.map +1 -1
- package/dist/db.mjs +16 -10
- package/dist/db.mjs.map +1 -1
- package/dist/index.cjs +17 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +17 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +90 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +43 -1
- package/dist/react.d.ts +43 -1
- package/dist/react.mjs +90 -1
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -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.
|
|
45
|
+
declare const VERSION: "3.2.2";
|
|
46
46
|
|
|
47
47
|
export { VERSION, checkCoreVersionCompat };
|
package/dist/index.d.ts
CHANGED
|
@@ -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.
|
|
45
|
+
declare const VERSION: "3.2.2";
|
|
46
46
|
|
|
47
47
|
export { VERSION, checkCoreVersionCompat };
|
package/dist/index.mjs
CHANGED
|
@@ -276,6 +276,9 @@ var init_db_errors = __esm({
|
|
|
276
276
|
});
|
|
277
277
|
|
|
278
278
|
// src/db/sql/lease.ts
|
|
279
|
+
function hasConnectionChanged(oldLease, newLease) {
|
|
280
|
+
return oldLease.leaseId !== newLease.leaseId || oldLease.credentialVersion !== newLease.credentialVersion || oldLease.host !== newLease.host || oldLease.port !== newLease.port || oldLease.dbName !== newLease.dbName || oldLease.user !== newLease.user || oldLease.password !== newLease.password || oldLease.sslca !== newLease.sslca || oldLease.clientCert !== newLease.clientCert || oldLease.clientKey !== newLease.clientKey;
|
|
281
|
+
}
|
|
279
282
|
function mapPoolError(err) {
|
|
280
283
|
if (err instanceof NeetruDbError) return err;
|
|
281
284
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -380,21 +383,25 @@ var init_lease = __esm({
|
|
|
380
383
|
async _doRenew() {
|
|
381
384
|
if (this._closed) return;
|
|
382
385
|
try {
|
|
383
|
-
const
|
|
384
|
-
|
|
386
|
+
const withDb = (o) => {
|
|
387
|
+
if (this._deps.database !== void 0) o.database = this._deps.database;
|
|
388
|
+
return o;
|
|
385
389
|
};
|
|
386
|
-
|
|
387
|
-
|
|
390
|
+
let newLease;
|
|
391
|
+
try {
|
|
392
|
+
newLease = await this._deps.fetchLease(withDb({ leaseId: this._lease.leaseId }));
|
|
393
|
+
} catch (renewErr) {
|
|
394
|
+
newLease = await this._deps.fetchLease(withDb({}));
|
|
388
395
|
}
|
|
389
|
-
const newLease = await this._deps.fetchLease(renewOpts);
|
|
390
396
|
await this._swapPool(newLease);
|
|
391
397
|
} catch (err) {
|
|
392
398
|
this._renewalTimer = setTimeout(() => {
|
|
393
399
|
void this._doRenew();
|
|
394
400
|
}, MIN_RENEWAL_DELAY_MS);
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
401
|
+
console.warn(
|
|
402
|
+
`[SqlLeaseManager] renova\xE7\xE3o E emiss\xE3o de lease novo falharam; re-tentando em ${MIN_RENEWAL_DELAY_MS}ms (cert mTLS expira ~15min ap\xF3s o \xFAltimo swap):`,
|
|
403
|
+
err instanceof Error ? err.message : err
|
|
404
|
+
);
|
|
398
405
|
return;
|
|
399
406
|
}
|
|
400
407
|
this._scheduleRenewal();
|
|
@@ -405,8 +412,7 @@ var init_lease = __esm({
|
|
|
405
412
|
* Exposto como método protegido para testes.
|
|
406
413
|
*/
|
|
407
414
|
async _swapPool(newLease) {
|
|
408
|
-
|
|
409
|
-
if (!credRotated && newLease.leaseId === this._lease.leaseId) {
|
|
415
|
+
if (!hasConnectionChanged(this._lease, newLease)) {
|
|
410
416
|
this._lease = newLease;
|
|
411
417
|
return;
|
|
412
418
|
}
|
|
@@ -7120,7 +7126,7 @@ function createNeetruClient(config = {}) {
|
|
|
7120
7126
|
init_errors();
|
|
7121
7127
|
init_db_errors();
|
|
7122
7128
|
init_http();
|
|
7123
|
-
var VERSION = "3.
|
|
7129
|
+
var VERSION = "3.2.2";
|
|
7124
7130
|
|
|
7125
7131
|
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 };
|
|
7126
7132
|
//# sourceMappingURL=index.mjs.map
|