
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ncmb-react-native
Advanced tools
ニフクラ mobile backendをReact Nativeから操作するためのSDKです。詳細な使い方は[ブログ](https://blog.mbaas.nifcloud.com/archive/category/ReactNativeSDK)でもご覧いただけます。
ニフクラ mobile backendをReact Nativeから操作するためのSDKです。詳細な使い方はブログでもご覧いただけます。
v2から大幅に利用法が変わっています。v1のREADMEはこちら。
npm i ncmb-react-native -S
必要なものを取得してください。
import NCMB, { NCMBUser, NCMBObject, NCMBQuery,
NCMBFile, NCMBAcl, NCMBRole,
NCMBRequest, NCMBRelation, NCMBGeoPoint,
NCMBInstallation, NCMBPush } from 'ncmb-react-native';
const applicationKey = 'YOUR_APPLICATION_KEY';
const clientKey = 'YOUR_CLIENT_KEY';
new NCMB(applicationKey, clientKey);
const obj = new NCMBObject('Test');
await obj
.set('message', 'Hello, world')
.save();
const obj = new NCMBObject('Test');
await obj
.set('message', 'Hello, world')
.set('number', 500)
.set('date', new Date)
.set('object', {a: 'b', c: 'd'})
.set('array', [1, 2, 3, 'test'])
.save();
const obj = new NCMBObject('Test');
await obj
.set('message', 'Hello, world')
.save();
await obj
.set('message', 'Hello, again')
.save();
obj2.set('objectId', 'OBJECT_ID');
await obj2.fetch();
const obj = new NCMBObject('Test');
await obj
.set('num', 1)
.save();
await obj.setIncrement('num', 1).save();
await obj.fetch();
obj.get('num') // -> 2
const obj = new NCMBObject('Test');
await obj
.set('ary', ['first'])
.save();
await obj
.add('ary', 'second')
.save();
await obj.fetch();
obj.get('ary')) // -> ['first', 'second']
const obj = new NCMBObject('Test');
await obj
.set('ary', ['first', 'second'])
.save();
await obj
.remove('ary', 'second')
.save();
await obj.fetch();
obj.get('ary') // -> ['first']
const obj = new NCMBObject('Test');
await obj
.set('ary', ['first', 'second'])
.save();
await obj
.addUnique('ary', ['second', 'third'])
.save();
await obj.fetch();
obj.get('ary') // => ['first', 'second', 'third']
await obj.delete();
const obj = new NCMBObject('Test');
const geo = new NCMBGeoPoint(30.0, 130.0);
await obj
.set('geo', geo)
.save();
const query = new NCMBQuery('Test');
const ary = await query.fetchAll();
const query = new NCMBQuery('Test');
const {count, results} = await query.count().fetchWithCount();
const query = new NCMBQuery('Test');
const query1 = new NCMBQuery('Test');
const query2 = new NCMBQuery('Test');
query1.equalTo('number', 0);
query2.equalTo('number', 2);
const ary = await query.or([query1, query2]).fetchAll();
const queryTest = new NCMBQuery('Test');
const queryTest2 = new NCMBQuery('Test2');
queryTest2.in('num', [1,4]);
const ary = await queryTest
.select('number', 'num', queryTest2)
.fetchAll();
const queryTest = new NCMBQuery('Test');
const queryTest2 = new NCMBQuery('Test2');
queryTest.in('number', [1,4]);
const ary3 = await queryTest2
.inQuery('num', queryTest)
.include('num')
.fetchAll();
const tokyoTower = new NCMBGeoPoint(35.6585805, 139.7454329);
const query = new NCMBQuery('Station');
const ary = await query
.withinKilometers('geo', tokyoTower, 2)
.fetchAll();
const geo1 = new NCMBGeoPoint(35.6622568, 139.7148997);
const geo2 = new NCMBGeoPoint(35.6206607, 139.7049691);
const query = new NCMBQuery('Station');
const ary = await query
.withinSquare('geo', geo1, geo2)
.fetchAll();
const item1 = new NCMBObject('Test');
await item1.set('message', 'Hello, world from item1').save();
const item2 = new NCMBObject('Test');
await item2.set('message', 'Hello, world from item2').save();
const relation = new NCMBRelation('Test');
relation.add(item1).add(item2);
const mainObj = new NCMBObject('Main');
await mainObj.set('relation', relation).save();
const query = new NCMBQuery('Test');
const ary = await query
.relatedTo(mainObj, 'relation')
.fetchAll();
const relation = new NCMBRelation('Test');
relation.remove(item1);
await mainObj
.set('relation', relation)
.save();
const role = new NCMBRole;
role
.set('roleName', 'admin');
await role.save();
await role.delete();
await role.addUser(user).save();
const query = NCMBRole.query();
const role2 = await (query
.equalTo('roleName', roleName)
.fetch()) as NCMBRole;
const users = await role2.fetchUser();
const query = NCMBRole.query();
const role2 = await (query
.equalTo('roleName', roleName)
.fetch()) as NCMBRole;
await role
.addRole(role2)
.save();
const query = NCMBRole.query();
const role = await (query
.equalTo('roleName', roleName)
.fetch()) as NCMBRole;
const roles = await role
.fetchRole();
const user = new NCMBUser;
user
.set('userName', 'tester')
.set('password', 'tester');
await user.signUpByAccount();
await user.delete();
NCMBUser.logout();
await NCMBUser
.requestSignUpEmail(`test@example.com`);
const user = await NCMBUser
.login('tester', 'tester');
const user = await NCMBUser
.loginWithMailAddress(config.test.emailAddress, config.test.password);
LocalStrage系のインタフェースを持ったライブラリ、オブジェクトが利用できます。
ncmb.storage = LocalStorage;
想定
復元する場合
const user = await NCMBUser.currentUser();
const user = await NCMBUser.loginAsAnonymous();
NCMBUser.signUpWith(provider: string, authData: authData)
が公式対応しています。必要なパラメータ authData は公式ドキュメント(リンク先)を参照してください。
const fileName = 'test.csv';
const file = await NCMBFile.upload(fileName, '1,2,3');
const fileName = 'test.jpg';
const blob = await promisify(fs.readFile)(`./test/${fileName}`);
const file = await NCMBFile.upload(fileName, blob);
await file.delete();
const download = await file.download();
const download = await file.download('binary');
download.type // -> eg. image/jpeg
const download = await file.download('datauri');
const query = NCMBFile.query();
const files = await query.fetchAll();
// 検索
const files2 = await query.regularExpressionTo('fileName', /^.*?\.txt/).fetchAll();
const files3 = await query.greaterThan('fileSize', 8).fetchAll();
const acl = new NCMBAcl;
acl
.setPublicReadAccess(false)
.setUserWriteAccess(loginUser, true)
.setUserReadAccess(loginUser, true);
const text = '1,2,3';
const fileName = 'acl2.csv';
const file = await NCMBFile.upload(fileName, text, acl);
const installation = new NCMBInstallation;
await installation
.set('deviceToken', 'aaa')
.set('deviceType', 'ios')
.save();
const installation = new NCMBInstallation;
await installation
.set('deviceToken', 'aaa')
.set('deviceType', 'ios')
.set('message', 'Hi!')
.save();
await installation
.set('message', 'Hello')
.save();
await installation.fetch();
await installation.delete();
const query = NCMBInstallation.query();
const ary = await query
.fetchAll();
const push = new NCMBPush;
await push
.set('immediateDeliveryFlag', true)
.set('target', ['ios'])
.save();
await push.fetch();
const push = new NCMBPush;
await push
.set('immediateDeliveryFlag', true)
.set('message', 'Hello')
.set('target', ['ios'])
.save();
await push
.set('message', 'Hello, again')
.save();
const query = NCMBPush.query();
query
.equalTo('objectId', 'aaa');
const push = new NCMBPush;
await push
.set('immediateDeliveryFlag', true)
.set('message', 'Hello')
.set('searchCondition', query)
.set('target', ['ios'])
.save();
await push.delete());
MIT.
FAQs
ニフクラ mobile backendをReact Nativeから操作するためのSDKです。詳細な使い方は[ブログ](https://blog.mbaas.nifcloud.com/archive/category/ReactNativeSDK)でもご覧いただけます。
The npm package ncmb-react-native receives a total of 6 weekly downloads. As such, ncmb-react-native popularity was classified as not popular.
We found that ncmb-react-native demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.