Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import { getXHRResponse } from './getXHRResponse';
export class AjaxResponse {
constructor(originalEvent, xhr, request, type = 'download_load') {
this.originalEvent = originalEvent;
this.xhr = xhr;
this.request = request;
this.type = type;
const { status, responseType } = xhr;
this.status = status !== null && status !== void 0 ? status : 0;
this.responseType = responseType !== null && responseType !== void 0 ? responseType : '';
const allHeaders = xhr.getAllResponseHeaders();
this.responseHeaders = allHeaders
?
allHeaders.split('\n').reduce((headers, line) => {
const index = line.indexOf(': ');
headers[line.slice(0, index)] = line.slice(index + 2);
return headers;
}, {})
: {};
this.response = getXHRResponse(xhr);
const { loaded, total } = originalEvent;
this.loaded = loaded;
this.total = total;
}
}
//# sourceMappingURL=AjaxResponse.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"AjaxResponse.js","sourceRoot":"","sources":["../../../../src/internal/ajax/AjaxResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,MAAM,OAAO,YAAY;IA+CvB,YAIkB,aAA4B,EAM5B,GAAmB,EAInB,OAAoB,EAcpB,OAAyB,eAAe;QAxBxC,kBAAa,GAAb,aAAa,CAAe;QAM5B,QAAG,GAAH,GAAG,CAAgB;QAInB,YAAO,GAAP,OAAO,CAAa;QAcpB,SAAI,GAAJ,IAAI,CAAoC;QAExD,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,CAAC;QASvC,MAAM,UAAU,GAAG,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,UAAU;YAC/B,CAAC;gBACC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAA+B,EAAE,IAAI,EAAE,EAAE;oBAItE,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACjC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;oBACtD,OAAO,OAAO,CAAC;gBACjB,CAAC,EAAE,EAAE,CAAC;YACR,CAAC,CAAC,EAAE,CAAC;QAEP,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}

236
my-app/node_modules/rxjs/dist/esm/internal/ajax/ajax.js generated vendored Executable file
View file

@ -0,0 +1,236 @@
import { map } from '../operators/map';
import { Observable } from '../Observable';
import { AjaxResponse } from './AjaxResponse';
import { AjaxTimeoutError, AjaxError } from './errors';
function ajaxGet(url, headers) {
return ajax({ method: 'GET', url, headers });
}
function ajaxPost(url, body, headers) {
return ajax({ method: 'POST', url, body, headers });
}
function ajaxDelete(url, headers) {
return ajax({ method: 'DELETE', url, headers });
}
function ajaxPut(url, body, headers) {
return ajax({ method: 'PUT', url, body, headers });
}
function ajaxPatch(url, body, headers) {
return ajax({ method: 'PATCH', url, body, headers });
}
const mapResponse = map((x) => x.response);
function ajaxGetJSON(url, headers) {
return mapResponse(ajax({
method: 'GET',
url,
headers,
}));
}
export const ajax = (() => {
const create = (urlOrConfig) => {
const config = typeof urlOrConfig === 'string'
? {
url: urlOrConfig,
}
: urlOrConfig;
return fromAjax(config);
};
create.get = ajaxGet;
create.post = ajaxPost;
create.delete = ajaxDelete;
create.put = ajaxPut;
create.patch = ajaxPatch;
create.getJSON = ajaxGetJSON;
return create;
})();
const UPLOAD = 'upload';
const DOWNLOAD = 'download';
const LOADSTART = 'loadstart';
const PROGRESS = 'progress';
const LOAD = 'load';
export function fromAjax(init) {
return new Observable((destination) => {
var _a, _b;
const config = Object.assign({ async: true, crossDomain: false, withCredentials: false, method: 'GET', timeout: 0, responseType: 'json' }, init);
const { queryParams, body: configuredBody, headers: configuredHeaders } = config;
let url = config.url;
if (!url) {
throw new TypeError('url is required');
}
if (queryParams) {
let searchParams;
if (url.includes('?')) {
const parts = url.split('?');
if (2 < parts.length) {
throw new TypeError('invalid url');
}
searchParams = new URLSearchParams(parts[1]);
new URLSearchParams(queryParams).forEach((value, key) => searchParams.set(key, value));
url = parts[0] + '?' + searchParams;
}
else {
searchParams = new URLSearchParams(queryParams);
url = url + '?' + searchParams;
}
}
const headers = {};
if (configuredHeaders) {
for (const key in configuredHeaders) {
if (configuredHeaders.hasOwnProperty(key)) {
headers[key.toLowerCase()] = configuredHeaders[key];
}
}
}
const crossDomain = config.crossDomain;
if (!crossDomain && !('x-requested-with' in headers)) {
headers['x-requested-with'] = 'XMLHttpRequest';
}
const { withCredentials, xsrfCookieName, xsrfHeaderName } = config;
if ((withCredentials || !crossDomain) && xsrfCookieName && xsrfHeaderName) {
const xsrfCookie = (_b = (_a = document === null || document === void 0 ? void 0 : document.cookie.match(new RegExp(`(^|;\\s*)(${xsrfCookieName})=([^;]*)`))) === null || _a === void 0 ? void 0 : _a.pop()) !== null && _b !== void 0 ? _b : '';
if (xsrfCookie) {
headers[xsrfHeaderName] = xsrfCookie;
}
}
const body = extractContentTypeAndMaybeSerializeBody(configuredBody, headers);
const _request = Object.assign(Object.assign({}, config), { url,
headers,
body });
let xhr;
xhr = init.createXHR ? init.createXHR() : new XMLHttpRequest();
{
const { progressSubscriber, includeDownloadProgress = false, includeUploadProgress = false } = init;
const addErrorEvent = (type, errorFactory) => {
xhr.addEventListener(type, () => {
var _a;
const error = errorFactory();
(_a = progressSubscriber === null || progressSubscriber === void 0 ? void 0 : progressSubscriber.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber, error);
destination.error(error);
});
};
addErrorEvent('timeout', () => new AjaxTimeoutError(xhr, _request));
addErrorEvent('abort', () => new AjaxError('aborted', xhr, _request));
const createResponse = (direction, event) => new AjaxResponse(event, xhr, _request, `${direction}_${event.type}`);
const addProgressEvent = (target, type, direction) => {
target.addEventListener(type, (event) => {
destination.next(createResponse(direction, event));
});
};
if (includeUploadProgress) {
[LOADSTART, PROGRESS, LOAD].forEach((type) => addProgressEvent(xhr.upload, type, UPLOAD));
}
if (progressSubscriber) {
[LOADSTART, PROGRESS].forEach((type) => xhr.upload.addEventListener(type, (e) => { var _a; return (_a = progressSubscriber === null || progressSubscriber === void 0 ? void 0 : progressSubscriber.next) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber, e); }));
}
if (includeDownloadProgress) {
[LOADSTART, PROGRESS].forEach((type) => addProgressEvent(xhr, type, DOWNLOAD));
}
const emitError = (status) => {
const msg = 'ajax error' + (status ? ' ' + status : '');
destination.error(new AjaxError(msg, xhr, _request));
};
xhr.addEventListener('error', (e) => {
var _a;
(_a = progressSubscriber === null || progressSubscriber === void 0 ? void 0 : progressSubscriber.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber, e);
emitError();
});
xhr.addEventListener(LOAD, (event) => {
var _a, _b;
const { status } = xhr;
if (status < 400) {
(_a = progressSubscriber === null || progressSubscriber === void 0 ? void 0 : progressSubscriber.complete) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber);
let response;
try {
response = createResponse(DOWNLOAD, event);
}
catch (err) {
destination.error(err);
return;
}
destination.next(response);
destination.complete();
}
else {
(_b = progressSubscriber === null || progressSubscriber === void 0 ? void 0 : progressSubscriber.error) === null || _b === void 0 ? void 0 : _b.call(progressSubscriber, event);
emitError(status);
}
});
}
const { user, method, async } = _request;
if (user) {
xhr.open(method, url, async, user, _request.password);
}
else {
xhr.open(method, url, async);
}
if (async) {
xhr.timeout = _request.timeout;
xhr.responseType = _request.responseType;
}
if ('withCredentials' in xhr) {
xhr.withCredentials = _request.withCredentials;
}
for (const key in headers) {
if (headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, headers[key]);
}
}
if (body) {
xhr.send(body);
}
else {
xhr.send();
}
return () => {
if (xhr && xhr.readyState !== 4) {
xhr.abort();
}
};
});
}
function extractContentTypeAndMaybeSerializeBody(body, headers) {
var _a;
if (!body ||
typeof body === 'string' ||
isFormData(body) ||
isURLSearchParams(body) ||
isArrayBuffer(body) ||
isFile(body) ||
isBlob(body) ||
isReadableStream(body)) {
return body;
}
if (isArrayBufferView(body)) {
return body.buffer;
}
if (typeof body === 'object') {
headers['content-type'] = (_a = headers['content-type']) !== null && _a !== void 0 ? _a : 'application/json;charset=utf-8';
return JSON.stringify(body);
}
throw new TypeError('Unknown body type');
}
const _toString = Object.prototype.toString;
function toStringCheck(obj, name) {
return _toString.call(obj) === `[object ${name}]`;
}
function isArrayBuffer(body) {
return toStringCheck(body, 'ArrayBuffer');
}
function isFile(body) {
return toStringCheck(body, 'File');
}
function isBlob(body) {
return toStringCheck(body, 'Blob');
}
function isArrayBufferView(body) {
return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(body);
}
function isFormData(body) {
return typeof FormData !== 'undefined' && body instanceof FormData;
}
function isURLSearchParams(body) {
return typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams;
}
function isReadableStream(body) {
return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream;
}
//# sourceMappingURL=ajax.js.map

File diff suppressed because one or more lines are too long

28
my-app/node_modules/rxjs/dist/esm/internal/ajax/errors.js generated vendored Executable file
View file

@ -0,0 +1,28 @@
import { getXHRResponse } from './getXHRResponse';
import { createErrorClass } from '../util/createErrorClass';
export const AjaxError = createErrorClass((_super) => function AjaxErrorImpl(message, xhr, request) {
this.message = message;
this.name = 'AjaxError';
this.xhr = xhr;
this.request = request;
this.status = xhr.status;
this.responseType = xhr.responseType;
let response;
try {
response = getXHRResponse(xhr);
}
catch (err) {
response = xhr.responseText;
}
this.response = response;
});
export const AjaxTimeoutError = (() => {
function AjaxTimeoutErrorImpl(xhr, request) {
AjaxError.call(this, 'ajax timeout', xhr, request);
this.name = 'AjaxTimeoutError';
return this;
}
AjaxTimeoutErrorImpl.prototype = Object.create(AjaxError.prototype);
return AjaxTimeoutErrorImpl;
})();
//# sourceMappingURL=errors.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/internal/ajax/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAsD5D,MAAM,CAAC,MAAM,SAAS,GAAkB,gBAAgB,CACtD,CAAC,MAAM,EAAE,EAAE,CACT,SAAS,aAAa,CAAY,OAAe,EAAE,GAAmB,EAAE,OAAoB;IAC1F,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACzB,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IACrC,IAAI,QAAa,CAAC;IAClB,IAAI;QAGF,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;KAChC;IAAC,OAAO,GAAG,EAAE;QACZ,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC;KAC7B;IACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,CAAC,CACJ,CAAC;AAsBF,MAAM,CAAC,MAAM,gBAAgB,GAAyB,CAAC,GAAG,EAAE;IAC1D,SAAS,oBAAoB,CAAY,GAAmB,EAAE,OAAoB;QAChF,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,oBAAoB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACpE,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC,EAAS,CAAC"}

View file

@ -0,0 +1,26 @@
export function getXHRResponse(xhr) {
switch (xhr.responseType) {
case 'json': {
if ('response' in xhr) {
return xhr.response;
}
else {
const ieXHR = xhr;
return JSON.parse(ieXHR.responseText);
}
}
case 'document':
return xhr.responseXML;
case 'text':
default: {
if ('response' in xhr) {
return xhr.response;
}
else {
const ieXHR = xhr;
return ieXHR.responseText;
}
}
}
}
//# sourceMappingURL=getXHRResponse.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"getXHRResponse.js","sourceRoot":"","sources":["../../../../src/internal/ajax/getXHRResponse.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,cAAc,CAAC,GAAmB;IAChD,QAAQ,GAAG,CAAC,YAAY,EAAE;QACxB,KAAK,MAAM,CAAC,CAAC;YACX,IAAI,UAAU,IAAI,GAAG,EAAE;gBACrB,OAAO,GAAG,CAAC,QAAQ,CAAC;aACrB;iBAAM;gBAEL,MAAM,KAAK,GAAQ,GAAG,CAAC;gBACvB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;aACvC;SACF;QACD,KAAK,UAAU;YACb,OAAO,GAAG,CAAC,WAAW,CAAC;QACzB,KAAK,MAAM,CAAC;QACZ,OAAO,CAAC,CAAC;YACP,IAAI,UAAU,IAAI,GAAG,EAAE;gBACrB,OAAO,GAAG,CAAC,QAAQ,CAAC;aACrB;iBAAM;gBAEL,MAAM,KAAK,GAAQ,GAAG,CAAC;gBACvB,OAAO,KAAK,CAAC,YAAY,CAAC;aAC3B;SACF;KACF;AACH,CAAC"}

2
my-app/node_modules/rxjs/dist/esm/internal/ajax/types.js generated vendored Executable file
View file

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/internal/ajax/types.ts"],"names":[],"mappings":""}