Skip to content

Commit

Permalink
build: Release (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Sep 16, 2023
2 parents 8e9afc6 + ccc9f60 commit f30d588
Show file tree
Hide file tree
Showing 109 changed files with 12,614 additions and 3,841 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ jobs:
uses: mansona/npm-lockfile-version@v1
with:
version: 2
check-types:
name: Check types
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: Check types
run: npm run test:types
build:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
docs-publish:
needs: release
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-manual-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
docs-publish:
if: github.event.inputs.tag != ''
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion babel-jest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const babelJest = require('babel-jest');

module.exports = babelJest.createTransformer({
presets: [["@babel/preset-env", {
presets: ["@babel/preset-typescript", ["@babel/preset-env", {
"targets": {
"node": "14"
},
Expand Down
75 changes: 75 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,78 @@
# [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)


### Features

* 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))

# [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)


### Features

* 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))

# [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)


### Features

* 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))

# [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)


### Bug Fixes

* `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))

# [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)


### Features

* 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))

# [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)


### Features

* 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))

# [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)


### Features

* 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))

# [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)


### Features

* 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))

# [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)


### Bug Fixes

* 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))

# [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)


### Bug Fixes

* `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))

### Features

* 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))
* 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))

# [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)


Expand Down
14 changes: 7 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ const transformRuntime = ["@babel/plugin-transform-runtime", {
}];

const PRESETS = {
'browser': [["@babel/preset-env", {
'browser': ["@babel/preset-typescript", ["@babel/preset-env", {
"targets": "> 0.25%, not dead"
}]],
'weapp': [["@babel/preset-env", {
'weapp': ["@babel/preset-typescript", ["@babel/preset-env", {
"targets": "> 0.25%, not dead"
}], '@babel/react'],
'node': [["@babel/preset-env", {
'node': ["@babel/preset-typescript", ["@babel/preset-env", {
"targets": { "node": "14" }
}]],
'react-native': ['module:metro-react-native-babel-preset'],
'react-native': ["@babel/preset-typescript", 'module:metro-react-native-babel-preset'],
};
const PLUGINS = {
'browser': [transformRuntime, '@babel/plugin-transform-flow-comments', '@babel/plugin-proposal-class-properties', 'inline-package-json',
Expand Down Expand Up @@ -79,7 +79,7 @@ function compileTask(stream) {
}

gulp.task('compile', function() {
return compileTask(gulp.src('src/*.js'));
return compileTask(gulp.src('src/*.*(js|ts)'));
});

gulp.task('browserify', function(cb) {
Expand Down Expand Up @@ -137,7 +137,7 @@ gulp.task('minify-weapp', function() {

gulp.task('watch', function() {
if (BUILD === 'browser') {
const watcher = gulp.watch('src/*.js', { ignoreInitial: false }, gulp.series('compile', 'browserify', 'minify'));
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`);
});
Expand All @@ -146,5 +146,5 @@ gulp.task('watch', function() {
});
return watcher;
}
return compileTask(watch('src/*.js', { ignoreInitial: false, verbose: true }));
return compileTask(watch('src/*.*(js|ts)', { ignoreInitial: false, verbose: true }));
});
67 changes: 40 additions & 27 deletions integration/test/ParseLocalDatastoreTest.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
'use strict';

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

global.localStorage = require('./mockLocalStorage');
global.WebSocket = require('ws');
const mockRNStorage = require('./mockRNStorage');
const LocalDatastoreUtils = require('../../lib/node/LocalDatastoreUtils');
const serverURL = 'http://localhost:1337/parse';

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

function LDS_KEY(object) {
return Parse.LocalDatastore.getKeyForObject(object);
}
function LDS_FULL_JSON(object) {
const json = object._toFullJSON();
if (object._localId) {
json._localId = object._localId;
const { DEFAULT_PIN, PIN_PREFIX, isLocalDatastoreKey } = LocalDatastoreUtils;

const Item = Parse.Object.extend('Item');
const TestObject = Parse.Object.extend('TestObject');

function LDS_KEY(object) {
return Parse.LocalDatastore.getKeyForObject(object);
}
return json;
}
function runTest(controller) {
function LDS_FULL_JSON(object) {
const json = object._toFullJSON();
if (object._localId) {
json._localId = object._localId;
}
return json;
}

describe(`Parse Object Pinning (${controller.name})`, () => {
beforeEach(async () => {
const StorageController = require(controller.file);
Parse.CoreManager.setAsyncStorage(mockRNStorage);
Parse.CoreManager.setLocalDatastoreController(StorageController);
Parse.enableLocalDatastore();
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);
Parse.User.enableUnsafeCurrentUser();
await Parse.LocalDatastore._clear();
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();
});

function getStorageCount(storage) {
return Object.keys(storage).reduce((acc, key) => acc + (isLocalDatastoreKey(key) ? 1 : 0), 1);
}

it(`${controller.name} can clear localDatastore`, async () => {
const obj1 = new TestObject();
const obj2 = new TestObject();
Expand Down Expand Up @@ -1060,8 +1076,15 @@ function runTest(controller) {
const StorageController = require(controller.file);
Parse.CoreManager.setAsyncStorage(mockRNStorage);
Parse.CoreManager.setLocalDatastoreController(StorageController);
Parse.enableLocalDatastore();
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);
Parse.LocalDatastore._clear();
Parse.User.enableUnsafeCurrentUser();
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 = [];
for (let i = 0; i < 10; i++) {
Expand Down Expand Up @@ -2949,20 +2972,10 @@ function runTest(controller) {
}

describe('Parse LocalDatastore', () => {
beforeEach(() => {
Parse.CoreManager.getInstallationController()._setInstallationIdCache('1234');
Parse.enableLocalDatastore();
Parse.User.enableUnsafeCurrentUser();
});

const controllers = [
{ name: 'Default', file: '../../lib/node/LocalDatastoreController' },
{
name: 'React-Native',
file: '../../lib/node/LocalDatastoreController.react-native',
},
{ name: 'node', file: '../../lib/node/LocalDatastoreController' },
{ name: 'react-native', file: '../../lib/react-native/LocalDatastoreController.react-native' },
];

for (let i = 0; i < controllers.length; i += 1) {
const controller = controllers[i];
runTest(controller);
Expand Down
17 changes: 17 additions & 0 deletions integration/test/ParseQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,23 @@ describe('Parse Query', () => {
assert.equal(result.get('slice'), 'pizza');
});

it('can exclude keys in findAll', async () => {
const object = new TestObject({
hello: 'world',
foo: 'bar',
slice: 'pizza',
});
await object.save();

const query = new Parse.Query(TestObject);
query.exclude('foo');
query.equalTo('objectId', object.id);
const [result] = await query.findAll();
assert.equal(result.get('foo'), undefined);
assert.equal(result.get('hello'), 'world');
assert.equal(result.get('slice'), 'pizza');
});

it('uses subclasses when creating objects', done => {
const ParentObject = Parse.Object.extend({ className: 'ParentObject' });
let ChildObject = Parse.Object.extend('ChildObject', {
Expand Down
9 changes: 9 additions & 0 deletions integration/test/ParseSchemaTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('Schema', () => {
.addString('stringField')
.addNumber('numberField')
.addBoolean('booleanField')
.addBytes('bytesField')
.addDate('dateField')
.addFile('fileField')
.addGeoPoint('geoPointField')
Expand All @@ -91,6 +92,7 @@ describe('Schema', () => {
assert.equal(result.fields.stringField.type, 'String');
assert.equal(result.fields.numberField.type, 'Number');
assert.equal(result.fields.booleanField.type, 'Boolean');
assert.equal(result.fields.bytesField.type, 'Bytes');
assert.equal(result.fields.dateField.type, 'Date');
assert.equal(result.fields.fileField.type, 'File');
assert.equal(result.fields.geoPointField.type, 'GeoPoint');
Expand Down Expand Up @@ -182,6 +184,7 @@ describe('Schema', () => {
required: true,
defaultValue: '2000-01-01T00:00:00.000Z',
})
.addBytes('bytesField', { required: true, defaultValue: 'ParseA==' })
.addFile('fileField', { required: true, defaultValue: file })
.addGeoPoint('geoPointField', { required: true, defaultValue: point })
.addPolygon('polygonField', { required: true, defaultValue: polygon })
Expand All @@ -204,6 +207,11 @@ describe('Schema', () => {
stringField: { type: 'String', required: true, defaultValue: 'world' },
numberField: { type: 'Number', required: true, defaultValue: 10 },
booleanField: { type: 'Boolean', required: true, defaultValue: false },
bytesField: {
type: 'Bytes',
required: true,
defaultValue: { __type: 'Bytes', base64: 'ParseA==' },
},
dateField: {
type: 'Date',
required: true,
Expand Down Expand Up @@ -245,6 +253,7 @@ describe('Schema', () => {
stringField: 'world',
numberField: 10,
booleanField: false,
bytesField: { __type: 'Bytes', base64: 'ParseA==' },
dateField: { __type: 'Date', iso: '2000-01-01T00:00:00.000Z' },
dateStringField: { __type: 'Date', iso: '2000-01-01T00:00:00.000Z' },
fileField: file.toJSON(),
Expand Down
14 changes: 12 additions & 2 deletions integration/test/ParseUserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,14 +979,18 @@ describe('Parse User', () => {
await Parse.FacebookUtils.link(user);

expect(Parse.FacebookUtils.isLinked(user)).toBe(true);
expect(Parse.AnonymousUtils.isLinked(user)).toBe(true);
expect(Parse.AnonymousUtils.isLinked(user)).toBe(false);
await Parse.FacebookUtils.unlink(user);

expect(Parse.FacebookUtils.isLinked(user)).toBe(false);
expect(Parse.AnonymousUtils.isLinked(user)).toBe(true);
expect(Parse.AnonymousUtils.isLinked(user)).toBe(false);
});

it('can link with twitter', async () => {
const server = await reconfigureServer();
const twitter = server.config.auth.twitter;
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();

Parse.User.enableUnsafeCurrentUser();
const user = new Parse.User();
user.setUsername(uuidv4());
Expand All @@ -999,9 +1003,14 @@ describe('Parse User', () => {

await user._unlinkFrom('twitter');
expect(user._isLinked('twitter')).toBe(false);
expect(spy).toHaveBeenCalled();
});

it('can link with twitter and facebook', async () => {
const server = await reconfigureServer();
const twitter = server.config.auth.twitter;
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();

Parse.User.enableUnsafeCurrentUser();
Parse.FacebookUtils.init();
const user = new Parse.User();
Expand All @@ -1017,6 +1026,7 @@ describe('Parse User', () => {

expect(user.get('authData').twitter.id).toBe(twitterAuthData.id);
expect(user.get('authData').facebook.id).toBe('test');
expect(spy).toHaveBeenCalled();
});

it('can verify user password via static method', async () => {
Expand Down
1 change: 1 addition & 0 deletions integration/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const defaultConfiguration = {
twitter: {
consumer_key: twitterAuthData.consumer_key,
consumer_secret: twitterAuthData.consumer_secret,
validateAuthData: () => {},
},
},
verbose: false,
Expand Down
Loading

0 comments on commit f30d588

Please sign in to comment.