@oapiex/sdk-kit 0.1.6 → 0.1.9
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 +54 -0
- package/dist/contracts.d.cts +1 -1
- package/dist/contracts.d.ts +1 -1
- package/dist/{find-up-simple-2VxcW9os.cjs → find-up-simple-BGJv1vWM.cjs} +2 -2
- package/dist/{find-up-simple-y_v4Cpd8.js → find-up-simple-eHmrWCoZ.js} +1 -1
- package/dist/{index-C_jXJLNo.d.ts → index-BA7Ul1Pi.d.cts} +1 -8
- package/dist/{index-CuddPXII.d.cts → index-BM1p0FMj.d.ts} +1 -8
- package/dist/index.cjs +188 -105
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +219 -139
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -174,6 +174,60 @@ const sdk = new Core({
|
|
|
174
174
|
});
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
`@oapiex/sdk-kit` can also read SDK init config from `oapiex.config.ts`, `oapiex.config.js`, or `oapiex.config.cjs` in the current working directory.
|
|
178
|
+
|
|
179
|
+
For an SDK-focused config file, prefer `defineConfig()` from `@oapiex/sdk-kit`:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
import { defineConfig } from '@oapiex/sdk-kit';
|
|
183
|
+
|
|
184
|
+
export default defineConfig({
|
|
185
|
+
clientId: process.env.CLIENT_ID,
|
|
186
|
+
clientSecret: process.env.CLIENT_SECRET,
|
|
187
|
+
environment: 'sandbox',
|
|
188
|
+
urls: {
|
|
189
|
+
sandbox: 'https://sandbox-api.example.com',
|
|
190
|
+
},
|
|
191
|
+
headers: {
|
|
192
|
+
'X-Trace-Source': 'example-sdk',
|
|
193
|
+
},
|
|
194
|
+
timeout: 15000,
|
|
195
|
+
auth: {
|
|
196
|
+
type: 'bearer',
|
|
197
|
+
token: process.env.ACCESS_TOKEN,
|
|
198
|
+
},
|
|
199
|
+
debugLevel: 1,
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
If you use the same `oapiex.config.*` file for extraction and SDK runtime defaults, prefer the root `oapiex` helper and scope the SDK settings under `sdkKit`:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { defineConfig } from 'oapiex';
|
|
207
|
+
|
|
208
|
+
export default defineConfig({
|
|
209
|
+
sdkKit: {
|
|
210
|
+
clientId: process.env.CLIENT_ID,
|
|
211
|
+
clientSecret: process.env.CLIENT_SECRET,
|
|
212
|
+
environment: 'sandbox',
|
|
213
|
+
urls: {
|
|
214
|
+
sandbox: 'https://sandbox-api.example.com',
|
|
215
|
+
},
|
|
216
|
+
headers: {
|
|
217
|
+
'X-Trace-Source': 'example-sdk',
|
|
218
|
+
},
|
|
219
|
+
timeout: 15000,
|
|
220
|
+
auth: {
|
|
221
|
+
type: 'bearer',
|
|
222
|
+
token: process.env.ACCESS_TOKEN,
|
|
223
|
+
},
|
|
224
|
+
debugLevel: 1,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Explicit constructor options override values loaded from `oapiex.config.*`.
|
|
230
|
+
|
|
177
231
|
## Debugging
|
|
178
232
|
|
|
179
233
|
SDK HTTP debugging is disabled by default.
|
package/dist/contracts.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-BA7Ul1Pi.cjs";
|
|
2
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 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-
|
|
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-BM1p0FMj.js";
|
|
2
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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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
2
|
let node_path = require("node:path");
|
|
5
3
|
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
node_process = require_chunk.__toESM(node_process);
|
|
6
6
|
let node_fs_promises = require("node:fs/promises");
|
|
7
7
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
8
8
|
let node_url = require("node:url");
|
|
@@ -159,13 +159,6 @@ interface InitOptions {
|
|
|
159
159
|
*/
|
|
160
160
|
debugLevel?: DebugLevel;
|
|
161
161
|
}
|
|
162
|
-
interface UserConfig {
|
|
163
|
-
environment?: Environment;
|
|
164
|
-
urls?: UserUrls;
|
|
165
|
-
headers?: Record<string, string>;
|
|
166
|
-
timeout?: number;
|
|
167
|
-
encryptionKey?: string;
|
|
168
|
-
auth?: AuthConfig | AuthConfig[];
|
|
169
|
-
}
|
|
162
|
+
interface UserConfig extends InitOptions {}
|
|
170
163
|
//#endregion
|
|
171
164
|
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 };
|
|
@@ -159,13 +159,6 @@ interface InitOptions {
|
|
|
159
159
|
*/
|
|
160
160
|
debugLevel?: DebugLevel;
|
|
161
161
|
}
|
|
162
|
-
interface UserConfig {
|
|
163
|
-
environment?: Environment;
|
|
164
|
-
urls?: UserUrls;
|
|
165
|
-
headers?: Record<string, string>;
|
|
166
|
-
timeout?: number;
|
|
167
|
-
encryptionKey?: string;
|
|
168
|
-
auth?: AuthConfig | AuthConfig[];
|
|
169
|
-
}
|
|
162
|
+
interface UserConfig extends InitOptions {}
|
|
170
163
|
//#endregion
|
|
171
164
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,10 @@ let axios = require("axios");
|
|
|
4
4
|
axios = require_chunk.__toESM(axios);
|
|
5
5
|
let path = require("path");
|
|
6
6
|
path = require_chunk.__toESM(path);
|
|
7
|
+
let jiti = require("jiti");
|
|
8
|
+
jiti = require_chunk.__toESM(jiti);
|
|
9
|
+
let node_path = require("node:path");
|
|
10
|
+
node_path = require_chunk.__toESM(node_path);
|
|
7
11
|
let crypto = require("crypto");
|
|
8
12
|
crypto = require_chunk.__toESM(crypto);
|
|
9
13
|
let node_process = require("node:process");
|
|
@@ -79,39 +83,96 @@ const buildUrl = (baseUrl, ...endpoint) => {
|
|
|
79
83
|
|
|
80
84
|
//#endregion
|
|
81
85
|
//#region src/utilities/Manager.ts
|
|
86
|
+
const CONFIG_BASENAMES = [
|
|
87
|
+
"oapiex.config.ts",
|
|
88
|
+
"oapiex.config.js",
|
|
89
|
+
"oapiex.config.cjs"
|
|
90
|
+
];
|
|
82
91
|
const defaultConfig = {
|
|
83
92
|
environment: "sandbox",
|
|
84
93
|
urls: {
|
|
85
94
|
live: "",
|
|
86
95
|
sandbox: ""
|
|
87
96
|
},
|
|
88
|
-
headers: {}
|
|
97
|
+
headers: {},
|
|
98
|
+
debugLevel: 0
|
|
99
|
+
};
|
|
100
|
+
const createBaseConfig = () => ({
|
|
101
|
+
...defaultConfig,
|
|
102
|
+
urls: { ...defaultConfig.urls ?? {} },
|
|
103
|
+
headers: { ...defaultConfig.headers ?? {} }
|
|
104
|
+
});
|
|
105
|
+
let globalConfig = createBaseConfig();
|
|
106
|
+
let loadedConfigRoot = null;
|
|
107
|
+
const mergeConfig = (baseConfig, config) => ({
|
|
108
|
+
...baseConfig,
|
|
109
|
+
...config,
|
|
110
|
+
urls: config.urls ? {
|
|
111
|
+
...baseConfig.urls ?? defaultConfig.urls,
|
|
112
|
+
...config.urls
|
|
113
|
+
} : baseConfig.urls,
|
|
114
|
+
headers: config.headers ? {
|
|
115
|
+
...baseConfig.headers ?? defaultConfig.headers,
|
|
116
|
+
...config.headers
|
|
117
|
+
} : baseConfig.headers
|
|
118
|
+
});
|
|
119
|
+
const pickInitOptions = (value) => {
|
|
120
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
121
|
+
const config = value;
|
|
122
|
+
const scoped = config.sdkKit ?? config.sdk;
|
|
123
|
+
if (scoped && typeof scoped === "object" && !Array.isArray(scoped)) return pickInitOptions(scoped);
|
|
124
|
+
const nextConfig = [
|
|
125
|
+
"clientId",
|
|
126
|
+
"clientSecret",
|
|
127
|
+
"encryptionKey",
|
|
128
|
+
"environment",
|
|
129
|
+
"urls",
|
|
130
|
+
"headers",
|
|
131
|
+
"timeout",
|
|
132
|
+
"auth",
|
|
133
|
+
"debugLevel"
|
|
134
|
+
].reduce((result, key) => {
|
|
135
|
+
if (config[key] !== void 0) result[key] = config[key];
|
|
136
|
+
return result;
|
|
137
|
+
}, {});
|
|
138
|
+
return Object.keys(nextConfig).length > 0 ? nextConfig : null;
|
|
139
|
+
};
|
|
140
|
+
const loadUserConfig = (rootDir = process.cwd()) => {
|
|
141
|
+
const syncLoad = (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href, {
|
|
142
|
+
interopDefault: true,
|
|
143
|
+
moduleCache: false,
|
|
144
|
+
fsCache: false
|
|
145
|
+
});
|
|
146
|
+
for (const basename of CONFIG_BASENAMES) {
|
|
147
|
+
const configPath = node_path.default.join(rootDir, basename);
|
|
148
|
+
try {
|
|
149
|
+
const loaded = syncLoad(configPath);
|
|
150
|
+
const loadedModule = typeof loaded === "object" && loaded !== null ? loaded : null;
|
|
151
|
+
const sdkConfig = pickInitOptions(loadedModule?.default ?? loadedModule?.config ?? loaded);
|
|
152
|
+
if (sdkConfig) return sdkConfig;
|
|
153
|
+
} catch {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
};
|
|
159
|
+
const ensureConfigLoaded = (rootDir = process.cwd()) => {
|
|
160
|
+
if (loadedConfigRoot === rootDir) return globalConfig;
|
|
161
|
+
globalConfig = createBaseConfig();
|
|
162
|
+
loadedConfigRoot = rootDir;
|
|
163
|
+
const userConfig = loadUserConfig(rootDir);
|
|
164
|
+
if (userConfig) globalConfig = mergeConfig(globalConfig, userConfig);
|
|
165
|
+
return globalConfig;
|
|
89
166
|
};
|
|
90
|
-
let globalConfig = defaultConfig;
|
|
91
167
|
const defineConfig = (config) => {
|
|
92
|
-
const
|
|
93
|
-
const userConfig = {
|
|
94
|
-
...baseConfig,
|
|
95
|
-
...config,
|
|
96
|
-
urls: config.urls ? {
|
|
97
|
-
...baseConfig.urls ?? defaultConfig.urls,
|
|
98
|
-
...config.urls
|
|
99
|
-
} : baseConfig.urls,
|
|
100
|
-
headers: config.headers ? {
|
|
101
|
-
...baseConfig.headers ?? defaultConfig.headers,
|
|
102
|
-
...config.headers
|
|
103
|
-
} : baseConfig.headers
|
|
104
|
-
};
|
|
168
|
+
const userConfig = mergeConfig(ensureConfigLoaded(), config);
|
|
105
169
|
globalConfig = userConfig;
|
|
106
170
|
return userConfig;
|
|
107
171
|
};
|
|
108
|
-
const getConfig = () =>
|
|
172
|
+
const getConfig = () => ensureConfigLoaded();
|
|
109
173
|
const resetConfig = () => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
urls: { ...defaultConfig.urls ?? {} },
|
|
113
|
-
headers: { ...defaultConfig.headers ?? {} }
|
|
114
|
-
};
|
|
174
|
+
loadedConfigRoot = null;
|
|
175
|
+
globalConfig = createBaseConfig();
|
|
115
176
|
return globalConfig;
|
|
116
177
|
};
|
|
117
178
|
|
|
@@ -204,8 +265,8 @@ var Builder = class {
|
|
|
204
265
|
* @param queryParams
|
|
205
266
|
* @returns
|
|
206
267
|
*/
|
|
207
|
-
static buildTargetUrl(path$
|
|
208
|
-
const url = this.buildUrl(path$
|
|
268
|
+
static buildTargetUrl(path$12, params = {}, queryParams = {}) {
|
|
269
|
+
const url = this.buildUrl(path$12);
|
|
209
270
|
let builtUrl = this.assignParamsToUrl(url, params, "path");
|
|
210
271
|
builtUrl = this.assignParamsToUrl(builtUrl, queryParams, "query");
|
|
211
272
|
return builtUrl;
|
|
@@ -2354,15 +2415,15 @@ var require_route = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modul
|
|
|
2354
2415
|
};
|
|
2355
2416
|
}
|
|
2356
2417
|
function wrapConversion(toModel, graph) {
|
|
2357
|
-
const path$
|
|
2418
|
+
const path$12 = [graph[toModel].parent, toModel];
|
|
2358
2419
|
let fn$1 = conversions$1[graph[toModel].parent][toModel];
|
|
2359
2420
|
let cur = graph[toModel].parent;
|
|
2360
2421
|
while (graph[cur].parent) {
|
|
2361
|
-
path$
|
|
2422
|
+
path$12.unshift(graph[cur].parent);
|
|
2362
2423
|
fn$1 = link(conversions$1[graph[cur].parent][cur], fn$1);
|
|
2363
2424
|
cur = graph[cur].parent;
|
|
2364
2425
|
}
|
|
2365
|
-
fn$1.conversion = path$
|
|
2426
|
+
fn$1.conversion = path$12;
|
|
2366
2427
|
return fn$1;
|
|
2367
2428
|
}
|
|
2368
2429
|
module.exports = function(fromModel) {
|
|
@@ -6049,17 +6110,17 @@ var require_path_exists = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
6049
6110
|
const fs$5 = require("fs");
|
|
6050
6111
|
const { promisify } = require("util");
|
|
6051
6112
|
const pAccess = promisify(fs$5.access);
|
|
6052
|
-
module.exports = async (path$
|
|
6113
|
+
module.exports = async (path$12) => {
|
|
6053
6114
|
try {
|
|
6054
|
-
await pAccess(path$
|
|
6115
|
+
await pAccess(path$12);
|
|
6055
6116
|
return true;
|
|
6056
6117
|
} catch (_) {
|
|
6057
6118
|
return false;
|
|
6058
6119
|
}
|
|
6059
6120
|
};
|
|
6060
|
-
module.exports.sync = (path$
|
|
6121
|
+
module.exports.sync = (path$12) => {
|
|
6061
6122
|
try {
|
|
6062
|
-
fs$5.accessSync(path$
|
|
6123
|
+
fs$5.accessSync(path$12);
|
|
6063
6124
|
return true;
|
|
6064
6125
|
} catch (_) {
|
|
6065
6126
|
return false;
|
|
@@ -9589,13 +9650,13 @@ var require_polyfills = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_m
|
|
|
9589
9650
|
fs$7.fstatSync = statFixSync(fs$7.fstatSync);
|
|
9590
9651
|
fs$7.lstatSync = statFixSync(fs$7.lstatSync);
|
|
9591
9652
|
if (fs$7.chmod && !fs$7.lchmod) {
|
|
9592
|
-
fs$7.lchmod = function(path$
|
|
9653
|
+
fs$7.lchmod = function(path$12, mode, cb) {
|
|
9593
9654
|
if (cb) process.nextTick(cb);
|
|
9594
9655
|
};
|
|
9595
9656
|
fs$7.lchmodSync = function() {};
|
|
9596
9657
|
}
|
|
9597
9658
|
if (fs$7.chown && !fs$7.lchown) {
|
|
9598
|
-
fs$7.lchown = function(path$
|
|
9659
|
+
fs$7.lchown = function(path$12, uid, gid, cb) {
|
|
9599
9660
|
if (cb) process.nextTick(cb);
|
|
9600
9661
|
};
|
|
9601
9662
|
fs$7.lchownSync = function() {};
|
|
@@ -9654,8 +9715,8 @@ var require_polyfills = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_m
|
|
|
9654
9715
|
};
|
|
9655
9716
|
})(fs$7.readSync);
|
|
9656
9717
|
function patchLchmod(fs$8) {
|
|
9657
|
-
fs$8.lchmod = function(path$
|
|
9658
|
-
fs$8.open(path$
|
|
9718
|
+
fs$8.lchmod = function(path$12, mode, callback) {
|
|
9719
|
+
fs$8.open(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
9659
9720
|
if (err) {
|
|
9660
9721
|
if (callback) callback(err);
|
|
9661
9722
|
return;
|
|
@@ -9667,8 +9728,8 @@ var require_polyfills = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_m
|
|
|
9667
9728
|
});
|
|
9668
9729
|
});
|
|
9669
9730
|
};
|
|
9670
|
-
fs$8.lchmodSync = function(path$
|
|
9671
|
-
var fd = fs$8.openSync(path$
|
|
9731
|
+
fs$8.lchmodSync = function(path$12, mode) {
|
|
9732
|
+
var fd = fs$8.openSync(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
9672
9733
|
var threw = true;
|
|
9673
9734
|
var ret;
|
|
9674
9735
|
try {
|
|
@@ -9685,8 +9746,8 @@ var require_polyfills = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_m
|
|
|
9685
9746
|
}
|
|
9686
9747
|
function patchLutimes(fs$8) {
|
|
9687
9748
|
if (constants.hasOwnProperty("O_SYMLINK") && fs$8.futimes) {
|
|
9688
|
-
fs$8.lutimes = function(path$
|
|
9689
|
-
fs$8.open(path$
|
|
9749
|
+
fs$8.lutimes = function(path$12, at, mt, cb) {
|
|
9750
|
+
fs$8.open(path$12, constants.O_SYMLINK, function(er, fd) {
|
|
9690
9751
|
if (er) {
|
|
9691
9752
|
if (cb) cb(er);
|
|
9692
9753
|
return;
|
|
@@ -9698,8 +9759,8 @@ var require_polyfills = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_m
|
|
|
9698
9759
|
});
|
|
9699
9760
|
});
|
|
9700
9761
|
};
|
|
9701
|
-
fs$8.lutimesSync = function(path$
|
|
9702
|
-
var fd = fs$8.openSync(path$
|
|
9762
|
+
fs$8.lutimesSync = function(path$12, at, mt) {
|
|
9763
|
+
var fd = fs$8.openSync(path$12, constants.O_SYMLINK);
|
|
9703
9764
|
var ret;
|
|
9704
9765
|
var threw = true;
|
|
9705
9766
|
try {
|
|
@@ -9807,11 +9868,11 @@ var require_legacy_streams = /* @__PURE__ */ require_chunk.__commonJS({ "../../n
|
|
|
9807
9868
|
ReadStream,
|
|
9808
9869
|
WriteStream
|
|
9809
9870
|
};
|
|
9810
|
-
function ReadStream(path$
|
|
9811
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path$
|
|
9871
|
+
function ReadStream(path$12, options) {
|
|
9872
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path$12, options);
|
|
9812
9873
|
Stream.call(this);
|
|
9813
9874
|
var self = this;
|
|
9814
|
-
this.path = path$
|
|
9875
|
+
this.path = path$12;
|
|
9815
9876
|
this.fd = null;
|
|
9816
9877
|
this.readable = true;
|
|
9817
9878
|
this.paused = false;
|
|
@@ -9849,10 +9910,10 @@ var require_legacy_streams = /* @__PURE__ */ require_chunk.__commonJS({ "../../n
|
|
|
9849
9910
|
self._read();
|
|
9850
9911
|
});
|
|
9851
9912
|
}
|
|
9852
|
-
function WriteStream(path$
|
|
9853
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path$
|
|
9913
|
+
function WriteStream(path$12, options) {
|
|
9914
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path$12, options);
|
|
9854
9915
|
Stream.call(this);
|
|
9855
|
-
this.path = path$
|
|
9916
|
+
this.path = path$12;
|
|
9856
9917
|
this.fd = null;
|
|
9857
9918
|
this.writable = true;
|
|
9858
9919
|
this.flags = "w";
|
|
@@ -9975,15 +10036,15 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
9975
10036
|
fs$7.createWriteStream = createWriteStream;
|
|
9976
10037
|
var fs$readFile = fs$7.readFile;
|
|
9977
10038
|
fs$7.readFile = readFile;
|
|
9978
|
-
function readFile(path$
|
|
10039
|
+
function readFile(path$12, options, cb) {
|
|
9979
10040
|
if (typeof options === "function") cb = options, options = null;
|
|
9980
|
-
return go$readFile(path$
|
|
9981
|
-
function go$readFile(path$
|
|
9982
|
-
return fs$readFile(path$
|
|
10041
|
+
return go$readFile(path$12, options, cb);
|
|
10042
|
+
function go$readFile(path$13, options$1, cb$1, startTime) {
|
|
10043
|
+
return fs$readFile(path$13, options$1, function(err) {
|
|
9983
10044
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
9984
10045
|
go$readFile,
|
|
9985
10046
|
[
|
|
9986
|
-
path$
|
|
10047
|
+
path$13,
|
|
9987
10048
|
options$1,
|
|
9988
10049
|
cb$1
|
|
9989
10050
|
],
|
|
@@ -9997,15 +10058,15 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
9997
10058
|
}
|
|
9998
10059
|
var fs$writeFile = fs$7.writeFile;
|
|
9999
10060
|
fs$7.writeFile = writeFile;
|
|
10000
|
-
function writeFile(path$
|
|
10061
|
+
function writeFile(path$12, data, options, cb) {
|
|
10001
10062
|
if (typeof options === "function") cb = options, options = null;
|
|
10002
|
-
return go$writeFile(path$
|
|
10003
|
-
function go$writeFile(path$
|
|
10004
|
-
return fs$writeFile(path$
|
|
10063
|
+
return go$writeFile(path$12, data, options, cb);
|
|
10064
|
+
function go$writeFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
10065
|
+
return fs$writeFile(path$13, data$1, options$1, function(err) {
|
|
10005
10066
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
10006
10067
|
go$writeFile,
|
|
10007
10068
|
[
|
|
10008
|
-
path$
|
|
10069
|
+
path$13,
|
|
10009
10070
|
data$1,
|
|
10010
10071
|
options$1,
|
|
10011
10072
|
cb$1
|
|
@@ -10020,15 +10081,15 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
10020
10081
|
}
|
|
10021
10082
|
var fs$appendFile = fs$7.appendFile;
|
|
10022
10083
|
if (fs$appendFile) fs$7.appendFile = appendFile;
|
|
10023
|
-
function appendFile(path$
|
|
10084
|
+
function appendFile(path$12, data, options, cb) {
|
|
10024
10085
|
if (typeof options === "function") cb = options, options = null;
|
|
10025
|
-
return go$appendFile(path$
|
|
10026
|
-
function go$appendFile(path$
|
|
10027
|
-
return fs$appendFile(path$
|
|
10086
|
+
return go$appendFile(path$12, data, options, cb);
|
|
10087
|
+
function go$appendFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
10088
|
+
return fs$appendFile(path$13, data$1, options$1, function(err) {
|
|
10028
10089
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
10029
10090
|
go$appendFile,
|
|
10030
10091
|
[
|
|
10031
|
-
path$
|
|
10092
|
+
path$13,
|
|
10032
10093
|
data$1,
|
|
10033
10094
|
options$1,
|
|
10034
10095
|
cb$1
|
|
@@ -10070,20 +10131,20 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
10070
10131
|
var fs$readdir = fs$7.readdir;
|
|
10071
10132
|
fs$7.readdir = readdir;
|
|
10072
10133
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
10073
|
-
function readdir(path$
|
|
10134
|
+
function readdir(path$12, options, cb) {
|
|
10074
10135
|
if (typeof options === "function") cb = options, options = null;
|
|
10075
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir$1(path$
|
|
10076
|
-
return fs$readdir(path$
|
|
10077
|
-
} : function go$readdir$1(path$
|
|
10078
|
-
return fs$readdir(path$
|
|
10136
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
10137
|
+
return fs$readdir(path$13, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
10138
|
+
} : function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
10139
|
+
return fs$readdir(path$13, options$1, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
10079
10140
|
};
|
|
10080
|
-
return go$readdir(path$
|
|
10081
|
-
function fs$readdirCallback(path$
|
|
10141
|
+
return go$readdir(path$12, options, cb);
|
|
10142
|
+
function fs$readdirCallback(path$13, options$1, cb$1, startTime) {
|
|
10082
10143
|
return function(err, files) {
|
|
10083
10144
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
10084
10145
|
go$readdir,
|
|
10085
10146
|
[
|
|
10086
|
-
path$
|
|
10147
|
+
path$13,
|
|
10087
10148
|
options$1,
|
|
10088
10149
|
cb$1
|
|
10089
10150
|
],
|
|
@@ -10155,7 +10216,7 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
10155
10216
|
enumerable: true,
|
|
10156
10217
|
configurable: true
|
|
10157
10218
|
});
|
|
10158
|
-
function ReadStream(path$
|
|
10219
|
+
function ReadStream(path$12, options) {
|
|
10159
10220
|
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
10160
10221
|
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
10161
10222
|
}
|
|
@@ -10172,7 +10233,7 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
10172
10233
|
}
|
|
10173
10234
|
});
|
|
10174
10235
|
}
|
|
10175
|
-
function WriteStream(path$
|
|
10236
|
+
function WriteStream(path$12, options) {
|
|
10176
10237
|
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
10177
10238
|
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
10178
10239
|
}
|
|
@@ -10188,23 +10249,23 @@ var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJS({ "../../node
|
|
|
10188
10249
|
}
|
|
10189
10250
|
});
|
|
10190
10251
|
}
|
|
10191
|
-
function createReadStream(path$
|
|
10192
|
-
return new fs$7.ReadStream(path$
|
|
10252
|
+
function createReadStream(path$12, options) {
|
|
10253
|
+
return new fs$7.ReadStream(path$12, options);
|
|
10193
10254
|
}
|
|
10194
|
-
function createWriteStream(path$
|
|
10195
|
-
return new fs$7.WriteStream(path$
|
|
10255
|
+
function createWriteStream(path$12, options) {
|
|
10256
|
+
return new fs$7.WriteStream(path$12, options);
|
|
10196
10257
|
}
|
|
10197
10258
|
var fs$open = fs$7.open;
|
|
10198
10259
|
fs$7.open = open;
|
|
10199
|
-
function open(path$
|
|
10260
|
+
function open(path$12, flags, mode, cb) {
|
|
10200
10261
|
if (typeof mode === "function") cb = mode, mode = null;
|
|
10201
|
-
return go$open(path$
|
|
10202
|
-
function go$open(path$
|
|
10203
|
-
return fs$open(path$
|
|
10262
|
+
return go$open(path$12, flags, mode, cb);
|
|
10263
|
+
function go$open(path$13, flags$1, mode$1, cb$1, startTime) {
|
|
10264
|
+
return fs$open(path$13, flags$1, mode$1, function(err, fd) {
|
|
10204
10265
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
10205
10266
|
go$open,
|
|
10206
10267
|
[
|
|
10207
|
-
path$
|
|
10268
|
+
path$13,
|
|
10208
10269
|
flags$1,
|
|
10209
10270
|
mode$1,
|
|
10210
10271
|
cb$1
|
|
@@ -17945,7 +18006,7 @@ var require_preferred_pm = /* @__PURE__ */ require_chunk.__commonJS({ "../../nod
|
|
|
17945
18006
|
name: "bun",
|
|
17946
18007
|
version: "*"
|
|
17947
18008
|
};
|
|
17948
|
-
const { findUp: findUp$1 } = await Promise.resolve().then(() => require("./find-up-simple-
|
|
18009
|
+
const { findUp: findUp$1 } = await Promise.resolve().then(() => require("./find-up-simple-BGJv1vWM.cjs"));
|
|
17949
18010
|
if (await findUp$1("pnpm-lock.yaml", { cwd: pkgPath })) return {
|
|
17950
18011
|
name: "pnpm",
|
|
17951
18012
|
version: ">=3"
|
|
@@ -18741,30 +18802,15 @@ var Core = class Core {
|
|
|
18741
18802
|
builder = Builder;
|
|
18742
18803
|
constructor(clientId, clientSecret, encryptionKey, env$3, config) {
|
|
18743
18804
|
const currentConfig = getConfig();
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
encryptionKey: clientId.encryptionKey,
|
|
18754
|
-
auth: clientId.auth
|
|
18755
|
-
});
|
|
18756
|
-
this.debug(clientId.debugLevel ?? 0);
|
|
18757
|
-
} else {
|
|
18758
|
-
this.clientId = Core.normalizeCredential(clientId) ?? Core.normalizeCredential(process.env.CLIENT_ID);
|
|
18759
|
-
this.clientSecret = Core.normalizeCredential(clientSecret) ?? Core.normalizeCredential(process.env.CLIENT_SECRET);
|
|
18760
|
-
this.environment = env$3 ?? currentConfig.environment ?? Core.normalizeEnvironment(process.env.ENVIRONMENT) ?? "live";
|
|
18761
|
-
this.configure({
|
|
18762
|
-
...config ?? {},
|
|
18763
|
-
environment: this.environment,
|
|
18764
|
-
encryptionKey: encryptionKey ?? config?.encryptionKey
|
|
18765
|
-
});
|
|
18766
|
-
this.debug(0);
|
|
18767
|
-
}
|
|
18805
|
+
const resolvedConfig = clientId && typeof clientId === "object" ? this.resolveInitOptionsFromObject(clientId, currentConfig) : this.resolveInitOptionsFromArgs(clientId, clientSecret, encryptionKey, env$3, config, currentConfig);
|
|
18806
|
+
this.clientId = Core.normalizeCredential(resolvedConfig.clientId);
|
|
18807
|
+
this.clientSecret = Core.normalizeCredential(resolvedConfig.clientSecret);
|
|
18808
|
+
this.environment = resolvedConfig.environment ?? Core.normalizeEnvironment(process.env.ENVIRONMENT) ?? "live";
|
|
18809
|
+
this.configure({
|
|
18810
|
+
...resolvedConfig,
|
|
18811
|
+
environment: this.environment
|
|
18812
|
+
});
|
|
18813
|
+
this.debug(resolvedConfig.debugLevel ?? 0);
|
|
18768
18814
|
if (!this.clientSecret && !this.hasConfiguredAuth()) throw new Error("Client Secret is required to initialize API instance when auth is not provided");
|
|
18769
18815
|
this.api = this.createApi();
|
|
18770
18816
|
}
|
|
@@ -18780,6 +18826,9 @@ var Core = class Core {
|
|
|
18780
18826
|
this.environment = nextConfig.environment;
|
|
18781
18827
|
this.builder.setEnvironment(nextConfig.environment);
|
|
18782
18828
|
}
|
|
18829
|
+
if ("clientId" in config) this.clientId = Core.normalizeCredential(nextConfig.clientId);
|
|
18830
|
+
if ("clientSecret" in config) this.clientSecret = Core.normalizeCredential(nextConfig.clientSecret);
|
|
18831
|
+
if (nextConfig.debugLevel !== void 0) this.debug(nextConfig.debugLevel);
|
|
18783
18832
|
return this;
|
|
18784
18833
|
}
|
|
18785
18834
|
/**
|
|
@@ -18886,6 +18935,36 @@ var Core = class Core {
|
|
|
18886
18935
|
const normalized = value.trim();
|
|
18887
18936
|
return normalized ? normalized : void 0;
|
|
18888
18937
|
}
|
|
18938
|
+
resolveInitOptionsFromObject(config, currentConfig) {
|
|
18939
|
+
return {
|
|
18940
|
+
...currentConfig,
|
|
18941
|
+
...config,
|
|
18942
|
+
clientId: Core.normalizeCredential(config.clientId) ?? Core.normalizeCredential(currentConfig.clientId) ?? Core.normalizeCredential(process.env.CLIENT_ID),
|
|
18943
|
+
clientSecret: Core.normalizeCredential(config.clientSecret) ?? Core.normalizeCredential(currentConfig.clientSecret) ?? Core.normalizeCredential(process.env.CLIENT_SECRET),
|
|
18944
|
+
environment: config.environment ?? currentConfig.environment ?? Core.normalizeEnvironment(process.env.ENVIRONMENT) ?? "live",
|
|
18945
|
+
encryptionKey: config.encryptionKey ?? currentConfig.encryptionKey,
|
|
18946
|
+
urls: config.urls ?? currentConfig.urls,
|
|
18947
|
+
headers: config.headers ?? currentConfig.headers,
|
|
18948
|
+
timeout: config.timeout ?? currentConfig.timeout,
|
|
18949
|
+
auth: config.auth ?? currentConfig.auth,
|
|
18950
|
+
debugLevel: config.debugLevel ?? currentConfig.debugLevel ?? 0
|
|
18951
|
+
};
|
|
18952
|
+
}
|
|
18953
|
+
resolveInitOptionsFromArgs(clientId, clientSecret, encryptionKey, env$3, config, currentConfig) {
|
|
18954
|
+
return {
|
|
18955
|
+
...currentConfig,
|
|
18956
|
+
...config ?? {},
|
|
18957
|
+
clientId: Core.normalizeCredential(clientId) ?? Core.normalizeCredential(currentConfig.clientId) ?? Core.normalizeCredential(process.env.CLIENT_ID),
|
|
18958
|
+
clientSecret: Core.normalizeCredential(clientSecret) ?? Core.normalizeCredential(currentConfig.clientSecret) ?? Core.normalizeCredential(process.env.CLIENT_SECRET),
|
|
18959
|
+
environment: env$3 ?? config?.environment ?? currentConfig.environment ?? Core.normalizeEnvironment(process.env.ENVIRONMENT) ?? "live",
|
|
18960
|
+
encryptionKey: encryptionKey ?? config?.encryptionKey ?? currentConfig.encryptionKey,
|
|
18961
|
+
urls: config?.urls ?? currentConfig.urls,
|
|
18962
|
+
headers: config?.headers ?? currentConfig.headers,
|
|
18963
|
+
timeout: config?.timeout ?? currentConfig.timeout,
|
|
18964
|
+
auth: config?.auth ?? currentConfig.auth,
|
|
18965
|
+
debugLevel: config?.debugLevel ?? currentConfig.debugLevel ?? 0
|
|
18966
|
+
};
|
|
18967
|
+
}
|
|
18889
18968
|
hasConfiguredAuth() {
|
|
18890
18969
|
const auth = getConfig().auth;
|
|
18891
18970
|
if (Array.isArray(auth)) return auth.length > 0;
|
|
@@ -18902,6 +18981,9 @@ var Core = class Core {
|
|
|
18902
18981
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
18903
18982
|
return [
|
|
18904
18983
|
"auth",
|
|
18984
|
+
"clientId",
|
|
18985
|
+
"clientSecret",
|
|
18986
|
+
"debugLevel",
|
|
18905
18987
|
"environment",
|
|
18906
18988
|
"headers",
|
|
18907
18989
|
"timeout",
|
|
@@ -19028,5 +19110,6 @@ Object.defineProperty(exports, 'globalConfig', {
|
|
|
19028
19110
|
return globalConfig;
|
|
19029
19111
|
}
|
|
19030
19112
|
});
|
|
19113
|
+
exports.loadUserConfig = loadUserConfig;
|
|
19031
19114
|
exports.normalizeValue = normalizeValue;
|
|
19032
19115
|
exports.resetConfig = resetConfig;
|