Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
breeze-client
Advanced tools
Breeze data management for JavaScript clients.
See the docs for more info about what Breeze does and how to use it.
npm install breeze-client@next
Run npm run build
. This will create files in the '\dist' dir. The directory structure is the Angular Package Format.
adapter-*/ Breeze adapter definitions (*.d.ts) for ajax, data service, model library, and uri builder
bundles/ Breeze and adapter libraries in UMD
esm5/ Breeze and adapter libraries as ES5 modules (separate source files)
esm2015/ Breeze and adapter libraries as ES6 modules (separate source files)
fesm5/ Breeze and adapter libraries as ES5 modules (combined source files)
fesm2015/ Breeze and adapter libraries as ES6 modules (combined source files)
spec/ TypeScript definition files (.d.ts) for tests
src/ TypeScript definition files (.d.ts) for source
breeze-client.d.ts TypeScript definition file (links to the files in src/)
breeze-client.metadata.json Metadata for Angular AOT
index.d.ts Main entry point
LICENSE MIT
package.json Package metadata
public_api.d.ts Main entry point
It will also create breeze-client-{version}.tgz
in the main directory. This file can then be installed in a project using
npm install ..\{path}\breeze-client-{version}.tgz
Run npm run typedoc
. This will create a '\docs' dir. click on the 'index.html' in this folder to see the docs.
API is almost identical to the original (breezejs 1.x) but small changes are noted below:
Promise
object. The setQ
function is now a no-op.EntityStateSymbol
is now EntityState
.DataServiceOptions
interface is now DataServiceConfig
to be consistent with other naminginitializeAdapterInstances
method is removed; use the singular config.initializeAdapterInstance
method.The names of the adapter files have changed. E.g. breeze.dataService.webApi
is now adapter-data-service-webapi
,
and the locations have changed due to Angular-compatible bundling.
Also, the aggressive tree-shaking of tsickle/terser/webpack in Angular 8 removes the functions that the Breeze adapters use to register themselves! So you need to register them yourself.
If you have this:
import 'breeze-client/breeze.dataService.webApi';
import 'breeze-client/breeze.modelLibrary.backingStore';
import 'breeze-client/breeze.uriBuilder.odata';
import { BreezeBridgeHttpClientModule } from 'breeze-bridge2-angular';
Replace it with this:
import { DataServiceWebApiAdapter } from 'breeze-client/adapter-data-service-webapi';
import { ModelLibraryBackingStoreAdapter } from 'breeze-client/adapter-model-library-backing-store';
import { UriBuilderODataAdapter } from 'breeze-client/adapter-uri-builder-odata';
import { AjaxHttpClientAdapter } from 'breeze-client/adapter-ajax-httpclient';
Note that now you do not need breeze-bridge2-angular
, because the AjaxHttpClientAdapter is now part of the breeze-client package.
Then, in your constructor function (for your module or Entity Manager Provider):
constructor(http: HttpClient) {
// the order is important
ModelLibraryBackingStoreAdapter.register();
UriBuilderODataAdapter.register();
AjaxHttpClientAdapter.register(http);
DataServiceWebApiAdapter.register();
}
The above has been tested on Angular 7 and 8, and should work for earlier versions.
Note that if you are using Breeze .NET Core on the server, you should use
UriBuilderJsonAdapter
instead ofUriBuilderODataAdapter
.
For apps that use global JavaScript libraries, the UMD versions are still available, under the bundles
directory:
<script src="node_modules/breeze-client/bundles/breeze-client.umd.js"></script>
<script src="node_modules/breeze-client/bundles/breeze-client-adapter-model-library-backing-store.umd.js"></script>
<script src="node_modules/breeze-client/bundles/breeze-client-adapter-data-service-webapi.umd.js"></script>
<script src="node_modules/breeze-client/bundles/breeze-client-adapter-ajax-angularjs.umd.js"></script>
In general we have avoided using null parameters in favor of undefined parameters thoughout the API. This means that signatures will look like
a(p1: string, p2?: Entity)
as opposed to
a(p1: string, p2?: Entity | null);
This IS deliberate. In general, with very few exceptions input parameters will rarely say 'p: x | null'. The only exceptions are where we need to be able to pass a null parameter followed by one or more non null params. This is very rare. SaveEntities(entities: Entity[] | null, ...) is one exception.
Note that this is not a breaking change because the underlying code will always check for either a null or undefined. i.e. 'if (p2 == null) {' so this convention only affects typescript consumers of the api. Pure javascript users can still pass a null in ( if they want to)
Note that it is still acceptable for api calls to return a null to indicate that nothing was found. i.e. like getEntityType().
The tests are found in the spec
directory. There are three ways to run them.
1) From command line:
run npm install jasmine -g
( global install).
run npm run test
from top level breeze-client dir.
2) From VS code debugger:
add this section to 'launch.json'
{
"name": "Debug Jasmine Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jasmine/bin/jasmine.js",
"stopOnEntry": false,
"args": [
],
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"outDir": "${workspaceRoot}/dist"
}
Run npm install jasmine
(local install)
Set breakpoint and hit Ctrl-F5.
3) From Chrome debugger:
See Debugging Node.js with Chrome DevTools.
Open Chrome and go to chrome://inspect
Click on the link that says Open dedicated DevTools for Node
Put a debugger;
statement in your code where you want to start debugging
Run your Jasmine tests in debug mode
npm run debug
Go back to the browser. The --inspect-brk
(part of the npm run debug
script) tells the debugger to break on the first line of the first script. You're stopped inside of Jasmine. Now set your breakpoints, and click the arrow (or hit F8) to continue.
The original breeze.js repo contains thousands of tests, some of which are end-to-end and require a server backend. The tests are in breeze.js/test/internal/, and they expect to find a breeze.debug.js
file in
the neighboring directory, breeze.js/test/breeze/.
The breeze.debug.js
file is a UMD module containing the main breeze-client code and certain adapters. To build it, run
npm run copy-to-breezejs
That will create (or overwrite!) ../breeze.js/test/breeze/breeze.debug.js
.
Then you can launch the server, navigate to the test page, and run the test suite.
FAQs
Breeze data management for JavaScript clients
The npm package breeze-client receives a total of 2,097 weekly downloads. As such, breeze-client popularity was classified as popular.
We found that breeze-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.