prisma-cursorstream 0.2.0 → 0.3.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/README.md CHANGED
@@ -23,6 +23,21 @@ import cursorStream from "prisma-cursorstream";
23
23
  const db = new PrismaClient().$extends(cursorStream);
24
24
  ```
25
25
 
26
+ <details>
27
+ <summary>Using CommonJS `require`?</summary>
28
+
29
+ ### CommonJS `require`
30
+
31
+ ```js
32
+ const cursorStream = require("prisma-cursorstream").default;
33
+
34
+ const db = new PrismaClient().$extends(cursorStream);
35
+ ```
36
+
37
+ Refer to [#1](https://github.com/etabits/prisma-cursorstream/issues/1).
38
+
39
+ </details>
40
+
26
41
  ## Usage
27
42
 
28
43
  ```js
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Prisma, PrismaClientExtends } from "@prisma/client/extension";
2
2
  import { DefaultArgs } from "@prisma/client/runtime/library";
3
3
  declare const _default: (client: any) => PrismaClientExtends<import("@prisma/client/runtime/library").InternalArgs<{}, {
4
4
  $allModels: {
5
- cursorStream<T, A extends Prisma.Args<T, "findMany">, R extends Prisma.Result<T, A, "findMany">[number], C extends ((dataset: R[]) => Promise<unknown[]>) | undefined>(this: T, findManyArgs: A, { batchSize, prefill, batchTransformer }?: {
5
+ cursorStream<T, A extends Prisma.Args<T, "findMany"> | undefined, R extends Prisma.Result<T, A, "findMany">[number], C extends ((dataset: R[]) => Promise<unknown[]>) | undefined>(this: T, findManyArgs: A, { batchSize, prefill, batchTransformer }?: {
6
6
  batchSize?: number | undefined;
7
7
  prefill?: number | undefined;
8
8
  batchTransformer?: C | undefined;
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ exports.default = extension_1.Prisma.defineExtension((client) => {
7
7
  model: {
8
8
  $allModels: {
9
9
  cursorStream(findManyArgs, { batchSize, prefill, batchTransformer } = {}) {
10
+ findManyArgs = findManyArgs !== null && findManyArgs !== void 0 ? findManyArgs : {};
10
11
  const context = extension_1.Prisma.getExtensionContext(this);
11
12
  const take = batchSize || 100;
12
13
  const highWaterMark = prefill || take * 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-cursorstream",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Prisma Stream Client Extension (Cursor-based Implementation)",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",