2024-11-04 19:03:26 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-03-24 19:34:05 +01:00
|
|
|
#include <AK/Variant.h>
|
2024-11-04 19:03:26 +01:00
|
|
|
#include <LibJS/Runtime/Realm.h>
|
2025-03-24 21:23:58 +01:00
|
|
|
#include <LibWeb/HTML/DOMStringList.h>
|
2024-11-04 19:03:26 +01:00
|
|
|
#include <LibWeb/IndexedDB/IDBRequest.h>
|
2024-11-11 10:49:36 +01:00
|
|
|
#include <LibWeb/IndexedDB/Internal/Key.h>
|
2024-11-04 19:03:26 +01:00
|
|
|
#include <LibWeb/StorageAPI/StorageKey.h>
|
|
|
|
|
|
|
|
namespace Web::IndexedDB {
|
|
|
|
|
2025-03-24 19:34:05 +01:00
|
|
|
using KeyPath = Variant<String, Vector<String>>;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<IDBDatabase>> open_a_database_connection(JS::Realm&, StorageAPI::StorageKey, String, Optional<u64>, GC::Ref<IDBRequest>);
|
|
|
|
bool fire_a_version_change_event(JS::Realm&, FlyString const&, GC::Ref<DOM::EventTarget>, u64, Optional<u64>);
|
2025-04-19 17:08:59 +02:00
|
|
|
WebIDL::ExceptionOr<ErrorOr<GC::Ref<Key>>> convert_a_value_to_a_key(JS::Realm&, JS::Value, Vector<JS::Value> = {});
|
2025-04-09 22:53:43 +02:00
|
|
|
void close_a_database_connection(GC::Ref<IDBDatabase>, bool forced = false);
|
2025-03-21 12:18:24 +01:00
|
|
|
GC::Ref<IDBTransaction> upgrade_a_database(JS::Realm&, GC::Ref<IDBDatabase>, u64, GC::Ref<IDBRequest>);
|
2024-12-01 21:10:28 +01:00
|
|
|
WebIDL::ExceptionOr<u64> delete_a_database(JS::Realm&, StorageAPI::StorageKey, String, GC::Ref<IDBRequest>);
|
2025-04-02 10:28:34 +02:00
|
|
|
void abort_a_transaction(GC::Ref<IDBTransaction>, GC::Ptr<WebIDL::DOMException>);
|
2025-01-08 23:25:46 +01:00
|
|
|
JS::Value convert_a_key_to_a_value(JS::Realm&, GC::Ref<Key>);
|
2025-03-24 19:34:05 +01:00
|
|
|
bool is_valid_key_path(KeyPath const&);
|
2025-03-24 21:23:58 +01:00
|
|
|
GC::Ref<HTML::DOMStringList> create_a_sorted_name_list(JS::Realm&, Vector<String>);
|
2025-04-09 23:11:12 +02:00
|
|
|
void commit_a_transaction(JS::Realm&, GC::Ref<IDBTransaction>);
|
2025-04-11 10:38:55 +02:00
|
|
|
WebIDL::ExceptionOr<JS::Value> clone_in_realm(JS::Realm&, JS::Value, GC::Ref<IDBTransaction>);
|
2025-04-11 10:46:21 +02:00
|
|
|
WebIDL::ExceptionOr<ErrorOr<GC::Ref<Key>>> convert_a_value_to_a_multi_entry_key(JS::Realm&, JS::Value);
|
2025-04-11 10:51:03 +02:00
|
|
|
WebIDL::ExceptionOr<ErrorOr<JS::Value>> evaluate_key_path_on_a_value(JS::Realm&, JS::Value, KeyPath const&);
|
2025-04-11 10:47:08 +02:00
|
|
|
WebIDL::ExceptionOr<ErrorOr<GC::Ref<Key>>> extract_a_key_from_a_value_using_a_key_path(JS::Realm&, JS::Value, KeyPath const&, bool = false);
|
2025-04-11 10:54:23 +02:00
|
|
|
bool check_that_a_key_could_be_injected_into_a_value(JS::Realm&, JS::Value, KeyPath const&);
|
2025-04-11 11:09:16 +02:00
|
|
|
void fire_an_error_event(JS::Realm&, GC::Ref<IDBRequest>);
|
2025-04-11 11:10:05 +02:00
|
|
|
void fire_a_success_event(JS::Realm&, GC::Ref<IDBRequest>);
|
2025-04-11 11:22:29 +02:00
|
|
|
GC::Ref<IDBRequest> asynchronously_execute_a_request(JS::Realm&, IDBRequestSource, GC::Ref<GC::Function<WebIDL::ExceptionOr<JS::Value>()>>, GC::Ptr<IDBRequest> = nullptr);
|
2025-04-11 11:25:56 +02:00
|
|
|
ErrorOr<u64> generate_a_key(GC::Ref<ObjectStore>);
|
2025-04-11 11:27:22 +02:00
|
|
|
void possibly_update_the_key_generator(GC::Ref<ObjectStore>, GC::Ref<Key>);
|
2024-11-04 19:03:26 +01:00
|
|
|
|
|
|
|
}
|