@oapiex/sdk-kit 0.1.5 → 0.1.6
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 +38 -2
- package/dist/chunk-BLWcukCW.js +33 -0
- package/dist/chunk-BncF-t-1.cjs +48 -0
- package/dist/contracts.d.cts +2 -2
- package/dist/contracts.d.ts +2 -2
- package/dist/find-up-simple-2VxcW9os.cjs +34 -0
- package/dist/find-up-simple-y_v4Cpd8.js +30 -0
- package/dist/{index-DUI9uPJQ.d.ts → index-C_jXJLNo.d.ts} +8 -3
- package/dist/{index-JjhthUpt.d.cts → index-CuddPXII.d.cts} +8 -3
- package/dist/index.cjs +18220 -240
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +18027 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,14 +134,15 @@ await sdk.api.examples.list();
|
|
|
134
134
|
|
|
135
135
|
`Core` and `createSdk()` both accept the same `InitOptions` object.
|
|
136
136
|
|
|
137
|
-
- `clientId`:
|
|
138
|
-
- `clientSecret`:
|
|
137
|
+
- `clientId`: optional API client identifier, useful when your validator or auth exchange still needs client credentials
|
|
138
|
+
- `clientSecret`: optional when `auth` is already provided, otherwise required
|
|
139
139
|
- `environment`: selects `sandbox` or `live`
|
|
140
140
|
- `urls`: optional base URL overrides per environment
|
|
141
141
|
- `headers`: optional default headers added to every request
|
|
142
142
|
- `timeout`: optional Axios timeout in milliseconds
|
|
143
143
|
- `encryptionKey`: optional runtime encryption key override
|
|
144
144
|
- `auth`: one auth strategy or an array of strategies applied to outgoing requests
|
|
145
|
+
- `debugLevel`: optional HTTP debug verbosity, one of `0 | 1 | 2 | 3`
|
|
145
146
|
|
|
146
147
|
```ts
|
|
147
148
|
const sdk = new Core({
|
|
@@ -156,9 +157,44 @@ const sdk = new Core({
|
|
|
156
157
|
'X-Trace-Source': 'example-sdk',
|
|
157
158
|
},
|
|
158
159
|
timeout: 15000,
|
|
160
|
+
debugLevel: 1,
|
|
159
161
|
});
|
|
160
162
|
```
|
|
161
163
|
|
|
164
|
+
If you already have a token or API key strategy, you can initialize without client credentials:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
const sdk = new Core({
|
|
168
|
+
environment: 'sandbox',
|
|
169
|
+
auth: {
|
|
170
|
+
type: 'bearer',
|
|
171
|
+
token: process.env.ACCESS_TOKEN!,
|
|
172
|
+
},
|
|
173
|
+
debugLevel: 1,
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Debugging
|
|
178
|
+
|
|
179
|
+
SDK HTTP debugging is disabled by default.
|
|
180
|
+
|
|
181
|
+
- Use `sdk.debug(level)` after initialization when you want to enable or adjust request logging.
|
|
182
|
+
- Use `debugLevel` in `InitOptions` when you want debug logging active immediately during construction.
|
|
183
|
+
- Supported levels are `0 | 1 | 2 | 3`.
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
const sdk = new Core({
|
|
187
|
+
environment: 'sandbox',
|
|
188
|
+
auth: {
|
|
189
|
+
type: 'bearer',
|
|
190
|
+
token: process.env.ACCESS_TOKEN!,
|
|
191
|
+
},
|
|
192
|
+
debugLevel: 2,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
sdk.debug(3);
|
|
196
|
+
```
|
|
197
|
+
|
|
162
198
|
## Auth Shapes
|
|
163
199
|
|
|
164
200
|
The `auth` option accepts any `AuthConfig` supported by the transport layer.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __esm = (fn, res) => function() {
|
|
11
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
+
};
|
|
13
|
+
var __commonJS = (cb, mod) => function() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
+
value: mod,
|
|
28
|
+
enumerable: true
|
|
29
|
+
}) : target, mod));
|
|
30
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { __toESM as i, __esm as n, __require as r, __commonJS as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
+
key = keys[i];
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(exports, '__commonJS', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return __commonJS;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, '__esm', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return __esm;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, '__toESM', {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return __toESM;
|
|
47
|
+
}
|
|
48
|
+
});
|
package/dist/contracts.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BasicAuthConfig, BearerAuthConfig, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, Environment, ErrorResponse, HttpMethod, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, SuccessResponse, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, XGenericObject };
|
|
1
|
+
import { A as CountryCodeRestricted, C as UnifiedResponse, D as ValidationErrorResponse, E as ValidationError, O as XGenericObject, S as SuccessResponse, T as UserUrls, _ as NormalPagination, a as AuthErrorResponse, b as Response, c as BasicAuthConfig, d as CustomAuthConfig, f as DebugLevel, g as InitOptions, h as HttpMethod, i as AuthConfig, j as CurrencyCode, k as CountryCode, l as BearerAuthConfig, m as ErrorResponse, n as AccessValidationResult, o as AuthRequestConfig, p as Environment, r as ApiKeyAuthConfig, s as AuthResponse, t as AccessValidationConfigUpdate, u as CursorPagination, v as OAuth2AuthConfig, w as UserConfig, x as ResponseStatus, y as PageInfoMeta } from "./index-CuddPXII.cjs";
|
|
2
|
+
export { AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BasicAuthConfig, BearerAuthConfig, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, DebugLevel, Environment, ErrorResponse, HttpMethod, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, SuccessResponse, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, XGenericObject };
|
package/dist/contracts.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BasicAuthConfig, BearerAuthConfig, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, Environment, ErrorResponse, HttpMethod, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, SuccessResponse, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, XGenericObject };
|
|
1
|
+
import { A as CountryCodeRestricted, C as UnifiedResponse, D as ValidationErrorResponse, E as ValidationError, O as XGenericObject, S as SuccessResponse, T as UserUrls, _ as NormalPagination, a as AuthErrorResponse, b as Response, c as BasicAuthConfig, d as CustomAuthConfig, f as DebugLevel, g as InitOptions, h as HttpMethod, i as AuthConfig, j as CurrencyCode, k as CountryCode, l as BearerAuthConfig, m as ErrorResponse, n as AccessValidationResult, o as AuthRequestConfig, p as Environment, r as ApiKeyAuthConfig, s as AuthResponse, t as AccessValidationConfigUpdate, u as CursorPagination, v as OAuth2AuthConfig, w as UserConfig, x as ResponseStatus, y as PageInfoMeta } from "./index-C_jXJLNo.js";
|
|
2
|
+
export { AccessValidationConfigUpdate, AccessValidationResult, ApiKeyAuthConfig, AuthConfig, AuthErrorResponse, AuthRequestConfig, AuthResponse, BasicAuthConfig, BearerAuthConfig, CountryCode, CountryCodeRestricted, CurrencyCode, CursorPagination, CustomAuthConfig, DebugLevel, Environment, ErrorResponse, HttpMethod, InitOptions, NormalPagination, OAuth2AuthConfig, PageInfoMeta, Response, ResponseStatus, SuccessResponse, UnifiedResponse, UserConfig, UserUrls, ValidationError, ValidationErrorResponse, XGenericObject };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BncF-t-1.cjs');
|
|
2
|
+
let node_process = require("node:process");
|
|
3
|
+
node_process = require_chunk.__toESM(node_process);
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_chunk.__toESM(node_path);
|
|
6
|
+
let node_fs_promises = require("node:fs/promises");
|
|
7
|
+
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
8
|
+
let node_url = require("node:url");
|
|
9
|
+
node_url = require_chunk.__toESM(node_url);
|
|
10
|
+
|
|
11
|
+
//#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
12
|
+
async function findUp(name, { cwd = node_process.default.cwd(), type = "file", stopAt } = {}) {
|
|
13
|
+
let directory = node_path.default.resolve(toPath(cwd) ?? "");
|
|
14
|
+
const { root } = node_path.default.parse(directory);
|
|
15
|
+
stopAt = node_path.default.resolve(directory, toPath(stopAt ?? root));
|
|
16
|
+
const isAbsoluteName = node_path.default.isAbsolute(name);
|
|
17
|
+
while (directory) {
|
|
18
|
+
const filePath = isAbsoluteName ? name : node_path.default.join(directory, name);
|
|
19
|
+
try {
|
|
20
|
+
const stats = await node_fs_promises.default.stat(filePath);
|
|
21
|
+
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
22
|
+
} catch {}
|
|
23
|
+
if (directory === stopAt || directory === root) break;
|
|
24
|
+
directory = node_path.default.dirname(directory);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
var toPath;
|
|
28
|
+
var init_find_up_simple = require_chunk.__esm({ "../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js": (() => {
|
|
29
|
+
toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, node_url.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
30
|
+
}) });
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
init_find_up_simple();
|
|
34
|
+
exports.findUp = findUp;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as __esm } from "./chunk-BLWcukCW.js";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import fsPromises from "node:fs/promises";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
//#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
8
|
+
async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
9
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
10
|
+
const { root } = path.parse(directory);
|
|
11
|
+
stopAt = path.resolve(directory, toPath(stopAt ?? root));
|
|
12
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
13
|
+
while (directory) {
|
|
14
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
15
|
+
try {
|
|
16
|
+
const stats = await fsPromises.stat(filePath);
|
|
17
|
+
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
18
|
+
} catch {}
|
|
19
|
+
if (directory === stopAt || directory === root) break;
|
|
20
|
+
directory = path.dirname(directory);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var toPath;
|
|
24
|
+
var init_find_up_simple = __esm({ "../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js": (() => {
|
|
25
|
+
toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
26
|
+
}) });
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
init_find_up_simple();
|
|
30
|
+
export { findUp };
|
|
@@ -10,6 +10,7 @@ interface XGenericObject {
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/Contracts/Core.d.ts
|
|
12
12
|
type Environment = 'sandbox' | 'live';
|
|
13
|
+
type DebugLevel = 0 | 1 | 2 | 3;
|
|
13
14
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
14
15
|
type ResponseStatus = 'failed' | 'success';
|
|
15
16
|
interface ValidationError {
|
|
@@ -124,11 +125,11 @@ interface InitOptions {
|
|
|
124
125
|
/**
|
|
125
126
|
* Your API Public Key
|
|
126
127
|
*/
|
|
127
|
-
clientId
|
|
128
|
+
clientId?: string;
|
|
128
129
|
/**
|
|
129
130
|
* Your API Secret Key
|
|
130
131
|
*/
|
|
131
|
-
clientSecret
|
|
132
|
+
clientSecret?: string;
|
|
132
133
|
/**
|
|
133
134
|
* Your API Encryption Key
|
|
134
135
|
*/
|
|
@@ -153,6 +154,10 @@ interface InitOptions {
|
|
|
153
154
|
* Request authentication strategy or strategies.
|
|
154
155
|
*/
|
|
155
156
|
auth?: AuthConfig | AuthConfig[];
|
|
157
|
+
/**
|
|
158
|
+
* HTTP debug verbosity. Use 0 to disable logging.
|
|
159
|
+
*/
|
|
160
|
+
debugLevel?: DebugLevel;
|
|
156
161
|
}
|
|
157
162
|
interface UserConfig {
|
|
158
163
|
environment?: Environment;
|
|
@@ -163,4 +168,4 @@ interface UserConfig {
|
|
|
163
168
|
auth?: AuthConfig | AuthConfig[];
|
|
164
169
|
}
|
|
165
170
|
//#endregion
|
|
166
|
-
export {
|
|
171
|
+
export { CountryCodeRestricted as A, UnifiedResponse as C, ValidationErrorResponse as D, ValidationError as E, XGenericObject as O, SuccessResponse as S, UserUrls as T, NormalPagination as _, AuthErrorResponse as a, Response as b, BasicAuthConfig as c, CustomAuthConfig as d, DebugLevel as f, InitOptions as g, HttpMethod as h, AuthConfig as i, CurrencyCode as j, CountryCode as k, BearerAuthConfig as l, ErrorResponse as m, AccessValidationResult as n, AuthRequestConfig as o, Environment as p, ApiKeyAuthConfig as r, AuthResponse as s, AccessValidationConfigUpdate as t, CursorPagination as u, OAuth2AuthConfig as v, UserConfig as w, ResponseStatus as x, PageInfoMeta as y };
|
|
@@ -10,6 +10,7 @@ interface XGenericObject {
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/Contracts/Core.d.ts
|
|
12
12
|
type Environment = 'sandbox' | 'live';
|
|
13
|
+
type DebugLevel = 0 | 1 | 2 | 3;
|
|
13
14
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
14
15
|
type ResponseStatus = 'failed' | 'success';
|
|
15
16
|
interface ValidationError {
|
|
@@ -124,11 +125,11 @@ interface InitOptions {
|
|
|
124
125
|
/**
|
|
125
126
|
* Your API Public Key
|
|
126
127
|
*/
|
|
127
|
-
clientId
|
|
128
|
+
clientId?: string;
|
|
128
129
|
/**
|
|
129
130
|
* Your API Secret Key
|
|
130
131
|
*/
|
|
131
|
-
clientSecret
|
|
132
|
+
clientSecret?: string;
|
|
132
133
|
/**
|
|
133
134
|
* Your API Encryption Key
|
|
134
135
|
*/
|
|
@@ -153,6 +154,10 @@ interface InitOptions {
|
|
|
153
154
|
* Request authentication strategy or strategies.
|
|
154
155
|
*/
|
|
155
156
|
auth?: AuthConfig | AuthConfig[];
|
|
157
|
+
/**
|
|
158
|
+
* HTTP debug verbosity. Use 0 to disable logging.
|
|
159
|
+
*/
|
|
160
|
+
debugLevel?: DebugLevel;
|
|
156
161
|
}
|
|
157
162
|
interface UserConfig {
|
|
158
163
|
environment?: Environment;
|
|
@@ -163,4 +168,4 @@ interface UserConfig {
|
|
|
163
168
|
auth?: AuthConfig | AuthConfig[];
|
|
164
169
|
}
|
|
165
170
|
//#endregion
|
|
166
|
-
export {
|
|
171
|
+
export { CountryCodeRestricted as A, UnifiedResponse as C, ValidationErrorResponse as D, ValidationError as E, XGenericObject as O, SuccessResponse as S, UserUrls as T, NormalPagination as _, AuthErrorResponse as a, Response as b, BasicAuthConfig as c, CustomAuthConfig as d, DebugLevel as f, InitOptions as g, HttpMethod as h, AuthConfig as i, CurrencyCode as j, CountryCode as k, BearerAuthConfig as l, ErrorResponse as m, AccessValidationResult as n, AuthRequestConfig as o, Environment as p, ApiKeyAuthConfig as r, AuthResponse as s, AccessValidationConfigUpdate as t, CursorPagination as u, OAuth2AuthConfig as v, UserConfig as w, ResponseStatus as x, PageInfoMeta as y };
|