Skip to content

Commit

Permalink
build: Release (#2188)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Jun 24, 2024
2 parents 1ac1890 + dd48992 commit 79f6a7f
Show file tree
Hide file tree
Showing 178 changed files with 14,043 additions and 10,663 deletions.
26 changes: 12 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"extends": [
"eslint:recommended",
"plugin:jsdoc/recommended",
"plugin:flowtype/recommended"
"plugin:@typescript-eslint/recommended"
],
"env": {
"node": true,
"es6": true
},
"parser": "@babel/eslint-parser",
"parser": "@typescript-eslint/parser",
"globals": {
"wx": true
},
"plugins": [
"flowtype",
"jsdoc"
"jsdoc",
"@typescript-eslint"
],
"parserOptions": {
"ecmaVersion": 6,
Expand All @@ -36,7 +36,14 @@
"no-console": 0,
"no-prototype-builtins": "off",
"require-atomic-updates": "off",
"flowtype/no-types-missing-file-annotation": 0,
"prefer-spread": "off",
"prefer-rest-params": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"jsdoc/require-jsdoc": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-param-description": 0,
Expand All @@ -49,15 +56,6 @@
"allowExtraTrailingParamDocs": true
}
],
"jsdoc/check-tag-names": [
"error",
{
"definedTags": [
"flow",
"flow-weak"
]
}
],
"jsdoc/no-undefined-types": [
"error",
{
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- run: npm ci
- name: Build Types
run: npm run build:types
- name: Lint Types
run: npm run lint:types
- name: Test Types
run: npm run test:types
- name: Lint Types
run: npm run lint:types
check-docs:
name: Check Docs
timeout-minutes: 5
Expand Down Expand Up @@ -89,7 +89,8 @@ jobs:
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
# Set to `true` once codecov token bug is fixed; https://github.com/parse-community/parse-server/issues/9129
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run pre-commit
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ semi: true
trailingComma: "es5"
singleQuote: true
arrowParens: "avoid"
printWidth: 100
printWidth: 100
parser: "typescript"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Parse Community has a [responsible Vulnerability Disclosure Program](https://git
## Coding Style

* Most importantly, match the existing code style as much as possible.
* We use [Flow](http://flowtype.org/) and ES6 for this codebase. Use modern syntax whenever possible.
* We use ES6 for this codebase. Use modern syntax whenever possible.
* Keep lines within 80 characters.
* Always end lines with semicolons.

Expand Down
1 change: 0 additions & 1 deletion babel-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ module.exports = babelJest.createTransformer({
useBuiltIns: 'entry',
corejs: 3,
}]],
plugins: ['@babel/plugin-transform-flow-comments'],
});
28 changes: 28 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# [5.2.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/5.2.0-alpha.2...5.2.0-alpha.3) (2024-06-24)


### Bug Fixes

* `LiveQueryClient.resubscribe` with Parse Server 7 causes many open connections ([#2184](https://github.com/parse-community/Parse-SDK-JS/issues/2184)) ([71b4d17](https://github.com/parse-community/Parse-SDK-JS/commit/71b4d17efa197f6f0bb94105809f32a9adc86ea6))

# [5.2.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/5.2.0-alpha.1...5.2.0-alpha.2) (2024-06-07)


### Bug Fixes

* Duplicate pending operations on nested fields ([#2162](https://github.com/parse-community/Parse-SDK-JS/issues/2162)) ([df6df7c](https://github.com/parse-community/Parse-SDK-JS/commit/df6df7c68b9871f0b744958a489a54f1623943a9))

# [5.2.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.1-alpha.1...5.2.0-alpha.1) (2024-05-17)


### Features

* Support dot notation on array fields ([#2120](https://github.com/parse-community/Parse-SDK-JS/issues/2120)) ([25ec684](https://github.com/parse-community/Parse-SDK-JS/commit/25ec684bf01cf9cd616ceff6f5d30e2e7fb83a5a))

## [5.1.1-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0...5.1.1-alpha.1) (2024-05-16)


### Bug Fixes

* `Parse.Installation` not working when installation is deleted on server ([#2126](https://github.com/parse-community/Parse-SDK-JS/issues/2126)) ([22360b4](https://github.com/parse-community/Parse-SDK-JS/commit/22360b4dc96ca7ebfcc2441855456b241bf450ac))

# [5.1.0-alpha.11](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.10...5.1.0-alpha.11) (2024-05-16)


Expand Down
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ const PRESETS = {
'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',
'browser': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
'weapp': [transformRuntime, '@babel/plugin-transform-flow-comments', '@babel/plugin-proposal-class-properties', 'inline-package-json',
'weapp': [transformRuntime, '@babel/plugin-proposal-class-properties', 'inline-package-json',
['transform-inline-environment-variables', {'exclude': ['SERVER_RENDERING']}]],
'node': ['@babel/plugin-transform-flow-comments', 'inline-package-json', 'transform-inline-environment-variables'],
'react-native': ['@babel/plugin-transform-flow-comments', 'inline-package-json', 'transform-inline-environment-variables']
'node': ['inline-package-json', 'transform-inline-environment-variables'],
'react-native': ['inline-package-json', 'transform-inline-environment-variables']
};

const DEV_HEADER = (
Expand Down
9 changes: 6 additions & 3 deletions integration/test/ParseDistTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
request.continue();
});
page.on('requestfailed', request => {
if (request.failure().errorText === 'net::ERR_ABORTED' && !request.url().includes('favicon.ico')) {
if (
request.failure().errorText === 'net::ERR_ABORTED' &&
!request.url().includes('favicon.ico')
) {
abortedCount += 1;
promise.resolve();
}
});
await page.evaluate(async () => {
const parseLogo =
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png';
'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(() => {});

return new Promise((resolve) => {
return new Promise(resolve => {
const intervalId = setInterval(() => {
if (file._requestTask && typeof file._requestTask.abort === 'function') {
file.cancel();
Expand Down
6 changes: 3 additions & 3 deletions integration/test/ParseEventuallyQueueTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('Parse EventuallyQueue', () => {
it('can saveEventually', async () => {
const parseServer = await reconfigureServer();
const object = new TestObject({ hash: 'saveSecret' });
await new Promise((resolve) => parseServer.server.close(resolve));
await new Promise(resolve => parseServer.server.close(resolve));
await object.saveEventually();

const length = await Parse.EventuallyQueue.length();
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('Parse EventuallyQueue', () => {
const object = new TestObject({ hash: 'saveSecret' });
object.setACL(acl);

await new Promise((resolve) => parseServer.server.close(resolve));
await new Promise(resolve => parseServer.server.close(resolve));
await object.saveEventually();

const length = await Parse.EventuallyQueue.length();
Expand All @@ -250,7 +250,7 @@ describe('Parse EventuallyQueue', () => {
const parseServer = await reconfigureServer();
const object = new TestObject({ hash: 'deleteSecret' });
await object.save();
await new Promise((resolve) => parseServer.server.close(resolve));
await new Promise(resolve => parseServer.server.close(resolve));
await object.destroyEventually();
const length = await Parse.EventuallyQueue.length();

Expand Down
38 changes: 35 additions & 3 deletions integration/test/ParseLiveQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('Parse LiveQuery', () => {
it('can subscribe to query', async () => {
const object = new TestObject();
await object.save();
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
const installationId =
await Parse.CoreManager.getInstallationController().currentInstallationId();

const query = new Parse.Query(TestObject);
query.equalTo('objectId', object.id);
Expand All @@ -39,7 +40,8 @@ describe('Parse LiveQuery', () => {
it('can subscribe to query with client', async () => {
const object = new TestObject();
await object.save();
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
const installationId =
await Parse.CoreManager.getInstallationController().currentInstallationId();

const query = new Parse.Query(TestObject);
query.equalTo('objectId', object.id);
Expand Down Expand Up @@ -88,6 +90,35 @@ describe('Parse LiveQuery', () => {
await promise;
});

it('can resubscribe', async () => {
const client = new Parse.LiveQueryClient({
applicationId: 'integration',
serverURL: 'ws://localhost:1337',
javascriptKey: null,
masterKey: null,
sessionToken: null,
});
client.open();
const resubscribeSpy = spyOn(client, 'resubscribe').and.callThrough();
const subscribeRequest = {
op: 'subscribe',
requestId: 1,
query: {
className: 'TestObject',
where: { objectId: 'HEXkuHFm0D' },
keys: ['foo', 'objectId'],
watch: undefined,
unknownField: 'throws Additional properties not allowed error',
},
sessionToken: undefined,
};
await client.connectPromise;
client.socket.send(JSON.stringify(subscribeRequest));
await sleep(1000);
expect(resubscribeSpy).toHaveBeenCalled();
await client.close();
});

it('can subscribe to multiple queries', async () => {
const objectA = new TestObject();
const objectB = new TestObject();
Expand Down Expand Up @@ -389,7 +420,8 @@ describe('Parse LiveQuery', () => {
Parse.CoreManager.setEventEmitter(CustomEmitter);
const object = new TestObject();
await object.save();
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
const installationId =
await Parse.CoreManager.getInstallationController().currentInstallationId();

const query = new Parse.Query(TestObject);
query.equalTo('objectId', object.id);
Expand Down
1 change: 0 additions & 1 deletion integration/test/ParseQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2415,5 +2415,4 @@ describe('Parse Query', () => {
const explain = await query.find();
assert.equal(explain.command.comment, comment);
});

});
5 changes: 3 additions & 2 deletions integration/test/ParseReactNativeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Parse React Native', () => {

it('can log in a user', async () => {
// Handle Storage Controller
await Parse.User.signUp('asdf', 'zxcv')
await Parse.User.signUp('asdf', 'zxcv');
const user = await Parse.User.logIn('asdf', 'zxcv');
expect(user.get('username')).toBe('asdf');
expect(user.existed()).toBe(true);
Expand Down Expand Up @@ -86,7 +86,8 @@ describe('Parse React Native', () => {
// Handle WebSocket Controller
const object = new Parse.Object('TestObject');
await object.save();
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
const installationId =
await Parse.CoreManager.getInstallationController().currentInstallationId();

const query = new Parse.Query('TestObject');
query.equalTo('objectId', object.id);
Expand Down
8 changes: 5 additions & 3 deletions integration/test/ParseServerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ describe('ParseServer', () => {
it('can reconfigure server', async () => {
const parseServer = await reconfigureServer({ serverURL: 'www.google.com' });
assert.strictEqual(parseServer.config.serverURL, 'www.google.com');
await new Promise((resolve) => parseServer.server.close(resolve));
await new Promise(resolve => parseServer.server.close(resolve));
await reconfigureServer();
});

it('can shutdown', async () => {
const parseServer = await reconfigureServer();
const object = new TestObject({ foo: 'bar' });
await parseServer.handleShutdown();
await new Promise((resolve) => parseServer.server.close(resolve));
await expectAsync(object.save()).toBeRejectedWithError('XMLHttpRequest failed: "Unable to connect to the Parse API"');
await new Promise(resolve => parseServer.server.close(resolve));
await expectAsync(object.save()).toBeRejectedWithError(
'XMLHttpRequest failed: "Unable to connect to the Parse API"'
);
await reconfigureServer({});
await object.save();
assert(object.id);
Expand Down
Loading

0 comments on commit 79f6a7f

Please sign in to comment.