Skip to content

Commit

Permalink
chore: remove deprecated from v10
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-crouzet committed Oct 20, 2023
1 parent 04c48a6 commit 1174a8f
Show file tree
Hide file tree
Showing 352 changed files with 88 additions and 21,479 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
${{ runner.os }}-jest-${{ env.hash }}
${{ runner.os }}-jest
${{ runner.os }}
- name: Build swagger generator
run: yarn nx run ama-sdk-generator-sdk:build-swagger
- name: Test
env:
testCmd: ${{ inputs.affected && format('test:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'test'}}
Expand Down
40 changes: 0 additions & 40 deletions packages/@ama-sdk/core/src/fwk/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export class CommonDate extends Date {
super(...(args as []));
}

/** @deprecated will be removed in v10 */
public get dateInstance(): Date { return this; }

/**
* Overrides the JSON conversion to remove any timezone information.
*/
Expand Down Expand Up @@ -130,42 +127,5 @@ export namespace utils {
* To ensure that users cannot use a standard Date instead of utils.DateTime
*/
protected _DateTime(): void {}

/**
* Get an instance of utils.Date base on the current date
*
* @deprecated will be removed in v10
*/
public getUtilsDate(): Date {
return new Date(this);
}
}

/**
* Receives an object containing key/value pairs
* Encodes this object to match application/x-www-urlencoded or multipart/form-data
*
* @deprecated Please use processFormData in api.helpers, will be removed in v10
*/
export function processFormData(headers: Headers, data: any, type: string): any {

let encodedData: any;

if (type === 'multipart/form-data') {
const formData: FormData = new FormData();
for (const i in data) {
formData.append(i, data[i]);
}
encodedData = formData;
} else {
headers.set('Content-Type', 'application/x-www-form-urlencoded');
const formData: string[] = [];
for (const i in data) {
formData.push(`${i}=${encodeURIComponent(data[i])}`);
}
encodedData = formData.join('&');
}

return encodedData;
}
}
8 changes: 0 additions & 8 deletions packages/@ama-sdk/core/src/fwk/mocks/mock-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export interface MockAdapter {
*/
getLatestMock(operationId: string): Mock<any>;

/**
* Retrieves an operation ID from an API request
*
* @param request the api request
* @deprecated Please use retrieveOperationId instead
*/
getOperationId(request: EncodedApiRequest): string;

/**
* Retrieves an operation ID from an API request
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,6 @@ import {PluginRunner, RequestOptions, RequestPlugin} from '../core';
*/
export type BotProtectionFingerprintRetriever = () => string | undefined | Promise<string | undefined>;

/**
* Implementation of a retriever based on a cookie.
* Creates a reused RegExp based on the cookieName and tries to extract its value from document.cookie.
*
* @param cookieName Name of the cookie to search for
* @deprecated Imperva integration should rely on the latest impervaProtectionRetrieverFactory
*/
export function cookieRetrieverFactory(cookieName: string): BotProtectionFingerprintRetriever {
const cookieRegExp = new RegExp(`(?:^|;)\\s*${cookieName}\\s*=\\s*([^;]+)`);
return () => {
if (typeof document === 'undefined') {
throw new Error('[SDK][Plug-in][BotProtectionFingerprintRequest] Trying to use cookieRetrieverFactory but "document" is not defined.');
}
const cookieMatcher = document.cookie && document.cookie.match(cookieRegExp);
if (cookieMatcher) {
return cookieMatcher[cookieMatcher.length - 1];
}
};
}

/**
* Represents the object exposed by Imperva for the integration of their Advanced Bot Protection script with Singe Page Apps.
*/
Expand Down Expand Up @@ -119,32 +99,6 @@ export function akamaiTelemetryRetrieverFactory(bmakOpt?: AkamaiObject): BotProt
};
}

/**
* Implementation of a retriever based on the way Imperva stores the fingerprint information in localStorage.
* Since it contains the expiry time of the fingerprint we are able to ignore it if it has to be recomputed.
*
* @param storageKey The name of the property in local storage where the fingerprint is saved
* @param ignoreExpired Return the fingerprint even if it is expired. Default: false
* @deprecated Imperva integration should rely on the latest impervaProtectionRetrieverFactory
*/
export function impervaLocalStorageRetrieverFactory(storageKey: string, ignoreExpired = false): BotProtectionFingerprintRetriever {
return () => {
if (typeof localStorage === 'undefined') {
throw new Error('[SDK][Plug-in][BotProtectionFingerprintRequest] Trying to use localStorageRetrieverFactory but localStorage is not defined.');
}
const storedFingerprint = localStorage.getItem(storageKey);

try {
const parsedFingerprint = storedFingerprint && JSON.parse(storedFingerprint) as { token?: string; renewTime?: number };

if (parsedFingerprint && (ignoreExpired || parsedFingerprint.renewTime && parsedFingerprint.renewTime >= Date.now())) {
return parsedFingerprint.token;
}
} catch {
}
};
}

/**
* Options to configure the fingerprint poller
*/
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/@ama-sdk/core/src/plugins/fetch-options/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions packages/@ama-sdk/core/src/plugins/fetch-options/readme.md

This file was deleted.

Loading

0 comments on commit 1174a8f

Please sign in to comment.