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

@harlem/extension-action

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harlem/extension-action - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

80

dist/esm/index.js
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -35,4 +65,2 @@ // src/index.ts

super(`Action ${name} as been cancelled`);
__publicField(this, "name");
__publicField(this, "instanceId");
this.name = name;

@@ -64,12 +92,24 @@ this.instanceId = instanceId;

function addInstance(name, instanceId, payload) {
_store.write("$action-add-instance", SENDER, (state) => state[STATE_PROP][name]?.instances.set(instanceId, payload));
_store.write("$action-add-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.set(instanceId, payload);
});
}
function removeInstance(name, instanceId) {
_store.write("$action-remove-instance", SENDER, (state) => state[STATE_PROP][name]?.instances.delete(instanceId));
_store.write("$action-remove-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.delete(instanceId);
});
}
function addError(name, instanceId, error) {
_store.write("$action-add-error", SENDER, (state) => state[STATE_PROP][name]?.errors.set(instanceId, error));
_store.write("$action-add-error", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.set(instanceId, error);
});
}
function clearErrors(name) {
_store.write("$action-clear-errors", SENDER, (state) => state[STATE_PROP][name]?.errors.clear());
_store.write("$action-clear-errors", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.clear();
});
}

@@ -82,7 +122,6 @@ function action(name, body, options) {

autoClearErrors
} = {
} = __spreadValues({
parallel: false,
autoClearErrors: true,
...options
};
autoClearErrors: true
}, options);
const mutate = (mutator) => _store.write(name, SENDER, mutator);

@@ -99,3 +138,4 @@ return (payload, controller) => {

}
const task = new Task(async (resolve, reject, controller2, onAbort) => {
const task = new Task((resolve, reject, controller2, onAbort) => __async(this, null, function* () {
var _a;
const id = Symbol(name);

@@ -114,4 +154,4 @@ const complete = () => (tasks.delete(task), removeInstance(name, id));

try {
const providedPayload = _store.providers.payload(payload) ?? payload;
result = await body(providedPayload, mutate, controller2, onAbort);
const providedPayload = (_a = _store.providers.payload(payload)) != null ? _a : payload;
result = yield body(providedPayload, mutate, controller2, onAbort);
emit(EVENTS.action.success);

@@ -132,3 +172,3 @@ incrementRunCount(name);

}
}, controller);
}), controller);
tasks.add(task);

@@ -177,6 +217,8 @@ return task;

function hasActionFailed(name) {
return _store.state[STATE_PROP][name]?.errors.size > 0;
var _a;
return ((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.size) > 0;
}
function getActionErrors(name) {
return Array.from(_store.state[STATE_PROP][name]?.errors.entries()).map(([id, error]) => ({
var _a;
return Array.from((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.entries()).map(([id, error]) => ({
id,

@@ -183,0 +225,0 @@ error

@@ -6,5 +6,18 @@ var HarlemActionExtension = (() => {

var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });

@@ -32,5 +45,21 @@ var __require = (x) => {

};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -66,4 +95,2 @@

super(`Action ${name} as been cancelled`);
__publicField(this, "name");
__publicField(this, "instanceId");
this.name = name;

@@ -95,12 +122,24 @@ this.instanceId = instanceId;

function addInstance(name, instanceId, payload) {
_store.write("$action-add-instance", SENDER, (state) => state[STATE_PROP][name]?.instances.set(instanceId, payload));
_store.write("$action-add-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.set(instanceId, payload);
});
}
function removeInstance(name, instanceId) {
_store.write("$action-remove-instance", SENDER, (state) => state[STATE_PROP][name]?.instances.delete(instanceId));
_store.write("$action-remove-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.delete(instanceId);
});
}
function addError(name, instanceId, error) {
_store.write("$action-add-error", SENDER, (state) => state[STATE_PROP][name]?.errors.set(instanceId, error));
_store.write("$action-add-error", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.set(instanceId, error);
});
}
function clearErrors(name) {
_store.write("$action-clear-errors", SENDER, (state) => state[STATE_PROP][name]?.errors.clear());
_store.write("$action-clear-errors", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.clear();
});
}

@@ -113,7 +152,6 @@ function action(name, body, options) {

autoClearErrors
} = {
} = __spreadValues({
parallel: false,
autoClearErrors: true,
...options
};
autoClearErrors: true
}, options);
const mutate = (mutator) => _store.write(name, SENDER, mutator);

@@ -130,3 +168,4 @@ return (payload, controller) => {

}
const task = new import_task.default(async (resolve, reject, controller2, onAbort) => {
const task = new import_task.default((resolve, reject, controller2, onAbort) => __async(this, null, function* () {
var _a;
const id = Symbol(name);

@@ -145,4 +184,4 @@ const complete = () => (tasks.delete(task), removeInstance(name, id));

try {
const providedPayload = _store.providers.payload(payload) ?? payload;
result = await body(providedPayload, mutate, controller2, onAbort);
const providedPayload = (_a = _store.providers.payload(payload)) != null ? _a : payload;
result = yield body(providedPayload, mutate, controller2, onAbort);
emit(EVENTS.action.success);

@@ -163,3 +202,3 @@ incrementRunCount(name);

}
}, controller);
}), controller);
tasks.add(task);

@@ -208,6 +247,8 @@ return task;

function hasActionFailed(name) {
return _store.state[STATE_PROP][name]?.errors.size > 0;
var _a;
return ((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.size) > 0;
}
function getActionErrors(name) {
return Array.from(_store.state[STATE_PROP][name]?.errors.entries()).map(([id, error]) => ({
var _a;
return Array.from((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.entries()).map(([id, error]) => ({
id,

@@ -214,0 +255,0 @@ error

@@ -1,7 +0,37 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -35,4 +65,2 @@ // src/index.ts

super(`Action ${name} as been cancelled`);
__publicField(this, "name");
__publicField(this, "instanceId");
this.name = name;

@@ -64,12 +92,24 @@ this.instanceId = instanceId;

function addInstance(name, instanceId, payload) {
_store.write("$action-add-instance", SENDER, (state) => _optionalChain([state, 'access', _ => _[STATE_PROP], 'access', _2 => _2[name], 'optionalAccess', _3 => _3.instances, 'access', _4 => _4.set, 'call', _5 => _5(instanceId, payload)]));
_store.write("$action-add-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.set(instanceId, payload);
});
}
function removeInstance(name, instanceId) {
_store.write("$action-remove-instance", SENDER, (state) => _optionalChain([state, 'access', _6 => _6[STATE_PROP], 'access', _7 => _7[name], 'optionalAccess', _8 => _8.instances, 'access', _9 => _9.delete, 'call', _10 => _10(instanceId)]));
_store.write("$action-remove-instance", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.instances.delete(instanceId);
});
}
function addError(name, instanceId, error) {
_store.write("$action-add-error", SENDER, (state) => _optionalChain([state, 'access', _11 => _11[STATE_PROP], 'access', _12 => _12[name], 'optionalAccess', _13 => _13.errors, 'access', _14 => _14.set, 'call', _15 => _15(instanceId, error)]));
_store.write("$action-add-error", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.set(instanceId, error);
});
}
function clearErrors(name) {
_store.write("$action-clear-errors", SENDER, (state) => _optionalChain([state, 'access', _16 => _16[STATE_PROP], 'access', _17 => _17[name], 'optionalAccess', _18 => _18.errors, 'access', _19 => _19.clear, 'call', _20 => _20()]));
_store.write("$action-clear-errors", SENDER, (state) => {
var _a;
return (_a = state[STATE_PROP][name]) == null ? void 0 : _a.errors.clear();
});
}

@@ -82,7 +122,6 @@ function action(name, body, options) {

autoClearErrors
} = {
} = __spreadValues({
parallel: false,
autoClearErrors: true,
...options
};
autoClearErrors: true
}, options);
const mutate = (mutator) => _store.write(name, SENDER, mutator);

@@ -99,3 +138,4 @@ return (payload, controller) => {

}
const task = new (0, _task2.default)(async (resolve, reject, controller2, onAbort) => {
const task = new (0, _task2.default)((resolve, reject, controller2, onAbort) => __async(this, null, function* () {
var _a;
const id = Symbol(name);

@@ -114,4 +154,4 @@ const complete = () => (tasks.delete(task), removeInstance(name, id));

try {
const providedPayload = _nullishCoalesce(_store.providers.payload(payload), () => ( payload));
result = await body(providedPayload, mutate, controller2, onAbort);
const providedPayload = (_a = _store.providers.payload(payload)) != null ? _a : payload;
result = yield body(providedPayload, mutate, controller2, onAbort);
emit(EVENTS.action.success);

@@ -132,3 +172,3 @@ incrementRunCount(name);

}
}, controller);
}), controller);
tasks.add(task);

@@ -177,6 +217,8 @@ return task;

function hasActionFailed(name) {
return _optionalChain([_store, 'access', _21 => _21.state, 'access', _22 => _22[STATE_PROP], 'access', _23 => _23[name], 'optionalAccess', _24 => _24.errors, 'access', _25 => _25.size]) > 0;
var _a;
return ((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.size) > 0;
}
function getActionErrors(name) {
return Array.from(_optionalChain([_store, 'access', _26 => _26.state, 'access', _27 => _27[STATE_PROP], 'access', _28 => _28[name], 'optionalAccess', _29 => _29.errors, 'access', _30 => _30.entries, 'call', _31 => _31()])).map(([id, error]) => ({
var _a;
return Array.from((_a = _store.state[STATE_PROP][name]) == null ? void 0 : _a.errors.entries()).map(([id, error]) => ({
id,

@@ -183,0 +225,0 @@ error

{
"name": "@harlem/extension-action",
"amdName": "harlemAction",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",

@@ -42,3 +42,3 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>",

"dependencies": {
"@harlem/task": "^2.0.0"
"@harlem/task": "^2.0.1"
},

@@ -50,7 +50,7 @@ "peerDependencies": {

"devDependencies": {
"@harlem/core": "^2.0.0",
"@harlem/testing": "^2.0.0",
"@harlem/core": "^2.0.1",
"@harlem/testing": "^2.0.1",
"vue": "^3.2.0"
},
"gitHead": "08c19b9a416c273807b488884af1d8cc35ff5969"
"gitHead": "4d9efd9e353355446fb12431ab8e32c5c160c319"
}

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