diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md index 6ac20b46..8d4d7e1a 100644 --- a/DEPRECATIONS.md +++ b/DEPRECATIONS.md @@ -13,7 +13,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h | 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 | - | | 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 | - | | 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 | - | -| 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 | - | +| 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 | - | | DEPPS11 | Replace `PublicAPIRouter` with `PagesRouter` | [#7625](https://github.com/parse-community/parse-server/issues/7625) | 8.0.0 (2025) | 9.0.0 (2026) | deprecated | - | | 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 | - | diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index b2aac473..400efbc3 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -1702,28 +1702,7 @@ describe('Cloud Code', () => { }); }); - it('should not encode Parse Objects', async () => { - await reconfigureServer({ encodeParseObjectInCloudFunction: false }); - const user = new Parse.User(); - user.setUsername('username'); - user.setPassword('password'); - user.set('deleted', false); - await user.signUp(); - Parse.Cloud.define( - 'deleteAccount', - async req => { - expect(req.params.object instanceof Parse.Object).not.toBeTrue(); - return 'Object deleted'; - }, - { - requireMaster: true, - } - ); - await Parse.Cloud.run('deleteAccount', { object: user.toPointer() }, { useMasterKey: true }); - }); - - it('allow cloud to encode Parse Objects', async () => { - await reconfigureServer({ encodeParseObjectInCloudFunction: true }); + it('should encode Parse Objects in cloud functions', async () => { const user = new Parse.User(); user.setUsername('username'); user.setPassword('password'); diff --git a/spec/ParseAPI.spec.js b/spec/ParseAPI.spec.js index 779a97c9..8cfe9ef0 100644 --- a/spec/ParseAPI.spec.js +++ b/spec/ParseAPI.spec.js @@ -1266,7 +1266,6 @@ describe('miscellaneous', () => { }); it('test cloud function query parameters with array of pointers', async () => { - await reconfigureServer({ encodeParseObjectInCloudFunction: false }); Parse.Cloud.define('echoParams', req => { return req.params; }); @@ -1279,7 +1278,7 @@ describe('miscellaneous', () => { method: 'POST', headers: headers, url: 'http://localhost:8378/1/functions/echoParams', - body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest" }]}', + body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest", "objectId": "test123" }]}', }); const res = response.data.result; expect(res.arr.length).toEqual(1); diff --git a/spec/helper.js b/spec/helper.js index 43b5ceeb..e8299d11 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -150,7 +150,6 @@ const defaultConfiguration = { shortLivedAuth: mockShortLivedAuth(), }, allowClientClassCreation: true, - encodeParseObjectInCloudFunction: true, }; if (silent) { diff --git a/src/Deprecator/Deprecations.js b/src/Deprecator/Deprecations.js index c63225f5..a8a9be2e 100644 --- a/src/Deprecator/Deprecations.js +++ b/src/Deprecator/Deprecations.js @@ -16,7 +16,6 @@ * If there are no deprecations, this must return an empty array. */ module.exports = [ - { optionKey: 'encodeParseObjectInCloudFunction', changeNewDefault: 'true' }, { optionKey: 'enableInsecureAuthAdapters', changeNewDefault: 'false' }, { optionKey: 'databaseOptions.allowPublicExplain', changeNewDefault: 'false' }, ]; diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index 8fa173d6..57dd3378 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -255,13 +255,6 @@ module.exports.ParseServerOptions = { action: parsers.booleanParser, default: true, }, - encodeParseObjectInCloudFunction: { - env: 'PARSE_SERVER_ENCODE_PARSE_OBJECT_IN_CLOUD_FUNCTION', - help: - '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`.

\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`.', - action: parsers.booleanParser, - default: true, - }, encryptionKey: { env: 'PARSE_SERVER_ENCRYPTION_KEY', help: 'Key for encrypting your files', diff --git a/src/Options/docs.js b/src/Options/docs.js index 60bbf022..2380c771 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -46,7 +46,6 @@ * @property {Boolean} enableExpressErrorHandler Enables the default express error handler for all errors * @property {Boolean} enableInsecureAuthAdapters Enable (or disable) insecure auth adapters, defaults to true. Insecure auth adapters are deprecated and it is recommended to disable them. * @property {Boolean} enableSanitizedErrorResponse If set to `true`, error details are removed from error messages in responses to client requests, and instead a generic error message is sent. Default is `true`. - * @property {Boolean} encodeParseObjectInCloudFunction 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`.

ℹ️ 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`. * @property {String} encryptionKey Key for encrypting your files * @property {Boolean} enforcePrivateUsers Set to true if new users should be created without public read and write access. * @property {Boolean} expireInactiveSessions Sets whether we should expire the inactive sessions, defaults to true. If false, all new sessions are created with no expiration date. diff --git a/src/Options/index.js b/src/Options/index.js index 9ff66b30..fbfe13b7 100644 --- a/src/Options/index.js +++ b/src/Options/index.js @@ -223,9 +223,6 @@ export interface ParseServerOptions { cacheAdapter: ?Adapter; /* Adapter module for email sending */ emailAdapter: ?Adapter; - /* 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`.

ℹ️ 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`. - :DEFAULT: true */ - encodeParseObjectInCloudFunction: ?boolean; /* 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://`. :ENV: PARSE_PUBLIC_SERVER_URL */ publicServerURL: ?(string | (() => string) | (() => Promise)); diff --git a/src/Routers/FunctionsRouter.js b/src/Routers/FunctionsRouter.js index 2e56a1b4..9720e467 100644 --- a/src/Routers/FunctionsRouter.js +++ b/src/Routers/FunctionsRouter.js @@ -18,7 +18,7 @@ function parseObject(obj, config) { return Object.assign(new Date(obj.iso), obj); } else if (obj && obj.__type == 'File') { return Parse.File.fromJSON(obj); - } else if (obj && obj.__type == 'Pointer' && config.encodeParseObjectInCloudFunction) { + } else if (obj && obj.__type == 'Pointer') { return Parse.Object.fromJSON({ __type: 'Pointer', className: obj.className, diff --git a/types/Options/index.d.ts b/types/Options/index.d.ts index ad110506..42e64022 100644 --- a/types/Options/index.d.ts +++ b/types/Options/index.d.ts @@ -84,7 +84,6 @@ export interface ParseServerOptions { passwordPolicy?: PasswordPolicyOptions; cacheAdapter?: Adapter; emailAdapter?: Adapter; - encodeParseObjectInCloudFunction?: boolean; publicServerURL?: string | (() => string) | (() => Promise); pages?: PagesOptions; customPages?: CustomPagesOptions;