This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import csv from 'csv-parser'; | |
import PocketBase from 'pocketbase'; | |
const token = "API_KEY_OF_IMPERSONATED_SUPERUSER"; | |
// Initialize PocketBase client | |
const pb = new PocketBase('https://<YOUR-POCKETBASE-URL>'); | |
pb.authStore.save(token, null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { browser } from '$app/environment'; | |
let ws: WebSocket | null = null; | |
let connecting = true; | |
let connected = false; | |
let messages: string[] = []; | |
let sendValue: string = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Database } from "bun:sqlite"; | |
export class InMemoryKeyValueStore { | |
private static instance: InMemoryKeyValueStore | null = null; | |
private db: Database; | |
// Private constructor to initialize the SQLite database | |
private constructor() { | |
this.db = new Database(":memory:"); // In-memory SQLite database | |
this.initializeDatabase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import '../app.css'; | |
let { children }: { children: any } = $props(); | |
import { source } from 'sveltekit-sse'; | |
const value = source('/api/config').select('message'); // Use $value to access the store | |
</script> | |
<p>Fiddle with field change in Pocketbase to see this update in realtime</p> | |
{JSON.stringify($value)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM oven/bun:latest | |
WORKDIR /app | |
COPY . . | |
RUN bun install | |
RUN bun build ./realtime.ts --compile --outfile realtime | |
RUN chmod +x /app/realtime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Database } from "bun:sqlite"; | |
import jsonData from '$lib/server/utils/realty/fieldMaps.json'; // Import the JSON directly | |
// Define structure for the JSON object | |
interface FieldMapping { | |
fieldName: string; | |
alias: string; | |
description: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { PageServerLoad } from './$types'; | |
import pb from '$lib/pocketbase'; | |
import { propertyClassMap } from './guards'; // Import the source of truth | |
export const load: PageServerLoad = async ({ url, depends, params }) => { | |
depends('app:search'); // Revalidate on every request to this tag. | |
const slugs = params.slugs?.replace(/^\/|\/$/g, '').split('/') || []; | |
const [classSlug, typeSlug] = slugs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { goto } from '$app/navigation'; | |
import { page } from '$app/stores'; | |
import { onMount } from 'svelte'; | |
import { queryParameters, ssp } from 'sveltekit-search-params'; | |
import Pagination from './pagination.svelte'; | |
let { records, ...props } = $props(); | |
const system = $state({ Class: '', Type: '', page: 1 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { goto } from '$app/navigation'; | |
import { page } from '$app/stores'; | |
import { onMount } from 'svelte'; | |
import { queryParameters } from 'sveltekit-search-params'; | |
// Initialize query parameters management | |
const params = queryParameters( | |
{ | |
test: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the type for individual fields | |
export interface RETSField { | |
SystemName?: string | string[]; | |
Interpretation?: string[]; | |
DataType?: string[]; | |
MaximumLength?: number[]; | |
Precision?: number[]; | |
LongName?: string[]; | |
} |