Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3c236b1
refactor: Bump puppeteer from 24.4.0 to 24.6.0 (#2555)
dependabot[bot] Apr 5, 2025
d706dff
refactor: Bump typescript-eslint from 8.28.0 to 8.29.0 (#2546)
dependabot[bot] Apr 5, 2025
c601676
ci: Remove `husky` and `prettier` in favor of `eslint` (#2550)
dplewis Apr 6, 2025
ab449ed
refactor: Bump mongodb-runner from 5.8.0 to 5.8.1 (#2552)
dependabot[bot] Apr 6, 2025
6b48462
refactor: Bump express from 4.21.2 to 5.1.0 (#2541)
dependabot[bot] Apr 7, 2025
616eabd
refactor: Upgrade to parse-server 8.1.0 (#2557)
dblythy Apr 7, 2025
6f6bb66
feat: Add `Uint8Array` support for `Parse.File` data (#2548)
dplewis Apr 7, 2025
378bf32
chore(release): 6.2.0-alpha.1 [skip ci]
semantic-release-bot Apr 7, 2025
b8c019e
refactor: Add missing git enforcement of line endings to be Line Feed…
dplewis Apr 7, 2025
1283df1
refactor: Bump eslint from 9.23.0 to 9.24.0 (#2559)
dependabot[bot] Apr 7, 2025
f2ca7a6
refactor: Bump @eslint/js from 9.23.0 to 9.24.0 (#2558)
dependabot[bot] Apr 7, 2025
f91f3f1
fix: Missing error message when returning an internal server error (#…
dplewis Apr 7, 2025
783ca32
chore(release): 6.2.0-alpha.2 [skip ci]
semantic-release-bot Apr 7, 2025
6f38020
refactor: Bump mongodb-runner from 5.8.1 to 5.8.2 (#2561)
dependabot[bot] Apr 9, 2025
bdd440e
refactor: Bump typescript-eslint from 8.29.0 to 8.29.1 (#2560)
dependabot[bot] Apr 9, 2025
86eadbd
refactor: Bump puppeteer from 24.6.0 to 24.6.1 (#2562)
dependabot[bot] Apr 10, 2025
cfb25ef
refactor: Bump lint-staged from 15.5.0 to 15.5.1 (#2563)
dependabot[bot] Apr 14, 2025
a4b19e5
perf: Optimize bundle packaging with Vite (#2553)
dplewis Apr 15, 2025
bad506f
chore(release): 6.2.0-alpha.3 [skip ci]
semantic-release-bot Apr 15, 2025
5bb143a
refactor: Bump typescript-eslint from 8.29.1 to 8.30.1 (#2566)
dependabot[bot] Apr 15, 2025
cc0f65f
refactor: Bump vite from 6.2.4 to 6.2.6 (#2565)
dependabot[bot] Apr 15, 2025
dcaccc2
refactor: Bump vite from 6.2.6 to 6.3.1 (#2569)
dependabot[bot] Apr 17, 2025
d098c00
refactor: Bump vite from 6.3.1 to 6.3.2 (#2570)
dependabot[bot] Apr 19, 2025
085225c
refactor: Bump eslint from 9.24.0 to 9.25.0 (#2572)
dependabot[bot] Apr 21, 2025
b78e9aa
refactor: Bump eslint from 9.25.0 to 9.25.1 (#2575)
dependabot[bot] Apr 23, 2025
d3ca465
feat: Add `Parse.File` upload and download progress in browser and No…
dplewis Apr 23, 2025
7d179a8
refactor: Bump @eslint/js from 9.24.0 to 9.25.1 (#2574)
dependabot[bot] Apr 23, 2025
ef6362a
refactor: Bump eslint-plugin-jsdoc from 50.6.9 to 50.6.10 (#2578)
dependabot[bot] Apr 25, 2025
2532ce1
refactor: Bump vite from 6.3.2 to 6.3.3 (#2580)
dependabot[bot] Apr 25, 2025
6bc2a05
refactor: Bump typescript-eslint from 8.30.1 to 8.31.0 (#2576)
dependabot[bot] Apr 25, 2025
46cd5ca
refactor: Bump eslint-plugin-jsdoc from 50.6.10 to 50.6.11 (#2583)
dependabot[bot] Apr 25, 2025
34d3b7e
refactor: Bump mongodb-runner from 5.8.2 to 5.8.3 (#2582)
dependabot[bot] Apr 25, 2025
6929c18
refactor: Bump puppeteer from 24.6.1 to 24.7.2 (#2581)
dependabot[bot] Apr 25, 2025
bdbc060
refactor: Bump @semantic-release/github from 11.0.1 to 11.0.2 (#2585)
dependabot[bot] Apr 28, 2025
368e983
refactor: Bump typescript-eslint from 8.31.0 to 8.31.1 (#2586)
dependabot[bot] Apr 29, 2025
16ba032
refactor: Bump jasmine from 5.6.0 to 5.7.0 (#2584)
dependabot[bot] Apr 29, 2025
365599f
empty commit to trigger CI
github-actions[bot] May 1, 2025
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
* text=auto eol=lf

*.js text
*.ts text
*.mjs text
*.html text
*.less text
*.json text
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

11 changes: 3 additions & 8 deletions build_releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ console.log(`Building JavaScript SDK v${pkg.version}...\n`)

console.log('Cleaning up old builds...\n');

rmDir(path.join(__dirname, 'dist'));
rmDir(path.join(__dirname, 'lib'));

const crossEnv = 'npm run cross-env';
Expand All @@ -54,13 +53,9 @@ const gulp = 'npm run gulp';
execCommand(`${crossEnv} PARSE_BUILD=react-native ${gulp} compile`),
]);

console.log('Bundling and minifying for CDN distribution:');
console.log('Bundling and minifying for CDN distribution');
await Promise.all([
execCommand(`${gulp} browserify`),
execCommand(`${gulp} browserify-weapp`),
]);
await Promise.all([
execCommand(`${gulp} minify`),
execCommand(`${gulp} minify-weapp`),
execCommand('npm run build:browser'),
execCommand('npm run build:weapp'),
]);
}());
21 changes: 21 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [6.2.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/6.2.0-alpha.2...6.2.0-alpha.3) (2025-04-15)


### Performance Improvements

* Optimize bundle packaging with Vite ([#2553](https://github.com/parse-community/Parse-SDK-JS/issues/2553)) ([a4b19e5](https://github.com/parse-community/Parse-SDK-JS/commit/a4b19e532ce97fd61632335ca5b8158f756d6fe6))

# [6.2.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/6.2.0-alpha.1...6.2.0-alpha.2) (2025-04-07)


### Bug Fixes

* Missing error message when returning an internal server error ([#2543](https://github.com/parse-community/Parse-SDK-JS/issues/2543)) ([f91f3f1](https://github.com/parse-community/Parse-SDK-JS/commit/f91f3f10f645acf22d6e54379ad21a1701b5ccba))

# [6.2.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.1...6.2.0-alpha.1) (2025-04-07)


### Features

* Add `Uint8Array` support for `Parse.File` data ([#2548](https://github.com/parse-community/Parse-SDK-JS/issues/2548)) ([6f6bb66](https://github.com/parse-community/Parse-SDK-JS/commit/6f6bb660204f3b102f8e4167297327bf12e2e2be))

# [6.1.0-alpha.5](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0-alpha.4...6.1.0-alpha.5) (2025-04-02)


Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = tseslint.config({
jsdoc,
},
"rules": {
"indent": ["error", 2],
"indent": ["error", 2, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": 2,
"eol-last": 2,
Expand Down
103 changes: 4 additions & 99 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
const babel = require('gulp-babel');
const browserify = require('browserify');
const derequire = require('gulp-derequire');
const gulp = require('gulp');
const insert = require('gulp-insert');
const path = require('path');
const rename = require('gulp-rename');
const source = require('vinyl-source-stream');
const uglify = require('gulp-uglify');
const watch = require('gulp-watch');

const BUILD = process.env.PARSE_BUILD || 'browser';
const VERSION = require('./package.json').version;

const transformRuntime = ["@babel/plugin-transform-runtime", {
"corejs": 3,
Expand All @@ -32,39 +25,14 @@ const PRESETS = {
'react-native': ["@babel/preset-typescript", 'module:metro-react-native-babel-preset'],
};
const PLUGINS = {
'browser': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
'browser': [transformRuntime, '@babel/plugin-proposal-class-properties',
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
'weapp': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
'weapp': [transformRuntime, '@babel/plugin-proposal-class-properties',
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
'node': ['inline-package-json', 'transform-inline-environment-variables'],
'react-native': ['inline-package-json', 'transform-inline-environment-variables']
'node': ['transform-inline-environment-variables'],
'react-native': ['transform-inline-environment-variables']
};

const DEV_HEADER = (
'/**\n' +
' * Parse JavaScript SDK v' + VERSION + '\n' +
' *\n' +
' * The source tree of this library can be found at\n' +
' * https://github.com/ParsePlatform/Parse-SDK-JS\n' +
' */\n'
);

const FULL_HEADER = (
'/**\n' +
' * Parse JavaScript SDK v' + VERSION + '\n' +
' *\n' +
' * Copyright 2015-present Parse Platform\n' +
' * All rights reserved.\n' +
' *\n' +
' * The source tree of this library can be found at\n' +
' * https://github.com/ParsePlatform/Parse-SDK-JS\n' +
' *\n' +
' * This source code is licensed under the license found in the LICENSE\n' +
' * file in the root directory of this source tree. Additional legal\n' +
' * information can be found in the NOTICE file in the same directory.\n' +
' */\n'
);

function compileTask(stream) {
return stream
.pipe(babel({
Expand All @@ -82,69 +50,6 @@ gulp.task('compile', function() {
return compileTask(gulp.src('src/*.*(js|ts)'));
});

gulp.task('browserify', function(cb) {
const stream = browserify({
builtins: ['_process', 'events'],
entries: 'lib/browser/Parse.js',
standalone: 'Parse'
})
.exclude('xmlhttprequest')
.ignore('_process')
.bundle();
stream.on('end', () => {
cb();
});
return stream.pipe(source('parse.js'))
.pipe(derequire())
.pipe(insert.prepend(DEV_HEADER))
.pipe(gulp.dest('./dist'));
});


gulp.task('browserify-weapp', function(cb) {
const stream = browserify({
builtins: ['_process', 'events'],
entries: 'lib/weapp/Parse.js',
standalone: 'Parse'
})
.exclude('xmlhttprequest')
.ignore('_process')
.bundle();
stream.on('end', () => {
cb();
});
return stream.pipe(source('parse.weapp.js'))
.pipe(derequire())
.pipe(insert.prepend(DEV_HEADER))
.pipe(gulp.dest('./dist'));
});

gulp.task('minify', function() {
return gulp.src('dist/parse.js')
.pipe(uglify())
.pipe(insert.prepend(FULL_HEADER))
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('./dist'))
});

gulp.task('minify-weapp', function() {
return gulp.src('dist/parse.weapp.js')
.pipe(uglify())
.pipe(insert.prepend(FULL_HEADER))
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('./dist'))
});

gulp.task('watch', function() {
if (BUILD === 'browser') {
const watcher = gulp.watch('src/*.*(js|ts)', { ignoreInitial: false }, gulp.series('compile', 'browserify', 'minify'));
watcher.on('add', function(path) {
console.log(`File ${path} was added`);
});
watcher.on('change', function(path) {
console.log(`File ${path} was changed`);
});
return watcher;
}
return compileTask(watch('src/*.*(js|ts)', { ignoreInitial: false, verbose: true }));
});
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./lib/browser/Parse.js');
module.exports = require('./lib/browser/Parse.js').default;
34 changes: 13 additions & 21 deletions integration/test/IdempotencyTest.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
'use strict';
const originalFetch = global.fetch;

const Parse = require('../../node');
const sleep = require('./sleep');

const Item = Parse.Object.extend('IdempotencyItem');
const RESTController = Parse.CoreManager.getRESTController();

const XHR = RESTController._getXHR();
function DuplicateXHR(requestId) {
function XHRWrapper() {
const xhr = new XHR();
const send = xhr.send;
xhr.send = function () {
this.setRequestHeader('X-Parse-Request-Id', requestId);
send.apply(this, arguments);
};
return xhr;
}
return XHRWrapper;
function DuplicateRequestId(requestId) {
global.fetch = async (...args) => {
const options = args[1];
options.headers['X-Parse-Request-Id'] = requestId;
return originalFetch(...args);
};
}

describe('Idempotency', () => {
beforeEach(() => {
RESTController._setXHR(XHR);
afterEach(() => {
global.fetch = originalFetch;
});

it('handle duplicate cloud code function request', async () => {
RESTController._setXHR(DuplicateXHR('1234'));
DuplicateRequestId('1234');
await Parse.Cloud.run('CloudFunctionIdempotency');
await expectAsync(Parse.Cloud.run('CloudFunctionIdempotency')).toBeRejectedWithError(
'Duplicate request'
);
await expectAsync(Parse.Cloud.run('CloudFunctionIdempotency')).toBeRejectedWithError(
'Duplicate request'
);

const query = new Parse.Query(Item);
const results = await query.find();
expect(results.length).toBe(1);
});

it('handle duplicate job request', async () => {
RESTController._setXHR(DuplicateXHR('1234'));
DuplicateRequestId('1234');
const params = { startedBy: 'Monty Python' };
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
await expectAsync(Parse.Cloud.startJob('CloudJob1', params)).toBeRejectedWithError(
Expand All @@ -61,12 +53,12 @@ describe('Idempotency', () => {
});

it('handle duplicate POST / PUT request', async () => {
RESTController._setXHR(DuplicateXHR('1234'));
DuplicateRequestId('1234');
const testObject = new Parse.Object('IdempotentTest');
await testObject.save();
await expectAsync(testObject.save()).toBeRejectedWithError('Duplicate request');

RESTController._setXHR(DuplicateXHR('5678'));
DuplicateRequestId('5678');
testObject.set('foo', 'bar');
await testObject.save();
await expectAsync(testObject.save()).toBeRejectedWithError('Duplicate request');
Expand Down
13 changes: 7 additions & 6 deletions integration/test/ParseDistTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
beforeEach(async () => {
browser = await puppeteer.launch({
args: ['--disable-web-security', '--incognito', '--no-sandbox'],
devtools: false,
});
const context = await browser.createBrowserContext();
page = await context.newPage();
Expand Down Expand Up @@ -42,7 +43,7 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
expect(obj.id).toEqual(response);
});

it('can cancel save file with uri', async () => {
it('can cancel save file', async () => {
let requestsCount = 0;
let abortedCount = 0;
const promise = resolvingPromise();
Expand All @@ -63,11 +64,11 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
}
});
await page.evaluate(async () => {
const parseLogo =
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png';
const file = new Parse.File('parse-server-logo', { uri: parseLogo });
file.save().then(() => {});

const SIZE_10_MB = 10 * 1024 * 1024;
const file = new Parse.File('test_file.txt', new Uint8Array(SIZE_10_MB));
file.save().then(() => {
fail('should not save');
});
return new Promise(resolve => {
const intervalId = setInterval(() => {
if (file._requestTask && typeof file._requestTask.abort === 'function') {
Expand Down
23 changes: 23 additions & 0 deletions integration/test/ParseFileTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ describe('Parse.File', () => {
file.cancel();
});

it('can get file upload / download progress', async () => {
const file = new Parse.File('parse-js-test-file', [61, 170, 236, 120]);
let progress = 0;
await file.save({
progress: (value, loaded, total) => {
progress = value;
expect(loaded).toBeDefined();
expect(total).toBeDefined();
},
});
expect(progress).toBe(1);
progress = 0;
file._data = null;
await file.getData({
progress: (value, loaded, total) => {
progress = value;
expect(loaded).toBeDefined();
expect(total).toBeDefined();
},
});
expect(progress).toBe(1);
});

it('can not get data from unsaved file', async () => {
const file = new Parse.File('parse-server-logo', [61, 170, 236, 120]);
file._data = null;
Expand Down
14 changes: 14 additions & 0 deletions integration/test/ParseLegacyTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const { Parse } = require('../../node');

describe('Parse Legacy Import', () => {
it('can query object', async () => {
const object = new Parse.Object('TestObject');
object.set('foo', 'bar');
await object.save();
const query = new Parse.Query('TestObject');
const result = await query.get(object.id);
expect(result.id).toBe(object.id);
});
});
4 changes: 0 additions & 4 deletions integration/test/ParseLocalDatastoreTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ function runTest(controller) {
Parse.initialize('integration');
Parse.CoreManager.set('SERVER_URL', serverURL);
Parse.CoreManager.set('MASTER_KEY', 'notsosecret');
const RESTController = Parse.CoreManager.getRESTController();
RESTController._setXHR(require('xmlhttprequest').XMLHttpRequest);
Parse.enableLocalDatastore();
});

Expand Down Expand Up @@ -1082,8 +1080,6 @@ function runTest(controller) {
Parse.initialize('integration');
Parse.CoreManager.set('SERVER_URL', serverURL);
Parse.CoreManager.set('MASTER_KEY', 'notsosecret');
const RESTController = Parse.CoreManager.getRESTController();
RESTController._setXHR(require('xmlhttprequest').XMLHttpRequest);
Parse.enableLocalDatastore();

const numbers = [];
Expand Down
2 changes: 0 additions & 2 deletions integration/test/ParseReactNativeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const LocalDatastoreController =
const StorageController = require('../../lib/react-native/StorageController.default').default;
const RESTController = require('../../lib/react-native/RESTController').default;

RESTController._setXHR(require('xmlhttprequest').XMLHttpRequest);

describe('Parse React Native', () => {
beforeEach(() => {
// Set up missing controllers and configurations
Expand Down
Loading