@getlatedev/node 0.2.1208 → 0.2.1209
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/README.md +3 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
- package/src/client.ts +13 -5
- package/src/generated/types.gen.ts +1 -1
package/README.md
CHANGED
|
@@ -52,10 +52,12 @@ console.log(`Published to ${post.platforms.length} platforms!`);
|
|
|
52
52
|
const zernio = new Zernio({
|
|
53
53
|
apiKey: 'your-api-key', // Defaults to process.env['ZERNIO_API_KEY']
|
|
54
54
|
baseURL: 'https://zernio.com/api',
|
|
55
|
-
timeout:
|
|
55
|
+
timeout: 300000,
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
A per-call `signal` overrides `timeout`, and a timed-out call rejects with a `TimeoutError`.
|
|
60
|
+
|
|
59
61
|
## Examples
|
|
60
62
|
|
|
61
63
|
### Schedule a Post
|
package/dist/index.d.mts
CHANGED
|
@@ -11,8 +11,8 @@ interface ClientOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
baseURL?: string | null | undefined;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @default
|
|
14
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
15
|
+
* @default 300000
|
|
16
16
|
*/
|
|
17
17
|
timeout?: number;
|
|
18
18
|
/**
|
|
@@ -46,7 +46,7 @@ interface ClientOptions {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
declare class Zernio {
|
|
49
|
-
private
|
|
49
|
+
private _timeout;
|
|
50
50
|
/**
|
|
51
51
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
52
52
|
* to it, so two Zernio instances in the same process never see each other's
|
|
@@ -71,7 +71,7 @@ declare class Zernio {
|
|
|
71
71
|
* Routes a generated operation through this instance's client, preserving the
|
|
72
72
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
73
73
|
* when it is bound, because class fields initialize before the constructor
|
|
74
|
-
* body runs.
|
|
74
|
+
* body runs. Each call gets its own timeout signal.
|
|
75
75
|
*/
|
|
76
76
|
private _bind;
|
|
77
77
|
/**
|
|
@@ -9451,7 +9451,7 @@ type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
9451
9451
|
*/
|
|
9452
9452
|
type timeframe = 'this_week' | 'this_month';
|
|
9453
9453
|
/**
|
|
9454
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
9454
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
9455
9455
|
*/
|
|
9456
9456
|
type InstagramPlatformData = {
|
|
9457
9457
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ interface ClientOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
baseURL?: string | null | undefined;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @default
|
|
14
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
15
|
+
* @default 300000
|
|
16
16
|
*/
|
|
17
17
|
timeout?: number;
|
|
18
18
|
/**
|
|
@@ -46,7 +46,7 @@ interface ClientOptions {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
declare class Zernio {
|
|
49
|
-
private
|
|
49
|
+
private _timeout;
|
|
50
50
|
/**
|
|
51
51
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
52
52
|
* to it, so two Zernio instances in the same process never see each other's
|
|
@@ -71,7 +71,7 @@ declare class Zernio {
|
|
|
71
71
|
* Routes a generated operation through this instance's client, preserving the
|
|
72
72
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
73
73
|
* when it is bound, because class fields initialize before the constructor
|
|
74
|
-
* body runs.
|
|
74
|
+
* body runs. Each call gets its own timeout signal.
|
|
75
75
|
*/
|
|
76
76
|
private _bind;
|
|
77
77
|
/**
|
|
@@ -9451,7 +9451,7 @@ type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
9451
9451
|
*/
|
|
9452
9452
|
type timeframe = 'this_week' | 'this_month';
|
|
9453
9453
|
/**
|
|
9454
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
9454
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
9455
9455
|
*/
|
|
9456
9456
|
type InstagramPlatformData = {
|
|
9457
9457
|
/**
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
// package.json
|
|
37
37
|
var package_default = {
|
|
38
38
|
name: "@getlatedev/node",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.1209",
|
|
40
40
|
description: "The official Node.js library for the Zernio API",
|
|
41
41
|
main: "dist/index.js",
|
|
42
42
|
module: "dist/index.mjs",
|
|
@@ -8128,7 +8128,8 @@ var Zernio = class _Zernio {
|
|
|
8128
8128
|
}
|
|
8129
8129
|
this.apiKey = apiKey;
|
|
8130
8130
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8131
|
-
|
|
8131
|
+
const timeout = options.timeout ?? 3e5;
|
|
8132
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8132
8133
|
this._client = M(
|
|
8133
8134
|
q({
|
|
8134
8135
|
baseUrl: this.baseURL,
|
|
@@ -8159,7 +8160,7 @@ var Zernio = class _Zernio {
|
|
|
8159
8160
|
* Routes a generated operation through this instance's client, preserving the
|
|
8160
8161
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8161
8162
|
* when it is bound, because class fields initialize before the constructor
|
|
8162
|
-
* body runs.
|
|
8163
|
+
* body runs. Each call gets its own timeout signal.
|
|
8163
8164
|
*/
|
|
8164
8165
|
_bind(operation) {
|
|
8165
8166
|
return ((options) => {
|
|
@@ -8167,6 +8168,9 @@ var Zernio = class _Zernio {
|
|
|
8167
8168
|
if (withClient["client"] === void 0) {
|
|
8168
8169
|
withClient["client"] = this._dispatchClient;
|
|
8169
8170
|
}
|
|
8171
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8172
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8173
|
+
}
|
|
8170
8174
|
return operation(withClient);
|
|
8171
8175
|
});
|
|
8172
8176
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@getlatedev/node",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1209",
|
|
9
9
|
description: "The official Node.js library for the Zernio API",
|
|
10
10
|
main: "dist/index.js",
|
|
11
11
|
module: "dist/index.mjs",
|
|
@@ -8097,7 +8097,8 @@ var Zernio = class _Zernio {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
this.apiKey = apiKey;
|
|
8099
8099
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8100
|
-
|
|
8100
|
+
const timeout = options.timeout ?? 3e5;
|
|
8101
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8101
8102
|
this._client = M(
|
|
8102
8103
|
q({
|
|
8103
8104
|
baseUrl: this.baseURL,
|
|
@@ -8128,7 +8129,7 @@ var Zernio = class _Zernio {
|
|
|
8128
8129
|
* Routes a generated operation through this instance's client, preserving the
|
|
8129
8130
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8130
8131
|
* when it is bound, because class fields initialize before the constructor
|
|
8131
|
-
* body runs.
|
|
8132
|
+
* body runs. Each call gets its own timeout signal.
|
|
8132
8133
|
*/
|
|
8133
8134
|
_bind(operation) {
|
|
8134
8135
|
return ((options) => {
|
|
@@ -8136,6 +8137,9 @@ var Zernio = class _Zernio {
|
|
|
8136
8137
|
if (withClient["client"] === void 0) {
|
|
8137
8138
|
withClient["client"] = this._dispatchClient;
|
|
8138
8139
|
}
|
|
8140
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8141
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8142
|
+
}
|
|
8139
8143
|
return operation(withClient);
|
|
8140
8144
|
});
|
|
8141
8145
|
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -983,8 +983,8 @@ export interface ClientOptions {
|
|
|
983
983
|
baseURL?: string | null | undefined;
|
|
984
984
|
|
|
985
985
|
/**
|
|
986
|
-
*
|
|
987
|
-
* @default
|
|
986
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
987
|
+
* @default 300000
|
|
988
988
|
*/
|
|
989
989
|
timeout?: number;
|
|
990
990
|
|
|
@@ -1019,7 +1019,7 @@ export interface ClientOptions {
|
|
|
1019
1019
|
* ```
|
|
1020
1020
|
*/
|
|
1021
1021
|
export class Zernio {
|
|
1022
|
-
private
|
|
1022
|
+
private _timeout: number | undefined;
|
|
1023
1023
|
|
|
1024
1024
|
/**
|
|
1025
1025
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
@@ -1049,7 +1049,7 @@ export class Zernio {
|
|
|
1049
1049
|
* Routes a generated operation through this instance's client, preserving the
|
|
1050
1050
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
1051
1051
|
* when it is bound, because class fields initialize before the constructor
|
|
1052
|
-
* body runs.
|
|
1052
|
+
* body runs. Each call gets its own timeout signal.
|
|
1053
1053
|
*/
|
|
1054
1054
|
private _bind<F>(operation: F): F {
|
|
1055
1055
|
return ((options?: Record<string, unknown>) => {
|
|
@@ -1057,6 +1057,10 @@ export class Zernio {
|
|
|
1057
1057
|
if (withClient['client'] === undefined) {
|
|
1058
1058
|
withClient['client'] = this._dispatchClient;
|
|
1059
1059
|
}
|
|
1060
|
+
// A caller signal replaces the timeout instead of joining it: AbortSignal.any needs Node 18.17 and engines allows 18.0.
|
|
1061
|
+
if (withClient['signal'] === undefined && this._timeout !== undefined) {
|
|
1062
|
+
withClient['signal'] = AbortSignal.timeout(this._timeout);
|
|
1063
|
+
}
|
|
1060
1064
|
return (operation as (opts: unknown) => unknown)(withClient);
|
|
1061
1065
|
}) as F;
|
|
1062
1066
|
}
|
|
@@ -3016,7 +3020,11 @@ export class Zernio {
|
|
|
3016
3020
|
|
|
3017
3021
|
this.apiKey = apiKey;
|
|
3018
3022
|
this.baseURL = options.baseURL ?? 'https://zernio.com/api';
|
|
3019
|
-
|
|
3023
|
+
// AbortSignal.timeout throws a RangeError outside uint32 integers, and `timeout` was
|
|
3024
|
+
// ignored by every earlier release, so no value an integrator already passes may start throwing.
|
|
3025
|
+
const timeout = options.timeout ?? 300000;
|
|
3026
|
+
this._timeout =
|
|
3027
|
+
timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : undefined;
|
|
3020
3028
|
|
|
3021
3029
|
// One client per instance. Interceptors used to be registered on the
|
|
3022
3030
|
// module-global client, so every `new Zernio()` stacked another auth
|
|
@@ -7762,7 +7762,7 @@ export type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
7762
7762
|
export type timeframe = 'this_week' | 'this_month';
|
|
7763
7763
|
|
|
7764
7764
|
/**
|
|
7765
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
7765
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
7766
7766
|
*/
|
|
7767
7767
|
export type InstagramPlatformData = {
|
|
7768
7768
|
/**
|