Skip to content

Commit f30d588

Browse files
authored
build: Release (#2023)
2 parents 8e9afc6 + ccc9f60 commit f30d588

File tree

109 files changed

+12614
-3841
lines changed

Some content is hidden

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

109 files changed

+12614
-3841
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ jobs:
1616
uses: mansona/npm-lockfile-version@v1
1717
with:
1818
version: 2
19+
check-types:
20+
name: Check types
21+
timeout-minutes: 5
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- run: npm ci
26+
- name: Check types
27+
run: npm run test:types
1928
build:
2029
runs-on: ubuntu-latest
2130
timeout-minutes: 30

.github/workflows/release-automated.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
docs-publish:
4040
needs: release
4141
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
42-
runs-on: ubuntu-18.04
42+
runs-on: ubuntu-latest
4343
timeout-minutes: 15
4444
steps:
4545
- uses: actions/checkout@v2

.github/workflows/release-manual-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
docs-publish:
1010
if: github.event.inputs.tag != ''
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-latest
1212
timeout-minutes: 15
1313
steps:
1414
- uses: actions/checkout@v3

babel-jest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const babelJest = require('babel-jest');
22

33
module.exports = babelJest.createTransformer({
4-
presets: [["@babel/preset-env", {
4+
presets: ["@babel/preset-typescript", ["@babel/preset-env", {
55
"targets": {
66
"node": "14"
77
},

changelogs/CHANGELOG_alpha.md

+75
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
# [4.2.0-alpha.10](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.9...4.2.0-alpha.10) (2023-09-03)
2+
3+
4+
### Features
5+
6+
* Add support for custom EventEmitter ([#1999](https://github.com/parse-community/Parse-SDK-JS/issues/1999)) ([ca568a6](https://github.com/parse-community/Parse-SDK-JS/commit/ca568a61771e15afe67c9001f2a728205059f2ae))
7+
8+
# [4.2.0-alpha.9](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.8...4.2.0-alpha.9) (2023-09-01)
9+
10+
11+
### Features
12+
13+
* Allow overriding `Parse.Error` message with custom message via new Core Manager option `PARSE_ERRORS` ([#2014](https://github.com/parse-community/Parse-SDK-JS/issues/2014)) ([be0c8a6](https://github.com/parse-community/Parse-SDK-JS/commit/be0c8a6ff90a7714487ae793e2b68ae04d0c8d0c))
14+
15+
# [4.2.0-alpha.8](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.7...4.2.0-alpha.8) (2023-08-30)
16+
17+
18+
### Features
19+
20+
* Add Cloud Code context accessibility to `ParseUser.logIn` ([#2010](https://github.com/parse-community/Parse-SDK-JS/issues/2010)) ([2446007](https://github.com/parse-community/Parse-SDK-JS/commit/2446007ede4cc5af79e34f27dc1fbcc574d5f717))
21+
22+
# [4.2.0-alpha.7](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.6...4.2.0-alpha.7) (2023-08-29)
23+
24+
25+
### Bug Fixes
26+
27+
* `ParseUser.linkWith` doesn't remove anonymous auth data ([#2007](https://github.com/parse-community/Parse-SDK-JS/issues/2007)) ([7e2585c](https://github.com/parse-community/Parse-SDK-JS/commit/7e2585c5eb84a396900553d55d6a919de4d9a2c0))
28+
29+
# [4.2.0-alpha.6](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.5...4.2.0-alpha.6) (2023-08-27)
30+
31+
32+
### Features
33+
34+
* Add Bytes type to `Parse.Schema` ([#2001](https://github.com/parse-community/Parse-SDK-JS/issues/2001)) ([343d0d7](https://github.com/parse-community/Parse-SDK-JS/commit/343d0d729a57acdd3c9ba5c1dbe5738b3916ea04))
35+
36+
# [4.2.0-alpha.5](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.4...4.2.0-alpha.5) (2023-08-27)
37+
38+
39+
### Features
40+
41+
* Add support for excluding keys in `ParseQuery.findAll` ([#2000](https://github.com/parse-community/Parse-SDK-JS/issues/2000)) ([012ba4c](https://github.com/parse-community/Parse-SDK-JS/commit/012ba4cdab1e3f853625f507c713cef2264a40dd))
42+
43+
# [4.2.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.3...4.2.0-alpha.4) (2023-07-23)
44+
45+
46+
### Features
47+
48+
* Login with username, password and additional authentication data via `ParseUser.logInWithAdditionalAuth` ([#1955](https://github.com/parse-community/Parse-SDK-JS/issues/1955)) ([2bad411](https://github.com/parse-community/Parse-SDK-JS/commit/2bad4119c23372d1b38c811c4b4bb3d06b1b62f0))
49+
50+
# [4.2.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.2...4.2.0-alpha.3) (2023-06-11)
51+
52+
53+
### Features
54+
55+
* Add support to invoke a Cloud Function with a custom `installationId` via `Parse.Cloud.run` ([#1939](https://github.com/parse-community/Parse-SDK-JS/issues/1939)) ([eb70b93](https://github.com/parse-community/Parse-SDK-JS/commit/eb70b934b798cb37722c1ac36796596f5373f67d))
56+
57+
# [4.2.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.1...4.2.0-alpha.2) (2023-06-08)
58+
59+
60+
### Bug Fixes
61+
62+
* Hard-coding of `react-native` path does not work for workspace builds ([#1930](https://github.com/parse-community/Parse-SDK-JS/issues/1930)) ([8222f3c](https://github.com/parse-community/Parse-SDK-JS/commit/8222f3cc2a4a4ee0cdcaf30dd0f9a17e46de7d88))
63+
64+
# [4.2.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0...4.2.0-alpha.1) (2023-05-01)
65+
66+
67+
### Bug Fixes
68+
69+
* `Parse.File.cancel` starts new attempt to save file ([#1781](https://github.com/parse-community/Parse-SDK-JS/issues/1781)) ([b755e42](https://github.com/parse-community/Parse-SDK-JS/commit/b755e42394db8b94b87b0dbefc6cf6f18189c46d))
70+
71+
### Features
72+
73+
* Add `Parse.User.loginAs` ([#1875](https://github.com/parse-community/Parse-SDK-JS/issues/1875)) ([381fcfc](https://github.com/parse-community/Parse-SDK-JS/commit/381fcfc7f9cfda70af7c6dc3a35de59b82b72258))
74+
* Add `ParseQuery.watch` to trigger LiveQuery only on update of specific fields ([#1839](https://github.com/parse-community/Parse-SDK-JS/issues/1839)) ([7479343](https://github.com/parse-community/Parse-SDK-JS/commit/7479343abd8739fe03558ff9b2ce610c34c568ae))
75+
176
# [4.1.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0-alpha.3...4.1.0-alpha.4) (2023-04-28)
277

378

gulpfile.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ const transformRuntime = ["@babel/plugin-transform-runtime", {
2020
}];
2121

2222
const PRESETS = {
23-
'browser': [["@babel/preset-env", {
23+
'browser': ["@babel/preset-typescript", ["@babel/preset-env", {
2424
"targets": "> 0.25%, not dead"
2525
}]],
26-
'weapp': [["@babel/preset-env", {
26+
'weapp': ["@babel/preset-typescript", ["@babel/preset-env", {
2727
"targets": "> 0.25%, not dead"
2828
}], '@babel/react'],
29-
'node': [["@babel/preset-env", {
29+
'node': ["@babel/preset-typescript", ["@babel/preset-env", {
3030
"targets": { "node": "14" }
3131
}]],
32-
'react-native': ['module:metro-react-native-babel-preset'],
32+
'react-native': ["@babel/preset-typescript", 'module:metro-react-native-babel-preset'],
3333
};
3434
const PLUGINS = {
3535
'browser': [transformRuntime, '@babel/plugin-transform-flow-comments', '@babel/plugin-proposal-class-properties', 'inline-package-json',
@@ -79,7 +79,7 @@ function compileTask(stream) {
7979
}
8080

8181
gulp.task('compile', function() {
82-
return compileTask(gulp.src('src/*.js'));
82+
return compileTask(gulp.src('src/*.*(js|ts)'));
8383
});
8484

8585
gulp.task('browserify', function(cb) {
@@ -137,7 +137,7 @@ gulp.task('minify-weapp', function() {
137137

138138
gulp.task('watch', function() {
139139
if (BUILD === 'browser') {
140-
const watcher = gulp.watch('src/*.js', { ignoreInitial: false }, gulp.series('compile', 'browserify', 'minify'));
140+
const watcher = gulp.watch('src/*.*(js|ts)', { ignoreInitial: false }, gulp.series('compile', 'browserify', 'minify'));
141141
watcher.on('add', function(path) {
142142
console.log(`File ${path} was added`);
143143
});
@@ -146,5 +146,5 @@ gulp.task('watch', function() {
146146
});
147147
return watcher;
148148
}
149-
return compileTask(watch('src/*.js', { ignoreInitial: false, verbose: true }));
149+
return compileTask(watch('src/*.*(js|ts)', { ignoreInitial: false, verbose: true }));
150150
});

integration/test/ParseLocalDatastoreTest.js

+40-27
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
11
'use strict';
22

33
const assert = require('assert');
4-
const Parse = require('../../node');
54

65
global.localStorage = require('./mockLocalStorage');
6+
global.WebSocket = require('ws');
77
const mockRNStorage = require('./mockRNStorage');
8-
const LocalDatastoreUtils = require('../../lib/node/LocalDatastoreUtils');
8+
const serverURL = 'http://localhost:1337/parse';
99

10-
const { DEFAULT_PIN, PIN_PREFIX, isLocalDatastoreKey } = LocalDatastoreUtils;
10+
function runTest(controller) {
11+
const Parse = require(`../../${controller.name}`);
12+
const LocalDatastoreUtils = require('../../lib/node/LocalDatastoreUtils');
1113

12-
function LDS_KEY(object) {
13-
return Parse.LocalDatastore.getKeyForObject(object);
14-
}
15-
function LDS_FULL_JSON(object) {
16-
const json = object._toFullJSON();
17-
if (object._localId) {
18-
json._localId = object._localId;
14+
const { DEFAULT_PIN, PIN_PREFIX, isLocalDatastoreKey } = LocalDatastoreUtils;
15+
16+
const Item = Parse.Object.extend('Item');
17+
const TestObject = Parse.Object.extend('TestObject');
18+
19+
function LDS_KEY(object) {
20+
return Parse.LocalDatastore.getKeyForObject(object);
1921
}
20-
return json;
21-
}
22-
function runTest(controller) {
22+
function LDS_FULL_JSON(object) {
23+
const json = object._toFullJSON();
24+
if (object._localId) {
25+
json._localId = object._localId;
26+
}
27+
return json;
28+
}
29+
2330
describe(`Parse Object Pinning (${controller.name})`, () => {
2431
beforeEach(async () => {
2532
const StorageController = require(controller.file);
2633
Parse.CoreManager.setAsyncStorage(mockRNStorage);
2734
Parse.CoreManager.setLocalDatastoreController(StorageController);
28-
Parse.enableLocalDatastore();
35+
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);
36+
Parse.User.enableUnsafeCurrentUser();
2937
await Parse.LocalDatastore._clear();
38+
Parse.initialize('integration');
39+
Parse.CoreManager.set('SERVER_URL', serverURL);
40+
Parse.CoreManager.set('MASTER_KEY', 'notsosecret');
41+
const RESTController = Parse.CoreManager.getRESTController();
42+
RESTController._setXHR(require('xmlhttprequest').XMLHttpRequest);
43+
Parse.enableLocalDatastore();
3044
});
45+
3146
function getStorageCount(storage) {
3247
return Object.keys(storage).reduce((acc, key) => acc + (isLocalDatastoreKey(key) ? 1 : 0), 1);
3348
}
49+
3450
it(`${controller.name} can clear localDatastore`, async () => {
3551
const obj1 = new TestObject();
3652
const obj2 = new TestObject();
@@ -1060,8 +1076,15 @@ function runTest(controller) {
10601076
const StorageController = require(controller.file);
10611077
Parse.CoreManager.setAsyncStorage(mockRNStorage);
10621078
Parse.CoreManager.setLocalDatastoreController(StorageController);
1063-
Parse.enableLocalDatastore();
1079+
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);
10641080
Parse.LocalDatastore._clear();
1081+
Parse.User.enableUnsafeCurrentUser();
1082+
Parse.initialize('integration');
1083+
Parse.CoreManager.set('SERVER_URL', serverURL);
1084+
Parse.CoreManager.set('MASTER_KEY', 'notsosecret');
1085+
const RESTController = Parse.CoreManager.getRESTController();
1086+
RESTController._setXHR(require('xmlhttprequest').XMLHttpRequest);
1087+
Parse.enableLocalDatastore();
10651088

10661089
const numbers = [];
10671090
for (let i = 0; i < 10; i++) {
@@ -2949,20 +2972,10 @@ function runTest(controller) {
29492972
}
29502973

29512974
describe('Parse LocalDatastore', () => {
2952-
beforeEach(() => {
2953-
Parse.CoreManager.getInstallationController()._setInstallationIdCache('1234');
2954-
Parse.enableLocalDatastore();
2955-
Parse.User.enableUnsafeCurrentUser();
2956-
});
2957-
29582975
const controllers = [
2959-
{ name: 'Default', file: '../../lib/node/LocalDatastoreController' },
2960-
{
2961-
name: 'React-Native',
2962-
file: '../../lib/node/LocalDatastoreController.react-native',
2963-
},
2976+
{ name: 'node', file: '../../lib/node/LocalDatastoreController' },
2977+
{ name: 'react-native', file: '../../lib/react-native/LocalDatastoreController.react-native' },
29642978
];
2965-
29662979
for (let i = 0; i < controllers.length; i += 1) {
29672980
const controller = controllers[i];
29682981
runTest(controller);

integration/test/ParseQueryTest.js

+17
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,23 @@ describe('Parse Query', () => {
16211621
assert.equal(result.get('slice'), 'pizza');
16221622
});
16231623

1624+
it('can exclude keys in findAll', async () => {
1625+
const object = new TestObject({
1626+
hello: 'world',
1627+
foo: 'bar',
1628+
slice: 'pizza',
1629+
});
1630+
await object.save();
1631+
1632+
const query = new Parse.Query(TestObject);
1633+
query.exclude('foo');
1634+
query.equalTo('objectId', object.id);
1635+
const [result] = await query.findAll();
1636+
assert.equal(result.get('foo'), undefined);
1637+
assert.equal(result.get('hello'), 'world');
1638+
assert.equal(result.get('slice'), 'pizza');
1639+
});
1640+
16241641
it('uses subclasses when creating objects', done => {
16251642
const ParentObject = Parse.Object.extend({ className: 'ParentObject' });
16261643
let ChildObject = Parse.Object.extend('ChildObject', {

integration/test/ParseSchemaTest.js

+9
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ describe('Schema', () => {
7272
.addString('stringField')
7373
.addNumber('numberField')
7474
.addBoolean('booleanField')
75+
.addBytes('bytesField')
7576
.addDate('dateField')
7677
.addFile('fileField')
7778
.addGeoPoint('geoPointField')
@@ -91,6 +92,7 @@ describe('Schema', () => {
9192
assert.equal(result.fields.stringField.type, 'String');
9293
assert.equal(result.fields.numberField.type, 'Number');
9394
assert.equal(result.fields.booleanField.type, 'Boolean');
95+
assert.equal(result.fields.bytesField.type, 'Bytes');
9496
assert.equal(result.fields.dateField.type, 'Date');
9597
assert.equal(result.fields.fileField.type, 'File');
9698
assert.equal(result.fields.geoPointField.type, 'GeoPoint');
@@ -182,6 +184,7 @@ describe('Schema', () => {
182184
required: true,
183185
defaultValue: '2000-01-01T00:00:00.000Z',
184186
})
187+
.addBytes('bytesField', { required: true, defaultValue: 'ParseA==' })
185188
.addFile('fileField', { required: true, defaultValue: file })
186189
.addGeoPoint('geoPointField', { required: true, defaultValue: point })
187190
.addPolygon('polygonField', { required: true, defaultValue: polygon })
@@ -204,6 +207,11 @@ describe('Schema', () => {
204207
stringField: { type: 'String', required: true, defaultValue: 'world' },
205208
numberField: { type: 'Number', required: true, defaultValue: 10 },
206209
booleanField: { type: 'Boolean', required: true, defaultValue: false },
210+
bytesField: {
211+
type: 'Bytes',
212+
required: true,
213+
defaultValue: { __type: 'Bytes', base64: 'ParseA==' },
214+
},
207215
dateField: {
208216
type: 'Date',
209217
required: true,
@@ -245,6 +253,7 @@ describe('Schema', () => {
245253
stringField: 'world',
246254
numberField: 10,
247255
booleanField: false,
256+
bytesField: { __type: 'Bytes', base64: 'ParseA==' },
248257
dateField: { __type: 'Date', iso: '2000-01-01T00:00:00.000Z' },
249258
dateStringField: { __type: 'Date', iso: '2000-01-01T00:00:00.000Z' },
250259
fileField: file.toJSON(),

integration/test/ParseUserTest.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -979,14 +979,18 @@ describe('Parse User', () => {
979979
await Parse.FacebookUtils.link(user);
980980

981981
expect(Parse.FacebookUtils.isLinked(user)).toBe(true);
982-
expect(Parse.AnonymousUtils.isLinked(user)).toBe(true);
982+
expect(Parse.AnonymousUtils.isLinked(user)).toBe(false);
983983
await Parse.FacebookUtils.unlink(user);
984984

985985
expect(Parse.FacebookUtils.isLinked(user)).toBe(false);
986-
expect(Parse.AnonymousUtils.isLinked(user)).toBe(true);
986+
expect(Parse.AnonymousUtils.isLinked(user)).toBe(false);
987987
});
988988

989989
it('can link with twitter', async () => {
990+
const server = await reconfigureServer();
991+
const twitter = server.config.auth.twitter;
992+
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();
993+
990994
Parse.User.enableUnsafeCurrentUser();
991995
const user = new Parse.User();
992996
user.setUsername(uuidv4());
@@ -999,9 +1003,14 @@ describe('Parse User', () => {
9991003

10001004
await user._unlinkFrom('twitter');
10011005
expect(user._isLinked('twitter')).toBe(false);
1006+
expect(spy).toHaveBeenCalled();
10021007
});
10031008

10041009
it('can link with twitter and facebook', async () => {
1010+
const server = await reconfigureServer();
1011+
const twitter = server.config.auth.twitter;
1012+
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();
1013+
10051014
Parse.User.enableUnsafeCurrentUser();
10061015
Parse.FacebookUtils.init();
10071016
const user = new Parse.User();
@@ -1017,6 +1026,7 @@ describe('Parse User', () => {
10171026

10181027
expect(user.get('authData').twitter.id).toBe(twitterAuthData.id);
10191028
expect(user.get('authData').facebook.id).toBe('test');
1029+
expect(spy).toHaveBeenCalled();
10201030
});
10211031

10221032
it('can verify user password via static method', async () => {

integration/test/helper.js

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const defaultConfiguration = {
6060
twitter: {
6161
consumer_key: twitterAuthData.consumer_key,
6262
consumer_secret: twitterAuthData.consumer_secret,
63+
validateAuthData: () => {},
6364
},
6465
},
6566
verbose: false,

0 commit comments

Comments
 (0)