UNPKG

houdini-svelte

Version:
50 lines (49 loc) 1.79 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var fragments_exports = {}; __export(fragments_exports, { fragment: () => fragment, paginatedFragment: () => paginatedFragment }); module.exports = __toCommonJS(fragments_exports); function fragment(ref, store) { if (store.kind !== "HoudiniFragment") { throw new Error(`fragment can only take fragment documents. Found: ${store.kind}`); } const fragmentStore = store.get(ref); return { ...fragmentStore, artifact: store.artifact, data: { subscribe: fragmentStore.subscribe } }; } function paginatedFragment(initialValue, store) { if (store.kind !== "HoudiniFragment") { throw new Error("paginatedFragment() must be passed a fragment document: " + store.kind); } if (!("paginated" in store)) { throw new Error("paginatedFragment() must be passed a fragment with @paginate"); } return fragment(initialValue, store); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { fragment, paginatedFragment });