@m1212e/rumble 0.16.47 → 0.17.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/out/index.mjs CHANGED
@@ -181,7 +181,7 @@ function mapNullFieldsToUndefined(obj) {
181
181
  }
182
182
  //#endregion
183
183
  //#region package.json
184
- var version = "0.16.47";
184
+ var version = "0.17.0";
185
185
  //#endregion
186
186
  //#region lib/helpers/mergeFilters.ts
187
187
  function mergeFilters(filterA, filterB) {
@@ -1774,6 +1774,13 @@ export const db = drizzle(
1774
1774
  }
1775
1775
  });
1776
1776
  };
1777
+ const createWs = (implementation, args, ...rest) => {
1778
+ return implementation({
1779
+ ...args,
1780
+ schema: builtSchema(),
1781
+ context
1782
+ }, ...rest);
1783
+ };
1777
1784
  return {
1778
1785
  /**
1779
1786
  * The ability builder. Use it to declare whats allowed for each entity in your DB.
@@ -1826,6 +1833,26 @@ export const db = drizzle(
1826
1833
  */
1827
1834
  createSofa,
1828
1835
  /**
1836
+ * Creates a WebSocket server handler for GraphQL subscriptions.
1837
+ * Pass the ws implementation function as the first argument and rumble will
1838
+ * inject the schema and context automatically.
1839
+ *
1840
+ * @example
1841
+ *
1842
+ * ```ts
1843
+ * // ws
1844
+ * import { useServer } from "graphql-ws/use/ws";
1845
+ * import { WebSocketServer } from "ws";
1846
+ * const wss = new WebSocketServer({ port: 4000 });
1847
+ * const disposable = createWs(useServer, { ... }, wss);
1848
+ *
1849
+ * // bun
1850
+ * import { makeHandler } from "graphql-ws/use/bun";
1851
+ * Bun.serve({ websocket: createWs(makeHandler, { ... }), ... });
1852
+ * ```
1853
+ */
1854
+ createWs,
1855
+ /**
1829
1856
  * A function for creating default objects for your schema
1830
1857
  */
1831
1858
  object,