Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dist/contract
dist/cucumber
upload
test/specs
.claude/*

# GitHub Actions #
##################
Expand Down
10 changes: 8 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ coverage/
.idea
*.iml
.travis

test/*
.eslintignore
.eslintrc.cjs
.prettierrc
.prettierignore
.prettierignore
.claude/*
.babelrc

.github
release-artifacts-*
resources/*
docs-snippets/*
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2025-11-03
version: v10.2.1
changes:
- type: improvement
text: "Expose `File` on pubnub instance to manually create supported File construct."
- date: 2025-10-29
version: v10.2.0
changes:
Expand Down Expand Up @@ -1354,7 +1359,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '10.2.0'
version: '10.2.1'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1370,7 +1375,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.0.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.1.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -2041,7 +2046,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v10.2.0/pubnub.10.2.0.js
location: https://github.com/pubnub/javascript/releases/download/v10.2.1/pubnub.10.2.1.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v10.2.1
November 03 2025

#### Modified
- Expose `File` on pubnub instance to manually create supported File construct.

## v10.2.0
October 29 2025

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.1.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.1.min.js

2. Configure your keys:

Expand Down
6 changes: 5 additions & 1 deletion dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -5436,7 +5436,7 @@
return base.PubNubFile;
},
get version() {
return '10.2.0';
return '10.2.1';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -18358,6 +18358,10 @@
tokenManager,
crypto,
});
/**
* PubNub File constructor.
*/
this.File = PubNubFile;
this.onHeartbeatIntervalChange = heartbeatIntervalChangeHandler;
this.onAuthenticationChange = authenticationChangeHandler;
this.onPresenceStateChange = presenceStateChangeHandler;
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/components/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '10.2.0';
return '10.2.1';
},
getVersion() {
return this.version;
Expand Down
4 changes: 4 additions & 0 deletions lib/react_native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class PubNub extends pubnub_common_1.PubNubCore {
tokenManager,
crypto,
});
/**
* PubNub File constructor.
*/
this.File = react_native_1.default;
}
}
/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pubnub",
"version": "10.2.0",
"version": "10.2.1",
"author": "PubNub <support@pubnub.com>",
"description": "Publish & Subscribe Real-time Messaging with PubNub",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const makeConfiguration = (
return base.PubNubFile;
},
get version(): string {
return '10.2.0';
return '10.2.1';
},
getVersion(): string {
return this.version;
Expand Down
6 changes: 6 additions & 0 deletions src/react_native/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { CryptorConfiguration, ICryptoModule } from '../core/interfaces/cry
import { PubNubCore } from '../core/pubnub-common';
import { setDefaults } from './configuration';
import Cbor from '../cbor/common';
import { PubNubFileConstructor } from '../core/types/file';

export type {
LinearRetryPolicyConfiguration,
Expand Down Expand Up @@ -77,6 +78,11 @@ export default class PubNub extends PubNubCore<null, PubNubFileParameters> {
*/
static generateUUID = PubNubCore.generateUUID;

/**
* PubNub File constructor.
*/
public File: PubNubFileConstructor<PubNubFile, PubNubFileParameters> = PubNubFile;

/**
* Construct notification payload which will trigger push notification.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import WebCryptography from '../crypto/modules/web';
import { PubNubCore } from '../core/pubnub-common';
import Cbor from '../cbor/common';
import { Payload } from '../core/types/api';
import { PubNubFileConstructor } from '../core/types/file';

/**
* PubNub client for browser platform.
Expand All @@ -36,6 +37,10 @@ export default class PubNub extends PubNubCore<ArrayBuffer | string, PubNubFileP
static CryptoModule: typeof CryptoModuleType | undefined =
process.env.CRYPTO_MODULE !== 'disabled' ? WebCryptoModule : undefined;

/**
* PubNub File constructor.
*/
public File: PubNubFileConstructor<PubNubFile, PubNubFileParameters> = PubNubFile;
/**
* Create and configure the PubNub client core.
*
Expand Down
59 changes: 58 additions & 1 deletion test/dist/react-native.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe('#distribution test (rkt-native)', function () {

it('should maintain compatibility with all static method signatures', function () {
// Test that all methods match expected signatures from Web/Node

// Retry policy methods should accept configuration objects
expect(() => {
PubNub.ExponentialRetryPolicy({
Expand Down Expand Up @@ -356,4 +356,61 @@ describe('#distribution test (rkt-native)', function () {
}).to.not.throw();
});
});

describe('#File', function () {
it('should have access to File property on pubnub instance', function () {
expect(pubnub.File).to.be.a('function');
expect(pubnub.File).to.have.property('create');
});

it('should be able to create a PubNubFile using pubnub.File.create() with data object', function () {
const fileData = {
data: 'Hello World',
name: 'test.txt',
mimeType: 'text/plain'
};

const file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('test.txt');
expect(file).to.have.property('mimeType').equal('text/plain');
expect(file).to.have.property('data');
});

it('should be able to create a PubNubFile using pubnub.File.create() with Blob', function () {
const blob = new Blob(['test content'], { type: 'text/plain' });
const fileData = {
data: blob,
name: 'blob-test.txt',
mimeType: 'text/plain'
};

const file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('blob-test.txt');
expect(file).to.have.property('mimeType').equal('text/plain');
});

it('should be able to create a PubNubFile using pubnub.File.create() with uri', function () {
const fileData = {
uri: 'file:///path/to/file.txt',
name: 'uri-test.txt',
mimeType: 'text/plain'
};

const file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('uri-test.txt');
expect(file).to.have.property('mimeType').equal('text/plain');
});

it('should throw error when creating PubNubFile without required parameters', function () {
expect(() => {
pubnub.File.create({});
}).to.throw();
});
});
});
79 changes: 79 additions & 0 deletions test/dist/web.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* global describe, beforeEach, it, before, afterEach, after, chai */
/* eslint no-console: 0 */

import { expect } from 'chai';
import PubNub from '../../src/web';

var pubnub;

describe('#distribution test (web)', function () {
before(function () {
pubnub = new PubNub({
subscribeKey: 'demo',
publishKey: 'demo',
uuid: 'myUUID',
});
});

after(function () {
pubnub.destroy();
});

describe('#File', function () {
it('should have access to File property on pubnub instance', function () {
expect(pubnub.File).to.be.a('function');
expect(pubnub.File).to.have.property('create');
});

it('should be able to create a PubNubFile using pubnub.File.create() with data object', function () {
var fileData = {
data: 'Hello World',
name: 'test.txt',
mimeType: 'text/plain',
};

var file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('test.txt');
expect(file).to.have.property('mimeType').equal('text/plain');
expect(file).to.have.property('data');
});

it('should be able to create a PubNubFile using pubnub.File.create() with Blob', function () {
var blob = new Blob(['test content'], { type: 'text/plain' });
var fileData = {
data: blob,
name: 'blob-test.txt',
mimeType: 'text/plain',
};

var file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('blob-test.txt');
expect(file).to.have.property('mimeType').equal('text/plain');
});

it('should be able to create a PubNubFile using pubnub.File.create() with ArrayBuffer', function () {
var buffer = new ArrayBuffer(8);
var fileData = {
data: buffer,
name: 'buffer-test.bin',
mimeType: 'application/octet-stream',
};

var file = pubnub.File.create(fileData);

expect(file).to.be.an('object');
expect(file).to.have.property('name').equal('buffer-test.bin');
expect(file).to.have.property('mimeType').equal('application/octet-stream');
});

it('should throw error when creating PubNubFile without required parameters', function () {
expect(function () {
pubnub.File.create({});
}).to.throw();
});
});
});
Loading