Initial Sample.

This commit is contained in:
2024-06-03 20:23:50 +05:30
parent ef2b65f673
commit 5269ec3c66
2575 changed files with 282312 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import type { ClientOptions } from "subscriptions-transport-ws";
import { SubscriptionClient } from "subscriptions-transport-ws";
import type { Operation, FetchResult } from "../core/index.js";
import { ApolloLink } from "../core/index.js";
import type { Observable } from "../../utilities/index.js";
export declare namespace WebSocketLink {
/**
* Configuration to use when constructing the subscription client (subscriptions-transport-ws).
*/
interface Configuration {
/**
* The endpoint to connect to.
*/
uri: string;
/**
* Options to pass when constructing the subscription client.
*/
options?: ClientOptions;
/**
* A custom WebSocket implementation to use.
*/
webSocketImpl?: any;
}
}
export import WebSocketParams = WebSocketLink.Configuration;
export declare class WebSocketLink extends ApolloLink {
private subscriptionClient;
constructor(paramsOrClient: WebSocketLink.Configuration | SubscriptionClient);
request(operation: Operation): Observable<FetchResult> | null;
}
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,22 @@
import { __extends } from "tslib";
import { SubscriptionClient } from "subscriptions-transport-ws";
import { ApolloLink } from "../core/index.js";
var WebSocketLink = /** @class */ (function (_super) {
__extends(WebSocketLink, _super);
function WebSocketLink(paramsOrClient) {
var _this = _super.call(this) || this;
if (paramsOrClient instanceof SubscriptionClient) {
_this.subscriptionClient = paramsOrClient;
}
else {
_this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);
}
return _this;
}
WebSocketLink.prototype.request = function (operation) {
return this.subscriptionClient.request(operation);
};
return WebSocketLink;
}(ApolloLink));
export { WebSocketLink };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/ws/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4B9C;IAAmC,iCAAU;IAG3C,uBACE,cAAgE;QAEhE,YAAA,MAAK,WAAE,SAAC;QAER,IAAI,cAAc,YAAY,kBAAkB,EAAE,CAAC;YACjD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,KAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;QACJ,CAAC;;IACH,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACpC,SAAS,CACiB,CAAC;IAC/B,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,UAAU,GAwB5C","sourcesContent":["import type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl\n );\n }\n }\n\n public request(operation: Operation): Observable<FetchResult> | null {\n return this.subscriptionClient.request(\n operation\n ) as Observable<FetchResult>;\n }\n}\n"]}

View File

@@ -0,0 +1,8 @@
{
"name": "@apollo/client/link/ws",
"type": "module",
"main": "ws.cjs",
"module": "index.js",
"types": "index.d.ts",
"sideEffects": false
}

View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var tslib = require('tslib');
var subscriptionsTransportWs = require('subscriptions-transport-ws');
var core = require('../core');
var WebSocketLink = (function (_super) {
tslib.__extends(WebSocketLink, _super);
function WebSocketLink(paramsOrClient) {
var _this = _super.call(this) || this;
if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) {
_this.subscriptionClient = paramsOrClient;
}
else {
_this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);
}
return _this;
}
WebSocketLink.prototype.request = function (operation) {
return this.subscriptionClient.request(operation);
};
return WebSocketLink;
}(core.ApolloLink));
exports.WebSocketLink = WebSocketLink;
//# sourceMappingURL=ws.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ws.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\nimport { ApolloLink } from \"../core/index.js\";\nvar WebSocketLink = /** @class */ (function (_super) {\n __extends(WebSocketLink, _super);\n function WebSocketLink(paramsOrClient) {\n var _this = _super.call(this) || this;\n if (paramsOrClient instanceof SubscriptionClient) {\n _this.subscriptionClient = paramsOrClient;\n }\n else {\n _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);\n }\n return _this;\n }\n WebSocketLink.prototype.request = function (operation) {\n return this.subscriptionClient.request(operation);\n };\n return WebSocketLink;\n}(ApolloLink));\nexport { WebSocketLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;;AAGG,IAAC,aAAa,KAAkB,UAAU,MAAM,EAAE;AACrD,IAAIA,eAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACrC,IAAI,SAAS,aAAa,CAAC,cAAc,EAAE;AAC3C,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,IAAI,cAAc,YAAYC,2CAAkB,EAAE;AAC1D,YAAY,KAAK,CAAC,kBAAkB,GAAG,cAAc,CAAC;AACtD,SAAS;AACT,aAAa;AACb,YAAY,KAAK,CAAC,kBAAkB,GAAG,IAAIA,2CAAkB,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;AACxI,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;AAC3D,QAAQ,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC1D,KAAK,CAAC;AACN,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAACC,eAAU,CAAC;;;;"}

View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var tslib = require('tslib');
var subscriptionsTransportWs = require('subscriptions-transport-ws');
var core = require('../core');
var WebSocketLink = (function (_super) {
tslib.__extends(WebSocketLink, _super);
function WebSocketLink(paramsOrClient) {
var _this = _super.call(this) || this;
if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) {
_this.subscriptionClient = paramsOrClient;
}
else {
_this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);
}
return _this;
}
WebSocketLink.prototype.request = function (operation) {
return this.subscriptionClient.request(operation);
};
return WebSocketLink;
}(core.ApolloLink));
exports.WebSocketLink = WebSocketLink;
//# sourceMappingURL=ws.cjs.map