Skip to content

Commit f823119

Browse files
committed
Merge branch 'alpha' into replace-crypto-js
2 parents ba059bc + c9d487b commit f823119

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1837
-2886
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
* text=auto eol=lf
22

33
*.js text
4+
*.ts text
5+
*.mjs text
46
*.html text
57
*.less text
68
*.json text

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

build_releases.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ console.log(`Building JavaScript SDK v${pkg.version}...\n`)
3636

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

39-
rmDir(path.join(__dirname, 'dist'));
4039
rmDir(path.join(__dirname, 'lib'));
4140

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

57-
console.log('Bundling and minifying for CDN distribution:');
56+
console.log('Bundling and minifying for CDN distribution');
5857
await Promise.all([
59-
execCommand(`${gulp} browserify`),
60-
execCommand(`${gulp} browserify-weapp`),
61-
]);
62-
await Promise.all([
63-
execCommand(`${gulp} minify`),
64-
execCommand(`${gulp} minify-weapp`),
58+
execCommand('npm run build:browser'),
59+
execCommand('npm run build:weapp'),
6560
]);
6661
}());

changelogs/CHANGELOG_alpha.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
# [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)
2+
3+
4+
### Performance Improvements
5+
6+
* 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))
7+
8+
# [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)
9+
10+
11+
### Bug Fixes
12+
13+
* 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))
14+
15+
# [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)
16+
17+
18+
### Features
19+
20+
* 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))
21+
22+
# [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)
23+
24+
25+
### Bug Fixes
26+
27+
* Remove unused option `sessionToken` from `Parse.Query.aggregate` ([#2547](https://github.com/parse-community/Parse-SDK-JS/issues/2547)) ([c7015ba](https://github.com/parse-community/Parse-SDK-JS/commit/c7015ba42c13d7a4bbe5246b0944e64dcea1712f))
28+
29+
# [6.1.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0-alpha.3...6.1.0-alpha.4) (2025-03-29)
30+
31+
32+
### Bug Fixes
33+
34+
* Security upgrade tar-fs from 2.1.1 to 2.1.2 ([#2540](https://github.com/parse-community/Parse-SDK-JS/issues/2540)) ([44eeacd](https://github.com/parse-community/Parse-SDK-JS/commit/44eeacd9b4af90c8a5f48264506d058ca2745109))
35+
136
# [6.1.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0-alpha.2...6.1.0-alpha.3) (2025-03-16)
237

338

changelogs/CHANGELOG_release.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## [6.1.1](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0...6.1.1) (2025-04-04)
2+
3+
4+
### Bug Fixes
5+
6+
* Remove unused option `sessionToken` from `Parse.Query.aggregate` ([#2547](https://github.com/parse-community/Parse-SDK-JS/issues/2547)) ([c7015ba](https://github.com/parse-community/Parse-SDK-JS/commit/c7015ba42c13d7a4bbe5246b0944e64dcea1712f))
7+
* Security upgrade tar-fs from 2.1.1 to 2.1.2 ([#2540](https://github.com/parse-community/Parse-SDK-JS/issues/2540)) ([44eeacd](https://github.com/parse-community/Parse-SDK-JS/commit/44eeacd9b4af90c8a5f48264506d058ca2745109))
8+
9+
# [6.1.0](https://github.com/parse-community/Parse-SDK-JS/compare/6.0.0...6.1.0) (2025-03-17)
10+
11+
12+
### Features
13+
14+
* Add `Parse.Query` option `useMaintenanceKey` ([#2484](https://github.com/parse-community/Parse-SDK-JS/issues/2484)) ([2ead3f3](https://github.com/parse-community/Parse-SDK-JS/commit/2ead3f3af31654b27470bb5b596cb01df03e8fe3))
15+
* Allow `Parse.Object` field names to begin with underscore `_` to access internal fields of Parse Server ([#2475](https://github.com/parse-community/Parse-SDK-JS/issues/2475)) ([08e43ba](https://github.com/parse-community/Parse-SDK-JS/commit/08e43ba86276096820f467d9f5819e624a286b22))
16+
* Publish TypeScript definitions ([#2491](https://github.com/parse-community/Parse-SDK-JS/issues/2491)) ([fc3e573](https://github.com/parse-community/Parse-SDK-JS/commit/fc3e5737782f693ce291716ff68c6ef08115fbe7))
17+
118
# [6.0.0](https://github.com/parse-community/Parse-SDK-JS/compare/5.3.0...6.0.0) (2025-03-02)
219

320

eslint.config.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = tseslint.config({
1414
jsdoc,
1515
},
1616
"rules": {
17-
"indent": ["error", 2],
17+
"indent": ["error", 2, { "SwitchCase": 1 }],
1818
"linebreak-style": ["error", "unix"],
1919
"no-trailing-spaces": 2,
2020
"eol-last": 2,
@@ -55,6 +55,7 @@ module.exports = tseslint.config({
5555
"jsdoc/require-param-description": 0,
5656
"jsdoc/require-property-description": 0,
5757
"jsdoc/require-param-type": 0,
58+
"jsdoc/require-param": 1,
5859
"jsdoc/tag-lines": 0,
5960
"jsdoc/check-param-names": [
6061
"error",
@@ -69,11 +70,32 @@ module.exports = tseslint.config({
6970
"AuthProvider",
7071
"AsyncStorage",
7172
"LocalDatastoreController",
72-
"Parse"
73+
"Parse",
74+
"Parse.ACL",
75+
"Parse.CLP",
76+
"Parse.Error",
77+
"Parse.File",
78+
"Parse.GeoPoint",
79+
"Parse.Object",
80+
"Parse.Op",
81+
"Parse.Query",
82+
"Parse.Relation",
83+
"Parse.Role",
84+
"Parse.User",
85+
"Parse.setAsyncStorage"
7386
]
7487
}
7588
]
7689
},
90+
settings: {
91+
jsdoc: {
92+
tagNamePreference: {
93+
member: false,
94+
memberof: false,
95+
yield: false,
96+
},
97+
},
98+
},
7799
languageOptions: {
78100
parser: tseslint.parser,
79101
globals: {

gulpfile.js

Lines changed: 4 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
const babel = require('gulp-babel');
2-
const browserify = require('browserify');
3-
const derequire = require('gulp-derequire');
42
const gulp = require('gulp');
5-
const insert = require('gulp-insert');
63
const path = require('path');
7-
const rename = require('gulp-rename');
8-
const source = require('vinyl-source-stream');
9-
const uglify = require('gulp-uglify');
104
const watch = require('gulp-watch');
115

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

158
const transformRuntime = ["@babel/plugin-transform-runtime", {
169
"corejs": 3,
@@ -32,39 +25,14 @@ const PRESETS = {
3225
'react-native': ["@babel/preset-typescript", 'module:metro-react-native-babel-preset'],
3326
};
3427
const PLUGINS = {
35-
'browser': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
28+
'browser': [transformRuntime, '@babel/plugin-proposal-class-properties',
3629
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
37-
'weapp': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
30+
'weapp': [transformRuntime, '@babel/plugin-proposal-class-properties',
3831
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
39-
'node': ['inline-package-json', 'transform-inline-environment-variables'],
40-
'react-native': ['inline-package-json', 'transform-inline-environment-variables']
32+
'node': ['transform-inline-environment-variables'],
33+
'react-native': ['transform-inline-environment-variables']
4134
};
4235

43-
const DEV_HEADER = (
44-
'/**\n' +
45-
' * Parse JavaScript SDK v' + VERSION + '\n' +
46-
' *\n' +
47-
' * The source tree of this library can be found at\n' +
48-
' * https://github.com/ParsePlatform/Parse-SDK-JS\n' +
49-
' */\n'
50-
);
51-
52-
const FULL_HEADER = (
53-
'/**\n' +
54-
' * Parse JavaScript SDK v' + VERSION + '\n' +
55-
' *\n' +
56-
' * Copyright 2015-present Parse Platform\n' +
57-
' * All rights reserved.\n' +
58-
' *\n' +
59-
' * The source tree of this library can be found at\n' +
60-
' * https://github.com/ParsePlatform/Parse-SDK-JS\n' +
61-
' *\n' +
62-
' * This source code is licensed under the license found in the LICENSE\n' +
63-
' * file in the root directory of this source tree. Additional legal\n' +
64-
' * information can be found in the NOTICE file in the same directory.\n' +
65-
' */\n'
66-
);
67-
6836
function compileTask(stream) {
6937
return stream
7038
.pipe(babel({
@@ -82,69 +50,6 @@ gulp.task('compile', function() {
8250
return compileTask(gulp.src('src/*.*(js|ts)'));
8351
});
8452

85-
gulp.task('browserify', function(cb) {
86-
const stream = browserify({
87-
builtins: ['_process', 'events'],
88-
entries: 'lib/browser/Parse.js',
89-
standalone: 'Parse'
90-
})
91-
.exclude('xmlhttprequest')
92-
.ignore('_process')
93-
.bundle();
94-
stream.on('end', () => {
95-
cb();
96-
});
97-
return stream.pipe(source('parse.js'))
98-
.pipe(derequire())
99-
.pipe(insert.prepend(DEV_HEADER))
100-
.pipe(gulp.dest('./dist'));
101-
});
102-
103-
104-
gulp.task('browserify-weapp', function(cb) {
105-
const stream = browserify({
106-
builtins: ['_process', 'events'],
107-
entries: 'lib/weapp/Parse.js',
108-
standalone: 'Parse'
109-
})
110-
.exclude('xmlhttprequest')
111-
.ignore('_process')
112-
.bundle();
113-
stream.on('end', () => {
114-
cb();
115-
});
116-
return stream.pipe(source('parse.weapp.js'))
117-
.pipe(derequire())
118-
.pipe(insert.prepend(DEV_HEADER))
119-
.pipe(gulp.dest('./dist'));
120-
});
121-
122-
gulp.task('minify', function() {
123-
return gulp.src('dist/parse.js')
124-
.pipe(uglify())
125-
.pipe(insert.prepend(FULL_HEADER))
126-
.pipe(rename({ extname: '.min.js' }))
127-
.pipe(gulp.dest('./dist'))
128-
});
129-
130-
gulp.task('minify-weapp', function() {
131-
return gulp.src('dist/parse.weapp.js')
132-
.pipe(uglify())
133-
.pipe(insert.prepend(FULL_HEADER))
134-
.pipe(rename({ extname: '.min.js' }))
135-
.pipe(gulp.dest('./dist'))
136-
});
137-
13853
gulp.task('watch', function() {
139-
if (BUILD === 'browser') {
140-
const watcher = gulp.watch('src/*.*(js|ts)', { ignoreInitial: false }, gulp.series('compile', 'browserify', 'minify'));
141-
watcher.on('add', function(path) {
142-
console.log(`File ${path} was added`);
143-
});
144-
watcher.on('change', function(path) {
145-
console.log(`File ${path} was changed`);
146-
});
147-
return watcher;
148-
}
14954
return compileTask(watch('src/*.*(js|ts)', { ignoreInitial: false, verbose: true }));
15055
});

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('./lib/browser/Parse.js');
1+
module.exports = require('./lib/browser/Parse.js').default;

integration/test/IdempotencyTest.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
11
'use strict';
2+
const originalFetch = global.fetch;
23

34
const Parse = require('../../node');
45
const sleep = require('./sleep');
5-
66
const Item = Parse.Object.extend('IdempotencyItem');
7-
const RESTController = Parse.CoreManager.getRESTController();
87

9-
const XHR = RESTController._getXHR();
10-
function DuplicateXHR(requestId) {
11-
function XHRWrapper() {
12-
const xhr = new XHR();
13-
const send = xhr.send;
14-
xhr.send = function () {
15-
this.setRequestHeader('X-Parse-Request-Id', requestId);
16-
send.apply(this, arguments);
17-
};
18-
return xhr;
19-
}
20-
return XHRWrapper;
8+
function DuplicateRequestId(requestId) {
9+
global.fetch = async (...args) => {
10+
const options = args[1];
11+
options.headers['X-Parse-Request-Id'] = requestId;
12+
return originalFetch(...args);
13+
};
2114
}
2215

2316
describe('Idempotency', () => {
24-
beforeEach(() => {
25-
RESTController._setXHR(XHR);
17+
afterEach(() => {
18+
global.fetch = originalFetch;
2619
});
2720

2821
it('handle duplicate cloud code function request', async () => {
29-
RESTController._setXHR(DuplicateXHR('1234'));
22+
DuplicateRequestId('1234');
3023
await Parse.Cloud.run('CloudFunctionIdempotency');
3124
await expectAsync(Parse.Cloud.run('CloudFunctionIdempotency')).toBeRejectedWithError(
3225
'Duplicate request'
3326
);
3427
await expectAsync(Parse.Cloud.run('CloudFunctionIdempotency')).toBeRejectedWithError(
3528
'Duplicate request'
3629
);
37-
3830
const query = new Parse.Query(Item);
3931
const results = await query.find();
4032
expect(results.length).toBe(1);
4133
});
4234

4335
it('handle duplicate job request', async () => {
44-
RESTController._setXHR(DuplicateXHR('1234'));
36+
DuplicateRequestId('1234');
4537
const params = { startedBy: 'Monty Python' };
46-
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
47-
await expectAsync(Parse.Cloud.startJob('CloudJob1', params)).toBeRejectedWithError(
38+
const jobStatusId = await Parse.Cloud.startJob('CloudJobParamsInMessage', params);
39+
await expectAsync(Parse.Cloud.startJob('CloudJobParamsInMessage', params)).toBeRejectedWithError(
4840
'Duplicate request'
4941
);
5042

@@ -57,16 +49,16 @@ describe('Idempotency', () => {
5749
}
5850
const jobStatus = await Parse.Cloud.getJobStatus(jobStatusId);
5951
expect(jobStatus.get('status')).toBe('succeeded');
60-
expect(jobStatus.get('params').startedBy).toBe('Monty Python');
52+
expect(JSON.parse(jobStatus.get('message'))).toEqual(params);
6153
});
6254

6355
it('handle duplicate POST / PUT request', async () => {
64-
RESTController._setXHR(DuplicateXHR('1234'));
56+
DuplicateRequestId('1234');
6557
const testObject = new Parse.Object('IdempotentTest');
6658
await testObject.save();
6759
await expectAsync(testObject.save()).toBeRejectedWithError('Duplicate request');
6860

69-
RESTController._setXHR(DuplicateXHR('5678'));
61+
DuplicateRequestId('5678');
7062
testObject.set('foo', 'bar');
7163
await testObject.save();
7264
await expectAsync(testObject.save()).toBeRejectedWithError('Duplicate request');

0 commit comments

Comments
 (0)