@neetru/sdk 3.7.0 → 3.8.1
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 +75 -0
- package/README.md +66 -1
- package/dist/ai.cjs +221 -177
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.mjs +221 -177
- package/dist/auth.cjs +1051 -868
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.mjs +1048 -865
- package/dist/catalog.cjs +164 -97
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.mjs +164 -97
- package/dist/checkout.cjs +182 -115
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/checkout.mjs +181 -114
- package/dist/db-react.d.cts +1 -1
- package/dist/db-react.d.ts +1 -1
- package/dist/db.cjs +437 -345
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/db.mjs +455 -363
- package/dist/entitlements.cjs +17 -10
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/entitlements.mjs +17 -10
- package/dist/errors.cjs +15 -8
- package/dist/errors.d.cts +24 -3
- package/dist/errors.d.ts +24 -3
- package/dist/errors.mjs +14 -7
- package/dist/firestore-compat.d.cts +1 -1
- package/dist/firestore-compat.d.ts +1 -1
- package/dist/index.cjs +1544 -1190
- package/dist/index.d.cts +177 -3
- package/dist/index.d.ts +177 -3
- package/dist/index.mjs +1676 -1329
- package/dist/mobile.cjs +400 -181
- package/dist/mobile.d.cts +59 -4
- package/dist/mobile.d.ts +59 -4
- package/dist/mobile.mjs +400 -181
- package/dist/mocks.cjs +9 -2
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.mjs +9 -2
- package/dist/notifications.cjs +197 -130
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.mjs +196 -129
- package/dist/react.cjs +303 -282
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +295 -274
- package/dist/support.cjs +299 -229
- package/dist/support.d.cts +8 -4
- package/dist/support.d.ts +8 -4
- package/dist/support.mjs +298 -228
- package/dist/telemetry.cjs +234 -167
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.mjs +234 -167
- package/dist/{types-Dx0IrOSF.d.ts → types-BYPk_3HR.d.ts} +104 -17
- package/dist/{types-Bx4kTLmk.d.cts → types-yv3EDKg2.d.cts} +104 -17
- package/dist/usage.cjs +183 -116
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/usage.mjs +183 -116
- package/dist/webhooks.cjs +215 -148
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/dist/webhooks.mjs +212 -145
- package/package.json +2 -1
package/dist/entitlements.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/errors.ts
|
|
4
|
-
var e = class
|
|
4
|
+
var e = class i extends Error {
|
|
5
5
|
code;
|
|
6
6
|
status;
|
|
7
7
|
requestId;
|
|
@@ -14,31 +14,38 @@ var e = class o extends Error {
|
|
|
14
14
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
15
15
|
*/
|
|
16
16
|
reason;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
19
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
20
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
21
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
22
|
+
*/
|
|
23
|
+
correlationId;
|
|
24
|
+
constructor(t, r, n, s, a, c) {
|
|
25
|
+
super(r), this.name = "NeetruError", this.code = t, this.status = n, this.requestId = s, this.reason = a, this.correlationId = c, Object.setPrototypeOf(this, i.prototype);
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
// src/entitlements.ts
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
throw new e("validation_failed",
|
|
30
|
+
var d = "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.";
|
|
31
|
+
function o() {
|
|
32
|
+
throw new e("validation_failed", d);
|
|
26
33
|
}
|
|
27
|
-
function
|
|
34
|
+
function p(i) {
|
|
28
35
|
return {
|
|
29
36
|
/**
|
|
30
37
|
* @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
|
|
31
38
|
* Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
|
|
32
39
|
*/
|
|
33
40
|
async check(t, r, n) {
|
|
34
|
-
|
|
41
|
+
o();
|
|
35
42
|
},
|
|
36
43
|
/**
|
|
37
44
|
* @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
|
|
38
45
|
* Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
|
|
39
46
|
*/
|
|
40
47
|
async checkDetailed(t, r, n) {
|
|
41
|
-
|
|
48
|
+
o();
|
|
42
49
|
},
|
|
43
50
|
/** Test helper legado — no-op (não há mais cache). Mantido por compat. */
|
|
44
51
|
__resetCache() {
|
|
@@ -46,4 +53,4 @@ function l(o) {
|
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
exports.createEntitlementsNamespace =
|
|
56
|
+
exports.createEntitlementsNamespace = p;
|
package/dist/entitlements.d.cts
CHANGED
package/dist/entitlements.d.ts
CHANGED
package/dist/entitlements.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/errors.ts
|
|
2
|
-
var e = class
|
|
2
|
+
var e = class i extends Error {
|
|
3
3
|
code;
|
|
4
4
|
status;
|
|
5
5
|
requestId;
|
|
@@ -12,31 +12,38 @@ var e = class o extends Error {
|
|
|
12
12
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
13
13
|
*/
|
|
14
14
|
reason;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
17
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
18
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
19
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
20
|
+
*/
|
|
21
|
+
correlationId;
|
|
22
|
+
constructor(t, r, n, s, a, c) {
|
|
23
|
+
super(r), this.name = "NeetruError", this.code = t, this.status = n, this.requestId = s, this.reason = a, this.correlationId = c, Object.setPrototypeOf(this, i.prototype);
|
|
17
24
|
}
|
|
18
25
|
};
|
|
19
26
|
|
|
20
27
|
// src/entitlements.ts
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
throw new e("validation_failed",
|
|
28
|
+
var d = "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.";
|
|
29
|
+
function o() {
|
|
30
|
+
throw new e("validation_failed", d);
|
|
24
31
|
}
|
|
25
|
-
function
|
|
32
|
+
function p(i) {
|
|
26
33
|
return {
|
|
27
34
|
/**
|
|
28
35
|
* @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
|
|
29
36
|
* Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
|
|
30
37
|
*/
|
|
31
38
|
async check(t, r, n) {
|
|
32
|
-
|
|
39
|
+
o();
|
|
33
40
|
},
|
|
34
41
|
/**
|
|
35
42
|
* @deprecated Endpoint morto no Core — sempre retornava `not_subscribed`.
|
|
36
43
|
* Lança `NeetruError`. Use `client.usage.check(resource, {productId, tenantId})`.
|
|
37
44
|
*/
|
|
38
45
|
async checkDetailed(t, r, n) {
|
|
39
|
-
|
|
46
|
+
o();
|
|
40
47
|
},
|
|
41
48
|
/** Test helper legado — no-op (não há mais cache). Mantido por compat. */
|
|
42
49
|
__resetCache() {
|
|
@@ -44,4 +51,4 @@ function l(o) {
|
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
export {
|
|
54
|
+
export { p as createEntitlementsNamespace };
|
package/dist/errors.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/errors.ts
|
|
4
|
-
var
|
|
4
|
+
var s = class e extends Error {
|
|
5
5
|
code;
|
|
6
6
|
status;
|
|
7
7
|
requestId;
|
|
@@ -14,14 +14,21 @@ var o = class e extends Error {
|
|
|
14
14
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
15
15
|
*/
|
|
16
16
|
reason;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
19
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
20
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
21
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
22
|
+
*/
|
|
23
|
+
correlationId;
|
|
24
|
+
constructor(r, t, i, n, o, a) {
|
|
25
|
+
super(t), this.name = "NeetruError", this.code = r, this.status = i, this.requestId = n, this.reason = o, this.correlationId = a, Object.setPrototypeOf(this, e.prototype);
|
|
19
26
|
}
|
|
20
|
-
},
|
|
21
|
-
constructor(r, t, i, n) {
|
|
22
|
-
super("auth_required", r, i, n, t), this.name = "NeetruAuthRequiredError", Object.setPrototypeOf(this, e.prototype);
|
|
27
|
+
}, d = class e extends s {
|
|
28
|
+
constructor(r, t, i, n, o) {
|
|
29
|
+
super("auth_required", r, i, n, t, o), this.name = "NeetruAuthRequiredError", Object.setPrototypeOf(this, e.prototype);
|
|
23
30
|
}
|
|
24
31
|
};
|
|
25
32
|
|
|
26
|
-
exports.NeetruAuthRequiredError =
|
|
27
|
-
exports.NeetruError =
|
|
33
|
+
exports.NeetruAuthRequiredError = d;
|
|
34
|
+
exports.NeetruError = s;
|
package/dist/errors.d.cts
CHANGED
|
@@ -34,7 +34,21 @@ type NeetruErrorCode = 'invalid_config' | 'missing_api_key' | 'unauthorized' | '
|
|
|
34
34
|
*/
|
|
35
35
|
| 'auth_required'
|
|
36
36
|
/** 3.7.0: HTTP 410 — endpoint descontinuado/removido no Core. */
|
|
37
|
-
| 'gone'
|
|
37
|
+
| 'gone'
|
|
38
|
+
/**
|
|
39
|
+
* 3.8.0: a credencial `nrt_` do produto (só de servidor) chegou a um runtime
|
|
40
|
+
* de navegador ou React Native com `strictServerOnlyKey: true` — ou ao
|
|
41
|
+
* entrypoint `@neetru/sdk/mobile`, que recusa chave sempre.
|
|
42
|
+
*/
|
|
43
|
+
| 'server_only_key'
|
|
44
|
+
/**
|
|
45
|
+
* 3.8.0: o token apresentado não é um access_token OIDC válido para esta API
|
|
46
|
+
* (ex.: é um id_token, um refresh_token ou a chave `nrt_`; falta `jti`/`scope`;
|
|
47
|
+
* `client_id` diverge do `aud`; token de máquina sem `allowClientCredentials`).
|
|
48
|
+
*/
|
|
49
|
+
| 'token_invalid'
|
|
50
|
+
/** 3.8.0: o access_token é válido mas não tem todos os escopos exigidos (HTTP 403). */
|
|
51
|
+
| 'insufficient_scope' | 'unknown';
|
|
38
52
|
/**
|
|
39
53
|
* Erro tipado padrão do SDK. Sempre lançado em vez de Error genérico.
|
|
40
54
|
*
|
|
@@ -59,7 +73,14 @@ declare class NeetruError extends Error {
|
|
|
59
73
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
60
74
|
*/
|
|
61
75
|
readonly reason?: string;
|
|
62
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
78
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
79
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
80
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
81
|
+
*/
|
|
82
|
+
readonly correlationId?: string;
|
|
83
|
+
constructor(code: NeetruErrorCode | string, message: string, status?: number, requestId?: string, reason?: string, correlationId?: string);
|
|
63
84
|
}
|
|
64
85
|
/**
|
|
65
86
|
* 3.7.0 — a operação exige a identidade do USUÁRIO FINAL (id_token OIDC do
|
|
@@ -86,7 +107,7 @@ declare class NeetruError extends Error {
|
|
|
86
107
|
* ```
|
|
87
108
|
*/
|
|
88
109
|
declare class NeetruAuthRequiredError extends NeetruError {
|
|
89
|
-
constructor(message: string, reason: string, status?: number, requestId?: string);
|
|
110
|
+
constructor(message: string, reason: string, status?: number, requestId?: string, correlationId?: string);
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
export { NeetruAuthRequiredError, NeetruError, type NeetruErrorCode };
|
package/dist/errors.d.ts
CHANGED
|
@@ -34,7 +34,21 @@ type NeetruErrorCode = 'invalid_config' | 'missing_api_key' | 'unauthorized' | '
|
|
|
34
34
|
*/
|
|
35
35
|
| 'auth_required'
|
|
36
36
|
/** 3.7.0: HTTP 410 — endpoint descontinuado/removido no Core. */
|
|
37
|
-
| 'gone'
|
|
37
|
+
| 'gone'
|
|
38
|
+
/**
|
|
39
|
+
* 3.8.0: a credencial `nrt_` do produto (só de servidor) chegou a um runtime
|
|
40
|
+
* de navegador ou React Native com `strictServerOnlyKey: true` — ou ao
|
|
41
|
+
* entrypoint `@neetru/sdk/mobile`, que recusa chave sempre.
|
|
42
|
+
*/
|
|
43
|
+
| 'server_only_key'
|
|
44
|
+
/**
|
|
45
|
+
* 3.8.0: o token apresentado não é um access_token OIDC válido para esta API
|
|
46
|
+
* (ex.: é um id_token, um refresh_token ou a chave `nrt_`; falta `jti`/`scope`;
|
|
47
|
+
* `client_id` diverge do `aud`; token de máquina sem `allowClientCredentials`).
|
|
48
|
+
*/
|
|
49
|
+
| 'token_invalid'
|
|
50
|
+
/** 3.8.0: o access_token é válido mas não tem todos os escopos exigidos (HTTP 403). */
|
|
51
|
+
| 'insufficient_scope' | 'unknown';
|
|
38
52
|
/**
|
|
39
53
|
* Erro tipado padrão do SDK. Sempre lançado em vez de Error genérico.
|
|
40
54
|
*
|
|
@@ -59,7 +73,14 @@ declare class NeetruError extends Error {
|
|
|
59
73
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
60
74
|
*/
|
|
61
75
|
readonly reason?: string;
|
|
62
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
78
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
79
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
80
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
81
|
+
*/
|
|
82
|
+
readonly correlationId?: string;
|
|
83
|
+
constructor(code: NeetruErrorCode | string, message: string, status?: number, requestId?: string, reason?: string, correlationId?: string);
|
|
63
84
|
}
|
|
64
85
|
/**
|
|
65
86
|
* 3.7.0 — a operação exige a identidade do USUÁRIO FINAL (id_token OIDC do
|
|
@@ -86,7 +107,7 @@ declare class NeetruError extends Error {
|
|
|
86
107
|
* ```
|
|
87
108
|
*/
|
|
88
109
|
declare class NeetruAuthRequiredError extends NeetruError {
|
|
89
|
-
constructor(message: string, reason: string, status?: number, requestId?: string);
|
|
110
|
+
constructor(message: string, reason: string, status?: number, requestId?: string, correlationId?: string);
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
export { NeetruAuthRequiredError, NeetruError, type NeetruErrorCode };
|
package/dist/errors.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/errors.ts
|
|
2
|
-
var
|
|
2
|
+
var s = class e extends Error {
|
|
3
3
|
code;
|
|
4
4
|
status;
|
|
5
5
|
requestId;
|
|
@@ -12,13 +12,20 @@ var o = class e extends Error {
|
|
|
12
12
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
13
13
|
*/
|
|
14
14
|
reason;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
17
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
18
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
19
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
20
|
+
*/
|
|
21
|
+
correlationId;
|
|
22
|
+
constructor(r, t, i, n, o, a) {
|
|
23
|
+
super(t), this.name = "NeetruError", this.code = r, this.status = i, this.requestId = n, this.reason = o, this.correlationId = a, Object.setPrototypeOf(this, e.prototype);
|
|
17
24
|
}
|
|
18
|
-
},
|
|
19
|
-
constructor(r, t, i, n) {
|
|
20
|
-
super("auth_required", r, i, n, t), this.name = "NeetruAuthRequiredError", Object.setPrototypeOf(this, e.prototype);
|
|
25
|
+
}, d = class e extends s {
|
|
26
|
+
constructor(r, t, i, n, o) {
|
|
27
|
+
super("auth_required", r, i, n, t, o), this.name = "NeetruAuthRequiredError", Object.setPrototypeOf(this, e.prototype);
|
|
21
28
|
}
|
|
22
29
|
};
|
|
23
30
|
|
|
24
|
-
export {
|
|
31
|
+
export { d as NeetruAuthRequiredError, s as NeetruError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as NeetruDb, E as DbCollectionRef, Q as FieldSentinel, K as DbQuery } from './types-yv3EDKg2.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as NeetruDb, E as DbCollectionRef, Q as FieldSentinel, K as DbQuery } from './types-BYPk_3HR.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
|
4
4
|
|