Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@galette/core

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@galette/core - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

26

dist/hydra/HydraCollection.js
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,16 +16,18 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
const Collection_1 = __importDefault(require("../store/Collection"));
var Collection_1 = __importDefault(require("../store/Collection"));
function collectionStructureFromHydraResponse(hydraResponse) {
const items = hydraResponse['hydra:member'] || [];
var items = hydraResponse['hydra:member'] || [];
return {
items,
items: items,
};
}
exports.collectionStructureFromHydraResponse = collectionStructureFromHydraResponse;
class HydraCollection extends Collection_1.default {
constructor(response) {
super(collectionStructureFromHydraResponse(response));
var HydraCollection = /** @class */ (function (_super) {
__extends(HydraCollection, _super);
function HydraCollection(response) {
return _super.call(this, collectionStructureFromHydraResponse(response)) || this;
}
}
return HydraCollection;
}(Collection_1.default));
exports.default = HydraCollection;
//# sourceMappingURL=HydraCollection.js.map

@@ -6,5 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const HydraCollection_1 = __importDefault(require("./HydraCollection"));
var HydraCollection_1 = __importDefault(require("./HydraCollection"));
exports.HydraCollection = HydraCollection_1.default;
const redux_1 = require("./redux");
var redux_1 = require("./redux");
exports.reduceList = redux_1.reduceList;

@@ -11,0 +11,0 @@ exports.reduceItems = redux_1.reduceItems;

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -12,10 +20,10 @@ var t = {};

Object.defineProperty(exports, "__esModule", { value: true });
const reducers_1 = require("../store/redux/reducers");
const addDefaultHydraOptions = (options) => {
const { payloadResolver } = options, rest = __rest(options, ["payloadResolver"]);
return Object.assign({ itemIdentifierResolver: (item) => {
var reducers_1 = require("../store/redux/reducers");
var addDefaultHydraOptions = function (options) {
var payloadResolver = options.payloadResolver, rest = __rest(options, ["payloadResolver"]);
return __assign({ itemIdentifierResolver: function (item) {
return item['@id'];
}, items: (action) => {
}, items: function (action) {
return payloadResolver(action)['hydra:member'] || [];
}, totalItems: (action) => {
}, totalItems: function (action) {
return payloadResolver(action)['hydra:totalItems'];

@@ -22,0 +30,0 @@ } }, rest);

@@ -13,10 +13,10 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const store = __importStar(require("./store"));
var store = __importStar(require("./store"));
exports.store = store;
const hydra = __importStar(require("./hydra"));
var hydra = __importStar(require("./hydra"));
exports.hydra = hydra;
const ram = __importStar(require("./redux-api-middleware"));
var ram = __importStar(require("./redux-api-middleware"));
exports.ram = ram;
const factory_1 = __importDefault(require("./typed-action-creator/factory"));
var factory_1 = __importDefault(require("./typed-action-creator/factory"));
exports.typedActionCreatorFactory = factory_1.default;
//# sourceMappingURL=index.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
let CALL_API;
var CALL_API;
try {

@@ -10,6 +18,7 @@ CALL_API = require("redux-api-middleware").CALL_API;

}
const functions_1 = require("../store/redux/functions");
var functions_1 = require("../store/redux/functions");
exports.createReducer = functions_1.createMappedReducer;
// BC-layer end
function createApiCallReducer(actionName) {
var _a;
return exports.createReducer({

@@ -19,23 +28,25 @@ result: null,

loading: false
}, {
[actionName + "_SENT"](state) {
return Object.assign({}, state, { loading: true, error: null });
}, (_a = {},
_a[actionName + "_SENT"] = function (state) {
return __assign({}, state, { loading: true, error: null });
},
[actionName + "_RECEIVED"](state, action) {
return Object.assign({}, state, { loading: false, result: action.payload, error: null });
_a[actionName + "_RECEIVED"] = function (state, action) {
return __assign({}, state, { loading: false, result: action.payload, error: null });
},
[actionName + "_FAILED"](state, action) {
return Object.assign({}, state, { loading: false, error: action.payload });
_a[actionName + "_FAILED"] = function (state, action) {
return __assign({}, state, { loading: false, error: action.payload });
},
});
_a));
}
exports.createApiCallReducer = createApiCallReducer;
function createApiCallAction(actionName, call, meta = {}) {
return {
[CALL_API]: Object.assign({}, call, { types: [
{ type: actionName + "_SENT", meta },
{ type: actionName + "_RECEIVED", meta },
{ type: actionName + "_FAILED", meta }
] })
};
function createApiCallAction(actionName, call, meta) {
if (meta === void 0) { meta = {}; }
var _a;
return _a = {},
_a[CALL_API] = __assign({}, call, { types: [
{ type: actionName + "_SENT", meta: meta },
{ type: actionName + "_RECEIVED", meta: meta },
{ type: actionName + "_FAILED", meta: meta }
] }),
_a;
}

@@ -42,0 +53,0 @@ exports.createApiCallAction = createApiCallAction;

@@ -10,4 +10,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const functions = __importStar(require("./functions"));
var functions = __importStar(require("./functions"));
exports.functions = functions;
//# sourceMappingURL=index.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
class Collection {
constructor(structure) {
var Collection = /** @class */ (function () {
function Collection(structure) {
this.structure = structure;
}
items() {
Collection.prototype.items = function () {
return this.structure.items || [];
}
filter(callback) {
return new Collection(Object.assign({}, this.structure, { items: this.items().filter(callback) }));
}
map(callback) {
return new Collection(Object.assign({}, this.structure, { items: this.items().map(callback) }));
}
hasError() {
};
Collection.prototype.filter = function (callback) {
return new Collection(__assign({}, this.structure, { items: this.items().filter(callback) }));
};
Collection.prototype.map = function (callback) {
return new Collection(__assign({}, this.structure, { items: this.items().map(callback) }));
};
Collection.prototype.hasError = function () {
return !!this.structure.error;
}
isLoading() {
};
Collection.prototype.isLoading = function () {
return this.structure.loading || false;
}
getPage() {
};
Collection.prototype.getPage = function () {
return this.structure.up_to_page;
}
hasMore() {
};
Collection.prototype.hasMore = function () {
if (this.structure.total_items === undefined) {

@@ -30,5 +38,6 @@ return true;

return this.structure.total_items > this.items().length;
}
}
};
return Collection;
}());
exports.default = Collection;
//# sourceMappingURL=Collection.js.map

@@ -13,10 +13,10 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Collection_1 = __importDefault(require("./Collection"));
var Collection_1 = __importDefault(require("./Collection"));
exports.Collection = Collection_1.default;
const reducers = __importStar(require("./redux/reducers"));
var reducers = __importStar(require("./redux/reducers"));
exports.reducers = reducers;
const functions = __importStar(require("./redux/functions"));
var functions = __importStar(require("./redux/functions"));
exports.functions = functions;
const selectors = __importStar(require("./redux/selectors"));
var selectors = __importStar(require("./redux/selectors"));
exports.selectors = selectors;
//# sourceMappingURL=index.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateItem = (state = {}, itemIdentifier, itemState) => {
return Object.assign({}, state, { [itemIdentifier]: Object.assign({}, (state[itemIdentifier] || {}), itemState) });
exports.updateItem = function (state, itemIdentifier, itemState) {
if (state === void 0) { state = {}; }
var _a;
return __assign({}, state, (_a = {}, _a[itemIdentifier] = __assign({}, (state[itemIdentifier] || {}), itemState), _a));
};
function createMappedReducer(initialState, mapping) {
return (state = initialState, action) => {
return function (state, action) {
if (state === void 0) { state = initialState; }
if (action.type in mapping) {

@@ -9,0 +20,0 @@ return mapping[action.type](state, action);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const functions_1 = require("./functions");
exports.reduceListAndItems = (state = {}, action, options) => {
var functions_1 = require("./functions");
exports.reduceListAndItems = function (state, action, options) {
if (state === void 0) { state = {}; }
return exports.reduceList(exports.reduceItems(state, action, options), action, options);
};
function itemsFromAction(action, options) {
let items = 'function' === typeof options.items
var items = 'function' === typeof options.items
? options.items(action)

@@ -16,6 +17,7 @@ : options.items;

}
exports.reduceItems = (state = {}, action, options) => {
let items = itemsFromAction(action, options);
for (let i = 0; i < items.length; i++) {
const item = items[i];
exports.reduceItems = function (state, action, options) {
if (state === void 0) { state = {}; }
var items = itemsFromAction(action, options);
for (var i = 0; i < items.length; i++) {
var item = items[i];
state = functions_1.updateItem(state, options.itemIdentifierResolver(item), item);

@@ -25,3 +27,4 @@ }

};
exports.reduceList = (state = {}, action, options) => {
exports.reduceList = function (state, action, options) {
if (state === void 0) { state = {}; }
if (options.actionPrefix) {

@@ -45,8 +48,8 @@ options.actions = {

if (action.type === options.actions.succeed) {
const items = itemsFromAction(action, options);
const totalItems = 'function' === typeof options.totalItems
var items = itemsFromAction(action, options);
var totalItems = 'function' === typeof options.totalItems
? options.totalItems(action)
: undefined;
const loadedIdentifiers = items.map(options.itemIdentifierResolver);
const identifiers = action.meta && state[options.listKeyInState].up_to_page < action.meta.page
var loadedIdentifiers = items.map(options.itemIdentifierResolver);
var identifiers = action.meta && state[options.listKeyInState].up_to_page < action.meta.page
// Adds

@@ -57,3 +60,3 @@ ? state[options.listKeyInState].identifiers.concat(loadedIdentifiers)

return functions_1.updateItem(state, options.listKeyInState, {
identifiers,
identifiers: identifiers,
up_to_page: action.meta && action.meta.page,

@@ -60,0 +63,0 @@ loading: false,

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const defaultList = {
var defaultList = {
identifiers: [],
};
exports.collectionWithItems = (state, listKeyInState, options = {}) => {
let list = Object.assign({}, defaultList, state[listKeyInState]);
list.items = list.identifiers.map((identifier) => {
const item = options.itemResolver ? options.itemResolver(identifier) : state[identifier];
exports.collectionWithItems = function (state, listKeyInState, options) {
if (options === void 0) { options = {}; }
var list = __assign({}, defaultList, state[listKeyInState]);
list.items = list.identifiers.map(function (identifier) {
var item = options.itemResolver ? options.itemResolver(identifier) : state[identifier];
if (!item) {

@@ -15,5 +24,5 @@ console.warn('Could not find item ', identifier);

return item;
}).filter((item) => item !== undefined);
}).filter(function (item) { return item !== undefined; });
return list;
};
//# sourceMappingURL=selectors.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
function typedActionCreatorFactory(type, resolver) {
const creator = (...args) => {
const properties = resolver.apply(null, args);
return Object.assign({ type }, properties);
var creator = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var properties = resolver.apply(null, args);
return __assign({ type: type }, properties);
};
return Object.assign(creator, {
type
type: type
});

@@ -11,0 +23,0 @@ }

{
"name": "@galette/core",
"version": "0.0.7",
"version": "0.0.8",
"scripts": {

@@ -5,0 +5,0 @@ "build": "npm run build-ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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