Skip to content

Commit 1ec0a7e

Browse files
authored
Merge branch 'alpha' into fix-dates
2 parents 5b17a33 + 94d558e commit 1ec0a7e

File tree

7 files changed

+59
-16
lines changed

7 files changed

+59
-16
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [6.1.0-alpha.2](https://github.com/parse-community/parse-server/compare/6.1.0-alpha.1...6.1.0-alpha.2) (2023-03-05)
2+
3+
4+
### Bug Fixes
5+
6+
* Nested date is incorrectly decoded as empty object `{}` when fetching a Parse Object ([#8446](https://github.com/parse-community/parse-server/issues/8446)) ([22d2446](https://github.com/parse-community/parse-server/commit/22d2446dfea2bc339affc20535d181097e152acf))
7+
8+
# [6.1.0-alpha.1](https://github.com/parse-community/parse-server/compare/6.0.0...6.1.0-alpha.1) (2023-03-03)
9+
10+
11+
### Bug Fixes
12+
13+
* Security upgrade jsonwebtoken to 9.0.0 ([#8420](https://github.com/parse-community/parse-server/issues/8420)) ([f5bfe45](https://github.com/parse-community/parse-server/commit/f5bfe4571e82b2b7440d41f3cff0d49937398164))
14+
15+
### Features
16+
17+
* Add option `schemaCacheTtl` for schema cache pulling as alternative to `enableSchemaHooks` ([#8436](https://github.com/parse-community/parse-server/issues/8436)) ([b3b76de](https://github.com/parse-community/parse-server/commit/b3b76de71b1d4265689d052e7837c38ec1fa4323))
18+
* Add Parse Server option `resetPasswordSuccessOnInvalidEmail` to choose success or error response on password reset with invalid email ([#7551](https://github.com/parse-community/parse-server/issues/7551)) ([e5d610e](https://github.com/parse-community/parse-server/commit/e5d610e5e487ddab86409409ac3d7362aba8f59b))
19+
* Deprecate LiveQuery `fields` option in favor of `keys` for semantic consistency ([#8388](https://github.com/parse-community/parse-server/issues/8388)) ([a49e323](https://github.com/parse-community/parse-server/commit/a49e323d5ae640bff1c6603ec37fdaddb9328dd1))
20+
* Export `AuthAdapter` to make it available for extension with custom authentication adapters ([#8443](https://github.com/parse-community/parse-server/issues/8443)) ([40c1961](https://github.com/parse-community/parse-server/commit/40c196153b8efa12ae384c1c0092b2ed60a260d6))
21+
122
# [6.0.0-alpha.35](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.34...6.0.0-alpha.35) (2023-02-27)
223

324

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "6.1.0-beta.1",
3+
"version": "6.1.0-alpha.2",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/MongoStorageAdapter.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
248248
expect(object.date[0] instanceof Date).toBeTrue();
249249
expect(object.bar.date[0] instanceof Date).toBeTrue();
250250
expect(object.foo.test.date[0] instanceof Date).toBeTrue();
251+
const obj = await new Parse.Query('MyClass').first({useMasterKey: true});
252+
expect(obj.get('date')[0] instanceof Date).toBeTrue();
253+
expect(obj.get('bar').date[0] instanceof Date).toBeTrue();
254+
expect(obj.get('foo').test.date[0] instanceof Date).toBeTrue();
251255
});
252256

253257
it('handles updating a single object with array, object date', done => {

src/Adapters/Auth/index.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import loadAdapter from '../AdapterLoader';
22
import Parse from 'parse/node';
3+
import AuthAdapter from './AuthAdapter';
34

45
const apple = require('./apple');
56
const gcenter = require('./gcenter');
@@ -153,22 +154,30 @@ function loadAuthAdapter(provider, authOptions) {
153154
return;
154155
}
155156

156-
const adapter = Object.assign({}, defaultAdapter);
157+
const adapter = defaultAdapter instanceof AuthAdapter ? defaultAdapter : Object.assign({}, defaultAdapter);
158+
const keys = [
159+
'validateAuthData',
160+
'validateAppId',
161+
'validateSetUp',
162+
'validateLogin',
163+
'validateUpdate',
164+
'challenge',
165+
'policy'
166+
];
167+
const defaultAuthAdapter = new AuthAdapter();
168+
keys.forEach(key => {
169+
const existing = adapter?.[key];
170+
if (existing && typeof existing === 'function' && existing.toString() === defaultAuthAdapter[key].toString()) {
171+
adapter[key] = null;
172+
}
173+
});
157174
const appIds = providerOptions ? providerOptions.appIds : undefined;
158175

159176
// Try the configuration methods
160177
if (providerOptions) {
161178
const optionalAdapter = loadAdapter(providerOptions, undefined, providerOptions);
162179
if (optionalAdapter) {
163-
[
164-
'validateAuthData',
165-
'validateAppId',
166-
'validateSetUp',
167-
'validateLogin',
168-
'validateUpdate',
169-
'challenge',
170-
'policy',
171-
].forEach(key => {
180+
keys.forEach(key => {
172181
if (optionalAdapter[key]) {
173182
adapter[key] = optionalAdapter[key];
174183
}

src/Adapters/Storage/Mongo/MongoTransform.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ const transformInteriorValue = restValue => {
188188
// Handle atomic values
189189
var value = transformInteriorAtom(restValue);
190190
if (value !== CannotTransform) {
191+
if (value && typeof value === 'object') {
192+
if (value instanceof Date) {
193+
return value;
194+
}
195+
if (value instanceof Array) {
196+
value = value.map(transformInteriorValue);
197+
} else {
198+
value = mapValues(value, transformInteriorValue);
199+
}
200+
}
191201
return value;
192202
}
193203

@@ -1014,9 +1024,6 @@ function mapValues(object, iterator) {
10141024
const result = {};
10151025
Object.keys(object).forEach(key => {
10161026
result[key] = iterator(object[key]);
1017-
if (result[key] && JSON.stringify(result[key]).includes(`"__type"`)) {
1018-
result[key] = mapValues(object[key], iterator);
1019-
}
10201027
});
10211028
return result;
10221029
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import RedisCacheAdapter from './Adapters/Cache/RedisCacheAdapter';
66
import LRUCacheAdapter from './Adapters/Cache/LRUCache.js';
77
import * as TestUtils from './TestUtils';
88
import * as SchemaMigrations from './SchemaMigrations/Migrations';
9+
import AuthAdapter from './Adapters/Auth/AuthAdapter';
910

1011
import { useExternal } from './deprecated';
1112
import { getLogger } from './logger';
@@ -43,4 +44,5 @@ export {
4344
ParseGraphQLServer,
4445
_ParseServer as ParseServer,
4546
SchemaMigrations,
47+
AuthAdapter,
4648
};

0 commit comments

Comments
 (0)