Compare commits

...

2 Commits

3 changed files with 41 additions and 26 deletions

View File

@ -1,9 +1,14 @@
{
"name": "solid-pb",
"version": "1.0.0",
"name": "@hibas123/solid-pb",
"version": "1.1.1",
"type": "module",
"license": "MIT",
"main": "./dist/index.js",
"files": [
"tsconfig.json",
"dist/**/*",
"src/**/*"
],
"exports": {
".": {
"default": "./dist/index.js"
@ -13,17 +18,21 @@
"scripts": {
"dev": "tsc -w",
"build": "tsc -w",
"prepublish": "tsc"
"prepublishOnly": "tsc"
},
"dependencies": {
"@nedpals/pbf": "^1.3.2"
"@nedpals/pbf": "^1",
"nanoid": "^5"
},
"peerDependencies": {
"pocketbase": "^0.25.1",
"solid-js": "^1.9.4",
"zod": "^3.24.2"
"pocketbase": "^0.25",
"solid-js": "^1",
"zod": "^3"
},
"devDependencies": {
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"pocketbase": "^0.25",
"solid-js": "^1",
"zod": "^3"
}
}

View File

@ -3,6 +3,7 @@ import { createStore } from "solid-js/store";
import { RecordModel, RecordSubscription } from "pocketbase";
import * as pbf from "@nedpals/pbf";
import { z } from "zod";
import { nanoid } from "nanoid";
import { usePB } from "./context.js";
@ -14,7 +15,7 @@ interface IUseRecordOptions {
export function useRecord<T>(collection: string, id: () => string, options?: IUseRecordOptions) {
const pb = usePB();
const requestKey = crypto.randomUUID();
const requestKey = nanoid();
const [record, setRecord] = createStore<{
loading: boolean,
@ -80,7 +81,7 @@ interface IUseRecordsOptions {
export function useRecords<T>(collection: string, options: IUseRecordsOptions = { expand: [] }) {
const pb = usePB();
const requestKey = crypto.randomUUID();
const requestKey = nanoid();
const fstr = () => options.filter && options.filter() ? pbf.stringify(options.filter()) : undefined;
const v = options.validator ?? ({ parse: (i) => i });

View File

@ -2,35 +2,40 @@
# yarn lockfile v1
"@nedpals/pbf@^1.3.2":
"@nedpals/pbf@^1":
version "1.3.2"
resolved "https://npm.hibas123.de/@nedpals/pbf/-/pbf-1.3.2.tgz#53b00c65103fbaa90c217ea0a4183119d9f9817e"
resolved "https://registry.yarnpkg.com/@nedpals/pbf/-/pbf-1.3.2.tgz#53b00c65103fbaa90c217ea0a4183119d9f9817e"
integrity sha512-vTEUIbVF8AiufclVzor2HWMoTrnIZn74NTu+B7HlNlB+QR9HEq/9Rf/hufX9QOt54iOoJukP2x3ASsDUKl48MQ==
csstype@^3.1.0:
version "3.1.3"
resolved "https://npm.hibas123.de/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
pocketbase@^0.25.1:
version "0.25.1"
resolved "https://npm.hibas123.de/pocketbase/-/pocketbase-0.25.1.tgz#e2bb606d2e39a992d9b328d67a24a9879ba7337d"
integrity sha512-2IH0KLI/qMNR/E17C7BGWX2FxW7Tead+igLHOWZ45P56v/NyVT18Jnmddeft+3qWWGL1Hog2F8bc4orWV/+Fcg==
nanoid@^5:
version "5.1.4"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-5.1.4.tgz#10b15a91d2f727b1f200faf0ff73656fd96c497d"
integrity sha512-GTFcMIDgR7tqji/LpSY8rtg464VnJl/j6ypoehYnuGb+Y8qZUdtKB8WVCXon0UEZgFDbuUxpIl//6FHLHgXSNA==
pocketbase@^0.25:
version "0.25.2"
resolved "https://registry.yarnpkg.com/pocketbase/-/pocketbase-0.25.2.tgz#9a296c171a7890c8c634c91df50e70ed7c2386f8"
integrity sha512-ONZl1+qHJMnhR2uacBlBJ90lm7njtL/zy0606+1ROfK9hSL4LRBRc8r89rMcNRzPzRqCNyoFTh2Qg/lYXdEC1w==
seroval-plugins@^1.1.0:
version "1.2.1"
resolved "https://npm.hibas123.de/seroval-plugins/-/seroval-plugins-1.2.1.tgz#fa535e70ade8af553634b2b5c80d8a6fd8c2ff72"
resolved "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.2.1.tgz"
integrity sha512-H5vs53+39+x4Udwp4J5rNZfgFuA+Lt+uU+09w1gYBVWomtAl98B+E9w7yC05Xc81/HgLvJdlyqJbU0fJCKCmdw==
seroval@^1.1.0:
version "1.2.1"
resolved "https://npm.hibas123.de/seroval/-/seroval-1.2.1.tgz#fc671d63445923ab64f7abaf3967c83901382f40"
resolved "https://registry.npmjs.org/seroval/-/seroval-1.2.1.tgz"
integrity sha512-yBxFFs3zmkvKNmR0pFSU//rIsYjuX418TnlDmc2weaq5XFDqDIV/NOMPBoLrbxjLH42p4UzRuXHryXh9dYcKcw==
solid-js@^1.9.4:
version "1.9.4"
resolved "https://npm.hibas123.de/solid-js/-/solid-js-1.9.4.tgz#da9b5645f10875a631d93335cd50525ff36b6c27"
integrity sha512-ipQl8FJ31bFUoBNScDQTG3BjN6+9Rg+Q+f10bUbnO6EOTTf5NGerJeHc7wyu5I4RMHEl/WwZwUmy/PTRgxxZ8g==
solid-js@^1:
version "1.9.5"
resolved "https://registry.yarnpkg.com/solid-js/-/solid-js-1.9.5.tgz#168ae067c27d3d437c868484d21751335ec16063"
integrity sha512-ogI3DaFcyn6UhYhrgcyRAMbu/buBJitYQASZz5WzfQVPP10RD2AbCoRZ517psnezrasyCbWzIxZ6kVqet768xw==
dependencies:
csstype "^3.1.0"
seroval "^1.1.0"
@ -38,10 +43,10 @@ solid-js@^1.9.4:
typescript@^5.7.3:
version "5.7.3"
resolved "https://npm.hibas123.de/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
resolved "https://npm.hibas123.de/typescript/-/typescript-5.7.3.tgz"
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
zod@^3.24.2:
zod@^3:
version "3.24.2"
resolved "https://npm.hibas123.de/zod/-/zod-3.24.2.tgz#8efa74126287c675e92f46871cfc8d15c34372b3"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.2.tgz#8efa74126287c675e92f46871cfc8d15c34372b3"
integrity sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==