@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.cjs CHANGED
@@ -209,7 +209,7 @@ function mapNullFieldsToUndefined(obj) {
209
209
  }
210
210
  //#endregion
211
211
  //#region package.json
212
- var version = "0.16.47";
212
+ var version = "0.17.0";
213
213
  //#endregion
214
214
  //#region lib/helpers/mergeFilters.ts
215
215
  function mergeFilters(filterA, filterB) {
@@ -1802,6 +1802,13 @@ export const db = drizzle(
1802
1802
  }
1803
1803
  });
1804
1804
  };
1805
+ const createWs = (implementation, args, ...rest) => {
1806
+ return implementation({
1807
+ ...args,
1808
+ schema: builtSchema(),
1809
+ context
1810
+ }, ...rest);
1811
+ };
1805
1812
  return {
1806
1813
  /**
1807
1814
  * The ability builder. Use it to declare whats allowed for each entity in your DB.
@@ -1854,6 +1861,26 @@ export const db = drizzle(
1854
1861
  */
1855
1862
  createSofa,
1856
1863
  /**
1864
+ * Creates a WebSocket server handler for GraphQL subscriptions.
1865
+ * Pass the ws implementation function as the first argument and rumble will
1866
+ * inject the schema and context automatically.
1867
+ *
1868
+ * @example
1869
+ *
1870
+ * ```ts
1871
+ * // ws
1872
+ * import { useServer } from "graphql-ws/use/ws";
1873
+ * import { WebSocketServer } from "ws";
1874
+ * const wss = new WebSocketServer({ port: 4000 });
1875
+ * const disposable = createWs(useServer, { ... }, wss);
1876
+ *
1877
+ * // bun
1878
+ * import { makeHandler } from "graphql-ws/use/bun";
1879
+ * Bun.serve({ websocket: createWs(makeHandler, { ... }), ... });
1880
+ * ```
1881
+ */
1882
+ createWs,
1883
+ /**
1857
1884
  * A function for creating default objects for your schema
1858
1885
  */
1859
1886
  object,