GithubHelp home page GithubHelp logo

baqend / js-sdk Goto Github PK

View Code? Open in Web Editor NEW
26.0 13.0 12.0 24.12 MB

Baqend JavaScript SDK and CLI for High-Performance Websites

Home Page: https://www.baqend.com

License: MIT License

JavaScript 47.63% TypeScript 51.37% HTML 0.68% Shell 0.32%
baqend javascript sdk baas backend-as-a-service serverless

js-sdk's Introduction

Baqend JavaScript SDK

=======================

Baqend JavaScript SDK and CLI for High-Performance Websites

Please review the contribution guide for information on how to contribute to this project before supplying a merge request.

Rules

  • New fixes, features or other code work is done in separate branches. Please refer to the contribution guide for branch naming rules and other rules on contributing to this project.
  • Regularily (at leas once a day) rebase your feature branch onto the master branch. This will make sure, that you're working on the most up-to-date code. The chance for merge conflicts is much lower as well.

CLI

Baqend provides a CLI to easily manage your app. Install it by typing npm install -g baqend. Afterwards you can use the baqend command in your terminal.

If you don't already have a Baqend account, type baqend register to create your first app. Now you can open the dashboard of your app with baqend dashboard. To see all the command use baqend help.

Setup

To use the Baqend SDK, just include the baqend.js or baqend.min.js from the dist folder at the bottom of your body.
Alternatively you can install the Baqend SDK with npm. Just type npm install baqend
Or download the latest release directly from GitHub.

<!-- for legacy browsers -->
<script nomodule type="text/javascript" src="dist/baqend.es5.min.js"></script>
<!-- for browsers with module support -->
<script type="module" src="dist/baqend.es2015.min.js"></script>

You can use unpkg.com to directly load the dependency into your browser

<!-- for legacy browsers -->
<script nomodule type="text/javascript" src="https://unpkg.com/baqend@3/dist/baqend.es5.min.js"></script>
<!-- for browsers with module support -->
<script type="module" src="https://unpkg.com/baqend@3/dist/baqend.es2015.min.js"></script>

The Baqend SDK provides a global Baqend variable by default.

Initialize

Before you can actually use the Baqend SDK, you must link the Baqend SDK to your Baqend Account. Just call Baqend.db.connect(<your Baqend APP>) after including the Baqend SDK.

The Baqend SDK connects to your Baqend and initialize the SDK. If the connection was successfully established the ready callback will be called, and the db can be used to load, query and save objects.

<script type="module">
import { db } from 'https://unpkg.com/baqend@3/dist/baqend.es2015.min.js';

// connects to your Baqend Accounts example app
db.connect('example');

// Or pass false as a second parameter for an unencrypted connection (not recommended)
db.connect('example', false);

// For custom deployments i.e. the community edition use:
db.connect('https://baqend.example.com/v1');

// waits while the SDK connects to your Baqend
await db.ready();

// work with your Baqend instance
db.User.find()

</script>

Upgrading from 2.x

There are may some steps required to upgrade to the v3 version if you have previously used our v2 release.

We recommend changing your current imports to use the new ES2015 module structure of the SDK. Therefore, you should migrate your code to use the new ES2015 module imports:

<script type="module">
import { db, util } from 'https://unpkg.com/baqend@3/dist/baqend.es2015.min.js';

await db.connect('<your-app>');
const result = await db.MyClass.find().resultList();
result.forEach(object => {
    ...
})

You may change some import path. With node 14+ you can't require any specific subpath directly anymore. Accessing subpackages of the SDK can now be made by importing the submodule and use the modules from it:

import { util, metamodel } from 'baqend';

// generates a random uuid
util.uuid()

To enable better tree shaking support we have moved some classes from the util submodule to the new intersection submodule. The classes can still be accessed through the util module, but a deprecation warning will be logged. You should change the imports from util to intersection to fix the warning.

import { util, intersection } from 'baqend';

util.Permission() // access via util is deprecated
intersection.Permission() // change it by improting from the new submodule

If you have previously relied on the global DB variable, you must expose the global DB variable manually now. This will provide you with all the exports which were available in the 2.x release of the SDK:

window.DB = Baqend.db;

await DB.connect('<your-app>');
const result = await DB.MyClass.find().resultList();
...

We have dropped the cryptojs dependency and have replaced it with a native implementation of node.js / browser APIs. As a direct result, we have to change the signature of file.url -> string to an asynchronous version of it by providing
file.createURL() -> Promise<string> as a new method. Accessing the old property file.url will throw an exception.

All previously shipped shims are removed from our bundles to make the overall library size smaller. If you still need to support old Browsers e.g. IE, ensure that you will bundle a Promise shim to let the SDK work properly.

We have improved the typescript support by providing better typings. You may experience some new typescript errors since the typings are more precise in many cases.

Baqend Real-Time SDK

If you want to use real-time queries, you must include Rx.js in your project as well. The realtime components are now core part of v3 release of the SDK and no alternative module must be used.

The Rx.js module will be loaded as a optional peer dependency from the global Rx variable or will be required via. require('rxjs') call. If rxjs can't be loaded the realtime components of the SDK will throw an exception.

You can use the unpkg CDN to get all dependencies:

<script type="text/javascript" src="https://unpkg.com/rxjs/bundles/rxjs.umd.min.js"></script>
<!-- include the SDK after rxjs -->
<script type="module">
import { db } from 'https://unpkg.com/baqend@3/dist/baqend.es2015.js';

await db.connect('<your-app>');
const observable = db.MyClass.find().resultStream();
observable.subscribe((result) => {
    result.forEach(object => {
        ...
    })
})
</script>

Usage in Node.js

The Baqend SDK can also be used in Node.js. Just do an npm install baqend and use require('baqend') for old node environments or import { db } from 'baqend' in your code.

Up to Node.js v12

const { db } = require('baqend');

// connects to your Baqend Accounts example app
db.connect('example');

// waits while the SDK connects to your Baqend
db.ready(function() {
    // work with your Baqend
    db.User.find()
        ...
});

Node.js v13+

import { db } from 'baqend';

// connects to your Baqend Accounts example app 
// and waits while the SDK connects to your Baqend
await db.connect('example');

// work with your Baqend
await db.User.find()
   ...

Note: The Baqend Real-Time SDK can be used by just installing Rx.js as well npm install rxjs

License

This Baqend SDK is published under the very permissive MIT license

js-sdk's People

Contributors

baqend-ci avatar divinetraube avatar erikwitt avatar fbuecklers avatar gittegit avatar hannes-k avatar julianschenkemeyer avatar kddc avatar ksm2 avatar malte-lau avatar mndfcked avatar sonukurien avatar wingerath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-sdk's Issues

Depth loading leads to a lot of additional requests

Hey there,

it is me again *narf :).

I played around a little bit deeper and i do not get it why the "depth" option leads to such a mass of additional requests.

e.g. I have blog Posts -> connected to a Set of Comments and Tags.

When i do the following:

db.Post.find().resultList({depth: 1})

There is a request for each comment. What is quite heavy and costs time, bandwidth and requests ;).

I would expect (from a mongodb/mongoose background) that there is one request populateing the comments and retrieve them as a list.

`baqend deploy` skips first file in files array

Hey,

I just noticed that a file from my static files deployment was missing. I did some digging and stumbled upon this line:

const file = files[index += 1];

index += 1 evaluates to the updated value of index, so the first element in files is always skipped.

I'm sure it could be fixed easily by moving the update expression out of the array index:

const file = files[index];
index += 1

Data serialization in SSR mode is not possible

If you use a SSR framework like Next.js or Nuxt.js you can't use the Baqend JS SDK properly. Serialization and therefore correct client side hydration is not possible. This has to do with non-POJOs that can't be serialized on the server.

Because of that the framework triggers another call (client-side) on first render to Baqend to fetch the same data.

tl;dr: I don't know if this will ever be possible because the serialization can't handle functions or non-POJOs.

Modify Schema from javascript SDK

Is it possible to modify the schema from the clien (javascript SDK)t? Am I missing functionality already here?

I would like to make changes programmatically. Perhaps this should be guarded with Roles.

I spent some time digging into the documentation but didn't find anything suggesting that this could be done, but I very well may be overlooking.

Baqend Speed Kit Plesk - Joomla Site Almost No Acceleration

Hello,

I have a Joomla Site with Speed Kit for Plesk.

Before activating Speed Kit for the domain Speed Kit predicted a speed increase that would result in a loading time of around 500ms.

After activating Speed Kit the result is just a faktor of 1.1 to 1.8 depending whether I turn of a separate css and js acceleration plugin and the gzip compression within Joomla.

The page loading time is not near 500ms it's around 4 to 6 seconds.

Info: Newest Joomla version, PHP 7.3, around 25 elements to load with the Joomla compression plugin active and around 50 with it deactivated, page size around 2.5 MB.

Is there something I should check or configure to improve the result? Or is the acceleration generally not working so well with Joomla?

Thanks for your help.

Can't find variable: open

I am trying to start a Facebook oAuth login flow from my expo.io app with the following code:

_PressLearnMore = () => { db.User.loginWithFacebook("xxx").then((user) => { db.User.me == user; }); };

An error raises immediately:

Can't find variable: open
EntityManager.js:976:9

Support mobX.js observables

Please visit this issue for clarification:
mobxjs/mobx#1468

the main problem is that mobx observables won't react to changes on the Proxy-properties returned by baqend. the author of mobx claims that this cannot be an issue with mobx itself but the implementation of the proxy. somehow it is not possible to make them observable.

my workaround for this is to create an object-literal from to proxy-data with .toJSON() and re-create the Proxy later when saving, deleting etc. via .fromJSON(). This kind of works but is not free of implications when handling Dates or Files.

See my workaround:

function createViewModel<T>(
    Class: binding.EntityFactory<any>,
    item: binding.Entity,
    type?: misc.Type,
    refViewModel?: misc.ViewModel
): T {
    const viewModel: T & misc.ViewModel<T> = item.toJSON({
        depth: true
    }) as any;

    // convert all date-values and images
    [...Object.keys(Class.prototype), 'key'].forEach(key =>
        preserveItemValues(item, key, viewModel)
    );

    viewModel.restore = async function() {
        // `fromJSON` doesn't consider Dates
        // specify which dates will be formated
        const keepValues = Object.entries(this).reduce(
            (memo, [key, value]) => {
                if (value instanceof Date) {
                    return [...memo, { key, value }];
                }

                return memo;
            },
            [] as { key: string; value: any }[]
        );

        const item = Class.fromJSON(this);

        // assign values to be kept
        keepValues.forEach(({ key, value }) => (item[key] = value));

        // sync changes back to ref-viewModel
        if (refViewModel) {
            Object.keys(Class.prototype).forEach(key => {
                refViewModel[key] = this[key];
            });
        }

        return item;
    };

    viewModel.ref = item;
    viewModel.type = type;
    viewModel.isViewmodel = true;

    return viewModel;
}

I would love to see real support for mobx observables in the future :)

Titaniumifier –– library for Titanium

Hi,
I tried to build ti.Module by titaniumifier and cloned this branch to my machine.
In the root I started:

titaniumifier --out dist

and got:

/usr/local/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/promise.js:677
            throw e;
                  ^
Error: Cannot find module 'jahcode' from '/Users/fuerst/Documents/APPC_WORKSPACE/TiBaqend/lib'

Its right there is no jahcode in the repo. How can I fix it?

The automated release is failing 🚨

🚨 The automated release from the prerelease branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the prerelease branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.

Good luck with your project ✨

Your semantic-release bot 📦🚀

Failed to minify Metadata.js when building app

Hi,
For evaluation purpose I tried to build the application and it showed the following error

Failed to minify the code from this file:
./node_modules/baqend/lib/util/Metadata.js:12

Apparently it doesn't affect the produced application.

"Precondition Failed - 412" when using the depth option on queries

Hey!

I'm updating an old app, and thought I'd try to update the baqend SDK it uses.

After updating from 2.14.1 to 3.1.4, I keep on getting

{
    "status": 412,
    "message": "Precondition Failed"
}

On seemingly all the queries that use the depth option, for example

import {db as baqend} from 'baqend'

baqend.ActivityCategory
    .find()
    .equal('id', category)
    .singleResult({depth: 1})

I sadly don't have the time to troubleshoot this further now, maybe there's just something weird in our setup.

I'll get back to troubleshooting sometime next week. Do you have any suggestions until then, @fbuecklers? 🤞

Deploy: "App not found" while app name is correct

When I try to deploy via CLI I get the message

App not found.

while app name is fully correct. I used the CLI like: baqend deploy -F build app-name. baqend apps lists my app correctly and the possibility of typing errors is excluded.

SDK with Fusetools works on iOS and Mac but not on Android

I had to modify some parts of the baqend.js to make it work with Fusetools. The changes were required because Fusetools does not support window.sessionStorage but it has a shim for window.localStorage so i just changed the sessionStorage to localStorage.

Besides that in different places it tries to access the browser window api but as Fuse doesn't support it I had to change those parts as well. i.e I made the isChrome variable to False by default, similarly I changed
if (secure === undefined) { secure = window.location.protocol == 'https:'; }

to

if (secure === undefined) { secure = false; }

and this line: xhr.upload.onprogress = message.progress(); to this xhr.onprogress = message.progress();

These changes made it successfully work on local preview on MacOS and iOS but doesn't work on Android.

I hope together we can find a solution for it.

Thanks

Auto-generated typings incorrect for binding.File

When auto-generating typescript typing via baqend typings my-app, the typing for Files are incorrect.

F.e.

interface Notification extends binding.Entity {
      date: Date;
      image: undefined;
 }

the image is undefined although it's a File.
it should look like this

interface Notification extends binding.Entity {
      date: Date;
      image: binding.File;
 }

Same goes for typings with File in a List Array<undefined> -> Array<binding.File>.

A note: afaik Array typings are supossed to be written in the synatax binding.File[] and not Array<binding.File>.

Linebreaks and new lines are not save in Attributes type String

hey there,

i recognized that if i try to save text of an textarea with newlines, the line breaks are gone after i save the entry.

I want to store markdown in a next step of my blog application and without linebreaks this would be difficult.

Is this known or unwanted or is there something like special type for that purpose?

Thanks in advance.

Realtime-Queries for Community Edition

Hey, i just went through the toodle example on your website and then wanted to try the realtime queries … adjusted it to to use baquend/realtime + resultStream but im getting this error in Chrome 70:

WebSocket connection to 'wss://toodle.app.baqend.com/v1/events' failed: Error during WebSocket handshake: Unexpected response code: 404 at baqend-realtime.js:19644

Are the realtime features not supported by this example (and community edition)?

No warning for weird connection state

I'm using Baqend with next.js which leads to the problem that my code is run server side and client side which makes connecting to Baqend a bit of a problem because I don't have one single point in my applications lifecycle where I can connect.
My solution was this piece of code

BaqendApi.connect = function() {
  return new Promise((resolve, reject) => {
    if (DB.User) {
      resolve();
    } else {
      DB.ready(resolve);
      if (!BaqendApi.connecting) {
        BaqendApi.connecting = true;
        BaqendApi.connected = true;
        console.log("Connecting to Baqend");
        DB.connect(Config.baqendApp);
      }
    }
  });
};

As you can see this function returns a promise that resolves once Baqend is connected (mostly immediately).
While I was developing I forgot to call this function before doing some Baqend stuff and I could still load objects from Baqend but not update them.

DB.Page.load("/db/Page/d42c5a70-d301-41ab-bb8e-9fc47def0d4e").then(response => {
    response.route = "/test";
    response.save().then(r => {
      console.log(r);
    })
  });

This code would print the correctly updated object on the console but there was only one GET request being made. No update or save request was sent to Baqend.

let thing = new DB.Thing({type: "Test", data: data});
return thing.insert();

This code however would correctly insert the object. My ACL was set to public on everything so that was not the cause.

I'm sure this has something to do with the whole server side connection, client side connection, hot reload jimbo jambo that is going on on my end but it would still be nice to get an error of some kind if I call update and there isn't even a request being send.

How to mock js-sdk for unit testing

Heyho,

i am playing around with baqend + angular 2 and i am at a point, where i want to test a service, that is using baqend.

So how can i easily mock/stub the db object?

SDK not working with Expo React Native

On Android only, when I create a new project in Expo and then install baqend like this:

npm install baqend --save

Then use it in the project by importing it:
import { db } from 'baqend';

The android emulator (and my phone) starts throwing errors.

At first I thought maybe it was one of the other libraries I'm using, but in order to track this down, I started a brand new project in Expo, then started added packages one at a time.

Here's the package.json:

{
  "name": "my-new-project",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "baqend": "2.8.5",
    "expo": "29.0.0",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
    "react-navigation": "^2.9.3"
  },
  "devDependencies": {
    "jest-expo": "29.0.0"
  }
}

Now you will notice that in the above I'm using 2.8.5. I tested several releases while troubleshooting and found that 2.8.5 and lower produces one error. The more recent releases produce a different error.

2.8.5 version procudes this errror (on the packager):
/Documents/my-new-project/node_modules/baqend/dist/baqend.js: Unknown plugin "transform-proto-to-assign" specified in "/Users/chris/Documents/my-new-project/node_modules/baqend/.babelrc" at 0, attempted to resolve relative to "/Users/chris/Documents/my-new-project/node_modules/baqend"

And this error on the Android emulator (Android 7):

The development server returned response error code: 500

URL: http://localhost:19003/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fchris%2FDocuments%2Fmy-new-project%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles

Body:
{"type":"TransformError","lineNumber":0,"errors":[{"description":"/Users/chris/Documents/my-new-project/node_modules/baqend/dist/baqend.js: Unknown plugin \"transform-proto-to-assign\" specified in \"/Users/chris/Documents/my-new-project/node_modules/baqend/.babelrc\" at 0, attempted to resolve relative to \"/Users/chris/Documents/my-new-project/node_modules/baqend\"","lineNumber":0}],"name":"SyntaxError","message":"/Users/chris/Documents/my-new-project/node_modules/baqend/dist/baqend.js: Unknown plugin \"transform-proto-to-assign\" specified in \"/Users/chris/Documents/my-new-project/node_modules/baqend/.babelrc\" at 0, attempted to resolve relative to \"/Users/chris/Documents/my-new-project/node_modules/baqend\"","stack":"ReferenceError: Unknown plugin \"transform-proto-to-assign\" specified in \"/Users/chris/Documents/my-new-project/node_modules/baqend/.babelrc\" at 0, attempted to resolve relative to \"/Users/chris/Documents/my-new-project/node_modules/baqend\"\n    at /Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17\n    at Array.map (native)\n    at Function.normalisePlugins (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)\n    at OptionManager.mergeOptions (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)\n    at OptionManager.init (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)\n    at File.initOptions (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/index.js:212:65)\n    at new File (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/file/index.js:135:24)\n    at Pipeline.transform (/Users/chris/Documents/my-new-project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)\n    at Object.transform (/Users/chris/Documents/my-new-project/node_modules/metro/src/transformer.js:135:5)"}
processBundleResult
    BundleDownloader.java:268
access$200
    BundleDownloader.java:35
onChunkComplete
    BundleDownloader.java:195
emitChunk
    MultipartStreamReader.java:76
readAllParts
    MultipartStreamReader.java:154
processMultipartResponse
    BundleDownloader.java:179
access$100
    BundleDownloader.java:35
onResponse
    BundleDownloader.java:148
execute
    RealCall.java:135
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1162
run
    ThreadPoolExecutor.java:636
run
    Thread.java:764

Now, when I use any version greater than 2.8.5 I get a different error.

Here is the error using 2.12.3 (in this case its the error is only on the phone, no errors in the packager):

is not iterable!
exports
   _for-of.js:14:51
<unknown>
   _collection.js:61:41
Set
   es6.set.js:8:37
<unknown>
   Asset.js:21:30
loadModuleImplementation
   require.js:214:12
guardedLoadModule
   require.js:141:45
_require
   require.js:132:20
Asset
   index.js:3:11
Asset
   Expo.js:62:33
_callee$
   App.js:32:6
tryCatch
   runtime.js:62:44
invoke
   runtime.js:296:30
<unknown>
   runtime.js:114:28
tryCatch
   runtime.js:62:44
invoke
   runtime.js:152:28
<unknown>
   runtime.js:195:17
tryCallTwo
   core.js:45:7
doResolve
   core.js:200:23
Promise
   core.js:66:12
callInvokeWithMethodAndArg
   runtime.js:194:27
enqueue
   runtime.js:217:12
<unknown>
   runtime.js:114:28
async
   runtime.js:241:8
_callee
   App.js:30:24
_callee$
   AppLoading.js:48:12
tryCatch
   runtime.js:62:44
invoke
   runtime.js:296:30
<unknown>
   runtime.js:114:28
tryCatch
   runtime.js:62:44
invoke
   runtime.js:152:28
<unknown>
   runtime.js:195:17
tryCallTwo
   core.js:45:7
doResolve
   core.js:200:23
Promise
   core.js:66:12
callInvokeWithMethodAndArg
   runtime.js:194:27
enqueue
   runtime.js:217:12
<unknown>
   runtime.js:114:28
async
   runtime.js:241:8
_callee
   AppLoading.js:42:35
componentDidMount
   AppLoading.js:31:6
proxiedComponentDidMount
   createPrototypeProxy.js:61:45
commitLifeCycles
   ReactNativeRenderer-dev.js:10627:12
commitAllLifeCycles
   ReactNativeRenderer-dev.js:12512:10
invokeGuardedCallback
   ReactNativeRenderer-dev.js:39:15
invokeGuardedCallback
   ReactNativeRenderer-dev.js:221:34
commitRoot
   ReactNativeRenderer-dev.js:12677:10
completeRoot
   ReactNativeRenderer-dev.js:13685:46
performWorkOnRoot
   ReactNativeRenderer-dev.js:13635:23
performWork
   ReactNativeRenderer-dev.js:13545:26
performSyncWork
   ReactNativeRenderer-dev.js:13506:16
requestWork
   ReactNativeRenderer-dev.js:13392:6
scheduleWorkImpl
   ReactNativeRenderer-dev.js:13259:24
scheduleWork
   ReactNativeRenderer-dev.js:13207:28
scheduleRootUpdate
   ReactNativeRenderer-dev.js:13930:17
_updateContainerAtExpirationTime
   ReactNativeRenderer-dev.js:13966:6
updateContainer
   ReactNativeRenderer-dev.js:13991:8
render
   ReactNativeRenderer-dev.js:14726:35
renderApplication
   renderApplication.js:49:21
run
   AppRegistry.js:102:10
runApplication
   AppRegistry.js:194:26
__callFunction
   MessageQueue.js:351:47
<unknown>
   MessageQueue.js:116:26
__guardSafe
   MessageQueue.js:314:6
callFunctionReturnFlushedQueue
   MessageQueue.js:115:17

What would be awesome is for the latest version of the sdk to work on the latest version of expo.

To replicate:

In expo, create "my new project" use Tabbed Navigation preset.

Open it up on your android phone over wifi or use the android emulator. It works fine.

Now go to the newly created my-new-project folder and run npm install baqend --save this installs 2.12.3.

Then open up /screens/HomeScreen.js and add import { db } from 'baqend' to the top

Save it. Restart packager. Re-open project on your phone or emulator. Error happens as app starts.

Please let me know if I can help fix this. I'm not a really a developer but I'll do what I can.

Not compatible with RxJs 6

Using baqend 2.13.0 in angular 7 project.

There is a compile time error after using resultStream() instead of resultList().

Error:

   Type 'import("/home/harishm/xxx/node_modules/baqend/node_modules/rxjs/Observable").Observable<any>' is not assignable to type 'import("/home/harishm/xxx/node_modules/rxjs/internal/Observable").Observable<any>'.
      Property 'operator' is protected in type 'Observable<any>' but public in type 'Observable<any>'. [2322]

rxjs/internal/Observable is conflicting with /rxjs/Observable

image

Accessing Files

Hey there,

i've tried to show an image in my app.
I have a model with an attribute preview_image of type File and an reference to a file in /file/www/images/....

Now i want to show this image in my app using the way provided in your guide.

let file = new db.File(post.preview_image)

But it does not work.
I tried the other approach like:

post.load()

or

db.Post.resultList({ depth: true})

to get all referenced objects without an extra operation.
But with no luck.

How should i do it?

Thanks you!

Typing for db.File.headers

I'd like to point out, that the typing for db.File.headers is a little off. Sure, it's an object, but this leads to the side-effect that I cannot access any property on it without re-casting it to any.

Can you change its type to any?

Question react-redux: How to create Entity from JSON with new reference

Hey there,

i have a short question:

I play around with baqend and react + react-redux. https://github.com/KillerCodeMonkey/baqend-blog-admin-react/tree/redux

The problem is, that the reducers should not manipulate the state directly. They should return new instances of objects or arrays, so the change-detection works and the views are rendered again.
I have a model called "Post". If an action updates a post like

post.save().then(updatedPost => dispatch(....)) 

the associated reducers are listening to this, but needs to return the post as a new object.

I tried something like that:

const postJSON = Object.assign({}, action.post.toJSON(), { acl: null })

return db.Post.fromJSON(postJSON)
  1. Transforming the Post-instance to plain json (avoid errors --> set acl to null)
  2. create a Post with fromJSON function

Sadly i get exact the same reference.

Do you have any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.