Skip to content

ci: bump environment #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
bd1498f
wip: base implementation of defined schema
Moumouls Dec 22, 2020
06ee331
wip: block routes when defined schemas used
Moumouls Dec 22, 2020
6cf6355
wip: tests
Moumouls Dec 22, 2020
2907315
wip: testing
Moumouls Dec 23, 2020
0aaf531
wip: tested indexes
Moumouls Dec 23, 2020
cb07388
wip: tested CLP
Moumouls Dec 23, 2020
acba945
fix flow
Moumouls Dec 23, 2020
86b5125
remove fit
Moumouls Dec 23, 2020
69f19dc
coverage
Moumouls Dec 24, 2020
ae1cc7a
fix
Moumouls Dec 24, 2020
22e6815
add changelog
Moumouls Dec 24, 2020
410bebe
wip: add retry, missing test
Moumouls Jan 4, 2021
3e0145e
tested retry
Moumouls Jan 5, 2021
bf52c3d
test parallel
Moumouls Jan 6, 2021
0549d02
spread clp to avoid read only issue
Moumouls Apr 14, 2021
5f6628b
Merge branch 'upstream/master' into moumouls/defined-schema
Moumouls May 14, 2021
c79a32d
restored lock
Moumouls May 14, 2021
46269ff
update workflow
Moumouls May 14, 2021
d610bb9
update node version
Moumouls May 14, 2021
5188e69
Merge branch 'master' into moumouls/defined-schema
sadortun Jun 6, 2021
21034a7
Added beforeUnsubscribe Trigger
sadortun Jun 6, 2021
f953753
wip
sadortun Jun 10, 2021
4ce78b0
Fix relation keys not applied to sub-queries
sadortun Jun 10, 2021
879a3d5
Merge branch 'pr-migrations-wip'
sadortun Jun 15, 2021
47b016a
Added validations,
sadortun Jun 15, 2021
014120d
Updated SchemaMigrations, added validations and Types
sadortun Jun 15, 2021
555a038
Fix typo
sadortun Jun 15, 2021
97b57de
Clean code
sadortun Jun 15, 2021
f616ef9
Merge branch 'pr-migrations'
sadortun Jun 15, 2021
85f6a02
Add colors!
sadortun Jun 27, 2021
0822904
Fix logging, fix CLP not handled correctly for new schemas, ensure we…
sadortun Jun 27, 2021
4d58b6d
Add validation for schemas
sadortun Jun 27, 2021
25ed2f8
Improve handling of CLP
sadortun Jul 5, 2021
d557327
Add test case for issue #7459
sadortun Jul 8, 2021
99a8205
Clean up CLP, add logging
sadortun Jul 14, 2021
f369f63
Merge remote-tracking branch 'remotes/upstream/master' into pr-migrat…
sadortun Aug 11, 2021
9d7fe89
Fixed tests
sadortun Aug 11, 2021
aa9b15e
Fix formating issues
sadortun Aug 11, 2021
42696e9
Fix code review issues
sadortun Aug 11, 2021
b2c4efc
Merge branch 'master' into pr-migrations
sadortun Aug 11, 2021
089bcfc
Re-enable all tests
sadortun Aug 11, 2021
72e3bf3
Merge branch 'pr-migrations' of https://github.com/GoPlan-Finance/par…
sadortun Aug 11, 2021
14695f5
Merge branch 'pr-migrations'
sadortun Aug 11, 2021
9525e74
Replace the auto-locking of schemas by an explicit "lockSchemas" para…
sadortun Aug 12, 2021
3cb3ed8
Double-Quote prettier argument to fix issue on Windows
sadortun Aug 12, 2021
9db55b6
Replace the auto-locking of schemas by an explicit "lockSchemas" para…
sadortun Aug 12, 2021
9c915ee
Added ACL type
sadortun Aug 12, 2021
1a3acf8
Merge branch 'pr-migrations'
sadortun Aug 12, 2021
a5eace1
Remove quoted argument to fix issue on Windows
sadortun Aug 12, 2021
24c2a1c
Rename Migration/Schemas to Schema/Definitions
sadortun Aug 16, 2021
4c1d2f6
Re-added Migration retries to handle concurrent server startups
sadortun Aug 16, 2021
265420c
Rename Migration/Schemas to Schema/Definitions
sadortun Aug 16, 2021
2a5fd93
Re-added Migration retries to handle concurrent server startups
sadortun Aug 16, 2021
02caf69
Ensure before/after migration only run once.
sadortun Aug 16, 2021
f34153f
Added ParseServer startup options
sadortun Aug 16, 2021
d244d56
Merge branch 'master' into pr-migrations
sadortun Aug 16, 2021
a78aec6
Merge branch 'pr-migrations'
sadortun Aug 16, 2021
9a0ffd4
Ensure the migration are completed before adding Parse Cloud
sadortun Aug 26, 2021
7fea7d8
Merge branch 'pr-migrations'
sadortun Aug 27, 2021
98bcda8
Added beforeUnsubscribe Trigger
sadortun Jun 6, 2021
a86ef73
Remove duplicate onLiveQueryEvent
sadortun Jun 7, 2021
fd21ddc
Update CHANGELOG.md
sadortun Jun 22, 2021
69deddf
Add logged-in user to add missing coverage
sadortun Aug 11, 2021
46842cd
Updated CHANGELOG
sadortun Aug 16, 2021
4bcaf93
Add username check and try/catch block
sadortun Sep 3, 2021
fce0b14
Merge branch 'parse-community:master' into master
sadortun Sep 3, 2021
ab796c2
Update ParseLiveQueryServer.js
sadortun Sep 3, 2021
9b49f1f
Merge remote-tracking branch 'remotes/origin/pr_beforeUnsubscribe'
sadortun Oct 1, 2021
3227dc4
Re-throw on failure
sadortun Oct 5, 2021
6d360d7
Update initialization after code review
sadortun Oct 5, 2021
fa2d3d0
Merge branch 'master' into pr-migrations
sadortun Oct 5, 2021
a10c574
Revert unwanted changes
sadortun Oct 5, 2021
b6806e9
Implement code review changes
sadortun Oct 5, 2021
a1cd981
Implement code review changes
sadortun Oct 5, 2021
d3ba3bb
Updated CHANGELOG
sadortun Oct 5, 2021
0792324
Update CHANGELOG.md
sadortun Sep 3, 2021
351d1df
Merge remote-tracking branch 'remotes/upstream/master'
sadortun Oct 5, 2021
8463e91
Merge branch 'pr-migrations'
sadortun Oct 5, 2021
0e37d39
fix: test & review
Moumouls Oct 5, 2021
426857f
Merge pull request #1 from Moumouls/pr-migrations-moumouls
sadortun Oct 5, 2021
d6bf3e1
Merge branch 'upstream/master' into pr-migrations-moumouls
Moumouls Oct 11, 2021
8cc1cf2
test: clean on after each
Moumouls Oct 12, 2021
040b695
Merge branch 'upstream/master' into pr-migrations-moumouls
Moumouls Oct 13, 2021
cba3179
Merge pull request #2 from Moumouls/pr-migrations-moumouls
sadortun Oct 13, 2021
8bf9231
Merge branch 'master' into pr-migrations
sadortun Oct 21, 2021
19c4160
Implement code review changes
sadortun Oct 28, 2021
d7d2a9a
Merge remote-tracking branch 'remotes/upstream/alpha' into pr-migrations
sadortun Oct 28, 2021
00da243
Update index.js
sadortun Oct 30, 2021
49645ed
Merge branch 'alpha' into pr-migrations
sadortun Oct 30, 2021
af80d29
Merge branch 'alpha' into pr-migrations
sadortun Oct 31, 2021
41d906b
Disable failing Postgres test
sadortun Oct 31, 2021
cd6fb50
Merge remote-tracking branch 'remotes/upstream/alpha' into pr-migrations
sadortun Nov 1, 2021
63422fc
Fix flow errors
sadortun Nov 1, 2021
ec00163
Merge branch 'pr-migrations'
sadortun Dec 7, 2021
a9c5efc
Merge remote-tracking branch 'remotes/upstream/beta'
sadortun Dec 7, 2021
3aed1de
Fix incorect upper limit node version
sadortun Dec 7, 2021
1eee7f1
Re-add Color in logs
sadortun Dec 7, 2021
331a0c1
ci: bump environment
sadortun Dec 8, 2021
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Details:
- Branch: [beta][branch_beta]
- Purpose: feature maturation
- Suitable environment: development
- Added Cloud Trigger for LiveQuery event beforeUnsubscribe (sadortun) [#7419](https://github.com/parse-community/parse-server/pull/7419)
- Ensure the startup is completed before calling startupCompleted (sadortun) [#7525](https://github.com/parse-community/parse-server/pull/7525)

## 🔥 [Alpha Releases][log_alpha]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"madge:circular": "node_modules/.bin/madge ./src --circular"
},
"engines": {
"node": ">=12.20.0 <16"
"node": ">=12.20.0 <17"
},
"bin": {
"parse-server": "bin/parse-server"
Expand Down
39 changes: 39 additions & 0 deletions spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,45 @@ describe('ParseLiveQuery', function () {
await object.save();
});

it('can handle select beforeUnsubscribe trigger', async done => {
await reconfigureServer({
liveQuery: {
classNames: ['TestObject'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});
const user = new Parse.User();
user.setUsername('username');
user.setPassword('password');
await user.signUp();

Parse.Cloud.beforeSubscribe(TestObject, req => {
expect(req.requestId).toBe(1);
expect(req.user).toBeDefined();
});

Parse.Cloud.beforeUnsubscribe(TestObject, req => {
expect(req.requestId).toBe(1);
expect(req.user).toBeDefined();
expect(req.user.get('username')).toBe('username');
done();
});

const object = new TestObject();
await object.save();

const query = new Parse.Query(TestObject);
query.equalTo('objectId', object.id);
const subscription = await query.subscribe();

object.set({ foo: 'bar', yolo: 'abc' });
await object.save();

await subscription.unsubscribe();
});

it('LiveQuery with ACL', async () => {
await reconfigureServer({
liveQuery: {
Expand Down
17 changes: 17 additions & 0 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,23 @@ describe('Parse.Query testing', () => {
});
});

it('multiple notEqualTo queries', function (done) {
const makeBoxedNumber = function (i) {
return new BoxedNumber({ number: i });
};
Parse.Object.saveAll([0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(makeBoxedNumber)).then(function () {
const query = new Parse.Query(BoxedNumber);
query.notEqualTo('number', 1);
query.notEqualTo('number', 2);
query.notEqualTo('number', 3);
query.notEqualTo('number', 4);
query.find().then(function (results) {
equal(results.length, 5);
done();
});
});
});

it('notEqualTo zero queries', done => {
const makeBoxedNumber = i => {
return new BoxedNumber({ number: i });
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Logger/WinstonLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function configureTransports(options) {
colorize: true,
name: 'console',
silent,
format: format.combine(format.splat(), consoleFormat),
format: format.combine(format.colorize(), format.splat(), consoleFormat),
},
options
);
Expand Down
14 changes: 8 additions & 6 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,12 +1054,14 @@ class DatabaseController {
// Modifies query so that it no longer has $relatedTo
// Returns a promise that resolves when query is mutated
reduceRelationKeys(className: string, query: any, queryOptions: any): ?Promise<void> {
if (query['$or']) {
return Promise.all(
query['$or'].map(aQuery => {
return this.reduceRelationKeys(className, aQuery, queryOptions);
})
);
for (const op of ['$or', '$and', '$not']) {
if (query[op]) {
return Promise.all(
query[op].map(aQuery => {
return this.reduceRelationKeys(className, aQuery, queryOptions);
})
);
}
}
if (query['$and']) {
return Promise.all(
Expand Down
33 changes: 30 additions & 3 deletions src/LiveQuery/ParseLiveQueryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ class ParseLiveQueryServer {
this._handleSubscribe(parseWebsocket, request);
}

_handleUnsubscribe(parseWebsocket: any, request: any, notifyClient: boolean = true): any {
async _handleUnsubscribe(parseWebsocket: any, request: any, notifyClient: boolean = true): any {
// If we can not find this client, return error to client
if (!Object.prototype.hasOwnProperty.call(parseWebsocket, 'clientId')) {
Client.pushError(
Expand Down Expand Up @@ -893,11 +893,38 @@ class ParseLiveQueryServer {
return;
}

const subscription = subscriptionInfo.subscription;
const className = subscription.className;
const trigger = getTrigger(className, 'beforeUnsubscribe', Parse.applicationId);
if (trigger) {
const auth = await this.getAuthFromClient(client, request.requestId, request.sessionToken);
if (auth && auth.user) {
request.user = auth.user;
}

request.sessionToken = subscriptionInfo.sessionToken;
request.useMasterKey = client.hasMasterKey;
request.installationId = client.installationId;

try {
await runTrigger(trigger, `beforeUnsubscribe.${className}`, request, auth);
} catch (error) {
Client.pushError(
parseWebsocket,
error.code || Parse.Error.SCRIPT_FAILED,
error.message || error,
false
);
logger.error(
`Failed running beforeUnsubscribe for session ${request.sessionToken} with:\n Error: ` +
JSON.stringify(error)
);
}
}

// Remove subscription from client
client.deleteSubscriptionInfo(requestId);
// Remove client from subscription
const subscription = subscriptionInfo.subscription;
const className = subscription.className;
subscription.deleteClientSubscription(parseWebsocket.clientId, requestId);
// If there is no client which is subscribing this subscription, remove it from subscriptions
const classSubscriptions = this.subscriptions.get(className);
Expand Down
2 changes: 1 addition & 1 deletion src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export interface ParseServerOptions {
playgroundPath: ?string;
/* Callback when server has started */
serverStartComplete: ?(error: ?Error) => void;
/* Rest representation on Parse.Schema https://docs.parseplatform.org/rest/guide/#adding-a-schema */
/* Rest representation on Parse.Schema */
schema: ?SchemaOptions;
/* Callback when server has closed */
serverCloseComplete: ?() => void;
Expand Down
36 changes: 36 additions & 0 deletions src/cloud-code/Parse.Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,42 @@ ParseCloud.onLiveQueryEvent = function (handler) {
triggers.addLiveQueryEventHandler(handler, Parse.applicationId);
};

/**
* Registers a before live query subscription function.
*
* **Available in Cloud Code only.**
*
* If you want to use beforeUnsubscribe for a predefined class in the Parse JavaScript SDK (e.g. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.beforeUnsubscribe('MyCustomClass', (request) => {
* // code here
* }, (request) => {
* // validation code here
* });
*
* Parse.Cloud.beforeUnsubscribe(Parse.User, (request) => {
* // code here
* }, { ...validationObject });
*```
*
* @method beforeUnsubscribe
* @name Parse.Cloud.beforeUnsubscribe
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the before subscription function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a subscription. This function can be async and should take one parameter, a {@link Parse.Cloud.TriggerRequest}.
* @param {(Object|Function)} validator An optional function to help validating cloud code. This function can be an async function and should take one parameter a {@link Parse.Cloud.TriggerRequest}, or a {@link Parse.Cloud.ValidatorObject}.
*/
ParseCloud.beforeUnsubscribe = function (parseClass, handler, validationHandler) {
validateValidator(validationHandler);
const className = triggers.getClassName(parseClass);
triggers.addTrigger(
triggers.Types.beforeUnsubscribe,
className,
handler,
Parse.applicationId,
validationHandler
);
};

/**
* Registers an after live query server event function.
*
Expand Down
1 change: 1 addition & 0 deletions src/triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Types = {
afterDeleteFile: 'afterDeleteFile',
beforeConnect: 'beforeConnect',
beforeSubscribe: 'beforeSubscribe',
beforeUnsubscribe: 'beforeUnsubscribe',
afterEvent: 'afterEvent',
};

Expand Down