@brytdesigns/shopify-utils 1.2.22 → 3.0.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/effect/Actions/bridge.js +71 -0
- package/dist/effect/Actions/bridge.js.map +1 -0
- package/dist/effect/Actions/errors.js +46 -0
- package/dist/effect/Actions/errors.js.map +1 -0
- package/dist/effect/Actions/index.js +23 -0
- package/dist/effect/Actions/index.js.map +1 -0
- package/dist/effect/Actions/service.js +127 -0
- package/dist/effect/Actions/service.js.map +1 -0
- package/dist/effect/Actions/trampoline.js +26 -0
- package/dist/effect/Actions/trampoline.js.map +1 -0
- package/dist/effect/Ajax/Sections/index.js +2 -4
- package/dist/effect/Ajax/Sections/schema.js +28 -39
- package/dist/effect/Ajax/Sections/schema.js.map +1 -1
- package/dist/effect/Ajax/Window/data/AllowedRouteOrigins.js +75 -0
- package/dist/effect/Ajax/Window/data/AllowedRouteOrigins.js.map +1 -0
- package/dist/effect/Ajax/Window/data/ShopifyRoutes.js +86 -37
- package/dist/effect/Ajax/Window/data/ShopifyRoutes.js.map +1 -1
- package/dist/effect/Ajax/Window/data/StorefrontClientConfig.js +14 -13
- package/dist/effect/Ajax/Window/data/StorefrontClientConfig.js.map +1 -1
- package/dist/effect/Ajax/Window/data/StorefrontOrigin.js +32 -0
- package/dist/effect/Ajax/Window/data/StorefrontOrigin.js.map +1 -0
- package/dist/effect/Ajax/Window/data/index.js +15 -5
- package/dist/effect/Ajax/Window/data/index.js.map +1 -1
- package/dist/effect/Ajax/Window/index.js +2 -4
- package/dist/effect/Ajax/index.js +13 -3
- package/dist/effect/Ajax/index.js.map +1 -1
- package/dist/effect/Logging/index.js +13 -10
- package/dist/effect/Logging/index.js.map +1 -1
- package/dist/effect/Resource/data.js +20 -30
- package/dist/effect/Resource/data.js.map +1 -1
- package/dist/effect/Resource/index.js +14 -3
- package/dist/effect/Resource/index.js.map +1 -1
- package/dist/effect/Resource/schema.js +45 -45
- package/dist/effect/Resource/schema.js.map +1 -1
- package/dist/effect/_virtual/_rolldown/runtime.js +13 -0
- package/dist/effect/index.d.ts +383 -65
- package/dist/effect/index.js +5 -8
- package/dist/main/_virtual/_rolldown/runtime.js +13 -0
- package/dist/main/actions.js +78 -0
- package/dist/main/actions.js.map +1 -0
- package/dist/main/effect/Actions/bridge.js +65 -0
- package/dist/main/effect/Actions/bridge.js.map +1 -0
- package/dist/main/effect/Actions/errors.js +46 -0
- package/dist/main/effect/Actions/errors.js.map +1 -0
- package/dist/main/effect/Actions/index.js +4 -0
- package/dist/main/effect/Actions/service.js +127 -0
- package/dist/main/effect/Actions/service.js.map +1 -0
- package/dist/main/effect/Actions/trampoline.js +26 -0
- package/dist/main/effect/Actions/trampoline.js.map +1 -0
- package/dist/main/effect/Ajax/Sections/index.js +1 -4
- package/dist/main/effect/Ajax/Sections/schema.js +11 -41
- package/dist/main/effect/Ajax/Sections/schema.js.map +1 -1
- package/dist/main/effect/Ajax/Window/data/AllowedRouteOrigins.js +18 -0
- package/dist/main/effect/Ajax/Window/data/AllowedRouteOrigins.js.map +1 -0
- package/dist/main/effect/Ajax/Window/data/ShopifyRoutes.js +37 -37
- package/dist/main/effect/Ajax/Window/data/ShopifyRoutes.js.map +1 -1
- package/dist/main/effect/Ajax/Window/data/StorefrontClientConfig.js +3 -14
- package/dist/main/effect/Ajax/Window/data/StorefrontClientConfig.js.map +1 -1
- package/dist/main/effect/Ajax/Window/data/StorefrontOrigin.js +6 -0
- package/dist/main/effect/Ajax/Window/data/StorefrontOrigin.js.map +1 -0
- package/dist/main/effect/Ajax/Window/data/index.js +4 -6
- package/dist/main/effect/Ajax/Window/index.js +1 -4
- package/dist/main/effect/Ajax/index.js +2 -4
- package/dist/main/effect/Logging/index.js +2 -13
- package/dist/main/effect/Resource/data.js +20 -30
- package/dist/main/effect/Resource/data.js.map +1 -1
- package/dist/main/effect/Resource/index.js +3 -4
- package/dist/main/effect/Resource/schema.js +45 -45
- package/dist/main/effect/Resource/schema.js.map +1 -1
- package/dist/main/effect/index.js +4 -8
- package/dist/main/index.d.ts +351 -11
- package/dist/main/index.js +3 -3
- package/dist/main/resources/index.js +8 -7
- package/dist/main/resources/index.js.map +1 -1
- package/package.json +9 -9
- package/dist/effect/Ajax/Sections/index.js.map +0 -1
- package/dist/effect/Ajax/Window/data/types.js +0 -3
- package/dist/effect/Ajax/Window/data/types.js.map +0 -1
- package/dist/effect/Ajax/Window/index.js.map +0 -1
- package/dist/effect/index.js.map +0 -1
- package/dist/index.d.ts +0 -77
- package/dist/jsdelivr/effect/Ajax/Sections/index.js +0 -4
- package/dist/jsdelivr/effect/Ajax/Sections/index.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Sections/schema.js +0 -20
- package/dist/jsdelivr/effect/Ajax/Sections/schema.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Window/data/ShopifyRoutes.js +0 -38
- package/dist/jsdelivr/effect/Ajax/Window/data/ShopifyRoutes.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Window/data/StorefrontClientConfig.js +0 -16
- package/dist/jsdelivr/effect/Ajax/Window/data/StorefrontClientConfig.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Window/data/index.js +0 -6
- package/dist/jsdelivr/effect/Ajax/Window/data/index.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Window/data/types.js +0 -3
- package/dist/jsdelivr/effect/Ajax/Window/data/types.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/Window/index.js +0 -4
- package/dist/jsdelivr/effect/Ajax/Window/index.js.map +0 -1
- package/dist/jsdelivr/effect/Ajax/index.js +0 -4
- package/dist/jsdelivr/effect/Ajax/index.js.map +0 -1
- package/dist/jsdelivr/effect/Logging/index.js +0 -13
- package/dist/jsdelivr/effect/Logging/index.js.map +0 -1
- package/dist/jsdelivr/effect/Resource/data.js +0 -17
- package/dist/jsdelivr/effect/Resource/data.js.map +0 -1
- package/dist/jsdelivr/effect/Resource/index.js +0 -4
- package/dist/jsdelivr/effect/Resource/index.js.map +0 -1
- package/dist/jsdelivr/effect/Resource/schema.js +0 -47
- package/dist/jsdelivr/effect/Resource/schema.js.map +0 -1
- package/dist/jsdelivr/effect/index.js +0 -8
- package/dist/jsdelivr/effect/index.js.map +0 -1
- package/dist/jsdelivr/index.js +0 -3
- package/dist/jsdelivr/index.js.map +0 -1
- package/dist/jsdelivr/resources/index.js +0 -9
- package/dist/jsdelivr/resources/index.js.map +0 -1
- package/dist/main/effect/Ajax/Sections/index.js.map +0 -1
- package/dist/main/effect/Ajax/Window/data/index.js.map +0 -1
- package/dist/main/effect/Ajax/Window/data/types.js +0 -3
- package/dist/main/effect/Ajax/Window/data/types.js.map +0 -1
- package/dist/main/effect/Ajax/Window/index.js.map +0 -1
- package/dist/main/effect/Ajax/index.js.map +0 -1
- package/dist/main/effect/Logging/index.js.map +0 -1
- package/dist/main/effect/Resource/index.js.map +0 -1
- package/dist/main/effect/index.js.map +0 -1
- package/dist/main/index.js.map +0 -1
|
@@ -1,40 +1,89 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
products_url: "/products",
|
|
13
|
-
cart_add_url: "/cart/add.js",
|
|
14
|
-
cart_change_url: "/cart/change.js",
|
|
15
|
-
cart_clear_url: "/cart/clear.js",
|
|
16
|
-
cart_update_url: "/cart/update.js",
|
|
17
|
-
cart_url: "/cart.js",
|
|
18
|
-
collections_url: "/collections",
|
|
19
|
-
predictive_search_url: "/search/suggest",
|
|
20
|
-
product_recommendations_url: "/recommendations/products",
|
|
21
|
-
root_url: "/",
|
|
22
|
-
search_url: "/search",
|
|
23
|
-
storefront_login_url: "/customer_authentication/login?return_to=%2Fservices%2Fliquid_rendering%2Fresource%3Ffast_storefront_renderer%3D1&locale=en"
|
|
24
|
-
};
|
|
25
|
-
class ShopifyRoutes extends Data.Class {
|
|
26
|
-
constructor() {
|
|
27
|
-
super({
|
|
28
|
-
...Defaults,
|
|
29
|
-
...window?.BrytDesigns?.routes || {}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const make = () => Data.case()({
|
|
34
|
-
...Defaults,
|
|
35
|
-
...window?.BrytDesigns?.routes || {}
|
|
1
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Context from "effect/Context";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
//#region src/effect/Ajax/Window/data/ShopifyRoutes.ts
|
|
6
|
+
var ShopifyRoutes_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
Defaults: () => Defaults,
|
|
8
|
+
Routes: () => Routes,
|
|
9
|
+
ShopifyRoutes: () => ShopifyRoutes,
|
|
10
|
+
layer: () => layer,
|
|
11
|
+
make: () => make
|
|
36
12
|
});
|
|
13
|
+
var Defaults = {
|
|
14
|
+
account_addresses_url: "/account/addresses",
|
|
15
|
+
account_login_url: "/account/login",
|
|
16
|
+
account_logout_url: "/account/logout",
|
|
17
|
+
account_recover_url: "/account/recover",
|
|
18
|
+
account_register_url: "/account/register",
|
|
19
|
+
account_url: "/account",
|
|
20
|
+
all_products_collection_url: "/collections/all",
|
|
21
|
+
product_url: "/products/:handle",
|
|
22
|
+
products_url: "/products",
|
|
23
|
+
cart_add_url: "/cart/add.js",
|
|
24
|
+
cart_change_url: "/cart/change.js",
|
|
25
|
+
cart_clear_url: "/cart/clear.js",
|
|
26
|
+
cart_update_url: "/cart/update.js",
|
|
27
|
+
cart_url: "/cart.js",
|
|
28
|
+
collections_url: "/collections",
|
|
29
|
+
predictive_search_url: "/search/suggest",
|
|
30
|
+
product_recommendations_url: "/recommendations/products",
|
|
31
|
+
root_url: "/",
|
|
32
|
+
search_url: "/search",
|
|
33
|
+
storefront_login_url: "/customer_authentication/login?return_to=%2Fservices%2Fliquid_rendering%2Fresource%3Ffast_storefront_renderer%3D1&locale=en"
|
|
34
|
+
};
|
|
35
|
+
var ShopifyRoutes = class extends Data.Class {
|
|
36
|
+
constructor() {
|
|
37
|
+
super({
|
|
38
|
+
...Defaults,
|
|
39
|
+
...window?.BrytDesigns?.routes || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var make = () => new ShopifyRoutes();
|
|
44
|
+
/**
|
|
45
|
+
* The route table, as a service.
|
|
46
|
+
*
|
|
47
|
+
* Deliberately a `Context.Reference` rather than a `Context.Service`: a
|
|
48
|
+
* `Reference` carries its own default, so reading it leaves the effect's `R`
|
|
49
|
+
* channel at `never`. A `Service` would push `ShopifyRoutes` into `R` for
|
|
50
|
+
* every request effect in every downstream package, and those effects are run
|
|
51
|
+
* by plain Shopify themes through `Effect.runPromise` — which cannot provide
|
|
52
|
+
* anything. The default has to be the common path, and overriding it the
|
|
53
|
+
* exception.
|
|
54
|
+
*
|
|
55
|
+
* The default is evaluated lazily, on first read — but only once. Effect
|
|
56
|
+
* memoises a reference's default onto the reference itself
|
|
57
|
+
* (`Context.getDefaultValue`), so the table is read from `window` on the first
|
|
58
|
+
* Ajax call of the page and reused from then on.
|
|
59
|
+
*
|
|
60
|
+
* That is a deliberate change from the previous behaviour, where `make()` ran
|
|
61
|
+
* on every request and so picked up a later mutation of
|
|
62
|
+
* `window.BrytDesigns.routes`. Laziness buys the common case — a theme's inline
|
|
63
|
+
* script sets the routes before the first request, which module-scope
|
|
64
|
+
* evaluation would have missed — but a theme that rebinds routes *after* the
|
|
65
|
+
* first request must now provide them explicitly, with {@link layer} or
|
|
66
|
+
* `Effect.provideService`.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // Override in a test, with no DOM in sight.
|
|
71
|
+
* Effect.provideService(effect, ShopifyRoutes.Routes, {
|
|
72
|
+
* ...ShopifyRoutes.Defaults,
|
|
73
|
+
* cart_url: "/fixtures/cart.js",
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
var Routes = Context.Reference("@brytdesigns/shopify-utils/ShopifyRoutes", { defaultValue: () => typeof window === "undefined" ? Defaults : make() });
|
|
78
|
+
/**
|
|
79
|
+
* Pins the route table to an explicit value.
|
|
80
|
+
*
|
|
81
|
+
* Only needed when something must override the window-derived default for a
|
|
82
|
+
* whole program rather than a single effect; `Effect.provideService` covers
|
|
83
|
+
* the single-effect case without building a layer.
|
|
84
|
+
*/
|
|
85
|
+
var layer = (routes) => Layer.succeed(Routes, routes);
|
|
86
|
+
//#endregion
|
|
87
|
+
export { Defaults, Routes, ShopifyRoutes, ShopifyRoutes_exports, layer, make };
|
|
37
88
|
|
|
38
|
-
export { Defaults, ShopifyRoutes, make };
|
|
39
|
-
//# sourceMappingURL=ShopifyRoutes.js.map
|
|
40
89
|
//# sourceMappingURL=ShopifyRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/effect/Ajax/Window/data/ShopifyRoutes.ts"],"
|
|
1
|
+
{"version":3,"file":"ShopifyRoutes.js","names":[],"sources":["../../../../../src/effect/Ajax/Window/data/ShopifyRoutes.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Layer from \"effect/Layer\";\nimport type { IShopifyRoutes } from \"./types.js\";\n\nexport const Defaults: IShopifyRoutes = {\n\taccount_addresses_url: \"/account/addresses\",\n\taccount_login_url: \"/account/login\",\n\taccount_logout_url: \"/account/logout\",\n\taccount_recover_url: \"/account/recover\",\n\taccount_register_url: \"/account/register\",\n\taccount_url: \"/account\",\n\tall_products_collection_url: \"/collections/all\",\n\tproduct_url: \"/products/:handle\",\n\tproducts_url: \"/products\",\n\tcart_add_url: \"/cart/add.js\",\n\tcart_change_url: \"/cart/change.js\",\n\tcart_clear_url: \"/cart/clear.js\",\n\tcart_update_url: \"/cart/update.js\",\n\tcart_url: \"/cart.js\",\n\tcollections_url: \"/collections\",\n\tpredictive_search_url: \"/search/suggest\",\n\tproduct_recommendations_url: \"/recommendations/products\",\n\troot_url: \"/\",\n\tsearch_url: \"/search\",\n\tstorefront_login_url:\n\t\t\"/customer_authentication/login?return_to=%2Fservices%2Fliquid_rendering%2Fresource%3Ffast_storefront_renderer%3D1&locale=en\",\n};\n\nexport class ShopifyRoutes extends Data.Class<IShopifyRoutes> {\n\tconstructor() {\n\t\tsuper({\n\t\t\t...Defaults,\n\t\t\t...(window?.BrytDesigns?.routes || {}),\n\t\t});\n\t}\n}\n\n// v4 removed Data.case. The class constructor already applies exactly these\n// defaults, so the factory collapses to it.\nexport const make = (): ShopifyRoutes => new ShopifyRoutes();\n\n/**\n * The route table, as a service.\n *\n * Deliberately a `Context.Reference` rather than a `Context.Service`: a\n * `Reference` carries its own default, so reading it leaves the effect's `R`\n * channel at `never`. A `Service` would push `ShopifyRoutes` into `R` for\n * every request effect in every downstream package, and those effects are run\n * by plain Shopify themes through `Effect.runPromise` — which cannot provide\n * anything. The default has to be the common path, and overriding it the\n * exception.\n *\n * The default is evaluated lazily, on first read — but only once. Effect\n * memoises a reference's default onto the reference itself\n * (`Context.getDefaultValue`), so the table is read from `window` on the first\n * Ajax call of the page and reused from then on.\n *\n * That is a deliberate change from the previous behaviour, where `make()` ran\n * on every request and so picked up a later mutation of\n * `window.BrytDesigns.routes`. Laziness buys the common case — a theme's inline\n * script sets the routes before the first request, which module-scope\n * evaluation would have missed — but a theme that rebinds routes *after* the\n * first request must now provide them explicitly, with {@link layer} or\n * `Effect.provideService`.\n *\n * @example\n * ```ts\n * // Override in a test, with no DOM in sight.\n * Effect.provideService(effect, ShopifyRoutes.Routes, {\n * ...ShopifyRoutes.Defaults,\n * cart_url: \"/fixtures/cart.js\",\n * });\n * ```\n */\nexport const Routes: Context.Reference<IShopifyRoutes> =\n\tContext.Reference<IShopifyRoutes>(\n\t\t\"@brytdesigns/shopify-utils/ShopifyRoutes\",\n\t\t{\n\t\t\t// Guarded rather than just `make()`: the class constructor reads `window`\n\t\t\t// unconditionally, and `window?.` does not protect against the identifier\n\t\t\t// being undeclared. Falling back to `Defaults` keeps the reference usable\n\t\t\t// from Node - which is what lets `ajax-client`'s tests run without jsdom.\n\t\t\tdefaultValue: () => (typeof window === \"undefined\" ? Defaults : make()),\n\t\t},\n\t);\n\n/**\n * Pins the route table to an explicit value.\n *\n * Only needed when something must override the window-derived default for a\n * whole program rather than a single effect; `Effect.provideService` covers\n * the single-effect case without building a layer.\n */\nexport const layer = (routes: IShopifyRoutes): Layer.Layer<never> =>\n\tLayer.succeed(Routes, routes);\n"],"mappings":";;;;;;;;;;;;AAKA,IAAa,WAA2B;CACvC,uBAAuB;CACvB,mBAAmB;CACnB,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,aAAa;CACb,6BAA6B;CAC7B,aAAa;CACb,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,UAAU;CACV,iBAAiB;CACjB,uBAAuB;CACvB,6BAA6B;CAC7B,UAAU;CACV,YAAY;CACZ,sBACC;AACF;AAEA,IAAa,gBAAb,cAAmC,KAAK,MAAsB;CAC7D,cAAc;EACb,MAAM;GACL,GAAG;GACH,GAAI,QAAQ,aAAa,UAAU,CAAC;EACrC,CAAC;CACF;AACD;AAIA,IAAa,aAA4B,IAAI,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmC3D,IAAa,SACZ,QAAQ,UACP,4CACA,EAKC,oBAAqB,OAAO,WAAW,cAAc,WAAW,KAAK,EACtE,CACD;;;;;;;;AASD,IAAa,SAAS,WACrB,MAAM,QAAQ,QAAQ,MAAM"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
const make = () => Data.case()({
|
|
11
|
-
...window.BrytDesigns.storefront.config
|
|
1
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
//#region src/effect/Ajax/Window/data/StorefrontClientConfig.ts
|
|
4
|
+
var StorefrontClientConfig_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
StorefrontClientConfig: () => StorefrontClientConfig,
|
|
6
|
+
make: () => make
|
|
12
7
|
});
|
|
8
|
+
var StorefrontClientConfig = class extends Data.Class {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({ ...window.BrytDesigns.storefront.config });
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var make = () => new StorefrontClientConfig();
|
|
14
|
+
//#endregion
|
|
15
|
+
export { StorefrontClientConfig, StorefrontClientConfig_exports, make };
|
|
13
16
|
|
|
14
|
-
export { StorefrontClientConfig, make };
|
|
15
|
-
//# sourceMappingURL=StorefrontClientConfig.js.map
|
|
16
17
|
//# sourceMappingURL=StorefrontClientConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/effect/Ajax/Window/data/StorefrontClientConfig.ts"],"
|
|
1
|
+
{"version":3,"file":"StorefrontClientConfig.js","names":[],"sources":["../../../../../src/effect/Ajax/Window/data/StorefrontClientConfig.ts"],"sourcesContent":["import * as Data from \"effect/Data\";\nimport type { IStorefrontClientConfig } from \"./types.js\";\n\nexport class StorefrontClientConfig extends Data.Class<IStorefrontClientConfig> {\n\tconstructor() {\n\t\tsuper({\n\t\t\t...window.BrytDesigns.storefront.config,\n\t\t});\n\t}\n}\n\n// v4 removed Data.case. The class constructor already applies exactly these\n// defaults, so the factory collapses to it.\nexport const make = (): StorefrontClientConfig => new StorefrontClientConfig();\n"],"mappings":";;;;;;;AAGA,IAAa,yBAAb,cAA4C,KAAK,MAA+B;CAC/E,cAAc;EACb,MAAM,EACL,GAAG,OAAO,YAAY,WAAW,OAClC,CAAC;CACF;AACD;AAIA,IAAa,aAAqC,IAAI,uBAAuB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
//#region src/effect/Ajax/Window/data/StorefrontOrigin.ts
|
|
5
|
+
var StorefrontOrigin_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
Origin: () => Origin,
|
|
7
|
+
layer: () => layer
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* The origin every Ajax route is resolved against.
|
|
11
|
+
*
|
|
12
|
+
* Shopify's Ajax endpoints are same-origin paths (`/cart.js`), so this is
|
|
13
|
+
* `window.location.origin` on a storefront and the only reason the request
|
|
14
|
+
* layer needed a DOM at all. Lifting it to a `Context.Reference` means
|
|
15
|
+
* `ajax-client` can build a request without one, which is what makes its
|
|
16
|
+
* tests runnable outside jsdom.
|
|
17
|
+
*
|
|
18
|
+
* A `Reference` rather than a `Service` for the same reason as
|
|
19
|
+
* {@link ShopifyRoutes.Routes}: the default must work with no provision, so
|
|
20
|
+
* themes can keep calling `Effect.runPromise` directly.
|
|
21
|
+
*
|
|
22
|
+
* Read lazily. `window.location.origin` is stable within a page, but reading
|
|
23
|
+
* it at module scope would still break any environment that imports this
|
|
24
|
+
* module before a DOM exists.
|
|
25
|
+
*/
|
|
26
|
+
var Origin = Context.Reference("@brytdesigns/shopify-utils/StorefrontOrigin", { defaultValue: () => typeof window === "undefined" ? "" : window.location.origin });
|
|
27
|
+
/** Pins the origin for a whole program. */
|
|
28
|
+
var layer = (origin) => Layer.succeed(Origin, origin);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Origin, StorefrontOrigin_exports, layer };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=StorefrontOrigin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorefrontOrigin.js","names":[],"sources":["../../../../../src/effect/Ajax/Window/data/StorefrontOrigin.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\n/**\n * The origin every Ajax route is resolved against.\n *\n * Shopify's Ajax endpoints are same-origin paths (`/cart.js`), so this is\n * `window.location.origin` on a storefront and the only reason the request\n * layer needed a DOM at all. Lifting it to a `Context.Reference` means\n * `ajax-client` can build a request without one, which is what makes its\n * tests runnable outside jsdom.\n *\n * A `Reference` rather than a `Service` for the same reason as\n * {@link ShopifyRoutes.Routes}: the default must work with no provision, so\n * themes can keep calling `Effect.runPromise` directly.\n *\n * Read lazily. `window.location.origin` is stable within a page, but reading\n * it at module scope would still break any environment that imports this\n * module before a DOM exists.\n */\nexport const Origin: Context.Reference<string> = Context.Reference<string>(\n\t\"@brytdesigns/shopify-utils/StorefrontOrigin\",\n\t{\n\t\tdefaultValue: () =>\n\t\t\ttypeof window === \"undefined\" ? \"\" : window.location.origin,\n\t},\n);\n\n/** Pins the origin for a whole program. */\nexport const layer = (origin: string): Layer.Layer<never> =>\n\tLayer.succeed(Origin, origin);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,SAAoC,QAAQ,UACxD,+CACA,EACC,oBACC,OAAO,WAAW,cAAc,KAAK,OAAO,SAAS,OACvD,CACD;;AAGA,IAAa,SAAS,WACrB,MAAM,QAAQ,QAAQ,MAAM"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { AllowedRouteOrigins_exports } from "./AllowedRouteOrigins.js";
|
|
3
|
+
import { ShopifyRoutes_exports } from "./ShopifyRoutes.js";
|
|
4
|
+
import { StorefrontClientConfig_exports } from "./StorefrontClientConfig.js";
|
|
5
|
+
import { StorefrontOrigin_exports } from "./StorefrontOrigin.js";
|
|
6
|
+
//#region src/effect/Ajax/Window/data/index.ts
|
|
7
|
+
var data_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
AllowedRouteOrigins: () => AllowedRouteOrigins_exports,
|
|
9
|
+
ShopifyRoutes: () => ShopifyRoutes_exports,
|
|
10
|
+
StorefrontClientConfig: () => StorefrontClientConfig_exports,
|
|
11
|
+
StorefrontOrigin: () => StorefrontOrigin_exports
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { AllowedRouteOrigins_exports as AllowedRouteOrigins, ShopifyRoutes_exports as ShopifyRoutes, StorefrontClientConfig_exports as StorefrontClientConfig, StorefrontOrigin_exports as StorefrontOrigin, data_exports };
|
|
15
|
+
|
|
6
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/effect/Ajax/Window/data/index.ts"],"sourcesContent":["export * as AllowedRouteOrigins from \"./AllowedRouteOrigins.js\";\nexport * as ShopifyRoutes from \"./ShopifyRoutes.js\";\nexport * as StorefrontClientConfig from \"./StorefrontClientConfig.js\";\nexport * as StorefrontOrigin from \"./StorefrontOrigin.js\";\n"],"mappings":""}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { schema_exports } from "./Sections/schema.js";
|
|
3
|
+
import "./Sections/index.js";
|
|
4
|
+
import { data_exports } from "./Window/data/index.js";
|
|
5
|
+
import "./Window/index.js";
|
|
6
|
+
//#region src/effect/Ajax/index.ts
|
|
7
|
+
var Ajax_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
Sections: () => schema_exports,
|
|
9
|
+
Window: () => data_exports
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Ajax_exports, schema_exports as Sections, data_exports as Window };
|
|
13
|
+
|
|
4
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/effect/Ajax/index.ts"],"sourcesContent":["export * from \"./Sections/index.js\";\nexport * from \"./Window/index.js\";\n"],"mappings":""}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as References from "effect/References";
|
|
4
|
+
//#region src/effect/Logging/index.ts
|
|
5
|
+
var Logging_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
filterLevelOrNever: () => filterLevelOrNever,
|
|
7
|
+
makeNamespacedLogSpan: () => makeNamespacedLogSpan
|
|
8
|
+
});
|
|
9
|
+
var filterLevelOrNever = (level, effect) => Effect.gen(function* () {
|
|
10
|
+
if ((yield* References.MinimumLogLevel) !== level) return yield* effect;
|
|
8
11
|
});
|
|
9
|
-
|
|
12
|
+
var makeNamespacedLogSpan = (prefix) => (label) => Effect.withLogSpan(`${prefix}:${label}`);
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Logging_exports, filterLevelOrNever, makeNamespacedLogSpan };
|
|
10
15
|
|
|
11
|
-
export { filterLevelOrNever, makeNamespacedLogSpan };
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/effect/Logging/index.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport type * as LogLevel from \"effect/LogLevel\";\nimport * as References from \"effect/References\";\n\nexport const filterLevelOrNever = <A, E, R>(\n\tlevel: LogLevel.LogLevel,\n\teffect: Effect.Effect<A, E, R>,\n) =>\n\tEffect.gen(function* () {\n\t\t// v4: the minimum log level is a Context.Reference rather than a FiberRef,\n\t\t// and levels are string literals rather than branded objects.\n\t\tconst logLevel = yield* References.MinimumLogLevel;\n\t\tif (logLevel !== level) return yield* effect;\n\t});\n\nexport const makeNamespacedLogSpan = (prefix: string) => (label: string) =>\n\tEffect.withLogSpan(`${prefix}:${label}`);\n"],"mappings":";;;;;;;;AAIA,IAAa,sBACZ,OACA,WAEA,OAAO,IAAI,aAAa;CAIvB,KAAI,OADoB,WAAW,qBAClB,OAAO,OAAO,OAAO;AACvC,CAAC;AAEF,IAAa,yBAAyB,YAAoB,UACzD,OAAO,YAAY,GAAG,OAAO,GAAG,OAAO"}
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) => Effect.gen(function* () {
|
|
10
|
-
const [actualId, actualType] = yield* Effect.all(
|
|
11
|
-
[Schema.decode(ID)(id), Schema.decode(Type)(type)],
|
|
12
|
-
{
|
|
13
|
-
concurrency: "unbounded"
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
return `gid://shopify/${actualType}/${actualId}`;
|
|
1
|
+
import { GID, ID, Type } from "./schema.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as SchemaGetter from "effect/SchemaGetter";
|
|
5
|
+
//#region src/effect/Resource/data.ts
|
|
6
|
+
var format = ({ id, type }) => Effect.gen(function* () {
|
|
7
|
+
const [actualId, actualType] = yield* Effect.all([Schema.decodeEffect(ID)(id), Schema.decodeEffect(Type)(type)], { concurrency: "unbounded" });
|
|
8
|
+
return `gid://shopify/${actualType}/${actualId}`;
|
|
17
9
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)(input);
|
|
30
|
-
|
|
10
|
+
/**
|
|
11
|
+
* v4 replaces `Schema.transformOrFail` with `decodeTo` plus `SchemaGetter`
|
|
12
|
+
* transformations. The decode direction never fails, so it is a plain
|
|
13
|
+
* `transform`; the encode direction is refused outright, which `forbidden`
|
|
14
|
+
* expresses directly rather than by constructing an issue by hand.
|
|
15
|
+
*/
|
|
16
|
+
var parse = (input) => Schema.decodeEffect(GID.pipe(Schema.decodeTo(ID, {
|
|
17
|
+
decode: SchemaGetter.transform((value) => `${value}`.split("/").pop()),
|
|
18
|
+
encode: SchemaGetter.forbidden(() => "Encoding an ID to a GID is not allowed. Use the format function to convert IDs to GIDs.")
|
|
19
|
+
})))(input);
|
|
20
|
+
//#endregion
|
|
31
21
|
export { format, parse };
|
|
32
|
-
|
|
22
|
+
|
|
33
23
|
//# sourceMappingURL=data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"data.js","names":[],"sources":["../../../src/effect/Resource/data.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaGetter from \"effect/SchemaGetter\";\nimport { GID, ID, Type } from \"./schema.js\";\n\ntype FormatOptions<T extends ID, R extends Type> = {\n\tid: T;\n\ttype: R;\n};\n\nexport const format = <const T extends ID, const R extends Type>({\n\tid,\n\ttype,\n}: FormatOptions<T, R>) =>\n\tEffect.gen(function* () {\n\t\tconst [actualId, actualType] = yield* Effect.all(\n\t\t\t[Schema.decodeEffect(ID)(id), Schema.decodeEffect(Type)(type)],\n\t\t\t{\n\t\t\t\tconcurrency: \"unbounded\",\n\t\t\t},\n\t\t);\n\t\treturn `gid://shopify/${actualType}/${actualId}` as `gid://shopify/${R}/${T}`;\n\t});\n\n/**\n * v4 replaces `Schema.transformOrFail` with `decodeTo` plus `SchemaGetter`\n * transformations. The decode direction never fails, so it is a plain\n * `transform`; the encode direction is refused outright, which `forbidden`\n * expresses directly rather than by constructing an issue by hand.\n */\nexport const parse = (input: string) =>\n\tSchema.decodeEffect(\n\t\tGID.pipe(\n\t\t\tSchema.decodeTo(ID, {\n\t\t\t\tdecode: SchemaGetter.transform(\n\t\t\t\t\t(value: string) => `${value}`.split(\"/\").pop() as ID,\n\t\t\t\t),\n\t\t\t\tencode: SchemaGetter.forbidden(\n\t\t\t\t\t() =>\n\t\t\t\t\t\t\"Encoding an ID to a GID is not allowed. Use the format function to convert IDs to GIDs.\",\n\t\t\t\t),\n\t\t\t}),\n\t\t),\n\t)(input);\n"],"mappings":";;;;;AAUA,IAAa,UAAoD,EAChE,IACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,CAAC,UAAU,cAAc,OAAO,OAAO,IAC5C,CAAC,OAAO,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,aAAa,IAAI,CAAC,CAAC,IAAI,CAAC,GAC7D,EACC,aAAa,YACd,CACD;CACA,OAAO,iBAAiB,WAAW,GAAG;AACvC,CAAC;;;;;;;AAQF,IAAa,SAAS,UACrB,OAAO,aACN,IAAI,KACH,OAAO,SAAS,IAAI;CACnB,QAAQ,aAAa,WACnB,UAAkB,GAAG,QAAQ,MAAM,GAAG,CAAC,CAAC,IAAI,CAC9C;CACA,QAAQ,aAAa,gBAEnB,yFACF;AACD,CAAC,CACF,CACD,CAAC,CAAC,KAAK"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { GID, ID, Type } from "./schema.js";
|
|
3
|
+
import { format, parse } from "./data.js";
|
|
4
|
+
//#region src/effect/Resource/index.ts
|
|
5
|
+
var Resource_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
GID: () => GID,
|
|
7
|
+
ID: () => ID,
|
|
8
|
+
Type: () => Type,
|
|
9
|
+
format: () => format,
|
|
10
|
+
parse: () => parse
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { GID, ID, Resource_exports, Type, format, parse };
|
|
14
|
+
|
|
4
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/effect/Resource/index.ts"],"sourcesContent":["export * from \"./data.js\";\nexport { GID, ID, Type } from \"./schema.js\";\n"],"mappings":""}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import * as Schema from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
44
|
-
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
//#region src/effect/Resource/schema.ts
|
|
3
|
+
var Type = Schema.Literals([
|
|
4
|
+
"Cart",
|
|
5
|
+
"Collection",
|
|
6
|
+
"Customer",
|
|
7
|
+
"DeliveryCarrierService",
|
|
8
|
+
"DeliveryLocationGroup",
|
|
9
|
+
"DeliveryProfile",
|
|
10
|
+
"DeliveryZone",
|
|
11
|
+
"DraftOrder",
|
|
12
|
+
"DraftOrderLineItem",
|
|
13
|
+
"Duty",
|
|
14
|
+
"EmailTemplate",
|
|
15
|
+
"Fulfillment",
|
|
16
|
+
"FulfullmentEvent",
|
|
17
|
+
"FullfullmentService",
|
|
18
|
+
"InventoryItem",
|
|
19
|
+
"InventoryLevel",
|
|
20
|
+
"LineItem",
|
|
21
|
+
"Location",
|
|
22
|
+
"MarketingEvent",
|
|
23
|
+
"MediaImage",
|
|
24
|
+
"Metafield",
|
|
25
|
+
"OnlineStoreArticle",
|
|
26
|
+
"OnlineStoreBlog",
|
|
27
|
+
"OnlineStorePage",
|
|
28
|
+
"Order",
|
|
29
|
+
"OrderTransaction",
|
|
30
|
+
"Product",
|
|
31
|
+
"ProductImage",
|
|
32
|
+
"ProductVariant",
|
|
33
|
+
"Refund",
|
|
34
|
+
"Shop",
|
|
35
|
+
"StaffMember",
|
|
36
|
+
"Theme"
|
|
37
|
+
]);
|
|
38
|
+
var GID = Schema.String.check(Schema.isStartingWith("gid://shopify/"));
|
|
39
|
+
var ID = Schema.Union([
|
|
40
|
+
Schema.Number,
|
|
41
|
+
Schema.NumberFromString,
|
|
42
|
+
Schema.String
|
|
43
|
+
]);
|
|
44
|
+
//#endregion
|
|
45
45
|
export { GID, ID, Type };
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../../src/effect/Resource/schema.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport type Type = Schema.Schema.Type<typeof Type>;\nexport const Type = Schema.Literals([\n\t\"Cart\",\n\t\"Collection\",\n\t\"Customer\",\n\t\"DeliveryCarrierService\",\n\t\"DeliveryLocationGroup\",\n\t\"DeliveryProfile\",\n\t\"DeliveryZone\",\n\t\"DraftOrder\",\n\t\"DraftOrderLineItem\",\n\t\"Duty\",\n\t\"EmailTemplate\",\n\t\"Fulfillment\",\n\t\"FulfullmentEvent\",\n\t\"FullfullmentService\",\n\t\"InventoryItem\",\n\t\"InventoryLevel\",\n\t\"LineItem\",\n\t\"Location\",\n\t\"MarketingEvent\",\n\t\"MediaImage\",\n\t\"Metafield\",\n\t\"OnlineStoreArticle\",\n\t\"OnlineStoreBlog\",\n\t\"OnlineStorePage\",\n\t\"Order\",\n\t\"OrderTransaction\",\n\t\"Product\",\n\t\"ProductImage\",\n\t\"ProductVariant\",\n\t\"Refund\",\n\t\"Shop\",\n\t\"StaffMember\",\n\t\"Theme\",\n]);\n\nexport type GID = Schema.Codec.Encoded<typeof GID>;\nexport const GID = Schema.String.check(Schema.isStartingWith(\"gid://shopify/\"));\n\nexport type ID = Schema.Codec.Encoded<typeof ID>;\nexport const ID = Schema.Union([\n\tSchema.Number,\n\tSchema.NumberFromString,\n\tSchema.String,\n]);\n"],"mappings":";;AAGA,IAAa,OAAO,OAAO,SAAS;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAGD,IAAa,MAAM,OAAO,OAAO,MAAM,OAAO,eAAe,gBAAgB,CAAC;AAG9E,IAAa,KAAK,OAAO,MAAM;CAC9B,OAAO;CACP,OAAO;CACP,OAAO;AACR,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|