@cedarjs/internal 8.0.0-canary.3383 → 8.0.0-canary.3386
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/dist/generate/graphqlCodeGen.d.ts.map +1 -1
- package/dist/generate/graphqlCodeGen.js +11 -3
- package/dist/generate/templates/all-currentUser.d.ts.template +12 -3
- package/dist/generate/templates/api-test-globals.d.ts.template +2 -2
- package/dist/generate/templates/web-test-globals.d.ts.template +2 -2
- package/dist/generate/typeDefinitions.js +10 -2
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphqlCodeGen.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlCodeGen.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAoB9D,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAiFvE,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CA2DvE,CAAA;AAyFD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM;SACD,MAAM;GAQ5D;
|
|
1
|
+
{"version":3,"file":"graphqlCodeGen.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlCodeGen.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAoB9D,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAiFvE,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CA2DvE,CAAA;AAyFD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM;SACD,MAAM;GAQ5D;AAmQD,eAAO,MAAM,iBAAiB,4RAe7B,CAAA"}
|
|
@@ -306,8 +306,11 @@ async function getPluginConfig(side) {
|
|
|
306
306
|
// @Note: DateTime fields can be valid Date-strings, or the Date object in the api side. They're strings on the web side, unless `graphql.parsedScalars.DateTime` is set. Then they are Date objects when the web side reads them, and Apollo Client accepts a Date or a string when they're sent.
|
|
307
307
|
DateTime: side === 1 /* WEB */ ? getParsedScalars().DateTime === "Date" ? { input: "Date | string", output: "Date" } : "string" : "Date | string",
|
|
308
308
|
Date: side === 1 /* WEB */ ? "string" : "Date | string",
|
|
309
|
-
JSON
|
|
310
|
-
|
|
309
|
+
// On the api side JSON inputs use Prisma's input types, so they can be
|
|
310
|
+
// passed straight to Prisma. These don't include a top-level null; a
|
|
311
|
+
// nullable JSON argument is typed as `InputMaybe<...>` instead
|
|
312
|
+
JSON: side === 1 /* WEB */ ? "Prisma.JsonValue" : { input: "Prisma.InputJsonValue", output: "Prisma.JsonValue" },
|
|
313
|
+
JSONObject: side === 1 /* WEB */ ? "Prisma.JsonObject" : { input: "Prisma.InputJsonObject", output: "Prisma.JsonObject" },
|
|
311
314
|
Time: side === 1 /* WEB */ ? "string" : "Date | string",
|
|
312
315
|
Byte: "Uint8Array"
|
|
313
316
|
};
|
|
@@ -330,7 +333,12 @@ async function getPluginConfig(side) {
|
|
|
330
333
|
// We do this, so that service tests can call resolvers without doing a null check
|
|
331
334
|
// see https://github.com/redwoodjs/redwood/pull/6222#issuecomment-1230156868
|
|
332
335
|
// Look at type or source https://shrtm.nu/2BA0 for possible config, not well documented
|
|
333
|
-
resolvers: true
|
|
336
|
+
resolvers: true,
|
|
337
|
+
// `resolvers` doesn't cover the root types, so Query and Mutation
|
|
338
|
+
// resolvers need their own flags for services to export non-optional
|
|
339
|
+
// resolver functions
|
|
340
|
+
query: true,
|
|
341
|
+
mutation: true
|
|
334
342
|
},
|
|
335
343
|
contextType: `@cedarjs/graphql-server/dist/types#CedarGraphQLContext`
|
|
336
344
|
};
|
|
@@ -3,7 +3,14 @@ import '@cedarjs/auth'
|
|
|
3
3
|
|
|
4
4
|
import { getCurrentUser } from '../../../api/src/lib/auth.js'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// The logged-in user getCurrentUser() returns. getCurrentUser() returns null
|
|
7
|
+
// when nobody is logged in; @cedarjs/auth's CurrentUser type and
|
|
8
|
+
// GlobalContext's currentUser type below cover that case. LoggedInUser below
|
|
9
|
+
// extends this type, and with strictNullChecks an interface can't extend a
|
|
10
|
+
// type that includes null.
|
|
11
|
+
export type InferredLoggedInUser = NonNullable<
|
|
12
|
+
Awaited<ReturnType<typeof getCurrentUser>>
|
|
13
|
+
>
|
|
7
14
|
|
|
8
15
|
type UndefinedRoles = {
|
|
9
16
|
/**
|
|
@@ -21,10 +28,12 @@ type Overwrite<T, U> = Omit<T, keyof U> & U
|
|
|
21
28
|
|
|
22
29
|
declare module '@cedarjs/context' {
|
|
23
30
|
interface GlobalContext {
|
|
24
|
-
|
|
31
|
+
// Not set when nobody is logged in. Functions wrapped in useRequireAuth
|
|
32
|
+
// set it to whatever getCurrentUser() returned, including null
|
|
33
|
+
currentUser?: Overwrite<UndefinedRoles, InferredLoggedInUser> | null
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
declare module '@cedarjs/auth' {
|
|
29
|
-
interface
|
|
38
|
+
interface LoggedInUser extends InferredLoggedInUser {}
|
|
30
39
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { vi as _vi } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { InferredLoggedInUser } from './all-currentUser.js'
|
|
4
4
|
|
|
5
5
|
declare global {
|
|
6
6
|
// describe, it, expect etc. are typed by @types/jest. Referencing
|
|
7
7
|
// vitest/globals here would conflict with those declarations, so only vi
|
|
8
8
|
// is declared
|
|
9
9
|
const vi: typeof _vi
|
|
10
|
-
const mockCurrentUser: (currentUser:
|
|
10
|
+
const mockCurrentUser: (currentUser: InferredLoggedInUser | null) => void
|
|
11
11
|
}
|
|
@@ -5,14 +5,14 @@ import type {
|
|
|
5
5
|
mockGraphQLQuery as _mockGraphQLQuery,
|
|
6
6
|
} from '@cedarjs/testing/web'
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import type { InferredLoggedInUser } from './all-currentUser.js'
|
|
9
9
|
|
|
10
10
|
declare global {
|
|
11
11
|
// describe, it, expect etc. are typed by @types/jest. Referencing
|
|
12
12
|
// vitest/globals here would conflict with those declarations, so only vi
|
|
13
13
|
// is declared
|
|
14
14
|
const vi: typeof _vi
|
|
15
|
-
const mockCurrentUser: (currentUser:
|
|
15
|
+
const mockCurrentUser: (currentUser: InferredLoggedInUser | null) => void
|
|
16
16
|
const mockGraphQLQuery: typeof _mockGraphQLQuery
|
|
17
17
|
const mockGraphQLMutation: typeof _mockGraphQLMutation
|
|
18
18
|
}
|
|
@@ -304,8 +304,16 @@ const generateViteClientTypesDirective = () => {
|
|
|
304
304
|
};
|
|
305
305
|
function generateStubStorybookTypes() {
|
|
306
306
|
const stubStorybookTypesFileContent = `declare module '@storybook/react' {
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
// Loose stand-ins for when Storybook isn't installed. \`render\` is spelled
|
|
308
|
+
// out so that its parameters are typed in stories, which keeps them valid
|
|
309
|
+
// with \`noImplicitAny\`
|
|
310
|
+
interface StubStoryAnnotations {
|
|
311
|
+
[key: string]: any
|
|
312
|
+
render?: (args: any, context: any) => any
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export type Meta<T = any> = StubStoryAnnotations
|
|
316
|
+
export type StoryObj<T = any> = StubStoryAnnotations
|
|
309
317
|
}
|
|
310
318
|
`;
|
|
311
319
|
const cedarProjectPaths = getPaths();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3386",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -120,14 +120,14 @@
|
|
|
120
120
|
"@babel/core": "^7.26.10",
|
|
121
121
|
"@babel/parser": "7.29.9",
|
|
122
122
|
"@babel/traverse": "7.29.10",
|
|
123
|
-
"@cedarjs/api": "8.0.0-canary.
|
|
124
|
-
"@cedarjs/babel-config": "8.0.0-canary.
|
|
125
|
-
"@cedarjs/cli-helpers": "8.0.0-canary.
|
|
126
|
-
"@cedarjs/graphql-server": "8.0.0-canary.
|
|
127
|
-
"@cedarjs/project-config": "8.0.0-canary.
|
|
128
|
-
"@cedarjs/router": "8.0.0-canary.
|
|
129
|
-
"@cedarjs/structure": "8.0.0-canary.
|
|
130
|
-
"@cedarjs/utils": "8.0.0-canary.
|
|
123
|
+
"@cedarjs/api": "8.0.0-canary.3386",
|
|
124
|
+
"@cedarjs/babel-config": "8.0.0-canary.3386",
|
|
125
|
+
"@cedarjs/cli-helpers": "8.0.0-canary.3386",
|
|
126
|
+
"@cedarjs/graphql-server": "8.0.0-canary.3386",
|
|
127
|
+
"@cedarjs/project-config": "8.0.0-canary.3386",
|
|
128
|
+
"@cedarjs/router": "8.0.0-canary.3386",
|
|
129
|
+
"@cedarjs/structure": "8.0.0-canary.3386",
|
|
130
|
+
"@cedarjs/utils": "8.0.0-canary.3386",
|
|
131
131
|
"@graphql-codegen/add": "6.0.1",
|
|
132
132
|
"@graphql-codegen/cli": "6.3.1",
|
|
133
133
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"vite-tsconfig-paths": "^6.1.1"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
168
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3386",
|
|
169
169
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
170
170
|
"@oxc-project/types": "^0.153.0",
|
|
171
171
|
"concurrently": "9.2.4",
|