mirror of
https://github.com/Rolands-Laucis/Socio.git
synced 2026-05-15 14:15:57 -06:00
demos now actually use the npm version
This commit is contained in:
parent
5a090d0955
commit
8aa553cd2f
7 changed files with 131 additions and 51 deletions
91
demos/basic/package-lock.json
generated
91
demos/basic/package-lock.json
generated
|
|
@ -11,16 +11,14 @@
|
|||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"sequelize": "^6.25.3",
|
||||
"socio": "^0.4.13",
|
||||
"sqlite3": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"socio": "file:../../core"
|
||||
}
|
||||
},
|
||||
"../../core": {
|
||||
"name": "socio",
|
||||
"version": "0.4.3",
|
||||
"dev": true,
|
||||
"version": "0.4.13",
|
||||
"extraneous": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.17",
|
||||
|
|
@ -102,9 +100,9 @@
|
|||
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.11.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.4.tgz",
|
||||
"integrity": "sha512-BxcJpBu8D3kv/GZkx/gSMz6VnTJREBj/4lbzYOQueUOELkt8WrO6zAcSPmp9uRPEW/d+lUO8QK0W2xnS1hEU0A=="
|
||||
"version": "18.11.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
|
||||
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA=="
|
||||
},
|
||||
"node_modules/@types/validator": {
|
||||
"version": "13.7.9",
|
||||
|
|
@ -898,6 +896,17 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.26.7",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz",
|
||||
"integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==",
|
||||
"dependencies": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||
|
|
@ -1653,8 +1662,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/socio": {
|
||||
"resolved": "../../core",
|
||||
"link": true
|
||||
"version": "0.4.13",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-0.4.13.tgz",
|
||||
"integrity": "sha512-//Dvt2vEBjjy+l/y/OajEmDNLab1BsrX1o5Jms52OwF3WsEj874DCICTlUOzgfGet5k+Og9D+sJMuhPTovaejA==",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.17",
|
||||
"magic-string": "^0.26.7",
|
||||
"ws": "^8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socks": {
|
||||
"version": "2.7.1",
|
||||
|
|
@ -1707,6 +1722,12 @@
|
|||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/sourcemap-codec": {
|
||||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
|
||||
"deprecated": "Please use @jridgewell/sourcemap-codec instead"
|
||||
},
|
||||
"node_modules/sqlite3": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.2.tgz",
|
||||
|
|
@ -1940,6 +1961,26 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.12.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz",
|
||||
"integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
|
@ -2009,9 +2050,9 @@
|
|||
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.11.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.4.tgz",
|
||||
"integrity": "sha512-BxcJpBu8D3kv/GZkx/gSMz6VnTJREBj/4lbzYOQueUOELkt8WrO6zAcSPmp9uRPEW/d+lUO8QK0W2xnS1hEU0A=="
|
||||
"version": "18.11.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
|
||||
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA=="
|
||||
},
|
||||
"@types/validator": {
|
||||
"version": "13.7.9",
|
||||
|
|
@ -2643,6 +2684,14 @@
|
|||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"magic-string": {
|
||||
"version": "0.26.7",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz",
|
||||
"integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==",
|
||||
"requires": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
}
|
||||
},
|
||||
"make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||
|
|
@ -3170,10 +3219,11 @@
|
|||
"optional": true
|
||||
},
|
||||
"socio": {
|
||||
"version": "file:../../core",
|
||||
"version": "0.4.13",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-0.4.13.tgz",
|
||||
"integrity": "sha512-//Dvt2vEBjjy+l/y/OajEmDNLab1BsrX1o5Jms52OwF3WsEj874DCICTlUOzgfGet5k+Og9D+sJMuhPTovaejA==",
|
||||
"requires": {
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/ws": "^8.5.3",
|
||||
"magic-string": "^0.26.7",
|
||||
"ws": "^8.9.0"
|
||||
}
|
||||
|
|
@ -3216,6 +3266,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"sourcemap-codec": {
|
||||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
|
||||
},
|
||||
"sqlite3": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.2.tgz",
|
||||
|
|
@ -3396,6 +3451,12 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.12.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz",
|
||||
"integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==",
|
||||
"requires": {}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@
|
|||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"sequelize": "^6.25.3",
|
||||
"socio": "^0.4.13",
|
||||
"sqlite3": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"socio": "file:../../core"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// import {SocioServer} from '../../core/core.js' //i use this locally
|
||||
import { SocioServer } from 'socio/dist/core.js' //for using the lib as a download from npm
|
||||
import { log, info, done } from 'socio/logging';
|
||||
import { log, info, done } from 'socio/dist/logging.js';
|
||||
|
||||
import express from 'express'
|
||||
import { Sequelize } from 'sequelize';
|
||||
|
|
@ -23,7 +22,7 @@ async function QueryWrap({ id = 0, sql = '', params = {} } = {}) {
|
|||
return (await sequelize.query(sql, { logging: false, raw: true, replacements: params }))[0]
|
||||
}
|
||||
|
||||
const socserv = new SocioServer({ port: ws_port }, QueryWrap, {verbose:true} )
|
||||
const socserv = new SocioServer({ port: ws_port }, { DB_query_function: QueryWrap, verbose:true} )
|
||||
done(`Created SocioServer on port`, ws_port)
|
||||
|
||||
//init
|
||||
|
|
|
|||
48
demos/full-stack_framework/package-lock.json
generated
48
demos/full-stack_framework/package-lock.json
generated
|
|
@ -9,6 +9,7 @@
|
|||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"sequelize": "^6.28.0",
|
||||
"socio": "^0.4.13",
|
||||
"sqlite3": "^5.1.4",
|
||||
"svelte-french-toast": "^1.0.3",
|
||||
"ws": "^8.11.0"
|
||||
|
|
@ -18,7 +19,6 @@
|
|||
"@sveltejs/adapter-auto": "^1.0.0",
|
||||
"@sveltejs/kit": "^1.0.0",
|
||||
"sass": "^1.53.0",
|
||||
"socio": "file:../../core",
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-check": "^2.9.2",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
},
|
||||
"../../core": {
|
||||
"name": "socio",
|
||||
"version": "0.4.3",
|
||||
"dev": true,
|
||||
"version": "0.4.13",
|
||||
"extraneous": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.17",
|
||||
|
|
@ -2750,8 +2750,25 @@
|
|||
}
|
||||
},
|
||||
"node_modules/socio": {
|
||||
"resolved": "../../core",
|
||||
"link": true
|
||||
"version": "0.4.13",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-0.4.13.tgz",
|
||||
"integrity": "sha512-//Dvt2vEBjjy+l/y/OajEmDNLab1BsrX1o5Jms52OwF3WsEj874DCICTlUOzgfGet5k+Og9D+sJMuhPTovaejA==",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.17",
|
||||
"magic-string": "^0.26.7",
|
||||
"ws": "^8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socio/node_modules/magic-string": {
|
||||
"version": "0.26.7",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz",
|
||||
"integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==",
|
||||
"dependencies": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/socks": {
|
||||
"version": "2.7.1",
|
||||
|
|
@ -2809,8 +2826,7 @@
|
|||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
|
||||
"deprecated": "Please use @jridgewell/sourcemap-codec instead",
|
||||
"dev": true
|
||||
"deprecated": "Please use @jridgewell/sourcemap-codec instead"
|
||||
},
|
||||
"node_modules/sqlite3": {
|
||||
"version": "5.1.4",
|
||||
|
|
@ -5120,12 +5136,23 @@
|
|||
"optional": true
|
||||
},
|
||||
"socio": {
|
||||
"version": "file:../../core",
|
||||
"version": "0.4.13",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-0.4.13.tgz",
|
||||
"integrity": "sha512-//Dvt2vEBjjy+l/y/OajEmDNLab1BsrX1o5Jms52OwF3WsEj874DCICTlUOzgfGet5k+Og9D+sJMuhPTovaejA==",
|
||||
"requires": {
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/ws": "^8.5.3",
|
||||
"magic-string": "^0.26.7",
|
||||
"ws": "^8.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"magic-string": {
|
||||
"version": "0.26.7",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz",
|
||||
"integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==",
|
||||
"requires": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"socks": {
|
||||
|
|
@ -5170,8 +5197,7 @@
|
|||
"sourcemap-codec": {
|
||||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
|
||||
},
|
||||
"sqlite3": {
|
||||
"version": "5.1.4",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
"@sveltejs/adapter-auto": "^1.0.0",
|
||||
"@sveltejs/kit": "^1.0.0",
|
||||
"sass": "^1.53.0",
|
||||
"socio": "file:../../core",
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-check": "^2.9.2",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
|
|
@ -25,6 +24,7 @@
|
|||
"type": "module",
|
||||
"dependencies": {
|
||||
"sequelize": "^6.28.0",
|
||||
"socio": "^0.4.13",
|
||||
"sqlite3": "^5.1.4",
|
||||
"svelte-french-toast": "^1.0.3",
|
||||
"ws": "^8.11.0"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
console.log('running hooks.server.ts ...')
|
||||
import { SocioServer } from 'socio/core';
|
||||
import { SocioSecurity } from 'socio/secure';
|
||||
import type { QueryFunction, QueryFuncParams } from 'socio/core';
|
||||
import type { PropValue } from 'socio/types';
|
||||
import { SocioServer } from 'socio/dist/core';
|
||||
import { SocioSecurity } from 'socio/dist/secure';
|
||||
import type { QueryFunction, QueryFuncParams } from 'socio/dist/core';
|
||||
import type { PropValue } from 'socio/dist/types';
|
||||
// import { SocioStringParse } from 'socio/utils'
|
||||
|
||||
import { Sequelize } from 'sequelize';
|
||||
import { log, info, done, soft_error } from 'socio/logging';
|
||||
import { log, info, done, soft_error } from 'socio/dist/logging';
|
||||
|
||||
// log(SocioStringParse('SELECT * FROM users;--socio-32946486'))
|
||||
// process.exit(0)
|
||||
|
|
@ -28,17 +28,13 @@ try{
|
|||
}
|
||||
|
||||
const socsec = new SocioSecurity({ secure_private_key: 'skk#$U#Y$7643GJHKGDHJH#$K#$HLI#H$KBKDBDFKU34534', verbose: true });
|
||||
const socserv = new SocioServer({ port: ws_port }, QueryWrap as QueryFunction, { verbose: true, socio_security: socsec });
|
||||
done(`Created SocioServer on port`, ws_port);
|
||||
const socserv = new SocioServer({ port: ws_port }, { DB_query_function: QueryWrap as QueryFunction, verbose: true, socio_security: socsec });
|
||||
|
||||
socserv.RegisterProp('color', '#ffffff', (curr_val: PropValue, new_val: PropValue): boolean => {
|
||||
if (typeof new_val != 'string' || new_val.length != 7) return false;
|
||||
if (!new_val.match(/^#[0-9a-f]{6}/mi)) return false;
|
||||
//...more checks.
|
||||
|
||||
//success, so assign
|
||||
return socserv.SetPropVal('color', new_val);
|
||||
})
|
||||
});
|
||||
} catch (e:any) {
|
||||
soft_error(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<script lang="ts">
|
||||
//imports
|
||||
import { SocioClient } from "socio/core-client";
|
||||
// import type {id} from 'socio/types'
|
||||
import { SocioClient } from "socio/dist/core-client";
|
||||
import type {id} from 'socio/dist/types'
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
//@ts-ignore
|
||||
|
||||
import { slide } from "svelte/transition";
|
||||
import toast from 'svelte-french-toast';
|
||||
import toast from 'svelte-french-toast'; //https://github.com/kbrgl/svelte-french-toast
|
||||
|
||||
//comps
|
||||
import Bloom from "$lib/bloom.svelte";
|
||||
|
|
@ -21,9 +21,9 @@
|
|||
//setup toasts
|
||||
sc.lifecycle_hooks.msg = (name:string, client_id:string, kind:string, data:any) => {
|
||||
if(['UPD', 'PROP_UPD'].includes(kind))
|
||||
toast('An update came in from the Socio Server.', {style:'background: #0D0D0E; color: #fff;',position: "bottom-center"});
|
||||
toast('An update came in from the Socio Server.', {style:'background: #0D0D0E; color: #fff;',position: "bottom-center", duration:1000});
|
||||
else if(kind == 'ERR')
|
||||
toast.error(`An error arrived for a query or prop. MSG ID:${data.id}`,{position: "bottom-center"})
|
||||
toast.error(`An error arrived for a query or prop. MSG ID:${data.id}`,{position: "bottom-center", duration:2000})
|
||||
}
|
||||
|
||||
//variables
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
onMount(async () => {
|
||||
ready = await sc.ready();
|
||||
toast.success('Socio Client connected!', {icon:'🥳',position: "bottom-center"});
|
||||
toast.success('Socio Client connected!', {icon:'🥳',position: "bottom-center", duration:1000});
|
||||
|
||||
sc.subscribe({sql: "SELECT COUNT(*) AS RES FROM users WHERE name = :name;--socio",params: { name: "John" }}, (res) => {
|
||||
//@ts-ignore
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue