@paid-ai/paid-node 0.0.6 → 0.0.7
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/dist/cjs/Client.d.ts +1 -1
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/BatchUsage.d.ts +6 -0
- package/dist/cjs/wrapper/BatchUsage.js +24 -0
- package/dist/esm/Client.d.mts +1 -1
- package/dist/esm/Client.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/BatchUsage.d.mts +6 -0
- package/dist/esm/wrapper/BatchUsage.mjs +20 -0
- package/package.json +1 -1
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Customers } from "./api/resources/customers/client/Client.js";
|
|
|
7
7
|
import { Agents } from "./api/resources/agents/client/Client.js";
|
|
8
8
|
import { Contacts } from "./api/resources/contacts/client/Client.js";
|
|
9
9
|
import { Orders } from "./api/resources/orders/client/Client.js";
|
|
10
|
-
import { Usage } from "./
|
|
10
|
+
import { Usage } from "./wrapper/BatchUsage.js";
|
|
11
11
|
export declare namespace PaidClient {
|
|
12
12
|
interface Options {
|
|
13
13
|
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -43,7 +43,7 @@ const Client_js_1 = require("./api/resources/customers/client/Client.js");
|
|
|
43
43
|
const Client_js_2 = require("./api/resources/agents/client/Client.js");
|
|
44
44
|
const Client_js_3 = require("./api/resources/contacts/client/Client.js");
|
|
45
45
|
const Client_js_4 = require("./api/resources/orders/client/Client.js");
|
|
46
|
-
const
|
|
46
|
+
const BatchUsage_js_1 = require("./wrapper/BatchUsage.js");
|
|
47
47
|
class PaidClient {
|
|
48
48
|
constructor(_options) {
|
|
49
49
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
@@ -73,7 +73,7 @@ class PaidClient {
|
|
|
73
73
|
}
|
|
74
74
|
get usage() {
|
|
75
75
|
var _a;
|
|
76
|
-
return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new
|
|
76
|
+
return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new BatchUsage_js_1.Usage(this._options)));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
exports.PaidClient = PaidClient;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.7";
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Usage = void 0;
|
|
4
|
+
const Client_1 = require("../api/resources/usage/client/Client");
|
|
5
|
+
class Usage extends Client_1.Usage {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.signals = [];
|
|
9
|
+
}
|
|
10
|
+
flush(requestOptions) {
|
|
11
|
+
return this.recordBulk({ signals: this.signals }, requestOptions);
|
|
12
|
+
}
|
|
13
|
+
recordUsage(signal, requestOptions) {
|
|
14
|
+
if (!this.signals) {
|
|
15
|
+
this.signals = [];
|
|
16
|
+
}
|
|
17
|
+
this.signals.push(signal);
|
|
18
|
+
if (this.signals.length >= 100) {
|
|
19
|
+
this.recordBulk({ signals: this.signals }, requestOptions);
|
|
20
|
+
this.signals = [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Usage = Usage;
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
|
7
7
|
import { Agents } from "./api/resources/agents/client/Client.mjs";
|
|
8
8
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
9
9
|
import { Orders } from "./api/resources/orders/client/Client.mjs";
|
|
10
|
-
import { Usage } from "./
|
|
10
|
+
import { Usage } from "./wrapper/BatchUsage.mjs";
|
|
11
11
|
export declare namespace PaidClient {
|
|
12
12
|
interface Options {
|
|
13
13
|
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
|
7
7
|
import { Agents } from "./api/resources/agents/client/Client.mjs";
|
|
8
8
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
9
9
|
import { Orders } from "./api/resources/orders/client/Client.mjs";
|
|
10
|
-
import { Usage } from "./
|
|
10
|
+
import { Usage } from "./wrapper/BatchUsage.mjs";
|
|
11
11
|
export class PaidClient {
|
|
12
12
|
constructor(_options) {
|
|
13
13
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.7";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.7";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Usage as UsageFernClient } from "../api/resources/usage/client/Client";
|
|
2
|
+
export class Usage extends UsageFernClient {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.signals = [];
|
|
6
|
+
}
|
|
7
|
+
flush(requestOptions) {
|
|
8
|
+
return this.recordBulk({ signals: this.signals }, requestOptions);
|
|
9
|
+
}
|
|
10
|
+
recordUsage(signal, requestOptions) {
|
|
11
|
+
if (!this.signals) {
|
|
12
|
+
this.signals = [];
|
|
13
|
+
}
|
|
14
|
+
this.signals.push(signal);
|
|
15
|
+
if (this.signals.length >= 100) {
|
|
16
|
+
this.recordBulk({ signals: this.signals }, requestOptions);
|
|
17
|
+
this.signals = [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|