@brytdesigns/shopify-ajax-cart-api 1.0.43 → 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.
Files changed (35) hide show
  1. package/dist/effect/api/CartAdd.js +36 -9
  2. package/dist/effect/api/CartAdd.js.map +1 -1
  3. package/dist/effect/api/CartChange.js +32 -9
  4. package/dist/effect/api/CartChange.js.map +1 -1
  5. package/dist/effect/api/CartClear.js +26 -9
  6. package/dist/effect/api/CartClear.js.map +1 -1
  7. package/dist/effect/api/CartGet.js +35 -9
  8. package/dist/effect/api/CartGet.js.map +1 -1
  9. package/dist/effect/api/CartUpdate.js +31 -9
  10. package/dist/effect/api/CartUpdate.js.map +1 -1
  11. package/dist/effect/index.d.ts +1746 -899
  12. package/dist/effect/index.js +13 -13
  13. package/dist/effect/index.js.map +1 -1
  14. package/dist/effect/schema.js +970 -1059
  15. package/dist/effect/schema.js.map +1 -1
  16. package/dist/main/effect/api/CartAdd.js +36 -9
  17. package/dist/main/effect/api/CartAdd.js.map +1 -1
  18. package/dist/main/effect/api/CartChange.js +32 -9
  19. package/dist/main/effect/api/CartChange.js.map +1 -1
  20. package/dist/main/effect/api/CartClear.js +26 -9
  21. package/dist/main/effect/api/CartClear.js.map +1 -1
  22. package/dist/main/effect/api/CartGet.js +35 -9
  23. package/dist/main/effect/api/CartGet.js.map +1 -1
  24. package/dist/main/effect/api/CartUpdate.js +31 -9
  25. package/dist/main/effect/api/CartUpdate.js.map +1 -1
  26. package/dist/main/effect/index.js +13 -13
  27. package/dist/main/effect/index.js.map +1 -1
  28. package/dist/main/effect/schema.js +970 -1059
  29. package/dist/main/effect/schema.js.map +1 -1
  30. package/dist/main/index.d.ts +586 -1808
  31. package/dist/main/index.js +123 -235
  32. package/dist/main/index.js.map +1 -1
  33. package/package.json +11 -13
  34. package/dist/esm/index.js +0 -19525
  35. package/dist/esm/index.js.map +0 -1
@@ -1,12 +1,39 @@
1
- import { CartAddOutput, CartAddInput } from '../schema.js';
2
- import * as AjaxClient from '@brytdesigns/shopify-ajax-client';
3
-
4
- const make = AjaxClient.makeFactory({
5
- routeName: "cart_add_url",
6
- inputSchema: CartAddInput,
7
- outputSchema: CartAddOutput
1
+ import { CartAddInput, makeCartAddOutput } from "../schema.js";
2
+ import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
3
+ //#region src/effect/api/CartAdd.ts
4
+ /**
5
+ * Describes a request that adds items to the cart.
6
+ *
7
+ * Returns a description rather than an effect: pipe it through the
8
+ * `shopify-ajax-client` combinators and finish with `execute`.
9
+ *
10
+ * @param input - The items to add.
11
+ * @returns An `AjaxRequest` decoding to the updated cart.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
16
+ * import * as Effect from "effect/Effect";
17
+ * import { make as addToCart } from "./CartAdd.js";
18
+ *
19
+ * const cart = await Effect.runPromise(
20
+ * addToCart({ items: [{ id: 123, quantity: 2 }] }).pipe(
21
+ * AjaxClient.execute,
22
+ * Effect.provide(AjaxClient.layer),
23
+ * ),
24
+ * );
25
+ * ```
26
+ *
27
+ * A non-200 fails with `AjaxResponseError` rather than resolving to an
28
+ * envelope, so a sold-out variant is a failure you catch, not a field you
29
+ * check.
30
+ */
31
+ var make = AjaxClient.makeRoute({
32
+ routeName: "cart_add_url",
33
+ inputSchema: CartAddInput,
34
+ outputSchema: makeCartAddOutput
8
35
  });
9
-
36
+ //#endregion
10
37
  export { make };
11
- //# sourceMappingURL=CartAdd.js.map
38
+
12
39
  //# sourceMappingURL=CartAdd.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/effect/api/CartAdd.ts"],"names":[],"mappings":";;;AA2Ca,MAAA,IAAA,GAAO,WAAW,WAAY,CAAA;AAAA,EACzC,SAAW,EAAA,cAAA;AAAA,EACX,WAAa,EAAA,YAAA;AAAA,EACb,YAAc,EAAA;AAChB,CAAC","file":"CartAdd.js","sourcesContent":["import { CartAddInput, CartAddOutput } from \"../schema.js\";\n\nimport * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n\nexport type AddInput = CartAddInput;\n\n/**\n * This function is a factory method for creating a function that adds an item to the cart.\n * It utilizes the provided AjaxClient to make the necessary API request.\n *\n * @param routeName - The name of the route for adding an item to the cart.\n * @param inputSchema - The schema for the input parameters of the cart add API.\n * @param outputSchema - The schema for the output response of the cart add API.\n *\n * @returns A runnable effect that returns a promise which adhears to the CartAddOutput schema.\n *\n * @example\n * ```typescript\n * import * as Effect from \"effect/Effect\"\n * import { make } from \"./CartAdd.js\";\n *\n * const addItemToCart = make({\n * routeName: \"cart_add_url\",\n * inputSchema: CartAddInput,\n * outputSchema: CartAddOutput,\n * });\n *\n * const input: CartAddInput = {\n * items: [\n * { id: 123, quantity: 2 },\n * { id: 456, quantity: 1 },\n * ]\n * };\n *\n * Effect.runPromise(addItemToCart(input))\n * .then((output) => {\n * console.log(\"Item added to cart:\", output?.data);\n * })\n * .catch((error) => {\n * console.error(\"Failed to add item to cart:\", error);\n * });\n * ```\n */\nexport const make = AjaxClient.makeFactory({\n routeName: \"cart_add_url\",\n inputSchema: CartAddInput,\n outputSchema: CartAddOutput,\n});\n"]}
1
+ {"version":3,"file":"CartAdd.js","names":[],"sources":["../../../src/effect/api/CartAdd.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartAddInput, makeCartAddOutput } from \"../schema.js\";\n\nexport type AddInput = CartAddInput;\n\n/**\n * Describes a request that adds items to the cart.\n *\n * Returns a description rather than an effect: pipe it through the\n * `shopify-ajax-client` combinators and finish with `execute`.\n *\n * @param input - The items to add.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as addToCart } from \"./CartAdd.js\";\n *\n * const cart = await Effect.runPromise(\n * addToCart({ items: [{ id: 123, quantity: 2 }] }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n *\n * A non-200 fails with `AjaxResponseError` rather than resolving to an\n * envelope, so a sold-out variant is a failure you catch, not a field you\n * check.\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_add_url\",\n\tinputSchema: CartAddInput,\n\toutputSchema: makeCartAddOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
@@ -1,12 +1,35 @@
1
- import { CartChangeOutput, CartChangeInput } from '../schema.js';
2
- import * as AjaxClient from '@brytdesigns/shopify-ajax-client';
3
-
4
- const make = AjaxClient.makeFactory({
5
- routeName: "cart_change_url",
6
- inputSchema: CartChangeInput,
7
- outputSchema: CartChangeOutput
1
+ import { CartChangeInput, makeCartChangeOutput } from "../schema.js";
2
+ import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
3
+ //#region src/effect/api/CartChange.ts
4
+ /**
5
+ * Describes a request that changes one cart line.
6
+ *
7
+ * Identify the line by `id` (its key) or by `line` (its 1-based position), and
8
+ * supply any of `quantity`, `properties` or `selling_plan`.
9
+ *
10
+ * @param input - The line to change, and what to change about it.
11
+ * @returns An `AjaxRequest` decoding to the updated cart.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
16
+ * import * as Effect from "effect/Effect";
17
+ * import { make as changeLine } from "./CartChange.js";
18
+ *
19
+ * const cart = await Effect.runPromise(
20
+ * changeLine({ id: "44632334532825:694d7922", quantity: 2 }).pipe(
21
+ * AjaxClient.execute,
22
+ * Effect.provide(AjaxClient.layer),
23
+ * ),
24
+ * );
25
+ * ```
26
+ */
27
+ var make = AjaxClient.makeRoute({
28
+ routeName: "cart_change_url",
29
+ inputSchema: CartChangeInput,
30
+ outputSchema: makeCartChangeOutput
8
31
  });
9
-
32
+ //#endregion
10
33
  export { make };
11
- //# sourceMappingURL=CartChange.js.map
34
+
12
35
  //# sourceMappingURL=CartChange.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/effect/api/CartChange.ts"],"names":[],"mappings":";;;AAqDa,MAAA,IAAA,GAAO,WAAW,WAAY,CAAA;AAAA,EACzC,SAAW,EAAA,iBAAA;AAAA,EACX,WAAa,EAAA,eAAA;AAAA,EACb,YAAc,EAAA;AAChB,CAAC","file":"CartChange.js","sourcesContent":["import { CartChangeInput, CartChangeOutput } from \"../schema.js\";\n\nimport * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n\nexport type ChangeInput = CartChangeInput;\n\n/**\n * Factory function to create a new instance of CartChange API.\n * This function is used to make requests to the Shopify API for changing properties of an individual cart item.\n *\n * @param routeName - The name of the route for the CartChange API.\n * @param inputSchema - The input schema for the CartChange API.\n * @param outputSchema - The output schema for the CartChange API.\n *\n * @returns A runnable effect that returns a promise which adhears to the CartChangeOutput schema.\n *\n * @example\n * ```typescript\n * import * as Effect from \"effect/Effect\"\n * import { make } from \"./CartChange.js\";\n *\n * const cartChangeRequest = make({\n * routeName: \"cart_change_url\",\n * inputSchema: CartChangeInput,\n * outputSchema: CartChangeOutput,\n * });\n *\n * const response = await Effect.runPromise(cartChangeRequest({\n * line: 1,\n * quantity: 2\n * }));\n *\n * const response = await Effect.runPromise(cartChangeRequest({\n * // variant id\n * id: 1230311313,\n * quantity: 2\n * }));\n *\n * const response = await Effect.runPromise(cartChangeRequest({\n * // item key\n * id: \"q23asdl234lk241:1230311313\",\n * quantity: 2\n * }));\n *\n * const response = await Effect.runPromise(cartChangeRequest({\n * // item key\n * id: \"q23asdl234lk241:1230311313\",\n * properties: {\n * size: \"Large\"\n * }\n * }));\n * ```\n */\nexport const make = AjaxClient.makeFactory({\n routeName: \"cart_change_url\",\n inputSchema: CartChangeInput,\n outputSchema: CartChangeOutput,\n});\n"]}
1
+ {"version":3,"file":"CartChange.js","names":[],"sources":["../../../src/effect/api/CartChange.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartChangeInput, makeCartChangeOutput } from \"../schema.js\";\n\nexport type ChangeInput = CartChangeInput;\n\n/**\n * Describes a request that changes one cart line.\n *\n * Identify the line by `id` (its key) or by `line` (its 1-based position), and\n * supply any of `quantity`, `properties` or `selling_plan`.\n *\n * @param input - The line to change, and what to change about it.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as changeLine } from \"./CartChange.js\";\n *\n * const cart = await Effect.runPromise(\n * changeLine({ id: \"44632334532825:694d7922\", quantity: 2 }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_change_url\",\n\tinputSchema: CartChangeInput,\n\toutputSchema: makeCartChangeOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
@@ -1,12 +1,29 @@
1
- import { CartOutput, CartClearInput } from '../schema.js';
2
- import * as AjaxClient from '@brytdesigns/shopify-ajax-client';
3
-
4
- const make = AjaxClient.makeFactory({
5
- routeName: "cart_clear_url",
6
- inputSchema: CartClearInput,
7
- outputSchema: CartOutput
1
+ import { CartClearInput, makeCartOutput } from "../schema.js";
2
+ import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
3
+ //#region src/effect/api/CartClear.ts
4
+ /**
5
+ * Describes a request that empties the cart.
6
+ *
7
+ * @param input - Optional request input; carries the `sections` to re-render.
8
+ * @returns An `AjaxRequest` decoding to the emptied cart.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
13
+ * import * as Effect from "effect/Effect";
14
+ * import { make as clearCart } from "./CartClear.js";
15
+ *
16
+ * const cart = await Effect.runPromise(
17
+ * clearCart().pipe(AjaxClient.execute, Effect.provide(AjaxClient.layer)),
18
+ * );
19
+ * ```
20
+ */
21
+ var make = AjaxClient.makeRoute({
22
+ routeName: "cart_clear_url",
23
+ inputSchema: CartClearInput,
24
+ outputSchema: makeCartOutput
8
25
  });
9
-
26
+ //#endregion
10
27
  export { make };
11
- //# sourceMappingURL=CartClear.js.map
28
+
12
29
  //# sourceMappingURL=CartClear.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/effect/api/CartClear.ts"],"names":[],"mappings":";;;AAkCa,MAAA,IAAA,GAAO,WAAW,WAAY,CAAA;AAAA,EACzC,SAAW,EAAA,gBAAA;AAAA,EACX,WAAa,EAAA,cAAA;AAAA,EACb,YAAc,EAAA;AAChB,CAAC","file":"CartClear.js","sourcesContent":["import { CartOutput, CartClearInput } from \"../schema.js\";\n\nimport * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n\nexport type ClearInput = CartClearInput;\n\n/**\n * A factory function to create a clear cart API request using the provided input schema and output schema.\n * This function utilizes the AjaxClient library to make the API request.\n *\n * @param routeName - The name of the route for the clear cart API request.\n * @param inputSchema - The input schema for the clear cart API request.\n * @param outputSchema - The output schema for the clear cart API request.\n *\n * @returns A runnable effect that returns a promise which adhears to the CartClearOutput schema.\n *\n * @example\n * ```typescript\n * import * as Effect from \"effect/Effect\";\n * import { make } from \"./CartClear\";\n *\n * const clearCart = make({\n * routeName: \"cart_clear_url\",\n * inputSchema: CartClearInput,\n * outputSchema: CartOutput,\n * });\n *\n * Effect.runPromise(clearCart({})).then((response) => {\n * console.log(response); // Handle the response\n * }).catch((error) => {\n * console.error(error); // Handle the error\n * });\n * ```\n */\nexport const make = AjaxClient.makeFactory({\n routeName: \"cart_clear_url\",\n inputSchema: CartClearInput,\n outputSchema: CartOutput,\n});\n"]}
1
+ {"version":3,"file":"CartClear.js","names":[],"sources":["../../../src/effect/api/CartClear.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartClearInput, makeCartOutput } from \"../schema.js\";\n\nexport type ClearInput = CartClearInput;\n\n/**\n * Describes a request that empties the cart.\n *\n * @param input - Optional request input; carries the `sections` to re-render.\n * @returns An `AjaxRequest` decoding to the emptied cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as clearCart } from \"./CartClear.js\";\n *\n * const cart = await Effect.runPromise(\n * clearCart().pipe(AjaxClient.execute, Effect.provide(AjaxClient.layer)),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_clear_url\",\n\tinputSchema: CartClearInput,\n\toutputSchema: makeCartOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
@@ -1,12 +1,38 @@
1
- import { CartOutput, CartGetInput } from '../schema.js';
2
- import * as AjaxClient from '@brytdesigns/shopify-ajax-client';
3
-
4
- const make = AjaxClient.makeFactory({
5
- routeName: "cart_url",
6
- inputSchema: CartGetInput,
7
- outputSchema: CartOutput
1
+ import { CartGetInput, makeCartOutput } from "../schema.js";
2
+ import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
3
+ //#region src/effect/api/CartGet.ts
4
+ /**
5
+ * Describes a request for the current cart.
6
+ *
7
+ * Returns a description rather than an effect: pipe it through the
8
+ * `shopify-ajax-client` combinators and finish with `execute`.
9
+ *
10
+ * @param input - Optional request input; carries the `sections` to re-render.
11
+ * @returns An `AjaxRequest` decoding to the cart.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
16
+ * import * as Effect from "effect/Effect";
17
+ * import { pipe } from "effect/Function";
18
+ * import { make as getCart } from "./CartGet.js";
19
+ *
20
+ * const cart = await Effect.runPromise(
21
+ * pipe(
22
+ * getCart(),
23
+ * AjaxClient.withSections("cart-drawer"),
24
+ * AjaxClient.execute,
25
+ * Effect.provide(AjaxClient.layer),
26
+ * ),
27
+ * );
28
+ * ```
29
+ */
30
+ var make = AjaxClient.makeRoute({
31
+ routeName: "cart_url",
32
+ inputSchema: CartGetInput,
33
+ outputSchema: makeCartOutput
8
34
  });
9
-
35
+ //#endregion
10
36
  export { make };
11
- //# sourceMappingURL=CartGet.js.map
37
+
12
38
  //# sourceMappingURL=CartGet.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/effect/api/CartGet.ts"],"names":[],"mappings":";;;AAgCa,MAAA,IAAA,GAAO,WAAW,WAAY,CAAA;AAAA,EACzC,SAAW,EAAA,UAAA;AAAA,EACX,WAAa,EAAA,YAAA;AAAA,EACb,YAAc,EAAA;AAChB,CAAC","file":"CartGet.js","sourcesContent":["import { CartOutput, CartGetInput } from \"../schema.js\";\n\nimport * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n\nexport type GetInput = CartGetInput;\n\n/**\n * This function is a factory method for creating a function that retrieves the current cart from the Shopify store.\n * It utilizes the provided AjaxClient to make the API request.\n *\n * @param routeName - The name of the route for the cart API endpoint.\n * @param inputSchema - The input schema for the cart retrieval request.\n * @param outputSchema - The output schema for the cart retrieval response.\n *\n * @returns A runnable effect that returns a promise which adhears to the CartGetOutput schema.\n *\n * @example\n * ```typescript\n * import * as Effect from \"effect/Effect\";\n * import { make } from \"./CartGet\";\n *\n * const getCart = make({\n * routeName: \"cart_url\",\n * inputSchema: CartGetInput,\n * outputSchema: CartOutput,\n * });\n *\n * Effect.runPromise(getCart({})).then((response) => {\n * console.log(response.data);\n * });\n * ```\n */\nexport const make = AjaxClient.makeFactory({\n routeName: \"cart_url\",\n inputSchema: CartGetInput,\n outputSchema: CartOutput,\n});\n"]}
1
+ {"version":3,"file":"CartGet.js","names":[],"sources":["../../../src/effect/api/CartGet.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartGetInput, makeCartOutput } from \"../schema.js\";\n\nexport type GetInput = CartGetInput;\n\n/**\n * Describes a request for the current cart.\n *\n * Returns a description rather than an effect: pipe it through the\n * `shopify-ajax-client` combinators and finish with `execute`.\n *\n * @param input - Optional request input; carries the `sections` to re-render.\n * @returns An `AjaxRequest` decoding to the cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { pipe } from \"effect/Function\";\n * import { make as getCart } from \"./CartGet.js\";\n *\n * const cart = await Effect.runPromise(\n * pipe(\n * getCart(),\n * AjaxClient.withSections(\"cart-drawer\"),\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_url\",\n\tinputSchema: CartGetInput,\n\toutputSchema: makeCartOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
@@ -1,12 +1,34 @@
1
- import { CartUpdateOutput, CartUpdateInput } from '../schema.js';
2
- import * as AjaxClient from '@brytdesigns/shopify-ajax-client';
3
-
4
- const make = AjaxClient.makeFactory({
5
- routeName: "cart_update_url",
6
- inputSchema: CartUpdateInput,
7
- outputSchema: CartUpdateOutput
1
+ import { CartUpdateInput, makeCartUpdateOutput } from "../schema.js";
2
+ import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
3
+ //#region src/effect/api/CartUpdate.ts
4
+ /**
5
+ * Describes a request that updates cart-level data.
6
+ *
7
+ * Covers notes, attributes, discount codes and bulk line `updates`.
8
+ *
9
+ * @param input - The cart-level changes to apply.
10
+ * @returns An `AjaxRequest` decoding to the updated cart.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
15
+ * import * as Effect from "effect/Effect";
16
+ * import { make as updateCart } from "./CartUpdate.js";
17
+ *
18
+ * const cart = await Effect.runPromise(
19
+ * updateCart({ note: "Leave at door", discount: ["SPRING"] }).pipe(
20
+ * AjaxClient.execute,
21
+ * Effect.provide(AjaxClient.layer),
22
+ * ),
23
+ * );
24
+ * ```
25
+ */
26
+ var make = AjaxClient.makeRoute({
27
+ routeName: "cart_update_url",
28
+ inputSchema: CartUpdateInput,
29
+ outputSchema: makeCartUpdateOutput
8
30
  });
9
-
31
+ //#endregion
10
32
  export { make };
11
- //# sourceMappingURL=CartUpdate.js.map
33
+
12
34
  //# sourceMappingURL=CartUpdate.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/effect/api/CartUpdate.ts"],"names":[],"mappings":";;;AAwCa,MAAA,IAAA,GAAO,WAAW,WAAY,CAAA;AAAA,EACzC,SAAW,EAAA,iBAAA;AAAA,EACX,WAAa,EAAA,eAAA;AAAA,EACb,YAAc,EAAA;AAChB,CAAC","file":"CartUpdate.js","sourcesContent":["import { CartUpdateInput, CartUpdateOutput } from \"../schema.js\";\n\nimport * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n\nexport type UpdateInput = CartUpdateInput;\n\n/**\n * Factory function to create a new instance of CartUpdate API.\n * This function is used to update the cart with the provided input data.\n *\n * @param routeName - The name of the route for the CartUpdate API.\n * @param inputSchema - The input schema for the CartUpdate API.\n * @param outputSchema - The output schema for the CartUpdate API.\n *\n * @returns A runnable effect that returns a promise which adhears to the CartUpdateOutput schema.\n *\n * @example\n * ```typescript\n * import * as Effect from \"effect/Effect\";\n * import {make} from \"./CartUpdate.js\";\n *\n * const cartUpdateRequest = make({\n * routeName: \"cart_update_url\",\n * inputSchema: CartUpdateInput,\n * outputSchema: CartUpdateOutput,\n * });\n *\n * const updatedCart = await Effect.runPromise(cartUpdateRequest({\n * updates: {\n * // variant id\n * 123413523: 1\n * },\n * discount: [\"hello\"]\n * note: \"New note for the cart\",\n * attributes: {\n * \"custom_attribute\": \"new value\"\n * }\n * }));\n * ```\n */\nexport const make = AjaxClient.makeFactory({\n routeName: \"cart_update_url\",\n inputSchema: CartUpdateInput,\n outputSchema: CartUpdateOutput,\n});\n"]}
1
+ {"version":3,"file":"CartUpdate.js","names":[],"sources":["../../../src/effect/api/CartUpdate.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartUpdateInput, makeCartUpdateOutput } from \"../schema.js\";\n\nexport type UpdateInput = CartUpdateInput;\n\n/**\n * Describes a request that updates cart-level data.\n *\n * Covers notes, attributes, discount codes and bulk line `updates`.\n *\n * @param input - The cart-level changes to apply.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as updateCart } from \"./CartUpdate.js\";\n *\n * const cart = await Effect.runPromise(\n * updateCart({ note: \"Leave at door\", discount: [\"SPRING\"] }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_update_url\",\n\tinputSchema: CartUpdateInput,\n\toutputSchema: makeCartUpdateOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}