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

@lu-development/pi-xstate-fetch

Package Overview
Dependencies
Maintainers
13
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lu-development/pi-xstate-fetch - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

8

dist/enums.d.ts

@@ -1,2 +0,2 @@

export declare const enum fetchStates {
export declare enum fetchStates {
IDLE = "idle",

@@ -8,3 +8,3 @@ FETCHING = "fetching",

}
export declare const enum fetchEvents {
export declare enum fetchEvents {
RETRY = "RETRY",

@@ -14,9 +14,9 @@ FAIL = "FAIL",

}
export declare const enum eventsForFetchMachinesParent {
export declare enum eventsForFetchMachinesParent {
FETCHSUCCESS = "FETCH_SUCCESS",
FETCHFAILED = "FETCH_FAILED"
}
export declare const enum FetchMethods {
export declare enum FetchMethods {
GET = "GET",
POST = "POST"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FetchMethods = exports.eventsForFetchMachinesParent = exports.fetchEvents = exports.fetchStates = void 0;
var fetchStates;
(function (fetchStates) {
fetchStates["IDLE"] = "idle";
fetchStates["FETCHING"] = "fetching";
fetchStates["PROCESSING_FAILURE"] = "processingFailure";
fetchStates["FAILED"] = "failed";
fetchStates["SUCCESS"] = "success";
})(fetchStates = exports.fetchStates || (exports.fetchStates = {}));
var fetchEvents;
(function (fetchEvents) {
fetchEvents["RETRY"] = "RETRY";
fetchEvents["FAIL"] = "FAIL";
fetchEvents["FETCH_SERVICE_SUCCESS"] = "done.invoke.fetchServiceInvoker";
})(fetchEvents = exports.fetchEvents || (exports.fetchEvents = {}));
var eventsForFetchMachinesParent;
(function (eventsForFetchMachinesParent) {
eventsForFetchMachinesParent["FETCHSUCCESS"] = "FETCH_SUCCESS";
eventsForFetchMachinesParent["FETCHFAILED"] = "FETCH_FAILED";
})(eventsForFetchMachinesParent = exports.eventsForFetchMachinesParent || (exports.eventsForFetchMachinesParent = {}));
var FetchMethods;
(function (FetchMethods) {
FetchMethods["GET"] = "GET";
FetchMethods["POST"] = "POST";
})(FetchMethods = exports.FetchMethods || (exports.FetchMethods = {}));

@@ -8,2 +8,3 @@ "use strict";

var fetch_service_1 = require("./services/fetch-service");
var enums_1 = require("./enums");
exports.fetchModel = (0, model_1.createModel)({

@@ -19,5 +20,5 @@ requestMethod: 'GET',

events: (_a = {},
_a["RETRY" /* RETRY */] = function () { return ({}); },
_a["FAIL" /* FAIL */] = function (error) { return ({ error: error }); },
_a["done.invoke.fetchServiceInvoker" /* FETCH_SERVICE_SUCCESS */] = function (data) { return ({ data: data }); },
_a[enums_1.fetchEvents.RETRY] = function () { return ({}); },
_a[enums_1.fetchEvents.FAIL] = function (error) { return ({ error: error }); },
_a[enums_1.fetchEvents.FETCH_SERVICE_SUCCESS] = function (data) { return ({ data: data }); },
_a),

@@ -32,6 +33,6 @@ });

if (context.retriesAllowed > 0) {
callback("RETRY" /* RETRY */, { delay: context.delayBetweenRetriesMilliseconds });
callback(enums_1.fetchEvents.RETRY, { delay: context.delayBetweenRetriesMilliseconds });
}
else {
callback({ type: "FAIL" /* FAIL */, error: event.data });
callback({ type: enums_1.fetchEvents.FAIL, error: event.data });
}

@@ -43,9 +44,9 @@ }; };

id: 'fetch',
initial: "idle" /* IDLE */,
initial: enums_1.fetchStates.IDLE,
context: exports.fetchModel.initialContext,
states: (_b = {},
_b["idle" /* IDLE */] = {
always: "fetching" /* FETCHING */,
_b[enums_1.fetchStates.IDLE] = {
always: enums_1.fetchStates.FETCHING,
},
_b["fetching" /* FETCHING */] = {
_b[enums_1.fetchStates.FETCHING] = {
invoke: {

@@ -55,10 +56,10 @@ id: 'fetchServiceInvoker',

onDone: {
target: "success" /* SUCCESS */,
target: enums_1.fetchStates.SUCCESS,
},
onError: {
target: "processingFailure" /* PROCESSING_FAILURE */,
target: enums_1.fetchStates.PROCESSING_FAILURE,
},
},
},
_b["processingFailure" /* PROCESSING_FAILURE */] = {
_b[enums_1.fetchStates.PROCESSING_FAILURE] = {
invoke: {

@@ -70,11 +71,11 @@ id: 'processFetchFailure',

on: (_c = {},
_c["RETRY" /* RETRY */] = "idle" /* IDLE */,
_c["FAIL" /* FAIL */] = "failed" /* FAILED */,
_c[enums_1.fetchEvents.RETRY] = enums_1.fetchStates.IDLE,
_c[enums_1.fetchEvents.FAIL] = enums_1.fetchStates.FAILED,
_c),
},
_b["success" /* SUCCESS */] = {
_b[enums_1.fetchStates.SUCCESS] = {
type: 'final',
entry: (0, xstate_1.sendParent)(function (_, event) {
return {
type: "FETCH_SUCCESS" /* FETCHSUCCESS */,
type: enums_1.eventsForFetchMachinesParent.FETCHSUCCESS,
response: event.data,

@@ -84,7 +85,7 @@ };

},
_b["failed" /* FAILED */] = {
_b[enums_1.fetchStates.FAILED] = {
type: 'final',
entry: (0, xstate_1.sendParent)(function (_, event) {
return {
type: "FETCH_FAILED" /* FETCHFAILED */,
type: enums_1.eventsForFetchMachinesParent.FETCHFAILED,
error: event.error,

@@ -91,0 +92,0 @@ };

{
"name": "@lu-development/pi-xstate-fetch",
"version": "0.0.12",
"version": "0.0.13",
"description": "Fetch State Machine",

@@ -5,0 +5,0 @@ "files": [

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