@neetru/sdk 2.3.1 → 2.3.3
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 +19 -0
- 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.map +1 -1
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/index.cjs +54 -5
- 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 +54 -5
- package/dist/index.mjs.map +1 -1
- package/dist/mocks.cjs +54 -5
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +20 -2
- package/dist/mocks.d.ts +20 -2
- package/dist/mocks.mjs +54 -5
- package/dist/mocks.mjs.map +1 -1
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/support.d.cts +1 -1
- package/dist/support.d.ts +1 -1
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/{types-DvhtZ4bi.d.ts → types-CSC-RIdS.d.ts} +20 -0
- package/dist/{types-B6YJrynl.d.cts → types-sGGN1vkg.d.cts} +20 -0
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +6 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as NeetruClientConfig, N as NeetruClient } from './types-
|
|
2
|
-
export { A as AuthNamespace, a as AuthStateListener, C as CatalogListOptions, b as CatalogListResponse, c as CheckoutIntentInfo, d as CheckoutIntentStatus, e as CheckoutNamespace, f as CheckoutStartInput, g as CheckoutStartResult, h as CheckoutTenantType, i as CreateTicketInput, D as DEFAULT_BASE_URL, j as DbNamespace, k as DbSqlLease, l as DbWhereFilter, E as EntitlementCheck, L as ListNotificationsOptions, M as MockCheckout, m as MockNotifications, n as MockWebhooks, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, u as NeetruDbTransport, v as NeetruEnv, w as NeetruSqlClient, x as NeetruUser, y as NotificationsNamespace, P as Product, z as ProductNotification, B as ProductNotificationSeverity, F as ProductPlan, G as ProductStatus, R as RegisterWebhookInput, H as ResolvedConfig, S as SendNotificationInput, I as SignInOptions, K as SupportNamespace, O as SupportSeverity, Q as SupportStatus, T as SupportTicket, U as TelemetryEventAck, V as TelemetryEventInput, Y as UsageEventInput, Z as UsageNamespace, _ as UsageQuota, $ as VerifyTokenOptions, a0 as WebhookEndpoint, a1 as WebhookEvent, a2 as WebhookTestResult, a3 as WebhooksNamespace, a4 as createCheckoutNamespace, a5 as createNeetruDb, a6 as createNotificationsNamespace, a8 as createWebhooksNamespace } from './types-
|
|
1
|
+
import { o as NeetruClientConfig, N as NeetruClient } from './types-sGGN1vkg.cjs';
|
|
2
|
+
export { A as AuthNamespace, a as AuthStateListener, C as CatalogListOptions, b as CatalogListResponse, c as CheckoutIntentInfo, d as CheckoutIntentStatus, e as CheckoutNamespace, f as CheckoutStartInput, g as CheckoutStartResult, h as CheckoutTenantType, i as CreateTicketInput, D as DEFAULT_BASE_URL, j as DbNamespace, k as DbSqlLease, l as DbWhereFilter, E as EntitlementCheck, L as ListNotificationsOptions, M as MockCheckout, m as MockNotifications, n as MockWebhooks, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, u as NeetruDbTransport, v as NeetruEnv, w as NeetruSqlClient, x as NeetruUser, y as NotificationsNamespace, P as Product, z as ProductNotification, B as ProductNotificationSeverity, F as ProductPlan, G as ProductStatus, R as RegisterWebhookInput, H as ResolvedConfig, S as SendNotificationInput, I as SignInOptions, K as SupportNamespace, O as SupportSeverity, Q as SupportStatus, T as SupportTicket, U as TelemetryEventAck, V as TelemetryEventInput, Y as UsageEventInput, Z as UsageNamespace, _ as UsageQuota, $ as VerifyTokenOptions, a0 as WebhookEndpoint, a1 as WebhookEvent, a2 as WebhookTestResult, a3 as WebhooksNamespace, a4 as createCheckoutNamespace, a5 as createNeetruDb, a6 as createNotificationsNamespace, a8 as createWebhooksNamespace } from './types-sGGN1vkg.cjs';
|
|
3
3
|
export { createNeetruClient } from './auth.cjs';
|
|
4
4
|
export { NeetruError, NeetruErrorCode } from './errors.cjs';
|
|
5
5
|
export { D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery } from './collection-ref-DqAAhuhX.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as NeetruClientConfig, N as NeetruClient } from './types-
|
|
2
|
-
export { A as AuthNamespace, a as AuthStateListener, C as CatalogListOptions, b as CatalogListResponse, c as CheckoutIntentInfo, d as CheckoutIntentStatus, e as CheckoutNamespace, f as CheckoutStartInput, g as CheckoutStartResult, h as CheckoutTenantType, i as CreateTicketInput, D as DEFAULT_BASE_URL, j as DbNamespace, k as DbSqlLease, l as DbWhereFilter, E as EntitlementCheck, L as ListNotificationsOptions, M as MockCheckout, m as MockNotifications, n as MockWebhooks, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, u as NeetruDbTransport, v as NeetruEnv, w as NeetruSqlClient, x as NeetruUser, y as NotificationsNamespace, P as Product, z as ProductNotification, B as ProductNotificationSeverity, F as ProductPlan, G as ProductStatus, R as RegisterWebhookInput, H as ResolvedConfig, S as SendNotificationInput, I as SignInOptions, K as SupportNamespace, O as SupportSeverity, Q as SupportStatus, T as SupportTicket, U as TelemetryEventAck, V as TelemetryEventInput, Y as UsageEventInput, Z as UsageNamespace, _ as UsageQuota, $ as VerifyTokenOptions, a0 as WebhookEndpoint, a1 as WebhookEvent, a2 as WebhookTestResult, a3 as WebhooksNamespace, a4 as createCheckoutNamespace, a5 as createNeetruDb, a6 as createNotificationsNamespace, a8 as createWebhooksNamespace } from './types-
|
|
1
|
+
import { o as NeetruClientConfig, N as NeetruClient } from './types-CSC-RIdS.js';
|
|
2
|
+
export { A as AuthNamespace, a as AuthStateListener, C as CatalogListOptions, b as CatalogListResponse, c as CheckoutIntentInfo, d as CheckoutIntentStatus, e as CheckoutNamespace, f as CheckoutStartInput, g as CheckoutStartResult, h as CheckoutTenantType, i as CreateTicketInput, D as DEFAULT_BASE_URL, j as DbNamespace, k as DbSqlLease, l as DbWhereFilter, E as EntitlementCheck, L as ListNotificationsOptions, M as MockCheckout, m as MockNotifications, n as MockWebhooks, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, u as NeetruDbTransport, v as NeetruEnv, w as NeetruSqlClient, x as NeetruUser, y as NotificationsNamespace, P as Product, z as ProductNotification, B as ProductNotificationSeverity, F as ProductPlan, G as ProductStatus, R as RegisterWebhookInput, H as ResolvedConfig, S as SendNotificationInput, I as SignInOptions, K as SupportNamespace, O as SupportSeverity, Q as SupportStatus, T as SupportTicket, U as TelemetryEventAck, V as TelemetryEventInput, Y as UsageEventInput, Z as UsageNamespace, _ as UsageQuota, $ as VerifyTokenOptions, a0 as WebhookEndpoint, a1 as WebhookEvent, a2 as WebhookTestResult, a3 as WebhooksNamespace, a4 as createCheckoutNamespace, a5 as createNeetruDb, a6 as createNotificationsNamespace, a8 as createWebhooksNamespace } from './types-CSC-RIdS.js';
|
|
3
3
|
export { createNeetruClient } from './auth.js';
|
|
4
4
|
export { NeetruError, NeetruErrorCode } from './errors.js';
|
|
5
5
|
export { D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery } from './collection-ref-DqAAhuhX.js';
|
package/dist/index.mjs
CHANGED
|
@@ -5367,11 +5367,60 @@ var MockDb = class {
|
|
|
5367
5367
|
};
|
|
5368
5368
|
return ref;
|
|
5369
5369
|
}
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5370
|
+
/**
|
|
5371
|
+
* Implementa SQL in-memory via `pg-mem` + `drizzle-orm/node-postgres`.
|
|
5372
|
+
*
|
|
5373
|
+
* bug_a7f2ae25fda54129b52b6dd55aaa6050 (HIGH 26/05): antes lançava
|
|
5374
|
+
* `db_unavailable` sempre, bloqueando vitest server-side dos consumers
|
|
5375
|
+
* que refatoraram pra `client.db.sql()`. Agora carrega `pg-mem` lazy +
|
|
5376
|
+
* cria `NodePgDatabase` Drizzle apontando pra DB in-memory.
|
|
5377
|
+
*
|
|
5378
|
+
* Requer `pg-mem`, `drizzle-orm` e `pg` como devDependencies do consumer
|
|
5379
|
+
* (instale com `npm install -D pg-mem drizzle-orm pg`). Se ausentes, joga
|
|
5380
|
+
* `db_unavailable` com mensagem clara.
|
|
5381
|
+
*
|
|
5382
|
+
* Use `options.initSql` pra criar tabelas no test setup — sem isso o orm
|
|
5383
|
+
* funciona mas qualquer SELECT/INSERT em tabela inexistente vai falhar.
|
|
5384
|
+
*/
|
|
5385
|
+
async sql(schema, options) {
|
|
5386
|
+
let pgMemMod;
|
|
5387
|
+
let drizzlePg;
|
|
5388
|
+
try {
|
|
5389
|
+
pgMemMod = await import('pg-mem');
|
|
5390
|
+
drizzlePg = await import('drizzle-orm/node-postgres');
|
|
5391
|
+
} catch {
|
|
5392
|
+
throw new NeetruDbError(
|
|
5393
|
+
"db_unavailable",
|
|
5394
|
+
"[MockDb] sql() requer pg-mem + drizzle-orm + pg como devDependencies do consumer. Rode: npm install -D pg-mem drizzle-orm pg."
|
|
5395
|
+
);
|
|
5396
|
+
}
|
|
5397
|
+
const memDb = pgMemMod.newDb({ noAstCoverageCheck: true });
|
|
5398
|
+
if (options?.initSql) {
|
|
5399
|
+
const ddls = Array.isArray(options.initSql) ? options.initSql : [options.initSql];
|
|
5400
|
+
for (const ddl of ddls) {
|
|
5401
|
+
memDb.public.none(ddl);
|
|
5402
|
+
}
|
|
5403
|
+
}
|
|
5404
|
+
const adapters = memDb.adapters.createPg();
|
|
5405
|
+
const PoolCtor = adapters.Pool;
|
|
5406
|
+
const pool = new PoolCtor();
|
|
5407
|
+
const existingTypes = pool.types;
|
|
5408
|
+
if (!existingTypes || typeof existingTypes.getTypeParser !== "function") {
|
|
5409
|
+
pool.types = {
|
|
5410
|
+
getTypeParser: () => (val) => val
|
|
5411
|
+
};
|
|
5412
|
+
}
|
|
5413
|
+
const orm = drizzlePg.drizzle(pool, { schema });
|
|
5414
|
+
return {
|
|
5415
|
+
orm,
|
|
5416
|
+
async transaction(fn, _opts) {
|
|
5417
|
+
return await orm.transaction(fn);
|
|
5418
|
+
},
|
|
5419
|
+
async close() {
|
|
5420
|
+
const p = pool;
|
|
5421
|
+
if (p.end) await p.end();
|
|
5422
|
+
}
|
|
5423
|
+
};
|
|
5375
5424
|
}
|
|
5376
5425
|
get syncState() {
|
|
5377
5426
|
return {
|