Skip to content

Commit a2d3dbe

Browse files
authored
feat: Deprecation DEPPS10: Encode Parse.Object in Cloud Function and remove option encodeParseObjectInCloudFunction (#9973)
BREAKING CHANGE: This release encodes `Parse.Object` in Cloud Function and removes option `encodeParseObjectInCloudFunction` (Deprecation DEPPS10).
1 parent 5b68f7d commit a2d3dbe

File tree

10 files changed

+4
-40
lines changed

10 files changed

+4
-40
lines changed

DEPRECATIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
1313
| DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1414
| DEPPS8 | Login with expired 3rd party authentication token defaults to `false` | [#7079](https://github.com/parse-community/parse-server/pull/7079) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1515
| DEPPS9 | Rename LiveQuery `fields` option to `keys` | [#8389](https://github.com/parse-community/parse-server/issues/8389) | 6.0.0 (2023) | 7.0.0 (2024) | removed | - |
16-
| DEPPS10 | Encode `Parse.Object` in Cloud Function and remove option `encodeParseObjectInCloudFunction` | [#8634](https://github.com/parse-community/parse-server/issues/8634) | 6.2.0 (2023) | 9.0.0 (2026) | deprecated | - |
16+
| DEPPS10 | Encode `Parse.Object` in Cloud Function and remove option `encodeParseObjectInCloudFunction` | [#8634](https://github.com/parse-community/parse-server/issues/8634) | 6.2.0 (2023) | 9.0.0 (2026) | removed | - |
1717
| DEPPS11 | Replace `PublicAPIRouter` with `PagesRouter` | [#7625](https://github.com/parse-community/parse-server/issues/7625) | 8.0.0 (2025) | 9.0.0 (2026) | deprecated | - |
1818
| DEPPS12 | Database option `allowPublicExplain` will default to `true` | [#7519](https://github.com/parse-community/parse-server/issues/7519) | 8.5.0 (2025) | 9.0.0 (2026) | deprecated | - |
1919

spec/CloudCode.spec.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,28 +1702,7 @@ describe('Cloud Code', () => {
17021702
});
17031703
});
17041704

1705-
it('should not encode Parse Objects', async () => {
1706-
await reconfigureServer({ encodeParseObjectInCloudFunction: false });
1707-
const user = new Parse.User();
1708-
user.setUsername('username');
1709-
user.setPassword('password');
1710-
user.set('deleted', false);
1711-
await user.signUp();
1712-
Parse.Cloud.define(
1713-
'deleteAccount',
1714-
async req => {
1715-
expect(req.params.object instanceof Parse.Object).not.toBeTrue();
1716-
return 'Object deleted';
1717-
},
1718-
{
1719-
requireMaster: true,
1720-
}
1721-
);
1722-
await Parse.Cloud.run('deleteAccount', { object: user.toPointer() }, { useMasterKey: true });
1723-
});
1724-
1725-
it('allow cloud to encode Parse Objects', async () => {
1726-
await reconfigureServer({ encodeParseObjectInCloudFunction: true });
1705+
it('should encode Parse Objects in cloud functions', async () => {
17271706
const user = new Parse.User();
17281707
user.setUsername('username');
17291708
user.setPassword('password');

spec/ParseAPI.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,6 @@ describe('miscellaneous', () => {
12661266
});
12671267

12681268
it('test cloud function query parameters with array of pointers', async () => {
1269-
await reconfigureServer({ encodeParseObjectInCloudFunction: false });
12701269
Parse.Cloud.define('echoParams', req => {
12711270
return req.params;
12721271
});
@@ -1279,7 +1278,7 @@ describe('miscellaneous', () => {
12791278
method: 'POST',
12801279
headers: headers,
12811280
url: 'http://localhost:8378/1/functions/echoParams',
1282-
body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest" }]}',
1281+
body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest", "objectId": "test123" }]}',
12831282
});
12841283
const res = response.data.result;
12851284
expect(res.arr.length).toEqual(1);

spec/helper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ const defaultConfiguration = {
150150
shortLivedAuth: mockShortLivedAuth(),
151151
},
152152
allowClientClassCreation: true,
153-
encodeParseObjectInCloudFunction: true,
154153
};
155154

156155
if (silent) {

src/Deprecator/Deprecations.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* If there are no deprecations, this must return an empty array.
1717
*/
1818
module.exports = [
19-
{ optionKey: 'encodeParseObjectInCloudFunction', changeNewDefault: 'true' },
2019
{ optionKey: 'enableInsecureAuthAdapters', changeNewDefault: 'false' },
2120
{ optionKey: 'databaseOptions.allowPublicExplain', changeNewDefault: 'false' },
2221
];

src/Options/Definitions.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ module.exports.ParseServerOptions = {
255255
action: parsers.booleanParser,
256256
default: true,
257257
},
258-
encodeParseObjectInCloudFunction: {
259-
env: 'PARSE_SERVER_ENCODE_PARSE_OBJECT_IN_CLOUD_FUNCTION',
260-
help:
261-
'If set to `true`, a `Parse.Object` that is in the payload when calling a Cloud Function will be converted to an instance of `Parse.Object`. If `false`, the object will not be converted and instead be a plain JavaScript object, which contains the raw data of a `Parse.Object` but is not an actual instance of `Parse.Object`. Default is `false`. <br><br>\u2139\uFE0F The expected behavior would be that the object is converted to an instance of `Parse.Object`, so you would normally set this option to `true`. The default is `false` because this is a temporary option that has been introduced to avoid a breaking change when fixing a bug where JavaScript objects are not converted to actual instances of `Parse.Object`.',
262-
action: parsers.booleanParser,
263-
default: true,
264-
},
265258
encryptionKey: {
266259
env: 'PARSE_SERVER_ENCRYPTION_KEY',
267260
help: 'Key for encrypting your files',

src/Options/docs.js

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

src/Options/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ export interface ParseServerOptions {
223223
cacheAdapter: ?Adapter<CacheAdapter>;
224224
/* Adapter module for email sending */
225225
emailAdapter: ?Adapter<MailAdapter>;
226-
/* If set to `true`, a `Parse.Object` that is in the payload when calling a Cloud Function will be converted to an instance of `Parse.Object`. If `false`, the object will not be converted and instead be a plain JavaScript object, which contains the raw data of a `Parse.Object` but is not an actual instance of `Parse.Object`. Default is `false`. <br><br>ℹ️ The expected behavior would be that the object is converted to an instance of `Parse.Object`, so you would normally set this option to `true`. The default is `false` because this is a temporary option that has been introduced to avoid a breaking change when fixing a bug where JavaScript objects are not converted to actual instances of `Parse.Object`.
227-
:DEFAULT: true */
228-
encodeParseObjectInCloudFunction: ?boolean;
229226
/* Optional. The public URL to Parse Server. This URL will be used to reach Parse Server publicly for features like password reset and email verification links. The option can be set to a string or a function that can be asynchronously resolved. The returned URL string must start with `http://` or `https://`.
230227
:ENV: PARSE_PUBLIC_SERVER_URL */
231228
publicServerURL: ?(string | (() => string) | (() => Promise<string>));

src/Routers/FunctionsRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function parseObject(obj, config) {
1818
return Object.assign(new Date(obj.iso), obj);
1919
} else if (obj && obj.__type == 'File') {
2020
return Parse.File.fromJSON(obj);
21-
} else if (obj && obj.__type == 'Pointer' && config.encodeParseObjectInCloudFunction) {
21+
} else if (obj && obj.__type == 'Pointer') {
2222
return Parse.Object.fromJSON({
2323
__type: 'Pointer',
2424
className: obj.className,

types/Options/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export interface ParseServerOptions {
8484
passwordPolicy?: PasswordPolicyOptions;
8585
cacheAdapter?: Adapter<CacheAdapter>;
8686
emailAdapter?: Adapter<MailAdapter>;
87-
encodeParseObjectInCloudFunction?: boolean;
8887
publicServerURL?: string | (() => string) | (() => Promise<string>);
8988
pages?: PagesOptions;
9089
customPages?: CustomPagesOptions;

0 commit comments

Comments
 (0)