@snagsolutions/sdk 0.1.0-alpha.10
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 +125 -0
- package/LICENSE +201 -0
- package/README.md +297 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +241 -0
- package/core.d.ts.map +1 -0
- package/core.js +908 -0
- package/core.js.map +1 -0
- package/core.mjs +876 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +126 -0
- package/index.d.ts +126 -0
- package/index.d.ts.map +1 -0
- package/index.js +141 -0
- package/index.js.map +1 -0
- package/index.mjs +98 -0
- package/index.mjs.map +1 -0
- package/internal/qs/formats.d.ts +6 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +11 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +8 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +280 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +276 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.ts +14 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +229 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +103 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/assets.d.ts +50 -0
- package/resources/assets.d.ts.map +1 -0
- package/resources/assets.js +17 -0
- package/resources/assets.js.map +1 -0
- package/resources/assets.mjs +13 -0
- package/resources/assets.mjs.map +1 -0
- package/resources/auction-bids.d.ts +81 -0
- package/resources/auction-bids.d.ts.map +1 -0
- package/resources/auction-bids.js +30 -0
- package/resources/auction-bids.js.map +1 -0
- package/resources/auction-bids.mjs +26 -0
- package/resources/auction-bids.mjs.map +1 -0
- package/resources/drip/drip.d.ts +14 -0
- package/resources/drip/drip.d.ts.map +1 -0
- package/resources/drip/drip.js +43 -0
- package/resources/drip/drip.js.map +1 -0
- package/resources/drip/drip.mjs +16 -0
- package/resources/drip/drip.mjs.map +1 -0
- package/resources/drip/index.d.ts +4 -0
- package/resources/drip/index.d.ts.map +1 -0
- package/resources/drip/index.js +11 -0
- package/resources/drip/index.js.map +1 -0
- package/resources/drip/index.mjs +5 -0
- package/resources/drip/index.mjs.map +1 -0
- package/resources/drip/quests.d.ts +168 -0
- package/resources/drip/quests.d.ts.map +1 -0
- package/resources/drip/quests.js +17 -0
- package/resources/drip/quests.js.map +1 -0
- package/resources/drip/quests.mjs +13 -0
- package/resources/drip/quests.mjs.map +1 -0
- package/resources/drip/status.d.ts +26 -0
- package/resources/drip/status.d.ts.map +1 -0
- package/resources/drip/status.js +16 -0
- package/resources/drip/status.js.map +1 -0
- package/resources/drip/status.mjs +12 -0
- package/resources/drip/status.mjs.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +17 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -0
- package/resources/index.mjs.map +1 -0
- package/resources/loyalty/accounts.d.ts +157 -0
- package/resources/loyalty/accounts.d.ts.map +1 -0
- package/resources/loyalty/accounts.js +16 -0
- package/resources/loyalty/accounts.js.map +1 -0
- package/resources/loyalty/accounts.mjs +12 -0
- package/resources/loyalty/accounts.mjs.map +1 -0
- package/resources/loyalty/badges.d.ts +299 -0
- package/resources/loyalty/badges.d.ts.map +1 -0
- package/resources/loyalty/badges.js +46 -0
- package/resources/loyalty/badges.js.map +1 -0
- package/resources/loyalty/badges.mjs +42 -0
- package/resources/loyalty/badges.mjs.map +1 -0
- package/resources/loyalty/currencies.d.ts +252 -0
- package/resources/loyalty/currencies.d.ts.map +1 -0
- package/resources/loyalty/currencies.js +21 -0
- package/resources/loyalty/currencies.js.map +1 -0
- package/resources/loyalty/currencies.mjs +17 -0
- package/resources/loyalty/currencies.mjs.map +1 -0
- package/resources/loyalty/index.d.ts +9 -0
- package/resources/loyalty/index.d.ts.map +1 -0
- package/resources/loyalty/index.js +21 -0
- package/resources/loyalty/index.js.map +1 -0
- package/resources/loyalty/index.mjs +10 -0
- package/resources/loyalty/index.mjs.map +1 -0
- package/resources/loyalty/loyalty.d.ts +34 -0
- package/resources/loyalty/loyalty.d.ts.map +1 -0
- package/resources/loyalty/loyalty.js +63 -0
- package/resources/loyalty/loyalty.js.map +1 -0
- package/resources/loyalty/loyalty.mjs +36 -0
- package/resources/loyalty/loyalty.mjs.map +1 -0
- package/resources/loyalty/multipliers.d.ts +129 -0
- package/resources/loyalty/multipliers.d.ts.map +1 -0
- package/resources/loyalty/multipliers.js +34 -0
- package/resources/loyalty/multipliers.js.map +1 -0
- package/resources/loyalty/multipliers.mjs +30 -0
- package/resources/loyalty/multipliers.mjs.map +1 -0
- package/resources/loyalty/rule-edits.d.ts +330 -0
- package/resources/loyalty/rule-edits.d.ts.map +1 -0
- package/resources/loyalty/rule-edits.js +21 -0
- package/resources/loyalty/rule-edits.js.map +1 -0
- package/resources/loyalty/rule-edits.mjs +17 -0
- package/resources/loyalty/rule-edits.mjs.map +1 -0
- package/resources/loyalty/rules.d.ts +2430 -0
- package/resources/loyalty/rules.d.ts.map +1 -0
- package/resources/loyalty/rules.js +46 -0
- package/resources/loyalty/rules.js.map +1 -0
- package/resources/loyalty/rules.mjs +42 -0
- package/resources/loyalty/rules.mjs.map +1 -0
- package/resources/loyalty/transaction-entries.d.ts +175 -0
- package/resources/loyalty/transaction-entries.d.ts.map +1 -0
- package/resources/loyalty/transaction-entries.js +16 -0
- package/resources/loyalty/transaction-entries.js.map +1 -0
- package/resources/loyalty/transaction-entries.mjs +12 -0
- package/resources/loyalty/transaction-entries.mjs.map +1 -0
- package/resources/users/index.d.ts +4 -0
- package/resources/users/index.d.ts.map +1 -0
- package/resources/users/index.js +11 -0
- package/resources/users/index.js.map +1 -0
- package/resources/users/index.mjs +5 -0
- package/resources/users/index.mjs.map +1 -0
- package/resources/users/metadatas.d.ts +64 -0
- package/resources/users/metadatas.d.ts.map +1 -0
- package/resources/users/metadatas.js +16 -0
- package/resources/users/metadatas.js.map +1 -0
- package/resources/users/metadatas.mjs +12 -0
- package/resources/users/metadatas.mjs.map +1 -0
- package/resources/users/users.d.ts +14 -0
- package/resources/users/users.d.ts.map +1 -0
- package/resources/users/users.js +43 -0
- package/resources/users/users.js.map +1 -0
- package/resources/users/users.mjs +16 -0
- package/resources/users/users.mjs.map +1 -0
- package/resources/users/wallets.d.ts +193 -0
- package/resources/users/wallets.d.ts.map +1 -0
- package/resources/users/wallets.js +28 -0
- package/resources/users/wallets.js.map +1 -0
- package/resources/users/wallets.mjs +24 -0
- package/resources/users/wallets.mjs.map +1 -0
- package/resources/websites.d.ts +203 -0
- package/resources/websites.d.ts.map +1 -0
- package/resources/websites.js +22 -0
- package/resources/websites.js.map +1 -0
- package/resources/websites.mjs +18 -0
- package/resources/websites.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1201 -0
- package/src/error.ts +130 -0
- package/src/index.ts +235 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +9 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +388 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/assets.ts +71 -0
- package/src/resources/auction-bids.ts +123 -0
- package/src/resources/drip/drip.ts +25 -0
- package/src/resources/drip/index.ts +5 -0
- package/src/resources/drip/quests.ts +210 -0
- package/src/resources/drip/status.ts +33 -0
- package/src/resources/index.ts +14 -0
- package/src/resources/loyalty/accounts.ts +199 -0
- package/src/resources/loyalty/badges.ts +435 -0
- package/src/resources/loyalty/currencies.ts +321 -0
- package/src/resources/loyalty/index.ts +61 -0
- package/src/resources/loyalty/loyalty.ts +159 -0
- package/src/resources/loyalty/multipliers.ts +238 -0
- package/src/resources/loyalty/rule-edits.ts +421 -0
- package/src/resources/loyalty/rules.ts +3513 -0
- package/src/resources/loyalty/transaction-entries.ts +229 -0
- package/src/resources/users/index.ts +12 -0
- package/src/resources/users/metadatas.ts +103 -0
- package/src/resources/users/users.ts +39 -0
- package/src/resources/users/wallets.ts +271 -0
- package/src/resources/websites.ts +259 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +255 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +171 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +158 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var _a;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.SnagSolutionsError = exports.fileFromPath = exports.toFile = exports.SnagSolutions = void 0;
|
|
29
|
+
const qs = __importStar(require("./internal/qs/index.js"));
|
|
30
|
+
const Core = __importStar(require("./core.js"));
|
|
31
|
+
const Errors = __importStar(require("./error.js"));
|
|
32
|
+
const Uploads = __importStar(require("./uploads.js"));
|
|
33
|
+
const API = __importStar(require("./resources/index.js"));
|
|
34
|
+
const assets_1 = require("./resources/assets.js");
|
|
35
|
+
const auction_bids_1 = require("./resources/auction-bids.js");
|
|
36
|
+
const websites_1 = require("./resources/websites.js");
|
|
37
|
+
const drip_1 = require("./resources/drip/drip.js");
|
|
38
|
+
const loyalty_1 = require("./resources/loyalty/loyalty.js");
|
|
39
|
+
const users_1 = require("./resources/users/users.js");
|
|
40
|
+
/**
|
|
41
|
+
* API Client for interfacing with the Snag Solutions API.
|
|
42
|
+
*/
|
|
43
|
+
class SnagSolutions extends Core.APIClient {
|
|
44
|
+
/**
|
|
45
|
+
* API Client for interfacing with the Snag Solutions API.
|
|
46
|
+
*
|
|
47
|
+
* @param {string | undefined} [opts.apiKey=process.env['X_API_KEY'] ?? undefined]
|
|
48
|
+
* @param {string} [opts.baseURL=process.env['SNAG_SOLUTIONS_BASE_URL'] ?? https://admin.snagsolutions.io/] - Override the default base URL for the API.
|
|
49
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
50
|
+
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
51
|
+
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
52
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
53
|
+
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
54
|
+
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
55
|
+
*/
|
|
56
|
+
constructor({ baseURL = Core.readEnv('SNAG_SOLUTIONS_BASE_URL'), apiKey = Core.readEnv('X_API_KEY'), ...opts } = {}) {
|
|
57
|
+
if (apiKey === undefined) {
|
|
58
|
+
throw new Errors.SnagSolutionsError("The X_API_KEY environment variable is missing or empty; either provide it, or instantiate the SnagSolutions client with an apiKey option, like new SnagSolutions({ apiKey: 'My API Key' }).");
|
|
59
|
+
}
|
|
60
|
+
const options = {
|
|
61
|
+
apiKey,
|
|
62
|
+
...opts,
|
|
63
|
+
baseURL: baseURL || `https://admin.snagsolutions.io/`,
|
|
64
|
+
};
|
|
65
|
+
super({
|
|
66
|
+
baseURL: options.baseURL,
|
|
67
|
+
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
68
|
+
httpAgent: options.httpAgent,
|
|
69
|
+
maxRetries: options.maxRetries,
|
|
70
|
+
fetch: options.fetch,
|
|
71
|
+
});
|
|
72
|
+
this.assets = new API.Assets(this);
|
|
73
|
+
this.users = new API.Users(this);
|
|
74
|
+
this.loyalty = new API.Loyalty(this);
|
|
75
|
+
this.auctionBids = new API.AuctionBids(this);
|
|
76
|
+
this.websites = new API.Websites(this);
|
|
77
|
+
this.drip = new API.Drip(this);
|
|
78
|
+
this._options = options;
|
|
79
|
+
this.apiKey = apiKey;
|
|
80
|
+
}
|
|
81
|
+
defaultQuery() {
|
|
82
|
+
return this._options.defaultQuery;
|
|
83
|
+
}
|
|
84
|
+
defaultHeaders(opts) {
|
|
85
|
+
return {
|
|
86
|
+
...super.defaultHeaders(opts),
|
|
87
|
+
...this._options.defaultHeaders,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
authHeaders(opts) {
|
|
91
|
+
return { 'X-API-KEY': this.apiKey };
|
|
92
|
+
}
|
|
93
|
+
stringifyQuery(query) {
|
|
94
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.SnagSolutions = SnagSolutions;
|
|
98
|
+
_a = SnagSolutions;
|
|
99
|
+
SnagSolutions.SnagSolutions = _a;
|
|
100
|
+
SnagSolutions.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
101
|
+
SnagSolutions.SnagSolutionsError = Errors.SnagSolutionsError;
|
|
102
|
+
SnagSolutions.APIError = Errors.APIError;
|
|
103
|
+
SnagSolutions.APIConnectionError = Errors.APIConnectionError;
|
|
104
|
+
SnagSolutions.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
105
|
+
SnagSolutions.APIUserAbortError = Errors.APIUserAbortError;
|
|
106
|
+
SnagSolutions.NotFoundError = Errors.NotFoundError;
|
|
107
|
+
SnagSolutions.ConflictError = Errors.ConflictError;
|
|
108
|
+
SnagSolutions.RateLimitError = Errors.RateLimitError;
|
|
109
|
+
SnagSolutions.BadRequestError = Errors.BadRequestError;
|
|
110
|
+
SnagSolutions.AuthenticationError = Errors.AuthenticationError;
|
|
111
|
+
SnagSolutions.InternalServerError = Errors.InternalServerError;
|
|
112
|
+
SnagSolutions.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
113
|
+
SnagSolutions.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
114
|
+
SnagSolutions.toFile = Uploads.toFile;
|
|
115
|
+
SnagSolutions.fileFromPath = Uploads.fileFromPath;
|
|
116
|
+
SnagSolutions.Assets = assets_1.Assets;
|
|
117
|
+
SnagSolutions.Users = users_1.Users;
|
|
118
|
+
SnagSolutions.Loyalty = loyalty_1.Loyalty;
|
|
119
|
+
SnagSolutions.AuctionBids = auction_bids_1.AuctionBids;
|
|
120
|
+
SnagSolutions.Websites = websites_1.Websites;
|
|
121
|
+
SnagSolutions.Drip = drip_1.Drip;
|
|
122
|
+
var uploads_1 = require("./uploads.js");
|
|
123
|
+
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
124
|
+
Object.defineProperty(exports, "fileFromPath", { enumerable: true, get: function () { return uploads_1.fileFromPath; } });
|
|
125
|
+
var error_1 = require("./error.js");
|
|
126
|
+
Object.defineProperty(exports, "SnagSolutionsError", { enumerable: true, get: function () { return error_1.SnagSolutionsError; } });
|
|
127
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
128
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
129
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
130
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
|
|
131
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
|
|
132
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
133
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
|
|
134
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
135
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
|
|
136
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
137
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
138
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
139
|
+
exports = module.exports = SnagSolutions;
|
|
140
|
+
exports.default = SnagSolutions;
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;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AAM,CAAC,qBAAqB,CAAC;AACrD,sCAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAE3D,oBAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACxB,0BAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAG7C,aAAa,CAAC,MAAM,GAAG,eAAM,CAAC;AAC9B,aAAa,CAAC,KAAK,GAAG,aAAK,CAAC;AAC5B,aAAa,CAAC,OAAO,GAAG,iBAAO,CAAC;AAChC,aAAa,CAAC,WAAW,GAAG,0BAAW,CAAC;AACxC,aAAa,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAClC,aAAa,CAAC,IAAI,GAAG,WAAI,CAAC;AA+B1B,wCAAiD;AAAxC,iGAAA,MAAM,OAAA;AAAE,uGAAA,YAAY,OAAA;AAC7B,oCAciB;AAbf,2GAAA,kBAAkB,OAAA;AAClB,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAG1B,kBAAe,aAAa,CAAC"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
var _a;
|
|
3
|
+
import * as qs from "./internal/qs/index.mjs";
|
|
4
|
+
import * as Core from "./core.mjs";
|
|
5
|
+
import * as Errors from "./error.mjs";
|
|
6
|
+
import * as Uploads from "./uploads.mjs";
|
|
7
|
+
import * as API from "./resources/index.mjs";
|
|
8
|
+
import { Assets } from "./resources/assets.mjs";
|
|
9
|
+
import { AuctionBids } from "./resources/auction-bids.mjs";
|
|
10
|
+
import { Websites, } from "./resources/websites.mjs";
|
|
11
|
+
import { Drip } from "./resources/drip/drip.mjs";
|
|
12
|
+
import { Loyalty } from "./resources/loyalty/loyalty.mjs";
|
|
13
|
+
import { Users } from "./resources/users/users.mjs";
|
|
14
|
+
/**
|
|
15
|
+
* API Client for interfacing with the Snag Solutions API.
|
|
16
|
+
*/
|
|
17
|
+
export class SnagSolutions extends Core.APIClient {
|
|
18
|
+
/**
|
|
19
|
+
* API Client for interfacing with the Snag Solutions API.
|
|
20
|
+
*
|
|
21
|
+
* @param {string | undefined} [opts.apiKey=process.env['X_API_KEY'] ?? undefined]
|
|
22
|
+
* @param {string} [opts.baseURL=process.env['SNAG_SOLUTIONS_BASE_URL'] ?? https://admin.snagsolutions.io/] - Override the default base URL for the API.
|
|
23
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
24
|
+
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
25
|
+
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
26
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
27
|
+
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
28
|
+
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
29
|
+
*/
|
|
30
|
+
constructor({ baseURL = Core.readEnv('SNAG_SOLUTIONS_BASE_URL'), apiKey = Core.readEnv('X_API_KEY'), ...opts } = {}) {
|
|
31
|
+
if (apiKey === undefined) {
|
|
32
|
+
throw new Errors.SnagSolutionsError("The X_API_KEY environment variable is missing or empty; either provide it, or instantiate the SnagSolutions client with an apiKey option, like new SnagSolutions({ apiKey: 'My API Key' }).");
|
|
33
|
+
}
|
|
34
|
+
const options = {
|
|
35
|
+
apiKey,
|
|
36
|
+
...opts,
|
|
37
|
+
baseURL: baseURL || `https://admin.snagsolutions.io/`,
|
|
38
|
+
};
|
|
39
|
+
super({
|
|
40
|
+
baseURL: options.baseURL,
|
|
41
|
+
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
42
|
+
httpAgent: options.httpAgent,
|
|
43
|
+
maxRetries: options.maxRetries,
|
|
44
|
+
fetch: options.fetch,
|
|
45
|
+
});
|
|
46
|
+
this.assets = new API.Assets(this);
|
|
47
|
+
this.users = new API.Users(this);
|
|
48
|
+
this.loyalty = new API.Loyalty(this);
|
|
49
|
+
this.auctionBids = new API.AuctionBids(this);
|
|
50
|
+
this.websites = new API.Websites(this);
|
|
51
|
+
this.drip = new API.Drip(this);
|
|
52
|
+
this._options = options;
|
|
53
|
+
this.apiKey = apiKey;
|
|
54
|
+
}
|
|
55
|
+
defaultQuery() {
|
|
56
|
+
return this._options.defaultQuery;
|
|
57
|
+
}
|
|
58
|
+
defaultHeaders(opts) {
|
|
59
|
+
return {
|
|
60
|
+
...super.defaultHeaders(opts),
|
|
61
|
+
...this._options.defaultHeaders,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
authHeaders(opts) {
|
|
65
|
+
return { 'X-API-KEY': this.apiKey };
|
|
66
|
+
}
|
|
67
|
+
stringifyQuery(query) {
|
|
68
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_a = SnagSolutions;
|
|
72
|
+
SnagSolutions.SnagSolutions = _a;
|
|
73
|
+
SnagSolutions.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
74
|
+
SnagSolutions.SnagSolutionsError = Errors.SnagSolutionsError;
|
|
75
|
+
SnagSolutions.APIError = Errors.APIError;
|
|
76
|
+
SnagSolutions.APIConnectionError = Errors.APIConnectionError;
|
|
77
|
+
SnagSolutions.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
78
|
+
SnagSolutions.APIUserAbortError = Errors.APIUserAbortError;
|
|
79
|
+
SnagSolutions.NotFoundError = Errors.NotFoundError;
|
|
80
|
+
SnagSolutions.ConflictError = Errors.ConflictError;
|
|
81
|
+
SnagSolutions.RateLimitError = Errors.RateLimitError;
|
|
82
|
+
SnagSolutions.BadRequestError = Errors.BadRequestError;
|
|
83
|
+
SnagSolutions.AuthenticationError = Errors.AuthenticationError;
|
|
84
|
+
SnagSolutions.InternalServerError = Errors.InternalServerError;
|
|
85
|
+
SnagSolutions.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
86
|
+
SnagSolutions.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
87
|
+
SnagSolutions.toFile = Uploads.toFile;
|
|
88
|
+
SnagSolutions.fileFromPath = Uploads.fileFromPath;
|
|
89
|
+
SnagSolutions.Assets = Assets;
|
|
90
|
+
SnagSolutions.Users = Users;
|
|
91
|
+
SnagSolutions.Loyalty = Loyalty;
|
|
92
|
+
SnagSolutions.AuctionBids = AuctionBids;
|
|
93
|
+
SnagSolutions.Websites = Websites;
|
|
94
|
+
SnagSolutions.Drip = Drip;
|
|
95
|
+
export { toFile, fileFromPath } from "./uploads.mjs";
|
|
96
|
+
export { SnagSolutionsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
|
|
97
|
+
export default SnagSolutions;
|
|
98
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,EAAE;OACP,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAA0C,MAAM,EAAE;OAClD,EAAgD,WAAW,EAAE;OAC7D,EAKL,QAAQ,GACT;OACM,EAAE,IAAI,EAAE;OACR,EAAE,OAAO,EAAE;OACX,EAAE,KAAK,EAAE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AAC;AAC9B,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;AAC5B,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;AAChC,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC;AACxC,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAClC,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC;OA+BnB,EAAE,MAAM,EAAE,YAAY,EAAE;OACxB,EACL,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Format } from "./types.js";
|
|
2
|
+
export declare const default_format: Format;
|
|
3
|
+
export declare const formatters: Record<Format, (str: PropertyKey) => string>;
|
|
4
|
+
export declare const RFC1738 = "RFC1738";
|
|
5
|
+
export declare const RFC3986 = "RFC3986";
|
|
6
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,MAAkB,CAAC;AAChD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,MAAM,CAGnE,CAAC;AACF,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RFC3986 = exports.RFC1738 = exports.formatters = exports.default_format = void 0;
|
|
4
|
+
exports.default_format = 'RFC3986';
|
|
5
|
+
exports.formatters = {
|
|
6
|
+
RFC1738: (v) => String(v).replace(/%20/g, '+'),
|
|
7
|
+
RFC3986: (v) => String(v),
|
|
8
|
+
};
|
|
9
|
+
exports.RFC1738 = 'RFC1738';
|
|
10
|
+
exports.RFC3986 = 'RFC3986';
|
|
11
|
+
//# sourceMappingURL=formats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAW,SAAS,CAAC;AACnC,QAAA,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;CACvC,CAAC;AACW,QAAA,OAAO,GAAG,SAAS,CAAC;AACpB,QAAA,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.mjs","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAW,SAAS,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;CACvC,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const formats: {
|
|
2
|
+
formatters: Record<import("./types").Format, (str: PropertyKey) => string>;
|
|
3
|
+
RFC1738: string;
|
|
4
|
+
RFC3986: string;
|
|
5
|
+
default: import("./types").Format;
|
|
6
|
+
};
|
|
7
|
+
export { stringify } from "./stringify.js";
|
|
8
|
+
export { formats };
|
|
9
|
+
export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from "./types.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO;;;;;CAKZ,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formats = exports.stringify = void 0;
|
|
4
|
+
const formats_1 = require("./formats.js");
|
|
5
|
+
const formats = {
|
|
6
|
+
formatters: formats_1.formatters,
|
|
7
|
+
RFC1738: formats_1.RFC1738,
|
|
8
|
+
RFC3986: formats_1.RFC3986,
|
|
9
|
+
default: formats_1.default_format,
|
|
10
|
+
};
|
|
11
|
+
exports.formats = formats;
|
|
12
|
+
var stringify_1 = require("./stringify.js");
|
|
13
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return stringify_1.stringify; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":";;;AAAA,0CAAyE;AAEzE,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,oBAAU;IACV,OAAO,EAAP,iBAAO;IACP,OAAO,EAAP,iBAAO;IACP,OAAO,EAAE,wBAAc;CACxB,CAAC;AAGO,0BAAO;AADhB,4CAAwC;AAA/B,sGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default_format, formatters, RFC1738, RFC3986 } from "./formats.mjs";
|
|
2
|
+
const formats = {
|
|
3
|
+
formatters,
|
|
4
|
+
RFC1738,
|
|
5
|
+
RFC3986,
|
|
6
|
+
default: default_format,
|
|
7
|
+
};
|
|
8
|
+
export { stringify } from "./stringify.mjs";
|
|
9
|
+
export { formats };
|
|
10
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;AAEvD,MAAM,OAAO,GAAG;IACd,UAAU;IACV,OAAO;IACP,OAAO;IACP,OAAO,EAAE,cAAc;CACxB,CAAC;OAEK,EAAE,SAAS,EAAE;AACpB,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../src/internal/qs/stringify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkTvE,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,gBAAqB,UA+EjE"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringify = void 0;
|
|
4
|
+
const utils_1 = require("./utils.js");
|
|
5
|
+
const formats_1 = require("./formats.js");
|
|
6
|
+
const has = Object.prototype.hasOwnProperty;
|
|
7
|
+
const array_prefix_generators = {
|
|
8
|
+
brackets(prefix) {
|
|
9
|
+
return String(prefix) + '[]';
|
|
10
|
+
},
|
|
11
|
+
comma: 'comma',
|
|
12
|
+
indices(prefix, key) {
|
|
13
|
+
return String(prefix) + '[' + key + ']';
|
|
14
|
+
},
|
|
15
|
+
repeat(prefix) {
|
|
16
|
+
return String(prefix);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const is_array = Array.isArray;
|
|
20
|
+
const push = Array.prototype.push;
|
|
21
|
+
const push_to_array = function (arr, value_or_array) {
|
|
22
|
+
push.apply(arr, is_array(value_or_array) ? value_or_array : [value_or_array]);
|
|
23
|
+
};
|
|
24
|
+
const to_ISO = Date.prototype.toISOString;
|
|
25
|
+
const defaults = {
|
|
26
|
+
addQueryPrefix: false,
|
|
27
|
+
allowDots: false,
|
|
28
|
+
allowEmptyArrays: false,
|
|
29
|
+
arrayFormat: 'indices',
|
|
30
|
+
charset: 'utf-8',
|
|
31
|
+
charsetSentinel: false,
|
|
32
|
+
delimiter: '&',
|
|
33
|
+
encode: true,
|
|
34
|
+
encodeDotInKeys: false,
|
|
35
|
+
encoder: utils_1.encode,
|
|
36
|
+
encodeValuesOnly: false,
|
|
37
|
+
format: formats_1.default_format,
|
|
38
|
+
formatter: formats_1.formatters[formats_1.default_format],
|
|
39
|
+
/** @deprecated */
|
|
40
|
+
indices: false,
|
|
41
|
+
serializeDate(date) {
|
|
42
|
+
return to_ISO.call(date);
|
|
43
|
+
},
|
|
44
|
+
skipNulls: false,
|
|
45
|
+
strictNullHandling: false,
|
|
46
|
+
};
|
|
47
|
+
function is_non_nullish_primitive(v) {
|
|
48
|
+
return (typeof v === 'string' ||
|
|
49
|
+
typeof v === 'number' ||
|
|
50
|
+
typeof v === 'boolean' ||
|
|
51
|
+
typeof v === 'symbol' ||
|
|
52
|
+
typeof v === 'bigint');
|
|
53
|
+
}
|
|
54
|
+
const sentinel = {};
|
|
55
|
+
function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
56
|
+
let obj = object;
|
|
57
|
+
let tmp_sc = sideChannel;
|
|
58
|
+
let step = 0;
|
|
59
|
+
let find_flag = false;
|
|
60
|
+
while ((tmp_sc = tmp_sc.get(sentinel)) !== void undefined && !find_flag) {
|
|
61
|
+
// Where object last appeared in the ref tree
|
|
62
|
+
const pos = tmp_sc.get(object);
|
|
63
|
+
step += 1;
|
|
64
|
+
if (typeof pos !== 'undefined') {
|
|
65
|
+
if (pos === step) {
|
|
66
|
+
throw new RangeError('Cyclic object value');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
find_flag = true; // Break while
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (typeof tmp_sc.get(sentinel) === 'undefined') {
|
|
73
|
+
step = 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (typeof filter === 'function') {
|
|
77
|
+
obj = filter(prefix, obj);
|
|
78
|
+
}
|
|
79
|
+
else if (obj instanceof Date) {
|
|
80
|
+
obj = serializeDate?.(obj);
|
|
81
|
+
}
|
|
82
|
+
else if (generateArrayPrefix === 'comma' && is_array(obj)) {
|
|
83
|
+
obj = (0, utils_1.maybe_map)(obj, function (value) {
|
|
84
|
+
if (value instanceof Date) {
|
|
85
|
+
return serializeDate?.(value);
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (obj === null) {
|
|
91
|
+
if (strictNullHandling) {
|
|
92
|
+
return encoder && !encodeValuesOnly ?
|
|
93
|
+
// @ts-expect-error
|
|
94
|
+
encoder(prefix, defaults.encoder, charset, 'key', format)
|
|
95
|
+
: prefix;
|
|
96
|
+
}
|
|
97
|
+
obj = '';
|
|
98
|
+
}
|
|
99
|
+
if (is_non_nullish_primitive(obj) || (0, utils_1.is_buffer)(obj)) {
|
|
100
|
+
if (encoder) {
|
|
101
|
+
const key_value = encodeValuesOnly ? prefix
|
|
102
|
+
// @ts-expect-error
|
|
103
|
+
: encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
104
|
+
return [
|
|
105
|
+
formatter?.(key_value) +
|
|
106
|
+
'=' +
|
|
107
|
+
// @ts-expect-error
|
|
108
|
+
formatter?.(encoder(obj, defaults.encoder, charset, 'value', format)),
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
return [formatter?.(prefix) + '=' + formatter?.(String(obj))];
|
|
112
|
+
}
|
|
113
|
+
const values = [];
|
|
114
|
+
if (typeof obj === 'undefined') {
|
|
115
|
+
return values;
|
|
116
|
+
}
|
|
117
|
+
let obj_keys;
|
|
118
|
+
if (generateArrayPrefix === 'comma' && is_array(obj)) {
|
|
119
|
+
// we need to join elements in
|
|
120
|
+
if (encodeValuesOnly && encoder) {
|
|
121
|
+
// @ts-expect-error values only
|
|
122
|
+
obj = (0, utils_1.maybe_map)(obj, encoder);
|
|
123
|
+
}
|
|
124
|
+
obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
125
|
+
}
|
|
126
|
+
else if (is_array(filter)) {
|
|
127
|
+
obj_keys = filter;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const keys = Object.keys(obj);
|
|
131
|
+
obj_keys = sort ? keys.sort(sort) : keys;
|
|
132
|
+
}
|
|
133
|
+
const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
|
|
134
|
+
const adjusted_prefix = commaRoundTrip && is_array(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix;
|
|
135
|
+
if (allowEmptyArrays && is_array(obj) && obj.length === 0) {
|
|
136
|
+
return adjusted_prefix + '[]';
|
|
137
|
+
}
|
|
138
|
+
for (let j = 0; j < obj_keys.length; ++j) {
|
|
139
|
+
const key = obj_keys[j];
|
|
140
|
+
const value =
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
143
|
+
if (skipNulls && value === null) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
const encoded_key = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key;
|
|
148
|
+
const key_prefix = is_array(obj) ?
|
|
149
|
+
typeof generateArrayPrefix === 'function' ?
|
|
150
|
+
generateArrayPrefix(adjusted_prefix, encoded_key)
|
|
151
|
+
: adjusted_prefix
|
|
152
|
+
: adjusted_prefix + (allowDots ? '.' + encoded_key : '[' + encoded_key + ']');
|
|
153
|
+
sideChannel.set(object, step);
|
|
154
|
+
const valueSideChannel = new WeakMap();
|
|
155
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
156
|
+
push_to_array(values, inner_stringify(value, key_prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys,
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
generateArrayPrefix === 'comma' && encodeValuesOnly && is_array(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
159
|
+
}
|
|
160
|
+
return values;
|
|
161
|
+
}
|
|
162
|
+
function normalize_stringify_options(opts = defaults) {
|
|
163
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
164
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
165
|
+
}
|
|
166
|
+
if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
|
|
167
|
+
throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
168
|
+
}
|
|
169
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
170
|
+
throw new TypeError('Encoder has to be a function.');
|
|
171
|
+
}
|
|
172
|
+
const charset = opts.charset || defaults.charset;
|
|
173
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
174
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
175
|
+
}
|
|
176
|
+
let format = formats_1.default_format;
|
|
177
|
+
if (typeof opts.format !== 'undefined') {
|
|
178
|
+
if (!has.call(formats_1.formatters, opts.format)) {
|
|
179
|
+
throw new TypeError('Unknown format option provided.');
|
|
180
|
+
}
|
|
181
|
+
format = opts.format;
|
|
182
|
+
}
|
|
183
|
+
const formatter = formats_1.formatters[format];
|
|
184
|
+
let filter = defaults.filter;
|
|
185
|
+
if (typeof opts.filter === 'function' || is_array(opts.filter)) {
|
|
186
|
+
filter = opts.filter;
|
|
187
|
+
}
|
|
188
|
+
let arrayFormat;
|
|
189
|
+
if (opts.arrayFormat && opts.arrayFormat in array_prefix_generators) {
|
|
190
|
+
arrayFormat = opts.arrayFormat;
|
|
191
|
+
}
|
|
192
|
+
else if ('indices' in opts) {
|
|
193
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
arrayFormat = defaults.arrayFormat;
|
|
197
|
+
}
|
|
198
|
+
if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
199
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
200
|
+
}
|
|
201
|
+
const allowDots = typeof opts.allowDots === 'undefined' ?
|
|
202
|
+
!!opts.encodeDotInKeys === true ?
|
|
203
|
+
true
|
|
204
|
+
: defaults.allowDots
|
|
205
|
+
: !!opts.allowDots;
|
|
206
|
+
return {
|
|
207
|
+
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
allowDots: allowDots,
|
|
210
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
211
|
+
arrayFormat: arrayFormat,
|
|
212
|
+
charset: charset,
|
|
213
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
214
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
215
|
+
delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
|
|
216
|
+
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
|
|
217
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
|
|
218
|
+
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
|
|
219
|
+
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
220
|
+
filter: filter,
|
|
221
|
+
format: format,
|
|
222
|
+
formatter: formatter,
|
|
223
|
+
serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
|
|
224
|
+
skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
|
|
225
|
+
// @ts-ignore
|
|
226
|
+
sort: typeof opts.sort === 'function' ? opts.sort : null,
|
|
227
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function stringify(object, opts = {}) {
|
|
231
|
+
let obj = object;
|
|
232
|
+
const options = normalize_stringify_options(opts);
|
|
233
|
+
let obj_keys;
|
|
234
|
+
let filter;
|
|
235
|
+
if (typeof options.filter === 'function') {
|
|
236
|
+
filter = options.filter;
|
|
237
|
+
obj = filter('', obj);
|
|
238
|
+
}
|
|
239
|
+
else if (is_array(options.filter)) {
|
|
240
|
+
filter = options.filter;
|
|
241
|
+
obj_keys = filter;
|
|
242
|
+
}
|
|
243
|
+
const keys = [];
|
|
244
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
245
|
+
return '';
|
|
246
|
+
}
|
|
247
|
+
const generateArrayPrefix = array_prefix_generators[options.arrayFormat];
|
|
248
|
+
const commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
|
|
249
|
+
if (!obj_keys) {
|
|
250
|
+
obj_keys = Object.keys(obj);
|
|
251
|
+
}
|
|
252
|
+
if (options.sort) {
|
|
253
|
+
obj_keys.sort(options.sort);
|
|
254
|
+
}
|
|
255
|
+
const sideChannel = new WeakMap();
|
|
256
|
+
for (let i = 0; i < obj_keys.length; ++i) {
|
|
257
|
+
const key = obj_keys[i];
|
|
258
|
+
if (options.skipNulls && obj[key] === null) {
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
push_to_array(keys, inner_stringify(obj[key], key,
|
|
262
|
+
// @ts-expect-error
|
|
263
|
+
generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
|
|
264
|
+
}
|
|
265
|
+
const joined = keys.join(options.delimiter);
|
|
266
|
+
let prefix = options.addQueryPrefix === true ? '?' : '';
|
|
267
|
+
if (options.charsetSentinel) {
|
|
268
|
+
if (options.charset === 'iso-8859-1') {
|
|
269
|
+
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
270
|
+
prefix += 'utf8=%26%2310003%3B&';
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// encodeURIComponent('✓')
|
|
274
|
+
prefix += 'utf8=%E2%9C%93&';
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return joined.length > 0 ? prefix + joined : '';
|
|
278
|
+
}
|
|
279
|
+
exports.stringify = stringify;
|
|
280
|
+
//# sourceMappingURL=stringify.js.map
|