Initial commit: Open sourcing all of the Maple Open Technologies code.

This commit is contained in:
Bartlomiej Mika 2025-12-02 14:33:08 -05:00
commit 755d54a99d
2010 changed files with 448675 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DROP INDEX IF EXISTS maplepress.cache_expires_at_idx;
DROP TABLE IF EXISTS maplepress.cache;

View file

@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS maplepress.cache (
key TEXT PRIMARY KEY,
value BLOB,
expires_at TIMESTAMP
);

View file

@ -0,0 +1 @@
DROP INDEX IF EXISTS maplepress.cache_expires_at_idx;

View file

@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS cache_expires_at_idx ON maplepress.cache (expires_at);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.tenants_by_id;

View file

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS maplepress.tenants_by_id (
id UUID PRIMARY KEY,
name TEXT,
slug TEXT,
status TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.tenants_by_slug;

View file

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS maplepress.tenants_by_slug (
slug TEXT PRIMARY KEY,
id UUID,
name TEXT,
status TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.tenants_by_status;

View file

@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS maplepress.tenants_by_status (
status TEXT,
id UUID,
name TEXT,
slug TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY (status, id)
) WITH CLUSTERING ORDER BY (id ASC);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.users_by_id;

View file

@ -0,0 +1,63 @@
CREATE TABLE IF NOT EXISTS maplepress.users_by_id (
tenant_id UUID,
id UUID,
email TEXT,
first_name TEXT,
last_name TEXT,
name TEXT,
lexical_name TEXT,
timezone TEXT,
role INT,
status INT,
password_hash TEXT,
password_hash_algorithm TEXT,
-- Profile data
phone TEXT,
country TEXT,
region TEXT,
city TEXT,
postal_code TEXT,
address_line1 TEXT,
address_line2 TEXT,
has_shipping_address BOOLEAN,
shipping_name TEXT,
shipping_phone TEXT,
shipping_country TEXT,
shipping_region TEXT,
shipping_city TEXT,
shipping_postal_code TEXT,
shipping_address_line1 TEXT,
shipping_address_line2 TEXT,
profile_timezone TEXT,
agree_terms_of_service BOOLEAN,
agree_promotions BOOLEAN,
agree_to_tracking_across_third_party_apps_and_services BOOLEAN,
-- Security data
was_email_verified BOOLEAN,
code TEXT,
code_type TEXT,
code_expiry TIMESTAMP,
otp_enabled BOOLEAN,
otp_verified BOOLEAN,
otp_validated BOOLEAN,
otp_secret TEXT,
otp_auth_url TEXT,
otp_backup_code_hash TEXT,
otp_backup_code_hash_algorithm TEXT,
-- Timestamps
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- Metadata
created_by_user_id TEXT,
created_by_name TEXT,
modified_by_user_id TEXT,
modified_at TIMESTAMP,
modified_by_name TEXT,
last_login_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY ((tenant_id, id))
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.users_by_email;

View file

@ -0,0 +1,63 @@
CREATE TABLE IF NOT EXISTS maplepress.users_by_email (
tenant_id UUID,
email TEXT,
id UUID,
first_name TEXT,
last_name TEXT,
name TEXT,
lexical_name TEXT,
timezone TEXT,
role INT,
status INT,
password_hash TEXT,
password_hash_algorithm TEXT,
-- Profile data
phone TEXT,
country TEXT,
region TEXT,
city TEXT,
postal_code TEXT,
address_line1 TEXT,
address_line2 TEXT,
has_shipping_address BOOLEAN,
shipping_name TEXT,
shipping_phone TEXT,
shipping_country TEXT,
shipping_region TEXT,
shipping_city TEXT,
shipping_postal_code TEXT,
shipping_address_line1 TEXT,
shipping_address_line2 TEXT,
profile_timezone TEXT,
agree_terms_of_service BOOLEAN,
agree_promotions BOOLEAN,
agree_to_tracking_across_third_party_apps_and_services BOOLEAN,
-- Security data
was_email_verified BOOLEAN,
code TEXT,
code_type TEXT,
code_expiry TIMESTAMP,
otp_enabled BOOLEAN,
otp_verified BOOLEAN,
otp_validated BOOLEAN,
otp_secret TEXT,
otp_auth_url TEXT,
otp_backup_code_hash TEXT,
otp_backup_code_hash_algorithm TEXT,
-- Timestamps
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- Metadata
created_by_user_id TEXT,
created_by_name TEXT,
modified_by_user_id TEXT,
modified_at TIMESTAMP,
modified_by_name TEXT,
last_login_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY ((tenant_id, email))
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.users_by_date;

View file

@ -0,0 +1,64 @@
CREATE TABLE IF NOT EXISTS maplepress.users_by_date (
tenant_id UUID,
created_date TEXT,
id UUID,
email TEXT,
first_name TEXT,
last_name TEXT,
name TEXT,
lexical_name TEXT,
timezone TEXT,
role INT,
status INT,
password_hash TEXT,
password_hash_algorithm TEXT,
-- Profile data
phone TEXT,
country TEXT,
region TEXT,
city TEXT,
postal_code TEXT,
address_line1 TEXT,
address_line2 TEXT,
has_shipping_address BOOLEAN,
shipping_name TEXT,
shipping_phone TEXT,
shipping_country TEXT,
shipping_region TEXT,
shipping_city TEXT,
shipping_postal_code TEXT,
shipping_address_line1 TEXT,
shipping_address_line2 TEXT,
profile_timezone TEXT,
agree_terms_of_service BOOLEAN,
agree_promotions BOOLEAN,
agree_to_tracking_across_third_party_apps_and_services BOOLEAN,
-- Security data
was_email_verified BOOLEAN,
code TEXT,
code_type TEXT,
code_expiry TIMESTAMP,
otp_enabled BOOLEAN,
otp_verified BOOLEAN,
otp_validated BOOLEAN,
otp_secret TEXT,
otp_auth_url TEXT,
otp_backup_code_hash TEXT,
otp_backup_code_hash_algorithm TEXT,
-- Timestamps
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- Metadata
created_by_user_id TEXT,
created_by_name TEXT,
modified_by_user_id TEXT,
modified_at TIMESTAMP,
modified_by_name TEXT,
last_login_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY ((tenant_id, created_date), id)
) WITH CLUSTERING ORDER BY (id ASC);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.sites_by_id;

View file

@ -0,0 +1,32 @@
CREATE TABLE IF NOT EXISTS maplepress.sites_by_id (
tenant_id UUID,
id UUID,
site_url TEXT,
domain TEXT,
api_key_hash TEXT,
api_key_prefix TEXT,
api_key_last_four TEXT,
status TEXT,
is_verified BOOLEAN,
verification_token TEXT,
search_index_name TEXT,
total_pages_indexed BIGINT,
last_indexed_at TIMESTAMP,
plugin_version TEXT,
-- Usage tracking (for billing) - no limits/quotas
storage_used_bytes BIGINT,
search_requests_count BIGINT,
monthly_pages_indexed BIGINT,
last_reset_at TIMESTAMP,
language TEXT,
timezone TEXT,
notes TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY ((tenant_id, id))
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.sites_by_tenant;

View file

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS maplepress.sites_by_tenant (
tenant_id UUID,
created_at TIMESTAMP,
id UUID,
domain TEXT,
status TEXT,
is_verified BOOLEAN,
PRIMARY KEY (tenant_id, created_at, id)
) WITH CLUSTERING ORDER BY (created_at DESC, id ASC);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.sites_by_domain;

View file

@ -0,0 +1,31 @@
CREATE TABLE IF NOT EXISTS maplepress.sites_by_domain (
domain TEXT PRIMARY KEY,
tenant_id UUID,
id UUID,
site_url TEXT,
api_key_hash TEXT,
api_key_prefix TEXT,
api_key_last_four TEXT,
status TEXT,
is_verified BOOLEAN,
verification_token TEXT,
search_index_name TEXT,
total_pages_indexed BIGINT,
last_indexed_at TIMESTAMP,
plugin_version TEXT,
-- Usage tracking (for billing) - no limits/quotas
storage_used_bytes BIGINT,
search_requests_count BIGINT,
monthly_pages_indexed BIGINT,
last_reset_at TIMESTAMP,
language TEXT,
timezone TEXT,
notes TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.sites_by_apikey;

View file

@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS maplepress.sites_by_apikey (
api_key_hash TEXT PRIMARY KEY,
tenant_id UUID,
id UUID,
domain TEXT,
site_url TEXT,
api_key_prefix TEXT,
api_key_last_four TEXT,
status TEXT,
is_verified BOOLEAN,
search_index_name TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS maplepress.pages_by_site;

View file

@ -0,0 +1,24 @@
CREATE TABLE IF NOT EXISTS maplepress.pages_by_site (
site_id UUID,
page_id TEXT,
tenant_id UUID,
title TEXT,
content TEXT,
excerpt TEXT,
url TEXT,
status TEXT,
post_type TEXT,
author TEXT,
published_at TIMESTAMP,
modified_at TIMESTAMP,
indexed_at TIMESTAMP,
meilisearch_doc_id TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
-- CWE-359: IP address tracking for GDPR compliance (90-day retention)
created_from_ip_address TEXT,
created_from_ip_timestamp TIMESTAMP,
modified_from_ip_address TEXT,
modified_from_ip_timestamp TIMESTAMP,
PRIMARY KEY (site_id, page_id)
) WITH CLUSTERING ORDER BY (page_id ASC);