New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

can-connect

Package Overview
Dependencies
Maintainers
15
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-connect - npm Package Compare versions

Comparing version 3.0.0-pre.2 to 3.0.0-pre.3

8

base/base.js

@@ -44,2 +44,3 @@ var behavior = require("../behavior");

module.exports = behavior("base",function(baseConnection){
var setQueryLogic;
return {

@@ -157,3 +158,5 @@ /**

get queryLogic(){
if(baseConnection.queryLogic) {
if(setQueryLogic) {
return setQueryLogic;
} else if(baseConnection.queryLogic) {
return baseConnection.queryLogic;

@@ -163,2 +166,5 @@ } else if(baseConnection.algebra) {

}
},
set queryLogic(newVal) {
setQueryLogic = newVal;
}

@@ -165,0 +171,0 @@

@@ -19,3 +19,7 @@ var assign = require("can-reflect").assignMap;

var res = typeof behavior === "function" ? behavior.apply(newBehavior, arguments) : behavior;
assign(newBehavior, res);
for(var prop in res) {
if(res.hasOwnProperty(prop)) {
Object.defineProperty(newBehavior, prop, Object.getOwnPropertyDescriptor(res, prop));
}
}
newBehavior.__behaviorName = name;

@@ -22,0 +26,0 @@ return newBehavior;

39

can-connect.md

@@ -10,4 +10,3 @@ @module {function} can-connect

@description `can-connect` provides persisted data middleware. Assemble powerful model layers for any JavaScript
project from fully modularized behaviors (i.e. plugins).
@description `can-connect` provides persisted data middleware. Assemble powerful model layers from fully modularized behaviors (i.e. plugins).

@@ -22,4 +21,4 @@

import dataUrl from "can-connect/data/url/";
import constructor from "can-connect/constructor/";
const todosConnection = connect( [ dataUrl, constructor ], {
import connectConstructor from "can-connect/constructor/";
const todosConnection = connect( [ dataUrl, connectConstructor ], {
url: "/api/todos"

@@ -38,4 +37,26 @@ } );

`can-connect` includes behaviors that:
## Purpose
`can-connect` provides a wide variety of functionality useful for building
_data models_. _Data models_ are used to organize how an application
connects with persisted data. _Data models_ can greatly simplify higher order
functionality like components. Most commonly, `can-connect` is used to
create _data models_ that make it easy to create, retrieve, update, and
delete (CRUD) data by making HTTP requests to a backend server's service layer.
Unfortunately, there is a wide variety of service layer APIs. While REST, JSONAPI,
GRAPHQL and other specifications attempt to create a uniform service layer, a
one-size-all approach would leave many CanJS users having to build their own data layer from scratch.
Thus, `can-connect`'s primary design goal is flexibility and re-usability,
__not ease of use__. Some assembly is required! For easier, pre-assembled, _data models_,
checkout:
- [can-rest-model] - Connect a data type to a restful service layer.
- [can-realtime-rest-model] - Same as [can-rest-model], but adds automatic list management.
- [can-super-model] - Same as [can-realtime-rest-model], but adds fall-through localStorage caching.
`can-connect` includes behaviors used to assemble _data models_. It includes the
following behavior that:
Load data:

@@ -105,12 +126,4 @@

`can-connect` also provides several other non-behavior utilities for connection ease of use in CanJS:
- [can-connect/can/super-map/super-map] — Create a connection for [can-define/map/map can-define/map] or
[can-define/list/list can-define/list] types using nearly all behaviors.
- [can-connect/can/model/model] — Create [can-map] types that emulate the interface of
[can.Model](http://v2.canjs.com/docs/can.Model.html). Used for CanJS 2.x migrations.
- [can-connect/can/tag/tag] — Create a custom element that can load data into a template.
## Overview

@@ -117,0 +130,0 @@

@@ -270,5 +270,9 @@ var QUnit = require("steal-qunit");

var connection = this.connection;
connection.queryLogic = new canSet.Algebra(new canSet.Translate("where","$where"));
QUnit.stop();
connection.updateListData({ data: [{id: 1, placeId: 2, name: "J"}] }, {$where: {placeId: 2}}).then(function(){
connection.updateListData(
{ data: [{id: 1, placeId: 2, name: "J"}] },
{$where: {placeId: 2}}
).then(function(){
connection.updateData({id: 1, placeId: 2, name: "B"}).then(function(){

@@ -275,0 +279,0 @@ connection.getListData({$where: {placeId: 2}}).then(function(items){

@@ -42,3 +42,3 @@ /**

*
* To correct this, you can configure `data-parse` to use the [can-connect/data/parse/parse.parseListProp] and [connection.parseInstanceProp]
* To correct this, you can configure `data-parse` to use the [can-connect/data/parse/parse.parseListProp] and [can-connect/data/parse/parse.parseInstanceProp]
* as follows:

@@ -172,3 +172,3 @@ *

*
* This function will use [connection.parseInstanceProp] to find the data object
* This function will use [can-connect/data/parse/parse.parseInstanceProp] to find the data object
* representing the instance that will be created.

@@ -279,3 +279,3 @@ *

/**
* @property {String} connection.parseInstanceProp parseInstanceProp
* @property {String} can-connect/data/parse/parse.parseInstanceProp parseInstanceProp
* @parent can-connect/data/parse/parse

@@ -282,0 +282,0 @@ *

{
"name": "can-connect",
"version": "3.0.0-pre.2",
"version": "3.0.0-pre.3",
"description": "Data connection middleware and utilities",

@@ -5,0 +5,0 @@ "main": "can-connect.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc