Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auth0

Package Overview
Dependencies
Maintainers
46
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0 - npm Package Compare versions

Comparing version 4.0.0-beta.3 to 4.0.0-beta.4

62

dist/cjs/lib/runtime.js

@@ -13,16 +13,30 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseFormParam = exports.applyQueryParams = exports.validateRequiredRequestParams = exports.canConsumeForm = exports.COLLECTION_FORMATS = exports.BaseAPI = exports.FormData = void 0;
const node_fetch_1 = require("node-fetch");
exports.parseFormParam = exports.applyQueryParams = exports.validateRequiredRequestParams = exports.COLLECTION_FORMATS = exports.BaseAPI = exports.getFormDataCls = void 0;
const retry_js_1 = require("./retry.js");
const errors_js_1 = require("./errors.js");
const node_fetch_2 = __importDefault(require("node-fetch"));
const form_data_1 = __importDefault(require("form-data"));
exports.FormData = form_data_1.default;
/**
* @private
*/
const nodeFetch = (...args) => Promise.resolve().then(() => __importStar(require('node-fetch'))).then(({ default: fetch }) => fetch(...args));
/**
* @private
*/
const getFormDataCls = async () => Promise.resolve().then(() => __importStar(require('node-fetch'))).then(({ FormData }) => FormData);
exports.getFormDataCls = getFormDataCls;
__exportStar(require("./models.js"), exports);

@@ -116,3 +130,3 @@ /**

this.middleware = configuration.middleware || [];
this.fetchApi = configuration.fetchApi || node_fetch_2.default;
this.fetchApi = configuration.fetchApi || nodeFetch;
this.parseError = configuration.parseError;

@@ -155,7 +169,8 @@ this.timeoutDuration =

};
const { Blob } = await Promise.resolve().then(() => __importStar(require('node-fetch')));
const init = {
...overriddenInit,
body: isFormData(overriddenInit.body) ||
body: (await isFormData(overriddenInit.body)) ||
overriddenInit.body instanceof URLSearchParams ||
overriddenInit.body instanceof (await new node_fetch_1.Response().blob()).constructor
overriddenInit.body instanceof Blob
? overriddenInit.body

@@ -168,4 +183,5 @@ : JSON.stringify(overriddenInit.body),

exports.BaseAPI = BaseAPI;
function isFormData(value) {
return typeof form_data_1.default !== 'undefined' && value instanceof form_data_1.default;
async function isFormData(value) {
const FormData = await (0, exports.getFormDataCls)();
return typeof FormData !== 'undefined' && value instanceof FormData;
}

@@ -202,14 +218,2 @@ /**

*/
function canConsumeForm(consumes) {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
exports.canConsumeForm = canConsumeForm;
/**
* @private
*/
function validateRequiredRequestParams(requestParameters, keys) {

@@ -249,5 +253,11 @@ keys.forEach((key) => {

*/
function parseFormParam(originalValue) {
async function parseFormParam(originalValue) {
let value = originalValue;
value = typeof value == 'number' || typeof value == 'boolean' ? '' + value : value;
if (typeof originalValue === 'object' &&
'path' in originalValue &&
typeof originalValue.path === 'string') {
const { fileFrom } = await Promise.resolve().then(() => __importStar(require('node-fetch')));
value = await fileFrom(originalValue.path, 'application/json');
}
return value;

@@ -254,0 +264,0 @@ }

@@ -85,27 +85,17 @@ "use strict";

async importUsers(bodyParameters, initOverrides) {
const consumes = [{ contentType: 'multipart/form-data' }];
let formParams;
let useForm = false;
// use FormData to transmit files using content-type "multipart/form-data"
useForm = runtime.canConsumeForm(consumes);
if (useForm) {
formParams = new runtime.FormData();
}
else {
formParams = new URLSearchParams();
}
const formParams = new (await runtime.getFormDataCls())();
if (bodyParameters.users !== undefined) {
formParams.append('users', runtime.parseFormParam(bodyParameters.users));
formParams.append('users', await runtime.parseFormParam(bodyParameters.users));
}
if (bodyParameters.connection_id !== undefined) {
formParams.append('connection_id', runtime.parseFormParam(bodyParameters.connection_id));
formParams.append('connection_id', await runtime.parseFormParam(bodyParameters.connection_id));
}
if (bodyParameters.upsert !== undefined) {
formParams.append('upsert', runtime.parseFormParam(bodyParameters.upsert));
formParams.append('upsert', await runtime.parseFormParam(bodyParameters.upsert));
}
if (bodyParameters.external_id !== undefined) {
formParams.append('external_id', runtime.parseFormParam(bodyParameters.external_id));
formParams.append('external_id', await runtime.parseFormParam(bodyParameters.external_id));
}
if (bodyParameters.send_completion_email !== undefined) {
formParams.append('send_completion_email', runtime.parseFormParam(bodyParameters.send_completion_email));
formParams.append('send_completion_email', await runtime.parseFormParam(bodyParameters.send_completion_email));
}

@@ -112,0 +102,0 @@ const response = await this.request({

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = '4.0.0-beta.0';
exports.version = '4.0.0-beta.4';
//# sourceMappingURL=version.js.map

@@ -1,7 +0,11 @@

import { Response } from 'node-fetch';
import { retry } from './retry.js';
import { FetchError, RequiredError, TimeoutError } from './errors.js';
import fetch from 'node-fetch';
import FormData from 'form-data';
export { FormData };
/**
* @private
*/
const nodeFetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
/**
* @private
*/
export const getFormDataCls = async () => import('node-fetch').then(({ FormData }) => FormData);
export * from './models.js';

@@ -95,3 +99,3 @@ /**

this.middleware = configuration.middleware || [];
this.fetchApi = configuration.fetchApi || fetch;
this.fetchApi = configuration.fetchApi || nodeFetch;
this.parseError = configuration.parseError;

@@ -134,7 +138,8 @@ this.timeoutDuration =

};
const { Blob } = await import('node-fetch');
const init = {
...overriddenInit,
body: isFormData(overriddenInit.body) ||
body: (await isFormData(overriddenInit.body)) ||
overriddenInit.body instanceof URLSearchParams ||
overriddenInit.body instanceof (await new Response().blob()).constructor
overriddenInit.body instanceof Blob
? overriddenInit.body

@@ -146,3 +151,4 @@ : JSON.stringify(overriddenInit.body),

}
function isFormData(value) {
async function isFormData(value) {
const FormData = await getFormDataCls();
return typeof FormData !== 'undefined' && value instanceof FormData;

@@ -180,13 +186,2 @@ }

*/
export function canConsumeForm(consumes) {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
/**
* @private
*/
export function validateRequiredRequestParams(requestParameters, keys) {

@@ -224,7 +219,13 @@ keys.forEach((key) => {

*/
export function parseFormParam(originalValue) {
export async function parseFormParam(originalValue) {
let value = originalValue;
value = typeof value == 'number' || typeof value == 'boolean' ? '' + value : value;
if (typeof originalValue === 'object' &&
'path' in originalValue &&
typeof originalValue.path === 'string') {
const { fileFrom } = await import('node-fetch');
value = await fileFrom(originalValue.path, 'application/json');
}
return value;
}
//# sourceMappingURL=runtime.js.map

@@ -59,27 +59,17 @@ import * as runtime from '../../../lib/runtime.js';

async importUsers(bodyParameters, initOverrides) {
const consumes = [{ contentType: 'multipart/form-data' }];
let formParams;
let useForm = false;
// use FormData to transmit files using content-type "multipart/form-data"
useForm = runtime.canConsumeForm(consumes);
if (useForm) {
formParams = new runtime.FormData();
}
else {
formParams = new URLSearchParams();
}
const formParams = new (await runtime.getFormDataCls())();
if (bodyParameters.users !== undefined) {
formParams.append('users', runtime.parseFormParam(bodyParameters.users));
formParams.append('users', await runtime.parseFormParam(bodyParameters.users));
}
if (bodyParameters.connection_id !== undefined) {
formParams.append('connection_id', runtime.parseFormParam(bodyParameters.connection_id));
formParams.append('connection_id', await runtime.parseFormParam(bodyParameters.connection_id));
}
if (bodyParameters.upsert !== undefined) {
formParams.append('upsert', runtime.parseFormParam(bodyParameters.upsert));
formParams.append('upsert', await runtime.parseFormParam(bodyParameters.upsert));
}
if (bodyParameters.external_id !== undefined) {
formParams.append('external_id', runtime.parseFormParam(bodyParameters.external_id));
formParams.append('external_id', await runtime.parseFormParam(bodyParameters.external_id));
}
if (bodyParameters.send_completion_email !== undefined) {
formParams.append('send_completion_email', runtime.parseFormParam(bodyParameters.send_completion_email));
formParams.append('send_completion_email', await runtime.parseFormParam(bodyParameters.send_completion_email));
}

@@ -86,0 +76,0 @@ const response = await this.request({

@@ -1,2 +0,2 @@

export const version = '4.0.0-beta.0';
export const version = '4.0.0-beta.4';
//# sourceMappingURL=version.js.map
import { BaseAPI, ClientOptions } from '../lib/runtime.js';
import { AddClientAuthenticationPayload } from './client-authentication.js';
import type { Headers } from 'node-fetch';
export interface AuthenticationClientOptions extends ClientOptions {

@@ -5,0 +4,0 @@ domain: string;

@@ -1,2 +0,1 @@

import type { Headers } from 'node-fetch';
/**

@@ -3,0 +2,0 @@ * Error thrown when the API returns an error response that can't be parsed to a more specific Error instance.

@@ -1,2 +0,1 @@

import type { RequestInit, RequestInfo, Response, Headers } from 'node-fetch';
import { RetryConfiguration } from './retry.js';

@@ -6,3 +5,3 @@ /**

*/
export type FetchAPI = (url: URL | RequestInfo, init: RequestInit) => Promise<Response>;
export type FetchAPI = (url: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
export interface ClientOptions extends Omit<Configuration, 'baseUrl' | 'parseError'> {

@@ -29,3 +28,3 @@ telemetry?: boolean;

*/
agent?: RequestInit['agent'];
agent?: unknown;
/**

@@ -32,0 +31,0 @@ * Custom headers that will be added to every request.

@@ -1,2 +0,1 @@

import type { Response } from 'node-fetch';
/**

@@ -3,0 +2,0 @@ * Configure the retry logic for http calls.

@@ -1,6 +0,11 @@

import type { RequestInit, Blob as BlobType } from 'node-fetch';
import { Response } from 'node-fetch';
/// <reference types="node" />
import type { ReadStream } from 'fs';
import { RequestOpts, InitOverrideFunction, Configuration } from './models.js';
import FormData from 'form-data';
export { FormData, BlobType as Blob };
/**
* @private
*/
export declare const getFormDataCls: () => Promise<{
new (): FormData;
prototype: FormData;
}>;
export * from './models.js';

@@ -39,6 +44,2 @@ /**

*/
export declare function canConsumeForm(consumes: Consume[]): boolean;
/**
* @private
*/
export interface Consume {

@@ -70,2 +71,2 @@ contentType: string;

*/
export declare function parseFormParam(originalValue: unknown): unknown;
export declare function parseFormParam(originalValue: number | boolean | string | Blob | ReadStream): Promise<string | Blob>;
import { ManagementClientBase } from './__generated/index.js';
import { ManagementClientOptionsWithClientCredentials, ManagementClientOptionsWithToken } from './management-client-options.js';
import type { Headers } from 'node-fetch';
export declare class ManagementApiError extends Error {

@@ -5,0 +4,0 @@ errorCode: string;

@@ -1,1 +0,1 @@

export declare const version = "4.0.0-beta.0";
export declare const version = "4.0.0-beta.4";
{
"name": "auth0",
"version": "4.0.0-beta.3",
"version": "4.0.0-beta.4",
"description": "SDK for Auth0 API v2",

@@ -49,5 +49,4 @@ "main": "dist/cjs/index.js",

"dependencies": {
"form-data": "^4.0.0",
"jose": "^4.13.2",
"node-fetch": "^2.6.7",
"node-fetch": "^3.3.1",
"uuid": "^9.0.0"

@@ -60,2 +59,3 @@ },

"@types/mocha": "^10.0.1",
"@types/node": "^16.18.37",
"@types/node-fetch": "^2.6.3",

@@ -62,0 +62,0 @@ "@types/uuid": "^9.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc