
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@hdt-edge-products/client-pinia-vue-sdk
Advanced tools
A wrapper of the client-entities interactions using Vue and its Pinia state management
This package is an adapter which binds the FRANk change feeds / change streams to Vue and Pinia stores to assist in UI development
The SDK exports 4 items:
Here is an example of how the sdk is instantiated:
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import { eventRuntimeApiSdk, EventRuntimePiniaVueSdk, useEventActivityStore, useItemBiddingStore } from '@hdt-edge-products/client-pinia-vue-sdk';
const BIDDING_SERVER_URL = 'http://localhost:4030';
const DELTA_SERVER_URL = 'ws://localhost:9001';
// NOTE: Pinia and the app must be attached prior to setup/initialization of the event runtime sdk
const pinia = createPinia();
const app = createApp(App, { BIDDING_SERVER_URL, DELTA_SERVER_URL });
app.use(pinia);
useEventActivityStore();
useItemBiddingStore();
const customAuthHeaderFn = async function(){
return Promise.resolve({Authorization: 'Bearer jwt.token.here'});
}
// The api sdk allows the user to set an async customHeader function which will be applied for REST Api calls into the sdk.
eventRuntimeApiSdk.customHeaderFn = customAuthHeaderFn;
eventRuntimeApiSdk.baseBiddingUri = BIDDING_SERVER_URL;
const sdk = new EventRuntimePiniaVueSdk(BIDDING_SERVER_URL, DELTA_SERVER_URL);
await sdk.initialize();
await sdk.watchEvents(['event-10000', 'event-20000', 'event-30000']);
app.mount('#app');
An example pinia item bidding store is below:
import { ref } from 'vue';
import { defineStore } from 'pinia';
import { applyPatch } from 'fast-json-patch';
export const useItemBiddingStore = defineStore('itemBiddingStore', () => {
const items = ref({});
function addItemBidding(itemBiddingModel) {
this.items[itemBiddingModel.id] = itemBiddingModel;
}
function updateItemBidding(id, itemBiddingModel) {
this.items[id] = itemBiddingModel;
}
function removeItemBidding(id) {
delete this.items[id];
}
function applyJsonPatch(id, jsonPatch) {
applyPatch(this.items[id], jsonPatch, false, true);
}
return {
items,
addItemBidding,
updateItemBidding,
removeItemBidding,
applyJsonPatch
}
})
Note that the contents of these stores match the datamodel that is in the database directly - no changes or mutation. The contents are also live updated/added as changes/inserts to the database are written.
FAQs
A wrapper of the client-entities interactions using Vue and its Pinia state management
We found that @hdt-edge-products/client-pinia-vue-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.