Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
159 changes: 56 additions & 103 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"bcryptjs": "3.0.2",
"commander": "13.1.0",
"cors": "2.8.5",
"deepcopy": "2.1.0",
"express": "5.2.1",
"express-rate-limit": "7.5.1",
"follow-redirects": "1.15.9",
Expand Down
9 changes: 4 additions & 5 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import _ from 'lodash';
// @flow-disable-next
import intersect from 'intersect';
// @flow-disable-next
import deepcopy from 'deepcopy';
import logger from '../logger';
import Utils from '../Utils';
import * as SchemaController from './SchemaController';
Expand Down Expand Up @@ -502,7 +501,7 @@ class DatabaseController {
const originalQuery = query;
const originalUpdate = update;
// Make a copy of the object, so we don't mutate the incoming data.
update = deepcopy(update);
update = structuredClone(update);
var relationUpdates = [];
var isMaster = acl === undefined;
var aclGroup = acl || [];
Expand Down Expand Up @@ -1092,7 +1091,7 @@ class DatabaseController {
this.addInObjectIdsIds(ids, query);
return this.reduceRelationKeys(className, query, queryOptions);
})
.then(() => {});
.then(() => { });
}
}

Expand Down Expand Up @@ -1543,8 +1542,8 @@ class DatabaseController {
const fieldDescriptor = schema.getExpectedType(className, key);
const fieldType =
fieldDescriptor &&
typeof fieldDescriptor === 'object' &&
Object.prototype.hasOwnProperty.call(fieldDescriptor, 'type')
typeof fieldDescriptor === 'object' &&
Object.prototype.hasOwnProperty.call(fieldDescriptor, 'type')
? fieldDescriptor.type
: null;

Expand Down
5 changes: 2 additions & 3 deletions src/Controllers/SchemaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import DatabaseController from './DatabaseController';
import Config from '../Config';
import { createSanitizedError } from '../Error';
// @flow-disable-next
import deepcopy from 'deepcopy';
import type {
Schema,
SchemaFields,
Expand Down Expand Up @@ -573,7 +572,7 @@ class SchemaData {
if (!this.__data[schema.className]) {
const data = {};
data.fields = injectDefaultSchema(schema).fields;
data.classLevelPermissions = deepcopy(schema.classLevelPermissions);
data.classLevelPermissions = structuredClone(schema.classLevelPermissions);
data.indexes = schema.indexes;

const classProtectedFields = this.__protectedFields[schema.className];
Expand Down Expand Up @@ -768,7 +767,7 @@ export default class SchemaController {
throw err;
}
)
.then(() => {});
.then(() => { });
return this.reloadDataPromise;
}

Expand Down
3 changes: 1 addition & 2 deletions src/GraphQL/loaders/functionsMutations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { GraphQLNonNull, GraphQLEnumType } from 'graphql';
import deepcopy from 'deepcopy';
import { mutationWithClientMutationId } from 'graphql-relay';
import { FunctionsRouter } from '../../Routers/FunctionsRouter';
import * as defaultGraphQLTypes from './defaultGraphQLTypes';
Expand Down Expand Up @@ -44,7 +43,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context) => {
try {
const { functionName, params } = deepcopy(args);
const { functionName, params } = structuredClone(args);
const { config, auth, info } = context;

return {
Expand Down
7 changes: 3 additions & 4 deletions src/GraphQL/loaders/parseClassMutations.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { GraphQLNonNull } from 'graphql';
import { fromGlobalId, mutationWithClientMutationId } from 'graphql-relay';
import getFieldNames from 'graphql-list-fields';
import deepcopy from 'deepcopy';
import * as defaultGraphQLTypes from './defaultGraphQLTypes';
import { extractKeysAndInclude, getParseClassMutationConfig } from '../parseGraphQLUtils';
import * as objectsMutations from '../helpers/objectsMutations';
Expand Down Expand Up @@ -75,7 +74,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
let { fields } = deepcopy(args);
let { fields } = structuredClone(args);
if (!fields) { fields = {}; }
const { config, auth, info } = context;

Expand Down Expand Up @@ -178,7 +177,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
let { id, fields } = deepcopy(args);
let { id, fields } = structuredClone(args);
if (!fields) { fields = {}; }
const { config, auth, info } = context;

Expand Down Expand Up @@ -284,7 +283,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
let { id } = deepcopy(args);
let { id } = structuredClone(args);
const { config, auth, info } = context;

const globalIdObject = fromGlobalId(id);
Expand Down
5 changes: 2 additions & 3 deletions src/GraphQL/loaders/parseClassQueries.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { GraphQLNonNull } from 'graphql';
import { fromGlobalId } from 'graphql-relay';
import getFieldNames from 'graphql-list-fields';
import deepcopy from 'deepcopy';
import pluralize from 'pluralize';
import * as defaultGraphQLTypes from './defaultGraphQLTypes';
import * as objectsQueries from '../helpers/objectsQueries';
Expand Down Expand Up @@ -75,7 +74,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
return await getQuery(
parseClass,
_source,
deepcopy(args),
structuredClone(args),
context,
queryInfo,
parseGraphQLSchema.parseClasses
Expand All @@ -99,7 +98,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
async resolve(_source, args, context, queryInfo) {
try {
// Deep copy args to avoid internal re assign issue
const { where, order, skip, first, after, last, before, options } = deepcopy(args);
const { where, order, skip, first, after, last, before, options } = structuredClone(args);
const { readPreference, includeReadPreference, subqueryReadPreference } = options || {};
const { config, auth, info } = context;
const selectedFields = getFieldNames(queryInfo);
Expand Down
7 changes: 3 additions & 4 deletions src/GraphQL/loaders/schemaMutations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Parse from 'parse/node';
import { GraphQLNonNull } from 'graphql';
import deepcopy from 'deepcopy';
import { mutationWithClientMutationId } from 'graphql-relay';
import * as schemaTypes from './schemaTypes';
import { transformToParse, transformToGraphQL } from '../transformers/schemaFields';
Expand Down Expand Up @@ -28,7 +27,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context) => {
try {
const { name, schemaFields } = deepcopy(args);
const { name, schemaFields } = structuredClone(args);
const { config, auth } = context;

enforceMasterKeyAccess(auth, config);
Expand Down Expand Up @@ -78,7 +77,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context) => {
try {
const { name, schemaFields } = deepcopy(args);
const { name, schemaFields } = structuredClone(args);
const { config, auth } = context;

enforceMasterKeyAccess(auth, config);
Expand Down Expand Up @@ -130,7 +129,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context) => {
try {
const { name } = deepcopy(args);
const { name } = structuredClone(args);
const { config, auth } = context;

enforceMasterKeyAccess(auth, config);
Expand Down
3 changes: 1 addition & 2 deletions src/GraphQL/loaders/schemaQueries.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Parse from 'parse/node';
import deepcopy from 'deepcopy';
import { GraphQLNonNull, GraphQLList } from 'graphql';
import { transformToGraphQL } from '../transformers/schemaFields';
import * as schemaTypes from './schemaTypes';
Expand Down Expand Up @@ -28,7 +27,7 @@ const load = parseGraphQLSchema => {
type: new GraphQLNonNull(schemaTypes.CLASS),
resolve: async (_source, args, context) => {
try {
const { name } = deepcopy(args);
const { name } = structuredClone(args);
const { config, auth } = context;

enforceMasterKeyAccess(auth, config);
Expand Down
7 changes: 3 additions & 4 deletions src/GraphQL/loaders/usersMutations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GraphQLNonNull, GraphQLString, GraphQLBoolean, GraphQLInputObjectType } from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay';
import deepcopy from 'deepcopy';
import UsersRouter from '../../Routers/UsersRouter';
import * as objectsMutations from '../helpers/objectsMutations';
import { OBJECT } from './defaultGraphQLTypes';
Expand Down Expand Up @@ -32,7 +31,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
const { fields } = deepcopy(args);
const { fields } = structuredClone(args);
const { config, auth, info } = context;

const parseFields = await transformTypes('create', fields, {
Expand Down Expand Up @@ -109,7 +108,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
const { fields, authData } = deepcopy(args);
const { fields, authData } = structuredClone(args);
const { config, auth, info } = context;

const parseFields = await transformTypes('create', fields, {
Expand Down Expand Up @@ -173,7 +172,7 @@ const load = parseGraphQLSchema => {
},
mutateAndGetPayload: async (args, context, mutationInfo) => {
try {
const { username, password, authData } = deepcopy(args);
const { username, password, authData } = structuredClone(args);
const { config, auth, info } = context;

const { sessionToken, objectId, authDataResponse } = (
Expand Down
29 changes: 14 additions & 15 deletions src/LiveQuery/ParseLiveQueryServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { LRUCache as LRU } from 'lru-cache';
import UserRouter from '../Routers/UsersRouter';
import DatabaseController from '../Controllers/DatabaseController';
import { isDeepStrictEqual } from 'util';
import deepcopy from 'deepcopy';

class ParseLiveQueryServer {
server: any;
Expand Down Expand Up @@ -256,7 +255,7 @@ class ParseLiveQueryServer {
Client.pushError(client.parseWebSocket, error.code, error.message, false, requestId);
logger.error(
`Failed running afterLiveQueryEvent on class ${className} for event ${res.event} with session ${res.sessionToken} with:\n Error: ` +
JSON.stringify(error)
JSON.stringify(error)
);
}
});
Expand Down Expand Up @@ -417,7 +416,7 @@ class ParseLiveQueryServer {
Client.pushError(client.parseWebSocket, error.code, error.message, false, requestId);
logger.error(
`Failed running afterLiveQueryEvent on class ${className} for event ${res.event} with session ${res.sessionToken} with:\n Error: ` +
JSON.stringify(error)
JSON.stringify(error)
);
}
});
Expand Down Expand Up @@ -524,7 +523,7 @@ class ParseLiveQueryServer {
if (!parseObject) {
return false;
}
return matchesQuery(deepcopy(parseObject), subscription.query);
return matchesQuery(structuredClone(parseObject), subscription.query);
}

async _clearCachedRoles(userId: string) {
Expand Down Expand Up @@ -821,7 +820,7 @@ class ParseLiveQueryServer {
Client.pushError(parseWebsocket, error.code, error.message, false);
logger.error(
`Failed running beforeConnect for session ${request.sessionToken} with:\n Error: ` +
JSON.stringify(error)
JSON.stringify(error)
);
}
}
Expand Down Expand Up @@ -964,7 +963,7 @@ class ParseLiveQueryServer {
Client.pushError(parseWebsocket, error.code, error.message, false, request.requestId);
logger.error(
`Failed running beforeSubscribe on ${className} for session ${request.sessionToken} with:\n Error: ` +
JSON.stringify(error)
JSON.stringify(error)
);
}
}
Expand Down Expand Up @@ -994,8 +993,8 @@ class ParseLiveQueryServer {
parseWebsocket,
2,
'Cannot find client with clientId ' +
parseWebsocket.clientId +
'. Make sure you connect to live query server before unsubscribing.'
parseWebsocket.clientId +
'. Make sure you connect to live query server before unsubscribing.'
);
logger.error('Can not find this client ' + parseWebsocket.clientId);
return;
Expand All @@ -1007,16 +1006,16 @@ class ParseLiveQueryServer {
parseWebsocket,
2,
'Cannot find subscription with clientId ' +
parseWebsocket.clientId +
' subscriptionId ' +
requestId +
'. Make sure you subscribe to live query server before unsubscribing.'
parseWebsocket.clientId +
' subscriptionId ' +
requestId +
'. Make sure you subscribe to live query server before unsubscribing.'
);
logger.error(
'Can not find subscription with clientId ' +
parseWebsocket.clientId +
' subscriptionId ' +
requestId
parseWebsocket.clientId +
' subscriptionId ' +
requestId
);
return;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Push/PushWorker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// @flow-disable-next
import deepcopy from 'deepcopy';
import AdaptableController from '../Controllers/AdaptableController';
import { master } from '../Auth';
import Config from '../Config';
Expand Down Expand Up @@ -91,7 +90,7 @@ export class PushWorker {

// Map the on the badges count and return the send result
const promises = Object.keys(badgeInstallationsMap).map(badge => {
const payload = deepcopy(body);
const payload = structuredClone(body);
payload.data.badge = parseInt(badge);
const installations = badgeInstallationsMap[badge];
return this.sendToAdapter(payload, installations, pushStatus, config, UTCOffset);
Expand Down
5 changes: 2 additions & 3 deletions src/Push/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Parse from 'parse/node';
import deepcopy from 'deepcopy';

export function isPushIncrementing(body) {
if (!body.data || !body.data.badge) {
Expand Down Expand Up @@ -45,7 +44,7 @@ export function transformPushBodyForLocale(body, locale) {
if (!data) {
return body;
}
body = deepcopy(body);
body = structuredClone(body);
localizableKeys.forEach(key => {
const localeValue = body.data[`${key}-${locale}`];
if (localeValue) {
Expand Down Expand Up @@ -128,7 +127,7 @@ export function validatePushType(where = {}, validPushTypes = []) {
}

export function applyDeviceTokenExists(where) {
where = deepcopy(where);
where = structuredClone(where);
if (!Object.prototype.hasOwnProperty.call(where, 'deviceToken')) {
where['deviceToken'] = { $exists: true };
}
Expand Down
Loading
Loading