Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

superagent replacement and web worker for web #367

Merged
merged 34 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4092543
wip
parfeon Feb 23, 2024
0b11024
Merge branch 'master' into feature/network-provider-interfaces
parfeon Feb 23, 2024
d546dff
feat(browser): replace `superagent` with web worker
parfeon Mar 29, 2024
d3261a2
fix(subscribe): fix passed methods scope binding
parfeon Apr 1, 2024
eae2d35
fix(web): fix SDK family for Web package
parfeon Apr 1, 2024
d7c49e2
fix(worker): fix Web Worker load mechanism Chrome compatibility
parfeon Apr 1, 2024
12e87ed
Merge branch 'feature/network-provider-interfaces' of github.com:pubn…
parfeon Apr 1, 2024
a0da6d8
build: bumped minimum NodeJS version for tests
parfeon Apr 1, 2024
5040e5c
fix(subscription): fix subscription manager
parfeon Apr 2, 2024
b90835e
refactor(worker): migrate from `Web` to `Service` Worker
parfeon Apr 15, 2024
a94df08
fix(lint): exclude import line from check
parfeon Apr 16, 2024
780b1b4
test: print actual assertion reason
parfeon Apr 16, 2024
225b397
test: add payload debug output)
parfeon Apr 16, 2024
780fa90
test: upgrade cucumber modules
parfeon Apr 16, 2024
a20ebf9
fix: error message format for backward compatibility
parfeon Apr 16, 2024
6dbc387
build(workflow): add environment keys
parfeon Apr 16, 2024
727a65b
build(react-native): return pre-built React Native libs
parfeon Apr 17, 2024
313f48e
Merge branch 'feature/network-provider-interfaces' of github.com:pubn…
parfeon Apr 17, 2024
05d74a3
refactor(react-native): add polyfill for encoder and decoder
parfeon Apr 17, 2024
050a463
fix: event-engine test steps type issues
mohitpubnub Apr 18, 2024
d7cf6ca
fix: acceptance test tsconfig.json for implicit any types
mohitpubnub Apr 18, 2024
0445820
Merge branch 'master' into feature/network-provider-interfaces
parfeon Apr 18, 2024
6f73dae
test: fix acceptance tests runner
parfeon Apr 18, 2024
7fd473c
refactor(react-native): add 'URL.pathname' polyfill
parfeon Apr 18, 2024
8a9ac53
test(contract): fix decorator pattern for subscribe restore
parfeon Apr 18, 2024
d732b4e
test(contract): add small delay for event engine log check
parfeon Apr 18, 2024
6a34592
fix(presence-event-engine): fix leave call
parfeon Apr 18, 2024
7850412
test(event-engine): fix content type in mock for EE unit test
parfeon Apr 18, 2024
6bc21fa
fix(web-crypto): fix issues with cross SDK compatibility
parfeon Apr 19, 2024
096315f
refactor(service-worker): unresponsive clients clean up
parfeon Apr 22, 2024
db58678
fix(build): fix compiled lib import
parfeon Apr 22, 2024
50ed4f7
test: update runner environment with proper keys
parfeon Apr 22, 2024
7e5f0dd
PubNub SDK v8.0.0 release.
pubnub-release-bot Apr 22, 2024
ffed6a6
Update configuration.ts
parfeon Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
2 changes: 1 addition & 1 deletion .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spec: test/**/*.test.{ts,js}
require: test/setup.js
require: test/setup.cjs
exclude:
- test/dist/*.js
- test/feature/*.js
Expand Down
26,597 changes: 11,991 additions & 14,606 deletions dist/web/pubnub.js

Large diffs are not rendered by default.

19 changes: 2 additions & 17 deletions dist/web/pubnub.min.js

Large diffs are not rendered by default.

27 changes: 26 additions & 1 deletion lib/core/components/abort_signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbortSignal = exports.AbortError = void 0;
var subject_1 = require("./subject");
Expand All @@ -32,7 +57,7 @@ exports.AbortError = AbortError;
var AbortSignal = /** @class */ (function (_super) {
__extends(AbortSignal, _super);
function AbortSignal() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this._aborted = false;
return _this;
}
Expand Down
209 changes: 0 additions & 209 deletions lib/core/components/config.js

This file was deleted.

139 changes: 139 additions & 0 deletions lib/core/components/configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
"use strict";
/**
* {@link PubNub} client configuration module.
*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeConfiguration = void 0;
var uuid_1 = __importDefault(require("./uuid"));
// --------------------------------------------------------
// ----------------------- Defaults -----------------------
// --------------------------------------------------------
// region Defaults
/**
* Whether encryption (if set) should use random initialization vector or not.
*/
var USE_RANDOM_INITIALIZATION_VECTOR = true;
/**
* Create {@link PubNub} client private configuration object.
*
* @param base - User- and platform-provided configuration.
* @param setupCryptoModule - Platform-provided {@link CryptoModule} configuration block.
*
* @returns `PubNub` client private configuration.
*/
var makeConfiguration = function (base, setupCryptoModule) {
var _a, _b, _c;
// Ensure that retry policy has proper configuration (if has been set).
(_a = base.retryConfiguration) === null || _a === void 0 ? void 0 : _a.validate();
(_b = base.useRandomIVs) !== null && _b !== void 0 ? _b : (base.useRandomIVs = USE_RANDOM_INITIALIZATION_VECTOR);
// Override origin value.
base.origin = standardOrigin((_c = base.ssl) !== null && _c !== void 0 ? _c : false, base.origin);
var clientConfiguration = __assign(__assign({}, base), { _pnsdkSuffix: {}, _instanceId: "pn-".concat(uuid_1.default.createUUID()), _cryptoModule: undefined, _cipherKey: undefined, _setupCryptoModule: setupCryptoModule, get instanceId() {
if (this.useInstanceId)
return this._instanceId;
return undefined;
}, getUserId: function () {
return this.userId;
}, setUserId: function (value) {
if (!value || typeof value !== 'string' || value.trim().length === 0)
throw new Error('Missing or invalid userId parameter. Provide a valid string userId');
this.userId = value;
}, getAuthKey: function () {
return this.authKey;
}, setAuthKey: function (authKey) {
this.authKey = authKey;
}, getFilterExpression: function () {
return this.filterExpression;
}, setFilterExpression: function (expression) {
this.filterExpression = expression;
}, get cipherKey() {
return this._cipherKey;
}, setCipherKey: function (key) {
this._cipherKey = key;
if (!key && this._cryptoModule) {
this._cryptoModule = undefined;
return;
}
else if (!key || !this._setupCryptoModule)
return;
this._cryptoModule = this._setupCryptoModule({
cipherKey: key,
useRandomIVs: base.useRandomIVs,
customEncrypt: this.customEncrypt,
customDecrypt: this.customDecrypt,
});
}, get cryptoModule() {
return this._cryptoModule;
},
get useRandomIVs() {
return base.useRandomIVs;
}, getPresenceTimeout: function () {
return this.presenceTimeout;
}, getHeartbeatInterval: function () {
return this.heartbeatInterval;
}, setHeartbeatInterval: function (interval) {
this.heartbeatInterval = interval;
}, getTransactionTimeout: function () {
return this.transactionalRequestTimeout;
}, getSubscribeTimeout: function () {
return this.subscribeRequestTimeout;
}, get PubNubFile() {
return this.PubNubFile;
},
get version() {
return '7.6.0';
}, getVersion: function () {
return this.version;
}, _addPnsdkSuffix: function (name, suffix) {
this._pnsdkSuffix[name] = "".concat(suffix);
}, _getPnsdkSuffix: function (separator) {
return Object.values(this._pnsdkSuffix).join(separator);
},
// --------------------------------------------------------
// ---------------------- Deprecated ----------------------
// --------------------------------------------------------
// region Deprecated
getUUID: function () {
return this.getUserId();
}, setUUID: function (value) {
this.setUserId(value);
}, get customEncrypt() {
return base.customEncrypt;
},
get customDecrypt() {
return base.customDecrypt;
} });
// Setup `CryptoModule` if possible.
if (base.cipherKey)
clientConfiguration.setCipherKey(base.cipherKey);
return clientConfiguration;
};
exports.makeConfiguration = makeConfiguration;
/**
* Decide {@lin PubNub} service REST API origin.
*
* @param secure - Whether preferred to use secured connection or not.
* @param origin - User-provided or default origin.
*
* @returns `PubNub` REST API endpoints origin.
*/
var standardOrigin = function (secure, origin) {
var protocol = secure ? 'https://' : 'http://';
if (typeof origin === 'string')
return "".concat(protocol).concat(origin);
return "".concat(protocol).concat(origin[Math.floor(Math.random() * origin.length)]);
};
Loading
Loading