@cedarjs/api 8.0.0-canary.3398 → 8.0.0-canary.3402

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=removeNulls.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeNulls.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/removeNulls.test-d.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -8,9 +8,9 @@ export * from "./cors.js";
8
8
  export * from "./event.js";
9
9
  export * from "./signedTokens/index.js";
10
10
  const prismaVersion = "7.10.0";
11
- const redwoodVersion = "8.0.0-canary.3398";
12
- const cedarjsVersion = "8.0.0-canary.3398";
13
- const cedarVersion = "8.0.0-canary.3398";
11
+ const redwoodVersion = "8.0.0-canary.3402";
12
+ const cedarjsVersion = "8.0.0-canary.3402";
13
+ const cedarVersion = "8.0.0-canary.3402";
14
14
  export {
15
15
  cedarVersion,
16
16
  cedarjsVersion,
@@ -28,9 +28,27 @@ export declare const isFetchApiRequest: (event: Request | APIGatewayProxyEvent)
28
28
  */
29
29
  export declare function normalizeRequest(event: APIGatewayProxyEvent | Request): Promise<PartialRequest>;
30
30
  /**
31
- * Useful for removing nulls from an object, such as an input from a GraphQL mutation used directly in a Prisma query
32
- * @param input - Object to remove nulls from
33
- * See {@link https://www.prisma.io/docs/concepts/components/prisma-client/null-and-undefined Prisma docs: null vs undefined}
31
+ * The type of `T` after `removeNulls`: each field that can be `null` can be
32
+ * `undefined` instead.
34
33
  */
35
- export declare const removeNulls: (input: Record<number | symbol | string, any>) => Record<string | number | symbol, any>;
34
+ export type RemoveNulls<T> = {
35
+ [K in keyof T]: null extends T[K] ? Exclude<T[K], null> | undefined : T[K];
36
+ };
37
+ /**
38
+ * Returns a copy of `input` with every `null` field set to `undefined`.
39
+ *
40
+ * GraphQL input types make every field nullable, but Prisma doesn't accept
41
+ * `null` for required fields. `undefined` leaves the field unchanged, so this
42
+ * lets you pass a GraphQL mutation input straight to Prisma:
43
+ *
44
+ * ```ts
45
+ * db.post.update({ data: removeNulls(input), where: { id } })
46
+ * ```
47
+ *
48
+ * Only top-level fields are changed. Nested objects, such as `Json` field
49
+ * values, are passed through as they are.
50
+ *
51
+ * See {@link https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/null-and-undefined Prisma docs: null vs undefined}
52
+ */
53
+ export declare function removeNulls<T extends object>(input: T): RemoveNulls<T>;
36
54
  //# sourceMappingURL=transforms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD,MAAM,WAAW,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzD,QAAQ,EAAE,KAAK,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,GAAG,CAAA;CACX;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,oBAAoB,QAU/D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,OAAO,OAAO,iBAQvD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAS,OAAO,KACf,OAAO,CAAC,oBAAoB,CAgE9B,CAAA;AAoCD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,OAAO,GAAG,oBAAoB,KACpC,KAAK,IAAI,OAcX,CAAA;AAaD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,oBAAoB,GAAG,OAAO,GACpC,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAID;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,0CAcvE,CAAA"}
1
+ {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD,MAAM,WAAW,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzD,QAAQ,EAAE,KAAK,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,GAAG,CAAA;CACX;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,oBAAoB,QAU/D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,OAAO,OAAO,iBAQvD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAS,OAAO,KACf,OAAO,CAAC,oBAAoB,CAgE9B,CAAA;AAoCD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,OAAO,GAAG,oBAAoB,KACpC,KAAK,IAAI,OAcX,CAAA;AAaD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,oBAAoB,GAAG,OAAO,GACpC,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;CAC3E,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAiBtE"}
@@ -131,16 +131,18 @@ async function normalizeRequest(event) {
131
131
  jsonBody
132
132
  };
133
133
  }
134
- const removeNulls = (input) => {
135
- for (const key in input) {
136
- if (input[key] === null) {
137
- input[key] = void 0;
138
- } else if (typeof input[key] === "object" && !(input[key] instanceof Date)) {
139
- input[key] = removeNulls(input[key]);
140
- }
134
+ function removeNulls(input) {
135
+ if (Array.isArray(input)) {
136
+ return input.map(
137
+ (value) => value === null ? void 0 : value
138
+ );
141
139
  }
142
- return input;
143
- };
140
+ const result = {};
141
+ for (const [key, value] of Object.entries(input)) {
142
+ result[key] = value === null ? void 0 : value;
143
+ }
144
+ return result;
145
+ }
144
146
  export {
145
147
  isFetchApiRequest,
146
148
  normalizeRequest,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=webhooks.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.test-d.d.ts","sourceRoot":"","sources":["../../../src/webhooks/__tests__/webhooks.test-d.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api",
3
- "version": "8.0.0-canary.3398",
3
+ "version": "8.0.0-canary.3402",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -84,7 +84,7 @@
84
84
  "title-case": "3.0.3"
85
85
  },
86
86
  "devDependencies": {
87
- "@cedarjs/framework-tools": "8.0.0-canary.3398",
87
+ "@cedarjs/framework-tools": "8.0.0-canary.3402",
88
88
  "@types/aws-lambda": "8.10.164",
89
89
  "@types/jsonwebtoken": "9.0.10",
90
90
  "@types/memjs": "1",