@misiki/gocommerce-connector 0.1.0 → 0.3.0

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/index.d.cts CHANGED
@@ -1 +1,85 @@
1
- export { API_PROXY_PREFIX, AddressService, AuthService, AutocompleteService, BannerService, BaseService, BlogService, CartService, CategoryService, ChatService, CheckoutDetails, CheckoutService, CollectionService, ContactService, CouponService, Credentials, CurrencyService, DealService, EnquiryService, Envelope, FaqService, FeedbackService, GalleryService, GcAddress, GcCart, GcCartLine, GcCategory, GcCategoryPage, GcCheckoutMethods, GcCheckoutResult, GcCollection, GcCollectionPage, GcFulfillment, GcOrder, GcOrderLine, GcPaymentIntent, GcProduct, GcProductCategory, GcProductCollection, GcProductOption, GcVariant, GcVariantImage, GoCommerceError, HomeService, InitService, ListMeta, MAX_LIMIT, MeilisearchService, MenuService, Money, OrderService, PAGE_SIZE, PageService, Paginated, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductIndex, ProductSearchResult, ProductService, ProfileService, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StaticStoreProvider, StoreService, StoredAddress, UploadService, UserService, VarniCustomDesignService, VarniCustomProductService, VendorService, WishlistService, absoluteMedia, addressService, authService, autocompleteService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, clearCheckoutDetails, clearPhantomSession, collectionService, contactService, couponService, currencyFractionDigits, currencyService, dealService, emptyPage, enquiryService, faqService, feedbackService, findAddress, flattenMetadata, fromMoney, galleryService, hasPhantomSession, hasStaticStore, homeService, initService, listAddresses, mapCart, mapCategory, mapCollection, mapOrder, mapProduct, meilisearchService, menuService, orderService, pageService, paginated, patchAddress, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productImages, productService, profileService, putAddress, readCheckoutDetails, readOrderNumbers, readOrderToken, readStaticStore, readStaticStoreDetails, reelsService, regionService, rememberOrderToken, removeAddress, resolveProductIndex, reviewService, searchService, setStaticStore, settingService, settingsService, stateService, storeService, toGoCommerceAddress, toStorefrontAddress, uploadService, userService, varniCustomDesignService, varniCustomProductService, vendorService, wishlistService, writeCheckoutDetails } from './services/index.cjs';
1
+ export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeService, U as IdentityAddress, V as InitService, W as Invitation, X as Lead, Y as ListMeta, Z as MeilisearchService, _ as Member, $ as Menu, a0 as MenuItem, a1 as MenuService, a2 as MenuSummary, a3 as Money, a4 as NewsletterService, a5 as Offer, a6 as Order, a7 as OrderLine, a8 as OrderService, a9 as PageService, aa as PaymentIntent, ab as PaymentMethodService, ac as Plugin, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ag as Product, ah as ProductOption, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ap as Review, aq as ReviewPage, ar as ReviewService, as as SearchDoc, at as SearchResult, au as SearchService, av as SettingService, av as SettingsService, aw as ShippingRate, ax as StateService, ay as StoreService, az as StorefrontCategory, aA as StorefrontMenu, aB as StorefrontOrder, aC as StorefrontProduct, aD as UploadService, aE as UserService, aF as Variant, aG as VariantImage, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aK as Vendor, aL as VendorService, aM as WarrantyService, aN as Wishlist, aO as WishlistItem, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b2 as currencyExponent, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b6 as emptyCart, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, bb as fromEngineAddress, bc as fromIdentityAddress, bd as fromSearchDoc, be as galleryService, bf as homeService, bg as initService, bh as meilisearchService, bi as menuService, bj as minorToMajor, bk as newsletterService, bl as orderService, bm as pageService, bn as paymentMethodService, bo as pluginService, bp as pluginsService, bq as popularSearchService, br as popularityService, bs as priceOf, bt as productImages, bu as productService, bv as profileService, bw as qs, bx as reelsService, by as regionService, bz as reviewService, bA as searchService, bB as settingService, bC as settingsService, bD as stateService, bE as staticStore, bF as storeService, bG as toCart, bH as toCartLine, bI as toCategory, bJ as toCmsPage, bK as toCollection, bL as toEngineAddress, bM as toIdentityAddress, bN as toMajor, bO as toMinor, bP as toOrder, bQ as toPage, bR as toProduct, bS as toRating, bT as toUser, bU as toVariant, bV as toVendor, bW as uploadService, bX as userService, bY as variantService, bZ as varniCustomDesignService, b_ as varniCustomProductService, b$ as vendorService, c0 as warrantyService, c1 as wishlistService } from './index-BfbB3jQb.cjs';
2
+
3
+ /**
4
+ * The two ways a call through this connector fails.
5
+ *
6
+ * Both carry `message`, because the storefront shows `err.message` in a toast
7
+ * and has no other field it reliably reads.
8
+ */
9
+ /**
10
+ * What the engine refused, in a shape the storefront can show a shopper.
11
+ *
12
+ * `status` travels because the difference between 404 and 409 is the
13
+ * difference between "that product is gone" and "somebody just bought the last
14
+ * one", and a storefront renders those differently. `code` is the engine's own
15
+ * taxonomy (`not_found`, `validation`, `conflict`, `unauthorized`, …).
16
+ */
17
+ declare class GoCommerceError extends Error {
18
+ readonly status: number;
19
+ readonly code: string | undefined;
20
+ readonly details: unknown;
21
+ constructor(message: string, status: number, code?: string, details?: unknown);
22
+ }
23
+ /**
24
+ * A storefront feature this engine has no model for — reels, chat, a vendor's
25
+ * commission statement — or one that lives in a module this particular build
26
+ * did not compile in.
27
+ *
28
+ * The name is the one every connector in the family throws, so a storefront
29
+ * that branches on `err.name === 'NotSupportedError'` treats GoCommerce the same
30
+ * as the rest.
31
+ */
32
+ declare class NotSupportedError extends Error {
33
+ readonly service: string;
34
+ readonly method: string;
35
+ constructor(service: string, method: string, detail?: string);
36
+ }
37
+
38
+ /**
39
+ * Store identity — name, logo, favicon, menus, theme variables.
40
+ *
41
+ * Some of that the engine has (the settlement currency, the payment methods,
42
+ * the switched-on plugins) and most of it it does not: a logo and a hero banner
43
+ * are the storefront's own business. The storefront registers its static store
44
+ * record here at boot — `default-store.json` merged under the project's
45
+ * `kitcommerce.config.ts` — and `storeService` lays the engine's live facts
46
+ * over it, so the engine wins wherever it has an opinion.
47
+ */
48
+ type StaticStoreProvider = () => Promise<Record<string, any>> | Record<string, any>;
49
+ declare const setStaticStore: (fn: StaticStoreProvider) => void;
50
+ declare const hasStaticStore: () => boolean;
51
+ declare const readStaticStore: () => Promise<Record<string, any>>;
52
+ /** The marker the storefront reads to tell which backend is active. */
53
+ declare const connectorName = "gocommerce";
54
+
55
+ /**
56
+ * Litekart REST paths, intercepted.
57
+ *
58
+ * Every connector in the family exposes `get/post/put/patch/delete(path)` on
59
+ * its BaseService because Litekart's does, and a little storefront code still
60
+ * calls them with a Litekart path — `storeService.post('/api/…')`. Those paths
61
+ * are relative, so they would land on the storefront's own origin, where
62
+ * nothing answers.
63
+ *
64
+ * GoCommerce's own routes also start with `/api/`, which is why this connector
65
+ * never sends an engine request through those verbs: every engine call goes
66
+ * through `BaseService.engine()` with an absolute URL, and the storefront's own
67
+ * guard (which patches the same verbs) cannot reach it either. What arrives
68
+ * here is only ever an inherited Litekart path.
69
+ *
70
+ * Reads for a collection resolve empty (a store legitimately has none); reads
71
+ * for one record and every write throw, because a blank detail page reads as
72
+ * broken and a silent success would tell a shopper their enquiry was saved when
73
+ * nothing left the browser. Each distinct path is reported once.
74
+ */
75
+ /**
76
+ * Answers a Litekart REST path from data the storefront holds (menus,
77
+ * countries, plugin toggles…). Return `undefined` to fall through.
78
+ */
79
+ type RestResolver = (url: string) => Promise<unknown> | unknown | undefined;
80
+ declare const serveRestLocally: (resolver: RestResolver) => void;
81
+
82
+ /** For tests, and for a storefront that has just changed something itself. */
83
+ declare function forgetAll(): void;
84
+
85
+ export { GoCommerceError, NotSupportedError, type RestResolver, forgetAll as clearStoreCache, connectorName, hasStaticStore, readStaticStore, serveRestLocally, setStaticStore };
package/dist/index.d.ts CHANGED
@@ -1 +1,85 @@
1
- export { API_PROXY_PREFIX, AddressService, AuthService, AutocompleteService, BannerService, BaseService, BlogService, CartService, CategoryService, ChatService, CheckoutDetails, CheckoutService, CollectionService, ContactService, CouponService, Credentials, CurrencyService, DealService, EnquiryService, Envelope, FaqService, FeedbackService, GalleryService, GcAddress, GcCart, GcCartLine, GcCategory, GcCategoryPage, GcCheckoutMethods, GcCheckoutResult, GcCollection, GcCollectionPage, GcFulfillment, GcOrder, GcOrderLine, GcPaymentIntent, GcProduct, GcProductCategory, GcProductCollection, GcProductOption, GcVariant, GcVariantImage, GoCommerceError, HomeService, InitService, ListMeta, MAX_LIMIT, MeilisearchService, MenuService, Money, OrderService, PAGE_SIZE, PageService, Paginated, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductIndex, ProductSearchResult, ProductService, ProfileService, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StaticStoreProvider, StoreService, StoredAddress, UploadService, UserService, VarniCustomDesignService, VarniCustomProductService, VendorService, WishlistService, absoluteMedia, addressService, authService, autocompleteService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, clearCheckoutDetails, clearPhantomSession, collectionService, contactService, couponService, currencyFractionDigits, currencyService, dealService, emptyPage, enquiryService, faqService, feedbackService, findAddress, flattenMetadata, fromMoney, galleryService, hasPhantomSession, hasStaticStore, homeService, initService, listAddresses, mapCart, mapCategory, mapCollection, mapOrder, mapProduct, meilisearchService, menuService, orderService, pageService, paginated, patchAddress, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productImages, productService, profileService, putAddress, readCheckoutDetails, readOrderNumbers, readOrderToken, readStaticStore, readStaticStoreDetails, reelsService, regionService, rememberOrderToken, removeAddress, resolveProductIndex, reviewService, searchService, setStaticStore, settingService, settingsService, stateService, storeService, toGoCommerceAddress, toStorefrontAddress, uploadService, userService, varniCustomDesignService, varniCustomProductService, vendorService, wishlistService, writeCheckoutDetails } from './services/index.js';
1
+ export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeService, U as IdentityAddress, V as InitService, W as Invitation, X as Lead, Y as ListMeta, Z as MeilisearchService, _ as Member, $ as Menu, a0 as MenuItem, a1 as MenuService, a2 as MenuSummary, a3 as Money, a4 as NewsletterService, a5 as Offer, a6 as Order, a7 as OrderLine, a8 as OrderService, a9 as PageService, aa as PaymentIntent, ab as PaymentMethodService, ac as Plugin, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ag as Product, ah as ProductOption, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ap as Review, aq as ReviewPage, ar as ReviewService, as as SearchDoc, at as SearchResult, au as SearchService, av as SettingService, av as SettingsService, aw as ShippingRate, ax as StateService, ay as StoreService, az as StorefrontCategory, aA as StorefrontMenu, aB as StorefrontOrder, aC as StorefrontProduct, aD as UploadService, aE as UserService, aF as Variant, aG as VariantImage, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aK as Vendor, aL as VendorService, aM as WarrantyService, aN as Wishlist, aO as WishlistItem, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b2 as currencyExponent, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b6 as emptyCart, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, bb as fromEngineAddress, bc as fromIdentityAddress, bd as fromSearchDoc, be as galleryService, bf as homeService, bg as initService, bh as meilisearchService, bi as menuService, bj as minorToMajor, bk as newsletterService, bl as orderService, bm as pageService, bn as paymentMethodService, bo as pluginService, bp as pluginsService, bq as popularSearchService, br as popularityService, bs as priceOf, bt as productImages, bu as productService, bv as profileService, bw as qs, bx as reelsService, by as regionService, bz as reviewService, bA as searchService, bB as settingService, bC as settingsService, bD as stateService, bE as staticStore, bF as storeService, bG as toCart, bH as toCartLine, bI as toCategory, bJ as toCmsPage, bK as toCollection, bL as toEngineAddress, bM as toIdentityAddress, bN as toMajor, bO as toMinor, bP as toOrder, bQ as toPage, bR as toProduct, bS as toRating, bT as toUser, bU as toVariant, bV as toVendor, bW as uploadService, bX as userService, bY as variantService, bZ as varniCustomDesignService, b_ as varniCustomProductService, b$ as vendorService, c0 as warrantyService, c1 as wishlistService } from './index-BfbB3jQb.js';
2
+
3
+ /**
4
+ * The two ways a call through this connector fails.
5
+ *
6
+ * Both carry `message`, because the storefront shows `err.message` in a toast
7
+ * and has no other field it reliably reads.
8
+ */
9
+ /**
10
+ * What the engine refused, in a shape the storefront can show a shopper.
11
+ *
12
+ * `status` travels because the difference between 404 and 409 is the
13
+ * difference between "that product is gone" and "somebody just bought the last
14
+ * one", and a storefront renders those differently. `code` is the engine's own
15
+ * taxonomy (`not_found`, `validation`, `conflict`, `unauthorized`, …).
16
+ */
17
+ declare class GoCommerceError extends Error {
18
+ readonly status: number;
19
+ readonly code: string | undefined;
20
+ readonly details: unknown;
21
+ constructor(message: string, status: number, code?: string, details?: unknown);
22
+ }
23
+ /**
24
+ * A storefront feature this engine has no model for — reels, chat, a vendor's
25
+ * commission statement — or one that lives in a module this particular build
26
+ * did not compile in.
27
+ *
28
+ * The name is the one every connector in the family throws, so a storefront
29
+ * that branches on `err.name === 'NotSupportedError'` treats GoCommerce the same
30
+ * as the rest.
31
+ */
32
+ declare class NotSupportedError extends Error {
33
+ readonly service: string;
34
+ readonly method: string;
35
+ constructor(service: string, method: string, detail?: string);
36
+ }
37
+
38
+ /**
39
+ * Store identity — name, logo, favicon, menus, theme variables.
40
+ *
41
+ * Some of that the engine has (the settlement currency, the payment methods,
42
+ * the switched-on plugins) and most of it it does not: a logo and a hero banner
43
+ * are the storefront's own business. The storefront registers its static store
44
+ * record here at boot — `default-store.json` merged under the project's
45
+ * `kitcommerce.config.ts` — and `storeService` lays the engine's live facts
46
+ * over it, so the engine wins wherever it has an opinion.
47
+ */
48
+ type StaticStoreProvider = () => Promise<Record<string, any>> | Record<string, any>;
49
+ declare const setStaticStore: (fn: StaticStoreProvider) => void;
50
+ declare const hasStaticStore: () => boolean;
51
+ declare const readStaticStore: () => Promise<Record<string, any>>;
52
+ /** The marker the storefront reads to tell which backend is active. */
53
+ declare const connectorName = "gocommerce";
54
+
55
+ /**
56
+ * Litekart REST paths, intercepted.
57
+ *
58
+ * Every connector in the family exposes `get/post/put/patch/delete(path)` on
59
+ * its BaseService because Litekart's does, and a little storefront code still
60
+ * calls them with a Litekart path — `storeService.post('/api/…')`. Those paths
61
+ * are relative, so they would land on the storefront's own origin, where
62
+ * nothing answers.
63
+ *
64
+ * GoCommerce's own routes also start with `/api/`, which is why this connector
65
+ * never sends an engine request through those verbs: every engine call goes
66
+ * through `BaseService.engine()` with an absolute URL, and the storefront's own
67
+ * guard (which patches the same verbs) cannot reach it either. What arrives
68
+ * here is only ever an inherited Litekart path.
69
+ *
70
+ * Reads for a collection resolve empty (a store legitimately has none); reads
71
+ * for one record and every write throw, because a blank detail page reads as
72
+ * broken and a silent success would tell a shopper their enquiry was saved when
73
+ * nothing left the browser. Each distinct path is reported once.
74
+ */
75
+ /**
76
+ * Answers a Litekart REST path from data the storefront holds (menus,
77
+ * countries, plugin toggles…). Return `undefined` to fall through.
78
+ */
79
+ type RestResolver = (url: string) => Promise<unknown> | unknown | undefined;
80
+ declare const serveRestLocally: (resolver: RestResolver) => void;
81
+
82
+ /** For tests, and for a storefront that has just changed something itself. */
83
+ declare function forgetAll(): void;
84
+
85
+ export { GoCommerceError, NotSupportedError, type RestResolver, forgetAll as clearStoreCache, connectorName, hasStaticStore, readStaticStore, serveRestLocally, setStaticStore };