Using CloudKit v1 you could save a record like this:
function demoSaveRecord(recordName,recordChangeTag,zoneName,name,location,asset) {
var container = CloudKit.getDefaultContainer();
var privateDB = container.privateCloudDatabase;
var record = {
recordType: 'Items',
fields: {
name: { value: name }, ...
}
};
return privateDB.saveRecord(record,options)
.then(function(response) {
if (response.hasErrors) {
// Handle the errors in your app.
throw response.errors[0];
} else {
// It worked
var createdRecord = response.records[0];
}
});
}
But in CloudKit JS v2 they removed the .saveRecord option.
So now I'm stuck because I can't figure out how to save a record in v2. If anybody can help me, or can show me good documentation for v2, please help.
CloudKit JS API diffs v2 https://developer.apple.com/library/content/releasenotes/General/CloudKitJS_v2_APIDiffs/JavaScript/CloudKitJS.html