diff --git a/datex_all.ts b/datex_all.ts index 3e42188f..fc4428d0 100644 --- a/datex_all.ts +++ b/datex_all.ts @@ -35,10 +35,11 @@ export * from "./runtime/io_handler.ts"; export * from "./runtime/js_interface.ts"; export * from "./runtime/performance_measure.ts"; export * from "./runtime/pointers.ts"; -export * from "./runtime/storage.ts"; export * from "./runtime/cli.ts"; export * from "./runtime/cache_path.ts"; +// storage +export * from "./storage/storage.ts"; // types export * from "./types/abstract_types.ts"; diff --git a/init.ts b/init.ts index 40918bd2..113bbbce 100644 --- a/init.ts +++ b/init.ts @@ -2,11 +2,11 @@ import { Runtime } from "./runtime/runtime.ts"; import { Pointer } from "./runtime/pointers.ts"; import { LOCAL_ENDPOINT } from "./types/addressing.ts"; import { client_type } from "./utils/constants.ts"; -import { Storage, registerStorageAsPointerSource } from "./runtime/storage.ts"; +import { Storage, registerStorageAsPointerSource } from "./storage/storage.ts"; import { cwdURL, logger } from "./utils/global_values.ts"; -import { IndexedDBStorageLocation } from "./runtime/storage-locations/indexed-db.ts"; -import { LocalStorageLocation } from "./runtime/storage-locations/local-storage.ts"; -import { DenoKVStorageLocation } from "./runtime/storage-locations/deno-kv.ts"; +import { IndexedDBStorageLocation } from "./storage/storage-locations/indexed-db.ts"; +import { LocalStorageLocation } from "./storage/storage-locations/local-storage.ts"; +import { DenoKVStorageLocation } from "./storage/storage-locations/deno-kv.ts"; import { loadEternalValues } from "./utils/eternals.ts"; import { DX_BOUND_LOCAL_SLOT } from "./runtime/constants.ts"; import { verboseArg } from "./utils/logger.ts"; @@ -45,9 +45,9 @@ export async function init() { } if (await storageInitModule?.fsExists()) { - logger.info("Initializing custom storage configuration (" + storageInitModule!.normal_pathname + ")") + logger.info("Initializing custom storage configuration (" + storageInitModule!.toString() + ")") try { - await import(storageInitModule!.normal_pathname); + await import(storageInitModule!.toString()); } catch (e) { console.error(e) diff --git a/network/supranet.ts b/network/supranet.ts index 01eae861..5bfc9f36 100644 --- a/network/supranet.ts +++ b/network/supranet.ts @@ -18,7 +18,7 @@ import { Logger } from "../utils/logger.ts"; import { endpoint_config } from "../runtime/endpoint_config.ts"; import { endpoint_name, UnresolvedEndpointProperty } from "../datex_all.ts"; import { Datex } from "../mod.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { WebSocketClientInterface } from "./communication-interfaces/websocket-client-interface.ts"; import { communicationHub } from "./communication-hub.ts"; diff --git a/runtime/crypto.ts b/runtime/crypto.ts index 31415756..6dc4e333 100644 --- a/runtime/crypto.ts +++ b/runtime/crypto.ts @@ -3,7 +3,7 @@ import { logger } from "../utils/global_values.ts"; import { Endpoint, Target } from "../types/addressing.ts"; import { SecurityError, ValueError } from "../types/errors.ts"; import { NetworkUtils } from "../network/network_utils.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { Runtime } from "./runtime.ts"; import { displayFatalError } from "./display.ts"; import { Supranet } from "../network/supranet.ts"; diff --git a/runtime/pointers.ts b/runtime/pointers.ts index 18ea266a..619e0d33 100644 --- a/runtime/pointers.ts +++ b/runtime/pointers.ts @@ -30,7 +30,7 @@ import { LazyPointer } from "./lazy-pointer.ts"; import { ReactiveArrayMethods } from "../types/reactive-methods/array.ts"; import { Assertion } from "../types/assertion.ts"; import { StorageSet } from "../types/storage-set.ts"; -import { Storage } from "./storage.ts"; +import { Storage } from "../storage/storage.ts"; export type observe_handler = (value:V extends RefLike ? T : V, key?:K, type?:Ref.UPDATE_TYPE, transform?:boolean, is_child_update?:boolean, previous?: any, atomic_id?:symbol)=>void|boolean export type observe_options = {types?:Ref.UPDATE_TYPE[], ignore_transforms?:boolean, recursive?:boolean} diff --git a/runtime/runtime.ts b/runtime/runtime.ts index f6d7adef..8b13e410 100644 --- a/runtime/runtime.ts +++ b/runtime/runtime.ts @@ -32,7 +32,7 @@ import { BROADCAST, Endpoint, endpoints, IdEndpoint, LOCAL_ENDPOINT, Target, tar import { RuntimePerformance } from "./performance_measure.ts"; import { NetworkError, PermissionError, PointerError, RuntimeError, SecurityError, ValueError, Error as DatexError, CompilerError, TypeError, SyntaxError, AssertionError } from "../types/errors.ts"; import { Function as DatexFunction } from "../types/function.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { Observers } from "../utils/observers.ts"; import { BinaryCode } from "../compiler/binary_codes.ts"; import type { ExecConditions, trace, compile_info, datex_meta, datex_scope, dxb_header, routing_info } from "../utils/global_types.ts"; diff --git a/runtime/storage-locations/deno-kv.ts b/storage/storage-locations/deno-kv.ts similarity index 97% rename from runtime/storage-locations/deno-kv.ts rename to storage/storage-locations/deno-kv.ts index 521f9db9..615d0eee 100644 --- a/runtime/storage-locations/deno-kv.ts +++ b/storage/storage-locations/deno-kv.ts @@ -2,9 +2,9 @@ import { Runtime } from "../../runtime/runtime.ts"; import { Compiler } from "../../compiler/compiler.ts"; import { Pointer } from "../../runtime/pointers.ts"; -import { NOT_EXISTING } from "../constants.ts"; +import { NOT_EXISTING } from "../../runtime/constants.ts"; import { AsyncStorageLocation } from "../storage.ts"; -import { ptr_cache_path } from "../cache_path.ts"; +import { ptr_cache_path } from "../../runtime/cache_path.ts"; import { client_type } from "../../utils/constants.ts"; import { normalizePath } from "../../utils/normalize-path.ts"; import { ExecConditions } from "../../utils/global_types.ts"; diff --git a/runtime/storage-locations/indexed-db.ts b/storage/storage-locations/indexed-db.ts similarity index 98% rename from runtime/storage-locations/indexed-db.ts rename to storage/storage-locations/indexed-db.ts index deb33d6d..e4cbe1c3 100644 --- a/runtime/storage-locations/indexed-db.ts +++ b/storage/storage-locations/indexed-db.ts @@ -2,7 +2,7 @@ import { Runtime } from "../../runtime/runtime.ts"; import { Compiler } from "../../compiler/compiler.ts"; import { Pointer } from "../../runtime/pointers.ts"; -import { NOT_EXISTING } from "../constants.ts"; +import { NOT_EXISTING } from "../../runtime/constants.ts"; import { AsyncStorageLocation, site_suffix } from "../storage.ts"; import localforage from "../../lib/localforage/localforage.js"; diff --git a/runtime/storage-locations/local-storage-compat.ts b/storage/storage-locations/local-storage-compat.ts similarity index 98% rename from runtime/storage-locations/local-storage-compat.ts rename to storage/storage-locations/local-storage-compat.ts index cfe10122..2da7b05f 100644 --- a/runtime/storage-locations/local-storage-compat.ts +++ b/storage/storage-locations/local-storage-compat.ts @@ -2,7 +2,7 @@ import { logger } from "../../utils/global_values.ts"; import { client_type } from "../../utils/constants.ts"; -import { ptr_cache_path } from "../cache_path.ts"; +import { ptr_cache_path } from "../../runtime/cache_path.ts"; import { normalizePath } from "../../utils/normalize-path.ts"; class LocalStorage implements Storage { diff --git a/runtime/storage-locations/local-storage.ts b/storage/storage-locations/local-storage.ts similarity index 96% rename from runtime/storage-locations/local-storage.ts rename to storage/storage-locations/local-storage.ts index e16b6738..551104ca 100644 --- a/runtime/storage-locations/local-storage.ts +++ b/storage/storage-locations/local-storage.ts @@ -1,8 +1,8 @@ import { Compiler } from "../../compiler/compiler.ts"; import { Storage, SyncStorageLocation } from "../storage.ts"; -import { Pointer } from "../pointers.ts"; +import { Pointer } from "../../runtime/pointers.ts"; import { Runtime } from "../../runtime/runtime.ts"; -import { NOT_EXISTING } from "../constants.ts"; +import { NOT_EXISTING } from "../../runtime/constants.ts"; import { base64ToArrayBuffer } from "../../utils/utils.ts"; import { arrayBufferToBase64 } from "../../datex_all.ts"; import { localStorage } from "./local-storage-compat.ts"; diff --git a/runtime/storage-locations/sql-db.ts b/storage/storage-locations/sql-db.ts similarity index 99% rename from runtime/storage-locations/sql-db.ts rename to storage/storage-locations/sql-db.ts index 6222b9f4..9be442fc 100644 --- a/runtime/storage-locations/sql-db.ts +++ b/storage/storage-locations/sql-db.ts @@ -11,7 +11,7 @@ import { NOT_EXISTING } from "../../runtime/constants.ts"; import { client_type } from "../../utils/constants.ts"; import { Compiler } from "../../compiler/compiler.ts"; import { ExecConditions } from "../../utils/global_types.ts"; -import { Runtime } from "../runtime.ts"; +import { Runtime } from "../../runtime/runtime.ts"; const logger = new Logger("SQL Storage"); diff --git a/runtime/storage-locations/sql-definitions.ts b/storage/storage-locations/sql-definitions.ts similarity index 100% rename from runtime/storage-locations/sql-definitions.ts rename to storage/storage-locations/sql-definitions.ts diff --git a/runtime/storage-locations/sql-queries.ts b/storage/storage-locations/sql-queries.ts similarity index 100% rename from runtime/storage-locations/sql-queries.ts rename to storage/storage-locations/sql-queries.ts diff --git a/runtime/storage-locations/sql-type-map.ts b/storage/storage-locations/sql-type-map.ts similarity index 100% rename from runtime/storage-locations/sql-type-map.ts rename to storage/storage-locations/sql-type-map.ts diff --git a/runtime/storage.ts b/storage/storage.ts similarity index 99% rename from runtime/storage.ts rename to storage/storage.ts index b5315ccb..f7b85207 100644 --- a/runtime/storage.ts +++ b/storage/storage.ts @@ -4,11 +4,11 @@ import { Runtime } from "../runtime/runtime.ts"; import type { ExecConditions, PointerSource } from "../utils/global_types.ts"; import { logger } from "../utils/global_values.ts"; import { client_type } from "../utils/constants.ts"; -import { NOT_EXISTING } from "./constants.ts"; -import { Pointer, type MinimalJSRef, Ref } from "./pointers.ts"; +import { NOT_EXISTING } from "../runtime/constants.ts"; +import { Pointer, type MinimalJSRef, Ref } from "../runtime/pointers.ts"; import { localStorage } from "./storage-locations/local-storage-compat.ts"; import { MessageLogger } from "../utils/message_logger.ts"; -import { displayFatalError } from "./display.ts" +import { displayFatalError } from "../runtime/display.ts" import { Type } from "../types/type.ts"; import { addPersistentListener } from "../utils/persistent-listeners.ts"; import { Endpoint, LOCAL_ENDPOINT } from "../types/addressing.ts"; @@ -16,7 +16,7 @@ import { ESCAPE_SEQUENCES } from "../utils/logger.ts"; import { StorageMap } from "../types/storage-map.ts"; import { StorageSet } from "../types/storage-set.ts"; import { IterableWeakSet } from "../utils/iterable-weak-set.ts"; -import { LazyPointer } from "./lazy-pointer.ts"; +import { LazyPointer } from "../runtime/lazy-pointer.ts"; // displayInit(); diff --git a/types/storage-map.ts b/types/storage-map.ts index 65bd9b22..dfd3ebfb 100644 --- a/types/storage-map.ts +++ b/types/storage-map.ts @@ -3,7 +3,7 @@ import { Compiler } from "../compiler/compiler.ts"; import { DX_PTR } from "../runtime/constants.ts"; import { Pointer } from "../runtime/pointers.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { Logger } from "../utils/logger.ts"; const logger = new Logger("StorageMap"); diff --git a/types/storage-set.ts b/types/storage-set.ts index 95635256..1e4b0163 100644 --- a/types/storage-set.ts +++ b/types/storage-set.ts @@ -3,7 +3,7 @@ import { Compiler } from "../compiler/compiler.ts"; import { DX_PTR } from "../runtime/constants.ts"; import { Pointer } from "../runtime/pointers.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { Logger } from "../utils/logger.ts"; const logger = new Logger("StorageSet"); diff --git a/utils/eternals.ts b/utils/eternals.ts index 60c7c849..ad9ebd79 100644 --- a/utils/eternals.ts +++ b/utils/eternals.ts @@ -1,5 +1,5 @@ import { NOT_EXISTING } from "../runtime/constants.ts"; -import { Storage } from "../runtime/storage.ts"; +import { Storage } from "../storage/storage.ts"; import { getCallerInfo } from "./caller_metadata.ts"; import { logger } from "./global_values.ts"; diff --git a/utils/utils.ts b/utils/utils.ts index d568edab..abd7ba78 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -1,6 +1,6 @@ -//import { Storage } from "../runtime/storage.ts"; TODO Storage cannot be importet here, handle file caching somehow (somewhere else) +//import { Storage } from "../storage/storage.ts"; TODO Storage cannot be importet here, handle file caching somehow (somewhere else) import { ValueError } from "../types/errors.ts"; import { baseURL, Deno } from "./global_values.ts"; import { client_type } from "./constants.ts";