Email Sorter Beta
Ich habe soweit automatisiert the Emails sortieren aber ich muss noch schauen was es fur bugs es gibt wenn die app online ist deswegen wurde ich mit diesen Commit die website veroffentlichen obwohjl es sein konnte das es noch nicht fertig ist und verkaufs bereit
This commit is contained in:
74
server/node_modules/stripe/cjs/utils.js
generated
vendored
74
server/node_modules/stripe/cjs/utils.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.concat = exports.determineProcessUserAgentProperties = exports.validateInteger = exports.flattenAndStringify = exports.isObject = exports.emitWarning = exports.pascalToCamelCase = exports.callbackifyPromiseWithTimeout = exports.normalizeHeader = exports.normalizeHeaders = exports.removeNullish = exports.protoExtend = exports.getOptionsFromArgs = exports.getDataFromArgs = exports.extractUrlParams = exports.makeURLInterpolator = exports.stringifyRequestData = exports.isOptionsHash = void 0;
|
||||
exports.getAPIMode = exports.jsonStringifyRequestData = exports.concat = exports.createApiKeyAuthenticator = exports.determineProcessUserAgentProperties = exports.validateInteger = exports.flattenAndStringify = exports.isObject = exports.emitWarning = exports.pascalToCamelCase = exports.callbackifyPromiseWithTimeout = exports.normalizeHeader = exports.normalizeHeaders = exports.removeNullish = exports.protoExtend = exports.getOptionsFromArgs = exports.getDataFromArgs = exports.extractUrlParams = exports.makeURLInterpolator = exports.queryStringifyRequestData = exports.isOptionsHash = void 0;
|
||||
const qs = require("qs");
|
||||
const OPTIONS_KEYS = [
|
||||
'apiKey',
|
||||
@@ -10,6 +10,9 @@ const OPTIONS_KEYS = [
|
||||
'maxNetworkRetries',
|
||||
'timeout',
|
||||
'host',
|
||||
'authenticator',
|
||||
'stripeContext',
|
||||
'additionalHeaders',
|
||||
];
|
||||
function isOptionsHash(o) {
|
||||
return (o &&
|
||||
@@ -21,10 +24,11 @@ exports.isOptionsHash = isOptionsHash;
|
||||
* Stringifies an Object, accommodating nested objects
|
||||
* (forming the conventional key 'parent[child]=value')
|
||||
*/
|
||||
function stringifyRequestData(data) {
|
||||
function queryStringifyRequestData(data, apiMode) {
|
||||
return (qs
|
||||
.stringify(data, {
|
||||
serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(),
|
||||
arrayFormat: apiMode == 'v2' ? 'repeat' : 'indices',
|
||||
})
|
||||
// Don't use strict form encoding by changing the square bracket control
|
||||
// characters back to their literals. This is fine by the server, and
|
||||
@@ -32,7 +36,7 @@ function stringifyRequestData(data) {
|
||||
.replace(/%5B/g, '[')
|
||||
.replace(/%5D/g, ']'));
|
||||
}
|
||||
exports.stringifyRequestData = stringifyRequestData;
|
||||
exports.queryStringifyRequestData = queryStringifyRequestData;
|
||||
/**
|
||||
* Outputs a new function with interpolated object property values.
|
||||
* Use like so:
|
||||
@@ -94,7 +98,6 @@ exports.getDataFromArgs = getDataFromArgs;
|
||||
*/
|
||||
function getOptionsFromArgs(args) {
|
||||
const opts = {
|
||||
auth: null,
|
||||
host: null,
|
||||
headers: {},
|
||||
settings: {},
|
||||
@@ -102,7 +105,7 @@ function getOptionsFromArgs(args) {
|
||||
if (args.length > 0) {
|
||||
const arg = args[args.length - 1];
|
||||
if (typeof arg === 'string') {
|
||||
opts.auth = args.pop();
|
||||
opts.authenticator = createApiKeyAuthenticator(args.pop());
|
||||
}
|
||||
else if (isOptionsHash(arg)) {
|
||||
const params = Object.assign({}, args.pop());
|
||||
@@ -111,7 +114,7 @@ function getOptionsFromArgs(args) {
|
||||
emitWarning(`Invalid options found (${extraKeys.join(', ')}); ignoring.`);
|
||||
}
|
||||
if (params.apiKey) {
|
||||
opts.auth = params.apiKey;
|
||||
opts.authenticator = createApiKeyAuthenticator(params.apiKey);
|
||||
}
|
||||
if (params.idempotencyKey) {
|
||||
opts.headers['Idempotency-Key'] = params.idempotencyKey;
|
||||
@@ -119,6 +122,12 @@ function getOptionsFromArgs(args) {
|
||||
if (params.stripeAccount) {
|
||||
opts.headers['Stripe-Account'] = params.stripeAccount;
|
||||
}
|
||||
if (params.stripeContext) {
|
||||
if (opts.headers['Stripe-Account']) {
|
||||
throw new Error("Can't specify both stripeAccount and stripeContext.");
|
||||
}
|
||||
opts.headers['Stripe-Context'] = params.stripeContext;
|
||||
}
|
||||
if (params.apiVersion) {
|
||||
opts.headers['Stripe-Version'] = params.apiVersion;
|
||||
}
|
||||
@@ -131,6 +140,19 @@ function getOptionsFromArgs(args) {
|
||||
if (params.host) {
|
||||
opts.host = params.host;
|
||||
}
|
||||
if (params.authenticator) {
|
||||
if (params.apiKey) {
|
||||
throw new Error("Can't specify both apiKey and authenticator.");
|
||||
}
|
||||
if (typeof params.authenticator !== 'function') {
|
||||
throw new Error('The authenticator must be a function ' +
|
||||
'receiving a request as the first parameter.');
|
||||
}
|
||||
opts.authenticator = params.authenticator;
|
||||
}
|
||||
if (params.additionalHeaders) {
|
||||
opts.headers = params.additionalHeaders;
|
||||
}
|
||||
}
|
||||
}
|
||||
return opts;
|
||||
@@ -245,9 +267,7 @@ exports.isObject = isObject;
|
||||
function flattenAndStringify(data) {
|
||||
const result = {};
|
||||
const step = (obj, prevKey) => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
// @ts-ignore
|
||||
const value = obj[key];
|
||||
Object.entries(obj).forEach(([key, value]) => {
|
||||
const newKey = prevKey ? `${prevKey}[${key}]` : key;
|
||||
if (isObject(value)) {
|
||||
if (!(value instanceof Uint8Array) &&
|
||||
@@ -291,6 +311,16 @@ function determineProcessUserAgentProperties() {
|
||||
};
|
||||
}
|
||||
exports.determineProcessUserAgentProperties = determineProcessUserAgentProperties;
|
||||
function createApiKeyAuthenticator(apiKey) {
|
||||
const authenticator = (request) => {
|
||||
request.headers.Authorization = 'Bearer ' + apiKey;
|
||||
return Promise.resolve();
|
||||
};
|
||||
// For testing
|
||||
authenticator._apiKey = apiKey;
|
||||
return authenticator;
|
||||
}
|
||||
exports.createApiKeyAuthenticator = createApiKeyAuthenticator;
|
||||
/**
|
||||
* Joins an array of Uint8Arrays into a single Uint8Array
|
||||
*/
|
||||
@@ -305,3 +335,29 @@ function concat(arrays) {
|
||||
return merged;
|
||||
}
|
||||
exports.concat = concat;
|
||||
/**
|
||||
* Replaces Date objects with Unix timestamps
|
||||
*/
|
||||
function dateTimeReplacer(key, value) {
|
||||
if (this[key] instanceof Date) {
|
||||
return Math.floor(this[key].getTime() / 1000).toString();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* JSON stringifies an Object, replacing Date objects with Unix timestamps
|
||||
*/
|
||||
function jsonStringifyRequestData(data) {
|
||||
return JSON.stringify(data, dateTimeReplacer);
|
||||
}
|
||||
exports.jsonStringifyRequestData = jsonStringifyRequestData;
|
||||
/**
|
||||
* Inspects the given path to determine if the endpoint is for v1 or v2 API
|
||||
*/
|
||||
function getAPIMode(path) {
|
||||
if (!path) {
|
||||
return 'v1';
|
||||
}
|
||||
return path.startsWith('/v2') ? 'v2' : 'v1';
|
||||
}
|
||||
exports.getAPIMode = getAPIMode;
|
||||
|
||||
Reference in New Issue
Block a user