@rovela-ai/sdk 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/api/auth.js +5 -11
- package/dist/admin/api/auth.js.map +1 -1
- package/dist/admin/api/categories.js +43 -50
- package/dist/admin/api/categories.js.map +1 -1
- package/dist/admin/api/check.js +6 -9
- package/dist/admin/api/check.js.map +1 -1
- package/dist/admin/api/customers.js +17 -21
- package/dist/admin/api/customers.js.map +1 -1
- package/dist/admin/api/index.js +10 -38
- package/dist/admin/api/index.js.map +1 -1
- package/dist/admin/api/orders.js +30 -35
- package/dist/admin/api/orders.js.map +1 -1
- package/dist/admin/api/products.js +56 -66
- package/dist/admin/api/products.js.map +1 -1
- package/dist/admin/api/refund.js +26 -29
- package/dist/admin/api/refund.js.map +1 -1
- package/dist/admin/api/settings.js +17 -21
- package/dist/admin/api/settings.js.map +1 -1
- package/dist/admin/api/setup.js +17 -20
- package/dist/admin/api/setup.js.map +1 -1
- package/dist/admin/api/stats.js +14 -17
- package/dist/admin/api/stats.js.map +1 -1
- package/dist/admin/components/AdminGuard.js +13 -17
- package/dist/admin/components/AdminGuard.js.map +1 -1
- package/dist/admin/components/AdminHeader.js +8 -11
- package/dist/admin/components/AdminHeader.js.map +1 -1
- package/dist/admin/components/AdminLayout.js +5 -8
- package/dist/admin/components/AdminLayout.js.map +1 -1
- package/dist/admin/components/AdminLoginForm.js +11 -14
- package/dist/admin/components/AdminLoginForm.js.map +1 -1
- package/dist/admin/components/AdminNav.js +11 -14
- package/dist/admin/components/AdminNav.js.map +1 -1
- package/dist/admin/components/AdminSetupForm.js +11 -14
- package/dist/admin/components/AdminSetupForm.js.map +1 -1
- package/dist/admin/components/InventoryEditor.js +16 -19
- package/dist/admin/components/InventoryEditor.js.map +1 -1
- package/dist/admin/components/LowStockAlert.js +6 -9
- package/dist/admin/components/LowStockAlert.js.map +1 -1
- package/dist/admin/components/OrderDetails.js +15 -18
- package/dist/admin/components/OrderDetails.js.map +1 -1
- package/dist/admin/components/OrderTable.js +13 -16
- package/dist/admin/components/OrderTable.js.map +1 -1
- package/dist/admin/components/ProductForm.js +17 -20
- package/dist/admin/components/ProductForm.js.map +1 -1
- package/dist/admin/components/ProductTable.js +15 -18
- package/dist/admin/components/ProductTable.js.map +1 -1
- package/dist/admin/components/RecentOrders.js +6 -9
- package/dist/admin/components/RecentOrders.js.map +1 -1
- package/dist/admin/components/RefundDialog.js +12 -15
- package/dist/admin/components/RefundDialog.js.map +1 -1
- package/dist/admin/components/StatsCards.js +7 -10
- package/dist/admin/components/StatsCards.js.map +1 -1
- package/dist/admin/components/StoreSettings.js +10 -13
- package/dist/admin/components/StoreSettings.js.map +1 -1
- package/dist/admin/components/index.js +16 -35
- package/dist/admin/components/index.js.map +1 -1
- package/dist/admin/config.js +12 -54
- package/dist/admin/config.js.map +1 -1
- package/dist/admin/hooks/index.js +4 -11
- package/dist/admin/hooks/index.js.map +1 -1
- package/dist/admin/hooks/useAdminAuth.js +9 -12
- package/dist/admin/hooks/useAdminAuth.js.map +1 -1
- package/dist/admin/hooks/useAdminOrders.js +11 -14
- package/dist/admin/hooks/useAdminOrders.js.map +1 -1
- package/dist/admin/hooks/useAdminProducts.js +13 -16
- package/dist/admin/hooks/useAdminProducts.js.map +1 -1
- package/dist/admin/hooks/useAdminStats.js +11 -14
- package/dist/admin/hooks/useAdminStats.js.map +1 -1
- package/dist/admin/index.js +13 -66
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/server/admin-service.js +39 -83
- package/dist/admin/server/admin-service.js.map +1 -1
- package/dist/admin/server/index.js +3 -13
- package/dist/admin/server/index.js.map +1 -1
- package/dist/admin/types.js +1 -2
- package/dist/admin/types.js.map +1 -1
- package/dist/auth/api/auth.js +6 -14
- package/dist/auth/api/auth.js.map +1 -1
- package/dist/auth/api/forgot-password.js +8 -11
- package/dist/auth/api/forgot-password.js.map +1 -1
- package/dist/auth/api/index.js +6 -18
- package/dist/auth/api/index.js.map +1 -1
- package/dist/auth/api/register.js +17 -20
- package/dist/auth/api/register.js.map +1 -1
- package/dist/auth/api/resend-verification.js +9 -12
- package/dist/auth/api/resend-verification.js.map +1 -1
- package/dist/auth/api/reset-password.js +18 -22
- package/dist/auth/api/reset-password.js.map +1 -1
- package/dist/auth/api/verify-email.js +14 -18
- package/dist/auth/api/verify-email.js.map +1 -1
- package/dist/auth/components/AuthGuard.js +13 -17
- package/dist/auth/components/AuthGuard.js.map +1 -1
- package/dist/auth/components/ForgotPasswordForm.js +11 -14
- package/dist/auth/components/ForgotPasswordForm.js.map +1 -1
- package/dist/auth/components/ResetPasswordForm.js +18 -21
- package/dist/auth/components/ResetPasswordForm.js.map +1 -1
- package/dist/auth/components/SignInForm.js +13 -16
- package/dist/auth/components/SignInForm.js.map +1 -1
- package/dist/auth/components/SignUpForm.js +15 -18
- package/dist/auth/components/SignUpForm.js.map +1 -1
- package/dist/auth/components/UserMenu.js +13 -16
- package/dist/auth/components/UserMenu.js.map +1 -1
- package/dist/auth/components/VerifyEmailNotice.js +10 -13
- package/dist/auth/components/VerifyEmailNotice.js.map +1 -1
- package/dist/auth/components/index.js +7 -18
- package/dist/auth/components/index.js.map +1 -1
- package/dist/auth/config.js +9 -49
- package/dist/auth/config.js.map +1 -1
- package/dist/auth/hooks/index.js +1 -5
- package/dist/auth/hooks/index.js.map +1 -1
- package/dist/auth/hooks/useAuth.js +14 -17
- package/dist/auth/hooks/useAuth.js.map +1 -1
- package/dist/auth/index.js +15 -37
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/server/customer-service.js +39 -83
- package/dist/auth/server/customer-service.js.map +1 -1
- package/dist/auth/server/email-sender.js +11 -17
- package/dist/auth/server/email-sender.js.map +1 -1
- package/dist/auth/server/index.js +5 -36
- package/dist/auth/server/index.js.map +1 -1
- package/dist/auth/server/password-reset-service.js +30 -70
- package/dist/auth/server/password-reset-service.js.map +1 -1
- package/dist/auth/server/password.js +9 -18
- package/dist/auth/server/password.js.map +1 -1
- package/dist/auth/server/verification-service.js +35 -76
- package/dist/auth/server/verification-service.js.map +1 -1
- package/dist/auth/types.js +1 -2
- package/dist/auth/types.js.map +1 -1
- package/dist/cart/CartProvider.js +13 -17
- package/dist/cart/CartProvider.js.map +1 -1
- package/dist/cart/components/AddToCartButton.js +16 -19
- package/dist/cart/components/AddToCartButton.js.map +1 -1
- package/dist/cart/components/CartDrawer.js +17 -23
- package/dist/cart/components/CartDrawer.js.map +1 -1
- package/dist/cart/components/CartIcon.js +9 -12
- package/dist/cart/components/CartIcon.js.map +1 -1
- package/dist/cart/components/CartItem.js +7 -13
- package/dist/cart/components/CartItem.js.map +1 -1
- package/dist/cart/components/CartSummary.js +12 -15
- package/dist/cart/components/CartSummary.js.map +1 -1
- package/dist/cart/components/QuantitySelector.js +9 -12
- package/dist/cart/components/QuantitySelector.js.map +1 -1
- package/dist/cart/components/index.js +6 -15
- package/dist/cart/components/index.js.map +1 -1
- package/dist/cart/index.js +3 -17
- package/dist/cart/index.js.map +1 -1
- package/dist/cart/store.js +8 -13
- package/dist/cart/store.js.map +1 -1
- package/dist/checkout/api/checkout.js +12 -15
- package/dist/checkout/api/checkout.js.map +1 -1
- package/dist/checkout/api/index.js +2 -7
- package/dist/checkout/api/index.js.map +1 -1
- package/dist/checkout/api/webhook.js +8 -11
- package/dist/checkout/api/webhook.js.map +1 -1
- package/dist/checkout/components/CheckoutButton.js +8 -11
- package/dist/checkout/components/CheckoutButton.js.map +1 -1
- package/dist/checkout/components/CheckoutSuccess.js +11 -14
- package/dist/checkout/components/CheckoutSuccess.js.map +1 -1
- package/dist/checkout/components/OrderSummary.js +8 -11
- package/dist/checkout/components/OrderSummary.js.map +1 -1
- package/dist/checkout/components/ShippingForm.js +14 -17
- package/dist/checkout/components/ShippingForm.js.map +1 -1
- package/dist/checkout/components/index.js +4 -11
- package/dist/checkout/components/index.js.map +1 -1
- package/dist/checkout/hooks/index.js +1 -6
- package/dist/checkout/hooks/index.js.map +1 -1
- package/dist/checkout/hooks/useCheckout.js +10 -19
- package/dist/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/checkout/index.js +7 -28
- package/dist/checkout/index.js.map +1 -1
- package/dist/checkout/server/create-checkout-session.js +11 -16
- package/dist/checkout/server/create-checkout-session.js.map +1 -1
- package/dist/checkout/server/handle-webhook.js +21 -24
- package/dist/checkout/server/handle-webhook.js.map +1 -1
- package/dist/checkout/server/index.js +3 -13
- package/dist/checkout/server/index.js.map +1 -1
- package/dist/checkout/server/order-service.js +11 -16
- package/dist/checkout/server/order-service.js.map +1 -1
- package/dist/checkout/stripe/client.js +13 -29
- package/dist/checkout/stripe/client.js.map +1 -1
- package/dist/checkout/stripe/index.js +1 -15
- package/dist/checkout/stripe/index.js.map +1 -1
- package/dist/checkout/types.js +1 -2
- package/dist/checkout/types.js.map +1 -1
- package/dist/core/config.js +12 -57
- package/dist/core/config.js.map +1 -1
- package/dist/core/db/client.js +16 -62
- package/dist/core/db/client.js.map +1 -1
- package/dist/core/db/index.js +14 -93
- package/dist/core/db/index.js.map +1 -1
- package/dist/core/db/queries.js +207 -284
- package/dist/core/db/queries.js.map +1 -1
- package/dist/core/db/schema.js +179 -182
- package/dist/core/db/schema.js.map +1 -1
- package/dist/core/index.js +12 -42
- package/dist/core/index.js.map +1 -1
- package/dist/core/server/index.js +16 -68
- package/dist/core/server/index.js.map +1 -1
- package/dist/core/types.js +1 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/utils.js +26 -51
- package/dist/core/utils.js.map +1 -1
- package/dist/emails/config.js +13 -21
- package/dist/emails/config.js.map +1 -1
- package/dist/emails/index.js +10 -72
- package/dist/emails/index.js.map +1 -1
- package/dist/emails/send/auth.js +26 -34
- package/dist/emails/send/auth.js.map +1 -1
- package/dist/emails/send/index.js +2 -21
- package/dist/emails/send/index.js.map +1 -1
- package/dist/emails/send/orders.js +38 -50
- package/dist/emails/send/orders.js.map +1 -1
- package/dist/emails/sender.js +7 -12
- package/dist/emails/sender.js.map +1 -1
- package/dist/emails/templates/base.js +37 -53
- package/dist/emails/templates/base.js.map +1 -1
- package/dist/emails/templates/email-verification.js +12 -16
- package/dist/emails/templates/email-verification.js.map +1 -1
- package/dist/emails/templates/index.js +9 -43
- package/dist/emails/templates/index.js.map +1 -1
- package/dist/emails/templates/order-cancelled.js +18 -22
- package/dist/emails/templates/order-cancelled.js.map +1 -1
- package/dist/emails/templates/order-confirmation.js +30 -34
- package/dist/emails/templates/order-confirmation.js.map +1 -1
- package/dist/emails/templates/order-delivered.js +20 -24
- package/dist/emails/templates/order-delivered.js.map +1 -1
- package/dist/emails/templates/order-shipped.js +19 -23
- package/dist/emails/templates/order-shipped.js.map +1 -1
- package/dist/emails/templates/password-reset.js +12 -16
- package/dist/emails/templates/password-reset.js.map +1 -1
- package/dist/emails/templates/refund-processed.js +17 -21
- package/dist/emails/templates/refund-processed.js.map +1 -1
- package/dist/emails/templates/welcome.js +11 -15
- package/dist/emails/templates/welcome.js.map +1 -1
- package/dist/emails/types.js +1 -2
- package/dist/emails/types.js.map +1 -1
- package/dist/emails/utils.js +9 -20
- package/dist/emails/utils.js.map +1 -1
- package/dist/index.js +24 -176
- package/dist/index.js.map +1 -1
- package/dist/products/api/categories.js +7 -10
- package/dist/products/api/categories.js.map +1 -1
- package/dist/products/api/index.js +3 -9
- package/dist/products/api/index.js.map +1 -1
- package/dist/products/api/product.js +10 -13
- package/dist/products/api/product.js.map +1 -1
- package/dist/products/api/products.js +8 -11
- package/dist/products/api/products.js.map +1 -1
- package/dist/products/components/CategoryNav.js +20 -26
- package/dist/products/components/CategoryNav.js.map +1 -1
- package/dist/products/components/ProductBreadcrumb.js +7 -13
- package/dist/products/components/ProductBreadcrumb.js.map +1 -1
- package/dist/products/components/ProductCard.js +6 -12
- package/dist/products/components/ProductCard.js.map +1 -1
- package/dist/products/components/ProductDetails.js +14 -17
- package/dist/products/components/ProductDetails.js.map +1 -1
- package/dist/products/components/ProductFilters.js +15 -18
- package/dist/products/components/ProductFilters.js.map +1 -1
- package/dist/products/components/ProductGallery.js +17 -23
- package/dist/products/components/ProductGallery.js.map +1 -1
- package/dist/products/components/ProductGrid.js +10 -13
- package/dist/products/components/ProductGrid.js.map +1 -1
- package/dist/products/components/ProductSearch.js +14 -17
- package/dist/products/components/ProductSearch.js.map +1 -1
- package/dist/products/components/ProductSort.js +8 -11
- package/dist/products/components/ProductSort.js.map +1 -1
- package/dist/products/components/VariantSelector.js +16 -19
- package/dist/products/components/VariantSelector.js.map +1 -1
- package/dist/products/components/index.js +10 -23
- package/dist/products/components/index.js.map +1 -1
- package/dist/products/hooks/index.js +4 -11
- package/dist/products/hooks/index.js.map +1 -1
- package/dist/products/hooks/useCategories.js +12 -15
- package/dist/products/hooks/useCategories.js.map +1 -1
- package/dist/products/hooks/useProduct.js +9 -12
- package/dist/products/hooks/useProduct.js.map +1 -1
- package/dist/products/hooks/useProductAttributes.js +10 -13
- package/dist/products/hooks/useProductAttributes.js.map +1 -1
- package/dist/products/hooks/useProducts.js +15 -18
- package/dist/products/hooks/useProducts.js.map +1 -1
- package/dist/products/index.js +6 -23
- package/dist/products/index.js.map +1 -1
- package/dist/theme/ThemeProvider.js +12 -14
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/colors.js +3 -8
- package/dist/theme/colors.js.map +1 -1
- package/dist/theme/defaults.js +27 -30
- package/dist/theme/defaults.js.map +1 -1
- package/dist/theme/fonts.js +12 -18
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/generator.js +63 -69
- package/dist/theme/generator.js.map +1 -1
- package/dist/theme/hooks.js +11 -16
- package/dist/theme/hooks.js.map +1 -1
- package/dist/theme/index.js +6 -42
- package/dist/theme/index.js.map +1 -1
- package/package.json +35 -34
package/dist/core/config.js
CHANGED
|
@@ -1,56 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @rovela/sdk/core/config
|
|
4
3
|
*
|
|
5
4
|
* Configuration system for reading blueprint.json at runtime.
|
|
6
5
|
* The blueprint is generated by Rovela and placed at .rovela/blueprint.json
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.loadBlueprint = loadBlueprint;
|
|
43
|
-
exports.getBlueprint = getBlueprint;
|
|
44
|
-
exports.getStoreConfig = getStoreConfig;
|
|
45
|
-
exports.clearConfigCache = clearConfigCache;
|
|
46
|
-
exports.blueprintExists = blueprintExists;
|
|
47
|
-
exports.getTheme = getTheme;
|
|
48
|
-
exports.getBrand = getBrand;
|
|
49
|
-
exports.getHomepage = getHomepage;
|
|
50
|
-
exports.getModules = getModules;
|
|
51
|
-
exports.getSEO = getSEO;
|
|
52
|
-
const fs = __importStar(require("fs"));
|
|
53
|
-
const path = __importStar(require("path"));
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
54
9
|
// =============================================================================
|
|
55
10
|
// Configuration Loading
|
|
56
11
|
// =============================================================================
|
|
@@ -70,7 +25,7 @@ function getBlueprintPath() {
|
|
|
70
25
|
* Load and parse the blueprint.json file
|
|
71
26
|
* @throws Error if blueprint file is not found or invalid
|
|
72
27
|
*/
|
|
73
|
-
function loadBlueprint() {
|
|
28
|
+
export function loadBlueprint() {
|
|
74
29
|
if (cachedBlueprint) {
|
|
75
30
|
return cachedBlueprint;
|
|
76
31
|
}
|
|
@@ -92,14 +47,14 @@ function loadBlueprint() {
|
|
|
92
47
|
* Get the full blueprint object
|
|
93
48
|
* Use this when you need access to all blueprint data (theme, brand, homepage, etc.)
|
|
94
49
|
*/
|
|
95
|
-
function getBlueprint() {
|
|
50
|
+
export function getBlueprint() {
|
|
96
51
|
return loadBlueprint();
|
|
97
52
|
}
|
|
98
53
|
/**
|
|
99
54
|
* Get simplified store configuration
|
|
100
55
|
* Use this for basic store info (name, currency, locale)
|
|
101
56
|
*/
|
|
102
|
-
function getStoreConfig() {
|
|
57
|
+
export function getStoreConfig() {
|
|
103
58
|
if (cachedConfig) {
|
|
104
59
|
return cachedConfig;
|
|
105
60
|
}
|
|
@@ -116,14 +71,14 @@ function getStoreConfig() {
|
|
|
116
71
|
/**
|
|
117
72
|
* Clear cached blueprint and config (useful for testing or hot reloading)
|
|
118
73
|
*/
|
|
119
|
-
function clearConfigCache() {
|
|
74
|
+
export function clearConfigCache() {
|
|
120
75
|
cachedBlueprint = null;
|
|
121
76
|
cachedConfig = null;
|
|
122
77
|
}
|
|
123
78
|
/**
|
|
124
79
|
* Check if blueprint exists at the expected path
|
|
125
80
|
*/
|
|
126
|
-
function blueprintExists() {
|
|
81
|
+
export function blueprintExists() {
|
|
127
82
|
return fs.existsSync(getBlueprintPath());
|
|
128
83
|
}
|
|
129
84
|
// =============================================================================
|
|
@@ -132,31 +87,31 @@ function blueprintExists() {
|
|
|
132
87
|
/**
|
|
133
88
|
* Get theme configuration from blueprint
|
|
134
89
|
*/
|
|
135
|
-
function getTheme() {
|
|
90
|
+
export function getTheme() {
|
|
136
91
|
return loadBlueprint().theme;
|
|
137
92
|
}
|
|
138
93
|
/**
|
|
139
94
|
* Get brand configuration from blueprint
|
|
140
95
|
*/
|
|
141
|
-
function getBrand() {
|
|
96
|
+
export function getBrand() {
|
|
142
97
|
return loadBlueprint().brand;
|
|
143
98
|
}
|
|
144
99
|
/**
|
|
145
100
|
* Get homepage configuration from blueprint
|
|
146
101
|
*/
|
|
147
|
-
function getHomepage() {
|
|
102
|
+
export function getHomepage() {
|
|
148
103
|
return loadBlueprint().homepage;
|
|
149
104
|
}
|
|
150
105
|
/**
|
|
151
106
|
* Get module configuration from blueprint
|
|
152
107
|
*/
|
|
153
|
-
function getModules() {
|
|
108
|
+
export function getModules() {
|
|
154
109
|
return loadBlueprint().modules;
|
|
155
110
|
}
|
|
156
111
|
/**
|
|
157
112
|
* Get SEO configuration from blueprint
|
|
158
113
|
*/
|
|
159
|
-
function getSEO() {
|
|
114
|
+
export function getSEO() {
|
|
160
115
|
return loadBlueprint().seo;
|
|
161
116
|
}
|
|
162
117
|
//# sourceMappingURL=config.js.map
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH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1
|
/**
|
|
3
2
|
* @rovela/sdk/core/db/client
|
|
4
3
|
*
|
|
5
4
|
* Neon serverless database client with Drizzle ORM
|
|
6
5
|
* Includes tenant isolation for multi-tenant e-commerce stores
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.db = void 0;
|
|
43
|
-
exports.getSql = getSql;
|
|
44
|
-
exports.getDb = getDb;
|
|
45
|
-
exports.setTenantId = setTenantId;
|
|
46
|
-
exports.getTenantId = getTenantId;
|
|
47
|
-
exports.clearTenantId = clearTenantId;
|
|
48
|
-
exports.initTenantFromEnv = initTenantFromEnv;
|
|
49
|
-
exports.withTenant = withTenant;
|
|
50
|
-
exports.withTenantSql = withTenantSql;
|
|
51
|
-
exports.checkConnection = checkConnection;
|
|
52
|
-
exports.getConnectionInfo = getConnectionInfo;
|
|
53
|
-
const serverless_1 = require("@neondatabase/serverless");
|
|
54
|
-
const neon_http_1 = require("drizzle-orm/neon-http");
|
|
55
|
-
const schema = __importStar(require("./schema"));
|
|
7
|
+
import { neon } from '@neondatabase/serverless';
|
|
8
|
+
import { drizzle } from 'drizzle-orm/neon-http';
|
|
9
|
+
import * as schema from './schema';
|
|
56
10
|
// =============================================================================
|
|
57
11
|
// Configuration
|
|
58
12
|
// =============================================================================
|
|
@@ -74,9 +28,9 @@ let _db = null;
|
|
|
74
28
|
* Get the raw Neon SQL client
|
|
75
29
|
* Use this for raw SQL queries when needed
|
|
76
30
|
*/
|
|
77
|
-
function getSql() {
|
|
31
|
+
export function getSql() {
|
|
78
32
|
if (!_sql) {
|
|
79
|
-
_sql =
|
|
33
|
+
_sql = neon(getDatabaseUrl());
|
|
80
34
|
}
|
|
81
35
|
return _sql;
|
|
82
36
|
}
|
|
@@ -84,10 +38,10 @@ function getSql() {
|
|
|
84
38
|
* Get the Drizzle ORM database client with full schema
|
|
85
39
|
* This is the main entry point for database operations
|
|
86
40
|
*/
|
|
87
|
-
function getDb() {
|
|
41
|
+
export function getDb() {
|
|
88
42
|
if (!_db) {
|
|
89
43
|
const sql = getSql();
|
|
90
|
-
_db =
|
|
44
|
+
_db = drizzle(sql, { schema });
|
|
91
45
|
}
|
|
92
46
|
return _db;
|
|
93
47
|
}
|
|
@@ -97,7 +51,7 @@ function getDb() {
|
|
|
97
51
|
*
|
|
98
52
|
* Note: This is a lazy-loaded proxy to avoid connection at import time
|
|
99
53
|
*/
|
|
100
|
-
|
|
54
|
+
export const db = new Proxy({}, {
|
|
101
55
|
get(_target, prop) {
|
|
102
56
|
const database = getDb();
|
|
103
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -116,7 +70,7 @@ let currentTenantId = null;
|
|
|
116
70
|
* Set the current tenant ID for the request
|
|
117
71
|
* All queries using withTenant() will be scoped to this tenant
|
|
118
72
|
*/
|
|
119
|
-
function setTenantId(tenantId) {
|
|
73
|
+
export function setTenantId(tenantId) {
|
|
120
74
|
currentTenantId = tenantId;
|
|
121
75
|
}
|
|
122
76
|
/**
|
|
@@ -124,7 +78,7 @@ function setTenantId(tenantId) {
|
|
|
124
78
|
* Auto-initializes from TENANT_ID environment variable if not already set.
|
|
125
79
|
* @throws Error if tenant ID is not set and TENANT_ID env var is missing
|
|
126
80
|
*/
|
|
127
|
-
function getTenantId() {
|
|
81
|
+
export function getTenantId() {
|
|
128
82
|
if (!currentTenantId) {
|
|
129
83
|
// Auto-initialize from environment variable (lazy initialization)
|
|
130
84
|
const envTenantId = process.env.TENANT_ID;
|
|
@@ -140,14 +94,14 @@ function getTenantId() {
|
|
|
140
94
|
/**
|
|
141
95
|
* Clear the tenant context (call at end of request)
|
|
142
96
|
*/
|
|
143
|
-
function clearTenantId() {
|
|
97
|
+
export function clearTenantId() {
|
|
144
98
|
currentTenantId = null;
|
|
145
99
|
}
|
|
146
100
|
/**
|
|
147
101
|
* Initialize tenant from environment variable
|
|
148
102
|
* Useful for single-tenant deployments
|
|
149
103
|
*/
|
|
150
|
-
function initTenantFromEnv() {
|
|
104
|
+
export function initTenantFromEnv() {
|
|
151
105
|
const envTenantId = process.env.TENANT_ID;
|
|
152
106
|
if (envTenantId) {
|
|
153
107
|
setTenantId(envTenantId);
|
|
@@ -174,7 +128,7 @@ async function setDbTenantId(tenantId) {
|
|
|
174
128
|
* return db.query.products.findMany()
|
|
175
129
|
* })
|
|
176
130
|
*/
|
|
177
|
-
async function withTenant(tenantId, fn) {
|
|
131
|
+
export async function withTenant(tenantId, fn) {
|
|
178
132
|
const previousTenantId = currentTenantId;
|
|
179
133
|
try {
|
|
180
134
|
// Set at application level
|
|
@@ -201,7 +155,7 @@ async function withTenant(tenantId, fn) {
|
|
|
201
155
|
* return sql`SELECT * FROM products WHERE status = 'active'`
|
|
202
156
|
* })
|
|
203
157
|
*/
|
|
204
|
-
async function withTenantSql(tenantId, fn) {
|
|
158
|
+
export async function withTenantSql(tenantId, fn) {
|
|
205
159
|
const sql = getSql();
|
|
206
160
|
// Set tenant for this connection
|
|
207
161
|
await sql `SELECT set_config('app.tenant_id', ${tenantId}, false)`;
|
|
@@ -214,7 +168,7 @@ async function withTenantSql(tenantId, fn) {
|
|
|
214
168
|
* Check database connection health
|
|
215
169
|
* Returns true if connection is successful
|
|
216
170
|
*/
|
|
217
|
-
async function checkConnection() {
|
|
171
|
+
export async function checkConnection() {
|
|
218
172
|
try {
|
|
219
173
|
const sql = getSql();
|
|
220
174
|
await sql `SELECT 1`;
|
|
@@ -227,7 +181,7 @@ async function checkConnection() {
|
|
|
227
181
|
/**
|
|
228
182
|
* Get database connection info (for debugging)
|
|
229
183
|
*/
|
|
230
|
-
function getConnectionInfo() {
|
|
184
|
+
export function getConnectionInfo() {
|
|
231
185
|
return {
|
|
232
186
|
hasUrl: !!process.env.DATABASE_URL,
|
|
233
187
|
hasTenant: !!currentTenantId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/db/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/db/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAqB,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,OAAO,EAAoB,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAElC,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAE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H,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,EAAwD;IAExD,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;IACpB,iCAAiC;IACjC,MAAM,GAAG,CAAA,sCAAsC,QAAQ,UAAU,CAAA;IACjE,OAAO,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;AACtB,CAAC;AAED,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;QACpB,MAAM,GAAG,CAAA,UAAU,CAAA;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAK/B,OAAO;QACL,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY;QAClC,SAAS,EAAE,CAAC,CAAC,eAAe;QAC5B,QAAQ,EAAE,eAAe;KAC1B,CAAA;AACH,CAAC"}
|
package/dist/core/db/index.js
CHANGED
|
@@ -1,113 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @rovela/sdk/core/db
|
|
4
3
|
*
|
|
5
4
|
* Database module exports
|
|
6
5
|
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.getStoreStats = exports.findAdminByEmail = exports.findCustomerOrders = exports.countCustomers = exports.findCustomers = exports.findCustomerById = exports.findCustomerByEmail = exports.updateOrderStatus = exports.createOrderItems = exports.createOrder = exports.getOrdersByStatus = exports.getRevenueByPeriod = exports.countOrders = exports.findOrderByPaymentIntent = exports.findOrderItems = exports.findOrderById = exports.findOrders = exports.deleteCategory = exports.updateCategory = exports.createCategory = exports.countCategories = exports.findCategoryById = exports.findCategoryBySlug = exports.findCategories = exports.findVariantById = exports.updateVariantInventory = exports.deleteProductVariant = exports.updateProductVariant = exports.createProductVariant = exports.hardDeleteProduct = exports.deleteProduct = exports.updateProduct = exports.createProduct = exports.countProducts = exports.findProductVariants = exports.findProductById = exports.findProductBySlug = exports.findProducts = exports.schema = exports.getConnectionInfo = exports.checkConnection = exports.withTenantSql = exports.withTenant = exports.initTenantFromEnv = exports.clearTenantId = exports.getTenantId = exports.setTenantId = exports.getSql = exports.getDb = exports.db = void 0;
|
|
42
|
-
exports.upsertSettings = exports.findSettings = exports.getRecentOrders = exports.getLowStockProducts = void 0;
|
|
43
6
|
// Client and tenant management
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "db", { enumerable: true, get: function () { return client_1.db; } });
|
|
46
|
-
Object.defineProperty(exports, "getDb", { enumerable: true, get: function () { return client_1.getDb; } });
|
|
47
|
-
Object.defineProperty(exports, "getSql", { enumerable: true, get: function () { return client_1.getSql; } });
|
|
48
|
-
Object.defineProperty(exports, "setTenantId", { enumerable: true, get: function () { return client_1.setTenantId; } });
|
|
49
|
-
Object.defineProperty(exports, "getTenantId", { enumerable: true, get: function () { return client_1.getTenantId; } });
|
|
50
|
-
Object.defineProperty(exports, "clearTenantId", { enumerable: true, get: function () { return client_1.clearTenantId; } });
|
|
51
|
-
Object.defineProperty(exports, "initTenantFromEnv", { enumerable: true, get: function () { return client_1.initTenantFromEnv; } });
|
|
52
|
-
Object.defineProperty(exports, "withTenant", { enumerable: true, get: function () { return client_1.withTenant; } });
|
|
53
|
-
Object.defineProperty(exports, "withTenantSql", { enumerable: true, get: function () { return client_1.withTenantSql; } });
|
|
54
|
-
Object.defineProperty(exports, "checkConnection", { enumerable: true, get: function () { return client_1.checkConnection; } });
|
|
55
|
-
Object.defineProperty(exports, "getConnectionInfo", { enumerable: true, get: function () { return client_1.getConnectionInfo; } });
|
|
7
|
+
export { db, getDb, getSql, setTenantId, getTenantId, clearTenantId, initTenantFromEnv, withTenant, withTenantSql, checkConnection, getConnectionInfo, } from './client';
|
|
56
8
|
// Schema exports
|
|
57
|
-
|
|
9
|
+
export * as schema from './schema';
|
|
58
10
|
// Query helpers
|
|
59
|
-
|
|
11
|
+
export {
|
|
60
12
|
// Products (queries)
|
|
61
|
-
|
|
62
|
-
Object.defineProperty(exports, "findProductBySlug", { enumerable: true, get: function () { return queries_1.findProductBySlug; } });
|
|
63
|
-
Object.defineProperty(exports, "findProductById", { enumerable: true, get: function () { return queries_1.findProductById; } });
|
|
64
|
-
Object.defineProperty(exports, "findProductVariants", { enumerable: true, get: function () { return queries_1.findProductVariants; } });
|
|
65
|
-
Object.defineProperty(exports, "countProducts", { enumerable: true, get: function () { return queries_1.countProducts; } });
|
|
13
|
+
findProducts, findProductBySlug, findProductById, findProductVariants, countProducts,
|
|
66
14
|
// Products (mutations)
|
|
67
|
-
|
|
68
|
-
Object.defineProperty(exports, "updateProduct", { enumerable: true, get: function () { return queries_1.updateProduct; } });
|
|
69
|
-
Object.defineProperty(exports, "deleteProduct", { enumerable: true, get: function () { return queries_1.deleteProduct; } });
|
|
70
|
-
Object.defineProperty(exports, "hardDeleteProduct", { enumerable: true, get: function () { return queries_1.hardDeleteProduct; } });
|
|
15
|
+
createProduct, updateProduct, deleteProduct, hardDeleteProduct,
|
|
71
16
|
// Product Variants (mutations)
|
|
72
|
-
|
|
73
|
-
Object.defineProperty(exports, "updateProductVariant", { enumerable: true, get: function () { return queries_1.updateProductVariant; } });
|
|
74
|
-
Object.defineProperty(exports, "deleteProductVariant", { enumerable: true, get: function () { return queries_1.deleteProductVariant; } });
|
|
75
|
-
Object.defineProperty(exports, "updateVariantInventory", { enumerable: true, get: function () { return queries_1.updateVariantInventory; } });
|
|
76
|
-
Object.defineProperty(exports, "findVariantById", { enumerable: true, get: function () { return queries_1.findVariantById; } });
|
|
17
|
+
createProductVariant, updateProductVariant, deleteProductVariant, updateVariantInventory, findVariantById,
|
|
77
18
|
// Categories (queries)
|
|
78
|
-
|
|
79
|
-
Object.defineProperty(exports, "findCategoryBySlug", { enumerable: true, get: function () { return queries_1.findCategoryBySlug; } });
|
|
80
|
-
Object.defineProperty(exports, "findCategoryById", { enumerable: true, get: function () { return queries_1.findCategoryById; } });
|
|
81
|
-
Object.defineProperty(exports, "countCategories", { enumerable: true, get: function () { return queries_1.countCategories; } });
|
|
19
|
+
findCategories, findCategoryBySlug, findCategoryById, countCategories,
|
|
82
20
|
// Categories (mutations)
|
|
83
|
-
|
|
84
|
-
Object.defineProperty(exports, "updateCategory", { enumerable: true, get: function () { return queries_1.updateCategory; } });
|
|
85
|
-
Object.defineProperty(exports, "deleteCategory", { enumerable: true, get: function () { return queries_1.deleteCategory; } });
|
|
21
|
+
createCategory, updateCategory, deleteCategory,
|
|
86
22
|
// Orders (queries)
|
|
87
|
-
|
|
88
|
-
Object.defineProperty(exports, "findOrderById", { enumerable: true, get: function () { return queries_1.findOrderById; } });
|
|
89
|
-
Object.defineProperty(exports, "findOrderItems", { enumerable: true, get: function () { return queries_1.findOrderItems; } });
|
|
90
|
-
Object.defineProperty(exports, "findOrderByPaymentIntent", { enumerable: true, get: function () { return queries_1.findOrderByPaymentIntent; } });
|
|
91
|
-
Object.defineProperty(exports, "countOrders", { enumerable: true, get: function () { return queries_1.countOrders; } });
|
|
92
|
-
Object.defineProperty(exports, "getRevenueByPeriod", { enumerable: true, get: function () { return queries_1.getRevenueByPeriod; } });
|
|
93
|
-
Object.defineProperty(exports, "getOrdersByStatus", { enumerable: true, get: function () { return queries_1.getOrdersByStatus; } });
|
|
23
|
+
findOrders, findOrderById, findOrderItems, findOrderByPaymentIntent, countOrders, getRevenueByPeriod, getOrdersByStatus,
|
|
94
24
|
// Orders (mutations)
|
|
95
|
-
|
|
96
|
-
Object.defineProperty(exports, "createOrderItems", { enumerable: true, get: function () { return queries_1.createOrderItems; } });
|
|
97
|
-
Object.defineProperty(exports, "updateOrderStatus", { enumerable: true, get: function () { return queries_1.updateOrderStatus; } });
|
|
25
|
+
createOrder, createOrderItems, updateOrderStatus,
|
|
98
26
|
// Customers (queries)
|
|
99
|
-
|
|
100
|
-
Object.defineProperty(exports, "findCustomerById", { enumerable: true, get: function () { return queries_1.findCustomerById; } });
|
|
101
|
-
Object.defineProperty(exports, "findCustomers", { enumerable: true, get: function () { return queries_1.findCustomers; } });
|
|
102
|
-
Object.defineProperty(exports, "countCustomers", { enumerable: true, get: function () { return queries_1.countCustomers; } });
|
|
103
|
-
Object.defineProperty(exports, "findCustomerOrders", { enumerable: true, get: function () { return queries_1.findCustomerOrders; } });
|
|
27
|
+
findCustomerByEmail, findCustomerById, findCustomers, countCustomers, findCustomerOrders,
|
|
104
28
|
// Admins
|
|
105
|
-
|
|
29
|
+
findAdminByEmail,
|
|
106
30
|
// Stats
|
|
107
|
-
|
|
108
|
-
Object.defineProperty(exports, "getLowStockProducts", { enumerable: true, get: function () { return queries_1.getLowStockProducts; } });
|
|
109
|
-
Object.defineProperty(exports, "getRecentOrders", { enumerable: true, get: function () { return queries_1.getRecentOrders; } });
|
|
31
|
+
getStoreStats, getLowStockProducts, getRecentOrders,
|
|
110
32
|
// Settings
|
|
111
|
-
|
|
112
|
-
Object.defineProperty(exports, "upsertSettings", { enumerable: true, get: function () { return queries_1.upsertSettings; } });
|
|
33
|
+
findSettings, upsertSettings, } from './queries';
|
|
113
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/db/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/db/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+BAA+B;AAC/B,OAAO,EACL,EAAE,EACF,KAAK,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAA;AAEjB,iBAAiB;AACjB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAsBlC,gBAAgB;AAChB,OAAO;AACL,qBAAqB;AACrB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,aAAa;AACb,uBAAuB;AACvB,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB;AACjB,+BAA+B;AAC/B,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe;AACf,uBAAuB;AACvB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,eAAe;AACf,yBAAyB;AACzB,cAAc,EACd,cAAc,EACd,cAAc;AACd,mBAAmB;AACnB,UAAU,EACV,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,WAAW,EACX,kBAAkB,EAClB,iBAAiB;AACjB,qBAAqB;AACrB,WAAW,EACX,gBAAgB,EAChB,iBAAiB;AACjB,sBAAsB;AACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,kBAAkB;AAClB,SAAS;AACT,gBAAgB;AAChB,QAAQ;AACR,aAAa,EACb,mBAAmB,EACnB,eAAe;AACf,WAAW;AACX,YAAY,EACZ,cAAc,GACf,MAAM,WAAW,CAAA"}
|