How to use the parse-server/lib/cryptoUtils.newObjectId function in parse-server

To help you get started, we’ve selected a few parse-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benishak / parse-server-dynamodb-adapter / src / Partition.ts View on Github external
delete data.Attributes._pk_className;
                                    delete data.Attributes._sk_id;
                                    resolve({ ok : 1, n : 1, nModified : 1, value : data.Attributes });
                                } else {
                                    resolve({ ok : 1, n : 1, nModified : 1, value : null });
                                }
                            }
                        });
                    } else {
                        // here we do upserting
                        if (upsert) {
                            object = {
                                ...object['$set'],
                                ...object['$inc']
                            }
                            object['_id'] = newObjectId();
                            this.insertOne(object).then(
                                res => resolve({ ok : 1, n : 1, nModified : 1, value : res.ops[0] })
                            );
                        } else {
                            resolve({ ok : 1, n : 1, nModified : 1, value : null });
                        }
                    }   
                });
            }
github benishak / parse-server-dynamodb-adapter / spec / Adapter.spec.ts View on Github external
@test 'handles creating an array, object, date, file'(done) {
        const adapter = $;
        const objectId = newObjectId();
        const className = 'MyClass';

        const obj = {
            objectId : objectId,
            array: [1, 2, 3],
            object: {foo: 'bar'},
            date: {
                __type: 'Date',
                iso: '2016-05-26T20:55:01.154Z',
            },
            file: {
                __type: 'File',
                name: '7aefd44420d719adf65d16d52e688baf_license.txt',
                url: 'http://localhost:1337/files/app/7aefd44420d719adf65d16d52e688baf_license.txt' 
            }
        };
github benishak / parse-server-dynamodb-adapter / src / Partition.ts View on Github external
insertOne(object) : Promise {
        let id = object['_id'] || newObjectId();
        object['_id'] = id;

        let params : DynamoDB.DocumentClient.PutItemInput = {
            TableName : this.database,
            Item: {
                _pk_className : this.className,
                _sk_id : id,
                ...object
            },
            ExpressionAttributeNames : {
                '#id' : '_sk_id',
            },
            ConditionExpression : 'attribute_not_exists(#id)',
        }

        return new Promise(
github benishak / parse-server-dynamodb-adapter / spec / Adapter.spec.ts View on Github external
@test 'handles updating a single object with array, object, date'(done) {
        const adapter = $;
        const objectId = newObjectId();
        const className = 'MyClass';

        const schema = {
            fields: {
                array: { type: 'Array' },
                object: { type: 'Object' },
                date: { type: 'Date' },
            }
        };


        adapter.createObject(className, schema, { objectId: objectId })
        .then(() => adapter._rawFind(className))
        .then(results => {
            expect(results.length).to.be.equal(1);
            const update = {