web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit 94e194d4738d492a5de276bcbc6b633abbe5d59f
parent c201528e6068300f883ebefab1331baf318fcef7
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Mon, 10 Feb 2025 09:53:26 +0000

client: refactor library for app/0.0.1

Diffstat:
Mclient/package.json | 2+-
Mclient/src/database/tauri.ts | 2+-
Mclient/src/database/types.ts | 2+-
Mclient/src/datastore/tauri.ts | 2+-
Mclient/src/geolocation/tauri.ts | 6+++---
Mclient/src/gui/tauri.ts | 2+-
Mclient/src/http/tauri.ts | 2+-
Mclient/src/http/types.ts | 2+-
Mclient/src/keys/tauri.ts | 2+-
Mclient/src/keys/types.ts | 2+-
Mclient/src/radroots/tauri.ts | 2+-
Mclient/src/radroots/types.ts | 2+-
12 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/client/package.json b/client/package.json @@ -13,7 +13,7 @@ "@noble/hashes": "^1.4.0", "@nostr-dev-kit/ndk": "^2.10.7", "@radroots/models": "workspace:*", - "@radroots/utils": "workspace:*", + "@radroots/util": "workspace:*", "@tauri-apps/api": "2.0.3", "@tauri-apps/plugin-dialog": "^2.0.1", "@tauri-apps/plugin-fs": "^2.0.1", diff --git a/client/src/database/tauri.ts b/client/src/database/tauri.ts @@ -1,6 +1,6 @@ import { location_gcs_parse, location_gcs_parse_list, location_gcs_parse_select_query, location_gcs_parse_select_query_list, location_gcs_parse_update_query, location_gcs_validate_form_fields, location_gcs_validate_update_form_fields, log_error_parse, log_error_parse_list, log_error_parse_select_query, log_error_parse_select_query_list, log_error_parse_update_query, log_error_validate_form_fields, log_error_validate_update_form_fields, media_image_parse, media_image_parse_list, media_image_parse_select_query, media_image_parse_select_query_list, media_image_parse_update_query, media_image_validate_form_fields, media_image_validate_update_form_fields, nostr_profile_parse, nostr_profile_parse_list, nostr_profile_parse_select_query, nostr_profile_parse_select_query_list, nostr_profile_parse_update_query, nostr_profile_validate_form_fields, nostr_profile_validate_update_form_fields, nostr_relay_parse, nostr_relay_parse_list, nostr_relay_parse_select_query, nostr_relay_parse_select_query_list, nostr_relay_parse_update_query, nostr_relay_validate_form_fields, nostr_relay_validate_update_form_fields, trade_product_parse, trade_product_parse_list, trade_product_parse_select_query, trade_product_parse_select_query_list, trade_product_parse_update_query, trade_product_validate_form_fields, trade_product_validate_update_form_fields, type ILocationGcsCreate, type ILocationGcsCreateHandler, type ILocationGcsCreateResolve, type ILocationGcsDelete, type ILocationGcsDeleteHandler, type ILocationGcsDeleteResolve, type ILocationGcsRead, type ILocationGcsReadHandler, type ILocationGcsReadList, type ILocationGcsReadListHandler, type ILocationGcsReadListResolve, type ILocationGcsReadResolve, type ILocationGcsUpdate, type ILocationGcsUpdateHandler, type ILocationGcsUpdateResolve, type ILogErrorCreate, type ILogErrorCreateHandler, type ILogErrorCreateResolve, type ILogErrorDelete, type ILogErrorDeleteHandler, type ILogErrorDeleteResolve, type ILogErrorRead, type ILogErrorReadHandler, type ILogErrorReadList, type ILogErrorReadListHandler, type ILogErrorReadListResolve, type ILogErrorReadResolve, type ILogErrorUpdate, type ILogErrorUpdateHandler, type ILogErrorUpdateResolve, type IMediaImageCreate, type IMediaImageCreateHandler, type IMediaImageCreateResolve, type IMediaImageDelete, type IMediaImageDeleteHandler, type IMediaImageDeleteResolve, type IMediaImageRead, type IMediaImageReadHandler, type IMediaImageReadList, type IMediaImageReadListHandler, type IMediaImageReadListResolve, type IMediaImageReadResolve, type IMediaImageUpdate, type IMediaImageUpdateHandler, type IMediaImageUpdateResolve, type INostrProfileCreate, type INostrProfileCreateHandler, type INostrProfileCreateResolve, type INostrProfileDelete, type INostrProfileDeleteHandler, type INostrProfileDeleteResolve, type INostrProfileRead, type INostrProfileReadHandler, type INostrProfileReadList, type INostrProfileReadListHandler, type INostrProfileReadListResolve, type INostrProfileReadResolve, type INostrProfileRelayRelation, type INostrProfileRelayResolve, type INostrProfileUpdate, type INostrProfileUpdateHandler, type INostrProfileUpdateResolve, type INostrRelayCreate, type INostrRelayCreateHandler, type INostrRelayCreateResolve, type INostrRelayDelete, type INostrRelayDeleteHandler, type INostrRelayDeleteResolve, type INostrRelayRead, type INostrRelayReadHandler, type INostrRelayReadList, type INostrRelayReadListHandler, type INostrRelayReadListResolve, type INostrRelayReadResolve, type INostrRelayUpdate, type INostrRelayUpdateHandler, type INostrRelayUpdateResolve, type ITradeProductCreate, type ITradeProductCreateHandler, type ITradeProductCreateResolve, type ITradeProductDelete, type ITradeProductDeleteHandler, type ITradeProductDeleteResolve, type ITradeProductLocationRelation, type ITradeProductLocationResolve, type ITradeProductMediaRelation, type ITradeProductMediaResolve, type ITradeProductRead, type ITradeProductReadHandler, type ITradeProductReadList, type ITradeProductReadListHandler, type ITradeProductReadListResolve, type ITradeProductReadResolve, type ITradeProductUpdate, type ITradeProductUpdateHandler, type ITradeProductUpdateResolve } from "@radroots/models"; -import { err_msg, is_err_response, is_pass_response, is_result_response, is_results_response, type ErrorMessage } from "@radroots/utils"; +import { err_msg, is_err_response, is_pass_response, is_result_response, is_results_response, type ErrorMessage } from "@radroots/util"; import { invoke } from "@tauri-apps/api/core"; import type { IClientTauriDatabase, IClientTauriDatabaseMessage } from "./types"; diff --git a/client/src/database/types.ts b/client/src/database/types.ts @@ -1,5 +1,5 @@ import { type ILocationGcsCreate, type ILocationGcsCreateResolve, type ILocationGcsDelete, type ILocationGcsDeleteResolve, type ILocationGcsRead, type ILocationGcsReadList, type ILocationGcsReadListResolve, type ILocationGcsReadResolve, type ILocationGcsUpdate, type ILocationGcsUpdateResolve, type ILogErrorCreate, type ILogErrorCreateResolve, type ILogErrorDelete, type ILogErrorDeleteResolve, type ILogErrorRead, type ILogErrorReadList, type ILogErrorReadListResolve, type ILogErrorReadResolve, type ILogErrorUpdate, type ILogErrorUpdateResolve, type IMediaImageCreate, type IMediaImageCreateResolve, type IMediaImageDelete, type IMediaImageDeleteResolve, type IMediaImageRead, type IMediaImageReadList, type IMediaImageReadListResolve, type IMediaImageReadResolve, type IMediaImageUpdate, type IMediaImageUpdateResolve, type INostrProfileCreate, type INostrProfileCreateResolve, type INostrProfileDelete, type INostrProfileDeleteResolve, type INostrProfileRead, type INostrProfileReadList, type INostrProfileReadListResolve, type INostrProfileReadResolve, type INostrProfileUpdate, type INostrProfileUpdateResolve, type INostrRelayCreate, type INostrRelayCreateResolve, type INostrRelayDelete, type INostrRelayDeleteResolve, type INostrRelayRead, type INostrRelayReadList, type INostrRelayReadListResolve, type INostrRelayReadResolve, type INostrRelayUpdate, type INostrRelayUpdateResolve, type ITradeProductCreate, type ITradeProductCreateResolve, type ITradeProductDelete, type ITradeProductDeleteResolve, type ITradeProductRead, type ITradeProductReadList, type ITradeProductReadListResolve, type ITradeProductReadResolve, type ITradeProductUpdate, type ITradeProductUpdateResolve } from "@radroots/models"; -import type { IClientDatabase } from "@radroots/utils"; +import type { IClientDatabase } from "@radroots/util"; export type IClientTauriDatabaseMessage = | string diff --git a/client/src/datastore/tauri.ts b/client/src/datastore/tauri.ts @@ -1,4 +1,4 @@ -import { ds_map, ds_map_param, err_msg, type IClientDatastore, type IClientDatastoreEntriesResolve, type IClientDatastoreGetPResolve, type IClientDatastoreGetResolve, type IClientDatastoreKeysResolve, type IClientDatastoreRemoveResolve, type IClientDatastoreSetPResolve, type IClientDatastoreSetResolve } from '@radroots/utils'; +import { ds_map, ds_map_param, err_msg, type IClientDatastore, type IClientDatastoreEntriesResolve, type IClientDatastoreGetPResolve, type IClientDatastoreGetResolve, type IClientDatastoreKeysResolve, type IClientDatastoreRemoveResolve, type IClientDatastoreSetPResolve, type IClientDatastoreSetResolve } from '@radroots/util'; import { load, Store } from '@tauri-apps/plugin-store'; export class TauriClientDatastore implements IClientDatastore { diff --git a/client/src/geolocation/tauri.ts b/client/src/geolocation/tauri.ts @@ -1,4 +1,4 @@ -import { err_msg, handle_error, parse_geol_coords, type ErrorMessage, type IClientGeolocation, type IClientGeolocationPosition, type IGeolocationErrorMessage } from '@radroots/utils'; +import { err_msg, handle_error, parse_geol_coords, type ErrorMessage, type IClientGeolocation, type IClientGeolocationPosition, type IGeolocationErrorMessage } from '@radroots/util'; import { checkPermissions, getCurrentPosition, @@ -39,13 +39,13 @@ export class TauriClientGeolocation implements IClientGeolocation { public async current(): Promise<IClientGeolocationPosition | ErrorMessage<IGeolocationErrorMessage>> { try { - if (!(await this.has_permissions())) return err_msg(`*-permissions`); + if (!(await this.has_permissions())) return err_msg(`error.client.geolocation.permission_denied`); const position = await getCurrentPosition() return this.parse_geolocation_position(position); } catch (e) { console.log(`e current`, e) const { err } = handle_error(e); - if (err.includes(`The operation couldn’t be completed`)) return err_msg(`*-permissions`); + if (err.includes(`The operation couldn’t be completed`)) return err_msg(`error.client.geolocation.location_unavailable`); return err_msg(`*`); }; } diff --git a/client/src/gui/tauri.ts b/client/src/gui/tauri.ts @@ -1,5 +1,5 @@ -import { type IClientGui, type IClientGuiDialogConfirmOpts, type IClientGuiDialogKind, type IClientGuiDialogResolve, type IClientGuiNotifyPermission, type IClientGuiNotifySendOptions } from '@radroots/utils'; +import { type IClientGui, type IClientGuiDialogConfirmOpts, type IClientGuiDialogKind, type IClientGuiDialogResolve, type IClientGuiNotifyPermission, type IClientGuiNotifySendOptions } from '@radroots/util'; import { confirm, type ConfirmDialogOptions, message, open, type OpenDialogOptions } from '@tauri-apps/plugin-dialog'; import { isPermissionGranted as isPermissionGrantedNotification, diff --git a/client/src/http/tauri.ts b/client/src/http/tauri.ts @@ -1,4 +1,4 @@ -import { err_msg, http_fetch_opts, http_parse_response, type ErrorMessage, type FieldRecord, type IHttpImageResponse, type IHttpOpts, type IHttpResponse } from '@radroots/utils'; +import { err_msg, http_fetch_opts, http_parse_response, type ErrorMessage, type FieldRecord, type IHttpImageResponse, type IHttpOpts, type IHttpResponse } from '@radroots/util'; import { fetch, type ClientOptions } from '@tauri-apps/plugin-http'; import type { IClientHttp } from './types'; diff --git a/client/src/http/types.ts b/client/src/http/types.ts @@ -1,4 +1,4 @@ -import type { ErrorMessage, IHttpImageResponse, IHttpOpts, IHttpResponse } from "@radroots/utils"; +import type { ErrorMessage, IHttpImageResponse, IHttpOpts, IHttpResponse } from "@radroots/util"; export type IClientHttp = { fetch(opts: IHttpOpts): Promise<IHttpResponse | ErrorMessage<string>>; diff --git a/client/src/keys/tauri.ts b/client/src/keys/tauri.ts @@ -1,5 +1,5 @@ -import { err_msg, is_pass_response, is_result_response, is_results_response, lib_nostr_secret_key_validate } from '@radroots/utils'; +import { err_msg, is_pass_response, is_result_response, is_results_response, lib_nostr_secret_key_validate } from '@radroots/util'; import { invoke } from '@tauri-apps/api/core'; import type { IClientKeys, IClientKeysNostrAddResolve, IClientKeysNostrCreateResolve, IClientKeysNostrDeleteResolve, IClientKeysNostrKeystoreResetResolve, IClientKeysNostrReadAllResolve, IClientKeysNostrReadResolve } from './types'; diff --git a/client/src/keys/types.ts b/client/src/keys/types.ts @@ -1,4 +1,4 @@ -import type { ErrorMessage, ResultPass, ResultPublicKey, ResultSecretKey, ResultsList } from "@radroots/utils"; +import type { ErrorMessage, ResultPass, ResultPublicKey, ResultSecretKey, ResultsList } from "@radroots/util"; export type ICoreDeviceMetadata = { os_arch: string; diff --git a/client/src/radroots/tauri.ts b/client/src/radroots/tauri.ts @@ -1,5 +1,5 @@ -import { err_msg, type IHttpResponse, is_err_response, is_error_response, lib_nostr_event_sign_attest } from '@radroots/utils'; +import { err_msg, type IHttpResponse, is_err_response, is_error_response, lib_nostr_event_sign_attest } from '@radroots/util'; import { lib_http } from '../lib'; import type { IClientRadroots, IClientRadrootsFetchMediaImageUpload, IClientRadrootsFetchMediaImageUploadResolve, IClientRadrootsFetchProfileActivate, IClientRadrootsFetchProfileActivateResolve, IClientRadrootsFetchProfileCreate, IClientRadrootsFetchProfileCreateResolve, IClientRadrootsFetchProfileRequest, IClientRadrootsFetchProfileRequestResolve } from './types'; diff --git a/client/src/radroots/types.ts b/client/src/radroots/types.ts @@ -1,4 +1,4 @@ -import { type ErrorMessage, type FilePath, type ResultObj, type ResultPass } from '@radroots/utils'; +import { type ErrorMessage, type FilePath, type ResultObj, type ResultPass } from '@radroots/util'; export type IClientRadrootsFetchProfileRequestMessage = | string